Mercurial > dive4elements > river
comparison flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapThemePanel.java @ 4330:93e023131546
Removed the legend images from map theme panel.
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Tue, 30 Oct 2012 15:35:09 +0100 |
parents | 61020a61ed38 |
children | 5014a84c0c7d |
comparison
equal
deleted
inserted
replaced
4329:c9dcce9448f2 | 4330:93e023131546 |
---|---|
1 package de.intevation.flys.client.client.ui.map; | 1 package de.intevation.flys.client.client.ui.map; |
2 | 2 |
3 import com.google.gwt.core.client.GWT; | 3 import com.google.gwt.core.client.GWT; |
4 | |
5 import com.smartgwt.client.types.ImageStyle; | |
6 import com.smartgwt.client.types.ListGridFieldType; | 4 import com.smartgwt.client.types.ListGridFieldType; |
7 import com.smartgwt.client.types.VerticalAlignment; | |
8 import com.smartgwt.client.util.BooleanCallback; | 5 import com.smartgwt.client.util.BooleanCallback; |
9 import com.smartgwt.client.util.SC; | 6 import com.smartgwt.client.util.SC; |
10 import com.smartgwt.client.widgets.Canvas; | |
11 import com.smartgwt.client.widgets.Img; | |
12 import com.smartgwt.client.widgets.grid.ListGrid; | |
13 import com.smartgwt.client.widgets.grid.ListGridField; | 7 import com.smartgwt.client.widgets.grid.ListGridField; |
14 import com.smartgwt.client.widgets.grid.ListGridRecord; | 8 import com.smartgwt.client.widgets.grid.ListGridRecord; |
15 import com.smartgwt.client.widgets.grid.events.HeaderDoubleClickEvent; | 9 import com.smartgwt.client.widgets.grid.events.HeaderDoubleClickEvent; |
16 import com.smartgwt.client.widgets.grid.events.HeaderDoubleClickHandler; | 10 import com.smartgwt.client.widgets.grid.events.HeaderDoubleClickHandler; |
17 import com.smartgwt.client.widgets.layout.HLayout; | |
18 import com.smartgwt.client.widgets.layout.VLayout; | 11 import com.smartgwt.client.widgets.layout.VLayout; |
19 import com.smartgwt.client.widgets.menu.Menu; | 12 import com.smartgwt.client.widgets.menu.Menu; |
20 import com.smartgwt.client.widgets.menu.MenuItem; | 13 import com.smartgwt.client.widgets.menu.MenuItem; |
21 import com.smartgwt.client.widgets.menu.events.ClickHandler; | 14 import com.smartgwt.client.widgets.menu.events.ClickHandler; |
22 import com.smartgwt.client.widgets.menu.events.MenuItemClickEvent; | 15 import com.smartgwt.client.widgets.menu.events.MenuItemClickEvent; |
23 | 16 |
24 import de.intevation.flys.client.client.FLYSConstants; | 17 import de.intevation.flys.client.client.FLYSConstants; |
25 import de.intevation.flys.client.client.ui.CollectionView; | 18 import de.intevation.flys.client.client.ui.CollectionView; |
26 import de.intevation.flys.client.client.ui.ThemePanel; | 19 import de.intevation.flys.client.client.ui.ThemePanel; |
27 import de.intevation.flys.client.shared.MapUtils; | |
28 import de.intevation.flys.client.shared.model.AttributedTheme; | 20 import de.intevation.flys.client.shared.model.AttributedTheme; |
29 import de.intevation.flys.client.shared.model.FacetRecord; | 21 import de.intevation.flys.client.shared.model.FacetRecord; |
30 import de.intevation.flys.client.shared.model.OutputMode; | 22 import de.intevation.flys.client.shared.model.OutputMode; |
31 import de.intevation.flys.client.shared.model.Theme; | 23 import de.intevation.flys.client.shared.model.Theme; |
32 | 24 |
34 /** | 26 /** |
35 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> | 27 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
36 */ | 28 */ |
37 public class MapThemePanel extends ThemePanel { | 29 public class MapThemePanel extends ThemePanel { |
38 | 30 |
39 public static final int CELL_HEIGHT = 75; | 31 public static final int CELL_HEIGHT = 25; |
40 public static final int STYLE_CELL_WIDTH = 150; | |
41 | 32 |
42 | 33 |
43 public interface ActivateCallback { | 34 public interface ActivateCallback { |
44 void activate(Theme theme, boolean activate); | 35 void activate(Theme theme, boolean activate); |
45 } | 36 } |
64 | 55 |
65 protected ListGridRecord[] oldRecords; | 56 protected ListGridRecord[] oldRecords; |
66 | 57 |
67 | 58 |
68 public static final String GRID_FIELD_ACTIVE = "active"; | 59 public static final String GRID_FIELD_ACTIVE = "active"; |
69 public static final String GRID_FIELD_STYLE = "style"; | |
70 public static final String GRID_FIELD_NAME = "name"; | 60 public static final String GRID_FIELD_NAME = "name"; |
71 | 61 |
72 | 62 |
73 protected MapOutputTab mapOut; | 63 protected MapOutputTab mapOut; |
74 | 64 |
138 | 128 |
139 ListGridField active = new ListGridField(GRID_FIELD_ACTIVE, " ", 20); | 129 ListGridField active = new ListGridField(GRID_FIELD_ACTIVE, " ", 20); |
140 active.setType(ListGridFieldType.BOOLEAN); | 130 active.setType(ListGridFieldType.BOOLEAN); |
141 active.setCanDragResize(false); | 131 active.setCanDragResize(false); |
142 | 132 |
143 ListGridField style = new ListGridField( | |
144 GRID_FIELD_STYLE, | |
145 MSG.map_themepanel_header_style(), | |
146 STYLE_CELL_WIDTH); | |
147 style.setCanEdit(false); | |
148 style.setCanDragResize(false); | |
149 | |
150 ListGridField name = new ListGridField( | 133 ListGridField name = new ListGridField( |
151 GRID_FIELD_NAME, MSG.chart_themepanel_header_themes()); | 134 GRID_FIELD_NAME, MSG.chart_themepanel_header_themes()); |
152 name.setType(ListGridFieldType.TEXT); | 135 name.setType(ListGridFieldType.TEXT); |
153 | 136 |
154 list.setFields(active, style, name); | 137 list.setFields(active, name); |
155 } | |
156 | |
157 | |
158 @Override | |
159 protected ListGrid createNewGrid() { | |
160 ListGrid grid = new ListGrid() { | |
161 @Override | |
162 protected Canvas createRecordComponent(final ListGridRecord record, Integer colNum) { | |
163 String fieldname = getFieldName(colNum); | |
164 | |
165 if (fieldname.equals(GRID_FIELD_STYLE)) { | |
166 FacetRecord r = (FacetRecord) record; | |
167 AttributedTheme at = (AttributedTheme) r.getTheme(); | |
168 | |
169 String imgUrl = MapUtils.getLegendGraphicUrl( | |
170 at.getAttr("url"), | |
171 at.getAttr("layers")); | |
172 | |
173 HLayout layout = new HLayout(); | |
174 layout.setAlign(VerticalAlignment.CENTER); | |
175 layout.setLayoutAlign(VerticalAlignment.CENTER); | |
176 | |
177 Img img = new Img(imgUrl); | |
178 img.setImageType(ImageStyle.CENTER); | |
179 | |
180 layout.addMember(img); | |
181 | |
182 return layout; | |
183 } | |
184 | |
185 return super.createRecordComponent(record, colNum); | |
186 } | |
187 }; | |
188 | |
189 return grid; | |
190 } | 138 } |
191 | 139 |
192 | 140 |
193 @Override | 141 @Override |
194 protected void clearGrid() { | 142 protected void clearGrid() { |