public abstract class HtmlShadowElement extends AbstractComponent implements ShadowElement, ShadowElementCtrl
Modifier and Type | Class and Description |
---|---|
static class |
HtmlShadowElement.Direction
A help class for an insertion direction.
|
AbstractComponent.Children
Modifier and Type | Field and Description |
---|---|
protected boolean |
_afterComposed |
protected java.lang.Boolean |
_dynamicValue |
protected static java.lang.String |
BIND_ANNO |
protected static java.lang.String |
BINDER |
protected static java.lang.String |
INIT_ANNO |
protected static java.lang.String |
LOAD_ANNO |
protected static java.lang.String |
ON_REBUILD_SHADOW_TREE_LATER |
protected static java.lang.String |
REFERENCE_ANNO |
protected static java.lang.String |
SAVE_ANNO |
static java.lang.String |
SKIP_DISTRIBUTED_CHILDREN_PROPERTY_CHANGE |
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 |
---|
HtmlShadowElement() |
Modifier and Type | Method and Description |
---|---|
void |
afterCompose()
Creates the distributed children after apply dynamic properties
If a shadow element is created by ZK loader, this method is invoked
automatically.
|
void |
afterHostChildAdded(Component child,
int indexOfChild)
Called when a child is added to the host.
|
void |
afterHostChildRemoved(Component child)
Called when a child is removed to the host.
|
protected static <T extends HtmlShadowElement> |
asShadow(java.lang.Object o) |
void |
beforeChildAdded(Component child,
Component refChild)
Default: does nothing.
|
void |
beforeHostChildAdded(Component child,
Component insertBefore,
int indexOfInsertBefore)
Called before the host adding a child.
|
void |
beforeHostChildRemoved(Component child,
int indexOfChild)
Called before the host removing a child.
|
void |
beforeHostParentChanged(Component parent)
Called before the host changing the parent.
|
void |
beforeParentChanged(Component parent)
Default: If parent is null, execute the @Destroy method if any.
|
void |
clearChildren() |
java.lang.Object |
clone()
Clones the component.
|
protected abstract void |
compose(Component host)
Composes the shadow element.
|
void |
detach()
Removes the relation points between shadow host and this shadow element.
|
<T extends Component> |
getDistributedChildren()
Returns a list of distributed components of the shadow tree, including
its descendant.
|
Component |
getFirstInsertion()
Returns the first component of its insertion range.
|
Component |
getLastInsertion()
Returns the last component of its insertion range.
|
Component |
getNextInsertion()
Returns the next insertion point, it may be a component, a shadow element, or null.
|
Component |
getNextInsertionComponentIfAny()
Returns the next component before this shadow, if any.
|
Component |
getPreviousInsertion()
Returns the previous insertion point, it may be a component, a shadow element, or null.
|
Component |
getPreviousInsertionComponentIfAny()
Returns the first component before this shadow, if any.
|
Component |
getShadowHost()
Returns the owner component that hosts this shadow element.
|
Component |
getShadowHostIfAny()
Return the shadow host from it or its ancestor, if any.
|
static HtmlShadowElement.Direction |
inRange(HtmlShadowElement se,
Component target)
Returns the direction of the target component according to the given shadow element.
|
void |
invalidate()
Invalidates this component by setting the dirty flag
such that it will be redraw the whole content of this
component and its dependencies later.
|
boolean |
isDynamicValue()
Returns whether the shadow element contains a dynamic value, it means the
shadow element cannot be destroyed after evaluated.
|
protected boolean |
isDynamicValue(java.lang.String propName)
Returns whether the property name contains with a dynamic value.
|
protected abstract boolean |
isEffective()
Returns whether the shadow element is effective
|
protected void |
mergeSubTree()
Merge the all sub-tree into the parent's insertions, unlike
AbstractComponent.appendChild(Component) |
boolean |
mergeToHost(Component host)
Merge the host into the current shadow, unlike
setShadowHost(Component, Component) |
void |
onChildAdded(Component child)
Default: handles special event listeners.
|
protected void |
onHostAttached(Component host) |
void |
onHostChildAdded(Component child)
Default: does nothing.
|
void |
onHostChildRemoved(Component child)
Default: does nothing.
|
protected void |
onHostDetached(Component host) |
protected void |
rebuildSubShadowTree()
Rebuilds the shadow tree if the shadow element contains a dynamic value,
it should be alive, otherwise, it will be detached.
|
void |
recreate()
Detaches all child components and then recreate them by use of
compose(org.zkoss.zk.ui.Component) . |
protected void |
removeFromParent() |
java.lang.Object |
resolveVariable(Component child,
java.lang.String name,
boolean recurse)
Returns the variable associated with this base component or null if not found.
|
void |
setDynamicValue(boolean dynamicValue)
Sets whether the shadow element contains a dynamic value, if true means the
shadow element cannot be destroyed after evaluated, if false it will detect
its attribute automatically.
|
void |
setParent(Component parent)
Sets the parent component.
|
protected static void |
setPrevInsertion(Component target,
Component prevInsertion) |
void |
setShadowHost(Component host,
Component insertBefore)
Sets the owner component that hosts this shadow element.
|
protected void |
shrinkRange(Component firstChild,
Component lastChild) |
protected void |
stretchRange(Component firstChild,
Component lastChild) |
java.lang.String |
toString() |
protected void |
updateSubBindingAnnotationCount(int diff) |
addAnnotation, addAnnotation, addCallback, addClientEvent, addEventHandler, addEventListener, addEventListener, addForward, addForward, addForward, addForward, addMoved, addRedrawCallback, addScopeListener, addShadowRoot, addShadowRootBefore, addSharedEventHandlerMap, appendChild, applyProperties, beforeChildRemoved, 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, getWidgetClass, getWidgetListener, getWidgetListenerNames, getWidgetOverride, getWidgetOverrideNames, hasAttribute, hasAttribute, hasAttribute, hasAttributeOrFellow, hasBindingAnnotation, hasFellow, hasFellow, hasSubBindingAnnotation, insertBefore, invalidatePartial, isChildable, isInitialized, isInvalidated, isListenerAvailable, isVisible, onChildRemoved, onPageAttached, onPageDetached, onWrongValue, query, queryAll, redraw, redrawChildren, removeAttribute, removeAttribute, removeAttribute, removeCallback, removeChild, removeEventListener, removeForward, removeForward, removeRedrawCallback, removeScopeListener, removeShadowRoot, render, render, render, renderProperties, replace, response, response, response, service, service, sessionDidActivate, sessionWillPassivate, setAttribute, setAttribute, setAttribute, setAuService, setAutag, setClientAttribute, setClientDataAttribute, setDefinition, setDefinition, setId, setMold, setPage, setPageBefore, setStubonly, setStubonly, setSubBindingAnnotationCount, setTemplate, setVisible, setVisibleDirectly, setWidgetAttribute, setWidgetClass, setWidgetListener, setWidgetOverride, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdateWidgetListener, smartUpdateWidgetOverride, updateByClient, willPassivate, willPassivate, willSerialize, willSerialize
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
invalidatePartial
protected boolean _afterComposed
protected static java.lang.String ON_REBUILD_SHADOW_TREE_LATER
public static java.lang.String SKIP_DISTRIBUTED_CHILDREN_PROPERTY_CHANGE
protected static final java.lang.String INIT_ANNO
protected static final java.lang.String BIND_ANNO
protected static final java.lang.String LOAD_ANNO
protected static final java.lang.String SAVE_ANNO
protected static final java.lang.String REFERENCE_ANNO
protected static final java.lang.String BINDER
protected java.lang.Boolean _dynamicValue
public java.lang.Object resolveVariable(Component child, java.lang.String name, boolean recurse)
ShadowElementCtrl
Notice that it doesn't check any variable defined in
VariableResolver
(of Page.addVariableResolver(org.zkoss.xel.VariableResolver)
).
resolveVariable
in interface ShadowElementCtrl
child
- the child component of the shadow hostrecurse
- whether to look up the parent shadow for the
existence of the variable.public Component getNextInsertionComponentIfAny()
public Component getPreviousInsertionComponentIfAny()
protected void onHostAttached(Component host)
protected void onHostDetached(Component host)
public Component getNextInsertion()
getNextInsertion
in interface ShadowElementCtrl
public Component getPreviousInsertion()
getPreviousInsertion
in interface ShadowElementCtrl
public Component getFirstInsertion()
getFirstInsertion
in interface ShadowElementCtrl
public Component getLastInsertion()
getLastInsertion
in interface ShadowElementCtrl
public void setShadowHost(Component host, Component insertBefore)
ShadowElementCtrl
setShadowHost
in interface ShadowElementCtrl
host
- the host of the shadow elementinsertBefore
- a component or a shadow element to indicate where the
shadow's insertion point is added.public void detach()
detach
in interface Component
detach
in interface ShadowElement
detach
in class AbstractComponent
public void setParent(Component parent)
Component
Note: Component.setParent(org.zkoss.zk.ui.Component)
always calls back Component.insertBefore(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.Component)
and/or Component.removeChild(org.zkoss.zk.ui.Component)
,
while Component.insertBefore(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.Component)
and Component.removeChild(org.zkoss.zk.ui.Component)
always calls back Component.setParent(org.zkoss.zk.ui.Component)
,
if the parent is changed. Thus, you don't need to override
both Component.insertBefore(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.Component)
and Component.setParent(org.zkoss.zk.ui.Component)
, if you want
to customize the behavior.
setParent
in interface Component
setParent
in class AbstractComponent
public void beforeParentChanged(Component parent)
AbstractComponent
beforeParentChanged
in interface ComponentCtrl
beforeParentChanged
in class AbstractComponent
parent
- the new parent. If null, it means detachment.ComponentCtrl.beforeParentChanged(org.zkoss.zk.ui.Component)
public void beforeChildAdded(Component child, Component refChild)
AbstractComponent
beforeChildAdded
in interface ComponentCtrl
beforeChildAdded
in class AbstractComponent
child
- the child to be added (never null).refChild
- another child component that the new child
will be inserted before it. If null, the new child will be the
last child.ComponentCtrl.beforeChildAdded(org.zkoss.zk.ui.Component, org.zkoss.zk.ui.Component)
public void onChildAdded(Component child)
AbstractComponent
onChildAdded
in interface ComponentCtrl
onChildAdded
in class AbstractComponent
ComponentCtrl.onChildAdded(org.zkoss.zk.ui.Component)
public void invalidate()
Component
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.
invalidate
in interface Component
invalidate
in class AbstractComponent
public java.lang.Object clone()
Component
clone
in interface Component
clone
in class AbstractComponent
public Component getShadowHost()
ShadowElement
getShadowHost
in interface ShadowElement
public void afterCompose()
If a shadow element is created by ZK loader, this method is invoked automatically. Developers rarely need to invoke this method.
Default: it invokes compose(org.zkoss.zk.ui.Component)
to compose the shadow element.
The method will invoke the following methods in order.
isEffective()
to be true.compose(org.zkoss.zk.ui.Component)
method to create the distributed
children, otherwise, nothing happened.
Instead of overriding this method, it is suggested to override
compose(org.zkoss.zk.ui.Component)
, since all other methods depend on compose(org.zkoss.zk.ui.Component)
(rather than afterCompose()
).
afterCompose
in interface AfterCompose
protected void mergeSubTree()
AbstractComponent.appendChild(Component)
public boolean mergeToHost(Component host)
setShadowHost(Component, Component)
host
- protected void rebuildSubShadowTree()
java.util.ConcurrentModificationException
- if caller use the same collection,
it may throw this exception when merging sub-tree.protected abstract boolean isEffective()
protected abstract void compose(Component host)
afterCompose()
if the
shadow host is not null. Otherwise, it will skip this method call.
The second invocation is ignored. If you want to recreate child
components, use recreate()
instead.
host
- the shadow host component, never null.public void beforeHostChildRemoved(Component child, int indexOfChild)
ShadowElementCtrl
beforeHostChildRemoved
in interface ShadowElementCtrl
child
- the child to be removed (never null)indexOfChild
- the index of the removed childpublic void onHostChildRemoved(Component child)
onHostChildRemoved
in interface ShadowElementCtrl
ComponentCtrl.onChildAdded(org.zkoss.zk.ui.Component)
public void onHostChildAdded(Component child)
onHostChildAdded
in interface ShadowElementCtrl
ComponentCtrl.onChildAdded(org.zkoss.zk.ui.Component)
public void beforeHostParentChanged(Component parent)
ShadowElementCtrl
beforeHostParentChanged
in interface ShadowElementCtrl
parent
- the new parent. If null, it means detachment.public void beforeHostChildAdded(Component child, Component insertBefore, int indexOfInsertBefore)
ShadowElementCtrl
beforeHostChildAdded
in interface ShadowElementCtrl
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.indexOfInsertBefore
- the index of the insertBefore, if any. Otherwise -1 is assumed.protected static <T extends HtmlShadowElement> T asShadow(java.lang.Object o)
public static HtmlShadowElement.Direction inRange(HtmlShadowElement se, Component target)
se
- the shadow elementtarget
- the target to check.public void afterHostChildAdded(Component child, int indexOfChild)
ShadowElementCtrl
afterHostChildAdded
in interface ShadowElementCtrl
child
- the child has been added (never null).indexOfChild
- the index of the added child.public void afterHostChildRemoved(Component child)
ShadowElementCtrl
afterHostChildRemoved
in interface ShadowElementCtrl
child
- the child has been added (never null).public void recreate()
compose(org.zkoss.zk.ui.Component)
.recreate
in interface ShadowElement
public void clearChildren()
protected void removeFromParent()
public Component getShadowHostIfAny()
ShadowElementCtrl
getShadowHostIfAny
in interface ShadowElementCtrl
public <T extends Component> java.util.List<T> getDistributedChildren()
ShadowElement
It's better to manipulate with the component children from the host component.
getDistributedChildren
in interface ShadowElement
protected boolean isDynamicValue(java.lang.String propName)
public boolean isDynamicValue()
ShadowElementCtrl
isDynamicValue
in interface ShadowElementCtrl
public void setDynamicValue(boolean dynamicValue)
Default: false (auto detection)
setDynamicValue
in interface ShadowElementCtrl
public java.lang.String toString()
toString
in class AbstractComponent
protected void updateSubBindingAnnotationCount(int diff)
updateSubBindingAnnotationCount
in class AbstractComponent
Copyright © 2005-2023 Potix Corporation. All Rights Reserved.