changeset 1358:c437e4f0f7be

Moved the context menu handler to constructor to have the menu available in each subclass. flys-client/trunk@3043 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Raimund Renkert <raimund.renkert@intevation.de>
date Thu, 20 Oct 2011 09:11:49 +0000
parents 4b7105e514d2
children 5ebcf5b3fc10
files flys-client/ChangeLog flys-client/src/main/java/de/intevation/flys/client/client/ui/ThemePanel.java
diffstat 2 files changed, 30 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/flys-client/ChangeLog	Thu Oct 20 09:07:58 2011 +0000
+++ b/flys-client/ChangeLog	Thu Oct 20 09:11:49 2011 +0000
@@ -1,3 +1,9 @@
+2011-10-20  Raimund Renkert <raimund.renkert@intevation.de>
+
+	* src/main/java/de/intevation/flys/client/client/ui/ThemePanel.java:
+	  Moved the context menu handler to constructor to have the menu
+	  available in each subclass.
+
 2011-10-20  Raimund Renkert <raimund.renkert@intevation.de>
 
 	* src/main/java/de/intevation/flys/client/client/ui/StyleEditorWindow.java:
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/ThemePanel.java	Thu Oct 20 09:07:58 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/ThemePanel.java	Thu Oct 20 09:11:49 2011 +0000
@@ -82,6 +82,30 @@
         this.collection  = collection;
         this.mode        = mode;
         this.list        = createGrid();
+        list.addRowContextClickHandler(new RowContextClickHandler() {
+            public void onRowContextClick(RowContextClickEvent event) {
+                ListGridRecord[] records = list.getSelection();
+
+                Menu menu = null;
+
+                if (records == null || records.length == 0) {
+                    return;
+                }
+                else if (records.length == 1) {
+                    menu = getSingleContextMenu(records);
+                }
+                else if (records.length > 1) {
+                    menu = getMultiContextMenu(records);
+                }
+
+                if (menu != null) {
+                    list.setContextMenu(menu);
+                    menu.showContextMenu();
+
+                    event.cancel();
+                }
+            }
+        });
 
         this.redrawRequestHandlers = new ArrayList<RedrawRequestHandler>();
         this.outHandlers = new ArrayList<OutputParameterChangeHandler>();
@@ -244,30 +268,6 @@
      */
     protected ListGrid createGrid() {
         ListGrid grid = createNewGrid();
-        grid.addRowContextClickHandler(new RowContextClickHandler() {
-            public void onRowContextClick(RowContextClickEvent event) {
-                ListGridRecord[] records = list.getSelection();
-
-                Menu menu = null;
-
-                if (records == null || records.length == 0) {
-                    return;
-                }
-                else if (records.length == 1) {
-                    menu = getSingleContextMenu(records);
-                }
-                else if (records.length > 1) {
-                    menu = getMultiContextMenu(records);
-                }
-
-                if (menu != null) {
-                    list.setContextMenu(menu);
-                    menu.showContextMenu();
-
-                    event.cancel();
-                }
-            }
-        });
 
         return grid;
     }

http://dive4elements.wald.intevation.org