Mp3dings 
20100427

de.mospace.swing
Class JDoubleList

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 de.mospace.swing.JDoubleList
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class JDoubleList
extends JPanel

A two-column list where items can be moved from one side to the other. The order of the items can also be adjusted.

Version:
$Revision: 12 $ ($Date: 2007-07-27 11:48:53 +0200 (Fr, 27 Jul 2007) $)
Author:
Moritz Ringler
See Also:
Serialized Form

Nested Class Summary
static class JDoubleList.DefaultSingleListModel
           
static class JDoubleList.ListElement
          An element of a JDoubleList.
static interface JDoubleList.SingleListModel
          Minimum requirements on a model for one of the JLists.
 
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
static int CENTER
           
static int LEFT
           
static int MOVE_DOWN
           
static int MOVE_END
           
static int MOVE_LEFT
           
static int MOVE_RIGHT
           
static int MOVE_START
           
static int MOVE_UP
           
static int RIGHT
           
 
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
JDoubleList()
          Constructs a new double list.
JDoubleList(JDoubleList.SingleListModel left, JDoubleList.SingleListModel right)
          Constructs a new double list from the given single list models.
JDoubleList(JDoubleList.SingleListModel left, JDoubleList.SingleListModel right, boolean leftOrderFixed, boolean rightOrderFixed)
          Constructs a new double List from the given single list models.
JDoubleList(JList left, JList right, boolean leftOrderFixed, boolean rightOrderFixed)
          Constructs a new double List from the given single lists.
 
Method Summary
 JButton getButton(int movexxx)
          Returns one of the buttons that manipulate the double list.
 JList getLeftList()
          Returns the JList displayed on the left.
 Component getPart(int part)
           
 JList getRightList()
          Returns the JList displayed on the right.
 boolean isSymmetric()
           
 void moveLeft()
          Moves the selected elements from the list on the right into the list on the left.
 void moveRight()
          Moves the selected elements from the list on the left into the list on the right.
 void setComponentSize(int comp, Dimension d)
          Adjusts the size of one of the three double list components.
 void setSymmetric(boolean symm)
           
 
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, getPreferredSize, 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, 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, setPreferredSize, 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, 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

MOVE_RIGHT

public static final int MOVE_RIGHT
See Also:
Constant Field Values

MOVE_LEFT

public static final int MOVE_LEFT
See Also:
Constant Field Values

MOVE_UP

public static final int MOVE_UP
See Also:
Constant Field Values

MOVE_DOWN

public static final int MOVE_DOWN
See Also:
Constant Field Values

MOVE_START

public static final int MOVE_START
See Also:
Constant Field Values

MOVE_END

public static final int MOVE_END
See Also:
Constant Field Values

LEFT

public static final int LEFT
See Also:
Constant Field Values

CENTER

public static final int CENTER
See Also:
Constant Field Values

RIGHT

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

JDoubleList

public JDoubleList()
Constructs a new double list. The SingleListModels in this double list will be instances of javax.swing.DefaultListModel.


JDoubleList

public JDoubleList(JDoubleList.SingleListModel left,
                   JDoubleList.SingleListModel right)
Constructs a new double list from the given single list models.


JDoubleList

public JDoubleList(JDoubleList.SingleListModel left,
                   JDoubleList.SingleListModel right,
                   boolean leftOrderFixed,
                   boolean rightOrderFixed)
Constructs a new double List from the given single list models.


JDoubleList

public JDoubleList(JList left,
                   JList right,
                   boolean leftOrderFixed,
                   boolean rightOrderFixed)
Constructs a new double List from the given single lists. If the list models do not implement SingleListModel an IllegalArgumentException is thrown.

Throws:
IllegalArgumentException - if at least one of the list models is not an instance of SingleListModel
Method Detail

setSymmetric

public void setSymmetric(boolean symm)

isSymmetric

public boolean isSymmetric()

getPart

public Component getPart(int part)

moveLeft

public final void moveLeft()
Moves the selected elements from the list on the right into the list on the left. New items are added after the last selected item or - if there is no selection - after the last item in the target list.


moveRight

public final void moveRight()
Moves the selected elements from the list on the left into the list on the right. New items are added after the last selected item or - if there is no selection - after the last item in the target list.


getLeftList

public JList getLeftList()
Returns the JList displayed on the left.


getRightList

public JList getRightList()
Returns the JList displayed on the right.


getButton

public JButton getButton(int movexxx)
Returns one of the buttons that manipulate the double list.

Parameters:
movexxx - one of MOVE_RIGHT, MOVE_LEFT, MOVE_UP, MOVE_DOWN, MOVE_START, MOVE_END

setComponentSize

public void setComponentSize(int comp,
                             Dimension d)
Adjusts the size of one of the three double list components.

Parameters:
comp - one of LEFT (list), RIGHT (list), and CENTER (buttons)
d - the new preferred size for the respective component

Mp3dings 
20100427