jet.servlet
Class JetRenderer

java.lang.Object
  extended by jet.servlet.JetRenderer
All Implemented Interfaces:
Resetable

public class JetRenderer
extends java.lang.Object
implements Resetable

This class is the base class for every action in jet. Defines how the actions will be executed.

Author:
Markus.Meisters@web.de

Field Summary
(package private) static org.apache.log4j.Logger log
          logger object
private  JetMessages messages
          stores the messages occur
private  long timeInMilis
          stores the start time of execution - needed to determine the time needed to do the action in the debug modus
 
Constructor Summary
JetRenderer()
           
 
Method Summary
private static java.lang.String doColor(java.lang.String data)
          This methods formats the keys of the localizer file for bedder visualisation
private static java.lang.String formatTemplateName(java.lang.String templatename)
           
private static java.util.TreeMap generateMessages(java.util.List messages)
          This method returns a TreeMap with the given messages
 JetMessages getMessages()
          Returns the messages generated by the action execution
 long getTimeInMilis()
          Returns the tim in milis usedto render the response
private  void processTemplate(java.util.AbstractMap data, freemarker.template.Template template, java.io.Writer out)
           
 java.lang.String processTemplate(JetContext context, java.util.AbstractMap data, java.lang.String templatename)
           
 void processTemplate(JetContext context, java.util.AbstractMap data, java.lang.String templatename, java.io.Writer out)
           
 java.lang.String processTemplate(JetContext context, java.util.Locale locale, java.util.AbstractMap data, java.lang.String templatename)
           
 void processTemplate(JetContext context, java.util.Locale locale, java.util.AbstractMap data, java.lang.String templatename, java.io.Writer out)
           
protected  void render(JetContext context, java.util.AbstractMap data, java.lang.String templatename)
          Method to render a template to response
 void reset()
           
 void setMessages(JetMessages messages)
          Sets the messages - if you delegate between actions and want to collect all messages you have to set the messages manually on the new action
protected  void setTimeInMilis(long secs)
          Sets the time
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

static org.apache.log4j.Logger log
logger object


messages

private JetMessages messages
stores the messages occur


timeInMilis

private long timeInMilis
stores the start time of execution - needed to determine the time needed to do the action in the debug modus

Constructor Detail

JetRenderer

public JetRenderer()
Method Detail

setTimeInMilis

protected final void setTimeInMilis(long secs)
Sets the time

Parameters:
secs - time in milisecs

generateMessages

private static final java.util.TreeMap generateMessages(java.util.List messages)
This method returns a TreeMap with the given messages

Parameters:
messages - messages to hash
Returns:
hashed messages

render

protected final void render(JetContext context,
                            java.util.AbstractMap data,
                            java.lang.String templatename)
                     throws JetActionException,
                            java.io.IOException
Method to render a template to response

Parameters:
data - the TreeMap with data structure to use
templatename - the name of the template to render
Throws:
JetActionException,IOException
JetActionException
java.io.IOException

doColor

private static final java.lang.String doColor(java.lang.String data)
This methods formats the keys of the localizer file for bedder visualisation

Parameters:
data - the string containing key to colorize
Returns:
the colorized string

getTimeInMilis

public long getTimeInMilis()
Returns the tim in milis usedto render the response

Returns:
long miliseconds

getMessages

public final JetMessages getMessages()
Returns the messages generated by the action execution


setMessages

public final void setMessages(JetMessages messages)
Sets the messages - if you delegate between actions and want to collect all messages you have to set the messages manually on the new action

Parameters:
messages - messages object

reset

public final void reset()
Specified by:
reset in interface Resetable
See Also:
Resetable.reset()

processTemplate

public java.lang.String processTemplate(JetContext context,
                                        java.util.AbstractMap data,
                                        java.lang.String templatename)
                                 throws JetActionException,
                                        java.io.IOException
Throws:
JetActionException
java.io.IOException

processTemplate

public java.lang.String processTemplate(JetContext context,
                                        java.util.Locale locale,
                                        java.util.AbstractMap data,
                                        java.lang.String templatename)
                                 throws JetActionException,
                                        java.io.IOException
Throws:
JetActionException
java.io.IOException

processTemplate

public void processTemplate(JetContext context,
                            java.util.AbstractMap data,
                            java.lang.String templatename,
                            java.io.Writer out)
                     throws JetActionException,
                            java.io.IOException
Throws:
JetActionException
java.io.IOException

processTemplate

public void processTemplate(JetContext context,
                            java.util.Locale locale,
                            java.util.AbstractMap data,
                            java.lang.String templatename,
                            java.io.Writer out)
                     throws JetActionException,
                            java.io.IOException
Throws:
JetActionException
java.io.IOException

processTemplate

private final void processTemplate(java.util.AbstractMap data,
                                   freemarker.template.Template template,
                                   java.io.Writer out)
                            throws JetActionException,
                                   java.io.IOException
Throws:
JetActionException
java.io.IOException

formatTemplateName

private static java.lang.String formatTemplateName(java.lang.String templatename)