Package net.sf.archimede.jsf.component.tree

Examples of net.sf.archimede.jsf.component.tree.CustomTreeNode


   
    private TreeModelBase getMetadataTreeModelBase() {
        List metadatas = this.selectedFolder.getMetadatas();
        String rootName = "metadatas";
       
        CustomTreeNode treeData = new CustomTreeNode("root", rootName, false);
        treeData.setContent(this.selectedFolder);
       
        int metadataCount = 0;
        List paths = new ArrayList();
        for(Iterator it = metadatas.iterator(); it.hasNext(); metadataCount++) {
            Metadata currentMetadata = (Metadata) it.next();
            CustomTreeNode tnb = new CustomTreeNode("metadata", currentMetadata.getName(), false);
            tnb.setContent(currentMetadata);
            tnb.setIdentifier(currentMetadata.getId());
            treeData.getChildren().add(tnb);
           
            this.addElement(tnb, currentMetadata.getRootElement());
           
            for (int i = 0; i < currentMetadata.getRootElement().getElements().size(); i++) {
View Full Code Here


       
        return tmb;
    }
   
    private void addElement(CustomTreeNode elementNode, Element element) {
        CustomTreeNode tnb;
        if (element.isValue()) {
            tnb = new CustomTreeNode("valueElement", element.getName(), false);
//            if (this.defaultBg) {
//                tnb.getStyleAttributes().put("color", "#D5EDFF");
//            } else {
//                tnb.getStyleAttributes().put("color", "#FEEFB4");
//            }
//            this.defaultBg = !this.defaultBg;
        } else {
            tnb = new CustomTreeNode("element", element.getName(), false);
        }
        tnb.setContent(element);
        elementNode.getChildren().add(tnb);
        tnb.setParent(elementNode);
       
        if (!(element.isValue())) {
            List attributes = element.getAttributes();
            for (Iterator attrIt = attributes.iterator(); attrIt.hasNext(); ) {
                Attribute currentAttr = (Attribute) attrIt.next();
                CustomTreeNode attributeTreeNode = new CustomTreeNode("attribute", currentAttr.getName(), false);
                attributeTreeNode.setContent(currentAttr);
                attributeTreeNode.setParent(tnb);
                tnb.getChildren().add(attributeTreeNode);
            }
           
            List childElements = element.getElements();
            for( Iterator elementsIt = childElements.iterator(); elementsIt.hasNext(); ) {
View Full Code Here

   
    private TreeModelBase getMetadataTreeNode() {
        List metadatas = this.selectedFolder.getMetadatas();
        String rootName = "metadatas";
       
        CustomTreeNode treeData = new CustomTreeNode("root", rootName, false);
        treeData.setContent(this.selectedFolder);
       
        int metadataCount = 0;
        List paths = new ArrayList();
        for (Iterator it = metadatas.iterator(); it.hasNext(); metadataCount++) {
            Metadata currentMetadata = (Metadata) it.next();
            CustomTreeNode tnb = new CustomTreeNode("metadata", currentMetadata.getName(), false);
            tnb.setContent(currentMetadata);
            tnb.setIdentifier(currentMetadata.getId());
            treeData.getChildren().add(tnb);
           
            this.addUIElement(tnb, currentMetadata.getRootElement());
           
            //On affiche 50 elements et moins...
View Full Code Here

    private void addUIElement(CustomTreeNode elementNode, Element element) {
        String elementName = "element";
        if (element.isValue()) {
            elementName = "valueElement";
        }
        CustomTreeNode tnb = new CustomTreeNode(elementName, element.getName(), false);

        tnb.setContent(new ViewElement(element));
        elementNode.getChildren().add(tnb);
        tnb.setParent(elementNode);
       
        if (!(element.isValue())) {
            List attributes = element.getAttributes();
            Iterator attrIt = attributes.iterator();
            while(attrIt.hasNext()) {
                Attribute currentAttr = (Attribute) attrIt.next();
                CustomTreeNode attributeTreeNode = new CustomTreeNode("attribute", currentAttr.getName(), false);
                attributeTreeNode.setContent(currentAttr);
                attributeTreeNode.setParent(tnb);
                tnb.getChildren().add(attributeTreeNode);
            }
           
            List childElements = element.getElements();
            Iterator elementsIt = childElements.iterator();
View Full Code Here

  private TreeNode getTreeNode() {

    CollectionDao collectionDao = CollectionDao.createInstance();
    Collection collection = collectionDao.getRootCollection();
    if (collection == null) {
      CustomTreeNode treeData = new CustomTreeNode("root", " ", false);
      return treeData;
    }

    String rootName = collection.getName();
    CustomTreeNode treeData = new CustomTreeNode("root", rootName, false);

    List commnunities = collection.getCollections();
    for (Iterator it = commnunities.iterator(); it.hasNext();) {
      ViewCollection currentCommunity = new ViewCollection(
          (Collection) it.next());
      CustomTreeNode tnb = new CustomTreeNode("community",
          currentCommunity.getName(), false);
      tnb.setContent(currentCommunity);
      tnb.setIdentifier(currentCommunity.getId());
      tnb.setParent(treeData);
      treeData.getChildren().add(tnb);
      int foldersCount = this.addCommunity(tnb, currentCommunity);
      currentCommunity.setFoldersCount(foldersCount);
    }
View Full Code Here

    }

    for (Iterator collIt = collections.iterator(); collIt.hasNext();) {
      ViewCollection currentCollection = new ViewCollection(
          (Collection) collIt.next());
      CustomTreeNode tnb = new CustomTreeNode("collection",
          currentCollection.getName(), false);
      tnb.setContent(currentCollection);
      tnb.setIdentifier(currentCollection.getId());
      tnb.setParent(communityNode);
      communityNode.getChildren().add(tnb);
      int currentFoldersCount = this
          .addCommunity(tnb, currentCollection);
      currentCollection.setFoldersCount(currentFoldersCount);
      foldersCount += currentFoldersCount;
View Full Code Here

    return foldersCount;
  }

  private void addFolder(CustomTreeNode collectionNode,
      final ViewFolder folder) {
    CustomTreeNode tnbFolder = new CustomTreeNode("folder", "", false) {

      private List children;

      // For efficient caching of files
      public List getChildren() {
        if (this.children == null) {
          this.children = super.getChildren();

          List files = folder.getStoredFiles();

          if (files.size() == 0) {
            this.setLeaf(true);
          }

          Iterator filesIt = files.iterator();
          while (filesIt.hasNext()) {
            StoredFile currentFile = (StoredFile) filesIt.next();
            CustomTreeNode tnbFile = new CustomTreeNode("file",
                currentFile.getName(), true);
            tnbFile.setIdentifier(currentFile.getId());
            tnbFile.setParent(this);
            tnbFile.setContent(new ViewStoredFile(currentFile));
            this.children.add(tnbFile);
          }

          return this.children;
        } else {
View Full Code Here

        if (folder == null) {
            throw new IllegalArgumentException("folder is null");
        }
       
        //boolean hasChild = folder.getChildVersions() != null && folder.getChildVersions().size() > 0;
        CustomTreeNode treeData;
        if (folder.equals(this.selectedFolder)) {
            treeData = new CustomTreeNode("currentVersion", folder.getCheckinDate().getTime().toString(), false);
        } else {
            treeData = new CustomTreeNode("version", folder.getCheckinDate().getTime().toString(), false);
        }
        treeData.setContent(folder);
       
        List childVersions = folder.getChildVersions();
        for (Iterator it = childVersions.iterator(); it.hasNext(); ) {
            Folder currentFolder = (Folder) it.next();
            CustomTreeNode ctn = addVersionTreeNode(currentFolder);
            treeData.getChildren().add(ctn);
        }
       
        return treeData;
    }
View Full Code Here

    }
   
    private TreeModelBase getVersionsTreeNode() {
        Folder rootVersion = this.getRootVersion();
       
        CustomTreeNode treeData = new CustomTreeNode("root", "", true);
        if (rootVersion != null) {
            treeData = this.addVersionTreeNode(rootVersion);
        }
       
        return new TreeModelBase(treeData);
View Full Code Here

        return "";
    }
   
    public String restoreVersion() {
        FolderDao folderDao = FolderDao.createInstance();
        CustomTreeNode ctn = (CustomTreeNode) this.versionsTreeModel.getNode();
        folderDao.restoreVersion((Folder) ctn.getContent());
       
        //TODO faire une méthode refreshState()
        Folder folder = folderDao.retrieve(this.selectedFolder.getId());
        this.selectedFolder = new ViewFolder(folder);
        this.metadataTreeModel = getMetadataTreeNode();
View Full Code Here

TOP

Related Classes of net.sf.archimede.jsf.component.tree.CustomTreeNode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.