Package org.jboss.dashboard.workspace

Examples of org.jboss.dashboard.workspace.Panel


     *
     * @return Mapping to the controller servlet.
     */
    public String getBaseURI() {
        // Avoid an extra Controller in URL when it is already friendly
        Panel panel = RequestContext.lookup().getActivePanel();
        if (panel != null) {  // There will be a friendly url here
            return getLinkToPage(panel.getSection(), true);
        }
        return getServletMapping();
    }
View Full Code Here


     * @return A link url to a bean action
     */
    public String getMarkup(String beanName, String action, Map params) {
        try {
            if (params == null) params = new HashMap();
            Panel panel = RequestContext.lookup().getActivePanel();
            if (panel != null) {
                params.put(Parameters.DISPATCH_IDPANEL, panel.getPanelId());
                params.put(Parameters.DISPATCH_ACTION, "_factory");
            }

            StringBuffer sb = new StringBuffer();
            sb.append(_getServletMapping()).append("?");
View Full Code Here

     * @throws Exception
     */
    protected CommandResponse processShowKPI(final HttpServletRequest request, final HttpServletResponse response) throws Exception {
        String kpiCode = request.getParameter("kpi");
        KPI kpi = null;
        Panel currentPanel = null;

        if (kpiCode != null) {
            kpi = DataDisplayerServices.lookup().getKPIManager().getKPIByCode(kpiCode);
        }

View Full Code Here

    /**
     * Returns the panel where KPI has been configured. If more than one panel is showing this KPI,
     * then the first one is returned.
     */
    protected Panel getKPIPanel(KPI kpi) throws Exception {
        Panel currentPanel = null;
        PanelsManager panelsManager = UIServices.lookup().getPanelsManager();
        Set<PanelInstance> panelsI = panelsManager.getPanelsByParameter(DashboardHandler.KPI_CODE, kpi.getCode());

        if (panelsI != null && !panelsI.isEmpty()) {
            List<Panel> allPanels = new ArrayList<Panel>();
View Full Code Here

            return true;
        }

        // Get the specified panel from the current page.
        Section currentPage = NavigationManager.lookup().getCurrentSection();
        Panel panel = currentPage.getPanel(idPanel);
        if (panel == null) {
            // If not found then try to get the panel from wherever the request comes from.
            panel = UIServices.lookup().getPanelsManager().getPaneltById(new Long(idPanel));
            if (panel == null) {
                log.error("Cannot dispatch to panel " + idPanel + ". Panel not found.");
                return true;
            }
            // Ensure the panel's section is set as current.
            // This is needed to support requests coming from pages reached after clicking the browser's back button.
            NavigationManager.lookup().setCurrentSection(panel.getSection());
        }

        CodeBlockTrace trace = new PanelActionTrace(panel, pAction).begin();
        try {
            WorkspacePermission workspacePerm = WorkspacePermission.newInstance(panel.getWorkspace(), WorkspacePermission.ACTION_LOGIN);
            if (UserStatus.lookup().hasPermission(workspacePerm)) {
                SectionPermission sectionPerm = SectionPermission.newInstance(panel.getSection(), SectionPermission.ACTION_VIEW);
                if (UserStatus.lookup().hasPermission(sectionPerm)) {
                    PanelProvider provider = panel.getInstance().getProvider();
                    if (provider.isEnabled()) {
                        PanelDriver handler = provider.getDriver();
                        CommandResponse response = handler.execute(panel, getRequest());
                        if (response != null)
                            requestContext.setResponse(response);
View Full Code Here

        // 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 the request is being executed within a panel the pass such panel to the response.
        if (modalOn) {
            Panel panel = getCurrentPanel(request);
            if (modalSwitchedOn) setResponse(new ShowBeanAjaxResponse(modalDialog, panel));
            else setResponse(new ShowBeanAjaxResponse(modalDialog.getCurrentComponent(), panel));
        }
        return true;
    }
View Full Code Here

        Long id = Long.decode(idPanel);

        NavigationManager navMgr = NavigationManager.lookup();
        Panel[] panels =  navMgr.getCurrentSection().getAllPanels();
        for (int i = 0; i < panels.length; i++) {
            Panel panel = panels[i];
            if (panel.getPanelId().equals(id)) return panel;
        }
        return null;
    }
View Full Code Here

        if (panelId == null) return null;
        return UIServices.lookup().getPanelsManager().getPaneltByDbId(panelId);
    }

    public boolean execute(CommandRequest cmdReq) throws Exception {
        Panel panel = getPanel();
        if (log.isDebugEnabled()) log.debug("FullPanelAjaxResponse: " + panel.getFullDescription());
        try {
            RequestContext.lookup().activatePanel(panel);

            if (log.isDebugEnabled()) log.debug("ShowComponentAjaxResponse: " + component.getBeanName());
            cmdReq.getResponseObject().setHeader("Content-Encoding", HTTPSettings.lookup().getEncoding());
View Full Code Here

        if (panelId == null) return null;
        return UIServices.lookup().getPanelsManager().getPaneltByDbId(panelId);
    }

    public boolean execute(CommandRequest cmdReq) throws Exception {
        Panel panel = getPanel();
        PanelSession pSession = panel.getPanelSession();
        pSession.setCurrentPageId(page);
        if (log.isDebugEnabled()) log.debug("FullPanelAjaxResponse: " + panel.getFullDescription());
        try {
            RequestContext.lookup().activatePanel(panel);

            cmdReq.getResponseObject().setHeader("Content-Encoding", HTTPSettings.lookup().getEncoding());
            cmdReq.getResponseObject().setContentType("text/html;charset=" + HTTPSettings.lookup().getEncoding());
            RequestDispatcher rd[] = {
                    cmdReq.getRequestObject().getRequestDispatcher(commonRefreshPanelsPage),
                    cmdReq.getRequestObject().getRequestDispatcher(beforePanelsPage),
                    cmdReq.getRequestObject().getRequestDispatcher(panel.getProvider().getPage(page)),
                    cmdReq.getRequestObject().getRequestDispatcher(afterPanelsPage)};
            panel.getProvider().getDriver().fireBeforeRenderPanel(panel, cmdReq.getRequestObject(), cmdReq.getResponseObject());
            for (int i = 0; i < rd.length; i++) {
                RequestDispatcher requestDispatcher = rd[i];
                requestDispatcher.include(cmdReq.getRequestObject(), cmdReq.getResponseObject());
                cmdReq.getResponseObject().flushBuffer();
            }
            panel.getProvider().getDriver().fireAfterRenderPanel(panel, cmdReq.getRequestObject(), cmdReq.getResponseObject());
            return true;
        } finally {
            RequestContext.lookup().deactivatePanel(panel);
        }
    }
View Full Code Here

    }

    @Override
    public void beforeRenderBean() {
        try {
            Panel panel = getPanel();
            RequestContext.lookup().activatePanel(panel);
        } catch (Exception e) {
            getLogger().warn("Error setting current panel: ", e);
        }
    }
View Full Code Here

TOP

Related Classes of org.jboss.dashboard.workspace.Panel

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.