Search in sources :

Example 1 with SequentialGroup

use of javax.swing.GroupLayout.SequentialGroup 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 SequentialGroup

use of javax.swing.GroupLayout.SequentialGroup 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 3 with SequentialGroup

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

the class GroupLayouts method sequential.

public static SequentialGroup sequential(final GroupLayout layout, final Object... elements) {
    final SequentialGroup group = layout.createSequentialGroup();
    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 : SequentialGroup(javax.swing.GroupLayout.SequentialGroup) Group(javax.swing.GroupLayout.Group) ParallelGroup(javax.swing.GroupLayout.ParallelGroup) SequentialGroup(javax.swing.GroupLayout.SequentialGroup) Component(java.awt.Component)

Example 4 with SequentialGroup

use of javax.swing.GroupLayout.SequentialGroup in project briefcase by opendatakit.

the class MountedSDCardChooserDialog method rebuildPanel.

private void rebuildPanel() {
    GroupLayout groupLayout = new GroupLayout(radioPanel);
    // Get mounted drives that have the needed directory structures...
    List<File> mounts = FindDirectoryStructure.searchMountedDrives();
    // remove everything from the panel
    radioPanel.removeAll();
    while (radioGroup.getButtonCount() != 0) {
        AbstractButton rb = radioGroup.getElements().nextElement();
        radioGroup.remove(rb);
    }
    // construct the panel
    ParallelGroup leftAlignedHorizontals = groupLayout.createParallelGroup(Alignment.LEADING);
    SequentialGroup verticalGroup = groupLayout.createSequentialGroup();
    int len = 0;
    File oldDevice = odkDevice;
    JRadioButton activeButton = null;
    odkDevice = null;
    boolean first = true;
    for (File m : mounts) {
        String mountName = m.getAbsolutePath();
        JRadioButton mountButton = new JRadioButton(mountName, first);
        mountButton.setActionCommand(mountName);
        radioGroup.add(mountButton);
        mountButton.addActionListener(this);
        if (first) {
            verticalGroup.addContainerGap();
            odkDevice = new File(mountName);
            activeButton = mountButton;
        } else {
            verticalGroup.addPreferredGap(ComponentPlacement.RELATED);
        }
        // try to preserve original mount point selection
        if (oldDevice != null) {
            if (oldDevice.getAbsolutePath().startsWith(mountName)) {
                if (len < mountName.length()) {
                    len = mountName.length();
                    odkDevice = new File(mountName);
                    activeButton = mountButton;
                }
            }
        }
        leftAlignedHorizontals.addComponent(mountButton);
        verticalGroup.addComponent(mountButton);
        first = false;
    }
    if (first != true) {
        verticalGroup.addContainerGap();
    }
    // TODO: set the chosen device as selected.
    if (activeButton != null) {
        activeButton.setSelected(true);
    }
    groupLayout.setHorizontalGroup(groupLayout.createSequentialGroup().addContainerGap().addGroup(leftAlignedHorizontals).addContainerGap());
    groupLayout.setVerticalGroup(verticalGroup);
    radioPanel.setLayout(groupLayout);
    pack();
}
Also used : ParallelGroup(javax.swing.GroupLayout.ParallelGroup) AbstractButton(javax.swing.AbstractButton) JRadioButton(javax.swing.JRadioButton) SequentialGroup(javax.swing.GroupLayout.SequentialGroup) GroupLayout(javax.swing.GroupLayout) File(java.io.File)

Example 5 with SequentialGroup

use of javax.swing.GroupLayout.SequentialGroup in project EnrichmentMapApp by BaderLab.

the class LegendPanel method updateStyleLegendPanel.

private void updateStyleLegendPanel(JComponent[][] entries, JPanel p) {
    p.removeAll();
    GroupLayout layout = new GroupLayout(p);
    p.setLayout(layout);
    layout.setAutoCreateContainerGaps(true);
    layout.setAutoCreateGaps(true);
    if (entries != null) {
        ParallelGroup hGroup = layout.createParallelGroup(Alignment.LEADING, true);
        SequentialGroup vGroup = layout.createSequentialGroup();
        layout.setHorizontalGroup(hGroup);
        layout.setVerticalGroup(vGroup);
        for (JComponent[] row : entries) {
            makeSmall(row[0], row[1]);
            hGroup.addGroup(layout.createSequentialGroup().addComponent(row[0], PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE).addComponent(row[1], PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE));
            vGroup.addGroup(layout.createParallelGroup(Alignment.CENTER, false).addComponent(row[0]).addComponent(row[1]));
        }
    }
    p.revalidate();
}
Also used : ParallelGroup(javax.swing.GroupLayout.ParallelGroup) SequentialGroup(javax.swing.GroupLayout.SequentialGroup) GroupLayout(javax.swing.GroupLayout) JComponent(javax.swing.JComponent)

Aggregations

ParallelGroup (javax.swing.GroupLayout.ParallelGroup)12 SequentialGroup (javax.swing.GroupLayout.SequentialGroup)12 GroupLayout (javax.swing.GroupLayout)10 JPanel (javax.swing.JPanel)7 JLabel (javax.swing.JLabel)3 Component (java.awt.Component)2 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 Group (javax.swing.GroupLayout.Group)1 ImageIcon (javax.swing.ImageIcon)1 JDialog (javax.swing.JDialog)1