com.opensymphony.webwork.components
Class UIBean

java.lang.Object
  extended by com.opensymphony.webwork.components.Component
      extended by com.opensymphony.webwork.components.UIBean
Direct Known Subclasses:
ActionError, ActionMessage, Checkbox, ClosingUIBean, Debug, FieldError, File, FormButton, GenericUIBean, Head, Hidden, Label, ListUIBean, RichTextEditor, TextArea, TextField, Token

public abstract class UIBean
extends Component

UIBean is the standard superclass of all webwork UI componentns. It defines common webwork and html properties all UI components should present for usage.

Attribute Theme Data Types Description
templateDir n/a String define the template directory
theme n/a String define the theme name
template n/a String define the template name

Attribute Theme Data Types Description
cssClass simple String define html class attribute
cssStyle simple String define html style attribute
title simple String define html title attribute
disabled simple String define html disabled attribute
label xhtml String define label of form element
labelPosition xhtml String define label position of form element (top/left), default to left
requiredposition xhtml String define required label position of form element (left/right), default to right
name simple String Form Element's field name mapping
required xhtml Boolean add * to label (true to add false otherwise)
tabIndex simple String define html tabindex attribute
value simple Object define value of form element

Attribute Theme Data Types Description
onclick simple String html javascript onclick attribute
ondbclick simple String html javascript ondbclick attribute
onmousedown simple String html javascript onmousedown attribute
onmouseup simple String html javascript onmouseup attribute
onmouseover simple String html javascript onmouseover attribute
onmouseout simple String html javascript onmouseout attribute
onfocus simple String html javascript onfocus attribute
onblur simple String html javascript onblur attribute
onkeypress simple String html javascript onkeypress attribute
onkeyup simple String html javascript onkeyup attribute
onkeydown simple String html javascript onkeydown attribute
onselect simple String html javascript onselect attribute
onchange simple String html javascript onchange attribute

Attribute Data Type Default Description
tooltip String none Set the tooltip of this particular component
tooltipIcon String /webwork/static/tooltip/tooltip.gif The url to the tooltip icon
tooltipAboveMousePointer Boolean false Places the tooltip above the mousepointer. Additionally applied the tooltipOffseY allows to set the vertical distance from the mousepointer.
tooltipBgColor String #e6ecff Background color of the tooltip.
tooltipBgImg String none Background image.
tooltipBorderWidth String 1 Width of tooltip border.
tooltipBorderColor String #003399 Background color of the tooltip
tooltipDelay String 500 Tooltip shows up after the specified timeout (miliseconds). A behavior similar to that of OS based tooltips.
tooltipFixCoordinateX String not specified Fixes the tooltip to the X co-ordinates specified. Useful for example if combined with tooltipSticky attribute.
tooltipFixCoordinateY String not specified Fixes the tooltip to the Y co-ordinates specified. Useful for example if combined with tooltipSticky attribute.
tooltipFontColor String #000066 Font color.
tooltipFontFace String arial,helvetica,sans-serif Font face/family eg. verdana,geneva,sans-serif
tooltipFontSize String 11px Font size + unit eg. 30px
tooltipFontWeight String normal Font weight. either normal or bold
tooltipLeftOfMousePointer Boolean false Tooltip positioned on the left side of the mousepointer
tooltipOffsetX String 12 Horizontal offset from mouse-pointer.
tooltipOffsetY String 15 Vertical offset from mouse-pointer.
tooltipOpacity String 100 Transparency of tooltip. Opacity is the opposite of transparency. Value must be a number between 0 (fully transparent) and 100 (opaque, no transparency). Not (yet) supported by Opera.
tooltipPadding String 3 Inner spacing, ie. the spacing between border and content, for instance text or image(s)
tooltipShadowColor String #cccccc Creates shadow with the specified color.
tooltipShadowWidth String 5 Creates shodow with the specified width (offset).
tooltipStatic Boolean false Like OS-based tooltips, the tooltip doesn't follow the movements of the mouse pointer.
tooltipSticky Boolean false The tooltip stays fixed on its inital position until anohter tooltip is activated, or the user clicks on the document.
tooltipStayAppearTime String 0 Specifies a time span in miliseconds after which the tooltip disappears, even if the mousepointer is still on the concerned HTML element, with value <=0 it acts as if no time span is defined
tooltipTextAlign String left Aligns the text of both the title and the body of the tooltip. Either right, left or justify
tooltipTitle String none title
tooltipTitleColor String #ffffff Color of the title text
tooltipWidth String 300 Width of tooltip
Every Form UI component (in xhtml / css_xhtml or any others that extends of them) could have tooltip assigned to a them. The Form component's tooltip related attribute once defined will be applicable to all form UI component that is created under it unless explicitly overriden by having the Form UI component itself defined that tooltip attribute.

In Example 1, the textfield will inherit the tooltipAboveMousePointer attribte from its containing form. In other words, although it doesn't defined a tooltipAboveMousePointer attribute, it will have that attribute defined as true inherited from its containing form.

In Example 2, the the textfield will inherite both the tooltipAboveMousePointer and tooltipLeftOfMousePointer attribute from its containing form but tooltipLeftOfMousePointer attribute is overriden at the textfield itself. Hence, the textfield actually will have tooltipAboveMousePointer defined as true, inherited from its containing form and tooltipLeftOfMousePointer defined as false, due to overriden at the textfield itself.

Example 3, 4 and 5 shows different way of setting the tooltipConfig attribute.
Example 3:Set tooltip config through body of param tag
Example 4:Set tooltip config through value attribute of param tag
Example 5:Set tooltip config through tooltipConfig attribute of component tag

 

 <!-- Example 1: -->
 <ww:form
                        tooltipConfig="#{'tooltipAboveMousePointer':'true',
                           'tooltipBgColor='#eeeeee'}" .... >
   ....
     <ww:textfield label="Customer Name" tooltip="Enter the customer name" .... />
   ....
 </ww:form>

 <!-- Example 2: -->
 <ww:form
         tooltipConfig="#{'tooltipAboveMousePointer':'true',
                                         'tooltipLeftOfMousePointer':'true'}" ... >
   ....
     <ww:textfield label="Address"
          tooltip="Enter your address"
          tooltipConfig="#{'tooltipLeftOfMousePointer':'false'}" />
   ....
 </ww:form>


 <-- Example 3: -->
 <ww:textfield
        label="Customer Name"
              tooltip="One of our customer Details'">
        <ww:param name="tooltipConfig">
             tooltipWidth = 150 |
             tooltipAboveMousePointer = false |
             tooltipLeftOfMousePointer = false
        </ww:param>
 </ww:textfield>


 <-- Example 4: -->
 <ww:textfield
                label="Customer Address"
                tooltip="Enter The Customer Address" >
                <ww:param
              name="tooltipConfig"
              value="#{'tooltipStatic':'true',
                       'tooltipSticky':'true',
                       'tooltipAboveMousePointer':'false',
                       'tooltipLeftOfMousePointer':'false'}"  />
 </ww:textfield>


 <-- Example 5: -->
 <ww:textfield
          label="Customer Telephone Number"
          tooltip="Enter customer Telephone Number"
          tooltipConfig="#{'tooltipBgColor':'#cccccc',
                           'tooltipFontColor':'#eeeeee',
                           'tooltipAboveMousePointer':'false',
                           'tooltipLeftOfMousePointer':'false'}" /<

 
 

Since:
2.2
Version:
$Revision: 2973 $
Author:
Patrick Lightbody, Rene Gielen, Rainer Hermanns, tm_jee

Field Summary
protected  String accesskey
           
protected  String cssClass
           
protected  String cssStyle
           
protected  String disabled
           
protected  String label
           
protected  String labelPosition
           
protected  String name
           
protected  String onblur
           
protected  String onchange
           
protected  String onclick
           
protected  String ondblclick
           
protected  String onfocus
           
protected  String onkeydown
           
protected  String onkeypress
           
protected  String onkeyup
           
protected  String onmousedown
           
protected  String onmousemove
           
protected  String onmouseout
           
protected  String onmouseover
           
protected  String onmouseup
           
protected  String onselect
           
protected  HttpServletRequest request
           
protected  String required
           
protected  String requiredposition
           
protected  HttpServletResponse response
           
protected  String tabindex
           
protected  String template
           
protected  String templateDir
           
protected  String templateSuffix
           
protected  String theme
           
protected  String title
           
protected  String tooltip
           
protected  String tooltipConfig
           
protected  String value
           
 
Fields inherited from class com.opensymphony.webwork.components.Component
COMPONENT_STACK, id, parameters, stack
 
Constructor Summary
UIBean(OgnlValueStack stack, HttpServletRequest request, HttpServletResponse response)
           
 
Method Summary
 void addFormParameter(String key, Object value)
           
protected  Template buildTemplateName(String myTemplate, String myDefaultTemplate)
           
protected  void enableAncestorFormCustomOnsubmit()
           
 boolean end(Writer writer, String body)
          Callback for the end tag of this component.
protected  String escape(String name)
           
protected  void evaluateExtraParams()
           
protected  boolean evaluateNameValue()
           
 void evaluateParams()
           
protected abstract  String getDefaultTemplate()
          A contract that requires each concrete UI Tag to specify which template should be used as a default.
 String getTemplate()
           
 String getTemplateDir()
           
 String getTheme()
           
protected  Map getTooltipConfig(UIBean component)
           
protected  Class getValueClassType()
           
protected  void mergeTemplate(Writer writer, Template template)
           
protected  void populateComponentHtmlId(Form form)
          Create HTML id element for the component and populate this component parmaeter map.
 void setAccesskey(String accesskey)
          Set the html accesskey attribute on rendered html ekement
 void setCssClass(String cssClass)
          The css class to use for element
 void setCssStyle(String cssStyle)
          The css style definitions for element ro use
 void setDisabled(String disabled)
          Set the html disabled attribute on rendered html element
 void setLabel(String label)
          Label expression used for rendering a element specific label
 void setLabelposition(String labelPosition)
          define label position of form element (top/left)
 void setLabelPosition(String labelPosition)
          Deprecated. please use setLabelposition(String) instead
 void setName(String name)
          The name to set for element
 void setOnblur(String onblur)
          Set the html onblur attribute on rendered html element
 void setOnchange(String onchange)
          Set the html onchange attribute on rendered html element
 void setOnclick(String onclick)
          Set the html onclick attribute on rendered html element
 void setOndblclick(String ondblclick)
          Set the html ondblclick attribute on rendered html element
 void setOnfocus(String onfocus)
          Set the html onfocus attribute on rendered html element
 void setOnkeydown(String onkeydown)
          Set the html onkeydown attribute on rendered html element
 void setOnkeypress(String onkeypress)
          Set the html onkeypress attribute on rendered html element
 void setOnkeyup(String onkeyup)
          Set the html onkeyup attribute on rendered html element
 void setOnmousedown(String onmousedown)
          Set the html onmousedown attribute on rendered html element
 void setOnmousemove(String onmousemove)
          Set the html onmousemove attribute on rendered html element
 void setOnmouseout(String onmouseout)
          Set the html onmouseout attribute on rendered html element
 void setOnmouseover(String onmouseover)
          Set the html onmouseover attribute on rendered html element
 void setOnmouseup(String onmouseup)
          Set the html onmouseup attribute on rendered html element
 void setOnselect(String onselect)
          Set the html onselect attribute on rendered html element
 void setRequired(String required)
          If set to true, the rendered element will indicate that input is required
 void setRequiredposition(String requiredposition)
          define required position of required form element (left|right)
 void setTabindex(String tabindex)
          Set the html tabindex attribute on rendered html element
 void setTemplate(String template)
          The template (other than default) to use for rendering the element
 void setTemplateDir(String templateDir)
          The template directory (other than default) to used to find the themes and hence the template.
 void setTheme(String theme)
          The theme (other than default) to use for rendering the element
 void setTitle(String title)
          Set the html title attribute on rendered html element
 void setTooltip(String tooltip)
          Set the tooltip of this particular component
 void setTooltipConfig(String tooltipConfig)
          Set the tooltip configuration
 void setValue(String value)
          Preset the value of input element.
 
Methods inherited from class com.opensymphony.webwork.components.Component
addAllParameters, addParameter, altSyntax, copyParams, determineActionURL, determineNamespace, end, fieldError, findAncestor, findString, findString, findValue, findValue, findValue, getComponentStack, getId, getParameters, getStack, popComponentStack, setId, start, toString, usesBody
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

request

protected HttpServletRequest request

response

protected HttpServletResponse response

templateSuffix

protected String templateSuffix

template

protected String template

templateDir

protected String templateDir

theme

protected String theme

cssClass

protected String cssClass

cssStyle

protected String cssStyle

disabled

protected String disabled

label

protected String label

labelPosition

protected String labelPosition

requiredposition

protected String requiredposition

name

protected String name

required

protected String required

tabindex

protected String tabindex

value

protected String value

title

protected String title

onclick

protected String onclick

ondblclick

protected String ondblclick

onmousedown

protected String onmousedown

onmouseup

protected String onmouseup

onmouseover

protected String onmouseover

onmousemove

protected String onmousemove

onmouseout

protected String onmouseout

onfocus

protected String onfocus

onblur

protected String onblur

onkeypress

protected String onkeypress

onkeydown

protected String onkeydown

onkeyup

protected String onkeyup

onselect

protected String onselect

onchange

protected String onchange

accesskey

protected String accesskey

tooltip

protected String tooltip

tooltipConfig

protected String tooltipConfig
Constructor Detail

UIBean

public UIBean(OgnlValueStack stack,
              HttpServletRequest request,
              HttpServletResponse response)
Method Detail

end

public boolean end(Writer writer,
                   String body)
Description copied from class: Component
Callback for the end tag of this component. Should the body be evaluated again?

NOTE: will pop component stack.

Overrides:
end in class Component
Parameters:
writer - the output writer.
body - the rendered body.
Returns:
true if the body should be evaluated again

getDefaultTemplate

protected abstract String getDefaultTemplate()
A contract that requires each concrete UI Tag to specify which template should be used as a default. For example, the CheckboxTab might return "checkbox.vm" while the RadioTag might return "radio.vm". This value not begin with a '/' unless you intend to make the path absolute rather than relative to the current theme.

Returns:
The name of the template to be used as the default.

buildTemplateName

protected Template buildTemplateName(String myTemplate,
                                     String myDefaultTemplate)

mergeTemplate

protected void mergeTemplate(Writer writer,
                             Template template)
                      throws Exception
Throws:
Exception

getTemplateDir

public String getTemplateDir()

getTheme

public String getTheme()

evaluateParams

public void evaluateParams()

escape

protected String escape(String name)

evaluateExtraParams

protected void evaluateExtraParams()

evaluateNameValue

protected boolean evaluateNameValue()

getValueClassType

protected Class getValueClassType()

addFormParameter

public void addFormParameter(String key,
                             Object value)

enableAncestorFormCustomOnsubmit

protected void enableAncestorFormCustomOnsubmit()

getTooltipConfig

protected Map getTooltipConfig(UIBean component)

populateComponentHtmlId

protected void populateComponentHtmlId(Form form)
Create HTML id element for the component and populate this component parmaeter map. The order is as follows :-
  1. This component id attribute
  2. [containing_form_id]_[this_component_name]
  3. [this_component_name]

Parameters:
form -

setTheme

public void setTheme(String theme)
The theme (other than default) to use for rendering the element


getTemplate

public String getTemplate()

setTemplateDir

public void setTemplateDir(String templateDir)
The template directory (other than default) to used to find the themes and hence the template.


setTemplate

public void setTemplate(String template)
The template (other than default) to use for rendering the element


setCssClass

public void setCssClass(String cssClass)
The css class to use for element


setCssStyle

public void setCssStyle(String cssStyle)
The css style definitions for element ro use


setTitle

public void setTitle(String title)
Set the html title attribute on rendered html element


setDisabled

public void setDisabled(String disabled)
Set the html disabled attribute on rendered html element


setLabel

public void setLabel(String label)
Label expression used for rendering a element specific label


setLabelPosition

public void setLabelPosition(String labelPosition)
Deprecated. please use setLabelposition(String) instead

deprecated.


setLabelposition

public void setLabelposition(String labelPosition)
define label position of form element (top/left)


setRequiredposition

public void setRequiredposition(String requiredposition)
define required position of required form element (left|right)


setName

public void setName(String name)
The name to set for element


setRequired

public void setRequired(String required)
If set to true, the rendered element will indicate that input is required


setTabindex

public void setTabindex(String tabindex)
Set the html tabindex attribute on rendered html element


setValue

public void setValue(String value)
Preset the value of input element.


setOnclick

public void setOnclick(String onclick)
Set the html onclick attribute on rendered html element


setOndblclick

public void setOndblclick(String ondblclick)
Set the html ondblclick attribute on rendered html element


setOnmousedown

public void setOnmousedown(String onmousedown)
Set the html onmousedown attribute on rendered html element


setOnmouseup

public void setOnmouseup(String onmouseup)
Set the html onmouseup attribute on rendered html element


setOnmouseover

public void setOnmouseover(String onmouseover)
Set the html onmouseover attribute on rendered html element


setOnmousemove

public void setOnmousemove(String onmousemove)
Set the html onmousemove attribute on rendered html element


setOnmouseout

public void setOnmouseout(String onmouseout)
Set the html onmouseout attribute on rendered html element


setOnfocus

public void setOnfocus(String onfocus)
Set the html onfocus attribute on rendered html element


setOnblur

public void setOnblur(String onblur)
Set the html onblur attribute on rendered html element


setOnkeypress

public void setOnkeypress(String onkeypress)
Set the html onkeypress attribute on rendered html element


setOnkeydown

public void setOnkeydown(String onkeydown)
Set the html onkeydown attribute on rendered html element


setOnkeyup

public void setOnkeyup(String onkeyup)
Set the html onkeyup attribute on rendered html element


setOnselect

public void setOnselect(String onselect)
Set the html onselect attribute on rendered html element


setOnchange

public void setOnchange(String onchange)
Set the html onchange attribute on rendered html element


setAccesskey

public void setAccesskey(String accesskey)
Set the html accesskey attribute on rendered html ekement


setTooltip

public void setTooltip(String tooltip)
Set the tooltip of this particular component


setTooltipConfig

public void setTooltipConfig(String tooltipConfig)
Set the tooltip configuration


WebWork Project Page