Search in sources :

Example 31 with GroupLayout

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

the class CutoffPropertiesPanel method createFilterNodesPanel.

private JPanel createFilterNodesPanel() {
    JPanel panel = new JPanel();
    panel.setBorder(LookAndFeelUtil.createTitledBorder("Gene-Set Filtering (Nodes)"));
    pvalueLabel = new JLabel("p-value cutoff:");
    JLabel qvalueLabel = new JLabel("FDR q-value cutoff:");
    nesFilterLabel = new JLabel("NES:");
    shouldFilterMinLabel = new JLabel("Filter by minimum experiments:");
    minExperimentsLabel = new JLabel("Minimum experiments:");
    SwingUtil.makeSmall(qvalueLabel, pvalueLabel, minExperimentsLabel, shouldFilterMinLabel, nesFilterLabel);
    AbstractFormatterFactory formatterFactory = getFormatterFactory(false);
    pvalueText = new JFormattedTextField(formatterFactory);
    qvalueText = new JFormattedTextField(formatterFactory);
    shouldFilterMinCheckbox = new JCheckBox("");
    minExperimentsText = new JFormattedTextField(NumberFormat.getIntegerInstance());
    pvalueText.setValue(propertyManager.getDefaultPvalue());
    qvalueText.setValue(propertyManager.getDefaultQvalue());
    minExperimentsText.setValue(3);
    nesFilterCombo = new JComboBox<>();
    nesFilterCombo.addItem(new ComboItem<>(NESFilter.ALL, "All"));
    nesFilterCombo.addItem(new ComboItem<>(NESFilter.POSITIVE, "Positive"));
    nesFilterCombo.addItem(new ComboItem<>(NESFilter.NEGATIVE, "Negative"));
    nesFilterCombo.setSelectedItem(ComboItem.of(NESFilter.ALL));
    minExperimentsLabel.setEnabled(false);
    minExperimentsText.setEnabled(false);
    showAdvancedOptions(false);
    shouldFilterMinCheckbox.addActionListener(e -> {
        boolean enable = shouldFilterMinCheckbox.isSelected();
        minExperimentsLabel.setEnabled(enable);
        minExperimentsText.setEnabled(enable);
    });
    SwingUtil.makeSmall(pvalueText, qvalueText, shouldFilterMinCheckbox, nesFilterCombo, minExperimentsText);
    final GroupLayout layout = new GroupLayout(panel);
    panel.setLayout(layout);
    layout.setAutoCreateContainerGaps(true);
    layout.setAutoCreateGaps(true);
    layout.setHorizontalGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(Alignment.TRAILING).addComponent(qvalueLabel).addComponent(pvalueLabel).addComponent(nesFilterLabel).addComponent(shouldFilterMinLabel).addComponent(minExperimentsLabel)).addGroup(layout.createParallelGroup(Alignment.LEADING).addComponent(qvalueText, PREFERRED_SIZE, 100, PREFERRED_SIZE).addComponent(pvalueText, PREFERRED_SIZE, 100, PREFERRED_SIZE).addComponent(nesFilterCombo).addComponent(shouldFilterMinCheckbox).addComponent(minExperimentsText, PREFERRED_SIZE, 100, PREFERRED_SIZE)).addGap(0, 0, Short.MAX_VALUE));
    layout.setVerticalGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(Alignment.BASELINE).addComponent(qvalueLabel).addComponent(qvalueText)).addGroup(layout.createParallelGroup(Alignment.BASELINE).addComponent(pvalueLabel).addComponent(pvalueText)).addGroup(layout.createParallelGroup(Alignment.BASELINE).addComponent(nesFilterLabel).addComponent(nesFilterCombo)).addGroup(layout.createParallelGroup(Alignment.CENTER).addComponent(shouldFilterMinLabel).addComponent(shouldFilterMinCheckbox)).addGroup(layout.createParallelGroup(Alignment.BASELINE).addComponent(minExperimentsLabel).addComponent(minExperimentsText)).addGap(0, 0, Short.MAX_VALUE));
    if (LookAndFeelUtil.isAquaLAF())
        panel.setOpaque(false);
    return panel;
}
Also used : JCheckBox(javax.swing.JCheckBox) JPanel(javax.swing.JPanel) JFormattedTextField(javax.swing.JFormattedTextField) GroupLayout(javax.swing.GroupLayout) JLabel(javax.swing.JLabel) AbstractFormatterFactory(javax.swing.JFormattedTextField.AbstractFormatterFactory)

Example 32 with GroupLayout

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

the class CutoffPropertiesPanel method createContents.

@AfterInjection
public void createContents() {
    cutoffValues = new EnumMap<>(SimilarityMetric.class);
    cutoffValues.put(SimilarityMetric.JACCARD, propertyManager.getDefaultCutOff(SimilarityMetric.JACCARD));
    cutoffValues.put(SimilarityMetric.OVERLAP, propertyManager.getDefaultCutOff(SimilarityMetric.OVERLAP));
    cutoffValues.put(SimilarityMetric.COMBINED, propertyManager.getDefaultCutOff(SimilarityMetric.COMBINED));
    setBorder(LookAndFeelUtil.createPanelBorder());
    JPanel filterNodesPanel = createFilterNodesPanel();
    JPanel filterEdgesPanel = createFilterEdgesPanel();
    notationCheckBox = new JCheckBox("Scientific Notation");
    notationCheckBox.addActionListener(e -> {
        boolean scientific = notationCheckBox.isSelected();
        AbstractFormatterFactory factory = getFormatterFactory(scientific);
        pvalueText.setFormatterFactory(factory);
        qvalueText.setFormatterFactory(factory);
        similarityCutoffText.setFormatterFactory(factory);
    });
    advancedCheckBox = new JCheckBox("Show Advanced Options");
    advancedCheckBox.addActionListener(e -> showAdvancedOptions(advancedCheckBox.isSelected()));
    SwingUtil.makeSmall(notationCheckBox, advancedCheckBox);
    final GroupLayout layout = new GroupLayout(this);
    setLayout(layout);
    layout.setAutoCreateContainerGaps(true);
    layout.setAutoCreateGaps(true);
    layout.setHorizontalGroup(layout.createParallelGroup().addGroup(layout.createSequentialGroup().addComponent(filterNodesPanel).addComponent(filterEdgesPanel)).addGroup(layout.createSequentialGroup().addGap(0, 0, Short.MAX_VALUE).addComponent(notationCheckBox).addGap(10).addComponent(advancedCheckBox)));
    layout.setVerticalGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup().addComponent(filterNodesPanel).addComponent(filterEdgesPanel)).addGroup(layout.createParallelGroup().addComponent(notationCheckBox).addComponent(advancedCheckBox)));
}
Also used : JCheckBox(javax.swing.JCheckBox) JPanel(javax.swing.JPanel) GroupLayout(javax.swing.GroupLayout) SimilarityMetric(org.baderlab.csplugins.enrichmentmap.model.EMCreationParameters.SimilarityMetric) AbstractFormatterFactory(javax.swing.JFormattedTextField.AbstractFormatterFactory) AfterInjection(org.baderlab.csplugins.enrichmentmap.AfterInjection)

Example 33 with GroupLayout

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

the class EditCommonPanel method createContents.

@AfterInjection
private void createContents() {
    gmtText = pathTextFactory.create("GMT File:", FileBrowser.Filter.GMT);
    expressionsText = pathTextFactory.create("Expressions:", FileBrowser.Filter.EXPRESSION);
    GroupLayout layout = new GroupLayout(this);
    setLayout(layout);
    layout.setAutoCreateContainerGaps(true);
    layout.setAutoCreateGaps(true);
    layout.setHorizontalGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(Alignment.TRAILING).addComponent(gmtText.getLabel()).addComponent(expressionsText.getLabel())).addGroup(layout.createParallelGroup(Alignment.LEADING, true).addComponent(gmtText.getTextField()).addComponent(expressionsText.getTextField())).addGroup(layout.createParallelGroup().addComponent(gmtText.getBrowseButton()).addComponent(expressionsText.getBrowseButton())));
    layout.setVerticalGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(Alignment.BASELINE).addComponent(gmtText.getLabel()).addComponent(gmtText.getTextField()).addComponent(gmtText.getBrowseButton())).addGroup(layout.createParallelGroup(Alignment.BASELINE).addComponent(expressionsText.getLabel()).addComponent(expressionsText.getTextField()).addComponent(expressionsText.getBrowseButton())));
    if (LookAndFeelUtil.isAquaLAF())
        setOpaque(false);
}
Also used : GroupLayout(javax.swing.GroupLayout) AfterInjection(org.baderlab.csplugins.enrichmentmap.AfterInjection)

Example 34 with GroupLayout

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

the class EditDataSetPanel method createBody.

private void createBody() {
    nameText = pathTextFactory.create("* Name:", null);
    nameText.getTextField().getDocument().addDocumentListener(SwingUtil.simpleDocumentListener(() -> firePropertyChange(PROP_NAME, null, getDisplayName())));
    JLabel analysisLabel = new JLabel("* Analysis Type:");
    analysisTypeCombo = new JComboBox<>();
    analysisTypeCombo.addItem(new ComboItem<>(Method.GSEA, Method.GSEA.getLabel()));
    analysisTypeCombo.addItem(new ComboItem<>(Method.Generic, Method.Generic.getLabel()));
    analysisTypeCombo.addItem(new ComboItem<>(Method.Specialized, Method.Specialized.getLabel()));
    analysisTypeCombo.addActionListener(e -> {
        analysisTypeChanged();
        firePropertyChange(PROP_NAME, null, getDisplayName());
    });
    makeSmall(analysisLabel, analysisTypeCombo);
    enrichments1Text = pathTextFactory.create("* Enrichments:", FileBrowser.Filter.ENRICHMENT);
    enrichments2Text = pathTextFactory.create("Enrichments Neg:", FileBrowser.Filter.ENRICHMENT);
    gmtText = pathTextFactory.create("GMT:", FileBrowser.Filter.GMT);
    expressionsText = pathTextFactory.create("Expressions:", FileBrowser.Filter.EXPRESSION);
    ranksText = pathTextFactory.create("Ranks:", FileBrowser.Filter.RANK);
    classesText = pathTextFactory.create("Classes:", FileBrowser.Filter.CLASS);
    classesText.getTextField().getDocument().addDocumentListener(SwingUtil.simpleDocumentListener(this::updateClasses));
    enrichments2Text.getLabel().setVisible(false);
    enrichments2Text.getTextField().setVisible(false);
    enrichments2Text.getBrowseButton().setVisible(false);
    JLabel phenotypesLabel = new JLabel("Phenotypes:");
    JLabel positive = new JLabel("  Positive:");
    JLabel negative = new JLabel("Negative:");
    positiveText = new JTextField();
    negativeText = new JTextField();
    makeSmall(phenotypesLabel, positive, negative, positiveText, negativeText);
    GroupLayout layout = new GroupLayout(this);
    setLayout(layout);
    layout.setAutoCreateContainerGaps(true);
    layout.setAutoCreateGaps(true);
    layout.setHorizontalGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(Alignment.TRAILING).addComponent(nameText.getLabel()).addComponent(analysisLabel).addComponent(enrichments1Text.getLabel()).addComponent(enrichments2Text.getLabel()).addComponent(expressionsText.getLabel()).addComponent(gmtText.getLabel()).addComponent(ranksText.getLabel()).addComponent(classesText.getLabel()).addComponent(phenotypesLabel)).addGroup(layout.createParallelGroup(Alignment.LEADING, true).addComponent(nameText.getTextField(), 0, DEFAULT_SIZE, Short.MAX_VALUE).addComponent(analysisTypeCombo, 0, DEFAULT_SIZE, Short.MAX_VALUE).addComponent(enrichments1Text.getTextField(), 0, DEFAULT_SIZE, Short.MAX_VALUE).addComponent(enrichments2Text.getTextField(), 0, DEFAULT_SIZE, Short.MAX_VALUE).addComponent(expressionsText.getTextField(), 0, DEFAULT_SIZE, Short.MAX_VALUE).addComponent(gmtText.getTextField(), 0, DEFAULT_SIZE, Short.MAX_VALUE).addComponent(ranksText.getTextField(), 0, DEFAULT_SIZE, Short.MAX_VALUE).addComponent(classesText.getTextField(), 0, DEFAULT_SIZE, Short.MAX_VALUE).addGroup(layout.createSequentialGroup().addComponent(positive).addComponent(positiveText, 90, 90, Short.MAX_VALUE).addGap(10).addComponent(negative).addComponent(negativeText, 90, 90, Short.MAX_VALUE))).addGroup(layout.createParallelGroup().addComponent(enrichments1Text.getBrowseButton()).addComponent(enrichments2Text.getBrowseButton()).addComponent(expressionsText.getBrowseButton()).addComponent(gmtText.getBrowseButton()).addComponent(ranksText.getBrowseButton()).addComponent(classesText.getBrowseButton())));
    layout.setVerticalGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(Alignment.BASELINE).addComponent(nameText.getLabel()).addComponent(nameText.getTextField())).addGroup(layout.createParallelGroup(Alignment.BASELINE).addComponent(analysisLabel).addComponent(analysisTypeCombo)).addGroup(layout.createParallelGroup(Alignment.BASELINE).addComponent(enrichments1Text.getLabel()).addComponent(enrichments1Text.getTextField()).addComponent(enrichments1Text.getBrowseButton())).addGroup(layout.createParallelGroup(Alignment.BASELINE).addComponent(enrichments2Text.getLabel()).addComponent(enrichments2Text.getTextField()).addComponent(enrichments2Text.getBrowseButton())).addGroup(layout.createParallelGroup(Alignment.BASELINE).addComponent(expressionsText.getLabel()).addComponent(expressionsText.getTextField()).addComponent(expressionsText.getBrowseButton())).addGroup(layout.createParallelGroup(Alignment.BASELINE).addComponent(gmtText.getLabel()).addComponent(gmtText.getTextField()).addComponent(gmtText.getBrowseButton())).addGroup(layout.createParallelGroup(Alignment.BASELINE).addComponent(ranksText.getLabel()).addComponent(ranksText.getTextField()).addComponent(ranksText.getBrowseButton())).addGroup(layout.createParallelGroup(Alignment.BASELINE).addComponent(classesText.getLabel()).addComponent(classesText.getTextField()).addComponent(classesText.getBrowseButton())).addGroup(layout.createParallelGroup(Alignment.BASELINE).addComponent(phenotypesLabel).addComponent(positive).addComponent(positiveText, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE).addComponent(negative).addComponent(negativeText, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE)));
    if (LookAndFeelUtil.isAquaLAF())
        setOpaque(false);
}
Also used : GroupLayout(javax.swing.GroupLayout) JLabel(javax.swing.JLabel) JTextField(javax.swing.JTextField)

Example 35 with GroupLayout

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

the class AddRanksDialog method createTextFieldPanel.

private JPanel createTextFieldPanel() {
    JLabel ranksNameLabel = new JLabel("Ranks Name:");
    ranksNameText = new JTextField();
    textFieldForeground = ranksNameText.getForeground();
    ranksNameText.setText("MyRanks");
    ranksNameText.addFocusListener(new FocusValidator(ranksNameText));
    JLabel ranksFileLabel = new JLabel("Ranks File:");
    ranksFileText = new JTextField();
    JButton ranksBrowse = new JButton("Browse...");
    ranksFileText.addFocusListener(new FocusValidator(ranksFileText));
    ranksBrowse.addActionListener(e -> browse(ranksFileText, FileBrowser.Filter.RANK));
    JLabel datasetLabel = new JLabel("Data Set:");
    dataSetCombo = new JComboBox<>();
    for (EMDataSet dataset : map.getDataSetList()) {
        dataSetCombo.addItem(new ComboItem<>(dataset, dataset.getName()));
    }
    SwingUtil.makeSmall(ranksNameLabel, ranksNameText, ranksFileLabel, ranksFileText, ranksBrowse, datasetLabel, dataSetCombo);
    JPanel panel = new JPanel();
    GroupLayout layout = new GroupLayout(panel);
    panel.setLayout(layout);
    layout.setAutoCreateContainerGaps(true);
    layout.setAutoCreateGaps(true);
    layout.setHorizontalGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(Alignment.TRAILING).addComponent(ranksNameLabel).addComponent(ranksFileLabel).addComponent(datasetLabel)).addGroup(layout.createParallelGroup(Alignment.LEADING, true).addComponent(ranksNameText, 0, DEFAULT_SIZE, Short.MAX_VALUE).addComponent(ranksFileText, 0, DEFAULT_SIZE, Short.MAX_VALUE).addComponent(dataSetCombo, 0, DEFAULT_SIZE, Short.MAX_VALUE)).addGroup(layout.createParallelGroup().addComponent(ranksBrowse)));
    layout.setVerticalGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(Alignment.BASELINE).addComponent(ranksNameLabel).addComponent(ranksNameText)).addGroup(layout.createParallelGroup(Alignment.BASELINE).addComponent(ranksFileLabel).addComponent(ranksFileText).addComponent(ranksBrowse)).addGroup(layout.createParallelGroup(Alignment.BASELINE).addComponent(datasetLabel).addComponent(dataSetCombo)));
    if (LookAndFeelUtil.isAquaLAF())
        panel.setOpaque(false);
    return panel;
}
Also used : JPanel(javax.swing.JPanel) JButton(javax.swing.JButton) GroupLayout(javax.swing.GroupLayout) JLabel(javax.swing.JLabel) EMDataSet(org.baderlab.csplugins.enrichmentmap.model.EMDataSet) JTextField(javax.swing.JTextField)

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