Skip to content

Commit 106d203

Browse files
author
Michael P Schroeder
committed
Fix: update UI upon load color scale
1 parent 2196ae6 commit 106d203

File tree

4 files changed

+24
-6
lines changed

4 files changed

+24
-6
lines changed

changelog.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Gitools 2.2.2
1515
* Bugfix: Numeric header sorting
1616
* Non-0 event function for linear numeric (color) scale
1717
* Numeric Header value formatter
18-
18+
* Update color scale load in numeric header wizard
1919

2020
Gitools 2.2.1
2121
-------------------------------------------------------------

org.gitools.heatmap/src/main/java/org/gitools/heatmap/header/HeatmapDecoratorHeader.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
import org.gitools.heatmap.decorator.DetailsDecoration;
3030
import org.gitools.heatmap.decorator.impl.LinearDecorator;
3131
import org.gitools.matrix.filter.AnnotationFunction;
32-
import org.gitools.utils.formatter.HeatmapTextFormatter;
3332
import org.gitools.utils.formatter.ITextFormatter;
3433
import org.gitools.utils.formatter.ScientificHeatmapTextFormatter;
3534

@@ -106,6 +105,7 @@ public Decorator getDecorator() {
106105

107106
public void setDecorator(Decorator decorator) {
108107
this.decorator = decorator;
108+
firePropertyChange(this.PROPERTY_DECORATOR, decorator, null);
109109
}
110110

111111
public List<String> getAnnotationLabels() {

org.gitools.heatmap/src/main/java/org/gitools/heatmap/header/HeatmapHeader.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ public abstract class HeatmapHeader extends Model {
4949
public static final String PROPERTY_DESCRIPTION = "description";
5050
public static final String PROPERTY_DESCRIPTION_URL = "descriptionUrl";
5151
public static final String PROPERTY_VALUE_URL = "valueUrl";
52+
public static final String PROPERTY_DECORATOR = "decorator";
5253

5354
@XmlElement
5455
private String title;

org.gitools.ui.app/src/main/java/org/gitools/ui/app/heatmap/header/wizard/heatmapheader/ColorScalePage.java

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import com.jgoodies.binding.value.ValueModel;
2828
import org.gitools.heatmap.decorator.Decorator;
2929
import org.gitools.heatmap.header.HeatmapDecoratorHeader;
30+
import org.gitools.heatmap.header.HeatmapHeader;
3031
import org.gitools.ui.app.decorators.SaveDecoratorDialog;
3132
import org.gitools.ui.app.heatmap.panel.settings.layer.decorators.DecoratorPanelContainer;
3233
import org.gitools.ui.app.heatmap.panel.settings.layer.decorators.DecoratorPanels;
@@ -36,6 +37,8 @@
3637
import java.awt.*;
3738
import java.awt.event.MouseAdapter;
3839
import java.awt.event.MouseEvent;
40+
import java.beans.PropertyChangeEvent;
41+
import java.beans.PropertyChangeListener;
3942

4043
public class ColorScalePage extends AbstractWizardPage {
4144
private JPanel mainPanel;
@@ -49,8 +52,8 @@ public ColorScalePage(final HeatmapDecoratorHeader header) {
4952
super();
5053

5154
// Bind color scale controls
52-
DecoratorPanels decorators = new DecoratorPanels();
53-
DecoratorPanelContainer decoratorsPanels = (DecoratorPanelContainer) this.decoratorPanels;
55+
final DecoratorPanels decorators = new DecoratorPanels();
56+
final DecoratorPanelContainer decoratorsPanels = (DecoratorPanelContainer) this.decoratorPanels;
5457

5558
final ValueModel decoratorModel = new AbstractValueModel() {
5659
@Override
@@ -64,12 +67,26 @@ public void setValue(Object newValue) {
6467
}
6568
};
6669

67-
decoratorsPanels.init(decorators, decoratorModel);
70+
/* decoratorsPanels.init(decorators, decoratorModel);
6871
6972
Bindings.bind(decoratorPanelSelector, new SelectionInList<>(
7073
decorators,
7174
decoratorsPanels.getCurrentPanelModel()
72-
));
75+
)); */
76+
77+
PropertyChangeListener listener = new PropertyChangeListener() {
78+
@Override
79+
public void propertyChange(PropertyChangeEvent evt) {
80+
decoratorsPanels.init(decorators, decoratorModel);
81+
82+
Bindings.bind(decoratorPanelSelector, new SelectionInList<>(
83+
decorators,
84+
decoratorsPanels.getCurrentPanelModel()
85+
));
86+
}
87+
};
88+
listener.propertyChange(null);
89+
header.addPropertyChangeListener(HeatmapHeader.PROPERTY_DECORATOR, listener);
7390

7491
colorScaleSave.setCursor(new Cursor(Cursor.HAND_CURSOR));
7592
colorScaleSave.addMouseListener(new MouseAdapter() {

0 commit comments

Comments
 (0)