org.olat.core.gui.components.velocity
Class VelocityContainer

java.lang.Object
  extended by org.olat.core.gui.components.Component
      extended by org.olat.core.gui.components.Container
          extended by org.olat.core.gui.components.velocity.VelocityContainer

public class VelocityContainer
extends Container

Description:

Author:
Felix Jost

Field Summary
static java.lang.String COMMAND_ID
          Comment for COMMAND_ID
 
Constructor Summary
VelocityContainer(java.lang.String componentName, java.lang.Class baseClass, java.lang.String pageName, Translator trans, Controller listeningController)
          Constructor to create a VC container from a given base class and the page name
VelocityContainer(java.lang.String componentName, java.lang.String pagePath, Translator trans, Controller listeningController)
          Constructor to create a VC container from a given file path
 
Method Summary
 void contextPut(java.lang.String key, java.lang.Object value)
          Add a variable to the velocity context.
 void contextRemove(java.lang.String key)
          Remove a variable from the velocity context
 org.apache.velocity.context.Context getContext()
           
 java.lang.String getExtendedDebugInfo()
           
 ComponentRenderer getHTMLRendererSingleton()
           
 java.lang.String getPage()
           
 void setPage(java.lang.String page)
          Deprecated. Rather use panels to swap views
 void setTranslator(Translator newTranslator)
          Sets the translator for this VC.
 
Methods inherited from class org.olat.core.gui.components.Container
getComponent, getComponents, put, put, remove
 
Methods inherited from class org.olat.core.gui.components.Component
addListener, debuginfoGetListeners, dispatchRequest, getAndClearLatestFiredEvent, getComponentName, getDispatchID, getLatestDispatchedController, getListenerInfo, getParent, getSpanAsDomReplaceable, getTimestamp, getTranslator, isDirty, isDirtyForUser, isDomReplaceable, isEnabled, isVisible, setDirty, setDomReplaceable, setEnabled, setSpanAsDomReplaceable, setVisible, toString, validate
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

COMMAND_ID

public static final java.lang.String COMMAND_ID
Comment for COMMAND_ID

See Also:
Constant Field Values
Constructor Detail

VelocityContainer

public VelocityContainer(java.lang.String componentName,
                         java.lang.String pagePath,
                         Translator trans,
                         Controller listeningController)
Constructor to create a VC container from a given file path

Parameters:
componentName - Name of component, displayed in debug mode
pagePath - Full path to velocity page
trans - Translator to be used
listeningController - the listenenController; may be null if the caller has no need to register for events

VelocityContainer

public VelocityContainer(java.lang.String componentName,
                         java.lang.Class baseClass,
                         java.lang.String pageName,
                         Translator trans,
                         Controller listeningController)
Constructor to create a VC container from a given base class and the page name

Parameters:
componentName - Name of component, displayed in debug mode
baseClass -
pageName - page name that is available within this base class package
trans - Translator to be used
listeningController - the listenenController; may be null if the caller has no need to register for events
Method Detail

getContext

public org.apache.velocity.context.Context getContext()
Returns:
the Velocity Context

contextPut

public void contextPut(java.lang.String key,
                       java.lang.Object value)
Add a variable to the velocity context. The methods of the objects accessed from the velocity file must be public. If not public you will get an error message in the olat.log that the reference is not valid.

Parameters:
key -
value -

contextRemove

public void contextRemove(java.lang.String key)
Remove a variable from the velocity context

Parameters:
key -

getPage

public java.lang.String getPage()
Returns:
String

setPage

public void setPage(java.lang.String page)
Deprecated. Rather use panels to swap views

Sets the page.

Parameters:
page - The page to set

getExtendedDebugInfo

public java.lang.String getExtendedDebugInfo()
Overrides:
getExtendedDebugInfo in class Container
Returns:
the extended debuginfo
See Also:
Container.getExtendedDebugInfo()

getHTMLRendererSingleton

public ComponentRenderer getHTMLRendererSingleton()
Specified by:
getHTMLRendererSingleton in class Component

setTranslator

public void setTranslator(Translator newTranslator)
Sets the translator for this VC. Note that this should be called before adding any child components using put(component).

put(component) will set the current translator on the component if the component itself does not yet have a translator set. The translator of the components can't be modified afterwards.

This method overrides the protected setTranslator() method from the component interface and make it public to support workflows where the velocity container is created in the constructor (e.g. FormBasicController) but the translator might be modified later (using some special fallback translator or such)

Parameters:
translator - The translator to set