wt.clients.content
Class UploadFilesDialog

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjava.awt.Window
              extended byjava.awt.Dialog
                  extended bywt.clients.content.UploadFilesDialog
All Implemented Interfaces:
Accessible, ImageObserver, MenuContainer, Serializable

public class UploadFilesDialog
extends Dialog

Dialog which supports uploading files to a ContentHolder object. This dialog contains a multilist from which the user can choose files to be uploaded. The files displayed can either be explicitly set or taken from a given ContentHolder object. Eg.

       UploadFilesDialog upload_dialog = new UploadFilesDialog( frm, true );
       upload_dialog.setContentHolder( myContentHolder );
       upload_dialog.useAllFiles( true );
       upload_dialog.setVisible( true );
  


Supported API:true

Extendable:false

See Also:
wt.content.WTContentHolder, Serialized Form

Nested Class Summary
private  class UploadFilesDialog.ActionThread
          Thread class which handles the initialization of the list of files displayed in this dialog.
(package private)  class UploadFilesDialog.SymAction
           
(package private)  class UploadFilesDialog.SymKey
           
(package private)  class UploadFilesDialog.SymWindow
           
(package private)  class UploadFilesDialog.UploadThread
          Thread class that handles the actual uploading of the files.
 
Nested classes inherited from class java.awt.Dialog
Dialog.AccessibleAWTDialog
 
Nested classes inherited from class java.awt.Window
Window.AccessibleAWTWindow
 
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  boolean blocking
           
(package private)  Panel buttonPanel
           
private  boolean cancel
           
(package private)  Button cancelButton
           
private  ContentHolder contentHolder
           
private  ThreadGroup contextGroup
           
private  Object contextLock
           
private static boolean DEBUG
          Flag used to provide debugging messages.
(package private)  Label dialogLabel
           
(package private)  boolean fComponentsAdjusted
           
private static int FILE_NAME
           
(package private)  WTMultiList fileMultiList
           
private  Vector files
           
private static int FORMAT
           
(package private)  symantec.itools.awt.shape.HorizontalLine horizontalLine1
           
private static IconCache iconCache
           
protected static int INIT_FILE_CONTENT
           
private static int KEY
           
private  boolean markFiles
           
(package private)  Button okButton
           
private  Applet parentApplet
           
private static ResourceBundle resources
           
static String RESOURCES
          Defined constant which specifies the fully-qualified class name of the Resource Bundle containing message resources for localization.
private  Vector selectedFiles
           
private static int SIZE
           
private  boolean threadCompleted
           
private  Exception threadException
           
private  Object threadLock
          Primitives used for controlling thread synchronization
private  boolean threadSuccessful
           
private  Vector uploadListeners
           
private  boolean useAllFiles
           
private  int waitingOnContext
           
 
Fields inherited from class java.awt.Dialog
 
Fields inherited from class java.awt.Window
 
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
UploadFilesDialog(Frame parent, boolean modal)
          Constructor for UploadFilesDialog.
UploadFilesDialog(Frame parent, String title, boolean modal)
          Constructor for UploadFilesDialog.
 
Method Summary
 void addNotify()
           
 void addUploadListener(UploadDownloadListener listener)
          Adds an UploadDownloadListener to be notified when upload events occur on this dialog.
(package private)  void cancelButton_Action(ActionEvent event)
           
(package private)  void cancelButton_KeyPress(KeyEvent event)
           
(package private)  void Dialog1_WindowClosing(WindowEvent event)
           
private  void dispatchRefresh(Object obj, int action)
           
private  void enableActions(boolean enable)
           
private  ApplicationData findFile(String key)
           
 boolean getBlocking()
          Returns a boolean value indicating whether or not this dialog currently blocks until the uploads complete.
 ContentHolder getContentHolder()
          Returns the ContentHolder whose files are displayed in this dialog.
private  WTContext getContext()
          Returns the WTContext associated with this dialog.
private  String getFileSize(ApplicationData file)
           
private  String getObjectKey(ApplicationData file)
           
 Applet getParentApplet()
          Method getParentApplet returns the Applet which is used to provide context to this dialog.
 Vector getSelectedFiles()
          Method getSelectedFiles returns the files that have been selected by the user.
private  Image getStandardIcon(ApplicationData content)
           
private  void initContentHolder()
           
private  void initFileContentList()
           
private  void initializeIconCache()
          initializeIconCache initializes a HashMap of icons associated with file formats.
private  void initMultiList()
           
private  void initResources()
           
 boolean isCanceled()
          Method isCanceled checks whether or not this dialog has been cancelled.
 boolean isMarkIntentToChange()
          Returns a boolean value indicating whether or not the intent-to-change flag should be set when files are downloaded.
private  void localize()
           
private  void notifyUploadListeners(UploadDownloadEvent evt)
          Notify UploadDownloadListeners that an Upload event has occurred.
(package private)  void okButton_Action(ActionEvent event)
           
(package private)  void okButton_KeyPress(KeyEvent event)
           
protected  void processCancel()
           
protected  void processOkCommand()
           
 void refresh()
          Method refresh updates the display of this dialog.
 void removeUploadListener(UploadDownloadListener listener)
          Removes an UploadDownloadListener from being notified of upload events on this dialog.
 void setBlocking(boolean blocking)
          Sets whether or not this dialog should block until any uploads have completed.
 void setCancelButtonLabel(String label)
          Method setCancelButtonLabel uses the given String to set the label on the button that causes any selection to be cancelled and this dialog to be closed.
 void setContentHolder(ContentHolder content_holder)
          Method setContentHolder sets the ContentHolder object which is associated with the files displayed in this dialog.
private  void setContext(boolean context_on)
           
 void setDialogLabel(String label)
          Method setDialogLabel uses the given String to set the label displayed on this dialog.
 void setFileSet(Vector fileset)
          Method setFileSet sets the list of files to be displayed in this dialog.
 void setMarkIntentToChange(boolean mark_files)
          Sets whether or not the intent-to-change flag on the files should be set when the files are downloaded.
 void setOkButtonLabel(String label)
          Method setOkButtonLabel uses the given String to set the label on the button that causes the currently selected files to be selected.
 void setParentApplet(Applet parent_applet)
          Method setParentApplet sets the applet which is used to provide context for this dialog.
 void show()
           
private  void showMessageDialog(String message)
           
private  void uploadFiles(Vector files, boolean update)
           
private  void uploadFilesWithUpdate(Vector files)
           
 void useAllFiles(boolean use_files)
          Method useAllFiles specifies whether or not this dialog should use all of the files contained in a given ContentHolder.
 
Methods inherited from class java.awt.Dialog
dispose, getAccessibleContext, getTitle, hide, isModal, isResizable, isUndecorated, paramString, setModal, setResizable, setTitle, setUndecorated
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, finalize, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getMostRecentFocusOwner, getOwnedWindows, getOwner, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindowStateListeners, isActive, isFocusableWindow, isFocusCycleRoot, isFocused, isShowing, pack, postEvent, processEvent, processWindowEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, setCursor, setFocusableWindowState, setFocusCycleRoot, setLocationRelativeTo, 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, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, remove, removeAll, removeContainerListener, removeNotify, 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, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, 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, isOpaque, 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, 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, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

fComponentsAdjusted

boolean fComponentsAdjusted

dialogLabel

Label dialogLabel

fileMultiList

WTMultiList fileMultiList

horizontalLine1

symantec.itools.awt.shape.HorizontalLine horizontalLine1

buttonPanel

Panel buttonPanel

okButton

Button okButton

cancelButton

Button cancelButton

RESOURCES

public static String RESOURCES
Defined constant which specifies the fully-qualified class name of the Resource Bundle containing message resources for localization.


resources

private static ResourceBundle resources

INIT_FILE_CONTENT

protected static final int INIT_FILE_CONTENT
See Also:
Constant Field Values

FILE_NAME

private static final int FILE_NAME
See Also:
Constant Field Values

FORMAT

private static final int FORMAT
See Also:
Constant Field Values

SIZE

private static final int SIZE
See Also:
Constant Field Values

KEY

private static final int KEY
See Also:
Constant Field Values

iconCache

private static IconCache iconCache

DEBUG

private static boolean DEBUG
Flag used to provide debugging messages.


contentHolder

private ContentHolder contentHolder

parentApplet

private Applet parentApplet

selectedFiles

private Vector selectedFiles

files

private Vector files

markFiles

private boolean markFiles

useAllFiles

private boolean useAllFiles

cancel

private boolean cancel

blocking

private boolean blocking

contextGroup

private ThreadGroup contextGroup

uploadListeners

private Vector uploadListeners

threadLock

private Object threadLock
Primitives used for controlling thread synchronization


threadCompleted

private boolean threadCompleted

threadSuccessful

private boolean threadSuccessful

threadException

private Exception threadException

contextLock

private Object contextLock

waitingOnContext

private int waitingOnContext
Constructor Detail

UploadFilesDialog

public UploadFilesDialog(Frame parent,
                         boolean modal)
Constructor for UploadFilesDialog.

Parameters:
parent - the owner of this dialog
modal - if true, this dialog blocks input to the parent window when shown
See Also:
Dialog

UploadFilesDialog

public UploadFilesDialog(Frame parent,
                         String title,
                         boolean modal)
Constructor for UploadFilesDialog.

Parameters:
parent - the owner of this dialog
title - the title of this dialog
modal - if true, this dialog blocks input to the parent window when shown
See Also:
Dialog
Method Detail

localize

private void localize()

initMultiList

private void initMultiList()

initResources

private void initResources()

addNotify

public void addNotify()

show

public void show()

Dialog1_WindowClosing

void Dialog1_WindowClosing(WindowEvent event)

addUploadListener

public void addUploadListener(UploadDownloadListener listener)
Adds an UploadDownloadListener to be notified when upload events occur on this dialog. When an upload initiated by this dialog completes, an UploadDownloadEvent for the upload will be broadcast to UploadDownloadListeners.

Parameters:
listener - the UploadDownloadListener to be notified of events
See Also:
removeUploadListener(wt.clients.content.UploadDownloadListener)

removeUploadListener

public void removeUploadListener(UploadDownloadListener listener)
Removes an UploadDownloadListener from being notified of upload events on this dialog.

Parameters:
listener - the UploadDownloadListener to be removed as a listener to UploadDownloadEvents
See Also:
addUploadListener(wt.clients.content.UploadDownloadListener)

setBlocking

public void setBlocking(boolean blocking)
Sets whether or not this dialog should block until any uploads have completed. If the given boolean is true, this dialog will be displayed until the uploads have completed. If false, this dialog will close as soon as the thread to perform the uploads has started. If this dialog is set to not block, upload notification can be used to allow the caller to determine when the uploads have completed (see addUploadListener).

Parameters:
blocking - if true, this dialog will block until the uploads have completed.
See Also:
getBlocking(), addUploadListener(wt.clients.content.UploadDownloadListener)

getBlocking

public boolean getBlocking()
Returns a boolean value indicating whether or not this dialog currently blocks until the uploads complete.

Returns:
true if this dialog will block until uploads complete
See Also:
setBlocking(boolean)

notifyUploadListeners

private void notifyUploadListeners(UploadDownloadEvent evt)
Notify UploadDownloadListeners that an Upload event has occurred.

Parameters:
evt - the UploadDownloadEvent of which listeners will be notified.

initContentHolder

private void initContentHolder()

useAllFiles

public void useAllFiles(boolean use_files)
Method useAllFiles specifies whether or not this dialog should use all of the files contained in a given ContentHolder.

Parameters:
use_files - if true, this dialog will initialize the list of files displayed by retrieving all files contained in a given ContentHolder. If false, this dialog assumes the list of files will be explicitly provided via setFileSet
See Also:
setContentHolder(wt.content.ContentHolder), setFileSet(java.util.Vector), ContentHolder

getContentHolder

public ContentHolder getContentHolder()
Returns the ContentHolder whose files are displayed in this dialog.

Returns:
the ContentHolder whose files are displayed in and upload from this dialog.
See Also:
setContentHolder(wt.content.ContentHolder)

setContentHolder

public void setContentHolder(ContentHolder content_holder)
Method setContentHolder sets the ContentHolder object which is associated with the files displayed in this dialog. Setting the ContentHolder is necessary if this dialog is set to display all of the files in the given ContentHolder.

Parameters:
content_holder - the ContentHolder associated with the displayed files
See Also:
useAllFiles, getContentHolder()

setFileSet

public void setFileSet(Vector fileset)
Method setFileSet sets the list of files to be displayed in this dialog.

Parameters:
fileset - the Vector of files (ApplicationData items) to be displayed in this dialog

setParentApplet

public void setParentApplet(Applet parent_applet)
Method setParentApplet sets the applet which is used to provide context for this dialog. The given applet is used in retrieving the appropriate WTContext object.

Parameters:
parent_applet - the Applet used to give context to this dialog.
See Also:
getParentApplet(), WTContext

getParentApplet

public Applet getParentApplet()
Method getParentApplet returns the Applet which is used to provide context to this dialog.

Returns:
the Applet which gives context to this dialog
See Also:
setParentApplet(java.applet.Applet), WTContext

setMarkIntentToChange

public void setMarkIntentToChange(boolean mark_files)
Sets whether or not the intent-to-change flag on the files should be set when the files are downloaded.

Parameters:
mark_files - if true, the intent-to-change flag will be set to true for any content files downloaded

isMarkIntentToChange

public boolean isMarkIntentToChange()
Returns a boolean value indicating whether or not the intent-to-change flag should be set when files are downloaded.

Returns:
if true, the intent-to-change flag will be set to true for any content files downloaded.

setOkButtonLabel

public void setOkButtonLabel(String label)
Method setOkButtonLabel uses the given String to set the label on the button that causes the currently selected files to be selected.

Parameters:
label - the String to use as the button label
See Also:
setCancelButtonLabel(java.lang.String)

setCancelButtonLabel

public void setCancelButtonLabel(String label)
Method setCancelButtonLabel uses the given String to set the label on the button that causes any selection to be cancelled and this dialog to be closed.

Parameters:
label - the String to use as the button label
See Also:
setOkButtonLabel(java.lang.String)

setDialogLabel

public void setDialogLabel(String label)
Method setDialogLabel uses the given String to set the label displayed on this dialog. The label is useful for providing context to the action to be taken on the selected files. Eg.
    UploadFilesDialog select_dialog = new UploadFilesDialog( my_frame, true );
    select_dialog.setDialogLabel( "Please Select the Files to be Uploaded" );
    ...
  

Parameters:
label - the String to be used as the label of this dialog

isCanceled

public boolean isCanceled()
Method isCanceled checks whether or not this dialog has been cancelled. This dialog is considered to be cancelled if the user either closes this dialog via the "Cancel" button, or closes the dialog by clicking the "x" window control in the corner of this dialog.

Returns:
if true, this dialog has been cancelled, and no files have been selected

getContext

private WTContext getContext()
Returns the WTContext associated with this dialog. If the ThreadGroup captured when this dialog was constructed is not null, the ThreadGroup will be used to retreive the WTContext. Otherwise, if the given parent Applet of this dialog is not null, that Applet will be used to retreive the WTContext. If neither the ThreadGroup or Applet is available, this method will return a new WTContext.

Returns:
the WTContext associated with this dialog.

setContext

private void setContext(boolean context_on)

getSelectedFiles

public Vector getSelectedFiles()
Method getSelectedFiles returns the files that have been selected by the user.

Returns:
the Vector of selected files. If this dialog has been cancelled, the returned Vector will be null
See Also:
isCanceled()

initFileContentList

private void initFileContentList()

getObjectKey

private String getObjectKey(ApplicationData file)

cancelButton_Action

void cancelButton_Action(ActionEvent event)

processCancel

protected void processCancel()

okButton_Action

void okButton_Action(ActionEvent event)

processOkCommand

protected void processOkCommand()

findFile

private ApplicationData findFile(String key)

enableActions

private void enableActions(boolean enable)

showMessageDialog

private void showMessageDialog(String message)

refresh

public void refresh()
Method refresh updates the display of this dialog.


okButton_KeyPress

void okButton_KeyPress(KeyEvent event)

cancelButton_KeyPress

void cancelButton_KeyPress(KeyEvent event)

dispatchRefresh

private void dispatchRefresh(Object obj,
                             int action)

uploadFiles

private void uploadFiles(Vector files,
                         boolean update)
                  throws PropertyVetoException,
                         WTException,
                         InterruptedException
Throws:
PropertyVetoException
WTException
InterruptedException

uploadFilesWithUpdate

private void uploadFilesWithUpdate(Vector files)
                            throws PropertyVetoException,
                                   WTException,
                                   InterruptedException
Throws:
PropertyVetoException
WTException
InterruptedException

getFileSize

private String getFileSize(ApplicationData file)

initializeIconCache

private void initializeIconCache()
initializeIconCache initializes a HashMap of icons associated with file formats. The HashMap is used for retrieving the icon associated with a particular ContentItem.

See Also:
HashMap

getStandardIcon

private Image getStandardIcon(ApplicationData content)