Package org.opencms.gwt.client.ui
Class CmsListItem
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.CmsListItem
- All Implemented Interfaces:
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_CmsListItem,I_CmsTruncable
- Direct Known Subclasses:
CmsCreatableListItem,CmsMenuListItem,CmsResultListItem,CmsToolbarClipboardView.CmsClipboardDeletedItem,CmsTreeItem
List item which uses a float panel for layout.
- Since:
- 8.0.0
-
Nested Class Summary
Nested ClassesNested 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 CmsCheckBoxThe checkbox of this list item, or null if there is no checkbox.protected CmsSimpleDecoratedPanelThe panel which contains both the decorations (checkbox, etc.) and the main widget.protected LinkedList<com.google.gwt.user.client.ui.Widget> A list of decoration widgets which is used to initializem_decoratedPanel.protected intThe decoration width which should be used to initializem_decoratedPanel.protected StringThe logical id, it is not the HTML id.protected CmsListItemWidgetThe list item widget, if this widget has one.protected com.google.gwt.user.client.ui.WidgetThe main widget of the list item.protected CmsFlowPanelThis widgets panel.protected com.google.gwt.dom.client.ElementThe drag'n drop place holder element.protected com.google.gwt.dom.client.ElementThe provisional drag parent.static final StringThe CSS class to mark the move handle.Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.CmsListItem(CmsListItemWidget widget) Default constructor.CmsListItem(CmsCheckBox checkBox, CmsListItemWidget widget) Default constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(com.google.gwt.user.client.ui.Widget w) Adds a widget to this list item.protected voidaddCheckBox(CmsCheckBox checkbox) Adds a check box to this list item.protected voidaddDecoration(com.google.gwt.user.client.ui.Widget widget, int width, boolean first) Helper method for adding a decoration widget and updating the decoration width accordingly.voidaddDecorationWidget(com.google.gwt.user.client.ui.Widget widget, int width) Adds a decoration widget to the list item.protected voidaddMainWidget(com.google.gwt.user.client.ui.Widget widget) Adds the main widget to the list item.protected com.google.gwt.dom.client.ElementcloneForPlaceholder(CmsListItem listItem) Clones the given item to be used as a place holder.Gets the checkbox of this list item.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.<T> TgetData()Gets the data belonging to the list item.List<com.google.gwt.user.client.ui.Widget> Returns the decoration widgets of this list item.Gets the class for the DND helper.Gets the class for the DND parent.com.google.gwt.dom.client.ElementgetDragHelper(I_CmsDropTarget target) Creates the drag helper element and attaches it into the DOM.getId()Returns the logical id, it is not the HTML id.Returns the list item widget of this list item, or null if this item doesn't have a list item widget.com.google.gwt.user.client.ui.WidgetReturns the main widget.Returns the move handle.Returns the parent list.Returns the parent drop target ornullif there is none.com.google.gwt.dom.client.ElementgetPlaceholder(I_CmsDropTarget target) Creates the drag placeholder element.protected voidThis internal helper method creates the actual contents of the widget by combining the decorators and the main widget.protected voidinitContent(com.google.gwt.user.client.ui.Widget mainWidget) This method is a convenience method which sets the main widget of this widget, and then callsinitContent().protected voidinitContent(CmsCheckBox checkbox, com.google.gwt.user.client.ui.Widget mainWidget) This method is a convenience method which sets the checkbox and main widget of this widget, and then callsinitContent().booleaninitMoveHandle(CmsDNDHandler dndHandler) Initializes the move handle with the given drag and drop handler and adds it to the list item widget.booleaninitMoveHandle(CmsDNDHandler dndHandler, boolean addFirst) Initializes the move handle with the given drag and drop handler and adds it to the list item widget.protected intmoveHandleLeft(com.google.gwt.dom.client.Element elem) Gets the left edge of the move handle located in the element.voidExecuted on drag cancel.voidonDrop(I_CmsDropTarget target) Executed on drop.voidonStartDrag(I_CmsDropTarget target) Executed on drag start.protected voidremoveDecorationWidget(com.google.gwt.user.client.ui.Widget widget, int width) Removes a decoration widget.voidSets the data for this list item.voidsetDndHelperClass(String dndHelperClass) Sets the class for the DND helper.voidsetDndParentClass(String dndParentClass) Sets the class for the DND parent.voidSets the logical id, it is not the HTML id.voidsetSmallView(boolean smallView) Sets the decoration style to fit with the small view of list items.voidTruncates long text and sets the original text to the title attribute.Methods inherited from class com.google.gwt.user.client.ui.Composite
claimElement, getWidget, initializeClaimedElement, initWidget, isAttached, onAttach, onBrowserEvent, onDetach, render, render, resolvePotentialElement, setWidgetMethods 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, unsinkEventsMethods 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, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.opencms.gwt.client.dnd.I_CmsDraggable
getElement
-
Field Details
-
MOVE_HANDLE_MARKER_CLASS
The CSS class to mark the move handle.- See Also:
-
m_checkbox
The checkbox of this list item, or null if there is no checkbox. -
m_decoratedPanel
The panel which contains both the decorations (checkbox, etc.) and the main widget. -
m_decorationWidgets
A list of decoration widgets which is used to initializem_decoratedPanel. -
m_decorationWidth
The decoration width which should be used to initializem_decoratedPanel. -
m_id
The logical id, it is not the HTML id. -
m_listItemWidget
The list item widget, if this widget has one. -
m_mainWidget
The main widget of the list item. -
m_panel
This widgets panel. -
m_placeholder
The drag'n drop place holder element. -
m_provisionalParent
The provisional drag parent.
-
-
Constructor Details
-
CmsListItem
public CmsListItem()Default constructor. -
CmsListItem
Default constructor.- Parameters:
checkBox- the checkboxwidget- the widget to use
-
CmsListItem
Default constructor.- Parameters:
widget- the widget to use
-
-
Method Details
-
add
Description copied from interface:I_CmsListItemAdds a widget to this list item.- Specified by:
addin interfaceI_CmsListItem- Parameters:
w- the widget to add- See Also:
-
addDecorationWidget
Adds a decoration widget to the list item.- Parameters:
widget- the widgetwidth- the widget width
-
getCheckBox
Gets the checkbox of this list item.This method will return a checkbox if this list item has one, or null if it doesn't.
- Returns:
- a check box or null
-
getCursorOffsetDelta
Description copied from interface:I_CmsDraggableGets an optional pair of integers which are to be used as an "offset delta" for the drag and drop process.- Specified by:
getCursorOffsetDeltain interfaceI_CmsDraggable- Returns:
- an optional array containing exactly 2 entries [x,y]
- See Also:
-
getData
Gets the data belonging to the list item.- Returns:
- the data belonging to the list item
-
getDecorationWidgets
Returns the decoration widgets of this list item.- Returns:
- the decoration widgets
-
getDndHelperClass
Gets the class for the DND helper.- Returns:
- the class for the DND helper
-
getDndParentClass
Gets the class for the DND parent.- Returns:
- the class for the DND parent
-
getDragHelper
Description copied from interface:I_CmsDraggableCreates the drag helper element and attaches it into the DOM.- Specified by:
getDragHelperin interfaceI_CmsDraggable- Parameters:
target- the drop target- Returns:
- the drag helper element
- See Also:
-
getId
Description copied from interface:I_CmsListItemReturns the logical id, it is not the HTML id.- Specified by:
getIdin interfaceI_CmsDraggable- Specified by:
getIdin interfaceI_CmsListItem- Returns:
- the id
- See Also:
-
getListItemWidget
Returns the list item widget of this list item, or null if this item doesn't have a list item widget.- Returns:
- a list item widget or null
-
getMainWidget
Returns the main widget.- Returns:
- the main widget
-
getMoveHandle
Returns the move handle.- Returns:
- the move handle
-
getParentList
Returns the parent list.- Returns:
- the parent list
-
getParentTarget
Description copied from interface:I_CmsDraggableReturns the parent drop target ornullif there is none.- Specified by:
getParentTargetin interfaceI_CmsDraggable- Returns:
- the parent drop target
- See Also:
-
getPlaceholder
Description copied from interface:I_CmsDraggableCreates the drag placeholder element.- Specified by:
getPlaceholderin interfaceI_CmsDraggable- Parameters:
target- the drop target- Returns:
- the drag placeholder element
- See Also:
-
initMoveHandle
Initializes the move handle with the given drag and drop handler and adds it to the list item widget.This method will not work for list items that don't have a list-item-widget.
- Parameters:
dndHandler- the drag and drop handler- Returns:
trueif initialization was successful
-
initMoveHandle
Initializes the move handle with the given drag and drop handler and adds it to the list item widget.This method will not work for list items that don't have a list-item-widget.
- Parameters:
dndHandler- the drag and drop handleraddFirst- if true, adds the move handle as first child- Returns:
trueif initialization was successful
-
onDragCancel
Description copied from interface:I_CmsDraggableExecuted on drag cancel.- Specified by:
onDragCancelin interfaceI_CmsDraggable- See Also:
-
onDrop
Description copied from interface:I_CmsDraggableExecuted on drop.- Specified by:
onDropin interfaceI_CmsDraggable- Parameters:
target- the drop target- See Also:
-
onStartDrag
Description copied from interface:I_CmsDraggableExecuted on drag start.- Specified by:
onStartDragin interfaceI_CmsDraggable- Parameters:
target- the current drop target- See Also:
-
setData
Sets the data for this list item.- Parameters:
data- the data to set
-
setDndHelperClass
Sets the class for the DND helper.- Parameters:
dndHelperClass- the class for the DND helper
-
setDndParentClass
Sets the class for the DND parent.- Parameters:
dndParentClass- the class for the DND parent
-
setId
Description copied from interface:I_CmsListItemSets the logical id, it is not the HTML id.- Specified by:
setIdin interfaceI_CmsListItem- Parameters:
id- the id to set- See Also:
-
setSmallView
Sets the decoration style to fit with the small view of list items.- Parameters:
smallView- true if the decoration has to fit with the small view of list items
-
truncate
Description copied from interface:I_CmsTruncableTruncates long text and sets the original text to the title attribute.- Specified by:
truncatein interfaceI_CmsTruncable- Parameters:
textMetricsPrefix- the key identifying the text metrics to usewidgetWidth- the width to use in pixels- See Also:
-
addCheckBox
Adds a check box to this list item.- Parameters:
checkbox- the check box
-
addDecoration
Helper method for adding a decoration widget and updating the decoration width accordingly.- Parameters:
widget- the decoration widget to addwidth- the intended width of the decoration widgetfirst- if true, inserts the widget at the front of the decorations, else at the end.
-
addMainWidget
Adds the main widget to the list item.In most cases, the widget will be a list item widget. If this is the case, then further calls to
getListItemWidget()will return the widget which was passed as a parameter to this method. Otherwise, the method will return null.- Parameters:
widget- the main content widget
-
cloneForPlaceholder
Clones the given item to be used as a place holder.- Parameters:
listItem- the item to clone- Returns:
- the cloned item
-
initContent
This internal helper method creates the actual contents of the widget by combining the decorators and the main widget. -
initContent
This method is a convenience method which sets the checkbox and main widget of this widget, and then callsinitContent().- Parameters:
checkbox- the checkbox to addmainWidget- the mainWidget to add
-
initContent
This method is a convenience method which sets the main widget of this widget, and then callsinitContent().- Parameters:
mainWidget- the main widget to add
-
moveHandleLeft
Gets the left edge of the move handle located in the element.- Parameters:
elem- the element to search in- Returns:
- the left edge of the move handle
-
removeDecorationWidget
Removes a decoration widget.- Parameters:
widget- the widget to removewidth- the widget width
-