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 java.util.Set;
8   
9   import thinwire.ui.GridBox;
10  
11  import com.hack23.cia.model.application.dto.common.UserSessionDTO;
12  import com.hack23.cia.model.application.impl.admin.LanguageContentActionEvent;
13  import com.hack23.cia.model.application.impl.common.Agency;
14  import com.hack23.cia.model.application.impl.common.LanguageContent;
15  import com.hack23.cia.web.action.admin.LanguageContentAction;
16  import com.hack23.cia.web.common.BeanLocator;
17  
18  /***
19   * The Class LanguageContentGridBox.
20   */
21  public class LanguageContentGridBox extends GridBox {
22  
23      /***
24       * Instantiates a new language content grid box.
25       *
26       * @param userSessionDTO the user session dto
27       * @param agency the agency
28       * @param set the set
29       */
30      public LanguageContentGridBox(final UserSessionDTO userSessionDTO,final Agency agency,final Set<LanguageContent> set) {
31          super();
32          this.setVisibleHeader(true);
33          this.addActionListener(ACTION_CLICK, BeanLocator
34                  .getApplicationActionListener());
35  
36          this.getColumns().add(GridBoxColumnFactory.getKeyHeader(userSessionDTO));
37          this.getColumns().add(GridBoxColumnFactory.getValueHeader(userSessionDTO));
38          
39  
40          for (final LanguageContent languageContent : set) {
41              final GridBox.Row row = new GridBox.Row(languageContent.getContentPropertyName(),languageContent.getContent());
42              row.setUserObject(new LanguageContentAction(
43                      LanguageContentActionEvent.Operation.Update,agency,languageContent));
44              this.getRows().add(row);
45          }        
46      }
47  
48  }