Class AbstractBeanValidationEditorDriver<T,E extends com.google.gwt.editor.client.Editor<T>>
- java.lang.Object
-
- com.google.gwt.editor.client.impl.BaseEditorDriver<T,E>
-
- de.knightsoftnet.validators.client.editor.impl.AbstractBeanValidationEditorDriver<T,E>
-
- Type Parameters:
T- the type being editedE- the Editor type
- All Implemented Interfaces:
com.google.gwt.editor.client.EditorDriver<T>,com.google.gwt.event.logical.shared.HasValueChangeHandlers<T>,com.google.gwt.event.shared.HasHandlers,BeanValidationEditorDriver<T,E>,HasFormSubmitHandlers<T>
public abstract class AbstractBeanValidationEditorDriver<T,E extends com.google.gwt.editor.client.Editor<T>> extends com.google.gwt.editor.client.impl.BaseEditorDriver<T,E> implements BeanValidationEditorDriver<T,E>
A base implementation class for generated BeanValidationEditorDriver implementations.
-
-
Field Summary
Fields Modifier and Type Field Description protected Class<?>[]validationGroupsvalidation groups to limit validation.
-
Constructor Summary
Constructors Constructor Description AbstractBeanValidationEditorDriver()default constructor.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description com.google.gwt.event.shared.HandlerRegistrationaddFormSubmitHandler(FormSubmitHandler<T> phandler)Adds aFormSubmitEventhandler.com.google.gwt.event.shared.HandlerRegistrationaddValueChangeHandler(com.google.gwt.event.logical.shared.ValueChangeHandler<T> phandler)com.google.gwt.editor.client.EditorVisitorcreateInitializerVisitor()create a initializer visitor implementation.voidedit(T object)Push the data in an object graph into the Editor given toBeanValidationEditorDriver.initialize(E).voidfireEvent(com.google.gwt.event.shared.GwtEvent<?> pevent)Tflush()Update the object being edited with the current state of the Editor.CheckTimeEnumgetCheckTime()get the time of validation.voidinitialize(E editor)Initialize the editor driver.booleanisCheckOnKeyUp()get state of validation on key up (check on every key up event).booleanisSubmitOnReturn()get state of submit on return (form is submitted if it's valid and return/enter is pressed).booleanisSubmitOnValueChange()get state of submit on value change (form is submitted if it's valid and value has changed).booleanisSubmitUnchanged()submit unchanged forms.voidsetCheckOnKeyUp(boolean pcheckOnKeyUp)set state of validation on key up (check on every key up event), to change this state is only possible, before the first edit call was done.voidsetCheckTime(CheckTimeEnum pcheckTime)set time of validation, to change this state is only possible, before the first edit call was done.voidsetSubmitButton(com.google.gwt.user.client.ui.Widget psubmitButton)setter to add as submit button which is automatically .voidsetSubmitOnReturn(boolean psubmitOnReturn)set state of submit on return (form is submitted if it's valid and return/enter is pressed).voidsetSubmitOnValueChange(boolean psubmitOnValueChange)set state of submit on value change (form is submitted if it's valid and value has changed).voidsetSubmitUnchanged(boolean psubmitUnchanged)setter to change submit unchanged forms.voidsetValidationGroups(Class<?>... pgroups)set validation groups.booleantryToSubmitFrom()try to submit form, if validation is ok, aFormSubmitEventis thrown.booleantryToSubmitFrom(boolean pdirty)try to submit with dirty as parameter.booleanvalidate()start bean validation.protected Set<javax.validation.ConstraintViolation<?>>validateContent(T pobject)protected abstract Set<javax.validation.ConstraintViolation<T>>validateContent(T pobject, AbstractGwtValidator pvalidator)-
Methods inherited from class com.google.gwt.editor.client.impl.BaseEditorDriver
accept, configureDelegate, createDelegate, doEdit, doFlush, doInitialize, doSetViolations, getDelegate, getEditor, getErrors, getObject, getViolationKeyMethod, hasErrors, isDirty, setConstraintViolations, toString
-
-
-
-
Field Detail
-
validationGroups
protected Class<?>[] validationGroups
validation groups to limit validation.
-
-
Method Detail
-
edit
public void edit(T object)
Description copied from interface:BeanValidationEditorDriverPush the data in an object graph into the Editor given toBeanValidationEditorDriver.initialize(E).- Specified by:
editin interfaceBeanValidationEditorDriver<T,E extends com.google.gwt.editor.client.Editor<T>>- Parameters:
object- the object providing input data
-
createInitializerVisitor
public com.google.gwt.editor.client.EditorVisitor createInitializerVisitor()
Description copied from interface:BeanValidationEditorDrivercreate a initializer visitor implementation.- Specified by:
createInitializerVisitorin interfaceBeanValidationEditorDriver<T,E extends com.google.gwt.editor.client.Editor<T>>- Overrides:
createInitializerVisitorin classcom.google.gwt.editor.client.impl.BaseEditorDriver<T,E extends com.google.gwt.editor.client.Editor<T>>- Returns:
- editor visitor
-
flush
public T flush()
Description copied from interface:BeanValidationEditorDriverUpdate the object being edited with the current state of the Editor.- Specified by:
flushin interfaceBeanValidationEditorDriver<T,E extends com.google.gwt.editor.client.Editor<T>>- Specified by:
flushin interfacecom.google.gwt.editor.client.EditorDriver<T>- Returns:
- the object passed into
BeanValidationEditorDriver.edit(Object)
-
initialize
public void initialize(E editor)
Description copied from interface:BeanValidationEditorDriverInitialize the editor driver.- Specified by:
initializein interfaceBeanValidationEditorDriver<T,E extends com.google.gwt.editor.client.Editor<T>>- Parameters:
editor- the Editor to populate
-
validate
public final boolean validate()
Description copied from interface:BeanValidationEditorDriverstart bean validation.- Specified by:
validatein interfaceBeanValidationEditorDriver<T,E extends com.google.gwt.editor.client.Editor<T>>- Returns:
- true if created bean is valid
-
validateContent
protected abstract Set<javax.validation.ConstraintViolation<T>> validateContent(T pobject, AbstractGwtValidator pvalidator) throws IllegalArgumentException
- Throws:
IllegalArgumentException
-
addFormSubmitHandler
public final com.google.gwt.event.shared.HandlerRegistration addFormSubmitHandler(FormSubmitHandler<T> phandler)
Description copied from interface:HasFormSubmitHandlersAdds aFormSubmitEventhandler.- Specified by:
addFormSubmitHandlerin interfaceHasFormSubmitHandlers<T>- Parameters:
phandler- the handler- Returns:
- the registration for the event
-
addValueChangeHandler
public final com.google.gwt.event.shared.HandlerRegistration addValueChangeHandler(com.google.gwt.event.logical.shared.ValueChangeHandler<T> phandler)
- Specified by:
addValueChangeHandlerin interfacecom.google.gwt.event.logical.shared.HasValueChangeHandlers<T>
-
fireEvent
public void fireEvent(com.google.gwt.event.shared.GwtEvent<?> pevent)
- Specified by:
fireEventin interfacecom.google.gwt.event.shared.HasHandlers
-
tryToSubmitFrom
public final boolean tryToSubmitFrom()
Description copied from interface:BeanValidationEditorDrivertry to submit form, if validation is ok, aFormSubmitEventis thrown.- Specified by:
tryToSubmitFromin interfaceBeanValidationEditorDriver<T,E extends com.google.gwt.editor.client.Editor<T>>- Returns:
- true if submit is done, otherwise false
-
tryToSubmitFrom
public final boolean tryToSubmitFrom(boolean pdirty)
Description copied from interface:BeanValidationEditorDrivertry to submit with dirty as parameter.- Specified by:
tryToSubmitFromin interfaceBeanValidationEditorDriver<T,E extends com.google.gwt.editor.client.Editor<T>>- Parameters:
pdirty- dirty flag, if true form is handled as dirty/changed- Returns:
- true if submit is done
-
isSubmitUnchanged
public final boolean isSubmitUnchanged()
Description copied from interface:BeanValidationEditorDriversubmit unchanged forms.- Specified by:
isSubmitUnchangedin interfaceBeanValidationEditorDriver<T,E extends com.google.gwt.editor.client.Editor<T>>- Returns:
- true if unchanged forms can be submitted
-
setSubmitUnchanged
public final void setSubmitUnchanged(boolean psubmitUnchanged)
Description copied from interface:BeanValidationEditorDriversetter to change submit unchanged forms.- Specified by:
setSubmitUnchangedin interfaceBeanValidationEditorDriver<T,E extends com.google.gwt.editor.client.Editor<T>>- Parameters:
psubmitUnchanged- the submitUnchanged to set
-
isCheckOnKeyUp
public final boolean isCheckOnKeyUp()
Description copied from interface:BeanValidationEditorDriverget state of validation on key up (check on every key up event).- Specified by:
isCheckOnKeyUpin interfaceBeanValidationEditorDriver<T,E extends com.google.gwt.editor.client.Editor<T>>- Returns:
- true if it's active
-
setCheckOnKeyUp
public final void setCheckOnKeyUp(boolean pcheckOnKeyUp) throws RuntimeExceptionDescription copied from interface:BeanValidationEditorDriverset state of validation on key up (check on every key up event), to change this state is only possible, before the first edit call was done.- Specified by:
setCheckOnKeyUpin interfaceBeanValidationEditorDriver<T,E extends com.google.gwt.editor.client.Editor<T>>- Parameters:
pcheckOnKeyUp- true/false- Throws:
RuntimeException- if this method is called after a edit call
-
getCheckTime
public final CheckTimeEnum getCheckTime()
Description copied from interface:BeanValidationEditorDriverget the time of validation.- Specified by:
getCheckTimein interfaceBeanValidationEditorDriver<T,E extends com.google.gwt.editor.client.Editor<T>>- Returns:
- check time enumeration
-
setCheckTime
public final void setCheckTime(CheckTimeEnum pcheckTime) throws RuntimeException
Description copied from interface:BeanValidationEditorDriverset time of validation, to change this state is only possible, before the first edit call was done.- Specified by:
setCheckTimein interfaceBeanValidationEditorDriver<T,E extends com.google.gwt.editor.client.Editor<T>>- Parameters:
pcheckTime- check time enumeration- Throws:
RuntimeException- if this method is called after a edit call
-
isSubmitOnReturn
public final boolean isSubmitOnReturn()
Description copied from interface:BeanValidationEditorDriverget state of submit on return (form is submitted if it's valid and return/enter is pressed).- Specified by:
isSubmitOnReturnin interfaceBeanValidationEditorDriver<T,E extends com.google.gwt.editor.client.Editor<T>>- Returns:
- true if it's active
-
setSubmitOnReturn
public final void setSubmitOnReturn(boolean psubmitOnReturn) throws RuntimeExceptionDescription copied from interface:BeanValidationEditorDriverset state of submit on return (form is submitted if it's valid and return/enter is pressed). To change this state is only possible, before the first edit call was done.- Specified by:
setSubmitOnReturnin interfaceBeanValidationEditorDriver<T,E extends com.google.gwt.editor.client.Editor<T>>- Parameters:
psubmitOnReturn- true/false- Throws:
RuntimeException- if this method is called after a edit call
-
isSubmitOnValueChange
public boolean isSubmitOnValueChange()
Description copied from interface:BeanValidationEditorDriverget state of submit on value change (form is submitted if it's valid and value has changed).- Specified by:
isSubmitOnValueChangein interfaceBeanValidationEditorDriver<T,E extends com.google.gwt.editor.client.Editor<T>>- Returns:
- true if it's active
-
setSubmitOnValueChange
public void setSubmitOnValueChange(boolean psubmitOnValueChange)
Description copied from interface:BeanValidationEditorDriverset state of submit on value change (form is submitted if it's valid and value has changed). To change this state is only possible, before the first edit call was done.- Specified by:
setSubmitOnValueChangein interfaceBeanValidationEditorDriver<T,E extends com.google.gwt.editor.client.Editor<T>>- Parameters:
psubmitOnValueChange- true/false
-
setSubmitButton
public final void setSubmitButton(com.google.gwt.user.client.ui.Widget psubmitButton)
Description copied from interface:BeanValidationEditorDriversetter to add as submit button which is automatically .- Specified by:
setSubmitButtonin interfaceBeanValidationEditorDriver<T,E extends com.google.gwt.editor.client.Editor<T>>- Parameters:
psubmitButton- the submitUnchanged to set
-
setValidationGroups
public final void setValidationGroups(Class<?>... pgroups)
Description copied from interface:BeanValidationEditorDriverset validation groups.- Specified by:
setValidationGroupsin interfaceBeanValidationEditorDriver<T,E extends com.google.gwt.editor.client.Editor<T>>- Parameters:
pgroups- group or list of groups targeted for validation (default toDefault)
-
-