- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- javax.swing.JPanel
-
- util.ui.OrderChooser<E>
-
- All Implemented Interfaces:
java.awt.image.ImageObserver
,java.awt.MenuContainer
,java.io.Serializable
,javax.accessibility.Accessible
,ListDropAction<SelectableItem<E>>
public class OrderChooser<E> extends javax.swing.JPanel implements ListDropAction<SelectableItem<E>>
- Author:
- Til Schneider, www.murfman.de
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
-
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
-
-
Field Summary
-
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
-
-
Constructor Summary
Constructors Constructor Description OrderChooser(E[] currOrder, E[] allItems)
Constructs an OrderChooser without selection Buttons.OrderChooser(E[] currOrder, E[] allItems, boolean showSelectionButtons)
Konstruiert einen OrderChooser.OrderChooser(E[] currOrder, E[] allItems, boolean showSelectionButtons, java.lang.Class<?> renderClass, SelectableItemRendererCenterComponentIf<E> renderComponent)
OrderChooser(E[] currOrder, E[] allItems, java.lang.Class<?> renderClass, SelectableItemRendererCenterComponentIf<E> renderComponent)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addButton(javax.swing.JButton button)
Adds a button to the button panel.void
addElement(E value)
Add a value to the end of the list.void
addElement(E value, int index, boolean selected)
Adds an element to the list of items at the given index (or at the end if index not available).void
addListSelectionListener(javax.swing.event.ListSelectionListener listener)
Add a list selection listener to the list.void
addMouseListener(java.awt.event.MouseListener listener)
void
clearSelection()
void
drop(javax.swing.JList<SelectableItem<E>> source, javax.swing.JList<SelectableItem<E>> target, int rows, boolean move)
The method that is called by the drop event.javax.swing.JButton
getDownButton()
int
getItemCount()
Get the number of items in the order chooserjava.lang.Object[]
getOrder()
Deprecated.since 3.4.5 usegetOrderList()
insteadjava.util.List<E>
getOrderList()
int
getSelectedIndex()
Gets the selected index of the list.java.lang.Object
getSelectedValue()
Gets the selected value of this list.javax.swing.JButton
getUpButton()
void
invertSelection()
void
refreshList()
Refreshes the list UI.void
removeElementAt(int index)
Remove the value at the given indexvoid
selectAll()
void
setEnabled(boolean value)
void
setOrder(E[] currOrder, E[] allItems)
void
setSelectedIndex(int index)
Set the selection indexvoid
setSelectionMode(int value)
Set the selection mode of the list.-
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, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, 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, 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, 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
-
-
-
-
Constructor Detail
-
OrderChooser
public OrderChooser(E[] currOrder, E[] allItems)
Constructs an OrderChooser without selection Buttons.- Parameters:
currOrder
- Die aktuelle ReihenfolgeallItems
- Alle moeglichen Objekte (die Objekte der aktuellen Reihenfolge eingeschlossen)
-
OrderChooser
public OrderChooser(E[] currOrder, E[] allItems, boolean showSelectionButtons)
Konstruiert einen OrderChooser.Die Reihenfolge wird aus currOrder Uebernommen. Dann wird das Array allItems durchgegangen und jedes Objekt, das nicht in der Reihenfolge vorkommt, wird aufgenommen.
- Parameters:
currOrder
- Die aktuelle ReihenfolgeallItems
- Alle moeglichen Objekte (die Objekte der aktuellen Reihenfolge eingeschlossen)showSelectionButtons
- Shows the selection buttons.
-
OrderChooser
public OrderChooser(E[] currOrder, E[] allItems, java.lang.Class<?> renderClass, SelectableItemRendererCenterComponentIf<E> renderComponent)
-
OrderChooser
public OrderChooser(E[] currOrder, E[] allItems, boolean showSelectionButtons, java.lang.Class<?> renderClass, SelectableItemRendererCenterComponentIf<E> renderComponent)
-
-
Method Detail
-
getUpButton
public javax.swing.JButton getUpButton()
-
getDownButton
public javax.swing.JButton getDownButton()
-
getOrder
@Deprecated(since="3.4.5") public java.lang.Object[] getOrder()
Deprecated.since 3.4.5 usegetOrderList()
instead- Returns:
- The order of selected items.
-
getOrderList
public java.util.List<E> getOrderList()
- Returns:
- A list with the selected items in order.
- Since:
- 3.4.5
-
invertSelection
public void invertSelection()
-
selectAll
public void selectAll()
-
clearSelection
public void clearSelection()
-
drop
public void drop(javax.swing.JList<SelectableItem<E>> source, javax.swing.JList<SelectableItem<E>> target, int rows, boolean move)
Description copied from interface:ListDropAction
The method that is called by the drop event.- Specified by:
drop
in interfaceListDropAction<E>
- Parameters:
source
- The source JList.target
- The target JList.rows
- The number of the row to move the entries to.move
- Only move one entry from the source to the target list.
-
setEnabled
public void setEnabled(boolean value)
- Overrides:
setEnabled
in classjavax.swing.JComponent
-
setSelectionMode
public void setSelectionMode(int value)
Set the selection mode of the list.- Parameters:
value
- The new selection mode.- Since:
- 2.5.1
-
addListSelectionListener
public void addListSelectionListener(javax.swing.event.ListSelectionListener listener)
Add a list selection listener to the list.- Parameters:
listener
- The listener to add.- Since:
- 2.5.1
-
addMouseListener
public void addMouseListener(java.awt.event.MouseListener listener)
- Overrides:
addMouseListener
in classjava.awt.Component
-
refreshList
public void refreshList()
Refreshes the list UI.- Since:
- 2.5.1
-
addElement
public void addElement(E value)
Add a value to the end of the list.- Parameters:
value
- The value to add.- Since:
- 2.5.1
-
removeElementAt
public void removeElementAt(int index)
Remove the value at the given index- Parameters:
index
- The index to remove.- Since:
- 2.5.1
-
getSelectedIndex
public int getSelectedIndex()
Gets the selected index of the list.- Returns:
- The selected index of the list.
- Since:
- 2.5.1
-
getSelectedValue
public java.lang.Object getSelectedValue()
Gets the selected value of this list.- Returns:
- The selected value of this list.
- Since:
- 2.5.1
-
setSelectedIndex
public void setSelectedIndex(int index)
Set the selection index- Parameters:
index
- index of to be selected item- Since:
- 2.6
-
getItemCount
public int getItemCount()
Get the number of items in the order chooser- Returns:
- number of items in the list
- Since:
- 2.6
-
addButton
public void addButton(javax.swing.JButton button)
Adds a button to the button panel.- Parameters:
button
- The button to add to the panel.- Since:
- 3.3.4
-
addElement
public void addElement(E value, int index, boolean selected)
Adds an element to the list of items at the given index (or at the end if index not available).- Parameters:
value
- The element to add.index
- The index to insert the element.selected
- If the value should be selected.
-
-