/** * Override to implement any special controller initialization logic. */ protected void initializeController() { log.trace("Initializing Controller"); if (lblMessage != null) { lblMessage.addStyle("text-align", "center"); } Style style = new Style(); style.setSrc(CWFUtil.getResourcePath(AbstractServiceController.class, 1) + "common.css"); root.getPage().addChild(style); }
@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 protected void onAttach(Page page) { try { CommandUtil.associateCommand("help", this); getPage().addChild(messageWindow = new MessageWindow()); addChild(registeredStyles); desktop = new ElementDesktop(this); setLogoutConfirm(logoutConfirm); String confirmClose = getAppProperty("confirmClose", "CAREWEB.CONFIRM.CLOSE"); if (StringUtils.isEmpty(confirmClose) || BooleanUtils.toBoolean(confirmClose)) { ClientUtil.canClose(false); } String layout = defaultLayoutName != null ? defaultLayoutName : getAppProperty("layout", "CAREWEB.LAYOUT.DEFAULT"); if (!StringUtils.isEmpty(layout)) { loadLayout(layout); } } catch (Exception e) { log.error("Error initializing the shell.", e); throw MiscUtil.toUnchecked(e); } }