public class StubComponent extends AbstractComponent
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.
AbstractComponent.Children
APPLICATION_SCOPE, COMPONENT_SCOPE, DESKTOP_SCOPE, PAGE_SCOPE, REQUEST_SCOPE, SESSION_SCOPE, SPACE_SCOPE
AFTER_CHILD_ADDED, AFTER_CHILD_REMOVED, AFTER_PAGE_ATTACHED, AFTER_PAGE_DETACHED, CE_BUSY_IGNORE, CE_DUPLICATE_IGNORE, CE_IMPORTANT, CE_NON_DEFERRABLE, CE_REPEAT_IGNORE
Constructor and Description |
---|
StubComponent() |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getId(java.lang.String uuid)
Returns ID of the given UUID, or null if not found or no ID assigned.
|
java.lang.String |
getWidgetClass()
Returns the widget class, "#stub".
|
void |
replace(Component comp,
boolean bFellow,
boolean bListener,
boolean bChildren)
Replace the specified component with this component in
the component tree.
|
void |
service(AuRequest request,
boolean everError)
Handles an AU request.
|
void |
service(Event event,
Scope scope)
Handles an event.
|
addAnnotation, addAnnotation, addCallback, addClientEvent, addEventHandler, addEventListener, addEventListener, addForward, addForward, addForward, addForward, addMoved, addRedrawCallback, addScopeListener, addShadowRoot, addShadowRootBefore, addSharedEventHandlerMap, appendChild, applyProperties, beforeChildAdded, beforeChildRemoved, beforeParentChanged, clone, detach, didActivate, didActivate, didDeserialize, didDeserialize, disableBindingAnnotation, disableClientUpdate, enableBindingAnnotation, getAnnotatedProperties, getAnnotatedPropertiesBy, getAnnotation, getAnnotation, getAnnotations, 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, getId, getLastChild, getListenerIterator, getMold, getNextSibling, getPage, getParent, getPreviousSibling, getPropertyAccess, getRedrawCallback, getRoot, getShadowFellowIfAny, getShadowRoots, getShadowVariable, getShadowVariable, getShadowVariable0, getSpaceOwner, getSpecialRendererOutput, getStubonly, getSubBindingAnnotationCount, getTemplate, getTemplateNames, getUuid, getWidgetAttribute, getWidgetAttributeNames, getWidgetListener, getWidgetListenerNames, getWidgetOverride, getWidgetOverrideNames, hasAttribute, hasAttribute, hasAttribute, hasAttributeOrFellow, hasBindingAnnotation, hasFellow, hasFellow, hasSubBindingAnnotation, insertBefore, invalidate, invalidatePartial, isChildable, isInitialized, isInvalidated, isListenerAvailable, isVisible, onChildAdded, onChildRemoved, onPageAttached, onPageDetached, onWrongValue, query, queryAll, redraw, redrawChildren, removeAttribute, removeAttribute, removeAttribute, removeCallback, removeChild, removeEventListener, removeForward, removeForward, removeRedrawCallback, removeScopeListener, removeShadowRoot, render, render, render, renderProperties, response, response, response, sessionDidActivate, sessionWillPassivate, setAttribute, setAttribute, setAttribute, setAuService, setAutag, setClientAttribute, setClientDataAttribute, setDefinition, setDefinition, setId, setMold, setPage, setPageBefore, setParent, setStubonly, setStubonly, setSubBindingAnnotationCount, setTemplate, setVisible, setVisibleDirectly, setWidgetAttribute, setWidgetClass, setWidgetListener, setWidgetOverride, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdateWidgetListener, smartUpdateWidgetOverride, toString, updateByClient, updateSubBindingAnnotationCount, willPassivate, willPassivate, willSerialize, willSerialize
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
invalidatePartial
public java.lang.String getId(java.lang.String uuid)
Notice that it searches all descendants of this component.
public void replace(Component comp, boolean bFellow, boolean bListener, boolean bChildren)
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.
replace
in class AbstractComponent
comp
- the component. In this implementation it supports
only derived classes of AbstractComponent
.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 of
Event
(rather than MouseEvent or others).bChildren
- whether to have the children of the given component.java.lang.IllegalStateException
- if this component has a parent,
sibling or child.public java.lang.String getWidgetClass()
getWidgetClass
in interface Component
getWidgetClass
in class AbstractComponent
Component.setWidgetClass(java.lang.String)
public void service(AuRequest request, boolean everError)
AbstractComponent
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
(by Events.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)
.
service
in interface ComponentCtrl
service
in class AbstractComponent
everError
- whether any error ever occurred before
processing this request.AbstractComponent.setAuService(org.zkoss.zk.au.AuService)
public void service(Event event, Scope scope) throws java.lang.Exception
ComponentCtrl
service
in interface ComponentCtrl
service
in class AbstractComponent
event
- the event to handlescope
- the scope to evaluate the zscript, if any.
(see also Page.interpret(java.lang.String, java.lang.String, org.zkoss.zk.ui.ext.Scope)
.java.lang.Exception
Copyright © 2005-2023 Potix Corporation. All Rights Reserved.