Package org.opencms.acacia.client.ui
Class CmsAttributeValueView
java.lang.Object
com.google.gwt.user.client.ui.UIObject
com.google.gwt.user.client.ui.Widget
com.google.gwt.user.client.ui.Composite
org.opencms.acacia.client.ui.CmsAttributeValueView
- All Implemented Interfaces:
com.google.gwt.event.dom.client.HasMouseDownHandlers
,com.google.gwt.event.dom.client.HasMouseOutHandlers
,com.google.gwt.event.dom.client.HasMouseOverHandlers
,com.google.gwt.event.logical.shared.HasAttachHandlers
,com.google.gwt.event.shared.HasHandlers
,com.google.gwt.user.client.EventListener
,com.google.gwt.user.client.ui.HasVisibility
,com.google.gwt.user.client.ui.IsRenderable
,com.google.gwt.user.client.ui.IsWidget
,I_CmsDraggable
,I_CmsHasResizeOnShow
public class CmsAttributeValueView
extends com.google.gwt.user.client.ui.Composite
implements I_CmsDraggable, I_CmsHasResizeOnShow, com.google.gwt.event.dom.client.HasMouseOverHandlers, com.google.gwt.event.dom.client.HasMouseOutHandlers, com.google.gwt.event.dom.client.HasMouseDownHandlers
UI object holding an attribute value.
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected class
The widget value change handler.protected class
Handles showing and hiding the help bubble on mouse over the title label.protected class
The move handle.Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject
com.google.gwt.user.client.ui.UIObject.DebugIdImpl, com.google.gwt.user.client.ui.UIObject.DebugIdImplEnabled
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Attribute for marking menu bars that are actually menu bars which should open on hovering (rather than just a single button).static final String
static final int
The first column compact view mode.static final int
The nested compact view mode.static final int
The second column compact view mode.static final int
The single line compact view mode.static final int
The wide compact view mode.protected CmsAttributeChoiceWidget
The add button.protected CmsAttributeChoiceWidget
The attribute choice button.protected com.google.gwt.user.client.ui.FlowPanel
The button bar.protected CmsPushButton
The down button.protected com.google.gwt.dom.client.DivElement
The help bubble element.protected CmsPushButton
The help bubble close button.protected com.google.gwt.dom.client.DivElement
The help bubble text element.protected com.google.gwt.dom.client.SpanElement
The message text element.protected CmsAttributeValueView.MoveHandle
The move button.protected CmsPushButton
The remove button.protected CmsPushButton
The up button.protected com.google.gwt.user.client.ui.FlowPanel
The widget holder elemenet.Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX
-
Constructor Summary
ConstructorDescriptionCmsAttributeValueView
(CmsAttributeHandler handler, String label, String help) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addChoice
(I_CmsWidgetService widgetService, CmsChoiceMenuEntryBean menuEntry) Adds a new choice choice selection menu.com.google.gwt.event.shared.HandlerRegistration
addMouseDownHandler
(com.google.gwt.event.dom.client.MouseDownHandler handler) com.google.gwt.event.shared.HandlerRegistration
addMouseOutHandler
(com.google.gwt.event.dom.client.MouseOutHandler handler) com.google.gwt.event.shared.HandlerRegistration
addMouseOverHandler
(com.google.gwt.event.dom.client.MouseOverHandler handler) protected void
Adds a new attribute value.protected void
closeHelpBubble
(com.google.gwt.event.dom.client.ClickEvent event) Handles the click event to close the help bubble.com.google.gwt.user.client.ui.FlowPanel
com.google.common.base.Optional<int[]>
Gets an optional pair of integers which are to be used as an "offset delta" for the drag and drop process.com.google.gwt.dom.client.Element
getDragHelper
(I_CmsDropTarget target) Creates the drag helper element and attaches it into the DOM.Returns the attribute handler.getId()
Returns the draggable id.protected String
getLabel()
Returns the attribute label.Returns the parent drop target ornull
if there is none.Gets the parent attribute value view, or null if none exists.com.google.gwt.dom.client.Element
getPlaceholder
(I_CmsDropTarget target) Creates the drag placeholder element.int
Returns the attribute value index.Returns the editing widget.boolean
hasValue()
Returns if there is a value set for this attribute.void
Hides the button bar.boolean
Returns if drag and drop is enabled for this attribute.boolean
Returns if this view represents a simple value.protected void
moveAttributeValueDown
(com.google.gwt.event.dom.client.ClickEvent event) Handles the click event to move the attribute value down.protected void
moveAttributeValueUp
(com.google.gwt.event.dom.client.ClickEvent event) Handles the click event to move the attribute value up.protected void
onAttach()
void
Executed on drag cancel.void
onDrop
(I_CmsDropTarget target) Executed on drop.protected void
onResize()
Call when content changes.void
onStartDrag
(I_CmsDropTarget target) Executed on drag start.boolean
owns
(com.google.gwt.dom.client.Element element) Checks if the attribute value view's widget "owns" the given element.protected void
removeAttributeValue
(com.google.gwt.event.dom.client.ClickEvent event) Handles the click event to remove the attribute value.void
Removes any present error message.void
Removes the value.void
Adjusts widget's size once it's visible.protected void
selectChoice
(List<String> choicePath) Selects the attribute choice.void
Sets the value widget active and removes the inactive view styling.void
setCollapsed
(boolean collapsed) Enables or disables the "collapsed" style, which is used for choice elements to reduce the nesting level visually.void
setCompactMode
(int mode) Sets the compact view mode.void
setErrorMessage
(String message) Shows a validation error message.void
setValueEntity
(I_CmsEntityRenderer renderer, org.opencms.acacia.shared.CmsEntity value) Sets the value entity.void
setValueWidget
(I_CmsFormEditWidget widget, String value, String defaultValue, boolean active) Sets the value widget.void
setWarningMessage
(String message) Shows a validation warning message.void
Shows the button bar.void
toggleFocus
(boolean focusOn) Tells the attribute value view to change its display state between focused/unfocused (this doesn't actually change the focus).void
updateButtonVisibility
(boolean hasAddButton, boolean hasRemoveButton, boolean hasSortButtons) Updates the visibility of the add, remove, up and down buttons.Methods inherited from class com.google.gwt.user.client.ui.Composite
claimElement, getWidget, initializeClaimedElement, initWidget, isAttached, onBrowserEvent, onDetach, render, render, resolvePotentialElement, setWidget
Methods inherited from class com.google.gwt.user.client.ui.Widget
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, doAttachChildren, doDetachChildren, fireEvent, getHandlerCount, getLayoutData, getParent, isOrWasAttached, onLoad, onUnload, removeFromParent, setLayoutData, sinkEvents, unsinkEvents
Methods inherited from class com.google.gwt.user.client.ui.UIObject
addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkBitlessEvent, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.google.gwt.event.shared.HasHandlers
fireEvent
Methods inherited from interface org.opencms.gwt.client.dnd.I_CmsDraggable
getElement
-
Field Details
-
ATTR_KEY
- See Also:
-
COMPACT_MODE_FIRST_COLUMN
The first column compact view mode.- See Also:
-
COMPACT_MODE_NESTED
The nested compact view mode.- See Also:
-
COMPACT_MODE_SECOND_COLUMN
The second column compact view mode.- See Also:
-
COMPACT_MODE_SINGLE_LINE
The single line compact view mode.- See Also:
-
COMPACT_MODE_WIDE
The wide compact view mode.- See Also:
-
ATTR_HAS_HOVER
Attribute for marking menu bars that are actually menu bars which should open on hovering (rather than just a single button).- See Also:
-
m_addButton
The add button. -
m_attributeChoice
The attribute choice button. -
m_buttonBar
The button bar. -
m_downButton
The down button. -
m_helpBubble
The help bubble element. -
m_helpBubbleClose
The help bubble close button. -
m_helpBubbleText
The help bubble text element. -
m_messageText
The message text element. -
m_moveButton
The move button. -
m_removeButton
The remove button. -
m_upButton
The up button. -
m_widgetHolder
The widget holder elemenet.
-
-
Constructor Details
-
CmsAttributeValueView
Constructor.- Parameters:
handler
- the attribute handlerlabel
- the attribute labelhelp
- the attribute help information
-
-
Method Details
-
addChoice
Adds a new choice choice selection menu.- Parameters:
widgetService
- the widget service to use for labelsmenuEntry
- the menu entry bean for the choice
-
addMouseDownHandler
public com.google.gwt.event.shared.HandlerRegistration addMouseDownHandler(com.google.gwt.event.dom.client.MouseDownHandler handler) - Specified by:
addMouseDownHandler
in interfacecom.google.gwt.event.dom.client.HasMouseDownHandlers
- See Also:
-
HasMouseDownHandlers.addMouseDownHandler(com.google.gwt.event.dom.client.MouseDownHandler)
-
addMouseOutHandler
public com.google.gwt.event.shared.HandlerRegistration addMouseOutHandler(com.google.gwt.event.dom.client.MouseOutHandler handler) - Specified by:
addMouseOutHandler
in interfacecom.google.gwt.event.dom.client.HasMouseOutHandlers
- See Also:
-
HasMouseOutHandlers.addMouseOutHandler(com.google.gwt.event.dom.client.MouseOutHandler)
-
addMouseOverHandler
public com.google.gwt.event.shared.HandlerRegistration addMouseOverHandler(com.google.gwt.event.dom.client.MouseOverHandler handler) - Specified by:
addMouseOverHandler
in interfacecom.google.gwt.event.dom.client.HasMouseOverHandlers
- See Also:
-
HasMouseOverHandlers.addMouseOverHandler(com.google.gwt.event.dom.client.MouseOverHandler)
-
getButtonBar
-
getCursorOffsetDelta
Description copied from interface:I_CmsDraggable
Gets an optional pair of integers which are to be used as an "offset delta" for the drag and drop process.- Specified by:
getCursorOffsetDelta
in interfaceI_CmsDraggable
- Returns:
- an optional array containing exactly 2 entries [x,y]
- See Also:
-
getDragHelper
Description copied from interface:I_CmsDraggable
Creates the drag helper element and attaches it into the DOM.- Specified by:
getDragHelper
in interfaceI_CmsDraggable
- Parameters:
target
- the drop target- Returns:
- the drag helper element
- See Also:
-
getHandler
Returns the attribute handler.- Returns:
- the attribute handler
-
getId
Description copied from interface:I_CmsDraggable
Returns the draggable id.- Specified by:
getId
in interfaceI_CmsDraggable
- Returns:
- the id
- See Also:
-
getParentTarget
Description copied from interface:I_CmsDraggable
Returns the parent drop target ornull
if there is none.- Specified by:
getParentTarget
in interfaceI_CmsDraggable
- Returns:
- the parent drop target
- See Also:
-
getParentView
Gets the parent attribute value view, or null if none exists.- Returns:
- the parent attribute value view
-
getPlaceholder
Description copied from interface:I_CmsDraggable
Creates the drag placeholder element.- Specified by:
getPlaceholder
in interfaceI_CmsDraggable
- Parameters:
target
- the drop target- Returns:
- the drag placeholder element
- See Also:
-
getValueIndex
Returns the attribute value index.- Returns:
- the attribute value index
-
getValueWidget
Returns the editing widget.- Returns:
- the editing widget or
null
if not available
-
hasValue
Returns if there is a value set for this attribute.- Returns:
true
if there is a value set for this attribute
-
hideAllButtons
Hides the button bar. -
isDragEnabled
Returns if drag and drop is enabled for this attribute.- Returns:
true
if drag and drop is enabled for this attribute
-
isSimpleValue
Returns if this view represents a simple value.- Returns:
true
if this view represents a simple value
-
onDragCancel
Description copied from interface:I_CmsDraggable
Executed on drag cancel.- Specified by:
onDragCancel
in interfaceI_CmsDraggable
- See Also:
-
onDrop
Description copied from interface:I_CmsDraggable
Executed on drop.- Specified by:
onDrop
in interfaceI_CmsDraggable
- Parameters:
target
- the drop target- See Also:
-
onStartDrag
Description copied from interface:I_CmsDraggable
Executed on drag start.- Specified by:
onStartDrag
in interfaceI_CmsDraggable
- Parameters:
target
- the current drop target- See Also:
-
owns
Checks if the attribute value view's widget "owns" the given element.- Parameters:
element
- the element to check- Returns:
- true if the widget owns the element
-
removeValidationMessage
Removes any present error message. -
removeValue
Removes the value. -
resizeOnShow
Description copied from interface:I_CmsHasResizeOnShow
Adjusts widget's size once it's visible.- Specified by:
resizeOnShow
in interfaceI_CmsHasResizeOnShow
- See Also:
-
setActive
Sets the value widget active and removes the inactive view styling. -
setCollapsed
Enables or disables the "collapsed" style, which is used for choice elements to reduce the nesting level visually.- Parameters:
collapsed
- true if the view should be set to 'collapsed'
-
setCompactMode
Sets the compact view mode.- Parameters:
mode
- the mode to set
-
setErrorMessage
Shows a validation error message.- Parameters:
message
- the error message
-
setValueWidget
public void setValueWidget(I_CmsFormEditWidget widget, String value, String defaultValue, boolean active) Sets the value widget.- Parameters:
widget
- the widgetvalue
- the valuedefaultValue
- the default attribute valueactive
-true
if the widget should be activated
-
setWarningMessage
Shows a validation warning message.- Parameters:
message
- the warning message
-
showButtons
Shows the button bar. -
toggleFocus
Tells the attribute value view to change its display state between focused/unfocused (this doesn't actually change the focus).- Parameters:
focusOn
-true
to change the display state to 'focused'
-
updateButtonVisibility
public void updateButtonVisibility(boolean hasAddButton, boolean hasRemoveButton, boolean hasSortButtons) Updates the visibility of the add, remove, up and down buttons.- Parameters:
hasAddButton
-true
if the add button should be visiblehasRemoveButton
-true
if the remove button should be visiblehasSortButtons
-true
if the sort buttons should be visible
-
addNewAttributeValue
Adds a new attribute value. -
closeHelpBubble
@UiHandler("m_helpBubbleClose") protected void closeHelpBubble(com.google.gwt.event.dom.client.ClickEvent event) Handles the click event to close the help bubble.- Parameters:
event
- the click event
-
getLabel
Returns the attribute label.- Returns:
- the attribute label
-
moveAttributeValueDown
@UiHandler("m_downButton") protected void moveAttributeValueDown(com.google.gwt.event.dom.client.ClickEvent event) Handles the click event to move the attribute value down.- Parameters:
event
- the click event
-
moveAttributeValueUp
@UiHandler("m_upButton") protected void moveAttributeValueUp(com.google.gwt.event.dom.client.ClickEvent event) Handles the click event to move the attribute value up.- Parameters:
event
- the click event
-
onAttach
- Overrides:
onAttach
in classcom.google.gwt.user.client.ui.Composite
- See Also:
-
Composite.onAttach()
-
onResize
Call when content changes. -
removeAttributeValue
@UiHandler("m_removeButton") protected void removeAttributeValue(com.google.gwt.event.dom.client.ClickEvent event) Handles the click event to remove the attribute value.- Parameters:
event
- the click event
-
selectChoice
Selects the attribute choice.- Parameters:
choicePath
- the choice attribute path
-