@Override public void encodeChildren(FacesContext context, UIComponent component) throws IOException { final ChartPopup popup = (ChartPopup) component; if (popup.getLoadingMode().equals(LoadingMode.SERVER)) { throw new IllegalArgumentException( "Server loading mode is unsupported by ChartPopup component."); } final boolean clientLoadingMode = popup.getLoadingMode().equals(LoadingMode.CLIENT); if (clientLoadingMode) { super.encodeChildren(context, component); } }
private void renderScripts(FacesContext context, UIComponent component) throws IOException { final ChartPopup popup = (ChartPopup) component; final String clientId = popup.getClientId(context); final boolean clientLoadingMode = popup.getLoadingMode().equals(LoadingMode.CLIENT); final UIComponent chartView = popup.getParent(); final Chart chart = (Chart) chartView.getParent(); final Integer entityIndex = chart.getEntityIndex(); chart.setEntityIndex(-1); final String chartId = chart.getClientId(context); chart.setEntityIndex(entityIndex); ScriptBuilder buf = new ScriptBuilder(); buf.functionCall("O$.ChartPopup._init", clientId, popup.getLoadingMode().toString(), chartId) .semicolon(); Rendering.renderInitScript( context, buf, Resources.utilJsURL(context), Resources.internalURL(context, "chart/chart.js"), (!clientLoadingMode ? Resources.ajaxUtilJsURL(context) : null)); }