Package com.ibm.xsp.extlib.tree.impl

Examples of com.ibm.xsp.extlib.tree.impl.BasicLeafTreeNode


    public NodeIterator iterateChildren(int arg0, int arg1) {
        FileServiceData data = getDataSource();
        if(data != null){
            List<ITreeNode> children = new ArrayList<ITreeNode>();
            if(!data.isRootDirectory()){
                BasicLeafTreeNode node = new BasicLeafTreeNode();
                node.setLabel("Root");
                node.setSubmitValue("/");
                node.setSelected(true);
                node.setExpanded(true);
                node.setNodeContext(getNodeContext());
                children.add(node);
               
                String name = data.getCurrentDirectory();
                if(StringUtil.isNotEmpty(name)){
                    String[] parts = name.split("/");
                    if(parts != null){
                        StringBuffer path = new StringBuffer();
                        for(String part : parts){
                            if(StringUtil.isEmpty(part)){
                                continue;
                            }
                            node = new BasicLeafTreeNode();
                            try {
                                //Present a readable label in the bread crumb label
                                node.setLabel(URLDecoder.decode(part, "UTF-8"));
                            } catch (UnsupportedEncodingException e) {
                                e.printStackTrace();
                            }
                            path.append("/");
                            path.append(part);
                            node.setSubmitValue(path.toString());
                            node.setSelected(true);
                            node.setExpanded(true);
                            node.setNodeContext(getNodeContext());
                            children.add(node);
                        }
                    }
                }
            }else{
                BasicLeafTreeNode node = new BasicLeafTreeNode();
                node.setLabel("Root");
                children.add(node);
            }
            return TreeUtil.getIterator(children, 0, children.size());
        }
        return null;
View Full Code Here

TOP

Related Classes of com.ibm.xsp.extlib.tree.impl.BasicLeafTreeNode

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.