/** Sets the mode to overlapped, popup, modal, embedded or highlighted. * * @see #setMode(String) */ public void setMode(int mode) { switch (mode) { case POPUP: doPopup(); break; case OVERLAPPED: doOverlapped(); break; case EMBEDDED: doEmbedded(); break; case MODAL: if (isEventThreadEnabled(false)) Events.postEvent(Events.ON_MODAL, this, null); else doModal(); break; case HIGHLIGHTED: doHighlighted(); break; default: throw new WrongValueException("Unknown mode: " + mode); } }
/** Process the onClose event sent when the close button is pressed. * <p>Default: detach itself. */ public void onClose() { detach(); }
public void onPageDetached(Page page) { super.onPageDetached(page); if (_mode == MODAL && getPage() == null) leaveModal(OVERLAPPED); }
/** * @param title the window title (see {@link #setTitle}). * @param border the border (see {@link #setBorder}). * @param closable whether it is closable (see {@link #setClosable}). */ public Window(String title, String border, boolean closable) { this(); setTitle(title); setBorder(border); setClosable(closable); }
public void render(Component comp, Writer out) throws IOException { final SmartWriter wh = new SmartWriter(out); final Window self = (Window)comp; final String uuid = self.getUuid(); final String zcls = self.getZclass(); wh.write(self.getOuterAttrs()).write(self.getInnerAttrs()).write(">"); final Caption caption = self.getCaption(); final String title = self.getTitle(); final boolean isFrame = !self.inEmbedded() && !self.inPopup(); final String noBorder = !"normal".equals(self.getBorder()) ? "-noborder" : ""; if (caption != null || title.length() > 0) { wh.write("<div class=\"").write(zcls).write("-tl\"><div class=\"") .write(uuid).write("!caption\" class=\"").write(zcls).write("-header\">"); if (caption == null) { if (self.isClosable()) wh.write("<div id=\"").write(uuid).write("!close\" class=\"").write(zcls).write("-icon ").write(zcls).write("-close\"></div>"); if (self.isMaximizable()) { wh.write("<div id=\"").write(uuid).write("!maximize\" class=\"").write(zcls).write("-icon ").write(zcls).write("-max"); if (self.isMaximized()) wh.write(" ").write(zcls).write("-maxd"); wh.write("\"></div>"); if (self.isMinimizable()) wh.write("<div id=\"").write(uuid).write("!minimize\" class=\"").write(zcls).write("-icon ").write(zcls).write("-min\"></div>"); new Out(title).render(out); wh.write(self.getContentSclass()).write(" ").write(zcls).write("-cnt").write(noBorder); wh.write("\"").writeAttr("style", self.getContentStyle());
/** * Displays the encounter selection dialog. * * @param flags The encounter flags. */ public static void execute(EncounterFlag... flags) { String resource = Constants.RESOURCE_PREFIX + "encounterSelection.zul"; Window dlg = (Window) FrameworkUtil.getAttribute(resource); if (dlg == null || dlg.getPage() == null) { dlg = PopupDialog.popup(resource, true, true, false); FrameworkUtil.setAttribute(resource, dlg); } try { EncounterSelection sel = ZKUtil.findChild(dlg, EncounterSelection.class); sel.setEncounterFlags(EncounterFlag.flags(flags)); dlg.doModal(); } catch (Exception e) { throw new RuntimeException(e); } }
@Listen("onClick = #reorderBtn") public void onEditorOpen(Event e) { Window win = (Window) Executions.createComponents("/lbMenu.zul", this.getSelf(), null); win.doModal(); }
/** * Handles a deferred request to show the dialog. * * @param event The onShow event. * @throws Exception Unspecified exception. */ public void onShow(Event event) throws Exception { root.removeAttribute(Constants.SELECTED_PATIENT_ATTRIB); lstSearch.clearSelection(); onCheck$rgrpLists(); Events.echoEvent(Events.ON_FOCUS, root, null); if (!root.inModal()) { root.doModal(); } }
@Override public Patient select() { Events.sendEvent("onShow", dlg, null); return (Patient) dlg.getAttribute(Constants.SELECTED_PATIENT_ATTRIB); } };
@Override public void doAfterCompose(Component comp) throws Exception { super.doAfterCompose(comp); record = (AntiCoagRecord) arg.get("record"); inputs = new Component[] { rgIndicated, cboGoal, cboMin, cboMax, cboDuration, datStart, wbProvider, txtComment }; loadComboValues(); Window win = (Window) root; win.setTitle(StrUtil.formatMessage(win.getTitle(), record == null ? "Add" : "Edit")); Events.postEvent("onInitDialog", comp, null); }
if (view instanceof Window) { Window win = (Window) view; PageCtrl pc = (PageCtrl) win.getPage(); pc.addBeforeHeadTags("<script type=\"text/javascript\">" + "(function(i,s,o,g,r,a,m)" + "{i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){" + "(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();" + "a=s.createElement(o)," + "m=s.getElementsByTagName(o)[0];" + "a.async=1;a.src=g;m.parentNode.insertBefore(a,m)" + "})" + "(window,document,'script','//www.google-analytics.com/analytics.js','ga');" + "ga('create', " + this.trackingID + ", 'auto'); " + "ga('send', 'pageview');" + "</script>"); } else { throw new UiException("This view model must be applied from a Window component."); }
@Override public void doAfterCompose(Component comp) throws Exception { super.doAfterCompose(comp); Iterator<Object> params = getParameters(); lookupParams = new LookupParams((Table) params.next()); ((Window) comp).setTitle("Lookup " + lookupParams.getTableName()); String searchText = (String) params.next(); autoReturn = (Boolean) params.next(); screen = (String) params.next(); if (screen == null) { screen = lookupParams.getScreen(); } txtSearch.setText(searchText); if (lookupParams.getRpc() == null) { close(true); } initHeaders(); }
private void afterUnmarshal() { for (Iterator<Component> it = getChildren().iterator(); it.hasNext();) { final Object child = it.next(); if (child instanceof Caption) { _caption = (Caption) child; break; } } }
@Override public void doAfterCompose(Component comp) throws Exception { super.doAfterCompose(comp); String[] subsets = (String[]) arg.get("subsets"); TermSubset termSubsets = TermUtil.getSubset(null); for (String subset : subsets) { Listitem item = new Listitem(termSubsets.getMemberName(subset)); item.setValue(subset); lbSubset.appendChild(item); } if (subsets.length == 1) { pnlSubset.setVisible(false); lbSubset.setSelectedIndex(0); ((Window) root).getCaption().setLabel(lbSubset.getSelectedItem().getLabel()); } treeSearch.setItemRenderer(termMatchRenderer); }
/** * Displays the encounter selection dialog. * * @param flags The encounter flags. */ public static void execute(EncounterFlag... flags) { try { Window dlg = (Window) FrameworkUtil.getAttribute(SELECTION_DIALOG); if (dlg == null || dlg.getPage() == null) { dlg = PopupDialog.popup(SELECTION_DIALOG, true, true, false); FrameworkUtil.setAttribute(SELECTION_DIALOG, dlg); } MainController sel = (MainController) getController(dlg); sel.setEncounterFlags(EncounterFlag.flags(flags)); if (sel.needsInit) { sel.init(); } dlg.doModal(); } catch (Exception e) { FrameworkUtil.setAttribute(SELECTION_DIALOG, null); throw MiscUtil.toUnchecked(e); } }
/** Process the onModal event by making itself a modal window. */ public void onModal() { doModal(); }
public static AntiCoagRecord show(AntiCoagRecord record) { Map<Object, Object> args = new HashMap<Object, Object>(); args.put("record", record); return (AntiCoagRecord) PopupDialog.popup(DIALOG, args, false, false, true).getAttribute(ATTR_RESULT); }
doPopup(); else if ("overlapped".equals(name)) doOverlapped(); else if ("embedded".equals(name)) doEmbedded(); else if ("modal".equals(name)) { if (isEventThreadEnabled(false)) Events.postEvent(Events.ON_MODAL, this, null); else doModal(); } else if ("highlighted".equals(name)) doHighlighted(); else throw new WrongValueException("Unknown mode: " + name);
/** * Show detail for specified list item. * * @param li The list item. */ protected void showDetail(Listitem li) { @SuppressWarnings("unchecked") M modelObject = li == null ? null : (M) li.getValue(); String detail = modelObject == null ? null : getDetail(modelObject); if (!StringUtils.isEmpty(detail)) { if (getShowDetailPane()) { detailView.setContent(detail); } else { Map<Object, Object> map = new HashMap<Object, Object>(); map.put("title", detailTitle); map.put("content", detail); map.put("allowPrint", getAllowPrint()); try { ((Window) ZKUtil.loadZulPage(Constants.RESOURCE_PREFIX + "resourceListDetail.zul", null, map)).doModal(); } catch (Exception e) { PromptDialog.showError(e); } } } }
@Command public void test(@BindingParam("cmp") Window x) { x.detach(); }