T
- UploadReceiver
implemented class.public abstract class AbstractUploadField<T extends UploadReceiver> extends com.vaadin.v7.ui.CustomField<T> implements com.vaadin.v7.ui.Upload.StartedListener, com.vaadin.v7.ui.Upload.FinishedListener, com.vaadin.v7.ui.Upload.ProgressListener, com.vaadin.v7.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.
|
protected static class |
AbstractUploadField.UploadStatus
Simple Enumeration listing all available Interruption reason.
|
com.vaadin.v7.ui.AbstractField.FocusShortcut, com.vaadin.v7.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.v7.ui.Field.ValueChangeEvent
com.vaadin.v7.data.Buffered.SourceException
com.vaadin.v7.data.Property.Editor, com.vaadin.v7.data.Property.ReadOnlyException, com.vaadin.v7.data.Property.ReadOnlyStatusChangeListener, com.vaadin.v7.data.Property.ReadOnlyStatusChangeNotifier, com.vaadin.v7.data.Property.Transactional<T>, com.vaadin.v7.data.Property.ValueChangeListener, com.vaadin.v7.data.Property.ValueChangeNotifier, com.vaadin.v7.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.v7.ui.Upload |
getUpload() |
protected void |
interruptUpload(AbstractUploadField.InterruptionReason reason)
Interrupt upload based on a user Action.
|
protected boolean |
isValidFile(com.vaadin.v7.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.v7.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.v7.ui.Upload.FailedEvent event) |
void |
uploadFinished(com.vaadin.v7.ui.Upload.FinishedEvent event)
Handle the
Upload.FinishedEvent . |
void |
uploadStarted(com.vaadin.v7.ui.Upload.StartedEvent event)
Start Upload if the file is supported.
|
attach, focus, getContent, getTabIndex, initContent, iterator, setFocusDelegate, setHeight, setTabIndex, setWidth
addListener, addListener, addReadOnlyStatusChangeListener, addValidator, addValueChangeListener, beforeClientResponse, clear, commit, discard, fireReadOnlyStatusChange, fireValueChange, getConversionError, getConversionError, getConvertedValue, getConverter, getCurrentBufferedSourceException, getCustomAttributes, getErrorMessage, getInternalValue, getModelType, getPropertyDataSource, getRequiredError, getState, getState, getValidators, getValue, isBuffered, isEmpty, 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, setValidationVisible, setValue, setValue, setValue, shouldHideErrors, validate, validate, valueChange, writeDesign
getExplicitImmediateValue, isImmediate, setImmediate
addContextClickListener, addListener, addShortcutListener, addStyleName, findAncestor, fireComponentErrorEvent, fireComponentEvent, getActionManager, getCaption, getComponentError, getData, getDebugId, getDescription, getHeight, getHeightUnits, getIcon, getId, getLocale, getParent, getPrimaryStyleName, getStyleName, getWidth, getWidthUnits, isCaptionAsHtml, isConnectorEnabled, isEnabled, isOrHasAncestor, isRequiredIndicatorVisible, isResponsive, isVisible, removeContextClickListener, removeListener, removeShortcutListener, removeStyleName, setCaption, setCaptionAsHtml, setComponentError, setData, setDebugId, setDescription, setDescription, setEnabled, setHeight, setHeightFull, setHeightUndefined, setIcon, setId, setParent, setPrimaryStyleName, setRequiredIndicatorVisible, setResponsive, setSizeFull, setSizeUndefined, setStyleName, setVisible, setWidth, setWidthFull, setWidthUndefined
addAttachListener, addDetachListener, addExtension, addListener, addListener, addListener, 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, removeListener, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler, setResource, updateDiffstate
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
addListener, addStyleName, addStyleNames, getCaption, getDescription, getIcon, getId, getLocale, getParent, getPrimaryStyleName, getStyleName, getUI, isEnabled, isVisible, readDesign, removeListener, removeStyleName, removeStyleNames, setCaption, setEnabled, setIcon, setId, setParent, setPrimaryStyleName, setStyleName, 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, setHeightFull, setHeightUndefined, setSizeFull, setSizeUndefined, setWidth, setWidthFull, 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.v7.ui.AbstractField<T extends UploadReceiver>
public void setPropertyDataSource(com.vaadin.v7.data.Property newDataSource)
setPropertyDataSource
in interface com.vaadin.v7.data.Property.Viewer
setPropertyDataSource
in class com.vaadin.v7.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.v7.ui.Upload.StartedEvent event)
protected com.vaadin.v7.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.v7.ui.Upload.StartedEvent event)
uploadStarted
in interface com.vaadin.v7.ui.Upload.StartedListener
public void updateProgress(long readBytes, long contentLength)
updateProgress
in interface com.vaadin.v7.ui.Upload.ProgressListener
public void uploadFinished(com.vaadin.v7.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.v7.ui.Upload.FinishedListener
public void uploadFailed(com.vaadin.v7.ui.Upload.FailedEvent event)
uploadFailed
in interface com.vaadin.v7.ui.Upload.FailedListener
public Class getType()
getType
in interface com.vaadin.v7.data.Property<T extends UploadReceiver>
getType
in class com.vaadin.v7.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.v7.ui.AbstractField<T extends UploadReceiver>
Copyright © 2021 Magnolia International Ltd.. All rights reserved.