Class JDraggableList<E>

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, Scrollable, PersistentList
Direct Known Subclasses:
JStaticList

public class JDraggableList<E> extends JList<E> implements PersistentList
JList that responds to drag and drop so items can be rearranged Also supports the persisting of list data when used as skin variable, the resulting data is a tab separated string of list items
Since:
14
See Also:
  • Field Details

    • listItemsFlavor

      public static final DataFlavor listItemsFlavor
  • Constructor Details

    • JDraggableList

      public JDraggableList(DefaultListModel<E> dataModel)
    • JDraggableList

      public JDraggableList(Object[] listData)
    • JDraggableList

      public JDraggableList(Object[] listData, String[] primaryItemKeys)
      Create a pair or JDraggableLists, populating this primary one with the items matching the keys listed as the second parameter and the remainder in the secondary list
      Parameters:
      listData - Full set of items to use. Use for instance Strings or Item objects
      primaryItemKeys - Specifies keys for items to be placed in the primary list. The rest goes in the secondary
      Since:
      14.1.2
      See Also:
    • JDraggableList

      public JDraggableList(Object[] listData, E... primaryItemKeys)
    • JDraggableList

      public JDraggableList(Object[] listData, boolean allowDuplicates)
    • JDraggableList

      public JDraggableList(Object[] listData, String[] primaryItemKeys, boolean allowDuplicates)
      Create a pair or JDraggableLists, populating this primary one with the items matching the keys listed as the second parameter
      Parameters:
      listData - Full set of items to use. Use for instance Strings or Item objects
      primaryItemKeys - Specifies keys for items to be placed in the primary list.
      allowDuplicates - If true, put all items in a static secondary list, which can be dragged from multiple times
      Since:
      14.1.11
      See Also:
    • JDraggableList

      public JDraggableList()
  • Method Details

    • contains

      public boolean contains(E item)
      Parameters:
      item -
      Returns:
      Since:
      14.1.12 Check whether this list contains given item
    • setModel

      public void setModel(ListModel<E> model)
      Overrides:
      setModel in class JList<E>
    • getSecondaryList

      public JDraggableList getSecondaryList()
      Get the secondary list, create one if needed
      Returns:
      secondary list
      Since:
      14.1.2
    • setSecondaryList

      public void setSecondaryList(JDraggableList secondaryList)
      Assign a secondary list to this list, making this list the primary list When deleting items from the primary list they are moved to the secondary list
      Parameters:
      secondaryList - - List to move deleted items to
      Since:
      14.2
    • includeItem

      public void includeItem(Object item, boolean include)
    • getContent

      public List<String> getContent()
      Specified by:
      getContent in interface PersistentList
    • setContent

      public void setContent(E... data)
      Parameters:
      data -
      Since:
      20
    • setContent

      public void setContent(List<String> data)
      Specified by:
      setContent in interface PersistentList
    • horizontal

      public JDraggableList horizontal()
      Use horizontal layout instead of vertical
      Returns:
    • small

      public JDraggableList small()
      Use smaller font size for items
      Returns:
    • isSmall

      public boolean isSmall()
    • isUseBorders

      public boolean isUseBorders()
    • setUseBorders

      public JDraggableList setUseBorders(boolean useBorders)
    • getPreferredScrollableViewportSize

      public Dimension getPreferredScrollableViewportSize()
      This method is overridden so JDraggableLists that work in pair always deliver the largest with and height of the two
      Specified by:
      getPreferredScrollableViewportSize in interface Scrollable
      Overrides:
      getPreferredScrollableViewportSize in class JList<E>
      Returns: