Package org.primefaces.model

Examples of org.primefaces.model.TreeNode


        ContentKey contentKey = new ContentKey(null, namespace.getFullName(), "namespace");
        ContentKey parentKey = null;
        if(namespace.getParent() != null)
            parentKey = new ContentKey(null, namespace.getParent().getFullName(), "namespace");

        TreeNode parent = allContent.get(parentKey);
        parent = parent == null ? rootNode : parent;
        TreeNode newNode = new DefaultTreeNode("namespace", namespace, parent);
        newNode.setExpanded(true);
        namespace.setTreeNode(newNode);
        allContent.put(contentKey, newNode);
    }
View Full Code Here


    public void add(Content content) {
        ContentKey contentKey = new ContentKey(content.getName(), content.getNamespace().getFullName(), "content");
        ContentKey parentKey = new ContentKey(null, content.getNamespace().getFullName(), "namespace");

        TreeNode parent = allContent.get(parentKey);
        TreeNode newNode = new DefaultTreeNode("content", content, parent);
        newNode.setExpanded(true);
        content.setTreeNode(newNode);
        allContent.put(contentKey, newNode);
    }
View Full Code Here

    public void add(Style style) {
        ContentKey contentKey = new ContentKey(style.getName(), style.getNamespace().getFullName(), "style");
        ContentKey parentKey = new ContentKey(null, style.getNamespace().getFullName(), "namespace");

        TreeNode parent = allContent.get(parentKey);
        TreeNode newNode = new DefaultTreeNode("style", style, parent);
        style.setTreeNode(newNode);
        newNode.setExpanded(true);
        if(!allContent.containsKey(contentKey))
            allContent.put(contentKey, newNode);
    }
View Full Code Here

    public TreeNode find(ContentKey contentKey) {
        return allContent.get(contentKey);
    }

    public void remove(ContentKey contentKey) {
        TreeNode node = find(contentKey);
        node.getParent().getChildren().remove(node);
        allContent.remove(contentKey);
    }
View Full Code Here

        if(rowKey == null) {
            requestMap.remove(getVar());
            this.rowNode = null;
        }
        else {
            TreeNode root = getValue();
            this.rowNode = findTreeNode(root, rowKey);
           
            if(this.rowNode != null)
                requestMap.put(getVar(), this.rowNode.getData());
            else
View Full Code Here

       
    public void buildRowKeys(TreeNode node) {
        int childCount = node.getChildCount();
        if(childCount > 0) {
            for(int i = 0; i < childCount; i++) {
                TreeNode childNode = node.getChildren().get(i);
                if(childNode.isSelected()) {
                    addToPreselection(childNode);
                }
               
                String childRowKey = (node.getParent() == null) ? String.valueOf(i) : node.getRowKey() + "_" + i;
                childNode.setRowKey(childRowKey);
                buildRowKeys(childNode);
            }
        }
    }
View Full Code Here

   
    public void populateRowKeys(TreeNode node, List<String> keys) {
        int childCount = node.getChildCount();
        if(childCount > 0) {
            for(int i = 0; i < childCount; i++) {
                TreeNode childNode = node.getChildren().get(i);
                keys.add(childNode.getRowKey());
                populateRowKeys(childNode, keys);
            }
        }
    }
View Full Code Here

        }

        if(tt.isCheckboxSelection() && tt.isSelectionRequest(context)) {
            String selectedNodeRowKey = params.get(clientId + "_instantSelection");
            tt.setRowKey(selectedNodeRowKey);
            TreeNode selectedNode = tt.getRowNode();
            List<String> descendantRowKeys = new ArrayList<String>();
            tt.populateRowKeys(selectedNode, descendantRowKeys);
            int size = descendantRowKeys.size();
            StringBuilder sb = SharedStringBuilder.get(context, SB_DECODE_SELECTION);
           
View Full Code Here

        Map<String,String> params = context.getExternalContext().getRequestParameterMap();
       
        String nodeKey = params.get(clientId + "_expand");
        if(nodeKey != null) {
            tt.setRowKey(nodeKey);
            TreeNode node = tt.getRowNode();
            node.setExpanded(true);
           
            encodeNodeChildren(context, tt, node);
        }
        else if(tt.isSortRequest(context)) {
            encodeSort(context, tt);
View Full Code Here

  protected void encodeMarkup(FacesContext context, TreeTable tt) throws IOException {
    ResponseWriter writer = context.getResponseWriter();
    String clientId = tt.getClientId(context);
        boolean scrollable = tt.isScrollable();
        TreeNode root = tt.getValue();
       
        if(root.getRowKey() == null) {
            root.setRowKey("root");
            tt.buildRowKeys(root);
            tt.initPreselection();
        }
       
        //default sort
View Full Code Here

TOP

Related Classes of org.primefaces.model.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.