Mercurial > dive4elements > river
comparison flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartOutputTab.java @ 531:c17c593f8732
The chart in the ChartOutputTab is refreshed when there occur any changes in the chart theme panel.
flys-client/trunk@2020 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Fri, 27 May 2011 09:50:57 +0000 |
parents | 902609b5cc79 |
children | 0ba7c43e7b62 |
comparison
equal
deleted
inserted
replaced
530:26e38b79658d | 531:c17c593f8732 |
---|---|
22 | 22 |
23 import de.intevation.flys.client.shared.model.Artifact; | 23 import de.intevation.flys.client.shared.model.Artifact; |
24 import de.intevation.flys.client.shared.model.Collection; | 24 import de.intevation.flys.client.shared.model.Collection; |
25 import de.intevation.flys.client.shared.model.OutputMode; | 25 import de.intevation.flys.client.shared.model.OutputMode; |
26 import de.intevation.flys.client.client.Config; | 26 import de.intevation.flys.client.client.Config; |
27 import de.intevation.flys.client.client.event.OutputParameterChangeEvent; | |
28 import de.intevation.flys.client.client.event.OutputParameterChangeHandler; | |
27 import de.intevation.flys.client.client.ui.CollectionView; | 29 import de.intevation.flys.client.client.ui.CollectionView; |
28 import de.intevation.flys.client.client.ui.DatacageWindow; | 30 import de.intevation.flys.client.client.ui.DatacageWindow; |
29 import de.intevation.flys.client.client.ui.OutputTab; | 31 import de.intevation.flys.client.client.ui.OutputTab; |
30 | 32 |
31 | 33 |
32 /** | 34 /** |
33 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> | 35 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
34 */ | 36 */ |
35 public class ChartOutputTab extends OutputTab implements ResizedHandler { | 37 public class ChartOutputTab |
36 | 38 extends OutputTab |
39 implements ResizedHandler, OutputParameterChangeHandler | |
40 { | |
37 public static final int DEFAULT_CHART_WIDTH = 600; | 41 public static final int DEFAULT_CHART_WIDTH = 600; |
38 public static final int DEFAULT_CHART_HEIGHT = 500; | 42 public static final int DEFAULT_CHART_HEIGHT = 500; |
39 | 43 |
40 public static final int THEMEPANEL_MIN_WIDTH = 200; | 44 public static final int THEMEPANEL_MIN_WIDTH = 200; |
41 | 45 |
85 hLayout.setMembersMargin(10); | 89 hLayout.setMembersMargin(10); |
86 | 90 |
87 hLayout.addMember(left); | 91 hLayout.addMember(left); |
88 hLayout.addMember(right); | 92 hLayout.addMember(right); |
89 | 93 |
94 ChartThemePanel ctp = new ChartThemePanel(collection, mode); | |
95 ctp.addOutputParameterChangeHandler(this); | |
96 | |
90 right.addChild(createChartPanel()); | 97 right.addChild(createChartPanel()); |
91 left.addChild(new ChartThemePanel(collection, mode)); | 98 left.addChild(ctp); |
92 tbarPanel.addChild( | 99 tbarPanel.addChild( |
93 createTBarPanel(collectionView)); | 100 createTBarPanel(collectionView)); |
94 | 101 |
95 vLayout.addMember(tbarPanel); | 102 vLayout.addMember(tbarPanel); |
96 vLayout.addMember(hLayout); | 103 vLayout.addMember(hLayout); |
106 * chart - if existing - and requests a new one with adjusted size. | 113 * chart - if existing - and requests a new one with adjusted size. |
107 * | 114 * |
108 * @param event The resize event. | 115 * @param event The resize event. |
109 */ | 116 */ |
110 public void onResized(ResizedEvent event) { | 117 public void onResized(ResizedEvent event) { |
118 updateChartPanel(); | |
119 } | |
120 | |
121 | |
122 /** | |
123 * Listens to change event in the chart them panel and updates chart after | |
124 * receiving such an event. | |
125 * | |
126 * @param event The OutputParameterChangeEvent. | |
127 */ | |
128 public void onOutputParameterChanged(OutputParameterChangeEvent event) { | |
129 updateChartPanel(); | |
130 } | |
131 | |
132 | |
133 public void updateChartPanel() { | |
111 Canvas[] children = right.getChildren(); | 134 Canvas[] children = right.getChildren(); |
112 for (Canvas child: children) { | 135 for (Canvas child: children) { |
113 right.removeChild(child); | 136 right.removeChild(child); |
114 } | 137 } |
115 | 138 |