Package lumis.doui.control
Class DataControl
- java.lang.Object
-
- lumis.doui.control.Control
-
- lumis.doui.control.DataControl
-
- All Implemented Interfaces:
VariableResolver
,IControl
,IDataControl
,IRenderer
- Direct Known Subclasses:
AutoRefreshControl
,CalendarControl
,DataBoundControl
,ErrorSummaryControl
,LanguageFilterControl
,PublisherFiltersAutoLayoutFieldsControl
,TabbedControl
,XslEditorControl
@StableMinor(version="14.1", sinceVersion="4.0") public abstract class DataControl extends Control implements IDataControl, IRenderer
Base implementation forIDataControl
- Since:
- 4.0.0
- Version:
- $Revision: 24684 $ $Date: 2021-08-23 18:58:35 -0300 (Mon, 23 Aug 2021) $
-
-
Field Summary
Fields Modifier and Type Field Description static String
FORCE_CASE_LOWER
static String
FORCE_CASE_NONE
static String
FORCE_CASE_UPPER
protected String
forceCase
protected String
requestParameterName
protected IDouiDataType
UNKNOWN_DATA_TYPE
The instance used for dataType for controls for which the data type is not known.protected Object
value
protected boolean
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 DataControl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Object
convertValueToControlValue(Object value, Locale locale, String pattern)
Method to centralize the implementation of conversion of a value to this control's value.protected IConverter
createConverter()
Creates the converter instance for this control.protected IDouiDataType
createDataType()
Creates the data type to be used for this control.IConverter
getConverter()
Returns the converter that is able to convert this control's value.protected IDouiDataType
getDataType()
Returns the data type for this control.protected Object
getDefaultValue()
protected Object
getParameterValue(String parameterName)
Returns the value for this control, reading from request the parameters based on the specified name.protected String
getProcessActionHandlerParameterName()
Define the name of the process action parameter to be set.Set<String>
getProcessActionIds()
Returns the process action identifiers for which this control sets parameters to.protected String
getRequestParameterName()
Object
getValue()
<T> T
getValue(Class<T> expectedClass)
protected Class<?>
getValueClass()
Returns the class the possible values of this control are assignable to.void
init(Node controlDefinitionNode, ControlContainer controlContainer, IControl parentControl)
protected void
initProcessActionIds()
Initializes the attributeprocessActionIds
.protected boolean
isTrim()
Returns if the value for this control should be trimmed.void
loadFromRequest()
protected void
loadSubControlFromRequest(IControl control)
protected void
loadSubControlsFromRequest()
protected void
setDefaultValue()
protected void
setProcessActionHandlerParameter(IProcessActionHandler processActionHandler, String parameterName)
Set the process action parameter with the control current value.protected void
setProcessActionHandlerParameter(IProcessActionHandler processActionHandler, String parameterName, Object value)
Set the process action parameter name and value.void
setProcessActionHandlerParameters(IProcessActionHandler processActionHandler)
Sets the control value as a process action handler parameter.protected void
setRawValue(Object value)
Sets directly the value in this control.protected void
setSourceParameter(String parameterName, String sourceId)
Set the parameter with the given name in source with the given identifier.protected void
setSourceParameter(Source source, String parameterName)
Sets the parameter with the given name in the given source.protected void
setSourceParameters()
Sets the appropriate source parameters.protected void
setTrim(boolean trim)
Sets if the value for this control should be trimmed.void
setValue(Object value)
Sets the value for this control.boolean
valueIsArray()
Returns true if the value in the control is expected to be an array.-
Methods inherited from class lumis.doui.control.Control
appendSubControl, appendSubControls, applyOnEventScripts, buildSubControls, convertToStandardValue, createContainer, disconnect, fixedIdentifierRequired, generateControlId, generateControlIdPrefix, getAdditionalParameters, getAdditionalParameters, getAncestor, getChildControls, getClientEventHandlerScript, getControlResource, getId, getLocale, getName, getNamespace, getParentControl, getPrepareForReadScript, getRenderData, getResources, getRuntimeDefaultSource, getScriptActionValidation, getSourceContext, getStringsToLocalize, getType, getValidationScript, getWindowProperties, getWindowProperties, isRequired, isValid, localize, localizeStrings, processCustomTags, registerOnEventScript, removeChild, removeChildren, resolveVariable, setName, setRenderData, setRuntimeAttributes, setValid
-
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
buildSubControls, createContainer, disconnect, getChildControls, getControlResource, getId, getName, getParentControl, getPrepareForReadScript, getRenderData, getResources, getType, isValid, registerOnEventScript, removeChild, removeChildren, setRenderData, setRuntimeAttributes, setValid
-
Methods inherited from interface lumis.doui.control.IDataControl
getRequestHelpDefinition
-
Methods inherited from interface lumis.doui.render.IRenderer
getResources, getSourceContext
-
-
-
-
Field Detail
-
FORCE_CASE_NONE
public static final String FORCE_CASE_NONE
- See Also:
- Constant Field Values
-
FORCE_CASE_UPPER
public static final String FORCE_CASE_UPPER
- See Also:
- Constant Field Values
-
FORCE_CASE_LOWER
public static final String FORCE_CASE_LOWER
- See Also:
- Constant Field Values
-
UNKNOWN_DATA_TYPE
protected final IDouiDataType UNKNOWN_DATA_TYPE
The instance used for dataType for controls for which the data type is not known.- Since:
- 4.0.10
- See Also:
createDataType()
,getDataType()
-
forceCase
protected String forceCase
-
value
protected Object value
-
valuePreviouslySet
protected boolean valuePreviouslySet
-
requestParameterName
protected String requestParameterName
-
-
Method Detail
-
init
public void init(Node controlDefinitionNode, ControlContainer controlContainer, IControl parentControl) throws PortalException
- Specified by:
init
in interfaceIControl
- Overrides:
init
in classControl
- Throws:
PortalException
-
initProcessActionIds
protected void initProcessActionIds() throws PortalException
Initializes the attributeprocessActionIds
.- Throws:
PortalException
- Since:
- 5.0.0
-
getProcessActionIds
public Set<String> getProcessActionIds() throws PortalException
Description copied from interface:IDataControl
Returns the process action identifiers for which this control sets parameters to. A return value of null indicates that the control sets parameters in all process action handlers.- Specified by:
getProcessActionIds
in interfaceIDataControl
- Returns:
- the set of process action identifiers.
- Throws:
PortalException
-
createDataType
protected IDouiDataType createDataType() throws PortalException
Creates the data type to be used for this control.- Returns:
- the data type to be used for this control, or null if this control does not knows which data type to use.
- Throws:
PortalException
- Since:
- 4.0.10
-
getDataType
protected final IDouiDataType getDataType()
Returns the data type for this control. If the data type for this control is not known,UNKNOWN_DATA_TYPE
is returned.- Returns:
- the data type for this control.
- Since:
- 4.0.10
- See Also:
createDataType()
-
createConverter
protected IConverter createConverter() throws PortalException
Creates the converter instance for this control.- Returns:
- the converter instance or null if this control has no converter.
- Throws:
PortalException
- Since:
- 4.0.10
-
setDefaultValue
protected void setDefaultValue() throws PortalException
- Throws:
PortalException
-
getDefaultValue
protected Object getDefaultValue() throws PortalException
- Throws:
PortalException
-
getValueClass
protected Class<?> getValueClass() throws PortalException
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.- Returns:
- the class the possible values of this control are assignable to.
- Throws:
PortalException
- Since:
- 4.0.4
-
convertValueToControlValue
protected Object convertValueToControlValue(Object value, Locale locale, String pattern) throws PortalException, ConversionException
Method to centralize the implementation of conversion of a value to this control's value.Uses this control's converter to convert the value to this control's value class.
- Parameters:
value
- the value.locale
- the locale to use in the conversion.pattern
- the pattern to use in the conversion.- Returns:
- the value converted to this control's value class.
- Throws:
ConversionException
- if an exception is thrown by this control's converter.PortalException
- Since:
- 4.0.10
-
isTrim
protected boolean isTrim()
Returns if the value for this control should be trimmed. The trimming should occur in thesetValue(Object)
method.- Returns:
- if the value for this control should be trimmed.
- Since:
- 4.0.11
-
setTrim
protected void setTrim(boolean trim)
Sets if the value for this control should be trimmed.- Parameters:
trim
- true to enable the trimming or false to disable it. This does not affect the value already set in the control.- Since:
- 4.0.11
- See Also:
isTrim()
-
setValue
public void setValue(Object value) throws PortalException
Sets the value for this control. The value is converted to this control's value class usingconvertValueToControlValue(Object, Locale, String)
. Then the value is set usingsetRawValue(Object)
.- Specified by:
setValue
in interfaceIDataControl
- Parameters:
value
- the value to set. It is automatically converted as necessary.- Throws:
PortalException
-
setRawValue
protected void setRawValue(Object value) throws PortalException
Sets directly the value in this control.- Parameters:
value
- the value to set.- Throws:
PortalException
- Since:
- 4.0.4
-
getValue
public Object getValue() throws PortalException
- Specified by:
getValue
in interfaceIDataControl
- Throws:
PortalException
-
getValue
public <T> T getValue(Class<T> expectedClass) throws PortalException
- Specified by:
getValue
in interfaceIDataControl
- Throws:
PortalException
-
getRequestParameterName
protected String getRequestParameterName() throws PortalException
- Returns:
- Returns the dataId.
- Throws:
PortalException
-
loadFromRequest
public void loadFromRequest() throws PortalException
- Specified by:
loadFromRequest
in interfaceIDataControl
- Throws:
PortalException
-
getParameterValue
protected Object getParameterValue(String parameterName) throws PortalException
Returns the value for this control, reading from request the parameters based on the specified name.loadFromRequest()
calls this method when necessary, to read the value to be set in the control.- Parameters:
parameterName
- the parameter name where the value is to be read from. For controls that require multiple request parameters, it is recommended to use the control's identifier as a prefix to its parameter names during render, and then can implement this method as using the given parameter name as the prefix.- Returns:
- the value.
- Throws:
PortalException
- Since:
- 4.1.1
-
valueIsArray
public boolean valueIsArray() throws PortalException
Returns true if the value in the control is expected to be an array.- Returns:
- Throws:
PortalException
-
loadSubControlsFromRequest
protected void loadSubControlsFromRequest() throws PortalException
- Throws:
PortalException
-
loadSubControlFromRequest
protected void loadSubControlFromRequest(IControl control) throws PortalException
- Throws:
PortalException
-
setProcessActionHandlerParameters
public void setProcessActionHandlerParameters(IProcessActionHandler processActionHandler) throws PortalException
Sets the control value as a process action handler parameter.- Specified by:
setProcessActionHandlerParameters
in interfaceIDataControl
- Parameters:
processActionHandler
-- Throws:
PortalException
-
setProcessActionHandlerParameter
protected void setProcessActionHandlerParameter(IProcessActionHandler processActionHandler, String parameterName) throws PortalException
Set the process action parameter with the control current value.- Parameters:
processActionHandler
- the process action handlerparameterName
- the parameter name- Throws:
PortalException
-
setProcessActionHandlerParameter
protected void setProcessActionHandlerParameter(IProcessActionHandler processActionHandler, String parameterName, Object value) throws PortalException
Set the process action parameter name and value.- Parameters:
processActionHandler
- the process action handlerparameterName
- the parameter nameparameterValue
- the parameter value- Throws:
PortalException
-
getProcessActionHandlerParameterName
protected String getProcessActionHandlerParameterName() throws PortalException
Define the name of the process action parameter to be set. This name is defined by the processActionParameterName attribute of the control definition. If undefined, the default name will be the control id.- Returns:
- the name of the process action parameter set by the control.
- Throws:
PortalException
-
getConverter
public IConverter getConverter() throws PortalException
Description copied from interface:IDataControl
Returns the converter that is able to convert this control's value.- Specified by:
getConverter
in interfaceIDataControl
- Specified by:
getConverter
in interfaceIRenderer
- Returns:
- the converter or null if this control has no converter.
- Throws:
PortalException
-
setSourceParameters
protected void setSourceParameters() throws PortalException
Sets the appropriate source parameters.- Throws:
PortalException
- Since:
- 11.2.0
-
setSourceParameter
protected void setSourceParameter(String parameterName, String sourceId) throws PortalException
Set the parameter with the given name in source with the given identifier.- Parameters:
parameterName
- the parameter namesourceId
- the source identifier- Throws:
PortalException
- Since:
- 11.2.0
-
setSourceParameter
protected void setSourceParameter(Source source, String parameterName) throws PortalException
Sets the parameter with the given name in the given source.- Parameters:
source
- the sourceparameterName
- the parameter name- Throws:
PortalException
- Since:
- 11.2.0
-
-