IDEMPIERE-5800 Info Window Context Variables are not Cleared after Closing (#1937)

This commit is contained in:
hengsin 2023-07-16 22:02:44 +08:00 committed by GitHub
parent b04da9dfce
commit 407b756cb8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 22 additions and 6 deletions

View File

@ -641,9 +641,9 @@ public class CLogMgt
.append(cc.getDatabase().getStatus().replace(" , ", NL)).append(NL);
// Context
sb.append(NL)
.append("=== Context ===").append(NL);
String[] context = Env.getEntireContext(ctx);
sb.append(NL)
.append("=== Context (%s) ===".formatted(context.length)).append(NL);
Arrays.sort(context);
for (int i = 0; i < context.length; i++)
sb.append(context[i]).append(NL);

View File

@ -132,7 +132,8 @@ public class WQuickEntry extends AbstractWQuickEntry implements EventListener<Ev
Env.setContext(Env.getCtx(), m_WindowNo, QUICK_ENTRY_CALLER_WINDOW, parent_WindowNo);
Env.setContext(Env.getCtx(), m_WindowNo, QUICK_ENTRY_CALLER_TAB, parent_TabNo);
initPOs();
log.info("R/O=" + isReadOnly());
if (log.isLoggable(Level.INFO))
log.info("R/O=" + isReadOnly());
} // WQuickEntry

View File

@ -2686,10 +2686,20 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
boolean hasNew = getADWindowID () > 0;
if (hasNew && vqe == null && hasRightQuickEntry){
GridWindow gridwindow = GridWindow.get(Env.getCtx(), 0, getADWindowID());
GridWindow gridwindow = GridWindow.get(Env.getCtx(), -1, getADWindowID());
hasRightQuickEntry = gridwindow != null;
if (hasRightQuickEntry)
vqe = Extensions.getQuickEntry(0, 0, getADWindowID());
if (hasRightQuickEntry) {
vqe = Extensions.getQuickEntry(p_WindowNo, 0, getADWindowID());
if (vqe != null) {
int windowNo = SessionManager.getAppDesktop().findWindowNo(vqe);
if (windowNo > 0 && windowNo != p_WindowNo) {
SessionManager.getAppDesktop().unregisterWindow(windowNo);
}
}
}
//clear gridWindow context
if (gridwindow != null)
Env.clearWinContext(-1);
}
return hasNew && vqe != null && vqe.isAvailableQuickEdit();

View File

@ -232,6 +232,8 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
private Button btnSelectAll;
private Button btnDeSelectAll;
private boolean registerWindowNo = false;
/**************************************************
* Detail Constructor
@ -295,6 +297,7 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
{
if (WindowNo <= 0) {
p_WindowNo = SessionManager.getAppDesktop().registerWindow(this);
registerWindowNo = true;
} else {
p_WindowNo = WindowNo;
}
@ -3237,6 +3240,8 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
SessionManager.getSessionApplication().getKeylistener().removeEventListener(Events.ON_CTRL_KEY, this);
if (getFirstChild() != null)
saveWlistBoxColumnWidth(getFirstChild());
if (registerWindowNo && SessionManager.getAppDesktop() != null)
SessionManager.getAppDesktop().unregisterWindow(p_WindowNo);
} catch (Exception e){
log.log(Level.WARNING, e.getMessage(), e);
}