public class WebFileUploadField extends WebAbstractUploadField<CubaFileUploadWrapper> implements FileUploadField
FileUploadField.AfterValueClearEvent, FileUploadField.AfterValueClearListener, FileUploadField.BeforeValueClearEvent, FileUploadField.BeforeValueClearListener, FileUploadField.FileContentProvider, FileUploadField.FileStoragePutMode, FileUploadField.FileUploadSucceedEvent, FileUploadField.FileUploadSucceedListener, FileUploadField.Listener, FileUploadField.ListenerAdapter
UploadField.DropZone, UploadField.FileUploadErrorEvent, UploadField.FileUploadErrorListener, UploadField.FileUploadEvent, UploadField.FileUploadFinishEvent, UploadField.FileUploadFinishListener, UploadField.FileUploadStartEvent, UploadField.FileUploadStartListener
Field.Validator
Component.ActionOwner, Component.ActionsHolder, Component.Alignment, Component.BelongToFrame, Component.Buffered, Component.ChildEditableController, Component.Collapsable, Component.Container, Component.Disposable, Component.Editable, Component.EditableChangeEvent, Component.EditableChangeListener, Component.EditableChangeNotifier, Component.ExpandedStateChangeEvent, Component.ExpandedStateChangeListener, Component.Focusable, Component.HasBorder, Component.HasButtonsPanel, Component.HasCaption, Component.HasFormatter, Component.HasIcon, Component.HasInputPrompt, Component.HasNamedComponents, Component.HasPresentations, Component.HasRowsCount, Component.HasSettings, Component.HasValue, Component.HasXmlDescriptor, Component.LayoutClickEvent, Component.LayoutClickListener, Component.LayoutClickNotifier, Component.Margin, Component.MouseEventDetails, Component.OrderedContainer, Component.OuterMargin, Component.SecuredActionsHolder, Component.ShortcutAction, Component.ShortcutNotifier, Component.ShortcutTriggeredEvent, Component.Spacing, Component.UiPermissionAware, Component.Validatable, Component.ValueChangeEvent, Component.ValueChangeListener, Component.Wrapper
ICON_STYLE, UNIT_SYMBOLS
NAME
AUTO_SIZE, AUTO_SIZE_PX, UNITS_PERCENTAGE, UNITS_PIXELS
Constructor and Description |
---|
WebFileUploadField() |
Modifier and Type | Method and Description |
---|---|
void |
addAfterValueClearListener(FileUploadField.AfterValueClearListener listener) |
void |
addBeforeValueClearListener(FileUploadField.BeforeValueClearListener listener) |
void |
addFileUploadErrorListener(UploadField.FileUploadErrorListener listener) |
void |
addFileUploadFinishListener(UploadField.FileUploadFinishListener listener) |
void |
addFileUploadStartListener(UploadField.FileUploadStartListener listener) |
void |
addFileUploadSucceedListener(FileUploadField.FileUploadSucceedListener listener) |
void |
addListener(FileUploadField.Listener listener) |
void |
commit()
Updates all changes since the previous commit to the data source.
|
void |
discard()
Discards all changes since last commit.
|
java.lang.String |
getAccept()
Returns comma separated types of files.
|
byte[] |
getBytes()
Deprecated.
Please use
getFileId() method and FileUploadingAPI |
java.lang.String |
getClearButtonCaption() |
java.lang.String |
getClearButtonDescription() |
java.lang.String |
getClearButtonIcon() |
FileUploadField.FileContentProvider |
getContentProvider() |
java.io.InputStream |
getFileContent() |
FileDescriptor |
getFileDescriptor() |
java.util.UUID |
getFileId()
Get id for uploaded file in
FileUploading . |
java.lang.String |
getFileName() |
FileUploadField.FileStoragePutMode |
getMode() |
int |
getTabIndex()
Gets the tabulator index of the
HasTabIndex component. |
java.lang.String |
getUploadButtonCaption() |
java.lang.String |
getUploadButtonDescription() |
java.lang.String |
getUploadButtonIcon() |
boolean |
isBuffered() |
boolean |
isModified()
Tests if the value stored in the object has been modified since it was
last updated from the data source.
|
boolean |
isShowClearButton() |
boolean |
isShowFileName() |
void |
removeAfterValueClearListener(FileUploadField.AfterValueClearListener listener) |
void |
removeBeforeValueClearListener(FileUploadField.BeforeValueClearListener listener) |
void |
removeFileUploadErrorListener(UploadField.FileUploadErrorListener listener) |
void |
removeFileUploadFinishListener(UploadField.FileUploadFinishListener listener) |
void |
removeFileUploadStartListener(UploadField.FileUploadStartListener listener) |
void |
removeFileUploadSucceedListener(FileUploadField.FileUploadSucceedListener listener) |
void |
removeListener(FileUploadField.Listener listener) |
void |
setAccept(java.lang.String accept)
Sets the mask for files to filter them in the file selection dialog.
Example: |
void |
setBuffered(boolean buffered)
Sets the buffered mode.
|
void |
setClearButtonCaption(java.lang.String caption)
Setup clear button caption.
|
void |
setClearButtonDescription(java.lang.String description)
Setup clear button description.
|
void |
setClearButtonIcon(java.lang.String icon)
Setup clear button icon.
|
void |
setContentProvider(FileUploadField.FileContentProvider contentProvider)
Set content provider which contains file data.
|
void |
setDropZone(UploadField.DropZone dropZone)
Set drop zone reference to this upload component.
|
void |
setDropZonePrompt(java.lang.String dropZonePrompt)
Set drop zone prompt that will be shown on drag over window with file.
|
void |
setFileSizeLimit(long fileSizeLimit)
Sets maximum allowed file size in bytes.
|
void |
setMode(FileUploadField.FileStoragePutMode mode)
Set mode which determines when
FileDescriptor will be committed. |
void |
setPermittedExtensions(java.util.Set<java.lang.String> permittedExtensions)
Set white list of file extensions.
|
void |
setShowClearButton(boolean showClearButton)
Enable or disable displaying name of clear button.
|
void |
setShowFileName(boolean showFileName)
Enable or disable displaying name of uploaded file next to upload button.
|
void |
setTabIndex(int tabIndex)
Sets the tabulator index of the
Focusable component. |
void |
setUploadButtonCaption(java.lang.String caption)
Setup caption of upload button.
|
void |
setUploadButtonDescription(java.lang.String description)
Setup upload button description.
|
void |
setUploadButtonIcon(java.lang.String icon)
Setup upload button icon.
|
getDropZone, getDropZonePrompt, getFileSizeLimit, getPermittedExtensions
addListener, addValidator, addValueChangeListener, getDatasource, getMetaProperty, getMetaPropertyPath, getRequiredMessage, getValidators, getValue, isEditable, isRequired, isValid, removeListener, removeValidator, removeValueChangeListener, setDatasource, setEditable, setParent, setRequired, setRequiredMessage, setValue, validate
addStyleName, assignAutoDebugId, getAlignment, getCaption, getComponent, getComponentEnabledFlag, getComponentVisibleFlag, getComposition, getDebugId, getDescription, getFrame, getHeight, getHeightUnits, getIcon, getId, getParent, getStyleName, getWidth, getWidthUnits, getXmlDescriptor, isEnabled, isEnabledItself, isResponsive, isVisible, isVisibleItself, removeStyleName, requestFocus, setAlignment, setCaption, setDebugId, setDescription, setEnabled, setFrame, setHeight, setIcon, setId, setResponsive, setStyleName, setVisible, setWidth, setXmlDescriptor, unwrap, unwrapComposition
addListener, addListener, fireEvent, hasListeners, removeListener, removeListener
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getDropZone, getDropZonePrompt, getFileSizeLimit, getPermittedExtensions
isFocusable, setFocusable
addValidator, getRequiredMessage, getValidators, isRequired, removeValidator, setRequired, setRequiredMessage
getDatasource, getMetaProperty, getMetaPropertyPath, setDatasource
addListener, addValueChangeListener, getValue, removeListener, removeValueChangeListener, setValue
isEditable, isEditableWithParent, setEditable
getFrame, setFrame
addStyleName, getAlignment, getDebugId, getHeight, getHeightUnits, getId, getParent, getStyleName, getWidth, getWidthUnits, isEnabled, isEnabledItself, isResponsive, isVisible, isVisibleItself, removeStyleName, requestFocus, setAlignment, setDebugId, setEnabled, setHeight, setHeightAuto, setHeightFull, setId, setParent, setResponsive, setSizeAuto, setSizeFull, setStyleName, setVisible, setWidth, setWidthAuto, setWidthFull, unwrap, unwrapComposition
getCaption, getDescription, setCaption, setDescription
isValid, isValidateOnCommit, validate
getIcon, setIcon
public java.lang.String getFileName()
getFileName
in interface FileUploadField
public void addListener(FileUploadField.Listener listener)
addListener
in interface FileUploadField
public void removeListener(FileUploadField.Listener listener)
removeListener
in interface FileUploadField
@Deprecated public byte[] getBytes()
getFileId()
method and FileUploadingAPI
getBytes
in interface FileUploadField
public java.util.UUID getFileId()
FileUploadField
FileUploading
.getFileId
in interface FileUploadField
FileUploadingAPI
public FileDescriptor getFileDescriptor()
getFileDescriptor
in interface FileUploadField
public java.lang.String getAccept()
UploadField
getAccept
in interface UploadField
public void setAccept(java.lang.String accept)
UploadField
fileUpload.setAccept(".png,.jpeg")
setAccept
in interface UploadField
accept
- comma separated types of filespublic void setDropZone(UploadField.DropZone dropZone)
UploadField
setDropZone
in interface UploadField
setDropZone
in class WebAbstractUploadField<CubaFileUploadWrapper>
dropZone
- drop zone descriptorpublic void setDropZonePrompt(java.lang.String dropZonePrompt)
UploadField
setDropZonePrompt
in interface UploadField
setDropZonePrompt
in class WebAbstractUploadField<CubaFileUploadWrapper>
dropZonePrompt
- drop zone promptpublic void addFileUploadStartListener(UploadField.FileUploadStartListener listener)
addFileUploadStartListener
in interface UploadField
public void removeFileUploadStartListener(UploadField.FileUploadStartListener listener)
removeFileUploadStartListener
in interface UploadField
public void addFileUploadFinishListener(UploadField.FileUploadFinishListener listener)
addFileUploadFinishListener
in interface UploadField
public void removeFileUploadFinishListener(UploadField.FileUploadFinishListener listener)
removeFileUploadFinishListener
in interface UploadField
public void addFileUploadErrorListener(UploadField.FileUploadErrorListener listener)
addFileUploadErrorListener
in interface UploadField
public void removeFileUploadErrorListener(UploadField.FileUploadErrorListener listener)
removeFileUploadErrorListener
in interface UploadField
public void addFileUploadSucceedListener(FileUploadField.FileUploadSucceedListener listener)
addFileUploadSucceedListener
in interface FileUploadField
public void removeFileUploadSucceedListener(FileUploadField.FileUploadSucceedListener listener)
removeFileUploadSucceedListener
in interface FileUploadField
public java.io.InputStream getFileContent()
getFileContent
in interface FileUploadField
public void setContentProvider(FileUploadField.FileContentProvider contentProvider)
FileUploadField
Passed content provider will be used for downloading by clicking the link with file name
or as source for FileUploadField.getFileContent()
method.
setContentProvider
in interface FileUploadField
contentProvider
- content providerpublic FileUploadField.FileContentProvider getContentProvider()
getContentProvider
in interface FileUploadField
public void setFileSizeLimit(long fileSizeLimit)
UploadField
setFileSizeLimit
in interface UploadField
public FileUploadField.FileStoragePutMode getMode()
getMode
in interface FileUploadField
FileDescriptor
will be commited.public void setMode(FileUploadField.FileStoragePutMode mode)
FileUploadField
FileDescriptor
will be committed.setMode
in interface FileUploadField
public boolean isShowFileName()
isShowFileName
in interface FileUploadField
public void setShowFileName(boolean showFileName)
FileUploadField
setShowFileName
in interface FileUploadField
public void setPermittedExtensions(java.util.Set<java.lang.String> permittedExtensions)
UploadField
private FileUploadField uploadField;
...
uploadField.setPermittedExtensions(Sets.newHashSet(".png", ".jpg"));
setPermittedExtensions
in interface UploadField
setPermittedExtensions
in class WebAbstractUploadField<CubaFileUploadWrapper>
permittedExtensions
- permitted extensions.public void setShowClearButton(boolean showClearButton)
FileUploadField
setShowClearButton
in interface FileUploadField
public boolean isShowClearButton()
isShowClearButton
in interface FileUploadField
public void setClearButtonCaption(java.lang.String caption)
FileUploadField
setClearButtonCaption
in interface FileUploadField
public java.lang.String getClearButtonCaption()
getClearButtonCaption
in interface FileUploadField
public void setClearButtonIcon(java.lang.String icon)
FileUploadField
setClearButtonIcon
in interface FileUploadField
public java.lang.String getClearButtonIcon()
getClearButtonIcon
in interface FileUploadField
public void setClearButtonDescription(java.lang.String description)
FileUploadField
setClearButtonDescription
in interface FileUploadField
public java.lang.String getClearButtonDescription()
getClearButtonDescription
in interface FileUploadField
public void addBeforeValueClearListener(FileUploadField.BeforeValueClearListener listener)
addBeforeValueClearListener
in interface FileUploadField
public void removeBeforeValueClearListener(FileUploadField.BeforeValueClearListener listener)
removeBeforeValueClearListener
in interface FileUploadField
public void addAfterValueClearListener(FileUploadField.AfterValueClearListener listener)
addAfterValueClearListener
in interface FileUploadField
public void removeAfterValueClearListener(FileUploadField.AfterValueClearListener listener)
removeAfterValueClearListener
in interface FileUploadField
public void setUploadButtonCaption(java.lang.String caption)
FileUploadField
setUploadButtonCaption
in interface FileUploadField
public java.lang.String getUploadButtonCaption()
getUploadButtonCaption
in interface FileUploadField
public void setUploadButtonIcon(java.lang.String icon)
FileUploadField
setUploadButtonIcon
in interface FileUploadField
public java.lang.String getUploadButtonIcon()
getUploadButtonIcon
in interface FileUploadField
public void setUploadButtonDescription(java.lang.String description)
FileUploadField
setUploadButtonDescription
in interface FileUploadField
public java.lang.String getUploadButtonDescription()
getUploadButtonDescription
in interface FileUploadField
public int getTabIndex()
Component.Focusable
HasTabIndex
component.getTabIndex
in interface Component.Focusable
HasTabIndex
componentpublic void setTabIndex(int tabIndex)
Component.Focusable
Focusable
component.
The tab index property is used to specify the order in which the
fields are focused when the user presses the Tab key. Components with
a defined tab index are focused sequentially first, and then the
components with no tab index.setTabIndex
in interface Component.Focusable
tabIndex
- tab indexpublic void commit()
Component.Buffered
commit
in interface Component.Buffered
public void discard()
Component.Buffered
discard
in interface Component.Buffered
public boolean isBuffered()
isBuffered
in interface Component.Buffered
true
if buffered mode is on, false
otherwisepublic void setBuffered(boolean buffered)
Component.Buffered
When in buffered mode, an internal buffer will be used to store changes
until Component.Buffered.commit()
is called. Calling Component.Buffered.discard()
will revert
the internal buffer to the value of the data source.
When in non-buffered mode both read and write operations will be done
directly on the data source. In this mode the Component.Buffered.commit()
and
Component.Buffered.discard()
methods serve no purpose.
setBuffered
in interface Component.Buffered
buffered
- true
if buffered mode should be turned on, false
otherwisepublic boolean isModified()
Component.Buffered
isModified
in interface Component.Buffered
true
if the value in the object has been modified
since the last data source update, false
if not.