Package com.diagrammr.data

Examples of com.diagrammr.data.DiagramData


    try {
      User user = UserServiceFactory.getUserService().getCurrentUser();
      String email = user != null ? user.getEmail() : null;

      DiagramData data = DiagramStoreManager.get().getDiagram(
          req.getParameter("key"), email);

      // Post to render server
      String json = URLEncoder.encode(data.toJSON(), "UTF-8");

      HTTPRequest request = new HTTPRequest(new URL(SERVER), HTTPMethod.POST);
      request.setPayload(("json=" + json).getBytes("UTF-8"));
      HTTPResponse response = URLFetchServiceFactory.getURLFetchService()
          .fetch(request);
View Full Code Here


    if (sentence != null) {
      sentence = sentence.trim();
    }
    String command = req.getParameter("cmd");
    String key = req.getParameter("key");
    DiagramData data = DiagramStoreManager.get().getDiagram(key, email);
    if ("add".equals(command)) {
      if (sentence.length() > MAX_SENTENCE_LENGTH ||
          data.getSentences().size() > MAX_DIAGRAM_LENGTH) {
        return;
      }
      data.addSentence(sentence);
    } else if ("delete".equals(command)) {
      data.deleteSentence(sentence);
    } else if ("moveup".equals(command)) {
      data.moveUp(sentence);
    } else if ("movedown".equals(command)) {
      data.moveDown(sentence);
    } else if ("changelayout".equals(command)) {
      data.changeLayout();
    } else if ("resize".equals(command)) {
      int width = Integer.parseInt(req.getParameter("width"));
      int height = Integer.parseInt(req.getParameter("height"));
      data.setSize(new int[] { width, height });
    } else if ("changepermission".equals(command)) {
      data.setOwners(Arrays.asList(req.getParameter("owners").split(",")));
      data.setViewPermission(DiagramData.Permission.valueOf(req
          .getParameter("viewlevel")));
      data.setEditPermission(DiagramData.Permission.valueOf(req
          .getParameter("editlevel")));
    }
    if (command != null) {
      DiagramStoreManager.get().updateDiagram(key, email, data);
    }
    try {
      resp.getWriter().write(data.toJSON(true));
    } catch (JSONException e) {
      e.printStackTrace();
    }
  }
View Full Code Here

TOP

Related Classes of com.diagrammr.data.DiagramData

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.