wt.clients.widgets
Class ListSelector

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JPanel
                  extended bywt.clients.widgets.BaseSelector
                      extended bywt.clients.widgets.ListSelector
All Implemented Interfaces:
Accessible, ImageObserver, MenuContainer, SelectorInterface, Serializable
Direct Known Subclasses:
AttrDefListSelector, ClassificationStructureSelector, ConstraintTable.ConstraintListSelector, DiscreteQFDetailsSelector, LikeQFDetailsSelector, MainPanelSelector, MeasurementSystemSelector, NavigationStructureSelector, QuantityOfMeasureSelector, RangeQFDetailsSelector, RankingContextSelector, RankingDataManager.SearchClassSelector, RankingDataSelector, RankingObjectSelector

public class ListSelector
extends BaseSelector

This is a List Selector. The selection of the list can be set to single/multi selection mode. ListSelection events are transmitted to all the registered ListSelectionListeners.



Supported API:true

Extendable:false

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class wt.clients.widgets.BaseSelector
BaseSelector.SelectCancelPanel
 
Nested classes inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
 
Nested classes inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
private static boolean debug
           
protected  ListSelectorList list
           
protected  ListSelectorModel listModel
           
static String MAX_LEN
           
protected  boolean notifyEnabled
           
static int NUM_VISIBLE_ROW
           
protected  ListSelectorListRenderer renderer
           
 
Fields inherited from class wt.clients.widgets.BaseSelector
BASE_RESOURCE, baseSelectorTitle, canceled, editorDialog, errorDialogTitle, id, modelDialogFlag, multiSelection, resource, selected, selectorListenerManager, statusBarHost, warningDialogTitle
 
Fields inherited from class javax.swing.JPanel
 
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.Container
 
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
ListSelector()
          Constructs a ListSelector
 
Method Summary
 void addToList(Object obj)
          Adds an item into the list
 void addValue(Object obj)
          Add the object to the selector.
 void clearSelection()
          Clears the selection
private  ListSelectorList createList()
          Creates a JList
protected  ListSelectorModel createModel()
           
 ListCellRenderer getCellRenderer()
          Returns the current list cell renderer
 int getCount()
          Returns the no of items in the list
 Object getFirstSelected()
          Returns the value for the selected cell
 Font getListFont()
           
 ListSelectorModel getModel()
           
 int getSelectedIndex()
          Returns the index of the selected item
 int[] getSelectedIndices()
          Returns an array of the indices of the items selected
 Vector getSelectedValues()
          Returns an array of values for the selected cells
 int getSelectionMode()
          Returns the selection mode
 boolean isEmpty()
          Checks if the list is empty
 boolean isEquivalent(Object obj1, Object obj2)
           
 boolean isSelectedIndex(int index)
          Returns true if the specified index is selected
 void removeFromList(int index)
          Removes an item from the list Remove the object from the list
 void removeFromList(Object obj)
          Removes an item from the list Remove an element from the list
 void removeFromList(Vector objs)
          Removes an item from the list Removes a Vector of objects from the list
 void removeValue(Object obj)
          Remove the object from the selector.
 void setCellRenderer(ListCellRenderer renderer)
          Sets the list cell renderer to the new one provided
private  void setComponents()
          Places the list in a ScrollPane and registers all listSelectionListeners to the list's listSelectionEvent
 void setListData(Object[] listData)
           
 void setListData(Vector listData)
          Sets the items to be displayed in the list
 void setListFont(Font font)
          Set the list font
 void setModel(ListSelectorModel model)
           
 void setMultiSelect(boolean b)
          Set the multi-select mode.
 void setSelectedIndex(int index)
          Selects an item in the list
 void setSelectedIndices(int[] indices)
          Selects a list of items in the list
 void setSelectedValue(Object object)
          Select an item in the list and scroll to display the selected object
 void setSelectedValue(Object object, boolean shouldScroll)
          Select an item in the list
 void setSelectedValues(Vector v)
          If the selector is set to have multiple selection, then the elements inside the vector will be selected in the selector.
 void setSelectionMode(int mode)
          Determines whether single-item or multiple-item selections are allowed.
 void setVisibleRowCount(int numRow)
          Set the preferred no of rows that is to be displayed without a scrollbar
 
Methods inherited from class wt.clients.widgets.BaseSelector
addSelectorListener, clearAllStatusMessages, fireSelectionChangedEvent, getContext, initResource, isModalDialog, isMultiSelect, removeSelectorListener, setBusy, setStatusBarHost, showAsModalSelectorDialog, showAsModalSelectorDialog, showAsModalSelectorDialog
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, 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, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, 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, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, 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, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, 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

debug

private static final boolean debug

list

protected ListSelectorList list

renderer

protected ListSelectorListRenderer renderer

listModel

protected ListSelectorModel listModel

notifyEnabled

protected boolean notifyEnabled

MAX_LEN

public static final String MAX_LEN
See Also:
Constant Field Values

NUM_VISIBLE_ROW

public static final int NUM_VISIBLE_ROW
See Also:
Constant Field Values
Constructor Detail

ListSelector

public ListSelector()
Constructs a ListSelector

Method Detail

setComponents

private void setComponents()
Places the list in a ScrollPane and registers all listSelectionListeners to the list's listSelectionEvent


setModel

public void setModel(ListSelectorModel model)

getModel

public ListSelectorModel getModel()

createModel

protected ListSelectorModel createModel()

createList

private ListSelectorList createList()
Creates a JList


setListData

public void setListData(Object[] listData)

setListData

public void setListData(Vector listData)
Sets the items to be displayed in the list

Parameters:
listData - a Vector of Objects containing the items to display in the list

isEmpty

public boolean isEmpty()
Checks if the list is empty

Returns:
true if the list is empty else false

addToList

public void addToList(Object obj)
Adds an item into the list


removeFromList

public void removeFromList(Object obj)
Removes an item from the list Remove an element from the list


removeFromList

public void removeFromList(Vector objs)
Removes an item from the list Removes a Vector of objects from the list


removeFromList

public void removeFromList(int index)
Removes an item from the list Remove the object from the list

Parameters:
index - from where the object is to be removed

getCount

public int getCount()
Returns the no of items in the list

Returns:
no of items in the list

getFirstSelected

public Object getFirstSelected()
Returns the value for the selected cell

Specified by:
getFirstSelected in interface SelectorInterface
Specified by:
getFirstSelected in class BaseSelector
Returns:
the selected value

getSelectedValues

public Vector getSelectedValues()
Returns an array of values for the selected cells

Specified by:
getSelectedValues in interface SelectorInterface
Specified by:
getSelectedValues in class BaseSelector
Returns:
the selected values

getCellRenderer

public ListCellRenderer getCellRenderer()
Returns the current list cell renderer


setCellRenderer

public void setCellRenderer(ListCellRenderer renderer)
Sets the list cell renderer to the new one provided


setSelectionMode

public void setSelectionMode(int mode)
Determines whether single-item or multiple-item selections are allowed.

Supported API:true

Parameters:
mode - an int specifying the type of selections Selection modes: SINGLE_SELECTION ListSelectionModel.SINGLE_SELECTION SINGLE_INTERVAL_SELECTION ListSelectionModel.SINGLE_INTERVAL_SELECTION MULTIPLE_INTERVAL_SELECTION ListSelectionModel.MULTIPLE_INTERVAL_SELECTION

getSelectionMode

public int getSelectionMode()
Returns the selection mode

Returns:
the selection mode

setSelectedIndex

public void setSelectedIndex(int index)
Selects an item in the list

Parameters:
index - The index of item that is to be selected

getSelectedIndex

public int getSelectedIndex()
Returns the index of the selected item

Returns:
the index of the selected item

setSelectedIndices

public void setSelectedIndices(int[] indices)
Selects a list of items in the list

Parameters:
indices - an array of indices to be selected

getSelectedIndices

public int[] getSelectedIndices()
Returns an array of the indices of the items selected

Returns:
an array of indices of the items selected

isSelectedIndex

public boolean isSelectedIndex(int index)
Returns true if the specified index is selected

Returns:
true if the index is selected

setSelectedValue

public void setSelectedValue(Object object,
                             boolean shouldScroll)
Select an item in the list

Parameters:
object - the Object to select
shouldScroll - true if the list should scroll to display the selected object

setSelectedValue

public void setSelectedValue(Object object)
Select an item in the list and scroll to display the selected object

Specified by:
setSelectedValue in interface SelectorInterface
Specified by:
setSelectedValue in class BaseSelector
Parameters:
object - the Object to select

setVisibleRowCount

public void setVisibleRowCount(int numRow)
Set the preferred no of rows that is to be displayed without a scrollbar

Parameters:
numRow - the no of rows

clearSelection

public void clearSelection()
Clears the selection


setListFont

public void setListFont(Font font)
Set the list font

Parameters:
font - list font

getListFont

public Font getListFont()

addValue

public void addValue(Object obj)
Description copied from interface: SelectorInterface
Add the object to the selector.

Specified by:
addValue in interface SelectorInterface
Specified by:
addValue in class BaseSelector

removeValue

public void removeValue(Object obj)
Description copied from interface: SelectorInterface
Remove the object from the selector.

Specified by:
removeValue in interface SelectorInterface
Specified by:
removeValue in class BaseSelector

setSelectedValues

public void setSelectedValues(Vector v)
Description copied from interface: SelectorInterface
If the selector is set to have multiple selection, then the elements inside the vector will be selected in the selector. Otherwise, only the first element will be selected.

Specified by:
setSelectedValues in interface SelectorInterface
Specified by:
setSelectedValues in class BaseSelector

setMultiSelect

public void setMultiSelect(boolean b)
Description copied from interface: SelectorInterface
Set the multi-select mode.

Specified by:
setMultiSelect in interface SelectorInterface
Specified by:
setMultiSelect in class BaseSelector

isEquivalent

public boolean isEquivalent(Object obj1,
                            Object obj2)