com.sun.javatest.tool
Class EditableList

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by com.sun.javatest.tool.EditableList
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible
Direct Known Subclasses:
EditableFileList

public class EditableList
extends javax.swing.JComponent
implements javax.accessibility.Accessible

A component that displays an editable list of items.

See Also:
Serialized Form

Nested Class Summary
 
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
protected  javax.swing.DefaultListModel listModel
          The list model that contains the elements of the list.
protected  UIFactory uif
          The factory used to create the GUI elements of the component.
 
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
EditableList()
          Create an empty component, using a standard UIFactory for this class, and using resources beginning with "list.".
EditableList(UIFactory uif, java.lang.String uiKey)
          Create an empty component, using a specified UIFactory and resource prefix.
 
Method Summary
 void addListDataListener(javax.swing.event.ListDataListener l)
          Add a listener to be notified of events when the list data changes.
 void clear()
          Remove all entries from the list.
 javax.accessibility.AccessibleContext getAccessibleContext()
          Get the accessible context for this pane.
protected  java.lang.Object getDisplayValue(java.lang.Object item)
          Get the display value for an item in the list.
 java.lang.Object[] getItems()
          Get the items currently in the list.
 java.lang.Object[] getItems(java.lang.Class c)
          Get the items currently in the list, in an array of a specific type.
protected  java.lang.Object getNewItem()
          Invoked to get a new item to put in the list, when the user clicks the "Add" button".
protected  java.lang.Object getNewItem(java.lang.Object oldItem)
          Invoked to get a new item to replace an existing item in the list.
 java.lang.String getToolTipText()
          Get the tool tip text that appears on the list.
 boolean isDuplicatesAllowed()
          Check whether or not duplicates should be allowed in the list.
 void removeListDataListener(javax.swing.event.ListDataListener l)
          Remove a listener that was previously added to be notified of events when the list data changes.
 void setDuplicatesAllowed(boolean b)
          Specify whether or not duplicates should be allowed in the list.
 void setEnabled(boolean b)
          Set whether or not the list can be edited by the user.
 void setItems(java.lang.Object[] items)
          Set the items in the list.
 void setToolTipText(java.lang.String tip)
          Set the tool tip text that appears on the list.
 
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, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, 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, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
 
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, 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, transferFocusBackward, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

uif

protected final UIFactory uif
The factory used to create the GUI elements of the component.


listModel

protected javax.swing.DefaultListModel listModel
The list model that contains the elements of the list.

Constructor Detail

EditableList

public EditableList()
Create an empty component, using a standard UIFactory for this class, and using resources beginning with "list.".


EditableList

public EditableList(UIFactory uif,
                    java.lang.String uiKey)
Create an empty component, using a specified UIFactory and resource prefix.

Parameters:
uif - The UIFactory used to construct the component
uiKey - The prefix for any UI resources that may be required
Method Detail

getAccessibleContext

public javax.accessibility.AccessibleContext getAccessibleContext()
Get the accessible context for this pane.

Specified by:
getAccessibleContext in interface javax.accessibility.Accessible
Overrides:
getAccessibleContext in class javax.swing.JComponent
Returns:
the accessible context for this pane

setEnabled

public void setEnabled(boolean b)
Set whether or not the list can be edited by the user.

Overrides:
setEnabled in class javax.swing.JComponent
Parameters:
b - if true, the component can be edited by the user; if false, it cannot

setItems

public void setItems(java.lang.Object[] items)
Set the items in the list. Any previous items are removed first.

Parameters:
items - the array of items to be put in the list.
See Also:
getItems()

clear

public void clear()
Remove all entries from the list.


getItems

public java.lang.Object[] getItems()
Get the items currently in the list.

Returns:
an array containing the items currently in the list
See Also:
setItems(java.lang.Object[])

getItems

public java.lang.Object[] getItems(java.lang.Class c)
Get the items currently in the list, in an array of a specific type.

Parameters:
c - the component type of the array to be returned
Returns:
an array containing the items currently in the list
See Also:
setItems(java.lang.Object[])

getToolTipText

public java.lang.String getToolTipText()
Get the tool tip text that appears on the list. (Separate tool tip text will appear on the buttons to manipulate the list.)

Overrides:
getToolTipText in class javax.swing.JComponent
Returns:
the tool tip text that appears on the list
See Also:
setToolTipText(java.lang.String)

setToolTipText

public void setToolTipText(java.lang.String tip)
Set the tool tip text that appears on the list. (Separate tool tip text will appear on the buttons to manipulate the list.)

Overrides:
setToolTipText in class javax.swing.JComponent
Parameters:
tip - the tool tip text to appear on the list
See Also:
getToolTipText()

addListDataListener

public void addListDataListener(javax.swing.event.ListDataListener l)
Add a listener to be notified of events when the list data changes.

Parameters:
l - the listener to be notified
See Also:
removeListDataListener(javax.swing.event.ListDataListener)

removeListDataListener

public void removeListDataListener(javax.swing.event.ListDataListener l)
Remove a listener that was previously added to be notified of events when the list data changes.

Parameters:
l - the listener to be notified
See Also:
addListDataListener(javax.swing.event.ListDataListener)

setDuplicatesAllowed

public void setDuplicatesAllowed(boolean b)
Specify whether or not duplicates should be allowed in the list.

Parameters:
b - true if duplicates should be allowed, and false otherwise
See Also:
isDuplicatesAllowed()

isDuplicatesAllowed

public boolean isDuplicatesAllowed()
Check whether or not duplicates should be allowed in the list.

Returns:
true if duplicates should be allowed, and false otherwise
See Also:
setDuplicatesAllowed(boolean)

getDisplayValue

protected java.lang.Object getDisplayValue(java.lang.Object item)
Get the display value for an item in the list. By default, the display value is the item itself.

Parameters:
item - the object for which to get the display value
Returns:
the display value for the specified item

getNewItem

protected java.lang.Object getNewItem()
Invoked to get a new item to put in the list, when the user clicks the "Add" button". The default is to show an input dialog to allow the user to type in a new string. Subtypes may override this method to provide other ways of specifying items to be added, such as a file chooser.

Returns:
an object to be added to the list, or null if no object to be added.

getNewItem

protected java.lang.Object getNewItem(java.lang.Object oldItem)
Invoked to get a new item to replace an existing item in the list. The default is to show an input dialog to allow the user to type in a new string. Subtypes may override this method to provide other ways of specifying items to be added, such as a file chooser.

Parameters:
oldItem - the item to be replaced in the list
Returns:
an object to replace the old item the list, or null if no replacement should occur.


Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.