diff options
Diffstat (limited to 'server/src/com/vaadin/ui/Upload.java')
-rw-r--r-- | server/src/com/vaadin/ui/Upload.java | 130 |
1 files changed, 110 insertions, 20 deletions
diff --git a/server/src/com/vaadin/ui/Upload.java b/server/src/com/vaadin/ui/Upload.java index 619db07eea..2323b22e17 100644 --- a/server/src/com/vaadin/ui/Upload.java +++ b/server/src/com/vaadin/ui/Upload.java @@ -24,12 +24,12 @@ import java.util.Iterator; import java.util.LinkedHashSet; import java.util.Map; -import com.vaadin.terminal.PaintException; -import com.vaadin.terminal.PaintTarget; -import com.vaadin.terminal.StreamVariable.StreamingProgressEvent; -import com.vaadin.terminal.Vaadin6Component; -import com.vaadin.terminal.gwt.server.NoInputStreamException; -import com.vaadin.terminal.gwt.server.NoOutputStreamException; +import com.vaadin.server.NoInputStreamException; +import com.vaadin.server.NoOutputStreamException; +import com.vaadin.server.PaintException; +import com.vaadin.server.PaintTarget; +import com.vaadin.server.LegacyComponent; +import com.vaadin.server.StreamVariable.StreamingProgressEvent; /** * Component for uploading files from client to server. @@ -71,7 +71,7 @@ import com.vaadin.terminal.gwt.server.NoOutputStreamException; */ @SuppressWarnings("serial") public class Upload extends AbstractComponent implements Component.Focusable, - Vaadin6Component { + LegacyComponent { /** * Should the field be focused on next repaint? @@ -570,87 +570,159 @@ public class Upload extends AbstractComponent implements Component.Focusable, * @param listener * the Listener to be added. */ - public void addListener(StartedListener listener) { + public void addStartedListener(StartedListener listener) { addListener(StartedEvent.class, listener, UPLOAD_STARTED_METHOD); } /** + * @deprecated Since 7.0, replaced by + * {@link #addStartedListener(StartedListener)} + **/ + @Deprecated + public void addListener(StartedListener listener) { + addStartedListener(listener); + } + + /** * Removes the upload started event listener. * * @param listener * the Listener to be removed. */ - public void removeListener(StartedListener listener) { + public void removeStartedListener(StartedListener listener) { removeListener(StartedEvent.class, listener, UPLOAD_STARTED_METHOD); } /** + * @deprecated Since 7.0, replaced by + * {@link #removeStartedListener(StartedListener)} + **/ + @Deprecated + public void removeListener(StartedListener listener) { + removeStartedListener(listener); + } + + /** * Adds the upload received event listener. * * @param listener * the Listener to be added. */ - public void addListener(FinishedListener listener) { + public void addFinishedListener(FinishedListener listener) { addListener(FinishedEvent.class, listener, UPLOAD_FINISHED_METHOD); } /** + * @deprecated Since 7.0, replaced by + * {@link #addFinishedListener(FinishedListener)} + **/ + @Deprecated + public void addListener(FinishedListener listener) { + addFinishedListener(listener); + } + + /** * Removes the upload received event listener. * * @param listener * the Listener to be removed. */ - public void removeListener(FinishedListener listener) { + public void removeFinishedListener(FinishedListener listener) { removeListener(FinishedEvent.class, listener, UPLOAD_FINISHED_METHOD); } /** + * @deprecated Since 7.0, replaced by + * {@link #removeFinishedListener(FinishedListener)} + **/ + @Deprecated + public void removeListener(FinishedListener listener) { + removeFinishedListener(listener); + } + + /** * Adds the upload interrupted event listener. * * @param listener * the Listener to be added. */ - public void addListener(FailedListener listener) { + public void addFailedListener(FailedListener listener) { addListener(FailedEvent.class, listener, UPLOAD_FAILED_METHOD); } /** + * @deprecated Since 7.0, replaced by + * {@link #addFailedListener(FailedListener)} + **/ + @Deprecated + public void addListener(FailedListener listener) { + addFailedListener(listener); + } + + /** * Removes the upload interrupted event listener. * * @param listener * the Listener to be removed. */ - public void removeListener(FailedListener listener) { + public void removeFailedListener(FailedListener listener) { removeListener(FailedEvent.class, listener, UPLOAD_FAILED_METHOD); } /** + * @deprecated Since 7.0, replaced by + * {@link #removeFailedListener(FailedListener)} + **/ + @Deprecated + public void removeListener(FailedListener listener) { + removeFailedListener(listener); + } + + /** * Adds the upload success event listener. * * @param listener * the Listener to be added. */ - public void addListener(SucceededListener listener) { + public void addSucceededListener(SucceededListener listener) { addListener(SucceededEvent.class, listener, UPLOAD_SUCCEEDED_METHOD); } /** + * @deprecated Since 7.0, replaced by + * {@link #addSucceededListener(SucceededListener)} + **/ + @Deprecated + public void addListener(SucceededListener listener) { + addSucceededListener(listener); + } + + /** * Removes the upload success event listener. * * @param listener * the Listener to be removed. */ - public void removeListener(SucceededListener listener) { + public void removeSucceededListener(SucceededListener listener) { removeListener(SucceededEvent.class, listener, UPLOAD_SUCCEEDED_METHOD); } /** + * @deprecated Since 7.0, replaced by + * {@link #removeSucceededListener(SucceededListener)} + **/ + @Deprecated + public void removeListener(SucceededListener listener) { + removeSucceededListener(listener); + } + + /** * Adds the upload success event listener. * * @param listener * the Listener to be added. */ - public void addListener(ProgressListener listener) { + public void addProgressListener(ProgressListener listener) { if (progressListeners == null) { progressListeners = new LinkedHashSet<ProgressListener>(); } @@ -658,18 +730,36 @@ public class Upload extends AbstractComponent implements Component.Focusable, } /** + * @deprecated Since 7.0, replaced by + * {@link #addProgressListener(ProgressListener)} + **/ + @Deprecated + public void addListener(ProgressListener listener) { + addProgressListener(listener); + } + + /** * Removes the upload success event listener. * * @param listener * the Listener to be removed. */ - public void removeListener(ProgressListener listener) { + public void removeProgressListener(ProgressListener listener) { if (progressListeners != null) { progressListeners.remove(listener); } } /** + * @deprecated Since 7.0, replaced by + * {@link #removeProgressListener(ProgressListener)} + **/ + @Deprecated + public void removeListener(ProgressListener listener) { + removeProgressListener(listener); + } + + /** * Emit upload received event. * * @param filename @@ -936,11 +1026,11 @@ public class Upload extends AbstractComponent implements Component.Focusable, * Handle to terminal via Upload monitors and controls the upload during it * is being streamed. */ - private com.vaadin.terminal.StreamVariable streamVariable; + private com.vaadin.server.StreamVariable streamVariable; - protected com.vaadin.terminal.StreamVariable getStreamVariable() { + protected com.vaadin.server.StreamVariable getStreamVariable() { if (streamVariable == null) { - streamVariable = new com.vaadin.terminal.StreamVariable() { + streamVariable = new com.vaadin.server.StreamVariable() { private StreamingStartEvent lastStartedEvent; @Override |