If you extend
DataSourceWorkScreen, it should be possible to use:
- Code: Select all
setAskBeforeClose(true);
//optional
//setAskBeforeCloseMessage("Save changes?");
Override the method
- Code: Select all
protected boolean hasChanges()
if you need specific control about change detection.
If you don't extend the DataSourceWorkScreen, it's also possible but needs more work:
Overwrite the method
- Code: Select all
notifyDestroy()
and check if your screen has changes. If it has changes, show a message and throw a
SilentAbortException. The SilentAbortException won't open the error dialog but will cancel the current operation.
An example:
- Code: Select all
if (isChanged())
{
getApplication().showQuestion(this, "Save changes?",
"doSaveChanges", "doRevertChanges");
throw new SilentAbortException("Save question");
}