com.sas.mail.commands
Class AddAttachmentCommand

java.lang.Object
  |
  +--com.sas.mail.commands.AddAttachmentCommand
All Implemented Interfaces:
Command, PublicClonable, SimpleCommand, StringDataInterface, SupportsErrorHandlerInterface

public class AddAttachmentCommand
extends java.lang.Object
implements Command, SupportsErrorHandlerInterface, java.io.Serializable

AddAttachmentCommand is a Command interface implementation that can be executed to add a File Attachment to a list of Attachments. It will show a FileDialog to choose an Attachment from and then create an Attachment with a FileDataSource for the selected file. The new Attachment is added to the attachmentList. If the file does not exist or a SecurityException is thrown, the errorHandler will be called.

See Also:
Attachment, Serialized Form

Field Summary
protected  OrderedCollectionInterface attachmentList
           
protected  Component parentComponent
           
static String RB_KEY
           
protected  String text
           
 
Constructor Summary
AddAttachmentCommand(Component parent, OrderedCollectionInterface list)
          Constructor for AddAttachmentCommand.
 
Method Summary
 Object clone()
          Get a clone of the AddAttachmentCommand.
 void execute(Object arg)
          Allow the user to chose a file to add as an Attachment to a list of Attachments.
 ErrorHandlerInterface getErrorHandler()
          Get the errorHandler to be notified when an error occurs.
 String getText()
          Get the text of the Command.
 boolean isExecutable()
          Return true, this Command is executable.
 boolean isUndoable()
          Return false, this Command is not undoable.
 void setErrorHandler(ErrorHandlerInterface errHandler)
          Set the errorHandler to be notified when an error occurs.
 void setText(String txt)
          Set the text of the Command.
 void undo()
          This does nothing.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RB_KEY

public static final String RB_KEY

text

protected String text

attachmentList

protected OrderedCollectionInterface attachmentList

parentComponent

protected Component parentComponent
Constructor Detail

AddAttachmentCommand

public AddAttachmentCommand(Component parent,
                            OrderedCollectionInterface list)
Constructor for AddAttachmentCommand.
Method Detail

clone

public Object clone()
             throws CloneNotSupportedException
Get a clone of the AddAttachmentCommand.
Specified by:
clone in interface Command
Overrides:
clone in class Object
Returns:
the cloned object
Throws:
CloneNotSupportedException - thrown if the command doesn't support creating a clone of itself

isExecutable

public boolean isExecutable()
Return true, this Command is executable.
Specified by:
isExecutable in interface Command
Returns:
true, this Command is executable

isUndoable

public boolean isUndoable()
Return false, this Command is not undoable.
Specified by:
isUndoable in interface Command
Returns:
false, this Command is not undoable

undo

public void undo()
This does nothing.
Specified by:
undo in interface Command
Following copied from interface: com.sas.util.Command
See Also:
SimpleCommand.execute(Object)

execute

public void execute(Object arg)
Allow the user to chose a file to add as an Attachment to a list of Attachments. This will fail if the user is running in a browser with security restrictions.
Specified by:
execute in interface SimpleCommand
Parameters:
arg - this parameter is not used

getErrorHandler

public ErrorHandlerInterface getErrorHandler()
Get the errorHandler to be notified when an error occurs.
Specified by:
getErrorHandler in interface SupportsErrorHandlerInterface
Returns:
the error handler to be notified when an error occurs

setErrorHandler

public void setErrorHandler(ErrorHandlerInterface errHandler)
Set the errorHandler to be notified when an error occurs.
Specified by:
setErrorHandler in interface SupportsErrorHandlerInterface
Parameters:
errHandler - the error handler to be notified when an error occurs

getText

public String getText()
Get the text of the Command. The text is used as the text on popup menus using Command objects.
Specified by:
getText in interface StringDataInterface
Returns:
the text

setText

public void setText(String txt)
Set the text of the Command. The text is used as the text on popup menus using Command objects.
Specified by:
setText in interface StringDataInterface
Parameters:
txt - the new text




Copyright © 2005 SAS Institute Inc. All Rights Reserved.
javadoc generated Thu, 16 Feb 2006 02:03:16