Class CmsListItemWidget

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.gwt.client.ui.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
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    Additional info item HTML.
    static enum 
    Background color values.
    protected static interface 
     
    static interface 
    The interface for handling edits of the title field.

    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
    protected com.google.gwt.user.client.ui.FlowPanel
    DIV for additional item info.
    protected com.google.gwt.user.client.ui.FlowPanel
    Panel to hold buttons.
    protected com.google.gwt.user.client.ui.FlowPanel
    Panel to hold the content.
    protected List<com.google.gwt.event.dom.client.ClickHandler>
    A list of click handlers for the main icon.
    protected com.google.gwt.user.client.ui.SimplePanel
    The DIV showing the list icon.
    protected CmsPushButton
    The open-close button for the additional info.
    protected com.google.gwt.user.client.ui.InlineLabel
    A label which is optionally displayed after the subtitle.
    protected CmsLabel
    Sub title label.
    protected CmsLabel
    Title label.
    protected com.google.gwt.user.client.ui.FlowPanel
    Container for the title.
    protected com.google.gwt.user.client.ui.FlowPanel
    The title row, holding the title and the open-close button for the additional info.
    protected static final String
    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

    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
    Adds a style name to the subtitle label.
    void
    Adds a style name to the title label.
    void
    Hides the icon of the list item widget.
    protected void
    Internal method which is called when the user clicks on an editable title field.
    protected void
    Ensures the open close button for the additional info list is present.
    void
    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
    Returns the number of buttons.
    com.google.gwt.user.client.ui.FlowPanel
    Returns the button panel.
    com.google.gwt.user.client.ui.FlowPanel
    Returns the content panel.
    org.opencms.gwt.shared.CmsListInfoBean
     
     
    com.google.gwt.user.client.ui.InlineLabel
    Returns the label after the subtitle.
    Returns the subtitle label.
    Returns the title label text.
    Gets the title widget.
    boolean
    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
    Removes all registered mouse event handlers including the context menu handler.
    void
    Removes a style name from the subtitle label.
    void
    Removes a style name from the title label.
    void
    setAdditionalInfoValue(int index, String label)
    Sets the additional info value label at the given position.
    void
    setAdditionalInfoVisible(boolean visible)
    Sets the additional info visible if present.
    void
    Sets the background color.
    void
    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(String iconClasses)
    Sets the icon for this item using the given CSS classes.
    void
    setIcon(String iconClasses, 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
    Sets the icon title.
    void
    setLockIcon(org.opencms.gwt.shared.CmsListInfoBean.LockIcon icon, String iconTitle)
    Sets the lock icon.
    void
    setStateIcon(org.opencms.gwt.shared.CmsListInfoBean.StateIcon icon)
    Sets the state icon.
    void
    Sets the subtitle label text.
    void
    setTitleEditable(boolean editable)
    Enables or disabled editing of the title field.
    void
    Sets the handler for editing the list item widget's title.
    void
    Sets the title label text.
    void
    setTopRightIcon(String iconClass, String title)
    Sets the icon in the top right corner and its title.
    void
    Makes the content of the list info box unselectable.
    void
    truncate(String textMetricsPrefix, int widgetWidth)
    Truncates long text and sets the original text to the title attribute.
    void
    truncateAdditionalInfo(String textMetricsPrefix, int widgetWidth)
    Truncates the additional info items.
    void
    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 Details

    • OPENCLASS

      protected static final 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 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_openClose

      The open-close button for the additional info.
    • m_shortExtraInfoLabel

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

      @UiField protected CmsLabel m_subtitle
      Sub title label.
    • m_title

      @UiField protected CmsLabel m_title
      Title label.
    • 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 Details

    • 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 Details

    • 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(String styleName)
      Adds a style name to the subtitle label.

      Parameters:
      styleName - the style name to add
    • addTitleStyleName

      public void addTitleStyleName(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
    • getInfoBean

      public org.opencms.gwt.shared.CmsListInfoBean getInfoBean()
    • getOpenClose

    • getShortExtraInfoLabel

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

      Returns:
      the label after the subtitle
    • getSubtitleLabel

      Returns the subtitle label.

      Returns:
      the subtitle label
    • getTitleLabel

      Returns the title label text.

      Returns:
      the title label text
    • getTitleWidget

      Gets the title widget.

      Returns:
      the title widget
    • 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(String styleName)
      Removes a style name from the subtitle label.

      Parameters:
      styleName - the style name to add
    • removeTitleStyleName

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

      Parameters:
      styleName - the style name to add
    • setAdditionalInfoValue

      public void setAdditionalInfoValue(int index, 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
    • setBackground

      public void setBackground(CmsListItemWidget.Background background)
      Sets the background color.

      Parameters:
      background - the color
    • setExtraInfo

      public void setExtraInfo(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(String iconClasses)
      Sets the icon for this item using the given CSS classes.

      Parameters:
      iconClasses - the CSS classes
    • setIcon

      public void setIcon(String iconClasses, 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(String title)
      Sets the icon title.

      Parameters:
      title - the new icon title
    • setLockIcon

      public void setLockIcon(org.opencms.gwt.shared.CmsListInfoBean.LockIcon icon, 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(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
    • setTitleEditHandler

      Sets the handler for editing the list item widget's title.
      Parameters:
      handler - the new title editing handler
    • setTitleLabel

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

      Parameters:
      label - the new title to set
    • setTopRightIcon

      public void setTopRightIcon(String iconClass, 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.

    • truncate

      public void truncate(String textMetricsPrefix, int widgetWidth)
      Description copied from interface: I_CmsTruncable
      Truncates long text and sets the original text to the title attribute.

      Specified by:
      truncate in interface I_CmsTruncable
      Parameters:
      textMetricsPrefix - the key identifying the text metrics to use
      widgetWidth - the width to use in pixels
      See Also:
    • truncateAdditionalInfo

      public void truncateAdditionalInfo(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

      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