1
2
3
4
5 package com.hack23.cia.web.views.components.panels;
6
7 import thinwire.ui.Component;
8 import thinwire.ui.Panel;
9 import thinwire.ui.TabFolder;
10 import thinwire.ui.TabSheet;
11 import thinwire.ui.layout.TableLayout;
12
13 import com.hack23.cia.model.application.dto.common.UserSessionDTO;
14 import com.hack23.cia.model.application.impl.common.Agency;
15
16 /***
17 * The Class SimpleComponentPanel.
18 */
19 public class SimpleComponentPanel extends Panel {
20
21 /*** The tab folder. */
22 private final TabFolder tabFolder = new TabFolder();
23
24 /*** The user session dto. */
25 private UserSessionDTO userSessionDTO;
26
27 /***
28 * Instantiates a new simple component panel.
29 *
30 * @param title the title
31 * @param titleImage the title image
32 * @param component the component
33 */
34 public SimpleComponentPanel(final String title, final String titleImage,
35 final Component component) {
36 super();
37
38 setLayout(new TableLayout(new double[][] { { 0 },
39 { 0 } },
40 1,
41 5));
42
43 final TabSheet componentTabSheet = new TabSheet();
44 tabFolder.getChildren().add(componentTabSheet);
45 componentTabSheet.setText(title);
46 componentTabSheet.setImage(titleImage);
47 componentTabSheet.setLayout(new TableLayout(new double[][] { { 0 },
48
49 { 0 } },
50 1,
51 5));
52
53 component.setLimit("0,0");
54 componentTabSheet.getChildren().add(component);
55
56 tabFolder.setLimit("0,0,1,1");
57 getChildren().add(tabFolder);
58 }
59
60 /***
61 * Instantiates a new simple component panel.
62 *
63 * @param title the title
64 * @param titleImage the title image
65 * @param component the component
66 * @param title2 the title2
67 * @param titleImage2 the title image2
68 * @param component2 the component2
69 * @param userSessionDTO the user session dto
70 */
71 public SimpleComponentPanel(final String title, final String titleImage,
72 final Component component,final String title2, final String titleImage2,
73 final Component component2,final UserSessionDTO userSessionDTO) {
74 this(title,titleImage,component);
75 this.userSessionDTO = userSessionDTO;
76 addComponentPanel(title2, titleImage2, component2);
77 tabFolder.getChildren().add(createTabFolderCitizenOperation(userSessionDTO));
78 }
79
80
81 /***
82 * Adds the component panel.
83 *
84 * @param title the title
85 * @param titleImage the title image
86 * @param component the component
87 */
88 public final void addComponentPanel(final String title, final String titleImage,
89 final Component component) {
90
91 final TabSheet componentTabSheet = new TabSheet();
92 tabFolder.getChildren().add(componentTabSheet);
93 componentTabSheet.setText(title);
94 componentTabSheet.setImage(titleImage);
95 componentTabSheet.setLayout(new TableLayout(new double[][] { { 0 },
96
97 { 0 } },
98 1,
99 5));
100
101 component.setLimit("0,0");
102 componentTabSheet.getChildren().add(component);
103 }
104
105 /***
106 * Creates the tab folder citizen operation.
107 *
108 * @param userSessionDTO the user session dto
109 * @return the tab sheet
110 */
111 private TabSheet createTabFolderCitizenOperation(final UserSessionDTO userSessionDTO) {
112 this.userSessionDTO = userSessionDTO;
113 final TabSheet tabSheet = new TabSheet();
114
115 tabSheet.setText(userSessionDTO
116 .getLanguageResource(Agency.LanguageContentKey.CITIZEN_OPERATION));
117 tabSheet.setLayout(new TableLayout(new double[][] { { 0 },
118
119 { 0 } },
120 1,
121 5));
122
123 final TabFolder tabFolder = new TabFolder();
124 tabFolder.setLimit("0,0");
125
126 tabFolder.getChildren().add(
127 createTabFolderGrading());
128 tabFolder.getChildren().add(
129 createTabFolderForum());
130 tabFolder.getChildren().add(
131 createTabFolderOpinions());
132 tabFolder.getChildren().add(
133 createTabFolderShortComment());
134 tabFolder.getChildren().add(
135 createTabFolderVote());
136
137 tabFolder.setCurrentIndex(0);
138 tabSheet.getChildren().add(tabFolder);
139
140 return tabSheet;
141 }
142
143 /***
144 * Creates the tab folder forum.
145 *
146 * @return the tab sheet
147 */
148 private TabSheet createTabFolderForum() {
149 final TabSheet tabSheet = new TabSheet();
150
151 tabSheet.setText(userSessionDTO
152 .getLanguageResource(Agency.LanguageContentKey.FORUM));
153 tabSheet.setLayout(new TableLayout(new double[][] { { 0 },
154
155 { 0 } },
156 1,
157 5));
158
159 return tabSheet;
160 }
161
162
163 /***
164 * Creates the tab folder grading.
165 *
166 * @return the tab sheet
167 */
168 private TabSheet createTabFolderGrading() {
169 final TabSheet tabSheet = new TabSheet();
170
171 tabSheet.setText(userSessionDTO
172 .getLanguageResource(Agency.LanguageContentKey.GRADING));
173 tabSheet.setLayout(new TableLayout(new double[][] { { 0 },
174
175 { 0 } },
176 1,
177 5));
178
179 return tabSheet;
180 }
181
182 /***
183 * Creates the tab folder opinions.
184 *
185 * @return the tab sheet
186 */
187 private TabSheet createTabFolderOpinions() {
188 final TabSheet tabSheet = new TabSheet();
189
190 tabSheet.setText(userSessionDTO
191 .getLanguageResource(Agency.LanguageContentKey.OPINIONS));
192 tabSheet.setLayout(new TableLayout(new double[][] { { 0 },
193
194 { 0 } },
195 1,
196 5));
197
198 return tabSheet;
199 }
200
201 /***
202 * Creates the tab folder short comment.
203 *
204 * @return the tab sheet
205 */
206 private TabSheet createTabFolderShortComment() {
207 final TabSheet tabSheet = new TabSheet();
208
209 tabSheet.setText(userSessionDTO
210 .getLanguageResource(Agency.LanguageContentKey.SHORT_COMMENT));
211 tabSheet.setLayout(new TableLayout(new double[][] { { 0 },
212
213 { 0 } },
214 1,
215 5));
216
217 return tabSheet;
218 }
219
220 /***
221 * Creates the tab folder vote.
222 *
223 * @return the tab sheet
224 */
225 private TabSheet createTabFolderVote() {
226 final TabSheet tabSheet = new TabSheet();
227
228 tabSheet.setText(userSessionDTO
229 .getLanguageResource(Agency.LanguageContentKey.VOTE));
230 tabSheet.setLayout(new TableLayout(new double[][] { { 0 },
231
232 { 0 } },
233 1,
234 5));
235
236 return tabSheet;
237 }
238
239
240
241 }