Search in sources :

Example 1 with AbstractLayout

use of com.intellij.uiDesigner.core.AbstractLayout in project intellij-community by JetBrains.

the class HGapProperty method setValueImpl.

protected void setValueImpl(final RadContainer component, final Integer value) throws Exception {
    if (component.getLayout() instanceof BorderLayout) {
        BorderLayout layout = (BorderLayout) component.getLayout();
        layout.setHgap(value.intValue());
    } else if (component.getLayout() instanceof FlowLayout) {
        FlowLayout layout = (FlowLayout) component.getLayout();
        layout.setHgap(value.intValue());
    } else if (component.getLayout() instanceof CardLayout) {
        CardLayout layout = (CardLayout) component.getLayout();
        layout.setHgap(value.intValue());
    } else {
        final AbstractLayout layoutManager = (AbstractLayout) component.getLayout();
        layoutManager.setHGap(value.intValue());
    }
}
Also used : AbstractLayout(com.intellij.uiDesigner.core.AbstractLayout)

Example 2 with AbstractLayout

use of com.intellij.uiDesigner.core.AbstractLayout in project intellij-community by JetBrains.

the class RadContainer method setLayout.

public final void setLayout(final LayoutManager layout) {
    // some components (for example, JXCollapsiblePanel from SwingX) have asymmetrical getLayout/setLayout - a different
    // layout is returned compared to what was passed to setLayout(). to avoid crashes, we store the layout we passed to
    // the component.
    myDelegeeLayout = layout;
    getDelegee().setLayout(layout);
    if (layout instanceof AbstractLayout) {
        AbstractLayout aLayout = (AbstractLayout) layout;
        for (int i = 0; i < getComponentCount(); i++) {
            final RadComponent c = getComponent(i);
            aLayout.addLayoutComponent(c.getDelegee(), c.getConstraints());
        }
    }
}
Also used : AbstractLayout(com.intellij.uiDesigner.core.AbstractLayout)

Example 3 with AbstractLayout

use of com.intellij.uiDesigner.core.AbstractLayout in project intellij-community by JetBrains.

the class AbstractGridLayoutProperty method setValueImpl.

protected void setValueImpl(final RadContainer component, final Boolean value) throws Exception {
    final AbstractLayout layoutManager = (AbstractLayout) component.getLayout();
    if (!(layoutManager instanceof GridLayoutManager)) {
        throw new IllegalArgumentException("grid layout expected: " + layoutManager);
    }
    final GridLayoutManager gridLayoutManager = (GridLayoutManager) layoutManager;
    setGridLayoutPropertyValue(gridLayoutManager, value.booleanValue());
}
Also used : GridLayoutManager(com.intellij.uiDesigner.core.GridLayoutManager) AbstractLayout(com.intellij.uiDesigner.core.AbstractLayout)

Example 4 with AbstractLayout

use of com.intellij.uiDesigner.core.AbstractLayout in project intellij-community by JetBrains.

the class MarginProperty method setValueImpl.

protected void setValueImpl(final RadContainer component, @NotNull final Insets value) throws Exception {
    final AbstractLayout layoutManager = (AbstractLayout) component.getLayout();
    layoutManager.setMargin(value);
}
Also used : AbstractLayout(com.intellij.uiDesigner.core.AbstractLayout)

Example 5 with AbstractLayout

use of com.intellij.uiDesigner.core.AbstractLayout in project intellij-community by JetBrains.

the class RadXYLayoutManager method writeLayout.

public void writeLayout(final XmlWriter writer, final RadContainer radContainer) {
    final AbstractLayout layout = (AbstractLayout) radContainer.getLayout();
    // It has sense to save hpap and vgap even for XY layout. The reason is
    // that XY was previously GRID with non default gaps, so when the user
    // compose XY into the grid again then he will get the same non default gaps.
    writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_HGAP, layout.getHGap());
    writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_VGAP, layout.getVGap());
    // Margins
    final Insets margin = layout.getMargin();
    writer.startElement("margin");
    try {
        writer.writeInsets(margin);
    } finally {
        // margin
        writer.endElement();
    }
}
Also used : Insets(java.awt.Insets) AbstractLayout(com.intellij.uiDesigner.core.AbstractLayout)

Aggregations

AbstractLayout (com.intellij.uiDesigner.core.AbstractLayout)9 GridLayoutManager (com.intellij.uiDesigner.core.GridLayoutManager)2 JBLabel (com.intellij.ui.components.JBLabel)1 GridConstraints (com.intellij.uiDesigner.core.GridConstraints)1 BorderLayout (java.awt.BorderLayout)1 CardLayout (java.awt.CardLayout)1 FlowLayout (java.awt.FlowLayout)1 Insets (java.awt.Insets)1 Border (javax.swing.border.Border)1 EmptyBorder (javax.swing.border.EmptyBorder)1 TitledBorder (javax.swing.border.TitledBorder)1