IDEMPIERE-4769 False result in validation for pending changes (#661)
* IDEMPIERE-4769 False result in validation for pending changes * * Fix also the case that changing detail is not decorating the window title with prefix *
This commit is contained in:
parent
3be5c0ac92
commit
4e73c87e8f
|
@ -184,8 +184,6 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
|
|||
|
||||
protected String title;
|
||||
|
||||
private boolean boolChanges = false;
|
||||
|
||||
private int m_onlyCurrentDays = 0;
|
||||
|
||||
private Component parent;
|
||||
|
@ -1122,13 +1120,13 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
|
|||
*/
|
||||
public void onExit(Callback<Boolean> callback)
|
||||
{
|
||||
if (!boolChanges)
|
||||
if (isPendingChanges())
|
||||
{
|
||||
callback.onCallback(Boolean.TRUE);
|
||||
FDialog.ask(curWindowNo, null, "CloseUnSave?", callback);
|
||||
}
|
||||
else
|
||||
{
|
||||
FDialog.ask(curWindowNo, null, "CloseUnSave?", callback);
|
||||
callback.onCallback(Boolean.TRUE);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1497,6 +1495,66 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
|
|||
if (adTabbox.getSelectedGridTab() != gridTab) detailTab = true;
|
||||
}
|
||||
|
||||
String adInfo = e.getAD_Message();
|
||||
if ( adInfo == null
|
||||
|| GridTab.DEFAULT_STATUS_MESSAGE.equals(adInfo)
|
||||
|| GridTable.DATA_REFRESH_MESSAGE.equals(adInfo)
|
||||
|| GridTable.DATA_INSERTED_MESSAGE.equals(adInfo)
|
||||
|| GridTable.DATA_IGNORED_MESSAGE.equals(adInfo)
|
||||
|| GridTable.DATA_UPDATE_COPIED_MESSAGE.equals(adInfo)
|
||||
|| GridTable.DATA_SAVED_MESSAGE.equals(adInfo)
|
||||
) {
|
||||
|
||||
String prefix = null;
|
||||
if (adTabbox.needSave(true, false) ||
|
||||
adTabbox.getSelectedGridTab().isNew() ||
|
||||
(adTabbox.getSelectedDetailADTabpanel() != null && adTabbox.getSelectedDetailADTabpanel().getGridTab().isNew())) {
|
||||
// same condition as enableSave below
|
||||
prefix = "*";
|
||||
}
|
||||
|
||||
String titleLogic = null;
|
||||
int windowID = getADTab().getSelectedGridTab().getAD_Window_ID();
|
||||
if (windowID > 0) {
|
||||
titleLogic = MWindow.get(Env.getCtx(), windowID).getTitleLogic();
|
||||
}
|
||||
String header = null;
|
||||
if (! Util.isEmpty(titleLogic)) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (prefix != null)
|
||||
sb.append(prefix);
|
||||
sb.append(Env.getContext(ctx, curWindowNo, "_WinInfo_WindowName", false)).append(": ");
|
||||
if (titleLogic.contains("<")) {
|
||||
// IDEMPIERE-1328 - enable using format or subcolumns on title
|
||||
if ( getADTab() != null
|
||||
&& getADTab().getADTabpanel(0) != null
|
||||
&& getADTab().getADTabpanel(0).getGridTab() != null
|
||||
&& getADTab().getADTabpanel(0).getGridTab().getTableModel() != null) {
|
||||
GridTab tab = getADTab().getADTabpanel(0).getGridTab();
|
||||
int row = tab.getCurrentRow();
|
||||
int cnt = tab.getRowCount();
|
||||
boolean inserting = tab.getTableModel().isInserting();
|
||||
if (row >= 0 && cnt > 0 && !inserting) {
|
||||
PO po = tab.getTableModel().getPO(row);
|
||||
titleLogic = Env.parseVariable(titleLogic, po, null, false);
|
||||
} else {
|
||||
titleLogic = Env.parseContext(Env.getCtx(), curWindowNo, titleLogic, false, true);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
titleLogic = Env.parseContext(Env.getCtx(), curWindowNo, titleLogic, false, true);
|
||||
}
|
||||
sb.append(titleLogic);
|
||||
header = sb.toString().trim();
|
||||
if (header.endsWith(":"))
|
||||
header = header.substring(0, header.length()-1);
|
||||
}
|
||||
if (Util.isEmpty(header))
|
||||
header = AEnv.getDialogHeader(Env.getCtx(), curWindowNo, prefix);
|
||||
|
||||
SessionManager.getAppDesktop().setTabTitle(header, curWindowNo);
|
||||
}
|
||||
|
||||
if (!detailTab)
|
||||
{
|
||||
String dbInfo = e.getMessage();
|
||||
|
@ -1504,62 +1562,6 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
|
|||
if (adTabbox.getSelectedGridTab() != null && adTabbox.getSelectedGridTab().isQueryActive())
|
||||
dbInfo = "[ " + dbInfo + " ]";
|
||||
breadCrumb.setStatusDB(dbInfo, e, adTabbox.getSelectedGridTab());
|
||||
|
||||
String adInfo = e.getAD_Message();
|
||||
if ( adInfo == null
|
||||
|| GridTab.DEFAULT_STATUS_MESSAGE.equals(adInfo)
|
||||
|| GridTable.DATA_REFRESH_MESSAGE.equals(adInfo)
|
||||
|| GridTable.DATA_INSERTED_MESSAGE.equals(adInfo)
|
||||
|| GridTable.DATA_IGNORED_MESSAGE.equals(adInfo)
|
||||
|| GridTable.DATA_UPDATE_COPIED_MESSAGE.equals(adInfo)
|
||||
|| GridTable.DATA_SAVED_MESSAGE.equals(adInfo)
|
||||
) {
|
||||
|
||||
String prefix = null;
|
||||
if (dbInfo.contains("*") || dbInfo.contains("?")) // ? used when not-autosave
|
||||
prefix = "*";
|
||||
|
||||
String titleLogic = null;
|
||||
int windowID = getADTab().getSelectedGridTab().getAD_Window_ID();
|
||||
if (windowID > 0) {
|
||||
titleLogic = MWindow.get(Env.getCtx(), windowID).getTitleLogic();
|
||||
}
|
||||
String header = null;
|
||||
if (! Util.isEmpty(titleLogic)) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (prefix != null)
|
||||
sb.append(prefix);
|
||||
sb.append(Env.getContext(ctx, curWindowNo, "_WinInfo_WindowName", false)).append(": ");
|
||||
if (titleLogic.contains("<")) {
|
||||
// IDEMPIERE-1328 - enable using format or subcolumns on title
|
||||
if ( getADTab() != null
|
||||
&& getADTab().getADTabpanel(0) != null
|
||||
&& getADTab().getADTabpanel(0).getGridTab() != null
|
||||
&& getADTab().getADTabpanel(0).getGridTab().getTableModel() != null) {
|
||||
GridTab tab = getADTab().getADTabpanel(0).getGridTab();
|
||||
int row = tab.getCurrentRow();
|
||||
int cnt = tab.getRowCount();
|
||||
boolean inserting = tab.getTableModel().isInserting();
|
||||
if (row >= 0 && cnt > 0 && !inserting) {
|
||||
PO po = tab.getTableModel().getPO(row);
|
||||
titleLogic = Env.parseVariable(titleLogic, po, null, false);
|
||||
} else {
|
||||
titleLogic = Env.parseContext(Env.getCtx(), curWindowNo, titleLogic, false, true);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
titleLogic = Env.parseContext(Env.getCtx(), curWindowNo, titleLogic, false, true);
|
||||
}
|
||||
sb.append(titleLogic);
|
||||
header = sb.toString().trim();
|
||||
if (header.endsWith(":"))
|
||||
header = header.substring(0, header.length()-1);
|
||||
}
|
||||
if (Util.isEmpty(header))
|
||||
header = AEnv.getDialogHeader(Env.getCtx(), curWindowNo, prefix);
|
||||
|
||||
SessionManager.getAppDesktop().setTabTitle(header, curWindowNo);
|
||||
}
|
||||
}
|
||||
else if (adTabbox.getSelectedDetailADTabpanel() == null)
|
||||
{
|
||||
|
@ -1711,9 +1713,6 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
|
|||
boolean deleteRecord = !readOnly;
|
||||
if (!detailTab)
|
||||
{
|
||||
// update Change
|
||||
boolChanges = changed;
|
||||
|
||||
if (insertRecord)
|
||||
{
|
||||
insertRecord = tabPanel.getGridTab().isInsertRecord();
|
||||
|
@ -3663,7 +3662,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
|
|||
}
|
||||
|
||||
public boolean isPendingChanges() {
|
||||
return boolChanges;
|
||||
return adTabbox.getDirtyADTabpanel() != null;
|
||||
}
|
||||
|
||||
public void setADWindow(ADWindow adwindow) {
|
||||
|
|
Loading…
Reference in New Issue