Skip to content

Commit bdce386

Browse files
committed
Make data set add buttons bigger, with text
1 parent b8a4213 commit bdce386

File tree

5 files changed

+47
-32
lines changed

5 files changed

+47
-32
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public String getPageChooserLabelText() {
4848

4949
@Override
5050
public Dimension getPreferredSize() {
51-
return new Dimension(820, 700);
51+
return new Dimension(900, 700);
5252
}
5353

5454
@Override

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

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,16 @@
66
import static org.baderlab.csplugins.enrichmentmap.EMBuildProps.HELP_URL_PROTOCOL;
77
import static org.baderlab.csplugins.enrichmentmap.EMBuildProps.HELP_URL_TUTORIAL;
88

9-
import java.awt.Color;
10-
import java.awt.Font;
11-
129
import javax.swing.GroupLayout;
1310
import javax.swing.GroupLayout.Alignment;
14-
import javax.swing.Icon;
1511
import javax.swing.JButton;
1612
import javax.swing.JLabel;
1713
import javax.swing.JPanel;
18-
import javax.swing.UIManager;
1914

2015
import org.baderlab.csplugins.enrichmentmap.AfterInjection;
2116
import org.baderlab.csplugins.enrichmentmap.view.util.OpenBrowser;
2217
import org.baderlab.csplugins.enrichmentmap.view.util.SwingUtil;
2318
import org.cytoscape.util.swing.IconManager;
24-
import org.cytoscape.util.swing.TextIcon;
2519

2620
import com.google.inject.Inject;
2721

@@ -44,8 +38,7 @@ public DetailGettingStartedPanel setScanButtonCallback(Runnable callback) {
4438
public void createContents() {
4539
JLabel header = new JLabel("<html><h2>Getting Started with EnrichmentMap</h2></html>");
4640

47-
JButton scanButton = new JButton("Scan a folder for enrichment data");
48-
scanButton.setIcon(getFolderIcon());
41+
JButton scanButton = SwingUtil.createIconTextButton(iconManager, IconManager.ICON_FOLDER_O, "Scan a folder for enrichment data", null);
4942
scanButton.addActionListener(e -> {
5043
if(scanButtonCallback != null)
5144
scanButtonCallback.run();
@@ -65,7 +58,7 @@ public void createContents() {
6558
.addGap(0, 0, Short.MAX_VALUE)
6659
.addGroup(layout.createParallelGroup(Alignment.CENTER)
6760
.addComponent(header, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE)
68-
.addComponent(scanButton, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE)
61+
// .addComponent(scanButton, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE)
6962
.addComponent(link1, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE)
7063
.addComponent(link2, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE)
7164
.addComponent(link3, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE)
@@ -76,7 +69,7 @@ public void createContents() {
7669
.addGap(0, 0, Short.MAX_VALUE)
7770
.addComponent(header, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE)
7871
.addGap(2, 10, 10)
79-
.addComponent(scanButton, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE)
72+
// .addComponent(scanButton, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE)
8073
.addComponent(link1, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE)
8174
.addComponent(link2, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE)
8275
.addComponent(link3, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE)
@@ -85,15 +78,6 @@ public void createContents() {
8578

8679
setOpaque(false);
8780
}
88-
89-
90-
private Icon getFolderIcon() {
91-
Font iconFont = iconManager.getIconFont(12.0f);
92-
Color iconColor = UIManager.getColor("Label.foreground");
93-
int iconSize = 20;
94-
TextIcon icon = new TextIcon(IconManager.ICON_FOLDER_O, iconFont, iconColor, iconSize, iconSize);
95-
return icon;
96-
}
9781

9882

9983
}

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

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ public JPanel createBodyPanel(CardDialogCallback callback) {
220220

221221
private JPanel createDataSetPanel() {
222222
JPanel titlePanel = createTitlePanel();
223+
titlePanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0));
223224

224225
dataSetListModel = new IterableListModel<>();
225226
dataSetList = new DataSetList(dataSetListModel);
@@ -263,10 +264,11 @@ private JPanel createDataSetPanel() {
263264

264265
private JPanel createTitlePanel() {
265266
JLabel label = new JLabel("Data Sets:");
267+
label.setBorder(BorderFactory.createEmptyBorder(5, 5, 0, 0));
266268
SwingUtil.makeSmall(label);
267269

268-
JButton addButton = SwingUtil.createIconButton(iconManager, IconManager.ICON_PLUS, "Add data set from files");
269-
scanButton = SwingUtil.createIconButton(iconManager, IconManager.ICON_FOLDER_O, "Add data sets from folder (scan)");
270+
scanButton = SwingUtil.createIconTextButton(iconManager, IconManager.ICON_FOLDER_O, "Scan folder for data sets");
271+
JButton addButton = SwingUtil.createIconTextButton(iconManager, IconManager.ICON_PLUS, "Add data set manually");
270272
deleteButton = SwingUtil.createIconButton(iconManager, IconManager.ICON_TRASH_O, "Delete selected data sets");
271273

272274
addButton.addActionListener(e -> addNewDataSetToList());
@@ -279,19 +281,24 @@ private JPanel createTitlePanel() {
279281
layout.setAutoCreateGaps(true);
280282
layout.setAutoCreateContainerGaps(false);
281283

282-
layout.setHorizontalGroup(layout.createSequentialGroup()
284+
layout.setHorizontalGroup(layout.createParallelGroup()
283285
.addComponent(label)
284-
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
285-
.addComponent(scanButton)
286-
.addComponent(addButton)
287-
.addComponent(deleteButton)
286+
.addGroup(layout.createSequentialGroup()
287+
.addGap(5)
288+
.addComponent(scanButton)
289+
.addComponent(addButton)
290+
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
291+
.addComponent(deleteButton)
292+
)
288293
);
289294

290-
layout.setVerticalGroup(layout.createParallelGroup(Alignment.BASELINE)
295+
layout.setVerticalGroup(layout.createSequentialGroup()
291296
.addComponent(label)
292-
.addComponent(scanButton)
293-
.addComponent(addButton)
294-
.addComponent(deleteButton)
297+
.addGroup(layout.createParallelGroup(Alignment.BASELINE)
298+
.addComponent(scanButton)
299+
.addComponent(addButton)
300+
.addComponent(deleteButton)
301+
)
295302
);
296303

297304
return panel;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ private void createContents() {
6161

6262
yFilesLink = createInstallLink();
6363

64-
autoAnnotateCheck = new JCheckBox("Run AutoAnnotate after creating network");
64+
autoAnnotateCheck = new JCheckBox("Highlight Significant Nodes with AutoAnnotate");
6565

6666
makeSmall(networkLabel, useAutomaticCheck, nameText);
6767
makeSmall(layoutLabel, layoutComboBox, yFilesLink, autoAnnotateCheck);

EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/view/util/SwingUtil.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
import org.cytoscape.service.util.CyServiceRegistrar;
4747
import org.cytoscape.util.swing.IconManager;
4848
import org.cytoscape.util.swing.LookAndFeelUtil;
49+
import org.cytoscape.util.swing.TextIcon;
4950

5051
import com.google.common.base.Strings;
5152
import com.google.common.util.concurrent.ListenableFuture;
@@ -144,6 +145,7 @@ public static JButton createOnlineHelpButton(String url, String toolTipText, CyS
144145
return btn;
145146
}
146147

148+
147149
public static JButton createIconButton(IconManager iconManager, String icon, String toolTip) {
148150
JButton button = new JButton(icon);
149151
button.setFont(iconManager.getIconFont(13.0f));
@@ -155,6 +157,28 @@ public static JButton createIconButton(IconManager iconManager, String icon, Str
155157
return button;
156158
}
157159

160+
161+
public static JButton createIconTextButton(IconManager iconManager, String icon, String text) {
162+
return createIconTextButton(iconManager, icon, text, null);
163+
}
164+
165+
public static JButton createIconTextButton(IconManager iconManager, String icon, String text, String toolTip) {
166+
JButton button = new JButton(text);
167+
button.setToolTipText(toolTip);
168+
Font iconFont = iconManager.getIconFont(12.0f);
169+
Color iconColor = UIManager.getColor("Label.foreground");
170+
int iconSize = 20;
171+
TextIcon textIcon = new TextIcon(icon, iconFont, iconColor, iconSize, iconSize);
172+
button.setIcon(textIcon);
173+
// if(LookAndFeelUtil.isAquaLAF()) {
174+
// button.putClientProperty("JButton.buttonType", "gradient");
175+
// button.putClientProperty("JComponent.sizeVariant", "small");
176+
// }
177+
makeSmall(button);
178+
return button;
179+
}
180+
181+
158182
/**
159183
* Utility method that invokes the code in Runnable.run on the AWT Event Dispatch Thread.
160184
* @param runnable

0 commit comments

Comments
 (0)