@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 java.util.function.Consumer<InputDialog.InputDialogCloseEvent> |
closeListener |
protected DataComponents |
dataComponents |
protected DatatypeRegistry |
datatypeRegistry |
protected DialogActions |
dialogActions |
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 Messages |
messages |
protected Metadata |
metadata |
protected java.util.List<InputParameter> |
parameters |
protected PersistenceManagerService |
persistenceManagerService |
protected java.util.function.Consumer<InputDialog.InputDialogResult> |
resultHandler |
protected ScreenValidation |
screenValidation |
protected ThemeConstants |
theme |
protected UiComponents |
uiComponents |
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 |
---|---|
protected DialogAction |
createDialogAction(DialogAction.Type type,
CloseAction closeAction) |
protected Field |
createEntityField(InputParameter parameter) |
protected Field |
createEnumField(InputParameter parameter) |
protected Field |
createField(InputParameter parameter) |
protected Field |
createFieldByClass(java.lang.Class datatypeJavaClass) |
protected void |
fireCloseAndResultEvents(CloseAction closeAction) |
java.util.List<Action> |
getActions() |
java.util.function.Consumer<InputDialog.InputDialogCloseEvent> |
getCloseListener() |
DialogActions |
getDialogActions()
Returns predefined dialog actions.
|
DialogWindow |
getDialogWindow() |
<T> java.util.Optional<T> |
getOptional(java.lang.String parameterId)
Returns optional value from parameter by its id.
|
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 |
setCloseListener(java.util.function.Consumer<InputDialog.InputDialogCloseEvent> listener)
Add close listener to the dialog.
|
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, applyDataLoadingSettings, applySettings, close, close, closeWithDefaultAction, deleteSettings, fireEvent, getBeanLocator, getEventHub, getExtensions, getId, getScreenData, getSettings, getUiEventListeners, getWindow, isMultipleOpen, isSameScreen, isSaveScreenHistoryOnClose, isSaveSettingsOnClose, saveSettings, setBeanLocator, 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.@Inject protected UiComponents uiComponents
@Inject protected DatatypeRegistry datatypeRegistry
@Inject protected Metadata metadata
@Inject protected Actions actions
@Inject protected Messages messages
@Inject protected Icons icons
@Inject protected ScreenValidation screenValidation
@Inject protected ThemeConstants theme
@Inject protected PersistenceManagerService persistenceManagerService
@Inject protected DataComponents dataComponents
@Inject protected Form form
@Inject 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.InputDialogCloseEvent> closeListener
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 <T> java.util.Optional<T> getOptional(java.lang.String parameterId)
parameterId
- parameter idpublic 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 void setCloseListener(java.util.function.Consumer<InputDialog.InputDialogCloseEvent> listener)
listener
- close listener to addpublic java.util.function.Consumer<InputDialog.InputDialogCloseEvent> getCloseListener()
public 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)
setCloseListener(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)
@Nullable protected Field createFieldByClass(@Nullable java.lang.Class datatypeJavaClass)
protected void initActions(java.util.List<Action> actions)
protected void initDialogActions()
protected DialogAction createDialogAction(DialogAction.Type type, CloseAction closeAction)
protected void fireCloseAndResultEvents(CloseAction closeAction)