Package org.apache.myfaces.custom.tree2

Examples of org.apache.myfaces.custom.tree2.TreeState


    private TreeModelBase     _treeModel;
    private HtmlTree          _tree;

    public TreeNode getTreeData()
    {
        TreeNode treeData = new TreeNodeBase("foo-folder", "Inbox", false);

        // construct a set of fake data (normally your data would come from a database)

        // populate Frank's portion of the tree
        TreeNodeBase personNode = new TreeNodeBase("person", "Frank Foo", false);
        personNode.getChildren().add(new TreeNodeBase("foo-folder", "Requires Foo", false));
        TreeNodeBase folderNode = new TreeNodeBase("foo-folder", "Requires Foo Reviewer", false);
        folderNode.getChildren().add(new TreeNodeBase("document", "X050001", true));
        folderNode.getChildren().add(new TreeNodeBase("document", "X050002", true));
        folderNode.getChildren().add(new TreeNodeBase("document", "X050003", true));
        personNode.getChildren().add(folderNode);
        personNode.getChildren().add(new TreeNodeBase("foo-folder", "Requires Foo Recommendation", false));
        folderNode = new TreeNodeBase("foo-folder", "Requires Foo Approval", false);
        folderNode.getChildren().add(new TreeNodeBase("document", "J050001", true));
        folderNode.getChildren().add(new TreeNodeBase("document", "J050002", true));
        folderNode.getChildren().add(new TreeNodeBase("document", "J050003", true));
        folderNode.getChildren().add(new TreeNodeBase("document", "E050011", true));
        folderNode.getChildren().add(new TreeNodeBase("document", "R050002", true));
        folderNode.getChildren().add(new TreeNodeBase("document", "C050003", true));
        personNode.getChildren().add(folderNode);
        folderNode = new TreeNodeBase("bar-folder", "Requires Bar Processing", false);
        folderNode.getChildren().add(new TreeNodeBase("document", "X050003", true));
        folderNode.getChildren().add(new TreeNodeBase("document", "X050011", true));
        folderNode.getChildren().add(new TreeNodeBase("document", "F050002", true));
        folderNode.getChildren().add(new TreeNodeBase("document", "G050003", true));
        personNode.getChildren().add(folderNode);
        folderNode = new TreeNodeBase("bar-folder", "Requires Bar Approval", false);
        folderNode.getChildren().add(new TreeNodeBase("document", "J050006", true));
        folderNode.getChildren().add(new TreeNodeBase("document", "J050007", true));
        personNode.getChildren().add(folderNode);

        treeData.getChildren().add(personNode);

        // populate Betty's portion of the tree
        personNode = new TreeNodeBase("person", "Betty Bar", false);
        personNode.getChildren().add(new TreeNodeBase("foo-folder", "Requires Foo", false));
        folderNode = new TreeNodeBase("foo-folder", "Requires Foo Reviewer", false);
        folderNode.getChildren().add(new TreeNodeBase("document", "X012000", true));
        folderNode.getChildren().add(new TreeNodeBase("document", "X013000", true));
        folderNode.getChildren().add(new TreeNodeBase("document", "X014000", true));
        personNode.getChildren().add(folderNode);
        folderNode = new TreeNodeBase("foo-folder", "Requires Foo Recommendation", false);
        folderNode.getChildren().add(new TreeNodeBase("document", "J010026", true));
        folderNode.getChildren().add(new TreeNodeBase("document", "J020002", true));
        folderNode.getChildren().add(new TreeNodeBase("document", "J030103", true));
        folderNode.getChildren().add(new TreeNodeBase("document", "E030214", true));
        folderNode.getChildren().add(new TreeNodeBase("document", "R020444", true));
        folderNode.getChildren().add(new TreeNodeBase("document", "C010000", true));
        personNode.getChildren().add(folderNode);
        personNode.getChildren().add(new TreeNodeBase("foo-folder", "Requires Foo Approval", false));
        folderNode = new TreeNodeBase("bar-folder", "Requires Bar Processing", false);
        folderNode.getChildren().add(new TreeNodeBase("document", "T052003", true));
        folderNode.getChildren().add(new TreeNodeBase("document", "T020011", true));
        personNode.getChildren().add(folderNode);
        folderNode = new TreeNodeBase("bar-folder", "Requires Bar Approval", false);
        folderNode.getChildren().add(new TreeNodeBase("document", "J010002", true));
        folderNode.getChildren().add(new TreeNodeBase("document", "J030047", true));
        folderNode.getChildren().add(new TreeNodeBase("document", "F030112", true));
        personNode.getChildren().add(folderNode);

        treeData.getChildren().add(personNode);

        return treeData;
View Full Code Here


    /**
     * Takes a set of 1..n TestbedServiceTemplates and builds the tree model
     * for rendering them within a JSF tree2 view.
     */
    private void loadTreeData(Collection<TestbedServiceTemplate> templates){
      treeData = new TreeNodeBase("root","Available Service Templates","IDroot",false);
      if((templates!=null)&&(templates.size()>0)){
        Iterator<TestbedServiceTemplate> itTemplates = templates.iterator();
        //iterate over all templates
        while(itTemplates.hasNext()){
          //the current template: iterate over all Serviceperations
          TestbedServiceTemplate template = itTemplates.next();
          //build new child node containing a serviceTemplate
          TreeNodeBase nodeServiceTemplate = new TreeNodeBase("TBServiceTemplate",template.getName()+": "+template.getDescription(),template.getUUID(),false);
         
          //addServiceTemplate properties
          nodeServiceTemplate.getChildren().add(new TreeNodeBase("Description",template.getDescription(),true));
          nodeServiceTemplate.getChildren().add(new TreeNodeBase("Endpoint",template.getEndpoint(),true));
          nodeServiceTemplate.getChildren().add(new TreeNodeBase("WSDLContent",template.getWSDLContent(),true));
          nodeServiceTemplate.getChildren().add(new TreeNodeBase("UUID",template.getUUID(),true));
          nodeServiceTemplate.getChildren().add(new TreeNodeBase("DeploymentDate",template.getDeploymentDate().getTime()+"",true));
         
          Collection<ServiceTag> tags = template.getAllTags();
          if((tags!=null)&&(tags.size()>0)){
            Iterator<ServiceTag> itTags = tags.iterator();
            while(itTags.hasNext()){
              ServiceTag tag = itTags.next();
              TreeNodeBase nodeTag = new TreeNodeBase("Tag",tag.getName(),tag.getName(),false);
              nodeTag.getChildren().add(new TreeNodeBase("TagValue",tag.getValue(),true));
              nodeTag.getChildren().add(new TreeNodeBase("TagDescription",tag.getDescription(),true));
              nodeTag.getChildren().add(new TreeNodeBase("TagPriority",tag.getPriority()+"",true));
             
              //add to serviceTemplate node
              nodeServiceTemplate.getChildren().add(nodeTag);
            }
          }
         
          Collection<ServiceOperation> operations = template.getAllServiceOperations();
          if((operations!=null)&&(operations.size()>0)){
            //Iterate over all serviceOperations
            Iterator<ServiceOperation> itOperations = operations.iterator();
            while(itOperations.hasNext()){
              ServiceOperation operation = itOperations.next();
              TreeNodeBase nodeOp = new TreeNodeBase("operation",operation.getName(), operation.getName(), false);
              //att leaf nodes with properties
              nodeOp.getChildren().add(new TreeNodeBase("OpDescription",operation.getDescription(),true));
              nodeOp.getChildren().add(new TreeNodeBase("OutputObjectType",operation.getOutputObjectType(),true));
              nodeOp.getChildren().add(new TreeNodeBase("ServiceOperationType",operation.getServiceOperationType(),true));
              nodeOp.getChildren().add(new TreeNodeBase("maxInputFiles",operation.getMaxSupportedInputFiles()+"",true));
              nodeOp.getChildren().add(new TreeNodeBase("minReqFiles",operation.getMinRequiredInputFiles()+"",true));
           
              //add nodeOp to ServiceTemplate
              nodeServiceTemplate.getChildren().add(nodeOp);
            }
          }
View Full Code Here

    private TreeModelBase     _treeModel;
    private HtmlTree          _tree;

    public TreeNode getTreeData()
    {
        TreeNode treeData = new TreeNodeBase("foo-folder", "Inbox", false);

        // construct a set of fake data (normally your data would come from a database)

        // populate Frank's portion of the tree
        TreeNodeBase personNode = new TreeNodeBase("person", "Frank Foo", false);
        personNode.getChildren().add(new TreeNodeBase("foo-folder", "Requires Foo", false));
        TreeNodeBase folderNode = new TreeNodeBase("foo-folder", "Requires Foo Reviewer", false);
        folderNode.getChildren().add(new TreeNodeBase("document", "X050001", true));
        folderNode.getChildren().add(new TreeNodeBase("document", "X050002", true));
        folderNode.getChildren().add(new TreeNodeBase("document", "X050003", true));
        personNode.getChildren().add(folderNode);
        personNode.getChildren().add(new TreeNodeBase("foo-folder", "Requires Foo Recommendation", false));
        folderNode = new TreeNodeBase("foo-folder", "Requires Foo Approval", false);
        folderNode.getChildren().add(new TreeNodeBase("document", "J050001", true));
        folderNode.getChildren().add(new TreeNodeBase("document", "J050002", true));
        folderNode.getChildren().add(new TreeNodeBase("document", "J050003", true));
        folderNode.getChildren().add(new TreeNodeBase("document", "E050011", true));
        folderNode.getChildren().add(new TreeNodeBase("document", "R050002", true));
        folderNode.getChildren().add(new TreeNodeBase("document", "C050003", true));
        personNode.getChildren().add(folderNode);
        folderNode = new TreeNodeBase("bar-folder", "Requires Bar Processing", false);
        folderNode.getChildren().add(new TreeNodeBase("document", "X050003", true));
        folderNode.getChildren().add(new TreeNodeBase("document", "X050011", true));
        folderNode.getChildren().add(new TreeNodeBase("document", "F050002", true));
        folderNode.getChildren().add(new TreeNodeBase("document", "G050003", true));
        personNode.getChildren().add(folderNode);
        folderNode = new TreeNodeBase("bar-folder", "Requires Bar Approval", false);
        folderNode.getChildren().add(new TreeNodeBase("document", "J050006", true));
        folderNode.getChildren().add(new TreeNodeBase("document", "J050007", true));
        personNode.getChildren().add(folderNode);

        treeData.getChildren().add(personNode);

        // populate Betty's portion of the tree
        personNode = new TreeNodeBase("person", "Betty Bar", false);
        personNode.getChildren().add(new TreeNodeBase("foo-folder", "Requires Foo", false));
        folderNode = new TreeNodeBase("foo-folder", "Requires Foo Reviewer", false);
        folderNode.getChildren().add(new TreeNodeBase("document", "X012000", true));
        folderNode.getChildren().add(new TreeNodeBase("document", "X013000", true));
        folderNode.getChildren().add(new TreeNodeBase("document", "X014000", true));
        personNode.getChildren().add(folderNode);
        folderNode = new TreeNodeBase("foo-folder", "Requires Foo Recommendation", false);
        folderNode.getChildren().add(new TreeNodeBase("document", "J010026", true));
        folderNode.getChildren().add(new TreeNodeBase("document", "J020002", true));
        folderNode.getChildren().add(new TreeNodeBase("document", "J030103", true));
        folderNode.getChildren().add(new TreeNodeBase("document", "E030214", true));
        folderNode.getChildren().add(new TreeNodeBase("document", "R020444", true));
        folderNode.getChildren().add(new TreeNodeBase("document", "C010000", true));
        personNode.getChildren().add(folderNode);
        personNode.getChildren().add(new TreeNodeBase("foo-folder", "Requires Foo Approval", false));
        folderNode = new TreeNodeBase("bar-folder", "Requires Bar Processing", false);
        folderNode.getChildren().add(new TreeNodeBase("document", "T052003", true));
        folderNode.getChildren().add(new TreeNodeBase("document", "T020011", true));
        personNode.getChildren().add(folderNode);
        folderNode = new TreeNodeBase("bar-folder", "Requires Bar Approval", false);
        folderNode.getChildren().add(new TreeNodeBase("document", "J010002", true));
        folderNode.getChildren().add(new TreeNodeBase("document", "J030047", true));
        folderNode.getChildren().add(new TreeNodeBase("document", "F030112", true));
        personNode.getChildren().add(folderNode);

        treeData.getChildren().add(personNode);

        return treeData;
View Full Code Here

        }
        if (metadataCount > 0) {
          metadataEmpty = true;
        }
        TreeModelBase tmb = new TreeModelBase(treeData);
        TreeState ts = new TreeStateBase();       
        for (Iterator it = paths.iterator(); it.hasNext(); ) {
            String path = (String) it.next();
            ts.toggleExpanded(path);
        }
        tmb.setTreeState(ts);
        //tmb.getTreeState().collapsePath(new String[]{"0:0"});
        return tmb;
    }
View Full Code Here

//FIXME CHANGER POUR DES CLASSES
public class MetadataTreeRenderer extends HtmlTreeRenderer {
   
    private boolean isLastNodeBeforeMetadata(HtmlTree tree) {

        TreeState treeState = tree.getDataModel().getTreeState();
        if (treeState.isNodeExpanded(tree.getNodeId())) {
            return false;
        }
       
        CustomTreeNode node = (CustomTreeNode) tree.getNode();
        if (node.getType().equals("metadata") && !tree.isNodeExpanded()) {
View Full Code Here

        if (parent == null) {
            return tree.isNodeExpanded();
        }

        TreeState treestate = tree.getDataModel().getTreeState();

        String[] ids = tree.getPathInformation(tree.getNodeId());
        if (ids.length < 3) {
            return false;
        }

        String parentIdentifier = ids[ids.length - 2];
        if (treestate.isNodeExpanded(parentIdentifier)) {
            int siblingCount = parent.getChildCount();
            for (int i = 0; i < siblingCount; i++) {
                String childIdentifier = parentIdentifier + ":" + i;
                if (treestate.isNodeExpanded(childIdentifier)) {
                    return false;
                }
            }
        } else {
            return false;
View Full Code Here

     */
    private void toggleAll(boolean expanded) {
        TreeWalker walker = htmlTree.getDataModel().getTreeWalker();
        walker.reset();

        TreeState state =  htmlTree.getDataModel().getTreeState();
        walker.setCheckState(false);
        walker.setTree(htmlTree);

        while(walker.next())
        {
            String id = htmlTree.getNodeId();
            if ((expanded && !state.isNodeExpanded(id)) || (!expanded && state.isNodeExpanded(id)))
            {
                state.toggleExpanded(id);
            }
        }
    }
View Full Code Here

        }
        if (metadataCount > 0) {
          metadataEmpty = true;
        }
        TreeModelBase tmb = new TreeModelBase(treeData);
        TreeState ts = new TreeStateBase();       
        for (Iterator it = paths.iterator(); it.hasNext(); ) {
            String path = (String) it.next();
            ts.toggleExpanded(path);
        }
        tmb.setTreeState(ts);
        //tmb.getTreeState().collapsePath(new String[]{"0:0"});
        return tmb;
    }
View Full Code Here

    /**
     * Code taken from org.apache.myfaces.custom.tree2.UITreeData
     * @param expanded
     */
    private void toggleAll(boolean expanded) {
        TreeWalker walker = htmlTree.getDataModel().getTreeWalker();
        walker.reset();

        TreeState state =  htmlTree.getDataModel().getTreeState();
        walker.setCheckState(false);
        walker.setTree(htmlTree);

        while(walker.next())
        {
            String id = htmlTree.getNodeId();
            if ((expanded && !state.isNodeExpanded(id)) || (!expanded && state.isNodeExpanded(id)))
            {
                state.toggleExpanded(id);
View Full Code Here

TOP

Related Classes of org.apache.myfaces.custom.tree2.TreeState

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.