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 java.util.List;
9   
10  import thinwire.ui.Button;
11  import thinwire.ui.Component;
12  import thinwire.ui.Label;
13  import thinwire.ui.Panel;
14  import thinwire.ui.layout.TableLayout;
15  
16  import com.hack23.cia.model.application.dto.common.UserSessionDTO;
17  import com.hack23.cia.model.application.impl.common.Agency;
18  import com.hack23.cia.model.sweden.impl.CommitteeReport;
19  import com.hack23.cia.web.common.BeanLocator;
20  
21  /***
22   * The Class ActionBarPanel.
23   */
24  public class ActionBarPanel extends Panel {
25  
26      /*** The user session dto. */
27      private final UserSessionDTO userSessionDTO;
28  
29      /***
30       * Instantiates a new action bar panel.
31       *
32       * @param userSessionDTO the user session dto
33       * @param filePath the file path
34       * @param actionDescription the action description
35       * @param userObject the user object
36       * @param commiteeReports the commitee reports
37       */
38      public ActionBarPanel(final UserSessionDTO userSessionDTO,final String filePath,
39              final String actionDescription, final Object userObject,
40              final List<CommitteeReport> commiteeReports) {
41          super();
42          this.userSessionDTO = userSessionDTO;
43          setLayout(new TableLayout(new double[][] { { 0 }, // Column Widths
44                  { 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, // Row Heights
45                  1, // Margin around edge of container
46                  5)); // Spacing between cells
47  
48          final Button actionButton = new Button(actionDescription, filePath);
49          actionButton.setLimit("0,0,1,1"); //$NON-NLS-1$
50          actionButton.setUserObject(userObject);
51          actionButton.addActionListener(Component.ACTION_CLICK, BeanLocator
52                  .getApplicationActionListener());
53  
54          final Panel searchPanel = new SearchPanel(userSessionDTO);
55          searchPanel.setLimit("0,1,1,2"); //$NON-NLS-1$
56  
57          final Label treeViewDescription = new Label(
58                  userSessionDTO
59                          .getLanguageResource(Agency.LanguageContentKey.LAST_TEN_DECIDED_COMMITEE_REPORTS_DESCRIPTION));
60          treeViewDescription.setWrapText(true);
61          treeViewDescription.setLimit("0,3,1,1"); //$NON-NLS-1$
62  
63          final Panel committeeReportsPanel = new CommitteeReportPanel(userSessionDTO,commiteeReports);
64  
65          committeeReportsPanel.setLimit("0,4,1,5"); //$NON-NLS-1$
66          committeeReportsPanel.setUserObject(userObject);
67  
68          getChildren().add(actionButton);
69          getChildren().add(searchPanel);
70          getChildren().add(treeViewDescription);
71          getChildren().add(committeeReportsPanel);
72      }
73  
74  }