Search in sources :

Example 6 with ParallelGroup

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

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

Example 8 with ParallelGroup

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

the class GradientLegendPanel method createExpressionLegendPanel.

private static JPanel createExpressionLegendPanel(DataSetColorRange range) {
    JPanel panel = new JPanel();
    GroupLayout layout = new GroupLayout(panel);
    panel.setLayout(layout);
    layout.setAutoCreateContainerGaps(true);
    layout.setAutoCreateGaps(!LookAndFeelUtil.isAquaLAF());
    ParallelGroup hGroup = layout.createParallelGroup(Alignment.CENTER, true);
    SequentialGroup vGroup = layout.createSequentialGroup();
    layout.setHorizontalGroup(hGroup);
    layout.setVerticalGroup(vGroup);
    ColorGradientWidget legend = ColorGradientWidget.getInstance("", range.getTheme(), range.getRange(), true, ColorGradientWidget.LEGEND_POSITION.NA);
    hGroup.addComponent(legend, DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE);
    vGroup.addComponent(legend, 25, 25, 25);
    if (LookAndFeelUtil.isAquaLAF())
        panel.setOpaque(false);
    panel.revalidate();
    panel.setOpaque(false);
    return panel;
}
Also used : ColorGradientWidget(org.mskcc.colorgradient.ColorGradientWidget) JPanel(javax.swing.JPanel) ParallelGroup(javax.swing.GroupLayout.ParallelGroup) SequentialGroup(javax.swing.GroupLayout.SequentialGroup) GroupLayout(javax.swing.GroupLayout)

Example 9 with ParallelGroup

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

the class ImportTablePanel method showAdvancedDialog.

protected void showAdvancedDialog() {
    if (advancedDialog == null) {
        advancedDialog = new JDialog(SwingUtilities.getWindowAncestor(this), ModalityType.DOCUMENT_MODAL);
        advancedDialog.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE);
        advancedDialog.setResizable(false);
        advancedDialog.setTitle("Import - Advanced Options");
        final JButton okButton = new JButton(new AbstractAction("OK") {

            @Override
            public void actionPerformed(ActionEvent e) {
                advancedDialog.setVisible(false);
            }
        });
        final JPanel contentPane = new JPanel();
        final GroupLayout layout = new GroupLayout(contentPane);
        contentPane.setLayout(layout);
        layout.setAutoCreateContainerGaps(true);
        layout.setAutoCreateGaps(true);
        final ParallelGroup hGroup = layout.createParallelGroup(LEADING, true);
        final SequentialGroup vGroup = layout.createSequentialGroup();
        layout.setHorizontalGroup(hGroup);
        layout.setVerticalGroup(vGroup);
        if (importType == TABLE_IMPORT || importType == ONTOLOGY_IMPORT) {
            hGroup.addComponent(getAnnotationTblMappingPanel(), DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE);
            vGroup.addComponent(getAnnotationTblMappingPanel(), PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE);
        }
        hGroup.addComponent(getTextImportOptionPanel(), DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE);
        vGroup.addComponent(getTextImportOptionPanel(), PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE);
        hGroup.addComponent(okButton, TRAILING, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE);
        vGroup.addComponent(okButton, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE);
        advancedDialog.setContentPane(contentPane);
        LookAndFeelUtil.setDefaultOkCancelKeyStrokes(advancedDialog.getRootPane(), okButton.getAction(), okButton.getAction());
        advancedDialog.getRootPane().setDefaultButton(okButton);
        if (importType == ONTOLOGY_IMPORT) {
            // Disable unnecessary components
            getImportAllCheckBox().setSelected(true);
            getImportAllCheckBox().setEnabled(false);
        }
    }
    advancedDialog.pack();
    advancedDialog.setLocationRelativeTo(serviceRegistrar.getService(CySwingApplication.class).getJFrame());
    advancedDialog.setVisible(true);
}
Also used : JPanel(javax.swing.JPanel) ParallelGroup(javax.swing.GroupLayout.ParallelGroup) ActionEvent(java.awt.event.ActionEvent) SequentialGroup(javax.swing.GroupLayout.SequentialGroup) JButton(javax.swing.JButton) GroupLayout(javax.swing.GroupLayout) AbstractAction(javax.swing.AbstractAction) JDialog(javax.swing.JDialog)

Example 10 with ParallelGroup

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

the class ImportTablePanel method getBasicPanel.

private JPanel getBasicPanel() {
    if (basicPanel == null) {
        basicPanel = new JPanel();
        final GroupLayout layout = new GroupLayout(basicPanel);
        basicPanel.setLayout(layout);
        layout.setAutoCreateGaps(true);
        final ParallelGroup hGroup = layout.createParallelGroup(CENTER);
        final SequentialGroup vGroup = layout.createSequentialGroup();
        layout.setHorizontalGroup(hGroup);
        layout.setVerticalGroup(vGroup);
        if (importType == ONTOLOGY_IMPORT) {
            hGroup.addComponent(getDataSourcesPanel(), DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE);
            vGroup.addComponent(getDataSourcesPanel(), PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE);
        } else if (importType == TABLE_IMPORT || importType == NETWORK_IMPORT) {
            hGroup.addComponent(getSimpleAttributeImportPanel(), DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE);
            vGroup.addComponent(getSimpleAttributeImportPanel(), PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE);
        }
    }
    return basicPanel;
}
Also used : JPanel(javax.swing.JPanel) ParallelGroup(javax.swing.GroupLayout.ParallelGroup) SequentialGroup(javax.swing.GroupLayout.SequentialGroup) GroupLayout(javax.swing.GroupLayout)

Aggregations

ParallelGroup (javax.swing.GroupLayout.ParallelGroup)16 SequentialGroup (javax.swing.GroupLayout.SequentialGroup)14 GroupLayout (javax.swing.GroupLayout)11 JPanel (javax.swing.JPanel)7 Component (java.awt.Component)4 Group (javax.swing.GroupLayout.Group)4 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