util.ui.customizableitems

## Class SelectableItemList

- java.lang.Object
- - java.awt.Component
  - - java.awt.Container
    - - javax.swing.JComponent
      - - javax.swing.JPanel
        - - util.ui.customizableitems.SelectableItemList

- All Implemented Interfaces:
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.event.ListSelectionListener

      public class SelectableItemList
      extends javax.swing.JPanel
      implements javax.swing.event.ListSelectionListener

  A class that provides a list that contains selectable items.
  Author:
    René Mach
  See Also:
    Serialized Form

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class javax.swing.JPanel

      `javax.swing.JPanel.AccessibleJPanel`

    - ### Nested classes/interfaces inherited from class javax.swing.JComponent

      `javax.swing.JComponent.AccessibleJComponent`

    - ### Nested classes/interfaces inherited from class java.awt.Container

      `java.awt.Container.AccessibleAWTContainer`

    - ### Nested classes/interfaces inherited from class java.awt.Component

      `java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy`

  - ### Field Summary

    - ### Fields inherited from class javax.swing.JComponent

      `accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW`

    - ### Fields inherited from class java.awt.Component

      `BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT`

    - ### Fields inherited from interface java.awt.image.ImageObserver

      `ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SelectableItemList(java.lang.Object[] currSelection, java.lang.Object[] allItems)` Creates the SelectableItemList without the selection buttons.
    `SelectableItemList(java.lang.Object[] currSelection, java.lang.Object[] allItems, boolean showSelectionButtons)` Creates the SelectableItemList.
    `SelectableItemList(java.lang.Object[] currSelection, java.lang.Object[] allItems, boolean showSelectionButtons, java.lang.Object[] notSelectableItems)` Creates the SelectableItemList.
    `SelectableItemList(java.lang.Object[] currSelection, java.lang.Object[] allItems, java.lang.Object[] notSelectableItems)` Creates the SelectableItemList without the selection buttons.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addCenterRendererComponent(java.lang.Class<?> clazz, SelectableItemRendererCenterComponentIf component)` Adds the render component that is to be used for the given class or it's super class.
    `void` | `addListSelectionListener(javax.swing.event.ListSelectionListener listener)`
    `void` | `addMouseListener(java.awt.event.MouseListener listener)` Adds a mouse listener to the list.
    `void` | `calculateSize()` Calculates the size of the list.
    `void` | `clearSelection()` Clear the selection.
    `int` | `getItemCount()`
    `java.lang.Object[]` | `getListSelection()` Current selected Items in the List.
    `java.lang.Object` | `getSelectedValue()`
    `java.lang.Object[]` | `getSelection()` Attention: This is not a List with all selected Items in the List.
    `void` | `invertSelection()` Invert the selection
    `boolean` | `isEmpty()` Gets if this selectable item list is empty.
    `void` | `removeListSelectionListener(javax.swing.event.ListSelectionListener listener)`
    `void` | `selectAll()` Select all items.
    `void` | `setEnabled(boolean value)`
    `void` | `setFilterComboBox(javax.swing.JComboBox filterBox)` Sets the combo box that contains ItemFilters to filter the shown values of the list.
    `void` | `setHorizontalScrollBarPolicy(int value)` Sets if the horizontal scroll policy.
    `void` | `setListUI(javax.swing.plaf.ListUI ui)` Sets the UI to be used for the list.
    `void` | `setSelectedIndex(int index)` set the (focus) selection to the item with the given index
    `void` | `setSelectionMode(int selectionMode)`
    `void` | `setVerticalScrollBarBlockIncrement(int value)` Sets the vertical scroll bar block increment
    `void` | `valueChanged(javax.swing.event.ListSelectionEvent e)`

    - ### Methods inherited from class javax.swing.JPanel

      `getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI`

    - ### Methods inherited from class javax.swing.JComponent

      `addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update`

    - ### Methods inherited from class java.awt.Container

      `add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree`

    - ### Methods inherited from class java.awt.Component

      `action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### SelectableItemList

          public SelectableItemList(java.lang.Object[] currSelection,
                            java.lang.Object[] allItems)

      Creates the SelectableItemList without the selection buttons.
      Parameters:
        `currSelection` - The currently selected Objects.
        `allItems` - All Objects of the list.

    - #### SelectableItemList

          public SelectableItemList(java.lang.Object[] currSelection,
                            java.lang.Object[] allItems,
                            java.lang.Object[] notSelectableItems)

      Creates the SelectableItemList without the selection buttons.
      Parameters:
        `currSelection` - The currently selected Objects.
        `allItems` - All Objects of the list.
        `notSelectableItems` - All Objects that could not be selected/deselected
      Since:
        2.7.2

    - #### SelectableItemList

          public SelectableItemList(java.lang.Object[] currSelection,
                            java.lang.Object[] allItems,
                            boolean showSelectionButtons)

      Creates the SelectableItemList.
      Parameters:
        `currSelection` - The currently selected Objects.
        `allItems` - All Objects of the list.
        `showSelectionButtons` - If the selection buttons should be shown.

    - #### SelectableItemList

          public SelectableItemList(java.lang.Object[] currSelection,
                            java.lang.Object[] allItems,
                            boolean showSelectionButtons,
                            java.lang.Object[] notSelectableItems)

      Creates the SelectableItemList.
      Parameters:
        `currSelection` - The currently selected Objects.
        `allItems` - All Objects of the list.
        `showSelectionButtons` - If the selection buttons should be shown.
        `notSelectableItems` - All Objects that could not be selected/deselected
      Since:
        2.7.2

  - ### Method Detail

    - #### addListSelectionListener

          public void addListSelectionListener(javax.swing.event.ListSelectionListener listener)

      Parameters:
        `listener` - Add this Listener
      Since:
        2.5

    - #### removeListSelectionListener

          public void removeListSelectionListener(javax.swing.event.ListSelectionListener listener)

      Parameters:
        `listener` - Remove this Listener
      Since:
        2.5

    - #### setSelectionMode

          public void setSelectionMode(int selectionMode)

      Parameters:
        `selectionMode` - The selection mode of the list.
      Since:
        2.5

    - #### getListSelection

          public java.lang.Object[] getListSelection()

      Current selected Items in the List. Attention: This is not a List with all activated Items.
      Returns:
        Current selected Items in the List
      Since:
        2.5

    - #### getSelection

          public java.lang.Object[] getSelection()

      Attention: This is not a List with all selected Items in the List. This List is a List with all checked Items
      Returns:
        The selected Objects

    - #### getSelectedValue

          public java.lang.Object getSelectedValue()

      Returns:
        The current selected value (value that has focus)
      Since:
        2.5

    - #### setSelectedIndex

          public void setSelectedIndex(int index)

      set the (focus) selection to the item with the given index
      Parameters:
        `index` -
      Since:
        3.0

    - #### invertSelection

          public void invertSelection()

      Invert the selection

    - #### selectAll

          public void selectAll()

      Select all items.

    - #### clearSelection

          public void clearSelection()

      Clear the selection.

    - #### setEnabled

          public void setEnabled(boolean value)

      Overrides:
        `setEnabled` in class `javax.swing.JComponent`

    - #### calculateSize

          public void calculateSize()

      Calculates the size of the list.

    - #### addCenterRendererComponent

          public void addCenterRendererComponent(java.lang.Class<?> clazz,
                                        SelectableItemRendererCenterComponentIf component)

      Adds the render component that is to be used for the given class or it's super class.

      Parameters:
        `clazz` - The class to use the render component for, the render component is also used for the super class of clazz.
        `component` - The render component.
      Since:
        2.7

    - #### setListUI

          public void setListUI(javax.swing.plaf.ListUI ui)

      Sets the UI to be used for the list.

      Parameters:
        `ui` - The list ui that should be used for the list.
      Since:
        2.7

    - #### setHorizontalScrollBarPolicy

          public void setHorizontalScrollBarPolicy(int value)

      Sets if the horizontal scroll policy.

      Parameters:
        `value` - The values from ScrollPaneConstants.
      Since:
        2.7

    - #### addMouseListener

          public void addMouseListener(java.awt.event.MouseListener listener)

      Adds a mouse listener to the list.

      Overrides:
        `addMouseListener` in class `java.awt.Component`
      Parameters:
        `listener` - The listener to add.
      Since:
        2.7

    - #### setFilterComboBox

          public void setFilterComboBox(javax.swing.JComboBox filterBox)

      Sets the combo box that contains ItemFilters to filter the shown values of the list.

      Parameters:
        `filterBox` - The combo box with the ItemFilters.
      Since:
        2.7

    - #### getItemCount

          public int getItemCount()

    - #### setVerticalScrollBarBlockIncrement

          public void setVerticalScrollBarBlockIncrement(int value)

      Sets the vertical scroll bar block increment

      Parameters:
        `value` - The scroll bar block increment
      Since:
        3.1

    - #### valueChanged

          public void valueChanged(javax.swing.event.ListSelectionEvent e)

      Specified by:
        `valueChanged` in interface `javax.swing.event.ListSelectionListener`

    - #### isEmpty

          public boolean isEmpty()

      Gets if this selectable item list is empty.

      Returns:
        `true` if this list is empty.
      Since:
        3.4.3

TV-Browser 3.4.3, Copyright (C) 2004-2008 TV-Browser Team (dev@tvbrowser.org)