Class AbstractTag

java.lang.Object
org.zkoss.zk.ui.AbstractComponent
org.zkoss.zhtml.impl.AbstractTag
All Implemented Interfaces:
Serializable, 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:
  • Field Details

    • _tagnm

      protected String _tagnm
      The tag name.
  • Constructor Details

    • AbstractTag

      protected AbstractTag(String tagname)
    • AbstractTag

      protected AbstractTag()
  • Method Details

    • getSclass

      public 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(String sclass)
      Sets the CSS class.
    • getStyle

      public String getStyle()
      Returns the CSS style.

      Default: null.

    • setStyle

      public void setStyle(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 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(String accesskey) throws WrongValueException
      Sets 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 WrongValueException
      Sets 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 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(String dir) throws WrongValueException
      Sets 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 WrongValueException
      Sets 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 WrongValueException
      Sets 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 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(String lang) throws WrongValueException
      Sets 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 WrongValueException
      Sets 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 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(Integer tabindex) throws WrongValueException
      Sets 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 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(String title) throws WrongValueException
      Sets 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 String getTag()
      Returns the tag name.
    • hasDynamicProperty

      public boolean hasDynamicProperty(String name)
      Description copied from interface: DynamicPropertied
      Returns whether a dynamic property is defined.
      Specified by:
      hasDynamicProperty in interface DynamicPropertied
    • getDynamicProperties

      public Map<String,Object> getDynamicProperties()
      Description copied from interface: DynamicPropertied
      Returns all available dynamic properties.
      Specified by:
      getDynamicProperties in interface DynamicPropertied
    • getDynamicProperty

      public Object getDynamicProperty(String name)
      Returns the dynamic property, or null if not found. Note: it must be a String object or null.
      Specified by:
      getDynamicProperty in interface DynamicPropertied
    • setDynamicProperty

      public void setDynamicProperty(String name, Object value) throws WrongValueException
      Sets the dynamic property. Note: it converts the value to a string object (by use of Objects.toString(java.lang.Object)).

      Note: it handles the style property specially. Refer to setStyle(java.lang.String) for details.

      Specified by:
      setDynamicProperty in interface DynamicPropertied
      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:
      setVisible in interface Component
      Overrides:
      setVisible in class AbstractComponent
      Returns:
      the previous visibility
    • getWidgetClass

      public String getWidgetClass()
      Returns the widget class, "zhtml.Widget".
      Specified by:
      getWidgetClass in interface Component
      Overrides:
      getWidgetClass in class AbstractComponent
      Since:
      5.0.0
      See Also:
    • redraw

      public void redraw(Writer out) throws IOException
      Description copied from class: AbstractComponent
      Redraws this component and all its descendants.

      Default: It uses JsContentRenderer to 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 then AbstractComponent.redrawChildren(java.io.Writer) to redraw children (and descendants) (by calling their AbstractComponent.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 override AbstractComponent.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 of ContentRenderer.

      Specified by:
      redraw in interface ComponentCtrl
      Overrides:
      redraw in class AbstractComponent
      Throws:
      IOException
    • redrawChildrenDirectly

      protected void redrawChildrenDirectly(TagRenderContext rc, Execution exec, Writer out) throws IOException
      Renders the children directly to the given output. Notice it is called only if redraw(java.io.Writer) is going to render the content (HTML tags) directly. If it is about to generate the JavaScript code AbstractComponent.redrawChildren(java.io.Writer) will be called instead.

      You have to override this method if the deriving class has additional information to render.

      Throws:
      IOException
      Since:
      5.0.7
    • renderProperties

      protected void renderProperties(ContentRenderer renderer) throws IOException
      Description copied from class: AbstractComponent
      Called 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 in AbstractComponent.getClientEvents()).

      Note: it doesn't render AbstractComponent.getWidgetClass(), AbstractComponent.getUuid() and AbstractComponent.getMold(), which are caller's job.

      Overrides:
      renderProperties in class AbstractComponent
      Throws:
      IOException
    • isChildable

      protected boolean isChildable()
      Description copied from class: AbstractComponent
      Returns whether this component can have a child.

      Default: return true (means it can have children).

      Overrides:
      isChildable in class AbstractComponent
    • 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(String prop)
      Description copied from interface: ComponentCtrl
      Returns the corresponding property access object from the given property name, if any.
      Specified by:
      getPropertyAccess in interface ComponentCtrl
      Overrides:
      getPropertyAccess in class AbstractComponent
      Parameters:
      prop - the name of the property
      Returns:
      null it means not to support for the property name.
    • clone

      public Object clone()
      Description copied from interface: Component
      Clones the component. All of its children and descendants are cloned. Also, ID are preserved.
      Specified by:
      clone in interface Component
      Overrides:
      clone in class AbstractComponent
      Returns:
      the new component. Notice that it doesn't belong to any page, nor desktop. It doesn't have a parent, either.
    • toString

      public String toString()
      Overrides:
      toString in class AbstractComponent
    • getExtraCtrl

      public Object getExtraCtrl()
      Description copied from class: AbstractComponent
      Returns the extra controls that tell ZK how to handle this component specially. It is used only by component developers.

      Default: null.

      Specified by:
      getExtraCtrl in interface ComponentCtrl
      Overrides:
      getExtraCtrl in class AbstractComponent
      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: