diff 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
line wrap: on
line diff
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/ThemePanel.java	Mon Oct 10 15:29:39 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/ThemePanel.java	Tue Oct 11 11:50:58 2011 +0000
@@ -255,6 +255,19 @@
     }
 
 
+    /**
+     * This method should be defined in subclasses that wants to listen to this
+     * event.
+     *
+     * @param theme The theme that is moved.
+     * @param oldIdx The index of the theme before it was moved.
+     * @param newIdx The index of the theme after it was moved.
+     */
+    protected void fireThemeMoved(Theme theme, int oldIdx, int newIdx) {
+        // TODO Implement in subclasses
+    }
+
+
     @Override
     public void onMove(OnMoveEvent event) {
         int type = event.getType();
@@ -291,6 +304,7 @@
 
         for (ListGridRecord record: records) {
             Theme theme = ((FacetRecord) record).getTheme();
+            fireThemeMoved(theme, theme.getPosition(), idx);
             themeList.setThemePosition(theme, idx++);
         }
 
@@ -315,6 +329,7 @@
 
         for (int i = 0; i < records.length ; i++) {
             Theme theme = ((FacetRecord) records[i]).getTheme();
+            fireThemeMoved(theme, theme.getPosition(), newPos[i]);
             themeList.setThemePosition(theme, newPos[i]);
         }
 
@@ -339,6 +354,7 @@
 
         for (int i = records.length-1; i >= 0; i--) {
             Theme theme = ((FacetRecord) records[i]).getTheme();
+            fireThemeMoved(theme, theme.getPosition(), newPos[i]);
             themeList.setThemePosition(theme, newPos[i]);
         }
 
@@ -358,6 +374,7 @@
 
         for (int i = records.length-1; i >= 0; i--) {
             Theme theme = ((FacetRecord) records[i]).getTheme();
+            fireThemeMoved(theme, theme.getPosition(), idx);
             themeList.setThemePosition(theme, idx--);
         }
 

http://dive4elements.wald.intevation.org