public class CubaFileUpload extends com.vaadin.ui.AbstractComponent implements com.vaadin.ui.Component.Focusable, UploadComponent, com.vaadin.ui.LegacyComponent
Modifier and Type | Class and Description |
---|---|
static class |
CubaFileUpload.FailedEvent
CubaFileUpload.FailedEvent event is sent when the upload is received, but the reception is interrupted for some
reason.
|
static interface |
CubaFileUpload.FailedListener
Receives events when the uploads are finished, but unsuccessful.
|
static class |
CubaFileUpload.FileExtensionNotAllowedEvent |
static interface |
CubaFileUpload.FileExtensionNotAllowedListener
Receives events when the file extension is not included in
getPermittedExtensions() . |
static class |
CubaFileUpload.FileSizeLimitExceededEvent |
static interface |
CubaFileUpload.FileSizeLimitExceededListener
Receives events when the file size is greater than
getFileSizeLimit() . |
static class |
CubaFileUpload.FinishedEvent
CubaFileUpload.FinishedEvent is sent when the upload receives a file, regardless of whether the reception was
successful or failed.
|
static interface |
CubaFileUpload.FinishedListener
Receives the events when the uploads are ready.
|
static class |
CubaFileUpload.NoInputStreamEvent
FailedEvent that indicates that an input stream could not be obtained.
|
static class |
CubaFileUpload.NoOutputStreamEvent
FailedEvent that indicates that an output stream could not be obtained.
|
static class |
CubaFileUpload.QueueFinishedEvent
CubaFileUpload.StartedEvent event is sent when the queue upload is finished.
|
static interface |
CubaFileUpload.QueueFinishedListener |
static interface |
CubaFileUpload.Receiver
Interface that must be implemented by the upload receivers to provide the CubaFileUpload component an output
stream to write the uploaded data.
|
static class |
CubaFileUpload.StartedEvent
CubaFileUpload.StartedEvent event is sent when the upload is started to received.
|
static interface |
CubaFileUpload.StartedListener
Receives the events when the upload starts.
|
static class |
CubaFileUpload.SucceededEvent
CubaFileUpload.SucceededEvent event is sent when the upload is received successfully.
|
static interface |
CubaFileUpload.SucceededListener
Receives events when the uploads are successfully finished.
|
com.vaadin.server.AbstractClientConnector.IncorrectConcurrentAccessHandler
com.vaadin.ui.Component.ErrorEvent, com.vaadin.ui.Component.Event, com.vaadin.ui.Component.Focusable, com.vaadin.ui.Component.HasContextHelp, 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
Modifier and Type | Field and Description |
---|---|
protected long |
contentLength |
protected boolean |
interrupted |
protected boolean |
isUploading |
protected java.util.Map<java.lang.String,java.lang.String> |
mimeTypes |
protected CubaFileUpload.Receiver |
receiver
The output of the upload is redirected to this receiver.
|
protected com.vaadin.server.StreamVariable |
streamVariable |
Constructor and Description |
---|
CubaFileUpload() |
Modifier and Type | Method and Description |
---|---|
void |
addFailedListener(CubaFileUpload.FailedListener listener) |
void |
addFileExtensionNotAllowedListener(CubaFileUpload.FileExtensionNotAllowedListener listener) |
void |
addFileSizeLimitExceededListener(CubaFileUpload.FileSizeLimitExceededListener listener) |
void |
addFinishedListener(CubaFileUpload.FinishedListener listener) |
void |
addQueueUploadFinishedListener(CubaFileUpload.QueueFinishedListener listener) |
void |
addStartedListener(CubaFileUpload.StartedListener listener) |
void |
addSucceededListener(CubaFileUpload.SucceededListener listener) |
void |
changeVariables(java.lang.Object source,
java.util.Map<java.lang.String,java.lang.Object> variables) |
protected void |
endUpload()
Go into state where new uploading can begin.
|
protected void |
fireFileExtensionNotAllowed(java.lang.String fileName) |
protected void |
fireFileSizeLimitExceeded(java.lang.String fileName) |
protected void |
fireNoInputStream(java.lang.String fileName,
java.lang.String MIMEType,
long length) |
protected void |
fireNoOutputStream(java.lang.String fileName,
java.lang.String MIMEType,
long length) |
protected void |
fireQueueUploadFinished() |
protected void |
fireStarted(java.lang.String fileName,
java.lang.String MIMEType) |
protected void |
fireUploadInterrupted(java.lang.String fileName,
java.lang.String MIMEType,
long length,
java.lang.Exception e) |
protected void |
fireUploadSuccess(java.lang.String fileName,
java.lang.String MIMEType,
long length) |
void |
focus() |
java.lang.String |
getAccept() |
java.lang.String |
getCancelButtonCaption() |
com.vaadin.ui.Component |
getDropZone() |
java.lang.String |
getDropZonePrompt() |
double |
getFileSizeLimit() |
java.lang.String |
getIconAlternateText()
Returns the icon's alt text.
|
com.vaadin.ui.Component |
getPasteZone() |
java.util.Set<java.lang.String> |
getPermittedExtensions() |
java.lang.String |
getProgressWindowCaption() |
CubaFileUpload.Receiver |
getReceiver() |
protected com.haulmont.cuba.web.widgets.client.fileupload.CubaFileUploadState |
getState() |
protected com.haulmont.cuba.web.widgets.client.fileupload.CubaFileUploadState |
getState(boolean markAsDirty) |
protected com.vaadin.server.StreamVariable |
getStreamVariable() |
int |
getTabIndex() |
java.lang.String |
getUnableToUploadFileMessage() |
protected void |
interruptUpload()
Interrupts the upload currently being received.
|
boolean |
isHtmlContentAllowed()
Return HTML rendering setting
|
boolean |
isMultiSelect() |
void |
paintContent(com.vaadin.server.PaintTarget target) |
void |
removeFailedListener(CubaFileUpload.FailedListener listener) |
void |
removeFileExtensionNotAllowedListener(CubaFileUpload.FileExtensionNotAllowedListener listener) |
void |
removeFileSizeLimitExceededListener(CubaFileUpload.FileSizeLimitExceededListener listener) |
void |
removeFinishedListener(CubaFileUpload.FinishedListener listener) |
void |
removeQueueUploadFinishedListener(CubaFileUpload.QueueFinishedListener listener) |
void |
removeStartedListener(CubaFileUpload.StartedListener listener) |
void |
removeSucceededListener(CubaFileUpload.SucceededListener listener) |
protected void |
resetUploadingErrorHandler() |
void |
setAccept(java.lang.String accept)
Note: this is just a hint for browser, user may select files that do not meet this property
|
void |
setCancelButtonCaption(java.lang.String cancelButtonCaption) |
void |
setDropZone(com.vaadin.ui.Component component) |
void |
setDropZonePrompt(java.lang.String dropZonePrompt) |
void |
setFileSizeLimit(long fileSizeLimit) |
void |
setHtmlContentAllowed(boolean htmlContentAllowed)
Set whether the caption text is rendered as HTML or not.
|
void |
setIcon(com.vaadin.server.Resource icon,
java.lang.String iconAltText)
Sets the component's icon and alt text.
|
void |
setIconAlternateText(java.lang.String iconAltText) |
void |
setMultiSelect(boolean multiSelect) |
void |
setPasteZone(com.vaadin.ui.Component component) |
void |
setPermittedExtensions(java.util.Set<java.lang.String> permittedExtensions) |
void |
setProgressWindowCaption(java.lang.String progressWindowCaption) |
void |
setReceiver(CubaFileUpload.Receiver receiver) |
void |
setTabIndex(int tabIndex) |
void |
setUnableToUploadFileMessage(java.lang.String message) |
protected void |
setUploadingErrorHandler() |
protected void |
startUpload()
Go into upload state.
|
addContextClickListener, addContextHelpIconClickListener, addListener, addShortcutListener, addStyleName, attach, beforeClientResponse, detach, ensureContextHelpInitialized, findAncestor, fireComponentErrorEvent, fireComponentEvent, fireContextHelpClick, getActionManager, getCaption, getComponentError, getComponentErrorProvider, getContextHelpText, getCubaId, getCustomAttributes, getData, getDebugId, getDescription, getErrorMessage, getHeight, getHeightUnits, getIcon, getId, getLocale, getParent, getPrimaryStyleName, getRequiredError, getStyleName, getWidth, getWidthUnits, isCaptionAsHtml, isConnectorEnabled, isContextHelpTextHtmlEnabled, isEnabled, isOrHasAncestor, isReadOnly, isRequiredIndicatorVisible, isResponsive, isVisible, readDesign, removeContextClickListener, removeListener, removeShortcutListener, removeStyleName, setCaption, setCaptionAsHtml, setComponentError, setComponentErrorProvider, setContextHelpText, setContextHelpTextHtmlEnabled, setCubaId, setData, setDebugId, setDescription, setDescription, setEnabled, setHeight, setHeight, setHeightUndefined, setIcon, setId, setLocale, setParent, setPrimaryStyleName, setReadOnly, setRequiredError, setRequiredIndicatorVisible, setResponsive, setSizeFull, setSizeUndefined, setStyleName, setVisible, setWidth, setWidth, setWidthUndefined, writeDesign
addAttachListener, addDetachListener, addExtension, addListener, addListener, addListener, addMethodInvocationToQueue, createState, encodeState, equals, fireEvent, getAllChildrenIterable, getConnectorId, getErrorHandler, getExtensions, getIncorrectConcurrentAccessHandler, 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, setConnectorResource, setErrorHandler, setIncorrectConcurrentAccessHandler, setResource, updateDiffstate
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
setDescription
addListener, addStyleName, addStyleNames, attach, getCaption, getCubaId, getDescription, getIcon, getId, getLocale, getParent, getPrimaryStyleName, getStyleName, getUI, isEnabled, isVisible, readDesign, removeListener, removeStyleName, removeStyleNames, setCaption, setCubaId, setEnabled, setIcon, setId, setParent, setPrimaryStyleName, setStyleName, setStyleName, setVisible, writeDesign
addAttachListener, addDetachListener, beforeClientResponse, detach, encodeState, getErrorHandler, getExtensions, getRpcManager, getStateType, handleConnectorRequest, isAttached, isConnectorEnabled, markAsDirty, markAsDirtyRecursive, removeAttachListener, removeDetachListener, removeExtension, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler
protected CubaFileUpload.Receiver receiver
protected boolean isUploading
protected long contentLength
protected java.util.Map<java.lang.String,java.lang.String> mimeTypes
protected boolean interrupted
protected com.vaadin.server.StreamVariable streamVariable
protected void setUploadingErrorHandler()
protected void resetUploadingErrorHandler()
protected com.haulmont.cuba.web.widgets.client.fileupload.CubaFileUploadState getState()
getState
in class com.vaadin.ui.AbstractComponent
protected com.haulmont.cuba.web.widgets.client.fileupload.CubaFileUploadState getState(boolean markAsDirty)
getState
in class com.vaadin.ui.AbstractComponent
public int getTabIndex()
getTabIndex
in interface com.vaadin.ui.Component.Focusable
public void setTabIndex(int tabIndex)
setTabIndex
in interface com.vaadin.ui.Component.Focusable
public java.lang.String getIconAlternateText()
public void setIconAlternateText(java.lang.String iconAltText)
public boolean isHtmlContentAllowed()
true
if the caption text is to be rendered as HTML, false
otherwisepublic void setHtmlContentAllowed(boolean htmlContentAllowed)
If set to true, the captions are passed to the browser as html and the developer is responsible for ensuring no harmful html is used. If set to false, the content is passed to the browser as plain text.
htmlContentAllowed
- true
if caption is rendered as HTML, false
otherwisepublic void setIcon(com.vaadin.server.Resource icon, java.lang.String iconAltText)
An alt text is shown when an image could not be loaded, and read by assistive devices.
icon
- the icon to be shown with the component's caption.iconAltText
- String to use as alt textpublic boolean isMultiSelect()
public void setMultiSelect(boolean multiSelect)
public java.lang.String getUnableToUploadFileMessage()
public void setUnableToUploadFileMessage(java.lang.String message)
public java.lang.String getProgressWindowCaption()
public void setProgressWindowCaption(java.lang.String progressWindowCaption)
public java.lang.String getCancelButtonCaption()
public void setCancelButtonCaption(java.lang.String cancelButtonCaption)
public java.lang.String getAccept()
getAccept
in interface UploadComponent
public void setAccept(java.lang.String accept)
setAccept
in interface UploadComponent
accept
- mime types, comma separatedpublic java.util.Set<java.lang.String> getPermittedExtensions()
public void setPermittedExtensions(java.util.Set<java.lang.String> permittedExtensions)
public double getFileSizeLimit()
public void setFileSizeLimit(long fileSizeLimit)
fileSizeLimit
- file size limit in bytespublic CubaFileUpload.Receiver getReceiver()
public void setReceiver(CubaFileUpload.Receiver receiver)
public com.vaadin.ui.Component getDropZone()
public void setDropZone(com.vaadin.ui.Component component)
public void setPasteZone(com.vaadin.ui.Component component)
public com.vaadin.ui.Component getPasteZone()
public java.lang.String getDropZonePrompt()
public void setDropZonePrompt(java.lang.String dropZonePrompt)
protected com.vaadin.server.StreamVariable getStreamVariable()
protected void startUpload()
Warning: this is an internal method used by the framework and should not be used by user of the Upload component. Using it results in the Upload component going in wrong state and not working. It is currently public because it is used by another class.
protected void interruptUpload()
protected void endUpload()
Warning: this is an internal method used by the framework and should not be used by user of the Upload component.
public void paintContent(com.vaadin.server.PaintTarget target) throws com.vaadin.server.PaintException
paintContent
in interface com.vaadin.ui.LegacyComponent
com.vaadin.server.PaintException
public void changeVariables(java.lang.Object source, java.util.Map<java.lang.String,java.lang.Object> variables)
changeVariables
in interface com.vaadin.server.VariableOwner
protected void fireStarted(java.lang.String fileName, java.lang.String MIMEType)
protected void fireNoInputStream(java.lang.String fileName, java.lang.String MIMEType, long length)
protected void fireNoOutputStream(java.lang.String fileName, java.lang.String MIMEType, long length)
protected void fireUploadInterrupted(java.lang.String fileName, java.lang.String MIMEType, long length, java.lang.Exception e)
protected void fireUploadSuccess(java.lang.String fileName, java.lang.String MIMEType, long length)
protected void fireFileSizeLimitExceeded(java.lang.String fileName)
protected void fireFileExtensionNotAllowed(java.lang.String fileName)
protected void fireQueueUploadFinished()
public void addStartedListener(CubaFileUpload.StartedListener listener)
public void removeStartedListener(CubaFileUpload.StartedListener listener)
public void addFinishedListener(CubaFileUpload.FinishedListener listener)
public void removeFinishedListener(CubaFileUpload.FinishedListener listener)
public void addFailedListener(CubaFileUpload.FailedListener listener)
public void removeFailedListener(CubaFileUpload.FailedListener listener)
public void addSucceededListener(CubaFileUpload.SucceededListener listener)
public void removeSucceededListener(CubaFileUpload.SucceededListener listener)
public void addFileSizeLimitExceededListener(CubaFileUpload.FileSizeLimitExceededListener listener)
public void addFileExtensionNotAllowedListener(CubaFileUpload.FileExtensionNotAllowedListener listener)
public void removeFileExtensionNotAllowedListener(CubaFileUpload.FileExtensionNotAllowedListener listener)
public void removeFileSizeLimitExceededListener(CubaFileUpload.FileSizeLimitExceededListener listener)
public void addQueueUploadFinishedListener(CubaFileUpload.QueueFinishedListener listener)
public void removeQueueUploadFinishedListener(CubaFileUpload.QueueFinishedListener listener)
public void focus()
focus
in interface com.vaadin.ui.Component.Focusable
focus
in class com.vaadin.ui.AbstractComponent