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:
AvailabilityFieldHandler,BirthDateFieldHandler,CheckboxHandler,CodeFieldHandler,ComboBoxHandler,CustomDataFieldHandler,DateFieldHandler,DatetimeFieldHandler,DisplayExpressionHandler,DisplayFieldHandler,DocumentFieldHandler,FieldHandler,FormatFieldHandler,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
FieldsFields inherited from class ch.tocco.nice2.model.form.spi.reader.handler.AbstractComponentHandler
displayType, field, forceEditable, label, name, receiver, scopes, useLabel -
Constructor Summary
ConstructorsConstructorDescriptionAbstractDataComponentHandler(ComponentReceiver receiver, ValidatorHandlerContextFactory validatorHandlerContextFactory, DefaultValueResolver resolver) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddValidator(Validator validator) This case only allows a AndGroupValidatorImpl, not just any validator!protected abstract voidWill be called at the or towards the end of afterFinish().protected voidWill be called after running theAbstractComponentHandler.finish()-Method.protected voidWill be called before running theAbstractComponentHandler.finish()-Method this.field won't be available yet.Overridable getter for field handlers to return default validators.voidsetConstriction(String constriction) final voidfinal voidsetDataType(String dataType) final voidsetDefaultLangOnly(boolean flag) final voidsetEventHandler(String eventHandler) final voidsetIgnoreCopy(boolean ignoreCopy) voidsimpleSearch(boolean simpleSearch) voidstartElement(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:
startElementin 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:AbstractComponentHandlerWill be called before running theAbstractComponentHandler.finish()-Method this.field won't be available yet.- Overrides:
beforeFinishin classAbstractComponentHandler<T extends LabeledComponent & DataComponent>- See Also:
-
afterFinish
Description copied from class:AbstractComponentHandlerWill be called after running theAbstractComponentHandler.finish()-Method. this.field will be ready to fill.- Overrides:
afterFinishin 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:
addValidatorin interfaceValidatorReceivable- Parameters:
validator- .- Throws:
IllegalArgumentException- if a later validator uses a stronger error level than a previous one in the same group.
-
simpleSearch
-