Package org.opencms.widgets
Class A_CmsNativeComplexWidget
java.lang.Object
org.opencms.widgets.A_CmsNativeComplexWidget
- All Implemented Interfaces:
I_CmsComplexWidget
This is an abstract class which you can inherit from to relatively easily implement complex widgets for rendering nested contents in Javascript.
Subclasses of this class only need to implement the methods getScripts(), getStyleSheets(), getName(), and configure(). The name of the initialization function is generated by prepending the string "init_" to the widget name returned by getName().
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
The prefix which is prepended to the widget name to get the name of the initialization function.protected String
The configuration string.The configuration map created from the configuration string.protected JSONObject
The configuration map in JSON format. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract String
getName()
Gets the name of the complex widget.getScripts
(CmsObject cms) Gets the list of URLs of scripts which the widget reuires.getStyleSheets
(CmsObject cms) Gets the list of URLs of stylesheets which are required by the widget.final CmsComplexWidgetData
getWidgetData
(CmsObject cms) Gets the data needed for the editor to render the complex widget.final void
initConfiguration
(String config) Initializes the configuration date from the given configuration string.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.opencms.widgets.I_CmsComplexWidget
configure
-
Field Details
-
INIT_FUNCTION_PREFIX
The prefix which is prepended to the widget name to get the name of the initialization function.- See Also:
-
m_configuration
The configuration string. -
m_configurationMap
The configuration map created from the configuration string. -
m_jsonConfig
The configuration map in JSON format.
-
-
Constructor Details
-
A_CmsNativeComplexWidget
public A_CmsNativeComplexWidget()
-
-
Method Details
-
getName
Description copied from interface:I_CmsComplexWidget
Gets the name of the complex widget.The string returned by this function should be a valid Javascript identifier.
- Specified by:
getName
in interfaceI_CmsComplexWidget
- Returns:
- the name of the complex widget
- See Also:
-
getScripts
Gets the list of URLs of scripts which the widget reuires.- Parameters:
cms
- the current CMS context- Returns:
- the list of URLs of scripts needed by the widget
-
getStyleSheets
Gets the list of URLs of stylesheets which are required by the widget.- Parameters:
cms
- the current CMS context- Returns:
- the list of URLs of stylesheets needed by the widget
-
getWidgetData
Description copied from interface:I_CmsComplexWidget
Gets the data needed for the editor to render the complex widget.- Specified by:
getWidgetData
in interfaceI_CmsComplexWidget
- Parameters:
cms
- The CMS object to use for VFS operations- Returns:
- the data for the complex widget
- See Also:
-
initConfiguration
Initializes the configuration date from the given configuration string.This should be called by subclasses of this class.
- Parameters:
config
- the widget configuration string
-