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
ConstructorsConstructorDescriptionCmsAttributeHandler(I_CmsEntityBackend entityBackEnd, org.opencms.acacia.shared.CmsEntity entity, String attributeName, I_CmsWidgetService widgetService) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddNewAttributeValue(String value) Adds a new attribute value and adds the required widgets to the editor DOM.voidaddNewAttributeValue(CmsAttributeValueView reference) Adds a new attribute value below the reference view.voidaddNewAttributeValue(org.opencms.acacia.shared.CmsEntity value) Adds a new attribute value and adds the required widgets to the editor DOM.voidaddNewAttributeValueToEntity(int referenceIndex) Adds a new attribute value below the reference index.voidaddNewChoiceAttributeValue(CmsAttributeValueView reference, List<String> choicePath) Adds a new choice attribute value.voidchangeValue(String value, int valueIndex) Applies a value change to the entity data as well as to the value view widget.static voidclearErrorStyles(CmsTabbedPanel<?> tabbedPanel) Clears the error styles on the given tabbed panel.collectSimplePath(I_CmsAttributeHandler childHandler) Returns the simple path.voidcreateNestedEntitiesForChoicePath(org.opencms.acacia.shared.CmsEntity value, List<String> choicePath) Creates a sequence of nested entities according to a given path of choice attribute names.voiddestroy()Destroys the attribute handler instance.Returns the attribute name.org.opencms.acacia.shared.CmsTypeReturns the attribute type.Returns the drag and drop handler.Returns the entity id.intGets the maximum occurrence of the attribute.static com.google.gwt.event.logical.shared.ResizeHandlerReturns the global widget resize handler.getSimplePath(int index) Returns the simple value path for the given index.Gets the widget service.voidhandleValueChange(int valueIndex, String value) Handles value changes from the view.voidhandleValueChange(CmsAttributeValueView reference, String value) Handles value changes from the view.static booleanReturnstrueif a global widget resize handler is present.booleanReturn true if there is a single remaining value, which is optional.booleanhasValueView(int valueIndex) Returns if there is a value view widget registered for the given index.voidinsertNewAttributeValue(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.booleanReturns if this is a choice handler.protected booleanReturns if the attribute handler is handling a single value only.voidmoveAttributeValue(CmsAttributeValueView valueView, int currentPosition, int targetPosition) Moves the give attribute value from one position to another.voidmoveAttributeValueDown(CmsAttributeValueView reference) Moves the reference value down in the value list.voidmoveAttributeValueUp(CmsAttributeValueView reference) Moves the reference value up in the value list.voidregisterAttributeValue(CmsAttributeValueView attributeValue) Registers an attribute value view.voidremoveAttributeValue(int valueIndex) Removes the attribute value from the given index, also manipulating the editor DOM to display the change.voidremoveAttributeValue(CmsAttributeValueView reference) Removes the reference attribute value view.voidremoveAttributeValue(CmsAttributeValueView reference, boolean force) Removes the reference attribute value view.com.google.gwt.user.client.ui.PanelremoveAttributeValueAndReturnPrevParent(int valueIndex, boolean force) Removes the attribute value (and corresponding widget) with the given index, and returns the parent widget.voidremoveAttributeValueFromEntity(int valueIndex) Removes the attribute value with the given index.voidRemoves validation messages for all views associated with this attribute handler.voidsetErrorMessage(int valueIndex, String message, CmsTabbedPanel<?> tabbedPanel) Sets the error message for the given value index.voidsetHandlerById(String attributeName, CmsAttributeHandler handler) Sets the handler by id.voidsetParentHandler(I_CmsAttributeHandler handler) Sets the parent attribute handler.static voidsetResizeHandler(com.google.gwt.event.logical.shared.ResizeHandler handler) Sets the global widget resize handler.static voidsetScrollElement(com.google.gwt.dom.client.Element scrollElement) Sets the scroll element.protected voidsetSingleValueIndex(int valueIndex) Sets the single value index.voidsetWarningMessage(int valueIndex, String message, CmsTabbedPanel<?> tabbedPanel) Sets the warning message for the given value index.voidupdateButtonVisibilty(CmsInlineEntityWidget inlineWidget) Updates the add, remove and sort button visibility on the given inline widget or all registered attribute value views.voidUpdates 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
Returnstrueif a global widget resize handler is present.- Returns:
trueif 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_CmsAttributeHandlerReturns the simple path.- Specified by:
collectSimplePathin interfaceI_CmsAttributeHandler- Overrides:
collectSimplePathin 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:
getAttributeNamein interfaceI_CmsAttributeHandler- Overrides:
getAttributeNamein 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:
trueif there is a value view widget registered for the given index
-
isChoiceHandler
Returns if this is a choice handler.- Returns:
trueif 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-trueif 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-trueif 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_CmsAttributeHandlerSets the handler by id.- Specified by:
setHandlerByIdin interfaceI_CmsAttributeHandler- Overrides:
setHandlerByIdin 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:
trueif the attribute handler is handling a single value only
-
setSingleValueIndex
Sets the single value index.- Parameters:
valueIndex- the value index
-