/** * Creates a callback registry for the specified page using the specified eviction interval. * * @param page The owning page. * @param evictionInterval The time in milliseconds after which an entry will be evicted. */ public CallbackRegistry(Page page, long evictionInterval) { this.evictionInterval = evictionInterval; page.addEventListener(CallbackEvent.class, callbackListener); }
/** * Create an invocation request queue for the specified page and target. * * @param name Unique name for this queue. * @param page Page instance that owns the queue. * @param target Target upon which invocations will operate. * @param onClose Invocation request to send to the target upon queue closure (may be null). */ public InvocationRequestQueue(String name, Page page, Object target, InvocationRequest onClose) { super(); this.name = name; this.target = target; this.page = page; this.onClose = onClose; eventName = "invoke_" + name; InvocationRequestQueueRegistry.getInstance().register(this); page.addEventListener(eventName, invocationListener); }
@Override public void onSessionCreate(Session session) { session.getPage().addEventListener("afterInitialize", (event) -> { ReportHeaderRegistry rhr = getInstance(); Namespace headerRoot = new Namespace(); headerRoot.addStyle("display", "none"); headerRoot.setName("report_headers"); for (Entry<String, String> entry : rhr.map.entrySet()) { String key = entry.getKey(); String url = entry.getValue(); try { Namespace root = new Namespace(); root.setName(key); PageUtil.createPage(url, root); root.setParent(headerRoot); } catch (Exception e) { log.error("Error loading report header " + key, e); } } session.getPage().addChild(headerRoot); }); }
@Override public void afterInitialized(BaseComponent comp) { window = (Window) comp; window.setCloseAction(CloseAction.HIDE); comp.setAttribute("controller", this); bringToFront = comp.getPage().getAttribute(ATTR_BRING_TO_FRONT, true); layoutChangedEvent = new LayoutChangedEvent(comp, null); contextMenu.setListener(comp); clipboard.addListener(comp); comp.getPage().addEventListener("register unregister", layoutListener); }