Package org.apache.click.extras.tree

Examples of org.apache.click.extras.tree.TreeNode


        String expandId = getContext().getRequestParameter(Tree.EXPAND_TREE_NODE_PARAM);
        if(selectId == null && expandId == null) {
            return;
        }

        TreeNode node = null;
        if(selectId != null) {
            node = tree.find(selectId);
        } else {
            node = tree.find(expandId);
        }
View Full Code Here


        tree = createTree();

        //Try and load the already stored nodes from the session.
        //If this is the first time we access the page, this method
        //will return null, indicating no nodes is stored.
        TreeNode existingRootNode = loadNodesFromSession();

        if(existingRootNode != null) {
            //OK we had already nodes stored in the session, so no need
            //to rebuild them. We attach the root node and return.
            tree.setRootNode(existingRootNode);

            //By default root node is not displayed in browser. Here we expand it,
            //so that the root's children are visible.
            tree.expand(existingRootNode);
            return tree;
        }

        TreeNode root = createNodes();

        //Attach the root node containing all the other nodes to the tree
        tree.setRootNode(root);

        //By default root node is not displayed in browser. Here we expand it,
View Full Code Here

        //Create a node representing the root directory with the specified
        //parameter as the value. Because an id is not specified, a random
        //one will be generated by the node. By default the root node is
        //not rendered by the tree. This can be changed by calling
        //tree.setRootNodeDisplayed(true).
        TreeNode root = new TreeNode("c:");

        //Create a new directory, setting the root directory as its parent. Here
        //we do specify a id as the 2nd argument, so no id is generated.
        TreeNode dev = new TreeNode("dev","1", root);

        //The follwing 3 nodes represent files in the directory, setting the
        //dev node as their parent. Note the false argument to the constructor.
        //This means that the specific node does not support child nodes, and
        //it will be rendered as a leaf icon. If children are supported (the
        //default value) then even  if the node is a leaf, it will still be rendered
        //as a collapsed icon. In the example a default leaf node will be
        //rendered as a directory, and a node that does not support children is
        //rendered as a file.
        // Also note the node with the long text, will cause the tree to overflow
        // and add scrollbars
        new TreeNode("java.pdf", "1.1", dev, false);
        new TreeNode("JEE 6 - the new fantastic approach to write better software (apparently)", "1.2", dev, false);
        new TreeNode("ruby.pdf", "1.3", dev, false);

        //We continue constructing the rest of the tree
        TreeNode programFiles = new TreeNode("program files", "2", root);
        new TreeNode("Adobe", "2.1", programFiles);

        TreeNode download = new TreeNode("downloads","3", root);

        TreeNode web = new TreeNode("web", "3.1", download);
        new TreeNode("html.pdf", "3.1.1", web, false);
        new TreeNode("css.html", "3.1.2", web, false);

        TreeNode databases = new TreeNode("databases", "3.2", download);
        TreeNode relationalDb = new TreeNode("relational", "3.2.1", databases);

        new TreeNode("mysql.html", "3.2.1.1", relationalDb, false);
        new TreeNode("oracle.pdf", "3.2.1.2", relationalDb, false);
        new TreeNode("postgres", "3.2.1.3", relationalDb, false);

        TreeNode objectDb = new TreeNode("object", "3.2.2", databases);
        new TreeNode("db4o.html", "3.2.2.1", objectDb, false);

        return root;
    }
View Full Code Here

        tree = createTree();

        //Try and load the already stored nodes from the session.
        //If this is the first time we access the page, this method
        //will return null, indicating no nodes is stored.
        TreeNode existingRootNode = loadNodesFromSession();

        if(existingRootNode != null) {
            //OK we had already nodes stored in the session, so no need
            //to rebuild them. We attach the root node and return.
            tree.setRootNode(existingRootNode);

            return tree;
        }

        //Create a node representing the root directory with the specified
        //parameter as the value. Because an id is not specified, a random
        //one will be generated by the node. By default the root node is
        //not rendered by the tree. This can be changed by calling
        //tree.setRootNodeDisplayed(true).
        TreeNode root = new TreeNode("c:");

        //Create a new directory, setting the root directory as its parent. Here
        //we do specify a id as the 2nd argument, so no id is generated.
        TreeNode dev = new TreeNode("dev","1", root);

        //The follwing 3 nodes represent files in the directory, setting the
        //dev node as their parent. Note the false argument to the constructor.
        //This means that the specific node does not support child nodes, and
        //it will be rendered as a leaf icon. If children are supported (the
        //default value) then even  if the node is a leaf, it will still be rendered
        //as a collapsed icon. In the example a default leaf node will be
        //rendered as a directory, and a node that does not support children is
        //rendered as a file.
        // Also note the node with the long text, will cause the tree to overflow
        // and add scrollbars
        new TreeNode("java.pdf", "1.1", dev, false);
        new TreeNode("JEE 6 - the new fantastic approach to write better software (apparently)", "1.2", dev, false);
        new TreeNode("ruby.pdf", "1.3", dev, false);

        //We continue constructing the rest of the tree
        TreeNode programFiles = new TreeNode("program files", "2", root);
        new TreeNode("Adobe", "2.1", programFiles);

        TreeNode download = new TreeNode("downloads","3", root);

        TreeNode web = new TreeNode("web", "3.1", download);
        new TreeNode("html.pdf", "3.1.1", web, false);
        new TreeNode("css.html", "3.1.2", web, false);

        TreeNode databases = new TreeNode("databases", "3.2", download);
        TreeNode relationalDb = new TreeNode("relational", "3.2.1", databases);

        new TreeNode("mysql.html", "3.2.1.1", relationalDb, false);
        new TreeNode("oracle.pdf", "3.2.1.2", relationalDb, false);
        new TreeNode("postgres", "3.2.1.3", relationalDb, false);

        TreeNode objectDb = new TreeNode("object", "3.2.2", databases);
        new TreeNode("db4o.html", "3.2.2.1", objectDb, false);

        //Attach the root node containing all the other nodes to the tree
        tree.setRootNode(root);

        //By default root node is not displayed in browser. Here we expand it,
View Full Code Here

        tree = createTree();

        //Try and load the already stored nodes from the session.
        //If this is the first time we access the page, this method
        //will return null, indicating no nodes is stored.
        TreeNode existingRootNode = loadNodesFromSession();

        if(existingRootNode != null) {
            //OK we had already nodes stored in the session, so no need
            //to rebuild them. We attach the root node and return.
            tree.setRootNode(existingRootNode);

            return tree;
        }

        //Create a node representing the root directory with the specified
        //parameter as the value. Because an id is not specified, a random
        //one will be generated by the node. By default the root node is
        //not rendered by the tree. This can be changed by calling
        //tree.setRootNodeDisplayed(true).
        TreeNode root = new TreeNode("c:");

        //Create a new directory, setting the root directory as its parent. Here
        //we do specify a id as the 2nd argument, so no id is generated.
        TreeNode dev = new TreeNode("dev","1", root);

        //The follwing 3 nodes represent files in the directory, setting the
        //dev node as their parent. Note the false argument to the constructor.
        //This means that the specific node does not support child nodes, and
        //it will be rendered as a leaf icon. If children are supported (the
        //default value) then even  if the node is a leaf, it will still be rendered
        //as a collapsed icon. In the example a default leaf node will be
        //rendered as a directory, and a node that does not support children is
        //rendered as a file.
        // Also note the node with the long text, will cause the tree to overflow
        // and add scrollbars
        new TreeNode("java.pdf", "1.1", dev, false);
        new TreeNode("JEE 6 - the new fantastic approach to write better software (apparently)", "1.2", dev, false);
        new TreeNode("ruby.pdf", "1.3", dev, false);

        //We continue constructing the rest of the tree
        TreeNode programFiles = new TreeNode("program files", "2", root);
        new TreeNode("Adobe", "2.1", programFiles);

        TreeNode download = new TreeNode("downloads","3", root);

        TreeNode web = new TreeNode("web", "3.1", download);
        new TreeNode("html.pdf", "3.1.1", web, false);
        new TreeNode("css.html", "3.1.2", web, false);

        TreeNode databases = new TreeNode("databases", "3.2", download);
        TreeNode relationalDb = new TreeNode("relational", "3.2.1", databases);

        new TreeNode("mysql.html", "3.2.1.1", relationalDb, false);
        new TreeNode("oracle.pdf", "3.2.1.2", relationalDb, false);
        new TreeNode("postgres", "3.2.1.3", relationalDb, false);

        TreeNode objectDb = new TreeNode("object", "3.2.2", databases);
        new TreeNode("db4o.html", "3.2.2.1", objectDb, false);

        //Attach the root node containing all the other nodes to the tree
        tree.setRootNode(root);

        //By default root node is not displayed in browser. Here we expand it,
View Full Code Here

        //Create a node representing the root directory with the specified
        //parameter as the value. Because an id is not specified, a random
        //one will be generated by the node. By default the root node is
        //not rendered by the tree. This can be changed by calling
        //tree.setRootNodeDisplayed(true).
        TreeNode root = new TreeNode("Pages");

        //Create a new directory, setting the root directory as its parent. Here
        //we do specify a id as the 2nd argument, so no id is generated.
        TreeNode general = new TreeNode("Intro", "1", root);

        boolean supportsChildNodes = false;

        new TreeNode(HelloWorld.class, "1.1", general, supportsChildNodes);
        new TreeNode(ControlListenerType1Page.class, "1.2", general, supportsChildNodes);
        new TreeNode(ControlListenerType2Page.class, "1.3", general, supportsChildNodes);

        TreeNode forms = new TreeNode("Forms", "2", root);
        new TreeNode(SimpleForm.class, "2.1", forms, supportsChildNodes);
        new TreeNode(AdvancedForm.class, "2.2", forms, supportsChildNodes);

        TreeNode tables = new TreeNode("Tables", "3", root);
        new TreeNode(SimpleTable.class, "3.1", tables, supportsChildNodes);
        new TreeNode(AdvancedTable.class, "3.2", tables, supportsChildNodes);

        return root;
    }
View Full Code Here

        tree = createTree();

        //Try and load the already stored nodes from the session.
        //If this is the first time we access the page, this method
        //will return null, indicating no nodes is stored.
        TreeNode existingRootNode = loadNodesFromSession();

        if(existingRootNode != null) {
            //OK we had already nodes stored in the session, so no need
            //to rebuild them. We attach the root node and return.
            tree.setRootNode(existingRootNode);

            return tree;
        }

        // Create a node representing the root directory with the specified
        // parameter as the value. Because an id is not specified, a random
        // one will be generated by the node. By default the root node is
        // not rendered by the tree. This can be changed by calling
        // tree.setRootNodeDisplayed(true).
        TreeNode root = new TreeNode("c:");

        // Create a new directory, setting the root directory as its parent. Here
        // we do specify a id as the 2nd argument, so no id is generated.
        TreeNode dev = new TreeNode("dev","1");
        root.add(dev);

        // The following 3 nodes represent files in the directory as children of
        // the dev node. Note the false argument to the constructor.
        // This means that the specific node does not support child nodes, and
        // it will be rendered as a leaf icon. If children are supported (the
        // default value) then even  if the node is a leaf, it will still be rendered
        // as a collapsed icon. In the example a default leaf node will be
        // rendered as a directory, and a node that does not support children is
        // rendered as a file.
        // Also note the node with the long text, will cause the tree to overflow
        // and add scrollbars
        dev.add(new TreeNode("java.pdf", "1.1", false));
        dev.add(new TreeNode("JEE 6 - the new fantastic approach to write better software (apparently)", "1.2", false));
        dev.add(new TreeNode("ruby.pdf", "1.3", false));

        //We continue constructing the rest of the tree
        TreeNode programFiles = new TreeNode("program files", "2");
        root.add(programFiles);
        programFiles.add(new TreeNode("Adobe", "2.1"));

        TreeNode download = new TreeNode("downloads","3");
        root.add(download);

        TreeNode web = new TreeNode("web", "3.1");
        download.add(web);
        web.add(new TreeNode("html.pdf", "3.1.1", false));
        web.add(new TreeNode("css.html", "3.1.2", false));

        TreeNode databases = new TreeNode("databases", "3.2");
        download.add(databases);
        TreeNode relationalDb = new TreeNode("relational", "3.2.1");
        databases.add(relationalDb);

        relationalDb.add(new TreeNode("mysql.html", "3.2.1.1", false));
        relationalDb.add(new TreeNode("oracle.pdf", "3.2.1.2", false));
        relationalDb.add(new TreeNode("postgres", "3.2.1.3", false));

        TreeNode objectDb = new TreeNode("object", "3.2.2");
        databases.add(objectDb);
        objectDb.add(new TreeNode("db4o.html", "3.2.2.1", false));

        //Attach the root node containing all the other nodes to the tree
        tree.setRootNode(root);

        //By default root node is not displayed in browser. Here we expand it,
View Full Code Here

        tree = createTree();

        // Try and load the already stored nodes from the session.
        // If this is the first time we access the page, this method
        // will return null, indicating no nodes is stored.
        TreeNode existingRootNode = loadNodesFromSession();

        if(existingRootNode != null) {
            // OK we had already nodes stored in the session, so no need
            // to rebuild them. We attach the root node and return.
            tree.setRootNode(existingRootNode);

            return tree;
        }

        // Create a node representing the root directory with the specified
        // parameter as the value. Because an id is not specified, a random
        // one will be generated by the node. By default the root node is
        // not rendered by the tree. This can be changed by calling
        // tree.setRootNodeDisplayed(true).
        TreeNode root = new TreeNode("c:");

        // Create a new directory, setting the root directory as its parent. Here
        // we do specify a id as the 2nd argument, so no id is generated.
        TreeNode dev = new TreeNode("dev","1");
        root.add(dev);

        // The following 3 nodes represent files in the directory as children of
        // the dev node. Note the false argument to the constructor.
        // This means that the specific node does not support child nodes, and
        // it will be rendered as a leaf icon. If children are supported (the
        // default value) then even  if the node is a leaf, it will still be rendered
        // as a collapsed icon. In the example a default leaf node will be
        // rendered as a directory, and a node that does not support children is
        // rendered as a file.
        // Also note the node with the long text, will cause the tree to overflow
        // and add scrollbars
        dev.add(new TreeNode("java.pdf", "1.1", false));
        dev.add(new TreeNode("JEE 6 - the new fantastic approach to write better software (apparently)", "1.2", false));
        dev.add(new TreeNode("ruby.pdf", "1.3", false));

        //We continue constructing the rest of the tree
        TreeNode programFiles = new TreeNode("program files", "2");
        root.add(programFiles);
        programFiles.add(new TreeNode("Adobe", "2.1"));

        TreeNode download = new TreeNode("downloads","3");
        root.add(download);

        TreeNode web = new TreeNode("web", "3.1");
        download.add(web);
        web.add(new TreeNode("html.pdf", "3.1.1", false));
        web.add(new TreeNode("css.html", "3.1.2", false));

        TreeNode databases = new TreeNode("databases", "3.2");
        download.add(databases);
        TreeNode relationalDb = new TreeNode("relational", "3.2.1");
        databases.add(relationalDb);

        relationalDb.add(new TreeNode("mysql.html", "3.2.1.1",false));
        relationalDb.add(new TreeNode("oracle.pdf", "3.2.1.2", false));
        relationalDb.add(new TreeNode("postgres", "3.2.1.3", false));

        TreeNode objectDb = new TreeNode("object", "3.2.2");
        databases.add(objectDb);
        objectDb.add(new TreeNode("db4o.html", "3.2.2.1", false));

        // Attach the root node containing all the other nodes to the tree
        tree.setRootNode(root);

        // By default root node is not displayed in browser. Here we expand it,
View Full Code Here

        //Create a node representing the root directory with the specified
        //parameter as the value. Because an id is not specified, a random
        //one will be generated by the node. By default the root node is
        //not rendered by the tree. This can be changed by calling
        //tree.setRootNodeDisplayed(true).
        TreeNode root = new TreeNode("Pages");

        //Create a new directory, setting the root directory as its parent. Here
        //we do specify a id as the 2nd argument, so no id is generated.
        TreeNode general = new TreeNode("Intro", "1");
        root.add(general);

        boolean supportsChildNodes = false;

        general.add(new TreeNode(HelloWorld.class, "1.1", supportsChildNodes));
        general.add(new TreeNode(ControlListenerType1Page.class, "1.2", supportsChildNodes));
        general.add(new TreeNode(ControlListenerType2Page.class, "1.3", supportsChildNodes));

        TreeNode forms = new TreeNode("Forms", "2");
        root.add(forms);
        forms.add(new TreeNode(SimpleForm.class, "2.1", supportsChildNodes));
        forms.add(new TreeNode(AdvancedForm.class, "2.2", supportsChildNodes));

        TreeNode tables = new TreeNode("Tables", "3");
        root.add(tables);
        tables.add(new TreeNode(SimpleTable.class, "3.1", supportsChildNodes));
        tables.add(new TreeNode(AdvancedTable.class, "3.2",  supportsChildNodes));

        return root;
    }
View Full Code Here

        String expandId = getContext().getRequestParameter(Tree.EXPAND_TREE_NODE_PARAM);
        if(selectId == null && expandId == null) {
            return;
        }

        TreeNode node = null;
        if(selectId != null) {
            node = tree.find(selectId);
        } else {
            node = tree.find(expandId);
        }
View Full Code Here

TOP

Related Classes of org.apache.click.extras.tree.TreeNode

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.