Class AbstractJspFactory

java.lang.Object
net.sf.basedb.clients.web.extensions.AbstractJspFactory
All Implemented Interfaces:
DynamicActionAttributes
Direct Known Subclasses:
AbstractJspActionFactory, AbstractJspRendererFactory

public abstract class AbstractJspFactory extends Object implements DynamicActionAttributes
An abstract BASE class for action and renderer factories. This class provides support for adding scripts and stylesheets to the rendered JSP page.

Use the setScript(String) and setStylesheet(String) methods to add references to script and stylesheet files to the factory.

This class also implements generic parameter method setParameter(String, String) which will be used if no specific setter method for a parameter exists.

Note! The naming of these methods may be a bit misleading, since each call ADD the argument to a set. To remove items from the sets use the getScripts() and getStylesheets() methods.

Scripts and stylesheets that has been added to the factory will be propagated to the JspContext.addScript(String) and JspContext.addStylesheet(String) methods in the prepareContext(JspContext).

Version:
2.7
Author:
nicklas
Last modified
$Date: 2014-01-28 12:28:44 +0100 (ti, 28 jan 2014) $
  • Field Details

  • Constructor Details

    • AbstractJspFactory

      public AbstractJspFactory()
      Create a new factory instance.
  • Method Details

    • prepareContext

      protected void prepareContext(JspContext jspContext)
      Prepare the JSP context by adding all registered script and stylesheet references to it.
      Parameters:
      jspContext - The context to add the scripts to
    • setScript

      @VariableSetter @PathSetter public void setScript(String script)
      Add a reference to a javascript file to the factory.
      Parameters:
      script - The script to add
    • setStylesheet

      @VariableSetter @PathSetter public void setStylesheet(String stylesheet)
      Add a reference to a CSS stylesheet file to the factory.
      Parameters:
      stylesheet - The stylesheet to add
    • getScripts

      public Set<String> getScripts()
      Get a set with all script references.
      Returns:
      A set or null if no scripts has been added
    • getStylesheets

      public Set<String> getStylesheets()
      Get a set with all stylesheet references.
      Returns:
      A set or null if no stylesheets has been added
    • setParameter

      @VariableSetter @PathSetter public void setParameter(String key, String value)
      Generic parameter setter metod.
      Parameters:
      key - The name of the parameter
      value - The value of the parameter
      Since:
      3.3
    • getParameter

      public String getParameter(String key)
      Get a generic parameter value.
      Parameters:
      key - The name of the parameter
      Returns:
      The value of the parameter, or null if no value has been defined
      Since:
      3.3
    • getDynamicActionAttributes

      public Iterator<DynamicActionAttribute> getDynamicActionAttributes()
      Description copied from interface: DynamicActionAttributes
      Get an iterator that return all dynamic attributes. If no dynamic attributes have been defined, the method may return null or an iterator that doesn't return any elements.
      Specified by:
      getDynamicActionAttributes in interface DynamicActionAttributes
      Returns:
      An iterator or null