T
- type of entitypublic abstract class StandardEditor<T extends Entity> extends Screen implements EditorScreen<T>
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.
|
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 |
showSaveNotification |
WINDOW_CLOSE, WINDOW_COMMIT, WINDOW_COMMIT_AND_CLOSE
NO_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 com.haulmont.bali.events.Subscription |
addAfterCommitChangesListener(java.util.function.Consumer<StandardEditor.AfterCommitChangesEvent> listener)
Adds a listener to
StandardEditor.AfterCommitChangesEvent . |
protected com.haulmont.bali.events.Subscription |
addBeforeCommitChangesListener(java.util.function.Consumer<StandardEditor.BeforeCommitChangesEvent> listener)
Adds a listener to
StandardEditor.BeforeCommitChangesEvent . |
protected com.haulmont.bali.events.Subscription |
addInitEntityListener(java.util.function.Consumer<StandardEditor.InitEntityEvent<T>> listener)
Adds a listener to
StandardEditor.InitEntityEvent . |
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 boolean |
doNotReloadEditedEntity() |
protected void |
editedEntityCommitted(DataContext.PostCommitEvent event) |
protected void |
editedEntityModified(DataContext.ChangeEvent event) |
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 |
isEntityModified() |
protected boolean |
isEntityModifiedInParentContext() |
protected boolean |
isEntityModifiedRecursive(Entity entity,
DataContext dataContext,
java.util.HashSet<java.lang.Object> visited) |
boolean |
isLocked() |
protected boolean |
isReadOnly() |
boolean |
isShowSaveNotification() |
protected void |
preventUnsavedChanges(Screen.BeforeCloseEvent event) |
protected void |
releaseLock() |
protected void |
setCrossFieldValidate(boolean crossFieldValidate) |
protected void |
setEntityModified(boolean entityModified) |
void |
setEntityToEdit(T item)
Sets entity instance to editor.
|
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, 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 showSaveNotification
protected boolean commitActionPerformed
protected void initActions(Screen.InitEvent event)
protected void setupModifiedTracking()
protected void editedEntityModified(DataContext.ChangeEvent event)
protected void editedEntityCommitted(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)
EditorScreen
setEntityToEdit
in interface EditorScreen<T extends Entity>
item
- entitypublic boolean hasUnsavedChanges()
hasUnsavedChanges
in interface ChangeTracker
protected OperationResult commitChanges()
public boolean isLocked()
isLocked
in interface EditorScreen<T extends Entity>
protected void setEntityModified(boolean entityModified)
protected boolean isEntityModified()
protected boolean isReadOnly()
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 com.haulmont.bali.events.Subscription addInitEntityListener(java.util.function.Consumer<StandardEditor.InitEntityEvent<T>> listener)
StandardEditor.InitEntityEvent
.listener
- listenerprotected com.haulmont.bali.events.Subscription addBeforeCommitChangesListener(java.util.function.Consumer<StandardEditor.BeforeCommitChangesEvent> listener)
StandardEditor.BeforeCommitChangesEvent
.listener
- listenerprotected com.haulmont.bali.events.Subscription addAfterCommitChangesListener(java.util.function.Consumer<StandardEditor.AfterCommitChangesEvent> listener)
StandardEditor.AfterCommitChangesEvent
.listener
- listener