Search in sources :

Example 1 with ParallelGroup

use of javax.swing.GroupLayout.ParallelGroup in project cytoscape-impl by cytoscape.

the class ImportTablePanel method getTextImportOptionPanel.

private JPanel getTextImportOptionPanel() {
    if (textImportOptionPanel == null) {
        textImportOptionPanel = new JPanel();
        textImportOptionPanel.setBorder(LookAndFeelUtil.createTitledBorder("File Import Options"));
        final JLabel startRowLabel = new JLabel("Start Import Row:");
        startRowLabel.setHorizontalAlignment(JLabel.RIGHT);
        final JLabel commentLineLabel = new JLabel("Ignore Lines Starting With:");
        commentLineLabel.setHorizontalAlignment(JLabel.RIGHT);
        final JLabel defaultInteractionLabel = new JLabel("Default Interaction:");
        defaultInteractionLabel.setHorizontalAlignment(JLabel.RIGHT);
        final GroupLayout layout = new GroupLayout(textImportOptionPanel);
        textImportOptionPanel.setLayout(layout);
        layout.setAutoCreateContainerGaps(true);
        layout.setAutoCreateGaps(true);
        // Get the width of the largest left and right components
        // - to align all left-side components
        final int lw = commentLineLabel.getPreferredSize().width;
        // - to align all right-side components
        final int rw = Math.max(getTransferNameCheckBox().getPreferredSize().width, getImportAllCheckBox().getPreferredSize().width);
        final ParallelGroup hGroup = layout.createParallelGroup(Alignment.LEADING, true);
        final SequentialGroup vGroup = layout.createSequentialGroup();
        if (!isSpreadsheetFile()) {
            // These fields cannot be used with Excel files
            final JSeparator sep = new JSeparator();
            hGroup.addGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(Alignment.TRAILING, true).addComponent(delimiterLabel, PREFERRED_SIZE, lw, PREFERRED_SIZE).addGap(lw).addGap(lw).addGap(lw).addGap(lw)).addGroup(layout.createParallelGroup(Alignment.LEADING, true).addComponent(commaCheckBox, rw, rw, Short.MAX_VALUE).addComponent(semicolonCheckBox, rw, rw, Short.MAX_VALUE).addComponent(spaceCheckBox, rw, rw, Short.MAX_VALUE).addComponent(tabCheckBox, rw, rw, Short.MAX_VALUE).addGroup(layout.createSequentialGroup().addComponent(otherCheckBox).addComponent(otherDelimiterTextField, PREFERRED_SIZE, 80, PREFERRED_SIZE)))).addComponent(sep, DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE);
            vGroup.addGroup(layout.createParallelGroup(Alignment.CENTER, false).addComponent(delimiterLabel).addComponent(commaCheckBox)).addComponent(semicolonCheckBox).addComponent(spaceCheckBox).addComponent(tabCheckBox).addGroup(layout.createParallelGroup(Alignment.CENTER, false).addComponent(otherCheckBox, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE).addComponent(otherDelimiterTextField, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE)).addComponent(sep, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE);
        }
        if (importType == NETWORK_IMPORT) {
            final JSeparator sep = new JSeparator();
            hGroup.addGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(Alignment.TRAILING, true).addComponent(defaultInteractionLabel, PREFERRED_SIZE, lw, PREFERRED_SIZE)).addGroup(layout.createParallelGroup(Alignment.LEADING, true).addComponent(defaultInteractionTextField, rw, rw, Short.MAX_VALUE))).addComponent(sep, DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE);
            vGroup.addGroup(layout.createParallelGroup(Alignment.CENTER, false).addComponent(defaultInteractionLabel).addComponent(defaultInteractionTextField)).addComponent(sep, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE);
        }
        layout.setHorizontalGroup(hGroup.addGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(Alignment.TRAILING, true).addGap(lw).addComponent(startRowLabel, PREFERRED_SIZE, lw, PREFERRED_SIZE).addComponent(commentLineLabel, PREFERRED_SIZE, lw, PREFERRED_SIZE).addGap(lw)).addGroup(layout.createParallelGroup(Alignment.LEADING, true).addComponent(getTransferNameCheckBox(), rw, rw, Short.MAX_VALUE).addComponent(getStartRowSpinner(), PREFERRED_SIZE, 54, PREFERRED_SIZE).addComponent(getCommentLineTextField(), PREFERRED_SIZE, 54, PREFERRED_SIZE).addComponent(getImportAllCheckBox(), rw, rw, Short.MAX_VALUE))));
        layout.setVerticalGroup(vGroup.addComponent(getTransferNameCheckBox()).addGroup(layout.createParallelGroup(Alignment.CENTER, false).addComponent(startRowLabel).addComponent(getStartRowSpinner())).addGroup(layout.createParallelGroup(Alignment.CENTER, false).addComponent(commentLineLabel).addComponent(getCommentLineTextField())).addComponent(getImportAllCheckBox()));
        if (importType != ONTOLOGY_IMPORT)
            getImportAllCheckBox().setVisible(false);
    }
    return textImportOptionPanel;
}
Also used : JPanel(javax.swing.JPanel) ParallelGroup(javax.swing.GroupLayout.ParallelGroup) SequentialGroup(javax.swing.GroupLayout.SequentialGroup) GroupLayout(javax.swing.GroupLayout) JLabel(javax.swing.JLabel) JSeparator(javax.swing.JSeparator)

Example 2 with ParallelGroup

use of javax.swing.GroupLayout.ParallelGroup in project cytoscape-impl by cytoscape.

the class CompositeFilterPanel method updateLayout.

@Override
public void updateLayout() {
    if (!SwingUtilities.isEventDispatchThread()) {
        SwingUtilities.invokeLater(this::updateLayout);
        return;
    }
    removeAll();
    final ParallelGroup checkBoxGroup = layout.createParallelGroup(Alignment.LEADING);
    final ParallelGroup viewGroup = layout.createParallelGroup(Alignment.LEADING);
    final Group columns = layout.createParallelGroup(Alignment.LEADING, true);
    final Group rows = layout.createSequentialGroup();
    combiningMethodComboBox.setVisible((depth > 0 && !compositeFilterController.autoHideComboBox()) || model.getLength() > 1);
    columns.addComponent(combiningMethodPanel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE);
    rows.addComponent(combiningMethodPanel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE);
    columns.addGroup(layout.createSequentialGroup().addGap(4).addGroup(checkBoxGroup).addGap(4).addGroup(viewGroup));
    int separatorHeight = 5;
    viewGroup.addComponent(separator);
    rows.addComponent(separator, separatorHeight, separatorHeight, separatorHeight);
    for (int i = 0; i < model.getLength(); i++) {
        final TransformerElementViewModel<?> viewModel = getViewModel(model.get(i));
        if (viewModel.view instanceof CompositeFilterPanel) {
            CompositeFilterPanel<?> panel = (CompositeFilterPanel<?>) viewModel.view;
            panel.updateLayout();
        }
        checkBoxGroup.addGroup(layout.createParallelGroup().addGroup(layout.createSequentialGroup().addComponent(viewModel.deleteButton, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE).addGap(4).addComponent(viewModel.handle, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE)).addGap(4).addComponent(viewModel.warnIcon, Alignment.CENTER));
        viewGroup.addComponent(viewModel.view, 0, GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE).addComponent(viewModel.separator);
        rows.addGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(layout.createSequentialGroup().addGap(ViewUtil.INTERNAL_VERTICAL_PADDING).addGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup().addComponent(viewModel.deleteButton, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE).addComponent(viewModel.handle, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)).addGap(4).addComponent(viewModel.warnIcon))).addComponent(viewModel.view, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE));
        rows.addComponent(viewModel.separator, separatorHeight, separatorHeight, separatorHeight);
    }
    columns.addComponent(addButton);
    rows.addGap(ViewUtil.INTERNAL_VERTICAL_PADDING).addComponent(addButton);
    layout.setHorizontalGroup(columns);
    layout.setVerticalGroup(rows);
}
Also used : ParallelGroup(javax.swing.GroupLayout.ParallelGroup) ParallelGroup(javax.swing.GroupLayout.ParallelGroup) Group(javax.swing.GroupLayout.Group)

Example 3 with ParallelGroup

use of javax.swing.GroupLayout.ParallelGroup in project cytoscape-impl by cytoscape.

the class AbstractChartEditor method getLabelsPnl.

protected JPanel getLabelsPnl() {
    if (labelsPnl == null) {
        labelsPnl = new JPanel();
        // Transparent if Aqua
        labelsPnl.setOpaque(!isAquaLAF());
        labelsPnl.setVisible(setItemLabels || setDomainLabels || setRangeLabels);
        if (!labelsPnl.isVisible())
            return labelsPnl;
        final GroupLayout layout = new GroupLayout(labelsPnl);
        labelsPnl.setLayout(layout);
        layout.setAutoCreateContainerGaps(false);
        layout.setAutoCreateGaps(!isAquaLAF());
        final ParallelGroup hGroup = layout.createParallelGroup(Alignment.LEADING, true);
        final SequentialGroup vGroup = layout.createSequentialGroup();
        layout.setHorizontalGroup(hGroup);
        layout.setVerticalGroup(vGroup);
        if (setItemLabels) {
            hGroup.addGroup(layout.createSequentialGroup().addComponent(getItemLabelsVisibleCkb()).addPreferredGap(ComponentPlacement.UNRELATED).addComponent(itemLabelsColumnLbl).addComponent(getItemLabelsColumnCmb(), PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE).addPreferredGap(ComponentPlacement.UNRELATED).addComponent(itemFontSizeLbl).addComponent(getItemFontSizeTxt(), PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE));
            vGroup.addGroup(layout.createParallelGroup(Alignment.CENTER, false).addComponent(getItemLabelsVisibleCkb()).addComponent(itemLabelsColumnLbl).addComponent(getItemLabelsColumnCmb()).addComponent(itemFontSizeLbl).addComponent(getItemFontSizeTxt()));
        }
        if (setRangeLabels) {
            hGroup.addGroup(layout.createSequentialGroup().addComponent(rangeLabelsColumnLbl).addComponent(getRangeLabelsColumnCmb(), PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE));
            vGroup.addGroup(layout.createParallelGroup(Alignment.CENTER, false).addComponent(rangeLabelsColumnLbl).addComponent(getRangeLabelsColumnCmb()));
        }
        if (setDomainLabels) {
            hGroup.addGroup(layout.createSequentialGroup().addComponent(domainLabelsColumnLbl).addComponent(getDomainLabelsColumnCmb(), PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE));
            vGroup.addGroup(layout.createParallelGroup(Alignment.CENTER, false).addComponent(domainLabelsColumnLbl).addComponent(getDomainLabelsColumnCmb()));
        }
        hGroup.addGroup(layout.createSequentialGroup().addComponent(domainLabelPositionLbl).addComponent(getDomainLabelPositionCmb(), PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE));
        vGroup.addGroup(layout.createParallelGroup(Alignment.CENTER, false).addComponent(domainLabelPositionLbl).addComponent(getDomainLabelPositionCmb()));
        final JSeparator sep = new JSeparator();
        hGroup.addComponent(sep);
        vGroup.addComponent(sep, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE);
    }
    return labelsPnl;
}
Also used : JPanel(javax.swing.JPanel) ParallelGroup(javax.swing.GroupLayout.ParallelGroup) SequentialGroup(javax.swing.GroupLayout.SequentialGroup) GroupLayout(javax.swing.GroupLayout) JSeparator(javax.swing.JSeparator)

Example 4 with ParallelGroup

use of javax.swing.GroupLayout.ParallelGroup in project com.revolsys.open by revolsys.

the class GroupLayouts method parallel.

public static ParallelGroup parallel(final GroupLayout layout, final Object... elements) {
    final ParallelGroup group = layout.createParallelGroup();
    for (final Object element : elements) {
        if (element instanceof Component) {
            final Component component = (Component) element;
            group.addComponent(component);
        } else if (element instanceof Group) {
            final Group childGroup = (Group) element;
            group.addGroup(childGroup);
        }
    }
    return group;
}
Also used : ParallelGroup(javax.swing.GroupLayout.ParallelGroup) SequentialGroup(javax.swing.GroupLayout.SequentialGroup) Group(javax.swing.GroupLayout.Group) ParallelGroup(javax.swing.GroupLayout.ParallelGroup) Component(java.awt.Component)

Example 5 with ParallelGroup

use of javax.swing.GroupLayout.ParallelGroup in project com.revolsys.open by revolsys.

the class GroupLayouts method parallel.

public static ParallelGroup parallel(final GroupLayout layout, final Alignment alignment, final Object... elements) {
    final ParallelGroup group = layout.createParallelGroup(alignment);
    for (final Object element : elements) {
        if (element instanceof Component) {
            final Component component = (Component) element;
            group.addComponent(component);
        } else if (element instanceof Group) {
            final Group childGroup = (Group) element;
            group.addGroup(childGroup);
        }
    }
    return group;
}
Also used : ParallelGroup(javax.swing.GroupLayout.ParallelGroup) SequentialGroup(javax.swing.GroupLayout.SequentialGroup) Group(javax.swing.GroupLayout.Group) ParallelGroup(javax.swing.GroupLayout.ParallelGroup) Component(java.awt.Component)

Aggregations

ParallelGroup (javax.swing.GroupLayout.ParallelGroup)15 SequentialGroup (javax.swing.GroupLayout.SequentialGroup)13 GroupLayout (javax.swing.GroupLayout)10 JPanel (javax.swing.JPanel)7 Group (javax.swing.GroupLayout.Group)4 Component (java.awt.Component)3 JLabel (javax.swing.JLabel)3 JButton (javax.swing.JButton)2 JComponent (javax.swing.JComponent)2 JSeparator (javax.swing.JSeparator)2 BorderLayout (java.awt.BorderLayout)1 Color (java.awt.Color)1 ActionEvent (java.awt.event.ActionEvent)1 File (java.io.File)1 ArrayList (java.util.ArrayList)1 AbstractAction (javax.swing.AbstractAction)1 AbstractButton (javax.swing.AbstractButton)1 ButtonGroup (javax.swing.ButtonGroup)1 ImageIcon (javax.swing.ImageIcon)1 JDialog (javax.swing.JDialog)1