PL-7289 Implementing Committable in a browser controller does not affect showing message about unsaved changes

This commit is contained in:
Konstantin Krivopustov 2016-05-31 11:45:23 +04:00
parent 901fc78150
commit 8707986f80
4 changed files with 12 additions and 17 deletions

View File

@ -396,8 +396,8 @@ public class DesktopWindow implements Window, Component.Disposable,
return res;
}
protected boolean isModified() {
return getDsContext() != null && getDsContext().isModified();
public boolean isModified() {
return delegate.isModified();
}
private void stopTimers() {
@ -1498,11 +1498,6 @@ public class DesktopWindow implements Window, Component.Disposable,
return delegate.getDatasource();
}
@Override
public boolean isModified() {
return ((EditorWindowDelegate) delegate).isModified();
}
@Override
public boolean commit() {
return commit(true);

View File

@ -241,10 +241,8 @@ public class EditorWindowDelegate extends WindowDelegate {
public boolean isModified() {
if (readOnly)
return false;
else if (wrapper instanceof Window.Committable)
return ((Window.Committable) wrapper).isModified();
else
return window.getDsContext() != null && window.getDsContext().isModified();
return super.isModified();
}
public boolean commit(boolean close) {

View File

@ -213,6 +213,13 @@ public class WindowDelegate {
return true;
}
public boolean isModified() {
if (wrapper instanceof Window.Committable)
return ((Window.Committable) wrapper).isModified();
else
return window.getDsContext() != null && window.getDsContext().isModified();
}
public Window openWindow(String windowAlias, WindowManager.OpenType openType, Map<String, Object> params) {
WindowInfo windowInfo = windowConfig.getWindowInfo(windowAlias);
return window.getWindowManager().openWindow(windowInfo, openType, params);

View File

@ -1121,8 +1121,8 @@ public class WebWindow implements Window, Component.Wrapper,
return false;
}
protected boolean isModified() {
return getDsContext() != null && getDsContext().isModified();
public boolean isModified() {
return delegate.isModified();
}
@Override
@ -1416,11 +1416,6 @@ public class WebWindow implements Window, Component.Wrapper,
}
}
@Override
public boolean isModified() {
return ((EditorWindowDelegate) delegate).isModified();
}
@Override
public boolean commit() {
return commit(true);