1003416 IDEMPIERE-1478 Usability improvement - closing without saving. Peer Review.
This commit is contained in:
parent
374d7ac576
commit
216c61b9d9
|
@ -195,34 +195,18 @@ public class ADWindowContent extends AbstractADWindowContent
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class TabOnCloseHanlder implements ITabOnCloseHandler {
|
class TabOnCloseHanlder implements ITabOnCloseHandler, Callback<Boolean> {
|
||||||
|
private Tabpanel tabPanel;
|
||||||
public void onClose(Tabpanel tabPanel) {
|
public void onClose(Tabpanel tabPanel) {
|
||||||
if (ADWindowContent.this.getOnExitCallBack() == null){
|
|
||||||
OnCloseCallback onCloseCallback = new OnCloseCallback();
|
|
||||||
ADWindowContent.this.setOnExitCallBack(onCloseCallback);
|
|
||||||
onCloseCallback.setTabPanel(tabPanel);
|
|
||||||
}
|
|
||||||
if (ADWindowContent.this.onExit()) {
|
|
||||||
closeTab (tabPanel);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class OnCloseCallback implements Callback<Boolean>{
|
|
||||||
Tabpanel tabPanel;
|
|
||||||
public Tabpanel getTabPanel() {
|
|
||||||
return tabPanel;
|
|
||||||
}
|
|
||||||
public void setTabPanel(Tabpanel tabPanel) {
|
|
||||||
this.tabPanel = tabPanel;
|
this.tabPanel = tabPanel;
|
||||||
|
ADWindowContent.this.onExit(this);
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public void onCallback(Boolean result) {
|
public void onCallback(Boolean result) {
|
||||||
if (result){
|
if (result){
|
||||||
closeTab (tabPanel);
|
closeTab (tabPanel);
|
||||||
}
|
}
|
||||||
|
this.tabPanel = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -970,33 +970,18 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
|
||||||
focusToActivePanel();
|
focusToActivePanel();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* handle respond of user with close un save message.
|
|
||||||
* must set before call onExit
|
|
||||||
*/
|
|
||||||
private Callback<Boolean> onExitCallBack;
|
|
||||||
|
|
||||||
public Callback<Boolean> getOnExitCallBack() {
|
|
||||||
return onExitCallBack;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOnExitCallBack(Callback<Boolean> onExitCallBack) {
|
|
||||||
this.onExitCallBack = onExitCallBack;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return boolean
|
* @param callback
|
||||||
*/
|
*/
|
||||||
public boolean onExit()
|
public void onExit(Callback<Boolean> callback)
|
||||||
{
|
{
|
||||||
if (!boolChanges)
|
if (!boolChanges)
|
||||||
{
|
{
|
||||||
return true;
|
callback.onCallback(Boolean.TRUE);
|
||||||
}
|
}
|
||||||
else{
|
else
|
||||||
|
{
|
||||||
FDialog.ask(curWindowNo, null, "CloseUnSave?", getOnExitCallBack());
|
FDialog.ask(curWindowNo, null, "CloseUnSave?", callback);
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue