org.zkoss.jsp.zul.impl
Class LeafTag

java.lang.Object
  extended by javax.servlet.jsp.tagext.SimpleTagSupport
      extended by org.zkoss.jsp.zul.impl.AbstractTag
          extended by org.zkoss.jsp.zul.impl.LeafTag
All Implemented Interfaces:
javax.servlet.jsp.tagext.DynamicAttributes, javax.servlet.jsp.tagext.JspTag, javax.servlet.jsp.tagext.SimpleTag, ComponentTag
Direct Known Subclasses:
BranchTag

public abstract class LeafTag
extends AbstractTag
implements javax.servlet.jsp.tagext.DynamicAttributes, ComponentTag

The skeletal class used to implement the JSP tag for ZK components that don't accept any child.

Remember to declare the following in the TLD file: <body-content>empty</body-content>

Author:
tomyeh, Ian Tsai

Field Summary
protected  java.util.Map _attrMap
           
protected  org.zkoss.zk.ui.Component _comp
           
protected  java.util.Map _eventListenerMap
           
protected  java.lang.String _forward
           
protected  ComponentTag _parenttag
           
protected  RootTag _roottag
           
protected  java.lang.String _use
           
protected  ComposerHandler composeHandle
           
 
Constructor Summary
LeafTag()
           
 
Method Summary
 void doTag()
          To process the leaf tag.
 void evaluateDynaAttributes(org.zkoss.zk.ui.Component target, java.util.Map attrs)
          Test if the attributes are annotation or component attributes.
 org.zkoss.zk.ui.Component getComponent()
          Returns the component associated with this tag.
 org.zkoss.zk.ui.Component[] getComponents()
          a dummy method of getComponent()
 java.lang.String getForward()
          Returns the forward condition that controls how to forward an event, that is received by the component created by this info, to another component.
protected abstract  java.lang.String getJspTagName()
          The name of Jsp Tag.
 ComponentTag getParentTag()
          Returns the parent tag.
 RootTag getRootTag()
          Returns the page tag that this tag belongs to.
 java.lang.String getUse()
          Returns the class name that is used to implement the component associated with this tag.
 boolean isInline()
          default Tag's Component is not an inline macro.
 void setDynamicAttribute(java.lang.String uri, java.lang.String localName, java.lang.Object value)
          Called when a tag declared to accept dynamic attributes is passed an attribute that is not declared in the Tag Library Descriptor.
 void setForward(java.lang.String forward)
          Sets the forward condition that controls when to forward an event receiving by this component to another component.
 void setParent(javax.servlet.jsp.tagext.JspTag parent)
          Sets the parent tag.
 void setUse(java.lang.String use)
          Sets the class name that is used to implement the component associated with this tag.
 
Methods inherited from class org.zkoss.jsp.zul.impl.AbstractTag
getIf, getUnless, isEffective, setIf, setUnless
 
Methods inherited from class javax.servlet.jsp.tagext.SimpleTagSupport
findAncestorWithClass, getJspBody, getJspContext, getParent, setJspBody, setJspContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.zkoss.jsp.zul.impl.ComponentTag
addChildTag
 

Field Detail

_comp

protected org.zkoss.zk.ui.Component _comp

_roottag

protected RootTag _roottag

_parenttag

protected ComponentTag _parenttag

_attrMap

protected java.util.Map _attrMap

_eventListenerMap

protected java.util.Map _eventListenerMap

_use

protected java.lang.String _use

_forward

protected java.lang.String _forward

composeHandle

protected ComposerHandler composeHandle
Constructor Detail

LeafTag

public LeafTag()
Method Detail

getRootTag

public RootTag getRootTag()
Returns the page tag that this tag belongs to.

Specified by:
getRootTag in interface ComponentTag
Returns:
the page tag that this tag belongs to.

getParentTag

public ComponentTag getParentTag()
Returns the parent tag.

Specified by:
getParentTag in interface ComponentTag
Returns:
the parent tag.

getComponent

public org.zkoss.zk.ui.Component getComponent()
Returns the component associated with this tag.

Specified by:
getComponent in interface ComponentTag
Returns:
the component associated with this tag.

getJspTagName

protected abstract java.lang.String getJspTagName()
The name of Jsp Tag.


setParent

public void setParent(javax.servlet.jsp.tagext.JspTag parent)
Sets the parent tag. Deriving class rarely need to invoke this method.

Specified by:
setParent in interface javax.servlet.jsp.tagext.SimpleTag
Overrides:
setParent in class javax.servlet.jsp.tagext.SimpleTagSupport

doTag

public void doTag()
           throws javax.servlet.jsp.JspException,
                  java.io.IOException
To process the leaf tag. The deriving class rarely need to override this method.

Specified by:
doTag in interface javax.servlet.jsp.tagext.SimpleTag
Overrides:
doTag in class javax.servlet.jsp.tagext.SimpleTagSupport
Throws:
javax.servlet.jsp.JspException
java.io.IOException

evaluateDynaAttributes

public void evaluateDynaAttributes(org.zkoss.zk.ui.Component target,
                                   java.util.Map attrs)
                            throws org.zkoss.util.ModificationException,
                                   java.lang.NoSuchMethodException
Test if the attributes are annotation or component attributes.
If(is Component attributes)Invokes setter methods to update all assigned attributes. If(is annotations)

Parameters:
target - the target component
attrs -
Throws:
org.zkoss.util.ModificationException
java.lang.NoSuchMethodException

setDynamicAttribute

public void setDynamicAttribute(java.lang.String uri,
                                java.lang.String localName,
                                java.lang.Object value)
                         throws javax.servlet.jsp.JspException
Called when a tag declared to accept dynamic attributes is passed an attribute that is not declared in the Tag Library Descriptor.

Specified by:
setDynamicAttribute in interface javax.servlet.jsp.tagext.DynamicAttributes
Parameters:
uri - the namespace of the attribute, always null currently.
localName - the name of the attribute being set.
value - the value of the attribute
Throws:
javax.servlet.jsp.JspException

getUse

public java.lang.String getUse()
Returns the class name that is used to implement the component associated with this tag.

Default: null

Returns:
the class name used to implement the component, or null to use the default

setUse

public void setUse(java.lang.String use)
Sets the class name that is used to implement the component associated with this tag.

Parameters:
use - the class name used to implement the component, or null to use the default

getForward

public java.lang.String getForward()
Returns the forward condition that controls how to forward an event, that is received by the component created by this info, to another component.

Default: null.

If not null, when the component created by this info receives the event specified in the forward condition, it will forward it to the target component, which is also specified in the forward condition.

See Also:
setForward(java.lang.String)

setForward

public void setForward(java.lang.String forward)
Sets the forward condition that controls when to forward an event receiving by this component to another component.

The basic format:
onEvent1=id1/id2.onEvent2

It means when onEvent1 is received, onEvent2 will be posted to the component with the specified path (id1/id2).

If onEvent1 is omitted, it is assumed to be onClick (and the equal sign need not to be specified. If the path is omitted, it is assumed to be the space owner Component.getSpaceOwner().

For example, "onOK" means "onClick=onOK".

You can specify several forward conditions by separating them with comma as follows:

onChanging=onChanging,onChange=onUpdate,onOK

Parameters:
forward - the forward condition. There are several forms: "onEvent1", "target.onEvent1" and "onEvent1(target.onEvent2)", where target could be "id", "id1/id2" or "${elExpr}". The EL expression must return either a path or a reference to a component.

isInline

public boolean isInline()
default Tag's Component is not an inline macro.

Specified by:
isInline in interface ComponentTag

getComponents

public org.zkoss.zk.ui.Component[] getComponents()
a dummy method of getComponent()

Specified by:
getComponents in interface ComponentTag
Returns:
the inline macro will return mulitple Components.


Copyright © 2005-2007 Potix Corporation. All Rights Reserved.