Package org.opencms.widgets
Class A_CmsNativeComplexWidget
- java.lang.Object
-
- org.opencms.widgets.A_CmsNativeComplexWidget
-
- All Implemented Interfaces:
I_CmsComplexWidget
public abstract class A_CmsNativeComplexWidget extends java.lang.Object implements 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
Fields Modifier and Type Field Description static java.lang.String
INIT_FUNCTION_PREFIX
The prefix which is prepended to the widget name to get the name of the initialization function.protected java.lang.String
m_configuration
The configuration string.protected java.util.Map<java.lang.String,java.lang.String>
m_configurationMap
The configuration map created from the configuration string.protected JSONObject
m_jsonConfig
The configuration map in JSON format.
-
Constructor Summary
Constructors Constructor Description A_CmsNativeComplexWidget()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract java.lang.String
getName()
Gets the name of the complex widget.abstract java.util.List<java.lang.String>
getScripts(CmsObject cms)
Gets the list of URLs of scripts which the widget reuires.abstract java.util.List<java.lang.String>
getStyleSheets(CmsObject cms)
Gets the list of URLs of stylesheets which are required by the widget.CmsComplexWidgetData
getWidgetData(CmsObject cms)
Gets the data needed for the editor to render the complex widget.void
initConfiguration(java.lang.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 Detail
-
INIT_FUNCTION_PREFIX
public static final java.lang.String INIT_FUNCTION_PREFIX
The prefix which is prepended to the widget name to get the name of the initialization function.- See Also:
- Constant Field Values
-
m_configuration
protected java.lang.String m_configuration
The configuration string.
-
m_configurationMap
protected java.util.Map<java.lang.String,java.lang.String> m_configurationMap
The configuration map created from the configuration string.
-
m_jsonConfig
protected JSONObject m_jsonConfig
The configuration map in JSON format.
-
-
Constructor Detail
-
A_CmsNativeComplexWidget
public A_CmsNativeComplexWidget()
-
-
Method Detail
-
getName
public abstract java.lang.String 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:
The result of this method will be used to determine the initialization function name for the widget by prepending the prefix "init_". For example, if "foo" is returned by this method, "init_foo" will be used as the initialization function name.
-
getScripts
public abstract java.util.List<java.lang.String> getScripts(CmsObject cms)
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
public abstract java.util.List<java.lang.String> getStyleSheets(CmsObject cms)
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
public final CmsComplexWidgetData getWidgetData(CmsObject cms)
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:
I_CmsComplexWidget.getWidgetData(org.opencms.file.CmsObject)
-
initConfiguration
public final void initConfiguration(java.lang.String config)
Initializes the configuration date from the given configuration string.This should be called by subclasses of this class.
- Parameters:
config
- the widget configuration string
-
-