Package org.opencms.gwt.client.ui
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 ClassesModifier and TypeClassDescriptionstatic 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
FieldsModifier and TypeFieldDescriptionprotected 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
ConstructorsConstructorDescriptionCmsListItemWidget
(org.opencms.gwt.shared.CmsListInfoBean infoBean) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
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
(String styleName) Adds a style name to the subtitle label.void
addTitleStyleName
(String styleName) 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
removeSubtitleStyleName
(String styleName) Removes a style name from the subtitle label.void
removeTitleStyleName
(String styleName) 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
setBackground
(CmsListItemWidget.Background background) Sets the background color.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.void
setIcon
(com.google.gwt.user.client.ui.Image image) Sets the icon of this item.void
Sets the icon for this item using the given CSS classes.void
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
(String title) 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
setSubtitleLabel
(String label) 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
setTitleLabel
(String label) 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
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
The CSS class to set the additional info open. -
m_additionalInfo
DIV for additional item info. -
m_buttonPanel
Panel to hold buttons. -
m_contentPanel
Panel to hold the content. -
m_iconClickHandlers
A list of click handlers for the main icon. -
m_iconPanel
The DIV showing the list icon. -
m_openClose
The open-close button for the additional info. -
m_shortExtraInfoLabel
A label which is optionally displayed after the subtitle. -
m_subtitle
Sub title label. -
m_title
Title label. -
m_titleBox
Container for the title. -
m_titleRow
The title row, holding the title and the open-close button for the additional info.
-
-
Constructor Details
-
Method Details
-
addButton
Adds a widget to the button panel.- Parameters:
w
- the widget to add
-
addButtonToFront
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 interfacecom.google.gwt.event.dom.client.HasClickHandlers
- See Also:
-
HasClickHandlers.addClickHandler(ClickHandler)
-
addDoubleClickHandler
public com.google.gwt.event.shared.HandlerRegistration addDoubleClickHandler(com.google.gwt.event.dom.client.DoubleClickHandler handler) - Specified by:
addDoubleClickHandler
in interfacecom.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 interfacecom.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 interfacecom.google.gwt.event.dom.client.HasMouseOverHandlers
- See Also:
-
HasMouseOverHandlers.addMouseOverHandler(com.google.gwt.event.dom.client.MouseOverHandler)
-
addSubtitleStyleName
Adds a style name to the subtitle label.- Parameters:
styleName
- the style name to add
-
addTitleStyleName
Adds a style name to the title label.- Parameters:
styleName
- the style name to add
-
clearIcon
Hides the icon of the list item widget. -
forceMouseOut
Forces mouse out on self and contained buttons. -
getButton
Returns the button at the given position.- Parameters:
index
- the button index- Returns:
- the button at the given position
-
getButtonCount
Returns the number of buttons.- Returns:
- the number of buttons
-
getButtonPanel
Returns the button panel.- Returns:
- the button panel
-
getContentPanel
Returns the content panel.- Returns:
- the content panel
-
getInfoBean
-
getOpenClose
-
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
Returns if additional info items are present.- Returns:
true
if additional info items are present
-
removeButton
Removes a widget from the button panel.- Parameters:
w
- the widget to remove
-
removeMouseHandlers
Removes all registered mouse event handlers including the context menu handler. -
removeSubtitleStyleName
Removes a style name from the subtitle label.- Parameters:
styleName
- the style name to add
-
removeTitleStyleName
Removes a style name from the title label.- Parameters:
styleName
- the style name to add
-
setAdditionalInfoValue
Sets the additional info value label at the given position.- Parameters:
index
- the additional info indexlabel
- the new value to set
-
setAdditionalInfoVisible
Sets the additional info visible if present.- Parameters:
visible
-true
to show,false
to hide
-
setBackground
Sets the background color.- Parameters:
background
- the color
-
setExtraInfo
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
Sets the icon of this item.- Parameters:
image
- the image to use as icon
-
setIcon
Sets the icon for this item using the given CSS classes.- Parameters:
iconClasses
- the CSS classes
-
setIcon
Sets the icon for this item using the given CSS classes.- Parameters:
iconClasses
- the CSS classesdetailIconClasses
- the detail type icon classes if available
-
setIconCursor
Sets the cursor for the icon.- Parameters:
cursor
- the cursor for the icon
-
setIconTitle
Sets the icon title.- Parameters:
title
- the new icon title
-
setSubtitleLabel
Sets the subtitle label text.- Parameters:
label
- the new subtitle to set
-
setTitleEditable
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
Sets the title label text.- Parameters:
label
- the new title to set
-
setTopRightIcon
Sets the icon in the top right corner and its title.- Parameters:
iconClass
- the CSS class for the icontitle
- the value for the title attribute of the icon
-
setUnselectable
Makes the content of the list info box unselectable. -
truncate
Description copied from interface:I_CmsTruncable
Truncates long text and sets the original text to the title attribute.- Specified by:
truncate
in interfaceI_CmsTruncable
- Parameters:
textMetricsPrefix
- the key identifying the text metrics to usewidgetWidth
- the width to use in pixels- See Also:
-
truncateAdditionalInfo
Truncates the additional info items.- Parameters:
textMetricsPrefix
- the text metrics prefixwidgetWidth
- the width to truncate to
-
updateTruncation
Updates the truncation of labels if needed.Use after changing any text on the widget.
-
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. -
onEditTitleTextBox
Internal method which is called when the user has finished editing the title.- Parameters:
box
- the text box which has been edited