com.taggercat.tags
Class DataSourceActionButtonTag

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.DataSourceActionButtonTag
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 DataSourceActionButtonTag
extends AbstractDataSourceActionTag

This tag dynamically creates a HTML button. The button 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 will usually have an onClick event handler. The onClick event handler can be any JavaScript expression. However, it will usually be of the form:

<tc:actionButton value="Basic Chart" action="newBasicChart" dsn="UserChart" onclick="tc.submitRequest( document.form1,'{dsn}','{action}')" title="Create a new basic Pie Chart." /> &nbsp; <tc:actionButton value="Project Stats Time Series" action="newStatsTimeSeriesChart" dsn="UserChart" onclick="tc.submitRequest( document.form1,'{dsn}','{action}')" title="Create a new Project Time Series Chart for Stats." /> &nbsp; <tc:actionButton value="Project Time Series by Status" action="newStatusTimeSeriesChart" dsn="UserChart" onclick="tc.submitRequest( document.form1,'{dsn}','{action}')" title="Create a new Project Time Series Chart by Status." /> &nbsp; <tc:actionButton value="Project Time Series by Phase" action="newPhaseTimeSeriesChart" dsn="UserChart" onclick="tc.submitRequest( document.form1,'{dsn}','{action}')" title="Create a new Project Time Series Chart by Phase." /> &nbsp; <tc:actionButton value="Refresh All Charts" action="updateAllCharts" dsn="UserChart" onclick="tc.submitRequest( document.form1,'{dsn}','{action}')" title="Refresh all charts." />

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, 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.
  5. If the action is a custom action and it includes an ActionPermission annotation, and the user is in one of the specified groups.

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

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

 onClick="myAppOperations(this.form, 'placeOrder');"
 

The showDisabled attribute can be used to control if the button is shown in a disabled state, or not shown at all for invalid actions. The default is to show the button in a disabled state. By setting showDisabled="false", the button 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
DataSourceActionButtonTag()
           
 
Method Summary
 int doEndTag()
          Resets the state of the tag.
 java.lang.String getAlt()
          Gets the alt image text.
 java.lang.String getHeight()
          Gets the height attribute.
 java.lang.String getOnselect()
          Gets the onselect javascript event handler.
 java.lang.String getSrc()
          Gets the source for images.
 java.lang.String getWidth()
          Gets the width attribute.
 void setAlt(java.lang.String alt)
          Sets the alt attribute.
 void setHeight(java.lang.String height)
          Sets the height attribute.
 void setOnselect(java.lang.String onselect)
          Sets the onselect attribute.
 void setSrc(java.lang.String src)
          Sets the src attribute.
 void setWidth(java.lang.String width)
          Sets the width attribute.
 
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, toString, wait, wait, wait
 

Constructor Detail

DataSourceActionButtonTag

public DataSourceActionButtonTag()
Method Detail

doEndTag

public int doEndTag()
             throws javax.servlet.jsp.JspException
Resets 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

getAlt

public java.lang.String getAlt()
Gets the alt image text.

Returns:
the alt image text

getHeight

public java.lang.String getHeight()
Gets the height attribute.

Returns:
the height

getOnselect

public java.lang.String getOnselect()
Gets the onselect javascript event handler.

Returns:
the onselect javascript event handler

getSrc

public java.lang.String getSrc()
Gets the source for images.

Returns:
the source for images

getWidth

public java.lang.String getWidth()
Gets the width attribute.

Returns:
the width

setAlt

public void setAlt(java.lang.String alt)
Sets the alt attribute.

Parameters:
alt - the new alt value

setHeight

public void setHeight(java.lang.String height)
Sets the height attribute.

Parameters:
height - the height attribute

setOnselect

public void setOnselect(java.lang.String onselect)
Sets the onselect attribute.

Parameters:
onselect - the new onselect value

setSrc

public void setSrc(java.lang.String src)
Sets the src attribute.

Parameters:
src - the new src value

setWidth

public void setWidth(java.lang.String width)
Sets the width attribute.

Parameters:
width - the width attribute