Search in sources :

Example 21 with GroupLayout

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

the class PostAnalysisWeightPanel method createHypergeomPanel.

private JPanel createHypergeomPanel() {
    ActionListener universeSelectActionListener = e -> {
        boolean enable = e.getActionCommand().equals("User Defined");
        universeSelectionTextField.setEnabled(enable);
    };
    gmtRadioButton = new JRadioButton();
    gmtRadioButton.setActionCommand("GMT");
    gmtRadioButton.addActionListener(universeSelectActionListener);
    gmtRadioButton.setSelected(true);
    expressionSetRadioButton = new JRadioButton();
    expressionSetRadioButton.setActionCommand("Expression Set");
    expressionSetRadioButton.addActionListener(universeSelectActionListener);
    intersectionRadioButton = new JRadioButton();
    intersectionRadioButton.setActionCommand("Intersection");
    intersectionRadioButton.addActionListener(universeSelectActionListener);
    userDefinedRadioButton = new JRadioButton("User Defined:");
    userDefinedRadioButton.setActionCommand("User Defined");
    userDefinedRadioButton.addActionListener(universeSelectActionListener);
    ButtonGroup buttonGroup = new ButtonGroup();
    buttonGroup.add(gmtRadioButton);
    buttonGroup.add(expressionSetRadioButton);
    buttonGroup.add(intersectionRadioButton);
    buttonGroup.add(userDefinedRadioButton);
    DecimalFormat intFormat = new DecimalFormat();
    intFormat.setParseIntegerOnly(true);
    universeSelectionTextField = new JFormattedTextField(intFormat);
    universeSelectionTextField.addPropertyChangeListener("value", e -> {
        Number val = (Number) universeSelectionTextField.getValue();
        if (val == null || val.intValue() < 0) {
            universeSelectionTextField.setValue(1);
            CySwingApplication application = serviceRegistrar.getService(CySwingApplication.class);
            JOptionPane.showMessageDialog(application.getJFrame(), "Universe value must be greater than zero", "Parameter out of bounds", JOptionPane.WARNING_MESSAGE);
        }
    });
    universeSelectionTextField.setEnabled(false);
    gmtRadioButton.setText("GMT");
    expressionSetRadioButton.setText("Expression Set");
    intersectionRadioButton.setText("Intersection");
    universeSelectionTextField.setValue(0);
    makeSmall(gmtRadioButton, expressionSetRadioButton, intersectionRadioButton, userDefinedRadioButton, universeSelectionTextField);
    JPanel panel = new JPanel();
    panel.setBorder(LookAndFeelUtil.createTitledBorder("Advanced Hypergeometric Universe"));
    final GroupLayout layout = new GroupLayout(panel);
    panel.setLayout(layout);
    layout.setAutoCreateContainerGaps(true);
    layout.setAutoCreateGaps(!LookAndFeelUtil.isAquaLAF());
    layout.setHorizontalGroup(layout.createParallelGroup(Alignment.LEADING, true).addComponent(gmtRadioButton).addComponent(expressionSetRadioButton).addComponent(intersectionRadioButton).addGroup(layout.createSequentialGroup().addComponent(userDefinedRadioButton, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE).addPreferredGap(ComponentPlacement.RELATED).addComponent(universeSelectionTextField, DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE)));
    layout.setVerticalGroup(layout.createSequentialGroup().addComponent(gmtRadioButton, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE).addComponent(expressionSetRadioButton, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE).addComponent(intersectionRadioButton, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE).addGroup(layout.createParallelGroup(Alignment.CENTER, false).addComponent(userDefinedRadioButton, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE).addComponent(universeSelectionTextField, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE)));
    if (LookAndFeelUtil.isAquaLAF())
        panel.setOpaque(false);
    return panel;
}
Also used : Arrays(java.util.Arrays) CardLayout(java.awt.CardLayout) ActionListener(java.awt.event.ActionListener) PostAnalysisParameters(org.baderlab.csplugins.enrichmentmap.model.PostAnalysisParameters) JTextField(javax.swing.JTextField) EnrichmentMap(org.baderlab.csplugins.enrichmentmap.model.EnrichmentMap) Ranking(org.baderlab.csplugins.enrichmentmap.model.Ranking) IconManager(org.cytoscape.util.swing.IconManager) PostAnalysisFilterParameters(org.baderlab.csplugins.enrichmentmap.model.PostAnalysisFilterParameters) GeneExpressionMatrix(org.baderlab.csplugins.enrichmentmap.model.GeneExpressionMatrix) Map(java.util.Map) EnablementComboBoxRenderer(org.baderlab.csplugins.enrichmentmap.view.EnablementComboBoxRenderer) DefaultComboBoxModel(javax.swing.DefaultComboBoxModel) SwingUtil.makeSmall(org.baderlab.csplugins.enrichmentmap.view.util.SwingUtil.makeSmall) JComboBox(javax.swing.JComboBox) JFrame(javax.swing.JFrame) CyServiceRegistrar(org.cytoscape.service.util.CyServiceRegistrar) DEFAULT_SIZE(javax.swing.GroupLayout.DEFAULT_SIZE) UniverseType(org.baderlab.csplugins.enrichmentmap.model.PostAnalysisParameters.UniverseType) JFormattedTextField(javax.swing.JFormattedTextField) ButtonGroup(javax.swing.ButtonGroup) DecimalFormat(java.text.DecimalFormat) ComponentPlacement(javax.swing.LayoutStyle.ComponentPlacement) JOptionPane(javax.swing.JOptionPane) JRadioButton(javax.swing.JRadioButton) PREFERRED_SIZE(javax.swing.GroupLayout.PREFERRED_SIZE) List(java.util.List) Alignment(javax.swing.GroupLayout.Alignment) EMDataSet(org.baderlab.csplugins.enrichmentmap.model.EMDataSet) PostAnalysisFilterType(org.baderlab.csplugins.enrichmentmap.model.PostAnalysisFilterType) LookAndFeelUtil(org.cytoscape.util.swing.LookAndFeelUtil) JLabel(javax.swing.JLabel) GroupLayout(javax.swing.GroupLayout) CySwingApplication(org.cytoscape.application.swing.CySwingApplication) Optional(java.util.Optional) Collections(java.util.Collections) JPanel(javax.swing.JPanel) JPanel(javax.swing.JPanel) JRadioButton(javax.swing.JRadioButton) ActionListener(java.awt.event.ActionListener) ButtonGroup(javax.swing.ButtonGroup) CySwingApplication(org.cytoscape.application.swing.CySwingApplication) DecimalFormat(java.text.DecimalFormat) JFormattedTextField(javax.swing.JFormattedTextField) GroupLayout(javax.swing.GroupLayout)

Example 22 with GroupLayout

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

the class CardDialog method createChooserPanel.

private JPanel createChooserPanel(List<CardDialogPage> pages) {
    JLabel label = new JLabel(params.getPageChooserLabelText());
    pageChooserCombo = new JComboBox<>();
    for (CardDialogPage page : pages) {
        pageChooserCombo.addItem(new ComboItem<>(page, page.getPageComboText()));
    }
    SwingUtil.makeSmall(label, pageChooserCombo);
    JPanel panel = new JPanel();
    final GroupLayout layout = new GroupLayout(panel);
    panel.setLayout(layout);
    layout.setAutoCreateContainerGaps(true);
    layout.setAutoCreateGaps(true);
    layout.setHorizontalGroup(layout.createSequentialGroup().addComponent(label).addComponent(pageChooserCombo).addGap(0, 0, Short.MAX_VALUE));
    layout.setVerticalGroup(layout.createParallelGroup(Alignment.CENTER, true).addComponent(label).addComponent(pageChooserCombo, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE));
    panel.setBorder(LookAndFeelUtil.createPanelBorder());
    if (LookAndFeelUtil.isAquaLAF())
        panel.setOpaque(false);
    return panel;
}
Also used : JPanel(javax.swing.JPanel) GroupLayout(javax.swing.GroupLayout) JLabel(javax.swing.JLabel)

Example 23 with GroupLayout

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

the class SliderBarPanel method init.

@SuppressWarnings("unchecked")
protected void init() {
    JLabel titleLabel = new JLabel(title);
    titleLabel.setVisible(title != null && !title.trim().isEmpty());
    makeSmall(titleLabel, getSlider(), getTextField());
    final GroupLayout layout = new GroupLayout(this);
    this.setLayout(layout);
    layout.setAutoCreateContainerGaps(false);
    layout.setAutoCreateGaps(!LookAndFeelUtil.isAquaLAF());
    layout.setHorizontalGroup(layout.createParallelGroup(Alignment.LEADING, true).addComponent(titleLabel).addGroup(layout.createSequentialGroup().addComponent(getSlider(), DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE).addComponent(getTextField(), PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE)));
    layout.setVerticalGroup(layout.createSequentialGroup().addComponent(titleLabel, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE).addGroup(layout.createParallelGroup(Alignment.LEADING, true).addComponent(getSlider(), PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE).addComponent(getTextField(), PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE)));
    if (LookAndFeelUtil.isAquaLAF())
        setOpaque(false);
    // Change the slider's label sizes -- only works if it's done after the slider has been added to
    // its parent container and had its UI assigned
    final Font tickFont = getSlider().getFont().deriveFont(getSmallFontSize());
    final Dictionary<Integer, JLabel> labelTable = getSlider().getLabelTable();
    for (Enumeration<Integer> enumeration = labelTable.keys(); enumeration.hasMoreElements(); ) {
        int k = enumeration.nextElement();
        final JLabel label = labelTable.get(k);
        // Updates the font size
        label.setFont(tickFont);
        // Updates the label size and slider layout
        label.setSize(label.getPreferredSize());
    }
    revalidate();
}
Also used : GroupLayout(javax.swing.GroupLayout) JLabel(javax.swing.JLabel) Font(java.awt.Font)

Example 24 with GroupLayout

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

the class PostAnalysisInputPanel method createAnalysisTypePanel.

/**
	 * Creates a JPanel containing scope radio buttons
	 */
private JPanel createAnalysisTypePanel() {
    makeSmall(getKnownSignatureRadio(), getSignatureDiscoveryRadio());
    ButtonGroup analysisOptions = new ButtonGroup();
    analysisOptions.add(getKnownSignatureRadio());
    analysisOptions.add(getSignatureDiscoveryRadio());
    JPanel panel = new JPanel();
    panel.setBorder(LookAndFeelUtil.createTitledBorder("Post Analysis Type"));
    final GroupLayout layout = new GroupLayout(panel);
    panel.setLayout(layout);
    layout.setAutoCreateContainerGaps(true);
    layout.setAutoCreateGaps(true);
    layout.setHorizontalGroup(layout.createSequentialGroup().addGap(0, 0, Short.MAX_VALUE).addComponent(getKnownSignatureRadio()).addComponent(getSignatureDiscoveryRadio()).addGap(0, 0, Short.MAX_VALUE));
    layout.setVerticalGroup(layout.createParallelGroup(Alignment.CENTER, true).addComponent(getKnownSignatureRadio(), PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE).addComponent(getSignatureDiscoveryRadio(), PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE));
    if (LookAndFeelUtil.isAquaLAF())
        panel.setOpaque(false);
    return panel;
}
Also used : JPanel(javax.swing.JPanel) ButtonGroup(javax.swing.ButtonGroup) GroupLayout(javax.swing.GroupLayout)

Example 25 with GroupLayout

use of javax.swing.GroupLayout in project zaproxy by zaproxy.

the class DialogAddAutoTagScanner method getFieldsPanel.

@Override
protected JPanel getFieldsPanel() {
    JPanel fieldsPanel = new JPanel();
    GroupLayout layout = new GroupLayout(fieldsPanel);
    fieldsPanel.setLayout(layout);
    layout.setAutoCreateGaps(true);
    layout.setAutoCreateContainerGaps(true);
    JLabel nameLabel = new JLabel(NAME_FIELD_LABEL);
    JLabel typeLabel = new JLabel(TYPE_FIELD_LABEL);
    JLabel configurationLabel = new JLabel(CONFIGURATION_FIELD_LABEL);
    JLabel requestUrlRegexLabel = new JLabel(REQUEST_URL_REGEX_FIELD_LABEL);
    JLabel requestHeaderRegexLabel = new JLabel(REQUEST_HEADER_REGEX_FIELD_LABEL);
    JLabel responseHeaderRegexLabel = new JLabel(RESPONSE_HEADER_REGEX_FIELD_LABEL);
    JLabel responseBodyRegexLabel = new JLabel(RESPONSE_BODY_REGEX_FIELD_LABEL);
    JLabel enabledLabel = new JLabel(ENABLED_FIELD_LABEL);
    layout.setHorizontalGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(GroupLayout.Alignment.TRAILING).addComponent(nameLabel).addComponent(typeLabel).addComponent(configurationLabel).addComponent(requestUrlRegexLabel).addComponent(requestHeaderRegexLabel).addComponent(responseHeaderRegexLabel).addComponent(responseBodyRegexLabel).addComponent(enabledLabel)).addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(getNameTextField()).addComponent(getTypeTextField()).addComponent(getConfigurationTextField()).addComponent(getRequestUrlRegexTextField()).addComponent(getRequestHeaderRegexTextField()).addComponent(getResponseHeaderRegexTextField()).addComponent(getResponseBodyRegexTextField()).addComponent(getEnabledCheckBox())));
    layout.setVerticalGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(nameLabel).addComponent(getNameTextField())).addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(typeLabel).addComponent(getTypeTextField())).addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(configurationLabel).addComponent(getConfigurationTextField())).addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(requestUrlRegexLabel).addComponent(getRequestUrlRegexTextField())).addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(requestHeaderRegexLabel).addComponent(getRequestHeaderRegexTextField())).addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(responseHeaderRegexLabel).addComponent(getResponseHeaderRegexTextField())).addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(responseBodyRegexLabel).addComponent(getResponseBodyRegexTextField())).addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(enabledLabel).addComponent(getEnabledCheckBox())));
    return fieldsPanel;
}
Also used : JPanel(javax.swing.JPanel) GroupLayout(javax.swing.GroupLayout) JLabel(javax.swing.JLabel)

Aggregations

GroupLayout (javax.swing.GroupLayout)61 JPanel (javax.swing.JPanel)43 JLabel (javax.swing.JLabel)36 JButton (javax.swing.JButton)17 JScrollPane (javax.swing.JScrollPane)11 ActionEvent (java.awt.event.ActionEvent)9 ActionListener (java.awt.event.ActionListener)9 JCheckBox (javax.swing.JCheckBox)9 JTextField (javax.swing.JTextField)9 AfterInjection (org.baderlab.csplugins.enrichmentmap.AfterInjection)8 JFormattedTextField (javax.swing.JFormattedTextField)6 Dimension (java.awt.Dimension)5 JTable (javax.swing.JTable)5 Color (java.awt.Color)4 JRadioButton (javax.swing.JRadioButton)4 JSpinner (javax.swing.JSpinner)4 SpinnerNumberModel (javax.swing.SpinnerNumberModel)4 MouseEvent (java.awt.event.MouseEvent)3 PropertyChangeEvent (java.beans.PropertyChangeEvent)3 Arrays (java.util.Arrays)3