|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Component | +--java.awt.Container | +--java.awt.Window | +--java.awt.Frame | +--javax.swing.JFrame | +--FileTransfer.v1_1.FTClientWindow
FTClientWindow is the Graphical User Interface (GUI) of the FileTransfer application. It contains two panels called transferPane and receivePane. It is used when the FTClient is transfering a file to another FTClient and receiving a file from another FTClient, respectively.
Inner Class Summary | |
class |
FTClientWindow.CancelThread
CancelThread extends Thread. |
class |
FTClientWindow.FTListener
FTListener is an internal listener class which handles both WindowEvents and ActionEvents generated in the FTClientWindow. |
(package private) class |
FTClientWindow.TransferThread
TransferThread extends Thread. |
Inner classes inherited from class javax.swing.JFrame |
javax.swing.JFrame.AccessibleJFrame |
Inner classes inherited from class java.awt.Frame |
java.awt.Frame.AccessibleAWTFrame |
Inner classes inherited from class java.awt.Window |
java.awt.Window.AccessibleAWTWindow |
Inner classes inherited from class java.awt.Container |
java.awt.Container.AccessibleAWTContainer |
Inner classes inherited from class java.awt.Component |
java.awt.Component.AccessibleAWTComponent, java.awt.Component.AWTTreeLock |
Field Summary | |
private java.lang.String |
actorName
|
private java.awt.Color |
background
|
private javax.swing.JButton |
browse
|
private int |
bytesize
|
private javax.swing.JMenuItem |
bytesizeMenu
|
private javax.swing.JButton |
cancelReceive
|
private javax.swing.JButton |
cancelTransfer
|
private java.awt.CardLayout |
card
The layoutmanager of the contentpane |
private FTClient |
client
Reference to the FTClient. |
private javax.swing.JPanel |
contentPane
The contentpane |
private javax.swing.JMenuItem |
destDirMenu
|
private java.lang.String |
destinationDirectory
|
private javax.swing.JMenuItem |
exitMenu
|
private java.io.File |
file
|
private java.awt.Font |
font
|
private java.io.FileOutputStream |
fos
|
private javax.swing.JPanel |
receivePane
The panel used for configuring reception of a file |
private javax.swing.JProgressBar |
receiveProgressBar
|
private javax.swing.JButton |
send
|
private FTClientWindow.TransferThread |
thread
|
private javax.swing.JPanel |
transferPane
The panel used for configuring transfer of a file |
private javax.swing.JProgressBar |
transferProgressBar
|
private javax.swing.JTextField |
txtDestinationFile
|
private javax.swing.JTextField |
txtReceiver
|
private javax.swing.JTextField |
txtSender
|
private javax.swing.JTextField |
txtSourceFile
|
Fields inherited from class javax.swing.JFrame |
accessibleContext, defaultCloseOperation, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled |
Fields inherited from class java.awt.Frame |
base, CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, frameSerializedDataVersion, HAND_CURSOR, icon, ICONIFIED, mbManagement, menuBar, MOVE_CURSOR, N_RESIZE_CURSOR, nameCounter, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, ownedWindows, resizable, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, serialVersionUID, state, SW_RESIZE_CURSOR, TEXT_CURSOR, title, W_RESIZE_CURSOR, WAIT_CURSOR, weakThis |
Fields inherited from class java.awt.Window |
active, dbg, focusMgr, inputContext, inputContextLock, OPENED, ownedWindowList, showWithParent, warningString, windowListener, windowSerializedDataVersion |
Fields inherited from class java.awt.Container |
component, containerListener, containerSerializedDataVersion, dispatcher, layoutMgr, listeningBoundsChildren, listeningChildren, maxSize, ncomponents, printing, printingThreads |
Fields inherited from class java.awt.Component |
actionListenerK, adjustmentListenerK, appContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, changeSupport, componentListener, componentListenerK, componentOrientation, componentSerializedDataVersion, containerListenerK, cursor, dropTarget, enabled, eventMask, focusListener, focusListenerK, foreground, graphicsConfig, hasFocus, height, hierarchyBoundsListener, hierarchyBoundsListenerK, hierarchyListener, hierarchyListenerK, incRate, inputMethodListener, inputMethodListenerK, isInc, isPacked, itemListenerK, keyListener, keyListenerK, LEFT_ALIGNMENT, locale, LOCK, metrics, minSize, mouseListener, mouseListenerK, mouseMotionListener, mouseMotionListenerK, name, nameExplicitlySet, newEventsOnly, ownedWindowK, parent, peer, peerFont, popups, prefSize, privateKey, RIGHT_ALIGNMENT, textListenerK, TOP_ALIGNMENT, valid, width, windowClosingException, windowListenerK, visible, x, y |
Fields inherited from interface javax.swing.WindowConstants |
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE |
Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
FTClientWindow(FTClient client)
Creates a new FTClientWindow. |
Method Summary | |
void |
cancelFileTransfer()
Called when either the transmitter or the receiver has selected to cancel the filetransfer. |
private void |
dbg(java.lang.String dbg)
Writes a debugging line to the actor's baseframe window. |
void |
filePart(byte[] bytes)
Called when the FTClient received a new part of the file being transferred. |
void |
fileTransferFinished()
Called to notify the receiving FTClient that the filetransfer is finished. |
boolean |
fileTransferRequest(java.lang.String sender,
java.lang.String filename,
java.lang.String filesize)
Called when the FTClient receives a request for filetransfer from another FTClient. |
int |
getBytesize()
Returns the size of the byte array used to transfer file parts. |
java.lang.String |
getDestinationDirectory()
Returns the current directory used to store received files. |
java.lang.String |
getReceiver()
Returns the GAI of the receiving FTClient. |
java.lang.String |
getSourceFile()
Returns the path to the file selected to be transferred. |
private void |
initReceivePane(javax.swing.JPanel p)
Creates the components for the receive panel, initializes them and lays them out using GridBagLayout. |
private void |
initTransferPane(javax.swing.JPanel p)
Creates the components for the transfer panel, initializes them and lays them out using GridBagLayout. |
static void |
main(java.lang.String[] args)
Used for debugging GUI. |
void |
resumeFileTransfer(java.lang.String receiverGAI,
java.lang.String filepath,
java.lang.String filesize,
java.lang.String numOfBytes)
Called when the FTClient has been resumed and a filetransfer shall be resumed. |
boolean |
resumeFileTransferRequest(java.lang.String sender,
java.lang.String sourceFile,
java.lang.String filesize,
int bytesTransferred)
Called when the FTClient receives a request for resuming a filetransfer from another FTClient. |
void |
setActorName(java.lang.String name)
Sets the name of the FTClient belonging to this FTClientWindow. |
void |
setBytesize(int size)
Sets the size of the byte array used to transfer file parts. |
private void |
setComponentsEnabled(boolean isTransfering)
Sets some of the GUI components enabled, disabled, editable or not editable depending on the specified boolean value. |
void |
setDestinationDirectory(java.lang.String dir)
Sets the current directory used to store received files. |
void |
setReceiver(java.lang.String gai)
Sets the GAI of the receiving FTClient. |
void |
setSourceFile(java.lang.String filepath)
Sets the path to the file selected to be transferred. |
Methods inherited from class javax.swing.JFrame |
addImpl, createRootPane, createRootPaneException, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isRootPaneCheckingEnabled, paramString, processKeyEvent, processWindowEvent, remove, setContentPane, setDefaultCloseOperation, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, update |
Methods inherited from class java.awt.Frame |
|
Methods inherited from class java.awt.Window |
addOwnedWindow, addWindowListener, adjustListeningChildren, applyResourceBundle, applyResourceBundle, connectOwnedWindow, dispatchEventImpl, dispose, eventEnabled, getFocusOwner, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getOwnedWindows, getOwner, getToolkit, getWarningString, hide, isActive, isShowing, nextFocus, ownedInit, pack, postEvent, postWindowEvent, preProcessKeyEvent, processEvent, removeOwnedWindow, removeWindowListener, resetGC, setCursor, setFocusOwner, setWarningString, show, toBack, toFront, transferFocus |
Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, applyOrientation, checkGD, countComponents, createChildHierarchyEvents, createHierarchyEvents, deliverEvent, dispatchEventToSelf, doLayout, findComponentAt, findComponentAt, findComponentAt, getAccessibleAt, getAccessibleChild, getAccessibleChildrenCount, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents_NoClientCode, getComponents, getInsets, getLayout, getMaximumSize, getMinimumSize, getMouseEventTarget, getPreferredSize, getWindow, insets, invalidate, invalidateTree, isAncestorOf, layout, lightweightPaint, lightweightPrint, list, list, locate, minimumSize, numListening, paint, paintComponents, paintHeavyweightComponents, postsOldMouseEvents, preferredSize, print, printComponents, printHeavyweightComponents, processContainerEvent, proxyEnableEvents, proxyRequestFocus, remove, removeAll, removeContainerListener, setFont, validate, validateTree |
Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, areInputMethodsEnabled, bounds, checkImage, checkImage, checkWindowClosingException, coalesceEvents, contains, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getAccessibleIndexInParent, getAccessibleStateSet, getBackground, getBounds, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont_NoClientCode, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getInputMethodRequests, getLocation, getLocation, getLocationOnScreen_NoTreeLock, getLocationOnScreen, getName, getNativeContainer, getParent_NoClientCode, getParent, getPeer, getSize, getSize, getToolkitImpl, getTreeLock, getWidth, getWindowForObject, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isDisplayable, isDoubleBuffered, isEnabled, isEnabledImpl, isFocusTraversable, isLightweight, isOpaque, isRecursivelyVisible, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseMotionEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setDropTarget, setEnabled, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, size, toString, transferFocus |
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait |
Methods inherited from interface java.awt.MenuContainer |
getFont, postEvent |
Field Detail |
private FTClient client
private javax.swing.JPanel contentPane
private javax.swing.JPanel receivePane
private javax.swing.JPanel transferPane
private java.awt.CardLayout card
private javax.swing.JButton browse
private javax.swing.JButton cancelReceive
private javax.swing.JButton cancelTransfer
private javax.swing.JButton send
private javax.swing.JProgressBar receiveProgressBar
private javax.swing.JProgressBar transferProgressBar
private javax.swing.JTextField txtDestinationFile
private javax.swing.JTextField txtReceiver
private javax.swing.JTextField txtSender
private javax.swing.JTextField txtSourceFile
private javax.swing.JMenuItem destDirMenu
private javax.swing.JMenuItem bytesizeMenu
private javax.swing.JMenuItem exitMenu
private java.awt.Font font
private java.awt.Color background
private java.io.File file
private FTClientWindow.TransferThread thread
private java.io.FileOutputStream fos
private java.lang.String actorName
private java.lang.String destinationDirectory
private int bytesize
Constructor Detail |
public FTClientWindow(FTClient client)
client
- Reference to the FTClient.Method Detail |
public void cancelFileTransfer()
public void filePart(byte[] bytes)
bytes
- The byte array constituting the filepart.public void fileTransferFinished()
public boolean fileTransferRequest(java.lang.String sender, java.lang.String filename, java.lang.String filesize)
sender
- The GAI of the FTClient sending the request.filename
- The name of the file.filesize
- The size of the file.public int getBytesize()
public java.lang.String getDestinationDirectory()
public java.lang.String getReceiver()
public java.lang.String getSourceFile()
public void resumeFileTransfer(java.lang.String receiverGAI, java.lang.String filepath, java.lang.String filesize, java.lang.String numOfBytes)
receiverGAI
- The GAI of the receiving FTClient.filepath
- The path to the file to be transferred.filesize
- The size of the file to be transferred.numOfBytes
- Specifies how much of the file that has been transferred.public boolean resumeFileTransferRequest(java.lang.String sender, java.lang.String sourceFile, java.lang.String filesize, int bytesTransferred)
sender
- The GAI of the FTClient sending the request.filename
- The name of the file.filesize
- The size of the file.bytesTransferred
- The number of bytes that have been transferred.public void setActorName(java.lang.String name)
name
- The name of the FTClient.public void setBytesize(int size)
size
- The new bytesize.public void setDestinationDirectory(java.lang.String dir)
dir
- The new destination directory.public void setReceiver(java.lang.String gai)
gai
- The new GAI of the receiver.public void setSourceFile(java.lang.String filepath)
filename
- The new sourcefile.private void dbg(java.lang.String dbg)
dbg
- The debugging line.private void initReceivePane(javax.swing.JPanel p)
p
- The receive panel.private void initTransferPane(javax.swing.JPanel p)
p
- The transfer panel.private void setComponentsEnabled(boolean isTransfering)
isTransfering
- Is true if this FTClient is currently transfering
a file, else if it false.public static void main(java.lang.String[] args)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |