Package gov.nih.mipav.view
Class ViewJProgressBarMulti
java.lang.Object
java.awt.Component
java.awt.Container
java.awt.Window
java.awt.Frame
javax.swing.JFrame
gov.nih.mipav.view.ViewJProgressBar
gov.nih.mipav.view.ViewJProgressBarMulti
- All Implemented Interfaces:
ProgressBarInterface,ProgressChangeListener,ActionListener,MouseListener,WindowListener,ImageObserver,MenuContainer,Serializable,EventListener,Accessible,RootPaneContainer,WindowConstants
Extension of ViewJProgressBar, ViewJProgressBarMulti is used to keep track of multiple
algorithms or threads at a single time. Each algorithm/thread must be registered to the
multi-bar, or linked in AlgorithmBase. A progress bar will update as progress changes are
fired. This class acts as like a bunch of different ViewJProgressBars, except in one frame
instead of many.
Unlike ViewJProgressBar, the frame will not automatically close. Even when all registered
threads are completed, the frame will remain visible.
- Author:
- wangvg
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate classA container class that holds all the information to correctly draw each progress bar.private classVery basic structure to update determine which algorithm is linked, and over what range.Nested classes/interfaces inherited from class javax.swing.JFrame
JFrame.AccessibleJFrameNested classes/interfaces inherited from class java.awt.Frame
Frame.AccessibleAWTFrameNested classes/interfaces inherited from class java.awt.Window
Window.AccessibleAWTWindow, Window.TypeNested 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 ActionListenerList of containers that hold all the information to correctly draw each progress barList containing which runnables are registered to this listenerprivate JPanelPanel containing all the progress bars as well as relevent text labelsprivate JButtonprivate booleanList to determine which progress bar to closeprivate booleanWhether or not emptyLabel is currently displayedprivate JLabelLabel to display when there are no runnables to display or listen for.private GridBagConstraintsList to determine which progress bar to hide/showprivate booleanprivate static final longprivate WindowListenerFields inherited from class gov.nih.mipav.view.ViewJProgressBar
LOCK_PROGRESS_MESSAGE, PROGRESS_VALUE_UNCHANGED, PROGRESS_WINDOW_CLOSING, UNLOCK_PROGRESS_MESSAGEFields inherited from class javax.swing.JFrame
accessibleContext, rootPane, rootPaneCheckingEnabledFields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSORFields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTHFields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, EXIT_ON_CLOSE, HIDE_ON_CLOSE -
Constructor Summary
ConstructorsConstructorDescriptionViewJProgressBarMulti(String _title, boolean _cancelFlag, ActionListener _actionListener, WindowListener _windowListener) Constructor to start building the frame. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCollectionOfRunnable(Collection<Runnable> algs, Collection<String> titles) Secondary method for registering algorithms to the multi-bar.voidaddRunnable(Runnable alg, String title, int min, int max) Basic method for registering an algorithm to the multi-bar.private voidinit()voidThis listens for when the buttons to hide or close a progress bar are clicked.voidvoidvoidvoidvoidHandle any progress changes by updating the correct progress bar attached to the throwing algorithmvoidremoveAlgorithm(Runnable alg) Method for removing the algorithm from the frame displayed as well as removing the listener attached to itvoidCreate a link between two algorithms.voidsetMessage(int index, String msg) Updates the displayed message above a given progress barvoidupdateValue(int index, int value) Update the specific algorithm's progress displayMethods inherited from class gov.nih.mipav.view.ViewJProgressBar
actionPerformed, addActionListener, appendMessage, getCancelButton, getMessageBar, getPercentageLabel, getProgressBar, getProgressFromFloat, getProgressFromInt, getValue, isComplete, removeActionListener, setIndeterminate, setMessage, setReadyToDispose, setSeparateThread, setTitle, setVisible, updateValue, updateValue, updateValueImmed, windowActivated, windowClosed, windowClosing, windowDeactivated, windowDeiconified, windowIconified, windowOpenedMethods inherited from class javax.swing.JFrame
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, updateMethods inherited from class java.awt.Frame
addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setUndecoratedMethods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, show, toBack, toFrontMethods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, 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, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setMixingCutoutShape, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycleMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.awt.MenuContainer
getFont, postEventMethods inherited from interface gov.nih.mipav.view.ProgressBarInterface
dispose, setLocation
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
barPanel
Panel containing all the progress bars as well as relevent text labels -
algList
List containing which runnables are registered to this listener -
messageLocked
private boolean messageLocked -
actionListener
-
windowListener
-
cancelFlag
private boolean cancelFlag -
cancelButton
-
emptyLabel
Label to display when there are no runnables to display or listen for. -
emptyDisplayed
private boolean emptyDisplayedWhether or not emptyLabel is currently displayed -
gbc
-
hideList
List to determine which progress bar to hide/show -
closeList
List to determine which progress bar to close -
algCont
List of containers that hold all the information to correctly draw each progress bar
-
-
Constructor Details
-
ViewJProgressBarMulti
public ViewJProgressBarMulti(String _title, boolean _cancelFlag, ActionListener _actionListener, WindowListener _windowListener) Constructor to start building the frame. It mostly only needs the title for the frame. The other paramters are just being carried over from the single version.- Parameters:
_title- title of the frame_cancelFlag-_actionListener-_windowListener-
-
-
Method Details
-
addRunnable
Basic method for registering an algorithm to the multi-bar. Should be called in conjunction with addPropertyChangeListener (in AlgorithmBase) if the algorithm is an instance of AlgorithmBase.- Parameters:
alg- the algorithm to register to the multi-bartitle- the name to associate with this algorithmmin- min progress value. Should be set to 0.max- max progress value. Should be set to 100.
-
addCollectionOfRunnable
Secondary method for registering algorithms to the multi-bar. The user can pass a collection of algorithms (which must be accompanied by a title) to register to the multi-bar. Each algorithm should already have added this as its property change listener.- Parameters:
algs- the collection of algorithms to register to the multi-bartitles- the collection of titles to assocaite with each algorithm
-
progressStateChanged
Handle any progress changes by updating the correct progress bar attached to the throwing algorithm- Specified by:
progressStateChangedin interfaceProgressChangeListener- Overrides:
progressStateChangedin classViewJProgressBar- Parameters:
e- DOCUMENT ME!
-
removeAlgorithm
Method for removing the algorithm from the frame displayed as well as removing the listener attached to it- Parameters:
alg- the algorithm to remove
-
setLink
Create a link between two algorithms. Any progress in the child algorithm will cause updates in the given range in the parent algorithm- Parameters:
to- the parent algorighmfrom- the child algorithmmin- the lower bound of where the child affects the parentmax- the upper bound of where the child affects the parent
-
setMessage
Updates the displayed message above a given progress bar- Parameters:
index- which algorithm to updatemsg- the message to display
-
updateValue
public void updateValue(int index, int value) Update the specific algorithm's progress display- Parameters:
index- location of algorithm in the listvalue- progress value to display
-
init
private void init() -
mouseClicked
This listens for when the buttons to hide or close a progress bar are clicked. It will automatically determine which bar to choose.- Specified by:
mouseClickedin interfaceMouseListener
-
mousePressed
- Specified by:
mousePressedin interfaceMouseListener
-
mouseReleased
- Specified by:
mouseReleasedin interfaceMouseListener
-
mouseEntered
- Specified by:
mouseEnteredin interfaceMouseListener
-
mouseExited
- Specified by:
mouseExitedin interfaceMouseListener
-