com.cc.framework.taglib.controls
Class BaseControlTag

java.lang.Object
  extended byjavax.servlet.jsp.tagext.TagSupport
      extended bycom.cc.framework.taglib.ScriptTagSupport
          extended bycom.cc.framework.taglib.controls.BaseControlTag
All Implemented Interfaces:
AjaxSupportTag, DesignRuleContainerTag, javax.servlet.jsp.tagext.IterationTag, javax.servlet.jsp.tagext.JspTag, ScriptSupport, java.io.Serializable, javax.servlet.jsp.tagext.Tag
Direct Known Subclasses:
ButtonTag, CheckboxGroupTag, CheckboxTag, ComboBoxTag, CrumbsTag, FormTag, FrameTag, GaugeTag, HeadlineTag, InfoTag, ListTag, MenuButtonTag, MenuTag, MessageTag, PanelTag, RatingTag, RecurrencePatternTag, SchedulerTag, SelectTag, SwapSelectTag, TabbarTag, TextareaTag, TextListTag, TextTag, TreelistTag, TreeSwapSelectTag, TreeTag

public abstract class BaseControlTag
extends ScriptTagSupport
implements DesignRuleContainerTag, AjaxSupportTag

Base class for control tag handler

Since:
1.0
Version:
$Revision: 1.54 $
Author:
Harald Schulz
See Also:
Serialized Form

Field Summary
private  Control control
          The Control instance
private  ControlDesignModel designModel
          The controls design model
private  java.lang.Object directValue
          A direct set value
protected  org.apache.commons.logging.Log log
          Commons Logging instance.
private  ControlPainter painter
          The painter, which is responsible to render the control
private  HttpScope scope
          The scope of the bean containing our underlying property.
private static long serialVersionUID
          Serial Version UID
 
Fields inherited from class javax.servlet.jsp.tagext.TagSupport
id, pageContext
 
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
BaseControlTag()
          Constructor
 
Method Summary
 void addDesignRule(DesignRule rule)
          Adds a new design rule to the container
 void beginPaint()
          Starts rendering the Control
protected  Control createControl()
          Creates the control element
 void createPainter(Control ctrl)
          Creates the Painter to render the Control
protected abstract  Control doCreateControl()
          Creates the control element
protected abstract  ControlDesignModel doCreateDesignModel()
          This method is called to create the DesignModel for the control
 int doEndTag()
           
 int doStartTag()
           
 void endPaint()
          Writes the HTML-Code to the Output-Stream
private  void exposeScriptingVariable(Control ctrl)
          Exposes the control instance as a scripting variable to the Tag body
 ClientHandler getClientHandler()
          Returns the ClientHandler interface of the controls design model.
 Control getControl()
          Retrieves the current Control instance.
 java.lang.String getDefaultAction()
          Gets the default Action which should be used to forward requests from this control.
protected  ControlDesignModel getDesignModel()
          Returns the DesignModel of the Control
 java.lang.Object getDirectValue()
          Returns a direct set value
 HttpScope getHttpScope()
          Returns the scope.
 PainterContext getPainterContext()
          Returns the painter context of the control painter
protected  java.lang.Object lookupBean()
          Retrieves the bean which holds the Display Data or Control Instance
 void release()
           
protected  void releaseDesignModel()
          This method gets called when the design model is not longer needed
 void setAction(java.lang.String action)
          Sets the Action
 void setAjax(boolean ajax)
          Directs the framework to add additional AJAX handlers to the control.
 void setAjax(java.lang.String ajax)
          Directs the framework to add additional AJAX handlers to the column.
 void setBorder(java.lang.String newBorder)
          Sets the Border
 void setDirectValue(java.lang.Object value)
          Sets the direct value for this control.
 void setDisabled(java.lang.String disabled)
          This attribute can be used to disable the control element.
 void setFormElement(java.lang.String flag)
          Defines, if the Controls should act as a FormElement
 void setHeight(java.lang.String newHeight)
          sets the height of the control
 void setHelp(java.lang.String helpId)
          Associates this control with a help id
 void setId(java.lang.String newId)
           
 void setLocale(java.lang.String locale)
          Sets the Locale configuration for this control
 void setName(java.lang.String name)
          Specifies the name of the Java-Bean.
 void setPageContext(javax.servlet.jsp.PageContext pc)
           
 void setPermission(java.lang.String permission)
          With this attribute, access to the element can be restricted.
 void setProperty(java.lang.String property)
          Sets the Property-Attribute
 void setRunat(java.lang.String runat)
          This attribute specifies whether, for the control element, client side JavaScript should be used, or whether the control element should work purely with Server round trips.
 void setScope(java.lang.String scope)
          Sets the scope
 void setShadow(java.lang.String shadow)
          Sets the shadow Attribute
 void setStyle(java.lang.String style)
          An HTML-style.
 void setStyleClass(java.lang.String styleClass)
          The HTML-class attribute.
 void setStyleId(java.lang.String styleId)
          The HTML-id attribute.
 void setSummary(java.lang.String summary)
          Sets the property that can be used for rendering to non-visual media such as speech or Braille
 void setTabindex(java.lang.String tabIndex)
          Tabulator Index for this element
 void setTooltip(java.lang.String tooltip)
          Sets the optional tooltip text
 void setTransaction(java.lang.String transaction)
          Directs the framework to include a transaction token (if any) in all generated hyperlinks for this column.
 void setValue(java.lang.String value)
          Sets the direct value for this control.
 void setWidth(java.lang.String newWidth)
          Sets the width of the control
 
Methods inherited from class com.cc.framework.taglib.ScriptTagSupport
setOnabort, setOnactivate, setOnafterprint, setOnafterupdate, setOnbeforeactivate, setOnbeforecopy, setOnbeforecut, setOnbeforedeactivate, setOnbeforeeditfocus, setOnbeforepaste, setOnbeforeprint, setOnbeforeunload, setOnbeforeupdate, setOnblur, setOnbounce, setOncellchange, setOnchange, setOncheck, setOncheckall, setOnclick, setOncollapse, setOncontextmenu, setOncontrolselect, setOncopy, setOncut, setOndataavailable, setOndatasetchanged, setOndatasetcomplete, setOndblclick, setOndeactivate, setOndrag, setOndragend, setOndragenter, setOndragleave, setOndragover, setOndragstart, setOndrop, setOnerror, setOnerrorupdate, setOnexpand, setOnexpandex, setOnfilterchange, setOnfinish, setOnfocus, setOnfocusin, setOnfocusout, setOnhelp, setOnkeydown, setOnkeypress, setOnkeyup, setOnlayoutcomplete, setOnload, setOnlosecapture, setOnmousedown, setOnmouseenter, setOnmouseleave, setOnmousemove, setOnmouseout, setOnmouseover, setOnmouseup, setOnmousewheel, setOnmove, setOnmoveend, setOnmovestart, setOnpaste, setOnpropertychange, setOnreadystatechange, setOnreset, setOnresize, setOnresizeend, setOnresizestart, setOnrowenter, setOnrowexit, setOnrowsdelete, setOnrowsinserted, setOnscroll, setOnselect, setOnselectionchange, setOnselectstart, setOnspindown, setOnspinup, setOnstart, setOnstop, setOnsubmit, setOnuncheck, setOnuncheckall, setOnunload
 
Methods inherited from class javax.servlet.jsp.tagext.TagSupport
doAfterBody, findAncestorWithClass, getId, getParent, getValue, getValues, removeValue, setParent, setValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
Serial Version UID

See Also:
Constant Field Values

log

protected transient org.apache.commons.logging.Log log
Commons Logging instance.


scope

private HttpScope scope
The scope of the bean containing our underlying property.


painter

private ControlPainter painter
The painter, which is responsible to render the control


designModel

private ControlDesignModel designModel
The controls design model


control

private Control control
The Control instance


directValue

private java.lang.Object directValue
A direct set value

Constructor Detail

BaseControlTag

public BaseControlTag()
Constructor

Method Detail

release

public void release()
Specified by:
release in interface javax.servlet.jsp.tagext.Tag
See Also:
Tag.release()

setPageContext

public void setPageContext(javax.servlet.jsp.PageContext pc)
Specified by:
setPageContext in interface javax.servlet.jsp.tagext.Tag
See Also:
Tag.setPageContext(PageContext pc)

getDesignModel

protected ControlDesignModel getDesignModel()
Returns the DesignModel of the Control

Returns:
ControlDesignModel

doCreateDesignModel

protected abstract ControlDesignModel doCreateDesignModel()
This method is called to create the DesignModel for the control

Returns:
A concrete DesignModel

releaseDesignModel

protected void releaseDesignModel()
This method gets called when the design model is not longer needed


getClientHandler

public ClientHandler getClientHandler()
Description copied from interface: ScriptSupport
Returns the ClientHandler interface of the controls design model.

Specified by:
getClientHandler in interface ScriptSupport
Returns:
ClientHandler
See Also:
ScriptSupport.getClientHandler()

doCreateControl

protected abstract Control doCreateControl()
                                    throws javax.servlet.jsp.JspException
Creates the control element

Returns:
control element
Throws:
javax.servlet.jsp.JspException - If an error during bean lookup occurs

createControl

protected final Control createControl()
                               throws javax.servlet.jsp.JspException
Creates the control element

Returns:
control element
Throws:
javax.servlet.jsp.JspException - If an error during bean lookup occurs

getControl

public Control getControl()
Retrieves the current Control instance. This method can only be called between doStartTag() and doEndTag()

Returns:
the current control instance

lookupBean

protected java.lang.Object lookupBean()
                               throws javax.servlet.jsp.JspException
Retrieves the bean which holds the Display Data or Control Instance

Returns:
Bean (Control instance or DataModel)
Throws:
javax.servlet.jsp.JspException - Is thrown when the bean could not be found

exposeScriptingVariable

private void exposeScriptingVariable(Control ctrl)
Exposes the control instance as a scripting variable to the Tag body

Parameters:
ctrl - The control instance

doStartTag

public int doStartTag()
               throws javax.servlet.jsp.JspException
Specified by:
doStartTag in interface javax.servlet.jsp.tagext.Tag
Throws:
javax.servlet.jsp.JspException
See Also:
Tag.doStartTag()

doEndTag

public int doEndTag()
             throws javax.servlet.jsp.JspException
Specified by:
doEndTag in interface javax.servlet.jsp.tagext.Tag
Throws:
javax.servlet.jsp.JspException
See Also:
Tag.doEndTag()

setPermission

public void setPermission(java.lang.String permission)
                   throws javax.servlet.jsp.JspException
With this attribute, access to the element can be restricted.

Authorizations are checked using the com.cc.framework.security.Principal object in the user session. The principal object is registered in the session with the method com.cc.framework.security.SecurityUtil#registerPrincipal(HttpSession, Principal). It is made available by the application developer by implementing the principal interface. In this manner, any authorization system can be very easily connected within the framework.

Authorizations are always specified in the form of an Access Control List (ACL). What is involved here is a semicolon-delimited list with individual authorizations. The framework supports the following authorization types, which, however, can be expanded at will by the application developer:

Literal
true|false -> com.cc.framework.security.StaticPermission
Role
#rolename -> com.cc.framework.security.RoleBasedPermission
Function
$functionname -> com.cc.framework.security.FunctionBasedPermission

Parameters:
permission - The permission to set for this control
Throws:
javax.servlet.jsp.JspException - If the argument can't be converted into an object of type Permission

setId

public void setId(java.lang.String newId)
See Also:
TagSupport.setId(java.lang.String)

setProperty

public void setProperty(java.lang.String property)
                 throws javax.servlet.jsp.JspException
Sets the Property-Attribute

Parameters:
property - The Property-Attribute
Throws:
javax.servlet.jsp.JspException

setWidth

public void setWidth(java.lang.String newWidth)
Sets the width of the control

Parameters:
newWidth - The Width of the Control in Pixel or %

setHeight

public void setHeight(java.lang.String newHeight)
sets the height of the control

Parameters:
newHeight - The Height

setBorder

public void setBorder(java.lang.String newBorder)
               throws javax.servlet.jsp.JspException
Sets the Border

Parameters:
newBorder - Border
Throws:
javax.servlet.jsp.JspException - If the Argument can't be converted to integer

setTabindex

public void setTabindex(java.lang.String tabIndex)
                 throws javax.servlet.jsp.JspException
Tabulator Index for this element

Parameters:
tabIndex - Tab index
Throws:
javax.servlet.jsp.JspException - If the Argument can't be converted to integer

setName

public void setName(java.lang.String name)
Specifies the name of the Java-Bean. The Java-Bean must be stored in the given scope.

Parameters:
name - Name of the Bean

setStyle

public void setStyle(java.lang.String style)
An HTML-style. See HTML documentation for the attribute style.

Parameters:
style - An HTML-style

setStyleId

public void setStyleId(java.lang.String styleId)
The HTML-id attribute. See HTML documentation for the Attribute id.

Parameters:
styleId - The HTML-id attribute

setStyleClass

public void setStyleClass(java.lang.String styleClass)
The HTML-class attribute. See HTML documentation for the attribute class.

Parameters:
styleClass - The HTML-class attribute

setHelp

public void setHelp(java.lang.String helpId)
Associates this control with a help id

Parameters:
helpId - The Help Help id of the element. The semantic of this id is completely in the responsibility of the applications help system

setTooltip

public void setTooltip(java.lang.String tooltip)
Sets the optional tooltip text

Parameters:
tooltip - Tooltip

setSummary

public void setSummary(java.lang.String summary)
Sets the property that can be used for rendering to non-visual media such as speech or Braille

Parameters:
summary - specifies a description and/or structure of the object.

setTransaction

public void setTransaction(java.lang.String transaction)
                    throws javax.servlet.jsp.JspException
Directs the framework to include a transaction token (if any) in all generated hyperlinks for this column. The Transaction token is used to track form re-submissions.

Parameters:
transaction - include transaction token
Throws:
javax.servlet.jsp.JspException - If the Argument can't be converted to boolean

setDisabled

public void setDisabled(java.lang.String disabled)
                 throws javax.servlet.jsp.JspException
This attribute can be used to disable the control element. It then does not accept any user inputs and does not generate any control element events.

Parameters:
disabled - Disabled-Flag
Throws:
javax.servlet.jsp.JspException - If the Argument can't be converted to boolean

setScope

public void setScope(java.lang.String scope)
              throws javax.servlet.jsp.JspException
Sets the scope

Parameters:
scope - Scope
Throws:
javax.servlet.jsp.JspException - If the Argument can't be converted to HttpScope

getHttpScope

public HttpScope getHttpScope()
Returns the scope.

Returns:
Scope

setAction

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

Parameters:
action - Action to be performed

setShadow

public void setShadow(java.lang.String shadow)
               throws javax.servlet.jsp.JspException
Sets the shadow Attribute

Parameters:
shadow - shadow Attribute
Throws:
javax.servlet.jsp.JspException - If the Argument can't be converted to boolean

setRunat

public void setRunat(java.lang.String runat)
              throws javax.servlet.jsp.JspException
This attribute specifies whether, for the control element, client side JavaScript should be used, or whether the control element should work purely with Server round trips.

Parameters:
runat - Specifies whether the control element should work with (=server) or without Server round trips (=client).
Throws:
javax.servlet.jsp.JspException - If the argument can't be converted to an object of type com.cc.framework.ui.RunAt
See Also:
RunAt

getDefaultAction

public java.lang.String getDefaultAction()
Gets the default Action which should be used to forward requests from this control. This action is used when the action-property of the control is not set

Returns:
String or null

setFormElement

public void setFormElement(java.lang.String flag)
                    throws javax.servlet.jsp.JspException
Defines, if the Controls should act as a FormElement

Parameters:
flag - True, if the Controls acts as a FormElement
Throws:
javax.servlet.jsp.JspException - If the Argument can't be converted to boolean

createPainter

public void createPainter(Control ctrl)
Creates the Painter to render the Control

Parameters:
ctrl - Control

beginPaint

public void beginPaint()
                throws javax.servlet.jsp.JspException
Starts rendering the Control

Throws:
javax.servlet.jsp.JspException - Error while rendering the control

endPaint

public void endPaint()
              throws javax.servlet.jsp.JspException
Writes the HTML-Code to the Output-Stream

Throws:
javax.servlet.jsp.JspException - Error while rendering the control

getPainterContext

public PainterContext getPainterContext()
Returns the painter context of the control painter

Returns:
painter context

setLocale

public void setLocale(java.lang.String locale)
Sets the Locale configuration for this control

Parameters:
locale - Locale Identifier or true|false

addDesignRule

public void addDesignRule(DesignRule rule)
Description copied from interface: DesignRuleContainerTag
Adds a new design rule to the container

Specified by:
addDesignRule in interface DesignRuleContainerTag
Parameters:
rule - Design rule
See Also:
DesignRuleContainerTag.addDesignRule(com.cc.framework.ui.model.DesignRule)

setValue

public void setValue(java.lang.String value)
Sets the direct value for this control. This will overwrite the value of the property attribute

Parameters:
value - The direct value

setDirectValue

public void setDirectValue(java.lang.Object value)
Sets the direct value for this control. This will overwrite the value of the property attribute

Parameters:
value - The direct value

getDirectValue

public java.lang.Object getDirectValue()
Returns a direct set value

Returns:
Value

setAjax

public void setAjax(java.lang.String ajax)
             throws javax.servlet.jsp.JspException
Description copied from interface: AjaxSupportTag
Directs the framework to add additional AJAX handlers to the column.

Specified by:
setAjax in interface AjaxSupportTag
Parameters:
ajax - enable AJAX
Throws:
javax.servlet.jsp.JspException - If the Argument can't be converted to boolean
See Also:
AjaxSupportTag.setAjax(java.lang.String)

setAjax

public void setAjax(boolean ajax)
Directs the framework to add additional AJAX handlers to the control.

Specified by:
setAjax in interface AjaxSupportTag
Parameters:
ajax - enable AJAX


Copyright © 2000-2005 SCC Informationssysteme GmbH. All Rights Reserved.