use of org.olat.core.gui.components.ComponentRenderer in project OpenOLAT by OpenOLAT.
the class DelegatingRenderer method render.
/**
* @see org.olat.core.gui.render.ui.ComponentRenderer#render(org.olat.core.gui.render.Renderer,
* org.olat.core.gui.render.StringOutput, org.olat.core.gui.components.Component,
* org.olat.core.gui.render.URLBuilder, org.olat.core.gui.translator.Translator,
* org.olat.core.gui.render.RenderResult, java.lang.String[])
*/
public void render(Renderer renderer, StringOutput sb, Component source, URLBuilder ubu, Translator translator, RenderResult renderResult, String[] args) {
ComponentRenderer cr = ((DelegatingComponent) source).getDelegateRenderer();
cr.render(renderer, sb, source, ubu, translator, renderResult, args);
}
use of org.olat.core.gui.components.ComponentRenderer in project OpenOLAT by OpenOLAT.
the class SegmentViewRenderer method render.
@Override
public void render(Renderer renderer, StringOutput sb, Component source, URLBuilder ubu, Translator translator, RenderResult renderResult, String[] args) {
SegmentViewComponent component = (SegmentViewComponent) source;
if (component.isEmpty() || (component.isDontShowSingleSegment() && component.getSegments().size() == 1)) {
return;
}
sb.append("<div class='o_segments btn-group btn-group-justified'>");
for (Component segment : component.getSegments()) {
ComponentRenderer subRenderer = segment.getHTMLRendererSingleton();
Translator subTranslator = segment.getTranslator();
subRenderer.render(renderer, sb, segment, ubu, subTranslator, renderResult, args);
}
sb.append("</div>");
}
use of org.olat.core.gui.components.ComponentRenderer in project OpenOLAT by OpenOLAT.
the class Renderer method render.
/**
* used by the renderer, and also by the panel and tabbedpane renderer to delegate rendering
* @param sb
* @param source
* @param args
*/
public void render(StringOutput sb, Component source, String[] args) {
GlobalSettings gset = getGlobalSettings();
boolean ajaxon = gset.getAjaxFlags().isIframePostEnabled();
// wrap with div's so javascript can replace this component by doing a document.getElementById(cid).innerHTML and so on.
boolean domReplaceable = source.isDomReplaceable();
boolean useSpan = source.getSpanAsDomReplaceable();
boolean domReplacementWrapperRequired = source.isDomReplacementWrapperRequired();
boolean forceDebugDivs = gset.isIdDivsForced();
if (source.isVisible()) {
int lev = renderResult.getNestedLevel();
if (lev > 60)
throw new AssertException("components were nested more than 60 times, assuming endless loop bug: latest comp name: " + source.getComponentName());
Translator componentTranslator = source.getTranslator();
// identifier for dom replacement
if (domReplaceable && domReplacementWrapperRequired && (ajaxon || forceDebugDivs)) {
if (useSpan) {
sb.append("<span id='o_c").append(source.getDispatchID());
} else {
sb.append("<div id='o_c").append(source.getDispatchID());
}
if (Settings.isDebuging()) {
// sb.append("' title='").append(source.getComponentName());
}
sb.append("'>");
}
ComponentRenderer cr = findComponentRenderer(source);
URLBuilder cubu = urlBuilder.createCopyFor(source);
renderResult.incNestedLevel();
// ---- for gui debug mode, direct the rendering to a special componentrenderer
InterceptHandlerInstance dhi = renderResult.getInterceptHandlerInstance();
if (dhi != null) {
cr = dhi.createInterceptComponentRenderer(cr);
}
try {
int preRenderLength = sb.length();
cr.render(this, sb, source, cubu, componentTranslator, renderResult, args);
if (preRenderLength == sb.length()) {
// Add bugfix for IE min-height on empty div problem: min-height does
// not get applied when div contains an empty comment.
// Affects IE6, IE7
sb.append("<!-- empty -->");
}
source.setDirty(false);
} catch (Exception e) {
// in order to produce a decent error msg, we need to postpone the
// exception
renderResult.setRenderExceptionInfo("exception while rendering component '" + source.getComponentName() + "' (" + source.getClass().getName() + ") " + source.getListenerInfo() + "<br />Message of exception: " + e.getMessage(), e);
}
renderResult.decNestedLevel();
if (ajaxon && domReplaceable && domReplacementWrapperRequired) {
if (useSpan) {
sb.append("</span>");
} else {
sb.append("</div>");
}
}
} else {
// not visible
if (domReplaceable && (ajaxon || forceDebugDivs)) {
// browser dom tree
if (useSpan) {
sb.append("<span id=\"o_c").append(source.getDispatchID()).append("\"></span>");
} else {
// Add bugfix for IE min-height on empty div problem: min-height does
// not get applied when div contains an empty comment.
// Affects IE6, IE7
sb.append("<div id=\"o_c").append(source.getDispatchID()).append("\"><!-- empty --></div>");
}
}
}
}
use of org.olat.core.gui.components.ComponentRenderer in project OpenOLAT by OpenOLAT.
the class Renderer method renderBodyOnLoadJSFunctionCall.
/**
* 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
*
* @param sb
* @param source
* @see org.olat.core.gui.render.ui.ComponentRenderer
*/
public void renderBodyOnLoadJSFunctionCall(StringOutput sb, Component source, RenderingState rstate) {
if (source != null && source.isVisible()) {
ComponentRenderer cr = findComponentRenderer(source);
cr.renderBodyOnLoadJSFunctionCall(this, sb, source, rstate);
}
}
use of org.olat.core.gui.components.ComponentRenderer in project OpenOLAT by OpenOLAT.
the class Renderer method renderHeaderIncludes.
/**
* @param sb
* @param source
*/
public void renderHeaderIncludes(StringOutput sb, Component source, RenderingState rstate) {
if (source != null && source.isVisible()) {
ComponentRenderer cr = findComponentRenderer(source);
URLBuilder cubu = urlBuilder.createCopyFor(source);
cr.renderHeaderIncludes(this, sb, source, cubu, translator, rstate);
}
}
Aggregations