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.FieldErrorNested classes/interfaces inherited from interface com.storedobject.vaadin.ClickHandler
ClickHandler.ModifiedClickEvent<C extends com.vaadin.flow.component.Component> -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ButtonThe Cancel button.protected ButtonThe 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 voidaddField(com.vaadin.flow.component.HasValue<?, ?>... fields) Add fields to the form.final voidAdd a field to the form.protected final voidattachField(String fieldName, com.vaadin.flow.component.HasValue<?, ?> field) Attach a field to the form.protected voidcancel()This method is invoked if the "Cancel" button is pressed.voidcenter()Center thisViewon the screen.voidclicked(com.vaadin.flow.component.Component c) Default implementation, does nothing.protected com.vaadin.flow.component.ComponentCreate a component for the given Id value.protected StringGet the name of the field.protected final voidinitUI()This method is invoked when the view wants to determine its "content" to be displayed and nothing exists at that moment.protected abstract booleanprocess()This method is invoked if the "Ok" button is pressed and there is no error raised byvalidateData()method.final voidsetWindowMode(boolean windowOn) Set the "window mode".booleanskipFirstFocus(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 voidValidate 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, streamFieldsCreatedMethods 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, setScrollableMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.storedobject.vaadin.ClickHandler
clicked, doubleClicked, onComponentEvent, rightClickedMethods inherited from interface com.storedobject.vaadin.ExecutableView
createMenuItem, error, getMenuIconName, getView, isCloseable, isHomeView, log, log, message, returnedFrom, run, setClickable, speak, trackValueChange, tray, valueChanged, warningMethods 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:ViewThis 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:ViewSet the "window mode". Content of the view will be wrapped in aDialogfor "window mode".- Overrides:
setWindowModein classView- Parameters:
windowOn- Window mode
-
skipFirstFocus
public boolean skipFirstFocus(com.vaadin.flow.component.Focusable<?> skipFocus) Description copied from class:ViewCheck if this component to be skipped while traversing the component tree to find the first focusable component or not.- Overrides:
skipFirstFocusin 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 returntruein 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:ExecutableViewDefault implementation, does nothing.- Parameters:
c- Component
-
validateData
-
attachField
Description copied from class:AbstractDataFormAttach 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:
attachFieldin classAbstractDataForm<Object>- Parameters:
fieldName- Name of the fieldfield- Field
-
addField
public final void addField(com.vaadin.flow.component.HasValue<?, ?>... fields) Description copied from class:AbstractDataFormAdd fields to the form. These fields will not be having "field names".- Overrides:
addFieldin classAbstractDataForm<Object>- Parameters:
fields- Fields to be added
-
addField
Description copied from class:AbstractDataFormAdd a field to the form.- Overrides:
addFieldin classAbstractDataForm<Object>- Parameters:
fieldName- Name associated with the fieldfield- Field
-
center
public void center()Center thisViewon the screen.
-