org.zkoss.zhtml.impl
Class AbstractTag

java.lang.Object
  extended by org.zkoss.zk.ui.AbstractComponent
      extended by org.zkoss.zhtml.impl.AbstractTag
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, Component, DynamicPropertied, RawId, Scope, ComponentCtrl
Direct Known Subclasses:
A, Abbr, Acronym, Address, Area, B, Base, Big, Blockquote, Body, Br, Button, Caption, Center, Cite, Code, Col, Colgroup, Dd, Del, Dfn, Dir, Div, Dl, Dt, Em, Embed, Fieldset, Font, Form, H1, H2, H3, H4, Head, Hr, Html, I, Iframe, Img, Input, Ins, Isindex, Kbd, Label, Legend, Li, Link, Map, Menu, Meta, Nobr, Object, Ol, Optgroup, Option, P, Pre, Q, Raw, S, Samp, Script, Select, Small, Span, Strong, Style, Sub, Sup, Table, Tbody, Td, Tfoot, Th, Thead, Title, Tr, Tt, Ul, Var

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/interfaces inherited from class org.zkoss.zk.ui.AbstractComponent
AbstractComponent.Children
 
Field Summary
protected  java.lang.String _tagnm
          The tag name.
 
Fields inherited from class org.zkoss.zk.ui.AbstractComponent
_visible
 
Fields inherited from interface org.zkoss.zk.ui.Component
APPLICATION_SCOPE, COMPONENT_SCOPE, DESKTOP_SCOPE, PAGE_SCOPE, REQUEST_SCOPE, SESSION_SCOPE, SPACE_SCOPE
 
Constructor Summary
protected AbstractTag()
           
protected AbstractTag(java.lang.String tagname)
           
 
Method Summary
 boolean addEventListener(java.lang.String evtnm, EventListener listener)
          Adds an event listener to specified event for this component.
 java.lang.Object clone()
          Clones the component.
 java.lang.Object getDynamicProperty(java.lang.String name)
          Returns the dynamic property, or null if not found.
 java.lang.String getSclass()
          Returns the CSS class.
 java.lang.String getStyle()
          Returns the CSS style.
 java.lang.String getTag()
          Returns the tag name.
 boolean hasDynamicProperty(java.lang.String name)
          Returns whether a dynamic property is defined.
 boolean isChildable()
          Default: return true (allows to have children).
 void redraw(java.io.Writer out)
          Redraws this component.
 void setDynamicProperty(java.lang.String name, java.lang.Object value)
          Sets the dynamic property.
 void setSclass(java.lang.String sclass)
          Sets the CSS class.
 void setStyle(java.lang.String style)
          Sets the CSS style.
 boolean setVisible(boolean visible)
          Changes the visibility of this component.
protected  boolean shallHideId()
          Whether to hide the id attribute.
 java.lang.String toString()
           
 
Methods inherited from class org.zkoss.zk.ui.AbstractComponent
addAnnotation, addAnnotation, addEventHandler, addForward, addForward, addForward, addForward, addMoved, addSharedAnnotationMap, addSharedEventHandlerMap, appendAsapAttr, appendAsapAttr, appendChild, applyProperties, beforeChildAdded, beforeChildRemoved, beforeParentChanged, containsVariable, detach, disableClientUpdate, equals, getAnnotatedProperties, getAnnotatedPropertiesBy, getAnnotation, getAnnotation, getAnnotations, getAnnotations, getAttribute, getAttribute, getAttributes, getAttributes, getChildren, getCommand, getDefinition, getDesktop, getEventHandler, getEventHandlerNames, getExtraCtrl, getFellow, getFellowIfAny, getFellows, getFirstChild, getId, getLastChild, getListenerIterator, getMold, getMoldURI, getNamespace, getNextSibling, getPage, getParent, getPreviousSibling, getRoot, getSpaceOwner, getUuid, getVariable, hasFellow, insertBefore, invalidate, isAsapRequired, isInvalidated, isListenerAvailable, isVisible, newChildren, newExtraCtrl, onChildAdded, onChildRemoved, onDrawNewChild, onPageAttached, onPageDetached, onWrongValue, removeAttribute, removeAttribute, removeChild, removeEventListener, removeForward, removeForward, response, sessionDidActivate, sessionWillPassivate, setAttribute, setAttribute, setComponentDefinition, setId, setMold, setPage, setPageBefore, setParent, setVariable, smartUpdate, smartUpdate, smartUpdate, smartUpdateDeferred, smartUpdateValues, unsetVariable
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_tagnm

protected java.lang.String _tagnm
The tag name.

Constructor Detail

AbstractTag

protected AbstractTag(java.lang.String tagname)

AbstractTag

protected AbstractTag()
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 dispaly 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.


getTag

public java.lang.String getTag()
Returns the tag name.


hasDynamicProperty

public boolean hasDynamicProperty(java.lang.String name)
Description copied from interface: DynamicPropertied
Returns whether a dynamic property is defined.

Specified by:
hasDynamicProperty in interface DynamicPropertied

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:
getDynamicProperty in interface DynamicPropertied

setDynamicProperty

public void setDynamicProperty(java.lang.String name,
                               java.lang.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 will 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

addEventListener

public boolean addEventListener(java.lang.String evtnm,
                                EventListener listener)
Description copied from interface: Component
Adds an event listener to specified event for this component. The second registration is ignored and false is returned.

You could register listener to all components in the same page by use of Page.addEventListener(java.lang.String, org.zkoss.zk.ui.event.EventListener).

Specified by:
addEventListener in interface Component
Overrides:
addEventListener in class AbstractComponent
Parameters:
evtnm - what event to listen (never null)
Returns:
whether the listener is added; false if it was added before
See Also:
Page.addEventListener(java.lang.String, org.zkoss.zk.ui.event.EventListener)

redraw

public void redraw(java.io.Writer out)
            throws java.io.IOException
Description copied from class: AbstractComponent
Redraws this component. This method implements the mold mechanism.
  1. It first invokes AbstractComponent.getMoldURI() to retrieve the mold to redraw. The mold is either an URI (String) or a ComponentRenderer instance.
  2. If URI, it invokes Execution.include(java.io.Writer, java.lang.String, java.util.Map, int) to generate the output.
  3. If a ComponentRenderer instance, ComponentRenderer.render(org.zkoss.zk.ui.Component, java.io.Writer) is called to generate the output.
  4. Specified by:
    redraw in interface Component
    Overrides:
    redraw in class AbstractComponent
    Throws:
    java.io.IOException

isChildable

public boolean isChildable()
Description copied from class: AbstractComponent
Default: return true (allows to have children).

Specified by:
isChildable in interface Component
Overrides:
isChildable in class AbstractComponent

clone

public java.lang.Object clone()
Description copied from interface: Component
Clones the component. All of its children is cloned. Notice that the cloned component doesn't belong to any page, nor desktop. It doesn't have parent, either.

Specified by:
clone in interface Component
Overrides:
clone in class AbstractComponent

toString

public java.lang.String toString()
Overrides:
toString in class AbstractComponent


Copyright © 2005-2009 Potix Corporation. All Rights Reserved. SourceForge.net Logo