JIDE 3.5.15

com.jidesoft.combobox
Class MultiSelectListChooserPanel

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by com.jidesoft.combobox.PopupPanel
                      extended by com.jidesoft.combobox.ListChooserPanel
                          extended by com.jidesoft.combobox.MultiSelectListChooserPanel
All Implemented Interfaces:
DefaultButtonProvider, AlignmentSupport, ItemListener, ImageObserver, ItemSelectable, MenuContainer, Serializable, EventListener, Accessible, ListDataListener
Direct Known Subclasses:
CheckBoxListChooserPanel

public class MultiSelectListChooserPanel
extends ListChooserPanel
implements DefaultButtonProvider

MultiSelectListChooserPanel is a PopupPanel that can choose a value from a JList with allows multiple selection.

See Also:
Serialized Form

Nested Class Summary
protected  class MultiSelectListChooserPanel.Handler
           
 
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
protected  Action _cancelAction
           
protected  JButton _cancelButton
           
protected  ListModel _listModel
           
protected  Action _okAction
           
protected  JButton _okButton
           
 
Fields inherited from class com.jidesoft.combobox.ListChooserPanel
_class, _list, keyListener, listMouseListener, listMouseMotionListener, listSelectionListener, mouseListener, mouseMotionListener
 
Fields inherited from class com.jidesoft.combobox.PopupPanel
_previousSelectedObject, SELECTED_BY_MOUSE_ROLLOVER
 
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
MultiSelectListChooserPanel()
           
MultiSelectListChooserPanel(Action okAction, Action cancelAction)
           
MultiSelectListChooserPanel(ComboBoxModel model, Class<?> clazz)
          Creates a new JPanel with a double buffer and a flow layout.
MultiSelectListChooserPanel(ComboBoxModel model, Class<?> clazz, Action okAction, Action cancelAction)
           
MultiSelectListChooserPanel(ComboBoxModel model, Class<?> clazz, ConverterContext elementConverterContext)
          Creates a new JPanel with a double buffer and a flow layout.
MultiSelectListChooserPanel(ComboBoxModel model, Class<?> clazz, ConverterContext elementConverterContext, Action okAction, Action cancelAction)
           
MultiSelectListChooserPanel(Object[] objects, Class<?> clazz)
          Creates a new CheckBoxListChooserPanel.
MultiSelectListChooserPanel(Object[] objects, Class<?> clazz, Action okAction, Action cancelAction)
           
MultiSelectListChooserPanel(Vector<?> objects, Class<?> clazz)
          Creates a new JPanel with a double buffer and a flow layout.
MultiSelectListChooserPanel(Vector<?> objects, Class<?> clazz, Action okAction, Action cancelAction)
           
 
Method Summary
protected  void configureListModel(ComboBoxModel model)
          Configure the list model with the combo box model of MultiSelectListChooserPanel.
 void contentsChanged(ListDataEvent e)
          The list data listener when entry(s) is/are inserted in the combo box model.
protected  Vector<Object> convertComboBoxModelToVector(ComboBoxModel comboBoxModel)
           
 Component createButtonPanel(int alignment)
           
protected  MultiSelectListChooserPanel.Handler createHandler()
          Creates the handler to handle mouse events and property change events
protected  JList createList(ComboBoxModel comboBoxModel)
          Subclass can override this method to create a custom JList.
protected  ListModel createListModel(Vector<?> vector)
          Creates the list model for the list use based on the vector.
 Action getCancelAction()
           
 JButton getDefaultButton()
          Gets the default button
 Action getOkAction()
           
 Object getSelectedObject()
          Gets the selected object.
protected  void initComponents()
           
 void intervalAdded(ListDataEvent e)
          The list data listener when new entry(s) is/are inserted in the combo box model.
 void intervalRemoved(ListDataEvent e)
          The list data listener when old entry(s) is/are removed in the combo box model.
protected  boolean isAutoScroll()
           
protected  void prepareSelectedObject()
           
protected  Object[] retrieveListSelection()
           
 void setCancelAction(Action cancelAction)
           
 void setOkAction(Action okAction)
           
protected  void setupList(JList list)
          Configures the list.
protected  void updateListSelection(Object selectedObject, boolean shouldScroll)
           
 
Methods inherited from class com.jidesoft.combobox.ListChooserPanel
convertMouseEvent, createItemListener, createKeyListener, createListDataListener, createListMouseListener, createListMouseMotionListener, createListSelectionListener, createMouseListener, createMouseMotionListener, createPropertyChangeListener, customizeScroller, getConverter, getConverterContext, getHorizontalAlignment, getList, getMaximumRowCount, getMaximumWidth, getMouseListener, getMouseMotionListener, getRenderer, getVerticalAlignment, installListListeners, itemStateChanged, removeAllListeners, setConverter, setConverterContext, setHorizontalAlignment, setMaximumRowCount, setMaximumWidth, setRenderer, setSelectedObject, setVerticalAlignment, updateListSelectionWithoutFiringEvent
 
Methods inherited from class com.jidesoft.combobox.PopupPanel
addItemListener, addItemListener, fireItemStateChanged, getActualPreferredSize, getDefaultFocusComponent, getItemListeners, getPreferredSize, getPreviousSelectedObject, getResizableCorners, getSelectedObjects, getTitle, isResetButtonVisible, isResizable, isStretchToFit, needsButtons, removeItemListener, requestFocus, setDefaultFocusComponent, setNeedButtons, setPreferredSize, setResizable, setResizableCorners, setSelectedObject, setSelectedObject, setSelectedObject, setStretchToFit, setTitle
 
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, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, 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, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, 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, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, 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, hide, 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, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_listModel

protected ListModel _listModel

_okButton

protected JButton _okButton

_cancelButton

protected JButton _cancelButton

_okAction

protected Action _okAction

_cancelAction

protected Action _cancelAction
Constructor Detail

MultiSelectListChooserPanel

public MultiSelectListChooserPanel()

MultiSelectListChooserPanel

public MultiSelectListChooserPanel(Action okAction,
                                   Action cancelAction)

MultiSelectListChooserPanel

public MultiSelectListChooserPanel(Object[] objects,
                                   Class<?> clazz)
Creates a new CheckBoxListChooserPanel.

Parameters:
objects - an array of objects to insert into the combo box
clazz - the element type

MultiSelectListChooserPanel

public MultiSelectListChooserPanel(Object[] objects,
                                   Class<?> clazz,
                                   Action okAction,
                                   Action cancelAction)
Parameters:
objects - an array of objects to insert into the combo box
clazz - the element type
okAction - the OK action
cancelAction - the cancel action

MultiSelectListChooserPanel

public MultiSelectListChooserPanel(Vector<?> objects,
                                   Class<?> clazz)
Creates a new JPanel with a double buffer and a flow layout.

Parameters:
objects - a vector of the objects
clazz - the element type

MultiSelectListChooserPanel

public MultiSelectListChooserPanel(Vector<?> objects,
                                   Class<?> clazz,
                                   Action okAction,
                                   Action cancelAction)

MultiSelectListChooserPanel

public MultiSelectListChooserPanel(ComboBoxModel model,
                                   Class<?> clazz)
Creates a new JPanel with a double buffer and a flow layout.

Parameters:
model - the ComboBoxModel that provides the displayed list of items
clazz - the element type

MultiSelectListChooserPanel

public MultiSelectListChooserPanel(ComboBoxModel model,
                                   Class<?> clazz,
                                   Action okAction,
                                   Action cancelAction)
Parameters:
model - the ComboBoxModel that provides the displayed list of items
clazz - the element type
okAction - the OK action
cancelAction - the cancel action

MultiSelectListChooserPanel

public MultiSelectListChooserPanel(ComboBoxModel model,
                                   Class<?> clazz,
                                   ConverterContext elementConverterContext)
Creates a new JPanel with a double buffer and a flow layout.

Parameters:
model - the combobox model
clazz - the element type
elementConverterContext - the converter context for the elements.

MultiSelectListChooserPanel

public MultiSelectListChooserPanel(ComboBoxModel model,
                                   Class<?> clazz,
                                   ConverterContext elementConverterContext,
                                   Action okAction,
                                   Action cancelAction)
Method Detail

setOkAction

public void setOkAction(Action okAction)

getOkAction

public Action getOkAction()

setCancelAction

public void setCancelAction(Action cancelAction)

getCancelAction

public Action getCancelAction()

getDefaultButton

public JButton getDefaultButton()
Description copied from interface: DefaultButtonProvider
Gets the default button

Specified by:
getDefaultButton in interface DefaultButtonProvider
Returns:
the default button

createButtonPanel

public Component createButtonPanel(int alignment)

initComponents

protected void initComponents()
Overrides:
initComponents in class ListChooserPanel

createList

protected JList createList(ComboBoxModel comboBoxModel)
Subclass can override this method to create a custom JList. The Searchable is installed in this method. If you override, you need to install the Searchable on the list by yourself.

Overrides:
createList in class ListChooserPanel
Parameters:
comboBoxModel - the combobox model which is used to create a CheckBoxList.
Returns:
the list

createListModel

protected ListModel createListModel(Vector<?> vector)
Creates the list model for the list use based on the vector.

Parameters:
vector - the elements vector
Returns:
the created list model.
Since:
3.2.1

convertComboBoxModelToVector

protected Vector<Object> convertComboBoxModelToVector(ComboBoxModel comboBoxModel)

setupList

protected void setupList(JList list)
Configures the list. The base class sets cell renderer and add mouse/key listener in this method. Subclass can override this method to do additional setup.

Overrides:
setupList in class ListChooserPanel
Parameters:
list - the check box list

retrieveListSelection

protected Object[] retrieveListSelection()

updateListSelection

protected void updateListSelection(Object selectedObject,
                                   boolean shouldScroll)
Overrides:
updateListSelection in class ListChooserPanel

getSelectedObject

public Object getSelectedObject()
Gets the selected object. In the case of MultiSelectListChooserPanel, the selected object is an array of elements that are checked in the CheckBoxList. The return type is always Object[] regardless of the actual data type.

Overrides:
getSelectedObject in class PopupPanel
Returns:
the selected object.

createHandler

protected MultiSelectListChooserPanel.Handler createHandler()
Description copied from class: ListChooserPanel
Creates the handler to handle mouse events and property change events

Overrides:
createHandler in class ListChooserPanel
Returns:
the handler

isAutoScroll

protected boolean isAutoScroll()
Overrides:
isAutoScroll in class ListChooserPanel

intervalAdded

public void intervalAdded(ListDataEvent e)
The list data listener when new entry(s) is/are inserted in the combo box model.

Specified by:
intervalAdded in interface ListDataListener
Overrides:
intervalAdded in class ListChooserPanel
Parameters:
e - the event
Since:
3.2.1

intervalRemoved

public void intervalRemoved(ListDataEvent e)
The list data listener when old entry(s) is/are removed in the combo box model.

Specified by:
intervalRemoved in interface ListDataListener
Overrides:
intervalRemoved in class ListChooserPanel
Parameters:
e - the event
Since:
3.2.1

contentsChanged

public void contentsChanged(ListDataEvent e)
The list data listener when entry(s) is/are inserted in the combo box model.

Specified by:
contentsChanged in interface ListDataListener
Overrides:
contentsChanged in class ListChooserPanel
Parameters:
e - the event
Since:
3.2.1

configureListModel

protected void configureListModel(ComboBoxModel model)
Configure the list model with the combo box model of MultiSelectListChooserPanel.

Parameters:
model - the combo box model
Since:
3.2.1

prepareSelectedObject

protected void prepareSelectedObject()

JIDE 3.5.15