Skip to content

Commit 617d54e

Browse files
author
mpschr
committed
add newly added annotation to header
1 parent a7b04be commit 617d54e

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

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

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import org.gitools.api.analysis.Clusters;
2525
import org.gitools.api.matrix.MatrixDimensionKey;
2626
import org.gitools.heatmap.Heatmap;
27+
import org.gitools.heatmap.HeatmapDimension;
2728
import org.gitools.heatmap.header.ColoredLabel;
2829
import org.gitools.heatmap.header.HeatmapColoredLabelsHeader;
2930
import org.gitools.heatmap.header.HeatmapHeader;
@@ -51,6 +52,7 @@
5152
import java.util.List;
5253

5354
import static org.gitools.ui.app.commands.AddHeaderColoredLabelsCommand.makeAnnotationClustering;
55+
import static org.gitools.ui.app.commands.AddHeaderColoredLabelsCommand.updateFromClusterResults;
5456

5557
public class EditAnnotationValueAction extends HeatmapDimensionAction implements IHeatmapHeaderAction {
5658

@@ -94,7 +96,7 @@ public void actionPerformed(ActionEvent e) {
9496
execute(header, position);
9597
}
9698

97-
public static void execute(final HeatmapHeader header, final HeatmapPosition position) {
99+
public void execute(final HeatmapHeader header, final HeatmapPosition position) {
98100

99101
final List<ISettingsSection> sections = new ArrayList<>();
100102
final Set<String> selected = header.getHeatmapDimension().getSelected();
@@ -206,11 +208,20 @@ private static void applyChanges(ChangeAnnotationValueSection section) {
206208
}
207209
}
208210

209-
private static void addNewAnnotation(AddNewManualAnnotationSection section) {
211+
private void addNewAnnotation(AddNewManualAnnotationSection section) {
210212
AnnotationMatrix annotations = section.getAnnotations();
211213
for (String s : section.getSelected()) {
212214
annotations.setAnnotation(s, section.getAnnotationLabel(), section.getAnnotationValue());
213215
}
216+
HeatmapDimension dim = getHeader().getHeatmapDimension();
217+
HeatmapColoredLabelsHeader newHeader = new HeatmapColoredLabelsHeader(dim);
218+
newHeader.setAnnotationPattern("${" + section.getAnnotationLabel() + "}");
219+
newHeader.setTitle(section.getAnnotationLabel());
220+
Clusters results = makeAnnotationClustering(newHeader);
221+
updateFromClusterResults(newHeader, results.getClusters());
222+
dim.addHeader(newHeader);
223+
224+
214225
}
215226

216227
@Override

org.gitools.ui.app/src/main/java/org/gitools/ui/app/heatmap/panel/settings/headers/AddNewManualAnnotationSection.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public class AddNewManualAnnotationSection extends AbstractSettingsSection {
4747
public AddNewManualAnnotationSection(final AnnotationMatrix annotations, final List<String> selected) {
4848
this.annotations = annotations;
4949
this.selected = selected;
50-
this.explanationLabel.setText("<html><body><i>The annotation is not automatically added as header</i></body></html>");
50+
this.explanationLabel.setText("<html><body><i>The annotation will automatically added as a colored header</i></body></html>");
5151

5252

5353
DocumentChangeListener docListener = new DocumentChangeListener() {

0 commit comments

Comments
 (0)