Package com.storedobject.vaadin
Class DataForm
- 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:
AbstractUserForm,ActionForm,AddressForm,ApplicationFrame.EntitySelector,ApplicationManager,AuditTrail,AuthenticatorRegistration,BarcodeScanner,BlockSelector,CaptureSignature,ChangeItemOwnership,ChangeObjectPassword,ChangePartNumber,ChangePassword,ChangeUOM,CodeShell,CommandSelector,ComputeLandedCost,CorrectUOM,DataDownload,DataPickup,DataTransfer,DataUpload,DefineReplacementItems,DeployFlutterApplication,DeveloperActivity,EditCost,EditPurchaseTax,HandleReturnedItems,Issue,ItemMovementReport,JournalReport,LicenseManagement,MailForm,MailLog,ManageJobScheduler,ManageTomcatApplication,MigrateItem,MigratePartNumber,Obfuscator,ObjectList,ProcessCheckList,PurchaseReturn,Rebin,ReceiveMaterial,Remove,SchedulerLogViewer,SelectLocation,SelectStore,SetMailSenderPassword,SMSLog,Statement,StockMovementReport,StockReport,SupplierInvoiceDetail,TelegramLog,TelegramRegistration,TransactionLog,TrialBalance
This class is used to accept some quick data from the users. It has an "Ok" and a "Cancel" button. By default, is is displayed
as a
Dialog box.- 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 com.vaadin.flow.component.HasComponentsButton panel where buttons are added.protected ButtonThe Cancel button.protected ButtonThe Ok button.Fields inherited from class com.storedobject.vaadin.AbstractDataForm
form -
Constructor Summary
ConstructorsConstructorDescriptionConstructor.Constructor.Constructor.Constructor.Constructor.Constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidBuild the buttons.protected voidThis is where the fields are built.protected voidcancel()This method is invoked if the "Cancel" button is pressed.voidclicked(com.vaadin.flow.component.Component c) Default implementation, does nothing.intGet the maximum "content height" (Percentage value of the view port height.intGet the maximum "content width" (Percentage value of the view port width).intGet the minimum "content height" (Percentage value of the view port height.intGet the minimum "content width" (Percentage value of the view port width).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.voidsetButtonsAtTop(boolean buttonsAtTop) Button panel is normally shown at the bottom.voidsetCloseable(boolean closeable) Set the closeability.voidsetWindowMode(boolean windowOn) Set the "window mode".protected voidsizeSet()This method is invoked once when the size of the content is set.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, 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, 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. -
buttonPanel
protected com.vaadin.flow.component.HasComponents buttonPanelButton panel where buttons are added.
-
-
Constructor Details
-
DataForm
-
DataForm
Constructor.- Parameters:
caption- CaptionwindowMode- True if the view to be displayed as a window/dialog
-
DataForm
Constructor.- Parameters:
caption- CaptionwindowMode- True if the view to be displayed as a window/dialogcentered- Whether the components to be centered in the content area or not. Useful only when the "window mode" is off.
-
DataForm
-
DataForm
-
DataForm
public DataForm(String caption, String labelOK, String labelCancel, boolean windowMode, boolean centered) Constructor.- Parameters:
caption- CaptionlabelOK- "Ok" labellabelCancel- "Cancel" labelwindowMode- True if the view to be displayed as a window/dialogcentered- Whether the components to be centered in the content area or not. Useful only when the "window mode" is off.
-
-
Method Details
-
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. -
sizeSet
protected void sizeSet()This method is invoked once when the size of the content is set. You can do further change if any. -
getMinimumContentWidth
public int getMinimumContentWidth()Get the minimum "content width" (Percentage value of the view port width). Value should be between 10 and 80. This value is used only in "window mode" or "centered" mode.- Returns:
- Percentage value of the view port width. Default is 10%.
-
getMaximumContentWidth
public int getMaximumContentWidth()Get the maximum "content width" (Percentage value of the view port width). Value should be between 10 and 90. This value is used only in "window mode" or "centered" mode.- Returns:
- Percentage value of the view port width. Default is 80%.
-
getMinimumContentHeight
public int getMinimumContentHeight()Get the minimum "content height" (Percentage value of the view port height. Value should be between 10 and 80.) This value is used only in "window mode" or "centered" mode.- Returns:
- Percentage value of the view port height. Default is 10%.
-
getMaximumContentHeight
public int getMaximumContentHeight()Get the maximum "content height" (Percentage value of the view port height. Value should be between 10 and 90.) This value is used only in "window mode" or "centered" mode.- Returns:
- Percentage value of the view port height. Default is 80%.
-
setWindowMode
public 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).
-
buildFields
protected void buildFields()This is where the fields are built. Typically, we create the fields and add it usingAbstractDataForm.addField(HasValue...)orAbstractDataForm.addField(String, HasValue)methods. -
buildButtons
protected void buildButtons()Build the buttons. Button "Ok" and "Cancel" are already created. This method add those to thebuttonPanel. You can add additional custom buttons and components to thebuttonPanel. -
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
-
setButtonsAtTop
public void setButtonsAtTop(boolean buttonsAtTop) Button panel is normally shown at the bottom. This method makes it appear at the top.- Parameters:
buttonsAtTop- Whether the button panel should be shown at the top or not
-
validateData
-
setCloseable
public void setCloseable(boolean closeable) Set the closeability. This will have effect only in window-mode and theWindowwas created by theDataFormitself. If you create theWindowin an overriddenView.createWindow(Component)method, you should control the closeability of that yourself.- Parameters:
closeable- True/false.
-