Mercurial > dive4elements > river
comparison flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/CrossSectionChartThemePanel.java @ 1470:eef55d18f424
Cosmetics, refactoring, renamed Master to CSMaster to avoid confusion.
flys-client/trunk@3512 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Wed, 21 Dec 2011 12:21:23 +0000 |
parents | 61521bc0ced3 |
children | a2b0b2af529f |
comparison
equal
deleted
inserted
replaced
1469:31d0557f31a2 | 1470:eef55d18f424 |
---|---|
61 /** Service to query measurement points of cross sections. */ | 61 /** Service to query measurement points of cross sections. */ |
62 CrossSectionKMServiceAsync kmService = GWT.create( | 62 CrossSectionKMServiceAsync kmService = GWT.create( |
63 de.intevation.flys.client.client.services.CrossSectionKMService.class); | 63 de.intevation.flys.client.client.services.CrossSectionKMService.class); |
64 | 64 |
65 /** UUID of the current "master" cross section. */ | 65 /** UUID of the current "master" cross section. */ |
66 protected String currentMasterUUID; | 66 protected String currentCSMasterUUID; |
67 | 67 |
68 /** The layout (used for visual active/inactive feedback). */ | 68 /** The layout (used for visual active/inactive feedback). */ |
69 protected VLayout layout; | 69 protected VLayout layout; |
70 | 70 |
71 /** | 71 /** |
98 SC.warn(MSG.getString(caught.getMessage())); | 98 SC.warn(MSG.getString(caught.getMessage())); |
99 enable(); | 99 enable(); |
100 } | 100 } |
101 public void onSuccess(Artifact artifact) { | 101 public void onSuccess(Artifact artifact) { |
102 GWT.log("Successfully injected master mark to " + artifact); | 102 GWT.log("Successfully injected master mark to " + artifact); |
103 setCurrentMaster(artifact.getUuid()); | 103 setCurrentCSMaster(artifact.getUuid()); |
104 requestRedraw(); | 104 requestRedraw(); |
105 enable(); | 105 enable(); |
106 } | 106 } |
107 }); | 107 }); |
108 } | 108 } |
109 | 109 |
110 | 110 |
111 | 111 |
112 /** | 112 /** |
113 * Sets currentMasterUUID. | 113 * Sets currentCSMasterUUID. |
114 */ | 114 */ |
115 public String findCurrentMaster() { | 115 public String findCurrentCSMaster() { |
116 ThemeList themeList = getThemeList(); | 116 ThemeList themeList = getThemeList(); |
117 int count = getThemeList().getThemeCount(); | 117 int count = getThemeList().getThemeCount(); |
118 String firstCSUuid = null; | 118 String firstCSUuid = null; |
119 for (int i = 1; i <= count; i++) { | 119 for (int i = 1; i <= count; i++) { |
120 Theme theme = themeList.getThemeAt(i); | 120 Theme theme = themeList.getThemeAt(i); |
123 if (value != null) { | 123 if (value != null) { |
124 if (firstCSUuid == null) { | 124 if (firstCSUuid == null) { |
125 firstCSUuid = theme.getArtifact(); | 125 firstCSUuid = theme.getArtifact(); |
126 } | 126 } |
127 if (!value.equals("0")) { | 127 if (!value.equals("0")) { |
128 setCurrentMaster(theme.getArtifact()); | 128 setCurrentCSMaster(theme.getArtifact()); |
129 GWT.log("found a master: " + currentMasterUUID + "/" + theme.getDescription()); | 129 GWT.log("found a master: " + currentCSMasterUUID + "/" + theme.getDescription()); |
130 return theme.getDescription(); | 130 return theme.getDescription(); |
131 } | 131 } |
132 } | 132 } |
133 } | 133 } |
134 // There is none selected. Take the first one. | 134 // There is none selected. Take the first one. |
135 if (firstCSUuid != null) { | 135 if (firstCSUuid != null) { |
136 setCurrentMaster(firstCSUuid); | 136 setCurrentCSMaster(firstCSUuid); |
137 feedTellMaster(firstCSUuid); | 137 feedTellMaster(firstCSUuid); |
138 } | 138 } |
139 return null; | 139 return null; |
140 } | 140 } |
141 | 141 |
161 form.setFields(cbItem); | 161 form.setFields(cbItem); |
162 layout.addMember(form); | 162 layout.addMember(form); |
163 | 163 |
164 Config config = Config.getInstance(); | 164 Config config = Config.getInstance(); |
165 final String locale = config.getLocale(); | 165 final String locale = config.getLocale(); |
166 findCurrentMaster(); | 166 findCurrentCSMaster(); |
167 cbItem.setValue(getCurrentMaster()); | 167 cbItem.setValue(getCurrentCSMaster()); |
168 | 168 |
169 // Add Change Handler to first unset the old master and then set the | 169 // Add Change Handler to first unset the old master and then set the |
170 // new master. | 170 // new master. |
171 cbItem.addChangeHandler(new ChangeHandler() { | 171 cbItem.addChangeHandler(new ChangeHandler() { |
172 public void onChange(ChangeEvent event) { | 172 public void onChange(ChangeEvent event) { |
174 final String artifact = selectedItem; | 174 final String artifact = selectedItem; |
175 | 175 |
176 disable(); | 176 disable(); |
177 | 177 |
178 // Tell current master that he is not master anymore. | 178 // Tell current master that he is not master anymore. |
179 if (getCurrentMaster() != null) { | 179 if (getCurrentCSMaster() != null) { |
180 Data[] feedData = DefaultData.createSimpleStringDataArray( | 180 Data[] feedData = DefaultData.createSimpleStringDataArray( |
181 "cross_section.master?", "0"); | 181 "cross_section.master?", "0"); |
182 feedService.feed( | 182 feedService.feed( |
183 locale, | 183 locale, |
184 new DefaultArtifact(getCurrentMaster(), "TODO:hash"), | 184 new DefaultArtifact(getCurrentCSMaster(), "TODO:hash"), |
185 feedData, | 185 feedData, |
186 new AsyncCallback<Artifact>() { | 186 new AsyncCallback<Artifact>() { |
187 public void onFailure(Throwable caught) { | 187 public void onFailure(Throwable caught) { |
188 GWT.log("Could not un-master artifact ("+getCurrentMaster()+"): " + | 188 GWT.log("Could not un-master artifact ("+getCurrentCSMaster()+"): " + |
189 caught.getMessage()); | 189 caught.getMessage()); |
190 SC.warn(MSG.getString(caught.getMessage())); | 190 SC.warn(MSG.getString(caught.getMessage())); |
191 enable(); | 191 enable(); |
192 } | 192 } |
193 public void onSuccess(Artifact oldMaster) { | 193 public void onSuccess(Artifact oldMaster) { |
246 } | 246 } |
247 } | 247 } |
248 return bestMatch; | 248 return bestMatch; |
249 } | 249 } |
250 | 250 |
251 | |
252 /** Feed the master (WINFO) artifact with the km of the crosssection, | |
253 * such that it can be displayed in the diagrams subtitle. */ | |
254 public void sendFeed(double kmD) { | |
255 ; | |
256 } | |
251 | 257 |
252 /** Feed a single artifact with the km of the crosssection to display. */ | 258 /** Feed a single artifact with the km of the crosssection to display. */ |
253 public void sendFeed(FacetRecord facetRecord, double kmD) { | 259 public void sendFeed(FacetRecord facetRecord, double kmD) { |
254 Config config = Config.getInstance(); | 260 Config config = Config.getInstance(); |
255 final String locale = config.getLocale(); | 261 final String locale = config.getLocale(); |
460 list.setFields(active, name, actions); | 466 list.setFields(active, name, actions); |
461 } | 467 } |
462 | 468 |
463 | 469 |
464 /** Get Current Cross-section Masters uuid. */ | 470 /** Get Current Cross-section Masters uuid. */ |
465 public String getCurrentMaster() { | 471 public String getCurrentCSMaster() { |
466 return currentMasterUUID; | 472 return currentCSMasterUUID; |
467 } | 473 } |
468 | 474 |
469 | 475 |
470 /** Set Current Cross-section Masters uuid. */ | 476 /** Set Current Cross-section Masters uuid. */ |
471 public void setCurrentMaster(String currentMasterUuid) { | 477 public void setCurrentCSMaster(String currentMasterUuid) { |
472 this.currentMasterUUID = currentMasterUuid; | 478 this.currentCSMasterUUID = currentMasterUuid; |
473 } | 479 } |
474 | 480 |
475 | 481 |
476 /** Returns name of cross section area facets. */ | 482 /** Returns name of cross section area facets. */ |
477 protected String getAreaFacetName() { | 483 protected String getAreaFacetName() { |