Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.turbine.modules.screens
Class TemplateScreen

    java.lang.Object
      org.apache.turbine.modules.Assembler
          org.apache.turbine.modules.Screen
              org.apache.turbine.modules.screens.TemplateScreen

Direct Known Subclasses:
  BaseJspScreen, VelocityScreen

    public abstract class TemplateScreen

extends Screen

Template Screen. Base Template Screens should extend this class and override the buildTemplate() method. Users of the particular service can then override the doBuildTemplate() for any specific pre-processing. You can also override the doBuild() method in order to add extra functionality to your system, but you need to make sure to at least duplicate the existing functionality in order for things to work. Look at the code for the doBuild() method to get an idea of what is going on there (it is quite simple really).

Version:
  $Id: TemplateScreen.java 938645 2010-04-27 20:57:51Z tv $
Author:
  Dave Bryson, Henning P. Schmiedehausen, Peter Courcoux

Field Summary
`protected org.apache.commons.logging.Log` | `log` Logging

Fields inherited from class org.apache.turbine.modules.Screen
`CACHE_SIZE_DEFAULT, CACHE_SIZE_KEY, NAME, PREFIX`

Constructor Summary
`TemplateScreen()` Default constructor

Method Summary
`org.apache.ecs.ConcreteElement` | `buildTemplate(PipelineData pipelineData)` This method should be implemented by Base template classes.
`abstract org.apache.ecs.ConcreteElement` | `buildTemplate(RunData data)` Deprecated. Use PipelineData version instead.
`protected org.apache.ecs.ConcreteElement` | `doBuild(PipelineData pipelineData)` This method is called by the Screenloader to construct the Screen.
`protected org.apache.ecs.ConcreteElement` | `doBuild(RunData data)` Deprecated. Use PipelineData version instead.
`protected void` | `doBuildTemplate(PipelineData pipelineData)` This method should be overidden by subclasses that wish to add specific business logic.
`protected abstract void` | `doBuildTemplate(RunData data)` Deprecated. Use PipelineData version instead.
`protected void` | `doPostBuildTemplate(PipelineData pipelineData)` This method can be overridden to write code that executes when the template has been built (called from a finally clause, so executes regardless of whether an exception is thrown or not)
`protected void` | `doPostBuildTemplate(RunData data)` Deprecated. Use PipelineData version instead.
`void` | `doRedirect(PipelineData pipelineData, String template)` You can call this within a Screen to cause an internal redirect to happen.
`void` | `doRedirect(PipelineData pipelineData, String screen, String template)` You can call this within a Screen to cause an internal redirect to happen.
`void` | `doRedirect(RunData data, String template)` Deprecated. Use PipelineData version instead.
`void` | `doRedirect(RunData data, String screen, String template)` Deprecated. Use PipelineData version instead.
`static void` | `setTemplate(PipelineData pipelineData, String template)` This method is used when you want to short circuit a Screen and change the template that will be executed next.
`static void` | `setTemplate(RunData data, String template)` Deprecated. Use PipelineData version instead.

Methods inherited from class org.apache.turbine.modules.Screen
`build, build, getLayout, getLayout, getPrefix, prepareText, prepareTextMinimum, setLayout, setLayout`

Methods inherited from class org.apache.turbine.modules.Assembler
`getRunData`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### log

    protected org.apache.commons.logging.Log log

  Logging

Constructor Detail

### TemplateScreen

    public TemplateScreen()

  Default constructor

Method Detail

### doBuildTemplate

    protected abstract void doBuildTemplate(RunData data)
                                     throws Exception

  Deprecated. Use PipelineData version instead.

  This method should be overidden by subclasses that wish to add specific business logic.

  Parameters:
    `data` - Turbine information.
  Throws:
    `Exception` - A generic exception.

### doBuildTemplate

    protected void doBuildTemplate(PipelineData pipelineData)
                            throws Exception

  This method should be overidden by subclasses that wish to add specific business logic. Should revert to abstract when RunData has gone.

  Parameters:
    `data` - Turbine information.
  Throws:
    `Exception` - A generic exception.

### buildTemplate

    public abstract org.apache.ecs.ConcreteElement buildTemplate(RunData data)
                                                          throws Exception

  Deprecated. Use PipelineData version instead.

  This method should be implemented by Base template classes. It should contain the specific template service code to generate the template.

  Parameters:
    `data` - Turbine information.
  Returns:
    A ConcreteElement.
  Throws:
    `Exception` - A generic exception.

### buildTemplate

    public org.apache.ecs.ConcreteElement buildTemplate(PipelineData pipelineData)
                                                 throws Exception

  This method should be implemented by Base template classes. It should contain the specific template service code to generate the template. Should revert to abstract when RunData goes.

  Parameters:
    `data` - Turbine information.
  Returns:
    A ConcreteElement.
  Throws:
    `Exception` - A generic exception.

### doPostBuildTemplate

    protected void doPostBuildTemplate(RunData data)

  Deprecated. Use PipelineData version instead.

  This method can be overridden to write code that executes when the template has been built (called from a finally clause, so executes regardless of whether an exception is thrown or not)

### doPostBuildTemplate

    protected void doPostBuildTemplate(PipelineData pipelineData)

  This method can be overridden to write code that executes when the template has been built (called from a finally clause, so executes regardless of whether an exception is thrown or not)

### doBuild

    protected org.apache.ecs.ConcreteElement doBuild(RunData data)
                                              throws Exception

  Deprecated. Use PipelineData version instead.

  This method is called by the Screenloader to construct the Screen.

  Specified by:
    `doBuild` in class `Screen`
  Parameters:
    `data` - Turbine information.
  Returns:
    A ConcreteElement.
  Throws:
    `Exception` - A generic exception.

### doBuild

    protected org.apache.ecs.ConcreteElement doBuild(PipelineData pipelineData)
                                              throws Exception

  This method is called by the Screenloader to construct the Screen.

  Overrides:
    `doBuild` in class `Screen`
  Parameters:
    `data` - Turbine information.
  Returns:
    A ConcreteElement.
  Throws:
    `Exception` - A generic exception.

### setTemplate

    public static void setTemplate(RunData data,
                                   String template)

  Deprecated. Use PipelineData version instead.

  This method is used when you want to short circuit a Screen and change the template that will be executed next. Note that the current context will be applied to the next template that is executed. If you want to have the context executed for the next screen, to be the same one as the next screen, then you should use the TemplateScreen.doRedirect() method.

  Parameters:
    `data` - Turbine information.
    `template` - The name of the next template.

### setTemplate

    public static void setTemplate(PipelineData pipelineData,
                                   String template)

  This method is used when you want to short circuit a Screen and change the template that will be executed next. Note that the current context will be applied to the next template that is executed. If you want to have the context executed for the next screen, to be the same one as the next screen, then you should use the TemplateScreen.doRedirect() method.

  Parameters:
    `data` - Turbine information.
    `template` - The name of the next template.

### doRedirect

    public void doRedirect(RunData data,
                           String screen,
                           String template)
                    throws Exception

  Deprecated. Use PipelineData version instead.

  You can call this within a Screen to cause an internal redirect to happen. It essentially allows you to stop execution in one Screen and instantly execute another Screen. Don't worry, this does not do a HTTP redirect and also if you have anything added in the Context, it will get carried over.

  This class is useful if you have a Screen that submits to another Screen and you want it to do error validation before executing the other Screen. If there is an error, you can doRedirect() back to the original Screen.

  Parameters:
    `data` - Turbine information.
    `screen` - Name of screen to redirect to.
    `template` - Name of template.
  Throws:
    `Exception` - A generic exception.

### doRedirect

    public void doRedirect(PipelineData pipelineData,
                           String screen,
                           String template)
                    throws Exception

  You can call this within a Screen to cause an internal redirect to happen. It essentially allows you to stop execution in one Screen and instantly execute another Screen. Don't worry, this does not do a HTTP redirect and also if you have anything added in the Context, it will get carried over.

  This class is useful if you have a Screen that submits to another Screen and you want it to do error validation before executing the other Screen. If there is an error, you can doRedirect() back to the original Screen.

  Parameters:
    `data` - Turbine information.
    `screen` - Name of screen to redirect to.
    `template` - Name of template.
  Throws:
    `Exception` - A generic exception.

### doRedirect

    public void doRedirect(RunData data,
                           String template)
                    throws Exception

  Deprecated. Use PipelineData version instead.

  You can call this within a Screen to cause an internal redirect to happen. It essentially allows you to stop execution in one Screen and instantly execute another Screen. Don't worry, this does not do a HTTP redirect and also if you have anything added in the Context, it will get carried over.

  This class is useful if you have a Screen that submits to another Screen and you want it to do error validation before executing the other Screen. If there is an error, you can doRedirect() back to the original Screen.

  Parameters:
    `data` - Turbine information.
    `template` - Name of template.
  Throws:
    `Exception` - A generic exception.

### doRedirect

    public void doRedirect(PipelineData pipelineData,
                           String template)
                    throws Exception

  You can call this within a Screen to cause an internal redirect to happen. It essentially allows you to stop execution in one Screen and instantly execute another Screen. Don't worry, this does not do a HTTP redirect and also if you have anything added in the Context, it will get carried over.

  This class is useful if you have a Screen that submits to another Screen and you want it to do error validation before executing the other Screen. If there is an error, you can doRedirect() back to the original Screen.

  Parameters:
    `data` - Turbine information.
    `template` - Name of template.
  Throws:
    `Exception` - A generic exception.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000-2011 The Apache Software Foundation. All Rights Reserved.