Package org.primefaces.model.mindmap

Examples of org.primefaces.model.mindmap.MindmapNode


    @Override
    public void encodeEnd(FacesContext context, UIComponent component) throws IOException {
        Mindmap map = (Mindmap) component;

        if(map.isNodeSelectRequest(context)) {
            MindmapNode node = map.getSelectedNode();
           
            encodeNode(context, map, node, map.getSelectedNodeKey(context));
        }
        else {
            encodeMarkup(context, map);
View Full Code Here


    }

    protected void encodeScript(FacesContext context, Mindmap map) throws IOException {
        ResponseWriter writer = context.getResponseWriter();
        String clientId = map.getClientId(context);
        MindmapNode root = map.getValue();

        startScript(writer, clientId);
       
        writer.write("$(function(){");
        writer.write("PrimeFaces.cw('Mindmap','" + map.resolveWidgetVar() + "',{");
View Full Code Here

    }
   
    protected void encodeNode(FacesContext context, Mindmap map, MindmapNode node, String nodeKey) throws IOException {
        ResponseWriter writer = context.getResponseWriter();
        List<MindmapNode> children = node.getChildren();
        MindmapNode parent = node.getParent();
       
        writer.write("{");
       
        encodeNodeConfig(context, map, node, nodeKey);
       
        if(parent != null) {
            String parentNodeKey = (nodeKey.indexOf("_") != -1) ? nodeKey.substring(0, nodeKey.lastIndexOf("_")) : "root";
           
            writer.write(",\"parent\":{");
            encodeNodeConfig(context, map, parent, parentNodeKey);
            writer.write("}");
        }
       
        if(!children.isEmpty()) {
            int size = children.size();
           
            writer.write(",\"children\":[");
           
            for(int i = 0; i < size; i++) {
                String childKey = (nodeKey.equals("root")) ? String.valueOf(i) : nodeKey + "_" + i;
               
                MindmapNode child = children.get(i);
                encodeNode(context, map, child, childKey);
               
                if(i != (size - 1)) {
                    writer.write(",");
                }
View Full Code Here

TOP

Related Classes of org.primefaces.model.mindmap.MindmapNode

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.