Java Code Examples for net.miginfocom.layout.LC#debug()

The following examples show how to use net.miginfocom.layout.LC#debug() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DesktopFilter.java    From cuba with Apache License 2.0 6 votes vote down vote up
public DesktopFilter() {
    delegate = AppBeans.get(FilterDelegate.class);
    delegate.setFilter(this);
    LC topLc = new LC();
    topLc.hideMode(3);
    topLc.insetsAll("0");
    if (LayoutAdapter.isDebug()) {
        topLc.debug(1000);
    }
    MigLayout topLayout = new MigLayout(topLc);
    impl = new JPanel(topLayout);

    ComponentContainer layout = delegate.getLayout();
    JComponent unwrap = DesktopComponentsHelper.getComposition(layout);
    impl.add(unwrap, "width 100%");

    setWidth("100%");

    delegate.setExpandedStateChangeListener(e -> fireExpandStateChange(e.isExpanded()));
    delegate.setCaptionChangedListener(this::updateCaption);
}
 
Example 2
Source File: DesktopFieldGroup.java    From cuba with Apache License 2.0 6 votes vote down vote up
public DesktopFieldGroup() {
    LC lc = new LC();
    lc.hideMode(3); // Invisible components will not participate in the layout at all and it will for instance not take up a grid cell.
    lc.insets("0 0 0 0");
    if (LayoutAdapter.isDebug()) {
        lc.debug(1000);
    }

    layout = new MigLayout(lc);
    impl = new JPanel(layout);
    assignClassDebugProperty(impl);
    collapsiblePanel = new CollapsiblePanel(super.getComposition());
    assignClassDebugProperty(collapsiblePanel);
    collapsiblePanel.setBorderVisible(false);

    setWidth(Component.AUTO_SIZE);

    fieldFactory = AppBeans.get(FieldGroupFieldFactory.NAME);
}
 
Example 3
Source File: MigGridLayoutAdapter.java    From cuba with Apache License 2.0 5 votes vote down vote up
@Override
protected void update() {
    LC lc = new LC();
    lc.setWrapAfter(getColumns());
    lc.hideMode(2); // The size of an invisible component will be set to 0, 0 and the gaps will also be set to 0 around it.
    lc.fill();

    lc.setInsets(MigLayoutHelper.makeInsets(margins));

    if (!spacing) {
        lc.gridGap("0", "0");
    }

    if (isDebug())
        lc.debug(1000);

    layout.setLayoutConstraints(lc);

    AC rowConstr = new AC();
    rowConstr.align("top");  // left-top align by default
    layout.setRowConstraints(rowConstr);

    AC colConstr = new AC();
    for (int i = 0; i < colCount; i++) {
        float ratio = columnRatio[i];
        colConstr.grow(ratio, i);
        colConstr.shrink(ratio != 0 ? (float) Math.sqrt(1.0f / ratio) : 100.0f, i);
    }
    layout.setColumnConstraints(colConstr);
}
 
Example 4
Source File: MigBoxLayoutAdapter.java    From cuba with Apache License 2.0 5 votes vote down vote up
private void updateLayoutConstraints(boolean resetExpanded) {
    LC lc = new LC();
    lc.hideMode(2); //  Invisible components will not participate in the layout at all and it will for instance not take up a grid cell
    lc.fill(); // always give all space to components, otherwise align doesn't work
    AC rowConstr = new AC();
    AC colConstr = new AC();

    if (direction.equals(FlowDirection.X)) {
        rowConstr.align("top");
        lc.flowX();
        if (expandedComponent != null || resetExpanded) {
            adjustExpanding(lc, colConstr);
        }
    } else {
        lc.flowY();
        if (expandedComponent != null || resetExpanded) {
            adjustExpanding(lc, rowConstr);
        }
    }

    lc.setInsets(MigLayoutHelper.makeInsets(margins));

    if (!spacing) {
        if (direction.equals(FlowDirection.X)) {
            lc.gridGapX("0");
        } else {
            lc.gridGapY("0");
        }
    }

    if (isDebug())
        lc.debug(1000);

    layout.setLayoutConstraints(lc);
    layout.setRowConstraints(rowConstr);
    layout.setColumnConstraints(colConstr);
}
 
Example 5
Source File: DesktopRowsCount.java    From cuba with Apache License 2.0 5 votes vote down vote up
public RowsCountComponent() {
    LC lc = new LC();
    lc.hideMode(2);
    lc.insetsAll("2");

    layout = new MigLayout(lc);
    if (LayoutAdapter.isDebug()) {
        lc.debug(1000);
    }
    setLayout(layout);

    firstButton = new JButton("<<");
    add(firstButton);
    firstButton.setPreferredSize(size);
    firstButton.setMinimumSize(size);

    prevButton = new JButton("<");
    add(prevButton);
    prevButton.setPreferredSize(size);
    prevButton.setMinimumSize(size);

    label = new JLabel();
    label.setMinimumSize(size);
    add(label);

    countButton = new JXHyperlink();
    countButton.setText("[?]");
    add(countButton);

    nextButton = new JButton(">");
    add(nextButton);
    nextButton.setPreferredSize(size);
    nextButton.setMinimumSize(size);

    lastButton = new JButton(">>");
    add(lastButton);
    lastButton.setPreferredSize(size);
    lastButton.setMinimumSize(size);
}
 
Example 6
Source File: VclTestApp.java    From cuba with Apache License 2.0 5 votes vote down vote up
private Component createAlignTab() {
    JPanel box = new JPanel();
    box.setFocusable(false);
    MigLayout boxLayout = new MigLayout("debug 1000, fill");
    box.setLayout(boxLayout);

    JPanel panel = new JPanel();
    MigLayout layout = new MigLayout("debug 1000, fill");
    panel.setLayout(layout);

    JLabel label = new JLabel("Label");
    CC cc = new CC();
    cc.alignX("right").alignY("50%");

    panel.add(label);

    layout.setComponentConstraints(label, cc);

    LC lc = new LC();
    lc.hideMode(2); // The size of an invisible component will be set to 0, 0 and the gaps will also be set to 0 around it.
    lc.debug(1000);

    AC rowConstr = new AC();
    AC colConstr = new AC();

    lc.fillX();
    lc.flowY();
    lc.gridGapY("0");

    layout.setLayoutConstraints(lc);
    layout.setRowConstraints(rowConstr);
    layout.setColumnConstraints(colConstr);

    box.add(panel, "height 100px, width 100px");
    layout.setComponentConstraints(label, cc);
    return box;
}