jbpm-form-modeler-request-dispatcher 6.2.0.CR4

org.jbpm.formModeler.service.bb.mvc.taglib.formatter
Class Formatter

java.lang.Object
  extended by org.jbpm.formModeler.service.bb.mvc.taglib.formatter.Formatter
Direct Known Subclasses:
ErrorReportFormatter, ForFormatter, MessagesComponentFormatter, TemplateFormatter

public abstract class Formatter
extends Object

This is the base class for all formatters. It provides methods to render output fragments, and to set attributes for the output fragments. Also, input parameters can be read.

ALL classes extending this class MUST provide documentation on the parameters they need, the fragments they render, and the attributes they pass to the fragments. The following template is to be used:

This class extends Formatter to provide support for [ ... what this class does ... ].

It expects the following input parameters:


Constructor Summary
Formatter()
           
 
Method Summary
 void afterRendering(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Called after the formatter finished rendering
protected  String getLang()
           
protected  Locale getLocale()
           
protected  LocaleManager getLocaleManager()
           
protected  Object getParameter(String name)
          Return a parameter by its name.
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)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Formatter

public Formatter()
Method Detail

setTag

public void setTag(FormatterTag tag)
Sets the parent tag. Called by the framework.


getLocaleManager

protected LocaleManager getLocaleManager()

getLocale

protected Locale getLocale()

getLang

protected String getLang()

renderFragment

protected void renderFragment(String fragmentName)
Orders the processing of fragment with given name.

Parameters:
fragmentName - Name of the fragment to be rendered.

includePage

protected void includePage(String pageName)

writeToOut

protected void writeToOut(String text)

setAttributeInterpreter

protected void setAttributeInterpreter(FormaterTagDynamicAttributesInterpreter interpreter)

setAttribute

protected void setAttribute(String name,
                            Object value)
Sets a parameter for the fragment. The object set as parameter value must not be changed during all the execution, otherwise the result won't be as expected. That is, if this object has a method that changes its content, this method must not be called by the Formatter during the service() method. Otherwise, all the rendering performed by the fragmentValue tag will use the *last* version of the object, the one existing after the invocation of service method, which is probably not expected.

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();

Parameters:
name - Name of the parameter.
value - It's value. Must not be changed during all the execution.

setAttribute

protected void setAttribute(String name,
                            int value)
Sets a parameter for the fragment. The object set as parameter value must not be changed during all the execution, otherwise the result won't be as expected. That is, if this object has a method that changes its content, this method must not be called by the Formatter during the service() method. Otherwise, all the rendering performed by the fragmentValue tag will use the *last* version of the object, the one existing after the invocation of service method, which is probably not expected.

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();

Parameters:
name - Name of the parameter.
value - It's value. Must not be changed during all the execution.

setAttribute

protected void setAttribute(String name,
                            byte value)
Sets a parameter for the fragment. The object set as parameter value must not be changed during all the execution, otherwise the result won't be as expected. That is, if this object has a method that changes its content, this method must not be called by the Formatter during the service() method. Otherwise, all the rendering performed by the fragmentValue tag will use the *last* version of the object, the one existing after the invocation of service method, which is probably not expected.

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();

Parameters:
name - Name of the parameter.
value - It's value. Must not be changed during all the execution.

setAttribute

protected void setAttribute(String name,
                            long value)
Sets a parameter for the fragment. The object set as parameter value must not be changed during all the execution, otherwise the result won't be as expected. That is, if this object has a method that changes its content, this method must not be called by the Formatter during the service() method. Otherwise, all the rendering performed by the fragmentValue tag will use the *last* version of the object, the one existing after the invocation of service method, which is probably not expected.

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();

Parameters:
name - Name of the parameter.
value - It's value. Must not be changed during all the execution.

setAttribute

protected void setAttribute(String name,
                            short value)
Sets a parameter for the fragment. The object set as parameter value must not be changed during all the execution, otherwise the result won't be as expected. That is, if this object has a method that changes its content, this method must not be called by the Formatter during the service() method. Otherwise, all the rendering performed by the fragmentValue tag will use the *last* version of the object, the one existing after the invocation of service method, which is probably not expected.

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();

Parameters:
name - Name of the parameter.
value - It's value. Must not be changed during all the execution.

setAttribute

protected void setAttribute(String name,
                            boolean value)
Sets a parameter for the fragment. The object set as parameter value must not be changed during all the execution, otherwise the result won't be as expected. That is, if this object has a method that changes its content, this method must not be called by the Formatter during the service() method. Otherwise, all the rendering performed by the fragmentValue tag will use the *last* version of the object, the one existing after the invocation of service method, which is probably not expected.

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();

Parameters:
name - Name of the parameter.
value - It's value. Must not be changed during all the execution.

setAttribute

protected void setAttribute(String name,
                            char value)
Sets a parameter for the fragment. The object set as parameter value must not be changed during all the execution, otherwise the result won't be as expected. That is, if this object has a method that changes its content, this method must not be called by the Formatter during the service() method. Otherwise, all the rendering performed by the fragmentValue tag will use the *last* version of the object, the one existing after the invocation of service method, which is probably not expected.

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();

Parameters:
name - Name of the parameter.
value - It's value. Must not be changed during all the execution.

setAttribute

protected void setAttribute(String name,
                            float value)
Sets a parameter for the fragment. The object set as parameter value must not be changed during all the execution, otherwise the result won't be as expected. That is, if this object has a method that changes its content, this method must not be called by the Formatter during the service() method. Otherwise, all the rendering performed by the fragmentValue tag will use the *last* version of the object, the one existing after the invocation of service method, which is probably not expected.

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();

Parameters:
name - Name of the parameter.
value - It's value. Must not be changed during all the execution.

setAttribute

protected void setAttribute(String name,
                            double value)
Sets a parameter for the fragment. The object set as parameter value must not be changed during all the execution, otherwise the result won't be as expected. That is, if this object has a method that changes its content, this method must not be called by the Formatter during the service() method. Otherwise, all the rendering performed by the fragmentValue tag will use the *last* version of the object, the one existing after the invocation of service method, which is probably not expected.

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();

Parameters:
name - Name of the parameter.
value - It's value. Must not be changed during all the execution.

getParameter

protected Object getParameter(String name)
Return a parameter by its name. If the parameter is not defined, returns null

Parameters:
name - Parameter name to be used.
Returns:
a parameter by its name. If the parameter is not defined, returns null.

service

public abstract void service(javax.servlet.http.HttpServletRequest request,
                             javax.servlet.http.HttpServletResponse response)
                      throws FormatterException
Perform the required logic for this Formatter. Inside, the methods setAttribute and renderFragment are intended to be used to generate the output and set parameters for this output. Method getParameter is intended to retrieve input parameters by name.

Exceptions are to be catched inside the method, and not to be thrown, normally, formatters could use a error fragment to be displayed when an error happens in displaying. But if the error is unexpected, it can be wrapped inside a FormatterException.

Parameters:
request - user request
response - response to the user
Throws:
FormatterException - in case of an unexpected exception.

afterRendering

public void afterRendering(javax.servlet.http.HttpServletRequest request,
                           javax.servlet.http.HttpServletResponse response)
                    throws FormatterException
Called after the formatter finished rendering

Parameters:
request -
response -
Throws:
FormatterException

jbpm-form-modeler-request-dispatcher 6.2.0.CR4

Copyright © 2001-2015 JBoss by Red Hat. All Rights Reserved.