Your browser does not support JavaScript and this site utilizes JavaScript to build content and provide links to additional information. You should either enable JavaScript in your browser settings or use a browser that supports JavaScript in order to take full advantage of this site.
1 12 13 package org.openedit.links.webtree; 14 15 import java.util.List ; 16 17 import org.openedit.links.Link; 18 import org.openedit.links.LinkTree; 19 20 import com.openedit.webui.tree.DefaultWebTreeModel; 21 22 23 28 public class LinkTreeModel extends DefaultWebTreeModel 29 { 30 protected LinkTree fieldLinkTree; 31 protected String fieldRootPath; 32 long lastMod = 1001; 33 34 39 public LinkTreeModel(LinkTree inLinkTree) 40 { 41 this( inLinkTree, null); 42 } 43 44 public LinkTreeModel( LinkTree inLinkTree, String inRootPath ) 45 { 46 super(); 47 fieldLinkTree = inLinkTree; 48 fieldRootPath = inRootPath; 49 } 50 51 52 55 public Object getRoot() 56 { 57 if (fieldRoot == null ) 58 { 59 reload(); 60 } 61 62 return fieldRoot; 63 } 64 65 public List getChildren(Object parent) 66 { 67 return super.getChildren(parent); 72 } 73 74 83 public LinkNode findNode(String inPath) 84 { 85 return ((LinkNode) getRoot()).findNode(inPath); 86 } 87 88 91 public void reload() 92 { 93 Link rootItem; 94 if( getRootPath() == null) 95 { 96 rootItem = getLinkTree().getRootLink(); 97 } 98 else 99 { 100 rootItem = getLinkTree().getLink( getRootPath() ); 101 } 102 LinkNode newRoot = new LinkNode( rootItem); 103 fieldRoot = newRoot; 104 lastMod = getLinkTree().getLastModified(); 105 } 106 109 public void ignore(String inString) 110 { 111 LinkNode node = (LinkNode)getRoot(); 112 node.getIgnoreTypes().add( inString); 113 } 114 public LinkTree getLinkTree() 115 { 116 return fieldLinkTree; 117 } 118 public void setLinkTree( LinkTree LinkTree ) 119 { 120 fieldLinkTree = LinkTree; 121 } 122 public String getRootPath() 123 { 124 return fieldRootPath; 125 } 126 public void setRootPath( String rootPath ) 127 { 128 fieldRootPath = rootPath; 129 } 130 } 131
| Popular Tags
|