public void redraw(Writer out) throws IOException { if (_inRedraw) { //if callback, invoke super super.redraw(out); } else { _inRedraw = true; try { draw(out); } finally { _inRedraw = false; } } } /** A draw implementation for {@link #redraw} to encapsulate
public void beforeParentChanged(Component parent) { if (parent != null && !(parent instanceof Imagemap)) throw new UiException("Area's parent must be imagemap, not " + parent); super.beforeParentChanged(parent); }
public Object clone() { final HtmlShadowElement clone = (HtmlShadowElement) super.clone(); clone._previousInsertion = _previousInsertion; clone._firstInsertion = _firstInsertion; clone._lastInsertion = _lastInsertion; clone._nextInsertion = _nextInsertion; return clone; }
public String setClientDataAttribute(String name, String value) { String old = setClientAttribute("data-" + name, value); if (old != null) invalidate(); return old; }
public void addSharedEventHandlerMap(EventHandlerMap evthds) { if (evthds != null && !evthds.isEmpty()) { unshareEventHandlerMap(false); if (initAuxInfo().evthds == null) { _auxinf.evthds = evthds; _auxinf.evthdsShared = true; } else { _auxinf.evthds.addAll(evthds); } final Desktop desktop = getDesktop(); if (desktop != null) onListenerChange(desktop, true); } }
public void setMold(String mold) { if (mold != null && (DEFAULT.equals(mold) || mold.length() == 0)) mold = null; if (!Objects.equals(_auxinf != null ? _auxinf.mold : DEFAULT, mold)) { if (!_def.hasMold(mold != null ? mold : DEFAULT)) throw new UiException("Unknown mold: " + mold + "; allowed: " + _def.getMoldNames()); final String oldtype = getWidgetClass(); initAuxInfo().mold = mold; if (Objects.equals(oldtype, getWidgetClass())) smartUpdate("mold", getMold()); else invalidate(); } }
checkParentChild(parent, this); //create _chdinf beforeParentChanged(parent); triggerBeforeHostParentChanged(parent); final boolean idSpaceChanged = (parent != null ? spaceController(parent) : null) != (_parent != null ? spaceController(_parent) : _page); clearVirtualIdSpace(); //clear since it is being added to another if (idSpaceChanged) removeFromIdSpacesDown(this); op._chdinf.markRemoving(this, true); try { op.removeChild(this); //spec: call back removeChild } finally { op._chdinf.markRemoving(this, false); np._chdinf.markAdding(this, true); try { np.insertBefore(this, null); //spec: call back inserBefore } finally { np._chdinf.markAdding(this, false); final Page newpg = _parent != null ? _parent.getPage() : null, oldpg = _page; addMoved(op, _page, newpg); //Not depends on UUID try { ComponentsCtrl.setRootParent(parent != null ? parent : op); setPage0(newpg); //UUID might be changed here } finally {
final boolean aupg = isAsyncUpdate(); final String extra; try { out.write('['); else { out.write(HtmlPageRenders.outSpecialJS(getDesktop())); out.write("zkx("); renderProperties(renderer); if (_page != null) { PropertiesRenderer[] prs = _page.getDesktop().getWebApp().getConfiguration().getPropertiesRenderers(); Collection<Callback<ContentRenderer>> redrawCallback = getRedrawCallback(); final String wgtcls = getWidgetClass(); if (wgtcls == null) throw new UiException("Widget class required for " + this + " with " + getMold()); out.write("\n['"); out.write(wgtcls); out.write("','"); out.write(getUuid()); out.write("',{"); out.write(renderer.getBuffer().toString()); redrawChildren(out); final String mold = getMold(); if (!DEFAULT.equals(mold)) {
protected void renderProperties(org.zkoss.zk.ui.sys.ContentRenderer renderer) throws java.io.IOException { super.renderProperties(renderer); for (Component child = getFirstChild(); child != null; child = child.getNextSibling()) { if (child instanceof HtmlBasedComponent && (((HtmlBasedComponent) child).getHflex() != null || ((HtmlBasedComponent) child).getVflex() != null)) log.warn("Using hflex/vflex inside NoDOM component is not supported"); } } }
render(renderer, "id", _id); if (_auxinf != null && !_auxinf.visible) //don't call isVisible since it might be overriden (backward compatible) renderer.render("visible", false); render(renderer, "autag", getAutag()); final Desktop desktop = getDesktop(); if (this instanceof IdSpace && this.getAttribute("z$is") == null) // Used by Window and others to minimize number of bytes renderer.render("z$is", true); for (Map.Entry<String, Integer> me : getClientEvents().entrySet()) { final String evtnm = me.getKey(); final int flags = me.getValue().intValue(); if ((flags & CE_IMPORTANT) != 0) { if (shallHandleImportant == null) shallHandleImportant = Boolean.valueOf(Utils.markClientInfoPerDesktop(desktop, getWidgetClass())); if (shallHandleImportant.booleanValue()) renderer.render("$$" + evtnm, (flags & CE_NON_DEFERRABLE) != 0); Object o = getAttribute("$composer"); if (o != null) renderer.render("$ZKAUS$", Boolean.TRUE); o = getAttribute(Attributes.CLIENT_ROD); if (o != null) renderer.render("z$rod", (o instanceof Boolean && ((Boolean) o).booleanValue()) || !"false".equals(o));
if (initAuxInfo().listeners == null) _auxinf.listeners = new HashMap<String, List<EventListenerInfo>>(8); if (!found && (desktop = getDesktop()) != null) { if (Events.ON_CLIENT_INFO.equals(evtnm)) { desktop.setAttribute("org.zkoss.desktop.clientinfo.enabled", true); response(new AuClientInfo(desktop)); } else if (Events.ON_PIGGYBACK.equals(evtnm)) { ((DesktopCtrl) desktop).onPiggybackListened(this, true); } else if (Events.ON_VISIBILITY_CHANGE.equals(evtnm)) { desktop.setAttribute("org.zkoss.desktop.visibilitychange.enabled", true); } else if (getClientEvents().containsKey(evtnm)) { final boolean asap = Events.isListened(this, evtnm, true); if (lis.size() == 1 || oldasap != asap) smartUpdate("$" + evtnm, asap);
public boolean removeEventListener(String evtnm, EventListener<? extends Event> listener) { if (evtnm == null || listener == null) throw new IllegalArgumentException("null"); if (_auxinf != null && _auxinf.listeners != null) { final boolean oldasap = Events.isListened(this, evtnm, true); final List<EventListenerInfo> lis = _auxinf.listeners.get(evtnm); if (lis != null) { for (Iterator<EventListenerInfo> it = lis.iterator(); it.hasNext();) { final EventListenerInfo li = it.next(); if (li.listener.equals(listener)) { it.remove(); if (lis.isEmpty()) _auxinf.listeners.remove(evtnm); final Desktop desktop = getDesktop(); if (desktop != null) { onListenerChange(desktop, false); if (getClientEvents().containsKey(evtnm)) { if (lis.isEmpty() && !Events.isListened(this, evtnm, false)) smartUpdate("$" + evtnm, (Object) null); //no listener at all else if (oldasap != Events.isListened(this, evtnm, true)) smartUpdate("$" + evtnm, !oldasap); } } return true; } } } } return false; }
public void service(Event event, Scope scope, Component comp, String cmd) throws Exception { ((AbstractComponent) comp).service(event, scope, _listeners != null ? _listeners.get(cmd) : null, _evthds != null ? _evthds.get(comp, cmd) : null, null, true); //skip page's listener }
public PropertyAccess getPropertyAccess(String prop) { PropertyAccess pa = _properties.get(prop); if (pa != null) return pa; return super.getPropertyAccess(prop); }
final Desktop desktop = comp.getDesktop(); if (desktop == null) return ""; //no avail at client bExtRequired = name.lastIndexOf('.') < 0; } else { sb.append(comp.getId());
private void onListenerChange(Desktop desktop, boolean listen) { if (listen) { if (Events.isListened(this, Events.ON_CLIENT_INFO, false)) { //asap+deferrable response(new AuClientInfo(desktop)); getDesktop().setAttribute("org.zkoss.desktop.clientinfo.enabled", true); //We always fire event not a root, since we don't like to //check when setParent or setPage is called } if (Events.isListened(this, Events.ON_PIGGYBACK, false)) ((DesktopCtrl) desktop).onPiggybackListened(this, true); if (Events.isListened(this, Events.ON_VISIBILITY_CHANGE, false)) getDesktop().setAttribute("org.zkoss.desktop.visibilitychange.enabled", true); } else { if (!Events.isListened(this, Events.ON_PIGGYBACK, false)) ((DesktopCtrl) desktop).onPiggybackListened(this, false); } }
onEvent(li.listener, event); if (!event.isPropagatable()) return; //done if (page != null && getDesktop() != null) { //this.desktop, not exec.desktop final ZScript zscript = evthd != null ? evthd.getZScript() : null; if (zscript != null) { if (li.priority < 1000) { execinf.update(null, li.listener, null); onEvent(li.listener, event); if (!event.isPropagatable()) return; //done onEvent(el, event); if (!event.isPropagatable()) return; //done
/** @deprecated As of release 6.0.0, replaced with * {@link #getAnnotation(String, String)}. */ public Annotation getAnnotation(String annotName) { return getAnnotation(null, annotName); }
/** @deprecated As of release 6.0.0, replaced with {@link #getAnnotations(String)}. */ public Collection<Annotation> getAnnotations() { return getAnnotations(null); }
public void invalidate() { if (!invalidateParent()) super.invalidate(); else if (getParent() != null) getParent().invalidate(); }