com.taggercat.tags
Class AbstractDataSourceActionTag

java.lang.Object
  extended by javax.servlet.jsp.tagext.TagSupport
      extended by com.taggercat.tags.AbstractExpEvalTag
          extended by com.taggercat.tags.AbstractDataSourceActionTag
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
Direct Known Subclasses:
DataSourceActionButtonTag, DataSourceActionLinkTag

public abstract class AbstractDataSourceActionTag
extends AbstractExpEvalTag

This tag dynamically creates a HTML button or link element. The Button/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 button should be enabled.

The button/Link will usually have an onClick event handler. The onClick event handler can be any JavaScript expression. However, it will usually be of the form:

 onClick="dsOperation(this.form, '{dsn}','{action}', '/order_detail.jsp', '/error_general.jsp');"
 

The generated onClick method will be:

 onClick="dsOperation(this.form, 'orderitems','insert', '/order_detail.jsp', '/error_general.jsp');"
 

The button/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, delete can only be valid when 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 onClick handler. They are:

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

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
AbstractDataSourceActionTag()
           
 
Method Summary
 void addBaseAttributes(HTMLTagBuilder htmlTag)
          Fills in the base attributes that are common to both buttons and anchor tags.
 void addBaseEnabledAttributes(HTMLTagBuilder htmlTag)
          Fills in the base attributes that are common to both buttons and anchor tags.
 int doEndTag()
          Reset the state of the tag.
 int doStartTag()
          Creates the button / link element, and its onClick event handler.
 java.lang.String getAccesskey()
          Gets the access key.
 java.lang.String getAction()
          Gets the action name.
 java.lang.String getCondition()
          Gets additional enabled condition.
 boolean getDisabled()
          Gets the disabled state.
 java.lang.String getDsn()
          Gets the data soruce name.
 java.lang.String getErrorPage()
          Gets the errorPage name.
 java.lang.String getName()
          Gets the buttons name.
 java.lang.String getOnblur()
          Gets the onblur javascript event handler.
 java.lang.String getOnclick()
          Gets the onclick javascript event handler.
 java.lang.String getOndblclick()
          Gets the onfocus javascript event handler.
 java.lang.String getOnfocus()
          Gets the onfocus javascript event handler.
 java.lang.String getOnkeydown()
          Gets the onkeydown javascript event handler.
 java.lang.String getOnkeypress()
          Gets the onkeypress javascript event handler.
 java.lang.String getOnkeyup()
          Gets the onkeyup javascript event handler.
 java.lang.String getOnmousedown()
          Gets the onmousedown javascript event handler.
 java.lang.String getOnmousemove()
          Gets the onmousemove javascript event handler.
 java.lang.String getOnmouseout()
          Gets the onmouseout javascript event handler.
 java.lang.String getOnmouseover()
          Gets the onmouseover javascript event handler.
 java.lang.String getOnmouseup()
          Gets the onmouseup javascript event handler.
 java.lang.String getResponsePage()
          Gets the name of the response page.
 java.util.Map<java.lang.String,java.lang.Object> getStandardPlaceholdersMap()
          Returns a map of the standard action element placeholders
 java.lang.String getStyle()
          Gets the CSS Style.
 java.lang.String getStyleclass()
          Gets the CSS style class.
 java.lang.String getStyleid()
          Gets the CSS Style ID.
 java.lang.String getTabindex()
          Gets the tab index.
 java.lang.String getTitle()
          Gets the title attribute.
 java.lang.String getValue()
          Gets the value attribute.
 boolean isShowDisabled()
          Controls if the element should be shown when the action is disabled, or not shown at all.
static java.lang.Boolean isXHTMLTag()
           
 void setAccesskey(java.lang.String accesskey)
          Sets the accesskey attribute.
 void setAction(java.lang.String action)
          Sets the action name.
 void setCondition(java.lang.String condition)
          Sets the condition attribute.
 void setDisabled(boolean disabled)
          Sets the disabled attribute.
 void setDsn(java.lang.String dsn)
          Set the name of the data source this field is a member of.
 void setErrorPage(java.lang.String errorPage)
          Sets the error page.
 void setName(java.lang.String name)
          Sets the name attribute.
 void setOnblur(java.lang.String onblur)
          Sets the onblur attribute.
 void setOnclick(java.lang.String onclick)
          Sets the onclick attribute.
 void setOndblclick(java.lang.String ondblclick)
          Sets the ondblclick attribute.
 void setOnfocus(java.lang.String onfocus)
          Sets the onfocus attribute.
 void setOnkeydown(java.lang.String onkeydown)
          Sets the onkeydown attribute.
 void setOnkeypress(java.lang.String onkeypress)
          Sets the onkeypress attribute.
 void setOnkeyup(java.lang.String onkeyup)
          Sets the onkeyup attribute.
 void setOnmousedown(java.lang.String onmousedown)
          Sets the onmousedown attribute.
 void setOnmousemove(java.lang.String onmousemove)
          Sets the onmousemove attribute.
 void setOnmouseout(java.lang.String onmouseout)
          Sets the onmouseout attribute.
 void setOnmouseover(java.lang.String onmouseover)
          Sets the onmouseover attribute.
 void setOnmouseup(java.lang.String onmouseup)
          Sets the onmouseup attribute.
 void setResponsePage(java.lang.String responsePage)
          Sets the response page.
 void setShowDisabled(boolean showDisabled)
          Sets the show disabled attribute.
 void setStyle(java.lang.String style)
          Sets the CSS style attribute.
 void setStyleclass(java.lang.String styleclass)
          Sets the CSS style class attribute.
 void setStyleid(java.lang.String styleid)
          Sets the CSS styleid attribute.
 void setTabindex(java.lang.String tabindex)
          Sets the tabindex attribute.
 void setTitle(java.lang.String title)
          Sets the title attribute.
 void setValue(java.lang.String value)
          Sets the value attribute.
 
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, toString, wait, wait, wait
 

Constructor Detail

AbstractDataSourceActionTag

public AbstractDataSourceActionTag()
Method Detail

addBaseAttributes

public void addBaseAttributes(HTMLTagBuilder htmlTag)
Fills in the base attributes that are common to both buttons and anchor tags.

Parameters:
htmlTag - the html tag to add to

addBaseEnabledAttributes

public void addBaseEnabledAttributes(HTMLTagBuilder htmlTag)
Fills in the base attributes that are common to both buttons and anchor tags.

Parameters:
htmlTag - the html tag to the enabled attributes to

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 AbstractExpEvalTag
Throws:
javax.servlet.jsp.JspException
Returns:
Tag.EVAL_PAGE

doStartTag

public int doStartTag()
               throws javax.servlet.jsp.JspException
Creates the button / link element, and its onClick event handler. The onClick event handler can be any JavaScript function. However, it will usually be of the form:
 onClick="dsOperation(this.form, '{0}','{1}', '/order_detail.jsp', '/error_general.jsp');"
 
The generated onClick method will be:
 onClick="dsOperation(this.form, 'orderitems','insert', '/order_detail.jsp', '/error_general.jsp');"
 

The button 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, delete can only be valid when 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 onClick handler. They are:

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

Specified by:
doStartTag in interface javax.servlet.jsp.tagext.Tag
Overrides:
doStartTag in class AbstractExpEvalTag
Throws:
javax.servlet.jsp.JspException
Returns:
SKIP_BODY

getStandardPlaceholdersMap

public java.util.Map<java.lang.String,java.lang.Object> getStandardPlaceholdersMap()
Returns a map of the standard action element placeholders

Returns:
a map of the standard action element placeholders

getAccesskey

public java.lang.String getAccesskey()
Gets the access key.

Returns:
the access key

getAction

public java.lang.String getAction()
Gets the action name.

Returns:
the ds action name this element invokes

getCondition

public java.lang.String getCondition()
Gets additional enabled condition.

Returns:
additional enabled condition

getDisabled

public boolean getDisabled()
Gets the disabled state.

Returns:
the disabled state

getDsn

public java.lang.String getDsn()
Gets the data soruce name.

Returns:
the name of the data source the operation applies to

getErrorPage

public java.lang.String getErrorPage()
Gets the errorPage name.

Returns:
the name of the error page

getName

public java.lang.String getName()
Gets the buttons name.

Returns:
the buttons name

getOnblur

public java.lang.String getOnblur()
Gets the onblur javascript event handler.

Returns:
the onblur javascript event handler

getOnclick

public java.lang.String getOnclick()
Gets the onclick javascript event handler.

Returns:
the onclick javascript event handler

getOndblclick

public java.lang.String getOndblclick()
Gets the onfocus javascript event handler.

Returns:
the onfocus javascript event handler

getOnfocus

public java.lang.String getOnfocus()
Gets the onfocus javascript event handler.

Returns:
the onfocus javascript event handler

getOnkeydown

public java.lang.String getOnkeydown()
Gets the onkeydown javascript event handler.

Returns:
the onkeydown javascript event handler

getOnkeypress

public java.lang.String getOnkeypress()
Gets the onkeypress javascript event handler.

Returns:
the onkeypress javascript event handler

getOnkeyup

public java.lang.String getOnkeyup()
Gets the onkeyup javascript event handler.

Returns:
the onkeyup javascript event handler

getOnmousedown

public java.lang.String getOnmousedown()
Gets the onmousedown javascript event handler.

Returns:
the onmousedown javascript event handler

getOnmousemove

public java.lang.String getOnmousemove()
Gets the onmousemove javascript event handler.

Returns:
the onmousemove javascript event handler

getOnmouseout

public java.lang.String getOnmouseout()
Gets the onmouseout javascript event handler.

Returns:
the onmouseout javascript event handler

getOnmouseover

public java.lang.String getOnmouseover()
Gets the onmouseover javascript event handler.

Returns:
the onmouseover javascript event handler

getOnmouseup

public java.lang.String getOnmouseup()
Gets the onmouseup javascript event handler.

Returns:
the onmouseup javascript event handler

getResponsePage

public java.lang.String getResponsePage()
Gets the name of the response page.

Returns:
the name of the response page

getStyle

public java.lang.String getStyle()
Gets the CSS Style.

Returns:
the name of the CSS Style

getStyleclass

public java.lang.String getStyleclass()
Gets the CSS style class.

Returns:
the name of the CSS style class

getStyleid

public java.lang.String getStyleid()
Gets the CSS Style ID.

Returns:
the CSS style ID

getTabindex

public java.lang.String getTabindex()
Gets the tab index.

Returns:
the tab index

getTitle

public java.lang.String getTitle()
Gets the title attribute.

Returns:
the title set for the element

getValue

public java.lang.String getValue()
Gets the value attribute.

Returns:
the value used for the element

isShowDisabled

public boolean isShowDisabled()
Controls if the element should be shown when the action is disabled, or not shown at all.

Returns:
true if the element should be shown when it is disabled.

setAccesskey

public void setAccesskey(java.lang.String accesskey)
Sets the accesskey attribute.

Parameters:
accesskey - the new accesskey value

setAction

public void setAction(java.lang.String action)
Sets the action name.

Parameters:
action - The action name

setCondition

public void setCondition(java.lang.String condition)
Sets the condition attribute.

Parameters:
condition - the new condition value

setDisabled

public void setDisabled(boolean disabled)
Sets the disabled attribute.

Parameters:
disabled - the new disabled value

setDsn

public void setDsn(java.lang.String dsn)
Set the name of the data source this field is a member of.

Parameters:
dsn - the data source name

setErrorPage

public void setErrorPage(java.lang.String errorPage)
Sets the error page. This can be references with a {3} placeholder within the javascript handler.

Parameters:
errorPage - the resulting errorPage page

setName

public void setName(java.lang.String name)
Sets the name attribute.

Parameters:
name - the new name value

setOnblur

public void setOnblur(java.lang.String onblur)
Sets the onblur attribute.

Parameters:
onblur - the new onblur value

setOnclick

public void setOnclick(java.lang.String onclick)
Sets the onclick attribute.

Parameters:
onclick - the new onclick value

setOndblclick

public void setOndblclick(java.lang.String ondblclick)
Sets the ondblclick attribute.

Parameters:
ondblclick - the new ondblclick value

setOnfocus

public void setOnfocus(java.lang.String onfocus)
Sets the onfocus attribute.

Parameters:
onfocus - the new onfocus value

setOnkeydown

public void setOnkeydown(java.lang.String onkeydown)
Sets the onkeydown attribute.

Parameters:
onkeydown - the new onkeydown value

setOnkeypress

public void setOnkeypress(java.lang.String onkeypress)
Sets the onkeypress attribute.

Parameters:
onkeypress - the new onkeypress value

setOnkeyup

public void setOnkeyup(java.lang.String onkeyup)
Sets the onkeyup attribute.

Parameters:
onkeyup - the new onkeyup value

setOnmousedown

public void setOnmousedown(java.lang.String onmousedown)
Sets the onmousedown attribute.

Parameters:
onmousedown - the new onmousedown value

setOnmousemove

public void setOnmousemove(java.lang.String onmousemove)
Sets the onmousemove attribute.

Parameters:
onmousemove - the new onmousemove value

setOnmouseout

public void setOnmouseout(java.lang.String onmouseout)
Sets the onmouseout attribute.

Parameters:
onmouseout - the new onmouseout value

setOnmouseover

public void setOnmouseover(java.lang.String onmouseover)
Sets the onmouseover attribute.

Parameters:
onmouseover - the new onmouseover value

setOnmouseup

public void setOnmouseup(java.lang.String onmouseup)
Sets the onmouseup attribute.

Parameters:
onmouseup - the new onmouseup value

setResponsePage

public void setResponsePage(java.lang.String responsePage)
Sets the response page. This can be references with a {2} placeholder within the javascript handler.

Parameters:
responsePage - the resulting response page, usually the current page

setShowDisabled

public void setShowDisabled(boolean showDisabled)
Sets the show disabled attribute. If it is set to true, then disabled option elements will be displayed. The default is true.

Parameters:
showDisabled - the new disabled value

setStyle

public void setStyle(java.lang.String style)
Sets the CSS style attribute.

Parameters:
style - the new style value

setStyleclass

public void setStyleclass(java.lang.String styleclass)
Sets the CSS style class attribute.

Parameters:
styleclass - the new styleclass value

setStyleid

public void setStyleid(java.lang.String styleid)
Sets the CSS styleid attribute.

Parameters:
styleid - the new styleid value

setTabindex

public void setTabindex(java.lang.String tabindex)
Sets the tabindex attribute.

Parameters:
tabindex - the new tabindex value

setTitle

public void setTitle(java.lang.String title)
Sets the title attribute.

Parameters:
title - the new title value

setValue

public void setValue(java.lang.String value)
Sets the value attribute.

Overrides:
setValue in class AbstractExpEvalTag
Parameters:
value - the new value

isXHTMLTag

public static java.lang.Boolean isXHTMLTag()