Class DataGridControl
- java.lang.Object
-
- lumis.doui.control.Control
-
- lumis.doui.control.DataControl
-
- lumis.doui.control.DataBoundControl
-
- lumis.doui.control.datagrid.DataGridControl
-
- All Implemented Interfaces:
Observer
,VariableResolver
,IControl
,IDataBoundControl
,IDataControl
,IRenderer
public class DataGridControl extends DataBoundControl
Used to render a data grid that allows the end user to manipulate multiple fields and rows of a given source.This control by default reads the primary key and displayed fields of all the rows of the source, rendering a grid where each row corresponds to a source row and each cell represents a field of the source. The input control used for a field value is determined by the field definition.
To persist the changes made while using this control, an appropriate process action handler must be set. The process action handlers
TableUpdateMultiRowDataProcessActionHandler
andTableAddMultiRowDataProcessActionHandler
may be used to do such persistence. TheTableUpdateMultiRowDataProcessActionHandler
is able to add new rows, update changed rows and delete removed rows, and is suitable for use in edit interfaces. TheTableAddMultiRowDataProcessActionHandler
adds all rows (it assumes all rows are new), and is suitable for use in add interfaces.
Example use:1 - Since:
- 4.0.4
- Version:
- $Revision: 20825 $ $Date: 2017-12-11 14:43:21 -0200 (Mon, 11 Dec 2017) $
- See Also:
AutoLayoutFieldControl
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
showHeader
-
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 DataGridControl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addGridControls()
void
buildSubControls()
For each field specified create a autoLayoutField control.IDataControlRequestHelpDefinition
getRequestHelpDefinition()
Returns the request parameters help definition.void
init(Node controlDefinitionNode, ControlContainer controlContainer, IControl parentControl)
boolean
isAllowAddRows()
boolean
isAllowDeleteRows()
boolean
isShowHeader()
void
loadFromRequest()
Loads the number of rows and index of row to delete if exists.protected void
reloadSubControlsRecursively(IControl currentControl)
void
setAllowAddRows(boolean allowAddRows)
void
setAllowDeleteRows(boolean allowDeleteRow)
void
setProcessActionHandlerParameters(IProcessActionHandler processActionHandler)
Sets the control value as a process action handler parameter.void
setRenderData()
Sets information for rendering.void
setShowHeader(boolean showHeader)
protected void
setSourceParameter(Source source, String parameterName)
This control must not set source parameters.protected void
setValueFromSource(Source source)
Retrieves the number of rows in the source tabular data.-
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, update
-
Methods inherited from class lumis.doui.control.DataControl
convertValueToControlValue, getConverter, getDataType, getDefaultValue, getParameterValue, getProcessActionIds, getRequestParameterName, getValue, getValue, getValueClass, initProcessActionIds, isTrim, loadSubControlFromRequest, loadSubControlsFromRequest, setProcessActionHandlerParameter, setProcessActionHandlerParameter, 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, getStringsToLocalize, 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, 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
-
setValueFromSource
protected void setValueFromSource(Source source) throws PortalException
Retrieves the number of rows in the source tabular data.- Overrides:
setValueFromSource
in classDataBoundControl
- Throws:
PortalException
-
reloadSubControlsRecursively
protected void reloadSubControlsRecursively(IControl currentControl) throws PortalException
- Throws:
PortalException
-
buildSubControls
public void buildSubControls() throws PortalException
For each field specified create a autoLayoutField control. In addition include an Add button and a Delete button for each row.- Specified by:
buildSubControls
in interfaceIControl
- Overrides:
buildSubControls
in classDataBoundControl
- Throws:
PortalException
-
addGridControls
protected void addGridControls() throws PortalException
- Throws:
PortalException
-
loadFromRequest
public void loadFromRequest() throws PortalException
Loads the number of rows and index of row to delete if exists.- Specified by:
loadFromRequest
in interfaceIDataControl
- Overrides:
loadFromRequest
in classDataBoundControl
- Throws:
PortalException
-
setRenderData
public void setRenderData() throws PortalException
Sets information for rendering. If a row is to be deleted, copy all the values in the rows below the row to be deleted to their previous row. Finally delete the last row. The only information that the data grid needs for itself is the number of rows.- Specified by:
setRenderData
in interfaceIControl
- Overrides:
setRenderData
in classDataBoundControl
- Throws:
PortalException
-
setProcessActionHandlerParameters
public void setProcessActionHandlerParameters(IProcessActionHandler processActionHandler) throws PortalException
Description copied from class:DataControl
Sets the control value as a process action handler parameter.- Specified by:
setProcessActionHandlerParameters
in interfaceIDataControl
- Overrides:
setProcessActionHandlerParameters
in classDataControl
- Throws:
PortalException
-
setSourceParameter
protected void setSourceParameter(Source source, String parameterName) throws PortalException
This control must not set source parameters.- Overrides:
setSourceParameter
in classDataControl
- Parameters:
source
- the sourceparameterName
- the parameter name- Throws:
PortalException
-
isShowHeader
public boolean isShowHeader()
-
setShowHeader
public void setShowHeader(boolean showHeader)
-
isAllowAddRows
public boolean isAllowAddRows()
-
setAllowAddRows
public void setAllowAddRows(boolean allowAddRows)
-
isAllowDeleteRows
public boolean isAllowDeleteRows()
-
setAllowDeleteRows
public void setAllowDeleteRows(boolean allowDeleteRow)
-
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
-
-