|
24 | 24 | import org.gitools.api.analysis.Clusters; |
25 | 25 | import org.gitools.api.matrix.MatrixDimensionKey; |
26 | 26 | import org.gitools.heatmap.Heatmap; |
| 27 | +import org.gitools.heatmap.HeatmapDimension; |
27 | 28 | import org.gitools.heatmap.header.ColoredLabel; |
28 | 29 | import org.gitools.heatmap.header.HeatmapColoredLabelsHeader; |
29 | 30 | import org.gitools.heatmap.header.HeatmapHeader; |
|
51 | 52 | import java.util.List; |
52 | 53 |
|
53 | 54 | import static org.gitools.ui.app.commands.AddHeaderColoredLabelsCommand.makeAnnotationClustering; |
| 55 | +import static org.gitools.ui.app.commands.AddHeaderColoredLabelsCommand.updateFromClusterResults; |
54 | 56 |
|
55 | 57 | public class EditAnnotationValueAction extends HeatmapDimensionAction implements IHeatmapHeaderAction { |
56 | 58 |
|
@@ -94,7 +96,7 @@ public void actionPerformed(ActionEvent e) { |
94 | 96 | execute(header, position); |
95 | 97 | } |
96 | 98 |
|
97 | | - public static void execute(final HeatmapHeader header, final HeatmapPosition position) { |
| 99 | + public void execute(final HeatmapHeader header, final HeatmapPosition position) { |
98 | 100 |
|
99 | 101 | final List<ISettingsSection> sections = new ArrayList<>(); |
100 | 102 | final Set<String> selected = header.getHeatmapDimension().getSelected(); |
@@ -206,11 +208,20 @@ private static void applyChanges(ChangeAnnotationValueSection section) { |
206 | 208 | } |
207 | 209 | } |
208 | 210 |
|
209 | | - private static void addNewAnnotation(AddNewManualAnnotationSection section) { |
| 211 | + private void addNewAnnotation(AddNewManualAnnotationSection section) { |
210 | 212 | AnnotationMatrix annotations = section.getAnnotations(); |
211 | 213 | for (String s : section.getSelected()) { |
212 | 214 | annotations.setAnnotation(s, section.getAnnotationLabel(), section.getAnnotationValue()); |
213 | 215 | } |
| 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 | + |
214 | 225 | } |
215 | 226 |
|
216 | 227 | @Override |
|
0 commit comments