Search in sources :

Example 26 with CellConstraints

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;
}
Also used : GridConstraints(com.intellij.uiDesigner.core.GridConstraints) CellConstraints(com.jgoodies.forms.layout.CellConstraints)

Example 27 with CellConstraints

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);
}
Also used : GridConstraints(com.intellij.uiDesigner.core.GridConstraints) CellConstraints(com.jgoodies.forms.layout.CellConstraints)

Example 28 with CellConstraints

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);
}
Also used : Element(org.jdom.Element) CellConstraints(com.jgoodies.forms.layout.CellConstraints)

Example 29 with CellConstraints

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;
}
Also used : FormLayout(com.jgoodies.forms.layout.FormLayout) JPanel(javax.swing.JPanel) CellConstraints(com.jgoodies.forms.layout.CellConstraints)

Example 30 with CellConstraints

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]));
    }
}
Also used : Dimension(java.awt.Dimension) CellConstraints(com.jgoodies.forms.layout.CellConstraints)

Aggregations

CellConstraints (com.jgoodies.forms.layout.CellConstraints)126 FormLayout (com.jgoodies.forms.layout.FormLayout)81 JPanel (javax.swing.JPanel)60 Dimension (java.awt.Dimension)41 JLabel (javax.swing.JLabel)29 JScrollPane (javax.swing.JScrollPane)26 TitledSeparator (com.jeta.forms.components.separator.TitledSeparator)6 DatePanel (jgnash.ui.components.DatePanel)5 JRadioButton (javax.swing.JRadioButton)4 JSpinner (javax.swing.JSpinner)4 SpinnerNumberModel (javax.swing.SpinnerNumberModel)4 GridConstraints (com.intellij.uiDesigner.core.GridConstraints)3 DefaultFormBuilder (com.jgoodies.forms.builder.DefaultFormBuilder)3 FileChooserDescriptor (com.intellij.openapi.fileChooser.FileChooserDescriptor)2 TextFieldWithBrowseButton (com.intellij.openapi.ui.TextFieldWithBrowseButton)2 PanelBuilder (com.jgoodies.forms.builder.PanelBuilder)2 ResourceBundle (java.util.ResourceBundle)2 JButton (javax.swing.JButton)2 JCheckBox (javax.swing.JCheckBox)2 UserActivityListener (com.intellij.ui.UserActivityListener)1