org.skunk.swing
Class DualListPanel

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--javax.swing.JPanel
                          |
                          +--org.skunk.swing.DualListPanel
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class DualListPanel
extends javax.swing.JPanel

a widget for making an ordered selection from a list of items. Two JLists are separated vertically by a stack of four buttons, add, remove, up and down. The add and remove buttons move items from the left Jlist to the right and vice versa, respectively. The up and down buttons move selected items of the right JList up and down the list.

Internationalized applications should set the label properties.

See Also:
Serialized Form

Inner classes inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Inner classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Inner classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Inner classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent
 
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
DualListPanel(java.lang.Object[] sourceItems, java.lang.Object[] sinkItems)
          constructs a DualListPanel with the given source and sink values.
DualListPanel(java.lang.Object[] sourceItems, java.lang.Object[] sinkItems, java.lang.String sourceLabel, java.lang.String sinkLabel)
          constructs a DualListPanel with the given source and sink values and labels.
 
Method Summary
 void addListDataListener(javax.swing.event.ListDataListener ldl)
          add a listener to the data model of the left JList
 javax.swing.JButton getAddButton()
          provides access to the add button
 java.lang.Object[] getChosenItems()
          returns the items in the right JList
 javax.swing.JButton getDownButton()
          provides access to the down button
 javax.swing.JButton getRemoveButton()
          provides access to the remove button
 javax.swing.JButton getUpButton()
          provides access to the up button
 void removeListDataListener(javax.swing.event.ListDataListener ldl)
          remove a listener from the data model of the left JList
 void reset()
          returns panel and models to original state at time of construction.
 void reset(java.lang.Object[] chosenItems)
          sets the contents of the right JList to the given values, and places other values currently in the DualListPanel in the left JList
 void reset(java.lang.Object[] sourceItems, java.lang.Object[] sinkItems)
          populates the JLists with the given source and sink values.
 void setAddLabel(java.lang.String addLabel)
          sets the label of the add button.
 void setDownLabel(java.lang.String downLabel)
          sets the label of the down button
 void setListPreferredSize(java.awt.Dimension d)
          sets the preferred size of both lists.
 void setRemoveLabel(java.lang.String removeLabel)
          sets the label of the remove button
 void setSinkListLabelText(java.lang.String sinkListLabelText)
          sets the label of the right JList
 void setSourceListLabelText(java.lang.String sourceListLabelText)
          sets the label of the left JList
 void setUpLabel(java.lang.String upLabel)
          sets the label of the up button
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUIClassID, paramString, 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, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getVerifyInputWhenFocusTarget, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, hide, isDoubleBuffered, isFocusCycleRoot, isFocusTraversable, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processFocusEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getLayout, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setLayout, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, imageUpdate, inside, isDisplayable, isEnabled, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DualListPanel

public DualListPanel(java.lang.Object[] sourceItems,
                     java.lang.Object[] sinkItems)
constructs a DualListPanel with the given source and sink values.
Parameters:
sourceItems - the source values (will appear in the left JList)
sinkItems - the sink values (will appear in the right JList)

DualListPanel

public DualListPanel(java.lang.Object[] sourceItems,
                     java.lang.Object[] sinkItems,
                     java.lang.String sourceLabel,
                     java.lang.String sinkLabel)
constructs a DualListPanel with the given source and sink values and labels.
Parameters:
sourceItems - the source values (will appear in the left JList)
sinkItems - the sink values (will appear in the right JList)
sourceLabel - the label text for the left JList
sinkLabel - the label text for the right JList
Method Detail

reset

public void reset()
returns panel and models to original state at time of construction.

reset

public void reset(java.lang.Object[] sourceItems,
                  java.lang.Object[] sinkItems)
populates the JLists with the given source and sink values.
Parameters:
sourceItems - the new contents of the left JList
sinkITems - the new contents of the right JList

reset

public void reset(java.lang.Object[] chosenItems)
sets the contents of the right JList to the given values, and places other values currently in the DualListPanel in the left JList
Parameters:
chosenItems - the items the right JList should contain

getChosenItems

public java.lang.Object[] getChosenItems()
returns the items in the right JList
Returns:
the chosen items

addListDataListener

public void addListDataListener(javax.swing.event.ListDataListener ldl)
add a listener to the data model of the left JList
Parameters:
ldl - the listener

removeListDataListener

public void removeListDataListener(javax.swing.event.ListDataListener ldl)
remove a listener from the data model of the left JList
Parameters:
ldl - the listener

getAddButton

public javax.swing.JButton getAddButton()
provides access to the add button
Returns:
the add button

getRemoveButton

public javax.swing.JButton getRemoveButton()
provides access to the remove button
Returns:
the remove button

getUpButton

public javax.swing.JButton getUpButton()
provides access to the up button
Returns:
the up button

getDownButton

public javax.swing.JButton getDownButton()
provides access to the down button
Returns:
the down button

setListPreferredSize

public void setListPreferredSize(java.awt.Dimension d)
sets the preferred size of both lists.
Parameters:
d - the preferred size

setAddLabel

public void setAddLabel(java.lang.String addLabel)
sets the label of the add button.
Parameters:
addLabel - the new label

setRemoveLabel

public void setRemoveLabel(java.lang.String removeLabel)
sets the label of the remove button
Parameters:
removeLabel - the new label

setUpLabel

public void setUpLabel(java.lang.String upLabel)
sets the label of the up button
Parameters:
upLabel - the new label

setDownLabel

public void setDownLabel(java.lang.String downLabel)
sets the label of the down button
Parameters:
downLabel - the new label

setSourceListLabelText

public void setSourceListLabelText(java.lang.String sourceListLabelText)
sets the label of the left JList
Parameters:
sourceListLabelText - the new label

setSinkListLabelText

public void setSinkListLabelText(java.lang.String sinkListLabelText)
sets the label of the right JList
Parameters:
sinkListLabelText - the new label