Package edu.wpi.cs.wpisuitetng.network

Examples of edu.wpi.cs.wpisuitetng.network.Request.addObserver()


   */
  public void refreshData() {   
    final RequestObserver requestObserver = new RetrieveAllDefectsRequestObserver(this);
    Request request;
    request = Network.getInstance().makeRequest("defecttracker/defect", HttpMethod.GET);
    request.addObserver(requestObserver);
    request.send();
  }

  /**
   * This method is called by the {@link RetrieveAllDefectsRequestObserver} when the
View Full Code Here


      }

      // Generate the request
      Request request;
      request = Network.getInstance().makeRequest("defecttracker/defect/" + id, HttpMethod.GET);
      request.addObserver(new LookupRequestObserver(this));
      request.send();
    }
  }

  /**
 
View Full Code Here

        String defectId = (String) resultsTable.getValueAt(row, 0);

        // Create and send a request for the defect with the given ID
        Request request;
        request = Network.getInstance().makeRequest("defecttracker/defect/" + defectId, HttpMethod.GET);
        request.addObserver(new RetrieveDefectRequestObserver(this));
        request.send();
      }
    }
  }
View Full Code Here

    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);
    request.send();
  }

}
View Full Code Here

      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());
      request.addObserver(requestObserver);
      request.send();
    }
  }
 
  /**
 
View Full Code Here

    // Make a new POST Request.
    Request manualRequest = new Request(config, "subpath", HttpMethod.POST)// construct the Request

    // Configure the request
    manualRequest.setBody(body1)// set the request body to send to the server
    manualRequest.addObserver(requestObserver)// Add the requestObserver to the request's set of Observers

    // Send the request!
    manualRequest.send();

    // This should print first.
View Full Code Here

    // Make a new POST Request with the default network configuration.
    Request networkRequest = Network.getInstance().makeRequest("subpath", HttpMethod.POST);

    // Configure the request
    networkRequest.setBody(body2)// set the request body to send to the server
    networkRequest.addObserver(requestObserver)// Add the requestObserver to the request's set of Observers

    // Send the request!
    networkRequest.send();

    // This should print first.
View Full Code Here

      view.getTxtNewMessage().setText("");
     
      // Send a request to the core to save this message
      final Request request = Network.getInstance().makeRequest("postboard/postboardmessage", HttpMethod.PUT); // PUT == create
      request.setBody(new PostBoardMessage(message).toJSON()); // put the new message in the body of the request
      request.addObserver(new AddMessageRequestObserver(this)); // add an observer to process the response
      request.send(); // send the request
    }
  }

  /**
 
View Full Code Here

  @Override
  public void actionPerformed(ActionEvent e) {
    // Send a request to the core to save this message
    final Request request = Network.getInstance().makeRequest("postboard/postboardmessage", HttpMethod.GET); // GET == read
    request.addObserver(new GetMessagesRequestObserver(this)); // add an observer to process the response
    request.send(); // send the request
  }
 
  /**
   * Add the given messages to the local model (they were received from the core).
View Full Code Here

      // Make a new POST Request.
      Request manualRequest = new Request(config, null, HttpMethod.POST)// construct the Request

      // Configure the request
      manualRequest.setBody(body)// set the request body to send to the server
      manualRequest.addObserver(requestObserver)// Add the requestObserver to the request's set of Observers

      // Send the request!
      manualRequest.send();
      synchronized (requestObserver) {
        requestObserver.wait(2000);
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.