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

    Fields
    Modifier and Type
    Field
    Description
    protected 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

    Constructors
    Constructor
    Description
    Constructor.
  • Method Summary

    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, 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
    Clears the list.
    Returns the drag'n drop handler.
    getItem(int index)
    Returns the list item at the given position.
    getItem(String itemId)
    Returns the list item with the given id.
    int
    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 return true on check target requests within drag and drop.
    boolean
    Checks if dropping is enabled.
    void
    Executed on drop.
    protected void
    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.
    Removes an item from the list.
    void
    Removes the placeholder.
    void
    repositionPlaceholder(int x, int y, CmsDNDHandler.Orientation orientation)
    Repositions the placeholder.
    void
    Sets the drag'n drop handler.
    void
    setDNDTakeAll(boolean takeAll)
    Sets if the list will always return true 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(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

    Methods inherited from interface java.lang.Iterable

    forEach, spliterator
  • Field Details

  • Constructor Details

    • CmsList

      public CmsList()
      Constructor.

  • Method Details

    • add

      public void add(com.google.gwt.user.client.ui.Widget widget)
      Specified by:
      add in interface com.google.gwt.user.client.ui.HasWidgets
      Overrides:
      add in class com.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:
    • 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 interface I_CmsDropTarget
      Parameters:
      x - the cursor client x position
      y - the cursor client y position
      orientation - the drag and drop orientation
      Returns:
      true if the given cursor position is over the drop target
      See Also:
    • clearList

      public void clearList()
      Clears the list.

    • 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(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 interface I_CmsDropTarget
      Returns:
      the index
      See Also:
    • 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 insert
      position - the position
    • insertItem

      public void insertItem(I item, int position)
      Inserts the given item at the given position.

      Parameters:
      item - the item to insert
      position - 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 interface I_CmsDropTarget
      Parameters:
      placeholder - the placeholder element
      x - the cursor client x position
      y - the cursor client y position
      orientation - the drag and drop orientation
      See Also:
    • isDNDTakeAll

      public boolean isDNDTakeAll()
      Returns if the list will always return true 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 interface I_CmsDropTarget
      Parameters:
      draggable - the draggable being dropped
      See Also:
    • remove

      public boolean remove(com.google.gwt.user.client.ui.Widget w)
      Specified by:
      remove in interface com.google.gwt.user.client.ui.HasWidgets
      Overrides:
      remove in class com.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:
    • removeItem

      public I removeItem(String itemId)
      Removes an item from the list.

      Parameters:
      itemId - the id of the item to remove
      Returns:
      the removed item
      See Also:
    • removePlaceholder

      public void removePlaceholder()
      Description copied from interface: I_CmsDropTarget
      Removes the placeholder.

      Specified by:
      removePlaceholder in interface I_CmsDropTarget
      See Also:
    • repositionPlaceholder

      public void repositionPlaceholder(int x, int y, CmsDNDHandler.Orientation orientation)
      Description copied from interface: I_CmsDropTarget
      Repositions the placeholder.

      Specified by:
      repositionPlaceholder in interface I_CmsDropTarget
      Parameters:
      x - the cursor client x position
      y - the cursor client y position
      orientation - the drag and drop orientation
      See Also:
    • 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 return true 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, or false to disable
    • truncate

      public void truncate(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 interface I_CmsTruncable
      Parameters:
      textMetricsPrefix - the key identifying the text metrics to use
      widgetWidth - the width to use in pixels
      See Also:
    • changeId

      protected void changeId(I item, String id)
      Changes the id for the given item.

      Parameters:
      item - the item to change the id for
      id - 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