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
,java.lang.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 holdCmsListItemWidget
.- 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
-
-
Field Summary
Fields Modifier and Type Field Description protected CmsDNDHandler
m_dndHandler
The drag'n drop handler.protected com.google.gwt.dom.client.Element
m_placeholder
The current place holder.protected int
m_placeholderIndex
The placeholder position index.
-
Constructor Summary
Constructors Constructor Description CmsList()
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(com.google.gwt.user.client.ui.Widget widget)
void
addItem(I item)
Adds an item to the list.protected void
changeId(I item, java.lang.String id)
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
clearList()
Clears the list.CmsDNDHandler
getDnDHandler()
Returns the drag'n drop handler.I
getItem(int index)
Returns the list item at the given position.I
getItem(java.lang.String itemId)
Returns the list item with the given id.int
getItemPosition(I item)
Returns the given item position.int
getPlaceholderIndex()
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
isDNDTakeAll()
Returns if the list will always returntrue
on check target requests within drag and drop.boolean
isDropEnabled()
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)
I
removeItem(I item)
Removes an item from the list.I
removeItem(java.lang.String itemId)
Removes an item from the list.void
removePlaceholder()
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
truncate(java.lang.String textMetricsPrefix, int widgetWidth)
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
-
-
-
-
Field Detail
-
m_dndHandler
protected CmsDNDHandler m_dndHandler
The drag'n drop handler.
-
m_placeholder
protected com.google.gwt.dom.client.Element m_placeholder
The current place holder.
-
m_placeholderIndex
protected int m_placeholderIndex
The placeholder position index.
-
-
Constructor Detail
-
CmsList
public CmsList()
Constructor.
-
-
Method Detail
-
add
public void add(com.google.gwt.user.client.ui.Widget widget)
- 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
public void addItem(I item)
Adds an item to the list.- Parameters:
item
- the item to add- See Also:
add(Widget)
-
checkPosition
public boolean checkPosition(int x, int y, CmsDNDHandler.Orientation orientation)
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:
I_CmsDropTarget.checkPosition(int, int, Orientation)
-
clearList
public void clearList()
Clears the list.
-
getDnDHandler
public CmsDNDHandler getDnDHandler()
Returns the drag'n drop handler.- Returns:
- the handler
-
getItem
public I getItem(int index)
Returns the list item at the given position.- Parameters:
index
- the position- Returns:
- the list item
- See Also:
ComplexPanel.getWidget(int)
-
getItem
public I getItem(java.lang.String itemId)
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
public int getItemPosition(I item)
Returns the given item position.- Parameters:
item
- the item to get the position for- Returns:
- the item position
-
getPlaceholderIndex
public int 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:
I_CmsDropTarget.getPlaceholderIndex()
-
insert
public void insert(com.google.gwt.user.client.ui.Widget widget, int position)
Inserts the given widget at the given position.- Parameters:
widget
- the widget to insertposition
- the position
-
insertItem
public void insertItem(I item, int position)
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:
I_CmsDropTarget.insertPlaceholder(com.google.gwt.dom.client.Element, int, int, Orientation)
-
isDNDTakeAll
public boolean 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
public boolean isDropEnabled()
Checks if dropping is enabled.- Returns:
true
if dropping is enabled
-
onDrop
public void onDrop(I_CmsDraggable draggable)
Description copied from interface:I_CmsDropTarget
Executed on drop.- Specified by:
onDrop
in interfaceI_CmsDropTarget
- Parameters:
draggable
- the draggable being dropped- See Also:
I_CmsDropTarget.onDrop(org.opencms.gwt.client.dnd.I_CmsDraggable)
-
remove
public boolean remove(com.google.gwt.user.client.ui.Widget w)
- 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
public I removeItem(I item)
Removes an item from the list.- Parameters:
item
- the item to remove- Returns:
- the removed item
- See Also:
remove(Widget)
-
removeItem
public I removeItem(java.lang.String itemId)
Removes an item from the list.- Parameters:
itemId
- the id of the item to remove- Returns:
- the removed item
- See Also:
remove(Widget)
-
removePlaceholder
public void removePlaceholder()
Description copied from interface:I_CmsDropTarget
Removes the placeholder.- Specified by:
removePlaceholder
in interfaceI_CmsDropTarget
- See Also:
I_CmsDropTarget.removePlaceholder()
-
repositionPlaceholder
public void repositionPlaceholder(int x, int y, CmsDNDHandler.Orientation orientation)
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:
I_CmsDropTarget.repositionPlaceholder(int, int, Orientation)
-
setDNDHandler
public void setDNDHandler(CmsDNDHandler handler)
Sets the drag'n drop handler.- Parameters:
handler
- the handler to set
-
setDNDTakeAll
public void setDNDTakeAll(boolean takeAll)
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
public void setDropEnabled(boolean enabled)
Enables/disables dropping.- Parameters:
enabled
-true
to enable, orfalse
to disable
-
truncate
public void truncate(java.lang.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 interfaceI_CmsTruncable
- Parameters:
textMetricsPrefix
- the key identifying the text metrics to usewidgetWidth
- the width to use in pixels- See Also:
I_CmsTruncable.truncate(java.lang.String, int)
-
changeId
protected void changeId(I item, java.lang.String id)
Changes the id for the given item.- Parameters:
item
- the item to change the id forid
- the new id
-
registerItem
protected void registerItem(I item)
Registers the given item on this list.- Parameters:
item
- the item to register
-
setPlaceholder
protected void setPlaceholder(com.google.gwt.dom.client.Element placeholder)
Sets the current drag'n drop place holder.- Parameters:
placeholder
- the element to set as place holder
-
-