Skip to content

Commit 2ef340e

Browse files
committed
Changes to create dialog to make more usable, new [+ Add...] button
1 parent bdce386 commit 2ef340e

File tree

8 files changed

+227
-158
lines changed

8 files changed

+227
-158
lines changed

EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/view/control/DataSetSelector.java

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
import org.baderlab.csplugins.enrichmentmap.model.EnrichmentMap;
5151
import org.baderlab.csplugins.enrichmentmap.style.EMStyleBuilder;
5252
import org.baderlab.csplugins.enrichmentmap.view.postanalysis.PADialogMediator;
53+
import org.baderlab.csplugins.enrichmentmap.view.util.SwingUtil;
5354
import org.cytoscape.util.swing.IconManager;
5455
import org.cytoscape.util.swing.LookAndFeelUtil;
5556

@@ -413,20 +414,12 @@ JMenuItem getSyncPropMenuItem() {
413414

414415
JButton getOptionsButton() {
415416
if (optionButton == null) {
416-
optionButton = new JButton("Options...");
417-
makeSmall(optionButton);
418-
if (isAquaLAF())
419-
optionButton.putClientProperty("JButton.buttonType", "gradient");
420-
421-
optionButton.addActionListener(e -> {
422-
getOptionsMenu().show(optionButton, 0, optionButton.getHeight());
423-
});
417+
optionButton = SwingUtil.createMenuButton("Options...", this::fillOptionsMenu);
424418
}
425419
return optionButton;
426420
}
427421

428-
private JPopupMenu getOptionsMenu() {
429-
JPopupMenu menu = new JPopupMenu();
422+
private void fillOptionsMenu(JPopupMenu menu) {
430423
menu.add(getAddMenuItem());
431424
menu.add(getDataSetColorMenuItem());
432425
menu.addSeparator();
@@ -436,10 +429,7 @@ private JPopupMenu getOptionsMenu() {
436429
menu.add(getSelectNodesMenuItem());
437430
menu.add(getDeleteSignatureMenuItem());
438431
menu.add(getSyncPropMenuItem());
439-
440432
getDeleteSignatureMenuItem().setEnabled(isOnlySignatureSelected());
441-
442-
return menu;
443433
}
444434

445435
private boolean isOnlySignatureSelected() {

EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/view/creation/CutoffPropertiesPanel.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -348,10 +348,10 @@ private JPanel createFilterEdgesPanel_Top() {
348348

349349

350350
private JPanel createFilterEdgesPanel_Simple() {
351-
JLabel sliderLabel = new JLabel("Connectivity: ");
351+
// JLabel sliderLabel = new JLabel("Connectivity: ");
352352
similaritySlider = new SimilaritySlider(sliderTicks, 3);
353353
similaritySlider.setOpaque(false);
354-
SwingUtil.makeSmall(sliderLabel);
354+
// SwingUtil.makeSmall(sliderLabel);
355355

356356
JPanel panel = new JPanel();
357357
final GroupLayout layout = new GroupLayout(panel);
@@ -361,12 +361,12 @@ private JPanel createFilterEdgesPanel_Simple() {
361361

362362
layout.setHorizontalGroup(
363363
layout.createSequentialGroup()
364-
.addComponent(sliderLabel)
364+
// .addComponent(sliderLabel)
365365
.addComponent(similaritySlider, PREFERRED_SIZE, PREFERRED_SIZE, PREFERRED_SIZE)
366366
);
367367
layout.setVerticalGroup(
368368
layout.createParallelGroup(Alignment.CENTER)
369-
.addComponent(sliderLabel)
369+
// .addComponent(sliderLabel)
370370
.addComponent(similaritySlider, PREFERRED_SIZE, PREFERRED_SIZE, PREFERRED_SIZE)
371371
);
372372

EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/view/creation/DetailCommonPanel.java

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import javax.swing.GroupLayout;
99
import javax.swing.GroupLayout.Alignment;
1010
import javax.swing.JButton;
11+
import javax.swing.JLabel;
1112
import javax.swing.JPanel;
1213

1314
import org.baderlab.csplugins.enrichmentmap.AfterInjection;
@@ -22,6 +23,8 @@
2223
@SuppressWarnings("serial")
2324
public class DetailCommonPanel extends JPanel implements DetailPanel {
2425

26+
public static final String ICON = IconManager.ICON_FILE_O;
27+
2528
@Inject private PathTextField.Factory pathTextFactory;
2629

2730
private PathTextField gmtText;
@@ -31,7 +34,7 @@ public class DetailCommonPanel extends JPanel implements DetailPanel {
3134

3235
@Override
3336
public String getIcon() {
34-
return IconManager.ICON_FILE_O;
37+
return ICON;
3538
}
3639

3740
@Override
@@ -51,6 +54,8 @@ public JPanel getPanel() {
5154

5255
@AfterInjection
5356
private void createContents() {
57+
JLabel title = new JLabel("<html>These files will be included in all data sets. <br>Individual data sets may overide these files.</html>");
58+
SwingUtil.makeSmall(title);
5459
gmtText = pathTextFactory.create("GMT File:", FileBrowser.Filter.GMT);
5560
expressionsText = pathTextFactory.create("Expressions:", FileBrowser.Filter.EXPRESSION);
5661
classText = pathTextFactory.create("Class File:", FileBrowser.Filter.CLASS);
@@ -64,28 +69,30 @@ private void createContents() {
6469
layout.setAutoCreateContainerGaps(true);
6570
layout.setAutoCreateGaps(true);
6671

67-
layout.setHorizontalGroup(
68-
layout.createSequentialGroup()
69-
.addGroup(layout.createParallelGroup(Alignment.TRAILING)
70-
.addComponent(gmtText.getLabel())
71-
.addComponent(expressionsText.getLabel())
72-
.addComponent(classText.getLabel())
73-
)
74-
.addGroup(layout.createParallelGroup(Alignment.LEADING, true)
75-
.addComponent(gmtText.getTextField())
76-
.addComponent(expressionsText.getTextField())
77-
.addComponent(classText.getTextField())
78-
.addComponent(resetButton, Alignment.TRAILING)
79-
)
80-
.addGroup(layout.createParallelGroup()
81-
.addComponent(gmtText.getBrowseButton())
82-
.addComponent(expressionsText.getBrowseButton())
83-
.addComponent(classText.getBrowseButton())
84-
)
72+
layout.setHorizontalGroup(layout.createSequentialGroup()
73+
.addGroup(layout.createParallelGroup(Alignment.TRAILING)
74+
.addComponent(gmtText.getLabel())
75+
.addComponent(expressionsText.getLabel())
76+
.addComponent(classText.getLabel())
77+
)
78+
.addGroup(layout.createParallelGroup(Alignment.LEADING, true)
79+
.addComponent(title)
80+
.addComponent(gmtText.getTextField())
81+
.addComponent(expressionsText.getTextField())
82+
.addComponent(classText.getTextField())
83+
.addComponent(resetButton, Alignment.TRAILING)
84+
)
85+
.addGroup(layout.createParallelGroup()
86+
.addComponent(gmtText.getBrowseButton())
87+
.addComponent(expressionsText.getBrowseButton())
88+
.addComponent(classText.getBrowseButton())
89+
)
8590
);
8691

8792
layout.setVerticalGroup(
8893
layout.createSequentialGroup()
94+
.addComponent(title)
95+
.addGap(15)
8996
.addGroup(layout.createParallelGroup(Alignment.BASELINE)
9097
.addComponent(gmtText.getLabel())
9198
.addComponent(gmtText.getTextField())

EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/view/creation/DetailDataSetPanel.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ public List<Message> validateInput(MasterDetailDialogPage parent) {
328328
if(!classesText.emptyOrReadable())
329329
messages.add(Message.error("Classes file path is not valid."));
330330

331-
if(gmtText.isReadable() && !parent.getCommonPanel().hasGmtFile()) {
331+
if(gmtText.isReadable() && !parent.getCommonPanel().map(cp -> cp.hasGmtFile()).orElse(false)) {
332332
String parentDir = gmtText.getPath().getParent().getFileName().toString();
333333
if("edb".equalsIgnoreCase(parentDir)) {
334334
messages.add(Message.warn("Using GMT file from EDB directory. This GMT file was filtered by "

EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/view/creation/DetailGettingStartedPanel.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ public DetailGettingStartedPanel setScanButtonCallback(Runnable callback) {
3737
@AfterInjection
3838
public void createContents() {
3939
JLabel header = new JLabel("<html><h2>Getting Started with EnrichmentMap</h2></html>");
40+
JLabel message = new JLabel("Click the \"Add\" button");
4041

4142
JButton scanButton = SwingUtil.createIconTextButton(iconManager, IconManager.ICON_FOLDER_O, "Scan a folder for enrichment data", null);
4243
scanButton.addActionListener(e -> {
@@ -58,6 +59,7 @@ public void createContents() {
5859
.addGap(0, 0, Short.MAX_VALUE)
5960
.addGroup(layout.createParallelGroup(Alignment.CENTER)
6061
.addComponent(header, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE)
62+
.addComponent(message)
6163
// .addComponent(scanButton, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE)
6264
.addComponent(link1, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE)
6365
.addComponent(link2, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE)
@@ -69,6 +71,8 @@ public void createContents() {
6971
.addGap(0, 0, Short.MAX_VALUE)
7072
.addComponent(header, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE)
7173
.addGap(2, 10, 10)
74+
.addComponent(message)
75+
.addGap(2, 20, 20)
7276
// .addComponent(scanButton, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE)
7377
.addComponent(link1, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE)
7478
.addComponent(link2, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE)

0 commit comments

Comments
 (0)