Package org.opencms.acacia.client
Class CmsWidgetService
- java.lang.Object
-
- org.opencms.acacia.client.CmsWidgetService
-
- All Implemented Interfaces:
I_CmsWidgetService
- Direct Known Subclasses:
CmsDefaultWidgetService
public class CmsWidgetService extends java.lang.Object implements I_CmsWidgetService
Service providing form widget renderer for entity attributes.
-
-
Constructor Summary
Constructors Constructor Description CmsWidgetService()
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addChangedOrderPath(java.lang.String valuePath)
Adds the given path to the list of paths where child attributes have change their order.void
addConfigurations(java.util.Map<java.lang.String,org.opencms.acacia.shared.CmsAttributeConfiguration> configurations)
Adds all configurations.void
addRenderer(java.lang.String typeName, I_CmsEntityRenderer renderer)
Adds a renderer for the given type.void
addRenderer(I_CmsEntityRenderer renderer)
Adds a renderer.void
addWidgetFactory(java.lang.String widgetName, I_CmsWidgetFactory widgetFactory)
Registers the given widget factory with the service.I_CmsFormEditWidget
getAttributeFormWidget(java.lang.String attributeName)
Returns the attribute form editing widget.java.lang.String
getAttributeHelp(java.lang.String attributeName)
Returns the attribute help information.I_CmsEditWidget
getAttributeInlineWidget(java.lang.String attributeName, com.google.gwt.dom.client.Element element)
Returns the attribute inline editing widget wrapping the given DOM element.java.lang.String
getAttributeLabel(java.lang.String attributeName)
Returns the label for the given attribute.java.lang.String
getDefaultAttributeValue(java.lang.String attributeName, java.lang.String simpleValuePath)
Returns the default attribute value.I_CmsEntityRenderer
getRendererForAttribute(java.lang.String attributeName)
Gets the renderer instance for a specific attribute.I_CmsEntityRenderer
getRendererForAttribute(java.lang.String attributeName, org.opencms.acacia.shared.CmsType attributeType)
Returns the renderer for the given attribute.I_CmsEntityRenderer
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(java.lang.String attributeName)
Returns the if the attribute widget should be displayed in compact view.boolean
isDisplaySingleLine(java.lang.String attributeName)
Returns if the attribute widget should be displayed in single line view.boolean
isVisible(java.lang.String attributeName)
Returns if the given attribute should be visible in the editor.void
registerComplexWidgetAttribute(java.lang.String attrName, java.lang.String rendererName, java.lang.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(java.util.Map<java.lang.String,I_CmsWidgetFactory> widgetFactories)
Sets the widget factories.boolean
shouldRemoveLastValueAfterUnfocus(I_CmsEditWidget widget)
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 Detail
-
CmsWidgetService
public CmsWidgetService()
Constructor.
-
-
Method Detail
-
addChangedOrderPath
public void addChangedOrderPath(java.lang.String valuePath)
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:
I_CmsWidgetService.addChangedOrderPath(java.lang.String)
-
addConfigurations
public void addConfigurations(java.util.Map<java.lang.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:
I_CmsWidgetService.addConfigurations(java.util.Map)
-
addRenderer
public void addRenderer(I_CmsEntityRenderer renderer)
Description copied from interface:I_CmsWidgetService
Adds a renderer.- Specified by:
addRenderer
in interfaceI_CmsWidgetService
- Parameters:
renderer
- the renderer to add- See Also:
I_CmsWidgetService.addRenderer(org.opencms.acacia.client.I_CmsEntityRenderer)
-
addRenderer
public void addRenderer(java.lang.String typeName, I_CmsEntityRenderer renderer)
Adds a renderer for the given type.- Parameters:
typeName
- the type namerenderer
- the renderer
-
addWidgetFactory
public void addWidgetFactory(java.lang.String widgetName, I_CmsWidgetFactory widgetFactory)
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:
I_CmsWidgetService.addWidgetFactory(java.lang.String, org.opencms.acacia.client.I_CmsWidgetFactory)
-
getAttributeFormWidget
public I_CmsFormEditWidget getAttributeFormWidget(java.lang.String attributeName)
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:
I_CmsWidgetService.getAttributeFormWidget(java.lang.String)
-
getAttributeHelp
public java.lang.String getAttributeHelp(java.lang.String attributeName)
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:
I_CmsWidgetService.getAttributeHelp(java.lang.String)
-
getAttributeInlineWidget
public I_CmsEditWidget getAttributeInlineWidget(java.lang.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:
I_CmsWidgetService.getAttributeInlineWidget(java.lang.String, com.google.gwt.dom.client.Element)
-
getAttributeLabel
public java.lang.String getAttributeLabel(java.lang.String attributeName)
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:
I_CmsWidgetService.getAttributeLabel(java.lang.String)
-
getDefaultAttributeValue
public java.lang.String getDefaultAttributeValue(java.lang.String attributeName, java.lang.String simpleValuePath)
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:
I_CmsWidgetService.getDefaultAttributeValue(java.lang.String, java.lang.String)
-
getRendererForAttribute
public I_CmsEntityRenderer getRendererForAttribute(java.lang.String attributeName)
Gets the renderer instance for a specific attribute.- Parameters:
attributeName
- the attribute for which we want the renderer- Returns:
- the renderer instance
-
getRendererForAttribute
public I_CmsEntityRenderer getRendererForAttribute(java.lang.String attributeName, org.opencms.acacia.shared.CmsType attributeType)
Description copied from interface:I_CmsWidgetService
Returns the renderer for the given attribute.- Specified by:
getRendererForAttribute
in interfaceI_CmsWidgetService
- Parameters:
attributeName
- the name of the attributeattributeType
- the type of the attribute- Returns:
- the renderer
- See Also:
I_CmsWidgetService.getRendererForAttribute(java.lang.String, org.opencms.acacia.shared.CmsType)
-
getRendererForType
public I_CmsEntityRenderer getRendererForType(org.opencms.acacia.shared.CmsType entityType)
Description copied from interface:I_CmsWidgetService
Returns the renderer for the given entity type.- Specified by:
getRendererForType
in interfaceI_CmsWidgetService
- Parameters:
entityType
- the type- Returns:
- the renderer
- See Also:
I_CmsWidgetService.getRendererForType(org.opencms.acacia.shared.CmsType)
-
init
public void init(org.opencms.acacia.shared.CmsContentDefinition definition)
Initializes the widget service with the given content definition.- Parameters:
definition
- the content definition
-
isDisplayCompact
public boolean isDisplayCompact(java.lang.String attributeName)
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:
I_CmsWidgetService.isDisplayCompact(java.lang.String)
-
isDisplaySingleLine
public boolean isDisplaySingleLine(java.lang.String attributeName)
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:
I_CmsWidgetService.isDisplaySingleLine(java.lang.String)
-
isVisible
public boolean isVisible(java.lang.String attributeName)
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:
I_CmsWidgetService.isVisible(java.lang.String)
-
registerComplexWidgetAttribute
public void registerComplexWidgetAttribute(java.lang.String attrName, java.lang.String rendererName, java.lang.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:
I_CmsWidgetService.registerComplexWidgetAttribute(java.lang.String, java.lang.String, java.lang.String)
-
setDefaultRenderer
public void setDefaultRenderer(I_CmsEntityRenderer renderer)
Adds the default complex type renderer.- Specified by:
setDefaultRenderer
in interfaceI_CmsWidgetService
- Parameters:
renderer
- the renderer
-
setWidgetFactories
public void setWidgetFactories(java.util.Map<java.lang.String,I_CmsWidgetFactory> widgetFactories)
Description copied from interface:I_CmsWidgetService
Sets the widget factories.- Specified by:
setWidgetFactories
in interfaceI_CmsWidgetService
- Parameters:
widgetFactories
- the widget factories- See Also:
I_CmsWidgetService.setWidgetFactories(java.util.Map)
-
shouldRemoveLastValueAfterUnfocus
public boolean shouldRemoveLastValueAfterUnfocus(I_CmsEditWidget widget)
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:
I_CmsWidgetService.shouldRemoveLastValueAfterUnfocus(org.opencms.acacia.client.widgets.I_CmsEditWidget)
-
-