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();
}
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();
}
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;
}
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);
}
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;
}
Aggregations