private void mySetupTemplateComponent(Component comp, Object owner, Component item) { if (existsBindings(comp)) { if (comp.getAttribute(OWNER) != null) { comp.setAttribute(HASTEMPLATEOWNER, Boolean.TRUE); //owner is a template } comp.setAttribute(OWNER, owner); comp.setAttribute(ITEM, item); } for (Component c : comp.getChildren()) { mySetupTemplateComponent(c, owner, item); //recursive } }
/** * Enables selection of the institution. */ private void allowOrganizationSelection() { institutionList.setVisible(true); institutionButton.setVisible(false); }
/** * @param comp the component whose UUID has been changed. * @param oldid the old UUID. */ public AuUuid(Component comp, String oldid) { super("uuid", comp, new String[] { oldid, comp.getUuid() }); } }
/** * Return the child index of the component. If the component is one of the * page roots, return -1. */ public int getComponentChildIndex() { if (_compChildIndex > -1) return _compChildIndex; Component parent = _comp.getParent(); return parent == null ? -1 : parent.getChildren().indexOf(_comp); }
@SuppressWarnings("unchecked") private static Set<String> getEvtLisSet(Component comp, String name) { Object obj = comp.getAttribute(name); if (obj != null) return (Set<String>) obj; Set<String> set = new HashSet<String>(); comp.setAttribute(name, set); return set; }
private void removeForm(Component comp) { String id = (String) comp.getAttribute(FORM_ID, Component.COMPONENT_SCOPE); if (id != null) { comp.removeAttribute(FORM_ID); Object form = comp.removeAttribute(id); if (form != null) initSaveFormMap().remove(form); comp.removeAttribute(id + "Status"); } }
private void resolveDefineComponents(Collection<Component> comps, Map<String, Component> map) { if (!comps.isEmpty()) { Component comp = comps.iterator().next(); // join "define" components as children of "insert" component do { final Component nextRoot = comp.getNextSibling(); final Annotation annt = ((ComponentCtrl) comp).getAnnotation(null, "define"); if (annt != null) { final String joinId = annt.getAttribute("value"); final Component insertComp = map.get(joinId); if (insertComp != null) { comp.setParent(insertComp); } else { comp.detach(); //no where to insert } } resolveDefineComponents(comp.getChildren(), map); comp = nextRoot; } while (comp != null); } }
/** * Update the original recipient list, set the response attribute, and close the dialog */ public void onClick$btnOK() { recipients.clear(); recipients.addAll(modelRecipients); root.setAttribute("ok", txtComment.isVisible() ? txtComment.getText() : true); root.detach(); } }
private void removeChildren(Component firstChild) { for (Component next = firstChild; next != null;) { // recursively remove all children, depth first if (next.getFirstChild() != null) { removeChildren(next.getFirstChild()); } Component tmp = next.getNextSibling(); ((HtmlShadowElement) next).removeFromParent(); next = tmp; } }
private static void init(Map<String, Component> fellows, Component comp) { if (!(comp instanceof NonFellow)) { final String compId = comp.getId(); if (!AbstractComponent.isAutoId(compId)) fellows.put(compId, comp); } if (!(comp instanceof IdSpace)) for (Component child = comp.getFirstChild(); child != null; child = child.getNextSibling()) init(fellows, child); //recursive }
/** Replaces all children of the specified component. * It is the same as * <pre><code>parent.getChildren().clear(); *parent.getChildren().addAll(newChildren); *</code></pre> * @since 3.5.2 */ public static void replaceChildren(Component parent, Collection<Component> newChildren) { final Collection<Component> children = parent.getChildren(); children.clear(); children.addAll(newChildren); }
@SuppressWarnings("unchecked") private void syncModel(ListModel<?> model) { //clear all List<Component[]> cbrCompsList = (List<Component[]>) _owner .getAttribute(BinderCtrl.CHILDREN_BINDING_RENDERED_COMPONENTS); if (cbrCompsList != null) { _owner.removeAttribute(BinderCtrl.CHILDREN_BINDING_RENDERED_COMPONENTS); for (Component[] oldComps : cbrCompsList) { if (oldComps != null) { for (Component oc : oldComps) { oc.detach(); } } } } renderModelData(model, 0, model.getSize() - 1); }
private static void checkIdSpacesDown(Component comp, IdSpace owner) { final String compId = comp.getId(); if (!(comp instanceof NonFellow) && !isAutoId(compId) && (owner instanceof Component ? ((AbstractComponent) owner)._auxinf.spaceInfo.fellows.containsKey(compId) : owner.hasFellow(compId))) throw new UiException("Not unique in the ID space of " + owner + ": " + compId); if (!(comp instanceof IdSpace)) for (AbstractComponent ac = (AbstractComponent) comp.getFirstChild(); ac != null; ac = ac._next) checkIdSpacesDown(ac, owner); //recursive }
private final int nDChild() { if (_firstInsertion != null) { int size = 1; Component next = _firstInsertion; while (next != _lastInsertion) { size++; next = next.getNextSibling(); } return size; } return 0; }
private void test(Component root, String eventName, int eventData, int expectedSize) { String labelText = eventName + "." + eventData; EventManager.getInstance().fireLocalEvent(eventName, labelText); assertEquals(expectedSize, root.getChildren().size()); Label label = (Label) root.getChildren().get(expectedSize - 1).getFirstChild(); assertEquals(labelText, label.getValue()); } }
public void handle(ServletRequest request, ServletResponse response, AccessDeniedException accessDeniedException) throws IOException, ServletException { // Put exception into request scope (perhaps of use to a view) ((HttpServletRequest) request).setAttribute(AccessDeniedHandlerImpl.ACEGI_SECURITY_ACCESS_DENIED_EXCEPTION_KEY, accessDeniedException); final Component comp = (Component) request.getAttribute(ZkEventExceptionFilter.COMPONENT); if (!comp.isListenerAvailable(ON_ACCESSDENIED, true)) { final EventListener<Event> listener = new ShowWindowEventListener<Event>(); comp.setAttribute(ON_ACCESSDENIED, listener); comp.addEventListener(ON_ACCESSDENIED, listener); } final String url = getErrorPage(); Events.postEvent(new Event(ON_ACCESSDENIED, comp, url != null ? url : "~./accessDenied.zul")); } }
/** * Wire change listener to all input elements of child form. * * @param root Root element. */ private void wireListener(Component root) { for (Component child : root.getChildren()) { if (child instanceof MeshElement) { child.addEventListener(Events.ON_SELECT, changeListener); } else if (child instanceof InputElement) { child.addEventListener(Events.ON_CHANGING, changeListener); } else if (child instanceof Button) { child.addEventListener(Events.ON_CLICK, changeListener); } else { wireListener(child); } } }
public void clearChildren() { if (getFirstChild() != null) { removeChildren(getFirstChild()); } if (_firstInsertion != null) { for (Component next = _firstInsertion, end = _lastInsertion.getNextSibling(); next != end;) { Component tmp = next.getNextSibling(); next.detach(); next = tmp; } } }
private final void fixFellows(Collection<Component> c) { for (Component comp : c) { final String compId = comp.getId(); if (compId.length() > 0) addFellow(comp); if (!(comp instanceof IdSpace)) fixFellows(comp.getChildren()); //recursive } }