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
Nested ClassesModifier and TypeClassDescriptionprotected classThe widget value change handler.protected classHandles showing and hiding the help bubble on mouse over the title label.protected classThe 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
FieldsModifier and TypeFieldDescriptionstatic final StringAttribute for marking menu bars that are actually menu bars which should open on hovering (rather than just a single button).static final Stringstatic final intThe first column compact view mode.static final intThe nested compact view mode.static final intThe second column compact view mode.static final intThe single line compact view mode.static final intThe wide compact view mode.protected CmsAttributeChoiceWidgetThe add button.protected CmsAttributeChoiceWidgetThe attribute choice button.protected com.google.gwt.user.client.ui.FlowPanelThe button bar.protected CmsPushButtonThe down button.protected com.google.gwt.dom.client.DivElementThe help bubble element.protected CmsPushButtonThe help bubble close button.protected com.google.gwt.dom.client.DivElementThe help bubble text element.protected com.google.gwt.dom.client.SpanElementThe message text element.protected CmsAttributeValueView.MoveHandleThe move button.protected CmsPushButtonThe remove button.protected CmsPushButtonThe up button.protected com.google.gwt.user.client.ui.FlowPanelThe widget holder elemenet.Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX -
Constructor Summary
ConstructorsConstructorDescriptionCmsAttributeValueView(CmsAttributeHandler handler, String label, String help) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddChoice(I_CmsWidgetService widgetService, CmsChoiceMenuEntryBean menuEntry) Adds a new choice choice selection menu.com.google.gwt.event.shared.HandlerRegistrationaddMouseDownHandler(com.google.gwt.event.dom.client.MouseDownHandler handler) com.google.gwt.event.shared.HandlerRegistrationaddMouseOutHandler(com.google.gwt.event.dom.client.MouseOutHandler handler) com.google.gwt.event.shared.HandlerRegistrationaddMouseOverHandler(com.google.gwt.event.dom.client.MouseOverHandler handler) protected voidAdds a new attribute value.protected voidcloseHelpBubble(com.google.gwt.event.dom.client.ClickEvent event) Handles the click event to close the help bubble.com.google.gwt.user.client.ui.FlowPanelcom.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.ElementgetDragHelper(I_CmsDropTarget target) Creates the drag helper element and attaches it into the DOM.Returns the attribute handler.getId()Returns the draggable id.protected StringgetLabel()Returns the attribute label.Returns the parent drop target ornullif there is none.Gets the parent attribute value view, or null if none exists.com.google.gwt.dom.client.ElementgetPlaceholder(I_CmsDropTarget target) Creates the drag placeholder element.intReturns the attribute value index.Returns the editing widget.booleanhasValue()Returns if there is a value set for this attribute.voidHides the button bar.booleanReturns if drag and drop is enabled for this attribute.booleanReturns if this view represents a simple value.protected voidmoveAttributeValueDown(com.google.gwt.event.dom.client.ClickEvent event) Handles the click event to move the attribute value down.protected voidmoveAttributeValueUp(com.google.gwt.event.dom.client.ClickEvent event) Handles the click event to move the attribute value up.protected voidonAttach()voidExecuted on drag cancel.voidonDrop(I_CmsDropTarget target) Executed on drop.protected voidonResize()Call when content changes.voidonStartDrag(I_CmsDropTarget target) Executed on drag start.booleanowns(com.google.gwt.dom.client.Element element) Checks if the attribute value view's widget "owns" the given element.protected voidremoveAttributeValue(com.google.gwt.event.dom.client.ClickEvent event) Handles the click event to remove the attribute value.voidRemoves any present error message.voidRemoves the value.voidAdjusts widget's size once it's visible.protected voidselectChoice(List<String> choicePath) Selects the attribute choice.voidSets the value widget active and removes the inactive view styling.voidsetCollapsed(boolean collapsed) Enables or disables the "collapsed" style, which is used for choice elements to reduce the nesting level visually.voidsetCompactMode(int mode) Sets the compact view mode.voidsetErrorMessage(String message) Shows a validation error message.voidsetValueEntity(I_CmsEntityRenderer renderer, org.opencms.acacia.shared.CmsEntity value) Sets the value entity.voidsetValueWidget(I_CmsFormEditWidget widget, String value, String defaultValue, boolean active) Sets the value widget.voidsetWarningMessage(String message) Shows a validation warning message.voidShows the button bar.voidtoggleFocus(boolean focusOn) Tells the attribute value view to change its display state between focused/unfocused (this doesn't actually change the focus).voidupdateButtonVisibility(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, setWidgetMethods 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, unsinkEventsMethods 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, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.google.gwt.event.shared.HasHandlers
fireEventMethods 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:
addMouseDownHandlerin interfacecom.google.gwt.event.dom.client.HasMouseDownHandlers- See Also:
-
addMouseOutHandler
public com.google.gwt.event.shared.HandlerRegistration addMouseOutHandler(com.google.gwt.event.dom.client.MouseOutHandler handler) - Specified by:
addMouseOutHandlerin interfacecom.google.gwt.event.dom.client.HasMouseOutHandlers- See Also:
-
addMouseOverHandler
public com.google.gwt.event.shared.HandlerRegistration addMouseOverHandler(com.google.gwt.event.dom.client.MouseOverHandler handler) - Specified by:
addMouseOverHandlerin interfacecom.google.gwt.event.dom.client.HasMouseOverHandlers- See Also:
-
getButtonBar
-
getCursorOffsetDelta
Description copied from interface:I_CmsDraggableGets an optional pair of integers which are to be used as an "offset delta" for the drag and drop process.- Specified by:
getCursorOffsetDeltain interfaceI_CmsDraggable- Returns:
- an optional array containing exactly 2 entries [x,y]
- See Also:
-
getDragHelper
Description copied from interface:I_CmsDraggableCreates the drag helper element and attaches it into the DOM.- Specified by:
getDragHelperin 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_CmsDraggableReturns the draggable id.- Specified by:
getIdin interfaceI_CmsDraggable- Returns:
- the id
- See Also:
-
getParentTarget
Description copied from interface:I_CmsDraggableReturns the parent drop target ornullif there is none.- Specified by:
getParentTargetin 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_CmsDraggableCreates the drag placeholder element.- Specified by:
getPlaceholderin 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
nullif not available
-
hasValue
Returns if there is a value set for this attribute.- Returns:
trueif 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:
trueif drag and drop is enabled for this attribute
-
isSimpleValue
Returns if this view represents a simple value.- Returns:
trueif this view represents a simple value
-
onDragCancel
Description copied from interface:I_CmsDraggableExecuted on drag cancel.- Specified by:
onDragCancelin interfaceI_CmsDraggable- See Also:
-
onDrop
Description copied from interface:I_CmsDraggableExecuted on drop.- Specified by:
onDropin interfaceI_CmsDraggable- Parameters:
target- the drop target- See Also:
-
onStartDrag
Description copied from interface:I_CmsDraggableExecuted on drag start.- Specified by:
onStartDragin 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_CmsHasResizeOnShowAdjusts widget's size once it's visible.- Specified by:
resizeOnShowin 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-trueif 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-trueto 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-trueif the add button should be visiblehasRemoveButton-trueif the remove button should be visiblehasSortButtons-trueif 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:
onAttachin classcom.google.gwt.user.client.ui.Composite- See Also:
-
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
-