public boolean hasDynamicProperty(String name) { return ComponentsCtrl.isReservedAttribute(name); }
results.add(ComponentsCtrl.parseEventExpression(_comp, sub, _comp, false));
/** Returns the automatically generate component's UUID/ID. */ public static final String toAutoId(String prefix, int val) { return encodeId(new StringBuffer(16).append(prefix), val); }
public Component newInstance(Class<? extends Component> cls) { final Object curInfo = ComponentsCtrl.getCurrentInfo(); boolean bSet = true; if (curInfo instanceof ComponentInfo) { bSet = ((ComponentInfo) curInfo).getComponentDefinition() != this; } else if (curInfo instanceof ShadowInfo) { bSet = ((ShadowInfo) curInfo).getComponentDefinition() != this; } if (bSet) ComponentsCtrl.setCurrentInfo(this); final Component comp; try { comp = cls.newInstance(); } catch (Exception ex) { throw UiException.Aide.wrap(ex); } finally { if (bSet) ComponentsCtrl.setCurrentInfo((ComponentDefinition) null); } return comp; }
ComponentsCtrl.applyForward(_comp, _forward);
public String getNextUuid(Page page) { final IdGenerator idgen = ((WebAppCtrl) _wapp).getIdGenerator(); String uuid = idgen != null ? idgen.nextPageUuid(page) : null; if (uuid == null) return nextUuid(); ComponentsCtrl.checkUuid(uuid); return uuid; }
public void onEvent(Event evt) throws Exception { final Object controller = getController(); final Method mtd = ComponentsCtrl.getEventMethod(controller.getClass(), evt.getName()); if (mtd != null) { if (mtd.getParameterTypes().length == 0) mtd.invoke(controller); else if (evt instanceof ForwardEvent) { //ForwardEvent final Class paramcls = mtd.getParameterTypes()[0]; //paramcls is ForwardEvent || Event if (ForwardEvent.class.isAssignableFrom(paramcls) || Event.class.equals(paramcls)) { mtd.invoke(controller, evt); } else { do { evt = ((ForwardEvent) evt).getOrigin(); } while (evt instanceof ForwardEvent); mtd.invoke(controller, evt); } } else mtd.invoke(controller, evt); } }
public void onPageAttached(Page newpage, Page oldpage) { super.onPageAttached(newpage, oldpage); Component rootParent = ComponentsCtrl.getRootParent(); final Radiogroup rg = getRadiogroup(); // ZK-3818: update selected index in the callback if (!_explictGroup) { _group = this.getRadiogroup(); } if (rg != null && rootParent instanceof ComponentCtrl && (!Components.isAncestor(rootParent, rg) || rootParent == rg)) { ((ComponentCtrl) rootParent).addCallback(AFTER_CHILD_ADDED, new Callback<Component>() { public void call(Component rootParent) { rg.fixOnAdd(Radio.this, false); } }); } } }
/** * Applies the forward condition to the specified component. * * <p>The basic format:<br/> * <code>onEvent1=id1/id2.onEvent2,onEvent3=id3.onEvent4</code> * * <p>See {@link org.zkoss.zk.ui.metainfo.ComponentInfo#setForward} * for more information. * * @since 3.0.0 */ public static final void applyForward(Component comp, String forward) { if (forward == null) return; final Map<String, Collection<String>> fwds = new LinkedHashMap<String, Collection<String>>(); //remain the order Maps.parseMultiple(fwds, forward, ',', '\'', true, true); for (Map.Entry<String, Collection<String>> me : fwds.entrySet()) { final String orgEvent = me.getKey(); if (orgEvent != null && !Events.isValid(orgEvent)) throw new UiException("Not an event name: " + orgEvent); final Collection<String> conds = me.getValue(); for (String cond : conds) applyForward0(comp, orgEvent, cond); } }
public boolean removeComponent(Component comp, boolean recycleAllowed) { final String uuid = comp.getUuid(); if (_comps.remove(uuid) == null || !recycleAllowed || recycleUuidDisabled() || (comp instanceof StubComponent)) //Bug ZK-1452: don't need to recycle StubComponent's uuid since it's never reset return false; //not recycled //Bug 3002611: don't recycle UUID if RawId, since addUuidChanged will //cause AuRemove to be sent if (comp instanceof RawId && (!ComponentsCtrl.isAutoUuid(uuid) || ((WebAppCtrl) _wapp).getIdGenerator() != null)) return false; //not recycled final int execId = getExecId(); RecycleInfo ri = null; if (_uuidRecycle == null) { _uuidRecycle = new LinkedList<RecycleInfo>(); } else { for (RecycleInfo r : _uuidRecycle) if (r.execId == execId) { ri = r; //found break; } } if (ri == null) _uuidRecycle.add(ri = new RecycleInfo(execId)); ri.uuids.add(uuid); return true; //recycled }
final Object curInfo = ComponentsCtrl.getCurrentInfo(); if (curInfo != null) { ComponentsCtrl.setCurrentInfo((ComponentInfo) null); //to avoid mis-use if (curInfo instanceof ComponentInfo) { final ComponentInfo compInfo = (ComponentInfo) curInfo;
ci.doAfterCompose(child, bRoot); ComponentsCtrl.applyForward(child, childInfo.getForward());
return nextUuid(); ComponentsCtrl.checkUuid(uuid); return uuid;
public void service(Event event, Scope scope) throws Exception { final String evtnm = event.getName(); final Method mtd = ComponentsCtrl.getEventMethod(getClass(), evtnm); if (_auxinf != null) service(event, scope, _auxinf.listeners != null ? _auxinf.listeners.get(evtnm) : null, _auxinf.evthds != null ? _auxinf.evthds.get(this, evtnm) : null, mtd, false); else service(event, scope, null, null, mtd, false); }
@Override public void onPageDetached(Page page) { super.onPageDetached(page); //B65-ZK-1768 remove the radio from the radiogroup in case it is an external radio final Radiogroup rg = getRadiogroup(); if (rg != null) { rg.removeExternal(this); } // ZK-3818: update selected index in the callback if (!_explictGroup) { _group = null; } Component rootParent = ComponentsCtrl.getRootParent(); if (rg != null && rootParent instanceof ComponentCtrl && (!Components.isAncestor(rootParent, rg) || rootParent == rg)) { ((ComponentCtrl) rootParent).addCallback(AFTER_CHILD_REMOVED, new Callback<Component>() { public void call(Component rootParent) { rg.fixOnRemove(Radio.this); } }); } }
final Object[] result = parseEventExpression(comp, cond, null, true);
public boolean hasDynamicProperty(String name) { return ComponentsCtrl.isReservedAttribute(name); }
_id = nextDesktopId(dc); else if (idgen != null) ComponentsCtrl.checkUuid(_id); updateUuidPrefix();
return true; if (ComponentsCtrl.getEventMethod(comp.getClass(), evtnm) != null || comp.isListenerAvailable(evtnm, asap)) return true;
private static String nextDesktopId(DesktopCache dc) { if (dc != null) return ComponentsCtrl.encodeId(new StringBuffer(12).append(DESKTOP_ID_PREFIX), dc.getNextKey()).toString(); final int v; synchronized (DesktopImpl.class) { v = _keyWithoutDC++; } return ComponentsCtrl.encodeId(new StringBuffer(12).append("_g"), v).toString(); }