Package edu.wpi.cs.wpisuitetng.network

Examples of edu.wpi.cs.wpisuitetng.network.RequestObserver


  /**
   * Sends a request for all of the defects
   */
  public void refreshData() {   
    final RequestObserver requestObserver = new RetrieveAllDefectsRequestObserver(this);
    Request request;
    request = Network.getInstance().makeRequest("defecttracker/defect", HttpMethod.GET);
    request.addObserver(requestObserver);
    request.send();
  }
View Full Code Here


  /**
   * Save the view's Defect model to the server (asynchronous).
   */
  public void save() {
    final DefectPanel panel = (DefectPanel) view.getDefectPanel();
    final RequestObserver requestObserver = (panel.getEditMode() == Mode.CREATE) ? new CreateDefectRequestObserver(view) : new UpdateDefectRequestObserver(view);
    Request request;
    panel.getParent().setInputEnabled(false);
    request = Network.getInstance().makeRequest("defecttracker/defect", (panel.getEditMode() == Mode.CREATE) ? HttpMethod.PUT : HttpMethod.POST);
    request.setBody(panel.getEditedModel().toJSON());
    request.addObserver(requestObserver);
View Full Code Here

   * Save a comment to the server
   */
  public void saveComment() {
    final String commentText = view.getCommentField().getText();
    if (commentText.length() > 0) {
      final RequestObserver requestObserver = new SaveCommentObserver(this);
      final Request request = Network.getInstance().makeRequest(
          "defecttracker/comment", HttpMethod.PUT);
      final Comment comment = new Comment(model.getId(), model.getCreator(), view.getCommentField().getText());
      view.getCommentField().setText("");
      request.setBody(comment.toJSON());
View Full Code Here

TOP

Related Classes of edu.wpi.cs.wpisuitetng.network.RequestObserver

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.