Window parent = new Window(); // Temporary parent in case materialize fails, so can cleanup. Page currentPage = ExecutionContext.getPage(); parent.setParent(currentPage); Window window = null; window = parent.getChild(Window.class); window.setParent(null); BaseComponent child; while ((child = parent.getFirstChild()) != null) { child.setParent(window); parent.destroy(); window.setParent(currentPage); } else { // Otherwise, use the temp parent as the window window = parent; window.setClosable(closable); window.setSizable(sizable); window.modal(closeListener); window.destroy(); window = null; parent.destroy();
@Override public void afterInitialized(BaseComponent comp) { this.root = (Window) comp; root.setAttribute("controller", this); root.setTitle(root.getAttribute("title", "")); root.addClass("flavor:" + root.getAttribute("panelClass", "panel-primary")); prompt.setLabel(root.getAttribute("prompt", "")); textbox.setValue(root.getAttribute("oldValue", null)); textbox.selectAll(); updateState(); }
/** * Displays the dialog. * * @param text The text or HTML content. HTML content is indicated by prefixing with the html * tag. * @param title Dialog title. * @param allowPrint If true, a print button is provided. * @param asModal If true, open as modal; otherwise, as popup. * @param callback Callback when dialog is closed. * @return The created dialog. */ public static Window show(String text, String title, boolean allowPrint, boolean asModal, IEventListener callback) { Map<String, Object> args = new HashMap<>(); args.put("text", text); args.put("title", title); args.put("allowPrint", allowPrint); Window dialog = PopupDialog.show(DialogConstants.RESOURCE_PREFIX + "reportDialog.fsp", args, true, true, false, null); if (asModal) { dialog.modal(callback); } else { dialog.popup(callback); } return dialog; }
private void close(LayoutIdentifier layoutId) { window.setAttribute("layoutId", layoutId); LayoutManager.defaultIsShared(layoutId.shared); window.close(); }
boolean proxied = proxyId != null; mode = proxied ? HelpViewerMode.POPUP : HelpViewerMode.EMBEDDED; root.setWidth(proxied ? "100%" : lastWidth + "px"); root.setHeight(proxied ? "100%" : lastHeight + "px"); root.setSizable(!proxied); root.setClosable(!proxied); root.setMaximizable(!proxied); root.setMinimizable(!proxied); root.setTitle(proxied ? null : "Help"); root.setVisible(proxied); findView(HelpViewType.HISTORY, true, false); history.addTopicListener(this); root.setCloseAction(CloseAction.DESTROY); page.setTitle("Help"); InvocationRequestQueue proxyQueue = InvocationRequestQueueRegistry.getInstance().get("help" + proxyId); root.setCloseAction(CloseAction.HIDE);
@Override public void afterInitialized(BaseComponent comp) { this.root = (Window) comp; root.setAttribute("controller", this); control = (DialogControl<?>) root.getAttribute("control"); root.setTitle(control.getTitle()); icon.addClass(control.getIconClass()); message.addClass(control.getTextClass()); message.setLabel(control.getMessage()); root.addClass(control.getPanelClass()); chkRemember.setVisible(root.hasAttribute("remember")); root.setOnCanClose(() -> { control.callback(response); return true; }); if (control.getFormat() == ChoiceFormat.BUTTONS) { processButtonResponses(); } else { processListResponses(); } }
/** * Creates a property grid for the given target UI element. * * @param target UI element whose properties are to be edited. * @param parent Parent component for property grid (may be null). * @param embedded If true, the property grid is embedded within another component. * @return Newly created PropertyGrid instance. */ public static PropertyGrid create(ElementBase target, BaseComponent parent, boolean embedded) { Map<String, Object> args = new HashMap<>(); args.put("target", target); args.put("embedded", embedded); Window window = (Window) PageUtil.createPage(DesignConstants.RESOURCE_PREFIX + "propertyGrid.fsp", parent, args) .get(0); if (parent == null) { window.modal(null); } return window.getAttribute("controller", PropertyGrid.class); }
/** * Initializes the property grid. * * @param comp The root component. */ @Override public void afterInitialized(BaseComponent comp) { window = (Window) comp; changeEvent = new ChangeEvent(window, null); @SuppressWarnings("rawtypes") IModelAndView<Row, PropertyEditorBase> mv = gridProperties.getRows().getModelAndView(PropertyEditorBase.class); mv.setRenderer(rowRenderer); mv.setModel(model); comp.setAttribute("controller", this); this.embedded = comp.getAttribute("embedded", false); setTarget(comp.getAttribute("target", ElementBase.class)); if (window.getParent() != null) { window.setClosable(false); window.setWidth("100%"); window.setHeight("100%"); window.setSizable(false); window.addClass("cwf-propertygrid-embedded"); toolbar.setVisible(embedded); } btnOK.setVisible(!embedded); btnCancel.setVisible(!embedded); }
window.setTitle(popupData.getTitle()); window.setParent(currentPage); String pos = getPosition(); window.addStyle("left", pos); window.addStyle("top", pos); window.addEventListener("close", this); Label label = window.findByName("messagetext", Label.class); label.setLabel(popupData.getMessage()); window.setMode(Mode.POPUP); } catch (Exception e) {}
/** * Handles close events from the client. */ @EventHandler(value = "close", syncToClient = false, mode = "init") private void _close() { close(); }
/** * Opens the window modally. */ public void modal() { modal(null); }
/** * Set the current caption. * * @param caption Current caption. */ public void setCaption(String caption) { panel.setTitle(caption); }
/** * @see org.carewebframework.help.IHelpViewer#show() */ @Override public void show() { lblLoading.setVisible(false); tvNavigator.setVisible(true); if (mode == HelpViewerMode.EMBEDDED) { root.setHeight(lastHeight + "px"); root.setWidth(lastWidth + "px"); root.setSize(Size.NORMAL); root.popup(null); } else { ClientUtil.invoke("window.focus"); } }
/** * Display the Layout Manager dialog * * @param rootElement The root UI element. */ public static void execute(ElementBase rootElement) { Window dlg = getInstance(true); dlg.getAttribute("controller", LayoutDesigner.class).init(rootElement); dlg.popup(null); }
if (canClose()) { switch (closeAction) { case DESTROY: destroy(); break; detach(); break; setVisible(false); break;
/** * Display view resources dialog. * * @param scenario Scenario whose resources are to be viewed. * @param callback Callback upon dialog closure. */ public static void show(Scenario scenario, IResponseCallback<Boolean> callback) { Map<String, Object> args = new HashMap<>(); args.put("scenario", scenario); Window dlg = (Window) PageUtil.createPage("web/org/hspconsortium/cwf/ui/scenario/viewResources.fsp", null, args) .get(0); dlg.modal((event) -> { if (callback != null) { callback.onComplete(dlg.hasAttribute("modified")); } }); }
window.setTitle( StrUtil.formatMessage("@cwf.shell.designer.add.component.title", parentElement.getDefinition().getName())); window.setOnCanClose(() -> { if (favoritesChanged) { PropertyUtil.saveValues(DesignConstants.DESIGN_FAVORITES_PROPERTY, null, false, favorites);