Package org.opencms.acacia.client
Class CmsAttributeHandler
java.lang.Object
org.opencms.acacia.client.CmsRootHandler
org.opencms.acacia.client.CmsAttributeHandler
- All Implemented Interfaces:
I_CmsAttributeHandler
The attribute handler. Handles value changes, addition of new values, remove and move operations on values.
-
Field Summary
Fields inherited from class org.opencms.acacia.client.CmsRootHandler
m_handlers
-
Constructor Summary
ConstructorDescriptionCmsAttributeHandler
(I_CmsEntityBackend entityBackEnd, org.opencms.acacia.shared.CmsEntity entity, String attributeName, I_CmsWidgetService widgetService) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addNewAttributeValue
(String value) Adds a new attribute value and adds the required widgets to the editor DOM.void
addNewAttributeValue
(CmsAttributeValueView reference) Adds a new attribute value below the reference view.void
addNewAttributeValue
(org.opencms.acacia.shared.CmsEntity value) Adds a new attribute value and adds the required widgets to the editor DOM.void
addNewAttributeValueToEntity
(int referenceIndex) Adds a new attribute value below the reference index.void
addNewChoiceAttributeValue
(CmsAttributeValueView reference, List<String> choicePath) Adds a new choice attribute value.void
changeValue
(String value, int valueIndex) Applies a value change to the entity data as well as to the value view widget.static void
clearErrorStyles
(CmsTabbedPanel<?> tabbedPanel) Clears the error styles on the given tabbed panel.collectSimplePath
(I_CmsAttributeHandler childHandler) Returns the simple path.void
createNestedEntitiesForChoicePath
(org.opencms.acacia.shared.CmsEntity value, List<String> choicePath) Creates a sequence of nested entities according to a given path of choice attribute names.void
destroy()
Destroys the attribute handler instance.Returns the attribute name.org.opencms.acacia.shared.CmsType
Returns the attribute type.Returns the drag and drop handler.Returns the entity id.int
Gets the maximum occurrence of the attribute.static com.google.gwt.event.logical.shared.ResizeHandler
Returns the global widget resize handler.getSimplePath
(int index) Returns the simple value path for the given index.Gets the widget service.void
handleValueChange
(int valueIndex, String value) Handles value changes from the view.void
handleValueChange
(CmsAttributeValueView reference, String value) Handles value changes from the view.static boolean
Returnstrue
if a global widget resize handler is present.boolean
Return true if there is a single remaining value, which is optional.boolean
hasValueView
(int valueIndex) Returns if there is a value view widget registered for the given index.void
insertNewAttributeValue
(org.opencms.acacia.shared.CmsEntity value, int index, com.google.gwt.user.client.ui.Panel container) Adds a new attribute value and adds the required widgets to the editor DOM.boolean
Returns if this is a choice handler.protected boolean
Returns if the attribute handler is handling a single value only.void
moveAttributeValue
(CmsAttributeValueView valueView, int currentPosition, int targetPosition) Moves the give attribute value from one position to another.void
moveAttributeValueDown
(CmsAttributeValueView reference) Moves the reference value down in the value list.void
moveAttributeValueUp
(CmsAttributeValueView reference) Moves the reference value up in the value list.void
registerAttributeValue
(CmsAttributeValueView attributeValue) Registers an attribute value view.void
removeAttributeValue
(int valueIndex) Removes the attribute value from the given index, also manipulating the editor DOM to display the change.void
removeAttributeValue
(CmsAttributeValueView reference) Removes the reference attribute value view.void
removeAttributeValue
(CmsAttributeValueView reference, boolean force) Removes the reference attribute value view.com.google.gwt.user.client.ui.Panel
removeAttributeValueAndReturnPrevParent
(int valueIndex, boolean force) Removes the attribute value (and corresponding widget) with the given index, and returns the parent widget.void
removeAttributeValueFromEntity
(int valueIndex) Removes the attribute value with the given index.void
Removes validation messages for all views associated with this attribute handler.void
setErrorMessage
(int valueIndex, String message, CmsTabbedPanel<?> tabbedPanel) Sets the error message for the given value index.void
setHandlerById
(String attributeName, CmsAttributeHandler handler) Sets the handler by id.void
setParentHandler
(I_CmsAttributeHandler handler) Sets the parent attribute handler.static void
setResizeHandler
(com.google.gwt.event.logical.shared.ResizeHandler handler) Sets the global widget resize handler.static void
setScrollElement
(com.google.gwt.dom.client.Element scrollElement) Sets the scroll element.protected void
setSingleValueIndex
(int valueIndex) Sets the single value index.void
setWarningMessage
(int valueIndex, String message, CmsTabbedPanel<?> tabbedPanel) Sets the warning message for the given value index.void
updateButtonVisibilty
(CmsInlineEntityWidget inlineWidget) Updates the add, remove and sort button visibility on the given inline widget or all registered attribute value views.void
Updates the add, remove and sort button visibility on all registered attribute value views.Methods inherited from class org.opencms.acacia.client.CmsRootHandler
clearHandlers, ensureHandlers, getChildHandler, getChildHandlerBySimpleName, getHandlerById, getHandlerByPath, getHandlersBySimplePath, initHandlers, insertHandlers, removeHandlers, setHandler, visit
-
Constructor Details
-
Method Details
-
clearErrorStyles
Clears the error styles on the given tabbed panel.- Parameters:
tabbedPanel
- the tabbed panel
-
getResizeHandler
Returns the global widget resize handler.- Returns:
- the global widget resize handler
-
hasResizeHandler
Returnstrue
if a global widget resize handler is present.- Returns:
true
if a global widget resize handler is present
-
setScrollElement
Sets the scroll element. To be used for automatic scrolling during drag and drop.- Parameters:
scrollElement
- the scroll element
-
addNewAttributeValue
Adds a new attribute value below the reference view.- Parameters:
reference
- the reference value view
-
addNewAttributeValue
Adds a new attribute value and adds the required widgets to the editor DOM.- Parameters:
value
- the simple value
-
addNewAttributeValueToEntity
Adds a new attribute value below the reference index.This will not execute any DOM manipulations.
- Parameters:
referenceIndex
- the reference value index
-
addNewChoiceAttributeValue
Adds a new choice attribute value.- Parameters:
reference
- the reference value viewchoicePath
- the path of the selected (possibly nested) choice attribute, consisting of attribute names
-
changeValue
Applies a value change to the entity data as well as to the value view widget.- Parameters:
value
- the valuevalueIndex
- the value index
-
collectSimplePath
Description copied from interface:I_CmsAttributeHandler
Returns the simple path.- Specified by:
collectSimplePath
in interfaceI_CmsAttributeHandler
- Overrides:
collectSimplePath
in classCmsRootHandler
- Parameters:
childHandler
- the child attribute handler- Returns:
- the simple path
- See Also:
-
destroy
Destroys the attribute handler instance. -
getAttributeName
Returns the attribute name.- Specified by:
getAttributeName
in interfaceI_CmsAttributeHandler
- Overrides:
getAttributeName
in classCmsRootHandler
- Returns:
- the attribute name
- See Also:
-
getAttributeType
Returns the attribute type.- Returns:
- the attribute type
-
getDNDHandler
Returns the drag and drop handler.- Returns:
- the drag and drop handler
-
getEntityId
Returns the entity id.- Returns:
- the entity id
-
getMaxOccurence
Gets the maximum occurrence of the attribute.- Returns:
- the maximum occurrence
-
getSimplePath
Returns the simple value path for the given index.This will use the last fragment of the attribute name and concatenate it with the parent path.
If the given index equals -1 no value index will be appended
- Parameters:
index
- the value index- Returns:
- the simple path
-
getWidgetService
Gets the widget service.- Returns:
- the widget service
-
handleValueChange
Handles value changes from the view.- Parameters:
reference
- the attribute value referencevalue
- the value
-
handleValueChange
Handles value changes from the view.- Parameters:
valueIndex
- the value indexvalue
- the value
-
hasSingleOptionalValue
Return true if there is a single remaining value, which is optional.- Returns:
- true if this has only one optional value
-
hasValueView
Returns if there is a value view widget registered for the given index.- Parameters:
valueIndex
- the value index- Returns:
true
if there is a value view widget registered for the given index
-
isChoiceHandler
Returns if this is a choice handler.- Returns:
true
if this is a choice handler
-
moveAttributeValue
public void moveAttributeValue(CmsAttributeValueView valueView, int currentPosition, int targetPosition) Moves the give attribute value from one position to another.- Parameters:
valueView
- the value to movecurrentPosition
- the current positiontargetPosition
- the target position
-
moveAttributeValueDown
Moves the reference value down in the value list.- Parameters:
reference
- the reference value
-
moveAttributeValueUp
Moves the reference value up in the value list.- Parameters:
reference
- the reference value
-
registerAttributeValue
Registers an attribute value view.- Parameters:
attributeValue
- the attribute value view
-
removeAttributeValue
Removes the reference attribute value view.- Parameters:
reference
- the reference view
-
removeAttributeValue
Removes the reference attribute value view.- Parameters:
reference
- the reference viewforce
-true
if the widget should be removed even if it is the last one
-
removeAttributeValue
Removes the attribute value from the given index, also manipulating the editor DOM to display the change.- Parameters:
valueIndex
- the value index
-
removeAttributeValueAndReturnPrevParent
public com.google.gwt.user.client.ui.Panel removeAttributeValueAndReturnPrevParent(int valueIndex, boolean force) Removes the attribute value (and corresponding widget) with the given index, and returns the parent widget.- Parameters:
valueIndex
- the value indexforce
-true
if the widget should be removed even if it is the last one- Returns:
- the parent widget
-
removeAttributeValueFromEntity
Removes the attribute value with the given index.This will not execute any DOM manipulations.
- Parameters:
valueIndex
- the index of the attribute value to remove
-
removeValidationMessages
Removes validation messages for all views associated with this attribute handler. -
setErrorMessage
Sets the error message for the given value index.- Parameters:
valueIndex
- the value indexmessage
- the error messagetabbedPanel
- the forms tabbed panel if available
-
setHandlerById
Description copied from interface:I_CmsAttributeHandler
Sets the handler by id.- Specified by:
setHandlerById
in interfaceI_CmsAttributeHandler
- Overrides:
setHandlerById
in classCmsRootHandler
- Parameters:
attributeName
- the attribute namehandler
- the handler- See Also:
-
setParentHandler
Sets the parent attribute handler.- Parameters:
handler
- the parent attribute handler
-
setWarningMessage
Sets the warning message for the given value index.- Parameters:
valueIndex
- the value indexmessage
- the warning messagetabbedPanel
- the forms tabbed panel if available
-
updateButtonVisibilty
Updates the add, remove and sort button visibility on the given inline widget or all registered attribute value views.- Parameters:
inlineWidget
- the inline widget
-
updateButtonVisisbility
Updates the add, remove and sort button visibility on all registered attribute value views. -
isSingleValueHandler
Returns if the attribute handler is handling a single value only.- Returns:
true
if the attribute handler is handling a single value only
-
setSingleValueIndex
Sets the single value index.- Parameters:
valueIndex
- the value index
-