|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.olat.core.gui.components.form.flexible.impl.FormItemImpl
org.olat.core.gui.components.form.flexible.impl.elements.FileElementImpl
public class FileElementImpl
Implementation of the file element. See the interface for more documentation.
The class implements the disposable interface to cleanup temporary files on form disposal.
Initial Date: 08.12.2008
| Field Summary |
|---|
| Fields inherited from interface org.olat.core.gui.components.form.flexible.elements.FileElement |
|---|
UPLOAD_ONE_MEGABYTE, UPLOAD_UNLIMITED |
| Fields inherited from interface org.olat.core.gui.components.form.flexible.FormItem |
|---|
ERRORC, EXAMPLEC, LABELC |
| Fields inherited from interface org.olat.core.gui.components.form.flexible.FormBaseComponentIdProvider |
|---|
DISPPREFIX |
| Constructor Summary | |
|---|---|
FileElementImpl(java.lang.String name)
Constructor for a file element. |
|
| Method Summary | |
|---|---|
void |
dispose()
disposes the disposable |
void |
evalFormRequest(UserRequest ureq)
gets called if the implementing component is part of a form which gets partly submitted -> extract data for you and store it temporarly for redisplay without a validation |
java.io.File |
getInitialFile()
Get the initial file value |
int |
getMaxUploadSizeKB()
|
java.util.Set<java.lang.String> |
getMimeTypeLimitations()
Get the set of the mime types limitation |
java.io.File |
getUploadFile()
Use the upload file only for temporary checks on the file. |
java.lang.String |
getUploadFileName()
|
java.io.InputStream |
getUploadInputStream()
Get the input stream of the uploaded file to copy it to some other place |
java.lang.String |
getUploadMimeType()
|
long |
getUploadSize()
Get the size of the uploaded file |
boolean |
isUploadSuccess()
|
void |
limitToMimeType(java.util.Set<java.lang.String> mimeTypes,
java.lang.String i18nErrKey,
java.lang.String[] i18nArgs)
Set a mime type limitation on which files are allowed in the upload process. |
java.io.File |
moveUploadFileTo(java.io.File destinationDir)
Move the uploaded file from the temporary location to the given destination directory. |
void |
reset()
reset the data in the field to a initial/predefined value. |
void |
setInitialFile(java.io.File initialFile)
Set an initial value for the file element. |
void |
setMandatory(boolean mandatory,
java.lang.String i18nErrKey)
Set this form element mandatory. |
void |
setMaxUploadSizeKB(int maxUploadSizeKB,
java.lang.String i18nErrKey,
java.lang.String[] i18nArgs)
Set the KB that are allowed in the file upload. |
void |
validate(java.util.List validationResults)
validate the data in the field, create error messages or update any component. |
| Methods inherited from class org.olat.core.gui.components.form.flexible.impl.FormItemImpl |
|---|
addActionListener, clearError, doDispatchFormRequest, getAction, getActionListenersFor, getComponent, getEmptyDisplayText, getErrorC, getErrorText, getExampleC, getExampleText, getFormDispatchId, getLabelC, getLabelText, getName, getRootForm, getTranslator, getUserObject, hasError, hasExample, hasFocus, hasLabel, isEnabled, isInlineEditingOn, isMandatory, isVisible, setEmptyDisplayText, setEnabled, setErrorComponent, setErrorKey, setExampleKey, setFocus, setLabel, setLabelComponent, setMandatory, setRootForm, setTranslator, setUserObject, setVisible, showError, showExample, showLabel, toString |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.olat.core.gui.components.form.flexible.FormItem |
|---|
addActionListener, clearError, doDispatchFormRequest, getAction, getActionListenersFor, getComponent, getErrorC, getErrorText, getExampleC, getExampleText, getLabelC, getLabelText, getName, getRootForm, getTranslator, getUserObject, hasError, hasExample, hasFocus, hasLabel, isEnabled, isMandatory, isVisible, setEnabled, setErrorComponent, setErrorKey, setExampleKey, setFocus, setLabel, setLabelComponent, setMandatory, setRootForm, setTranslator, setUserObject, setVisible, showError, showExample, showLabel |
| Methods inherited from interface org.olat.core.gui.components.form.flexible.FormBaseComponentIdProvider |
|---|
getFormDispatchId |
| Constructor Detail |
|---|
public FileElementImpl(java.lang.String name)
name - | Method Detail |
|---|
public void evalFormRequest(UserRequest ureq)
FormItemImpl
evalFormRequest in interface FormItemevalFormRequest in class FormItemImplFormItemImpl.evalFormRequest(org.olat.core.gui.UserRequest)public void reset()
FormItem
reset in interface FormItemreset in class FormItemImplFormItemImpl.reset()
public void setMandatory(boolean mandatory,
java.lang.String i18nErrKey)
FileElement
setMandatory in interface FileElementmandatory - true: is mandatory; false: is optionali18nErrKey - i18n key used in case user did not upload somethingFileElement.setMandatory(boolean,
java.lang.String)public void validate(java.util.List validationResults)
FormItemThis method must be implemented by a specialised form item provider.
validate in interface FormItemvalidate in class FormItemImplFormItemImpl.validate(java.util.List)public void setInitialFile(java.io.File initialFile)
FileElement
setInitialFile in interface FileElementFileElement.setInitialFile(java.io.File)public java.io.File getInitialFile()
FileElement
getInitialFile in interface FileElementFileElement.getInitialFile()
public void limitToMimeType(java.util.Set<java.lang.String> mimeTypes,
java.lang.String i18nErrKey,
java.lang.String[] i18nArgs)
FileElement
limitToMimeType in interface FileElementi18nErrKey - i18n key used in case user uploaded wrong filesi18nArgs - optional arguments for thei18nErrKeyFileElement.limitToMimeType(java.util.Set,
java.lang.String, java.lang.String[])public java.util.Set<java.lang.String> getMimeTypeLimitations()
FileElement
getMimeTypeLimitations in interface FileElementFileElement.getMimeTypeLimitations()
public void setMaxUploadSizeKB(int maxUploadSizeKB,
java.lang.String i18nErrKey,
java.lang.String[] i18nArgs)
FileElement
setMaxUploadSizeKB in interface FileElementmaxUploadSizeKB - max file size in KBi18nErrKey - i18n key used in case user uploaded to big filei18nArgs - optional arguments for thei18nErrKeyFileElement.setMaxUploadSizeKB(int,
java.lang.String, java.lang.String[])public int getMaxUploadSizeKB()
getMaxUploadSizeKB in interface FormMultipartItemFormMultipartItem.getMaxUploadSizeKB()public boolean isUploadSuccess()
isUploadSuccess in interface FileElementFileElement.isUploadSuccess()public java.lang.String getUploadFileName()
getUploadFileName in interface FileElementFileElement.getUploadFileName()public java.lang.String getUploadMimeType()
getUploadMimeType in interface FileElementFileElement.getUploadMimeType()public java.io.File getUploadFile()
FileElement
getUploadFile in interface FileElementFileElement.getUploadFile()public java.io.InputStream getUploadInputStream()
FileElement
getUploadInputStream in interface FileElementFileElement.getUploadInputStream()public long getUploadSize()
FileElement
getUploadSize in interface FileElementFileElement.getUploadSize()public java.io.File moveUploadFileTo(java.io.File destinationDir)
FileElementIf in the destination a file with the given name does already exist, rename the file accordingly
moveUploadFileTo in interface FileElementFileElement.moveUploadFileTo(java.io.File)public void dispose()
Disposable
dispose in interface DisposableDisposable.dispose()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||