Package org.opencms.acacia.client
Class CmsWidgetService
java.lang.Object
org.opencms.acacia.client.CmsWidgetService
- All Implemented Interfaces:
I_CmsWidgetService
- Direct Known Subclasses:
CmsDefaultWidgetService
Service providing form widget renderer for entity attributes.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addChangedOrderPath
(String valuePath) Adds the given path to the list of paths where child attributes have change their order.void
addConfigurations
(Map<String, org.opencms.acacia.shared.CmsAttributeConfiguration> configurations) Adds all configurations.void
addRenderer
(String typeName, I_CmsEntityRenderer renderer) Adds a renderer for the given type.void
addRenderer
(I_CmsEntityRenderer renderer) Adds a renderer.void
addWidgetFactory
(String widgetName, I_CmsWidgetFactory widgetFactory) Registers the given widget factory with the service.getAttributeFormWidget
(String attributeName) Returns the attribute form editing widget.getAttributeHelp
(String attributeName) Returns the attribute help information.getAttributeInlineWidget
(String attributeName, com.google.gwt.dom.client.Element element) Returns the attribute inline editing widget wrapping the given DOM element.getAttributeLabel
(String attributeName) Returns the label for the given attribute.getDefaultAttributeValue
(String attributeName, String simpleValuePath) Returns the default attribute value.getRendererForAttribute
(String attributeName) Gets the renderer instance for a specific attribute.getRendererForAttribute
(String attributeName, org.opencms.acacia.shared.CmsType attributeType) Returns the renderer for the given attribute.getRendererForType
(org.opencms.acacia.shared.CmsType entityType) Returns the renderer for the given entity type.void
init
(org.opencms.acacia.shared.CmsContentDefinition definition) Initializes the widget service with the given content definition.boolean
isDisplayCompact
(String attributeName) Returns the if the attribute widget should be displayed in compact view.boolean
isDisplaySingleLine
(String attributeName) Returns if the attribute widget should be displayed in single line view.boolean
Returns if the given attribute should be visible in the editor.void
registerComplexWidgetAttribute
(String attrName, String rendererName, String configuration) Registers a complex widget attribute which should be handled by a special renderer.void
setDefaultRenderer
(I_CmsEntityRenderer renderer) Adds the default complex type renderer.void
setWidgetFactories
(Map<String, I_CmsWidgetFactory> widgetFactories) Sets the widget factories.boolean
Returns true if the value which this widget is being used for should be disabled if it is unfocused and the last remaining attribute value for a given attribute.
-
Constructor Details
-
CmsWidgetService
public CmsWidgetService()Constructor.
-
-
Method Details
-
addChangedOrderPath
Description copied from interface:I_CmsWidgetService
Adds the given path to the list of paths where child attributes have change their order.- Specified by:
addChangedOrderPath
in interfaceI_CmsWidgetService
- Parameters:
valuePath
- the attribute path- See Also:
-
addConfigurations
public void addConfigurations(Map<String, org.opencms.acacia.shared.CmsAttributeConfiguration> configurations) Description copied from interface:I_CmsWidgetService
Adds all configurations.- Specified by:
addConfigurations
in interfaceI_CmsWidgetService
- Parameters:
configurations
- the configurations to add- See Also:
-
addRenderer
Description copied from interface:I_CmsWidgetService
Adds a renderer.- Specified by:
addRenderer
in interfaceI_CmsWidgetService
- Parameters:
renderer
- the renderer to add- See Also:
-
addRenderer
Adds a renderer for the given type.- Parameters:
typeName
- the type namerenderer
- the renderer
-
addWidgetFactory
Description copied from interface:I_CmsWidgetService
Registers the given widget factory with the service.- Specified by:
addWidgetFactory
in interfaceI_CmsWidgetService
- Parameters:
widgetName
- the widget namewidgetFactory
- the widget factory- See Also:
-
getAttributeFormWidget
Description copied from interface:I_CmsWidgetService
Returns the attribute form editing widget.- Specified by:
getAttributeFormWidget
in interfaceI_CmsWidgetService
- Parameters:
attributeName
- the attribute name- Returns:
- the attribute widget
- See Also:
-
getAttributeHelp
Description copied from interface:I_CmsWidgetService
Returns the attribute help information.- Specified by:
getAttributeHelp
in interfaceI_CmsWidgetService
- Parameters:
attributeName
- the attribute name- Returns:
- the attribute help information
- See Also:
-
getAttributeInlineWidget
public I_CmsEditWidget getAttributeInlineWidget(String attributeName, com.google.gwt.dom.client.Element element) Description copied from interface:I_CmsWidgetService
Returns the attribute inline editing widget wrapping the given DOM element.- Specified by:
getAttributeInlineWidget
in interfaceI_CmsWidgetService
- Parameters:
attributeName
- the attribute nameelement
- the DOM element to wrap- Returns:
- the attribute widget
- See Also:
-
getAttributeLabel
Description copied from interface:I_CmsWidgetService
Returns the label for the given attribute.- Specified by:
getAttributeLabel
in interfaceI_CmsWidgetService
- Parameters:
attributeName
- the attribute name- Returns:
- the attribute label
- See Also:
-
getDefaultAttributeValue
Description copied from interface:I_CmsWidgetService
Returns the default attribute value.- Specified by:
getDefaultAttributeValue
in interfaceI_CmsWidgetService
- Parameters:
attributeName
- the attribute namesimpleValuePath
- the value path- Returns:
- the default value
- See Also:
-
getRendererForAttribute
Gets the renderer instance for a specific attribute.- Parameters:
attributeName
- the attribute for which we want the renderer- Returns:
- the renderer instance
-
isDisplayCompact
Description copied from interface:I_CmsWidgetService
Returns the if the attribute widget should be displayed in compact view.- Specified by:
isDisplayCompact
in interfaceI_CmsWidgetService
- Parameters:
attributeName
- the attribute name- Returns:
true
if the attribute widget should be displayed in compact view- See Also:
-
isDisplaySingleLine
Description copied from interface:I_CmsWidgetService
Returns if the attribute widget should be displayed in single line view.- Specified by:
isDisplaySingleLine
in interfaceI_CmsWidgetService
- Parameters:
attributeName
- the attribute name- Returns:
true
if the attribute widget should be displayed in single line view- See Also:
-
isVisible
Description copied from interface:I_CmsWidgetService
Returns if the given attribute should be visible in the editor.- Specified by:
isVisible
in interfaceI_CmsWidgetService
- Parameters:
attributeName
- the attribute name- Returns:
true
if the given attribute should be visible in the editor- See Also:
-
registerComplexWidgetAttribute
public void registerComplexWidgetAttribute(String attrName, String rendererName, String configuration) Description copied from interface:I_CmsWidgetService
Registers a complex widget attribute which should be handled by a special renderer.- Specified by:
registerComplexWidgetAttribute
in interfaceI_CmsWidgetService
- Parameters:
attrName
- the attribute namerendererName
- the renderer to register for the attributeconfiguration
- the renderer configuration- See Also:
-
setDefaultRenderer
Adds the default complex type renderer.- Specified by:
setDefaultRenderer
in interfaceI_CmsWidgetService
- Parameters:
renderer
- the renderer
-
setWidgetFactories
Description copied from interface:I_CmsWidgetService
Sets the widget factories.- Specified by:
setWidgetFactories
in interfaceI_CmsWidgetService
- Parameters:
widgetFactories
- the widget factories- See Also:
-
shouldRemoveLastValueAfterUnfocus
Description copied from interface:I_CmsWidgetService
Returns true if the value which this widget is being used for should be disabled if it is unfocused and the last remaining attribute value for a given attribute.The main use case is disabling empty text input fields.
- Specified by:
shouldRemoveLastValueAfterUnfocus
in interfaceI_CmsWidgetService
- Parameters:
widget
- the widget to check- Returns:
- true if the value should be disabled
- See Also:
-