org.zkoss.web.servlet.dsp.action
Class AbstractAction

java.lang.Object
  extended by org.zkoss.web.servlet.dsp.action.AbstractAction
All Implemented Interfaces:
Action
Direct Known Subclasses:
Box, Choose, ForEach, If, Img, Include, Otherwise, Out, Page, Remove, Set, When

public abstract class AbstractAction
extends java.lang.Object
implements Action

A skeletal implementation to simplify the implementation of actions.

Author:
tomyeh

Field Summary
protected static int NULL_INT
          A special integer to denote no attribute is assigned.
protected static short NULL_SHORT
          A special short to denote no attribute is assigned.
 
Constructor Summary
AbstractAction()
           
 
Method Summary
protected static void append(java.lang.StringBuffer sb, java.lang.String attrName, boolean avail)
          Appends an attribute to the string buffer, if avail is true.
protected static void append(java.lang.StringBuffer sb, java.lang.String attrName, int val)
          Appends an attribute to the string buffer, if val is not NULL_INT.
protected static void append(java.lang.StringBuffer sb, java.lang.String attrName, java.lang.String attrValue)
          Appends an attribute to the string buffer, if attrValue is not null.
 boolean getIf()
          Returns the if condition.
 boolean getUnless()
          Returns the unless condition.
 boolean isEffective()
          Returns whether this tag is effecive.
protected static void put(java.util.Map params, java.lang.String attrName, boolean avail)
          Puts an attribute to the map.
protected static void put(java.util.Map params, java.lang.String attrName, int val)
          Puts an attribute to the map, if val is not NULL_INT.
protected static void put(java.util.Map params, java.lang.String attrName, java.lang.Object attrValue)
          Puts an object if it is not null.
protected static void put(java.util.Map params, java.lang.String attrName, java.lang.String attrValue)
          Puts an attribute to the map, if attrValue is not null.
 void setIf(boolean ifcond)
          Sets the if condition.
 void setUnless(boolean unless)
          Sets the unless condition.
protected static int toScope(java.lang.String scope)
          Returns one of ActionContext.PAGE_SCOPE, ActionContext.REQUEST_SCOPE, ActionContext.SESSION_SCOPE and ActionContext.APPLICATION_SCOPE of the specified scope name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.zkoss.web.servlet.dsp.action.Action
render
 

Field Detail

NULL_INT

protected static final int NULL_INT
A special integer to denote no attribute is assigned.

See Also:
Constant Field Values

NULL_SHORT

protected static final short NULL_SHORT
A special short to denote no attribute is assigned.

See Also:
Constant Field Values
Constructor Detail

AbstractAction

public AbstractAction()
Method Detail

getIf

public boolean getIf()
Returns the if condition. If the if condition is false, this tag is ignored. If the unless condition (getUnless()) is true, this tag is ignored, too. Tags deriving from this class shall invoke isEffective() to know the result.

Default: true.


setIf

public void setIf(boolean ifcond)
Sets the if condition.


getUnless

public boolean getUnless()
Returns the unless condition. If the unless condition is true, this tag is ignored. If the if condition (getIf()) is true, this tag is ignored, too. Tags deriving from this class shall invoke isEffective() to know the result.

Default: false.


setUnless

public void setUnless(boolean unless)
Sets the unless condition.


isEffective

public boolean isEffective()
Returns whether this tag is effecive. If false, this tag does nothing (as if not specified at all).


toScope

protected static final int toScope(java.lang.String scope)
Returns one of ActionContext.PAGE_SCOPE, ActionContext.REQUEST_SCOPE, ActionContext.SESSION_SCOPE and ActionContext.APPLICATION_SCOPE of the specified scope name.

Parameters:
scope - one of "page", "request", "session" and "application".

put

protected static final void put(java.util.Map params,
                                java.lang.String attrName,
                                java.lang.String attrValue)
Puts an attribute to the map, if attrValue is not null.


put

protected static final void put(java.util.Map params,
                                java.lang.String attrName,
                                boolean avail)
Puts an attribute to the map. Unlike othere put(...), it always puts the specified attribute.


put

protected static final void put(java.util.Map params,
                                java.lang.String attrName,
                                int val)
Puts an attribute to the map, if val is not NULL_INT.


put

protected static final void put(java.util.Map params,
                                java.lang.String attrName,
                                java.lang.Object attrValue)
Puts an object if it is not null.


append

protected static final void append(java.lang.StringBuffer sb,
                                   java.lang.String attrName,
                                   java.lang.String attrValue)
Appends an attribute to the string buffer, if attrValue is not null.


append

protected static void append(java.lang.StringBuffer sb,
                             java.lang.String attrName,
                             boolean avail)
Appends an attribute to the string buffer, if avail is true.


append

protected static final void append(java.lang.StringBuffer sb,
                                   java.lang.String attrName,
                                   int val)
Appends an attribute to the string buffer, if val is not NULL_INT.



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