View Javadoc
1   /*******************************************************************************
2    * Copyright (c) 2011, 2012 EclipseSource and others.
3    * All rights reserved. This program and the accompanying materials
4    * are made available under the terms of the Eclipse Public License v1.0
5    * which accompanies this distribution, and is available at
6    * http://www.eclipse.org/legal/epl-v10.html
7    *
8    * Contributors:
9    *    EclipseSource - initial API and implementation
10   ******************************************************************************/
11  package org.eclipse.rap.fileupload;
12  
13  import org.eclipse.swt.widgets.Display;
14  
15  
16  /**
17   * Listener to react on progress and completion of a file upload.
18   * <p>
19   * <strong>Note:</strong> This listener will be called from a different thread than the UI thread.
20   * Implementations must use {@link Display#asyncExec(Runnable)} to access the UI.
21   * </p>
22   *
23   * @see FileUploadEvent
24   */
25  public interface FileUploadListener {
26  
27    /**
28     * Called when new information about an in-progress upload is available.
29     *
30     * @param event event object that contains information about the uploaded file
31     * @see FileUploadEvent#getBytesRead()
32     */
33    void uploadProgress( FileUploadEvent event );
34  
35    /**
36     * Called when a file upload has finished successfully.
37     *
38     * @param event event object that contains information about the uploaded file
39     * @see FileUploadEvent
40     */
41    void uploadFinished( FileUploadEvent event );
42  
43    /**
44     * Called when a file upload failed.
45     *
46     * @param event event object that contains information about the uploaded file
47     * @see FileUploadEvent#getErrorMessage()
48     */
49    void uploadFailed( FileUploadEvent event );
50  
51  }