1 30 package com.genimen.djeneric.tools.administrator.nodes; 31 32 import javax.swing.ImageIcon ; 33 import javax.swing.tree.TreePath ; 34 35 import com.genimen.djeneric.language.Messages; 36 import com.genimen.djeneric.tools.administrator.Administrator; 37 import com.genimen.djeneric.util.DjLogger; 38 39 public class RootNode extends AdministratorTreeNode 40 { 41 private static final long serialVersionUID = 1L; 42 43 public RootNode() 44 { 45 } 46 47 public String toString() 48 { 49 return Messages.getString("RootNode.Root"); 50 } 51 52 public ImageIcon getImageIcon() 53 { 54 return Administrator.getImageIcon("root.gif"); 55 } 56 57 public void reload() throws Exception 58 { 59 _alreadyLoaded = false; 60 expandNode(); 61 } 62 63 public void delete() throws Exception 64 { 65 } 66 67 public void expandNode() throws Exception 68 { 69 if (_alreadyLoaded) return; 70 71 boolean isCollapsed = _tree.isCollapsed(new TreePath (this.getPath())); 72 removeAllChildren(); 73 74 try 75 { 76 insertAsFolder(new UserFolder()); 77 insertAsFolder(new ContextFolder()); 78 insertAsFolder(new ModelViewFolder()); 79 _alreadyLoaded = true; 80 } 81 catch (Exception x) 82 { 83 DjLogger.log(x); 84 } 85 finally 86 { 87 getModel().nodeStructureChanged(this); 88 } 89 90 if (!isCollapsed) _tree.expandPath(new TreePath (this.getPath())); 91 } 92 93 public boolean canEdit() 94 { 95 return false; 96 } 97 98 public boolean canCreate() 99 { 100 return false; 101 } 102 103 public boolean canDelete() 104 { 105 return false; 106 } 107 108 public String getNodeType() 109 { 110 return "Root"; 111 } 112 } | Popular Tags |