networking.client.frame
Class FileFrame

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Window
              extended by java.awt.Frame
                  extended by networking.client.frame.FileFrame
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, IConnectInfo, IFileClient, IFileTransferController, IFileTransferListener

 class FileFrame
extends java.awt.Frame
implements IFileTransferListener, IFileTransferController, IFileClient

FileFrame - this class represents a file transfer frame


Nested Class Summary
(package private)  class FileFrame.SmartLabel
          SmartLabel - extends label to facilitate partial text changes
 
Nested classes/interfaces inherited from class java.awt.Frame
java.awt.Frame.AccessibleAWTFrame
 
Nested classes/interfaces inherited from class java.awt.Window
java.awt.Window.AccessibleAWTWindow
 
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.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
protected static int BEGIN
          State constant - begin processing
protected static int COMPLETE
          State constant - file transfer has completed
static int DOWNLOAD
          Load mode
protected static int ERROR
          State constant - error happened
protected  boolean m_abort
          Abort flag
(package private)  java.awt.Button m_buttonAbort
          Buttons
(package private)  java.awt.Button m_buttonClose
           
(package private)  java.awt.Checkbox m_cbExit
          Close on exit Checkbox
protected  java.io.File m_file
          File being transfered
(package private)  FileFrame.SmartLabel m_info
          Label with status information
protected  int m_mode
          Transfer mode
protected  ClientFrame m_parent
          Parent frame
protected  ClientThread m_thread
          Transfer thread
protected static int TRANSFER
          State constant - file transfer has started
static int UPLOAD
          Save mode
 
Fields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
 
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, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
FileFrame(java.io.File file, int mode, ClientFrame parent)
          Construct new FileFrame object
 
Method Summary
 void aborted()
          Transfer aborted event handler
(package private)  void buttonAbort_actionPerformed(java.awt.event.ActionEvent event)
          Abort
(package private)  void buttonClose_actionPerformed(java.awt.event.ActionEvent event)
          Close
 void dispose()
           
 void error(java.lang.Exception e)
          Report error
(package private)  void error(java.lang.String s)
          Report error
 java.lang.String getHost()
          Get connection host
 int getPort()
          Get connection port
(package private)  void go(java.util.List recp)
          Start file upload
(package private)  void go(Message msg)
          Start file download
(package private)  void init()
          Initialize frame
 boolean mayContinue()
          Ask controller weither it's possible to continue
 void onDisconnect()
          Disconnect handler
 void onReject(Message msg)
          Reject handler
 void onSuccess()
          Success handler
 void percentComplete(int n)
          Percent complete event handler
(package private)  void send(Message msg)
          Send message to the ClientFileThread
(package private)  void setControlsState(int n)
          Set controls state
private  void setTitle(int n)
          Set title displaying percents
 void setTitle(java.lang.String title)
           
 void successful()
          Transfer successful event handler
 void truncated()
          Transfer truncated event handler
 
Methods inherited from class java.awt.Frame
addNotify, finalize, getAccessibleContext, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, paramString, remove, removeNotify, setCursor, setExtendedState, setIconImage, setMaximizedBounds, setMenuBar, setResizable, setState, setUndecorated
 
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, hide, isActive, isAlwaysOnTop, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, postEvent, processEvent, processWindowEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, setAlwaysOnTop, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setLocationByPlatform, setLocationRelativeTo, show, toBack, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, setLayout, transferFocusBackward, transferFocusDownCycle, update, 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, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, 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, getMousePosition, 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, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, 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, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Field Detail

UPLOAD

public static final int UPLOAD
Save mode

See Also:
Constant Field Values

DOWNLOAD

public static final int DOWNLOAD
Load mode

See Also:
Constant Field Values

BEGIN

protected static final int BEGIN
State constant - begin processing

See Also:
Constant Field Values

TRANSFER

protected static final int TRANSFER
State constant - file transfer has started

See Also:
Constant Field Values

COMPLETE

protected static final int COMPLETE
State constant - file transfer has completed

See Also:
Constant Field Values

ERROR

protected static final int ERROR
State constant - error happened

See Also:
Constant Field Values

m_info

FileFrame.SmartLabel m_info
Label with status information


m_buttonAbort

java.awt.Button m_buttonAbort
Buttons


m_buttonClose

java.awt.Button m_buttonClose

m_cbExit

java.awt.Checkbox m_cbExit
Close on exit Checkbox


m_file

protected java.io.File m_file
File being transfered


m_mode

protected int m_mode
Transfer mode


m_parent

protected ClientFrame m_parent
Parent frame


m_abort

protected boolean m_abort
Abort flag


m_thread

protected ClientThread m_thread
Transfer thread

Constructor Detail

FileFrame

public FileFrame(java.io.File file,
                 int mode,
                 ClientFrame parent)
Construct new FileFrame object

Parameters:
file - file
mode - mode
parent - parent
Method Detail

go

void go(Message msg)
Start file download

Parameters:
msg - original message

go

void go(java.util.List recp)
Start file upload

Parameters:
recp - recipients list

init

void init()
Initialize frame


setTitle

private void setTitle(int n)
Set title displaying percents

Parameters:
n - n% percent complete

setControlsState

void setControlsState(int n)
Set controls state

Parameters:
n - state to conform with

onSuccess

public void onSuccess()
Description copied from interface: IFileClient
Success handler

Specified by:
onSuccess in interface IFileClient

onDisconnect

public void onDisconnect()
Description copied from interface: IFileClient
Disconnect handler

Specified by:
onDisconnect in interface IFileClient

onReject

public void onReject(Message msg)
Description copied from interface: IFileClient
Reject handler

Specified by:
onReject in interface IFileClient

buttonAbort_actionPerformed

void buttonAbort_actionPerformed(java.awt.event.ActionEvent event)
Abort


buttonClose_actionPerformed

void buttonClose_actionPerformed(java.awt.event.ActionEvent event)
Close


send

void send(Message msg)
Send message to the ClientFileThread

Parameters:
msg - message to send

error

public void error(java.lang.Exception e)
Report error

Specified by:
error in interface IFileClient
Parameters:
e - exception

error

void error(java.lang.String s)
Report error

Parameters:
s - message

percentComplete

public void percentComplete(int n)
Description copied from interface: IFileTransferListener
Percent complete event handler

Specified by:
percentComplete in interface IFileTransferListener
Parameters:
n - n% complete

aborted

public void aborted()
Description copied from interface: IFileTransferListener
Transfer aborted event handler

Specified by:
aborted in interface IFileTransferListener

truncated

public void truncated()
Description copied from interface: IFileTransferListener
Transfer truncated event handler

Specified by:
truncated in interface IFileTransferListener

successful

public void successful()
Description copied from interface: IFileTransferListener
Transfer successful event handler

Specified by:
successful in interface IFileTransferListener

mayContinue

public boolean mayContinue()
Description copied from interface: IFileTransferController
Ask controller weither it's possible to continue

Specified by:
mayContinue in interface IFileTransferController
Returns:
true if it's possible to continue otherwise false

setTitle

public void setTitle(java.lang.String title)
Overrides:
setTitle in class java.awt.Frame

getHost

public final java.lang.String getHost()
Description copied from interface: IConnectInfo
Get connection host

Specified by:
getHost in interface IConnectInfo

getPort

public final int getPort()
Description copied from interface: IConnectInfo
Get connection port

Specified by:
getPort in interface IConnectInfo

dispose

public void dispose()
Overrides:
dispose in class java.awt.Window


Copyright © 2009 Alexey Veremenko. All rights reserved.