Search in sources :

Example 6 with SequentialGroup

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

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

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

Example 9 with SequentialGroup

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

the class AttributeEditorPanel method initComponents.

private void initComponents() {
    listDelimiterLabel = new JLabel("List Delimiter:");
    listDelimiterLabel.putClientProperty("JComponent.sizeVariant", "small");
    typeButtonGroup = new ButtonGroup();
    dataTypeButtonGroup = new ButtonGroup();
    final List<JToggleButton> dataTypeBtnList = new ArrayList<>();
    dataTypeBtnList.add(stringButton = createDataTypeButton(TYPE_STRING));
    dataTypeBtnList.add(integerButton = createDataTypeButton(TYPE_INTEGER));
    dataTypeBtnList.add(longButton = createDataTypeButton(TYPE_LONG));
    dataTypeBtnList.add(floatingPointButton = createDataTypeButton(TYPE_FLOATING));
    dataTypeBtnList.add(booleanButton = createDataTypeButton(TYPE_BOOLEAN));
    dataTypeBtnList.add(stringListButton = createDataTypeButton(TYPE_STRING_LIST));
    dataTypeBtnList.add(integerListButton = createDataTypeButton(TYPE_INTEGER_LIST));
    dataTypeBtnList.add(longListButton = createDataTypeButton(TYPE_LONG_LIST));
    dataTypeBtnList.add(floatingPointListButton = createDataTypeButton(TYPE_FLOATING_LIST));
    dataTypeBtnList.add(booleanListButton = createDataTypeButton(TYPE_BOOLEAN_LIST));
    setStyles(dataTypeBtnList);
    final GroupLayout layout = new GroupLayout(this);
    this.setLayout(layout);
    layout.setAutoCreateContainerGaps(true);
    layout.setAutoCreateGaps(false);
    final SequentialGroup typeHGroup = layout.createSequentialGroup();
    final ParallelGroup typeVGroup = layout.createParallelGroup(CENTER, false);
    for (SourceColumnSemantic type : availableTypes) {
        final JToggleButton btn = createTypeButton(type);
        typeHGroup.addComponent(btn, DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE);
        typeVGroup.addComponent(btn);
    }
    setStyles(new ArrayList<JToggleButton>(typeButtons.values()));
    final JLabel typeLabel = new JLabel("Meaning:");
    typeLabel.putClientProperty("JComponent.sizeVariant", "small");
    final JLabel dataTypeLabel = new JLabel("Data Type:");
    dataTypeLabel.putClientProperty("JComponent.sizeVariant", "small");
    layout.setHorizontalGroup(layout.createParallelGroup(CENTER, true).addComponent(getAttributeNameTextField(), DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE).addComponent(typeLabel, DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE).addGroup(typeHGroup).addComponent(dataTypeLabel, DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE).addGroup(layout.createSequentialGroup().addComponent(stringButton, DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE).addComponent(integerButton, DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE).addComponent(longButton, DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE).addComponent(floatingPointButton, DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE).addComponent(booleanButton, DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE)).addGroup(layout.createSequentialGroup().addComponent(stringListButton, DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE).addComponent(integerListButton, DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE).addComponent(longListButton, DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE).addComponent(floatingPointListButton, DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE).addComponent(booleanListButton, DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE)).addGroup(layout.createSequentialGroup().addComponent(listDelimiterLabel).addPreferredGap(ComponentPlacement.RELATED).addComponent(getListDelimiterComboBox(), PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE).addComponent(getOtherTextField(), 12, 36, Short.MAX_VALUE)));
    layout.setVerticalGroup(layout.createSequentialGroup().addComponent(getAttributeNameTextField(), PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE).addPreferredGap(ComponentPlacement.UNRELATED).addComponent(typeLabel, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE).addPreferredGap(ComponentPlacement.RELATED).addGroup(typeVGroup).addPreferredGap(ComponentPlacement.UNRELATED).addComponent(dataTypeLabel, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE).addPreferredGap(ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(CENTER).addComponent(stringButton).addComponent(integerButton).addComponent(longButton).addComponent(floatingPointButton).addComponent(booleanButton)).addGroup(layout.createParallelGroup(CENTER).addComponent(stringListButton).addComponent(integerListButton).addComponent(longListButton).addComponent(floatingPointListButton).addComponent(booleanListButton)).addGroup(layout.createSequentialGroup().addPreferredGap(ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(CENTER).addComponent(listDelimiterLabel).addComponent(getListDelimiterComboBox(), PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE).addComponent(getOtherTextField(), PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE))));
}
Also used : ParallelGroup(javax.swing.GroupLayout.ParallelGroup) SourceColumnSemantic(org.cytoscape.tableimport.internal.util.SourceColumnSemantic) JToggleButton(javax.swing.JToggleButton) ButtonGroup(javax.swing.ButtonGroup) SequentialGroup(javax.swing.GroupLayout.SequentialGroup) ArrayList(java.util.ArrayList) GroupLayout(javax.swing.GroupLayout) JLabel(javax.swing.JLabel)

Example 10 with SequentialGroup

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

the class GroupLayouts method makeColumns.

public static void makeColumns(final Container container, final GroupLayout groupLayout, final int columnCount) {
    final int componentCount = container.getComponentCount();
    final int numRows = (int) Math.ceil(componentCount / (double) columnCount);
    final SequentialGroup horizontalGroup = groupLayout.createSequentialGroup();
    groupLayout.setHorizontalGroup(horizontalGroup);
    for (int columnIndex = 0; columnIndex < columnCount; columnIndex++) {
        final ParallelGroup columnGroup = groupLayout.createParallelGroup(Alignment.LEADING);
        horizontalGroup.addGroup(columnGroup);
        for (int rowIndex = 0; rowIndex < numRows; rowIndex++) {
            final int componentIndex = rowIndex * columnCount + columnIndex;
            if (componentIndex < componentCount) {
                final Component component = container.getComponent(componentIndex);
                columnGroup.addComponent(component, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE);
            }
        }
    }
    final SequentialGroup verticalGroup = groupLayout.createSequentialGroup();
    groupLayout.setVerticalGroup(verticalGroup);
    for (int rowIndex = 0; rowIndex < numRows; rowIndex++) {
        final ParallelGroup rowGroup = groupLayout.createParallelGroup(Alignment.BASELINE);
        verticalGroup.addGroup(rowGroup);
        for (int columnIndex = 0; columnIndex < columnCount; columnIndex++) {
            final int componentIndex = rowIndex * columnCount + columnIndex;
            if (componentIndex < componentCount) {
                final Component component = container.getComponent(componentIndex);
                rowGroup.addComponent(component, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE);
            }
        }
    }
}
Also used : ParallelGroup(javax.swing.GroupLayout.ParallelGroup) SequentialGroup(javax.swing.GroupLayout.SequentialGroup) Component(java.awt.Component)

Aggregations

ParallelGroup (javax.swing.GroupLayout.ParallelGroup)13 SequentialGroup (javax.swing.GroupLayout.SequentialGroup)13 GroupLayout (javax.swing.GroupLayout)11 JPanel (javax.swing.JPanel)7 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 Group (javax.swing.GroupLayout.Group)1 ImageIcon (javax.swing.ImageIcon)1 JDialog (javax.swing.JDialog)1