View Javadoc

1   package org.gnomekr.potron.web.view;
2   
3   import org.apache.myfaces.custom.tree2.TreeNode;
4   import org.gnomekr.potron.service.IProjectManager;
5   import org.gnomekr.potron.web.tree.RootNode;
6   
7   /***
8    * NavigationTreeView.java
9    * @author Xavier Cho
10   * @version $Revision 1.1 $ $Date: 2005/07/18 18:03:14 $
11   * @jsf.bean
12   *              name = "navigation"
13   *              scope = "application"
14   */
15  public class NavigationTreeView extends AbstractFacesView {
16  
17      public static final String MENU_TRANSLATOR = "translatorMenu";
18      public static final String MENU_ADMIN = "adminMenu";
19  
20      private TreeNode rootNode;
21      private String menuName = MENU_TRANSLATOR;
22  
23      private IProjectManager manager;
24  
25      protected synchronized TreeNode createRootNode() {
26          TreeNode rootNode = new RootNode(manager.getProjects());
27          return rootNode;
28      }
29  
30      public synchronized void refresh() {
31          this.rootNode = null;
32      }
33  
34      public TreeNode getRootNode() {
35          if (rootNode == null) {
36              this.rootNode = createRootNode();
37          }
38  
39          return rootNode;
40      }
41  
42      /***
43       * @return
44       * @jsf.managed-property
45       *          value = "#{projectManager}"
46       */
47      public IProjectManager getManager() {
48          return manager;
49      }
50  
51      /***
52       * @param manager The manager to set.
53       */
54      public void setManager(IProjectManager manager) {
55          this.manager = manager;
56      }
57  
58      /***
59       * @return Returns the menuName.
60       */
61      public String getMenuName() {
62          return menuName;
63      }
64  
65      /***
66       * @param menuName The menuName to set.
67       */
68      public void setMenuName(String menuName) {
69          this.menuName = menuName;
70      }
71  }