airboardUI
Class ProgressDialog

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjava.awt.Window
              extended byjava.awt.Dialog
                  extended byairboardUI.ProgressDialog
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.event.ActionListener, java.util.EventListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class ProgressDialog
extends java.awt.Dialog
implements java.awt.event.ActionListener

Author:
Bruschieri Stefano
See Also:
Serialized Form

Field Summary
 javax.swing.JProgressBar progressBar
           
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
ProgressDialog(java.awt.Frame parent, int processLength)
          Creates a progress a dialog with a progress bar, a label and two buttons.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
          Handles events from the OK button.
 boolean hasBeenStopped()
          Returns true if the True if process has been stopped because any errors occurs or the user has stopped clicking on Cancel button.
 void setCancelled(java.lang.String errorString)
          Stops the progress bar and writes some diagnostic information.
 void setCompleted()
          Sets the progress bar to his maximum value.
 void setText(java.lang.String newText)
          Sets text of label under the bar.
 
Methods inherited from class java.awt.Dialog
addNotify, dispose, getAccessibleContext, getTitle, hide, isModal, isResizable, isUndecorated, setModal, setResizable, setTitle, setUndecorated, show
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getMostRecentFocusOwner, getOwnedWindows, getOwner, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindowStateListeners, isActive, isFocusableWindow, isFocusCycleRoot, isFocused, isShowing, pack, postEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, setCursor, setFocusableWindowState, setFocusCycleRoot, setLocationRelativeTo, toBack, toFront
 
Methods 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, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, remove, remove, removeAll, removeContainerListener, removeNotify, setFocusTraversalKeys, setFocusTraversalPolicy, setFont, setLayout, transferFocusBackward, transferFocusDownCycle, update, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, dispatchEvent, enable, enable, enableInputMethods, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isOpaque, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

progressBar

public javax.swing.JProgressBar progressBar
Constructor Detail

ProgressDialog

public ProgressDialog(java.awt.Frame parent,
                      int processLength)
Creates a progress a dialog with a progress bar, a label and two buttons.

Parameters:
parent - Any frame.
processLength - Length of process we want observe.
Method Detail

hasBeenStopped

public boolean hasBeenStopped()
Returns true if the True if process has been stopped because any errors occurs or the user has stopped clicking on Cancel button. By default, this is false.

Returns:
whether the process has been stopped

setText

public void setText(java.lang.String newText)
Sets text of label under the bar. It is used to show diagnostic information about occurred error or, simply, to write the name of the process in execution.

Parameters:
newText - The text under the progress bar

setCancelled

public void setCancelled(java.lang.String errorString)
Stops the progress bar and writes some diagnostic information. It is used if any errors occurs.

Parameters:
errorString - The cause of halt

setCompleted

public void setCompleted()
Sets the progress bar to his maximum value. If any errors occur, the progress bar becomes red and the label shows some diagnostic information; if process ends without errors the progress bar becomes green.


actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Handles events from the OK button. When OK is pressed the dialog becomes invisible, disposes of its self, and retruns.

Specified by:
actionPerformed in interface java.awt.event.ActionListener