Search in sources :

Example 1 with RowSpec

use of com.jgoodies.forms.layout.RowSpec 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 2 with RowSpec

use of com.jgoodies.forms.layout.RowSpec in project freeplane by freeplane.

the class KeyProperty method layout.

public void layout(final DefaultFormBuilder builder) {
    mButton.addActionListener(new ActionListener() {

        public void actionPerformed(final ActionEvent arg0) {
            final GrabKeyDialog keyDialog = new GrabKeyDialog(getValue(), modifierMask);
            keyDialog.setVisible(true);
            if (keyDialog.isOK()) {
                setValue(keyDialog.getShortcut());
                firePropertyChangeEvent();
            }
        }
    });
    if (labelText == null) {
        labelText = TextUtils.getOptionalText(getLabel());
    }
    final JLabel label = new JLabel(labelText, icon, JLabel.RIGHT);
    String tooltip = TextUtils.getOptionalText(getTooltip());
    label.setToolTipText(tooltip);
    if (KeyProperty.rowSpec == null) {
        KeyProperty.rowSpec = new RowSpec(RowSpec.FILL, Sizes.dluX(20), 0.0);
    }
    if (3 < builder.getColumn()) {
        builder.appendRelatedComponentsGapRow();
        builder.appendRow(KeyProperty.rowSpec);
        builder.nextLine(2);
    } else {
        builder.nextColumn(2);
    }
    builder.add(label);
    builder.nextColumn(2);
    builder.add(mButton);
    mButton.setToolTipText(tooltip);
}
Also used : ActionListener(java.awt.event.ActionListener) ActionEvent(java.awt.event.ActionEvent) RowSpec(com.jgoodies.forms.layout.RowSpec) JLabel(javax.swing.JLabel)

Example 3 with RowSpec

use of com.jgoodies.forms.layout.RowSpec 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 4 with RowSpec

use of com.jgoodies.forms.layout.RowSpec 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 RowSpec

use of com.jgoodies.forms.layout.RowSpec in project jgnash by ccavanaugh.

the class BudgetGoalDialog method layoutMainPanel.

private void layoutMainPanel() {
    FormLayout contentLayout = new FormLayout("fill:p:g, $lcgap, fill:p", "f:p:g, $ugap, f:p");
    JPanel contentPanel = new JPanel(contentLayout);
    DefaultFormBuilder contentBuilder = new DefaultFormBuilder(contentLayout, contentPanel);
    contentBuilder.border(Borders.DIALOG);
    FormLayout layout = new FormLayout("right:d, $lcgap, fill:p:g", "f:p, $rgap, d, $ugap, f:p:g");
    DefaultFormBuilder builder = new DefaultFormBuilder(layout);
    cancelButton = new JButton(rb.getString("Button.Cancel"));
    okButton = new JButton(rb.getString("Button.Ok"));
    historicalButton = new JButton(rb.getString("Button.HistoricalFill"));
    fillAmountField = new JFloatField(account.getCurrencyNode());
    fillAmountField.setDecimal(BigDecimal.ZERO);
    fillPatternAmountField = new JFloatField(account.getCurrencyNode());
    fillPatternAmountField.setDecimal(BigDecimal.ZERO);
    fillButton = new JButton(rb.getString("Button.Enter"));
    fillPatternEnterButton = new JButton(rb.getString("Button.Enter"));
    budgetPeriodCombo = new JComboBox<>();
    budgetPeriodCombo.setModel(new DefaultComboBoxModel<>(Period.values()));
    budgetPeriodCombo.setSelectedItem(getBudgetGoal().getBudgetPeriod());
    patternComboBox = new JComboBox<>();
    patternComboBox.setModel(new DefaultComboBoxModel<>(Pattern.values()));
    int max = getDescriptors().size();
    startRowSpinner = new JSpinner(new SpinnerNumberModel(1, 1, max, 1));
    endRowSpinner = new JSpinner(new SpinnerNumberModel(max, 1, max, 1));
    builder.append(new JLabel(rb.getString("Label.Period")), budgetPeriodCombo);
    builder.nextLine();
    builder.nextLine();
    builder.append(new JLabel(rb.getString("Label.Currency")), new JLabel(account.getCurrencyNode().getSymbol()));
    builder.nextLine();
    builder.nextLine();
    JTable table = new GoalTable(model);
    table.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    // save entry if focus is lost
    table.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);
    ToolTipManager.sharedInstance().unregisterComponent(table);
    JScrollPane scrollPane = new JScrollPane(table);
    // force it something small so it will resize correctly
    scrollPane.setPreferredSize(new Dimension(SCROLLPANE_WIDTH, SCROLLPANE_HEIGHT));
    builder.append(scrollPane, 3);
    JPanel patternPanel = new JPanel();
    patternPanel.setLayout(new FormLayout(new ColumnSpec[] { FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow") }, new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC }));
    patternPanel.add(new JLabel(rb.getString("Label.Pattern")), "1, 2, right, default");
    patternPanel.add(patternComboBox, "3, 2, fill, default");
    patternPanel.add(new JLabel(rb.getString("Label.StartRow")), "1, 4, right, default");
    patternPanel.add(startRowSpinner, "3, 4");
    patternPanel.add(new JLabel(rb.getString("Label.EndRow")), "1, 6, right, default");
    patternPanel.add(endRowSpinner, "3, 6");
    patternPanel.add(new JLabel(rb.getString("Label.Amount")), "1, 8, right, default");
    patternPanel.add(fillPatternAmountField, "3, 8, fill, default");
    patternPanel.add(new ButtonBarBuilder().addGlue().addButton(fillPatternEnterButton).build(), "3, 10");
    FormLayout fillLayout = new FormLayout("right:d, $lcgap, fill:max(48dlu;min):g, $lcgap, d", "d, $rgap, d, $rgap, d, $rgap, d, $rgap, d");
    DefaultFormBuilder fillBuilder = new DefaultFormBuilder(fillLayout);
    fillBuilder.border(new TitledBorder(rb.getString("Title.SmartFill")));
    fillBuilder.append(historicalButton, 5);
    fillBuilder.nextLine();
    fillBuilder.nextLine();
    fillBuilder.appendSeparator();
    fillBuilder.nextLine();
    fillBuilder.nextLine();
    fillBuilder.append(new JLabel(rb.getString("Label.FillAll")), fillAmountField, fillButton);
    fillBuilder.nextLine();
    fillBuilder.nextLine();
    fillBuilder.appendSeparator();
    fillBuilder.nextLine();
    fillBuilder.nextLine();
    fillBuilder.append(patternPanel, 5);
    budgetPeriodCombo.addActionListener(this);
    cancelButton.addActionListener(this);
    okButton.addActionListener(this);
    historicalButton.addActionListener(this);
    fillButton.addActionListener(this);
    fillPatternEnterButton.addActionListener(this);
    contentBuilder.append(builder.getPanel(), fillBuilder.getPanel());
    contentBuilder.nextLine();
    contentBuilder.nextLine();
    contentBuilder.append(StaticUIMethods.buildOKCancelBar(okButton, cancelButton), 3);
    getContentPane().add(contentBuilder.getPanel());
    pack();
    setMinimumSize(getSize());
    DialogUtils.addBoundsListener(this);
    // pack columns for better default appearance
    JTableUtils.packGenericTable(table);
}
Also used : FormLayout(com.jgoodies.forms.layout.FormLayout) JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) ColumnSpec(com.jgoodies.forms.layout.ColumnSpec) JFloatField(jgnash.ui.components.JFloatField) JButton(javax.swing.JButton) RowSpec(com.jgoodies.forms.layout.RowSpec) JLabel(javax.swing.JLabel) Dimension(java.awt.Dimension) TitledBorder(javax.swing.border.TitledBorder) SpinnerNumberModel(javax.swing.SpinnerNumberModel) DefaultFormBuilder(com.jgoodies.forms.builder.DefaultFormBuilder) ButtonBarBuilder(com.jgoodies.forms.builder.ButtonBarBuilder) JTable(javax.swing.JTable) FormattedJTable(jgnash.ui.components.FormattedJTable) JSpinner(javax.swing.JSpinner)

Aggregations

RowSpec (com.jgoodies.forms.layout.RowSpec)5 ColumnSpec (com.jgoodies.forms.layout.ColumnSpec)4 FormLayout (com.jgoodies.forms.layout.FormLayout)4 JLabel (javax.swing.JLabel)2 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 ActionEvent (java.awt.event.ActionEvent)1 ActionListener (java.awt.event.ActionListener)1 Iterator (java.util.Iterator)1 List (java.util.List)1 JButton (javax.swing.JButton)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