com.taggercat.tags
Class DataSourceActionLinkTag

java.lang.Object
  extended by javax.servlet.jsp.tagext.TagSupport
      extended by com.taggercat.tags.AbstractExpEvalTag
          extended by com.taggercat.tags.AbstractDataSourceActionTag
              extended by com.taggercat.tags.DataSourceActionLinkTag
All Implemented Interfaces:
com.taggercat.el.ELPropertyResolver, java.io.Serializable, javax.servlet.jsp.tagext.IterationTag, javax.servlet.jsp.tagext.JspTag, javax.servlet.jsp.tagext.Tag

public class DataSourceActionLinkTag
extends AbstractDataSourceActionTag

This tag dynamically creates a link ( as an anchor tag with an href attribute ) used for data source operations and other user defined events. The link is enabled only if the user has permission to perform the specified action on the named data source.

An expression can be set in the condition attribute for additional checks to determine if the link should be enabled. The link will usually have an href event handler. The href event handler can be any href expression. However, it will usually be of the form:

 <a href="javascript:dsOperation( document.form1,'{0}','{1}','/CustomerDetails.jsp','/CustomerDetails.jsp')">Add&nbsp;Customer</a>
 

The generated href method will be:

 <a href="javascript:dsOperation( document.form1,'customer','insert','/CustomerDetails.jsp','/CustomerDetails.jsp')">Add&nbsp;Customer</a>
 

The link will be enabled based on the following validation checks:

  1. A known action is being applied to a data source and the data source state is valid. For example, a delete action is only valid when the data source has rows.
  2. A known action is being applied to a data source and the user has permission for that action.
  3. If there is a condition expression, and that condition expression evaluates to true.
  4. If the action is unknown, and there is a condition expression, and that condition expression evaluates to true.

Known actions are:

There are four placeholders that you can use in your href handler. They are:

  1. {0} - the data source name
  2. {1} - the action name
  3. {2} - the response page
  4. {3} - the error page

You don't need to use the dsn, and action names in your href. For example you could use an href like.

 <a href="javascript:myAppOperations( document.form1,'{0}','placeOrder','/CustomerDetails.jsp','/CustomerDetails.jsp')">Place&nbsp;Order</a>
 

The showDisabled attribute can be used to control if the link is shown in a disabled state, or not shown at all for invalid actions. The default is to show the link in a disabled state by displaying it as simple text and using the disabledCaption if one has been set. By setting showDisabled="false", the link will not be shown for invalid actions.

See Also:
Serialized Form
 

Field Summary
 
Fields inherited from interface javax.servlet.jsp.tagext.IterationTag
EVAL_BODY_AGAIN
 
Fields inherited from interface javax.servlet.jsp.tagext.Tag
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE
 
Constructor Summary
DataSourceActionLinkTag()
           
 
Method Summary
 int doEndTag()
          Reset the state of the tag.
 java.lang.String getCaption()
          Gets the caption.
 java.lang.String getCharset()
          Gets the charset.
 java.lang.String getCoords()
          Gets the coords.
 java.lang.String getDisabledCaption()
          Gets the caption used when the link is disabled.
 java.lang.String getDisabledStyleclass()
          Gets the css style class to used then the link is disabled.
 java.lang.String getHref()
          Gets the href.
 java.lang.String getHreflang()
          Gets the hreflang.
 java.lang.String getMethod()
          Gets the method.
 java.lang.String getTarget()
          Gets the target.
 java.lang.String getType()
          Gets the type.
 void setCaption(java.lang.String caption)
          Sets the anchor caption.
 void setCharset(java.lang.String charset)
          Sets the charset attribute.
 void setCoords(java.lang.String coords)
          Sets the coords attribute.
 void setDisabledCaption(java.lang.String disabledCaption)
          Sets the caption when the action is not valid, and therefore disabled.
 void setDisabledStyleclass(java.lang.String disabledStyleclass)
          Sets the CSS Style class to use of the action is disabled.
 void setHref(java.lang.String href)
          Sets the href attribute.
 void setHreflang(java.lang.String hreflang)
          Sets the hreflang attribute.
 void setMethod(java.lang.String method)
          Sets the method attribute.
 void setTarget(java.lang.String target)
          Sets the target attribute.
 void setType(java.lang.String type)
          Sets the type attribute.
 java.lang.String toString()
          Gets the string representation of this object.
 
Methods inherited from class com.taggercat.tags.AbstractDataSourceActionTag
addBaseAttributes, addBaseEnabledAttributes, doStartTag, getAccesskey, getAction, getCondition, getDisabled, getDsn, getErrorPage, getName, getOnblur, getOnclick, getOndblclick, getOnfocus, getOnkeydown, getOnkeypress, getOnkeyup, getOnmousedown, getOnmousemove, getOnmouseout, getOnmouseover, getOnmouseup, getResponsePage, getStandardPlaceholdersMap, getStyle, getStyleclass, getStyleid, getTabindex, getTitle, getValue, isShowDisabled, isXHTMLTag, setAccesskey, setAction, setCondition, setDisabled, setDsn, setErrorPage, setName, setOnblur, setOnclick, setOndblclick, setOnfocus, setOnkeydown, setOnkeypress, setOnkeyup, setOnmousedown, setOnmousemove, setOnmouseout, setOnmouseover, setOnmouseup, setResponsePage, setShowDisabled, setStyle, setStyleclass, setStyleid, setTabindex, setTitle, setValue
 
Methods inherited from class com.taggercat.tags.AbstractExpEvalTag
getModel, resolveProperty, setScope, setVar
 
Methods inherited from class javax.servlet.jsp.tagext.TagSupport
doAfterBody, findAncestorWithClass, getId, getParent, getValue, getValues, release, removeValue, setId, setPageContext, setParent, setValue
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DataSourceActionLinkTag

public DataSourceActionLinkTag()
Method Detail

doEndTag

public int doEndTag()
             throws javax.servlet.jsp.JspException
Reset the state of the tag.

Specified by:
doEndTag in interface javax.servlet.jsp.tagext.Tag
Overrides:
doEndTag in class AbstractDataSourceActionTag
Throws:
javax.servlet.jsp.JspException
Returns:
EVAL_PAGE

getCaption

public java.lang.String getCaption()
Gets the caption.

Returns:
the caption

getCharset

public java.lang.String getCharset()
Gets the charset.

Returns:
the charset

getCoords

public java.lang.String getCoords()
Gets the coords.

Returns:
the coords

getHref

public java.lang.String getHref()
Gets the href.

Returns:
the href

getHreflang

public java.lang.String getHreflang()
Gets the hreflang.

Returns:
the hreflang

getMethod

public java.lang.String getMethod()
Gets the method.

Returns:
the method

getTarget

public java.lang.String getTarget()
Gets the target.

Returns:
the target

getType

public java.lang.String getType()
Gets the type.

Returns:
the type

setCaption

public void setCaption(java.lang.String caption)
Sets the anchor caption.

Parameters:
caption - the caption value.

setCharset

public void setCharset(java.lang.String charset)
Sets the charset attribute.

Parameters:
charset - the new charset value.

setCoords

public void setCoords(java.lang.String coords)
Sets the coords attribute.

Parameters:
coords - the new coords value.

setDisabledCaption

public void setDisabledCaption(java.lang.String disabledCaption)
Sets the caption when the action is not valid, and therefore disabled. This attribute is optional, and if not specified then the action name is used.

Parameters:
disabledCaption - the caption to use if the link is disabled.

setDisabledStyleclass

public void setDisabledStyleclass(java.lang.String disabledStyleclass)
Sets the CSS Style class to use of the action is disabled.

Parameters:
disabledStyleclass - the disabled style class

setHref

public void setHref(java.lang.String href)
Sets the href attribute.

Parameters:
href - the new href value.

setHreflang

public void setHreflang(java.lang.String hreflang)
Sets the hreflang attribute.

Parameters:
hreflang - the new hreflang value.

setMethod

public void setMethod(java.lang.String method)
Sets the method attribute.

Parameters:
method - the new method value.

setTarget

public void setTarget(java.lang.String target)
Sets the target attribute.

Parameters:
target - the new target value.

setType

public void setType(java.lang.String type)
Sets the type attribute.

Parameters:
type - the new type value.

getDisabledCaption

public java.lang.String getDisabledCaption()
Gets the caption used when the link is disabled.

Returns:
the disabled caption

getDisabledStyleclass

public java.lang.String getDisabledStyleclass()
Gets the css style class to used then the link is disabled.

Returns:
the disabled CSS style class

toString

public java.lang.String toString()
Gets the string representation of this object.

Overrides:
toString in class java.lang.Object
Returns:
a listing of this tag's attributes