/** * Sets the selected tab panel. */ public void setSelectedPanel(Tabpanel panel) { if (panel == null) throw new IllegalArgumentException("null tabpanel"); if (panel.getTabbox() != this) throw new UiException("Not a child: " + panel); final Tab tab = panel.getLinkedTab(); if (tab != null) setSelectedTab(tab); }
/** Returns the tab associated with this tab panel. */ public Tab getLinkedTab() { final int j = getIndex(); if (j >= 0) { final Tabbox tabbox = getTabbox(); if (tabbox != null) { final Tabs tabs = tabbox.getTabs(); if (tabs != null && tabs.getChildren().size() > j) return (Tab) tabs.getChildren().get(j); } } return null; }
/** Returns the tabbox owns this component. */ public Tabbox getTabbox() { final Tabpanels panels = (Tabpanels) getParent(); return panels != null ? panels.getTabbox() : null; }
public void render(Component comp, Writer out) throws IOException { final SmartWriter wh = new SmartWriter(out); final Tabpanel self = (Tabpanel) comp; final Tab tab = self.getLinkedTab(); if (tab == null) return; //generate nothing (Bug 1848377) final Tabbox tabbox = self.getTabbox(); final String tabzcs = tab.getZclass() + '-'; final String zcs = self.getZclass(); final String uuid = self.getUuid(); final String tabuuid = tab.getUuid(); final String mold = tabbox.getMold(); wh.write("<div class=\"").write(zcs).write("-outer\" id=\"").write(uuid).write("\">"); if(!Strings.isBlank(tabbox.getPanelSpacing()) && self.getIndex() != 0) wh.writeln("<div style=\"margin:0;display:list-item;width:100%;height:${self.tabbox.panelSpacing};\"></div>"); wh.write("</span></div></div></div></div></div>"); wh.write("<div id=\""+uuid+"!real\"") .writeln(self.getOuterAttrs()).write(self.getInnerAttrs()+">"); wh.writeln("<div id=\""+uuid+"!cave\">"); wh.writeChildren(self); wh.writeln("</span></span></div></div></div></div>"); wh.write("<div id=\""+uuid+"!real\"") .writeln(self.getOuterAttrs()).write(self.getInnerAttrs()+">"); wh.writeln("<div id=\""+uuid+"!cave\">"); wh.writeChildren(self);
public void renderTabpanel(Tabpanel item, final Object data, final int index) throws Exception { final Tabbox tabbox = item.getTabbox(); final Tabpanels tabpanels = tabbox.getTabpanels(); final int size = tabbox.getModel().getSize(); final Template tm = resolveTemplate(tabbox, item, data, index, size, tmn, "tabpanel"); if (tm == null) { item.appendChild(new Label(Objects.toString(data))); } else { final ForEachStatus iterStatus = new AbstractForEachStatus() { //provide iteration status in this context ntabpanel.setAttribute(BinderCtrl.VAR, varnm); // for the converter to get the value ntabpanel.setAttribute(AbstractRenderer.IS_TEMPLATE_MODEL_ENABLED_ATTR, true); ntabpanel.setAttribute(AbstractRenderer.CURRENT_INDEX_RESOLVER_ATTR, new IndirectBinding(data) { public Binder getBinder() { return BinderUtil.getBinder(ntabpanel, true); ntabpanel.setAttribute(itervarnm, iterStatus); ntabpanel.setAttribute(TemplateResolver.TEMPLATE_OBJECT, item.removeAttribute(TemplateResolver.TEMPLATE_OBJECT)); item.setAttribute(Attributes.MODEL_RENDERAS, ntabpanel); item.detach();
public void render(Component comp, Writer out) throws IOException { final Tabpanel self = (Tabpanel) comp; final Tabbox tabbox = self.getTabbox(); final String mold = tabbox.getMold(); if ("accordion".equals(mold) || "accordion-lite".equals(mold)) { _acdpanel.render(comp, out); return; } if ("vertical".equals(tabbox.getOrient())) { _vpanel.render(comp, out); return; } final SmartWriter wh = new SmartWriter(out); wh.write("<div id=\"").write(self.getUuid()).write('"') .write(" z.type=\"zul.tab2.Tabpanel2\"") .write(self.getOuterAttrs()) .write('>') .write("<div id=\"").write(self.getUuid()).write("!real\" ") .write(self.getInnerAttrs()).write('>') .writeChildren(self) .writeln("</div></div>"); } }
/** Returns whether this tab panel is selected. */ public boolean isSelected() { final Tab tab = getLinkedTab(); return tab != null && tab.isSelected(); }
public void render(Component comp, Writer out) throws IOException { final SmartWriter wh = new SmartWriter(out); final Tabpanel self = (Tabpanel) comp; wh.write("<div id=\"").write(self.getUuid()).write('"') .write(self.getOuterAttrs()).write(self.getInnerAttrs()).write('>') .writeChildren(self) .write("</div>"); } }
Component include = panel.getFirstChild(); if (include instanceof Include) { include.detach(); panel.detach();
/** * Initialize the selector controllers and determines which tab is selected by default. */ private void init() { needsInit = false; patient = PatientContext.getActivePatient(); boolean selected = false; for (Component child : tabbox.getTabpanels().getChildren()) { Tabpanel panel = (Tabpanel) child; if (getSelector(panel).init(this) && !selected) { selected = true; panel.getLinkedTab().setSelected(true); } } selectionChanged(); }
/** Returns the index of this panel, or -1 if it doesn't belong to any * tabpanels. */ public int getIndex() { final Tabpanels tabpanels = (Tabpanels) getParent(); if (tabpanels == null) return -1; int j = 0; for (Iterator<Component> it = tabpanels.getChildren().iterator();; ++j) if (it.next() == this) return j; }