org.opencms.widgets
Class A_CmsWidget

java.lang.Object
  extended by org.opencms.widgets.A_CmsWidget
All Implemented Interfaces:
I_CmsWidget
Direct Known Subclasses:
A_CmsGalleryWidget, A_CmsHtmlWidget, A_CmsSelectWidget, CmsCalendarWidget, CmsCategoryWidget, CmsCheckboxWidget, CmsColorpickerWidget, CmsDisplayWidget, CmsGroupWidget, CmsHttpUploadWidget, CmsInputWidget, CmsLocalizationWidget, CmsOrgUnitWidget, CmsPasswordWidget, CmsPrincipalWidget, CmsTextareaWidget, CmsUserWidget, CmsVfsFileWidget, CmsVfsImageWidget

public abstract class A_CmsWidget
extends java.lang.Object
implements I_CmsWidget

Base class for XML editor widgets.

Since:
6.0.0
Version:
$Revision: 1.26 $
Author:
Alexander Kandzior

Field Summary
static java.lang.String HELP_POSTFIX
          Postfix for melp message locale.
static java.lang.String LABEL_PREFIX
          Prefix for message locales.
 
Constructor Summary
protected A_CmsWidget()
          Default constructor.
protected A_CmsWidget(java.lang.String configuration)
          Constructor for preprocessing the configuration string.
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 java.lang.String getConfiguration()
          Returns the configuration string.
 java.lang.String getDialogHtmlEnd(CmsObject cms, I_CmsWidgetDialog widgetDialog, I_CmsWidgetParameter value)
          Generates the html to include at the end of the dialog for this widget.
 java.lang.String getDialogIncludes(CmsObject cms, I_CmsWidgetDialog widgetDialog)
          Generates the necessary JavaScript inclusion code for this widget.
 java.lang.String getDialogInitCall(CmsObject cms, I_CmsWidgetDialog widgetDialog)
          Generates the initialisation method JavaScript code for this widget.
 java.lang.String getDialogInitMethod(CmsObject cms, I_CmsWidgetDialog widgetDialog)
          Generates the initialization method JavaScript code for this widget.
 java.lang.String getHelpBubble(CmsObject cms, I_CmsWidgetDialog widgetDialog, I_CmsWidgetParameter param)
          Creates the HTML code for the help bubble for this widget.
static java.lang.String getHelpKey(I_CmsWidgetParameter param)
          Returns the localized help key for the provided widget parameter.
 java.lang.String getHelpText(I_CmsWidgetDialog widgetDialog, I_CmsWidgetParameter param)
          Creates a HTML <div> containing the help text for this widget.
protected  java.lang.String getJsHelpMouseHandler(I_CmsWidgetDialog widgetDialog, java.lang.String key, java.lang.String value)
          Returns the HTML for the JavaScript mouse handlers that show / hide the help text.
protected  java.lang.String getJSIncludeFile(java.lang.String fileName)
          Creates the tags to include external javascript files.
static java.lang.String getLabelKey(I_CmsWidgetParameter param)
          Returns the localized label key for the provided widget parameter.
 java.lang.String getWidgetStringValue(CmsObject cms, I_CmsWidgetDialog widgetDialog, I_CmsWidgetParameter param)
          Returns the I_CmsWidgetParameter.getStringValue(CmsObject) processed according to the output rules of this widget and the given widget dialog.
 int hashCode()
           
 void setConfiguration(java.lang.String configuration)
          Sets the configuration of this widget.
 void setEditorValue(CmsObject cms, java.util.Map formParameters, I_CmsWidgetDialog widgetDialog, I_CmsWidgetParameter param)
          Sets the value of in the given widget parameter by reading the "right" value from the offered map of parameters.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.opencms.widgets.I_CmsWidget
getDialogWidget, newInstance
 

Field Detail

HELP_POSTFIX

public static final java.lang.String HELP_POSTFIX
Postfix for melp message locale.

See Also:
Constant Field Values

LABEL_PREFIX

public static final java.lang.String LABEL_PREFIX
Prefix for message locales.

See Also:
Constant Field Values
Constructor Detail

A_CmsWidget

protected A_CmsWidget()
Default constructor.


A_CmsWidget

protected A_CmsWidget(java.lang.String configuration)
Constructor for preprocessing the configuration string.

Parameters:
configuration - the configuration string
Method Detail

getHelpKey

public static java.lang.String getHelpKey(I_CmsWidgetParameter param)
Returns the localized help key for the provided widget parameter.

Parameters:
param - the widget parameter to return the localized help key for
Returns:
the localized help key for the provided widget parameter

getLabelKey

public static java.lang.String getLabelKey(I_CmsWidgetParameter param)
Returns the localized label key for the provided widget parameter.

Parameters:
param - the widget parameter to return the localized label key for
Returns:
the localized label key for the provided widget parameter

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object
See Also:
Object.equals(java.lang.Object)

getConfiguration

public java.lang.String getConfiguration()
Returns the configuration string.

Specified by:
getConfiguration in interface I_CmsWidget
Returns:
the configuration string

getDialogHtmlEnd

public java.lang.String getDialogHtmlEnd(CmsObject cms,
                                         I_CmsWidgetDialog widgetDialog,
                                         I_CmsWidgetParameter value)
Description copied from interface: I_CmsWidget
Generates the html to include at the end of the dialog for this widget.

The "help bubble" text div's are added using this method.

Specified by:
getDialogHtmlEnd in interface I_CmsWidget
Parameters:
cms - the current users OpenCms context
widgetDialog - the dialog where the widget is used on
value - the widget parameter to generate the widget for
Returns:
the html to include at the end of the dialog for this widget
See Also:
I_CmsWidget.getDialogHtmlEnd(org.opencms.file.CmsObject, I_CmsWidgetDialog, I_CmsWidgetParameter)

getDialogIncludes

public java.lang.String getDialogIncludes(CmsObject cms,
                                          I_CmsWidgetDialog widgetDialog)
Description copied from interface: I_CmsWidget
Generates the necessary JavaScript inclusion code for this widget.

Specified by:
getDialogIncludes in interface I_CmsWidget
Parameters:
cms - the current users OpenCms context
widgetDialog - the dialog where the widget is used on
Returns:
the JavaScript inclusion code
See Also:
I_CmsWidget.getDialogIncludes(org.opencms.file.CmsObject, I_CmsWidgetDialog)

getDialogInitCall

public java.lang.String getDialogInitCall(CmsObject cms,
                                          I_CmsWidgetDialog widgetDialog)
Description copied from interface: I_CmsWidget
Generates the initialisation method JavaScript code for this widget.

Specified by:
getDialogInitCall in interface I_CmsWidget
Parameters:
cms - the current users OpenCms context
widgetDialog - the dialog where the widget is used on
Returns:
the initialisation method JavaScript code
See Also:
I_CmsWidget.getDialogInitCall(org.opencms.file.CmsObject, I_CmsWidgetDialog)

getDialogInitMethod

public java.lang.String getDialogInitMethod(CmsObject cms,
                                            I_CmsWidgetDialog widgetDialog)
Description copied from interface: I_CmsWidget
Generates the initialization method JavaScript code for this widget.

Specified by:
getDialogInitMethod in interface I_CmsWidget
Parameters:
cms - an initialized instance of a CmsObject
widgetDialog - the dialog where the widget is used on
Returns:
the initialization method JavaScript code
See Also:
I_CmsWidget.getDialogInitMethod(org.opencms.file.CmsObject, org.opencms.widgets.I_CmsWidgetDialog)

getHelpBubble

public java.lang.String getHelpBubble(CmsObject cms,
                                      I_CmsWidgetDialog widgetDialog,
                                      I_CmsWidgetParameter param)
Description copied from interface: I_CmsWidget
Creates the HTML code for the help bubble for this widget.

Specified by:
getHelpBubble in interface I_CmsWidget
Parameters:
cms - the current users OpenCms context
widgetDialog - the dialog where the widget is used on
param - the widget parameter to generate the widget for
Returns:
the HTML code for the help bubble for this widget
See Also:
I_CmsWidget.getHelpBubble(org.opencms.file.CmsObject, I_CmsWidgetDialog, I_CmsWidgetParameter)

getHelpText

public java.lang.String getHelpText(I_CmsWidgetDialog widgetDialog,
                                    I_CmsWidgetParameter param)
Description copied from interface: I_CmsWidget
Creates a HTML <div> containing the help text for this widget.

Specified by:
getHelpText in interface I_CmsWidget
Parameters:
widgetDialog - the dialog where the widget is used on
param - the value to create the help bubble for
Returns:
a HTML <div> containing the help text for this widget
See Also:
I_CmsWidget.getHelpText(I_CmsWidgetDialog, I_CmsWidgetParameter)

getWidgetStringValue

public java.lang.String getWidgetStringValue(CmsObject cms,
                                             I_CmsWidgetDialog widgetDialog,
                                             I_CmsWidgetParameter param)
Description copied from interface: I_CmsWidget
Returns the I_CmsWidgetParameter.getStringValue(CmsObject) processed according to the output rules of this widget and the given widget dialog.

Specified by:
getWidgetStringValue in interface I_CmsWidget
Parameters:
cms - the current users OpenCms context
widgetDialog - the dialog where the widget is used on
param - the widget parameter to generate the widget for
Returns:
the I_CmsWidgetParameter.getStringValue(CmsObject) processed according to the output rules of this widget
See Also:
I_CmsWidget.getWidgetStringValue(org.opencms.file.CmsObject, org.opencms.widgets.I_CmsWidgetDialog, org.opencms.widgets.I_CmsWidgetParameter)

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object
See Also:
Object.hashCode()

setConfiguration

public void setConfiguration(java.lang.String configuration)
Description copied from interface: I_CmsWidget
Sets the configuration of this widget.

This can be used to enable / disable certain widget features that should not always be available, or to pass specific initialization information to the widget. It depends on the widget implementation on how this information is used.

Specified by:
setConfiguration in interface I_CmsWidget
Parameters:
configuration - the configuration to set
See Also:
I_CmsWidget.setConfiguration(java.lang.String)

setEditorValue

public void setEditorValue(CmsObject cms,
                           java.util.Map formParameters,
                           I_CmsWidgetDialog widgetDialog,
                           I_CmsWidgetParameter param)
Description copied from interface: I_CmsWidget
Sets the value of in the given widget parameter by reading the "right" value from the offered map of parameters.

Specified by:
setEditorValue in interface I_CmsWidget
Parameters:
cms - the current users OpenCms context
formParameters - the map of parameters to get the value from
widgetDialog - the dialog where the widget is used on
param - the widget parameter to generate the widget for
See Also:
I_CmsWidget.setEditorValue(org.opencms.file.CmsObject, java.util.Map, org.opencms.widgets.I_CmsWidgetDialog, org.opencms.widgets.I_CmsWidgetParameter)

getJsHelpMouseHandler

protected java.lang.String getJsHelpMouseHandler(I_CmsWidgetDialog widgetDialog,
                                                 java.lang.String key,
                                                 java.lang.String value)
Returns the HTML for the JavaScript mouse handlers that show / hide the help text.

This is required since the handler differs between the "Dialog" and the "Administration" mode.

Parameters:
widgetDialog - the dialog where the widget is displayed on
key - the key for the help bubble
value - the localized help text, has to be an escaped String for JS usage, is only used in XML content editor
Returns:
the HTML for the JavaScript mouse handlers that show / hide the help text

getJSIncludeFile

protected java.lang.String getJSIncludeFile(java.lang.String fileName)
Creates the tags to include external javascript files.

Parameters:
fileName - the absolute path to the javascript file
Returns:
the tags to include external javascript files