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   
6   package com.hack23.cia.web.views.user;
7   
8   import thinwire.ui.TabFolder;
9   import thinwire.ui.TabSheet;
10  import thinwire.ui.layout.TableLayout;
11  
12  import com.hack23.cia.model.application.dto.common.UserSessionDTO;
13  import com.hack23.cia.model.application.impl.common.Agency;
14  
15  
16  /***
17   * The Class AbstractParliamentOperationPanel.
18   */
19  public abstract class AbstractParliamentOperationPanel extends AbstractParliamentPanel {
20  
21  	
22  	
23  	/*** The user session dto. */
24  	private final UserSessionDTO userSessionDTO;
25  
26  	/***
27  	 * Instantiates a new abstract parliament operation panel.
28  	 *
29  	 * @param userSessionDTO the user session dto
30  	 */
31  	protected AbstractParliamentOperationPanel(final UserSessionDTO userSessionDTO) {
32  		this.userSessionDTO = userSessionDTO;
33  	}
34  
35  	/***
36  	 * Creates the tab folder citizen operation.
37  	 *
38  	 * @return the tab sheet
39  	 */
40  	protected final TabSheet createTabFolderCitizenOperation() {
41  	    	  final TabSheet tabSheet = new TabSheet();
42  
43  	          tabSheet.setText(userSessionDTO
44  	                  .getLanguageResource(Agency.LanguageContentKey.CITIZEN_OPERATION));
45  	          tabSheet.setLayout(new TableLayout(new double[][] { { 0 }, // Column
46  	                  // Widths
47  	                  { 0 } }, // Row Heights
48  	                  1, // Margin around edge of container
49  	                  5)); // Spacing between cells
50  
51  	          final TabFolder tabFolder = new TabFolder();
52  	          tabFolder.setLimit("0,0"); //$NON-NLS-1$
53  
54  	          tabFolder.getChildren().add(
55  	                  createTabFolderGrading());
56  	          tabFolder.getChildren().add(
57  	                  createTabFolderForum());
58  	          tabFolder.getChildren().add(
59  	                  createTabFolderOpinions());
60  	          tabFolder.getChildren().add(
61  	                  createTabFolderShortComment());
62  	          tabFolder.getChildren().add(
63  	                  createTabFolderVote());
64  	          
65  	          tabFolder.setCurrentIndex(0);
66  	          tabSheet.getChildren().add(tabFolder);
67  	        
68  	        return tabSheet;
69  		}
70  	
71  	/***
72  	 * Creates the tab folder forum.
73  	 *
74  	 * @return the tab sheet
75  	 */
76  	private TabSheet createTabFolderForum() {     
77  		final TabSheet tabSheet = new TabSheet();
78  
79  	        tabSheet.setText(userSessionDTO
80  	                .getLanguageResource(Agency.LanguageContentKey.FORUM));
81  	        tabSheet.setLayout(new TableLayout(new double[][] { { 0 }, // Column
82  	                // Widths
83  	                { 0 } }, // Row Heights
84  	                1, // Margin around edge of container
85  	                5)); // Spacing between cells
86  	        
87  	        return tabSheet;
88  	}
89  
90  	/***
91  	 * Creates the tab folder grading.
92  	 *
93  	 * @return the tab sheet
94  	 */
95  	private TabSheet createTabFolderGrading() {
96  		final TabSheet tabSheet = new TabSheet();
97  
98          tabSheet.setText(userSessionDTO
99                  .getLanguageResource(Agency.LanguageContentKey.GRADING));
100         tabSheet.setLayout(new TableLayout(new double[][] { { 0 }, // Column
101                 // Widths
102                 { 0 } }, // Row Heights
103                 1, // Margin around edge of container
104                 5)); // Spacing between cells
105         
106         return tabSheet;
107 	}
108 
109 	/***
110 	 * Creates the tab folder opinions.
111 	 *
112 	 * @return the tab sheet
113 	 */
114 	private TabSheet createTabFolderOpinions() {
115 		final TabSheet tabSheet = new TabSheet();
116 
117         tabSheet.setText(userSessionDTO
118                 .getLanguageResource(Agency.LanguageContentKey.OPINIONS));
119         tabSheet.setLayout(new TableLayout(new double[][] { { 0 }, // Column
120                 // Widths
121                 { 0 } }, // Row Heights
122                 1, // Margin around edge of container
123                 5)); // Spacing between cells
124         
125         return tabSheet;
126 	}
127 
128     /***
129      * Creates the tab folder short comment.
130      *
131      * @return the tab sheet
132      */
133 	private TabSheet createTabFolderShortComment() {
134 		final TabSheet tabSheet = new TabSheet();
135 
136         tabSheet.setText(userSessionDTO
137                 .getLanguageResource(Agency.LanguageContentKey.SHORT_COMMENT));
138         tabSheet.setLayout(new TableLayout(new double[][] { { 0 }, // Column
139                 // Widths
140                 { 0 } }, // Row Heights
141                 1, // Margin around edge of container
142                 5)); // Spacing between cells
143         
144         return tabSheet;
145 	}
146 
147 	/***
148 	 * Creates the tab folder vote.
149 	 *
150 	 * @return the tab sheet
151 	 */
152 	private TabSheet createTabFolderVote() {
153 		final TabSheet tabSheet = new TabSheet();
154 
155         tabSheet.setText(userSessionDTO
156                 .getLanguageResource(Agency.LanguageContentKey.VOTE));
157         tabSheet.setLayout(new TableLayout(new double[][] { { 0 }, // Column
158                 // Widths
159                 { 0 } }, // Row Heights
160                 1, // Margin around edge of container
161                 5)); // Spacing between cells
162         
163         return tabSheet;
164 	}
165 
166 }