org.olat.core.gui.components.text
Class TextComponent

java.lang.Object
  extended by org.olat.core.gui.components.Component
      extended by org.olat.core.gui.components.text.TextComponent

public class TextComponent
extends Component

Description:
The text component can be used to display a text message. The message can be either a string or an i18n key that is automatically translated during render time. Optionally a CSS class can be provided.

By default, the text component renders in a span tag. If you want this span to be changed to a div tag, use the setSpanAsDomReplaceable() method.

Initial Date: 10.11.2009

Author:
gnaegi

Method Summary
 java.lang.String getCssClass()
          Get the optional CSS class(es)
 java.lang.String getDisplayText()
          Get the display text for this component.
 ComponentRenderer getHTMLRendererSingleton()
           
 void setCssClass(java.lang.String cssClass)
          Set an optional CSS class(es).
 void setI18nKey(java.lang.String i18nKey)
          Set a new i18n key.
 void setText(java.lang.String text)
          Set a new text that will not be translated.
 
Methods inherited from class org.olat.core.gui.components.Component
addListener, debuginfoGetListeners, dispatchRequest, getAndClearLatestFiredEvent, getComponentName, getDispatchID, getExtendedDebugInfo, 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
 

Method Detail

getHTMLRendererSingleton

public ComponentRenderer getHTMLRendererSingleton()
Specified by:
getHTMLRendererSingleton in class Component
See Also:
Component.getHTMLRendererSingleton()

setI18nKey

public void setI18nKey(java.lang.String i18nKey)
Set a new i18n key. Translator must be available.

Parameters:
i18nKey - the key or NULL to reset

setText

public void setText(java.lang.String text)
Set a new text that will not be translated. Overrides any previously set i18n keys.

Parameters:
text - the text or NULL to reset.

getDisplayText

public java.lang.String getDisplayText()
Get the display text for this component. If an explicit text is setted, this one will be displayed. If not, the i18n key will be translated.

Returns:
The translated text or NULL if not set

setCssClass

public void setCssClass(java.lang.String cssClass)
Set an optional CSS class(es). Use setSpanAsDomReplaceable() to decide if a span or div tag should be used to wrap the text.

Parameters:
cssClass -

getCssClass

public java.lang.String getCssClass()
Get the optional CSS class(es)

Returns:
the class(es) or NULL