1
2
3
4
5 package com.hack23.cia.web.views.components.gridboxes;
6
7 import thinwire.ui.GridBox;
8
9 import com.hack23.cia.model.application.dto.common.UserSessionDTO;
10 import com.hack23.cia.model.application.impl.common.Agency;
11 import com.hack23.cia.model.sweden.impl.RegisterInformation;
12
13 /***
14 * The Class RegisterInformationGridbox.
15 */
16 public class RegisterInformationGridbox extends GridBox {
17
18 /***
19 * Instantiates a new register information gridbox.
20 *
21 * @param userSessionDTO the user session dto
22 * @param registerInformation the register information
23 */
24 public RegisterInformationGridbox(final UserSessionDTO userSessionDTO,
25 final RegisterInformation registerInformation) {
26 super();
27 this.setVisibleHeader(true);
28 final GridBox.Column categoryHeader = new GridBox.Column();
29 categoryHeader.setName(userSessionDTO
30 .getLanguageResource(Agency.LanguageContentKey.CATEGORY));
31 categoryHeader.setWidth(240);
32 this.getColumns().add(categoryHeader);
33
34 final GridBox.Column votePositionHeader = new GridBox.Column();
35 votePositionHeader.setName(userSessionDTO
36 .getLanguageResource(Agency.LanguageContentKey.LOYALTIES));
37 this.getColumns().add(votePositionHeader);
38
39 if (registerInformation != null) {
40 GridBox.Row row = null;
41
42 for (final String dataStr : registerInformation.getStocks()) {
43 row = new GridBox.Row(userSessionDTO
44 .getLanguageResource(Agency.LanguageContentKey.STOCKS), dataStr);
45 this.getRows().add(row);
46 }
47
48 for (final String dataStr : registerInformation.getHouses()) {
49 row = new GridBox.Row(userSessionDTO
50 .getLanguageResource(Agency.LanguageContentKey.HOUSES), dataStr);
51 this.getRows().add(row);
52 }
53
54 for (final String dataStr : registerInformation.getIncomeActivity()) {
55 row = new GridBox.Row(userSessionDTO
56 .getLanguageResource(Agency.LanguageContentKey.INCOME_ACTIVITY), dataStr);
57 this.getRows().add(row);
58 }
59
60 for (final String dataStr : registerInformation.getAgreements()) {
61 row = new GridBox.Row(userSessionDTO
62 .getLanguageResource(Agency.LanguageContentKey.AGREEMENTS), dataStr);
63 this.getRows().add(row);
64 }
65
66 for (final String dataStr : registerInformation.getRoles()) {
67 row = new GridBox.Row(userSessionDTO
68 .getLanguageResource(Agency.LanguageContentKey.ROLES), dataStr);
69 this.getRows().add(row);
70 }
71
72 for (final String dataStr : registerInformation.getPublicRoles()) {
73 row = new GridBox.Row(userSessionDTO
74 .getLanguageResource(Agency.LanguageContentKey.PUBLIC_ROLES), dataStr);
75 this.getRows().add(row);
76 }
77
78 for (final String dataStr : registerInformation.getAllowances()) {
79 row = new GridBox.Row(userSessionDTO
80 .getLanguageResource(Agency.LanguageContentKey.ALLOWANCES), dataStr);
81 this.getRows().add(row);
82 }
83
84 if (registerInformation.getNothingDeclared().length() > 0) {
85 row = new GridBox.Row(userSessionDTO
86 .getLanguageResource(Agency.LanguageContentKey.NOTHING_DECLARED),
87 registerInformation.getNothingDeclared());
88 this.getRows().add(row);
89 }
90
91 } else {
92 GridBox.Row row = null;
93 row = new GridBox.Row(
94 userSessionDTO
95 .getLanguageResource(Agency.LanguageContentKey.NO_REGISTER_INFORMATION),
96 userSessionDTO
97 .getLanguageResource(Agency.LanguageContentKey.NO_REGISTER_INFORMATION_MSG));
98 this.getRows().add(row);
99 }
100 }
101 }