001 package echopoint.tucana.event;
002
003 import echopoint.tucana.FileUploadSelector;
004 import nextapp.echo.app.ApplicationInstance;
005 import nextapp.echo.app.event.ActionEvent;
006 import nextapp.echo.app.event.ActionListener;
007
008 /**
009 * A default action listener to associate with the {@link
010 * echopoint.tucana.FileUploadSelector} component. Sets up a task queue
011 * at start of upload and cleans it up after being notified that the queue
012 * is not longer necessary.
013 *
014 * <p><b>Note:</b> Development of this component was sponsored by <a
015 * href='http://tcnbroadcasting.com/index.jsp' target='_top'>TCN
016 * Broadcasting</a>. We are grateful for their support and sponsorship.</p>
017 *
018 * @author Rakesh Vidyadharan 2009-2-3
019 * @version $Id: DefaultUploadListener.java 106 2009-02-03 16:00:33Z sptrakesh $
020 */
021 public class DefaultUploadListener implements ActionListener
022 {
023 private static final long serialVersionUID = 1l;
024
025 /**
026 * Initialise the {@link echopoint.tucana.FileUploadSelector#getTaskQueue()}
027 * to enable server-push from callback handlers.
028 *
029 * @param event The action event that was triggered.
030 */
031 public void actionPerformed( final ActionEvent event )
032 {
033 final FileUploadSelector upload = ( FileUploadSelector) event.getSource();
034
035 if ( FileUploadSelector.START_ACTION.equals( event.getActionCommand() ) )
036 {
037 upload.setTaskQueue( ApplicationInstance.getActive().createTaskQueue() );
038 }
039 }
040 }