org.olat.core.gui.render
Class Renderer

java.lang.Object
  extended by org.olat.core.gui.render.Renderer

public class Renderer
extends java.lang.Object

Author:
Felix Jost

Method Summary
 Component findComponent(java.lang.String componentName)
          searches the rootcomponent of this renderer and all children recursively for a component by its name
static java.lang.String getComponentPrefix(Component comp)
          returns e.g.
 GlobalSettings getGlobalSettings()
           
static Renderer getInstance(Container renderContainer, Translator translator, URLBuilder ubu, RenderResult renderResult, GlobalSettings globalSettings)
           
 Translator getTranslator()
           
 java.lang.String getUriPrefix()
           
 URLBuilder getUrlBuilder()
           
 StringOutput render(Component source)
          used by window.java for top rendering or subtree rendering
 StringOutput render(Component source, java.lang.String[] args)
          used by velocityrenderdecorator and method render(component) above
 void render(StringOutput sb, Component source, java.lang.String[] args)
          used by the renderer, and also by the panel and tabbedpane renderer to delegate rendering
 void renderBodyOnLoadJSFunctionCall(StringOutput sb, Component source)
          to be called by VelocityRenderDecorator only
 void renderBodyOnLoadJSFunctionCall(StringOutput sb, Component source, RenderingState rstate)
          renders the HTMLHeader-Part which this component comp needs.
 void renderCommandURI(StringOutput target, java.lang.String command)
          please do not use anymore!
 void renderHeaderIncludes(StringOutput sb, Component source)
           
 void renderHeaderIncludes(StringOutput sb, Component source, RenderingState rstate)
           
static void renderNormalURI(StringOutput target, java.lang.String URI)
          Note: use only rarely - e.g.
static void renderStaticURI(StringOutput target, java.lang.String URI)
          Note: use only rarely - all non-generic js libs and css classes should be included using JsAndCssComponent, and all images should be referenced with the css background-image capability.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static Renderer getInstance(Container renderContainer,
                                   Translator translator,
                                   URLBuilder ubu,
                                   RenderResult renderResult,
                                   GlobalSettings globalSettings)
Parameters:
renderContainer - is used as a starting node for searching a component
translator - the translator to be used to translate
ubu -
renderResult -
globalSettings -
Returns:
an instance of the renderer

renderNormalURI

public static void renderNormalURI(StringOutput target,
                                   java.lang.String URI)
Note: use only rarely - e.g. for static redirects to login screen. Renders a uri which is mounted to the webapp/ directory of your webapplication.

For static references (e.g. images which cannot be delivered using css): use renderStaticURI

Parameters:
target -
URI - e.g. myspecialdispatcher/somestuff

renderStaticURI

public static void renderStaticURI(StringOutput target,
                                   java.lang.String URI)
Note: use only rarely - all non-generic js libs and css classes should be included using JsAndCssComponent, and all images should be referenced with the css background-image capability.
renders a uri which is mounted to the webapp/static/ directory of your webapplication.

Parameters:
target -
URI - e.g. img/specialimagenotpossiblewithcss.jpg

renderCommandURI

public void renderCommandURI(StringOutput target,
                             java.lang.String command)
please do not use anymore!

Parameters:
target -
command -

renderBodyOnLoadJSFunctionCall

public void renderBodyOnLoadJSFunctionCall(StringOutput sb,
                                           Component source,
                                           RenderingState rstate)
renders the HTMLHeader-Part which this component comp needs. e.g. the richtext component needs some css and javascript libraries an velocity-container is a special case: it should collect the information from all the children that are visible since all could be renderer. since the actual rendering of a component depends on the page and is not know beforehand, we could include some css/js which turns out not to be needed in this request, but it is cached by the browser anyway, so it should not matter to much. a little advice if you want to do it perfectly : program the controller in such a way that they make a component invisible if not needed

Parameters:
sb -
source -
See Also:
org.olat.core.gui.render.ui.ComponentRenderer

renderBodyOnLoadJSFunctionCall

public void renderBodyOnLoadJSFunctionCall(StringOutput sb,
                                           Component source)
to be called by VelocityRenderDecorator only

Parameters:
sb -
source -

renderHeaderIncludes

public void renderHeaderIncludes(StringOutput sb,
                                 Component source,
                                 RenderingState rstate)
Parameters:
sb -
source -

renderHeaderIncludes

public void renderHeaderIncludes(StringOutput sb,
                                 Component source)

findComponent

public Component findComponent(java.lang.String componentName)
searches the rootcomponent of this renderer and all children recursively for a component by its name

Parameters:
componentName -
Returns:

render

public StringOutput render(Component source)
used by window.java for top rendering or subtree rendering

Parameters:
source -
Returns:

render

public StringOutput render(Component source,
                           java.lang.String[] args)
used by velocityrenderdecorator and method render(component) above

Parameters:
source -
args -
Returns:

render

public void render(StringOutput sb,
                   Component source,
                   java.lang.String[] args)
used by the renderer, and also by the panel and tabbedpane renderer to delegate rendering

Parameters:
sb -
source -
args -

getComponentPrefix

public static java.lang.String getComponentPrefix(Component comp)
returns e.g. "o_c123" where 123 is the component id

Parameters:
comp - the component to get the id

getUrlBuilder

public URLBuilder getUrlBuilder()
Returns:
URLBuilder

getTranslator

public Translator getTranslator()
Returns:
Translator

getGlobalSettings

public GlobalSettings getGlobalSettings()
Returns:

getUriPrefix

public java.lang.String getUriPrefix()
Returns:
the current uri prefix, e.g. /demo/go (=the prefix for the window just being rendered)