comparison flys-client/src/main/java/de/intevation/flys/client/client/ui/ThemePanel.java @ 1303:84c50f1d939b

Added the option for the MapThemePanel to listen to Theme move events. flys-client/trunk@2936 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Tue, 11 Oct 2011 11:50:58 +0000
parents 4668357b255e
children a95e82d6bcc1
comparison
equal deleted inserted replaced
1302:17e7d5e437fb 1303:84c50f1d939b
253 253
254 updateCollection(); 254 updateCollection();
255 } 255 }
256 256
257 257
258 /**
259 * This method should be defined in subclasses that wants to listen to this
260 * event.
261 *
262 * @param theme The theme that is moved.
263 * @param oldIdx The index of the theme before it was moved.
264 * @param newIdx The index of the theme after it was moved.
265 */
266 protected void fireThemeMoved(Theme theme, int oldIdx, int newIdx) {
267 // TODO Implement in subclasses
268 }
269
270
258 @Override 271 @Override
259 public void onMove(OnMoveEvent event) { 272 public void onMove(OnMoveEvent event) {
260 int type = event.getType(); 273 int type = event.getType();
261 274
262 GWT.log("ThemePanel.onMove: " + type); 275 GWT.log("ThemePanel.onMove: " + type);
289 302
290 int idx = 1; 303 int idx = 1;
291 304
292 for (ListGridRecord record: records) { 305 for (ListGridRecord record: records) {
293 Theme theme = ((FacetRecord) record).getTheme(); 306 Theme theme = ((FacetRecord) record).getTheme();
307 fireThemeMoved(theme, theme.getPosition(), idx);
294 themeList.setThemePosition(theme, idx++); 308 themeList.setThemePosition(theme, idx++);
295 } 309 }
296 310
297 updateGrid(); 311 updateGrid();
298 } 312 }
313 newPos[i] = theme.getPosition() - 1; 327 newPos[i] = theme.getPosition() - 1;
314 } 328 }
315 329
316 for (int i = 0; i < records.length ; i++) { 330 for (int i = 0; i < records.length ; i++) {
317 Theme theme = ((FacetRecord) records[i]).getTheme(); 331 Theme theme = ((FacetRecord) records[i]).getTheme();
332 fireThemeMoved(theme, theme.getPosition(), newPos[i]);
318 themeList.setThemePosition(theme, newPos[i]); 333 themeList.setThemePosition(theme, newPos[i]);
319 } 334 }
320 335
321 updateGrid(); 336 updateGrid();
322 } 337 }
337 newPos[i] = theme.getPosition()+1; 352 newPos[i] = theme.getPosition()+1;
338 } 353 }
339 354
340 for (int i = records.length-1; i >= 0; i--) { 355 for (int i = records.length-1; i >= 0; i--) {
341 Theme theme = ((FacetRecord) records[i]).getTheme(); 356 Theme theme = ((FacetRecord) records[i]).getTheme();
357 fireThemeMoved(theme, theme.getPosition(), newPos[i]);
342 themeList.setThemePosition(theme, newPos[i]); 358 themeList.setThemePosition(theme, newPos[i]);
343 } 359 }
344 360
345 updateGrid(); 361 updateGrid();
346 } 362 }
356 372
357 int idx = themeList.getThemeCount(); 373 int idx = themeList.getThemeCount();
358 374
359 for (int i = records.length-1; i >= 0; i--) { 375 for (int i = records.length-1; i >= 0; i--) {
360 Theme theme = ((FacetRecord) records[i]).getTheme(); 376 Theme theme = ((FacetRecord) records[i]).getTheme();
377 fireThemeMoved(theme, theme.getPosition(), idx);
361 themeList.setThemePosition(theme, idx--); 378 themeList.setThemePosition(theme, idx--);
362 } 379 }
363 380
364 updateGrid(); 381 updateGrid();
365 } 382 }

http://dive4elements.wald.intevation.org