public Set<? extends Component> getAvailableAtClient() { if (!isCropper()) return null; final Tree tree = getTree(); final Component parent = getParent(); final Execution exe = Executions.getCurrent(); final String attrnm = VISIBLE_ITEM + tree.getUuid(); Map<Treeitem, Boolean> map = cast((Map) exe.getAttribute(attrnm)); if (map == null) { //Test very simple case first since getVisibleItems costly if (parent instanceof Treeitem) { for (Treeitem ti = (Treeitem) parent;;) { if (!ti.isOpen()) return Collections.emptySet(); Component gp = ti.getParent().getParent(); if (!(gp instanceof Treeitem)) break; ti = (Treeitem) gp; } } map = tree.getVisibleItems(); Executions.getCurrent().setAttribute(attrnm, map); } return map.keySet(); //yes, we return all visible items, not just direct children //in other words, we consider the whole tree as a single scope //See also bug 2814504 } }
public void render(Component comp, Writer out) throws IOException { final SmartWriter wh = new SmartWriter(out); final Tree self = (Tree) comp; final String uuid = self.getUuid(); final String zcls = self.getZclass(); final Execution exec = Executions.getCurrent(); final String tag = exec.isBrowser("ie") || exec.isBrowser("gecko") ? "a" : "button"; wh.write("<div id=\"").write(self.getUuid()).write("\" z.type=\"zul.tree.Tree\" z.pg=\"t\"") .write(self.getOuterAttrs()).write(self.getInnerAttrs()).write(">"); if (self.getPagingChild() != null && self.getPagingPosition().equals("top") || self.getPagingPosition().equals("both")) { wh.write("<div id=\"").write(self.getUuid()).write("!head\" class=\"").write(zcls).write("-header\">") .write("<table width=\"").write(self.getInnerWidth()).write("\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"table-layout:fixed\">"); if(self.getTreecols() != null) { wh.write("<div id=\"").write(self.getUuid()).write("!body\" class=\"").write(zcls).write("-body\">") .write("<table width=\"").write(self.getInnerWidth()).write("\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\""); if (self.isFixedLayout()) wh.write("<div id=\"").write(self.getUuid()).write("!foot\" class=\"").write(zcls).write("-footer\">") .write("<table width=\"").write(self.getInnerWidth()).write("\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"table-layout:fixed\">"); if(self.getTreecols() != null) {
public void render(Component comp, Writer out) throws IOException { final SmartWriter wh = new SmartWriter(out); final Tree self = (Tree) comp; final String uuid = self.getUuid(); final String zcls = self.getZclass(); final Execution exec = Executions.getCurrent();