org.olat.core.util.i18n.ui
Class InlineTranslationInterceptHandlerController

java.lang.Object
  extended by org.olat.core.gui.control.DefaultController
      extended by org.olat.core.gui.control.controller.BasicController
          extended by org.olat.core.util.i18n.ui.InlineTranslationInterceptHandlerController
All Implemented Interfaces:
Controller, ControllerEventListener, Disposable, InterceptHandler, InterceptHandlerInstance

public class InlineTranslationInterceptHandlerController
extends BasicController
implements InterceptHandlerInstance, InterceptHandler

Description:
This class acts both as the render intercepter and as the inline translation tool dispatcher. For each detected translated GUI element it will add a hover event which triggers an edit link.

When the server is configured as translation server, the inline translation tool will start in language translation mode. Otherwhise it will start in language customizing mode (overlay edit)

Initial Date: 16.09.2008

Author:
gnaegi

Method Summary
static void buildInlineTranslationLink(java.lang.String combinedKeyWithID, StringOutput link, Translator inlineTrans, URLBuilder inlineTranslationURLBuilder)
          Helper method to build the inline translation link.
 ComponentRenderer createInterceptComponentRenderer(ComponentRenderer originalRenderer)
           
 InterceptHandlerInstance createInterceptHandlerInstance()
           
static java.lang.String replaceLocalizationMarkupWithHTML(java.lang.String stringWithMarkup, URLBuilder inlineTranslationURLBuilder, Translator inlineTrans)
          Helper method to replace the translations that are wrapped with some identifyer markup by the translator with HTML markup to allow inline editing.
 
Methods inherited from class org.olat.core.gui.control.DefaultController
addControllerListener, addLoggingResourceable, dispatchEvent, dispatchEvent, dispose, getControllerCount, getInitialComponent, getUserActivityLogger, getWindowControlForDebug, isDisposed, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

createInterceptHandlerInstance

public InterceptHandlerInstance createInterceptHandlerInstance()
Specified by:
createInterceptHandlerInstance in interface InterceptHandler
Returns:
the instance, or null, if there is no intercept handler
See Also:
InterceptHandler.createInterceptHandlerInstance()

createInterceptComponentRenderer

public ComponentRenderer createInterceptComponentRenderer(ComponentRenderer originalRenderer)
Specified by:
createInterceptComponentRenderer in interface InterceptHandlerInstance
Returns:

replaceLocalizationMarkupWithHTML

public static java.lang.String replaceLocalizationMarkupWithHTML(java.lang.String stringWithMarkup,
                                                                 URLBuilder inlineTranslationURLBuilder,
                                                                 Translator inlineTrans)
Helper method to replace the translations that are wrapped with some identifyer markup by the translator with HTML markup to allow inline editing.

This method is public and static to be testable with jUnit.

Parameters:
stringWithMarkup - The text that contains translated elements that are wrapped with some identifyers
inlineTranslationURLBuilder - URI builder used to create the inline translation links
inlineTrans -
Returns:

buildInlineTranslationLink

public static void buildInlineTranslationLink(java.lang.String combinedKeyWithID,
                                              StringOutput link,
                                              Translator inlineTrans,
                                              URLBuilder inlineTranslationURLBuilder)
Helper method to build the inline translation link.

Public and static so that it can be used by the jUnit testcase

Parameters:
combinedKeyWithID - e.g. bundle.name:key.name:ramuniqueid
link -
inlineTrans -
inlineTranslationURLBuilder -