@UiDescriptor(value="inputdialog.xml") @UiController(value="inputDialog") public class InputDialog extends Screen
Modifier and Type | Class and Description |
---|---|
static class |
InputDialog.InputDialogCloseEvent
Event sent to a listener added using
withCloseListener() method of the input dialog builder. |
static class |
InputDialog.InputDialogResult
Describes result of handler that can be used with
DialogActions in the input dialog. |
static class |
InputDialog.ValidationContext
Describes input dialog validation context.
|
Screen.AfterCloseEvent, Screen.AfterDetachEvent, Screen.AfterInitEvent, Screen.AfterShowEvent, Screen.BeforeCloseEvent, Screen.BeforeShowEvent, Screen.InitEvent
Modifier and Type | Field and Description |
---|---|
protected Actions |
actions |
protected HBoxLayout |
actionsLayout |
protected java.util.List<Action> |
actionsList |
protected DataComponents |
dataComponents |
protected io.jmix.core.metamodel.datatype.DatatypeRegistry |
datatypeRegistry |
protected DialogActions |
dialogActions |
protected EntityFieldCreationSupport |
entityFieldCreationSupport |
protected java.util.List<java.lang.String> |
fieldIds |
protected Form |
form |
protected Icons |
icons |
static CloseAction |
INPUT_DIALOG_CANCEL_ACTION
A
CloseAction used when the user clicks "CANCEL" button. |
static CloseAction |
INPUT_DIALOG_NO_ACTION
A
CloseAction used when the user clicks "NO" button. |
static CloseAction |
INPUT_DIALOG_OK_ACTION
A
CloseAction used when the user clicks "OK" button and fields validation is successful. |
static CloseAction |
INPUT_DIALOG_YES_ACTION
A
CloseAction used when the user clicks "YES" button and fields validation is successful. |
protected io.jmix.core.Messages |
messages |
protected io.jmix.core.Metadata |
metadata |
protected java.util.List<InputParameter> |
parameters |
protected java.util.function.Consumer<InputDialog.InputDialogResult> |
resultHandler |
protected ScreenValidation |
screenValidation |
protected ThemeConstants |
theme |
protected UiComponents |
uiComponents |
protected UiProperties |
uiProperties |
protected java.util.function.Function<InputDialog.ValidationContext,ValidationErrors> |
validator |
NO_OPTIONS, WINDOW_CLOSE_ACTION, WINDOW_COMMIT_AND_CLOSE_ACTION, WINDOW_DISCARD_AND_CLOSE_ACTION
Constructor and Description |
---|
InputDialog() |
Modifier and Type | Method and Description |
---|---|
io.jmix.core.common.event.Subscription |
addCloseListener(java.util.function.Consumer<InputDialog.InputDialogCloseEvent> listener)
Adds 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) |
java.util.List<Action> |
getActions() |
DialogActions |
getDialogActions()
Returns predefined dialog actions.
|
DialogWindow |
getDialogWindow() |
java.util.List<InputParameter> |
getParameters() |
java.util.function.Consumer<InputDialog.InputDialogResult> |
getResultHandler() |
java.util.function.Function<InputDialog.ValidationContext,ValidationErrors> |
getValidator() |
<T> T |
getValue(java.lang.String parameterId)
Returns value from parameter by its id.
|
java.util.Map<java.lang.String,java.lang.Object> |
getValues()
Returns values from parameters.
|
protected void |
initActions(java.util.List<Action> actions) |
protected void |
initDialogActions() |
protected void |
initParameters() |
boolean |
isValid()
Validates form components and conditions from custom validation supplier and show errors.
|
protected void |
onAfterClose(Screen.AfterCloseEvent event) |
protected void |
onBeforeShow(Screen.BeforeShowEvent event) |
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(java.util.function.Consumer<InputDialog.InputDialogResult> resultHandler)
Sets handler for dialog actions (e.g.
|
void |
setValidator(java.util.function.Function<InputDialog.ValidationContext,ValidationErrors> validator)
Sets additional handler for field validation.
|
addAfterCloseListener, addAfterDetachListener, addAfterInitListener, addAfterShowListener, addBeforeCloseListener, addBeforeShowListener, addInitListener, addUrlParamsChangeListener, close, close, closeWithDefaultAction, fireEvent, getApplicationContext, getEventHub, getExtensions, getId, getScreenData, getUiEventListeners, getWindow, isMultipleOpen, isSameScreen, setApplicationContext, setExtensions, setId, setScreenData, setUiEventListeners, setWindow, show
public static final CloseAction INPUT_DIALOG_OK_ACTION
CloseAction
used when the user clicks "OK" button and fields validation is successful.public static final CloseAction INPUT_DIALOG_CANCEL_ACTION
CloseAction
used when the user clicks "CANCEL" button.public static final CloseAction INPUT_DIALOG_YES_ACTION
CloseAction
used when the user clicks "YES" button and fields validation is successful.public static final CloseAction INPUT_DIALOG_NO_ACTION
CloseAction
used when the user clicks "NO" button.@Autowired protected UiComponents uiComponents
@Autowired protected io.jmix.core.metamodel.datatype.DatatypeRegistry datatypeRegistry
@Autowired protected io.jmix.core.Metadata metadata
@Autowired protected Actions actions
@Autowired protected io.jmix.core.Messages messages
@Autowired protected Icons icons
@Autowired protected ScreenValidation screenValidation
@Autowired protected ThemeConstants theme
@Autowired protected UiProperties uiProperties
@Autowired protected EntityFieldCreationSupport entityFieldCreationSupport
@Autowired protected DataComponents dataComponents
@Autowired protected Form form
@Autowired protected HBoxLayout actionsLayout
protected java.util.List<InputParameter> parameters
protected java.util.List<Action> actionsList
protected DialogActions dialogActions
protected java.util.List<java.lang.String> fieldIds
protected java.util.function.Consumer<InputDialog.InputDialogResult> resultHandler
protected java.util.function.Function<InputDialog.ValidationContext,ValidationErrors> validator
@Subscribe protected void onBeforeShow(Screen.BeforeShowEvent event)
@Subscribe protected void onAfterClose(Screen.AfterCloseEvent event)
public <T> T getValue(java.lang.String parameterId)
parameterId
- parameter idjava.lang.IllegalArgumentException
- exception if wrong parameter id is sentpublic DialogWindow getDialogWindow()
public java.util.Map<java.lang.String,java.lang.Object> getValues()
public void setParameter(InputParameter parameter)
parameter
- input parameter that will be added to the dialogpublic void setParameters(InputParameter... parameters)
parameters
- input parameterspublic java.util.List<InputParameter> getParameters()
public io.jmix.core.common.event.Subscription addCloseListener(java.util.function.Consumer<InputDialog.InputDialogCloseEvent> listener)
listener
- close listener to addpublic void setActions(InputDialogAction... actions)
DialogActions.OK_CANCEL
.actions
- actionsInputDialogAction
public java.util.List<Action> getActions()
public void setDialogActions(DialogActions actions)
DialogActions.OK_CANCEL
.actions
- actionspublic DialogActions getDialogActions()
DialogActions.OK_CANCEL
by default.public void setResultHandler(java.util.function.Consumer<InputDialog.InputDialogResult> resultHandler)
addCloseListener(Consumer)
.
Note, it is worked only with setDialogActions(DialogActions)
. Custom actions are not handled.
resultHandler
- result handler@Nullable public java.util.function.Consumer<InputDialog.InputDialogResult> getResultHandler()
public boolean isValid()
public void setValidator(java.util.function.Function<InputDialog.ValidationContext,ValidationErrors> validator)
ValidationErrors
instance. Returned validation errors will be shown with another errors from fields.validator
- validatorpublic java.util.function.Function<InputDialog.ValidationContext,ValidationErrors> getValidator()
protected void initParameters()
protected Field createField(InputParameter parameter)
protected Field createEntityField(InputParameter parameter)
protected Field createEnumField(InputParameter parameter)
protected void initActions(java.util.List<Action> actions)
protected void initDialogActions()
protected DialogAction createDialogAction(DialogAction.Type type, CloseAction closeAction)
protected void fireCloseAndResultEvents(CloseAction closeAction)