T
- UploadReceiver
implemented class.public abstract class AbstractUploadField<T extends UploadReceiver> extends com.vaadin.ui.CustomField<T> implements com.vaadin.ui.Upload.StartedListener, com.vaadin.ui.Upload.FinishedListener, com.vaadin.ui.Upload.ProgressListener, com.vaadin.ui.Upload.FailedListener, com.vaadin.event.dd.DropHandler, UploadField
UploadField
and associated
classes.
This class handles Upload events and expose functions that allows to customize the 3 main upload states (link to a view Component):
Upload.StartedEvent
.Upload.FinishedEvent
Upload.FailedEvent
Upload
getUpload() : Return the Vaadin Upload Component responsible for the Uploading a File based on a folder. Modifier and Type | Class and Description |
---|---|
protected static class |
AbstractUploadField.InterruptionReason
Simple Enumeration listing all available Interruption reason.
|
com.vaadin.ui.AbstractField.FocusShortcut, com.vaadin.ui.AbstractField.ReadOnlyStatusChangeEvent
com.vaadin.ui.HasComponents.ComponentAttachDetachNotifier, com.vaadin.ui.HasComponents.ComponentAttachEvent, com.vaadin.ui.HasComponents.ComponentAttachListener, com.vaadin.ui.HasComponents.ComponentDetachEvent, com.vaadin.ui.HasComponents.ComponentDetachListener
com.vaadin.ui.Component.ErrorEvent, com.vaadin.ui.Component.Event, com.vaadin.ui.Component.Focusable, com.vaadin.ui.Component.Listener
com.vaadin.server.ClientConnector.AttachEvent, com.vaadin.server.ClientConnector.AttachListener, com.vaadin.server.ClientConnector.ConnectorErrorEvent, com.vaadin.server.ClientConnector.DetachEvent, com.vaadin.server.ClientConnector.DetachListener
com.vaadin.server.Sizeable.Unit
com.vaadin.ui.Field.ValueChangeEvent
com.vaadin.data.Buffered.SourceException
com.vaadin.data.Property.Editor, com.vaadin.data.Property.ReadOnlyException, com.vaadin.data.Property.ReadOnlyStatusChangeListener, com.vaadin.data.Property.ReadOnlyStatusChangeNotifier, com.vaadin.data.Property.Transactional<T>, com.vaadin.data.Property.ValueChangeListener, com.vaadin.data.Property.ValueChangeNotifier, com.vaadin.data.Property.Viewer
Constructor and Description |
---|
AbstractUploadField() |
Modifier and Type | Method and Description |
---|---|
protected abstract void |
buildCompletedLayout()
Build the Completed Layout.
Use the fileWrapper to display file information and Status. |
protected abstract void |
buildEmptyLayout()
Build the Empty Layout.
Use the fileWrapper to display file information and Status. |
protected abstract void |
buildInProgressLayout(String uploadedFileMimeType)
Build the in Progress Layout.
Generally display a progress bar UploadProgressIndicator and some file information.Refresh of the action bar is handled by refreshInProgressLayout(...) Use the fileWrapper to display file information and Status. |
protected DragAndDropWrapper |
createDropZone(com.vaadin.ui.Component c)
The dropZone is a wrapper around a Component.
|
void |
detach() |
protected abstract void |
displayUploadFailedNote(String fileName) |
protected abstract void |
displayUploadFinishedNote(String fileName) |
protected abstract void |
displayUploadInterruptNote(AbstractUploadField.InterruptionReason reason) |
void |
drop(com.vaadin.event.dd.DragAndDropEvent event)
Drop zone Handler.
|
com.vaadin.event.dd.acceptcriteria.AcceptCriterion |
getAcceptCriterion()
Handled by isValidFile().
|
protected DragAndDropWrapper |
getDropZone() |
protected com.vaadin.ui.HasComponents |
getRootLayout() |
Class |
getType() |
protected com.vaadin.ui.Upload |
getUpload() |
protected void |
interruptUpload(AbstractUploadField.InterruptionReason reason)
Interrupt upload based on a user Action.
|
protected boolean |
isValidFile(com.vaadin.ui.Upload.StartedEvent event)
Define the acceptance Upload Image criteria.
|
protected abstract void |
refreshInProgressLayout(long readBytes,
long contentLength,
String fileName)
Update the in Progress Layout.
|
protected void |
resetDataSource() |
void |
setAllowedMimeTypePattern(String allowedMimeTypePattern)
Set the AllowedMimeType.
|
void |
setLocale(Locale locale) |
void |
setMaxUploadSize(long maxUploadSize)
Define the Maximum Upload File size in bytes.
|
void |
setPropertyDataSource(com.vaadin.data.Property newDataSource) |
protected void |
setRootLayout(com.vaadin.ui.HasComponents root) |
protected void |
updateDisplay()
Call the correct layout.
|
void |
updateProgress(long readBytes,
long contentLength)
Update the Progress Component.
|
void |
uploadFailed(com.vaadin.ui.Upload.FailedEvent event) |
void |
uploadFinished(com.vaadin.ui.Upload.FinishedEvent event)
Handle the
Upload.FinishedEvent . |
void |
uploadStarted(com.vaadin.ui.Upload.StartedEvent event)
Start Upload if the file is supported.
|
attach, getContent, initContent, iterator, setHeight, setWidth
addListener, addListener, addReadOnlyStatusChangeListener, addValidator, addValueChangeListener, beforeClientResponse, clear, commit, discard, fireReadOnlyStatusChange, fireValueChange, focus, getConversionError, getConversionError, getConvertedValue, getConverter, getCurrentBufferedSourceException, getCustomAttributes, getErrorMessage, getInternalValue, getModelType, getPropertyDataSource, getRequiredError, getState, getState, getTabIndex, getValidators, getValue, isBuffered, isEmpty, isImmediate, isInvalidAllowed, isInvalidCommitted, isModified, isReadOnly, isRequired, isValid, isValidationVisible, readDesign, readOnlyStatusChange, removeAllValidators, removeListener, removeListener, removeReadOnlyStatusChangeListener, removeValidator, removeValueChangeListener, setBuffered, setConversionError, setConvertedValue, setConverter, setConverter, setCurrentBufferedSourceException, setInternalValue, setInvalidAllowed, setInvalidCommitted, setReadOnly, setRequired, setRequiredError, setTabIndex, setValidationVisible, setValue, setValue, setValue, shouldHideErrors, toString, validate, validate, valueChange, writeDesign
addContextClickListener, addListener, addShortcutListener, addStyleName, findAncestor, fireComponentErrorEvent, fireComponentEvent, getActionManager, getCaption, getComponentError, getData, getDebugId, getDescription, getExplicitImmediateValue, getHeight, getHeightUnits, getIcon, getId, getLocale, getParent, getPrimaryStyleName, getStyleName, getWidth, getWidthUnits, isCaptionAsHtml, isConnectorEnabled, isEnabled, isOrHasAncestor, isResponsive, isVisible, removeContextClickListener, removeListener, removeShortcutListener, removeStyleName, setCaption, setCaptionAsHtml, setComponentError, setData, setDebugId, setDescription, setEnabled, setHeight, setHeightUndefined, setIcon, setId, setImmediate, setParent, setPrimaryStyleName, setResponsive, setSizeFull, setSizeUndefined, setStyleName, setStyleName, setVisible, setWidth, setWidthUndefined
addAttachListener, addDetachListener, addExtension, addListener, addListener, addListener, addMethodInvocationToQueue, createState, encodeState, equals, fireEvent, getAllChildrenIterable, getConnectorId, getErrorHandler, getExtensions, getListeners, getResource, getRpcManager, getRpcProxy, getSession, getStateType, getUI, handleConnectorRequest, hashCode, hasListeners, isAttached, isThis, markAsDirty, markAsDirtyRecursive, registerRpc, registerRpc, removeAttachListener, removeDetachListener, removeExtension, removeListener, removeListener, removeListener, removeListener, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler, setResource
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
addListener, addStyleName, getCaption, getDescription, getIcon, getId, getLocale, getParent, getPrimaryStyleName, getStyleName, getUI, isEnabled, isReadOnly, isVisible, readDesign, removeListener, removeStyleName, setCaption, setEnabled, setIcon, setId, setParent, setPrimaryStyleName, setReadOnly, setStyleName, setVisible, writeDesign
addAttachListener, addDetachListener, beforeClientResponse, encodeState, getErrorHandler, getExtensions, getRpcManager, getStateType, handleConnectorRequest, isAttached, isConnectorEnabled, markAsDirty, markAsDirtyRecursive, removeAttachListener, removeDetachListener, removeExtension, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler
getHeight, getHeightUnits, getWidth, getWidthUnits, setHeight, setHeightUndefined, setSizeFull, setSizeUndefined, setWidth, setWidthUndefined
forEach, spliterator
protected abstract void buildEmptyLayout()
protected abstract void buildInProgressLayout(String uploadedFileMimeType)
UploadProgressIndicator
and some file information.protected abstract void refreshInProgressLayout(long readBytes, long contentLength, String fileName)
protected abstract void buildCompletedLayout()
protected abstract void displayUploadInterruptNote(AbstractUploadField.InterruptionReason reason)
protected abstract void displayUploadFinishedNote(String fileName)
protected abstract void displayUploadFailedNote(String fileName)
public void setLocale(Locale locale)
setLocale
in class com.vaadin.ui.AbstractField<T extends UploadReceiver>
public void setPropertyDataSource(com.vaadin.data.Property newDataSource)
setPropertyDataSource
in interface com.vaadin.data.Property.Viewer
setPropertyDataSource
in class com.vaadin.ui.AbstractField<T extends UploadReceiver>
protected void updateDisplay()
protected void interruptUpload(AbstractUploadField.InterruptionReason reason)
FileUploadHandler.UploadInterruptedException
will be thrown by the underlying Vaadin classes.protected boolean isValidFile(com.vaadin.ui.Upload.StartedEvent event)
protected com.vaadin.ui.Upload getUpload()
protected DragAndDropWrapper getDropZone()
protected DragAndDropWrapper createDropZone(com.vaadin.ui.Component c)
public void drop(com.vaadin.event.dd.DragAndDropEvent event)
drop
in interface com.vaadin.event.dd.DropHandler
public com.vaadin.event.dd.acceptcriteria.AcceptCriterion getAcceptCriterion()
getAcceptCriterion
in interface com.vaadin.event.dd.DropHandler
public void uploadStarted(com.vaadin.ui.Upload.StartedEvent event)
uploadStarted
in interface com.vaadin.ui.Upload.StartedListener
public void updateProgress(long readBytes, long contentLength)
updateProgress
in interface com.vaadin.ui.Upload.ProgressListener
public void uploadFinished(com.vaadin.ui.Upload.FinishedEvent event)
Upload.FinishedEvent
. In case of success: Upload.FailedEvent
(this event
is send on a Cancel upload) uploadFinished
in interface com.vaadin.ui.Upload.FinishedListener
public void uploadFailed(com.vaadin.ui.Upload.FailedEvent event)
uploadFailed
in interface com.vaadin.ui.Upload.FailedListener
public Class getType()
getType
in interface com.vaadin.data.Property<T extends UploadReceiver>
getType
in class com.vaadin.ui.AbstractField<T extends UploadReceiver>
protected void resetDataSource()
protected com.vaadin.ui.HasComponents getRootLayout()
protected void setRootLayout(com.vaadin.ui.HasComponents root)
public void setAllowedMimeTypePattern(String allowedMimeTypePattern)
UploadField
setAllowedMimeTypePattern
in interface UploadField
public void setMaxUploadSize(long maxUploadSize)
UploadField
setMaxUploadSize
in interface UploadField
public void detach()
detach
in interface com.vaadin.server.ClientConnector
detach
in class com.vaadin.ui.AbstractField<T extends UploadReceiver>
Copyright © 2017 Magnolia International Ltd.. All rights reserved.