Search in sources :

Example 36 with GroupLayout

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

the class PostAnalysisSignatureDiscoveryPanel method createContents.

@AfterInjection
private void createContents() {
    JPanel gmtPanel = createSignatureDiscoveryGMTPanel();
    JPanel sigGenesetsPanel = createSignatureGenesetsPanel();
    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(sigGenesetsPanel, 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(sigGenesetsPanel, 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 37 with GroupLayout

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

the class PostAnalysisSignatureDiscoveryPanel method createSignatureGenesetsPanel.

private JPanel createSignatureGenesetsPanel() {
    // List of all Signature Genesets
    availableLabel = new JLabel();
    setAvSigCount(0);
    availSigSetsField = new JList<>(availSigSetsModel);
    JScrollPane availSigSetsScroll = new JScrollPane(availSigSetsField, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    // List of selected Signature Genesets
    selectedLabel = new JLabel();
    setSelSigCount(0);
    selectedSigSetsField = new JList<>(selectedSigSetsModel);
    JScrollPane selectedSigSetsScroll = new JScrollPane(selectedSigSetsField, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    Dimension d = new Dimension(360, 86);
    availSigSetsScroll.setPreferredSize(d);
    selectedSigSetsScroll.setPreferredSize(d);
    // Selection Buttons
    Font selectBtnFont = iconManager.getIconFont(14.0f);
    addSelectedButton = new JButton(IconManager.ICON_ANGLE_DOWN);
    addSelectedButton.setToolTipText("Add Selected");
    addSelectedButton.setFont(selectBtnFont);
    addSelectedButton.setEnabled(false);
    removeSelectedButton = new JButton(IconManager.ICON_ANGLE_UP);
    removeSelectedButton.setToolTipText("Remove Selected");
    removeSelectedButton.setFont(selectBtnFont);
    removeSelectedButton.setEnabled(false);
    addSelectedButton.addActionListener(e -> {
        int[] selected = availSigSetsField.getSelectedIndices();
        for (int i = selected.length; i > 0; i--) {
            selectedSigSetsModel.addElement(availSigSetsModel.get(selected[i - 1]));
            availSigSetsModel.remove(selected[i - 1]);
        }
        setSelSigCount(selectedSigSetsModel.size());
        setAvSigCount(availSigSetsModel.size());
    });
    removeSelectedButton.addActionListener(e -> {
        int[] selected = selectedSigSetsField.getSelectedIndices();
        for (int i = selected.length; i > 0; i--) {
            availSigSetsModel.addElement(selectedSigSetsModel.get(selected[i - 1]));
            selectedSigSetsModel.remove(selected[i - 1]);
        }
        List<String> setNamesArray = Collections.list(availSigSetsModel.elements());
        Collections.sort(setNamesArray);
        availSigSetsModel.removeAllElements();
        for (String name : setNamesArray) {
            availSigSetsModel.addElement(name);
        }
        setAvSigCount(availSigSetsModel.size());
        setSelSigCount(selectedSigSetsModel.size());
    });
    if (LookAndFeelUtil.isAquaLAF()) {
        addSelectedButton.putClientProperty("JButton.buttonType", "gradient");
        removeSelectedButton.putClientProperty("JButton.buttonType", "gradient");
    }
    availSigSetsField.addListSelectionListener(this);
    selectedSigSetsField.addListSelectionListener(this);
    JButton clearButton = new JButton("Clear Signature Gene Sets");
    clearButton.addActionListener(e -> {
        availSigSetsModel.clear();
        availSigSetsField.clearSelection();
        setAvSigCount(0);
        selectedSigSetsModel.clear();
        selectedSigSetsField.clearSelection();
        setSelSigCount(0);
    });
    makeSmall(availableLabel, availSigSetsField, availSigSetsScroll);
    makeSmall(selectedLabel, selectedSigSetsField, selectedSigSetsScroll);
    makeSmall(addSelectedButton, removeSelectedButton, clearButton);
    JPanel panel = new JPanel();
    panel.setBorder(LookAndFeelUtil.createTitledBorder("Signature Gene Sets"));
    final GroupLayout layout = new GroupLayout(panel);
    panel.setLayout(layout);
    layout.setAutoCreateContainerGaps(true);
    layout.setAutoCreateGaps(!LookAndFeelUtil.isAquaLAF());
    layout.setHorizontalGroup(layout.createParallelGroup(Alignment.LEADING, true).addComponent(availableLabel).addComponent(availSigSetsScroll, DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE).addGroup(layout.createSequentialGroup().addGap(0, 0, Short.MAX_VALUE).addComponent(addSelectedButton, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE).addComponent(removeSelectedButton, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE).addGap(0, 0, Short.MAX_VALUE)).addComponent(selectedSigSetsScroll, DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE).addComponent(selectedLabel).addGroup(layout.createSequentialGroup().addGap(0, 0, Short.MAX_VALUE).addComponent(clearButton, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE).addGap(0, 0, Short.MAX_VALUE)));
    layout.setVerticalGroup(layout.createSequentialGroup().addComponent(availableLabel).addComponent(availSigSetsScroll, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE).addGroup(layout.createParallelGroup(Alignment.CENTER, false).addComponent(addSelectedButton, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE).addComponent(removeSelectedButton, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE)).addComponent(selectedSigSetsScroll, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE).addComponent(selectedLabel).addComponent(clearButton, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE));
    if (LookAndFeelUtil.isAquaLAF())
        panel.setOpaque(false);
    return panel;
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) JButton(javax.swing.JButton) GroupLayout(javax.swing.GroupLayout) JLabel(javax.swing.JLabel) Dimension(java.awt.Dimension) Font(java.awt.Font)

Example 38 with GroupLayout

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

the class LegendPanel method getEdgeLegendPanel.

BasicCollapsiblePanel getEdgeLegendPanel() {
    if (edgeLegendPanel == null) {
        edgeLegendPanel = new BasicCollapsiblePanel("Edges (Similarity Between Gene Sets)");
        edgeLegendPanel.setCollapsed(false);
        final GroupLayout layout = new GroupLayout(edgeLegendPanel.getContentPane());
        edgeLegendPanel.getContentPane().setLayout(layout);
        layout.setAutoCreateContainerGaps(false);
        layout.setAutoCreateGaps(true);
        layout.setHorizontalGroup(layout.createParallelGroup(Alignment.CENTER, true).addComponent(getEdgeColorPanel(), DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE));
        layout.setVerticalGroup(layout.createSequentialGroup().addComponent(getEdgeColorPanel(), PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE));
        if (isAquaLAF())
            edgeLegendPanel.setOpaque(false);
    }
    return edgeLegendPanel;
}
Also used : BasicCollapsiblePanel(org.cytoscape.util.swing.BasicCollapsiblePanel) GroupLayout(javax.swing.GroupLayout)

Example 39 with GroupLayout

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

the class LegendPanel method update.

/**
	 * Update parameters panel based on given enrichment map parameters
	 * @param chartType 
	 */
void update(EMStyleOptions options, Collection<EMDataSet> filteredDataSets) {
    this.options = options;
    CyNetworkView networkView = options != null ? options.getNetworkView() : null;
    removeAll();
    EnrichmentMap map = networkView != null ? emManager.getEnrichmentMap(networkView.getModel().getSUID()) : null;
    EMCreationParameters params = map != null ? map.getParams() : null;
    if (params == null) {
        JLabel infoLabel = new JLabel("No EnrichmentMap View selected");
        infoLabel.setEnabled(false);
        infoLabel.setForeground(UIManager.getColor("Label.disabledForeground"));
        infoLabel.setHorizontalAlignment(JLabel.CENTER);
        infoLabel.setVerticalAlignment(JLabel.CENTER);
        infoLabel.setBorder(new EmptyBorder(120, 40, 120, 40));
        add(infoLabel, BorderLayout.CENTER);
    } else {
        nodeLegendPanel = null;
        nodeColorPanel = null;
        nodeShapePanel = null;
        nodeChartPanel = null;
        edgeLegendPanel = null;
        edgeColorPanel = null;
        updateNodeColorPanel(filteredDataSets, map);
        updateNodeShapePanel(map);
        updateNodeChartPanel(filteredDataSets, map);
        updateEdgeColorPanel(map);
        JPanel panel = new JPanel();
        final GroupLayout layout = new GroupLayout(panel);
        panel.setLayout(layout);
        layout.setAutoCreateContainerGaps(true);
        layout.setAutoCreateGaps(true);
        layout.setHorizontalGroup(layout.createParallelGroup(Alignment.CENTER, true).addComponent(getNodeLegendPanel(), DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE).addComponent(getEdgeLegendPanel(), DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE));
        layout.setVerticalGroup(layout.createSequentialGroup().addComponent(getNodeLegendPanel(), PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE).addComponent(getEdgeLegendPanel(), PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE));
        JScrollPane scrollPane = new JScrollPane(panel);
        add(scrollPane, BorderLayout.CENTER);
    }
    revalidate();
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) EMCreationParameters(org.baderlab.csplugins.enrichmentmap.model.EMCreationParameters) GroupLayout(javax.swing.GroupLayout) JLabel(javax.swing.JLabel) EnrichmentMap(org.baderlab.csplugins.enrichmentmap.model.EnrichmentMap) EmptyBorder(javax.swing.border.EmptyBorder) CyNetworkView(org.cytoscape.view.model.CyNetworkView)

Example 40 with GroupLayout

use of javax.swing.GroupLayout 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();
}
Also used : ParallelGroup(javax.swing.GroupLayout.ParallelGroup) SequentialGroup(javax.swing.GroupLayout.SequentialGroup) GroupLayout(javax.swing.GroupLayout) JComponent(javax.swing.JComponent)

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