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));
}
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;
}
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;
}
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();
}
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();
}
Aggregations