View Javadoc

1   /*
2   Copyright 2010 James Pether Sörling Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. 
3   	$Id
4   */
5   package com.hack23.cia.web.views.components.gridboxes;
6   
7   import thinwire.ui.GridBox;
8   import thinwire.ui.GridBox.Column;
9   
10  import com.hack23.cia.model.application.dto.common.UserSessionDTO;
11  import com.hack23.cia.model.application.impl.common.Agency;
12  
13  /***
14   * A factory for creating GridBoxColumn objects.
15   */
16  public class GridBoxColumnFactory {
17  
18      /***
19       * Gets the agrement percentage header.
20       *
21       * @param userSessionDTO the user session dto
22       * @return the agrement percentage header
23       */
24      protected static Column getAgrementPercentageHeader(final UserSessionDTO userSessionDTO) {
25          final GridBox.Column header = new GridBox.Column();
26          header.setName(userSessionDTO
27                  .getLanguageResource(Agency.LanguageContentKey.AGREMENT_PERCENTAGE));
28          return header;
29      }
30  
31      /***
32       * Gets the electoral area header.
33       *
34       * @param userSessionDTO the user session dto
35       * @return the electoral area header
36       */
37      protected static Column getElectoralAreaHeader(final UserSessionDTO userSessionDTO) {
38          final GridBox.Column header = new GridBox.Column();
39          header.setName(userSessionDTO
40                  .getLanguageResource(Agency.LanguageContentKey.ELECTORAL_AREA));
41          return header;
42      }
43  
44      /***
45       * Gets the first vote header.
46       *
47       * @param userSessionDTO the user session dto
48       * @return the first vote header
49       */
50      protected static Column getFirstVoteHeader(final UserSessionDTO userSessionDTO) {
51          final GridBox.Column header = new GridBox.Column();
52          header.setName(userSessionDTO
53                  .getLanguageResource(Agency.LanguageContentKey.FIRST_VOTE));
54          return header;
55      }
56  
57      /***
58       * Gets the key header.
59       *
60       * @param userSessionDTO the user session dto
61       * @return the key header
62       */
63      public static Column getKeyHeader(final UserSessionDTO userSessionDTO) {
64          final GridBox.Column header = new GridBox.Column();
65          header.setName(userSessionDTO
66                  .getLanguageResource(Agency.LanguageContentKey.LANGUAGE_CONTENT_KEY));
67          return header;
68      }
69  
70      /***
71       * Gets the last vote header.
72       *
73       * @param userSessionDTO the user session dto
74       * @return the last vote header
75       */
76      protected static Column getLastVoteHeader(final UserSessionDTO userSessionDTO) {
77          final GridBox.Column header = new GridBox.Column();
78          header.setName(userSessionDTO
79                  .getLanguageResource(Agency.LanguageContentKey.LAST_VOTE));
80          return header;
81      }
82  
83      /***
84       * Gets the name header.
85       *
86       * @param userSessionDTO the user session dto
87       * @return the name header
88       */
89      protected static Column getNameHeader(final UserSessionDTO userSessionDTO) {
90          final GridBox.Column header = new GridBox.Column();
91          header.setName(userSessionDTO
92                  .getLanguageResource(Agency.LanguageContentKey.NAME));
93          return header;
94      }
95  
96      /***
97       * Gets the party header.
98       *
99       * @param userSessionDTO the user session dto
100      * @return the party header
101      */
102     protected static Column getPartyHeader(final UserSessionDTO userSessionDTO) {
103         final GridBox.Column header = new GridBox.Column();
104         header.setName(userSessionDTO
105                 .getLanguageResource(Agency.LanguageContentKey.PARTY));
106         return header;
107     }
108 
109     /***
110      * Gets the portal matches url header.
111      *
112      * @param userSessionDTO the user session dto
113      * @return the portal matches url header
114      */
115     protected static Column getPortalMatchesUrlHeader(final UserSessionDTO userSessionDTO) {
116         final GridBox.Column header = new GridBox.Column();
117         header.setName(userSessionDTO
118                 .getLanguageResource(Agency.LanguageContentKey.MATCHES_URL));
119         return header;
120     }
121 
122     /***
123      * Gets the rank header.
124      *
125      * @param userSessionDTO the user session dto
126      * @return the rank header
127      */
128     protected static Column getRankHeader(final UserSessionDTO userSessionDTO) {
129         final GridBox.Column header = new GridBox.Column();
130         header.setName(userSessionDTO
131                 .getLanguageResource(Agency.LanguageContentKey.RANK));
132         return header;
133     }
134 
135     /***
136      * Gets the registered votes header.
137      *
138      * @param userSessionDTO the user session dto
139      * @return the registered votes header
140      */
141     protected static Column getRegisteredVotesHeader(final UserSessionDTO userSessionDTO) {
142         final GridBox.Column header = new GridBox.Column();
143         header.setName(userSessionDTO
144                 .getLanguageResource(Agency.LanguageContentKey.REGISTERED_VOTES));
145         return header;
146     }
147 
148     /***
149      * Gets the value header.
150      *
151      * @param userSessionDTO the user session dto
152      * @return the value header
153      */
154     public static Column getValueHeader(final UserSessionDTO userSessionDTO) {
155         final GridBox.Column header = new GridBox.Column();
156         header.setName(userSessionDTO
157                 .getLanguageResource(Agency.LanguageContentKey.LANGUAGE_CONTENT_VALUE));
158         return header;
159     }
160 
161     /***
162      * Gets the vote occassions compared header.
163      *
164      * @param userSessionDTO the user session dto
165      * @return the vote occassions compared header
166      */
167     protected static Column getVoteOccassionsComparedHeader(final UserSessionDTO userSessionDTO) {
168         final GridBox.Column header = new GridBox.Column();
169         header.setName(userSessionDTO
170                 .getLanguageResource(Agency.LanguageContentKey.VOTE_OCCASSIONS_COMPARED));
171         return header;
172     }
173 
174     /***
175      * Gets the winning occassions header.
176      *
177      * @param userSessionDTO the user session dto
178      * @return the winning occassions header
179      */
180     protected static Column getWinningOccassionsHeader(final UserSessionDTO userSessionDTO) {
181         final GridBox.Column header = new GridBox.Column();
182         header.setName(userSessionDTO
183                 .getLanguageResource(Agency.LanguageContentKey.WINNING_OCCASSIONS));
184         return header;
185     }
186 
187     /***
188      * Gets the winning percentage header.
189      *
190      * @param userSessionDTO the user session dto
191      * @return the winning percentage header
192      */
193     protected static Column getWinningPercentageHeader(final UserSessionDTO userSessionDTO) {
194         final GridBox.Column header = new GridBox.Column();
195         header.setName(userSessionDTO
196                 .getLanguageResource(Agency.LanguageContentKey.WINNING_PERCENTAGE));
197         return header;
198     }
199 
200     /***
201      * Instantiates a new grid box column factory.
202      */
203     protected GridBoxColumnFactory() {
204         super();
205     }
206 }