StandardEditor
APIs instead.@Deprecated public class AbstractEditor<T extends Entity> extends AbstractWindow implements Window.Editor<T>, ReadOnlyAwareScreen
Screen.AfterCloseEvent, Screen.AfterDetachEvent, Screen.AfterInitEvent, Screen.AfterShowEvent, Screen.BeforeCloseEvent, Screen.BeforeShowEvent, Screen.InitEvent
Window.BeforeCloseEvent, Window.BeforeCloseWithCloseButtonEvent, Window.BeforeCloseWithShortcutEvent, Window.CloseListener, Window.CloseOrigin, Window.CloseWithCommitListener, Window.Committable, Window.ContentSwitchMode, Window.Editor<T extends Entity>, Window.HasFoldersPane, Window.HasUserIndicator, Window.HasWorkArea, Window.Lookup<T extends Entity>, Window.TopLevelWindow, Window.Wrapper
Frame.MessageMode, Frame.MessageType, Frame.NotificationType
ExpandingLayout.ExpandDirection
Component.Alignment, Component.BelongToFrame, Component.Disposable, Component.Editable, Component.Focusable, Component.HasCaption, Component.HasDescription, Component.HasIcon, Component.HasXmlDescriptor, Component.OptionsStyleProvider
Modifier and Type | Field and Description |
---|---|
protected boolean |
commitActionPerformed
Deprecated.
|
protected boolean |
crossFieldValidate
Deprecated.
|
protected boolean |
justLocked
Deprecated.
|
protected boolean |
readOnly
Deprecated.
|
protected boolean |
readOnlyDueToLock
Deprecated.
|
protected boolean |
showEnableEditingBtn
Deprecated.
|
protected boolean |
showSaveNotification
Deprecated.
|
frame, messages, UNKNOWN_CLOSE_ACTION_ID
NAME
BROWSE_WINDOW_SUFFIX, CLOSE_ACTION_ID, COMMIT_ACTION_ID, CREATE_WINDOW_SUFFIX, EDITOR_WINDOW_SUFFIX, LOOKUP_WINDOW_SUFFIX, SELECT_ACTION_ID
AUTO_SIZE, AUTO_SIZE_PX, FULL_SIZE, UNITS_PERCENTAGE, UNITS_PIXELS
ENABLE_EDITING, WINDOW_CLOSE, WINDOW_COMMIT, WINDOW_COMMIT_AND_CLOSE
NO_OPTIONS, WINDOW_CLOSE_ACTION, WINDOW_COMMIT_AND_CLOSE_ACTION, WINDOW_DISCARD_AND_CLOSE_ACTION
Constructor and Description |
---|
AbstractEditor()
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
protected void |
afterWindowApplyPostInit()
Deprecated.
Called after "postInit" in "Apply" action processing.
|
OperationResult |
closeWithCommit()
Deprecated.
Tries to validate and commit data.
|
boolean |
commit()
Deprecated.
Called by the framework to validate and commit changes.
|
boolean |
commit(boolean validate)
Deprecated.
Commit changes with optional validation.
|
void |
commitAndClose()
Deprecated.
Validate, commit and close the window if commit was successful.
|
protected boolean |
commitInternal(boolean close)
Deprecated.
|
protected void |
disableCommitAction()
Deprecated.
|
protected Datasource |
getDatasourceInternal()
Deprecated.
|
T |
getEditedEntity()
Deprecated.
|
T |
getItem()
Deprecated.
|
protected MetaClass |
getMetaClassForLocking(Datasource ds)
Deprecated.
|
Datasource |
getParentDs()
Deprecated.
|
protected void |
handlePreviouslyDeletedCompositionItems(Entity entity,
DatasourceImplementation parentDs)
Deprecated.
This method is required for multi-level composition, when a user deletes records from nested editors, saves them
and then reopens.
|
boolean |
hasUnsavedChanges()
Deprecated.
|
protected void |
initCommitActions(Screen.InitEvent event)
Deprecated.
|
protected void |
initNewItem(T item)
Deprecated.
Hook to be implemented in subclasses.
|
boolean |
isCrossFieldValidate()
Deprecated.
|
boolean |
isLocked()
Deprecated.
|
boolean |
isModified()
Deprecated.
|
boolean |
isReadOnly()
Deprecated.
|
boolean |
isShowSaveNotification()
Deprecated.
|
protected boolean |
postCommit(boolean committed,
boolean close)
Deprecated.
Hook to be implemented in subclasses.
|
protected void |
postInit()
Deprecated.
Hook to be implemented in subclasses.
|
protected boolean |
preCommit()
Deprecated.
Hook to be implemented in subclasses.
|
void |
releaseLock()
Deprecated.
|
void |
setCrossFieldValidate(boolean crossFieldValidate)
Deprecated.
Enable/disable cross field validation on
Window.validateAll() call. |
void |
setEntityToEdit(T entity)
Deprecated.
Sets entity instance to editor.
|
void |
setItem(Entity item)
Deprecated.
Called by the framework to set an edited entity after creation of all components and datasources, and after
AbstractWindow.init(java.util.Map) . |
protected void |
setItemInternal(Entity item)
Deprecated.
|
void |
setParentDs(Datasource parentDs)
Deprecated.
This method is called by the framework to set parent datasource to commit into this datasource instead
of directly to the database.
|
void |
setReadOnly(boolean readOnly)
Deprecated.
Changes the read-only mode.
|
void |
setShowSaveNotification(boolean showSaveNotification)
Deprecated.
|
void |
validateAdditionalRules(ValidationErrors errors)
Deprecated.
|
add, add, addAction, addAction, addBeforeWindowCloseListener, addFacet, addStyleName, addTimer, afterShow, applySettings, beforeClose, closeWithDiscard, deleteSettings, expand, expand, formatMessage, getAction, getActions, getActionsPermissions, getAlignment, getCaption, getCompanion, getComponent, getComponent, getComponent, getComponents, getComposition, getContentSwitchMode, getContext, getDescription, getDialogOptions, getDsContext, getExpandDirection, getExpandRatio, getFacet, getFacets, getFocusComponent, getFrame, getFrameOwner, getHeight, getHeightSizeUnit, getIcon, getMargin, getMaxHeight, getMaxWidth, getMessage, getMessagesPack, getMinHeight, getMinWidth, getOwnComponent, getOwnComponents, getOwnComponentsStream, getParent, getScreenHashCode, getSettings, getSpacing, getStyleName, getTimer, getWidth, getWidthSizeUnit, getWindowManager, getWrappedFrame, getWrappedWindow, getXmlDescriptor, handleValidationErrors, indexOf, init, init, initEnableEditingActionStub, isAttributeAccessControlEnabled, isCloseable, isEnabled, isEnabledRecursive, isExpanded, isResponsive, isSameScreen, isValid, isVisible, isVisibleRecursive, postValidate, preClose, ready, remove, removeAction, removeAction, removeAll, removeAllActions, removeBeforeWindowCloseListener, removeFacet, removeStyleName, resetExpanded, saveSettings, setAlignment, setCaption, setCloseable, setCompanion, setContentSwitchMode, setDescription, setDsContext, setEnabled, setExpandRatio, setFocusComponent, setFrame, setHeight, setIcon, setIconFromSet, setId, setMargin, setMaxHeight, setMaxWidth, setMessagesPack, setMinHeight, setMinWidth, setParent, setResponsive, setSpacing, setStyleName, setVisible, setWidth, setWindow, setXmlDescriptor, showValidationErrors, unwrap, unwrapComposition, unwrapCompositionOrNull, unwrapOrNull, validate, validate, validateAll, withUnwrapped, withUnwrappedComposition
addAfterCloseListener, addAfterDetachListener, addAfterInitListener, addAfterShowListener, addBeforeCloseListener, addBeforeShowListener, addInitListener, addUrlParamsChangeListener, applyDataLoadingSettings, close, close, closeWithDefaultAction, fireEvent, getBeanLocator, getEventHub, getExtensions, getId, getScreenData, getUiEventListeners, getWindow, isMultipleOpen, isSaveScreenHistoryOnClose, isSaveSettingsOnClose, setBeanLocator, setExtensions, setScreenData, setUiEventListeners, show
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addBeforeCloseWithCloseButtonListener, addBeforeCloseWithShortcutListener, addBeforeWindowCloseListener, addCloseListener, addCloseWithCommitListener, addListener, addTimer, applySettings, close, close, closeAndRun, deleteSettings, getContext, getDialogOptions, getFocusComponent, getFrameOwner, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getSettings, getTimer, getWindowManager, isCloseable, removeBeforeCloseWithCloseButtonListener, removeBeforeCloseWithShortcutListener, removeBeforeWindowCloseListener, removeCloseListener, removeCloseWithCommitListener, removeListener, saveSettings, setCloseable, setFocusComponent, setMaxHeight, setMaxWidth, setMinHeight, setMinWidth, validate, validateAll
addFacet, getFacet, getFacetNN, getFacets, isValid, removeFacet, validate
expand, expand, getExpandDirection, isExpanded, resetExpanded
add, getComponent, getComponentNN, indexOf
add, add, focusFirstComponent, getComponent, getComponentNN, getComponents, getOwnComponent, getOwnComponents, getOwnComponentsStream, remove, remove, removeAll
addStyleName, getAlignment, getHeight, getHeightSizeUnit, getHeightUnits, getId, getParent, getStyleName, getWidth, getWidthSizeUnit, getWidthUnits, isEnabled, isEnabledItself, isEnabledRecursive, isResponsive, isVisible, isVisibleItself, isVisibleRecursive, removeStyleName, requestFocus, setAlignment, setEnabled, setHeight, setHeightAuto, setHeightFull, setId, setParent, setResponsive, setSizeAuto, setSizeFull, setStyleName, setVisible, setWidth, setWidthAuto, setWidthFull, unwrap, unwrapComposition, unwrapCompositionOrNull, unwrapOrNull, withUnwrapped, withUnwrappedComposition
getFrame, setFrame
getSpacing, setSpacing
getMargin, setMargin, setMargin, setMargin
addAction, addAction, getAction, getActionNN, getActions, getSubPart, removeAction, removeAction, removeAllActions
getIcon, setIcon, setIconFromSet
getCaption, setCaption
getDescription, setDescription
openEditor, openEditor, openEditor, openEditor, openEditor, openEditor, openEditor, openFrame, openFrame, openLookup, openLookup, openLookup, openLookup, openWindow, openWindow, showMessageDialog, showNotification, showNotification, showNotification, showOptionDialog, showOptionDialog, showWebPage
getExpandRatio, setExpandRatio
getCompanion, getContext, getDsContext, getMessagesPack, getXmlDescriptor, isValid, setDsContext, setMessagesPack, setXmlDescriptor, validate, validate, validateAll
getComponent, getComposition
getWrappedFrame
protected boolean showSaveNotification
protected boolean readOnly
protected boolean readOnlyDueToLock
protected boolean justLocked
protected boolean crossFieldValidate
protected boolean showEnableEditingBtn
protected boolean commitActionPerformed
protected void initCommitActions(Screen.InitEvent event)
public T getItem()
getItem
in interface Window.Editor<T extends Entity>
@Nullable public Datasource getParentDs()
getParentDs
in interface Window.Editor<T extends Entity>
public void setItem(Entity item)
AbstractWindow.init(java.util.Map)
.
Don't override this method in subclasses, use hooks initNewItem(com.haulmont.cuba.core.entity.Entity)
and postInit()
instead.
setItem
in interface Window.Editor<T extends Entity>
item
- entity instanceprotected Datasource getDatasourceInternal()
protected void setItemInternal(Entity item)
public void releaseLock()
protected void handlePreviouslyDeletedCompositionItems(Entity entity, DatasourceImplementation parentDs)
public void setParentDs(Datasource parentDs)
Window.Editor
setParentDs
in interface Window.Editor<T extends Entity>
protected MetaClass getMetaClassForLocking(Datasource ds)
public boolean isModified()
isModified
in interface Window.Committable
public boolean commit()
Don't override this method in subclasses, use hooks AbstractWindow.postValidate(ValidationErrors)
, preCommit()
and postCommit(boolean, boolean)
instead.
commit
in interface Window.Editor<T extends Entity>
public boolean commit(boolean validate)
Don't override this method in subclasses, use hooks AbstractWindow.postValidate(ValidationErrors)
, preCommit()
and postCommit(boolean, boolean)
instead.
commit
in interface Window.Editor<T extends Entity>
validate
- false to avoid validationprotected boolean commitInternal(boolean close)
public void validateAdditionalRules(ValidationErrors errors)
validateAdditionalRules
in class AbstractWindow
public OperationResult closeWithCommit()
EditorScreen.WINDOW_COMMIT_AND_CLOSE
action. May show validation errors or open an additional dialog before closing
the screen.public void commitAndClose()
Window.COMMIT_ACTION_ID
to associated CloseListener
s
Don't override this method in subclasses, use hooks AbstractWindow.postValidate(ValidationErrors)
, preCommit()
and postCommit(boolean, boolean)
instead.
commitAndClose
in interface Window.Committable
public void setEntityToEdit(T entity)
EditorScreen
setEntityToEdit
in interface EditorScreen<T extends Entity>
entity
- entitypublic T getEditedEntity()
getEditedEntity
in interface EditorScreen<T extends Entity>
public boolean hasUnsavedChanges()
hasUnsavedChanges
in interface ChangeTracker
hasUnsavedChanges
in class AbstractWindow
public boolean isLocked()
isLocked
in interface EditorScreen<T extends Entity>
public boolean isReadOnly()
isReadOnly
in interface ReadOnlyAwareScreen
public void setReadOnly(boolean readOnly)
ReadOnlyAwareScreen
setReadOnly
in interface ReadOnlyAwareScreen
readOnly
- true
to enable the read-only mode, false
otherwiseprotected void disableCommitAction()
public boolean isCrossFieldValidate()
isCrossFieldValidate
in interface Window.Editor<T extends Entity>
Window.validateAll()
call using BeanValidation
.BeanValidation
public void setCrossFieldValidate(boolean crossFieldValidate)
Window.Editor
Window.validateAll()
call. UiCrossFieldChecks
group only
(without Default
group) when there are no other validation errors in UI components.
Cross field validation is triggered before AbstractWindow.postValidate(com.haulmont.cuba.gui.components.ValidationErrors)
hook.
setCrossFieldValidate
in interface Window.Editor<T extends Entity>
crossFieldValidate
- cross field validate flagBeanValidation
protected void initNewItem(T item)
setItem(com.haulmont.cuba.core.entity.Entity)
when
the editor is opened for a new entity instance. Allows to additionally initialize the new entity instance
before setting it into the datasource.item
- entity instanceprotected void postInit()
setItem(com.haulmont.cuba.core.entity.Entity)
.
At the moment of calling the main datasource is initialized and getItem()
returns reloaded entity instance.
postCommit(boolean, boolean)
if the window is not closed after
commit. Then getItem()
contains instance, returned from DataService.commit()
.
This is useful for initialization of components that have to show fresh information from the current instance.
protected void postInit() { if (!PersistenceHelper.isNew(getItem())) { diffFrame.loadVersions(getItem()); entityLogDs.refresh(); } }
protected boolean preCommit()
protected boolean postCommit(boolean committed, boolean close)
postInit()
if the window is not closing.committed
- whether any data were actually changed and committedclose
- whether the window is going to be closedprotected void afterWindowApplyPostInit()
public boolean isShowSaveNotification()
public void setShowSaveNotification(boolean showSaveNotification)