Class CmsListItemWidget

  • All Implemented Interfaces:
    com.google.gwt.event.dom.client.HasClickHandlers, com.google.gwt.event.dom.client.HasDoubleClickHandlers, 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.logical.shared.HasCloseHandlers<CmsListItemWidget>, com.google.gwt.event.logical.shared.HasOpenHandlers<CmsListItemWidget>, 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_CmsTruncable
    Direct Known Subclasses:
    CmsGalleryTreeItem.CmsGalleryListItemWidget, CmsInfoLoadingListItemWidget, CmsModelPageTreeItem.CmsModelPageListItemWidget, CmsResultItemWidget

    public class CmsListItemWidget
    extends com.google.gwt.user.client.ui.Composite
    implements com.google.gwt.event.logical.shared.HasOpenHandlers<CmsListItemWidget>, com.google.gwt.event.logical.shared.HasCloseHandlers<CmsListItemWidget>, com.google.gwt.event.dom.client.HasMouseOutHandlers, com.google.gwt.event.dom.client.HasClickHandlers, com.google.gwt.event.dom.client.HasDoubleClickHandlers, com.google.gwt.event.dom.client.HasMouseOverHandlers, I_CmsTruncable
    Provides a UI list item.

    Since:
    8.0.0
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected com.google.gwt.user.client.ui.FlowPanel m_additionalInfo
      DIV for additional item info.
      protected com.google.gwt.user.client.ui.FlowPanel m_buttonPanel
      Panel to hold buttons.
      protected com.google.gwt.user.client.ui.FlowPanel m_contentPanel
      Panel to hold the content.
      protected java.util.List<com.google.gwt.event.dom.client.ClickHandler> m_iconClickHandlers
      A list of click handlers for the main icon.
      protected com.google.gwt.user.client.ui.SimplePanel m_iconPanel
      The DIV showing the list icon.
      protected CmsPushButton m_openClose
      The open-close button for the additional info.
      protected com.google.gwt.user.client.ui.InlineLabel m_shortExtraInfoLabel
      A label which is optionally displayed after the subtitle.
      protected CmsLabel m_subtitle
      Sub title label.
      protected CmsLabel m_title
      Title label.
      protected com.google.gwt.user.client.ui.FlowPanel m_titleBox
      Container for the title.
      protected com.google.gwt.user.client.ui.FlowPanel m_titleRow
      The title row, holding the title and the open-close button for the additional info.
      protected static java.lang.String OPENCLASS
      The CSS class to set the additional info open.
      • Fields inherited from class com.google.gwt.user.client.ui.UIObject

        DEBUG_ID_PREFIX
    • Constructor Summary

      Constructors 
      Constructor Description
      CmsListItemWidget​(org.opencms.gwt.shared.CmsListInfoBean infoBean)
      Constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addAdditionalInfo​(org.opencms.gwt.shared.CmsAdditionalInfoBean additionalInfo)
      Adds an additional info item to the list.
      void addButton​(com.google.gwt.user.client.ui.Widget w)
      Adds a widget to the button panel.
      void addButtonToFront​(com.google.gwt.user.client.ui.Widget w)
      Adds a widget to the front of the button panel.
      com.google.gwt.event.shared.HandlerRegistration addClickHandler​(com.google.gwt.event.dom.client.ClickHandler handler)  
      com.google.gwt.event.shared.HandlerRegistration addCloseHandler​(com.google.gwt.event.logical.shared.CloseHandler<CmsListItemWidget> handler)  
      com.google.gwt.event.shared.HandlerRegistration addDoubleClickHandler​(com.google.gwt.event.dom.client.DoubleClickHandler handler)  
      com.google.gwt.event.shared.HandlerRegistration addIconClickHandler​(com.google.gwt.event.dom.client.ClickHandler handler)
      Adds a mouse click handler to the icon panel.
      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)  
      com.google.gwt.event.shared.HandlerRegistration addOpenHandler​(com.google.gwt.event.logical.shared.OpenHandler<CmsListItemWidget> handler)  
      void addSubtitleStyleName​(java.lang.String styleName)
      Adds a style name to the subtitle label.
      void addTitleStyleName​(java.lang.String styleName)
      Adds a style name to the title label.
      void clearIcon()
      Hides the icon of the list item widget.
      protected void editTitle()
      Internal method which is called when the user clicks on an editable title field.
      protected void ensureOpenCloseAdditionalInfo()
      Ensures the open close button for the additional info list is present.
      void forceMouseOut()
      Forces mouse out on self and contained buttons.
      com.google.gwt.user.client.ui.Widget getButton​(int index)
      Returns the button at the given position.
      int getButtonCount()
      Returns the number of buttons.
      com.google.gwt.user.client.ui.FlowPanel getButtonPanel()
      Returns the button panel.
      com.google.gwt.user.client.ui.FlowPanel getContentPanel()
      Returns the content panel.
      com.google.gwt.user.client.ui.InlineLabel getShortExtraInfoLabel()
      Returns the label after the subtitle.
      java.lang.String getSubtitleLabel()
      Returns the subtitle label.
      java.lang.String getTitleLabel()
      Returns the title label text.
      CmsLabel getTitleWidget()
      Gets the title widget.
      boolean hasAdditionalInfo()
      Returns if additional info items are present.
      protected void init​(org.opencms.gwt.shared.CmsListInfoBean infoBean)
      Constructor.
      protected void initAdditionalInfo​(org.opencms.gwt.shared.CmsListInfoBean infoBean)
      Initializes the additional info.
      protected void onEditTitleTextBox​(com.google.gwt.user.client.ui.TextBox box)
      Internal method which is called when the user has finished editing the title.
      void reInitAdditionalInfo​(org.opencms.gwt.shared.CmsListInfoBean infoBean)
      Re-initializes the additional infos.
      void removeButton​(com.google.gwt.user.client.ui.Widget w)
      Removes a widget from the button panel.
      void removeMouseHandlers()
      Removes all registered mouse event handlers including the context menu handler.
      void removeSubtitleStyleName​(java.lang.String styleName)
      Removes a style name from the subtitle label.
      void removeTitleStyleName​(java.lang.String styleName)
      Removes a style name from the title label.
      void setAdditionalInfoValue​(int index, java.lang.String label)
      Sets the additional info value label at the given position.
      void setAdditionalInfoVisible​(boolean visible)
      Sets the additional info visible if present.
      void setBackground​(CmsListItemWidget.Background background)
      Sets the background color.
      void setExtraInfo​(java.lang.String text)
      Sets the extra info text, and hides or displays the extra info label depending on whether the text is null or not null.
      void setIcon​(com.google.gwt.user.client.ui.Image image)
      Sets the icon of this item.
      void setIcon​(java.lang.String iconClasses)
      Sets the icon for this item using the given CSS classes.
      void setIcon​(java.lang.String iconClasses, java.lang.String detailIconClasses)
      Sets the icon for this item using the given CSS classes.
      void setIconCursor​(com.google.gwt.dom.client.Style.Cursor cursor)
      Sets the cursor for the icon.
      void setIconTitle​(java.lang.String title)
      Sets the icon title.
      void setLockIcon​(org.opencms.gwt.shared.CmsListInfoBean.LockIcon icon, java.lang.String iconTitle)
      Sets the lock icon.
      void setStateIcon​(org.opencms.gwt.shared.CmsListInfoBean.StateIcon icon)
      Sets the state icon.
      void setSubtitleLabel​(java.lang.String label)
      Sets the subtitle label text.
      void setTitleEditable​(boolean editable)
      Enables or disabled editing of the title field.
      void setTitleEditHandler​(CmsListItemWidget.I_CmsTitleEditHandler handler)
      Sets the handler for editing the list item widget's title.
      void setTitleLabel​(java.lang.String label)
      Sets the title label text.
      void setTopRightIcon​(java.lang.String iconClass, java.lang.String title)
      Sets the icon in the top right corner and its title.
      void setUnselectable()
      Makes the content of the list info box unselectable.
      void truncate​(java.lang.String textMetricsPrefix, int widgetWidth)
      Truncates long text and sets the original text to the title attribute.
      void truncateAdditionalInfo​(java.lang.String textMetricsPrefix, int widgetWidth)
      Truncates the additional info items.
      void updateTruncation()
      Updates the truncation of labels if needed.
      • Methods inherited from class com.google.gwt.user.client.ui.Composite

        claimElement, getWidget, initializeClaimedElement, initWidget, isAttached, onAttach, 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
    • Field Detail

      • OPENCLASS

        protected static final java.lang.String OPENCLASS
        The CSS class to set the additional info open.
      • m_additionalInfo

        @UiField
        protected com.google.gwt.user.client.ui.FlowPanel m_additionalInfo
        DIV for additional item info.
      • m_buttonPanel

        @UiField
        protected com.google.gwt.user.client.ui.FlowPanel m_buttonPanel
        Panel to hold buttons.
      • m_contentPanel

        @UiField
        protected com.google.gwt.user.client.ui.FlowPanel m_contentPanel
        Panel to hold the content.
      • m_iconClickHandlers

        protected java.util.List<com.google.gwt.event.dom.client.ClickHandler> m_iconClickHandlers
        A list of click handlers for the main icon.
      • m_iconPanel

        @UiField
        protected com.google.gwt.user.client.ui.SimplePanel m_iconPanel
        The DIV showing the list icon.
      • m_shortExtraInfoLabel

        protected com.google.gwt.user.client.ui.InlineLabel m_shortExtraInfoLabel
        A label which is optionally displayed after the subtitle.
      • m_titleBox

        @UiField
        protected com.google.gwt.user.client.ui.FlowPanel m_titleBox
        Container for the title.
      • m_titleRow

        @UiField
        protected com.google.gwt.user.client.ui.FlowPanel m_titleRow
        The title row, holding the title and the open-close button for the additional info.
    • Constructor Detail

      • CmsListItemWidget

        public CmsListItemWidget​(org.opencms.gwt.shared.CmsListInfoBean infoBean)
        Constructor. Using a 'li'-tag as default root element.

        Parameters:
        infoBean - bean holding the item information
    • Method Detail

      • addAdditionalInfo

        public void addAdditionalInfo​(org.opencms.gwt.shared.CmsAdditionalInfoBean additionalInfo)
        Adds an additional info item to the list.

        Parameters:
        additionalInfo - the additional info to display
      • addButton

        public void addButton​(com.google.gwt.user.client.ui.Widget w)
        Adds a widget to the button panel.

        Parameters:
        w - the widget to add
      • addButtonToFront

        public void addButtonToFront​(com.google.gwt.user.client.ui.Widget w)
        Adds a widget to the front of the button panel.

        Parameters:
        w - the widget to add
      • addClickHandler

        public com.google.gwt.event.shared.HandlerRegistration addClickHandler​(com.google.gwt.event.dom.client.ClickHandler handler)
        Specified by:
        addClickHandler in interface com.google.gwt.event.dom.client.HasClickHandlers
        See Also:
        HasClickHandlers.addClickHandler(ClickHandler)
      • addCloseHandler

        public com.google.gwt.event.shared.HandlerRegistration addCloseHandler​(com.google.gwt.event.logical.shared.CloseHandler<CmsListItemWidget> handler)
        Specified by:
        addCloseHandler in interface com.google.gwt.event.logical.shared.HasCloseHandlers<CmsListItemWidget>
        See Also:
        HasCloseHandlers.addCloseHandler(com.google.gwt.event.logical.shared.CloseHandler)
      • addDoubleClickHandler

        public com.google.gwt.event.shared.HandlerRegistration addDoubleClickHandler​(com.google.gwt.event.dom.client.DoubleClickHandler handler)
        Specified by:
        addDoubleClickHandler in interface com.google.gwt.event.dom.client.HasDoubleClickHandlers
        See Also:
        HasDoubleClickHandlers.addDoubleClickHandler(com.google.gwt.event.dom.client.DoubleClickHandler)
      • addIconClickHandler

        public com.google.gwt.event.shared.HandlerRegistration addIconClickHandler​(com.google.gwt.event.dom.client.ClickHandler handler)
        Adds a mouse click handler to the icon panel.

        Parameters:
        handler - the click handler
        Returns:
        the handler registration
      • 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)
      • addOpenHandler

        public com.google.gwt.event.shared.HandlerRegistration addOpenHandler​(com.google.gwt.event.logical.shared.OpenHandler<CmsListItemWidget> handler)
        Specified by:
        addOpenHandler in interface com.google.gwt.event.logical.shared.HasOpenHandlers<CmsListItemWidget>
        See Also:
        HasOpenHandlers.addOpenHandler(com.google.gwt.event.logical.shared.OpenHandler)
      • addSubtitleStyleName

        public void addSubtitleStyleName​(java.lang.String styleName)
        Adds a style name to the subtitle label.

        Parameters:
        styleName - the style name to add
      • addTitleStyleName

        public void addTitleStyleName​(java.lang.String styleName)
        Adds a style name to the title label.

        Parameters:
        styleName - the style name to add
      • clearIcon

        public void clearIcon()
        Hides the icon of the list item widget.

      • forceMouseOut

        public void forceMouseOut()
        Forces mouse out on self and contained buttons.

      • getButton

        public com.google.gwt.user.client.ui.Widget getButton​(int index)
        Returns the button at the given position.

        Parameters:
        index - the button index
        Returns:
        the button at the given position
      • getButtonCount

        public int getButtonCount()
        Returns the number of buttons.

        Returns:
        the number of buttons
      • getButtonPanel

        public com.google.gwt.user.client.ui.FlowPanel getButtonPanel()
        Returns the button panel.

        Returns:
        the button panel
      • getContentPanel

        public com.google.gwt.user.client.ui.FlowPanel getContentPanel()
        Returns the content panel.

        Returns:
        the content panel
      • getShortExtraInfoLabel

        public com.google.gwt.user.client.ui.InlineLabel getShortExtraInfoLabel()
        Returns the label after the subtitle.

        Returns:
        the label after the subtitle
      • getSubtitleLabel

        public java.lang.String getSubtitleLabel()
        Returns the subtitle label.

        Returns:
        the subtitle label
      • getTitleLabel

        public java.lang.String getTitleLabel()
        Returns the title label text.

        Returns:
        the title label text
      • hasAdditionalInfo

        public boolean hasAdditionalInfo()
        Returns if additional info items are present.

        Returns:
        true if additional info items are present
      • reInitAdditionalInfo

        public void reInitAdditionalInfo​(org.opencms.gwt.shared.CmsListInfoBean infoBean)
        Re-initializes the additional infos.

        Parameters:
        infoBean - the info bean
      • removeButton

        public void removeButton​(com.google.gwt.user.client.ui.Widget w)
        Removes a widget from the button panel.

        Parameters:
        w - the widget to remove
      • removeMouseHandlers

        public void removeMouseHandlers()
        Removes all registered mouse event handlers including the context menu handler.

      • removeSubtitleStyleName

        public void removeSubtitleStyleName​(java.lang.String styleName)
        Removes a style name from the subtitle label.

        Parameters:
        styleName - the style name to add
      • removeTitleStyleName

        public void removeTitleStyleName​(java.lang.String styleName)
        Removes a style name from the title label.

        Parameters:
        styleName - the style name to add
      • setAdditionalInfoValue

        public void setAdditionalInfoValue​(int index,
                                           java.lang.String label)
        Sets the additional info value label at the given position.

        Parameters:
        index - the additional info index
        label - the new value to set
      • setAdditionalInfoVisible

        public void setAdditionalInfoVisible​(boolean visible)
        Sets the additional info visible if present.

        Parameters:
        visible - true to show, false to hide
      • setExtraInfo

        public void setExtraInfo​(java.lang.String text)
        Sets the extra info text, and hides or displays the extra info label depending on whether the text is null or not null.

        Parameters:
        text - the text to put into the subtitle suffix
      • setIcon

        public void setIcon​(com.google.gwt.user.client.ui.Image image)
        Sets the icon of this item.

        Parameters:
        image - the image to use as icon
      • setIcon

        public void setIcon​(java.lang.String iconClasses)
        Sets the icon for this item using the given CSS classes.

        Parameters:
        iconClasses - the CSS classes
      • setIcon

        public void setIcon​(java.lang.String iconClasses,
                            java.lang.String detailIconClasses)
        Sets the icon for this item using the given CSS classes.

        Parameters:
        iconClasses - the CSS classes
        detailIconClasses - the detail type icon classes if available
      • setIconCursor

        public void setIconCursor​(com.google.gwt.dom.client.Style.Cursor cursor)
        Sets the cursor for the icon.

        Parameters:
        cursor - the cursor for the icon
      • setIconTitle

        public void setIconTitle​(java.lang.String title)
        Sets the icon title.

        Parameters:
        title - the new icon title
      • setLockIcon

        public void setLockIcon​(org.opencms.gwt.shared.CmsListInfoBean.LockIcon icon,
                                java.lang.String iconTitle)
        Sets the lock icon.

        Parameters:
        icon - the icon to use
        iconTitle - the icon title
      • setStateIcon

        public void setStateIcon​(org.opencms.gwt.shared.CmsListInfoBean.StateIcon icon)
        Sets the state icon.

        The state icon indicates if a resource is exported, secure, etc.

        Parameters:
        icon - the state icon
      • setSubtitleLabel

        public void setSubtitleLabel​(java.lang.String label)
        Sets the subtitle label text.

        Parameters:
        label - the new subtitle to set
      • setTitleEditable

        public void setTitleEditable​(boolean editable)
        Enables or disabled editing of the title field.

        Parameters:
        editable - if true, makes the title field editable
      • setTitleLabel

        public void setTitleLabel​(java.lang.String label)
        Sets the title label text.

        Parameters:
        label - the new title to set
      • setTopRightIcon

        public void setTopRightIcon​(java.lang.String iconClass,
                                    java.lang.String title)
        Sets the icon in the top right corner and its title.

        Parameters:
        iconClass - the CSS class for the icon
        title - the value for the title attribute of the icon
      • setUnselectable

        public void setUnselectable()
        Makes the content of the list info box unselectable.

      • truncateAdditionalInfo

        public void truncateAdditionalInfo​(java.lang.String textMetricsPrefix,
                                           int widgetWidth)
        Truncates the additional info items.

        Parameters:
        textMetricsPrefix - the text metrics prefix
        widgetWidth - the width to truncate to
      • updateTruncation

        public void updateTruncation()
        Updates the truncation of labels if needed.

        Use after changing any text on the widget.

      • editTitle

        protected void editTitle()
        Internal method which is called when the user clicks on an editable title field.

      • ensureOpenCloseAdditionalInfo

        protected void ensureOpenCloseAdditionalInfo()
        Ensures the open close button for the additional info list is present.

      • init

        protected void init​(org.opencms.gwt.shared.CmsListInfoBean infoBean)
        Constructor.

        Parameters:
        infoBean - bean holding the item information
      • initAdditionalInfo

        protected void initAdditionalInfo​(org.opencms.gwt.shared.CmsListInfoBean infoBean)
        Initializes the additional info.

        Parameters:
        infoBean - the info bean
      • onEditTitleTextBox

        protected void onEditTitleTextBox​(com.google.gwt.user.client.ui.TextBox box)
        Internal method which is called when the user has finished editing the title.
        Parameters:
        box - the text box which has been edited