Package org.openfaces.component.chart

Examples of org.openfaces.component.chart.ChartPopup


public class ChartPopupRenderer extends PopupLayerRenderer implements AjaxPortionRenderer {

    @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);
        }
    }
View Full Code Here


    @Override
    public void encodeEnd(FacesContext context, UIComponent component) throws IOException {
        super.encodeEnd(context, component);

        final ChartPopup popup = (ChartPopup) component;
        renderScripts(context, popup);
    }
View Full Code Here

        final ChartPopup popup = (ChartPopup) component;
        renderScripts(context, popup);
    }

    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));
View Full Code Here

TOP

Related Classes of org.openfaces.component.chart.ChartPopup

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.