@ParametersAreNonnullByDefault public abstract class MasterDetailScreen<T extends Entity> extends StandardLookup<T>
Modifier and Type | Class and Description |
---|---|
static class |
MasterDetailScreen.AfterCommitChangesEvent
Event sent after commit of data context from
commitEditorChanges() call. |
static class |
MasterDetailScreen.BeforeCommitChangesEvent
Event sent before commit of data context from
commitEditorChanges() call. |
static class |
MasterDetailScreen.InitEntityEvent<E extends Entity>
Event sent before the new entity instance is set to edited entity container.
|
Screen.AfterCloseEvent, Screen.AfterDetachEvent, Screen.AfterInitEvent, Screen.AfterShowEvent, Screen.BeforeCloseEvent, Screen.BeforeShowEvent, Screen.InitEvent
LookupScreen.ValidationContext<T extends Entity>
Modifier and Type | Field and Description |
---|---|
protected boolean |
creating
Indicates that a new instance of entity is being created.
|
protected boolean |
crossFieldValidate
Indicates whether the cross-field validation is enabled.
|
protected boolean |
editing
Indicates that the screen is in editing mode.
|
protected boolean |
justLocked
Indicates that edited entity is pessimistically locked.
|
selectHandler, selectValidator
LOOKUP_CANCEL_ACTION_ID, LOOKUP_SELECT_ACTION_ID, LOOKUP_SELECT_CLOSE_ACTION
NO_OPTIONS, WINDOW_CLOSE_ACTION, WINDOW_COMMIT_AND_CLOSE_ACTION, WINDOW_DISCARD_AND_CLOSE_ACTION
Constructor and Description |
---|
MasterDetailScreen() |
Modifier and Type | Method and Description |
---|---|
protected Subscription |
addAfterCommitChangesListener(java.util.function.Consumer<MasterDetailScreen.AfterCommitChangesEvent> listener)
Adds a listener to
StandardEditor.AfterCommitChangesEvent . |
protected Subscription |
addBeforeCommitChangesListener(java.util.function.Consumer<MasterDetailScreen.BeforeCommitChangesEvent> listener)
Adds a listener to
StandardEditor.BeforeCommitChangesEvent . |
protected Subscription |
addInitEntityListener(java.util.function.Consumer<MasterDetailScreen.InitEntityEvent<T>> listener)
Adds a listener to
MasterDetailScreen.InitEntityEvent . |
protected OperationResult |
commitEditorChanges()
Validates editor form and commits data context.
|
protected void |
disableEditControls()
Disables edit controls.
|
protected void |
discardChanges()
Method invoked when clicking the Cancel button, discards changes and disables controls for editing.
|
protected void |
enableEditControls(boolean creating)
Enables controls for editing.
|
protected ComponentContainer |
getActionsPane()
Returns the container with edit actions (save, cancel).
|
protected CollectionContainer<T> |
getBrowseContainer()
Returns the table's data container.
|
protected ComponentContainer |
getEditBox()
Returns the right container with edit components.
|
protected InstanceContainer<T> |
getEditContainer()
Returns the edit form's data container.
|
protected T |
getEditedEntity() |
protected InstanceLoader<T> |
getEditLoader()
Returns the loader of the edit form's data container.
|
protected java.lang.Class<T> |
getEntityClass()
Returns the entity meta-class.
|
protected Form |
getForm()
Returns the field group.
|
protected java.lang.String |
getLockName()
Returns the name of the pessimistic lock.
|
protected ComponentContainer |
getLookupBox()
Returns the left container with browse components.
|
protected ListComponent<T> |
getTable()
|
protected TabSheet |
getTabSheet()
Returns the tab sheet with edit components.
|
protected void |
initBrowseCreateAction()
Adds a CreateAction that removes selection in table, sets a newly created item to editDs
and enables controls for record editing.
|
protected void |
initBrowseEditAction()
Adds an EditAction that enables controls for editing.
|
protected void |
initBrowseItemChangeListener()
Adds a listener that reloads the selected record and sets it to editCt.
|
protected void |
initDataComponents()
Initializes data components.
|
protected void |
initEditComponents(boolean enabled)
Initializes edit controls, depending on if they should be enabled or disabled.
|
protected void |
initMasterDetailScreen(Screen.InitEvent event)
Method invoked on the screen initialization.
|
protected void |
initOkCancelActions()
Initializes OK/Cancel editor buttons.
|
protected void |
initShortcuts()
Adds ESCAPE shortcut that invokes cancel() method.
|
protected boolean |
isCrossFieldValidate() |
protected boolean |
lockIfNeeded(Entity entity)
Pessimistic lock before start of editing, if it is configured for the entity.
|
protected void |
refreshOptionsForLookupFields()
Loads options of LookupFields if any.
|
protected void |
releaseLock()
Releases pessimistic lock if the entity was locked.
|
protected void |
saveChanges()
Method invoked when clicking on the Ok button after editing an existing or creating a new record.
|
protected void |
setCrossFieldValidate(boolean crossFieldValidate)
Sets whether the cross-field validation is active.
|
protected void |
validateAdditionalRules(ValidationErrors errors)
Validates the cross-field rules if passed validation errors are empty.
|
protected ValidationErrors |
validateEditorForm()
Validates screen data.
|
protected ValidationErrors |
validateUiComponents()
Validates visible and enabled UI components.
|
cancel, getLookupActionsLayout, getLookupComponent, getSelectHandler, getSelectValidator, initActions, select, select, setLookupComponentMultiSelect, setSelectHandler, setSelectValidator, setupCommitShortcut, setupLookupComponent
addAfterCloseListener, addAfterDetachListener, addAfterInitListener, addAfterShowListener, addBeforeCloseListener, addBeforeShowListener, addInitListener, addUrlParamsChangeListener, applyDataLoadingSettings, applySettings, close, closeWithDefaultAction, deleteSettings, fireEvent, getBeanLocator, getEventHub, getExtensions, getId, getScreenData, getSettings, getUiEventListeners, getWindow, isMultipleOpen, isSameScreen, isSaveScreenHistoryOnClose, isSaveSettingsOnClose, saveSettings, setBeanLocator, setExtensions, setId, setScreenData, setUiEventListeners, setWindow, show
protected boolean editing
protected boolean creating
protected boolean justLocked
protected boolean crossFieldValidate
protected ComponentContainer getLookupBox()
protected ListComponent<T> getTable()
protected ComponentContainer getEditBox()
@Nullable protected TabSheet getTabSheet()
protected Form getForm()
protected ComponentContainer getActionsPane()
protected CollectionContainer<T> getBrowseContainer()
protected InstanceContainer<T> getEditContainer()
@Nonnull protected T getEditedEntity()
protected InstanceLoader<T> getEditLoader()
protected java.lang.Class<T> getEntityClass()
protected void initMasterDetailScreen(Screen.InitEvent event)
protected void initDataComponents()
Default implementation unlinks browse loader from DataContext to prevent from the edited entity being referenced from both edit and browse data containers. Keep in mind that as a result, entities loaded in the browse table are not tracked.
protected void initOkCancelActions()
protected void initBrowseItemChangeListener()
protected void initBrowseCreateAction()
protected void initBrowseEditAction()
protected void initShortcuts()
protected void refreshOptionsForLookupFields()
protected void enableEditControls(boolean creating)
creating
- indicates that a new instance is being createdprotected void disableEditControls()
protected void initEditComponents(boolean enabled)
enabled
- if true - enables edit controls and disables controls on the left side of the splitter
if false - vice versaprotected boolean lockIfNeeded(Entity entity)
protected void releaseLock()
protected java.lang.String getLockName()
protected void saveChanges()
protected OperationResult commitEditorChanges()
protected void discardChanges()
protected boolean isCrossFieldValidate()
true
if the cross-field validation is enabled, false
otherwiseprotected void setCrossFieldValidate(boolean crossFieldValidate)
true
by default.crossFieldValidate
- true
to enable the cross-field validation, false
otherwiseprotected ValidationErrors validateEditorForm()
protected ValidationErrors validateUiComponents()
protected void validateAdditionalRules(ValidationErrors errors)
errors
- errors found during components validationprotected Subscription addInitEntityListener(java.util.function.Consumer<MasterDetailScreen.InitEntityEvent<T>> listener)
MasterDetailScreen.InitEntityEvent
.listener
- listenerprotected Subscription addBeforeCommitChangesListener(java.util.function.Consumer<MasterDetailScreen.BeforeCommitChangesEvent> listener)
StandardEditor.BeforeCommitChangesEvent
.listener
- listenerprotected Subscription addAfterCommitChangesListener(java.util.function.Consumer<MasterDetailScreen.AfterCommitChangesEvent> listener)
StandardEditor.AfterCommitChangesEvent
.listener
- listener