1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34 package info.magnolia.ui.vaadin.gwt.client.applauncher.widget;
35
36 import java.util.HashMap;
37 import java.util.Map;
38
39 import com.google.gwt.user.client.DOM;
40 import com.google.gwt.user.client.Element;
41 import com.google.gwt.user.client.ui.ComplexPanel;
42
43
44
45
46 public abstract class VAppTileGroup extends ComplexPanel {
47
48 private String color;
49
50 private boolean clientGroup;
51
52 private final Map<String, AppTileWidget> appTileMap = new HashMap<String, AppTileWidget>();
53
54 public VAppTileGroup(String color) {
55 super();
56 this.color = color;
57 setElement(DOM.createElement("div"));
58
59 addStyleName("app-list");
60 addStyleName("section");
61 }
62
63 protected abstract void construct();
64
65 public void setColor(String color) {
66 this.color = color;
67 }
68
69 public String getColor() {
70 return color;
71 }
72
73 public boolean isClientGroup() {
74 return clientGroup;
75 }
76
77 public void setClientGroup(boolean clientGroup) {
78 this.clientGroup = clientGroup;
79 }
80
81 public void addAppTile(final AppTileWidget tile) {
82 add(tile, getTileContainer());
83 appTileMap.put(tile.getName(), tile);
84 }
85
86 protected Element getTileContainer() {
87 return getElement();
88 }
89
90 public boolean hasApp(String appName) {
91 return appTileMap.containsKey(appName);
92 }
93
94 public AppTileWidget getAppTile(String appName) {
95 return appTileMap.get(appName);
96 }
97 }