Ejemplo n.º 1
0
  private void postChirp() {
    // Making the RPC call and submitting in the feeds
    // Instead of using our wrapper we will use the Core RPC call mechanism from the docs
    feedservice.sendFeed(
        feed,
        new AsyncCallback<Void>() {
          @Override
          public void onSuccess(Void result) {
            // User Chirped so we have a new feed coming up and the list needs to be repopulated
            // But if user has not clicked on the right Tab as per the chirp the feed might not be
            // visible
            eventbus.fireEvent(
                new FeedsCheckEvent(feed.getCity(), feed.getAuthor(), feed.getClient()));
          }

          @Override
          public void onFailure(Throwable caught) {
            System.err.println("Feed Posting Failed: " + caught);
          }
        });

    // When done Chirping make the buttons unavailaible again,clear the textbox
    display.getChirpButton().setEnabled(false);
    display.getAttachFile().setEnabled(false);

    display.getTextArea().setText("");
  }
Ejemplo n.º 2
0
  public void afterChirpMarked(final FeedDTO feed) {
    this.feed = feed;
    // BTW AWESOMENESS---------> mysql AUTOMATICALLY INSERTS TIMESTAMP WHEN QUERY FIRES!

    // Now the Chirp and Attachment option get availaible
    display.getChirpButton().setEnabled(true);

    display.getAttachFile().setEnabled(true);
  }
Ejemplo n.º 3
0
  private void bind() {
    // Get all the Event handlers working
    display
        .getMarkButton()
        .addClickHandler(
            new ClickHandler() {
              public void onClick(ClickEvent event) {
                // Fire the Presenter which shows the next view where we choose City+Client
                description = display.getTextArea().getValue();
                eventbus.fireEvent(new MarkEvent(description));
              }
            });

    // if user clicks chirp
    display
        .getChirpButton()
        .addClickHandler(
            new ClickHandler() {
              public void onClick(ClickEvent event) {
                // Make the RPC call to submit in feed
                postChirp();
              }
            });

    // The user wants to attach a document
    display
        .getAttachFile()
        .addClickHandler(
            new ClickHandler() {
              public void onClick(ClickEvent event) {
                // Invoke the Uploader widget
                // We are using gwt-upload library " http://code.google.com/p/gwtupload/ "
                SingleUploader uploader = new SingleUploader();

                // System.err.println(uploader.getServletPath() +
                // "?description="+feed.getDescription()+"&"+"author="+feed.getAuthor()+"&"+"city="+feed.getCity());
                // Also when we send the file to server,we need to send feed details along
                uploader.setServletPath(
                    uploader.getServletPath()
                        + "?description="
                        + feed.getDescription()
                        + "&"
                        + "author="
                        + feed.getAuthor()
                        + "&"
                        + "city="
                        + feed.getCity());

                final DialogBox db = new DialogBox();
                db.add(uploader);
                db.setText("File Uploader...");
                db.center();

                db.show();

                uploader.addOnFinishUploadHandler(
                    new IUploader.OnFinishUploaderHandler() {
                      @Override
                      public void onFinish(IUploader uploader) {
                        if (uploader.getStatus() == Status.SUCCESS) {
                          db.hide();
                          eventbus.fireEvent(
                              new FeedsCheckEvent(
                                  feed.getCity(), feed.getAuthor(), feed.getClient()));
                          // When done Chirping make the buttons unavailaible again,clear the
                          // textbox
                          display.getChirpButton().setEnabled(false);
                          display.getAttachFile().setEnabled(false);

                          display.getTextArea().setText("");
                        }
                      }
                    });
              }
            }); // End of on click for Attach and Chirp button
  }