Class StubComponent
- All Implemented Interfaces:
Serializable,Cloneable,Component,Scope,ComponentCtrl
- Direct Known Subclasses:
StubsComponent
Application isn't really aware the existence of a stub component.
Rather, it is used by ZK Loader to minimize the footprint, if
it found a component doesn't have to maintain the states at the server
after rendered.
For example, HtmlNativeComponent and stub-only components
will degenerate to StubComponent or StubsComponent after rendered.
Refer Component.setStubonly(java.lang.String) for details about a stub-only component.
A component that wants to degenerate to a stub component usually
invoke replace(org.zkoss.zk.ui.Component, boolean, boolean, boolean) after AbstractComponent.redraw(java.io.Writer) is called.
- Since:
- 6.0.0
- Author:
- tomyeh
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.zkoss.zk.ui.AbstractComponent
AbstractComponent.Children, AbstractComponent.ForwardInfo, AbstractComponent.TargetInfo -
Field Summary
Fields inherited from interface org.zkoss.zk.ui.Component
APPLICATION_SCOPE, COMPONENT_SCOPE, DESKTOP_SCOPE, PAGE_SCOPE, REQUEST_SCOPE, SESSION_SCOPE, SPACE_SCOPEFields inherited from interface org.zkoss.zk.ui.sys.ComponentCtrl
AFTER_CHILD_ADDED, AFTER_CHILD_REMOVED, AFTER_CLONED, 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 -
Method Summary
Modifier and TypeMethodDescriptionReturns ID of the given UUID, or null if not found or no ID assigned.Returns the widget class, "#stub".voidReplace the specified component with this component in the component tree.voidHandles an AU request.voidHandles an event.Methods inherited from class org.zkoss.zk.ui.AbstractComponent
addAnnotation, addCallback, addClientEvent, addEventHandler, addEventListener, addEventListener, addForward, addForward, addForward, addForward, addMoved, addRedrawCallback, addScopeListener, addShadowRoot, addShadowRootBefore, addSharedEventHandlerMap, appendChild, applyProperties, beforeChildAdded, beforeChildRemoved, beforeParentChanged, clone, destroyIndexCacheMap, detach, didActivate, didActivate, didDeserialize, didDeserialize, disableBindingAnnotation, disableClientUpdate, disableHostChanged, enableBindingAnnotation, enableHostChanged, getAnnotatedProperties, getAnnotatedPropertiesBy, getAnnotation, getAnnotations, getAnnotations, getAttribute, getAttribute, getAttribute, getAttributeOrFellow, getAttributes, getAttributes, getAuService, getAutag, getCallback, getChildren, getClientAttribute, getClientDataAttribute, getClientEvents, getDefaultMold, getDefinition, getDesktop, getEventHandler, getEventHandlerNames, getEventListenerMap, getEventListeners, getExtraCtrl, getFellow, getFellow, getFellowIfAny, getFellowIfAny, getFellows, getFirstChild, getForwards, getId, getIndexCacheMap, getLastChild, getMold, getNextSibling, getPage, getParent, getPreviousSibling, getPropertyAccess, getRedrawCallback, getRoot, getShadowFellowIfAny, getShadowRoots, getShadowVariable, getShadowVariable, getShadowVariable0, getSpaceOwner, getSpecialRendererOutput, getStubonly, getStubonlyDescendants, getSubBindingAnnotationCount, getTemplate, getTemplateNames, getUuid, getWidgetAttributeNames, getWidgetListener, getWidgetListenerNames, getWidgetOverride, getWidgetOverrideNames, hasAttribute, hasAttribute, hasAttribute, hasAttributeOrFellow, hasBindingAnnotation, hasFellow, hasFellow, hasSubBindingAnnotation, initIndexCacheMap, insertBefore, invalidate, isChildable, isDisabledHostChanged, isInitialized, isInvalidated, isListenerAvailable, isVisible, onChildAdded, onChildRemoved, onPageAttached, onPageDetached, onParentChanged, onWrongValue, query, queryAll, redraw, redrawChildren, removeAttribute, removeAttribute, removeAttribute, removeCallback, removeChild, removeEventListener, removeForward, removeForward, removeRedrawCallback, removeScopeListener, removeShadowRoot, render, render, render, renderProperties, renderPropertiesOnly, response, response, response, sessionDidActivate, sessionWillPassivate, setAttribute, setAttribute, setAttribute, setAuService, setAutag, setClientAttribute, setClientDataAttribute, setDefinition, setDefinition, setId, setMold, setPage, setPageBefore, setParent, setStubonly, setStubonly, setStubonlyDescendants, setSubBindingAnnotationCount, setTemplate, setVisible, setVisibleDirectly, setWidgetClass, setWidgetListener, setWidgetOverride, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdateWidgetListener, smartUpdateWidgetOverride, toString, updateByClient, updateSubBindingAnnotationCount, willPassivate, willPassivate, willSerialize, willSerialize
-
Constructor Details
-
StubComponent
public StubComponent()
-
-
Method Details
-
getId
Returns ID of the given UUID, or null if not found or no ID assigned. It assumes the given UUID belonged to one of the component being merged into this component.Notice that it searches all descendants of this component.
-
replace
Replace the specified component with this component in the component tree. In other words, the parent of the given component will become the parent of this components, so are siblings and children. Furthermore, comp will be detached at the end.Notice that the replacement won't change anything at the client. A stub component assumes there is a full-functional widget running at the client to handle everything.
- Overrides:
replacein classAbstractComponent- Parameters:
comp- the component. In this implementation it supports only derived classes ofAbstractComponent.bFellow- whether to add this component to the map of fellows if it is assigned with an ID. If false, the component (comp) cannot be retrieved back even with an ID.bListener- whether to retain the event listeners and handlers. If true, the event listeners and handlers, if any, will be registered to this stub component. In other words, the event will be processed. However, it is a stub component, rather than the original one. I means the event is the most generic format: an instance ofEvent(rather than MouseEvent or others).bChildren- whether to have the children of the given component.
If false, this component won't have any children, and all UUID of children reference back to this component.
If true, the given component's children will belong to this component.- Throws:
IllegalStateException- if this component has a parent, sibling or child.
-
getWidgetClass
Returns the widget class, "#stub".- Specified by:
getWidgetClassin interfaceComponent- Overrides:
getWidgetClassin classAbstractComponent- See Also:
-
service
Description copied from class:AbstractComponentHandles an AU request. It is invoked internally.Default: it handles echo and setAttr, and it converts other request to an event (by
Event.getEvent(org.zkoss.zk.au.AuRequest)) and then posts the event (byEvents.postEvent(org.zkoss.zk.ui.event.Event)).Application developer can plug the custom service to handle the AU request by
AbstractComponent.setAuService(org.zkoss.zk.au.AuService).- Specified by:
servicein interfaceComponentCtrl- Overrides:
servicein classAbstractComponenteverError- whether any error ever occurred before processing this request.- See Also:
-
service
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- Overrides:
servicein classAbstractComponent- 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:
Exception
-