View Javadoc

1   package org.gnomekr.potron.web.tree;
2   
3   import java.util.ArrayList;
4   import java.util.List;
5   import java.util.Set;
6   
7   import org.apache.myfaces.custom.tree2.TreeNode;
8   import org.gnomekr.potron.data.Template;
9   import org.gnomekr.potron.data.Translation;
10  
11  /***
12   * TemplateNode.java
13   * @author Xavier Cho
14   * @version $Revision 1.1 $ $Date: 2005/07/20 17:41:28 $
15   */
16  public class TemplateNode extends AbstractNavigationNode<Template> {
17  
18      private static final long serialVersionUID = -2289495975979257022L;
19  
20      public TemplateNode(Template template) {
21          super(template);
22      }
23  
24      /***
25       * @see org.gnomekr.potron.web.tree.AbstractNavigationNode#createChildNodes()
26       */
27      @Override
28      protected List<TreeNode> createChildNodes() {
29          Set<Translation> translations = getUserObject().getTranslations();
30  
31          List<TreeNode> children = new ArrayList<TreeNode>(translations.size());
32  
33          for (Translation translation : translations) {
34              children.add(new TranslationNode(translation));
35          }
36  
37          return children;
38      }
39  }