AbstractADWindowPanel enhancement:

* Log more detail for user session crossover to make it easier to cross reference with details captured in log file.
* Make the invocation of onSave consistent with the invocation of cmd_save in APanel.
* No longer need to enabled server push before calling process dialog

Link to SF Tracker: http://sourceforge.net/support/tracker.php?aid=2979823
This commit is contained in:
Heng Sin Low 2010-03-31 08:05:20 +00:00
parent 16afab193b
commit 226018cbc9
1 changed files with 18 additions and 16 deletions

View File

@ -19,6 +19,7 @@ package org.adempiere.webui.panel;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.Map; import java.util.Map;
@ -258,13 +259,15 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
checkad_user_id = (Integer)currSess.getAttribute("Check_AD_User_ID"); checkad_user_id = (Integer)currSess.getAttribute("Check_AD_User_ID");
if (checkad_user_id!=Env.getAD_User_ID(ctx)) if (checkad_user_id!=Env.getAD_User_ID(ctx))
{ {
String msg = "Bug 2832968 SessionUser=" String msg = "Timestamp=" + new Date()
+ ", Bug 2832968 SessionUser="
+ checkad_user_id + checkad_user_id
+ ", ContextUser=" + ", ContextUser="
+ Env.getAD_User_ID(ctx) + Env.getAD_User_ID(ctx)
+ ". Please report conditions to your system administrator or in sf tracker 2832968"; + ". Please report conditions to your system administrator or in sf tracker 2832968";
logger.warning(msg); ApplicationException ex = new ApplicationException(msg);
throw new ApplicationException(msg); logger.log(Level.SEVERE, msg, ex);
throw ex;
} }
// End of temporary code for [ adempiere-ZK Web Client-2832968 ] User context lost? // End of temporary code for [ adempiere-ZK Web Client-2832968 ] User context lost?
@ -792,7 +795,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
if (gridWindow.isTransaction()) if (gridWindow.isTransaction())
{ {
if (curTab.needSave(true, true)/* && !onSave(false)*/) if (curTab.needSave(true, true) && !onSave(false))
return; return;
WOnlyCurrentDays ocd = new WOnlyCurrentDays(); WOnlyCurrentDays ocd = new WOnlyCurrentDays();
@ -1249,6 +1252,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
*/ */
public void onRefresh() public void onRefresh()
{ {
onSave(false);
curTab.dataRefreshAll(); curTab.dataRefreshAll();
curTabpanel.dynamicDisplay(0); curTabpanel.dynamicDisplay(0);
focusToActivePanel(); focusToActivePanel();
@ -1355,6 +1359,8 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
{ {
if (curTab == null) if (curTab == null)
return; return;
onSave(false);
// Gets Fields from AD_Field_v // Gets Fields from AD_Field_v
GridField[] findFields = GridField.createFields(ctx, curTab.getWindowNo(), 0,curTab.getAD_Tab_ID()); GridField[] findFields = GridField.createFields(ctx, curTab.getWindowNo(), 0,curTab.getAD_Tab_ID());
@ -1640,9 +1646,6 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
int table_ID = curTab.getAD_Table_ID(); int table_ID = curTab.getAD_Table_ID();
int record_ID = curTab.getRecord_ID(); int record_ID = curTab.getRecord_ID();
if (!getComponent().getDesktop().isServerPushEnabled())
getComponent().getDesktop().enableServerPush(true);
ProcessModalDialog dialog = new ProcessModalDialog(this,getWindowNo(), ProcessModalDialog dialog = new ProcessModalDialog(this,getWindowNo(),
AD_Process_ID,table_ID, record_ID, true); AD_Process_ID,table_ID, record_ID, true);
if (dialog.isValid()) { if (dialog.isValid()) {
@ -1831,7 +1834,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
if (curTab.needSave(true, false)) if (curTab.needSave(true, false))
{ {
if (!onSave(false)) if (!onSave(true))
return; return;
} }
@ -1881,7 +1884,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
if (vp.needSave()) if (vp.needSave())
{ {
onSave(); onSave(false);
onRefresh(); onRefresh();
} }
} // PaymentRule } // PaymentRule
@ -2006,10 +2009,10 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
// Save item changed // Save item changed
if (curTab.needSave(true, false)) if (curTab.needSave(true, false))
this.onSave(); {
if (!onSave(true))
if (!getComponent().getDesktop().isServerPushEnabled()) return;
getComponent().getDesktop().enableServerPush(true); }
// call form // call form
MProcess pr = new MProcess(ctx, wButton.getProcess_ID(), null); MProcess pr = new MProcess(ctx, wButton.getProcess_ID(), null);
@ -2115,7 +2118,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
{ {
try { try {
//get full control of desktop //get full control of desktop
Executions.activate(getComponent().getDesktop()); Executions.activate(getComponent().getDesktop(), 500);
try { try {
Clients.showBusy(null, true); Clients.showBusy(null, true);
} catch(Error ex){ } catch(Error ex){
@ -2155,7 +2158,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
{ {
try { try {
//get full control of desktop //get full control of desktop
Executions.activate(getComponent().getDesktop()); Executions.activate(getComponent().getDesktop(), 500);
try { try {
if (notPrint) // refresh if not print if (notPrint) // refresh if not print
{ {
@ -2189,7 +2192,6 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
// Get Log Info // Get Log Info
ProcessInfoUtil.setLogFromDB(pi); ProcessInfoUtil.setLogFromDB(pi);
String logInfo = pi.getLogInfo(); String logInfo = pi.getLogInfo();
//TODO: use better dialog for this
if (logInfo.length() > 0) if (logInfo.length() > 0)
FDialog.info(curWindowNo, this.getComponent(), Env.getHeader(ctx, curWindowNo), FDialog.info(curWindowNo, this.getComponent(), Env.getHeader(ctx, curWindowNo),
pi.getTitle() + "<br>" + logInfo); pi.getTitle() + "<br>" + logInfo);