IDEMPIERE-4973 : Render Quick info only when help panel (Right side P… (#1243)

* IDEMPIERE-4973 : Render Quick info only when help panel (Right side Panel) open

* IDEMPIERE-4973: Fixing issue pointed by hengsin
This commit is contained in:
Deepak Pansheriya 2022-03-17 06:57:59 +05:30 committed by GitHub
parent 24836a7c6c
commit 38fd810122
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 23 additions and 3 deletions

View File

@ -175,6 +175,12 @@ public class DefaultDesktop extends TabbedDesktop implements MenuListener, Seria
private ToolBarButton westBtn; private ToolBarButton westBtn;
// For quick info optimization
private GridTab gridTab;
// Right side Quick info is visible
private boolean isQuickInfoOpen = true;
public DefaultDesktop() public DefaultDesktop()
{ {
super(); super();
@ -259,6 +265,7 @@ public class DefaultDesktop extends TabbedDesktop implements MenuListener, Seria
@Override @Override
public void onEvent(Event event) throws Exception { public void onEvent(Event event) throws Exception {
OpenEvent oe = (OpenEvent) event; OpenEvent oe = (OpenEvent) event;
isQuickInfoOpen = oe.isOpen();
updateHelpCollapsedPreference(!oe.isOpen()); updateHelpCollapsedPreference(!oe.isOpen());
HtmlBasedComponent comp = windowContainer.getComponent(); HtmlBasedComponent comp = windowContainer.getComponent();
if (comp != null) { if (comp != null) {
@ -331,7 +338,10 @@ public class DefaultDesktop extends TabbedDesktop implements MenuListener, Seria
eastPopup = new Popup(); eastPopup = new Popup();
ToolBarButton btn = new ToolBarButton(); ToolBarButton btn = new ToolBarButton();
btn.setIconSclass("z-icon-remove"); btn.setIconSclass("z-icon-remove");
btn.addEventListener(Events.ON_CLICK, evt -> eastPopup.close()); btn.addEventListener(Events.ON_CLICK, evt -> {
eastPopup.close();
isQuickInfoOpen = false;
});
eastPopup.appendChild(btn); eastPopup.appendChild(btn);
btn.setStyle("position: absolute; top: 20px; right: 0px; padding: 2px 0px;"); btn.setStyle("position: absolute; top: 20px; right: 0px; padding: 2px 0px;");
eastPopup.setStyle("padding-top: 20px;"); eastPopup.setStyle("padding-top: 20px;");
@ -339,6 +349,9 @@ public class DefaultDesktop extends TabbedDesktop implements MenuListener, Seria
eastPopup.setPage(getComponent().getPage()); eastPopup.setPage(getComponent().getPage());
eastPopup.setHeight("100%"); eastPopup.setHeight("100%");
helpController.setupFieldTooltip(); helpController.setupFieldTooltip();
eastPopup.addEventListener(Events.ON_OPEN, (OpenEvent oe) -> {
isQuickInfoOpen = oe.isOpen();
});
westPopup = new Popup(); westPopup = new Popup();
westPopup.setStyle("padding-top: 10px;"); westPopup.setStyle("padding-top: 10px;");
@ -424,6 +437,7 @@ public class DefaultDesktop extends TabbedDesktop implements MenuListener, Seria
contextHelp.setSclass("window-container-toolbar-btn context-help-btn"); contextHelp.setSclass("window-container-toolbar-btn context-help-btn");
contextHelp.setTooltiptext(Util.cleanAmp(Msg.getElement(Env.getCtx(), "AD_CtxHelp_ID"))); contextHelp.setTooltiptext(Util.cleanAmp(Msg.getElement(Env.getCtx(), "AD_CtxHelp_ID")));
contextHelp.setVisible(!e.isVisible()); contextHelp.setVisible(!e.isVisible());
isQuickInfoOpen = e.isVisible();
if (!mobile) { if (!mobile) {
boolean headerCollapsed= pref.isPropertyBool(UserPreference.P_HEADER_COLLAPSED); boolean headerCollapsed= pref.isPropertyBool(UserPreference.P_HEADER_COLLAPSED);
@ -654,6 +668,8 @@ public class DefaultDesktop extends TabbedDesktop implements MenuListener, Seria
if (mobile && eastPopup != null) if (mobile && eastPopup != null)
{ {
eastPopup.open(layout.getCenter(), "overlap_end"); eastPopup.open(layout.getCenter(), "overlap_end");
isQuickInfoOpen = true;
updateHelpQuickInfo(gridTab);
} }
else else
{ {
@ -662,6 +678,8 @@ public class DefaultDesktop extends TabbedDesktop implements MenuListener, Seria
LayoutUtils.removeSclass("slide", layout.getEast()); LayoutUtils.removeSclass("slide", layout.getEast());
contextHelp.setVisible(false); contextHelp.setVisible(false);
updateHelpCollapsedPreference(false); updateHelpCollapsedPreference(false);
isQuickInfoOpen = true;
updateHelpQuickInfo(gridTab);
} }
} }
else if (comp == westBtn) else if (comp == westBtn)
@ -988,6 +1006,8 @@ public class DefaultDesktop extends TabbedDesktop implements MenuListener, Seria
@Override @Override
public void updateHelpQuickInfo(GridTab gridTab) { public void updateHelpQuickInfo(GridTab gridTab) {
this.gridTab = gridTab;
if (isQuickInfoOpen)
helpController.renderQuickInfo(gridTab); helpController.renderQuickInfo(gridTab);
} }