Mercurial > dive4elements > river
comparison flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/CrossSectionChartThemePanel.java @ 1445:df7ebcbff984
Bugfixing and feature-adding for cross-sections/areas.
flys-client/trunk@3457 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Mon, 19 Dec 2011 07:37:15 +0000 |
parents | bdac8a72f7e6 |
children | 8da36efc839a |
comparison
equal
deleted
inserted
replaced
1444:bdac8a72f7e6 | 1445:df7ebcbff984 |
---|---|
115 } | 115 } |
116 | 116 |
117 | 117 |
118 /** | 118 /** |
119 * Tell an area artifact where to get the upper and lower curve from. | 119 * Tell an area artifact where to get the upper and lower curve from. |
120 * @param over if null, something | |
120 */ | 121 */ |
121 public void feedTellArea(final String artifact, Theme under, Theme over) { | 122 public void feedTellArea(final String artifact, Theme under, Theme over) { |
122 Data[] feedData = new Data[] { | 123 |
123 DefaultData.createSimpleStringData("area.curve_under", | 124 Data[] feedData; |
124 under.getArtifact() + under.getIndex()), | 125 |
125 DefaultData.createSimpleStringData("area.curve_over", | 126 if (over != null) { |
126 over.getArtifact() + over.getIndex()), | 127 feedData = new Data[] { |
127 }; | 128 DefaultData.createSimpleStringData("area.curve_under", |
129 under.getArtifact() + under.getIndex()), | |
130 DefaultData.createSimpleStringData("area.curve_under", | |
131 under.getArtifact() + under.getIndex()), | |
132 DefaultData.createSimpleStringData("area.name", | |
133 over.getDescription() + " / " + under.getDescription()) | |
134 }; | |
135 } | |
136 else { | |
137 feedData = new Data[] { | |
138 DefaultData.createSimpleStringData("area.curve_under", | |
139 under.getArtifact() + under.getIndex()), | |
140 DefaultData.createSimpleStringData("area.name", | |
141 under.getDescription() + " / " + MSG.getString("x_axis")) | |
142 }; | |
143 } | |
128 | 144 |
129 feedService.feed( | 145 feedService.feed( |
130 Config.getInstance().getLocale(), | 146 Config.getInstance().getLocale(), |
131 new DefaultArtifact(artifact, "TODO:hash"), | 147 new DefaultArtifact(artifact, "TODO:hash"), |
132 feedData, | 148 feedData, |
138 enable(); | 154 enable(); |
139 } | 155 } |
140 public void onSuccess(Artifact artifact) { | 156 public void onSuccess(Artifact artifact) { |
141 GWT.log("Successfully set area params to " + artifact); | 157 GWT.log("Successfully set area params to " + artifact); |
142 requestRedraw(); | 158 requestRedraw(); |
159 updateCollection(); | |
160 updateGrid(); | |
143 enable(); | 161 enable(); |
144 // TODO: Update the grid/collection, to include this new | |
145 // facet. | |
146 //updateCollection? | |
147 } | 162 } |
148 }); | 163 }); |
149 } | 164 } |
150 | 165 |
151 /** | 166 /** |
152 * sets currentMasterUUID. | 167 * sets currentMasterUUID. |
153 */ | 168 */ |
154 public String findCurrentMaster() { | 169 public String findCurrentMaster() { |
155 ThemeList themeList = getThemeList(); | 170 ThemeList themeList = getThemeList(); |
156 int count = getThemeList().getThemeCount(); | 171 int count = getThemeList().getThemeCount(); |
172 String firstCSUuid = null; | |
157 for (int i = 1; i <= count; i++) { | 173 for (int i = 1; i <= count; i++) { |
158 Theme theme = themeList.getThemeAt(i); | 174 Theme theme = themeList.getThemeAt(i); |
159 String value = theme.getCollectionItem().getData().get("cross_section.master?"); | 175 String value = theme.getCollectionItem().getData().get("cross_section.master?"); |
160 | 176 |
161 if (value != null && !value.equals("0")) { | 177 if (value != null) { |
162 setCurrentMaster(theme.getArtifact()); | 178 if (firstCSUuid == null) { |
163 GWT.log("found a master! " + currentMasterUUID + "/" + theme.getDescription()); | 179 firstCSUuid = theme.getArtifact(); |
164 return theme.getDescription(); | 180 } |
165 } | 181 if (!value.equals("0")) { |
182 setCurrentMaster(theme.getArtifact()); | |
183 GWT.log("found a master: " + currentMasterUUID + "/" + theme.getDescription()); | |
184 return theme.getDescription(); | |
185 } | |
186 } | |
187 } | |
188 // There is none selected. Take the first one. | |
189 if (firstCSUuid != null) { | |
190 setCurrentMaster(firstCSUuid); | |
191 feedTellMaster(firstCSUuid); | |
166 } | 192 } |
167 return null; | 193 return null; |
168 } | 194 } |
169 | 195 |
170 | 196 |
422 | 448 |
423 // TODO actually use crosssectionkmservice with | 449 // TODO actually use crosssectionkmservice with |
424 // min/max-extension | 450 // min/max-extension |
425 spinnerItem.setMin(0); | 451 spinnerItem.setMin(0); |
426 spinnerItem.setMax(1000); | 452 spinnerItem.setMax(1000); |
427 spinnerItem.setStep(5f); | 453 spinnerItem.setStep(0.5f); |
428 spinnerItem.setChangeOnKeypress(true); | 454 spinnerItem.setChangeOnKeypress(true); |
429 return spinnerItem; | 455 return spinnerItem; |
430 } | 456 } |
431 | 457 |
432 | 458 |
523 } | 549 } |
524 | 550 |
525 | 551 |
526 /** | 552 /** |
527 * Create and parameterize a new area artifact. | 553 * Create and parameterize a new area artifact. |
554 * @param under | |
555 * @param over if null, something. | |
528 */ | 556 */ |
529 public void createAreaArtifact(final Theme under, final Theme over) { | 557 public void createAreaArtifact(final Theme under, final Theme over) { |
530 Config config = Config.getInstance(); | 558 Config config = Config.getInstance(); |
531 String locale = config.getLocale(); | 559 String locale = config.getLocale(); |
532 | 560 |
595 } | 623 } |
596 }); | 624 }); |
597 } | 625 } |
598 | 626 |
599 MenuItem underMenuItem = new MenuItem("Under ..."); | 627 MenuItem underMenuItem = new MenuItem("Under ..."); |
628 underMenuItem.addClickHandler(new ClickHandler() { | |
629 public void onClick(MenuItemClickEvent evt) { | |
630 disable(); | |
631 createAreaArtifact(facetTheme, null); | |
632 } | |
633 }); | |
600 MenuItem overMenuItem = new MenuItem("Over ..."); | 634 MenuItem overMenuItem = new MenuItem("Over ..."); |
635 overMenuItem.addClickHandler(new ClickHandler() { | |
636 public void onClick(MenuItemClickEvent evt) { | |
637 disable(); | |
638 createAreaArtifact(facetTheme, null); | |
639 } | |
640 }); | |
601 areaMenu.addItem(createSeparator()); | 641 areaMenu.addItem(createSeparator()); |
602 areaMenu.addItem(underMenuItem); | 642 areaMenu.addItem(underMenuItem); |
603 areaMenu.addItem(overMenuItem); | 643 areaMenu.addItem(overMenuItem); |
604 | 644 |
605 areaMenuItem.setSubmenu(areaMenu); | 645 areaMenuItem.setSubmenu(areaMenu); |