Class JPanelListController
- All Implemented Interfaces:
ActionListener,ImageObserver,MenuContainer,Serializable,EventListener,Accessible,ListSelectionListener
- Direct Known Subclasses:
JDialogListSaveSelection.JPanelListSelection,JDialogVOIStatistics.JPanelAddRemoveVOI
Creating an instance of this JPanel does not in fact create any visual representation of either list.
It does display the list-control buttons, but the JLists held (ListA and
ListB) are references. This is done so that the display may have as much freedom for display as possible (ie,
control spacing, control alignment and position, or insert explanation text). As such, the display panel which
contains the lists is created seperatly.
- Version:
- 1
$Logfile: /mipav/src/gov/nih/mipav/view/JPanelListController.java $
- Author:
- david parsons
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanelNested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponentNested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainerNested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate JButton'X'.protected JListupper or left-most list.protected JListlower or right-most list.private intDOCUMENT ME!private JButtonDOCUMENT ME!private JButtonDOCUMENT ME!private JButtonleft arrow or up arrow.private JButtonright arrow or down arrow.private static final longUse serialVersionUID for interoperability.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_WINDOWFields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH -
Constructor Summary
ConstructorsConstructorDescriptiondefualt position is all buttons vertical.JPanelListController(boolean noImages) Creates a list controller, with the buttons in the default layout, but which can be set to display images only or text.JPanelListController(int layout) Creates a list controller, with the buttons in the given layout, but which defaults to display images only.JPanelListController(int layout, boolean noImages) Creates a list controller, with the buttons in the given layout, and which can be set to display images only or text. -
Method Summary
Modifier and TypeMethodDescriptionvoidresponds to the button presses.protected voidcopySelected(JList a, JList b) Copies the selected items in list A and appends them to list B.private voidcreateAllDownButton(boolean noImage) convenience Method.private voidcreateAllLeftButton(boolean noImage) convenience Method.private voidcreateAllListAButton(boolean noImage) creates a button with either the image of an arrow (leftarrowcollection.gif) or with the text "Send All left" or "Send All up".private voidcreateAllListBButton(boolean noImage) creates a button with either the image of an arrow (rightarrowcollection.gif) or with the text "Send all right" or "Send all down".private voidcreateAllRightButton(boolean noImage) convenience Method.private voidcreateAllUpButton(boolean noImage) convenience Method.private voidcreateDeleteButton(boolean noImage) creates a button with either the image of an 'X' (delete.gif) or with the text "delete selection".private voidcreateDownButton(boolean noImage) convenience Method.private voidcreateLeftButton(boolean noImage) convenience Method.private voidcreateListAButton(boolean noImage) creates a button with either the image of an arrow (leftarrow.gif) or with the text "Send left" or "Send up".private voidcreateListBButton(boolean noImage) creates a button with either the image of an arrow (rightarrow.gif) or with the text "Send right" or "Send down".static JSplitPaneCreates a simple List controller display. one with the the given controls and with the orientation defined by the control panel.private voidcreateRightButton(boolean noImage) convenience Method.private voidcreateUpButton(boolean noImage) convenience Method.protected voiddeleteFrom(JList list) Removes all selected items in the given list.Convience method to get list A.getListA()there is no programmatic way to determine which arrow is pointing where.getListB()there is no programmatic way to determine which arrow is pointing where.protected intReturns the layout of the associated display panel or "how the arrows point", not the layout of the buttons themselves.Convience method to get list B.Convience method to get list B.Convience method to get list A.voidProgrammatically performs a 'delete' button click, based on however the implemented class performs it.voidProgrammatically performs a 'Send to list a' button click, based on however the implemented class performs it.voidProgrammatically performs a 'Send to list b' button click, based on however the implemented class performs it.protected voidremoveRepeatedElements(JList list) Removes all repeated elements in the given list.voidsetBackArrowEnabled(boolean b) A convenience method to set the to-list-A buttons (both selected and all) to the given enabled status.voidsetBackArrowVisble(boolean v) A convenience method to set the to-list-A buttons (both selected and all) to the given visible status.protected voidsetButtonFeatures(JButton button, String actionLabel, String tip) adds the tooltip, and the action label to the buttoin, as well as setting the action listener, font, borderpaint, and the enable.voidsetDeleteEnabled(boolean b) A method to set the delete button to the given enabled status.voidsetDeleteVisble(boolean v) A method to set the delete button to the given enabled status.voidsetForwardArrowEnabled(boolean b) A convenience method to set the to-list-B buttons (both selected and all) to the given enabled status.voidsetForwardArrowVisible(boolean v) A convenience method to set the to-list-B buttons (both selected and all) to the given visible status.voidsetLeftList(JList list) Convience method to set list A.voidthere is no programmatic way to determine which arrow is pointing where.voidthere is no programmatic way to determine which arrow is pointing where.voidsetLowerList(JList list) Convience method to set list B.voidsetRightList(JList list) Convience method to set list B.voidsetUpperList(JList list) Convience method to set list A.voidhandles list change events made when selecting from either left or right list.Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUIMethods 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, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, updateMethods 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, validateTreeMethods 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
-
serialVersionUID
private static final long serialVersionUIDUse serialVersionUID for interoperability.- See Also:
-
listA
upper or left-most list. -
listB
lower or right-most list. -
deleteSelection
'X'. -
listLayout
private int listLayoutDOCUMENT ME! -
sendAllToListA
DOCUMENT ME! -
sendAllToListB
DOCUMENT ME! -
sendSelectionToListA
left arrow or up arrow. -
sendSelectionToListB
right arrow or down arrow.
-
-
Constructor Details
-
JPanelListController
public JPanelListController()defualt position is all buttons vertical. Images are by default shown on the buttons. Both arrows are enabled, but Delete is disabled by default. panel is layed out as a BoxLayout.Y_AXIS- See Also:
-
JPanelListController
public JPanelListController(int layout) Creates a list controller, with the buttons in the given layout, but which defaults to display images only. The buttons point as if to lists in the orthogonal direction. Choose layout with:BoxLayout.X_AXIS, orBoxLayout.Y_AXIS. Both arrows are enabled, but Delete is disabled by default.- Parameters:
layout- TheBoxLayoutdesignation for the layout of the buttons in the panel. UseBoxLayout.X_AXISorBoxLayout.Y_AXIS.- See Also:
-
JPanelListController
public JPanelListController(boolean noImages) Creates a list controller, with the buttons in the default layout, but which can be set to display images only or text. The buttons point as if to lists in the orthogonal direction. Both arrows are enabled, but Delete is disabled by default. Panel is layed out as aBoxLayout.Y_AXIS, and points to lists that would be laid-out along the x-axis of the display panel.- Parameters:
noImages- Specifies if the buttons are to be displayed as images or with no images, using text instead.- See Also:
-
JPanelListController
public JPanelListController(int layout, boolean noImages) Creates a list controller, with the buttons in the given layout, and which can be set to display images only or text. The buttons point as if to lists in the orthogonal direction. Both arrows are enabled, but Delete is disabled by default. Choose layout of the buttons with:BoxLayout.X_AXIS, orBoxLayout.Y_AXIS.- See Also:
-
-
Method Details
-
createListControllerDisplay
Creates a simple List controller display. one with the the given controls and with the orientation defined by the control panel. The lists in the control panel are displayed, but if either arenull, an new, empty list is provided.The referenced lists are placed into
JScrollPanes, and placed on either side of the control's buttons, using a BorderLayout.- Parameters:
controls- A JPanelListController to place into a visual display.- Returns:
- A JSplitPane containing the list controller, formatted as the JPanelListController indicates (ie., vertical or horizontal layout).
-
actionPerformed
responds to the button presses.functionality of arrow/send-to- arrows is virtually identical. the 'delete' is not supported, and this class must be extended to assume functionality for that button. There are good reasons for this: there are two panels, and only one delete button, and delete functionality may be use-dependant. Indeed, for a panel such as a file-list, we may not want to support a 'delete' function. Hence, this aspect of the use, is left up to an extending class.
- Specified by:
actionPerformedin interfaceActionListener- Parameters:
ae- The action to listen for.
-
getLeftList
Convience method to get list A.- See Also:
-
getListA
there is no programmatic way to determine which arrow is pointing where. To compensate, the parent panel must notify the panel who it is listening to. Since it can, at most, point to one list, only the most recent list to be submitted will be retainted.This method gets the panel pointing to list A. (upper or left most)
- Returns:
- DOCUMENT ME!
-
getListB
there is no programmatic way to determine which arrow is pointing where. To compensate, the parent panel must notify the panel who it is listening to. Since it can, at most, point to one list, only the most recent list to be submitted will be retainted.This method gets the panel pointing to the list B (lower or right most)
- Returns:
ListBis returned.
-
getLowerList
Convience method to get list B.- Returns:
ListBis returned.- See Also:
-
getRightList
Convience method to get list B.- Returns:
ListBis returned.- See Also:
-
getUpperList
Convience method to get list A.- Returns:
ListAis returned.- See Also:
-
performDelete
public void performDelete()Programmatically performs a 'delete' button click, based on however the implemented class performs it. The delete button must be enabled to perform a programmatic action. -
performSendToListA
public void performSendToListA()Programmatically performs a 'Send to list a' button click, based on however the implemented class performs it. The 'send to list a' button must be enabled to perform a programmatic action. -
performSendToListB
public void performSendToListB()Programmatically performs a 'Send to list b' button click, based on however the implemented class performs it. The 'send to list b' button must be enabled to perform a programmatic action. -
setBackArrowEnabled
public void setBackArrowEnabled(boolean b) A convenience method to set the to-list-A buttons (both selected and all) to the given enabled status.- Parameters:
b- The enabled status of the buttons.
-
setDeleteEnabled
public void setDeleteEnabled(boolean b) A method to set the delete button to the given enabled status. By default, the delete button is not enabled when this object is created.- Parameters:
b- The enabled status of the button.
-
setForwardArrowEnabled
public void setForwardArrowEnabled(boolean b) A convenience method to set the to-list-B buttons (both selected and all) to the given enabled status.- Parameters:
b- The enabled status of the buttons.
-
setBackArrowVisble
public void setBackArrowVisble(boolean v) A convenience method to set the to-list-A buttons (both selected and all) to the given visible status.- Parameters:
v- Whether to make buttons visible
-
setDeleteVisble
public void setDeleteVisble(boolean v) A method to set the delete button to the given enabled status. By default, the delete button is visible when this object is created.- Parameters:
v- Whether to make button visible
-
setForwardArrowVisible
public void setForwardArrowVisible(boolean v) A convenience method to set the to-list-B buttons (both selected and all) to the given visible status.- Parameters:
v- Whether to make buttons visible
-
setLeftList
Convience method to set list A.- See Also:
-
setListA
there is no programmatic way to determine which arrow is pointing where. To compensate, the parent panel must notify the panel who it is listening to. Since it can, at most, point to one list, only the most recent list to be submitted will be retainted.This method makes the pointing to the list A (the upper or left most)
- Parameters:
list- DOCUMENT ME!
-
setListB
there is no programmatic way to determine which arrow is pointing where. To compensate, the parent panel must notify the panel who it is listening to. Since it can, at most, point to one list, only the most recent list to be submitted will be retainted.This method makes the pointing to the list B (the lower, or right most)
- Parameters:
list- DOCUMENT ME!
-
setLowerList
Convience method to set list B.- See Also:
-
setRightList
Convience method to set list B.- See Also:
-
setUpperList
Convience method to set list A.- See Also:
-
valueChanged
handles list change events made when selecting from either left or right list. This method has not been implementedIf the event isn't from a JList, an error messge is generated, and control is returned.
Otherwise, the list is copied to the appropriate storage
Vectors to hold the list.- Specified by:
valueChangedin interfaceListSelectionListener- Parameters:
lse- The selection event to listen for.
-
copySelected
Copies the selected items in list A and appends them to list B. The selected items in list A are then de-selected.- Parameters:
a- the source list.b- the destination list.
-
deleteFrom
Removes all selected items in the given list.- Parameters:
list- The list of items.
-
getListLayout
protected int getListLayout()Returns the layout of the associated display panel or "how the arrows point", not the layout of the buttons themselves.- Returns:
- Provides the
BoxLayoutcode for the intended layout of the associated display panel. EitherBoxLayout.X_AXISorBoxLayout.Y_AXIS.
-
removeRepeatedElements
Removes all repeated elements in the given list. All selections are lost after the method returns, however, as the list's model has been changed.- Parameters:
list- The list which is to have the duplicate items removed.
-
setButtonFeatures
adds the tooltip, and the action label to the buttoin, as well as setting the action listener, font, borderpaint, and the enable.- Parameters:
button- DOCUMENT ME!actionLabel- DOCUMENT ME!tip- DOCUMENT ME!
-
createAllDownButton
private void createAllDownButton(boolean noImage) convenience Method.- Parameters:
noImage- DOCUMENT ME!
-
createAllLeftButton
private void createAllLeftButton(boolean noImage) convenience Method.- Parameters:
noImage- DOCUMENT ME!
-
createAllListAButton
private void createAllListAButton(boolean noImage) creates a button with either the image of an arrow (leftarrowcollection.gif) or with the text "Send All left" or "Send All up".- Type Parameters:
code- noImage DOCUMENT ME! uses text.falsedisplays the image.
-
createAllListBButton
private void createAllListBButton(boolean noImage) creates a button with either the image of an arrow (rightarrowcollection.gif) or with the text "Send all right" or "Send all down".- Type Parameters:
code- noImage DOCUMENT ME! uses text.falsedisplays the image.
-
createAllRightButton
private void createAllRightButton(boolean noImage) convenience Method.- Parameters:
noImage- DOCUMENT ME!
-
createAllUpButton
private void createAllUpButton(boolean noImage) convenience Method.- Parameters:
noImage- DOCUMENT ME!
-
createDeleteButton
private void createDeleteButton(boolean noImage) creates a button with either the image of an 'X' (delete.gif) or with the text "delete selection". Delete selection is initially not enabled.- Type Parameters:
code- noImage DOCUMENT ME! uses text.falsedisplays the image.
-
createDownButton
private void createDownButton(boolean noImage) convenience Method.- Parameters:
noImage- DOCUMENT ME!
-
createLeftButton
private void createLeftButton(boolean noImage) convenience Method.- Parameters:
noImage- DOCUMENT ME!
-
createListAButton
private void createListAButton(boolean noImage) creates a button with either the image of an arrow (leftarrow.gif) or with the text "Send left" or "Send up".- Type Parameters:
code- noImage DOCUMENT ME! uses text.falsedisplays the image.
-
createListBButton
private void createListBButton(boolean noImage) creates a button with either the image of an arrow (rightarrow.gif) or with the text "Send right" or "Send down".- Type Parameters:
code- noImage DOCUMENT ME! uses text.falsedisplays the image.
-
createRightButton
private void createRightButton(boolean noImage) convenience Method.- Parameters:
noImage- DOCUMENT ME!
-
createUpButton
private void createUpButton(boolean noImage) convenience Method.- Parameters:
noImage- DOCUMENT ME!
-