wt.clients.util.http
Class UploadPanel

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjava.awt.Panel
              extended bywt.clients.util.http.UploadPanel
All Implemented Interfaces:
Accessible, ImageObserver, MenuContainer, Serializable

public class UploadPanel
extends Panel

Panel for uploading and downloading files via HTTP.

Supported API:false

Extendable:false

See Also:
Serialized Form

Nested Class Summary
(package private)  class UploadPanel.TargetInfo
           
(package private)  class UploadPanel.UploadDownloadController
           
 
Nested classes inherited from class java.awt.Panel
Panel.AccessibleAWTPanel
 
Nested classes inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
private  String callingAction
           
private  ThreadGroup contextGroup
           
private  FileAccess fileAccess
           
private  Applet parentApplet
           
private static String RESOURCE
           
static int TARGET_TYPE_FILE
          Target type indicator, indicates a file is the target.
static int TARGET_TYPE_NONE
          Target type indicator, indicates there is no target.
static int TARGET_TYPE_UNKNOWN
          Target type indicator, indicates the type is unknown.
static int TARGET_TYPE_URL
          Target type indicator, indicates a url is the target.
private  String targetString
           
private  int targetType
           
private  HTTPUploadDownload uploadDownload
           
private  HTTPUploadDownloadView uploadDownloadView
           
private  String uploadURL
           
(package private) static boolean VERBOSE
           
 
Fields inherited from class java.awt.Panel
 
Fields inherited from class java.awt.Container
 
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
UploadPanel()
           
 
Method Summary
private  boolean addNewFile(int uploadIndex, boolean isFile, UploadPanel.TargetInfo info, String targetName)
           
private  String display(String key, Object[] params)
          Returns the localized string to be displayed to the user given a key.
private  WTContext getContext()
           
private  UploadPanel.TargetInfo getExistingTargetInfo()
           
private  FileAccess getFileAccess()
           
 int getOperationStatus()
          Return the most recent status.
 Applet getParentApplet()
          Return the launching applet (if any).
protected  Frame getParentFrame()
          Return the parent frame.
 String getTarget()
          Return the target file or url.
 int getTargetType()
           
 void init(Applet parentApplet, HTTPUploadDownload newUploadDownload, HTTPUploadDownloadView view, int newTargetType)
          Initialize this panel to use the passed HTTPUploadDownload) object.
 boolean isDirty()
          Should be invoked before a call to save; this is where checksumming and initial file validation occurs.
 void performUploadOperation(boolean separateThread)
           
protected  void performUploadOperation(boolean separateThread, boolean needsSynch)
           
private  boolean removeCurrentFile(int uploadIndex, boolean isFile, UploadPanel.TargetInfo info)
           
 boolean save(boolean check, boolean primaryUpload, boolean secondaryUpload)
          Save the target content.
 boolean saveContent(boolean primaryUpload, boolean secondaryUpload)
           
private  boolean saveContentItems(boolean primaryUpload)
           
 void setCallingAction(String calling_action)
           
 void setParentApplet(Applet parentApplet)
           
 boolean setTarget(String target)
          Set the target file or url.
 boolean setUploadURL(String urlString)
          Set the upload url.
protected  void showMessageDialog(String message, boolean modal)
           
private  void synch()
           
private  void synch(int index)
           
 
Methods inherited from class java.awt.Panel
addNotify, getAccessibleContext
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, 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, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, 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

RESOURCE

private static String RESOURCE

VERBOSE

static boolean VERBOSE

TARGET_TYPE_UNKNOWN

public static final int TARGET_TYPE_UNKNOWN
Target type indicator, indicates the type is unknown.

See Also:
Constant Field Values

TARGET_TYPE_FILE

public static final int TARGET_TYPE_FILE
Target type indicator, indicates a file is the target.

See Also:
Constant Field Values

TARGET_TYPE_URL

public static final int TARGET_TYPE_URL
Target type indicator, indicates a url is the target.

See Also:
Constant Field Values

TARGET_TYPE_NONE

public static final int TARGET_TYPE_NONE
Target type indicator, indicates there is no target.

See Also:
Constant Field Values

uploadDownload

private HTTPUploadDownload uploadDownload

uploadDownloadView

private HTTPUploadDownloadView uploadDownloadView

parentApplet

private Applet parentApplet

contextGroup

private ThreadGroup contextGroup

fileAccess

private FileAccess fileAccess

uploadURL

private String uploadURL

callingAction

private String callingAction

targetType

private int targetType

targetString

private String targetString
Constructor Detail

UploadPanel

public UploadPanel()
Method Detail

init

public void init(Applet parentApplet,
                 HTTPUploadDownload newUploadDownload,
                 HTTPUploadDownloadView view,
                 int newTargetType)
Initialize this panel to use the passed HTTPUploadDownload) object. This operation (or init()) must be called once this panel has been added to its parent container.


setCallingAction

public void setCallingAction(String calling_action)

setUploadURL

public boolean setUploadURL(String urlString)
Set the upload url.


getTarget

public String getTarget()
Return the target file or url.


setTarget

public boolean setTarget(String target)
Set the target file or url.

Parameters:
target - The file path, e.g. "E:\abcd\test.txt" or "E:\abcd\*.txt" or url.

getParentApplet

public Applet getParentApplet()
Return the launching applet (if any).


setParentApplet

public void setParentApplet(Applet parentApplet)

performUploadOperation

public void performUploadOperation(boolean separateThread)

performUploadOperation

protected void performUploadOperation(boolean separateThread,
                                      boolean needsSynch)

saveContent

public boolean saveContent(boolean primaryUpload,
                           boolean secondaryUpload)

save

public boolean save(boolean check,
                    boolean primaryUpload,
                    boolean secondaryUpload)
Save the target content. Note that this operation will not check to see if the panel "is dirty". If This operation should occur only when the content has changed the caller should first check by calling operation isDirty().


getOperationStatus

public int getOperationStatus()
Return the most recent status.


isDirty

public boolean isDirty()
Should be invoked before a call to save; this is where checksumming and initial file validation occurs.


saveContentItems

private boolean saveContentItems(boolean primaryUpload)

removeCurrentFile

private boolean removeCurrentFile(int uploadIndex,
                                  boolean isFile,
                                  UploadPanel.TargetInfo info)

addNewFile

private boolean addNewFile(int uploadIndex,
                           boolean isFile,
                           UploadPanel.TargetInfo info,
                           String targetName)

getTargetType

public int getTargetType()

getExistingTargetInfo

private UploadPanel.TargetInfo getExistingTargetInfo()

getFileAccess

private FileAccess getFileAccess()

getParentFrame

protected Frame getParentFrame()
Return the parent frame.


synch

private void synch()

synch

private void synch(int index)

getContext

private WTContext getContext()

display

private String display(String key,
                       Object[] params)
Returns the localized string to be displayed to the user given a key.

Parameters:
key - The string that represents the key in the BeansRB.
Returns:
A string to be displayed to the user.

showMessageDialog

protected void showMessageDialog(String message,
                                 boolean modal)