Class 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  CmsAttributeValueView.ChangeHandler
      The widget value change handler.
      protected class  CmsAttributeValueView.LabelHoverHandler
      Handles showing and hiding the help bubble on mouse over the title label.
      protected class  CmsAttributeValueView.MoveHandle
      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
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void 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 addNewAttributeValue()
      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 getButtonBar()  
      com.google.common.base.Optional<int[]> getCursorOffsetDelta()
      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.
      CmsAttributeHandler getHandler()
      Returns the attribute handler.
      java.lang.String getId()
      Returns the draggable id.
      protected java.lang.String getLabel()
      Returns the attribute label.
      I_CmsDropTarget getParentTarget()
      Returns the parent drop target or null if there is none.
      CmsAttributeValueView getParentView()
      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 getValueIndex()
      Returns the attribute value index.
      I_CmsEditWidget getValueWidget()
      Returns the editing widget.
      boolean hasValue()
      Returns if there is a value set for this attribute.
      void hideAllButtons()
      Hides the button bar.
      boolean isDragEnabled()
      Returns if drag and drop is enabled for this attribute.
      boolean isSimpleValue()
      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 onDragCancel()
      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 removeValidationMessage()
      Removes any present error message.
      void removeValue()
      Removes the value.
      void resizeOnShow()
      Adjusts widget's size once it's visible.
      protected void selectChoice​(java.util.List<java.lang.String> choicePath)
      Selects the attribute choice.
      void setActive()
      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​(java.lang.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, java.lang.String value, java.lang.String defaultValue, boolean active)
      Sets the value widget.
      void setWarningMessage​(java.lang.String message)
      Shows a validation warning message.
      void showButtons()
      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
    • Constructor Detail

      • CmsAttributeValueView

        public CmsAttributeValueView​(CmsAttributeHandler handler,
                                     java.lang.String label,
                                     java.lang.String help)
        Constructor.

        Parameters:
        handler - the attribute handler
        label - the attribute label
        help - the attribute help information
    • Method Detail

      • 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()
      • getValueIndex

        public int getValueIndex()
        Returns the attribute value index.

        Returns:
        the attribute value index
      • 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
      • 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
      • 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
      • removeValue

        public void removeValue()
        Removes the value.

      • 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​(java.lang.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,
                                   java.lang.String value,
                                   java.lang.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​(java.lang.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
      • 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 java.lang.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​(java.util.List<java.lang.String> choicePath)
        Selects the attribute choice.

        Parameters:
        choicePath - the choice attribute path