Package com.xinapse.image
Class MultipleImageSelectionPanel
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
com.xinapse.image.MultipleImageSelectionPanel
- All Implemented Interfaces:
com.xinapse.util.CanLoadImage,ImageObserver,MenuContainer,Serializable,Accessible
A
As images are added, the new images are sorted lexically and added to the list Usually used to select a set of input images for processing.
MultipleImageSelectionPanel shows a list of images,
and contains the mechanism for selecting a new list of images, adding images to the list,
removing images from the list, and changing the order of images in the list.
As images are added, the new images are sorted lexically and added to the list Usually used to select a set of input images for processing.
For an example of the use of a MultipleImageSelectionPanel, see the
Perfusion/Permeability Tool in Jim.
- 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
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
ConstructorsConstructorDescriptionCreates a newMultipleImageSelectionPanelwith an empty list of images.MultipleImageSelectionPanel(Window parent) Creates a newMultipleImageSelectionPanel, that is contained within a parent Window, and with an empty list of images. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd aChangeListenerto thisMultipleImageSelectionPanel.voidvoidSet busy cursors.voidRemoves all files from the list.voidDo things that need to be done on the event dispatch thread after the image has been loaded.Returns the class of image that will be filtered when the user chooses a new image to set in the panel.intReturns the number of images currently set in this MultipleImageSelectionPanel.Get the Window which implements thisCanLoadImage.Override the default getPreferredSize() method.getReadableImage(int index) Returns the ReadableImage for the MultipleImageSelectionPanel at particular location in the list of images.Returns an array of ReadableImages with each array member being an image currently set in the MultipleImageSelectionPanel.getTitle()Returns the title for the list of images.Returns the "current working directory" for thisMultipleImageSelectionPanel.booleanTests whether thisCanLoadImageis currently loading an image.booleanloadImage(ReadableImage image, com.xinapse.util.ImageLoaderWorker worker) Load an image into thisCanLoadImage.voidSet ready cursors.voidRemove aChangeListenerfrom thisMultipleImageSelectionPanel.voidsetImageFilterClass(Class<? extends WritableImage> c) Sets the class of image that will be filtered when the user chooses a new image to set in the panel.voidsetParentWindow(Window parent) Sets the parent Window for thisMultipleImageSelectionPanel.voidSets the title for the list of images.voidShow an error message.voidShow a multi-line error message.voidshowStatus(String msg) Show a status message.booleanUnload any current image from this CanLoadImage.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, getNextFocusableComponent, getPopupLocation, 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
-
Constructor Details
-
MultipleImageSelectionPanel
public MultipleImageSelectionPanel()Creates a newMultipleImageSelectionPanelwith an empty list of images. -
MultipleImageSelectionPanel
Creates a newMultipleImageSelectionPanel, that is contained within a parent Window, and with an empty list of images.- Parameters:
parent- the parent Window that contains thisMultipleImageSelectionPanel. If parent is non-null, it will have its cursor set appropriately when theMultipleImageSelectionPanelis busy.
-
-
Method Details
-
setParentWindow
Sets the parent Window for thisMultipleImageSelectionPanel.- Parameters:
parent- the parentMessageShowerthat contains thisMultipleImageSelectionPanel. If parent is non-null, it will have its cursor set appropriately when theMultipleImageSelectionPanelis busy.
-
getNImages
public int getNImages()Returns the number of images currently set in this MultipleImageSelectionPanel.- Returns:
- the number of images currently set in this MultipleImageSelectionPanel.
-
getReadableImage
public ReadableImage getReadableImage(int index) throws IndexOutOfBoundsException, IOException, InvalidImageException Returns the ReadableImage for the MultipleImageSelectionPanel at particular location in the list of images.- Parameters:
index- the position in the list (indexed from zero).- Returns:
- the ReadableImage set for the MultipleImageSelectionPanel at the given position.
- Throws:
IndexOutOfBoundsException- if the index is less than zero or greater than or equal to the number of images in the list.IOException- if an I/O error occurs while reading the image.InvalidImageException- if the image at the given index is invalid.
-
getReadableImages
Returns an array of ReadableImages with each array member being an image currently set in the MultipleImageSelectionPanel.- Returns:
- an array of ReadableImages, one array element for each file set in the
MultipleImageSelectionPanel. Returns
nullif there are are no images currently set. - Throws:
InvalidImageException- if any of the images is invalid.IOException- if an I/O error occurs while reading the images.
-
getWorkingDirectory
Returns the "current working directory" for thisMultipleImageSelectionPanel. When the user chooses a new image to set in the panel, the ImageFileChooser used to select the image starts with the directory set to the current working directory. When the user, using the ImageFileChooser, moves to a different directory, the current working directory is set to the new directory.- Returns:
- the current working directory for this
MultipleImageSelectionPanel.
-
setImageFilterClass
Sets the class of image that will be filtered when the user chooses a new image to set in the panel. The ImageFileChooser used to select the image starts with the correct image filter set.- Parameters:
c- the class of a valid image type to filter, e.g.com.xinapse.multisliceimage.UNC.UNCImage.class.
-
getImageFilterClass
Returns the class of image that will be filtered when the user chooses a new image to set in the panel. The ImageFileChooser used to select the image starts with the correct image filter set.- Returns:
- the class of image that will be filtered when the user chooses a new image to set in the panel.
-
addChangeListener
Add aChangeListenerto thisMultipleImageSelectionPanel. All listeners are notified with aChangeEventwhen the image file is changed by the user. The image file is changed either by the user pressing the button and selecting a new file via theImageFileChooser, or by the user editing the folder or file text (after pressing carriage return).- Parameters:
l- the listener to be added.
-
removeChangeListener
Remove aChangeListenerfrom thisMultipleImageSelectionPanel.- Parameters:
l- the listener to be removed.
-
getTitle
Returns the title for the list of images. The title appears just above the list.- Returns:
- the current title for the list, or
nullif there is no title.
-
setTitle
Sets the title for the list of images. The title appears just above the list.- Parameters:
title- the new title for the list. Iftitleisnull, then no title is shown.
-
clearFiles
public void clearFiles()Removes all files from the list. -
getPreferredSize
Override the default getPreferredSize() method. We don't want theMultipleImageSelectionPanelto resize itsself when files with long names are selected and the Component in which this component is embedded is packed(). Once the initial size has been set (and is non-zero), then this component will always have the same preferred size.- Overrides:
getPreferredSizein classJComponent
-
getMinimumSize
- Overrides:
getMinimumSizein classJComponent
-
addFiles
-
getParentWindow
Description copied from interface:com.xinapse.util.CanLoadImageGet the Window which implements thisCanLoadImage.- Specified by:
getParentWindowin interfacecom.xinapse.util.CanLoadImage- Returns:
- the
Windowwhich implements theCanLoadImage.
-
busyCursors
public void busyCursors()Description copied from interface:com.xinapse.util.CanLoadImageSet busy cursors.- Specified by:
busyCursorsin interfacecom.xinapse.util.CanLoadImage
-
readyCursors
public void readyCursors()Description copied from interface:com.xinapse.util.CanLoadImageSet ready cursors.- Specified by:
readyCursorsin interfacecom.xinapse.util.CanLoadImage
-
showStatus
Description copied from interface:com.xinapse.util.CanLoadImageShow a status message.- Specified by:
showStatusin interfacecom.xinapse.util.CanLoadImage- Parameters:
msg- the message to show.
-
showError
Description copied from interface:com.xinapse.util.CanLoadImageShow an error message.- Specified by:
showErrorin interfacecom.xinapse.util.CanLoadImage- Parameters:
errorMsg- the error message to show.
-
showError
Description copied from interface:com.xinapse.util.CanLoadImageShow a multi-line error message.- Specified by:
showErrorin interfacecom.xinapse.util.CanLoadImage- Parameters:
errorMsg- the array of error messages to show - one per line.
-
loadImage
Description copied from interface:com.xinapse.util.CanLoadImageLoad an image into thisCanLoadImage.- Specified by:
loadImagein interfacecom.xinapse.util.CanLoadImage- Parameters:
image- the image to load.worker- the ImageLoaderWorker that loads the image.- Returns:
- true if the image was loaded successfully; false otherwise.
-
isLoadInProgress
public boolean isLoadInProgress()Description copied from interface:com.xinapse.util.CanLoadImageTests whether thisCanLoadImageis currently loading an image.- Specified by:
isLoadInProgressin interfacecom.xinapse.util.CanLoadImage- Returns:
trueif an image is currently being loaded;falseotherwise.
-
unloadImage
public boolean unloadImage()Description copied from interface:com.xinapse.util.CanLoadImageUnload any current image from this CanLoadImage.- Specified by:
unloadImagein interfacecom.xinapse.util.CanLoadImage- Returns:
trueif the image unloads successfully;falseif the image does not unload successfully.
-
doPostLoad
public void doPostLoad()Description copied from interface:com.xinapse.util.CanLoadImageDo things that need to be done on the event dispatch thread after the image has been loaded.- Specified by:
doPostLoadin interfacecom.xinapse.util.CanLoadImage
-