Search in sources :

Example 41 with GroupLayout

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

the class PostAnalysisWeightPanel method createRankTestSelectPanel.

@SuppressWarnings("unchecked")
private JPanel createRankTestSelectPanel() {
    JLabel testLabel = new JLabel(LABEL_TEST);
    JLabel cuttofLabel = new JLabel(LABEL_CUTOFF);
    JLabel dataSetLabel = new JLabel("Data Set:");
    DecimalFormat decFormat = new DecimalFormat();
    decFormat.setParseIntegerOnly(false);
    rankTestTextField = new JFormattedTextField(decFormat);
    rankTestTextField.setColumns(6);
    rankTestTextField.setHorizontalAlignment(JTextField.RIGHT);
    rankTestTextField.addPropertyChangeListener("value", e -> {
        StringBuilder message = new StringBuilder("The value you have entered is invalid.\n");
        Number number = (Number) rankTestTextField.getValue();
        PostAnalysisFilterType filterType = getFilterType();
        Optional<Double> value = PostAnalysisInputPanel.validateAndGetFilterValue(number, filterType, message);
        double def = filterType == PostAnalysisFilterType.HYPERGEOM ? HYPERGOM_DEFAULT : filterType.defaultValue;
        savedFilterValues.put(filterType, value.orElse(def));
        if (!value.isPresent()) {
            rankTestTextField.setValue(def);
            CySwingApplication application = serviceRegistrar.getService(CySwingApplication.class);
            JOptionPane.showMessageDialog(application.getJFrame(), message.toString(), "Parameter out of bounds", JOptionPane.WARNING_MESSAGE);
        }
    });
    rankingEnablementRenderer = new EnablementComboBoxRenderer<>();
    rankTestCombo = new JComboBox<>();
    rankTestCombo.setRenderer(rankingEnablementRenderer);
    rankTestCombo.addItem(PostAnalysisFilterType.MANN_WHIT_TWO_SIDED);
    rankTestCombo.addItem(PostAnalysisFilterType.MANN_WHIT_GREATER);
    rankTestCombo.addItem(PostAnalysisFilterType.MANN_WHIT_LESS);
    rankTestCombo.addItem(PostAnalysisFilterType.HYPERGEOM);
    rankTestCombo.addItem(PostAnalysisFilterType.NUMBER);
    rankTestCombo.addItem(PostAnalysisFilterType.PERCENT);
    rankTestCombo.addItem(PostAnalysisFilterType.SPECIFIC);
    rankTestCombo.addActionListener(e -> {
        PostAnalysisFilterType filterType = (PostAnalysisFilterType) rankTestCombo.getSelectedItem();
        rankTestTextField.setValue(savedFilterValues.get(filterType));
        CardLayout cardLayout = (CardLayout) cardPanel.getLayout();
        if (filterType.isMannWhitney() && map.getAllRanks().isEmpty())
            cardLayout.show(cardPanel, "warn");
        else
            cardLayout.show(cardPanel, filterType.name());
    });
    datasetCombo = new JComboBox<>();
    // Dataset model is already initialized
    datasetModel = new DefaultComboBoxModel<>();
    datasetCombo.setModel(datasetModel);
    datasetCombo.addActionListener(e -> {
        updateUniverseSize(getDataSet());
    });
    makeSmall(testLabel, cuttofLabel, rankTestCombo, rankTestTextField);
    makeSmall(dataSetLabel, datasetCombo);
    JPanel panel = new JPanel();
    final GroupLayout layout = new GroupLayout(panel);
    panel.setLayout(layout);
    layout.setAutoCreateContainerGaps(true);
    layout.setAutoCreateGaps(!LookAndFeelUtil.isAquaLAF());
    layout.setHorizontalGroup(layout.createParallelGroup(Alignment.CENTER, true).addGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(Alignment.TRAILING, true).addComponent(testLabel).addComponent(cuttofLabel).addComponent(dataSetLabel)).addGroup(layout.createParallelGroup(Alignment.LEADING, true).addComponent(rankTestCombo, DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE).addComponent(rankTestTextField, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE).addComponent(datasetCombo, DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE))));
    layout.setVerticalGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(Alignment.CENTER, false).addComponent(testLabel).addComponent(rankTestCombo, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE)).addGroup(layout.createParallelGroup(Alignment.CENTER, false).addComponent(cuttofLabel).addComponent(rankTestTextField, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE)).addPreferredGap(ComponentPlacement.UNRELATED).addGroup(layout.createParallelGroup(Alignment.CENTER, false).addComponent(dataSetLabel).addComponent(datasetCombo, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE)));
    if (LookAndFeelUtil.isAquaLAF())
        panel.setOpaque(false);
    return panel;
}
Also used : CardLayout(java.awt.CardLayout) JPanel(javax.swing.JPanel) PostAnalysisFilterType(org.baderlab.csplugins.enrichmentmap.model.PostAnalysisFilterType) CySwingApplication(org.cytoscape.application.swing.CySwingApplication) DecimalFormat(java.text.DecimalFormat) JFormattedTextField(javax.swing.JFormattedTextField) JLabel(javax.swing.JLabel) GroupLayout(javax.swing.GroupLayout)

Example 42 with GroupLayout

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

the class PostAnalysisKnownSignaturePanel method createContents.

@AfterInjection
private void createContents() {
    // Gene set file panel
    JPanel gmtPanel = createKnownSignatureGMTPanel();
    // Parameters collapsible panel
    weightPanel = new PostAnalysisWeightPanel(serviceRegistrar);
    final GroupLayout layout = new GroupLayout(this);
    setLayout(layout);
    layout.setAutoCreateContainerGaps(false);
    layout.setAutoCreateGaps(false);
    layout.setHorizontalGroup(layout.createParallelGroup(Alignment.CENTER, true).addComponent(gmtPanel, DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE).addComponent(weightPanel, DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE));
    layout.setVerticalGroup(layout.createSequentialGroup().addComponent(gmtPanel, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE).addComponent(weightPanel, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE));
}
Also used : JPanel(javax.swing.JPanel) GroupLayout(javax.swing.GroupLayout) AfterInjection(org.baderlab.csplugins.enrichmentmap.AfterInjection)

Example 43 with GroupLayout

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

the class PostAnalysisWeightPanel method createContents.

private void createContents() {
    setBorder(LookAndFeelUtil.createTitledBorder("Edge Weight Parameters"));
    JPanel selectPanel = createRankTestSelectPanel();
    JPanel hypergeomCard = createHypergeomPanel();
    JPanel mannWhittCard = createMannWhittPanel();
    JPanel warnCard = createWarningPanel();
    cardPanel = new JPanel(new CardLayout());
    cardPanel.add(mannWhittCard, PostAnalysisFilterType.MANN_WHIT_TWO_SIDED.name());
    cardPanel.add(mannWhittCard, PostAnalysisFilterType.MANN_WHIT_GREATER.name());
    cardPanel.add(mannWhittCard, PostAnalysisFilterType.MANN_WHIT_LESS.name());
    cardPanel.add(hypergeomCard, PostAnalysisFilterType.HYPERGEOM.name());
    cardPanel.add(createEmptyPanel(), PostAnalysisFilterType.PERCENT.name());
    cardPanel.add(createEmptyPanel(), PostAnalysisFilterType.NUMBER.name());
    cardPanel.add(createEmptyPanel(), PostAnalysisFilterType.SPECIFIC.name());
    cardPanel.add(warnCard, "warn");
    GroupLayout layout = new GroupLayout(this);
    setLayout(layout);
    layout.setAutoCreateContainerGaps(true);
    layout.setAutoCreateGaps(true);
    layout.setHorizontalGroup(layout.createParallelGroup(Alignment.CENTER, true).addComponent(selectPanel, DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE).addComponent(cardPanel, DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE));
    layout.setVerticalGroup(layout.createSequentialGroup().addComponent(selectPanel, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE).addComponent(cardPanel, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE));
    if (LookAndFeelUtil.isAquaLAF()) {
        setOpaque(false);
        cardPanel.setOpaque(false);
    }
}
Also used : JPanel(javax.swing.JPanel) CardLayout(java.awt.CardLayout) GroupLayout(javax.swing.GroupLayout)

Example 44 with GroupLayout

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

the class PostAnalysisWeightPanel method createMannWhittPanel.

private JPanel createMannWhittPanel() {
    JPanel panel = new JPanel();
    final GroupLayout layout = new GroupLayout(panel);
    panel.setLayout(layout);
    layout.setAutoCreateContainerGaps(true);
    layout.setAutoCreateGaps(!LookAndFeelUtil.isAquaLAF());
    if (LookAndFeelUtil.isAquaLAF())
        panel.setOpaque(false);
    return panel;
}
Also used : JPanel(javax.swing.JPanel) GroupLayout(javax.swing.GroupLayout)

Example 45 with GroupLayout

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

the class PostAnalysisWeightPanel method createWarningPanel.

private JPanel createWarningPanel() {
    JLabel iconLabel = new JLabel(IconManager.ICON_WARNING);
    iconLabel.setFont(serviceRegistrar.getService(IconManager.class).getIconFont(16.0f));
    iconLabel.setForeground(LookAndFeelUtil.getWarnColor());
    JLabel msgLabel = new JLabel("Mann-Whitney requires ranks.");
    JPanel panel = new JPanel();
    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(iconLabel, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE).addComponent(msgLabel, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE).addGap(0, 0, Short.MAX_VALUE));
    layout.setVerticalGroup(layout.createSequentialGroup().addGap(0, 0, Short.MAX_VALUE).addGroup(layout.createParallelGroup(Alignment.CENTER, false).addComponent(iconLabel).addComponent(msgLabel)).addGap(0, 0, Short.MAX_VALUE));
    if (LookAndFeelUtil.isAquaLAF())
        panel.setOpaque(false);
    return panel;
}
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