comparison flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/CrossSectionChartThemePanel.java @ 4568:bbd82bd8e541

flys-client: Cosmetics and warnings.
author Christian Lins <christian.lins@intevation.de>
date Mon, 19 Nov 2012 00:07:53 +0100
parents 3b4cef59836a
children
comparison
equal deleted inserted replaced
4567:5e6e89f19a37 4568:bbd82bd8e541
1 package de.intevation.flys.client.client.ui.chart; 1 package de.intevation.flys.client.client.ui.chart;
2 2
3 import com.google.gwt.core.client.GWT; 3 import com.google.gwt.core.client.GWT;
4 import com.google.gwt.user.client.rpc.AsyncCallback; 4 import com.google.gwt.user.client.rpc.AsyncCallback;
5
5 import com.smartgwt.client.types.ListGridFieldType; 6 import com.smartgwt.client.types.ListGridFieldType;
6 import com.smartgwt.client.util.SC; 7 import com.smartgwt.client.util.SC;
7 import com.smartgwt.client.widgets.Canvas; 8 import com.smartgwt.client.widgets.Canvas;
8 import com.smartgwt.client.widgets.form.DynamicForm; 9 import com.smartgwt.client.widgets.form.DynamicForm;
9 import com.smartgwt.client.widgets.form.fields.SelectItem; 10 import com.smartgwt.client.widgets.form.fields.SelectItem;
123 feedService.feed( 124 feedService.feed(
124 Config.getInstance().getLocale(), 125 Config.getInstance().getLocale(),
125 artifactReference(artifact), 126 artifactReference(artifact),
126 feedData, 127 feedData,
127 new AsyncCallback<Artifact>() { 128 new AsyncCallback<Artifact>() {
129 @Override
128 public void onFailure(Throwable caught) { 130 public void onFailure(Throwable caught) {
129 GWT.log("Could not feed artifact (" + artifact 131 GWT.log("Could not feed artifact (" + artifact
130 + ") with master marker: " + caught.getMessage()); 132 + ") with master marker: " + caught.getMessage());
131 SC.warn(MSG.getString(caught.getMessage())); 133 SC.warn(MSG.getString(caught.getMessage()));
132 enable(); 134 enable();
133 } 135 }
136 @Override
134 public void onSuccess(Artifact artifact) { 137 public void onSuccess(Artifact artifact) {
135 GWT.log("Successfully injected master mark to " + artifact); 138 GWT.log("Successfully injected master mark to " + artifact);
136 setCurrentCSMaster(artifact.getUuid()); 139 setCurrentCSMaster(artifact.getUuid());
137 requestRedraw(); 140 requestRedraw();
138 enable(); 141 enable();
146 */ 149 */
147 public String findCurrentCSMaster() { 150 public String findCurrentCSMaster() {
148 ThemeList themeList = getThemeList(); 151 ThemeList themeList = getThemeList();
149 int count = getThemeList().getThemeCount(); 152 int count = getThemeList().getThemeCount();
150 String firstCSUuid = null; 153 String firstCSUuid = null;
151 Theme firstCS = null; 154
152 for (int i = 1; i <= count; i++) { 155 for (int i = 1; i <= count; i++) {
153 Theme theme = themeList.getThemeAt(i); 156 Theme theme = themeList.getThemeAt(i);
154 String value = dataOf(theme, CS_IS_MASTER); 157 String value = dataOf(theme, CS_IS_MASTER);
155 158
156 if (value != null) { 159 if (value != null) {
157 if (firstCSUuid == null) { 160 if (firstCSUuid == null) {
158 firstCSUuid = theme.getArtifact(); 161 firstCSUuid = theme.getArtifact();
159 firstCS = theme;
160 } 162 }
161 if (!value.equals("0")) { 163 if (!value.equals("0")) {
162 setCurrentCSMaster(theme.getArtifact()); 164 setCurrentCSMaster(theme.getArtifact());
163 GWT.log("found a master: " + currentCSMasterUUID 165 GWT.log("found a master: " + currentCSMasterUUID
164 + "/" + theme.getDescription()); 166 + "/" + theme.getDescription());
201 masterCb.setValue(getCurrentCSMaster()); 203 masterCb.setValue(getCurrentCSMaster());
202 204
203 // Add Change Handler to first unset the old master and then set the 205 // Add Change Handler to first unset the old master and then set the
204 // new master. 206 // new master.
205 masterCb.addChangeHandler(new ChangeHandler() { 207 masterCb.addChangeHandler(new ChangeHandler() {
208 @Override
206 public void onChange(ChangeEvent event) { 209 public void onChange(ChangeEvent event) {
207 String selectedItem = (String) event.getValue(); 210 String selectedItem = (String) event.getValue();
208 final String artifact = selectedItem; 211 final String artifact = selectedItem;
209 212
210 disable(); 213 disable();
216 feedService.feed( 219 feedService.feed(
217 locale, 220 locale,
218 artifactReference(getCurrentCSMaster()), 221 artifactReference(getCurrentCSMaster()),
219 feedData, 222 feedData,
220 new AsyncCallback<Artifact>() { 223 new AsyncCallback<Artifact>() {
224 @Override
221 public void onFailure(Throwable caught) { 225 public void onFailure(Throwable caught) {
222 GWT.log("Could not un-master artifact (" 226 GWT.log("Could not un-master artifact ("
223 + getCurrentCSMaster() + "): " + 227 + getCurrentCSMaster() + "): " +
224 caught.getMessage()); 228 caught.getMessage());
225 SC.warn(MSG.getString(caught.getMessage())); 229 SC.warn(MSG.getString(caught.getMessage()));
226 enable(); 230 enable();
227 } 231 }
232 @Override
228 public void onSuccess(Artifact oldMaster) { 233 public void onSuccess(Artifact oldMaster) {
229 GWT.log("Successfully un-mastered artifact."); 234 GWT.log("Successfully un-mastered artifact.");
230 feedTellMaster(artifact); 235 feedTellMaster(artifact);
231 } 236 }
232 }); 237 });
394 * @param facetRecord The underlying datastores record. 399 * @param facetRecord The underlying datastores record.
395 * @param up If true, numerically higher values are preferred if 400 * @param up If true, numerically higher values are preferred if
396 * two values in \param in are in the same distance to 401 * two values in \param in are in the same distance to
397 * \param to. 402 * \param to.
398 */ 403 */
404 @Override
399 public void spinnerValueEntered(KMSpinner spinner, final double enteredKm, final FacetRecord facetRecord, final boolean up) { 405 public void spinnerValueEntered(KMSpinner spinner, final double enteredKm, final FacetRecord facetRecord, final boolean up) {
400 disable(); 406 disable();
401 Config config = Config.getInstance(); 407 Config config = Config.getInstance();
402 final String locale = config.getLocale(); 408 final String locale = config.getLocale();
403 409
608 MenuItem synchronNavigationMenuItem = new MenuItem(); 614 MenuItem synchronNavigationMenuItem = new MenuItem();
609 final String themeHash = themeHash(facetTheme); 615 final String themeHash = themeHash(facetTheme);
610 if (synchronCrossSectionThemes.contains(themeHash)) { 616 if (synchronCrossSectionThemes.contains(themeHash)) {
611 synchronNavigationMenuItem.setTitle(MSG.chart_themepanel_asynchron()); 617 synchronNavigationMenuItem.setTitle(MSG.chart_themepanel_asynchron());
612 synchronNavigationMenuItem.addClickHandler(new ClickHandler() { 618 synchronNavigationMenuItem.addClickHandler(new ClickHandler() {
619 @Override
613 public void onClick(MenuItemClickEvent evt) { 620 public void onClick(MenuItemClickEvent evt) {
614 synchronCrossSectionThemes.remove (themeHash); 621 synchronCrossSectionThemes.remove (themeHash);
615 } 622 }
616 }); 623 });
617 } 624 }
618 else { 625 else {
619 synchronNavigationMenuItem.setTitle(MSG.chart_themepanel_synchron()); 626 synchronNavigationMenuItem.setTitle(MSG.chart_themepanel_synchron());
620 synchronNavigationMenuItem.addClickHandler(new ClickHandler() { 627 synchronNavigationMenuItem.addClickHandler(new ClickHandler() {
628 @Override
621 public void onClick(MenuItemClickEvent evt) { 629 public void onClick(MenuItemClickEvent evt) {
622 synchronCrossSectionThemes.add (themeHash); 630 synchronCrossSectionThemes.add (themeHash);
623 } 631 }
624 }); 632 });
625 } 633 }

http://dive4elements.wald.intevation.org