Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.greenstone.gatherer.gui
Class LongProgressBar  view LongProgressBar download LongProgressBar.java

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JProgressBar
                  extended byorg.greenstone.gatherer.gui.LongProgressBar
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.swing.SwingConstants

public final class LongProgressBar
extends javax.swing.JProgressBar

A progress bar that doesn't pack a sad when you feed it longs (such as the sizes of files) which get mangled into negative numbers. I know how it feels, as I often have negative progress. Also tries to be efficent when updating the JProgressBar, so only updates when the value actually changes, which become necessary when you move a large number of files with millions of bytes (where upon shifting a file of a thousand bytes would be pretty insignificant, maybe not even a percent, but would fire several progress updates).

Version:
2.3c

Nested Class Summary
private  class LongProgressBar.SafeSetIndeterminate
           
private  class LongProgressBar.SafeSetString
           
private  class LongProgressBar.SafeSetValue
           
 
Nested classes inherited from class javax.swing.JProgressBar
javax.swing.JProgressBar.AccessibleJProgressBar
 
Nested classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
private  java.math.BigInteger cur_value
           
private  java.math.BigInteger max_value
           
private  java.math.BigInteger min_value
           
private  int previous
          The previous percentage value.
private  LongProgressBar.SafeSetIndeterminate safe_set_indeterminate
           
private  LongProgressBar.SafeSetString safe_set_string
           
private  LongProgressBar.SafeSetValue safe_set_value
           
 
Fields inherited from class javax.swing.JProgressBar
changeEvent, changeListener, model, orientation, paintBorder, paintString, progressString
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Container
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
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
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
LongProgressBar()
           
 
Method Summary
 void addMaximum(int size)
           
 void addMaximum(long size)
           
 void addValue(int size)
           
 void addValue(long size)
           
 void reset()
           
private  void safeSetString(java.lang.String label)
          Change the string displayed on the progress bar.
private  void safeSetValue(int ammount)
          Increase the value of the progress bar.
 void setIndeterminate(boolean state)
          This method changes the indeterminate property.
 void setMaximum(int size)
          This method sets the maximum value of this JProgressBar.
 void setMaximum(long size)
           
 void setString(java.lang.String label)
          This method changes the string property.
 void setValue(int size)
          This method sets the value of the JProgressBar.
 void setValue(long size)
           
 void unsafeSetIndeterminate(boolean state)
          This method is an unsafe way to set the progress bar to be indeterminate, -unless- it is called from the Event Queue.
 void unsafeSetString(java.lang.String label)
           
 void unsafeSetValue(int value)
           
private  void update()
           
 
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, setMinimum, setModel, setOrientation, setStringPainted, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, 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, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, swapComponents, 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, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, 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, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

cur_value

private java.math.BigInteger cur_value

max_value

private java.math.BigInteger max_value

min_value

private java.math.BigInteger min_value

previous

private int previous
The previous percentage value.


safe_set_indeterminate

private LongProgressBar.SafeSetIndeterminate safe_set_indeterminate

safe_set_string

private LongProgressBar.SafeSetString safe_set_string

safe_set_value

private LongProgressBar.SafeSetValue safe_set_value
Constructor Detail

LongProgressBar

public LongProgressBar()
Method Detail

addMaximum

public void addMaximum(int size)

addMaximum

public void addMaximum(long size)

addValue

public void addValue(int size)

addValue

public void addValue(long size)

reset

public void reset()

setIndeterminate

public void setIndeterminate(boolean state)
Description copied from class: javax.swing.JProgressBar
This method changes the indeterminate property. If the JProgressBar is determinate, it paints a percentage of the bar described by its value. If it is indeterminate, it simply bounces a box between the ends of the bar; the value of the JProgressBar is ignored.


setMaximum

public void setMaximum(int size)
Description copied from class: javax.swing.JProgressBar
This method sets the maximum value of this JProgressBar.


setMaximum

public void setMaximum(long size)

setString

public void setString(java.lang.String label)
Description copied from class: javax.swing.JProgressBar
This method changes the string property. The string given will be the one painted. If you want to revert to the default string given, set the string to null.


setValue

public void setValue(int size)
Description copied from class: javax.swing.JProgressBar
This method sets the value of the JProgressBar.


setValue

public void setValue(long size)

unsafeSetIndeterminate

public void unsafeSetIndeterminate(boolean state)
This method is an unsafe way to set the progress bar to be indeterminate, -unless- it is called from the Event Queue.


unsafeSetString

public void unsafeSetString(java.lang.String label)

unsafeSetValue

public void unsafeSetValue(int value)

update

private void update()

safeSetString

private void safeSetString(java.lang.String label)
Change the string displayed on the progress bar.


safeSetValue

private void safeSetValue(int ammount)
Increase the value of the progress bar.