org.olat.core.gui.components.link
Class Link

java.lang.Object
  extended by org.olat.core.gui.components.Component
      extended by org.olat.core.gui.components.link.Link

public class Link
extends Component

Description:
Use @see LinkFactory to get Link objects.

Initial Date: July 06, 2006

Author:
Alexander Schneider, Patrick Brunner

Nested Class Summary
static class Link.MouseEvent
          valid events for the register mouse event stuff
 
Field Summary
static int BUTTON
           
static int BUTTON_SMALL
           
static int BUTTON_XSMALL
           
static int FLEXIBLEFORMLNK
           
static int LINK
           
static int LINK_BACK
           
static int LINK_CUSTOM_CSS
          each can be combined with NONTRANSLATED
can not be combined with each other!
static int NONTRANSLATED
          can be added to one of the following:
static int TOOLENTRY_CLOSE
           
static int TOOLENTRY_DEFAULT
          to be refactored later into own components
 
Method Summary
 java.lang.String getCommand()
           
 java.lang.String getCustomDisabledLinkCSS()
           
 java.lang.String getCustomEnabledLinkCSS()
           
 ComponentRenderer getHTMLRendererSingleton()
           
 java.lang.String getI18n()
           
 int getOffsetX()
          returs the mouse position when the link was clicked.
 int getOffsetY()
          returs the mouse position when the link was clicked.
 int getPresentation()
           
 java.lang.String getTarget()
           
 java.lang.String getTitle()
          The link title, text that shows up when mouse hovers over link.
 java.lang.Object getUserObject()
           
 boolean isAjaxEnabled()
           
 boolean isSuppressDirtyFormWarning()
           
 void registerForMousePositionEvent(boolean b)
          get the mouse position as event.command coded as x123y456 and appended to the UserRequest catch it inside the event method with the ureq.getModuleUri() method.
Uses prototype.js
 void registerMouseEvent(Link.MouseEvent event, java.lang.String handlerFunction)
          register a javascript function to an event of this link TODO:gs:b may pass the event and the link element to the function as arguments
Uses prototype.js
 void removeCSS()
           
 void setAccessKey(java.lang.String accessKey)
          sets the accesskey, e.g.
 void setAjaxEnabled(boolean ajaxEnabled)
           
 void setCustomDisabledLinkCSS(java.lang.String customDisabledLinkCSS)
           
 void setCustomDisplayText(java.lang.String customDisplayText)
           
 void setCustomEnabledLinkCSS(java.lang.String customEnabledLinkCSS)
           
 void setEnabled(boolean b)
           
 void setSuppressDirtyFormWarning(boolean suppressDirtyFormWarning)
          When pressing this button, should the system prevent the check for any unsubmitted forms?
 void setTarget(java.lang.String target)
          allows setting an custom href target like "_blank" which opens an link in a new window.
 void setTextReasonForDisabling(java.lang.String textReasonForDisabling)
           
 void setTitle(java.lang.String i18nKey)
          Set an link title which gets displayed when hovering over the link.
 void setTooltip(Component comp, boolean stricky)
          sets a tooltip with a more complext content which is passed as an component
 void setTooltip(java.lang.String tooltipI18nKey, boolean sticky)
          Sets a tooltip out off the text from the provided i18n key.
 void setUserObject(java.lang.Object userObject)
           
 void setXYOffest(UserRequest ureq)
          convenience method to set the x and y values you get by link.registerForMousePositionEvent(true) to x and y
 
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, setSpanAsDomReplaceable, setVisible, toString, validate
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

LINK_CUSTOM_CSS

public static final int LINK_CUSTOM_CSS
each can be combined with NONTRANSLATED
can not be combined with each other!

See Also:
Constant Field Values

BUTTON_XSMALL

public static final int BUTTON_XSMALL
See Also:
Constant Field Values

BUTTON_SMALL

public static final int BUTTON_SMALL
See Also:
Constant Field Values

BUTTON

public static final int BUTTON
See Also:
Constant Field Values

LINK_BACK

public static final int LINK_BACK
See Also:
Constant Field Values

LINK

public static final int LINK
See Also:
Constant Field Values

TOOLENTRY_DEFAULT

public static final int TOOLENTRY_DEFAULT
to be refactored later into own components

See Also:
Constant Field Values

TOOLENTRY_CLOSE

public static final int TOOLENTRY_CLOSE
See Also:
Constant Field Values

NONTRANSLATED

public static final int NONTRANSLATED
can be added to one of the following:

See Also:
Constant Field Values

FLEXIBLEFORMLNK

public static final int FLEXIBLEFORMLNK
See Also:
Constant Field Values
Method Detail

getHTMLRendererSingleton

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

getCommand

public java.lang.String getCommand()

getI18n

public java.lang.String getI18n()

getPresentation

public int getPresentation()

getTitle

public java.lang.String getTitle()
The link title, text that shows up when mouse hovers over link. Not the link text.
If ((getPresentation() - Link.NONTRANSLATED) >= 0 ) the returned title is already translated, otherwise an untranslated i18n key is returned

Returns:

setTitle

public void setTitle(java.lang.String i18nKey)
Set an link title which gets displayed when hovering over the link.
If ((getPresentation() - Link.NONTRANSLATED) >= 0 ) the provided title is already translated, otherwise its an untranslated i18n key

Parameters:
the - i18n key or the translated key depending on presentation mode

setEnabled

public void setEnabled(boolean b)
Overrides:
setEnabled in class Component
Parameters:
true - or false
See Also:
Component.setEnabled(boolean)

setTextReasonForDisabling

public void setTextReasonForDisabling(java.lang.String textReasonForDisabling)

getCustomDisabledLinkCSS

public java.lang.String getCustomDisabledLinkCSS()
Returns:
the custom CSS class used for a disabled link

setCustomDisabledLinkCSS

public void setCustomDisabledLinkCSS(java.lang.String customDisabledLinkCSS)
Parameters:
customDisabledLinkCSS - the custom CSS class used for a disabled link

getCustomEnabledLinkCSS

public java.lang.String getCustomEnabledLinkCSS()
Returns:
the custom CSS class used for a enabled link

setCustomEnabledLinkCSS

public void setCustomEnabledLinkCSS(java.lang.String customEnabledLinkCSS)
Parameters:
customEnabledLinkCSS - the custom CSS class used for a enabled link

removeCSS

public void removeCSS()

getTarget

public java.lang.String getTarget()

setTarget

public void setTarget(java.lang.String target)
allows setting an custom href target like "_blank" which opens an link in a new window. As ajax links never should open in a new window, the setTarget automatically disables the ajax feature in the link.

Parameters:
target -

getUserObject

public java.lang.Object getUserObject()

setUserObject

public void setUserObject(java.lang.Object userObject)

setAccessKey

public void setAccessKey(java.lang.String accessKey)
sets the accesskey, e.g. "5" -> Alt+5 then focusses on this link

Parameters:
accessKey -

setAjaxEnabled

public void setAjaxEnabled(boolean ajaxEnabled)

isAjaxEnabled

public boolean isAjaxEnabled()

setSuppressDirtyFormWarning

public void setSuppressDirtyFormWarning(boolean suppressDirtyFormWarning)
When pressing this button, should the system prevent the check for any unsubmitted forms?

Parameters:
suppressDirtyFormWarning - true: don't check for dirt forms; false: check for dirty forms (default)

isSuppressDirtyFormWarning

public boolean isSuppressDirtyFormWarning()
Returns:
true: don't check for dirt forms; false: check for dirty forms (default)

setCustomDisplayText

public void setCustomDisplayText(java.lang.String customDisplayText)

registerForMousePositionEvent

public void registerForMousePositionEvent(boolean b)
get the mouse position as event.command coded as x123y456 and appended to the UserRequest catch it inside the event method with the ureq.getModuleUri() method.
Uses prototype.js

Parameters:
b -

registerMouseEvent

public void registerMouseEvent(Link.MouseEvent event,
                               java.lang.String handlerFunction)
register a javascript function to an event of this link TODO:gs:b may pass the event and the link element to the function as arguments
Uses prototype.js

Parameters:
event -
handlerFunction: - A javascript function name

setXYOffest

public void setXYOffest(UserRequest ureq)
convenience method to set the x and y values you get by link.registerForMousePositionEvent(true) to x and y

Parameters:
ureq -
offsetX -
offsetY -

getOffsetX

public int getOffsetX()
returs the mouse position when the link was clicked. Only available if registerForMousePositionEvent is set true

Returns:
offset x of mouse position

getOffsetY

public int getOffsetY()
returs the mouse position when the link was clicked. Only available if registerForMousePositionEvent is set true

Returns:
offset y of mouse position

setTooltip

public void setTooltip(java.lang.String tooltipI18nKey,
                       boolean sticky)
Sets a tooltip out off the text from the provided i18n key. Tooltips are fastser appearing than normal title tags and can contain HTML tags.

Parameters:
sticky: - sets the tooltip sticky, which means the user has to click the tip to disappear

setTooltip

public void setTooltip(Component comp,
                       boolean stricky)
sets a tooltip with a more complext content which is passed as an component

Parameters:
comp -
stricky - if true the user has to close the tooltip himself