Package lumis.doui.control.fileupload
Class FileUploadControl
- java.lang.Object
-
- lumis.doui.control.Control
-
- lumis.doui.control.DataControl
-
- lumis.doui.control.DataBoundControl
-
- lumis.doui.control.fileupload.FileUploadControl
-
- All Implemented Interfaces:
Observer
,VariableResolver
,IControl
,IDataBoundControl
,IDataControl
,IRenderer
public class FileUploadControl extends DataBoundControl
Doui control that allows the upload of files to the portal.Behavior, according to the request parameters:
-
Parameter
<control id>_prevFileId
must contain the original fileId if the control currently has a file data value. -
If the parameter
<control id>_clearFile
has value equals totrue
, then this control's datafullPath
is set tonull
, to indicate that the file should be removed, and the upload is ignored. -
Else if the parameter, whose name is specified in the xml
filenameField
tag, is present, the current file (if present) is renamed to the parameter's value. -
Else if a file is uploaded with the parameter name equals to this control's id,
and there is no previous file or the parameter
<control id>_replaceFile
has value equals totrue
, then the control's value will be changed to the uploaded file. -
If the parameter
<control id>_clearFile
has value equals tofalse
, then case the parameter<control id>.applyImageEdition
has value equals totrue
and there is no previous file or the parameter<control id>_replaceFile
has value equals tofalse
, then the control's value will be set with the file created from an image edition.
Example use:Remove File not found File Removed Cancel Upload Download Edit Image Cancel Editing Image (Edited) imageFile - Since:
- 4.0.0
- Version:
- $Revision: 20825 $ $Date: 2017-12-11 14:43:21 -0200 (Mon, 11 Dec 2017) $
-
-
Field Summary
-
Fields inherited from class lumis.doui.control.DataControl
FORCE_CASE_LOWER, FORCE_CASE_NONE, FORCE_CASE_UPPER, forceCase, requestParameterName, UNKNOWN_DATA_TYPE, value, valuePreviouslySet
-
Fields inherited from class lumis.doui.control.Control
childControls, controlContainer, controlDefinitionNode, controlResource, douiContext, hasValidatorSubControls, isValid, locale, ON_EVENT_CLOSE_WINDOW, ON_EVENT_LINK, ON_EVENT_POPUP_LINK_OR_RUNTIME_INTERFACE, ON_EVENT_POPUP_RUNTIME_INTERFACE, ON_EVENT_PROCESS_ACTION, ON_EVENT_RENDER_ACTION, ON_EVENT_REPLACE_INTERFACE, ON_EVENT_SCRIPT, ON_EVENT_VALIDATE, onEventScripts, PARAMETER_TYPE_FIRST_SELECTED, PARAMETER_TYPE_GET_VALUE, parentControl, resources, type, VALIDATION_SELECTED_MANY, VALIDATION_SELECTED_ONE
-
-
Constructor Summary
Constructors Constructor Description FileUploadControl()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addImageEditorControls()
Add controls for the image edition functionality.void
buildSubControls()
protected File
getEditedImageFile()
Returns the edited image file or null if it does not exist.protected String
getFilenameParameterName(String fieldId)
static String
getImageEditionFolderPath(SessionConfig sessionConfig, String imageEditionId)
Returns the image edition folder path of the given image edition id.IDataControlRequestHelpDefinition
getRequestHelpDefinition()
Returns the request parameters help definition.protected Map<String,String>
getStringsToLocalize()
protected Class
getValueClass()
Returns the class the possible values of this control are assignable to.void
init(Node controlDefinitionNode, ControlContainer controlContainer, IControl parentControl)
void
loadFromRequest()
void
setRenderData()
-
Methods inherited from class lumis.doui.control.DataBoundControl
autoAddDateTimeValueValidator, autoAddDoubleValueValidator, autoAddFileSizeValidator, autoAddIntegerValueValidator, autoAddLengthValidator, autoAddLongValueValidator, autoAddRequiredValueValidator, autoAddValidators, createConverter, createDataType, getDataId, getFieldName, getProcessActionHandlerParameterName, getReload, getRuntimeDefaultSource, getSource, getSourceById, getSourceContext, getUnboundedConverter, setDefaultValue, setRawValue, setReload, setSourceParameter, setValid, setValueFromSource, setValueFromSource, update
-
Methods inherited from class lumis.doui.control.DataControl
convertValueToControlValue, getConverter, getDataType, getDefaultValue, getParameterValue, getProcessActionIds, getRequestParameterName, getValue, getValue, initProcessActionIds, isTrim, loadSubControlFromRequest, loadSubControlsFromRequest, setProcessActionHandlerParameter, setProcessActionHandlerParameter, setProcessActionHandlerParameters, setSourceParameter, setSourceParameters, setTrim, setValue, valueIsArray
-
Methods inherited from class lumis.doui.control.Control
appendSubControl, appendSubControls, applyOnEventScripts, convertToStandardValue, createContainer, disconnect, fixedIdentifierRequired, generateControlId, generateControlIdPrefix, getAdditionalParameters, getAdditionalParameters, getAncestor, getChildControls, getClientEventHandlerScript, getControlResource, getId, getLocale, getName, getNamespace, getParentControl, getPrepareForReadScript, getRenderData, getResources, getScriptActionValidation, getType, getValidationScript, getWindowProperties, getWindowProperties, isRequired, isValid, localize, localizeStrings, processCustomTags, registerOnEventScript, removeChild, removeChildren, resolveVariable, setName, setRuntimeAttributes
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface lumis.doui.control.IControl
createContainer, disconnect, getChildControls, getControlResource, getId, getName, getParentControl, getPrepareForReadScript, getRenderData, getResources, getType, isValid, registerOnEventScript, removeChild, removeChildren, setRuntimeAttributes
-
Methods inherited from interface lumis.doui.control.IDataControl
getConverter, getProcessActionIds, getValue, getValue, setProcessActionHandlerParameters, setValue
-
Methods inherited from interface lumis.doui.render.IRenderer
getResources
-
-
-
-
Method Detail
-
init
public void init(Node controlDefinitionNode, ControlContainer controlContainer, IControl parentControl) throws PortalException
- Specified by:
init
in interfaceIControl
- Overrides:
init
in classDataBoundControl
- Throws:
PortalException
-
buildSubControls
public void buildSubControls() throws PortalException
- Specified by:
buildSubControls
in interfaceIControl
- Overrides:
buildSubControls
in classDataBoundControl
- Throws:
PortalException
-
addImageEditorControls
protected void addImageEditorControls() throws PortalException
Add controls for the image edition functionality.
xml data available for xsl rendering:lumis.service.doui.fileupload.editimage.editimage - Throws:
PortalException
- Since:
- 8.1.0
-
getValueClass
protected Class getValueClass() throws PortalException
Description copied from class:DataControl
Returns the class the possible values of this control are assignable to.This default implementation uses
IDouiDataType.getValueClass()
of the data type of this control.- Overrides:
getValueClass
in classDataControl
- Returns:
- the class the possible values of this control are assignable to.
- Throws:
PortalException
-
loadFromRequest
public void loadFromRequest() throws PortalException
- Specified by:
loadFromRequest
in interfaceIDataControl
- Overrides:
loadFromRequest
in classDataBoundControl
- Throws:
PortalException
-
setRenderData
public void setRenderData() throws PortalException
- Specified by:
setRenderData
in interfaceIControl
- Overrides:
setRenderData
in classDataBoundControl
- Throws:
PortalException
-
getEditedImageFile
protected File getEditedImageFile() throws UnexpectedException
Returns the edited image file or null if it does not exist.- Returns:
- the edited image file or null if it does not exist.
- Throws:
UnexpectedException
- Since:
- 8.1.0
-
getImageEditionFolderPath
public static String getImageEditionFolderPath(SessionConfig sessionConfig, String imageEditionId)
Returns the image edition folder path of the given image edition id.- Parameters:
sessionConfig
- the user's session.imageEditionId
- the image edition id- Returns:
- the image edition folder path of the given image edition id.
- Since:
- 8.1.0
-
getStringsToLocalize
protected Map<String,String> getStringsToLocalize()
- Overrides:
getStringsToLocalize
in classControl
-
getRequestHelpDefinition
public IDataControlRequestHelpDefinition getRequestHelpDefinition() throws PortalException
Description copied from interface:IDataControl
Returns the request parameters help definition. Used in process action REST API help. Must not return null.- Specified by:
getRequestHelpDefinition
in interfaceIDataControl
- Overrides:
getRequestHelpDefinition
in classDataBoundControl
- Returns:
- the request parameters help definition. Used in process action REST API help. Must not return null.
- Throws:
PortalException
-
-