Package io.jmix.ui.app.inputdialog
Class InputDialog
java.lang.Object
io.jmix.ui.screen.Screen
io.jmix.ui.app.inputdialog.InputDialog
- All Implemented Interfaces:
FrameOwner
@UiDescriptor("inputdialog.xml")
@UiController("inputDialog")
public class InputDialog
extends Screen
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classEvent sent to a listener added usingwithCloseListener()method of the input dialog builder.static classDescribes result of handler that can be used withDialogActionsin the input dialog.static classDescribes input dialog validation context.Nested classes/interfaces inherited from class io.jmix.ui.screen.Screen
Screen.AfterCloseEvent, Screen.AfterDetachEvent, Screen.AfterInitEvent, Screen.AfterShowEvent, Screen.BeforeCloseEvent, Screen.BeforeShowEvent, Screen.InitEvent -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Actionsprotected HBoxLayoutprotected CurrentAuthenticationprotected DataComponentsprotected DatatypeRegistryprotected DateTimeTransformationsprotected DialogActionsprotected EntityFieldCreationSupportprotected Formprotected Iconsstatic final CloseActionACloseActionused when the user clicks "CANCEL" button.static final CloseActionACloseActionused when the user clicks "NO" button.static final CloseActionACloseActionused when the user clicks "OK" button and fields validation is successful.static final CloseActionACloseActionused when the user clicks "YES" button and fields validation is successful.protected Messagesprotected Metadataprotected List<InputParameter>protected Consumer<InputDialog.InputDialogResult>protected ScreenValidationprotected ThemeConstantsprotected UiComponentsprotected UiPropertiesFields inherited from interface io.jmix.ui.screen.FrameOwner
NO_OPTIONS, WINDOW_CLOSE_ACTION, WINDOW_COMMIT_AND_CLOSE_ACTION, WINDOW_DISCARD_AND_CLOSE_ACTION -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdds a close listener to the input dialog.protected DialogActioncreateDialogAction(DialogAction.Type type, CloseAction closeAction) protected FieldcreateEntityField(InputParameter parameter) protected FieldcreateEnumField(InputParameter parameter) protected FieldcreateField(InputParameter parameter) protected voidfireCloseAndResultEvents(CloseAction closeAction) Returns predefined dialog actions.<T> TReturns value from parameter by its id.Returns values from parameters.protected voidinitActions(List<Action> actions) protected voidprotected voidprotected booleanisDateBasedDatatype(Datatype datatype) protected booleanisDateTimeBasedDatatype(Datatype datatype) protected booleanisTimeBasedDatatype(Datatype datatype) booleanisValid()Validates form components and conditions from custom validation supplier and show errors.protected voidprotected voidvoidsetActions(InputDialogAction... actions) Sets dialog actions.voidsetDialogActions(DialogActions actions) Sets predefined dialog actions.voidsetParameter(InputParameter parameter) Add input parameter to the dialog.voidsetParameters(InputParameter... parameters) Sets input parameters.voidsetResultHandler(Consumer<InputDialog.InputDialogResult> resultHandler) Sets handler for dialog actions (e.g.voidSets additional handler for field validation.Methods inherited from class io.jmix.ui.screen.Screen
addAfterCloseListener, addAfterDetachListener, addAfterInitListener, addAfterShowListener, addBeforeCloseListener, addBeforeShowListener, addInitListener, addUrlParamsChangeListener, close, close, closeWithDefaultAction, fireEvent, getApplicationContext, getEventHub, getExtensions, getId, getScreenData, getUiEventListeners, getWindow, isMultipleOpen, isSameScreen, isScreenAction, setApplicationContext, setExtensions, setId, setScreenData, setUiEventListeners, setWindow, show
-
Field Details
-
INPUT_DIALOG_OK_ACTION
ACloseActionused when the user clicks "OK" button and fields validation is successful. -
INPUT_DIALOG_CANCEL_ACTION
ACloseActionused when the user clicks "CANCEL" button. -
INPUT_DIALOG_YES_ACTION
ACloseActionused when the user clicks "YES" button and fields validation is successful. -
INPUT_DIALOG_NO_ACTION
ACloseActionused when the user clicks "NO" button. -
dateTimeDatatypes
-
dateDatatypes
-
timeDatatypes
-
uiComponents
-
datatypeRegistry
-
metadata
-
actions
-
messages
-
icons
-
screenValidation
-
theme
-
uiProperties
-
entityFieldCreationSupport
-
dataComponents
-
form
-
actionsLayout
-
currentAuthentication
-
dateTimeTransformations
-
parameters
-
actionsList
-
dialogActions
-
fieldIds
-
resultHandler
-
validator
-
-
Constructor Details
-
InputDialog
public InputDialog()
-
-
Method Details
-
onBeforeShow
-
onAfterClose
-
getValue
Returns value from parameter by its id.- Parameters:
parameterId- parameter id- Returns:
- parameter value
- Throws:
IllegalArgumentException- exception if wrong parameter id is sent
-
getDialogWindow
- Returns:
- dialog window in which you can set dialog properties (e.g. modal, resizable, etc)
-
getValues
Returns values from parameters. String - parameter id, Object - parameter value.- Returns:
- values
-
setParameter
Add input parameter to the dialog. Input parameter will be represented as a field.- Parameters:
parameter- input parameter that will be added to the dialog
-
setParameters
Sets input parameters.- Parameters:
parameters- input parameters
-
getParameters
- Returns:
- input parameters from dialog
-
addCloseListener
Adds a close listener to the input dialog.- Parameters:
listener- close listener to add- Returns:
- subscription
-
setActions
Sets dialog actions. If there is no actions are set input dialog will useDialogActions.OK_CANCEL.- Parameters:
actions- actions- See Also:
-
getActions
- Returns:
- actions list
-
setDialogActions
Sets predefined dialog actions. By default if there is no actions are input dialog will useDialogActions.OK_CANCEL.- Parameters:
actions- actions
-
getDialogActions
Returns predefined dialog actions.DialogActions.OK_CANCELby default.- Returns:
- dialog actions
-
setResultHandler
Sets handler for dialog actions (e.g. OK, CANCEL, etc) that are used in the dialog. Handler is invoked after close event and can be used instead ofaddCloseListener(Consumer).Note, it is worked only with
setDialogActions(DialogActions). Custom actions are not handled.- Parameters:
resultHandler- result handler
-
getResultHandler
- Returns:
- result handler
-
isValid
public boolean isValid()Validates form components and conditions from custom validation supplier and show errors.- Returns:
- true if validation is successful
-
setValidator
Sets additional handler for field validation. It takes values map and must returnValidationErrorsinstance. Returned validation errors will be shown with another errors from fields.- Parameters:
validator- validator
-
getValidator
- Returns:
- additional field validator
-
initParameters
protected void initParameters() -
createField
-
createEntityField
-
createEnumField
-
initActions
-
initDialogActions
protected void initDialogActions() -
createDialogAction
-
fireCloseAndResultEvents
-
isDateBasedDatatype
-
isTimeBasedDatatype
-
isDateTimeBasedDatatype
-