Package com.storedobject.ui
Class TemplateDataForm
- All Implemented Interfaces:
ClickHandler
,ExecutableView
,HasContainer
,ValueChangeHandler
,com.vaadin.flow.component.ComponentEventListener<com.vaadin.flow.component.ClickEvent<? extends com.vaadin.flow.component.Component>>
,com.vaadin.flow.component.HasValue.ValueChangeListener
,Serializable
,Runnable
,EventListener
This is equivalent of the
DataForm
class except that the content is based on HTML-template. However,
it doesn't support "window mode" because the whole UI part is controlled by the HTML template. Two "Id" values
("Ok" and "Cancel" buttons) must be mapped and must use the vaadin-button tags. Also, there is no concept of
"button panel" as in DataForm
. All required fields should be defined using "Id" annotations and
createComponentForId(String)
because methods
addField(String, HasValue)
and addField(HasValue[])
do not work.- Author:
- Syam
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.storedobject.vaadin.AbstractDataForm
AbstractDataForm.FieldError
Nested classes/interfaces inherited from interface com.storedobject.vaadin.ClickHandler
ClickHandler.ModifiedClickEvent<C extends com.vaadin.flow.component.Component>
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Button
The Cancel button.protected Button
The Ok button.Fields inherited from class com.storedobject.vaadin.AbstractDataForm
form
-
Constructor Summary
ConstructorsConstructorDescriptionTemplateDataForm
(String caption, TextContent textContent) TemplateDataForm
(String caption, String textContentName) TemplateDataForm
(String caption, Supplier<String> contentSupplier) TemplateDataForm
(Supplier<String> contentSupplier) -
Method Summary
Modifier and TypeMethodDescriptionfinal void
addField
(com.vaadin.flow.component.HasValue<?, ?>... fields) Add fields to the form.final void
Add a field to the form.protected final void
attachField
(String fieldName, com.vaadin.flow.component.HasValue<?, ?> field) Attach a field to the form.protected void
cancel()
This method is invoked if the "Cancel" button is pressed.void
center()
Center thisView
on the screen.void
clicked
(com.vaadin.flow.component.Component c) Default implementation, does nothing.protected com.vaadin.flow.component.Component
Create a component for the given Id value.protected String
Get the name of the field.protected final void
initUI()
This method is invoked when the view wants to determine its "content" to be displayed and nothing exists at that moment.protected abstract boolean
process()
This method is invoked if the "Ok" button is pressed and there is no error raised byvalidateData()
method.final void
setWindowMode
(boolean windowOn) Set the "window mode".boolean
skipFirstFocus
(com.vaadin.flow.component.Focusable<?> skipFocus) Check if this component to be skipped while traversing the component tree to find the first focusable component or not.protected void
Validate data.Methods inherited from class com.storedobject.vaadin.AbstractDataForm
add, addConstructedListener, addIncludeFieldChecker, addValidator, addValidator, clean, clearAlerts, clearError, clearErrors, clearFields, commit, connect, connect, connect, createButtonLayout, createField, createField, createFieldContainer, createLayout, detachField, fieldAttached, fieldDetached, fireFormConstructed, formConstructed, getColumns, getColumnSpan, getContainer, getContent, getData, getErrorDisplay, getField, getFieldLabel, getFieldLabel, getFieldName, getFieldNames, getForm, getLabel, isFieldEditable, isFieldEditable, isFieldVisible, isFieldVisible, isReadOnly, load, markError, newLine, remove, removeAll, removeField, removeField, removeField, setColumns, setColumnSpan, setErrorDisplay, setFieldContainerProvider, setFieldCustomizer, setFieldEditable, setFieldEditable, setFieldHidden, setFieldHidden, setFieldLabel, setFieldLabel, setFieldReadOnly, setFieldReadOnly, setFieldReadOnly, setFieldReadOnly, setFieldVisible, setFieldVisible, setFieldVisible, setFieldVisible, setIncludeFieldChecker, setReadOnly, setRequired, setRequired, setRequired, setRequired, setRequired, setRequired, setRequired, setRequired, streamFieldNamesCreated, streamFieldsCreated
Methods inherited from class com.storedobject.vaadin.View
abort, aborted, addClosedListener, addOpenedListener, close, createCloseableView, createWindow, decorateComponent, execute, execute, execute, executing, focus, focus, focusAny, getApplication, getCaption, getComponent, getCreatedBy, getEmbeddedView, getMenuItem, getMenuItem, getView, invoke, isFullScreen, isScrollable, isWindowMode, select, setCaption, setComponent, setCreatedBy, setDefaultPadding, setEmbeddedView, setFirstFocus, setFullScreen, setScrollable
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.storedobject.vaadin.ClickHandler
clicked, doubleClicked, onComponentEvent, rightClicked
Methods inherited from interface com.storedobject.vaadin.ExecutableView
createMenuItem, error, getMenuIconName, getView, isCloseable, isHomeView, log, log, message, returnedFrom, run, setClickable, speak, trackValueChange, tray, valueChanged, warning
Methods inherited from interface com.storedobject.vaadin.ValueChangeHandler
valueChanged
-
Field Details
-
ok
The Ok button. -
cancel
The Cancel button.
-
-
Constructor Details
-
TemplateDataForm
public TemplateDataForm() -
TemplateDataForm
-
TemplateDataForm
-
TemplateDataForm
-
TemplateDataForm
-
-
Method Details
-
createComponentForId
Create a component for the given Id value.- Parameters:
id
- Id for which a mapping component needs to be added.- Returns:
- Mapped component.
-
getFieldNameForId
-
initUI
protected final void initUI()Description copied from class:View
This method is invoked when the view wants to determine its "content" to be displayed and nothing exists at that moment.View.setComponent(Component)
may be called from within this method. -
setWindowMode
public final void setWindowMode(boolean windowOn) Description copied from class:View
Set the "window mode". Content of the view will be wrapped in aDialog
for "window mode".- Overrides:
setWindowMode
in classView
- Parameters:
windowOn
- Window mode
-
skipFirstFocus
public boolean skipFirstFocus(com.vaadin.flow.component.Focusable<?> skipFocus) Description copied from class:View
Check if this component to be skipped while traversing the component tree to find the first focusable component or not.- Overrides:
skipFirstFocus
in classView
- Parameters:
skipFocus
- The focusable component- Returns:
- False if it should not be skipped (Default implementation returns false).
-
cancel
protected void cancel()This method is invoked if the "Cancel" button is pressed. Default action closes the "data entry screen". -
process
protected abstract boolean process()This method is invoked if the "Ok" button is pressed and there is no error raised byvalidateData()
method. This method has to returntrue
in order to close the "data entry screen".- Returns:
- True or false.
-
clicked
public void clicked(com.vaadin.flow.component.Component c) Description copied from interface:ExecutableView
Default implementation, does nothing.- Parameters:
c
- Component
-
validateData
-
attachField
Description copied from class:AbstractDataForm
Attach a field to the form. This is invoked whenever a field is added to the form. The default implementation adds the component of the field (if it is a component) to the field container.- Overrides:
attachField
in classAbstractDataForm<Object>
- Parameters:
fieldName
- Name of the fieldfield
- Field
-
addField
public final void addField(com.vaadin.flow.component.HasValue<?, ?>... fields) Description copied from class:AbstractDataForm
Add fields to the form. These fields will not be having "field names".- Overrides:
addField
in classAbstractDataForm<Object>
- Parameters:
fields
- Fields to be added
-
addField
Description copied from class:AbstractDataForm
Add a field to the form.- Overrides:
addField
in classAbstractDataForm<Object>
- Parameters:
fieldName
- Name associated with the fieldfield
- Field
-
center
public void center()Center thisView
on the screen.
-