Package com.storedobject.vaadin
Class DataEditor<T>
java.lang.Object
com.storedobject.vaadin.View
com.storedobject.vaadin.AbstractDataForm<T>
com.storedobject.vaadin.AbstractDataEditor<T>
com.storedobject.vaadin.DataEditor<T>
- Type Parameters:
T- Type of the object to edit
- 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
- Direct Known Subclasses:
DataEditor
A
View that is used for creating a "data entry form" with "Save"/"Cancel" buttons.- Author:
- Syam
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.storedobject.vaadin.AbstractDataEditor
AbstractDataEditor.DFormNested 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 com.vaadin.flow.component.HasComponentsThe button panel where the buttons are painted.protected ButtonThe "cancel" button.protected ButtonThe "save" button.Fields inherited from class com.storedobject.vaadin.AbstractDataForm
form -
Constructor Summary
ConstructorsConstructorDescriptionDataEditor(Class<T> objectClass) Constructor.DataEditor(Class<T> objectClass, String caption) Constructor.DataEditor(Class<T> objectClass, String labelSave, String labelCancel) Constructor.Constructor.DataEditor(Class<T> objectClass, String caption, String labelSave, String labelCancel, Consumer<T> saveAction) Constructor.DataEditor(Class<T> objectClass, String caption, String labelSave, String labelCancel, Consumer<T> saveAction, Consumer<T> cancelAction) Constructor.Constructor.DataEditor(Class<T> objectClass, String labelSave, String labelCancel, Consumer<T> saveAction, Consumer<T> cancelAction) Constructor.Constructor.Constructor.DataEditor(Class<T> objectClass, Consumer<T> saveAction) Constructor.Constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidBuild the buttons.protected voidcancel()This method is invoked to carry out the "cancel".voidclicked(com.vaadin.flow.component.Component c) Default implementation, does nothing.protected voidOverride this if you want to do something before the View comes up on the screen.protected voidinitUI()This method is invoked when the view wants to determine its "content" to be displayed and nothing exists at that moment.protected voidsave()This method is invoked to carry out the "save".voidsetCancelAction(Consumer<T> cancelAction) Set the "cancel action" that will be used when "cancel" button is pressed.voidsetSaveAction(Consumer<T> saveAction) Set the "save action" that will be used to save the instance.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.AbstractDataEditor
addField, addField, addField, addField, addField, addField, addField, addField, constructField, createField, createObjectInstance, customizeField, getDataClass, getFieldCreator, getFieldGetMethod, getFieldNames, getFieldOrder, getFieldSetMethod, getForm, getObject, getObjectClass, handleValueSetError, includeField, isFieldIncluded, newObject, setFixedValue, setFixedValue, setFixedValues, setObject, setObjectMethods inherited from class com.storedobject.vaadin.AbstractDataForm
add, addConstructedListener, addField, addField, addIncludeFieldChecker, addValidator, addValidator, attachField, 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, 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, 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, setWindowModeMethods 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
-
save
The "save" button. -
cancel
The "cancel" button. -
buttonPanel
protected com.vaadin.flow.component.HasComponents buttonPanelThe button panel where the buttons are painted.
-
-
Constructor Details
-
DataEditor
-
DataEditor
-
DataEditor
-
DataEditor
-
DataEditor
-
DataEditor
-
DataEditor
public DataEditor(Class<T> objectClass, String labelSave, String labelCancel, Consumer<T> saveAction) Constructor.- Parameters:
objectClass- Object classlabelSave- Label for "save" buttonlabelCancel- Label for "cancel" buttonsaveAction- Save action (Will be called when the "save" button is pressed and data is validated)
-
DataEditor
public DataEditor(Class<T> objectClass, String caption, String labelSave, String labelCancel, Consumer<T> saveAction) Constructor.- Parameters:
objectClass- Object classcaption- CaptionlabelSave- Label for "save" buttonlabelCancel- Label for "cancel" buttonsaveAction- Save action (Will be called when the "save" button is pressed and data is validated)
-
DataEditor
Constructor.- Parameters:
objectClass- Object classsaveAction- Save action (Will be called when the "save" button is pressed and data is validated)cancelAction- Cancel action (Will be called when the "cancel" button is pressed)
-
DataEditor
public DataEditor(Class<T> objectClass, String caption, Consumer<T> saveAction, Consumer<T> cancelAction) Constructor.- Parameters:
objectClass- Object classcaption- CaptionsaveAction- Save action (Will be called when the "save" button is pressed and data is validated)cancelAction- Cancel action (Will be called when the "cancel" button is pressed)
-
DataEditor
public DataEditor(Class<T> objectClass, String labelSave, String labelCancel, Consumer<T> saveAction, Consumer<T> cancelAction) Constructor.- Parameters:
objectClass- Object classlabelSave- Label for "save" buttonlabelCancel- Label for "cancel" buttonsaveAction- Save action (Will be called when the "save" button is pressed and data is validated)cancelAction- Cancel action (Will be called when the "cancel" button is pressed)
-
DataEditor
public DataEditor(Class<T> objectClass, String caption, String labelSave, String labelCancel, Consumer<T> saveAction, Consumer<T> cancelAction) Constructor.- Parameters:
objectClass- Object classcaption- CaptionlabelSave- Label for "save" buttonlabelCancel- Label for "cancel" buttonsaveAction- Save action (Will be called when the "save" button is pressed and data is validated)cancelAction- Cancel action (Will be called when the "cancel" button is pressed)
-
-
Method Details
-
initUI
protected 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. -
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).
-
buildButtons
protected void buildButtons()Build the buttons. Button "save" and "cancel" are already created. This method add those to thebuttonPanel. You can add additional custom buttons and components to thebuttonPanel. -
execute
Description copied from class:ViewOverride this if you want to do something before the View comes up on the screen. Call super.execute(parent, doNotLock) to make the View appear on the screen. Parent view is automatically selected when this view closes. -
cancel
protected void cancel()This method is invoked to carry out the "cancel". By default it processes the "cancel action" if defined. -
save
protected void save()This method is invoked to carry out the "save". By default it processes the "save action" if defined. -
setSaveAction
-
setCancelAction
-
validateData
-
clicked
public void clicked(com.vaadin.flow.component.Component c) Description copied from interface:ExecutableViewDefault implementation, does nothing.- Parameters:
c- Component
-