use of com.jgoodies.forms.layout.CellConstraints in project intellij-community by JetBrains.
the class RadFormLayoutManagerTest method newComponent.
private RadComponent newComponent(final int row, final int column, final int rowSpan, final int colSpan) {
RadComponent c = new RadAtomicComponent(null, JLabel.class, "1");
c.setCustomLayoutConstraints(new CellConstraints(1, 1, CellConstraints.DEFAULT, CellConstraints.DEFAULT));
c.getConstraints().restore(new GridConstraints(row, column, rowSpan, colSpan, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null));
return c;
}
use of com.jgoodies.forms.layout.CellConstraints in project intellij-community by JetBrains.
the class FormLayoutCodeGenerator method addNewCellConstraints.
private static void addNewCellConstraints(final GeneratorAdapter generator, final LwComponent lwComponent) {
final GridConstraints constraints = lwComponent.getConstraints();
final CellConstraints cc = (CellConstraints) lwComponent.getCustomLayoutConstraints();
generator.newInstance(ourCellConstraintsType);
generator.dup();
generator.push(constraints.getColumn() + 1);
generator.push(constraints.getRow() + 1);
generator.push(constraints.getColSpan());
generator.push(constraints.getRowSpan());
if (cc.hAlign == CellConstraints.DEFAULT) {
generator.getStatic(ourCellConstraintsType, "DEFAULT", ourCellAlignmentType);
} else {
int hAlign = Utils.alignFromConstraints(constraints, true);
generator.getStatic(ourCellConstraintsType, HORZ_ALIGN_FIELDS[hAlign], ourCellAlignmentType);
}
if (cc.vAlign == CellConstraints.DEFAULT) {
generator.getStatic(ourCellConstraintsType, "DEFAULT", ourCellAlignmentType);
} else {
int vAlign = Utils.alignFromConstraints(constraints, false);
generator.getStatic(ourCellConstraintsType, VERT_ALIGN_FIELDS[vAlign], ourCellAlignmentType);
}
AsmCodeGenerator.pushPropValue(generator, Insets.class.getName(), cc.insets);
generator.invokeConstructor(ourCellConstraintsType, ourCellConstraintsConstructor);
}
use of com.jgoodies.forms.layout.CellConstraints in project intellij-community by JetBrains.
the class FormLayoutSerializer method readChildConstraints.
void readChildConstraints(final Element constraintsElement, final LwComponent component) {
super.readChildConstraints(constraintsElement, component);
CellConstraints cc = new CellConstraints();
final Element formsElement = LwXmlReader.getChild(constraintsElement, UIFormXmlConstants.ELEMENT_FORMS);
if (formsElement != null) {
if (formsElement.getAttributeValue(UIFormXmlConstants.ATTRIBUTE_TOP) != null) {
cc.insets = LwXmlReader.readInsets(formsElement);
}
if (!LwXmlReader.getOptionalBoolean(formsElement, UIFormXmlConstants.ATTRIBUTE_DEFAULTALIGN_HORZ, true)) {
cc.hAlign = ourHorizontalAlignments[Utils.alignFromConstraints(component.getConstraints(), true)];
}
if (!LwXmlReader.getOptionalBoolean(formsElement, UIFormXmlConstants.ATTRIBUTE_DEFAULTALIGN_VERT, true)) {
cc.vAlign = ourVerticalAlignments[Utils.alignFromConstraints(component.getConstraints(), false)];
}
}
component.setCustomLayoutConstraints(cc);
}
use of com.jgoodies.forms.layout.CellConstraints in project beast-mcmc by beast-dev.
the class JreForm method createPanel2.
public JPanel createPanel2() {
JPanel jpanel1 = new JPanel();
FormLayout formlayout1 = new FormLayout("FILL:DEFAULT:GROW(1.0),FILL:3DLU:NONE,FILL:DEFAULT:NONE,FILL:3DLU:NONE,FILL:DEFAULT:NONE", "CENTER:DEFAULT:NONE");
CellConstraints cc = new CellConstraints();
jpanel1.setLayout(formlayout1);
_jrePathField.setName("jrePathField");
_jrePathField.setToolTipText(Messages.getString("jrePathTip"));
jpanel1.add(_jrePathField, cc.xy(1, 1));
_bundledJre64BitCheck.setActionCommand(Messages.getString("bundledJre64Bit"));
_bundledJre64BitCheck.setName("bundledJre64BitCheck");
_bundledJre64BitCheck.setText(Messages.getString("bundledJre64Bit"));
_bundledJre64BitCheck.setToolTipText(Messages.getString("bundledJre64BitTip"));
jpanel1.add(_bundledJre64BitCheck, cc.xy(3, 1));
_bundledJreAsFallbackCheck.setActionCommand(Messages.getString("bundledJreAsFallback"));
_bundledJreAsFallbackCheck.setName("bundledJreAsFallbackCheck");
_bundledJreAsFallbackCheck.setText(Messages.getString("bundledJreAsFallback"));
_bundledJreAsFallbackCheck.setToolTipText(Messages.getString("bundledJreAsFallbackTip"));
jpanel1.add(_bundledJreAsFallbackCheck, cc.xy(5, 1));
addFillComponents(jpanel1, new int[] { 2, 4 }, new int[0]);
return jpanel1;
}
use of com.jgoodies.forms.layout.CellConstraints in project beast-mcmc by beast-dev.
the class MessagesForm method addFillComponents.
/**
* Adds fill components to empty cells in the first row and first column of the grid.
* This ensures that the grid spacing will be the same as shown in the designer.
* @param cols an array of column indices in the first row where fill components should be added.
* @param rows an array of row indices in the first column where fill components should be added.
*/
void addFillComponents(Container panel, int[] cols, int[] rows) {
Dimension filler = new Dimension(10, 10);
boolean filled_cell_11 = false;
CellConstraints cc = new CellConstraints();
if (cols.length > 0 && rows.length > 0) {
if (cols[0] == 1 && rows[0] == 1) {
/** add a rigid area */
panel.add(Box.createRigidArea(filler), cc.xy(1, 1));
filled_cell_11 = true;
}
}
for (int index = 0; index < cols.length; index++) {
if (cols[index] == 1 && filled_cell_11) {
continue;
}
panel.add(Box.createRigidArea(filler), cc.xy(cols[index], 1));
}
for (int index = 0; index < rows.length; index++) {
if (rows[index] == 1 && filled_cell_11) {
continue;
}
panel.add(Box.createRigidArea(filler), cc.xy(1, rows[index]));
}
}
Aggregations