net.shredzone.ifish.gui
Class StatusProgressBar
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JProgressBar
net.shredzone.ifish.gui.StatusProgressBar
- All Implemented Interfaces:
- ImageObserver, MenuContainer, Serializable, Runnable, Accessible, SwingConstants, StatusCallback
public final class StatusProgressBar
- extends JProgressBar
- implements StatusCallback, Runnable
This is an extension of the NaviDb class to make it usable in JTables.
- Version:
- $Id: StatusProgressBar.java 291 2009-04-28 21:29:27Z shred $
- See Also:
- Serialized Form
| Fields inherited from interface javax.swing.SwingConstants |
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST |
|
Method Summary |
void |
done()
Show that the process is finished. |
int |
estimateTime()
When countdown is enabled, this method will try to estimate the time
until index reaches maximum. |
boolean |
isCountdown()
Check if countdown is enabled. |
void |
run()
Runnable implementation. |
void |
setAction(String action)
Set the current action that is being done. |
void |
setCountdown(boolean cntdown)
Enable the countdown. |
void |
setCurrentDir(File base,
File dir)
Set the current directory being processed. |
void |
setCurrentEntry(Entry entry)
Set the current entry that is being processed by the current
action. |
void |
setCurrentIndex(int index)
Set the current entry number that is being processed by the current
action. |
void |
setMaxEntries(int max)
Set the maximum number of entries to be processed by the current
action. |
| Methods inherited from class javax.swing.JProgressBar |
addChangeListener, createChangeListener, fireStateChanged, getAccessibleContext, getChangeListeners, getMaximum, getMinimum, getModel, getOrientation, getPercentComplete, getString, getUI, getUIClassID, getValue, isBorderPainted, isIndeterminate, isStringPainted, paintBorder, paramString, removeChangeListener, setBorderPainted, setIndeterminate, setMaximum, setMinimum, setModel, setOrientation, setString, setStringPainted, setUI, setValue, 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, 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 |
StatusProgressBar
public StatusProgressBar()
- Create a new StatusProgressBar.
setAction
public void setAction(String action)
- Set the current action that is being done.
- Parameters:
action - Action string
done
public void done()
- Show that the process is finished. This will also disable the
countdown mode automatically.
setCountdown
public void setCountdown(boolean cntdown)
- Enable the countdown. The StatusProgressBar will now try to estimate
the time until the index reaches the maximum.
If countdown is enabled, you must make sure
to call setMaxEntries() only once at the beginning,
and you must ensure that setCurrentIndex() is always
only incrementing!
- Parameters:
cntdown - true: activate countdown, false: disactivate
isCountdown
public boolean isCountdown()
- Check if countdown is enabled.
- Returns:
- true: countdown activated, false: disactivated
setMaxEntries
public void setMaxEntries(int max)
- Set the maximum number of entries to be processed by the current
action. If max is negative, then the maximum number is not known.
Anyhow, during the operation setMaxEntries could be invoked multiple
times.
- Specified by:
setMaxEntries in interface StatusCallback
- Parameters:
max - Maximum number of entries.
setCurrentIndex
public void setCurrentIndex(int index)
- Set the current entry number that is being processed by the current
action. If the number is negative, then the current entry number is
not known.
- Specified by:
setCurrentIndex in interface StatusCallback
- Parameters:
index - Current entry.
setCurrentEntry
public void setCurrentEntry(Entry entry)
- Set the current entry that is being processed by the current
action. If null is passed, then no Entry is currently processed,
or there are no Entries being processed.
- Specified by:
setCurrentEntry in interface StatusCallback
- Parameters:
entry - Entry currently being processed, or null.
setCurrentDir
public void setCurrentDir(File base,
File dir)
- Set the current directory being processed. If there are no
directories to be processed, dir will be null. Note that this
method might be invoked several times, even without any changes.
- Specified by:
setCurrentDir in interface StatusCallback
- Parameters:
base - Base directorydir - Current directory
run
public void run()
- Runnable implementation. All StatusCallback data is cached. The
progress bar will only be updated every 500ms, to gain some
performance. In this thread, all the text concatenations and
countdown calculations are done as well, so the CPU does not
need to bother too much with this time consuming calculations.
- Specified by:
run in interface Runnable
estimateTime
public int estimateTime()
- When countdown is enabled, this method will try to estimate the time
until index reaches maximum. The estimated time in seconds will be
returned. If an estimation is not possible yet, -1 will be returned.
- Returns:
- Estimated Time of Arrival
Copyright © 2007-2011
shredzone.org. All Rights Reserved.