comparison flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapThemePanel.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 e50da1f74e58
children 8a93fb299e64
comparison
equal deleted inserted replaced
1302:17e7d5e437fb 1303:84c50f1d939b
22 public interface ActivateCallback { 22 public interface ActivateCallback {
23 void activate(Theme theme, boolean activate); 23 void activate(Theme theme, boolean activate);
24 } 24 }
25 25
26 26
27 public interface ThemeMovedCallback {
28 void onThemeMoved(Theme theme, int oldIdx, int newIdx);
29 }
30
31
27 32
28 private FLYSConstants MSG = GWT.create(FLYSConstants.class); 33 private FLYSConstants MSG = GWT.create(FLYSConstants.class);
29 34
30 35
31 protected ActivateCallback activateCallback; 36 protected ActivateCallback activateCallback;
37 protected ThemeMovedCallback themeMovedCallback;
32 38
33 39
34 public static final String GRID_FIELD_ACTIVE = "active"; 40 public static final String GRID_FIELD_ACTIVE = "active";
35 public static final String GRID_FIELD_NAME = "name"; 41 public static final String GRID_FIELD_NAME = "name";
36 42
37 43
38 protected MapOutputTab mapOut; 44 protected MapOutputTab mapOut;
39 45
40 46
41 public MapThemePanel( 47 public MapThemePanel(
42 Collection collection, 48 Collection collection,
43 OutputMode mode, 49 OutputMode mode,
44 ActivateCallback activateCallback) 50 ActivateCallback activateCallback
45 { 51 ) {
52 this(collection, mode, activateCallback, null);
53 }
54
55
56 public MapThemePanel(
57 Collection collection,
58 OutputMode mode,
59 ActivateCallback activateCallback,
60 ThemeMovedCallback themeMovedCallback
61 ) {
46 super(collection, mode); 62 super(collection, mode);
47 63
48 this.activateCallback = activateCallback; 64 this.activateCallback = activateCallback;
65 this.themeMovedCallback = themeMovedCallback;
49 66
50 initGrid(); 67 initGrid();
51 initLayout(); 68 initLayout();
52 69
53 updateGrid(); 70 updateGrid();
98 activateCallback.activate(theme, active); 115 activateCallback.activate(theme, active);
99 } 116 }
100 117
101 theme.setActive(active ? 1 : 0); 118 theme.setActive(active ? 1 : 0);
102 } 119 }
120
121
122 @Override
123 protected void fireThemeMoved(Theme theme, int oldIdx, int newIdx) {
124 if (themeMovedCallback != null) {
125 themeMovedCallback.onThemeMoved(theme, oldIdx, newIdx);
126 }
127 }
103 } 128 }
104 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : 129 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org