public abstract class Formatter extends Object
Constructor and Description |
---|
Formatter() |
Modifier and Type | Method and Description |
---|---|
void |
afterRendering(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Called after the formatter finished rendering
|
String |
formatObject(Object obj)
Given an object it returns a string representation.
|
protected String |
getDefaultLang() |
protected PanelDriver |
getDriver() |
protected String |
getEncoding() |
protected String |
getLang() |
protected Locale |
getLocale() |
protected LocaleManager |
getLocaleManager() |
protected String |
getLocalizedValue(Map<String,String> m) |
protected Panel |
getPanel() |
protected Object |
getParameter(String name)
Return a parameter by its name.
|
protected PanelProvider |
getProvider() |
protected Section |
getSection() |
protected Workspace |
getWorkspace() |
protected void |
includePage(String pageName) |
protected void |
renderFragment(String fragmentName)
Orders the processing of fragment with given name.
|
abstract void |
service(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Perform the required logic for this Formatter.
|
protected void |
setAttribute(String name,
boolean value)
Sets a parameter for the fragment.
|
protected void |
setAttribute(String name,
byte value)
Sets a parameter for the fragment.
|
protected void |
setAttribute(String name,
char value)
Sets a parameter for the fragment.
|
protected void |
setAttribute(String name,
double value)
Sets a parameter for the fragment.
|
protected void |
setAttribute(String name,
float value)
Sets a parameter for the fragment.
|
protected void |
setAttribute(String name,
int value)
Sets a parameter for the fragment.
|
protected void |
setAttribute(String name,
long value)
Sets a parameter for the fragment.
|
protected void |
setAttribute(String name,
Object value)
Sets a parameter for the fragment.
|
protected void |
setAttribute(String name,
short value)
Sets a parameter for the fragment.
|
protected void |
setAttributeInterpreter(FormaterTagDynamicAttributesInterpreter interpreter) |
void |
setTag(FormatterTag tag)
Sets the parent tag.
|
protected void |
writeToOut(String text) |
public void setTag(FormatterTag tag)
protected LocaleManager getLocaleManager()
protected Locale getLocale()
protected String getLang()
protected String getEncoding()
protected void renderFragment(String fragmentName)
fragmentName
- Name of the fragment to be rendered.protected void includePage(String pageName)
protected void writeToOut(String text)
protected void setAttributeInterpreter(FormaterTagDynamicAttributesInterpreter interpreter)
protected void setAttribute(String name, Object value)
Example, of a iterating formatter:
StringBuffer sb = new StringBuffer();
for( int i= 0; i<10; i++){
sb.delete(0,sb.length())
sb.append( i );
setAttribute("index",sb);
renderFragment("output");
}
*
will generate an output like :
10 10 10 10 10 10 10 10 10 10
while the expected output is:
0 1 2 3 4 5 6 7 8 9
So, use objects and don't change them. This is usually easy to accomplish, by using
different instances, in the example above, replace sb.delete(0,sb.length()) with
sb = new StringBuffer();name
- Name of the parameter.value
- It's value. Must not be changed during all the execution.protected void setAttribute(String name, int value)
Example, of a iterating formatter:
StringBuffer sb = new StringBuffer();
for( int i= 0; i<10; i++){
sb.delete(0,sb.length())
sb.append( i );
setAttribute("index",sb);
renderFragment("output");
}
*
will generate an output like :
10 10 10 10 10 10 10 10 10 10
while the expected output is:
0 1 2 3 4 5 6 7 8 9
So, use objects and don't change them. This is usually easy to accomplish, by using
different instances, in the example above, replace sb.delete(0,sb.length()) with
sb = new StringBuffer();name
- Name of the parameter.value
- It's value. Must not be changed during all the execution.protected void setAttribute(String name, byte value)
Example, of a iterating formatter:
StringBuffer sb = new StringBuffer();
for( int i= 0; i<10; i++){
sb.delete(0,sb.length())
sb.append( i );
setAttribute("index",sb);
renderFragment("output");
}
*
will generate an output like :
10 10 10 10 10 10 10 10 10 10
while the expected output is:
0 1 2 3 4 5 6 7 8 9
So, use objects and don't change them. This is usually easy to accomplish, by using
different instances, in the example above, replace sb.delete(0,sb.length()) with
sb = new StringBuffer();name
- Name of the parameter.value
- It's value. Must not be changed during all the execution.protected void setAttribute(String name, long value)
Example, of a iterating formatter:
StringBuffer sb = new StringBuffer();
for( int i= 0; i<10; i++){
sb.delete(0,sb.length())
sb.append( i );
setAttribute("index",sb);
renderFragment("output");
}
*
will generate an output like :
10 10 10 10 10 10 10 10 10 10
while the expected output is:
0 1 2 3 4 5 6 7 8 9
So, use objects and don't change them. This is usually easy to accomplish, by using
different instances, in the example above, replace sb.delete(0,sb.length()) with
sb = new StringBuffer();name
- Name of the parameter.value
- It's value. Must not be changed during all the execution.protected void setAttribute(String name, short value)
Example, of a iterating formatter:
StringBuffer sb = new StringBuffer();
for( int i= 0; i<10; i++){
sb.delete(0,sb.length())
sb.append( i );
setAttribute("index",sb);
renderFragment("output");
}
*
will generate an output like :
10 10 10 10 10 10 10 10 10 10
while the expected output is:
0 1 2 3 4 5 6 7 8 9
So, use objects and don't change them. This is usually easy to accomplish, by using
different instances, in the example above, replace sb.delete(0,sb.length()) with
sb = new StringBuffer();name
- Name of the parameter.value
- It's value. Must not be changed during all the execution.protected void setAttribute(String name, boolean value)
Example, of a iterating formatter:
StringBuffer sb = new StringBuffer();
for( int i= 0; i<10; i++){
sb.delete(0,sb.length())
sb.append( i );
setAttribute("index",sb);
renderFragment("output");
}
*
will generate an output like :
10 10 10 10 10 10 10 10 10 10
while the expected output is:
0 1 2 3 4 5 6 7 8 9
So, use objects and don't change them. This is usually easy to accomplish, by using
different instances, in the example above, replace sb.delete(0,sb.length()) with
sb = new StringBuffer();name
- Name of the parameter.value
- It's value. Must not be changed during all the execution.protected void setAttribute(String name, char value)
Example, of a iterating formatter:
StringBuffer sb = new StringBuffer();
for( int i= 0; i<10; i++){
sb.delete(0,sb.length())
sb.append( i );
setAttribute("index",sb);
renderFragment("output");
}
*
will generate an output like :
10 10 10 10 10 10 10 10 10 10
while the expected output is:
0 1 2 3 4 5 6 7 8 9
So, use objects and don't change them. This is usually easy to accomplish, by using
different instances, in the example above, replace sb.delete(0,sb.length()) with
sb = new StringBuffer();name
- Name of the parameter.value
- It's value. Must not be changed during all the execution.protected void setAttribute(String name, float value)
Example, of a iterating formatter:
StringBuffer sb = new StringBuffer();
for( int i= 0; i<10; i++){
sb.delete(0,sb.length())
sb.append( i );
setAttribute("index",sb);
renderFragment("output");
}
*
will generate an output like :
10 10 10 10 10 10 10 10 10 10
while the expected output is:
0 1 2 3 4 5 6 7 8 9
So, use objects and don't change them. This is usually easy to accomplish, by using
different instances, in the example above, replace sb.delete(0,sb.length()) with
sb = new StringBuffer();name
- Name of the parameter.value
- It's value. Must not be changed during all the execution.protected void setAttribute(String name, double value)
Example, of a iterating formatter:
StringBuffer sb = new StringBuffer();
for( int i= 0; i<10; i++){
sb.delete(0,sb.length())
sb.append( i );
setAttribute("index",sb);
renderFragment("output");
}
*
will generate an output like :
10 10 10 10 10 10 10 10 10 10
while the expected output is:
0 1 2 3 4 5 6 7 8 9
So, use objects and don't change them. This is usually easy to accomplish, by using
different instances, in the example above, replace sb.delete(0,sb.length()) with
sb = new StringBuffer();name
- Name of the parameter.value
- It's value. Must not be changed during all the execution.protected Object getParameter(String name)
name
- Parameter name to be used.public abstract void service(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws FormatterException
request
- user requestresponse
- response to the userFormatterException
- in case of an unexpected exception.public void afterRendering(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws FormatterException
request
- response
- FormatterException
public String formatObject(Object obj)
protected Panel getPanel()
protected Workspace getWorkspace()
protected Section getSection()
protected PanelProvider getProvider()
protected PanelDriver getDriver()
protected String getDefaultLang()
Copyright © 2012-2015 JBoss by Red Hat. All Rights Reserved.