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 Classes
    Modifier and Type
    Class
    Description
    protected 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

    Fields
    Modifier and Type
    Field
    Description
    static 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.
    The add button.
    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.
    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

    Constructors
    Constructor
    Description
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    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
    Creates the drag helper element and attaches it into the DOM.
    Returns the attribute handler.
    Returns the draggable id.
    protected String
    Returns the attribute label.
    Returns the parent drop target or null if there is none.
    Gets the parent attribute value view, or null if none exists.
    com.google.gwt.dom.client.Element
    Creates the drag placeholder element.
    int
    Returns the attribute value index.
    Returns the editing widget.
    boolean
    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
     
    void
    Executed on drag cancel.
    void
    Executed on drop.
    protected void
    Call when content changes.
    void
    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
    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
    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

  • Constructor Details

  • Method Details

    • addChoice

      public void addChoice(I_CmsWidgetService widgetService, CmsChoiceMenuEntryBean menuEntry)
      Adds a new choice choice selection menu.

      Parameters:
      widgetService - the widget service to use for labels
      menuEntry - 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 interface com.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 interface com.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 interface com.google.gwt.event.dom.client.HasMouseOverHandlers
      See Also:
      • HasMouseOverHandlers.addMouseOverHandler(com.google.gwt.event.dom.client.MouseOverHandler)
    • getButtonBar

      public com.google.gwt.user.client.ui.FlowPanel getButtonBar()
    • getCursorOffsetDelta

      public com.google.common.base.Optional<int[]> 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 interface I_CmsDraggable
      Returns:
      an optional array containing exactly 2 entries [x,y]
      See Also:
    • getDragHelper

      public com.google.gwt.dom.client.Element getDragHelper(I_CmsDropTarget target)
      Description copied from interface: I_CmsDraggable
      Creates the drag helper element and attaches it into the DOM.

      Specified by:
      getDragHelper in interface I_CmsDraggable
      Parameters:
      target - the drop target
      Returns:
      the drag helper element
      See Also:
    • getHandler

      Returns the attribute handler.

      Returns:
      the attribute handler
    • getId

      public String getId()
      Description copied from interface: I_CmsDraggable
      Returns the draggable id.

      Specified by:
      getId in interface I_CmsDraggable
      Returns:
      the id
      See Also:
    • getParentTarget

      Description copied from interface: I_CmsDraggable
      Returns the parent drop target or null if there is none.

      Specified by:
      getParentTarget in interface I_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

      public com.google.gwt.dom.client.Element getPlaceholder(I_CmsDropTarget target)
      Description copied from interface: I_CmsDraggable
      Creates the drag placeholder element.

      Specified by:
      getPlaceholder in interface I_CmsDraggable
      Parameters:
      target - the drop target
      Returns:
      the drag placeholder element
      See Also:
    • getValueIndex

      public int 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

      public boolean hasValue()
      Returns if there is a value set for this attribute.

      Returns:
      true if there is a value set for this attribute
    • hideAllButtons

      public void hideAllButtons()
      Hides the button bar.

    • isDragEnabled

      public boolean isDragEnabled()
      Returns if drag and drop is enabled for this attribute.

      Returns:
      true if drag and drop is enabled for this attribute
    • isSimpleValue

      public boolean isSimpleValue()
      Returns if this view represents a simple value.

      Returns:
      true if this view represents a simple value
    • onDragCancel

      public void onDragCancel()
      Description copied from interface: I_CmsDraggable
      Executed on drag cancel.

      Specified by:
      onDragCancel in interface I_CmsDraggable
      See Also:
    • onDrop

      public void onDrop(I_CmsDropTarget target)
      Description copied from interface: I_CmsDraggable
      Executed on drop.

      Specified by:
      onDrop in interface I_CmsDraggable
      Parameters:
      target - the drop target
      See Also:
    • onStartDrag

      public void onStartDrag(I_CmsDropTarget target)
      Description copied from interface: I_CmsDraggable
      Executed on drag start.

      Specified by:
      onStartDrag in interface I_CmsDraggable
      Parameters:
      target - the current drop target
      See Also:
    • owns

      public boolean owns(com.google.gwt.dom.client.Element element)
      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

      public void removeValidationMessage()
      Removes any present error message.

    • removeValue

      public void removeValue()
      Removes the value.

    • resizeOnShow

      public void resizeOnShow()
      Description copied from interface: I_CmsHasResizeOnShow
      Adjusts widget's size once it's visible.

      Specified by:
      resizeOnShow in interface I_CmsHasResizeOnShow
      See Also:
    • setActive

      public void setActive()
      Sets the value widget active and removes the inactive view styling.

    • setCollapsed

      public void setCollapsed(boolean collapsed)
      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

      public void setCompactMode(int mode)
      Sets the compact view mode.

      Parameters:
      mode - the mode to set
    • setErrorMessage

      public void setErrorMessage(String message)
      Shows a validation error message.

      Parameters:
      message - the error message
    • setValueEntity

      public void setValueEntity(I_CmsEntityRenderer renderer, org.opencms.acacia.shared.CmsEntity value)
      Sets the value entity.

      Parameters:
      renderer - the entity renderer
      value - the value entity
    • setValueWidget

      public void setValueWidget(I_CmsFormEditWidget widget, String value, String defaultValue, boolean active)
      Sets the value widget.

      Parameters:
      widget - the widget
      value - the value
      defaultValue - the default attribute value
      active - true if the widget should be activated
    • setWarningMessage

      public void setWarningMessage(String message)
      Shows a validation warning message.

      Parameters:
      message - the warning message
    • showButtons

      public void showButtons()
      Shows the button bar.

    • toggleFocus

      public void toggleFocus(boolean focusOn)
      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 visible
      hasRemoveButton - true if the remove button should be visible
      hasSortButtons - true if the sort buttons should be visible
    • addNewAttributeValue

      protected void 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

      protected String 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

      protected void onAttach()
      Overrides:
      onAttach in class com.google.gwt.user.client.ui.Composite
      See Also:
      • Composite.onAttach()
    • onResize

      protected void 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

      protected void selectChoice(List<String> choicePath)
      Selects the attribute choice.

      Parameters:
      choicePath - the choice attribute path