Skip to content

Commit 144f3d7

Browse files
author
mpschr
committed
New annotation edit page
1 parent 87beac6 commit 144f3d7

File tree

7 files changed

+656
-10
lines changed

7 files changed

+656
-10
lines changed

org.gitools.matrix/src/main/java/org/gitools/matrix/model/hashmatrix/HashMatrix.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,13 @@ public HashMatrix(MatrixLayers<? extends IMatrixLayer> layers, HashMatrixDimensi
5757
@Override
5858
public <T> T get(IMatrixLayer<T> layer, String... identifiers) {
5959

60-
Map result = values.get(layer.getId());
60+
Map result;
61+
try {
62+
result = values.get(layer.getId());
63+
} catch (NullPointerException e) {
64+
return null;
65+
}
66+
6167
if (result == null) {
6268
return null;
6369
}

org.gitools.matrix/src/main/java/org/gitools/matrix/model/matrix/AnnotationMatrix.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@
3838

3939
public class AnnotationMatrix extends HashMatrix implements IAnnotations {
4040

41+
public static String METADATA_DESCRIPTION = "description";
42+
4143
private Map<String, Map<String, String>> layersMetadata;
4244
private Collection<String> labels;
4345

@@ -66,7 +68,6 @@ public void addAnnotations(IAnnotations annotations) {
6668
}
6769
}
6870
}
69-
7071
}
7172

7273
@Override
@@ -106,13 +107,13 @@ private IMatrixLayer<String> getLayer(String label) {
106107
return getLayers().get(label);
107108
}
108109

109-
public void setAnnotation(String dimensionId, String annotationLabel, String annotationValue) {
110+
public void setAnnotation(String identifier, String layerId, String annotationValue) {
110111

111-
if (getLayer(annotationLabel) == null) {
112-
addLayer(new MatrixLayer<>(annotationLabel, String.class));
112+
if (getLayer(layerId) == null) {
113+
addLayer(new MatrixLayer<>(layerId, String.class));
113114
}
114115

115-
set(getLayer(annotationLabel), annotationValue, dimensionId);
116+
set(getLayer(layerId), annotationValue, identifier);
116117
}
117118

118119
@Override

org.gitools.ui.app/src/main/java/org/gitools/ui/app/actions/edit/AnnotationAction.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
import org.gitools.heatmap.HeatmapDimension;
2626
import org.gitools.ui.app.actions.HeatmapDimensionAction;
2727
import org.gitools.ui.core.Application;
28-
import org.gitools.ui.core.pages.common.PatternSourcePage;
28+
import org.gitools.ui.core.pages.common.AnnotationEditPage;
2929
import org.gitools.ui.platform.dialog.GlassPanePageDialog;
3030
import org.gitools.ui.platform.icons.IconNames;
3131

@@ -44,7 +44,8 @@ public void actionPerformed(ActionEvent e) {
4444

4545
HeatmapDimension heatmapDimension = getDimension();
4646

47-
PatternSourcePage annotationPage = new PatternSourcePage(heatmapDimension, true, true);
47+
//PatternSourcePage annotationPage = new PatternSourcePage(heatmapDimension, true, true);
48+
AnnotationEditPage annotationPage = new AnnotationEditPage(heatmapDimension);
4849
annotationPage.setTitle("View and load available " + heatmapDimension.getId().getLabel() + " annotations");
4950

5051
GlassPanePageDialog p = new GlassPanePageDialog(Application.get(), annotationPage);
Lines changed: 182 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,182 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="org.gitools.ui.core.pages.common.AnnotationEditPage">
3+
<grid id="27dc6" binding="root" layout-manager="FormLayout">
4+
<rowspec value="center:max(d;4px):noGrow"/>
5+
<rowspec value="top:4dlu:noGrow"/>
6+
<rowspec value="center:max(d;4px):noGrow"/>
7+
<rowspec value="top:4dlu:noGrow"/>
8+
<rowspec value="center:max(d;4px):noGrow"/>
9+
<rowspec value="top:4dlu:noGrow"/>
10+
<rowspec value="center:max(d;4px):noGrow"/>
11+
<rowspec value="top:4dlu:noGrow"/>
12+
<rowspec value="center:max(d;4px):noGrow"/>
13+
<rowspec value="top:4dlu:noGrow"/>
14+
<rowspec value="center:max(d;4px):noGrow"/>
15+
<rowspec value="top:4dlu:noGrow"/>
16+
<rowspec value="center:max(d;4px):noGrow"/>
17+
<rowspec value="top:4dlu:noGrow"/>
18+
<rowspec value="center:max(d;4px):noGrow"/>
19+
<rowspec value="top:4dlu:noGrow"/>
20+
<rowspec value="center:d:grow"/>
21+
<rowspec value="top:4dlu:noGrow"/>
22+
<rowspec value="center:max(d;4px):noGrow"/>
23+
<rowspec value="top:4dlu:noGrow"/>
24+
<rowspec value="center:max(d;4px):noGrow"/>
25+
<rowspec value="top:4dlu:noGrow"/>
26+
<rowspec value="center:max(d;4px):noGrow"/>
27+
<rowspec value="top:4dlu:noGrow"/>
28+
<rowspec value="center:200px:grow"/>
29+
<rowspec value="top:4dlu:grow"/>
30+
<rowspec value="center:max(d;4px):noGrow"/>
31+
<colspec value="fill:max(d;4px):noGrow"/>
32+
<colspec value="left:4dlu:noGrow"/>
33+
<colspec value="fill:d:grow"/>
34+
<colspec value="left:4dlu:noGrow"/>
35+
<colspec value="fill:max(d;4px):noGrow"/>
36+
<colspec value="left:4dlu:noGrow"/>
37+
<colspec value="fill:80dlu:noGrow"/>
38+
<colspec value="left:4dlu:noGrow"/>
39+
<colspec value="fill:max(d;4px):noGrow"/>
40+
<constraints>
41+
<xy x="20" y="20" width="594" height="791"/>
42+
</constraints>
43+
<properties/>
44+
<border type="none"/>
45+
<children>
46+
<scrollpane id="389f" binding="jScrollPane1">
47+
<constraints>
48+
<grid row="6" column="2" row-span="11" col-span="3" vsize-policy="7" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
49+
<forms defaultalign-horz="false" defaultalign-vert="false"/>
50+
</constraints>
51+
<properties/>
52+
<border type="none"/>
53+
<children>
54+
<component id="af68f" class="javax.swing.JList" binding="annList">
55+
<constraints/>
56+
<properties>
57+
<dropMode value="ON"/>
58+
<selectionMode value="2"/>
59+
</properties>
60+
</component>
61+
</children>
62+
</scrollpane>
63+
<component id="6382f" class="javax.swing.JButton" binding="loadAnnotations">
64+
<constraints>
65+
<grid row="6" column="6" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
66+
<forms/>
67+
</constraints>
68+
<properties>
69+
<text value="load Annotations"/>
70+
</properties>
71+
</component>
72+
<component id="dd937" class="javax.swing.JButton" binding="removeSelected">
73+
<constraints>
74+
<grid row="10" column="6" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
75+
<forms/>
76+
</constraints>
77+
<properties>
78+
<text value="remove Selected"/>
79+
</properties>
80+
</component>
81+
<component id="aecef" class="javax.swing.JTextField" binding="annotationSearchField">
82+
<constraints>
83+
<grid row="4" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
84+
<preferred-size width="150" height="-1"/>
85+
</grid>
86+
<forms defaultalign-horz="false"/>
87+
</constraints>
88+
<properties/>
89+
</component>
90+
<component id="ad6f7" class="javax.swing.JLabel">
91+
<constraints>
92+
<grid row="2" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
93+
<forms/>
94+
</constraints>
95+
<properties>
96+
<font style="1"/>
97+
<text value="Available Annotations"/>
98+
</properties>
99+
</component>
100+
<component id="8b7c" class="javax.swing.JLabel">
101+
<constraints>
102+
<grid row="4" column="6" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
103+
<forms/>
104+
</constraints>
105+
<properties>
106+
<text value="Add/Remove"/>
107+
</properties>
108+
</component>
109+
<component id="726" class="javax.swing.JLabel">
110+
<constraints>
111+
<grid row="18" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
112+
<forms/>
113+
</constraints>
114+
<properties>
115+
<font style="1"/>
116+
<text value="Edit selected"/>
117+
</properties>
118+
</component>
119+
<component id="c939a" class="javax.swing.JTextField" binding="annTitleField">
120+
<constraints>
121+
<grid row="20" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
122+
<preferred-size width="150" height="-1"/>
123+
</grid>
124+
<forms defaultalign-horz="false"/>
125+
</constraints>
126+
<properties/>
127+
</component>
128+
<scrollpane id="4ce6c" binding="previewScrollPane">
129+
<constraints>
130+
<grid row="24" column="2" row-span="1" col-span="5" vsize-policy="7" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
131+
<forms defaultalign-horz="false" defaultalign-vert="false"/>
132+
</constraints>
133+
<properties/>
134+
<border type="none"/>
135+
<children>
136+
<component id="f5c57" class="javax.swing.JTable" binding="previewTable" default-binding="true">
137+
<constraints/>
138+
<properties>
139+
<enabled value="true"/>
140+
</properties>
141+
</component>
142+
</children>
143+
</scrollpane>
144+
<component id="3e637" class="javax.swing.JTextField" binding="descriptionField">
145+
<constraints>
146+
<grid row="22" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
147+
<preferred-size width="150" height="-1"/>
148+
</grid>
149+
<forms defaultalign-horz="false"/>
150+
</constraints>
151+
<properties/>
152+
</component>
153+
<component id="370fc" class="javax.swing.JButton" binding="applyTitleChange">
154+
<constraints>
155+
<grid row="20" column="4" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
156+
<forms/>
157+
</constraints>
158+
<properties>
159+
<text value="apply new Title"/>
160+
</properties>
161+
</component>
162+
<component id="ec83b" class="javax.swing.JButton" binding="applyDescriptionButton">
163+
<constraints>
164+
<grid row="22" column="4" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
165+
<forms/>
166+
</constraints>
167+
<properties>
168+
<text value="apply new Description"/>
169+
</properties>
170+
</component>
171+
<component id="28c8a" class="javax.swing.JButton" binding="fromOtherHeatmapButton" default-binding="true">
172+
<constraints>
173+
<grid row="8" column="6" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
174+
<forms/>
175+
</constraints>
176+
<properties>
177+
<text value="from other Heatmap"/>
178+
</properties>
179+
</component>
180+
</children>
181+
</grid>
182+
</form>

0 commit comments

Comments
 (0)