Class VolatileComponent
- java.lang.Object
-
- org.zkoss.stateless.ui.util.VolatileComponent
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable,Component,Scope,ComponentCtrl
public abstract class VolatileComponent extends java.lang.Object implements Component, ComponentCtrl
a volatile component for AU update- Author:
- jumperchen
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from interface org.zkoss.zk.ui.Component
APPLICATION_SCOPE, COMPONENT_SCOPE, DESKTOP_SCOPE, PAGE_SCOPE, REQUEST_SCOPE, SESSION_SCOPE, SPACE_SCOPE
-
Fields inherited from interface org.zkoss.zk.ui.sys.ComponentCtrl
AFTER_CHILD_ADDED, AFTER_CHILD_REMOVED, AFTER_PAGE_ATTACHED, AFTER_PAGE_DETACHED, AFTER_PARENT_CHANGED, CE_BUSY_IGNORE, CE_DUPLICATE_IGNORE, CE_IMPORTANT, CE_NON_DEFERRABLE, CE_REPEAT_IGNORE
-
-
Constructor Summary
Constructors Constructor Description VolatileComponent()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAnnotation(java.lang.String propName, java.lang.String annotName, java.util.Map<java.lang.String,java.lang.String[]> annotAttrs)Adds an annotation to the specified property of this component.voidaddAnnotation(java.lang.String annotName, java.util.Map<java.lang.String,java.lang.String[]> annotAttrs)booleanaddCallback(java.lang.String name, Callback callback)Adds a callback at component in specific namevoidaddEventHandler(java.lang.String name, EventHandler evthd)Adds an event handler.booleanaddEventListener(int i, java.lang.String s, EventListener<? extends Event> eventListener)Adds an event listener to specified event name for this component with the given priority.booleanaddEventListener(java.lang.String s, EventListener<? extends Event> eventListener)Adds an event listener to specified event name for this component.booleanaddForward(java.lang.String s, java.lang.String s1, java.lang.String s2)Adds a forward condition to forward the event received by this component to another component, specified with a path.booleanaddForward(java.lang.String s, java.lang.String s1, java.lang.String s2, java.lang.Object o)Adds a forward condition to forward the event received by this component to another component of the specified path with extra event data.booleanaddForward(java.lang.String s, Component component, java.lang.String s1)Adds a forward condition to forward the event received by this component to another component.booleanaddForward(java.lang.String s, Component component, java.lang.String s1, java.lang.Object o)Adds a forward condition to forward the event received by this component to another component with extra event data.booleanaddRedrawCallback(Callback<ContentRenderer> callback)booleanaddScopeListener(ScopeListener scopeListener)Adds a listener to listen whether this scope is changed.booleanaddShadowRoot(ShadowElement shadow)Adds the given shadow root from this host.booleanaddShadowRootBefore(ShadowElement shadow, ShadowElement insertBefore)Adds the given shadow root from this host.voidaddSharedEventHandlerMap(EventHandlerMap evthds)Adds a map of event handlers which is shared by other components.booleanappendChild(Component component)Appends a child.voidapplyProperties()Initializes the properties (a.k.a. members) based on what are defined in the component definition.voidbeforeChildAdded(Component child, Component insertBefore)Called before adding a child.voidbeforeChildRemoved(Component child)Called before removing a child.voidbeforeParentChanged(Component parent)Called before changing the parent.java.lang.Objectclone()Clones the component.voiddetach()Detaches this component such that it won't belong to any page.voiddisableBindingAnnotation()Set to disable the component with binding annotation.booleandisableClientUpdate(boolean disable)Sets whether to disable the update of the client widgets of this component and its descendants.voidenableBindingAnnotation()Set to enable the component with binding annotation.booleanequals(java.lang.Object o)java.util.List<java.lang.String>getAnnotatedProperties()Returns a read-only list of the name of properties that are associated at least one annotation (never null).java.util.List<java.lang.String>getAnnotatedPropertiesBy(java.lang.String annotName)Returns a read-only list of the names of the properties that are associated with the specified annotation (never null).AnnotationgetAnnotation(java.lang.String annotName)AnnotationgetAnnotation(java.lang.String propName, java.lang.String annotName)Returns the annotation associated with the definition of the specified property, or null if not available.java.util.Collection<Annotation>getAnnotations()java.util.Collection<Annotation>getAnnotations(java.lang.String propName)Returns a read-only collection of all annotations (Annotation) associated with the specified property.java.util.Collection<Annotation>getAnnotations(java.lang.String propName, java.lang.String annotName)Returns the annotations associated with the definition of the specified property.java.lang.ObjectgetAttribute(java.lang.String s)Returns the custom attribute associated with this component, i.e.,Component.COMPONENT_SCOPE.java.lang.ObjectgetAttribute(java.lang.String s, boolean b)Returns the custom attribute associated with this object.java.lang.ObjectgetAttribute(java.lang.String s, int i)Returns the value of the specified custom attribute in the specified scope, or null if not defined.java.lang.ObjectgetAttributeOrFellow(java.lang.String s, boolean b)Returns the custom attribute associated with this component, or the fellow of this component; or null if not found.java.util.Map<java.lang.String,java.lang.Object>getAttributes()Returns all custom attributes associated with this component, i.e.,Component.COMPONENT_SCOPE.java.util.Map<java.lang.String,java.lang.Object>getAttributes(int i)Returns all custom attributes of the specified scope.AuServicegetAuService()Returns an AU service to process the AU request before the component's default handling.java.lang.StringgetAutag()Returns the AU tag for this widget.java.util.Collection<Callback>getCallback(java.lang.String name)Returns all of callbacks by specific name<T extends Component>
java.util.List<T>getChildren()Returns a live list of children.java.lang.StringgetClientAttribute(java.lang.String s)Returns the value of a DOM attributejava.lang.StringgetClientDataAttribute(java.lang.String s)Returns the value of a DOM data attributejava.util.Map<java.lang.String,java.lang.Integer>getClientEvents()Returns a map of event information that the client might send to this component.ComponentDefinitiongetDefinition()Returns the component definition of this component (never null).ZScriptgetEventHandler(java.lang.String evtnm)Returns the event listener of the specified name, or null if not found.java.util.Set<java.lang.String>getEventHandlerNames()Returns a readonly collection of event names (String), or an empty collection if no event name is registered.EventListenerMapgetEventListenerMap()Returns the map of event handlers and listeners defined in this component.java.lang.Iterable<EventListener<? extends Event>>getEventListeners(java.lang.String s)Returns an iterable collection of the event listeners for the given event.java.lang.ObjectgetExtraCtrl()Returns the extra controls that tell ZK how to handle this component specially.ComponentgetFellow(java.lang.String s)Returns a component of the specified ID in the same ID space.ComponentgetFellow(java.lang.String s, boolean b)Returns a component of the specified ID in the same ID space.ComponentgetFellowIfAny(java.lang.String s)Returns a component of the specified ID in the same ID space, or null if not found.ComponentgetFellowIfAny(java.lang.String s, boolean b)Returns a component of the specified ID in the same ID space, or null if not found.java.util.Collection<Component>getFellows()Returns all fellows in the same ID space of this component.ComponentgetFirstChild()Returns the first child component, or null if no child at all.java.lang.StringgetId()Returns the ID.ComponentgetLastChild()Returns the last child component, or null if no child at all.java.util.Iterator<EventListener<? extends Event>>getListenerIterator(java.lang.String s)java.lang.StringgetMold()Returns the mold used to render this component.ComponentgetNextSibling()Returns the next sibling, or null if it is the last child.ComponentgetParent()Returns the parent component, or null if this is the root component.ComponentgetPreviousSibling()Returns the previous sibling, or null if it is the first child.PropertyAccessgetPropertyAccess(java.lang.String prop)Returns the corresponding property access object from the given property name, if any.java.util.Collection<Callback<ContentRenderer>>getRedrawCallback()ComponentgetRoot()Returns the root of this component.ShadowElementgetShadowFellowIfAny(java.lang.String id)Returns the shadow element under this shadow host.<T extends ShadowElement>
java.util.List<T>getShadowRoots()Returns a set of shadow elements, if any.java.lang.ObjectgetShadowVariable(java.lang.String s, boolean b)Returns the shadow variable associated with this component or its parent component; or null if not found.java.lang.ObjectgetShadowVariable(Component component, java.lang.String s, boolean b)Returns the shadow variable enclosed with the base component, which associated with this component or its parent component; or null if not found.IdSpacegetSpaceOwner()Returns the owner of the ID space that this component belongs to.java.lang.StringgetStubonly()Returns whether this component is stub-only.intgetSubBindingAnnotationCount()Returns the count of the component's subtree binding annotation.TemplategetTemplate(java.lang.String s)Returns the template of the given name, or null if not available.java.util.Set<java.lang.String>getTemplateNames()Returns a readonly set of the names of all templates.java.lang.StringgetWidgetAttribute(java.lang.String s)java.util.Set<java.lang.String>getWidgetAttributeNames()Returns a read-only collection of additions DOM attributes that shall be generated.java.lang.StringgetWidgetClass()Returns the widget class (a.k.a., the widget type), or null if not available.java.lang.StringgetWidgetListener(java.lang.String s)Returns the script of the client event, or null if not found.java.util.Set<java.lang.String>getWidgetListenerNames()Returns a read-only collection of event names (String) that the listener of the peer widget are assigned, or an empty collection if none is registered.java.lang.StringgetWidgetOverride(java.lang.String s)Returns the script of the method definition to override widget's method, or null if not found.java.util.Set<java.lang.String>getWidgetOverrideNames()Returns a read-only collection of the property names (String) that shall be overridden, or an empty collection if none is registered.booleanhasAttribute(java.lang.String s)Returns if the custom attribute is associate with this component.booleanhasAttribute(java.lang.String s, boolean b)Returns if a custom attribute is associated with this object.booleanhasAttribute(java.lang.String s, int i)Returns if the custom attribute is associate with this component.booleanhasAttributeOrFellow(java.lang.String s, boolean b)Returns if a custom attribute is associated with this component, or the fellow of this component.booleanhasBindingAnnotation()Returns whether the component itself has binding annotation or not.booleanhasFellow(java.lang.String s)Returns whether a fellow exists in the same ID space of this component.booleanhasFellow(java.lang.String s, boolean b)Returns whether there is a fellow named with the specified component ID in the same ID space as this component.inthashCode()booleanhasSubBindingAnnotation()Returns whether the component and its children have binding annotation or not.booleaninsertBefore(Component component, Component component1)Inserts a child before the reference child.voidinvalidate()Invalidates this component by setting the dirty flag such that it will be redraw the whole content of this component and its dependencies later.voidinvalidatePartial()voidinvalidatePartial(java.lang.String subId)booleanisInvalidated()Returns if this component needs to be redrawn at the client.booleanisListenerAvailable(java.lang.String s, boolean b)Returns whether the event listener is available.booleanisVisible()Returns whether this component is visible.voidonChildAdded(Component child)Called when a child is added.voidonChildRemoved(Component child)Called when a child is removed.voidonPageAttached(Page newpage, Page oldpage)Called when this component is attached to a page.voidonPageDetached(Page page)Called when this component is detached from a page.voidonParentChanged(Component parent)Called after the parent changed.WrongValueExceptiononWrongValue(WrongValueException ex)Notifies that anWrongValueExceptioninstance is thrown, andWrongValueException.getComponent()is the component causing the exception.Componentquery(java.lang.String s)Find the first component that matches the given CSS3 selector.java.lang.Iterable<Component>queryAll(java.lang.String s)Returns an iterable object for components that match the given CSS3 selector.voidredraw(java.io.Writer out)Render (a.k.a., redraw) this component and all its descendants.java.lang.ObjectremoveAttribute(java.lang.String s)Removes the custom attribute associated with this component, i.e.,Component.COMPONENT_SCOPE.java.lang.ObjectremoveAttribute(java.lang.String s, boolean b)Removes the custom attribute associated with this scope.java.lang.ObjectremoveAttribute(java.lang.String s, int i)Removes the specified custom attribute in the specified scope.booleanremoveCallback(java.lang.String name, Callback callback)Removes a callback for component by specific name.booleanremoveChild(Component component)Removes a child.booleanremoveEventListener(java.lang.String s, EventListener<? extends Event> eventListener)Removes an event listener.booleanremoveForward(java.lang.String s, java.lang.String s1, java.lang.String s2)Removes a forward condition that was added byComponent.addForward(String, String, String).booleanremoveForward(java.lang.String s, Component component, java.lang.String s1)Removes a forward condition that was added byComponent.addForward(String, Component, String).booleanremoveRedrawCallback(Callback<ContentRenderer> callback)booleanremoveScopeListener(ScopeListener scopeListener)Removes a change listener from this scope.booleanremoveShadowRoot(ShadowElement shadow)Removes the given shadow root from this host.voidrenderPropertiesOnly(ContentRenderer renderer)Renders the component properties onlyvoidservice(AuRequest request, boolean everError)Handles an AU request.voidservice(Event event, Scope scope)Handles an event.voidsessionDidActivate(Page page)Notification that the session, which owns this component, has just been activated (a.k.a., deserialized).voidsessionWillPassivate(Page page)Notification that the session, which owns this component, is about to be passivated (a.k.a., serialized).java.lang.ObjectsetAttribute(java.lang.String s, java.lang.Object o)Sets the custom attribute associated with this component, i.e.,Component.COMPONENT_SCOPE.java.lang.ObjectsetAttribute(java.lang.String s, java.lang.Object o, boolean b)Sets the custom attribute associated with this scope, or the parent scope.java.lang.ObjectsetAttribute(java.lang.String s, java.lang.Object o, int i)Sets the value of the specified custom attribute in the specified scope.voidsetAuService(AuService auService)Sets an AU service to process the AU request before the component's default handling.voidsetAutag(java.lang.String s)Sets the AU tag for this widget.java.lang.StringsetClientAttribute(java.lang.String s, java.lang.String s1)Sets or removes a DOM attribute of the peer widget (at the client).java.lang.StringsetClientDataAttribute(java.lang.String s, java.lang.String s1)Sets a DOM data attribute of the peer widget (at the client).voidsetDefinition(java.lang.String defname)Sets the component definition by specifying the name.voidsetDefinition(ComponentDefinition compdef)Sets the component definition.voidsetId(java.lang.String s)Sets the ID.voidsetMold(java.lang.String s)Sets the mold to render this component.voidsetPage(Page page)Sets what page this component belongs to.voidsetPageBefore(Page page, Component component)Sets what page this component belongs to, and insert this component right before the reference component.voidsetParent(Component component)Sets the parent component.voidsetStubonly(boolean b)Sets whether this component is stub-only.voidsetStubonly(java.lang.String s)Sets whether this component is stub-only.TemplatesetTemplate(java.lang.String s, Template template)Sets a UI template which could be retrieved later withComponent.getTemplate(java.lang.String).booleansetVisible(boolean b)Sets whether this component is visible.java.lang.StringsetWidgetAttribute(java.lang.String s, java.lang.String s1)voidsetWidgetClass(java.lang.String s)Sets the widget class (a.k.a., the widget type).java.lang.StringsetWidgetListener(java.lang.String s, java.lang.String s1)Sets or removes an event listener of the peer widget.java.lang.StringsetWidgetOverride(java.lang.String s, java.lang.String s1)Sets or removes a method or a property of the peer widget (at the client).-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.zkoss.zk.ui.Component
getDesktop, getPage, getUuid
-
Methods inherited from interface org.zkoss.zk.ui.sys.ComponentCtrl
getForwards
-
-
-
-
Method Detail
-
getWidgetClass
public java.lang.String getWidgetClass()
Description copied from interface:ComponentReturns the widget class (a.k.a., the widget type), or null if not available. The widget class is a JavaScript class, including the package name. For example, "zul.wnd.Window".Default: the widget class is decided by the component definition (
ComponentDefinition) and the mold (Component.getMold()).To override in Java, you could invoke
Component.setWidgetClass(java.lang.String). To override in ZUML, you could use the client namespace as follows.<window xmlns:w="http://www.zkoss.org/2005/zk/client" w:use="foo.MyWindow"> </window>Note: for Ajax devices, the widget class must be non-null.
- Specified by:
getWidgetClassin interfaceComponent- See Also:
Component.setWidgetClass(java.lang.String)
-
setWidgetClass
public void setWidgetClass(java.lang.String s)
Description copied from interface:ComponentSets the widget class (a.k.a., the widget type). The widget class is a JavaScript class, including the package name. For example, "zul.wnd.Window".- Specified by:
setWidgetClassin interfaceComponent- Parameters:
s- the widget's class name at the client side. If null (or empty), the default one is used (seeComponent.getWidgetClass()).
-
getDefinition
public ComponentDefinition getDefinition()
Description copied from interface:ComponentReturns the component definition of this component (never null).- Specified by:
getDefinitionin interfaceComponent
-
getSpaceOwner
public IdSpace getSpaceOwner()
Description copied from interface:ComponentReturns the owner of the ID space that this component belongs to. The returned value could be a component, a page or null. If this component itself implementsIdSpace, this method returns itself. If it has an ancestor that implementsIdSpace, the ancestor is returned. Otherwise, the page it belongs to is returnedEach ID space defines an independent set of IDs. No component in the same ID space could have the same ID. To get any component in the same ID space, you could use
Component.getFellow(java.lang.String). SeeIdSpacefor more details.The ID space related methods include
Component.getFellow(java.lang.String),Component.getAttribute(java.lang.String, int)andComponent.getAttributeOrFellow(java.lang.String, boolean).- Specified by:
getSpaceOwnerin interfaceComponent
-
getId
public java.lang.String getId()
Description copied from interface:ComponentReturns the ID.Default: "" (an empty string; it means no ID at all).
If a component belongs to an ID space (see
IdSpace), the ID must also be unique in the ID space it belongs. any its parent and ancestor implementsIdSpace. If it is a root component (i.e., without any parent), its ID must be unique among root components of the same page.A page itself is also an ID space, so you could retrieve components in a page by use of
IdSpace.getFellow(java.lang.String), unless the component is a descendant of another component that implementsIdSpace. In this case, you have to retrieve the parent first (by use ofIdSpace.getFellow(java.lang.String)and then useComponent.getFellow(java.lang.String)against the owner of the ID space.In zscript and EL, a component with explicit ID can be accessed directly by the ID.
-
setId
public void setId(java.lang.String s)
Description copied from interface:ComponentSets the ID. The scope of uniqueness depends on whether this component is a root component. Refer toComponent.getId()for more details.Default: "" (an empty string; it means no ID at all).
-
setPage
public void setPage(Page page)
Description copied from interface:ComponentSets what page this component belongs to. If this component already belongs to the same page, nothing is changed.For child components, the page they belong is maintained automatically. You need to invoke this method only for root components.
Note: a component might be attached to a page due invocations other than this method. For example, a component is attached if its parent is attached. To know whether it is attached, override
ComponentCtrl.onPageAttached(org.zkoss.zk.ui.Page, org.zkoss.zk.ui.Page)rather than this method.If you would like to monitor if a component is attached or detached from a page, you could register a desktop listener implementing
UiLifeCycle.- Specified by:
setPagein interfaceComponent- See Also:
ComponentCtrl.onPageAttached(org.zkoss.zk.ui.Page, org.zkoss.zk.ui.Page),ComponentCtrl.onPageDetached(org.zkoss.zk.ui.Page)
-
setPageBefore
public void setPageBefore(Page page, Component component)
Description copied from interface:ComponentSets what page this component belongs to, and insert this component right before the reference component.For child components, the page they belong is maintained automatically. You need to invoke this method only for root components.
It is similar to
Component.setPage(org.zkoss.zk.ui.Page), except this component will be placed before the reference component. If the reference component is null, this component is placed at the end of all root components.- Specified by:
setPageBeforein interfaceComponentcomponent- another root component used as a reference which this component will be placed before. If null, this component will be placed at the end of all root components (no matter whether it already belongs to the same page).- See Also:
Component.setPage(org.zkoss.zk.ui.Page)
-
getFellow
public Component getFellow(java.lang.String s)
Description copied from interface:ComponentReturns a component of the specified ID in the same ID space. Components in the same ID space assigned with ID are called fellows.Unlike
Component.getFellowIfAny(java.lang.String), it throws an exception if not found.
-
getFellow
public Component getFellow(java.lang.String s, boolean b) throws ComponentNotFoundException
Description copied from interface:ComponentReturns a component of the specified ID in the same ID space. It is the same as getSpaceOwner().getFellow(id, recurse);Unlike
Component.getFellowIfAny(String, boolean), it throwsComponentNotFoundExceptionif not found.- Specified by:
getFellowin interfaceComponentb- whether to look up the parent ID space for the existence of the fellow- Throws:
ComponentNotFoundException- is thrown if this component doesn't belong to any ID space
-
getFellowIfAny
public Component getFellowIfAny(java.lang.String s)
Description copied from interface:ComponentReturns a component of the specified ID in the same ID space, or null if not found.Unlike
Component.getFellow(java.lang.String), it returns null if not found.- Specified by:
getFellowIfAnyin interfaceComponent
-
getFellowIfAny
public Component getFellowIfAny(java.lang.String s, boolean b)
Description copied from interface:ComponentReturns a component of the specified ID in the same ID space, or null if not found. It is the same as getSpaceOwner().getFellowIfAny(id, recurse);Unlike
Component.getFellow(String, boolean), it returns null if not found.- Specified by:
getFellowIfAnyin interfaceComponentb- whether to look up the parent ID space for the existence of the fellow
-
getFellows
public java.util.Collection<Component> getFellows()
Description copied from interface:ComponentReturns all fellows in the same ID space of this component. Notice that only components that are assigned with ID are considered as fellows. The returned collection is read-only.- Specified by:
getFellowsin interfaceComponent
-
hasFellow
public boolean hasFellow(java.lang.String s, boolean b)Description copied from interface:ComponentReturns whether there is a fellow named with the specified component ID in the same ID space as this component. It is the same as getSpaceOwner().hasFellow(id, recurse);
-
hasFellow
public boolean hasFellow(java.lang.String s)
Description copied from interface:ComponentReturns whether a fellow exists in the same ID space of this component.
-
getNextSibling
public Component getNextSibling()
Description copied from interface:ComponentReturns the next sibling, or null if it is the last child.- Specified by:
getNextSiblingin interfaceComponent
-
getPreviousSibling
public Component getPreviousSibling()
Description copied from interface:ComponentReturns the previous sibling, or null if it is the first child.- Specified by:
getPreviousSiblingin interfaceComponent
-
getFirstChild
public Component getFirstChild()
Description copied from interface:ComponentReturns the first child component, or null if no child at all.- Specified by:
getFirstChildin interfaceComponent
-
getLastChild
public Component getLastChild()
Description copied from interface:ComponentReturns the last child component, or null if no child at all.- Specified by:
getLastChildin interfaceComponent
-
getAttributes
public java.util.Map<java.lang.String,java.lang.Object> getAttributes(int i)
Description copied from interface:ComponentReturns all custom attributes of the specified scope. You could reference them by use of componentScope, spaceScope, pageScope, requestScope and desktopScope in zscript and EL.If scope is
Component.COMPONENT_SCOPE, it means custom attributes private to this component.If scope is
Component.SPACE_SCOPE, it means custom attributes shared by components from the same ID space as this one's.If scope is
Component.PAGE_SCOPE, it means custom attributes shared by components from the same page as this one's.If scope is
Component.DESKTOP_SCOPE, it means custom attributes shared by components from the same desktops this one's.- Specified by:
getAttributesin interfaceComponent- Parameters:
i- one ofComponent.COMPONENT_SCOPE,Component.SPACE_SCOPE,Component.PAGE_SCOPE,Component.DESKTOP_SCOPE,Component.SESSION_SCOPE,Component.REQUEST_SCOPEorComponent.APPLICATION_SCOPE,
-
getAttributes
public java.util.Map<java.lang.String,java.lang.Object> getAttributes()
Description copied from interface:ComponentReturns all custom attributes associated with this component, i.e.,Component.COMPONENT_SCOPE.- Specified by:
getAttributesin interfaceComponent- Specified by:
getAttributesin interfaceScope
-
getAttribute
public java.lang.Object getAttribute(java.lang.String s, int i)Description copied from interface:ComponentReturns the value of the specified custom attribute in the specified scope, or null if not defined.If scope is
Component.COMPONENT_SCOPE, it means attributes private to this component.If scope is
Component.SPACE_SCOPE, it means custom attributes shared by components from the same ID space as this one's.If scope is
Component.PAGE_SCOPE, it means custom attributes shared by components from the same page as this one's.If scope is
Component.DESKTOP_SCOPE, it means custom attributes shared by components from the same desktop as this one's.- Specified by:
getAttributein interfaceComponenti- one ofComponent.COMPONENT_SCOPE,Component.SPACE_SCOPE,Component.PAGE_SCOPE,Component.DESKTOP_SCOPE,Component.SESSION_SCOPE,Component.REQUEST_SCOPEorComponent.APPLICATION_SCOPE,
-
getAttribute
public java.lang.Object getAttribute(java.lang.String s)
Description copied from interface:ComponentReturns the custom attribute associated with this component, i.e.,Component.COMPONENT_SCOPE.- Specified by:
getAttributein interfaceComponent- Specified by:
getAttributein interfaceScope
-
getAttribute
public java.lang.Object getAttribute(java.lang.String s, boolean b)Description copied from interface:ScopeReturns the custom attribute associated with this object.- Specified by:
getAttributein interfaceScopeb- whether to search its ancestor scope. If true and the current scope doen't define the attribute, it searches up its ancestor to see any of them has defined the specified attribute.
-
hasAttribute
public boolean hasAttribute(java.lang.String s, int i)Description copied from interface:ComponentReturns if the custom attribute is associate with this component.If scope is
Component.COMPONENT_SCOPE, it means attributes private to this component.If scope is
Component.SPACE_SCOPE, it means custom attributes shared by components from the same ID space as this one's.If scope is
Component.PAGE_SCOPE, it means custom attributes shared by components from the same page as this one's.If scope is
Component.DESKTOP_SCOPE, it means custom attributes shared by components from the same desktop as this one's.Notice that
nullis a valid value, so you can tell if an attribute is associated by examining the return value ofComponent.getAttribute(java.lang.String, int).- Specified by:
hasAttributein interfaceComponenti- one ofComponent.COMPONENT_SCOPE,Component.SPACE_SCOPE,Component.PAGE_SCOPE,Component.DESKTOP_SCOPE,Component.SESSION_SCOPE,Component.REQUEST_SCOPEorComponent.APPLICATION_SCOPE,
-
hasAttribute
public boolean hasAttribute(java.lang.String s)
Description copied from interface:ComponentReturns if the custom attribute is associate with this component.Notice that
nullis a valid value, so you can tell if an attribute is associated by examining the return value ofComponent.getAttribute(java.lang.String, int).- Specified by:
hasAttributein interfaceComponent- Specified by:
hasAttributein interfaceScope
-
hasAttribute
public boolean hasAttribute(java.lang.String s, boolean b)Description copied from interface:ScopeReturns if a custom attribute is associated with this object.Notice that
nullis a valid value, so you can tell if an attribute is associated by examining the return value ofScope.getAttribute(java.lang.String).- Specified by:
hasAttributein interfaceScopeb- whether to search its ancestor scope. If true and the current scope doen't define the attribute, it searches up its ancestor to see any of them has defined the specified attribute.
-
setAttribute
public java.lang.Object setAttribute(java.lang.String s, java.lang.Object o, int i)Description copied from interface:ComponentSets the value of the specified custom attribute in the specified scope.Note: The attribute is removed (by
Component.removeAttribute(java.lang.String, int)if value is null.If scope is
Component.COMPONENT_SCOPE, it means custom attributes private to this component.If scope is
Component.SPACE_SCOPE, it means custom attributes shared by components from the same ID space as this one's.If scope is
Component.PAGE_SCOPE, it means custom attributes shared by components from the same page as this one's.If scope is
Component.DESKTOP_SCOPE, it means custom attributes shared by components from the same desktop as this one's.- Specified by:
setAttributein interfaceComponento- the value. If null, the attribute is removed.i- one ofComponent.COMPONENT_SCOPE,Component.SPACE_SCOPE,Component.PAGE_SCOPE,Component.DESKTOP_SCOPE,Component.SESSION_SCOPE,Component.REQUEST_SCOPEorComponent.APPLICATION_SCOPE,
-
setAttribute
public java.lang.Object setAttribute(java.lang.String s, java.lang.Object o)Description copied from interface:ComponentSets the custom attribute associated with this component, i.e.,Component.COMPONENT_SCOPE.- Specified by:
setAttributein interfaceComponent- Specified by:
setAttributein interfaceScope- Returns:
- the previous value associated with the attribute, if any
-
setAttribute
public java.lang.Object setAttribute(java.lang.String s, java.lang.Object o, boolean b)Description copied from interface:ScopeSets the custom attribute associated with this scope, or the parent scope.- Specified by:
setAttributein interfaceScopeb- whether to look up the parent scope for the existence of the attribute.
If recurse is true and the attribute is defined in one of its ancestor (including page), the attribute is replaced. Otherwise, it is the same asScope.setAttribute(String,Object).
-
removeAttribute
public java.lang.Object removeAttribute(java.lang.String s, int i)Description copied from interface:ComponentRemoves the specified custom attribute in the specified scope.If scope is
Component.COMPONENT_SCOPE, it means attributes private to this component.If scope is
Component.SPACE_SCOPE, it means custom attributes shared by components from the same ID space as this one's.If scope is
Component.PAGE_SCOPE, it means custom attributes shared by components from the same page as this one's.If scope is
Component.DESKTOP_SCOPE, it means custom attributes shared by components from the same desktop as this one's.- Specified by:
removeAttributein interfaceComponenti-Component.COMPONENT_SCOPE,Component.SPACE_SCOPE,Component.PAGE_SCOPE,Component.DESKTOP_SCOPE,Component.SESSION_SCOPE,Component.REQUEST_SCOPEorComponent.APPLICATION_SCOPE,
-
removeAttribute
public java.lang.Object removeAttribute(java.lang.String s)
Description copied from interface:ComponentRemoves the custom attribute associated with this component, i.e.,Component.COMPONENT_SCOPE.- Specified by:
removeAttributein interfaceComponent- Specified by:
removeAttributein interfaceScope- Returns:
- the previous value associated with the attribute, if any,
-
removeAttribute
public java.lang.Object removeAttribute(java.lang.String s, boolean b)Description copied from interface:ScopeRemoves the custom attribute associated with this scope.- Specified by:
removeAttributein interfaceScopeb- whether to look up the parent scope for the existence of the attribute.
If recurse is true and the attribute is defined in one of its ancestor (including page), the attribute is removed. Otherwise, it is the same asScope.removeAttribute(String).
-
addScopeListener
public boolean addScopeListener(ScopeListener scopeListener)
Description copied from interface:ScopeAdds a listener to listen whether this scope is changed. The listener is called when a custom attribute is added, removed, or the parent is changed.- Specified by:
addScopeListenerin interfaceScope- Returns:
- weather the listener is added successfully. Note: if the resolver was added before, it won't be added again and this method returns false.
-
removeScopeListener
public boolean removeScopeListener(ScopeListener scopeListener)
Description copied from interface:ScopeRemoves a change listener from this scope.- Specified by:
removeScopeListenerin interfaceScope- Returns:
- false if listener is not added before.
-
getAttributeOrFellow
public java.lang.Object getAttributeOrFellow(java.lang.String s, boolean b)Description copied from interface:ComponentReturns the custom attribute associated with this component, or the fellow of this component; or null if not found.Notice that it doesn't check any variable defined in
VariableResolver(ofPage.addVariableResolver(org.zkoss.xel.VariableResolver)).- Specified by:
getAttributeOrFellowin interfaceComponentb- whether to look up the parent component for the existence of the attribute.
Notice that, if recurse is false and this component is not an ID space owner, it won't look at the fellow.
If recurse is true, it will look up all parents, page, desktop, session and application until found. If any of them is a space owner, the fellows will be searched.
-
getShadowVariable
public java.lang.Object getShadowVariable(java.lang.String s, boolean b)Description copied from interface:ComponentReturns the shadow variable associated with this component or its parent component; or null if not found.Notice that it doesn't check any variable defined in
VariableResolver(ofPage.addVariableResolver(org.zkoss.xel.VariableResolver)).- Specified by:
getShadowVariablein interfaceComponentb- whether to look up the parent component for the existence of the shadow variable.
If recurse is true, it will look up all parents until found. If any of them is a shadow host.
-
getShadowVariable
public java.lang.Object getShadowVariable(Component component, java.lang.String s, boolean b)
Description copied from interface:ComponentReturns the shadow variable enclosed with the base component, which associated with this component or its parent component; or null if not found.Notice that it doesn't check any variable defined in
VariableResolver(ofPage.addVariableResolver(org.zkoss.xel.VariableResolver)).- Specified by:
getShadowVariablein interfaceComponent- Parameters:
component- the base component to seek the variable.b- whether to look up the parent component for the existence of the shadow variable.
If recurse is true, it will look up all parents until found. If any of them is a shadow host.- See Also:
Component.getShadowVariable(String, boolean)
-
hasAttributeOrFellow
public boolean hasAttributeOrFellow(java.lang.String s, boolean b)Description copied from interface:ComponentReturns if a custom attribute is associated with this component, or the fellow of this component.Notice that it doesn't check any variable defined in
VariableResolver(ofPage.addVariableResolver(org.zkoss.xel.VariableResolver)).- Specified by:
hasAttributeOrFellowin interfaceComponentb- whether to look up the parent component for the existence of the attribute.
Notice that, if recurse is false and this component is not an ID space owner, it won't look at the fellow.
If recurse is true, it will look up all parents, page, desktop, session and application until found. If any of them is a space owner, the fellows will be searched.
-
getStubonly
public java.lang.String getStubonly()
Description copied from interface:ComponentReturns whether this component is stub-only. By stub-only, we mean we don't need to maintain the states of the component at the server side.There are three possible values: "true", "false", and "inherit", and "ignore-native".
Notice that the native components will be stub-ized, no matter this property is set. Though rarely required, you could control whether to stub-ize the native components with a component attribute called
Attributes.STUB_NATIVE.- Specified by:
getStubonlyin interfaceComponent
-
setStubonly
public void setStubonly(java.lang.String s)
Description copied from interface:ComponentSets whether this component is stub-only. By stub-only, we mean we don't need to maintain the states of the component at the server side.Default: "inherit" (i.e., the same as the parent's stub-only, and "false" is assumed if none of parents is specified with stub-only).
If a component is set to stub-only, the application running at the server shall not access it anymore after rendered to the client. The ZK loader will try to minimize the memory footprint by merging stub-only components and replacing with light-weight components.
However, the event listeners and handlers are preserved, so they will be invoked if the corresponding event is received. Since the original component is gone, the event is the more generic format: an instance of
Event(rather than MouseEvent or others).If a component is stub-only, the application usually access it only at the client since all widgets are preserved at the client (so are events).
This method is available only for ZK EE.
- Specified by:
setStubonlyin interfaceComponent- Parameters:
s- whether it is stub-only. The allowed values include "true", "false" and "inherit".
-
setStubonly
public void setStubonly(boolean b)
Description copied from interface:ComponentSets whether this component is stub-only. It is the same assetStubonly(stubonly ? "true": "false").- Specified by:
setStubonlyin interfaceComponent
-
getParent
public Component getParent()
Description copied from interface:ComponentReturns the parent component, or null if this is the root component.
-
setParent
public void setParent(Component component)
Description copied from interface:ComponentSets the parent component.Note:
Component.setParent(org.zkoss.zk.ui.Component)always calls backComponent.insertBefore(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.Component)and/orComponent.removeChild(org.zkoss.zk.ui.Component), whileComponent.insertBefore(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.Component)andComponent.removeChild(org.zkoss.zk.ui.Component)always calls backComponent.setParent(org.zkoss.zk.ui.Component), if the parent is changed. Thus, you don't need to override bothComponent.insertBefore(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.Component)andComponent.setParent(org.zkoss.zk.ui.Component), if you want to customize the behavior.
-
getChildren
public <T extends Component> java.util.List<T> getChildren()
Description copied from interface:ComponentReturns a live list of children. By live we mean the developer could add or remove a child by manipulating the returned list directly.- Specified by:
getChildrenin interfaceComponent
-
getRoot
public Component getRoot()
Description copied from interface:ComponentReturns the root of this component.
-
isVisible
public boolean isVisible()
Description copied from interface:ComponentReturns whether this component is visible.- Specified by:
isVisiblein interfaceComponent- See Also:
Components.isRealVisible(org.zkoss.zk.ui.Component),Component.setVisible(boolean)
-
setVisible
public boolean setVisible(boolean b)
Description copied from interface:ComponentSets whether this component is visible. A component is visible by default. Both visible and invisible components are rendered in a browser's DOM. But an invisible component's DOM elements with CSSdisplay:none. Since a DOM element will inherit its parent's CSS rules, a component is visible only if all of its parents are also visible.
To remove a component's DOM elements, useComponent.detach().- Specified by:
setVisiblein interfaceComponent- Returns:
- the previous visibility
-
insertBefore
public boolean insertBefore(Component component, Component component1)
Description copied from interface:ComponentInserts a child before the reference child.You could use
Component.setParent(org.zkoss.zk.ui.Component)orComponent.appendChild(org.zkoss.zk.ui.Component)instead of this method, unless you want to control where to put the child.Note:
Component.setParent(org.zkoss.zk.ui.Component)always calls backComponent.insertBefore(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.Component)and/orComponent.removeChild(org.zkoss.zk.ui.Component), whileComponent.insertBefore(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.Component)andComponent.removeChild(org.zkoss.zk.ui.Component)always calls backComponent.setParent(org.zkoss.zk.ui.Component), if the parent is changed. Thus, you don't need to override bothComponent.insertBefore(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.Component)andComponent.setParent(org.zkoss.zk.ui.Component), if you want to customize the behavior.If you would like to monitor if a component is attached or detached from a page, you could register a desktop listener implementing
UiLifeCycle.- Specified by:
insertBeforein interfaceComponent- Parameters:
component- the new child to be inserted.component1- the child before which you want the new child being inserted. If null, the new child is append to the end.- Returns:
- true if newChild is added successfully or moved; false if it already has the specified child and the order doesn't change.
-
appendChild
public boolean appendChild(Component component)
Description copied from interface:ComponentAppends a child. A shortcut to insertBefore(child, null).- Specified by:
appendChildin interfaceComponent- See Also:
Component.insertBefore(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.Component)
-
removeChild
public boolean removeChild(Component component)
Description copied from interface:ComponentRemoves a child. The child is not actually removed. Rather, it is detached (seeComponent.detach()) and it will be removed if it is no longer used.You could use
Component.setParent(org.zkoss.zk.ui.Component)with null instead of this method.Note:
Component.setParent(org.zkoss.zk.ui.Component)always calls backComponent.insertBefore(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.Component)and/orComponent.removeChild(org.zkoss.zk.ui.Component), whileComponent.insertBefore(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.Component)andComponent.removeChild(org.zkoss.zk.ui.Component)always calls backComponent.setParent(org.zkoss.zk.ui.Component), if the parent is changed. Thus, you don't need to override bothComponent.insertBefore(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.Component)andComponent.setParent(org.zkoss.zk.ui.Component), if you want to customize the behavior.If you would like to monitor if a component is attached or detached from a page, you could register a desktop listener implementing
UiLifeCycle.- Specified by:
removeChildin interfaceComponent- Returns:
- true if child is removed successfully; false if it doesn't have the specified child
-
detach
public void detach()
Description copied from interface:ComponentDetaches this component such that it won't belong to any page. If you don't callComponent.setParent(org.zkoss.zk.ui.Component)orComponent.setPage(org.zkoss.zk.ui.Page)to attach it to any page, it will be removed automatically (from the client) after the current event is processed.
-
getMold
public java.lang.String getMold()
Description copied from interface:ComponentReturns the mold used to render this component.Default: "default"
Since 5.0, the default can be overridden by specify a library property. For example, if the component's class name is org.zkoss.zul.Button, then you can override the default mold by specifying the property called "org.zkoss.zul.Button.mold" with the mold you want in zk.xml. For example,
<library-property> <name>org.zkoss.zul.Button.mold</name> <value>trendy</value> </library-property>Notice that it doesn't affect the deriving classes. If you want to change the deriving class's default mold, you have to specify them explicitly, too.
- Specified by:
getMoldin interfaceComponent- See Also:
ComponentDefinition
-
setMold
public void setMold(java.lang.String s)
Description copied from interface:ComponentSets the mold to render this component.- Specified by:
setMoldin interfaceComponent- Parameters:
s- the mold. If null or empty, "default" is assumed.- See Also:
ComponentDefinition
-
addEventListener
public boolean addEventListener(int i, java.lang.String s, EventListener<? extends Event> eventListener)Description copied from interface:ComponentAdds an event listener to specified event name for this component with the given priority.You could register listener to all components in the same page by use of
Page.addEventListener(java.lang.String, org.zkoss.zk.ui.event.EventListener<? extends org.zkoss.zk.ui.event.Event>).Version Difference
ZK 5.0 and earlier, the second registration is ignored if an event listener has been registered twice. However, since 6.0.0 and later, it won't be ignored. If a listener has been registered multiple times, it will be invoked multiple times.
If you prefer to ignore the second registration, you could specify a library property called "org.zkoss.zk.ui.EventListener.duplicateIgnored" to true.
- Specified by:
addEventListenerin interfaceComponent- Parameters:
i- the priority of the event. The higher the priority is, the earlier it is invoked.
Notice:- If the priority equals or is greater than 1000, the event listener will be invoked before the event handlers registered in a ZUML page (i.e., the onXxx attribute declared in ZUML). On the other hand, if the priority is lower than 1000, it is invoked after the ZUML's event handler.
- The priority registered by
Component.addEventListener(String, EventListener)is 0. - Applications shall not use the priority higher than 10,000 and lower than -10,000 since they are reserved for component development.
s- what event to listen (never null)- Returns:
- whether the listener is added successfully
- See Also:
Page.addEventListener(java.lang.String, org.zkoss.zk.ui.event.EventListener<? extends org.zkoss.zk.ui.event.Event>)
-
addEventListener
public boolean addEventListener(java.lang.String s, EventListener<? extends Event> eventListener)Description copied from interface:ComponentAdds an event listener to specified event name for this component. The second registration is ignored and false is returned. The priority is assumed to 0.You could register listener to all components in the same page by use of
Page.addEventListener(java.lang.String, org.zkoss.zk.ui.event.EventListener<? extends org.zkoss.zk.ui.event.Event>).Version Difference
ZK 5.0 and earlier, the second registration is ignored if an event listener has been registered twice. However, since 6.0.0 and later, it won't be ignored. If a listener has been registered multiple times, it will be invoked multiple times.
If you prefer to ignore the second registration, you could specify a library property called "org.zkoss.zk.ui.EventListener.duplicateIgnored" to true.
- Specified by:
addEventListenerin interfaceComponent- Parameters:
s- what event to listen (never null)- Returns:
- whether the listener is added successfully
- See Also:
Page.addEventListener(java.lang.String, org.zkoss.zk.ui.event.EventListener<? extends org.zkoss.zk.ui.event.Event>)
-
removeEventListener
public boolean removeEventListener(java.lang.String s, EventListener<? extends Event> eventListener)Description copied from interface:ComponentRemoves an event listener.- Specified by:
removeEventListenerin interfaceComponent- Returns:
- whether the listener is removed; false if it was never added.
-
isListenerAvailable
public boolean isListenerAvailable(java.lang.String s, boolean b)Description copied from interface:ComponentReturns whether the event listener is available.Unlike
Events.isListened(org.zkoss.zk.ui.Component, java.lang.String, boolean), this method checks only the event listener registered byComponent.addEventListener(int, java.lang.String, org.zkoss.zk.ui.event.EventListener<? extends org.zkoss.zk.ui.event.Event>).- Specified by:
isListenerAvailablein interfaceComponentb- whether to check only non-deferrable listener, i.e., not implementingDeferrable, orDeferrable.isDeferrable()is false.- See Also:
Deferrable,Events.isListened(org.zkoss.zk.ui.Component, java.lang.String, boolean),Component.addEventListener(int, java.lang.String, org.zkoss.zk.ui.event.EventListener<? extends org.zkoss.zk.ui.event.Event>)
-
getListenerIterator
public java.util.Iterator<EventListener<? extends Event>> getListenerIterator(java.lang.String s)
-
getEventListeners
public java.lang.Iterable<EventListener<? extends Event>> getEventListeners(java.lang.String s)
Description copied from interface:ComponentReturns an iterable collection of the event listeners for the given event.Note: it is OK to invoke
Component.addEventListener(int, java.lang.String, org.zkoss.zk.ui.event.EventListener<? extends org.zkoss.zk.ui.event.Event>)orComponent.removeEventListener(java.lang.String, org.zkoss.zk.ui.event.EventListener<? extends org.zkoss.zk.ui.event.Event>)when iterating through the event listeners with the returned collection.To remove an event listener from the returned iterable collection, you could invoke
Iterable.iterator()'sIterator.remove().- Specified by:
getEventListenersin interfaceComponent
-
addForward
public boolean addForward(java.lang.String s, Component component, java.lang.String s1)Description copied from interface:ComponentAdds a forward condition to forward the event received by this component to another component.Default: no forward condition at all.
Once the condition is added, a event called
targetEventis posted to thetargetcomponent, when this component receives theorginalEventevent.- Specified by:
addForwardin interfaceComponent- Parameters:
s- the original event that was received by this component. If null, "onClick" is assumed.component- the target component to receive the event. If null, the space ownerComponent.getSpaceOwner()is assumed. If null and the space owner is the page, the root component is assumed.s1- the target event that the target component will receive. If null, it is the same as the original event.- Returns:
- whether it is added successfully. It returns false if the condition was always added before.
- See Also:
Component.removeForward(String, Component, String),Component.addForward(String, Component, String, Object)
-
addForward
public boolean addForward(java.lang.String s, java.lang.String s1, java.lang.String s2)Description copied from interface:ComponentAdds a forward condition to forward the event received by this component to another component, specified with a path.Note: the target component is retrieved from the path, each time the event is received. Thus, you can reference to a component that is created later.
- Specified by:
addForwardin interfaceComponent- Parameters:
s- the original event that was received by this component. If null, "onClick" is assumed.s1- the target component's path related to this component. If ".", this component is assumed. If null, the space owner is assumed. If null and the space owner is the page, the root component is assumed.s2- the target event that the target component will receive. If null, it is the same as the original event.- Returns:
- whether it is added successfully. It returns false if the condition was always added before.
- See Also:
Component.addForward(String, Component, String),Component.removeForward(String, String, String)
-
addForward
public boolean addForward(java.lang.String s, Component component, java.lang.String s1, java.lang.Object o)Description copied from interface:ComponentAdds a forward condition to forward the event received by this component to another component with extra event data.- Specified by:
addForwardin interfaceComponento- the extra data that can be retrieve byEvent.getData().- See Also:
Component.addForward(String, Component, String)
-
addForward
public boolean addForward(java.lang.String s, java.lang.String s1, java.lang.String s2, java.lang.Object o)Description copied from interface:ComponentAdds a forward condition to forward the event received by this component to another component of the specified path with extra event data.- Specified by:
addForwardin interfaceComponento- the extra data that can be retrieve byEvent.getData().- See Also:
Component.addForward(String, String, String)
-
removeForward
public boolean removeForward(java.lang.String s, Component component, java.lang.String s1)Description copied from interface:ComponentRemoves a forward condition that was added byComponent.addForward(String, Component, String). If no such forward condition exists, nothing happens but return false.- Specified by:
removeForwardin interfaceComponent- Parameters:
s- the original event that was received by this component. It must be the same as the one passed toComponent.addForward(String, Component, String).component- the target component to receive the event. It must be the same as the one passed toComponent.addForward(String, Component, String).s1- the target event that the target component will receive. It must be the same as the one passed toComponent.addForward(String, Component, String).- Returns:
- whether the forward is removed successfully. It returns false if the forward condition is not found
- See Also:
Component.addForward(String, Component, String)
-
removeForward
public boolean removeForward(java.lang.String s, java.lang.String s1, java.lang.String s2)Description copied from interface:ComponentRemoves a forward condition that was added byComponent.addForward(String, String, String). If no such forward condition exists, nothing happens but return false.- Specified by:
removeForwardin interfaceComponent- Parameters:
s- the original event that was received by this component. It must be the same as the one passed toComponent.addForward(String, Component, String).s1- the target component's path related to this component. If ".", this component is assumed. If null, the space owner is assumed. If null and the space owner is the page, the root component is assumed.s2- the target event that the target component will receive. It must be the same as the one passed toComponent.addForward(String, Component, String).- Returns:
- whether the forward is removed successfully. It returns false if the forward condition is not found
- See Also:
Component.addForward(String, String, String)
-
isInvalidated
public boolean isInvalidated()
Description copied from interface:ComponentReturns if this component needs to be redrawn at the client.Application developers rarely need to call this method.
Note:
- It always returns true if it doesn't belong to any page (since redraw is required if it is attached to a page later).
- It always returns true if the current execution is not an asynchronous update (so redrawn is always required).
- If its parent is invalidated, this component will be redrawn
too, but this method returns false if
Component.invalidate()was not called against this component.
- Specified by:
isInvalidatedin interfaceComponent
-
invalidate
public void invalidate()
Description copied from interface:ComponentInvalidates this component by setting the dirty flag such that it will be redraw the whole content of this component and its dependencies later. And, the widget associated with this component and all its descendant at the client will be deleted and recreated, too.If the application is totally controlled by the server side (i.e., you don't write client codes), you rarely need to access this method.
It can be called only in the request-processing and event-processing phases. However, it is NOT allowed in the rendering phase.
- Specified by:
invalidatein interfaceComponent
-
applyProperties
public void applyProperties()
Description copied from interface:ComponentInitializes the properties (a.k.a. members) based on what are defined in the component definition.This method is invoked automatically if a component is created by evaluating a ZUML page, i.e., if it is specified as an element of a ZUML page.
On the other hand, if it is created manually (by program), developer might choose to invoke this method or not, depending whether he wants to initializes the component with the properties defined in the ZUML page (
PageDefinition) and the language definition (LanguageDefinition).Notice that, since 5.0.7, custom-attributes are applied automatically in the constructor of
AbstractComponent, so they are always available no matter this method is called or not.- Specified by:
applyPropertiesin interfaceComponent
-
setWidgetListener
public java.lang.String setWidgetListener(java.lang.String s, java.lang.String s1)Description copied from interface:ComponentSets or removes an event listener of the peer widget. If there is an event listener associated with the same event, the previous one will be replaced and returned.- Specified by:
setWidgetListenerin interfaceComponent- Parameters:
s- the event name, such as onClicks1- the script to handle the event. If null, the event handler is removed.- Returns:
- the previous script if any
-
getWidgetListener
public java.lang.String getWidgetListener(java.lang.String s)
Description copied from interface:ComponentReturns the script of the client event, or null if not found.- Specified by:
getWidgetListenerin interfaceComponent
-
getWidgetListenerNames
public java.util.Set<java.lang.String> getWidgetListenerNames()
Description copied from interface:ComponentReturns a read-only collection of event names (String) that the listener of the peer widget are assigned, or an empty collection if none is registered.- Specified by:
getWidgetListenerNamesin interfaceComponent
-
setWidgetOverride
public java.lang.String setWidgetOverride(java.lang.String s, java.lang.String s1)Description copied from interface:ComponentSets or removes a method or a property of the peer widget (at the client). If there is a method or a property associated with the same name, the previous one will be replaced and returned.For example,
comp.setWidgetOverride("setValue", "function (value) {}"); //override a method comp.setWidgetOverride("myfield", "new Date()"); //override a propertyIf there is no previous method or property, the method/property will be assigned directly.
Notice that, unlike
Component.setWidgetListener(java.lang.String, java.lang.String), if the method has been sent to the client for update, it cannot be removed by calling this method with a null value. In other words, invoking this method with a null value only removes the method overrides if it has not YET been to sent to the client.The previous method/property can be accessed by this.$xxx. For example
function (value, fromServer) { this.$setValue(value, fromServer); if (this.desktop) { this._cnt = !this._cnt; this.setStyle('background:'+(this._cnt ? 'red':'green')); } }Notice that, since it is not extending, so this.$super references the superclass's method, rather than the old method.
- Specified by:
setWidgetOverridein interfaceComponent- Parameters:
s- the property name to override, such assetValueandmiles.s1- the method definition, such asfunction (arg) {...}, or a value, such as123andnew Date(). If not null, this method will be added to the peer widget. If there was a method with the same name, it will be renamed to$nameso can you call it back.
If null, the previous method, if any, will be restored.<label w:setValue="function (value) { this.$setValue(value); //old method }"/>- Returns:
- the previous script if any
-
getWidgetOverride
public java.lang.String getWidgetOverride(java.lang.String s)
Description copied from interface:ComponentReturns the script of the method definition to override widget's method, or null if not found.- Specified by:
getWidgetOverridein interfaceComponent
-
getWidgetOverrideNames
public java.util.Set<java.lang.String> getWidgetOverrideNames()
Description copied from interface:ComponentReturns a read-only collection of the property names (String) that shall be overridden, or an empty collection if none is registered.- Specified by:
getWidgetOverrideNamesin interfaceComponent
-
setWidgetAttribute
public java.lang.String setWidgetAttribute(java.lang.String s, java.lang.String s1)
-
getWidgetAttribute
public java.lang.String getWidgetAttribute(java.lang.String s)
-
setClientAttribute
public java.lang.String setClientAttribute(java.lang.String s, java.lang.String s1)Description copied from interface:ComponentSets or removes a DOM attribute of the peer widget (at the client). ZK pass the attributes directly to the DOM attribute generated at the client.Notice that
Component.setWidgetOverride(java.lang.String, java.lang.String)orComponent.setWidgetListener(java.lang.String, java.lang.String)are used to customize the peer widget, whileComponent.setClientAttribute(String, String)customizes the DOM element of the peer widget directly.Unlike
Component.setWidgetOverride(java.lang.String, java.lang.String)orComponent.setWidgetListener(java.lang.String, java.lang.String),Component.setClientAttribute(java.lang.String, java.lang.String)has no effect if the widget has been generated at the client, unlessComponent.invalidate()is called.- Specified by:
setClientAttributein interfaceComponent- Parameters:
s- the attribute name to generate to the DOM element, such asonload. UnlikeComponent.setWidgetOverride(java.lang.String, java.lang.String), the name might contain no alphanumeric characters, such as colon and dash.s1- the value of the attribute. It could be anything depending on the attribute. If null, the attribute will be removed. Make sure to specify an empty string if you want an attribute with an empty value.- Returns:
- the previous value if any
-
getClientAttribute
public java.lang.String getClientAttribute(java.lang.String s)
Description copied from interface:ComponentReturns the value of a DOM attribute- Specified by:
getClientAttributein interfaceComponent
-
setClientDataAttribute
public java.lang.String setClientDataAttribute(java.lang.String s, java.lang.String s1)Description copied from interface:ComponentSets a DOM data attribute of the peer widget (at the client). If it has previous value, the component will invalidate. ZK pass the attributes directly to the DOM attribute generated at the client.Notice that the parameter - name would be expanded by adding the prefix "data-" automatically.
- Specified by:
setClientDataAttributein interfaceComponent- Parameters:
s- the attribute name to generate to the DOM element, such asmask.s1- the value of the attribute. It could be anything depending on the attribute. If null, the attribute will be removed. Make sure to specify an empty string if you want an attribute with an empty value.- Returns:
- the previous value if any
- See Also:
Component.setClientDataAttribute(String, String)
-
getClientDataAttribute
public java.lang.String getClientDataAttribute(java.lang.String s)
Description copied from interface:ComponentReturns the value of a DOM data attributeNotice that the parameter - name would be expanded by adding the prefix "data-" automatically.
- Specified by:
getClientDataAttributein interfaceComponent- See Also:
Component.getClientDataAttribute(String)
-
getWidgetAttributeNames
public java.util.Set<java.lang.String> getWidgetAttributeNames()
Description copied from interface:ComponentReturns a read-only collection of additions DOM attributes that shall be generated. That is, they are the attributes added byComponent.setClientAttribute(java.lang.String, java.lang.String).- Specified by:
getWidgetAttributeNamesin interfaceComponent
-
getTemplate
public Template getTemplate(java.lang.String s)
Description copied from interface:ComponentReturns the template of the given name, or null if not available.- Specified by:
getTemplatein interfaceComponent- See Also:
Component.setTemplate(java.lang.String, org.zkoss.zk.ui.util.Template)
-
setTemplate
public Template setTemplate(java.lang.String s, Template template)
Description copied from interface:ComponentSets a UI template which could be retrieved later withComponent.getTemplate(java.lang.String).- Specified by:
setTemplatein interfaceComponent- Parameters:
s- the template's name. It cannot be empty or null.template- the template to assign. If it is null, the previous template, if any, will be removed- Returns:
- the previous template, if any
-
getTemplateNames
public java.util.Set<java.lang.String> getTemplateNames()
Description copied from interface:ComponentReturns a readonly set of the names of all templates.- Specified by:
getTemplateNamesin interfaceComponent
-
setAuService
public void setAuService(AuService auService)
Description copied from interface:ComponentSets an AU service to process the AU request before the component's default handling. This method is used if you want to send some custom request from client (by your application).Default: null.
If you want to provide an AU service for the AU requests targeting the desktop. Use
Desktop.addListener(java.lang.Object).See also How to process AU requests with JSON.
- Specified by:
setAuServicein interfaceComponent
-
getAuService
public AuService getAuService()
Description copied from interface:ComponentReturns an AU service to process the AU request before the component's default handling.Default: null
- Specified by:
getAuServicein interfaceComponent
-
getAutag
public java.lang.String getAutag()
Description copied from interface:ComponentReturns the AU tag for this widget. The AU tag tag is used to tag the AU requests sent by the peer widget. For instance, if the AU tag isxxx,yyyand the desktop's request path (Desktop.getRequestPath()) is/foo.zul, then the URL of the AU request will contain/_/foo.zul/xxx,yyy,.Default: null (no AU tag for this widget).
- Specified by:
getAutagin interfaceComponent- See Also:
Component.setAutag(java.lang.String)
-
setAutag
public void setAutag(java.lang.String s)
Description copied from interface:ComponentSets the AU tag for this widget. The AU tag tag is used to tag the AU requests sent by the peer widget.- Specified by:
setAutagin interfaceComponent- Parameters:
s- the AU tag. Both an empty string and null are considered as null, i.e., no AU tag for this widget.- See Also:
Component.getAutag()
-
clone
public java.lang.Object clone()
Description copied from interface:ComponentClones the component. All of its children and descendants are cloned. Also, ID are preserved.
-
query
public Component query(java.lang.String s)
Description copied from interface:ComponentFind the first component that matches the given CSS3 selector.- Specified by:
queryin interfaceComponent- Parameters:
s- the CSS3 selector. For example, comp.query("#id div").- Returns:
- the first matched component, or null if not found
- See Also:
Component.queryAll(java.lang.String)
-
queryAll
public java.lang.Iterable<Component> queryAll(java.lang.String s)
Description copied from interface:ComponentReturns an iterable object for components that match the given CSS3 selector.Notice: this method traverses the whole component tree, only if you iterate through the whole iterable object. In other words, the performance is good, and you can iterate it find the object that matches your criteria.
- Specified by:
queryAllin interfaceComponent- Parameters:
s- the CSS3 selector. For example, comp.queryAll("#id div").- Returns:
- a list of all matched component, or an empty list if none is found.
- See Also:
Component.query(java.lang.String)
-
setDefinition
public void setDefinition(ComponentDefinition compdef)
Description copied from interface:ComponentCtrlSets the component definition.The component definition affects how a component behaves. Developers rarely need to call this method. If a wrong definition is assigned, the result is unpredictable (and hard to debug). It is mainly designed for developing tools.
- Specified by:
setDefinitionin interfaceComponentCtrl
-
setDefinition
public void setDefinition(java.lang.String defname)
Description copied from interface:ComponentCtrlSets the component definition by specifying the name.- Specified by:
setDefinitionin interfaceComponentCtrl- Parameters:
defname- the name of the component definition
-
beforeChildAdded
public void beforeChildAdded(Component child, Component insertBefore)
Description copied from interface:ComponentCtrlCalled before adding a child. If a component accepts only certain types of children, it shall override this method and throw an exception for an illegal child.- Specified by:
beforeChildAddedin interfaceComponentCtrl- Parameters:
child- the child to be added (never null).insertBefore- another child component that the new child will be inserted before it. If null, the new child will be the last child.
-
beforeChildRemoved
public void beforeChildRemoved(Component child)
Description copied from interface:ComponentCtrlCalled before removing a child. If a component denies a certain child to be removed, it shall override this method to avoid it.- Specified by:
beforeChildRemovedin interfaceComponentCtrl- Parameters:
child- the child to be removed (never null)
-
beforeParentChanged
public void beforeParentChanged(Component parent)
Description copied from interface:ComponentCtrlCalled before changing the parent. If a component can be a child of certain parents, it shall override this method and throws an exception for an illegal parent.- Specified by:
beforeParentChangedin interfaceComponentCtrl- Parameters:
parent- the new parent. If null, it means detachment.
-
onParentChanged
public void onParentChanged(Component parent)
Description copied from interface:ComponentCtrlCalled after the parent changed. Usually,ComponentCtrl.onPageDetached(Page)andComponentCtrl.onPageAttached(Page, Page)cover all the cases, unless its page is not changed.- Specified by:
onParentChangedin interfaceComponentCtrl- Parameters:
parent- the new parent. If null, it means detachment.
-
onChildAdded
public void onChildAdded(Component child)
Description copied from interface:ComponentCtrlCalled when a child is added. If a component want to optimize the update, it might do something different. Otherwise, it does nothing.Note:
ComponentCtrl.onChildAdded(org.zkoss.zk.ui.Component)is called in the request-processing phase.It is not a good idea to throw an exception in this method, since it is in the middle of modifying the component tree.
- Specified by:
onChildAddedin interfaceComponentCtrl
-
onChildRemoved
public void onChildRemoved(Component child)
Description copied from interface:ComponentCtrlCalled when a child is removed. If a component want to optimize the update, it might do something different. Otherwise, it simply does nothing.It is not a good idea to throw an exception in this method, since it is in the middle of modifying the component tree.
- Specified by:
onChildRemovedin interfaceComponentCtrl
-
onPageAttached
public void onPageAttached(Page newpage, Page oldpage)
Description copied from interface:ComponentCtrlCalled when this component is attached to a page.If a component is moved from one page to another,
ComponentCtrl.onPageAttached(org.zkoss.zk.ui.Page, org.zkoss.zk.ui.Page)is called with both pages. Note:ComponentCtrl.onPageDetached(org.zkoss.zk.ui.Page)is not called in this case.Note: this method is called even if the component is attached to a page implicitly thru, say,
Component.setParent(org.zkoss.zk.ui.Component).It is not a good idea to throw an exception in this method, since it is in the middle of modifying the component tree.
- Specified by:
onPageAttachedin interfaceComponentCtrl- Parameters:
newpage- the new page (never null).oldpage- the previous page, if any, or null if it didn't belong to any page.
-
onPageDetached
public void onPageDetached(Page page)
Description copied from interface:ComponentCtrlCalled when this component is detached from a page.If a component is moved from one page to another,
ComponentCtrl.onPageAttached(org.zkoss.zk.ui.Page, org.zkoss.zk.ui.Page)is called with both pages. Note:ComponentCtrl.onPageDetached(org.zkoss.zk.ui.Page)is not called in this case. In other words,ComponentCtrl.onPageDetached(org.zkoss.zk.ui.Page)is called only if a component is detached from a page (not belong to any other page).Note: this method is called even if the component is detached to a page implicitly thru, say,
Component.setParent(org.zkoss.zk.ui.Component).It is not a good idea to throw an exception in this method, since it is in the middle of modifying the component tree.
- Specified by:
onPageDetachedin interfaceComponentCtrl- Parameters:
page- the previous page (never null)
-
getEventHandler
public ZScript getEventHandler(java.lang.String evtnm)
Description copied from interface:ComponentCtrlReturns the event listener of the specified name, or null if not found.- Specified by:
getEventHandlerin interfaceComponentCtrl- See Also:
Component.getWidgetListener(java.lang.String)
-
addEventHandler
public void addEventHandler(java.lang.String name, EventHandler evthd)Description copied from interface:ComponentCtrlAdds an event handler. Note: it is OK to add multiple event handlers to the same event. They are evaluated one-by-one. On the other hand,Component.setWidgetListener(java.lang.String, java.lang.String)will overwrite the previous listener if the event name is the same.- Specified by:
addEventHandlerin interfaceComponentCtrl- See Also:
Component.setWidgetListener(java.lang.String, java.lang.String)
-
addSharedEventHandlerMap
public void addSharedEventHandlerMap(EventHandlerMap evthds)
Description copied from interface:ComponentCtrlAdds a map of event handlers which is shared by other components. In other words, this component shall have all event handlers defined in the specified map, evthds. Meanwhile, this component shall not modify evthds, since it is shared. The caller shall not change annots after the invocation, too- Specified by:
addSharedEventHandlerMapin interfaceComponentCtrl- Parameters:
evthds- a map of event handler- See Also:
Component.setWidgetListener(java.lang.String, java.lang.String)
-
getEventHandlerNames
public java.util.Set<java.lang.String> getEventHandlerNames()
Description copied from interface:ComponentCtrlReturns a readonly collection of event names (String), or an empty collection if no event name is registered.- Specified by:
getEventHandlerNamesin interfaceComponentCtrl- See Also:
Component.getWidgetListenerNames()
-
getClientEvents
public java.util.Map<java.lang.String,java.lang.Integer> getClientEvents()
Description copied from interface:ComponentCtrlReturns a map of event information that the client might send to this component. The key of the returned map is a String instance representing the event name, and the value an integer representing the flags (a combination ofComponentCtrl.CE_IMPORTANT,ComponentCtrl.CE_BUSY_IGNORE,ComponentCtrl.CE_DUPLICATE_IGNOREandComponentCtrl.CE_REPEAT_IGNORE).Default: return the collection of events added by
ComponentCtrl.getClientEvents().- Specified by:
getClientEventsin interfaceComponentCtrl
-
getAnnotation
public Annotation getAnnotation(java.lang.String annotName)
-
getAnnotation
public Annotation getAnnotation(java.lang.String propName, java.lang.String annotName)
Description copied from interface:ComponentCtrlReturns the annotation associated with the definition of the specified property, or null if not available.If there are multiple annotation with the given name, this method will merge them before return. If you prefer to get all of them without merging, please use
ComponentCtrl.getAnnotations(String, String)instead. For example,<textbox value="@bind(abc, param1=foo1) @bind(xyz, param2=foo2)">This method will return a single annotation with three attributes: value=xyz, param1=foo1 and param2=foo2. On the other hand,
ComponentCtrl.getAnnotations(String, String)will return a two-element collections.Notice that the property is
not limited the 'real' property. For example, the following statement is correct thoughbuttondoesn't havesetFoomethod. And, you can retrieve it by use of this method (getAnnotation("foo", "bind"))<button foo="@bind(whatever=123)"/>Furthermore, you can declare it as
custom-attribute. For example, the following is equivalent to the above.<button> <custom-attribute foo="@bind(whatever=123}"> </button>- Specified by:
getAnnotationin interfaceComponentCtrl- Parameters:
propName- the property name, e.g., "value". If null, this method returns the annotation(s) associated with this component (rather than a particular property).annotName- the annotation name- See Also:
ComponentCtrl.getAnnotations(String, String)
-
getAnnotations
public java.util.Collection<Annotation> getAnnotations(java.lang.String propName, java.lang.String annotName)
Description copied from interface:ComponentCtrlReturns the annotations associated with the definition of the specified property. It never returns null.Notice that the property is
not limited the 'real' property. For example, the following statement is correct thoughbuttondoesn't havesetFoomethod. And, you can retrieve it by use of this method (getAnnotation("foo", "bind"))<button foo="@bind(whatever=123)"/>Furthermore, you can declare it as
custom-attribute. For example, the following is equivalent to the above.<button> <custom-attribute foo="@bind(whatever=123}"> </button>- Specified by:
getAnnotationsin interfaceComponentCtrl- Parameters:
propName- the property name, e.g., "value". If null, this method returns the annotation(s) associated with this component (rather than a particular property).annotName- the annotation name- See Also:
ComponentCtrl.getAnnotation(String, String)
-
getAnnotations
public java.util.Collection<Annotation> getAnnotations()
-
getAnnotations
public java.util.Collection<Annotation> getAnnotations(java.lang.String propName)
Description copied from interface:ComponentCtrlReturns a read-only collection of all annotations (Annotation) associated with the specified property. It never returns null.- Specified by:
getAnnotationsin interfaceComponentCtrl- Parameters:
propName- the property name, e.g., "value". If null, this method returns the annotation(s) associated with this component (rather than a particular property).
-
getAnnotatedPropertiesBy
public java.util.List<java.lang.String> getAnnotatedPropertiesBy(java.lang.String annotName)
Description copied from interface:ComponentCtrlReturns a read-only list of the names of the properties that are associated with the specified annotation (never null).- Specified by:
getAnnotatedPropertiesByin interfaceComponentCtrl
-
getAnnotatedProperties
public java.util.List<java.lang.String> getAnnotatedProperties()
Description copied from interface:ComponentCtrlReturns a read-only list of the name of properties that are associated at least one annotation (never null).- Specified by:
getAnnotatedPropertiesin interfaceComponentCtrl
-
addAnnotation
public void addAnnotation(java.lang.String annotName, java.util.Map<java.lang.String,java.lang.String[]> annotAttrs)
-
addAnnotation
public void addAnnotation(java.lang.String propName, java.lang.String annotName, java.util.Map<java.lang.String,java.lang.String[]> annotAttrs)Description copied from interface:ComponentCtrlAdds an annotation to the specified property of this component.If the given property is null, the annotation is associated to this component, rather than a particular property.
Unlike Java, you can add annotations dynamically, and each component has its own annotations.
- Specified by:
addAnnotationin interfaceComponentCtrl- Parameters:
propName- the property name. If null, the annotation is associated with the component (rather than a particular property).annotName- the annotation name (never null, nor empty).annotAttrs- a map of attributes, or null if no attribute at all. This method will make a copy ofannotAttrs, so the caller can use it after the invocation.
-
sessionWillPassivate
public void sessionWillPassivate(Page page)
Description copied from interface:ComponentCtrlNotification that the session, which owns this component, is about to be passivated (a.k.a., serialized).Note: only root components are notified by this method.
- Specified by:
sessionWillPassivatein interfaceComponentCtrl
-
sessionDidActivate
public void sessionDidActivate(Page page)
Description copied from interface:ComponentCtrlNotification that the session, which owns this component, has just been activated (a.k.a., deserialized).Note: only root components are notified by this method.
- Specified by:
sessionDidActivatein interfaceComponentCtrl
-
getExtraCtrl
public java.lang.Object getExtraCtrl()
Description copied from interface:ComponentCtrlReturns the extra controls that tell ZK how to handle this component specially.Application developers need NOT to access this method.
There are a set of extra controls: org.zkoss.zk.ui.ext.render.
The first package is used if the content of a component can be changed by the user at the client. It is so-called the client controls.
The second package is used to control how to render a component specially.
Override this method only if you want to return the extra controls.
- Specified by:
getExtraCtrlin interfaceComponentCtrl- Returns:
- null if no special handling required. If the component
requires some special controls, it could return an object that
implements one or several interfaces in the org.zkoss.zk.ui.ext.render
package.
For example,
Cropper.
-
getPropertyAccess
public PropertyAccess getPropertyAccess(java.lang.String prop)
Description copied from interface:ComponentCtrlReturns the corresponding property access object from the given property name, if any.- Specified by:
getPropertyAccessin interfaceComponentCtrl- Parameters:
prop- the name of the property- Returns:
- null it means not to support for the property name.
-
onWrongValue
public WrongValueException onWrongValue(WrongValueException ex)
Description copied from interface:ComponentCtrlNotifies that anWrongValueExceptioninstance is thrown, andWrongValueException.getComponent()is the component causing the exception. It is a callback and the component can store the error message, show up the custom information, or even 'eat' the exception.- Specified by:
onWrongValuein interfaceComponentCtrl- Parameters:
ex- the exception being thrown (never null)- Returns:
- the exception to throw, or null to ignore the exception In most cases, just return ex
-
redraw
public void redraw(java.io.Writer out) throws java.io.IOExceptionDescription copied from interface:ComponentCtrlRender (a.k.a., redraw) this component and all its descendants.It is called in the redrawing phase by the kernel, so it is too late to call
Component.invalidate(),AbstractComponent.smartUpdate(java.lang.String, java.lang.Object)orAbstractComponent.response(org.zkoss.zk.au.AuResponse)in this method.- Specified by:
redrawin interfaceComponentCtrl- Throws:
java.io.IOException
-
service
public void service(AuRequest request, boolean everError)
Description copied from interface:ComponentCtrlHandles an AU request.Notice: don't invoke this method directly. Rather, invoke
DesktopCtrl.service(AuRequest, boolean)instead. This method is designed to be overridden.To send responses to the client, use
AbstractComponent.smartUpdate(java.lang.String, java.lang.Object),AbstractComponent.response(org.zkoss.zk.au.AuResponse)orComponent.invalidate(). To handle the AU requests sent from the client, override this method.Application developer can plug the custom service to handle the AU request by calling
Component.setAuService(org.zkoss.zk.au.AuService).- Specified by:
servicein interfaceComponentCtrleverError- whether any error ever occurred before processing this request.- See Also:
Component.setAuService(org.zkoss.zk.au.AuService)
-
service
public void service(Event event, Scope scope) throws java.lang.Exception
Description copied from interface:ComponentCtrlHandles an event. This method will invoke the event handlers registered in a ZUML page, the event listeners registered in Java, and the event handlers declared as part of the component.- Specified by:
servicein interfaceComponentCtrl- Parameters:
event- the event to handlescope- the scope to evaluate the zscript, if any. (see alsoPage.interpret(java.lang.String, java.lang.String, org.zkoss.zk.ui.ext.Scope).- Throws:
java.lang.Exception
-
disableClientUpdate
public boolean disableClientUpdate(boolean disable)
Description copied from interface:ComponentCtrlSets whether to disable the update of the client widgets of this component and its descendants.By default, if a component is attached to a page, modifications that change the visual representation will be sent to the client to ensure the consistency.
Though rarely needed, you can disable the synchronization of the visual representation, if you prefer to update the client in a batch or the modification is caused by the client.
Notice:
- Once disabled, it not only affects the synchronization of this component but also all its descendants.
- The disable remains until the end of this execution (or the invocation of this method with false). In other words, it is enabled automatically in the next execution.
- The updates, if any, before calling this method will still be sent to the client.
- It does nothing, if there is no current execution.
Also notice that, with
Component.invalidate(), it is easy to synchronize the content of a component (and its descendants) to the client.- Specified by:
disableClientUpdatein interfaceComponentCtrl- Returns:
- whether it has been disabled before this invocation, i.e., the previous disable status
-
getEventListenerMap
public EventListenerMap getEventListenerMap()
Description copied from interface:ComponentCtrlReturns the map of event handlers and listeners defined in this component. This method is rarely used, but it is useful if you'd like to retrieve the behavior of the event handling of this component (and if you don't have the reference to the component)- Specified by:
getEventListenerMapin interfaceComponentCtrl
-
getShadowRoots
public <T extends ShadowElement> java.util.List<T> getShadowRoots()
Description copied from interface:ComponentCtrlReturns a set of shadow elements, if any.- Specified by:
getShadowRootsin interfaceComponentCtrl
-
removeShadowRoot
public boolean removeShadowRoot(ShadowElement shadow)
Description copied from interface:ComponentCtrlRemoves the given shadow root from this host. (Shadow developer use only)- Specified by:
removeShadowRootin interfaceComponentCtrl- Parameters:
shadow- a shadow element- Returns:
- true if child is removed successfully; false if it doesn't have the specified child
-
addShadowRoot
public boolean addShadowRoot(ShadowElement shadow)
Description copied from interface:ComponentCtrlAdds the given shadow root from this host. (Shadow developer use only)- Specified by:
addShadowRootin interfaceComponentCtrl- Parameters:
shadow- a shadow element- Returns:
- true if child is added successfully
-
addShadowRootBefore
public boolean addShadowRootBefore(ShadowElement shadow, ShadowElement insertBefore)
Description copied from interface:ComponentCtrlAdds the given shadow root from this host. (Shadow developer use only)- Specified by:
addShadowRootBeforein interfaceComponentCtrl- Parameters:
shadow- a shadow elementinsertBefore- the shadow before which you want the new child- Returns:
- true if child is added successfully
-
enableBindingAnnotation
public void enableBindingAnnotation()
Description copied from interface:ComponentCtrlSet to enable the component with binding annotation. (Internal or component developer use only.)- Specified by:
enableBindingAnnotationin interfaceComponentCtrl
-
disableBindingAnnotation
public void disableBindingAnnotation()
Description copied from interface:ComponentCtrlSet to disable the component with binding annotation. (Internal or component developer use only.)- Specified by:
disableBindingAnnotationin interfaceComponentCtrl
-
hasBindingAnnotation
public boolean hasBindingAnnotation()
Description copied from interface:ComponentCtrlReturns whether the component itself has binding annotation or not. (Internal or component developer use only.)- Specified by:
hasBindingAnnotationin interfaceComponentCtrl- Returns:
- true if the component itself has binding annotation
-
hasSubBindingAnnotation
public boolean hasSubBindingAnnotation()
Description copied from interface:ComponentCtrlReturns whether the component and its children have binding annotation or not. (Internal or component developer use only.)- Specified by:
hasSubBindingAnnotationin interfaceComponentCtrl- Returns:
- true if the component and its children have binding annotation
-
getSubBindingAnnotationCount
public int getSubBindingAnnotationCount()
Description copied from interface:ComponentCtrlReturns the count of the component's subtree binding annotation. (Internal or component developer use only.)- Specified by:
getSubBindingAnnotationCountin interfaceComponentCtrl- Returns:
- 0 if the component and its children have no binding annotation , more than 0 if they have binding annotation
-
addRedrawCallback
public boolean addRedrawCallback(Callback<ContentRenderer> callback)
-
removeRedrawCallback
public boolean removeRedrawCallback(Callback<ContentRenderer> callback)
-
getRedrawCallback
public java.util.Collection<Callback<ContentRenderer>> getRedrawCallback()
-
addCallback
public boolean addCallback(java.lang.String name, Callback callback)Description copied from interface:ComponentCtrlAdds a callback at component in specific name- Specified by:
addCallbackin interfaceComponentCtrl
-
removeCallback
public boolean removeCallback(java.lang.String name, Callback callback)Description copied from interface:ComponentCtrlRemoves a callback for component by specific name.- Specified by:
removeCallbackin interfaceComponentCtrl
-
getCallback
public java.util.Collection<Callback> getCallback(java.lang.String name)
Description copied from interface:ComponentCtrlReturns all of callbacks by specific name- Specified by:
getCallbackin interfaceComponentCtrl
-
getShadowFellowIfAny
public ShadowElement getShadowFellowIfAny(java.lang.String id)
Description copied from interface:ComponentCtrlReturns the shadow element under this shadow host.- Specified by:
getShadowFellowIfAnyin interfaceComponentCtrl- Returns:
- ShadowElement or null
-
invalidatePartial
public void invalidatePartial(java.lang.String subId)
-
invalidatePartial
public void invalidatePartial()
-
renderPropertiesOnly
public void renderPropertiesOnly(ContentRenderer renderer) throws java.io.IOException
Description copied from interface:ComponentCtrlRenders the component properties only- Specified by:
renderPropertiesOnlyin interfaceComponentCtrl- Throws:
java.io.IOException
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
-