Examples of JsonBuilder


Examples of com.vaynberg.wicket.select2.json.JsonBuilder

    @Override
    protected void renderInitializationScript(IHeaderResponse response) {
  Collection<? extends T> choices = getModelObject();
  if (choices != null && !choices.isEmpty()) {

      JsonBuilder selection = new JsonBuilder();

      try {
    selection.array();
    for (T choice : choices) {
        selection.object();
        getProvider().toJson(choice, selection);
        selection.endObject();
    }
    selection.endArray();
      } catch (JSONException e) {
    throw new RuntimeException("Error converting model objec to Json", e);
      }

      response.renderOnDomReadyJavaScript(JQuery.execute("$('#%s').select2('data', %s);", getMarkupId(),
        selection.toJson()));
  }
    }
View Full Code Here

Examples of groovy.json.JsonBuilder

})
public class JsonBuilderBindingsValuesProvider extends HashMap<String, Object> {

    public JsonBuilderBindingsValuesProvider() {
        super();
        put("jsonBuilder", new JsonBuilder());
    }
View Full Code Here

Examples of groovy.json.JsonBuilder

    }

    @Override
    public JsonBuilder read(final Kryo kryo, final Input input, final Class<JsonBuilder> jsonBuilderClass) {
        final String jsonString = input.readString();
        return new JsonBuilder(slurper.parseText(jsonString));
    }
View Full Code Here

Examples of groovy.json.JsonBuilder

/**
* Created by dteo on 10/05/2014.
*/
public class MapToJson {
  public static String convert(Map map) {
    JsonBuilder json = new JsonBuilder();
    json.call(map);
    return json.toPrettyString();
  }
View Full Code Here

Examples of net.sf.json.util.JSONBuilder

    osw.flush();
  }
 
  @Override
  public void write(Writer writer) throws Exception {
    JSONBuilder builder = new JSONBuilder(writer);
    write(builder);
  }
View Full Code Here

Examples of net.sf.json.util.JSONBuilder

    }
   
    private void writeJSON(Writer outWriter, DescribeLayerModel description) throws IOException {

        try {
            JSONBuilder json = new JSONBuilder(outWriter);
            final List<LayerDescription> layers = description.getLayerDescriptions();
            json.object();
            json.key("version").value(description.getVersion());
            json.key("layerDescriptions");
            json.array();
            for (LayerDescription layer : layers) {
                json.object();
                json.key("layerName").value(layer.getName());
                URL url = layer.getOwsURL();
                json.key("owsURL").value(url != null ? url.toString() : "");
                json.key("owsType").value(layer.getOwsType());
                json.key("typeName").value(layer.getName());
                json.endObject();
            }
            json.endArray();
            json.endObject();
        } catch (JSONException jsonException) {
            ServiceException serviceException = new ServiceException("Error: "
                    + jsonException.getMessage());
            serviceException.initCause(jsonException);
            throw serviceException;
View Full Code Here

Examples of net.sf.json.util.JSONBuilder

    write(osw);
    osw.flush();
  }
 
  public void write(Writer writer) throws Exception {
    JSONBuilder builder = new JSONBuilder(writer);
    builder.object();
    writeDirectory(builder, top);
    builder.endObject();
  }
View Full Code Here

Examples of org.wicketstuff.select2.json.JsonBuilder

      value = getModelObject();
    }

    if (value != null) {

      JsonBuilder selection = new JsonBuilder();

      try {
        selection.object();
        getProvider().toJson(value, selection);
        selection.endObject();
      } catch (JSONException e) {
        throw new RuntimeException("Error converting model object to Json", e);
      }
      response.render(OnDomReadyHeaderItem.forScript(JQuery.execute("$('#%s').select2('data', %s);", getJquerySafeMarkupId(),
          selection.toJson())));
    }
  }
View Full Code Here

Examples of org.wicketstuff.select2.json.JsonBuilder

      choices = getModelObject();
    }

    if (choices != null && !choices.isEmpty()) {

      JsonBuilder selection = new JsonBuilder();

      try {
        selection.array();
        for (T choice : choices) {
          selection.object();
          getProvider().toJson(choice, selection);
          selection.endObject();
        }
        selection.endArray();
      } catch (JSONException e) {
        throw new RuntimeException("Error converting model object to Json", e);
      }

      response.render(OnDomReadyHeaderItem.forScript(JQuery.execute("$('#%s').select2('data', %s);", getJquerySafeMarkupId(),
          selection.toJson())));
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.