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);
}
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);
}
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));
}
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;
}
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]);
}
}
Aggregations