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.DebugIdImplEnabledNested classes/interfaces inherited from interface com.google.gwt.user.client.ui.HasWidgets
com.google.gwt.user.client.ui.HasWidgets.ForIsWidgetNested classes/interfaces inherited from interface com.google.gwt.user.client.ui.IndexedPanel
com.google.gwt.user.client.ui.IndexedPanel.ForIsWidget -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected CmsDNDHandlerThe drag'n drop handler.protected com.google.gwt.dom.client.ElementThe current place holder.protected intThe placeholder position index.Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(com.google.gwt.user.client.ui.Widget widget) voidAdds an item to the list.protected voidChanges the id for the given item.booleancheckPosition(int x, int y, CmsDNDHandler.Orientation orientation) Returns true if the given cursor position is over the drop target.voidClears 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.intgetItemPosition(I item) Returns the given item position.intReturns the index of the placeholder or -1 if no placeholder is attached.voidinsert(com.google.gwt.user.client.ui.Widget widget, int position) Inserts the given widget at the given position.voidinsertItem(I item, int position) Inserts the given item at the given position.voidinsertPlaceholder(com.google.gwt.dom.client.Element placeholder, int x, int y, CmsDNDHandler.Orientation orientation) Inserts a new placeholder.booleanReturns if the list will always returntrueon check target requests within drag and drop.booleanChecks if dropping is enabled.voidonDrop(I_CmsDraggable draggable) Executed on drop.protected voidregisterItem(I item) Registers the given item on this list.booleanremove(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.voidRemoves the placeholder.voidrepositionPlaceholder(int x, int y, CmsDNDHandler.Orientation orientation) Repositions the placeholder.voidsetDNDHandler(CmsDNDHandler handler) Sets the drag'n drop handler.voidsetDNDTakeAll(boolean takeAll) Sets if the list will always returntrueon check target requests within drag and drop.voidsetDropEnabled(boolean enabled) Enables/disables dropping.protected voidsetPlaceholder(com.google.gwt.dom.client.Element placeholder) Sets the current drag'n drop place holder.voidTruncates 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, removeMethods inherited from class com.google.gwt.user.client.ui.Panel
add, adopt, clear, doAttachChildren, doDetachChildren, orphan, removeMethods 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, 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, resolvePotentialElement, 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_CmsDropTarget
getElementMethods 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:
addin interfacecom.google.gwt.user.client.ui.HasWidgets- Overrides:
addin classcom.google.gwt.user.client.ui.Panel- See Also:
-
addItem
Adds an item to the list.- Parameters:
item- the item to add- See Also:
-
checkPosition
Description copied from interface:I_CmsDropTargetReturns true if the given cursor position is over the drop target.- Specified by:
checkPositionin interfaceI_CmsDropTarget- Parameters:
x- the cursor client x positiony- the cursor client y positionorientation- the drag and drop orientation- Returns:
trueif 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:
-
getItem
Returns the list item with the given id.- Parameters:
itemId- the id of the item to retrieve- Returns:
- the list item
- See Also:
-
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_CmsDropTargetReturns the index of the placeholder or -1 if no placeholder is attached.- Specified by:
getPlaceholderIndexin 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_CmsDropTargetInserts a new placeholder.- Specified by:
insertPlaceholderin 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 returntrueon check target requests within drag and drop.- Returns:
trueif take all is enabled for drag and drop
-
isDropEnabled
Checks if dropping is enabled.- Returns:
trueif dropping is enabled
-
onDrop
Description copied from interface:I_CmsDropTargetExecuted on drop.- Specified by:
onDropin interfaceI_CmsDropTarget- Parameters:
draggable- the draggable being dropped- See Also:
-
remove
- Specified by:
removein interfacecom.google.gwt.user.client.ui.HasWidgets- Overrides:
removein classcom.google.gwt.user.client.ui.ComplexPanel- See Also:
-
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_CmsDropTargetRemoves the placeholder.- Specified by:
removePlaceholderin interfaceI_CmsDropTarget- See Also:
-
repositionPlaceholder
Description copied from interface:I_CmsDropTargetRepositions the placeholder.- Specified by:
repositionPlaceholderin 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 returntrueon check target requests within drag and drop.- Parameters:
takeAll-trueto enable take all for drag and drop
-
setDropEnabled
Enables/disables dropping.- Parameters:
enabled-trueto enable, orfalseto disable
-
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:
-
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
-