comparison 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
comparison
equal deleted inserted replaced
1357:4b7105e514d2 1358:c437e4f0f7be
80 */ 80 */
81 public ThemePanel(Collection collection, OutputMode mode) { 81 public ThemePanel(Collection collection, OutputMode mode) {
82 this.collection = collection; 82 this.collection = collection;
83 this.mode = mode; 83 this.mode = mode;
84 this.list = createGrid(); 84 this.list = createGrid();
85 list.addRowContextClickHandler(new RowContextClickHandler() {
86 public void onRowContextClick(RowContextClickEvent event) {
87 ListGridRecord[] records = list.getSelection();
88
89 Menu menu = null;
90
91 if (records == null || records.length == 0) {
92 return;
93 }
94 else if (records.length == 1) {
95 menu = getSingleContextMenu(records);
96 }
97 else if (records.length > 1) {
98 menu = getMultiContextMenu(records);
99 }
100
101 if (menu != null) {
102 list.setContextMenu(menu);
103 menu.showContextMenu();
104
105 event.cancel();
106 }
107 }
108 });
85 109
86 this.redrawRequestHandlers = new ArrayList<RedrawRequestHandler>(); 110 this.redrawRequestHandlers = new ArrayList<RedrawRequestHandler>();
87 this.outHandlers = new ArrayList<OutputParameterChangeHandler>(); 111 this.outHandlers = new ArrayList<OutputParameterChangeHandler>();
88 this.navigation = new ThemeNavigationPanel(); 112 this.navigation = new ThemeNavigationPanel();
89 this.navigation.addOnMoveHandler(this); 113 this.navigation.addOnMoveHandler(this);
242 /** 266 /**
243 * Create and configure the Grid to display. 267 * Create and configure the Grid to display.
244 */ 268 */
245 protected ListGrid createGrid() { 269 protected ListGrid createGrid() {
246 ListGrid grid = createNewGrid(); 270 ListGrid grid = createNewGrid();
247 grid.addRowContextClickHandler(new RowContextClickHandler() {
248 public void onRowContextClick(RowContextClickEvent event) {
249 ListGridRecord[] records = list.getSelection();
250
251 Menu menu = null;
252
253 if (records == null || records.length == 0) {
254 return;
255 }
256 else if (records.length == 1) {
257 menu = getSingleContextMenu(records);
258 }
259 else if (records.length > 1) {
260 menu = getMultiContextMenu(records);
261 }
262
263 if (menu != null) {
264 list.setContextMenu(menu);
265 menu.showContextMenu();
266
267 event.cancel();
268 }
269 }
270 });
271 271
272 return grid; 272 return grid;
273 } 273 }
274 274
275 275

http://dive4elements.wald.intevation.org