com.tonbeller.wcf.toolbar
Class ToolBarComponentSupport

java.lang.Object
  extended bycom.tonbeller.wcf.toolbar.ToolBarComponentSupport
All Implemented Interfaces:
ToolBarComponent
Direct Known Subclasses:
ImgButton, ToolButton, ToolSeparator

public abstract class ToolBarComponentSupport
extends java.lang.Object
implements ToolBarComponent

visibility of a toolbar button is computed as followd

  1. if a role attribute was supplied, and the user is authenticated, and the user is not member of that role, the button is not shown
  2. otherwise, if visibleExpr is given (either a ${...} EL expression or "true" or "false"), then its result is returned
  3. otherwise, the value of the boolean visible property is returned which defaults to true.


Constructor Summary
ToolBarComponentSupport()
           
 
Method Summary
 java.lang.String getId()
          must be unique within the toolbar. if null, the toolbar element will not be scriptable.
 java.lang.String getRole()
           
 java.lang.String getVisibleExpr()
           
 boolean isVisible()
          default visible state in case no visibleExpr is set
 boolean isVisible(RequestContext context)
          returns true if this Component is visible.
 void setId(java.lang.String id)
           
 void setRole(java.lang.String role)
           
 void setVisible(boolean visible)
          default visible state in case no visibleExpr is set
 void setVisibleExpr(java.lang.String string)
          an expression that evaluates to a boolean.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.tonbeller.wcf.toolbar.ToolBarComponent
initialize, isSeparator, render
 

Constructor Detail

ToolBarComponentSupport

public ToolBarComponentSupport()
Method Detail

isVisible

public boolean isVisible(RequestContext context)
returns true if this Component is visible. Visability is computed as follows
  1. If the visible property is set to false, the button is not visible.
  2. if a role attribute was supplied, and the user is authenticated, and the user is not member of that role, the button is not shown
  3. otherwise, if visibleExpr is given (either a ${...} EL expression or "true" or "false"), then its result is returned
  4. otherwise, the value of the boolean visible property is returned which defaults to true.

Specified by:
isVisible in interface ToolBarComponent

getVisibleExpr

public java.lang.String getVisibleExpr()
Returns:

setVisibleExpr

public void setVisibleExpr(java.lang.String string)
Description copied from interface: ToolBarComponent
an expression that evaluates to a boolean. If set, the button will be visible only if the boolen is true

Specified by:
setVisibleExpr in interface ToolBarComponent
Parameters:
string -

getRole

public java.lang.String getRole()
Returns:

setRole

public void setRole(java.lang.String role)
Parameters:
role -

isVisible

public boolean isVisible()
Description copied from interface: ToolBarComponent
default visible state in case no visibleExpr is set

Specified by:
isVisible in interface ToolBarComponent

setVisible

public void setVisible(boolean visible)
Description copied from interface: ToolBarComponent
default visible state in case no visibleExpr is set

Specified by:
setVisible in interface ToolBarComponent

getId

public java.lang.String getId()
Description copied from interface: ToolBarComponent
must be unique within the toolbar. if null, the toolbar element will not be scriptable.

Specified by:
getId in interface ToolBarComponent

setId

public void setId(java.lang.String id)