Search in sources :

Example 1 with ColumnSpec

use of com.jgoodies.forms.layout.ColumnSpec in project antlrworks by antlr.

the class DialogGenerate method initComponents.

private void initComponents() {
    // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
    // Generated using JFormDesigner Open Source Project license - ANTLR (www.antlr.org)
    dialogPane = new JPanel();
    contentPane = new JPanel();
    label1 = new JLabel();
    outputPathField = new JTextField();
    browseButton = new JButton();
    debugInfoButton = new JCheckBox();
    buttonBar = new JPanel();
    okButton = new JButton();
    cancelButton = new JButton();
    CellConstraints cc = new CellConstraints();
    //======== this ========
    setTitle("Generate");
    Container contentPane2 = getContentPane();
    contentPane2.setLayout(new BorderLayout());
    //======== dialogPane ========
    {
        dialogPane.setBorder(Borders.DIALOG_BORDER);
        dialogPane.setLayout(new BorderLayout());
        //======== contentPane ========
        {
            contentPane.setLayout(new FormLayout(new ColumnSpec[] { FormFactory.DEFAULT_COLSPEC, FormFactory.LABEL_COMPONENT_GAP_COLSPEC, new ColumnSpec("max(min;200dlu):grow"), FormFactory.LABEL_COMPONENT_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC }, new RowSpec[] { FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC }));
            //---- label1 ----
            label1.setText("Output path:");
            label1.setHorizontalAlignment(SwingConstants.RIGHT);
            contentPane.add(label1, cc.xy(1, 1));
            contentPane.add(outputPathField, cc.xy(3, 1));
            //---- browseButton ----
            browseButton.setText("Browse...");
            contentPane.add(browseButton, cc.xy(5, 1));
            //---- debugInfoButton ----
            debugInfoButton.setText("Debug information");
            contentPane.add(debugInfoButton, cc.xy(3, 3));
        }
        dialogPane.add(contentPane, BorderLayout.CENTER);
        //======== buttonBar ========
        {
            buttonBar.setBorder(Borders.BUTTON_BAR_GAP_BORDER);
            buttonBar.setLayout(new FormLayout(new ColumnSpec[] { FormFactory.GLUE_COLSPEC, FormFactory.BUTTON_COLSPEC, FormFactory.RELATED_GAP_COLSPEC, FormFactory.BUTTON_COLSPEC }, RowSpec.decodeSpecs("pref")));
            //---- okButton ----
            okButton.setText("OK");
            buttonBar.add(okButton, cc.xy(2, 1));
            //---- cancelButton ----
            cancelButton.setText("Cancel");
            buttonBar.add(cancelButton, cc.xy(4, 1));
        }
        dialogPane.add(buttonBar, BorderLayout.SOUTH);
    }
    contentPane2.add(dialogPane, BorderLayout.CENTER);
    pack();
// JFormDesigner - End of component initialization  //GEN-END:initComponents
}
Also used : FormLayout(com.jgoodies.forms.layout.FormLayout) ColumnSpec(com.jgoodies.forms.layout.ColumnSpec) RowSpec(com.jgoodies.forms.layout.RowSpec) CellConstraints(com.jgoodies.forms.layout.CellConstraints)

Example 2 with ColumnSpec

use of com.jgoodies.forms.layout.ColumnSpec in project intellij-community by JetBrains.

the class FormFirstComponentInsertLocation method processDrop.

@Override
public void processDrop(final GuiEditor editor, final RadComponent[] components, final GridConstraints[] constraintsToAdjust, final ComponentDragObject dragObject) {
    RadAbstractGridLayoutManager gridLayout = myContainer.getGridLayoutManager();
    if (myContainer.getGridRowCount() == 0) {
        gridLayout.insertGridCells(myContainer, 0, true, true, true);
    }
    if (myContainer.getGridColumnCount() == 0) {
        gridLayout.insertGridCells(myContainer, 0, false, true, true);
    }
    dropIntoGrid(myContainer, components, myRow, myColumn, dragObject);
    FormLayout formLayout = (FormLayout) myContainer.getDelegee().getLayout();
    if (myXPart == 0) {
        formLayout.setColumnSpec(1, new ColumnSpec("d"));
    } else if (myXPart == 2) {
        gridLayout.insertGridCells(myContainer, 0, false, true, true);
    }
    if (myYPart == 0) {
        formLayout.setRowSpec(1, new RowSpec("d"));
    } else if (myYPart == 2) {
        gridLayout.insertGridCells(myContainer, 0, true, true, true);
    }
}
Also used : FormLayout(com.jgoodies.forms.layout.FormLayout) RadAbstractGridLayoutManager(com.intellij.uiDesigner.radComponents.RadAbstractGridLayoutManager) ColumnSpec(com.jgoodies.forms.layout.ColumnSpec) RowSpec(com.jgoodies.forms.layout.RowSpec)

Example 3 with ColumnSpec

use of com.jgoodies.forms.layout.ColumnSpec in project intellij-community by JetBrains.

the class RadFormLayoutManagerTest method testMoveColumnLeft.

public void testMoveColumnLeft() {
    myManager.insertGridCells(myContainer, 0, false, false, true);
    final ConstantSize colSize = new ConstantSize(17, ConstantSize.MM);
    myLayout.setColumnSpec(3, new ColumnSpec(colSize));
    RadComponent c = newComponent(0, 2, 1, 1);
    myContainer.addComponent(c);
    myManager.processCellsMoved(myContainer, false, new int[] { 2 }, 0);
    assertEquals(colSize, myLayout.getColumnSpec(1).getSize());
    assertEquals(1, myLayout.getConstraints(c.getDelegee()).gridX);
}
Also used : ColumnSpec(com.jgoodies.forms.layout.ColumnSpec) ConstantSize(com.jgoodies.forms.layout.ConstantSize)

Example 4 with ColumnSpec

use of com.jgoodies.forms.layout.ColumnSpec in project intellij-community by JetBrains.

the class FormLayoutSerializer method readLayout.

void readLayout(Element element, LwContainer container) {
    FormLayout layout = new FormLayout();
    final List rowSpecs = element.getChildren(UIFormXmlConstants.ELEMENT_ROWSPEC, element.getNamespace());
    for (Iterator iterator = rowSpecs.iterator(); iterator.hasNext(); ) {
        Element rowSpecElement = (Element) iterator.next();
        final String spec = LwXmlReader.getRequiredString(rowSpecElement, UIFormXmlConstants.ATTRIBUTE_VALUE);
        layout.appendRow(new RowSpec(spec));
    }
    final List colSpecs = element.getChildren(UIFormXmlConstants.ELEMENT_COLSPEC, element.getNamespace());
    for (Iterator iterator = colSpecs.iterator(); iterator.hasNext(); ) {
        Element colSpecElement = (Element) iterator.next();
        final String spec = LwXmlReader.getRequiredString(colSpecElement, UIFormXmlConstants.ATTRIBUTE_VALUE);
        layout.appendColumn(new ColumnSpec(spec));
    }
    int[][] rowGroups = readGroups(element, UIFormXmlConstants.ELEMENT_ROWGROUP);
    int[][] colGroups = readGroups(element, UIFormXmlConstants.ELEMENT_COLGROUP);
    if (rowGroups != null) {
        layout.setRowGroups(rowGroups);
    }
    if (colGroups != null) {
        layout.setColumnGroups(colGroups);
    }
    container.setLayout(layout);
}
Also used : FormLayout(com.jgoodies.forms.layout.FormLayout) ColumnSpec(com.jgoodies.forms.layout.ColumnSpec) Element(org.jdom.Element) Iterator(java.util.Iterator) RowSpec(com.jgoodies.forms.layout.RowSpec) List(java.util.List)

Example 5 with ColumnSpec

use of com.jgoodies.forms.layout.ColumnSpec in project intellij-community by JetBrains.

the class RadFormLayoutManagerTest method testMoveMultipleColumnsRight.

public void testMoveMultipleColumnsRight() {
    myManager.insertGridCells(myContainer, 0, false, false, true);
    myManager.insertGridCells(myContainer, 0, false, false, true);
    final ConstantSize colSize1 = new ConstantSize(17, ConstantSize.MM);
    final ConstantSize colSize2 = new ConstantSize(19, ConstantSize.MM);
    myLayout.setColumnSpec(1, new ColumnSpec(colSize1));
    myLayout.setColumnSpec(3, new ColumnSpec(colSize2));
    RadComponent c1 = newComponent(0, 0, 1, 1);
    myContainer.addComponent(c1);
    RadComponent c2 = newComponent(0, 2, 1, 1);
    myContainer.addComponent(c2);
    myManager.processCellsMoved(myContainer, false, new int[] { 0, 2 }, 5);
    assertEquals(colSize1, myLayout.getColumnSpec(3).getSize());
    assertEquals(colSize2, myLayout.getColumnSpec(5).getSize());
    assertEquals(3, myLayout.getConstraints(c1.getDelegee()).gridX);
    assertEquals(5, myLayout.getConstraints(c2.getDelegee()).gridX);
}
Also used : ColumnSpec(com.jgoodies.forms.layout.ColumnSpec) ConstantSize(com.jgoodies.forms.layout.ConstantSize)

Aggregations

ColumnSpec (com.jgoodies.forms.layout.ColumnSpec)8 ConstantSize (com.jgoodies.forms.layout.ConstantSize)4 FormLayout (com.jgoodies.forms.layout.FormLayout)4 RowSpec (com.jgoodies.forms.layout.RowSpec)4 RadAbstractGridLayoutManager (com.intellij.uiDesigner.radComponents.RadAbstractGridLayoutManager)1 ButtonBarBuilder (com.jgoodies.forms.builder.ButtonBarBuilder)1 DefaultFormBuilder (com.jgoodies.forms.builder.DefaultFormBuilder)1 CellConstraints (com.jgoodies.forms.layout.CellConstraints)1 Dimension (java.awt.Dimension)1 Iterator (java.util.Iterator)1 List (java.util.List)1 JButton (javax.swing.JButton)1 JLabel (javax.swing.JLabel)1 JPanel (javax.swing.JPanel)1 JScrollPane (javax.swing.JScrollPane)1 JSpinner (javax.swing.JSpinner)1 JTable (javax.swing.JTable)1 SpinnerNumberModel (javax.swing.SpinnerNumberModel)1 TitledBorder (javax.swing.border.TitledBorder)1 FormattedJTable (jgnash.ui.components.FormattedJTable)1