Package com.sun.javatest.tool
Class EditableList
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
com.sun.javatest.tool.EditableList
- All Implemented Interfaces:
ImageObserver
,MenuContainer
,Serializable
,Accessible
- Direct Known Subclasses:
EditableFileList
A component that displays an editable list of items.
- See Also:
-
Nested Class Summary
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
FieldsModifier and TypeFieldDescriptionprotected DefaultListModel
<Object> The list model that contains the elements of the list.protected final UIFactory
The factory used to create the GUI elements of the component.Fields inherited from class javax.swing.JComponent
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
accessibleContext, 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
ConstructorsConstructorDescriptionCreate an empty component, using a standard UIFactory for this class, and using resources beginning with "list.".EditableList
(UIFactory uif, String uiKey) Create an empty component, using a specified UIFactory and resource prefix. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Add a listener to be notified of events when the list data changes.void
clear()
Remove all entries from the list.Get the accessible context for this pane.protected Object
getDisplayValue
(Object item) Get the display value for an item in the list.Object[]
getItems()
Get the items currently in the list.Object[]
Get the items currently in the list, in an array of a specific type.protected Object
Invoked to get a new item to put in the list, when the user clicks the "Add" button".protected Object
getNewItem
(Object oldItem) Invoked to get a new item to replace an existing item in the list.Get the tool tip text that appears on the list.boolean
Check whether or not duplicates should be allowed in the list.void
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
Set the items in the list.void
setToolTipText
(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, getUI, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, 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, 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, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Field Details
-
uif
The factory used to create the GUI elements of the component. -
listModel
The list model that contains the elements of the list.
-
-
Constructor Details
-
EditableList
public EditableList()Create an empty component, using a standard UIFactory for this class, and using resources beginning with "list.". -
EditableList
Create an empty component, using a specified UIFactory and resource prefix.- Parameters:
uif
- The UIFactory used to construct the componentuiKey
- The prefix for any UI resources that may be required
-
-
Method Details
-
getAccessibleContext
Get the accessible context for this pane.- Specified by:
getAccessibleContext
in interfaceAccessible
- Overrides:
getAccessibleContext
in classComponent
- 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 classJComponent
- Parameters:
b
- if true, the component can be edited by the user; if false, it cannot
-
clear
public void clear()Remove all entries from the list. -
getItems
Get the items currently in the list.- Returns:
- an array containing the items currently in the list
- See Also:
-
setItems
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
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:
-
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 classJComponent
- Returns:
- the tool tip text that appears on the list
- See Also:
-
setToolTipText
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 classJComponent
- Parameters:
tip
- the tool tip text to appear on the list- See Also:
-
addListDataListener
Add a listener to be notified of events when the list data changes.- Parameters:
l
- the listener to be notified- See Also:
-
removeListDataListener
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:
-
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
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:
-
getDisplayValue
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
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
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.
-