protected void renderPanel(Panel panel, boolean canEditPanel) { if (!isPanelOk(panel)) return; setAttribute("panel", panel); setAttribute("recommendedWidth", panelRecommendedWidth + "%"); renderFragment("panelOutputStart"); if (panel.isPaintTitle() || panel.getPanelSession().isMinimized() || (userAdmin) || (panel.getProvider().getDriver().supportsEditMode(panel) && canEditPanel)) { setAttribute("panel", panel); setAttribute("administratorMode", userAdmin); setAttribute( "panelTitle", StringEscapeUtils.ESCAPE_HTML4.translate(getLocalizedValue(panel.getTitle()))); setAttribute("recommendedWidth", panelRecommendedWidth + "%"); setAttribute("editMode", panel.getPanelSession().isEditMode()); renderFragment("panelContentWithMenu"); } else { setAttribute("panel", panel); setAttribute("recommendedWidth", panelRecommendedWidth + "%"); renderFragment("panelContentWithoutMenu"); } setAttribute("panel", panel); renderFragment("panelOutputEnd"); }
private List<Panel> getRegionPanels() { Panel[] allPanels = currentSectionRegion.getPanels(); List<Panel> panels = new ArrayList<Panel>(); boolean onlyOnePanel = false; // When a panel is maximized in region, only show it. for (int i = 0; i < allPanels.length; i++) { Panel panel = allPanels[i]; PanelSession status = panel.getPanelSession(); if (status.isMaximizedInRegion()) { PanelPermission viewPerm = PanelPermission.newInstance(panel, PanelPermission.ACTION_VIEW); boolean canViewPanel = getUserStatus().hasPermission(viewPerm); if (canViewPanel) { panels.add(panel); onlyOnePanel = true; break; } } } if (!onlyOnePanel) for (int i = 0; i < allPanels.length; i++) { Panel panel = allPanels[i]; PanelPermission viewPerm = PanelPermission.newInstance(panel, PanelPermission.ACTION_VIEW); boolean canViewPanel = getUserStatus().hasPermission(viewPerm); if (canViewPanel) { panels.add(panel); } } return panels; }