use of javax.swing.GroupLayout in project EnrichmentMapApp by BaderLab.
the class AddRanksDialog method createContents.
private void createContents() {
JPanel textFieldPanel = createTextFieldPanel();
JPanel buttonPanel = createButtonPanel();
Container contentPane = this.getContentPane();
GroupLayout layout = new GroupLayout(contentPane);
contentPane.setLayout(layout);
layout.setHorizontalGroup(layout.createParallelGroup().addComponent(textFieldPanel).addComponent(buttonPanel));
layout.setVerticalGroup(layout.createSequentialGroup().addComponent(textFieldPanel).addGap(0, 0, Short.MAX_VALUE).addComponent(buttonPanel));
}
use of javax.swing.GroupLayout in project EnrichmentMapApp by BaderLab.
the class ControlPanel method createContents.
@AfterInjection
private void createContents() {
setMinimumSize(new Dimension(390, 400));
setPreferredSize(new Dimension(390, 600));
JButton helpButton = SwingUtil.createOnlineHelpButton(EnrichmentMapBuildProperties.USER_MANUAL_URL, "Online Manual...", serviceRegistrar);
makeSmall(getAboutButton(), getClosePanelButton());
final GroupLayout layout = new GroupLayout(this);
setLayout(layout);
layout.setAutoCreateContainerGaps(LookAndFeelUtil.isWinLAF());
layout.setAutoCreateGaps(!LookAndFeelUtil.isAquaLAF());
layout.setHorizontalGroup(layout.createParallelGroup(CENTER, true).addGroup(layout.createSequentialGroup().addComponent(getEmViewCombo(), DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE).addPreferredGap(ComponentPlacement.RELATED).addComponent(getCreateEmButton(), PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE).addPreferredGap(ComponentPlacement.RELATED).addComponent(getOptionsButton(), PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE)).addComponent(getCtrlPanelsContainer(), DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE).addGroup(layout.createSequentialGroup().addComponent(helpButton, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE).addComponent(getAboutButton(), PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE).addGap(0, 0, Short.MAX_VALUE).addComponent(getClosePanelButton(), PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE)));
layout.setVerticalGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(CENTER, false).addComponent(getEmViewCombo(), PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE).addComponent(getCreateEmButton(), PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE).addComponent(getOptionsButton(), PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE)).addComponent(getCtrlPanelsContainer(), DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE).addGroup(layout.createParallelGroup(CENTER, false).addComponent(helpButton, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE).addComponent(getAboutButton(), PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE).addComponent(getClosePanelButton(), PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE)));
if (LookAndFeelUtil.isAquaLAF())
setOpaque(false);
}
use of javax.swing.GroupLayout in project EnrichmentMapApp by BaderLab.
the class DataSetSelector method init.
private void init() {
LookAndFeelUtil.equalizeSize(getAddButton(), getRemoveButton());
LookAndFeelUtil.equalizeSize(getSelectAllButton(), getSelectNoneButton());
final GroupLayout layout = new GroupLayout(this);
setLayout(layout);
layout.setAutoCreateContainerGaps(false);
layout.setAutoCreateGaps(!LookAndFeelUtil.isAquaLAF());
layout.setHorizontalGroup(layout.createParallelGroup(CENTER, true).addComponent(getTableScrollPane(), DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE).addGroup(layout.createSequentialGroup().addComponent(getAddButton(), PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE).addComponent(getRemoveButton(), PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE).addGap(20, 20, Short.MAX_VALUE).addComponent(getSelectAllButton(), PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE).addComponent(getSelectNoneButton(), PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE)));
layout.setVerticalGroup(layout.createSequentialGroup().addComponent(getTableScrollPane(), DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE).addGroup(layout.createParallelGroup(CENTER, false).addComponent(getAddButton(), DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE).addComponent(getRemoveButton(), DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE).addComponent(getSelectAllButton(), DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE).addComponent(getSelectNoneButton(), DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE)));
if (isAquaLAF())
setOpaque(false);
}
use of javax.swing.GroupLayout in project EnrichmentMapApp by BaderLab.
the class PostAnalysisKnownSignaturePanel method createKnownSignatureGMTPanel.
/**
* @return Panel for choosing and loading GMT and SignatureGMT Geneset-Files
*/
private JPanel createKnownSignatureGMTPanel() {
knownSignatureGMTFileNameTextField = new JFormattedTextField();
knownSignatureGMTFileNameTextField.setColumns(15);
knownSignatureGMTFileNameTextField.setToolTipText(Messages.GMT_INSTRUCTION);
final Color textFieldForeground = knownSignatureGMTFileNameTextField.getForeground();
knownSignatureGMTFileNameTextField.addPropertyChangeListener("value", new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent e) {
// if the text is red set it back to black as soon as the user starts typing
knownSignatureGMTFileNameTextField.setForeground(textFieldForeground);
}
});
JButton selectSigGMTFileButton = new JButton("Browse...");
selectSigGMTFileButton.setToolTipText(Messages.GMT_INSTRUCTION);
selectSigGMTFileButton.setActionCommand("Known Signature");
selectSigGMTFileButton.addActionListener(e -> {
parentPanel.chooseGMTFile(knownSignatureGMTFileNameTextField);
});
makeSmall(knownSignatureGMTFileNameTextField, selectSigGMTFileButton);
JPanel panel = new JPanel();
panel.setBorder(LookAndFeelUtil.createTitledBorder("SigGMT File (contains signature-genesets)"));
final GroupLayout layout = new GroupLayout(panel);
panel.setLayout(layout);
layout.setAutoCreateContainerGaps(true);
layout.setAutoCreateGaps(!LookAndFeelUtil.isAquaLAF());
layout.setHorizontalGroup(layout.createSequentialGroup().addComponent(knownSignatureGMTFileNameTextField, DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE).addComponent(selectSigGMTFileButton, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE));
layout.setVerticalGroup(layout.createParallelGroup(Alignment.CENTER, false).addComponent(knownSignatureGMTFileNameTextField, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE).addComponent(selectSigGMTFileButton));
if (LookAndFeelUtil.isAquaLAF())
panel.setOpaque(false);
return panel;
}
use of javax.swing.GroupLayout in project EnrichmentMapApp by BaderLab.
the class PostAnalysisSignatureDiscoveryPanel method createSignatureDiscoveryGMTPanel.
/**
* @return Panel for choosing and loading GMT and SignatureGMT Geneset-Files
*/
private JPanel createSignatureDiscoveryGMTPanel() {
signatureDiscoveryGMTFileNameTextField = new JFormattedTextField();
signatureDiscoveryGMTFileNameTextField.setColumns(15);
signatureDiscoveryGMTFileNameTextField.setToolTipText(Messages.GMT_INSTRUCTION);
final Color textFieldForeground = signatureDiscoveryGMTFileNameTextField.getForeground();
signatureDiscoveryGMTFileNameTextField.addPropertyChangeListener("value", (PropertyChangeEvent e) -> {
// if the text is red set it back to black as soon as the user starts typing
signatureDiscoveryGMTFileNameTextField.setForeground(textFieldForeground);
});
JButton selectSigGMTFileButton = new JButton("Browse...");
selectSigGMTFileButton.setToolTipText(Messages.GMT_INSTRUCTION);
selectSigGMTFileButton.setActionCommand("Signature Discovery");
selectSigGMTFileButton.addActionListener((ActionEvent evt) -> {
parentPanel.chooseGMTFile(signatureDiscoveryGMTFileNameTextField);
});
JLabel filterLabel = new JLabel("Filter:");
filterTextField = new JFormattedTextField();
filterTextField.setColumns(4);
filterTextField.setHorizontalAlignment(JTextField.RIGHT);
filterTextField.addPropertyChangeListener("value", (PropertyChangeEvent e) -> {
StringBuilder message = new StringBuilder("The value you have entered is invalid.\n");
Number number = (Number) filterTextField.getValue();
PostAnalysisFilterType filterType = getFilterType();
Optional<Double> value = PostAnalysisInputPanel.validateAndGetFilterValue(number, filterType, message);
savedFilterValues.put(filterType, value.orElse(filterType.defaultValue));
if (!value.isPresent()) {
filterTextField.setValue(filterType.defaultValue);
JOptionPane.showMessageDialog(application.getJFrame(), message.toString(), "Parameter out of bounds", JOptionPane.WARNING_MESSAGE);
}
});
// Types of filters:
// 1. filter by percent, i.e. the overlap between the signature geneset and EM geneset
// has to be X percentage of the EM set it overlaps with for at least one geneset in the enrichment map.
// 2. filter by number, i.e. the overlap between the signature geneset and EM geneset
// has to be X genes of the EM set it overlaps with for at least one geneset in the enrichment map.
// 3. filter by specificity, i.e looking for the signature genesets that are more specific than other genesets
// for instance a drug A that targets only X and Y as opposed to drug B that targets X,y,L,M,N,O,P.
filterTypeCombo = new JComboBox<>();
// default
filterTypeCombo.addItem(PostAnalysisFilterType.NO_FILTER);
// filterTypeCombo.addItem(PostAnalysisFilterType.MANN_WHIT_TWO_SIDED);
// filterTypeCombo.addItem(PostAnalysisFilterType.MANN_WHIT_GREATER);
// filterTypeCombo.addItem(PostAnalysisFilterType.MANN_WHIT_LESS);
filterTypeCombo.addItem(PostAnalysisFilterType.HYPERGEOM);
filterTypeCombo.addItem(PostAnalysisFilterType.NUMBER);
filterTypeCombo.addItem(PostAnalysisFilterType.PERCENT);
filterTypeCombo.addItem(PostAnalysisFilterType.SPECIFIC);
filterTypeCombo.addActionListener(e -> {
updateFilterTextField();
});
updateFilterTextField();
//TODO: Maybe move loading SigGMT to File-selection Event add load button
JButton loadButton = new JButton();
loadButton.setText("Load Gene Sets");
loadButton.addActionListener(e -> {
String filePath = (String) signatureDiscoveryGMTFileNameTextField.getValue();
if (filePath == null || PostAnalysisInputPanel.checkFile(filePath).equals(Color.RED)) {
String message = "Signature GMT file name not valid.\n";
signatureDiscoveryGMTFileNameTextField.setForeground(Color.RED);
JOptionPane.showMessageDialog(application.getJFrame(), message, "Post Analysis Known Signature", JOptionPane.WARNING_MESSAGE);
return;
}
if (!EnrichmentMapParameters.checkFile(filePath)) {
String message = "Signature GMT does not exist.\n";
signatureDiscoveryGMTFileNameTextField.setForeground(Color.RED);
JOptionPane.showMessageDialog(application.getJFrame(), message, "Post Analysis Known Signature", JOptionPane.WARNING_MESSAGE);
return;
}
FilterMetric filterMetric = createFilterMetric();
LoadSignatureSetsActionListener action = loadSignatureSetsActionListenerFactory.create(new File(filePath), filterMetric, parentPanel.getEnrichmentMap());
action.setGeneSetCallback(gs -> {
this.signatureGenesets = gs;
});
action.setFilteredSignatureSetsCallback(selected -> {
availSigSetsModel.clear();
selectedSigSetsModel.clear();
for (String name : selected) availSigSetsModel.addElement(name);
update();
});
action.actionPerformed(null);
});
makeSmall(signatureDiscoveryGMTFileNameTextField, selectSigGMTFileButton);
makeSmall(filterLabel, filterTypeCombo, filterTextField);
makeSmall(loadButton);
JPanel panel = new JPanel();
panel.setBorder(LookAndFeelUtil.createTitledBorder("SigGMT File (contains signature-genesets)"));
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().addComponent(signatureDiscoveryGMTFileNameTextField, DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE).addComponent(selectSigGMTFileButton, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE)).addGroup(layout.createSequentialGroup().addComponent(filterLabel, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE).addComponent(filterTypeCombo, DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE).addComponent(filterTextField, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE)).addComponent(loadButton, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE));
layout.setVerticalGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(Alignment.CENTER, false).addComponent(signatureDiscoveryGMTFileNameTextField, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE).addComponent(selectSigGMTFileButton)).addGroup(layout.createParallelGroup(Alignment.CENTER, false).addComponent(filterLabel, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE).addComponent(filterTypeCombo, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE).addComponent(filterTextField, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE)).addComponent(loadButton, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE));
if (LookAndFeelUtil.isAquaLAF())
panel.setOpaque(false);
return panel;
}
Aggregations