diff flys-client/src/main/java/de/intevation/flys/client/client/ui/ThemePanel.java @ 858:9f07f67f60a5

Subclassed ChartThemePanel, trigger redraws of Chart when interaction with "Action" widgets in ThemePanel occured (but will still crash). flys-client/trunk@2651 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Tue, 06 Sep 2011 11:09:13 +0000
parents 67c678903280
children 4668357b255e
line wrap: on
line diff
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/ThemePanel.java	Tue Sep 06 10:58:32 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/ThemePanel.java	Tue Sep 06 11:09:13 2011 +0000
@@ -22,10 +22,12 @@
 import de.intevation.flys.client.client.Config;
 import de.intevation.flys.client.client.FLYSConstants;
 import de.intevation.flys.client.client.event.HasOutputParameterChangeHandlers;
+import de.intevation.flys.client.client.event.HasRedrawRequestHandlers;
 import de.intevation.flys.client.client.event.OnMoveEvent;
 import de.intevation.flys.client.client.event.OnMoveHandler;
 import de.intevation.flys.client.client.event.OutputParameterChangeEvent;
 import de.intevation.flys.client.client.event.OutputParameterChangeHandler;
+import de.intevation.flys.client.client.event.RedrawRequestHandler;
 import de.intevation.flys.client.client.services.CollectionAttributeService;
 import de.intevation.flys.client.client.services.CollectionAttributeServiceAsync;
 
@@ -34,14 +36,18 @@
 extends               Canvas
 implements            OnMoveHandler,
                       EditCompleteHandler,
-                      HasOutputParameterChangeHandlers
+                      HasOutputParameterChangeHandlers,
+                      HasRedrawRequestHandlers
 {
     protected CollectionAttributeServiceAsync updater =
         GWT.create(CollectionAttributeService.class);
 
     private FLYSConstants MSG = GWT.create(FLYSConstants.class);
 
+    /** List of OutParameterChangedHandler. */
     protected List<OutputParameterChangeHandler> outHandlers;
+    /** List of ChartShallRedrawHandler. */
+    protected List<RedrawRequestHandler> redrawRequestHandlers;
 
     protected Collection collection;
     protected OutputMode mode;
@@ -57,9 +63,9 @@
     public ThemePanel(Collection collection, OutputMode mode) {
         this.collection  = collection;
         this.mode        = mode;
-
         this.list        = createGrid();
 
+        this.redrawRequestHandlers = new ArrayList<RedrawRequestHandler>();
         this.outHandlers = new ArrayList<OutputParameterChangeHandler>();
         this.navigation  = new ThemeNavigationPanel();
         this.navigation.addOnMoveHandler(this);
@@ -105,6 +111,28 @@
 
 
     /**
+     * Registers a RedrawRequestHandler.
+     *
+     * @param h The new handler.
+     */
+    public void addRedrawRequestHandler(RedrawRequestHandler h){
+        if (h != null) {
+            redrawRequestHandlers.add(h);
+        }
+    }
+
+
+    /**
+     * Request a redraw of e.g. a Chart.
+     */
+    protected void requestRedraw() {
+        for (RedrawRequestHandler handler: redrawRequestHandlers) {
+            handler.onRedrawRequest();
+        }
+    }
+
+
+    /**
      * Called when the attribution of an output changed. It informs the
      * registered handlers about the changes.
      */

http://dive4elements.wald.intevation.org