Package org.richfaces.json

Examples of org.richfaces.json.JSONObject


*/
class DateLineStrategy implements ChartStrategy {

    @Override
    public Object export(ChartDataModel model) throws IOException {
        JSONObject output = new JSONObject();
        JSONArray jsdata;

        // data
        jsdata = new JSONArray();
        for (Iterator it = model.getData().entrySet().iterator(); it.hasNext();) {
View Full Code Here


      HTTPSClient httpsClient = super.getContext().getHttpsClient();
      try {
        String content = httpsClient.getTextFromURL("https://info.teragrid.org:8444/web-apps/json/profile-v1/project",super.getContext().getCredentials().getMyproxyUserName(),super.getContext().getCredentials().getMyproxyPassword());
        JSONArray jsonArray = new JSONArray(content);
        for(int i=0;i<jsonArray.length();i++){
          JSONObject jsonObject = jsonArray.getJSONObject(i);
          projectNameItems.add(new SelectItem(jsonObject.get("projectId")));
        }
      } catch (Exception e) {
        e.printStackTrace();
      }
    }
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 = new JSONObject();
       JSONObject data = new JSONObject();
              
      
       for (Iterator it = model.getData().entrySet().iterator(); it.hasNext();) {
            Map.Entry entry = (Map.Entry) it.next();
            ChartRendererBase.addAttribute(data, entry.getKey().toString(), entry.getValue());
        }
       ChartRendererBase.addAttribute(obj, "data", data);
      
       JSONObject bars = new JSONObject();
       ChartRendererBase.addAttribute(bars, "show", true);
       ChartRendererBase.addAttribute(obj, "bars", bars);
      
       //label
       ChartRendererBase.addAttribute(obj, "label", model.getAttributes().get("label"));
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(obj, "bars", bars);
      
       return obj;
    }
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();
        /*for (Iterator it = getData().entrySet().iterator(); it.hasNext();) {
View Full Code Here

*/
class DateLineStrategy implements ChartStrategy {

    @Override
    public Object export(ChartDataModel model) throws IOException {
        JSONObject output = new JSONObject();
        JSONArray jsdata;

        //data
        jsdata = new JSONArray();
        for (Iterator it = model.getData().entrySet().iterator(); it.hasNext();) {
View Full Code Here

     * @param component
     * @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"));

        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);
        addAttribute(obj, "yaxis", yaxis);
View Full Code Here

        public VisitChart(AbstractChart ch) {
            this.nodata=true;
            this.chart = ch;
            this.chartType = null;
            this.data = new JSONArray();
            this.seriesSpecificHandlers = new JSONObject();
            this.plotClickHandlers = new JSONArray();
            this.plothoverHandlers = new JSONArray();
           
            try{
                addAttribute(seriesSpecificHandlers, "onplotclick", plotClickHandlers);
View Full Code Here

TOP

Related Classes of org.richfaces.json.JSONObject

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.