Usages of

org.zkoss.zul.TreeitemRenderer.TreeitemRenderer()
private TreeitemRenderer treeitemRenderer; // code omitted ... public ChooseIconDialog() { try { Map args = Executions.getCurrent().getArg(); startPath = args.get("path").toString(); } catch (Exception e) { startPath = "/rsc/img/"; } treeitemRenderer = new TreeitemRenderer() { public void render(Treeitem treeItem, Object treeNode, int index) throws Exception { TreeNode tn = (TreeNode) treeNode; //logger.debug("CT: " + tn.getData().getClass().getCanonicalName()); //StandardClass sc = (StandardClass) tn.getData(); String sc = (String) tn.getData(); Treerow dataRow = new Treerow(); dataRow.setParent(treeItem); treeItem.setValue(tn); Treecell treeCell = new Treecell(); treeCell.appendChild(new Label(sc)); dataRow.appendChild(treeCell); dataRow.addEventListener(Events.ON_CLICK, new EventListener() { public void onEvent(Event event) throws Exception { //EntityVersion ev = (EntityVersion) event.getData(); TreeNode node = (TreeNode) ((Treeitem) event.getTarget().getParent()).getValue(); //String pfad = (String) node.getCustomData(); String pfad = (String) node.getData(); showIcons(pfad); } }); } }; }
public void doAfterCompose(Component comp) throws Exception { super.doAfterCompose(comp); root = new DefaultTreeNode("", new DefaultTreeNode[0]); TreeModel model = new DefaultTreeModel(root); TreeDataListener listener = new TreeDataListener() { public void onChange(TreeDataEvent event) { switch(event.getType()) { case TreeDataEvent.INTERVAL_ADDED: alert("INTERVAL_ADDED"); break; case TreeDataEvent.INTERVAL_REMOVED: alert("INTERVAL_REMOVED"); break; } } }; model.addTreeDataListener(listener); TreeitemRenderer renderer = new TreeitemRenderer() { public void render(Treeitem item, Object data, int index) { item.setValue(data); item.setLabel("" + ((DefaultTreeNode) data).getData()); } }; tree.setModel(model); tree.setItemRenderer(renderer); }
Usage snippet has been bookmarked! Review your bookmarks
Thank you! Review your likes