edu.sdsc.grid.gui
Class TransferStatusPanel

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by edu.sdsc.grid.gui.TransferStatusPanel
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.lang.Runnable, javax.accessibility.Accessible

public class TransferStatusPanel
extends javax.swing.JPanel
implements java.lang.Runnable

Displays the progress of files being copied. A progress bar will be created for each file to be copied. This bar displays the amount of the file currently copied. A ticker in the bar of that file will also be regularily updated to make the user feel better. That is, due to network lag, sometimes it appears as if the file has stopped copying and the program has froze. The ticker lets the user know if the program has crashed or is just lagging.

Since:
JARGON1.5
See Also:
JargonGui, Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
protected  GeneralFile[] destinations
           
protected  javax.swing.JLabel[] fileNameLabel
           
protected  int overwrite
          Overwrite code, defaults to SKIP.
static int OVERWRITE
          If the file exists, force it to be overwritten; if the file cannot be overwritten throw IOException.
protected  javax.swing.JProgressBar[] progressBars
           
static int SKIP
          If the file exists, ignore it and go to the next.
protected  GeneralFile[] sources
           
 
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.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
TransferStatusPanel(GeneralFile source)
          Creates a GUI panel to transfer the source file to the current location on the local filesystem.
TransferStatusPanel(GeneralFile[] sources)
          Creates a GUI panel to transfer the sources files to the current location on the local filesystem.
TransferStatusPanel(GeneralFile[] sources, GeneralFile[] destinations)
          Creates a GUI panel to transfer the sources files to the destinations.
TransferStatusPanel(GeneralFile source, GeneralFile destination)
          Creates a GUI panel to transfer the source file to the destination file.
 
Method Summary
 GeneralFile[] getDestinations()
           
 int getOverwrite()
          If the file exists: If overwrite, force it to be overwritten; if the file cannot be overwritten throw IOException.
If append, the source file will be appended to the destination file.
 int getSleepLength()
          Time that threads will sleep.
 GeneralFile[] getSources()
           
static void main(java.lang.String[] args)
          Test method
 void run()
          This is to help show that the application has not frozen
 void setOverwrite(int overwrite)
          If the file exists: If overwrite, force it to be overwritten; if the file cannot be overwritten throw IOException.
If append, the source file will be appended to the destination file.
 void setSleepLength(int sleepFor)
          Time that threads will sleep.
 void start()
           
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, 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, 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, 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, transferFocusBackward, 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, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

OVERWRITE

public static final int OVERWRITE
If the file exists, force it to be overwritten; if the file cannot be overwritten throw IOException.

See Also:
Constant Field Values

SKIP

public static final int SKIP
If the file exists, ignore it and go to the next.

See Also:
Constant Field Values

sources

protected GeneralFile[] sources

destinations

protected GeneralFile[] destinations

progressBars

protected javax.swing.JProgressBar[] progressBars

fileNameLabel

protected javax.swing.JLabel[] fileNameLabel

overwrite

protected int overwrite
Overwrite code, defaults to SKIP.

Constructor Detail

TransferStatusPanel

public TransferStatusPanel(GeneralFile source)
Creates a GUI panel to transfer the source file to the current location on the local filesystem. The destinations file will have the same name as the source.


TransferStatusPanel

public TransferStatusPanel(GeneralFile[] sources)
Creates a GUI panel to transfer the sources files to the current location on the local filesystem. The destinations files will have the same name as the sources.


TransferStatusPanel

public TransferStatusPanel(GeneralFile source,
                           GeneralFile destination)
Creates a GUI panel to transfer the source file to the destination file.


TransferStatusPanel

public TransferStatusPanel(GeneralFile[] sources,
                           GeneralFile[] destinations)
Creates a GUI panel to transfer the sources files to the destinations. There must be an equal number of sources and destination. Destinations do not have to already exist. But if a destination does exist and it is a file, then the matching source must not be a directory.

Method Detail

setOverwrite

public void setOverwrite(int overwrite)
If the file exists: If overwrite, force it to be overwritten; if the file cannot be overwritten throw IOException.
If append, the source file will be appended to the destination file. If skip, ignore the file and go to the next.


getOverwrite

public int getOverwrite()
If the file exists: If overwrite, force it to be overwritten; if the file cannot be overwritten throw IOException.
If append, the source file will be appended to the destination file. If skip, ignore the file and go to the next.

Returns:
the overwrite value.

getSources

public GeneralFile[] getSources()

getDestinations

public GeneralFile[] getDestinations()

setSleepLength

public void setSleepLength(int sleepFor)
Time that threads will sleep. A longer time will give more resources to the copy part. But too long and the users tend to think the copy failed. Min. time 100ms. Default time 750ms.


getSleepLength

public int getSleepLength()
Time that threads will sleep. A longer time will give more resources to the copy part. But too long and the users tend to think the copy failed. Measured in milliseconds.


start

public void start()
           throws java.io.IOException
Throws:
java.io.IOException

run

public void run()
This is to help show that the application has not frozen

Specified by:
run in interface java.lang.Runnable

main

public static void main(java.lang.String[] args)
Test method