Package org.richfaces.json

Examples of org.richfaces.json.JSONObject$Null


    public void storeImagesToAlbum(JSONArray ja) {

        String imageId = "";
        String albumId = "";
        JSONObject jo;

        try {
            for (int i = 0; i < ja.length(); i++) {
                jo = ja.getJSONObject(i);

                if (!jo.has("albumId") || !jo.has("id")) {
                    error.fire(new ErrorEvent("Error, object does not contain images"));

                }

                albumId = jo.getString("albumId");
                imageId = jo.getString("id");

                images.get(albumId).put(imageId, jo);
            }
        } catch (JSONException je) {
            error.fire(new ErrorEvent("Error", je.getMessage()));
View Full Code Here


     * @return
     * @throws IOException
     */
    public JSONObject getOpts(FacesContext context, UIComponent component)
            throws IOException {
        JSONObject obj = new JSONObject();
        addAttribute(obj, "zoom", component.getAttributes().get("zoom"));
        addAttribute(obj, "charttype",
                component.getAttributes().get("charttype"));
        addAttribute(obj, "xtype", component.getAttributes().get("xtype"));
        addAttribute(obj, "ytype", component.getAttributes().get("ytype"));
        addAttribute(obj, "serverSideListener", component.getAttributes().get("serverSideListener"));

        JSONObject xaxis = new JSONObject();
        addAttribute(xaxis, "min", component.getAttributes().get("xmin"));
        addAttribute(xaxis, "max", component.getAttributes().get("xmax"));
        addAttribute(xaxis, "autoscaleMargin",
                component.getAttributes().get("xpad"));
        addAttribute(xaxis, "axisLabel", component.getAttributes()
                .get("xlabel"));
        addAttribute(xaxis, "format", component.getAttributes().get("xformat"));

        JSONObject yaxis = new JSONObject();
        addAttribute(yaxis, "min", component.getAttributes().get("ymin"));
        addAttribute(yaxis, "max", component.getAttributes().get("ymax"));
        addAttribute(yaxis, "autoscaleMargin",
                component.getAttributes().get("ypad"));
        addAttribute(yaxis, "axisLabel", component.getAttributes()
                .get("ylabel"));
        addAttribute(yaxis, "format", component.getAttributes().get("yformat"));

        JSONObject legend = new JSONObject();
        addAttribute(legend, "position",
                component.getAttributes().get("position"));
        addAttribute(legend, "sorted", component.getAttributes().get("sorting"));

        addAttribute(obj, "xaxis", xaxis);
View Full Code Here

        public VisitChart(AbstractChart ch) {
            this.nodata = true;
            this.chart = ch;
            this.chartType = null;
            this.data = new JSONArray();
            this.particularSeriesHandlers = new JSONObject();
            this.plotClickHandlers = new JSONArray();
            this.plothoverHandlers = new JSONArray();
            this.particularSeriesListeners = new LinkedList<MethodExpression>();

View Full Code Here

    @Override
    public Object export(ChartDataModel model) throws IOException {
        JSONArray jsData = new JSONArray();
        for (Iterator it = model.getData().entrySet().iterator(); it.hasNext();) {
            JSONObject point = new JSONObject();
            Map.Entry entry = (Map.Entry) it.next();
            try {
                point.put("label", entry.getKey());
                point.put("data", entry.getValue());
            } catch (JSONException ex) {
                throw new IOException(ex);
            }
            jsData.put(point);
        }
View Full Code Here

*/
public class LineStrategy implements ChartStrategy {

    @Override
    public Object export(ChartDataModel model) throws IOException {
        JSONObject output = model.defaultExport();

        // points->symbol
        Object symbol = model.getAttributes().get("symbol");
        if (symbol != null) {
            JSONObject points = new JSONObject();
            ChartRendererBase.addAttribute(points, "symbol", model
                    .getAttributes().get("symbol"));
            ChartRendererBase.addAttribute(points, "show", true);
            ChartRendererBase.addAttribute(output, "points", points);
        }

        // connect symblos with line
        JSONObject lines = new JSONObject();
        ChartRendererBase.addAttribute(lines, "show", true);
        ChartRendererBase.addAttribute(output, "lines", lines);

        return output;
    }
View Full Code Here

    }

    @Override
    public Object export(ChartDataModel model) throws IOException {
        JSONObject obj = model.defaultExport();

        JSONObject bars = new JSONObject();
        ChartRendererBase.addAttribute(bars, "show", true);
        ChartRendererBase.addAttribute(bars, "barWidth", (double) 1 / (model.getData().size() + 1));
        ChartRendererBase.addAttribute(bars, "align", "center");
        ChartRendererBase.addAttribute(obj, "bars", bars);
View Full Code Here

*/
public class BarStrategy implements ChartStrategy {

    @Override
    public Object export(ChartDataModel model) throws IOException {
        JSONObject obj = model.defaultExport();

        JSONObject bars = new JSONObject();
        ChartRendererBase.addAttribute(bars, "show", true);
        ChartRendererBase.addAttribute(bars, "barWidth", calculateBarWidth(obj));
        ChartRendererBase.addAttribute(obj, "bars", bars);

        return obj;
View Full Code Here

    private List<JSONObject> userAlbums;

    public void setUserInfoJSON(String userJson) {
        try {
            userInfo = new JSONObject(userJson);
        } catch (JSONException e) {
            error.fire(new ErrorEvent("Error", e.getMessage()));
        }
    }
View Full Code Here

    public String getUserId() {
        return userInfo != null ? userInfo.optString("id", "1") : "1";
    }

    public String getName() {
        JSONObject name = userInfo.optJSONObject("name");

        return name.optString("givenName") + " " + name.optString("familyName");
    }
View Full Code Here

        data.remove(key);
        keys.remove(key);
    }

    public JSONObject defaultExport() throws IOException {
        JSONObject output = new JSONObject();
        JSONArray jsdata;

        // data
        jsdata = new JSONArray();
View Full Code Here

TOP

Related Classes of org.richfaces.json.JSONObject$Null

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.