Class CmsList<I extends I_CmsListItem>

  • 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 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 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.
      • Fields inherited from class com.google.gwt.user.client.ui.UIObject

        DEBUG_ID_PREFIX
    • 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 return true 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 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​(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 java.lang.Iterable

        forEach, spliterator
    • Constructor Detail

      • CmsList

        public CmsList()
        Constructor.

    • Method Detail

      • 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:
        add(Widget)
      • clearList

        public void clearList()
        Clears the list.

      • 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
      • 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
      • 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
      • 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:
        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)
      • 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
      • 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 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