Package org.zkoss.zhtml

## Class Text

- java.lang.Object
- - org.zkoss.zk.ui.AbstractComponent
  - - org.zkoss.zhtml.Text

- All Implemented Interfaces:
    `java.io.Serializable`, `java.lang.Cloneable`, `Component`, `RawId`, `Scope`, `ComponentCtrl`

      public class Text
      extends AbstractComponent
      implements RawId

  Represents a piece of text (of DOM).
  Author:
    tomyeh
  See Also:
    Serialized Form

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class | Description
    --- | --- | ---
    `protected class` | `Text.ExtraCtrl` |

    - ### Nested classes/interfaces inherited from class org.zkoss.zk.ui.AbstractComponent

      `AbstractComponent.Children, AbstractComponent.ForwardInfo, AbstractComponent.TargetInfo`

  - ### Field Summary

    - ### 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
    Constructor | Description
    --- | ---
    `Text()` |
    `Text​(java.lang.String value)` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `java.lang.Object` | `getExtraCtrl()` | Returns the extra controls that tell ZK how to handle this component specially.
    `PropertyAccess` | `getPropertyAccess​(java.lang.String prop)` | Returns the corresponding property access object from the given property name, if any.
    `java.lang.Integer` | `getTabindexInteger()` | Returns null if not set.
    `java.lang.String` | `getValue()` | Returns the value.
    `java.lang.String` | `getWidgetClass()` | Returns the widget class, "zhtml.Text".
    `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.
    `protected boolean` | `isChildable()` | Returns whether this component can have a child.
    `boolean` | `isEncode()` | Returns whether to encode the text, such as converting < to &lt;.
    `void` | `redraw​(java.io.Writer out)` | Redraws this component and all its descendants.
    `protected void` | `renderProperties​(ContentRenderer renderer)` | Called by (`ComponentCtrl.redraw(java.io.Writer)`) to render the properties, excluding the enclosing tag and children.
    `void` | `setEncode​(boolean encode)` | Sets whether to encode the text, such as converting < to &lt;.
    `void` | `setParent​(Component parent)` | Sets the parent component.
    `void` | `setTabindex​(java.lang.Integer tabindex)` | Sets the tab order of this component.
    `void` | `setValue​(java.lang.String value)` | Sets the value.

    - ### 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, getSubBindingAnnotationCount, getTemplate, getTemplateNames, getUuid, getWidgetAttributeNames, getWidgetListener, getWidgetListenerNames, getWidgetOverride, getWidgetOverrideNames, hasAttribute, hasAttribute, hasAttribute, hasAttributeOrFellow, hasBindingAnnotation, hasFellow, hasFellow, hasSubBindingAnnotation, initIndexCacheMap, insertBefore, 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, setStubonly, setStubonly, setSubBindingAnnotationCount, setTemplate, setVisible, setVisibleDirectly, setWidgetClass, setWidgetListener, setWidgetOverride, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdateWidgetListener, smartUpdateWidgetOverride, toString, updateByClient, updateSubBindingAnnotationCount, willPassivate, willPassivate, willSerialize, willSerialize`

    - ### Methods inherited from class java.lang.Object

      `equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### Text

          public Text()

    - #### Text

          public Text​(java.lang.String value)

  - ### Method Detail

    - #### getValue

          public java.lang.String getValue()

      Returns the value.

      Default: "".

    - #### setValue

          public void setValue​(java.lang.String value)

      Sets the value.

    - #### getTabindexInteger

          public java.lang.Integer getTabindexInteger()

      Returns null if not set.
      Returns:
        the tab order of this component
      Since:
        8.0.2

    - #### setTabindex

          public void setTabindex​(java.lang.Integer tabindex)

      Sets the tab order of this component. Removes the tabindex attribute if it's set to null.
      Parameters:
        `tabindex` -

    - #### isEncode

          public boolean isEncode()

      Returns whether to encode the text, such as converting < to &lt;.

      Default: true.

      Since:
        5.0.8

    - #### setEncode

          public void setEncode​(boolean encode)

      Sets whether to encode the text, such as converting < to &lt;.

      Default: true.

      Since:
        5.0.8

    - #### getWidgetClass

          public java.lang.String getWidgetClass()

      Returns the widget class, "zhtml.Text".
      Specified by:
        `getWidgetClass` in interface `Component`
      Overrides:
        `getWidgetClass` in class `AbstractComponent`
      Since:
        5.0.0
      See Also:
        `Component.setWidgetClass(java.lang.String)`

    - #### setParent

          public void setParent​(Component parent)

      Description copied from interface: `Component`
      Sets the 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.

      Specified by:
        `setParent` in interface `Component`
      Overrides:
        `setParent` in class `AbstractComponent`

    - #### invalidate

          public void invalidate()

      Description copied from interface: `Component`
      Invalidates this component by setting the dirty flag such that it will be redraw the whole content of this component and its dependencies later. And, the widget associated with this component and all its descendant at the client will be deleted and recreated, too.

      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.

      Specified by:
        `invalidate` in interface `Component`
      Overrides:
        `invalidate` in class `AbstractComponent`

    - #### redraw

          public void redraw​(java.io.Writer out)
                      throws java.io.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:
        `java.io.IOException`

    - #### renderProperties

          protected void renderProperties​(ContentRenderer renderer)
                                   throws java.io.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:
        `java.io.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`

    - #### getExtraCtrl

          public java.lang.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:
        `ComponentCtrl.getExtraCtrl()`

    - #### getPropertyAccess

          public PropertyAccess getPropertyAccess​(java.lang.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.