Skip to content

Commit 744b245

Browse files
author
mpschr
committed
show/hide headers
1 parent 2fbc137 commit 744b245

File tree

10 files changed

+180
-19
lines changed

10 files changed

+180
-19
lines changed

changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Gitools 2.2.4
66
* Added Mode aggregator
77
* New data layers from data transformation
88
* Edit annotation values within the application
9+
* Enable show/hide headers from details box
910

1011
Gitools 2.2.3
1112
------------------------------------------------------------

org.gitools.heatmap/src/main/java/org/gitools/heatmap/HeatmapDimension.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,9 +236,7 @@ public void populateDetails(List<DetailsDecoration> details) {
236236
}
237237

238238
for (HeatmapHeader header : itHeaders) {
239-
if (header.isVisible()) {
240239
header.populateDetails(details, getFocus(), getSelectedHeader() == header);
241-
}
242240
}
243241
}
244242

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
/*
2+
* #%L
3+
* gitools-ui-app
4+
* %%
5+
* Copyright (C) 2013 Universitat Pompeu Fabra - Biomedical Genomics group
6+
* %%
7+
* This program is free software: you can redistribute it and/or modify
8+
* it under the terms of the GNU General Public License as
9+
* published by the Free Software Foundation, either version 3 of the
10+
* License, or (at your option) any later version.
11+
*
12+
* This program is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU General Public
18+
* License along with this program. If not, see
19+
* <http://www.gnu.org/licenses/gpl-3.0.html>.
20+
* #L%
21+
*/
22+
package org.gitools.ui.app.actions.edit;
23+
24+
import org.gitools.api.matrix.MatrixDimensionKey;
25+
import org.gitools.heatmap.header.HeatmapHeader;
26+
import org.gitools.ui.app.actions.HeatmapDimensionAction;
27+
import org.gitools.ui.app.heatmap.panel.details.boxes.actions.DimensionHeaderHighlightAction;
28+
import org.gitools.ui.core.HeatmapPosition;
29+
import org.gitools.ui.core.actions.dynamicactions.IHeatmapHeaderAction;
30+
import org.gitools.ui.platform.icons.IconNames;
31+
32+
import java.awt.event.ActionEvent;
33+
34+
public class HideHeaderAction extends HeatmapDimensionAction implements IHeatmapHeaderAction {
35+
36+
private HeatmapHeader header;
37+
38+
public HideHeaderAction(MatrixDimensionKey dimensionKey, String name) {
39+
super(dimensionKey, name);
40+
setSmallIconFromResource(IconNames.hide16);
41+
}
42+
43+
public HideHeaderAction(HeatmapHeader header) {
44+
super(header.getHeatmapDimension().getId(), header.getTitle());
45+
setSmallIconFromResource(IconNames.hide16);
46+
this.header = header;
47+
}
48+
49+
public HeatmapHeader getHeader() {
50+
return header;
51+
}
52+
53+
public void setHeader(HeatmapHeader header) {
54+
this.header = header;
55+
}
56+
57+
@Override
58+
public void actionPerformed(ActionEvent e) {
59+
execute(header);
60+
}
61+
62+
public void execute(final HeatmapHeader header) {
63+
header.setVisible(false);
64+
new DimensionHeaderHighlightAction(getDimension(), getHeader()).actionPerformed(null);
65+
}
66+
67+
@Override
68+
public void onConfigure(HeatmapHeader object, HeatmapPosition position) {
69+
setEnabled(object.isVisible());
70+
setHeader(object);
71+
}
72+
73+
74+
}
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
/*
2+
* #%L
3+
* gitools-ui-app
4+
* %%
5+
* Copyright (C) 2013 Universitat Pompeu Fabra - Biomedical Genomics group
6+
* %%
7+
* This program is free software: you can redistribute it and/or modify
8+
* it under the terms of the GNU General Public License as
9+
* published by the Free Software Foundation, either version 3 of the
10+
* License, or (at your option) any later version.
11+
*
12+
* This program is distributed in the hope that it will be useful,
13+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
* GNU General Public License for more details.
16+
*
17+
* You should have received a copy of the GNU General Public
18+
* License along with this program. If not, see
19+
* <http://www.gnu.org/licenses/gpl-3.0.html>.
20+
* #L%
21+
*/
22+
package org.gitools.ui.app.actions.edit;
23+
24+
import org.gitools.api.matrix.MatrixDimensionKey;
25+
import org.gitools.heatmap.header.HeatmapHeader;
26+
import org.gitools.ui.app.actions.HeatmapDimensionAction;
27+
import org.gitools.ui.app.heatmap.panel.details.boxes.actions.DimensionHeaderHighlightAction;
28+
import org.gitools.ui.core.HeatmapPosition;
29+
import org.gitools.ui.core.actions.dynamicactions.IHeatmapHeaderAction;
30+
import org.gitools.ui.platform.icons.IconNames;
31+
32+
import java.awt.event.ActionEvent;
33+
34+
public class ShowHeaderAction extends HeatmapDimensionAction implements IHeatmapHeaderAction {
35+
36+
private HeatmapHeader header;
37+
38+
public ShowHeaderAction(MatrixDimensionKey dimensionKey, String name) {
39+
super(dimensionKey, name);
40+
setSmallIconFromResource(IconNames.view16);
41+
}
42+
43+
public ShowHeaderAction(HeatmapHeader header) {
44+
super(header.getHeatmapDimension().getId(), header.getTitle());
45+
setSmallIconFromResource(IconNames.view16);
46+
this.header = header;
47+
}
48+
49+
public HeatmapHeader getHeader() {
50+
return header;
51+
}
52+
53+
public void setHeader(HeatmapHeader header) {
54+
this.header = header;
55+
}
56+
57+
@Override
58+
public void actionPerformed(ActionEvent e) {
59+
execute(header);
60+
new DimensionHeaderHighlightAction(getDimension(), getHeader()).actionPerformed(null);
61+
}
62+
63+
public static void execute(final HeatmapHeader header) {
64+
header.setVisible(true);
65+
}
66+
67+
@Override
68+
public void onConfigure(HeatmapHeader object, HeatmapPosition position) {
69+
setEnabled(!object.isVisible());
70+
setHeader(object);
71+
}
72+
73+
74+
}

org.gitools.ui.app/src/main/java/org/gitools/ui/app/heatmap/panel/details/boxes/actions/DimensionHeaderHighlightAction.java

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323

2424
import org.gitools.heatmap.HeatmapDimension;
2525
import org.gitools.heatmap.header.HeatmapHeader;
26+
import org.gitools.ui.core.Application;
2627
import org.gitools.ui.core.HeatmapPosition;
2728
import org.gitools.ui.core.actions.HeatmapAction;
2829
import org.gitools.ui.core.actions.dynamicactions.IHeatmapDimensionAction;
@@ -64,30 +65,35 @@ public void actionPerformed(ActionEvent e) {
6465
highlighter.switchTarget(dimension, header);
6566
}
6667

68+
if (header.isVisible()) {
6769

68-
Runnable runnable = new Runnable() {
69-
@Override
70-
public void run() {
70+
Runnable runnable = new Runnable() {
71+
@Override
72+
public void run() {
7173

72-
while(highlighter.getAlpha() > 0) {
73-
try {
74+
while (highlighter.getAlpha() > 0) {
75+
try {
7476

75-
setInteractionStatus(highlighting);
76-
Thread.currentThread().sleep(100);
77-
highlighter.highlight();
77+
setInteractionStatus(highlighting);
78+
Thread.currentThread().sleep(100);
79+
highlighter.highlight();
7880

79-
} catch (InterruptedException e1) {
80-
e1.printStackTrace();
81+
} catch (InterruptedException e1) {
82+
e1.printStackTrace();
83+
}
8184
}
82-
}
8385

84-
highlighter.resetDimension();
85-
highlighter = null;
86-
setInteractionStatus(none);
86+
highlighter.resetDimension();
87+
highlighter = null;
88+
setInteractionStatus(none);
8789

88-
}
89-
};
90-
updating = EXECUTOR.schedule(runnable, 10, TimeUnit.MILLISECONDS);
90+
}
91+
};
92+
updating = EXECUTOR.schedule(runnable, 10, TimeUnit.MILLISECONDS);
93+
} else {
94+
// header is not visible
95+
Application.get().showNotification("Header '" + header.getTitle() + "' is hidden.", 2000);
96+
}
9197

9298

9399
}

org.gitools.ui.app/src/main/java/org/gitools/ui/app/heatmap/popupmenus/PopupMenuActions.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ private static ActionSet getHeatmapMenu(MatrixDimensionKey dimensionKey) {
9797
// Details popup menus
9898
public static final ActionSet DETAILS_ROWS = new ActionSet(new BaseAction[]{
9999
new EditHeaderAction(MatrixDimensionKey.ROWS, "Edit..."),
100+
new ShowHeaderAction(MatrixDimensionKey.ROWS, "Show header"),
101+
new HideHeaderAction(MatrixDimensionKey.ROWS, "Hide header"),
100102
BaseAction.separator,
101103
new MoveUpHeaderAction("Move up (left)", MatrixDimensionKey.ROWS, IconNames.moveUp16),
102104
new MoveDownHeaderAction("Move down (right)", MatrixDimensionKey.ROWS, IconNames.moveDown16),
@@ -106,6 +108,9 @@ private static ActionSet getHeatmapMenu(MatrixDimensionKey dimensionKey) {
106108

107109
public static final ActionSet DETAILS_COLUMNS = new ActionSet(new BaseAction[]{
108110
new EditHeaderAction(MatrixDimensionKey.COLUMNS, "Edit..."),
111+
new ShowHeaderAction(MatrixDimensionKey.COLUMNS, "Show header"),
112+
new HideHeaderAction(MatrixDimensionKey.COLUMNS, "Hide header"),
113+
109114
BaseAction.separator,
110115
new MoveDownHeaderAction("Move up", MatrixDimensionKey.COLUMNS, IconNames.moveUp16),
111116
new MoveUpHeaderAction("Move down", MatrixDimensionKey.COLUMNS, IconNames.moveDown16),
2.21 KB
Loading
342 Bytes
Loading
579 Bytes
Loading

org.gitools.ui.platform/src/main/java/org/gitools/ui/platform/icons/IconNames.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,9 @@ public static DimensionIcons get(MatrixDimensionKey key) {
117117
public static final String view16 = "/img/view16.png";
118118
public static final String view24 = "/img/view24.png";
119119

120+
public static final String hide16 = "/img/hide16.png";
121+
public static final String hide24 = "/img/hide24.png";
122+
120123
public static final String biomart16 = "/img/Biomart16.png";
121124
public static final String biomart24 = "/img/Biomart24.png";
122125

0 commit comments

Comments
 (0)