Package org.jboss.dashboard.ui.components

Examples of org.jboss.dashboard.ui.components.ModalDialogComponent


                ModalDialogComponent.lookup().hide();
            }
        });

        // Display the error in a modal dialog window.
        ModalDialogComponent modalDialog = ModalDialogComponent.lookup();
        modalDialog.setTitle(report.printErrorTitle());
        modalDialog.setCurrentComponent(errorHandler);
        modalDialog.setCloseListener(new Runnable() {
            public void run() {
                ErrorReportHandler errorHandler = ErrorReportHandler.lookup();
                errorHandler.setErrorReport(null);
            }
        });
        modalDialog.show();

        // Force the current screen to be refreshed so the error report will be displayed.
        ControllerStatus controllerStatus = ControllerStatus.lookup();
        controllerStatus.setResponse(new ShowCurrentScreenResponse());
    }
View Full Code Here


    private static transient Logger log = org.slf4j.LoggerFactory.getLogger(ShowPanelPageComponent.class.getName());

    private String page;

    public void closePopup() {
        ModalDialogComponent mdc = getModalDialogComponent();
        if (mdc.isShowing()) mdc.hide();
    }
View Full Code Here

    private Long panelId;

    abstract Logger getLogger();

    public boolean closeDialog(CommandRequest request) {
        ModalDialogComponent mdc = getModalDialogComponent();

        if (mdc.isShowing()) {
            mdc.actionClose(request);
            return  true;
        }

        return false;
    }
View Full Code Here

        this.width = width;
        this.height = height;

        if (isWellConfigured()) {

            ModalDialogComponent mdc = getModalDialogComponent();

            mdc.setTitle(title);
            mdc.setCurrentComponent(this);
            mdc.setCloseListener(new Runnable() {
                public void run() {
                    try {
                        panel.getProvider().getDriver().activateNormalMode(panel, request);
                    } catch (Exception e) {
                        getLogger().warn("Error closing panel popup: ", e);
                    }
                }
            });
            return mdc.show();
        }
        return false;
    }
View Full Code Here

    public ModalDialogComponent getModalDialog() {
        return (ModalDialogComponent) Factory.lookup("org.jboss.dashboard.ui.components.ModalDialogComponent");
    }

    protected boolean processRequest() throws Exception {
        ModalDialogComponent modalDialog = (ModalDialogComponent) Factory.lookup("org.jboss.dashboard.ui.components.ModalDialogComponent");
        wasModalOn = modalDialog.isShowing();
        configEnabled = navigationManager.isShowingConfig();
        currentWorkspaceId = navigationManager.getCurrentWorkspaceId();
        currentSectionId = navigationManager.getCurrentSectionId();
        return true;
    }
View Full Code Here

    public void setShowedPanelSubgroupId(String showedPanelSubgroupId) {
        this.showedPanelSubgroupId = showedPanelSubgroupId;
    }

    public void actionGetPanelsPopupPage(CommandRequest request) {
        ModalDialogComponent modalDialog = getModalDialogComponent();

        if (modalDialog.isShowing()) {
            modalDialog.hide();
            return;
        }

        ResourceBundle i18n = ResourceBundle.getBundle("org.jboss.dashboard.ui.panel.messages", LocaleManager.currentLocale());
        modalDialog.setTitle(i18n.getString("ui.panels.popup.title"));
        modalDialog.setCurrentComponent(this);
        modalDialog.setModal(false);
        modalDialog.setDraggable(true);
        modalDialog.setCloseListener(new Runnable() {
            public void run() {
                PopupPanelsHandler.this.reset();
            }
        });
        modalDialog.show();
    }
View Full Code Here

    protected boolean processRequest() throws Exception {

        // Check whether the modal window has been activated within the current request.
        ModalDialogStatusSaver modalStatus = ModalDialogStatusSaver.lookup();
        ModalDialogComponent modalDialog = modalStatus.getModalDialog();
        boolean modalOn = modalDialog.isShowing();
        boolean modalOnBeforeRequest = modalStatus.modalOnBeforeRequest();
        boolean modalSwitchedOn = !modalOnBeforeRequest && modalOn;
        boolean modalSwitchedOff = modalOnBeforeRequest && !modalOn;

         // Check if the navigation has changed (f.i: URL typing) and so auto-close the modal (if was opened).
        if (modalOn) {
            if (!modalSwitchedOn) {
                NavigationManager navMgr = NavigationManager.lookup();
                boolean navigationChanged = false;
                boolean configEnabled = navMgr.isShowingConfig();
                boolean wasConfigEnabled = modalStatus.isConfigEnabled();
                String currentWorkspaceId = navMgr.getCurrentWorkspaceId();
                String oldWorkspaceId = modalStatus.getCurrentWorkspaceId();
                Long currentSectionId = navMgr.getCurrentSectionId();
                Long oldSectionId = modalStatus.getCurrentSectionId();
                if (configEnabled != wasConfigEnabled) navigationChanged = true;
                if (ComparatorUtils.compare(currentWorkspaceId, oldWorkspaceId, 1) != 0) navigationChanged = true;
                if (ComparatorUtils.compare(currentSectionId, oldSectionId, 1) != 0) navigationChanged = true;

                if (navigationChanged) {
                    modalDialog.hide();
                    return true;
                }
            }
            // Preserve panel session context when the modal has been activated inside a panel.
            Panel panel = getCurrentPanel();
            if (panel != null) getRequest().setAttribute(Parameters.RENDER_PANEL, panel);
        }

        // If modal has been switched off, return new screen response without ajax so as to
        // force to repaint all screen without the component.
        if (modalSwitchedOff) {
            getControllerStatus().setResponse(new ShowCurrentScreenResponse());
            return true;
        }

        // If no AJAX then just return the current response
        // The modal window is embedded into content.jsp so it will be displayed if the whole screen is repainted.
        String ajaxParam = getRequest().getParameter(Parameters.AJAX_ACTION);
        if (ajaxParam == null || !Boolean.valueOf(ajaxParam).booleanValue()) return true;

        // If the modal window is on then show it.
        // The AJAX response varies depending whether the modal window is rendered for the first time or
        // it's a response inside the modal window.
        if (modalOn) {
            if (modalSwitchedOn) getControllerStatus().setResponse(new ShowComponentAjaxResponse(modalDialog));
            else getControllerStatus().setResponse(new ShowComponentAjaxResponse(modalDialog.getCurrentComponent()));
        }
        return true;
    }
View Full Code Here

            txFragment.execute();
        }
    }

    public void hideModalDialog() {
        ModalDialogComponent mdc = getModalDialogComponent();
        if (mdc.isShowing()) mdc.hide();
    }
View Full Code Here

                ModalDialogComponent.lookup().hide();
            }
        });

        // Display the error in a modal dialog window.
        ModalDialogComponent modalDialog = ModalDialogComponent.lookup();
        modalDialog.setTitle(report.printErrorTitle());
        modalDialog.setCurrentComponent(errorHandler);
        modalDialog.setCloseListener(new Runnable() {
            public void run() {
                ErrorReportHandler errorHandler = ErrorReportHandler.lookup();
                errorHandler.setErrorReport(null);
            }
        });
        modalDialog.show();

        // Force the current screen to be refreshed so the error report will be displayed.
        ControllerStatus controllerStatus = ControllerStatus.lookup();
        controllerStatus.setResponse(new ShowCurrentScreenResponse());
    }
View Full Code Here

        HttpServletRequest request = req.getRequestObject();
        ControllerStatus controllerStatus = ControllerStatus.lookup();

        // Check whether the modal window has been activated within the current request.
        ModalDialogStatusSaver modalStatus = ModalDialogStatusSaver.lookup();
        ModalDialogComponent modalDialog = modalStatus.getModalDialog();
        boolean modalOn = modalDialog.isShowing();
        boolean modalOnBeforeRequest = modalStatus.modalOnBeforeRequest();
        boolean modalSwitchedOn = !modalOnBeforeRequest && modalOn;
        boolean modalSwitchedOff = modalOnBeforeRequest && !modalOn;

         // Check if the navigation has changed (f.i: URL typing) and so auto-close the modal (if was opened).
        if (modalOn) {
            if (!modalSwitchedOn) {
                NavigationManager navMgr = NavigationManager.lookup();
                boolean navigationChanged = false;
                boolean configEnabled = navMgr.isShowingConfig();
                boolean wasConfigEnabled = modalStatus.isConfigEnabled();
                String currentWorkspaceId = navMgr.getCurrentWorkspaceId();
                String oldWorkspaceId = modalStatus.getCurrentWorkspaceId();
                Long currentSectionId = navMgr.getCurrentSectionId();
                Long oldSectionId = modalStatus.getCurrentSectionId();
                if (configEnabled != wasConfigEnabled) navigationChanged = true;
                if (ComparatorUtils.compare(currentWorkspaceId, oldWorkspaceId, 1) != 0) navigationChanged = true;
                if (ComparatorUtils.compare(currentSectionId, oldSectionId, 1) != 0) navigationChanged = true;

                if (navigationChanged) {
                    modalDialog.hide();
                    return true;
                }
            }
            // Preserve panel session context when the modal has been activated inside a panel.
            Panel panel = getCurrentPanel(request);
            if (panel != null) request.setAttribute(Parameters.RENDER_PANEL, panel);
        }

        // If modal has been switched off, return new screen response without ajax so as to
        // force to repaint all screen without the component.
        if (modalSwitchedOff) {
            controllerStatus.setResponse(new ShowCurrentScreenResponse());
            return true;
        }

        // If no AJAX then just return the current response
        // The modal window is embedded into content.jsp so it will be displayed if the whole screen is repainted.
        String ajaxParam = request.getParameter(Parameters.AJAX_ACTION);
        if (ajaxParam == null || !Boolean.valueOf(ajaxParam).booleanValue()) return true;

        // If the modal window is on then show it.
        // The AJAX response varies depending whether the modal window is rendered for the first time or
        // it's a response inside the modal window.
        if (modalOn) {
            if (modalSwitchedOn) controllerStatus.setResponse(new ShowComponentAjaxResponse(modalDialog));
            else controllerStatus.setResponse(new ShowComponentAjaxResponse(modalDialog.getCurrentComponent()));
        }
        return true;
    }
View Full Code Here

TOP

Related Classes of org.jboss.dashboard.ui.components.ModalDialogComponent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.