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
Modifier and TypeClassDescriptionstatic class
Event sent to a listener added usingwithCloseListener()
method of the input dialog builder.static class
Describes result of handler that can be used withDialogActions
in the input dialog.static class
Describes 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
Modifier and TypeFieldDescriptionprotected Actions
protected HBoxLayout
protected CurrentAuthentication
protected DataComponents
protected DatatypeRegistry
protected DateTimeTransformations
protected DialogActions
protected EntityFieldCreationSupport
protected Form
protected Icons
static final CloseAction
ACloseAction
used when the user clicks "CANCEL" button.static final CloseAction
ACloseAction
used when the user clicks "NO" button.static final CloseAction
ACloseAction
used when the user clicks "OK" button and fields validation is successful.static final CloseAction
ACloseAction
used when the user clicks "YES" button and fields validation is successful.protected Messages
protected Metadata
protected List<InputParameter>
protected Consumer<InputDialog.InputDialogResult>
protected ScreenValidation
protected ThemeConstants
protected UiComponents
protected UiProperties
Fields 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
-
Method Summary
Modifier and TypeMethodDescriptionAdds a close listener to the input dialog.protected DialogAction
createDialogAction
(DialogAction.Type type, CloseAction closeAction) protected Field
createEntityField
(InputParameter parameter) protected Field
createEnumField
(InputParameter parameter) protected Field
createField
(InputParameter parameter) protected void
fireCloseAndResultEvents
(CloseAction closeAction) Returns predefined dialog actions.<T> T
Returns value from parameter by its id.Returns values from parameters.protected void
initActions
(List<Action> actions) protected void
protected void
protected boolean
isDateBasedDatatype
(Datatype datatype) protected boolean
isDateTimeBasedDatatype
(Datatype datatype) protected boolean
isTimeBasedDatatype
(Datatype datatype) boolean
isValid()
Validates form components and conditions from custom validation supplier and show errors.protected void
protected void
void
setActions
(InputDialogAction... actions) Sets dialog actions.void
setDialogActions
(DialogActions actions) Sets predefined dialog actions.void
setParameter
(InputParameter parameter) Add input parameter to the dialog.void
setParameters
(InputParameter... parameters) Sets input parameters.void
setResultHandler
(Consumer<InputDialog.InputDialogResult> resultHandler) Sets handler for dialog actions (e.g.void
Sets 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
ACloseAction
used when the user clicks "OK" button and fields validation is successful. -
INPUT_DIALOG_CANCEL_ACTION
ACloseAction
used when the user clicks "CANCEL" button. -
INPUT_DIALOG_YES_ACTION
ACloseAction
used when the user clicks "YES" button and fields validation is successful. -
INPUT_DIALOG_NO_ACTION
ACloseAction
used 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_CANCEL
by 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 returnValidationErrors
instance. 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
-