T - type of entitypublic abstract class StandardEditor<T extends Entity> extends Screen implements EditorScreen<T>, ReadOnlyAwareScreen
| Modifier and Type | Class and Description |
|---|---|
static class |
StandardEditor.AfterCommitChangesEvent
Event sent after commit of data context from
commitChanges() call. |
static class |
StandardEditor.BeforeCommitChangesEvent
Event sent before commit of data context from
commitChanges() call. |
static class |
StandardEditor.InitEntityEvent<E extends Entity>
Event sent before the new entity instance is set to edited entity container.
|
static class |
StandardEditor.ValidationEvent
Event sent when screen is validated from
validateAdditionalRules(ValidationErrors) call. |
Screen.AfterCloseEvent, Screen.AfterDetachEvent, Screen.AfterInitEvent, Screen.AfterShowEvent, Screen.BeforeCloseEvent, Screen.BeforeShowEvent, Screen.InitEvent| Modifier and Type | Field and Description |
|---|---|
protected boolean |
commitActionPerformed |
protected boolean |
showEnableEditingBtn |
protected boolean |
showSaveNotification |
ENABLE_EDITING, WINDOW_CLOSE, WINDOW_COMMIT, WINDOW_COMMIT_AND_CLOSENO_OPTIONS, WINDOW_CLOSE_ACTION, WINDOW_COMMIT_AND_CLOSE_ACTION, WINDOW_DISCARD_AND_CLOSE_ACTION| Modifier | Constructor and Description |
|---|---|
protected |
StandardEditor() |
| Modifier and Type | Method and Description |
|---|---|
protected Subscription |
addAfterCommitChangesListener(java.util.function.Consumer<StandardEditor.AfterCommitChangesEvent> listener)
Adds a listener to
StandardEditor.AfterCommitChangesEvent. |
protected Subscription |
addBeforeCommitChangesListener(java.util.function.Consumer<StandardEditor.BeforeCommitChangesEvent> listener)
Adds a listener to
StandardEditor.BeforeCommitChangesEvent. |
protected Subscription |
addInitEntityListener(java.util.function.Consumer<StandardEditor.InitEntityEvent<T>> listener)
Adds a listener to
StandardEditor.InitEntityEvent. |
protected Subscription |
addValidationEventListener(java.util.function.Consumer<StandardEditor.ValidationEvent> listener)
Adds a listener to
StandardEditor.ValidationEvent. |
protected void |
cancel(Action.ActionPerformedEvent event) |
OperationResult |
closeWithCommit()
Tries to validate and commit data.
|
OperationResult |
closeWithDiscard()
Ignores the unsaved changes and closes the screen with
FrameOwner.WINDOW_DISCARD_AND_CLOSE_ACTION action. |
protected void |
commit(Action.ActionPerformedEvent event) |
protected void |
commitAndClose(Action.ActionPerformedEvent event) |
protected OperationResult |
commitChanges()
Validates screen and commits data context.
|
protected void |
disableCommitActions() |
protected boolean |
doNotReloadEditedEntity() |
protected void |
enableEditing(Action.ActionPerformedEvent actionPerformedEvent) |
T |
getEditedEntity() |
protected InstanceContainer<T> |
getEditedEntityContainer() |
protected InstanceLoader |
getEditedEntityLoader() |
protected java.lang.String |
getLockName() |
boolean |
hasUnsavedChanges() |
protected void |
initActions(Screen.InitEvent event) |
protected boolean |
isCrossFieldValidate() |
protected boolean |
isEntityModifiedInParentContext() |
protected boolean |
isEntityModifiedRecursive(Entity entity,
DataContext dataContext,
java.util.HashSet<java.lang.Object> visited) |
boolean |
isLocked() |
protected boolean |
isModifiedAfterOpen() |
boolean |
isReadOnly() |
protected boolean |
isReadOnlyDueToLock() |
boolean |
isShowSaveNotification() |
protected void |
onChangeEvent(DataContext.ChangeEvent event) |
protected void |
onPostCommitEvent(DataContext.PostCommitEvent event) |
protected void |
preventUnsavedChanges(Screen.BeforeCloseEvent event) |
protected void |
releaseLock() |
protected void |
setCrossFieldValidate(boolean crossFieldValidate) |
void |
setEntityToEdit(T item)
Sets entity instance to editor.
|
protected void |
setModifiedAfterOpen(boolean entityModified) |
void |
setReadOnly(boolean readOnly)
Changes the read-only mode.
|
void |
setShowSaveNotification(boolean showSaveNotification)
Sets whether a notification will be shown in case of successful commit.
|
protected void |
setupEntityToEdit() |
protected void |
setupLock() |
protected void |
setupModifiedTracking() |
protected void |
validateAdditionalRules(ValidationErrors errors) |
protected ValidationErrors |
validateScreen()
Validates screen data.
|
protected ValidationErrors |
validateUiComponents()
Validates visible and enabled UI components.
|
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, showprotected boolean showSaveNotification
protected boolean commitActionPerformed
protected boolean showEnableEditingBtn
protected void initActions(Screen.InitEvent event)
protected void enableEditing(Action.ActionPerformedEvent actionPerformedEvent)
protected void setupModifiedTracking()
protected void onChangeEvent(DataContext.ChangeEvent event)
protected void onPostCommitEvent(DataContext.PostCommitEvent event)
protected void preventUnsavedChanges(Screen.BeforeCloseEvent event)
protected void setupEntityToEdit()
protected void setupLock()
protected void releaseLock()
protected java.lang.String getLockName()
protected boolean doNotReloadEditedEntity()
protected boolean isEntityModifiedInParentContext()
protected boolean isEntityModifiedRecursive(Entity entity, DataContext dataContext, java.util.HashSet<java.lang.Object> visited)
protected InstanceLoader getEditedEntityLoader()
protected InstanceContainer<T> getEditedEntityContainer()
public T getEditedEntity()
getEditedEntity in interface EditorScreen<T extends Entity>public void setEntityToEdit(T item)
EditorScreensetEntityToEdit in interface EditorScreen<T extends Entity>item - entitypublic boolean hasUnsavedChanges()
hasUnsavedChanges in interface ChangeTrackerprotected OperationResult commitChanges()
public boolean isLocked()
isLocked in interface EditorScreen<T extends Entity>protected void setModifiedAfterOpen(boolean entityModified)
protected boolean isModifiedAfterOpen()
protected boolean isReadOnlyDueToLock()
public boolean isReadOnly()
isReadOnly in interface ReadOnlyAwareScreenpublic void setReadOnly(boolean readOnly)
ReadOnlyAwareScreensetReadOnly in interface ReadOnlyAwareScreenreadOnly - true to enable the read-only mode, false otherwiseprotected void disableCommitActions()
protected boolean isCrossFieldValidate()
protected void setCrossFieldValidate(boolean crossFieldValidate)
protected ValidationErrors validateScreen()
protected ValidationErrors validateUiComponents()
protected void validateAdditionalRules(ValidationErrors errors)
protected void commitAndClose(Action.ActionPerformedEvent event)
protected void commit(Action.ActionPerformedEvent event)
protected void cancel(Action.ActionPerformedEvent event)
public OperationResult closeWithCommit()
EditorScreen.WINDOW_COMMIT_AND_CLOSE action. May show validation errors or open an additional dialog before closing
the screen.public OperationResult closeWithDiscard()
FrameOwner.WINDOW_DISCARD_AND_CLOSE_ACTION action.public boolean isShowSaveNotification()
public void setShowSaveNotification(boolean showSaveNotification)
showSaveNotification - true if a notification needs to be shown, false otherwiseprotected Subscription addInitEntityListener(java.util.function.Consumer<StandardEditor.InitEntityEvent<T>> listener)
StandardEditor.InitEntityEvent.listener - listenerprotected Subscription addBeforeCommitChangesListener(java.util.function.Consumer<StandardEditor.BeforeCommitChangesEvent> listener)
StandardEditor.BeforeCommitChangesEvent.listener - listenerprotected Subscription addAfterCommitChangesListener(java.util.function.Consumer<StandardEditor.AfterCommitChangesEvent> listener)
StandardEditor.AfterCommitChangesEvent.listener - listenerprotected Subscription addValidationEventListener(java.util.function.Consumer<StandardEditor.ValidationEvent> listener)
StandardEditor.ValidationEvent.listener - listener