Package lumis.doui.control
Class DataControl
- java.lang.Object
-
- lumis.doui.control.Control
-
- lumis.doui.control.DataControl
-
- All Implemented Interfaces:
javax.servlet.jsp.el.VariableResolver
,IControl
,IDataControl
,IRenderer
- Direct Known Subclasses:
AutoRefreshControl
,CalendarControl
,DataBoundControl
,ErrorSummaryControl
,LanguageFilterControl
,PublisherFiltersAutoLayoutFieldsControl
,TabbedControl
,XslEditorControl
@StableMinor(version="17.0", sinceVersion="4.0") public abstract class DataControl extends Control implements IDataControl, IRenderer
Base implementation forIDataControl
- Since:
- 4.0.0
- Version:
- $Revision$ $Date$
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
FORCE_CASE_LOWER
static java.lang.String
FORCE_CASE_NONE
static java.lang.String
FORCE_CASE_UPPER
protected java.lang.String
forceCase
protected java.lang.String
requestParameterName
protected IDouiDataType
UNKNOWN_DATA_TYPE
The instance used for dataType for controls for which the data type is not known.protected java.lang.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 java.lang.Object
convertValueToControlValue(java.lang.Object value, java.util.Locale locale, java.lang.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 java.lang.Object
getDefaultValue()
protected java.lang.Object
getParameterValue(java.lang.String parameterName)
Returns the value for this control, reading from request the parameters based on the specified name.protected java.lang.String
getProcessActionHandlerParameterName()
Define the name of the process action parameter to be set.java.util.Set<java.lang.String>
getProcessActionIds()
Returns the process action identifiers for which this control sets parameters to.protected java.lang.String
getRequestParameterName()
java.lang.Object
getValue()
<T> T
getValue(java.lang.Class<T> expectedClass)
protected java.lang.Class<?>
getValueClass()
Returns the class the possible values of this control are assignable to.void
init(org.w3c.dom.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, java.lang.String parameterName)
Set the process action parameter with the control current value.protected void
setProcessActionHandlerParameter(IProcessActionHandler processActionHandler, java.lang.String parameterName, java.lang.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(java.lang.Object value)
Sets directly the value in this control.protected void
setSourceParameter(java.lang.String parameterName, java.lang.String sourceId)
Set the parameter with the given name in source with the given identifier.protected void
setSourceParameter(Source source, java.lang.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(java.lang.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 java.lang.String FORCE_CASE_NONE
- See Also:
- Constant Field Values
-
FORCE_CASE_UPPER
public static final java.lang.String FORCE_CASE_UPPER
- See Also:
- Constant Field Values
-
FORCE_CASE_LOWER
public static final java.lang.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 java.lang.String forceCase
-
value
protected java.lang.Object value
-
valuePreviouslySet
protected boolean valuePreviouslySet
-
requestParameterName
protected java.lang.String requestParameterName
-
-
Method Detail
-
init
public void init(org.w3c.dom.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 java.util.Set<java.lang.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 java.lang.Object getDefaultValue() throws PortalException
- Throws:
PortalException
-
getValueClass
protected java.lang.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 java.lang.Object convertValueToControlValue(java.lang.Object value, java.util.Locale locale, java.lang.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(java.lang.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(java.lang.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 java.lang.Object getValue() throws PortalException
- Specified by:
getValue
in interfaceIDataControl
- Throws:
PortalException
-
getValue
public <T> T getValue(java.lang.Class<T> expectedClass) throws PortalException
- Specified by:
getValue
in interfaceIDataControl
- Throws:
PortalException
-
getRequestParameterName
protected java.lang.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 java.lang.Object getParameterValue(java.lang.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, java.lang.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, java.lang.String parameterName, java.lang.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 java.lang.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(java.lang.String parameterName, java.lang.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, java.lang.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
-
-