Mercurial > dive4elements > river
diff flys-client/src/main/java/de/intevation/flys/client/client/ui/ThemePanel.java @ 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 | 290d5687f202 |
children | 9d67cd17ab78 |
line wrap: on
line diff
--- 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; }