org.fuin.utils4swing.progress
Class FileCopyProgressPanel

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 org.fuin.utils4swing.progress.FileCopyProgressPanel
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class FileCopyProgressPanel
extends JPanel

A progress panel with two progress bars: One for the number of processed files and a second for the number of transferred bytes for the current file.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
 
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
FileCopyProgressPanel()
          No arguments Constructor.
 
Method Summary
static void main(String[] args)
          Main method to test the panel.
 void setCancelable(org.fuin.utils4j.Cancelable cancelable)
          Sets the listener to inform about the user cancelling the current transfer.
 void setCurrentByte(int n)
          Set the number of the current byte transferred.
 void setCurrentFile(int n)
          Set the number of the current file.
 void setDestFile(String destFile)
          Set the name of the destination file currently copied.If called outside the EDT this method will switch to the UI thread using SwingUtilities.invokeLater(Runnable).
 void setDestText(String text)
          Set the text for the "Destination" label.
 void setMaxByte(int m)
          Set the number of max bytes transferred.If called outside the EDT this method will switch to the UI thread using SwingUtilities.invokeLater(Runnable).
 void setMaxFile(int m)
          Set the number of the max file.If called outside the EDT this method will switch to the UI thread using SwingUtilities.invokeLater(Runnable).
 void setSourceFile(String srcFile)
          Sets the name of the source file currently copied.If called outside the EDT this method will switch to the UI thread using SwingUtilities.invokeLater(Runnable).
 void setSourceText(String text)
          Set the text for the "Source" label.
 void setTitle(String title)
          Sets the title inside the panel.
 void setTransferText(String transferText)
          Set the transfer text.
 void updateFile(String sourceFile, String destFile, int fileNo, int maxByte)
          Set the file information for the currently transferred file.
 
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
 

Constructor Detail

FileCopyProgressPanel

public FileCopyProgressPanel()
No arguments Constructor.

Method Detail

setCurrentFile

public final void setCurrentFile(int n)
Set the number of the current file. If called outside the EDT this method will switch to the UI thread using SwingUtilities.invokeLater(Runnable).

Parameters:
n - The N value in "N of M".

setMaxFile

public final void setMaxFile(int m)
Set the number of the max file.If called outside the EDT this method will switch to the UI thread using SwingUtilities.invokeLater(Runnable).

Parameters:
m - The M value in "N of M".

setDestFile

public final void setDestFile(String destFile)
Set the name of the destination file currently copied.If called outside the EDT this method will switch to the UI thread using SwingUtilities.invokeLater(Runnable).

Parameters:
destFile - Filename with full path.

setSourceFile

public final void setSourceFile(String srcFile)
Sets the name of the source file currently copied.If called outside the EDT this method will switch to the UI thread using SwingUtilities.invokeLater(Runnable).

Parameters:
srcFile - Filename with full path.

setTitle

public final void setTitle(String title)
Sets the title inside the panel. If called outside the EDT this method will switch to the UI thread using SwingUtilities.invokeLater(Runnable).

Parameters:
title - Title.

setCurrentByte

public final void setCurrentByte(int n)
Set the number of the current byte transferred. If called outside the EDT this method will switch to the UI thread using SwingUtilities.invokeLater(Runnable).

Parameters:
n - The N value in "N of M".

setMaxByte

public final void setMaxByte(int m)
Set the number of max bytes transferred.If called outside the EDT this method will switch to the UI thread using SwingUtilities.invokeLater(Runnable).

Parameters:
m - The M value in "N of M".

setTransferText

public final void setTransferText(String transferText)
Set the transfer text. Can contain two possible variables: $N = Current file number, $M = Max file count. If called outside the EDT this method will switch to the UI thread using SwingUtilities.invokeLater(Runnable).

Parameters:
transferText - Text to display for file number "N of M".

updateFile

public final void updateFile(String sourceFile,
                             String destFile,
                             int fileNo,
                             int maxByte)
Set the file information for the currently transferred file. If called outside the EDT this method will switch to the UI thread using SwingUtilities.invokeLater(Runnable).

Parameters:
sourceFile - Source filename with full path.
destFile - Destination filename with full path.
fileNo - Number of the current file.
maxByte - File size.

setCancelable

public final void setCancelable(org.fuin.utils4j.Cancelable cancelable)
Sets the listener to inform about the user cancelling the current transfer.

Parameters:
cancelable - Listener or null if cancel is disabled.

setDestText

public final void setDestText(String text)
Set the text for the "Destination" label. If called outside the EDT this method will switch to the UI thread using SwingUtilities.invokeLater(Runnable).

Parameters:
text - Text for the label.

setSourceText

public final void setSourceText(String text)
Set the text for the "Source" label. If called outside the EDT this method will switch to the UI thread using SwingUtilities.invokeLater(Runnable).

Parameters:
text - Text for the label.

main

public static void main(String[] args)
Main method to test the panel. Only for testing purposes.

Parameters:
args - Not used.


Copyright © 2011 Future Invent Informationsmanagement GmbH. All Rights Reserved.