Mercurial > dive4elements > river
comparison flys-client/src/main/java/de/intevation/flys/client/client/ui/map/MapThemePanel.java @ 805:f43d06d6a4a2
Refactored code of theme panel and added a MapThemePanel.
flys-client/trunk@2366 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Wed, 20 Jul 2011 07:52:19 +0000 |
parents | |
children | e50da1f74e58 |
comparison
equal
deleted
inserted
replaced
804:374712890b94 | 805:f43d06d6a4a2 |
---|---|
1 package de.intevation.flys.client.client.ui.map; | |
2 | |
3 import com.google.gwt.core.client.GWT; | |
4 | |
5 import com.smartgwt.client.types.ListGridFieldType; | |
6 import com.smartgwt.client.widgets.grid.ListGridField; | |
7 import com.smartgwt.client.widgets.layout.VLayout; | |
8 | |
9 import de.intevation.flys.client.shared.model.Collection; | |
10 import de.intevation.flys.client.shared.model.Theme; | |
11 import de.intevation.flys.client.shared.model.OutputMode; | |
12 | |
13 import de.intevation.flys.client.client.FLYSConstants; | |
14 import de.intevation.flys.client.client.ui.ThemePanel; | |
15 | |
16 | |
17 /** | |
18 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> | |
19 */ | |
20 public class MapThemePanel extends ThemePanel { | |
21 | |
22 private FLYSConstants MSG = GWT.create(FLYSConstants.class); | |
23 | |
24 | |
25 public static final String GRID_FIELD_ACTIVE = "active"; | |
26 public static final String GRID_FIELD_NAME = "name"; | |
27 | |
28 | |
29 protected MapOutputTab mapOut; | |
30 | |
31 | |
32 public MapThemePanel(Collection collection, OutputMode mode) { | |
33 super(collection, mode); | |
34 | |
35 initGrid(); | |
36 initLayout(); | |
37 | |
38 updateGrid(); | |
39 } | |
40 | |
41 | |
42 protected void initLayout() { | |
43 setWidth100(); | |
44 setHeight100(); | |
45 | |
46 VLayout layout = new VLayout(); | |
47 layout.setWidth100(); | |
48 layout.setHeight100(); | |
49 | |
50 layout.addMember(list); | |
51 layout.addMember(navigation); | |
52 | |
53 addChild(layout); | |
54 } | |
55 | |
56 | |
57 protected void initGrid() { | |
58 list.setCanEdit(true); | |
59 list.setCanSort(false); | |
60 list.setShowRecordComponents(false); | |
61 list.setShowRecordComponentsByCell(true); | |
62 list.setShowHeader(true); | |
63 list.setShowHeaderContextMenu(false); | |
64 list.setWidth100(); | |
65 list.setHeight100(); | |
66 | |
67 list.addEditCompleteHandler(this); | |
68 | |
69 ListGridField active = new ListGridField(GRID_FIELD_ACTIVE, " ", 20); | |
70 active.setType(ListGridFieldType.BOOLEAN); | |
71 | |
72 ListGridField name = new ListGridField( | |
73 GRID_FIELD_NAME, MSG.chart_themepanel_header_themes()); | |
74 name.setType(ListGridFieldType.TEXT); | |
75 | |
76 list.setFields(active, name); | |
77 } | |
78 | |
79 | |
80 @Override | |
81 public void activateTheme(Theme theme, boolean active) { | |
82 theme.setActive(active ? 1 : 0); | |
83 } | |
84 } | |
85 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |