|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.opensymphony.webwork.components.Component
public class Component
Base class to extend for UI components.
This class is a good extension point when building reuseable UI components.
| Field Summary | |
|---|---|
static String |
COMPONENT_STACK
|
protected String |
id
|
protected Map |
parameters
|
protected com.opensymphony.xwork.util.OgnlValueStack |
stack
|
| Constructor Summary | |
|---|---|
Component(com.opensymphony.xwork.util.OgnlValueStack stack)
Constructor. |
|
| Method Summary | |
|---|---|
void |
addAllParameters(Map params)
Add's all the given parameters to this componenets own parameters. |
void |
addParameter(String key,
Object value)
Add's the given key and value to this components own parameter. |
boolean |
altSyntax()
Is the altSyntax enabled? See webwork.properties where the altSyntax flag is defined. |
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 ActionMapper. |
protected String |
determineNamespace(String namespace,
com.opensymphony.xwork.util.OgnlValueStack stack,
HttpServletRequest req)
Determines the namespace of the current page being renderdd. |
boolean |
end(Writer writer,
String body)
Callback for the end tag of this component. |
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. |
protected Component |
findAncestor(Class clazz)
Finds the nearest ancestor of this component stack. |
protected String |
findString(String expr)
Evaluates the OGNL stack to find a String value. |
protected String |
findString(String expr,
String field,
String errorMsg)
Evaluates the OGNL stack to find a String value. |
protected Object |
findValue(String expr)
Finds a value from the OGNL stack based on the given expression. |
protected Object |
findValue(String expr,
Class toType)
Evaluates the OGNL stack to find an Object of the given type. |
protected Object |
findValue(String expr,
String field,
String errorMsg)
Evaluates the OGNL stack to find an Object value. |
Stack |
getComponentStack()
Get's the component stack of this component. |
String |
getId()
Get's the id for referencing element. |
Map |
getParameters()
Get's the parameters. |
com.opensymphony.xwork.util.OgnlValueStack |
getStack()
Get's the OGNL value stack assoicated with this component. |
protected void |
popComponentStack()
Pops the component stack. |
void |
setId(String id)
id for referencing element. |
boolean |
start(Writer writer)
Callback for the start tag of this component. |
protected String |
toString(Throwable t)
Constructs a string representation of the given exception. |
boolean |
usesBody()
Overwrite to set if body shold be used. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String COMPONENT_STACK
protected com.opensymphony.xwork.util.OgnlValueStack stack
protected Map parameters
protected String id
| Constructor Detail |
|---|
public Component(com.opensymphony.xwork.util.OgnlValueStack stack)
stack - OGNL value stack.| Method Detail |
|---|
public com.opensymphony.xwork.util.OgnlValueStack getStack()
public Stack getComponentStack()
public boolean start(Writer writer)
writer - the output writer.
public boolean end(Writer writer,
String body)
writer - the output writer.body - the rendered body.
protected boolean end(Writer writer,
String body,
boolean popComponentStack)
writer - the output writer.body - the rendered body.popComponentStack - should the component stack be popped?
protected void popComponentStack()
protected Component findAncestor(Class clazz)
clazz - the class to look for, or if assignable from.
protected String findString(String expr)
expr - OGNL expression.
protected String findString(String expr,
String field,
String errorMsg)
WebWorkException is thrown
constructed with a messaged based on the given field and errorMsg paramter.
expr - OGNL expression.field - field name used when throwing WebWorkException.errorMsg - error message used when throwing WebWorkException.
WebWorkException - is thrown in case of expression is null.
protected WebWorkException fieldError(String field,
String errorMsg,
Exception e)
WebWorkException based on the given information.
A message is constructed and logged at ERROR level before being returned
as a WebWorkException.
field - field name used when throwing WebWorkException.errorMsg - error message used when throwing WebWorkException.e - the caused exception, can be null.
WebWorkException.protected Object findValue(String expr)
expr - the expression. Returns null if expr is null.
public boolean altSyntax()
webwork.properties where the altSyntax flag is defined.
Note: Since WebWork 2.17 the altSyntax is default true.
protected Object findValue(String expr,
String field,
String errorMsg)
WebWorkException is thrown
constructed with a messaged based on the given field and errorMsg paramter.
expr - OGNL expression.field - field name used when throwing WebWorkException.errorMsg - error message used when throwing WebWorkException.
WebWorkException - is thrown in case of not found in the OGNL stack, or expression is null.
protected Object findValue(String expr,
Class toType)
expr - OGNL expression.toType - the type expected to find.
protected String determineActionURL(String action,
String namespace,
String method,
HttpServletRequest req,
HttpServletResponse res,
Map parameters,
String scheme,
boolean includeContext,
boolean encodeResult,
boolean escapeXml)
ActionMapper.
action - the actionnamespace - the namespacemethod - the methodreq - HTTP requestres - HTTP responseparameters - parametersscheme - http or httpsincludeContext - should the context path be included or notencodeResult - should the url be encoded
protected String determineNamespace(String namespace,
com.opensymphony.xwork.util.OgnlValueStack stack,
HttpServletRequest req)
namespace - the namespacestack - OGNL value stackreq - HTTP request
public void copyParams(Map params)
params - the parameters to copy.protected String toString(Throwable t)
t - the exception
public Map getParameters()
public void addAllParameters(Map params)
params - the parameters to add.
public void addParameter(String key,
Object value)
key - the key of the new parameter to add.value - the value assoicated with the key.public String getId()
public void setId(String id)
public boolean usesBody()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||