public abstract class UIBean extends Component
UIBean is the standard superclass of all Struts UI components. 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 |
themeExpansionToken | n/a | String | special token (defined with struts.ui.theme.expansion.token) used to search for template in parent theme (don't use it separately!) |
expandTheme | n/a | String | concatenation of themeExpansionToken and theme which tells internal template loader mechanism to try load template from current theme and then from parent theme (and parent theme, and so on) when used with <#include/> directive |
Attribute | Theme | Data Types | Description |
cssClass | simple | String | define html class attribute |
cssStyle | simple | String | define html style attribute |
cssErrorClass | simple | String | error class attribute |
cssErrorStyle | simple | String | error 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 |
errorPosition | xhtml | String | define error position of form element (top|bottom), default to top |
name | simple | String | Form Element's field name mapping |
requiredLabel | 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 |
ondblclick | 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. |
key | simple | String | The name of the property this input field represents. This will auto populate the name, label, and value |
tooltipConfig is deprecated, use individual tooltip configuration attributes instead
Every Form UI component (in xhtml / css_xhtml or any other that extends them) can have tooltips assigned to them. The Form component's tooltip related attribute, once defined, will be applied to all form UI components that are created under it unless explicitly overridden by having the Form UI component itself defined with their own tooltip attribute.
In Example 1, the textfield will inherit the tooltipDelay and tooltipIconPath attribute from its containing form. In other words, although it doesn't define a tooltipIconPath attribute, it will have that attribute inherited from its containing form.
In Example 2, the textfield will inherit both the tooltipDelay and tooltipIconPath attribute from its containing form, but the tooltipDelay attribute is overridden at the textfield itself. Hence, the textfield actually will have its tooltipIcon defined as /myImages/myIcon.gif, inherited from its containing form, and tooltipDelay defined as 5000.
Example 3, 4 and 5 show different ways of setting the tooltip configuration attribute.
Example 3: Set tooltip config through the body of the param tag
Example 4: Set tooltip config through the value attribute of the param tag
Example 5: Set tooltip config through the tooltip attributes of the component tag
<!-- Example 1: --> <s:form tooltipDelay="500" tooltipIconPath="/myImages/myIcon.gif" .... > .... <s:textfield label="Customer Name" tooltip="Enter the customer name" .... /> .... </s:form> <!-- Example 2: --> <s:form tooltipDelay="500" tooltipIconPath="/myImages/myIcon.gif" .... > .... <s:textfield label="Address" tooltip="Enter your address" tooltipDelay="5000" /> .... </s:form> <-- Example 3: --> <s:textfield label="Customer Name" tooltip="One of our customer Details"> <s:param name="tooltipDelay"> 500 </s:param> <s:param name="tooltipIconPath"> /myImages/myIcon.gif </s:param> </s:textfield> <-- Example 4: --> <s:textfield label="Customer Address" tooltip="Enter The Customer Address" > <s:param name="tooltipDelay" value="500" /> </s:textfield> <-- Example 5: --> <s:textfield label="Customer Telephone Number" tooltip="Enter customer Telephone Number" tooltipDelay="500" tooltipIconPath="/myImages/myIcon.gif" />
actionMapper, COMPONENT_STACK, devMode, parameters, stack, standardAttributesMap, throwExceptionOnELFailure
Constructor and Description |
---|
UIBean(ValueStack stack,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response) |
Modifier and Type | Method and Description |
---|---|
void |
addFormParameter(String key,
Object value) |
protected Template |
buildTemplateName(String myTemplate,
String myDefaultTemplate) |
void |
copyParams(Map params)
Pushes this component's parameter Map as well as the component itself on to the stack
and then copies the supplied parameters over.
|
protected void |
enableAncestorFormCustomOnsubmit() |
boolean |
end(Writer writer,
String body)
Callback for the end tag of this component.
|
protected String |
ensureAttributeSafelyNotEscaped(String val)
Ensures an unescaped attribute value cannot be vulnerable to XSS attacks
|
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 |
getId()
Get's the id for referencing element.
|
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 parameter
map.
|
void |
setAccesskey(String accesskey) |
void |
setClass(String cssClass) |
void |
setCssClass(String cssClass) |
void |
setCssErrorClass(String cssErrorClass) |
void |
setCssErrorStyle(String cssErrorStyle) |
void |
setCssStyle(String cssStyle) |
void |
setDefaultTemplateDir(String dir) |
void |
setDefaultUITheme(String theme) |
void |
setDisabled(String disabled) |
void |
setDynamicAttributes(Map<String,Object> tagDynamicAttributes) |
void |
setErrorPosition(String errorPosition) |
void |
setId(String id) |
void |
setJavascriptTooltip(String javascriptTooltip) |
void |
setKey(String key) |
void |
setLabel(String label) |
void |
setLabelposition(String labelPosition) |
void |
setLabelSeparator(String labelseparator) |
void |
setName(String name) |
void |
setOnblur(String onblur) |
void |
setOnchange(String onchange) |
void |
setOnclick(String onclick) |
void |
setOndblclick(String ondblclick) |
void |
setOnfocus(String onfocus) |
void |
setOnkeydown(String onkeydown) |
void |
setOnkeypress(String onkeypress) |
void |
setOnkeyup(String onkeyup) |
void |
setOnmousedown(String onmousedown) |
void |
setOnmousemove(String onmousemove) |
void |
setOnmouseout(String onmouseout) |
void |
setOnmouseover(String onmouseover) |
void |
setOnmouseup(String onmouseup) |
void |
setOnselect(String onselect) |
void |
setRequiredLabel(String requiredLabel) |
void |
setRequiredPosition(String requiredPosition) |
void |
setStyle(String cssStyle) |
void |
setTabindex(String tabindex) |
void |
setTemplate(String template) |
void |
setTemplateDir(String templateDir) |
void |
setTemplateEngineManager(TemplateEngineManager mgr) |
void |
setTheme(String theme) |
void |
setTitle(String title) |
void |
setTooltip(String tooltip) |
void |
setTooltipConfig(String tooltipConfig) |
void |
setTooltipCssClass(String tooltipCssClass) |
void |
setTooltipDelay(String tooltipDelay) |
void |
setTooltipIconPath(String tooltipIconPath) |
void |
setUIThemeExpansionToken(String uiThemeExpansionToken) |
void |
setValue(String value) |
addAllParameters, addParameter, altSyntax, completeExpressionIfAltSyntax, determineActionURL, determineNamespace, end, escapeHtmlBody, fieldError, findAncestor, findString, findString, findStringIfAltSyntax, findValue, findValue, findValue, getComponentStack, getParameters, getStack, getStandardAttributes, isValidTagAttribute, popComponentStack, setActionMapper, setDevMode, setThrowExceptionsOnELFailure, setUrlHelper, start, stripExpressionIfAltSyntax, toString, usesBody
protected javax.servlet.http.HttpServletRequest request
protected javax.servlet.http.HttpServletResponse response
protected String templateSuffix
protected String template
protected String templateDir
protected String theme
protected String key
protected String id
protected String cssClass
protected String cssStyle
protected String cssErrorClass
protected String cssErrorStyle
protected String disabled
protected String label
protected String labelPosition
protected String labelSeparator
protected String requiredPosition
protected String errorPosition
protected String name
protected String requiredLabel
protected String tabindex
protected String value
protected String title
protected String onclick
protected String ondblclick
protected String onmousedown
protected String onmouseup
protected String onmouseover
protected String onmousemove
protected String onmouseout
protected String onfocus
protected String onblur
protected String onkeypress
protected String onkeydown
protected String onkeyup
protected String onselect
protected String onchange
protected String accesskey
protected String tooltip
protected String tooltipConfig
protected String javascriptTooltip
protected String tooltipDelay
protected String tooltipCssClass
protected String tooltipIconPath
protected String defaultTemplateDir
protected String defaultUITheme
protected String uiThemeExpansionToken
protected TemplateEngineManager templateEngineManager
public UIBean(ValueStack stack, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
public void setDefaultTemplateDir(String dir)
public void setDefaultUITheme(String theme)
public void setUIThemeExpansionToken(String uiThemeExpansionToken)
public void setTemplateEngineManager(TemplateEngineManager mgr)
public boolean end(Writer writer, String body)
Component
protected abstract String getDefaultTemplate()
protected void mergeTemplate(Writer writer, Template template) throws Exception
Exception
public String getTemplateDir()
public String getTheme()
public void evaluateParams()
protected String ensureAttributeSafelyNotEscaped(String val)
val
- The value to checkprotected void evaluateExtraParams()
protected boolean evaluateNameValue()
protected Class getValueClassType()
protected void enableAncestorFormCustomOnsubmit()
protected void populateComponentHtmlId(Form form)
escape(String)
, needed eg. for naming Javascript identifiers based on the id value.
The order is as follows :-
form
- enclosing form tagpublic String getId()
public void setId(String id)
public void setTemplateDir(String templateDir)
public void setTheme(String theme)
public String getTemplate()
public void setTemplate(String template)
public void setCssClass(String cssClass)
public void setClass(String cssClass)
public void setCssStyle(String cssStyle)
public void setStyle(String cssStyle)
public void setCssErrorClass(String cssErrorClass)
public void setCssErrorStyle(String cssErrorStyle)
public void setTitle(String title)
public void setDisabled(String disabled)
public void setLabel(String label)
public void setLabelSeparator(String labelseparator)
public void setLabelposition(String labelPosition)
public void setRequiredPosition(String requiredPosition)
public void setErrorPosition(String errorPosition)
public void setName(String name)
public void setRequiredLabel(String requiredLabel)
public void setTabindex(String tabindex)
public void setValue(String value)
public void setOnclick(String onclick)
public void setOndblclick(String ondblclick)
public void setOnmousedown(String onmousedown)
public void setOnmouseup(String onmouseup)
public void setOnmouseover(String onmouseover)
public void setOnmousemove(String onmousemove)
public void setOnmouseout(String onmouseout)
public void setOnfocus(String onfocus)
public void setOnblur(String onblur)
public void setOnkeypress(String onkeypress)
public void setOnkeydown(String onkeydown)
public void setOnkeyup(String onkeyup)
public void setOnselect(String onselect)
public void setOnchange(String onchange)
public void setAccesskey(String accesskey)
public void setTooltip(String tooltip)
public void setTooltipConfig(String tooltipConfig)
public void setKey(String key)
public void setJavascriptTooltip(String javascriptTooltip)
public void setTooltipCssClass(String tooltipCssClass)
public void setTooltipDelay(String tooltipDelay)
public void setTooltipIconPath(String tooltipIconPath)
public void copyParams(Map params)
Component
copyParams
in class Component
params
- the parameters to copy.Copyright © 2000–2020 Apache Software Foundation. All rights reserved.