Class HtmlNativeComponent
- All Implemented Interfaces:
Serializable,Cloneable,Component,DynamicPropertied,DynamicTag,Native,NonFellow,Scope,ComponentCtrl
It contains the content that shall be sent directly to client.
It has three parts: prolog, children and epilog.
The prolog (getPrologContent()) and epilog (getEpilogContent())
are both String.
When this component is rendered (redraw(java.io.Writer)), it generates
the prolog first, the children and then the epilog.
- Since:
- 3.0.0
- Author:
- tomyeh
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classstatic classThe HTML helper.Nested classes/interfaces inherited from class org.zkoss.zk.ui.AbstractComponent
AbstractComponent.Children, AbstractComponent.ForwardInfo, AbstractComponent.TargetInfoNested classes/interfaces inherited from interface org.zkoss.zk.ui.ext.Native
Native.Helper -
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
ConstructorsConstructorDescriptionConstructs aHtmlNativeComponentcomponent.Constructs aHtmlNativeComponentcomponent with the specified tag name.HtmlNativeComponent(String tag, String prolog, String epilog) Constructs aHtmlNativeComponentcomponent with the specified prolog and epilog. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddDeclaredNamespace(org.zkoss.idom.Namespace ns) Adds a declared namespace.List<org.zkoss.idom.Namespace>Returns a readonly list of the declared namespaces (Namespace), or empty if no declared namespace.Returns all available dynamic properties.getDynamicProperty(String name) Returns the property value of the specified name.Returns the epilog content.Returns the extra controls that tell ZK how to handle this component specially.Returns the helper to generate the output of the native components.Returns the prolog content.getPropertyAccess(String prop) Returns the corresponding property access object from the given property name, if any.getTag()Returns the tag name, or null if plain text.Returns the widget class, "zk.Native".booleanhasDynamicProperty(String name) Returns whether a dynamic property is defined.booleanReturns whether the specified tag is allowed.voidRedraws this component and all its descendants.protected voidrenderProperties(ContentRenderer renderer) Called by (ComponentCtrl.redraw(java.io.Writer)) to render the properties, excluding the enclosing tag and children.voidsetDynamicProperty(String name, Object value) Sets a property with the specified name and value.voidsetEpilogContent(String epilog) Sets the epilog content.voidsetPrologContent(String prolog) Sets the prolog content.voidSets the tag name.booleansetVisible(boolean visible) Sets whether this component is visible.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, getFellow, getFellow, getFellowIfAny, getFellowIfAny, getFellows, getFirstChild, getForwards, getId, getIndexCacheMap, getLastChild, getMold, getNextSibling, getPage, getParent, getPreviousSibling, 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, redrawChildren, removeAttribute, removeAttribute, removeAttribute, removeCallback, removeChild, removeEventListener, removeForward, removeForward, removeRedrawCallback, removeScopeListener, removeShadowRoot, render, render, render, renderPropertiesOnly, replace, response, response, response, service, service, sessionDidActivate, sessionWillPassivate, setAttribute, setAttribute, setAttribute, setAuService, setAutag, setClientAttribute, setClientDataAttribute, setDefinition, setDefinition, setId, setMold, setPage, setPageBefore, setParent, setStubonly, setStubonly, setStubonlyDescendants, setSubBindingAnnotationCount, setTemplate, setVisibleDirectly, setWidgetClass, setWidgetListener, setWidgetOverride, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdateWidgetListener, smartUpdateWidgetOverride, toString, updateByClient, updateSubBindingAnnotationCount, willPassivate, willPassivate, willSerialize, willSerialize
-
Constructor Details
-
HtmlNativeComponent
public HtmlNativeComponent()Constructs aHtmlNativeComponentcomponent. -
HtmlNativeComponent
Constructs aHtmlNativeComponentcomponent with the specified tag name.- Parameters:
tag- the tag name. If null or empty, plain text is assumed.
-
HtmlNativeComponent
Constructs aHtmlNativeComponentcomponent with the specified prolog and epilog.- Parameters:
tag- the tag name. If null or empty, plain text is assumed.prolog- the content right before the children, if any.epilog- the content right after the children, if any.
-
-
Method Details
-
getWidgetClass
Returns the widget class, "zk.Native".- Specified by:
getWidgetClassin interfaceComponent- Overrides:
getWidgetClassin classAbstractComponent- Since:
- 5.0.0
- See Also:
-
getTag
Returns the tag name, or null if plain text. -
getDeclaredNamespaces
Description copied from interface:NativeReturns a readonly list of the declared namespaces (Namespace), or empty if no declared namespace.- Specified by:
getDeclaredNamespacesin interfaceNative
-
addDeclaredNamespace
public void addDeclaredNamespace(org.zkoss.idom.Namespace ns) Description copied from interface:NativeAdds a declared namespace. The added declared namespace will be generated to the output.- Specified by:
addDeclaredNamespacein interfaceNative- Parameters:
ns- the namespace (never null).
-
getPrologContent
Description copied from interface:NativeReturns the prolog content. It is the content generated before the child components, if any.Default: empty ("").
- Specified by:
getPrologContentin interfaceNative
-
setPrologContent
Description copied from interface:NativeSets the prolog content. It is the content generated before the child components, if any.- Specified by:
setPrologContentin interfaceNative
-
getEpilogContent
Description copied from interface:NativeReturns the epilog content. It is the content generated before the child components, if any.Default: empty ("").
- Specified by:
getEpilogContentin interfaceNative
-
setEpilogContent
Description copied from interface:NativeSets the epilog content. It is the content generated before the child components, if any.- Specified by:
setEpilogContentin interfaceNative
-
getHelper
Description copied from interface:NativeReturns the helper to generate the output of the native components. -
setVisible
public boolean setVisible(boolean visible) 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- Overrides:
setVisiblein classAbstractComponent- Returns:
- the previous visibility
-
redraw
Description copied from class:AbstractComponentRedraws this component and all its descendants.Default: It uses
JsContentRendererto render all information in JavaScript codes. For devices that don't support JavaScript, it must override this method.To generate all information, it first invokes
AbstractComponent.renderProperties(org.zkoss.zk.ui.sys.ContentRenderer)to render component's properties, and thenAbstractComponent.redrawChildren(java.io.Writer)to redraw children (and descendants) (by calling theirAbstractComponent.redraw(java.io.Writer)).If a derived class wants to render more properties, it can override
AbstractComponent.renderProperties(org.zkoss.zk.ui.sys.ContentRenderer).If a derived class renders only a subset of its children (such as paging/cropping), it could override
AbstractComponent.redrawChildren(java.io.Writer).If a deriving class wants to do something before
AbstractComponent.renderProperties(org.zkoss.zk.ui.sys.ContentRenderer), it has to overrideAbstractComponent.redraw(java.io.Writer).If a deriving class doesn't want to render in JavaScript codes, it has to override
AbstractComponent.redraw(java.io.Writer)with the proper implementation ofContentRenderer.- Specified by:
redrawin interfaceComponentCtrl- Overrides:
redrawin classAbstractComponent- Throws:
IOException
-
renderProperties
Description copied from class:AbstractComponentCalled by (ComponentCtrl.redraw(java.io.Writer)) to render the properties, excluding the enclosing tag and children.Default: it renders
AbstractComponent.getId()if it was assigned, and event names if listened (and listed inAbstractComponent.getClientEvents()).Note: it doesn't render
AbstractComponent.getWidgetClass(),AbstractComponent.getUuid()andAbstractComponent.getMold(), which are caller's job.- Overrides:
renderPropertiesin classAbstractComponent- Throws:
IOException
-
setTag
Sets the tag name.- Specified by:
setTagin interfaceDynamicTag- Parameters:
tag- the tag name. If null or empty, plain text is assumed.- Throws:
WrongValueException
-
hasTag
Description copied from interface:DynamicTagReturns whether the specified tag is allowed.- Specified by:
hasTagin interfaceDynamicTag
-
hasDynamicProperty
Description copied from interface:DynamicPropertiedReturns whether a dynamic property is defined.- Specified by:
hasDynamicPropertyin interfaceDynamicPropertied
-
getDynamicProperty
Description copied from interface:DynamicPropertiedReturns the property value of the specified name.- Specified by:
getDynamicPropertyin interfaceDynamicPropertied
-
getDynamicProperties
Description copied from interface:DynamicPropertiedReturns all available dynamic properties.- Specified by:
getDynamicPropertiesin interfaceDynamicPropertied
-
setDynamicProperty
Description copied from interface:DynamicPropertiedSets a property with the specified name and value.If a component supports only String-type values, it could use org.zkoss.lang.Objects.toString() to convert the value to a String instance.
- Specified by:
setDynamicPropertyin interfaceDynamicPropertied- Throws:
WrongValueException
-
getPropertyAccess
Description copied from interface:ComponentCtrlReturns the corresponding property access object from the given property name, if any.- Specified by:
getPropertyAccessin interfaceComponentCtrl- Overrides:
getPropertyAccessin classAbstractComponent- Parameters:
prop- the name of the property- Returns:
- null it means not to support for the property name.
-
getExtraCtrl
Description copied from class:AbstractComponentReturns the extra controls that tell ZK how to handle this component specially. It is used only by component developers.Default: null.
- Specified by:
getExtraCtrlin interfaceComponentCtrl- Overrides:
getExtraCtrlin classAbstractComponent- 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. - See Also:
-