Package org.opencms.gwt.client.ui
Class CmsList<I extends I_CmsListItem>
java.lang.Object
com.google.gwt.user.client.ui.UIObject
com.google.gwt.user.client.ui.Widget
com.google.gwt.user.client.ui.Panel
com.google.gwt.user.client.ui.ComplexPanel
org.opencms.gwt.client.ui.CmsList<I>
- Type Parameters:
I
- the specific list item implementation
- 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.HasWidgets
,com.google.gwt.user.client.ui.HasWidgets.ForIsWidget
,com.google.gwt.user.client.ui.IndexedPanel
,com.google.gwt.user.client.ui.IndexedPanel.ForIsWidget
,com.google.gwt.user.client.ui.IsWidget
,Iterable<com.google.gwt.user.client.ui.Widget>
,I_CmsDropTarget
,I_CmsTruncable
- Direct Known Subclasses:
CmsTree
public class CmsList<I extends I_CmsListItem>
extends com.google.gwt.user.client.ui.ComplexPanel
implements I_CmsTruncable, I_CmsDropTarget
A very basic list implementation to hold
CmsListItemWidget
.- Since:
- 8.0.0
-
Nested Class Summary
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
Nested classes/interfaces inherited from interface com.google.gwt.user.client.ui.HasWidgets
com.google.gwt.user.client.ui.HasWidgets.ForIsWidget
Nested classes/interfaces inherited from interface com.google.gwt.user.client.ui.IndexedPanel
com.google.gwt.user.client.ui.IndexedPanel.ForIsWidget
-
Field Summary
Modifier and TypeFieldDescriptionprotected CmsDNDHandler
The drag'n drop handler.protected com.google.gwt.dom.client.Element
The current place holder.protected int
The placeholder position index.Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(com.google.gwt.user.client.ui.Widget widget) void
Adds an item to the list.protected void
Changes the id for the given item.boolean
checkPosition
(int x, int y, CmsDNDHandler.Orientation orientation) Returns true if the given cursor position is over the drop target.void
Clears the list.Returns the drag'n drop handler.getItem
(int index) Returns the list item at the given position.Returns the list item with the given id.int
getItemPosition
(I item) Returns the given item position.int
Returns the index of the placeholder or -1 if no placeholder is attached.void
insert
(com.google.gwt.user.client.ui.Widget widget, int position) Inserts the given widget at the given position.void
insertItem
(I item, int position) Inserts the given item at the given position.void
insertPlaceholder
(com.google.gwt.dom.client.Element placeholder, int x, int y, CmsDNDHandler.Orientation orientation) Inserts a new placeholder.boolean
Returns if the list will always returntrue
on check target requests within drag and drop.boolean
Checks if dropping is enabled.void
onDrop
(I_CmsDraggable draggable) Executed on drop.protected void
registerItem
(I item) Registers the given item on this list.boolean
remove
(com.google.gwt.user.client.ui.Widget w) removeItem
(I item) Removes an item from the list.removeItem
(String itemId) Removes an item from the list.void
Removes the placeholder.void
repositionPlaceholder
(int x, int y, CmsDNDHandler.Orientation orientation) Repositions the placeholder.void
setDNDHandler
(CmsDNDHandler handler) Sets the drag'n drop handler.void
setDNDTakeAll
(boolean takeAll) Sets if the list will always returntrue
on check target requests within drag and drop.void
setDropEnabled
(boolean enabled) Enables/disables dropping.protected void
setPlaceholder
(com.google.gwt.dom.client.Element placeholder) Sets the current drag'n drop place holder.void
Truncates long text and sets the original text to the title attribute.Methods inherited from class com.google.gwt.user.client.ui.ComplexPanel
add, add, adjustIndex, checkIndexBoundsForAccess, checkIndexBoundsForInsertion, getChildren, getWidget, getWidgetCount, getWidgetIndex, getWidgetIndex, insert, insert, iterator, remove
Methods inherited from class com.google.gwt.user.client.ui.Panel
add, adopt, clear, doAttachChildren, doDetachChildren, orphan, remove
Methods inherited from class com.google.gwt.user.client.ui.Widget
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, fireEvent, getHandlerCount, getLayoutData, getParent, isAttached, isOrWasAttached, onAttach, onBrowserEvent, onDetach, 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, resolvePotentialElement, 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 org.opencms.gwt.client.dnd.I_CmsDropTarget
getElement
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
m_dndHandler
The drag'n drop handler. -
m_placeholder
The current place holder. -
m_placeholderIndex
The placeholder position index.
-
-
Constructor Details
-
CmsList
public CmsList()Constructor.
-
-
Method Details
-
add
- Specified by:
add
in interfacecom.google.gwt.user.client.ui.HasWidgets
- Overrides:
add
in classcom.google.gwt.user.client.ui.Panel
- See Also:
-
Panel.add(com.google.gwt.user.client.ui.Widget)
-
addItem
Adds an item to the list.- Parameters:
item
- the item to add- See Also:
-
checkPosition
Description copied from interface:I_CmsDropTarget
Returns true if the given cursor position is over the drop target.- Specified by:
checkPosition
in interfaceI_CmsDropTarget
- Parameters:
x
- the cursor client x positiony
- the cursor client y positionorientation
- the drag and drop orientation- Returns:
true
if the given cursor position is over the drop target- See Also:
-
clearList
Clears the list. -
getDnDHandler
Returns the drag'n drop handler.- Returns:
- the handler
-
getItem
Returns the list item at the given position.- Parameters:
index
- the position- Returns:
- the list item
- See Also:
-
ComplexPanel.getWidget(int)
-
getItem
Returns the list item with the given id.- Parameters:
itemId
- the id of the item to retrieve- Returns:
- the list item
- See Also:
-
ComplexPanel.getWidget(int)
-
getItemPosition
Returns the given item position.- Parameters:
item
- the item to get the position for- Returns:
- the item position
-
getPlaceholderIndex
Description copied from interface:I_CmsDropTarget
Returns the index of the placeholder or -1 if no placeholder is attached.- Specified by:
getPlaceholderIndex
in interfaceI_CmsDropTarget
- Returns:
- the index
- See Also:
-
insert
Inserts the given widget at the given position.- Parameters:
widget
- the widget to insertposition
- the position
-
insertItem
Inserts the given item at the given position.- Parameters:
item
- the item to insertposition
- the position
-
insertPlaceholder
public void insertPlaceholder(com.google.gwt.dom.client.Element placeholder, int x, int y, CmsDNDHandler.Orientation orientation) Description copied from interface:I_CmsDropTarget
Inserts a new placeholder.- Specified by:
insertPlaceholder
in interfaceI_CmsDropTarget
- Parameters:
placeholder
- the placeholder elementx
- the cursor client x positiony
- the cursor client y positionorientation
- the drag and drop orientation- See Also:
-
isDNDTakeAll
Returns if the list will always returntrue
on check target requests within drag and drop.- Returns:
true
if take all is enabled for drag and drop
-
isDropEnabled
Checks if dropping is enabled.- Returns:
true
if dropping is enabled
-
onDrop
Description copied from interface:I_CmsDropTarget
Executed on drop.- Specified by:
onDrop
in interfaceI_CmsDropTarget
- Parameters:
draggable
- the draggable being dropped- See Also:
-
remove
- Specified by:
remove
in interfacecom.google.gwt.user.client.ui.HasWidgets
- Overrides:
remove
in classcom.google.gwt.user.client.ui.ComplexPanel
- See Also:
-
ComplexPanel.remove(com.google.gwt.user.client.ui.Widget)
-
removeItem
Removes an item from the list.- Parameters:
item
- the item to remove- Returns:
- the removed item
- See Also:
-
removeItem
Removes an item from the list.- Parameters:
itemId
- the id of the item to remove- Returns:
- the removed item
- See Also:
-
removePlaceholder
Description copied from interface:I_CmsDropTarget
Removes the placeholder.- Specified by:
removePlaceholder
in interfaceI_CmsDropTarget
- See Also:
-
repositionPlaceholder
Description copied from interface:I_CmsDropTarget
Repositions the placeholder.- Specified by:
repositionPlaceholder
in interfaceI_CmsDropTarget
- Parameters:
x
- the cursor client x positiony
- the cursor client y positionorientation
- the drag and drop orientation- See Also:
-
setDNDHandler
Sets the drag'n drop handler.- Parameters:
handler
- the handler to set
-
setDNDTakeAll
Sets if the list will always returntrue
on check target requests within drag and drop.- Parameters:
takeAll
-true
to enable take all for drag and drop
-
setDropEnabled
Enables/disables dropping.- Parameters:
enabled
-true
to enable, orfalse
to disable
-
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:
-
changeId
Changes the id for the given item.- Parameters:
item
- the item to change the id forid
- the new id
-
registerItem
Registers the given item on this list.- Parameters:
item
- the item to register
-
setPlaceholder
Sets the current drag'n drop place holder.- Parameters:
placeholder
- the element to set as place holder
-