Package org.apache.wicket.ajax.json

Examples of org.apache.wicket.ajax.json.JSONArray


      if (isElementSnapshotList.pollLast()) {
        List<Boolean> undoCreationList = undoSnapshotCreationList.pollLast();
        List<Element> undoElement = undoSnapshots.pollLast();

        String deleteList = "";
        JSONArray changeList = new JSONArray();

        IWebSocketConnectionRegistry reg = WebSocketSettings.Holder.get(Application.get()).getConnectionRegistry();

        for (int i = 0; i < undoElement.size(); i++) {
          if (undoCreationList.get(i)) {
            elementMap.remove(undoElement.get(i).getId());
            if (loadedElementMap.containsKey(undoElement.get(i).getId())) {
              loadedContent = "";
              whiteboardMap.get(whiteboardObjectId).setLoadedContent("");
              loadedElementMap.remove(undoElement.get(i).getId());
            }
            if ("".equals(deleteList)) {
              deleteList = "" + undoElement.get(i).getId();
            } else {
              deleteList += "," + undoElement.get(i).getId();
            }
          } else {
            elementMap.put(undoElement.get(i).getId(), undoElement.get(i));
            try {
              changeList.put(undoElement.get(i).getJSON());
            } catch (JSONException e) {
              log.error("Unexpected error while getting JSON", e);
            }
          }
        }
View Full Code Here


  private boolean handleEraseAll() {
    elementMap.clear();
    IWebSocketConnectionRegistry reg = WebSocketSettings.Holder.get(Application.get()).getConnectionRegistry();
    for (IWebSocketConnection c : reg.getConnections(Application.get())) {
      try {
        JSONArray jsonArray = new JSONArray();
        c.sendMessage(getEraseAllMessage(jsonArray).toString());
        return true;
      } catch (Exception e) {
        log.error("Unexpected error while sending message through the web socket", e);
      }
View Full Code Here

    }

    boolean result = false;
    JSONObject saveObject = new JSONObject();

    JSONArray elementArray = new JSONArray();
    for (int elementID : elementMap.keySet()) {
      try {
        elementArray.put(elementMap.get(elementID).getJSON());
      } catch (JSONException e) {
        log.error("Unexpected error while getting JSON", e);
      }
    }
    JSONObject backgroundJSON = null;
View Full Code Here

  private void handleClipArts() {
    loadClipArts();
    IWebSocketConnectionRegistry reg = WebSocketSettings.Holder.get(Application.get()).getConnectionRegistry();
    for (IWebSocketConnection c : reg.getConnections(Application.get())) {
      try {
        JSONArray jsonArray = new JSONArray();
        for (String clipArtURL : clipArts) {
          jsonArray.put(clipArtURL);
        }
        c.sendMessage(getClipArtListMessage(jsonArray).toString());
      } catch (Exception e) {
        log.error("Unexpected error while sending message through the web socket", e);
      }
View Full Code Here

  private void handleDocs() {
    loadDocuments();
    IWebSocketConnectionRegistry reg = WebSocketSettings.Holder.get(Application.get()).getConnectionRegistry();
    for (IWebSocketConnection c : reg.getConnections(Application.get())) {
      try {
        JSONArray jsonArray = new JSONArray();
        Set<String> keySet = docMap.keySet();
        for (String key : keySet) {
          jsonArray.put(docMap.get(key).get(0));
        }
        c.sendMessage(getDocumentListMessage(jsonArray).toString());
      } catch (Exception e) {
        log.error("Unexpected error while sending message through the web socket", e);
      }
View Full Code Here

  private void handleDocComponents(String docBaseName) {
    loadDocuments();
    IWebSocketConnectionRegistry reg = WebSocketSettings.Holder.get(Application.get()).getConnectionRegistry();
    for (IWebSocketConnection c : reg.getConnections(Application.get())) {
      try {
        JSONArray jsonArray = new JSONArray();
        for (String url : docMap.get(docBaseName)) {
          jsonArray.put(url);
        }
        c.sendMessage(getDocumentComponentListMessage(jsonArray).toString());
      } catch (Exception e) {
        log.error("Unexpected error while sending message through the web socket", e);
      }
View Full Code Here

    initReferences(response);

    try {
      // Synchronizing existing content between clients
      JSONArray elements = null;
      if (!elementMap.isEmpty()) {
        Map<Integer, Element> sortedElementList = new TreeMap<Integer, Element>(elementMap);
        elements = new JSONArray();
        for (Element e : sortedElementList.values()) {
            elements.put(e.getJSON());
        }
      }
 
      response.render(OnDomReadyHeaderItem.forScript(String.format("initWB('%s', '%s', %s, %s);", getCallbackUrl(), whiteboardMarkupId
          , elements, background == null ? null : background.getJSON())));
View Full Code Here

   */
  public void buildResourceStream()
  {
    JSONObject json;
    String cmd = null, id = null;
    JSONArray paramArray = null;

    HttpServletRequest req = ((ServletWebRequest)RequestCycle.get().getRequest()).getContainerRequest();
    BufferedReader reader = null;
    try
    {
View Full Code Here

      {
        errors.add(event.getInvalidWord());
      }
    });

    JSONArray words = paramArray.optJSONArray(1);
    checker.checkSpelling(new StringWordTokenizer(words.toString()));
    respond(errors.iterator(), cmd, id);
  }
View Full Code Here

    respond(errors.iterator(), cmd, id);
  }

  private void respond(Iterator<String> words, String cmd, String id)
  {
    JSONArray array = new JSONArray();
    if (words != null)
    {
      while (words.hasNext())
        array.put(words.next());
    }

    JSONObject response = new JSONObject();
    try
    {
View Full Code Here

TOP

Related Classes of org.apache.wicket.ajax.json.JSONArray

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.