IDEMPIERE-231 Zk6: Improve the tablet experience. Revert setPage call that cause intermitten javascript error.
This commit is contained in:
parent
bfa663b93b
commit
5e2d4a77ca
|
@ -772,4 +772,10 @@ public final class AEnv
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static Desktop getDesktop() {
|
||||
boolean inUIThread = Executions.getCurrent() != null;
|
||||
return inUIThread ? Executions.getCurrent().getDesktop()
|
||||
: (Desktop) Env.getCtx().get(AdempiereWebUI.ZK_DESKTOP_SESSION_KEY);
|
||||
}
|
||||
} // AEnv
|
||||
|
|
|
@ -16,6 +16,7 @@ package org.adempiere.webui.dashboard;
|
|||
import java.util.Enumeration;
|
||||
|
||||
import org.adempiere.exceptions.DBException;
|
||||
import org.adempiere.webui.apps.AEnv;
|
||||
import org.adempiere.webui.event.TouchEventHelper;
|
||||
import org.adempiere.webui.session.SessionManager;
|
||||
import org.adempiere.webui.window.FDialog;
|
||||
|
@ -25,6 +26,7 @@ import org.compiere.util.CLogger;
|
|||
import org.compiere.util.DB;
|
||||
import org.compiere.util.Env;
|
||||
import org.zkoss.zk.ui.Component;
|
||||
import org.zkoss.zk.ui.Executions;
|
||||
import org.zkoss.zk.ui.event.DropEvent;
|
||||
import org.zkoss.zk.ui.event.Event;
|
||||
import org.zkoss.zk.ui.event.EventListener;
|
||||
|
@ -47,6 +49,8 @@ import org.zkoss.zul.Vbox;
|
|||
*/
|
||||
public class DPFavourites extends DashboardPanel implements EventListener<Event> {
|
||||
|
||||
private static final String ON_ADD_TAP_EVENT_LISTENER = "onAddTapEventListener";
|
||||
|
||||
private static final String NODE_ID_ATTR = "Node_ID";
|
||||
|
||||
/**
|
||||
|
@ -68,8 +72,6 @@ public class DPFavourites extends DashboardPanel implements EventListener<Event>
|
|||
{
|
||||
super();
|
||||
|
||||
this.setPage(SessionManager.getAppDesktop().getComponent().getPage());
|
||||
|
||||
Panel panel = new Panel();
|
||||
this.appendChild(panel);
|
||||
|
||||
|
@ -128,7 +130,15 @@ public class DPFavourites extends DashboardPanel implements EventListener<Event>
|
|||
btnFavItem.addEventListener(Events.ON_CLICK, this);
|
||||
btnFavItem.addEventListener(Events.ON_DROP, this);
|
||||
btnFavItem.setSclass("menu-href");
|
||||
TouchEventHelper.addOnTapEventListener(btnFavItem, this);
|
||||
|
||||
if (getPage() != null)
|
||||
{
|
||||
TouchEventHelper.addOnTapEventListener(btnFavItem, this);
|
||||
}
|
||||
else
|
||||
{
|
||||
Executions.schedule(AEnv.getDesktop(), this, new Event(ON_ADD_TAP_EVENT_LISTENER, btnFavItem, null));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -204,6 +214,10 @@ public class DPFavourites extends DashboardPanel implements EventListener<Event>
|
|||
}
|
||||
}
|
||||
}
|
||||
else if (eventName.equals(ON_ADD_TAP_EVENT_LISTENER))
|
||||
{
|
||||
TouchEventHelper.addOnTapEventListener(event.getTarget(), this);
|
||||
}
|
||||
//
|
||||
}
|
||||
|
||||
|
@ -276,7 +290,14 @@ public class DPFavourites extends DashboardPanel implements EventListener<Event>
|
|||
btnFavItem.addEventListener(Events.ON_CLICK, this);
|
||||
btnFavItem.addEventListener(Events.ON_DROP, this);
|
||||
btnFavItem.setSclass("menu-href");
|
||||
TouchEventHelper.addOnTapEventListener(btnFavItem, this);
|
||||
if (getPage() != null)
|
||||
{
|
||||
TouchEventHelper.addOnTapEventListener(btnFavItem, this);
|
||||
}
|
||||
else
|
||||
{
|
||||
Executions.schedule(AEnv.getDesktop(), this, new Event(ON_ADD_TAP_EVENT_LISTENER, btnFavItem, null));
|
||||
}
|
||||
bxFav.removeChild(lblMsg);
|
||||
bxFav.invalidate();
|
||||
} else {
|
||||
|
|
|
@ -15,6 +15,7 @@ package org.adempiere.webui.dashboard;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import org.adempiere.webui.apps.AEnv;
|
||||
import org.adempiere.webui.event.TouchEventHelper;
|
||||
import org.adempiere.webui.event.TouchEvents;
|
||||
import org.adempiere.webui.session.SessionManager;
|
||||
|
@ -25,6 +26,7 @@ import org.compiere.model.MSysConfig;
|
|||
import org.compiere.model.MTable;
|
||||
import org.compiere.util.Env;
|
||||
import org.zkoss.zk.ui.Component;
|
||||
import org.zkoss.zk.ui.Executions;
|
||||
import org.zkoss.zk.ui.event.DropEvent;
|
||||
import org.zkoss.zk.ui.event.Event;
|
||||
import org.zkoss.zk.ui.event.EventListener;
|
||||
|
@ -44,6 +46,8 @@ import org.zkoss.zul.Vbox;
|
|||
*/
|
||||
public class DPRecentItems extends DashboardPanel implements EventListener<Event> {
|
||||
|
||||
private static final String ON_ADD_TAP_EVENT_LISTENER = "onAddTapEventListener";
|
||||
|
||||
private static final String AD_RECENT_ITEM_ID_ATTR = "AD_RecentItem_ID";
|
||||
|
||||
/**
|
||||
|
@ -59,8 +63,6 @@ public class DPRecentItems extends DashboardPanel implements EventListener<Event
|
|||
{
|
||||
super();
|
||||
|
||||
this.setPage(SessionManager.getAppDesktop().getComponent().getPage());
|
||||
|
||||
Panel panel = new Panel();
|
||||
this.appendChild(panel);
|
||||
|
||||
|
@ -131,6 +133,10 @@ public class DPRecentItems extends DashboardPanel implements EventListener<Event
|
|||
}
|
||||
}
|
||||
}
|
||||
else if (eventName.equals(ON_ADD_TAP_EVENT_LISTENER))
|
||||
{
|
||||
TouchEventHelper.addOnTapEventListener(event.getTarget(), this);
|
||||
}
|
||||
}
|
||||
|
||||
private void doOnClick(Component comp) {
|
||||
|
@ -193,7 +199,14 @@ public class DPRecentItems extends DashboardPanel implements EventListener<Event
|
|||
btnrecentItem.addEventListener(Events.ON_CLICK, this);
|
||||
btnrecentItem.addEventListener(Events.ON_DROP, this);
|
||||
btnrecentItem.setSclass("menu-href");
|
||||
TouchEventHelper.addOnTapEventListener(btnrecentItem, this);
|
||||
if (getPage() != null)
|
||||
{
|
||||
TouchEventHelper.addOnTapEventListener(btnrecentItem, this);
|
||||
}
|
||||
else
|
||||
{
|
||||
Executions.schedule(AEnv.getDesktop(), this, new Event(ON_ADD_TAP_EVENT_LISTENER, btnrecentItem, null));
|
||||
}
|
||||
|
||||
riShown++;
|
||||
if (riShown >= maxri)
|
||||
|
|
|
@ -144,7 +144,7 @@ public class NavBarDesktop extends TabbedDesktop implements MenuListener, Serial
|
|||
navigationPanel.setWidth("100%");
|
||||
navigationPanel.setHeight("100%");
|
||||
|
||||
SidePanel pnlSide = new SidePanel(parent.getPage());
|
||||
SidePanel pnlSide = new SidePanel(null);
|
||||
pnlSide.getMenuPanel().addMenuListener(this);
|
||||
navigationPanel.add(pnlSide, "Application Menu");
|
||||
|
||||
|
|
|
@ -111,7 +111,6 @@ public abstract class TabbedDesktop extends AbstractDesktop {
|
|||
ADWindow adWindow = new ADWindow(Env.getCtx(), windowId);
|
||||
|
||||
DesktopTabpanel tabPanel = new DesktopTabpanel();
|
||||
tabPanel.setPage(SessionManager.getAppDesktop().getComponent().getPage());
|
||||
if (adWindow.createPart(tabPanel) != null) {
|
||||
preOpenNewTab();
|
||||
windowContainer.addWindow(tabPanel, adWindow.getTitle(), true);
|
||||
|
@ -132,7 +131,6 @@ public abstract class TabbedDesktop extends AbstractDesktop {
|
|||
ADWindow adWindow = new ADWindow(Env.getCtx(), windowId, query);
|
||||
|
||||
DesktopTabpanel tabPanel = new DesktopTabpanel();
|
||||
tabPanel.setPage(SessionManager.getAppDesktop().getComponent().getPage());
|
||||
if (adWindow.createPart(tabPanel) != null) {
|
||||
preOpenNewTab();
|
||||
windowContainer.addWindow(tabPanel, adWindow.getTitle(), true);
|
||||
|
|
|
@ -35,7 +35,6 @@ import org.compiere.util.Env;
|
|||
import org.compiere.util.Msg;
|
||||
import org.compiere.util.Util;
|
||||
import org.zkoss.zk.ui.Component;
|
||||
import org.zkoss.zk.ui.Page;
|
||||
import org.zkoss.zk.ui.event.Event;
|
||||
import org.zkoss.zk.ui.event.EventListener;
|
||||
import org.zkoss.zk.ui.event.Events;
|
||||
|
@ -72,12 +71,6 @@ public class MenuPanel extends Panel implements EventListener<Event>
|
|||
|
||||
private ToolBarButton expandToggle;
|
||||
|
||||
public MenuPanel(Page page)
|
||||
{
|
||||
setPage(page);
|
||||
init();
|
||||
}
|
||||
|
||||
public MenuPanel(Component parent)
|
||||
{
|
||||
if (parent != null)
|
||||
|
|
|
@ -19,7 +19,6 @@ package org.adempiere.webui.panel;
|
|||
|
||||
import org.adempiere.webui.component.Panel;
|
||||
import org.zkoss.zk.ui.Component;
|
||||
import org.zkoss.zk.ui.Page;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -35,12 +34,6 @@ public class SidePanel extends Panel
|
|||
private static final long serialVersionUID = -3039805384016666481L;
|
||||
private MenuPanel pnlMenu;
|
||||
|
||||
public SidePanel(Page page)
|
||||
{
|
||||
setPage(page);
|
||||
init();
|
||||
}
|
||||
|
||||
public SidePanel(Component parent)
|
||||
{
|
||||
setParent(parent);
|
||||
|
|
|
@ -167,8 +167,6 @@ private A reportLink;
|
|||
public ZkReportViewer(ReportEngine re, String title) {
|
||||
super();
|
||||
|
||||
setPage(SessionManager.getAppDesktop().getComponent().getPage());
|
||||
|
||||
log.info("");
|
||||
m_WindowNo = SessionManager.getAppDesktop().registerWindow(this);
|
||||
Env.setContext(re.getCtx(), m_WindowNo, "_WinInfo_IsReportViewer", "Y");
|
||||
|
|
Loading…
Reference in New Issue