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); .append(cc.getDatabase().getStatus().replace(" , ", NL)).append(NL);
// Context // Context
sb.append(NL)
.append("=== Context ===").append(NL);
String[] context = Env.getEntireContext(ctx); String[] context = Env.getEntireContext(ctx);
sb.append(NL)
.append("=== Context (%s) ===".formatted(context.length)).append(NL);
Arrays.sort(context); Arrays.sort(context);
for (int i = 0; i < context.length; i++) for (int i = 0; i < context.length; i++)
sb.append(context[i]).append(NL); 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_WINDOW, parent_WindowNo);
Env.setContext(Env.getCtx(), m_WindowNo, QUICK_ENTRY_CALLER_TAB, parent_TabNo); Env.setContext(Env.getCtx(), m_WindowNo, QUICK_ENTRY_CALLER_TAB, parent_TabNo);
initPOs(); initPOs();
log.info("R/O=" + isReadOnly()); if (log.isLoggable(Level.INFO))
log.info("R/O=" + isReadOnly());
} // WQuickEntry } // WQuickEntry

View File

@ -2686,10 +2686,20 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
boolean hasNew = getADWindowID () > 0; boolean hasNew = getADWindowID () > 0;
if (hasNew && vqe == null && hasRightQuickEntry){ if (hasNew && vqe == null && hasRightQuickEntry){
GridWindow gridwindow = GridWindow.get(Env.getCtx(), 0, getADWindowID()); GridWindow gridwindow = GridWindow.get(Env.getCtx(), -1, getADWindowID());
hasRightQuickEntry = gridwindow != null; hasRightQuickEntry = gridwindow != null;
if (hasRightQuickEntry) if (hasRightQuickEntry) {
vqe = Extensions.getQuickEntry(0, 0, getADWindowID()); 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(); 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 btnSelectAll;
private Button btnDeSelectAll; private Button btnDeSelectAll;
private boolean registerWindowNo = false;
/************************************************** /**************************************************
* Detail Constructor * Detail Constructor
@ -295,6 +297,7 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
{ {
if (WindowNo <= 0) { if (WindowNo <= 0) {
p_WindowNo = SessionManager.getAppDesktop().registerWindow(this); p_WindowNo = SessionManager.getAppDesktop().registerWindow(this);
registerWindowNo = true;
} else { } else {
p_WindowNo = WindowNo; 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); SessionManager.getSessionApplication().getKeylistener().removeEventListener(Events.ON_CTRL_KEY, this);
if (getFirstChild() != null) if (getFirstChild() != null)
saveWlistBoxColumnWidth(getFirstChild()); saveWlistBoxColumnWidth(getFirstChild());
if (registerWindowNo && SessionManager.getAppDesktop() != null)
SessionManager.getAppDesktop().unregisterWindow(p_WindowNo);
} catch (Exception e){ } catch (Exception e){
log.log(Level.WARNING, e.getMessage(), e); log.log(Level.WARNING, e.getMessage(), e);
} }