Class AbstractDataComponentHandler<T extends LabeledComponent & DataComponent>
java.lang.Object
ch.tocco.nice2.model.form.spi.reader.handler.AbstractComponentHandler<T>
ch.tocco.nice2.model.form.impl.reader.handlers.AbstractDataComponentHandler<T>
- All Implemented Interfaces:
ValidatorReceivable
- Direct Known Subclasses:
BirthDateFieldHandler
,CheckboxHandler
,CodeFieldHandler
,ComboBoxHandler
,CustomDataFieldHandler
,DateFieldHandler
,DatetimeFieldHandler
,DisplayExpressionHandler
,DisplayFieldHandler
,DocumentFieldHandler
,FieldHandler
,FulltextSearchHandler
,HtmlFieldHandler
,ImageFieldHandler
,IteratorHandler
,MultiRemoteFieldHandler
,MultiSelectBoxHandler
,NumberFieldHandler
,PathFieldHandler
,PulldownDateFieldHandler
,RemoteFieldHandler
,SingleSelectBoxHandler
,TableModelHandler
,TextAreaHandler
,TextFieldHandler
,TimeFieldHandler
,UrlFieldHandler
public abstract class AbstractDataComponentHandler<T extends LabeledComponent & DataComponent>
extends AbstractComponentHandler<T>
implements ValidatorReceivable
Abstract reader for basic field types.
-
Field Summary
Fields inherited from class ch.tocco.nice2.model.form.spi.reader.handler.AbstractComponentHandler
displayType, field, forceEditable, label, name, receiver, scopes, useLabel
-
Constructor Summary
ConstructorDescriptionAbstractDataComponentHandler
(ComponentReceiver receiver, ValidatorHandlerContextFactory validatorHandlerContextFactory, DefaultValueResolver resolver) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addValidator
(Validator validator) This case only allows a AndGroupValidatorImpl, not just any validator!protected abstract void
Will be called at the or towards the end of afterFinish().protected void
Will be called after running theAbstractComponentHandler.finish()
-Method.protected void
Will be called before running theAbstractComponentHandler.finish()
-Method this.field won't be available yet.Overridable getter for field handlers to return default validators.void
setConstriction
(String constriction) final void
final void
setDataType
(String dataType) final void
setDefaultLangOnly
(boolean flag) final void
setEventHandler
(String eventHandler) final void
setIgnoreCopy
(boolean ignoreCopy) void
simpleSearch
(boolean simpleSearch) void
startElement
(String elementName, URI resourceName) Methods inherited from class ch.tocco.nice2.model.form.spi.reader.handler.AbstractComponentHandler
addAttributeProps, addExtProps, createOrGetComponent, disableOldClient, doFinish, finish, forceEditable, getImplClass, getInterface, label, setDisplayType, setLabel, setName, setPosition, setScopes, setUseLabel
-
Field Details
-
data
-
validatorHandlerContextFactory
-
-
Constructor Details
-
AbstractDataComponentHandler
public AbstractDataComponentHandler(ComponentReceiver receiver, ValidatorHandlerContextFactory validatorHandlerContextFactory, DefaultValueResolver resolver)
-
-
Method Details
-
startElement
@StartElement public void startElement(@ElementName String elementName, @ResourceName URI resourceName) - Overrides:
startElement
in classAbstractComponentHandler<T extends LabeledComponent & DataComponent>
-
setData
- Throws:
ModelBuildException
-
setDataType
- Throws:
ModelBuildException
-
setConstriction
-
setDefaultLangOnly
-
setIgnoreCopy
-
setEventHandler
-
addValidations
@Element("validations") @Cardinality(min=0, max=1) public AndGroupValidatorModelHandler addValidations() throws ModelBuildException- Throws:
ModelBuildException
-
addDefaultValues
@Element("default") @Cardinality(min=0, max=1) public DefaultValueHandler addDefaultValues() throws ModelBuildException- Throws:
ModelBuildException
-
addAutoComplete
@Element("auto-complete") @Cardinality(min=0, max=1) public AutoCompleteHandler addAutoComplete() throws ModelBuildException- Throws:
ModelBuildException
-
beforeFinish
protected void beforeFinish()Description copied from class:AbstractComponentHandler
Will be called before running theAbstractComponentHandler.finish()
-Method this.field won't be available yet.- Overrides:
beforeFinish
in classAbstractComponentHandler<T extends LabeledComponent & DataComponent>
- See Also:
-
afterFinish
Description copied from class:AbstractComponentHandler
Will be called after running theAbstractComponentHandler.finish()
-Method. this.field will be ready to fill.- Overrides:
afterFinish
in classAbstractComponentHandler<T extends LabeledComponent & DataComponent>
- Throws:
ModelBuildException
- See Also:
-
afterDataSet
protected abstract void afterDataSet()Will be called at the or towards the end of afterFinish().This is abstract so that every implementer is forced to know about its existence.
For an example see
TextAreaHandler.afterDataSet()
; it assigns additional, component-specific data read from xml to the component: field.setRowHeight(rowHeight); -
getDefaultValidators
Overridable getter for field handlers to return default validators.This might be obsolete, because now, default validations come in based on data types.
For example the BirthDateFieldHandler returns a validator that checks for dates in the future. A ChZipcodeFieldHandler could return a validator that checks for a number range 1000-9999.
- Returns:
- May be empty but not null for easy iteration, not modifiable.
-
addValidator
This case only allows a AndGroupValidatorImpl, not just any validator!- Specified by:
addValidator
in interfaceValidatorReceivable
- Parameters:
validator
- .- Throws:
IllegalArgumentException
- if a later validator uses a stronger error level than a previous one in the same group.
-
simpleSearch
-