Class AbstractTag
- java.lang.Object
-
- org.zkoss.zk.ui.AbstractComponent
-
- org.zkoss.zhtml.impl.AbstractTag
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable,Component,DynamicPropertied,RawId,Scope,ComponentCtrl
- Direct Known Subclasses:
A,Abbr,Address,Area,Article,Aside,Audio,B,Base,Bdi,Bdo,Blockquote,Body,Br,Button,Canvas,Caption,Cite,Code,Col,Colgroup,ContentTag,Data,Datalist,Dd,Del,Details,Dfn,Dialog,Div,Dl,Dt,Em,Embed,Fieldset,Figcaption,Figure,Footer,Form,H1,H2,H3,H4,H5,H6,Head,Header,Hgroup,Hr,Html,I,Iframe,Img,Input,Ins,Kbd,Label,Legend,Li,Link,Main,Map,Mark,Menu,Meta,Meter,Nav,Noscript,Object,Ol,Optgroup,Option,Output,P,Picture,Pre,Progress,Q,Raw,Rp,Rt,Ruby,S,Samp,Section,Select,Slot,Small,Source,Span,Strong,Sub,Summary,Sup,Table,Tbody,Td,Template,Tfoot,Th,Thead,Time,Title,Tr,Track,U,Ul,Var,Video,Wbr
public class AbstractTag extends AbstractComponent implements DynamicPropertied, RawId
The raw component used to generate raw HTML elements.Note: ZHTML components ignore the page listener since it handles non-deferrable event listeners (see
Deferrable).- Author:
- tomyeh
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classAbstractTag.ExtraCtrl-
Nested classes/interfaces inherited from class org.zkoss.zk.ui.AbstractComponent
AbstractComponent.Children, AbstractComponent.ForwardInfo, AbstractComponent.TargetInfo
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.String_tagnmThe tag name.-
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_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 Modifier Constructor Description protectedAbstractTag()protectedAbstractTag(java.lang.String tagname)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Objectclone()Clones the component.java.lang.StringgetAccesskey()Returns the accesskey of this tag.java.lang.StringgetDir()Returns the dir of this tag.java.util.Map<java.lang.String,java.lang.Object>getDynamicProperties()Returns all available dynamic properties.java.lang.ObjectgetDynamicProperty(java.lang.String name)Returns the dynamic property, or null if not found.java.lang.ObjectgetExtraCtrl()Returns the extra controls that tell ZK how to handle this component specially.java.lang.StringgetLang()Returns the lang of this tag.PropertyAccessgetPropertyAccess(java.lang.String prop)Returns the corresponding property access object from the given property name, if any.java.lang.StringgetSclass()Returns the CSS class.java.lang.StringgetStyle()Returns the CSS style.java.lang.IntegergetTabindex()Returns the tabindex of this tag.java.lang.StringgetTag()Returns the tag name.java.lang.StringgetTitle()Returns the title of this tag.java.lang.StringgetWidgetClass()Returns the widget class, "zhtml.Widget".booleanhasDynamicProperty(java.lang.String name)Returns whether a dynamic property is defined.protected booleanisChildable()Returns whether this component can have a child.booleanisContenteditable()Returns the contenteditable of this tag.booleanisDraggable()Returns the draggable of this tag.booleanisHidden()Returns the hidden of this tag.protected booleanisOrphanTag()Returns whether this tag is an orphan tag, i.e., it shall be in the form of <tag/>.booleanisSpellcheck()Returns the spellcheck of this tag.voidredraw(java.io.Writer out)Redraws this component and all its descendants.protected voidredrawChildrenDirectly(TagRenderContext rc, Execution exec, java.io.Writer out)Renders the children directly to the given output.protected voidrenderProperties(ContentRenderer renderer)Called by (ComponentCtrl.redraw(java.io.Writer)) to render the properties, excluding the enclosing tag and children.voidsetAccesskey(java.lang.String accesskey)Sets the accesskey of this tag.voidsetContenteditable(boolean contenteditable)Sets the contenteditable of this tag.voidsetDir(java.lang.String dir)Sets the dir of this tag.voidsetDraggable(boolean draggable)Sets the draggable of this tag.voidsetDynamicProperty(java.lang.String name, java.lang.Object value)Sets the dynamic property.voidsetHidden(boolean hidden)Sets the hidden of this tag.voidsetLang(java.lang.String lang)Sets the lang of this tag.voidsetSclass(java.lang.String sclass)Sets the CSS class.voidsetSpellcheck(boolean spellcheck)Sets the spellcheck of this tag.voidsetStyle(java.lang.String style)Sets the CSS style.voidsetTabindex(java.lang.Integer tabindex)Sets the tabindex of this tag.voidsetTitle(java.lang.String title)Sets the title of this tag.booleansetVisible(boolean visible)Changes the visibility of this component.protected booleanshallHideId()Whether to hide the id attribute.java.lang.StringtoString()-
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, 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, getSubBindingAnnotationCount, getTemplate, getTemplateNames, getUuid, getWidgetAttributeNames, getWidgetListener, getWidgetListenerNames, getWidgetOverride, getWidgetOverrideNames, hasAttribute, hasAttribute, hasAttribute, hasAttributeOrFellow, hasBindingAnnotation, hasFellow, hasFellow, hasSubBindingAnnotation, initIndexCacheMap, insertBefore, invalidate, 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, setSubBindingAnnotationCount, setTemplate, setVisibleDirectly, setWidgetClass, setWidgetListener, setWidgetOverride, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdateWidgetListener, smartUpdateWidgetOverride, updateByClient, updateSubBindingAnnotationCount, willPassivate, willPassivate, willSerialize, willSerialize
-
-
-
-
Method Detail
-
getSclass
public java.lang.String getSclass()
Returns the CSS class. Due to Java's limitation, we cannot use the name called getClas.Default: null (the default value depends on element).
-
setSclass
public void setSclass(java.lang.String sclass)
Sets the CSS class.
-
getStyle
public java.lang.String getStyle()
Returns the CSS style.Default: null.
-
setStyle
public void setStyle(java.lang.String style)
Sets the CSS style.Note: if display is not specified as part of style, the returned value of
AbstractComponent.isVisible()is assumed. In other words, if not visible and display is not specified as part of style, "display:none" is appended.On the other hand, if display is specified, then
setVisible(boolean)is called to reflect the visibility, if necessary.
-
getAccesskey
public java.lang.String getAccesskey()
Returns the accesskey of this tag.Notice that this attribute refers to the corresponding attribute of the HTML5 specification. Hence, it would still be rendered to client-side as a DOM attribute even if the browser doesn’t support it.
- Since:
- 8.0.3
-
setAccesskey
public void setAccesskey(java.lang.String accesskey) throws WrongValueExceptionSets the accesskey of this tag.Notice that this attribute refers to the corresponding attribute of the HTML5 specification. Hence, it would still be rendered to client-side as a DOM attribute even if the browser doesn’t support it.
- Throws:
WrongValueException- Since:
- 8.0.3
-
isContenteditable
public boolean isContenteditable()
Returns the contenteditable of this tag.Notice that this attribute refers to the corresponding attribute of the HTML5 specification. Hence, it would still be rendered to client-side as a DOM attribute even if the browser doesn’t support it.
- Since:
- 8.0.3
-
setContenteditable
public void setContenteditable(boolean contenteditable) throws WrongValueExceptionSets the contenteditable of this tag.Notice that this attribute refers to the corresponding attribute of the HTML5 specification. Hence, it would still be rendered to client-side as a DOM attribute even if the browser doesn’t support it.
- Throws:
WrongValueException- Since:
- 8.0.3
-
getDir
public java.lang.String getDir()
Returns the dir of this tag.Notice that this attribute refers to the corresponding attribute of the HTML5 specification. Hence, it would still be rendered to client-side as a DOM attribute even if the browser doesn’t support it.
- Since:
- 8.0.3
-
setDir
public void setDir(java.lang.String dir) throws WrongValueExceptionSets the dir of this tag.Notice that this attribute refers to the corresponding attribute of the HTML5 specification. Hence, it would still be rendered to client-side as a DOM attribute even if the browser doesn’t support it.
- Throws:
WrongValueException- Since:
- 8.0.3
-
isDraggable
public boolean isDraggable()
Returns the draggable of this tag.Notice that this attribute refers to the corresponding attribute of the HTML5 specification. Hence, it would still be rendered to client-side as a DOM attribute even if the browser doesn’t support it.
- Since:
- 8.0.3
-
setDraggable
public void setDraggable(boolean draggable) throws WrongValueExceptionSets the draggable of this tag.Notice that this attribute refers to the corresponding attribute of the HTML5 specification. Hence, it would still be rendered to client-side as a DOM attribute even if the browser doesn’t support it.
- Throws:
WrongValueException- Since:
- 8.0.3
-
isHidden
public boolean isHidden()
Returns the hidden of this tag.Notice that this attribute refers to the corresponding attribute of the HTML5 specification. Hence, it would still be rendered to client-side as a DOM attribute even if the browser doesn’t support it.
- Since:
- 8.0.3
-
setHidden
public void setHidden(boolean hidden) throws WrongValueExceptionSets the hidden of this tag.Notice that this attribute refers to the corresponding attribute of the HTML5 specification. Hence, it would still be rendered to client-side as a DOM attribute even if the browser doesn’t support it.
- Throws:
WrongValueException- Since:
- 8.0.3
-
getLang
public java.lang.String getLang()
Returns the lang of this tag.Notice that this attribute refers to the corresponding attribute of the HTML5 specification. Hence, it would still be rendered to client-side as a DOM attribute even if the browser doesn’t support it.
- Since:
- 8.0.3
-
setLang
public void setLang(java.lang.String lang) throws WrongValueExceptionSets the lang of this tag.Notice that this attribute refers to the corresponding attribute of the HTML5 specification. Hence, it would still be rendered to client-side as a DOM attribute even if the browser doesn’t support it.
- Throws:
WrongValueException- Since:
- 8.0.3
-
isSpellcheck
public boolean isSpellcheck()
Returns the spellcheck of this tag.Notice that this attribute refers to the corresponding attribute of the HTML5 specification. Hence, it would still be rendered to client-side as a DOM attribute even if the browser doesn’t support it.
- Since:
- 8.0.3
-
setSpellcheck
public void setSpellcheck(boolean spellcheck) throws WrongValueExceptionSets the spellcheck of this tag.Notice that this attribute refers to the corresponding attribute of the HTML5 specification. Hence, it would still be rendered to client-side as a DOM attribute even if the browser doesn’t support it.
- Throws:
WrongValueException- Since:
- 8.0.3
-
getTabindex
public java.lang.Integer getTabindex()
Returns the tabindex of this tag.Notice that this attribute refers to the corresponding attribute of the HTML5 specification. Hence, it would still be rendered to client-side as a DOM attribute even if the browser doesn’t support it.
- Since:
- 8.0.3
-
setTabindex
public void setTabindex(java.lang.Integer tabindex) throws WrongValueExceptionSets the tabindex of this tag.Notice that this attribute refers to the corresponding attribute of the HTML5 specification. Hence, it would still be rendered to client-side as a DOM attribute even if the browser doesn’t support it.
- Throws:
WrongValueException- Since:
- 8.0.3
-
getTitle
public java.lang.String getTitle()
Returns the title of this tag.Notice that this attribute refers to the corresponding attribute of the HTML5 specification. Hence, it would still be rendered to client-side as a DOM attribute even if the browser doesn’t support it.
- Since:
- 8.0.3
-
setTitle
public void setTitle(java.lang.String title) throws WrongValueExceptionSets the title of this tag.Notice that this attribute refers to the corresponding attribute of the HTML5 specification. Hence, it would still be rendered to client-side as a DOM attribute even if the browser doesn’t support it.
- Throws:
WrongValueException- Since:
- 8.0.3
-
getTag
public java.lang.String getTag()
Returns the tag name.
-
hasDynamicProperty
public boolean hasDynamicProperty(java.lang.String name)
Description copied from interface:DynamicPropertiedReturns whether a dynamic property is defined.- Specified by:
hasDynamicPropertyin interfaceDynamicPropertied
-
getDynamicProperties
public java.util.Map<java.lang.String,java.lang.Object> getDynamicProperties()
Description copied from interface:DynamicPropertiedReturns all available dynamic properties.- Specified by:
getDynamicPropertiesin interfaceDynamicPropertied
-
getDynamicProperty
public java.lang.Object getDynamicProperty(java.lang.String name)
Returns the dynamic property, or null if not found. Note: it must be a String object or null.- Specified by:
getDynamicPropertyin interfaceDynamicPropertied
-
setDynamicProperty
public void setDynamicProperty(java.lang.String name, java.lang.Object value) throws WrongValueExceptionSets the dynamic property. Note: it converts the value to a string object (by use ofObjects.toString(java.lang.Object)).Note: it handles the style property specially. Refer to
setStyle(java.lang.String)for details.- Specified by:
setDynamicPropertyin interfaceDynamicPropertied- Throws:
WrongValueException
-
shallHideId
protected boolean shallHideId()
Whether to hide the id attribute.Default: false.
Some tags, such as
Html, won't generate the id attribute. They shall override this method to return true.
-
setVisible
public boolean setVisible(boolean visible)
Changes the visibility of this component.Note: it will adjust the style (
getStyle()) based on the visibility.- Specified by:
setVisiblein interfaceComponent- Overrides:
setVisiblein classAbstractComponent- Returns:
- the previous visibility
-
getWidgetClass
public java.lang.String getWidgetClass()
Returns the widget class, "zhtml.Widget".- Specified by:
getWidgetClassin interfaceComponent- Overrides:
getWidgetClassin classAbstractComponent- Since:
- 5.0.0
- See Also:
Component.setWidgetClass(java.lang.String)
-
redraw
public void redraw(java.io.Writer out) throws java.io.IOExceptionDescription 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:
java.io.IOException
-
redrawChildrenDirectly
protected void redrawChildrenDirectly(TagRenderContext rc, Execution exec, java.io.Writer out) throws java.io.IOException
Renders the children directly to the given output. Notice it is called only ifredraw(java.io.Writer)is going to render the content (HTML tags) directly. If it is about to generate the JavaScript codeAbstractComponent.redrawChildren(java.io.Writer)will be called instead.You have to override this method if the deriving class has additional information to render.
- Throws:
java.io.IOException- Since:
- 5.0.7
-
renderProperties
protected void renderProperties(ContentRenderer renderer) throws java.io.IOException
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:
java.io.IOException
-
isChildable
protected boolean isChildable()
Description copied from class:AbstractComponentReturns whether this component can have a child.Default: return true (means it can have children).
- Overrides:
isChildablein classAbstractComponent
-
isOrphanTag
protected boolean isOrphanTag()
Returns whether this tag is an orphan tag, i.e., it shall be in the form of <tag/>.- Since:
- 5.0.8
-
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- Overrides:
getPropertyAccessin classAbstractComponent- Parameters:
prop- the name of the property- Returns:
- null it means not to support for the property name.
-
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.- Specified by:
clonein interfaceComponent- Overrides:
clonein classAbstractComponent- Returns:
- the new component. Notice that it doesn't belong to any page, nor desktop. It doesn't have a parent, either.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classAbstractComponent
-
getExtraCtrl
public java.lang.Object 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:
ComponentCtrl.getExtraCtrl()
-
-