org.apache.struts2.components
Class UIBean

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

public abstract class UIBean
extends Component

UIBean is the standard superclass of all Struts UI componentns. It defines common Struts 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
jsTooltipEnabled String false Enable js tooltip rendering
tooltipIcon String /struts/static/tooltip/tooltip.gif The url to the tooltip icon
tooltipDelay String 500 Tooltip shows up after the specified timeout (miliseconds). A behavior similar to that of OS based tooltips.
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 tooltipDelay adn tooltipIcon attribte from its containing form. In other words, although it doesn't defined a tooltipAboveMousePointer attribute, it will have that attributes inherited from its containing form.

In Example 2, the the textfield will inherite both the tooltipDelay and tooltipIcon attribute from its containing form but tooltipDelay attribute is overriden at the textfield itself. Hence, the textfield actually will have tooltipIcon defined as /myImages/myIcon.gif, inherited from its containing form and tooltipDelay defined as 5000, 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: -->
 <s:form
                        tooltipConfig="#{'tooltipDelay':'500',
                           'tooltipIcon='/myImages/myIcon.gif'}" .... >
   ....
     <s:textfield label="Customer Name" tooltip="Enter the customer name" .... />
   ....
 </s:form>

 <!-- Example 2: -->
 <s:form
         tooltipConfig="#{'tooltipDelay':'500',
                                        'tooltipIcon':'/myImages/myIcon.gif'}" ... >
   ....
     <s:textfield label="Address"
          tooltip="Enter your address"
          tooltipConfig="#{'tooltipDelay':'5000'}" />
   ....
 </s:form>


 <-- Example 3: -->
 <s:textfield
        label="Customer Name"
              tooltip="One of our customer Details'">
        <s:param name="tooltipConfig">
             tooltipDelay = 500 |
             tooltipIcon = /myImages/myIcon.gif 
        </s:param>
 </s:textfield>


 <-- Example 4: -->
 <s:textfield
                label="Customer Address"
                tooltip="Enter The Customer Address" >
                <s:param
              name="tooltipConfig"
              value="#{'tooltipDelay':'500',
                       'tooltipIcon':'/myImages/myIcon.gif'}" />
 </s:textfield>


 <-- Example 5: -->
 <s:textfield
          label="Customer Telephone Number"
          tooltip="Enter customer Telephone Number"
          tooltipConfig="#{'tooltipDelay':'500',
                           'tooltipIcon':'/myImages/myIcon.gif'}" />

 
 


Field Summary
protected  java.lang.String accesskey
           
protected  java.lang.String cssClass
           
protected  java.lang.String cssStyle
           
protected  java.lang.String disabled
           
protected  java.lang.String label
           
protected  java.lang.String labelPosition
           
protected  java.lang.String name
           
protected  java.lang.String onblur
           
protected  java.lang.String onchange
           
protected  java.lang.String onclick
           
protected  java.lang.String ondblclick
           
protected  java.lang.String onfocus
           
protected  java.lang.String onkeydown
           
protected  java.lang.String onkeypress
           
protected  java.lang.String onkeyup
           
protected  java.lang.String onmousedown
           
protected  java.lang.String onmousemove
           
protected  java.lang.String onmouseout
           
protected  java.lang.String onmouseover
           
protected  java.lang.String onmouseup
           
protected  java.lang.String onselect
           
protected  javax.servlet.http.HttpServletRequest request
           
protected  java.lang.String required
           
protected  java.lang.String requiredposition
           
protected  javax.servlet.http.HttpServletResponse response
           
protected  java.lang.String tabindex
           
protected  java.lang.String template
           
protected  java.lang.String templateDir
           
protected  java.lang.String templateSuffix
           
protected  java.lang.String theme
           
protected  java.lang.String title
           
protected  java.lang.String tooltip
           
protected  java.lang.String tooltipConfig
           
protected  java.lang.String value
           
 
Fields inherited from class org.apache.struts2.components.Component
COMPONENT_STACK, id, parameters, stack
 
Constructor Summary
UIBean(com.opensymphony.xwork2.util.OgnlValueStack stack, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
           
 
Method Summary
 void addFormParameter(java.lang.String key, java.lang.Object value)
           
protected  Template buildTemplateName(java.lang.String myTemplate, java.lang.String myDefaultTemplate)
           
protected  void enableAncestorFormCustomOnsubmit()
           
 boolean end(java.io.Writer writer, java.lang.String body)
          Callback for the end tag of this component.
protected  java.lang.String escape(java.lang.String name)
           
protected  void evaluateExtraParams()
           
protected  boolean evaluateNameValue()
           
 void evaluateParams()
           
protected abstract  java.lang.String getDefaultTemplate()
          A contract that requires each concrete UI Tag to specify which template should be used as a default.
 java.lang.String getTemplate()
           
 java.lang.String getTemplateDir()
           
 java.lang.String getTheme()
           
protected  java.util.Map getTooltipConfig(UIBean component)
           
protected  java.lang.Class getValueClassType()
           
protected  void mergeTemplate(java.io.Writer writer, Template template)
           
protected  void populateComponentHtmlId(Form form)
          Create HTML id element for the component and populate this component parmaeter map.
 void setAccesskey(java.lang.String accesskey)
          Set the html accesskey attribute on rendered html element
 void setCssClass(java.lang.String cssClass)
          The css class to use for element
 void setCssStyle(java.lang.String cssStyle)
          The css style definitions for element ro use
 void setDisabled(java.lang.String disabled)
          Set the html disabled attribute on rendered html element
 void setLabel(java.lang.String label)
          Label expression used for rendering a element specific label
 void setLabelposition(java.lang.String labelPosition)
          define label position of form element (top/left)
 void setName(java.lang.String name)
          The name to set for element
 void setOnblur(java.lang.String onblur)
          Set the html onblur attribute on rendered html element
 void setOnchange(java.lang.String onchange)
          Set the html onchange attribute on rendered html element
 void setOnclick(java.lang.String onclick)
          Set the html onclick attribute on rendered html element
 void setOndblclick(java.lang.String ondblclick)
          Set the html ondblclick attribute on rendered html element
 void setOnfocus(java.lang.String onfocus)
          Set the html onfocus attribute on rendered html element
 void setOnkeydown(java.lang.String onkeydown)
          Set the html onkeydown attribute on rendered html element
 void setOnkeypress(java.lang.String onkeypress)
          Set the html onkeypress attribute on rendered html element
 void setOnkeyup(java.lang.String onkeyup)
          Set the html onkeyup attribute on rendered html element
 void setOnmousedown(java.lang.String onmousedown)
          Set the html onmousedown attribute on rendered html element
 void setOnmousemove(java.lang.String onmousemove)
          Set the html onmousemove attribute on rendered html element
 void setOnmouseout(java.lang.String onmouseout)
          Set the html onmouseout attribute on rendered html element
 void setOnmouseover(java.lang.String onmouseover)
          Set the html onmouseover attribute on rendered html element
 void setOnmouseup(java.lang.String onmouseup)
          Set the html onmouseup attribute on rendered html element
 void setOnselect(java.lang.String onselect)
          Set the html onselect attribute on rendered html element
 void setRequired(java.lang.String required)
          If set to true, the rendered element will indicate that input is required
 void setRequiredposition(java.lang.String requiredposition)
          define required position of required form element (left|right)
 void setTabindex(java.lang.String tabindex)
          Set the html tabindex attribute on rendered html element
 void setTemplate(java.lang.String template)
          The template (other than default) to use for rendering the element
 void setTemplateDir(java.lang.String templateDir)
          The template directory.
 void setTheme(java.lang.String theme)
          The theme (other than default) to use for rendering the element
 void setTitle(java.lang.String title)
          Set the html title attribute on rendered html element
 void setTooltip(java.lang.String tooltip)
          Set the tooltip of this particular component
 void setTooltipConfig(java.lang.String tooltipConfig)
          Set the tooltip configuration
 void setValue(java.lang.String value)
          Preset the value of input element.
 
Methods inherited from class org.apache.struts2.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 javax.servlet.http.HttpServletRequest request

response

protected javax.servlet.http.HttpServletResponse response

templateSuffix

protected java.lang.String templateSuffix

template

protected java.lang.String template

templateDir

protected java.lang.String templateDir

theme

protected java.lang.String theme

cssClass

protected java.lang.String cssClass

cssStyle

protected java.lang.String cssStyle

disabled

protected java.lang.String disabled

label

protected java.lang.String label

labelPosition

protected java.lang.String labelPosition

requiredposition

protected java.lang.String requiredposition

name

protected java.lang.String name

required

protected java.lang.String required

tabindex

protected java.lang.String tabindex

value

protected java.lang.String value

title

protected java.lang.String title

onclick

protected java.lang.String onclick

ondblclick

protected java.lang.String ondblclick

onmousedown

protected java.lang.String onmousedown

onmouseup

protected java.lang.String onmouseup

onmouseover

protected java.lang.String onmouseover

onmousemove

protected java.lang.String onmousemove

onmouseout

protected java.lang.String onmouseout

onfocus

protected java.lang.String onfocus

onblur

protected java.lang.String onblur

onkeypress

protected java.lang.String onkeypress

onkeydown

protected java.lang.String onkeydown

onkeyup

protected java.lang.String onkeyup

onselect

protected java.lang.String onselect

onchange

protected java.lang.String onchange

accesskey

protected java.lang.String accesskey

tooltip

protected java.lang.String tooltip

tooltipConfig

protected java.lang.String tooltipConfig
Constructor Detail

UIBean

public UIBean(com.opensymphony.xwork2.util.OgnlValueStack stack,
              javax.servlet.http.HttpServletRequest request,
              javax.servlet.http.HttpServletResponse response)
Method Detail

end

public boolean end(java.io.Writer writer,
                   java.lang.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 java.lang.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(java.lang.String myTemplate,
                                     java.lang.String myDefaultTemplate)

mergeTemplate

protected void mergeTemplate(java.io.Writer writer,
                             Template template)
                      throws java.lang.Exception
Throws:
java.lang.Exception

getTemplateDir

public java.lang.String getTemplateDir()

getTheme

public java.lang.String getTheme()

evaluateParams

public void evaluateParams()

escape

protected java.lang.String escape(java.lang.String name)

evaluateExtraParams

protected void evaluateExtraParams()

evaluateNameValue

protected boolean evaluateNameValue()

getValueClassType

protected java.lang.Class getValueClassType()

addFormParameter

public void addFormParameter(java.lang.String key,
                             java.lang.Object value)

enableAncestorFormCustomOnsubmit

protected void enableAncestorFormCustomOnsubmit()

getTooltipConfig

protected java.util.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 -

setTemplateDir

public void setTemplateDir(java.lang.String templateDir)
The template directory.


setTheme

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


getTemplate

public java.lang.String getTemplate()

setTemplate

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


setCssClass

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


setCssStyle

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


setTitle

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


setDisabled

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


setLabel

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


setLabelposition

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


setRequiredposition

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


setName

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


setRequired

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


setTabindex

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


setValue

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


setOnclick

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


setOndblclick

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


setOnmousedown

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


setOnmouseup

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


setOnmouseover

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


setOnmousemove

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


setOnmouseout

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


setOnfocus

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


setOnblur

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


setOnkeypress

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


setOnkeydown

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


setOnkeyup

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


setOnselect

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


setOnchange

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


setAccesskey

public void setAccesskey(java.lang.String accesskey)
Set the html accesskey attribute on rendered html element


setTooltip

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


setTooltipConfig

public void setTooltipConfig(java.lang.String tooltipConfig)
Set the tooltip configuration



Copyright © 2000-2006 Apache Software Foundation. All Rights Reserved.