| java.lang.Object com.opensymphony.webwork.components.Component
All known Subclasses: com.opensymphony.webwork.components.Param, com.opensymphony.webwork.components.Else, com.opensymphony.webwork.components.I18n, com.opensymphony.webwork.components.Date, com.opensymphony.webwork.components.ElseIf, com.opensymphony.webwork.components.IteratorComponent, com.opensymphony.webwork.components.UIBean, com.opensymphony.webwork.components.If, com.opensymphony.webwork.components.URL, com.opensymphony.webwork.components.ActionComponent, com.opensymphony.webwork.components.MergeIterator, com.opensymphony.webwork.components.Text, com.opensymphony.webwork.components.AppendIterator, com.opensymphony.webwork.components.Property, com.opensymphony.webwork.components.Bean, com.opensymphony.webwork.components.Push, com.opensymphony.webwork.components.Set, com.opensymphony.webwork.components.Include, com.opensymphony.webwork.views.sitemesh.ApplyDecoratorBean, com.opensymphony.webwork.components.OptGroup,
Component | public class Component (Code) | | Base class to extend for UI components.
This class is a good extension point when building reuseable UI components.
author: plightbo author: tm_jee version: $Date: 2007-02-16 08:15:36 +0100 (Fri, 16 Feb 2007) $ $Id: Component.java 2846 2007-02-16 07:15:36Z tm_jee $ |
Method Summary | |
public void | addAllParameters(Map params) Add's all the given parameters to this componenets own parameters. | public void | addParameter(String key, Object value) Add's the given key and value to this components own parameter. | public boolean | altSyntax() Is the altSyntax enabled?
See webwork.properties where the altSyntax flag is defined. | public 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 String | determineActionURL(String action, String namespace, String method, HttpServletRequest req, HttpServletResponse res, Map parameters, String scheme, boolean includeContext, boolean encodeResult, boolean escapeXml) Renders an action URL by consulting the
com.opensymphony.webwork.dispatcher.mapper.ActionMapper . | protected String | determineNamespace(String namespace, OgnlValueStack stack, HttpServletRequest req) Determines the namespace of the current page being renderdd. | public boolean | end(Writer writer, String body) Callback for the end tag of this component.
Should the body be evaluated again?
NOTE: will pop component stack.
Parameters: writer - the output writer. Parameters: body - the rendered body. | protected boolean | end(Writer writer, String body, boolean popComponentStack) Callback for the start tag of this component. | protected WebWorkException | fieldError(String field, String errorMsg, Exception e) Constructs?a WebWorkException based on the given information.
A message is constructed and logged at ERROR level before being returned
as a WebWorkException .
Parameters: field - field name used when throwing WebWorkException . Parameters: errorMsg - error message used when throwing WebWorkException . Parameters: e - the caused exception, can be null. | protected Component | findAncestor(Class clazz) Finds the nearest ancestor of this component stack.
Parameters: clazz - the class to look for, or if assignable from. | protected String | findString(String expr) Evaluates the OGNL stack to find a String value.
Parameters: expr - OGNL expression. | protected String | findString(String expr, String field, String errorMsg) Evaluates the OGNL stack to find a String value.
If the given expression is null a error is logged and a WebWorkException is thrown
constructed with a messaged based on the given field and errorMsg paramter.
Parameters: expr - OGNL expression. Parameters: field - field name used when throwing WebWorkException . Parameters: errorMsg - error message used when throwing WebWorkException . | protected Object | findValue(String expr) Finds a value from the OGNL stack based on the given expression.
Parameters: expr - the expression. | protected Object | findValue(String expr, String field, String errorMsg) Evaluates the OGNL stack to find an Object value.
If the given expression is null a error is logged and a WebWorkException is thrown
constructed with a messaged based on the given field and errorMsg paramter.
Parameters: expr - OGNL expression. Parameters: field - field name used when throwing WebWorkException . Parameters: errorMsg - error message used when throwing WebWorkException . | protected Object | findValue(String expr, Class toType) Evaluates the OGNL stack to find an Object of the given type.
This method only supports the altSyntax. | public Stack | getComponentStack() Get's the component stack of this component. | public String | getId() Get's the id for referencing element. | public Map | getParameters() Get's the parameters.
the parameters. | public OgnlValueStack | getStack() Get's the OGNL value stack assoicated with this component. | protected void | popComponentStack() Pops the component stack. | public void | setId(String id) id for referencing element. | public boolean | start(Writer writer) Callback for the start tag of this component.
Should the body be evaluated?
Parameters: writer - the output writer. | protected String | toString(Throwable t) Constructs a string representation of the given exception. | public boolean | usesBody() Overwrite to set if body shold be used. |
COMPONENT_STACK | final public static String COMPONENT_STACK(Code) | | |
Component | public Component(OgnlValueStack stack)(Code) | | Constructor.
Parameters: stack - OGNL value stack. |
addAllParameters | public void addAllParameters(Map params)(Code) | | Add's all the given parameters to this componenets own parameters.
Parameters: params - the parameters to add. |
addParameter | public void addParameter(String key, Object value)(Code) | | Add's the given key and value to this components own parameter.
If the provided key is null nothing happends.
If the provided value is null any existing parameter with
the given key name is removed.
Parameters: key - the key of the new parameter to add. Parameters: value - the value assoicated with the key. |
altSyntax | public boolean altSyntax()(Code) | | Is the altSyntax enabled?
See webwork.properties where the altSyntax flag is defined.
Note: Since WebWork 2.17 the altSyntax is default true.
true if the altSyntax is enabled. |
copyParams | public void copyParams(Map params)(Code) | | Pushes this component's parameter Map as well as the component itself on to the stack
and then copies the supplied parameters over. Because the component's parameter Map is
pushed before the component itself, any key-value pair that can't be assigned to componet
will be set in the parameters Map.
Parameters: params - the parameters to copy. |
determineActionURL | protected String determineActionURL(String action, String namespace, String method, HttpServletRequest req, HttpServletResponse res, Map parameters, String scheme, boolean includeContext, boolean encodeResult, boolean escapeXml)(Code) | | Renders an action URL by consulting the
com.opensymphony.webwork.dispatcher.mapper.ActionMapper .
Parameters: action - the action Parameters: namespace - the namespace Parameters: method - the method Parameters: req - HTTP request Parameters: res - HTTP response Parameters: parameters - parameters Parameters: scheme - http or https Parameters: includeContext - should the context path be included or not Parameters: encodeResult - should the url be encoded the action url. |
determineNamespace | protected String determineNamespace(String namespace, OgnlValueStack stack, HttpServletRequest req)(Code) | | Determines the namespace of the current page being renderdd. Useful for Form, URL, and href generations.
Parameters: namespace - the namespace Parameters: stack - OGNL value stack Parameters: req - HTTP request the namepsace of the current page being rendered, is never null. |
end | public boolean end(Writer writer, String body)(Code) | | Callback for the end tag of this component.
Should the body be evaluated again?
NOTE: will pop component stack.
Parameters: writer - the output writer. Parameters: body - the rendered body. true if the body should be evaluated again |
end | protected boolean end(Writer writer, String body, boolean popComponentStack)(Code) | | Callback for the start tag of this component.
Should the body be evaluated again?
NOTE: has a parameter to determine to pop the component stack.
Parameters: writer - the output writer. Parameters: body - the rendered body. Parameters: popComponentStack - should the component stack be popped? true if the body should be evaluated again |
fieldError | protected WebWorkException fieldError(String field, String errorMsg, Exception e)(Code) | | Constructs?a WebWorkException based on the given information.
A message is constructed and logged at ERROR level before being returned
as a WebWorkException .
Parameters: field - field name used when throwing WebWorkException . Parameters: errorMsg - error message used when throwing WebWorkException . Parameters: e - the caused exception, can be null. the constructed WebWorkException . |
findAncestor | protected Component findAncestor(Class clazz)(Code) | | Finds the nearest ancestor of this component stack.
Parameters: clazz - the class to look for, or if assignable from. the component if found, null if not. |
findString | protected String findString(String expr)(Code) | | Evaluates the OGNL stack to find a String value.
Parameters: expr - OGNL expression. the String value found. |
findString | protected String findString(String expr, String field, String errorMsg)(Code) | | Evaluates the OGNL stack to find a String value.
If the given expression is null a error is logged and a WebWorkException is thrown
constructed with a messaged based on the given field and errorMsg paramter.
Parameters: expr - OGNL expression. Parameters: field - field name used when throwing WebWorkException . Parameters: errorMsg - error message used when throwing WebWorkException . the String value found. throws: WebWorkException - is thrown in case of expression is null. |
findValue | protected Object findValue(String expr)(Code) | | Finds a value from the OGNL stack based on the given expression.
Parameters: expr - the expression. Returns null if expr is null. the value, null if not found. |
findValue | protected Object findValue(String expr, String field, String errorMsg)(Code) | | Evaluates the OGNL stack to find an Object value.
If the given expression is null a error is logged and a WebWorkException is thrown
constructed with a messaged based on the given field and errorMsg paramter.
Parameters: expr - OGNL expression. Parameters: field - field name used when throwing WebWorkException . Parameters: errorMsg - error message used when throwing WebWorkException . the Object found, is never null. throws: WebWorkException - is thrown in case of not found in the OGNL stack, or expression is null. |
findValue | protected Object findValue(String expr, Class toType)(Code) | | Evaluates the OGNL stack to find an Object of the given type.
This method only supports the altSyntax. So this should be set to true.
Parameters: expr - OGNL expression. Parameters: toType - the type expected to find. the Object found, or null if not found. |
getComponentStack | public Stack getComponentStack()(Code) | | Get's the component stack of this component.
the component stack of this component, never null. |
getId | public String getId()(Code) | | Get's the id for referencing element.
the id for referencing element. |
getParameters | public Map getParameters()(Code) | | Get's the parameters.
the parameters. Is never null. |
getStack | public OgnlValueStack getStack()(Code) | | Get's the OGNL value stack assoicated with this component.
the OGNL value stack assoicated with this component. |
popComponentStack | protected void popComponentStack()(Code) | | Pops the component stack.
|
setId | public void setId(String id)(Code) | | id for referencing element. For UI and form tags it will be used as HTML id attribute
|
start | public boolean start(Writer writer)(Code) | | Callback for the start tag of this component.
Should the body be evaluated?
Parameters: writer - the output writer. true if the body should be evaluated |
toString | protected String toString(Throwable t)(Code) | | Constructs a string representation of the given exception.
Parameters: t - the exception the exception as a string. |
usesBody | public boolean usesBody()(Code) | | Overwrite to set if body shold be used.
always false for this component. |
|
|