Search in sources :

Example 11 with GridLayoutManager

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

the class RadGridLayoutManager method writeLayout.

public void writeLayout(final XmlWriter writer, final RadContainer radContainer) {
    GridLayoutManager layout = (GridLayoutManager) radContainer.getLayout();
    writer.addAttribute("row-count", layout.getRowCount());
    writer.addAttribute("column-count", layout.getColumnCount());
    writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_SAME_SIZE_HORIZONTALLY, layout.isSameSizeHorizontally());
    writer.addAttribute(UIFormXmlConstants.ATTRIBUTE_SAME_SIZE_VERTICALLY, layout.isSameSizeVertically());
    RadXYLayoutManager.INSTANCE.writeLayout(writer, radContainer);
}
Also used : GridLayoutManager(com.intellij.uiDesigner.core.GridLayoutManager)

Example 12 with GridLayoutManager

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

the class RadGridLayoutManager method updateConstraints.

@Override
protected void updateConstraints(RadComponent component) {
    GridLayoutManager layout = (GridLayoutManager) component.getParent().getLayout();
    final GridConstraints radConstraints = component.getConstraints();
    final GridConstraints delegeeConstraints = layout.getConstraintsForComponent(component.getDelegee());
    if (radConstraints != delegeeConstraints) {
        delegeeConstraints.restore(radConstraints);
    }
    super.updateConstraints(component);
}
Also used : GridLayoutManager(com.intellij.uiDesigner.core.GridLayoutManager) GridConstraints(com.intellij.uiDesigner.core.GridConstraints)

Example 13 with GridLayoutManager

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

the class RadSwingGridLayoutManager method createSnapshotLayout.

@Override
public void createSnapshotLayout(final SnapshotContext context, final JComponent parent, final RadContainer container, final LayoutManager layout) {
    GridLayout gridLayout = (GridLayout) layout;
    int ncomponents = parent.getComponentCount();
    int nrows = gridLayout.getRows();
    int ncols = gridLayout.getColumns();
    if (nrows > 0) {
        ncols = (ncomponents + nrows - 1) / nrows;
    } else {
        nrows = (ncomponents + ncols - 1) / ncols;
    }
    container.setLayout(new GridLayoutManager(nrows, ncols, new Insets(0, 0, 0, 0), gridLayout.getHgap(), gridLayout.getVgap(), true, true));
}
Also used : GridLayout(java.awt.GridLayout) Insets(java.awt.Insets) GridLayoutManager(com.intellij.uiDesigner.core.GridLayoutManager)

Example 14 with GridLayoutManager

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

the class EmmetCompositeConfigurable method createComponent.

@Nullable
@Override
public JComponent createComponent() {
    final JPanel rootPanel = new JPanel(new GridLayoutManager(myInnerConfigurables.length + 1, 1, new Insets(0, 0, 0, 0), -1, -1, false, false));
    rootPanel.add(myTemplateExpandShortcutPanel, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_NORTH, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_GROW | GridConstraints.SIZEPOLICY_CAN_SHRINK, GridConstraints.SIZEPOLICY_FIXED, null, null, null));
    for (int i = 0; i < myInnerConfigurables.length; i++) {
        UnnamedConfigurable configurable = myInnerConfigurables[i];
        final JComponent component = configurable.createComponent();
        assert component != null;
        int vSizePolicy = GridConstraints.SIZEPOLICY_CAN_GROW | GridConstraints.SIZEPOLICY_CAN_SHRINK;
        if (i + 1 == myInnerConfigurables.length) {
            vSizePolicy |= GridConstraints.SIZEPOLICY_WANT_GROW;
        }
        rootPanel.add(component, new GridConstraints(i + 1, 0, 1, 1, GridConstraints.ANCHOR_NORTHWEST, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_GROW | GridConstraints.SIZEPOLICY_WANT_GROW | GridConstraints.SIZEPOLICY_CAN_SHRINK, vSizePolicy, null, null, null));
    }
    rootPanel.revalidate();
    return rootPanel;
}
Also used : GridLayoutManager(com.intellij.uiDesigner.core.GridLayoutManager) GridConstraints(com.intellij.uiDesigner.core.GridConstraints) UnnamedConfigurable(com.intellij.openapi.options.UnnamedConfigurable) Nullable(org.jetbrains.annotations.Nullable)

Example 15 with GridLayoutManager

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

the class GridBagConverter method prepareConstraints.

public static void prepareConstraints(final LwContainer container, final Map idToConstraintsMap) {
    GridLayoutManager gridLayout = (GridLayoutManager) container.getLayout();
    GridBagConverter converter = new GridBagConverter(gridLayout.getMargin(), getGap(container, true), getGap(container, false), gridLayout.isSameSizeHorizontally(), gridLayout.isSameSizeVertically());
    for (int i = 0; i < container.getComponentCount(); i++) {
        final LwComponent component = (LwComponent) container.getComponent(i);
        if (component instanceof LwHSpacer || component instanceof LwVSpacer) {
            GridConstraints constraints = component.getConstraints().store();
            constraints.setHSizePolicy(constraints.getHSizePolicy() & ~GridConstraints.SIZEPOLICY_WANT_GROW);
            constraints.setVSizePolicy(constraints.getVSizePolicy() & ~GridConstraints.SIZEPOLICY_WANT_GROW);
            converter.addComponent(null, constraints);
        } else {
            converter.addComponent(null, component.getConstraints());
        }
    }
    Result[] results = converter.convert();
    int componentIndex = 0;
    for (int i = 0; i < results.length; i++) {
        if (!results[i].isFillerPanel) {
            final LwComponent component = (LwComponent) container.getComponent(componentIndex++);
            idToConstraintsMap.put(component.getId(), results[i]);
        }
    // else generateFillerPanel(generator, componentLocal, results [i]);
    }
}
Also used : GridLayoutManager(com.intellij.uiDesigner.core.GridLayoutManager) GridConstraints(com.intellij.uiDesigner.core.GridConstraints)

Aggregations

GridLayoutManager (com.intellij.uiDesigner.core.GridLayoutManager)40 GridConstraints (com.intellij.uiDesigner.core.GridConstraints)17 Spacer (com.intellij.uiDesigner.core.Spacer)5 Module (com.intellij.openapi.module.Module)2 JBTextField (com.intellij.ui.components.JBTextField)2 DraggedComponentList (com.intellij.uiDesigner.designSurface.DraggedComponentList)2 GridInsertLocation (com.intellij.uiDesigner.designSurface.GridInsertLocation)2 ComponentItem (com.intellij.uiDesigner.palette.ComponentItem)2 RadContainer (com.intellij.uiDesigner.radComponents.RadContainer)2 XYLayoutManager (com.intellij.uiDesigner.shared.XYLayoutManager)2 Insets (java.awt.Insets)2 NotNull (org.jetbrains.annotations.NotNull)2 Nullable (org.jetbrains.annotations.Nullable)2 AndroidTargetHash.getAddonHashString (com.android.sdklib.AndroidTargetHash.getAddonHashString)1 BuildFileKey (com.android.tools.idea.gradle.parser.BuildFileKey)1 TemplateManager (com.android.tools.idea.templates.TemplateManager)1 TemplateMetadata (com.android.tools.idea.templates.TemplateMetadata)1 ImageComponent (com.android.tools.idea.ui.ImageComponent)1 NlComponent (com.android.tools.idea.uibuilder.model.NlComponent)1 LineMarginBorder (com.intellij.designer.designSurface.feedbacks.LineMarginBorder)1