예제 #1
0
  public ChirpPresenter(FeedsServiceAsync feedservice, SimpleEventBus eventbus, Display display) {

    this.feedservice = feedservice;
    this.eventbus = eventbus;
    this.display = display;
    this.description = display.getTextArea().getValue();
  }
예제 #2
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("");
  }
예제 #3
0
 /** Initializes the container. */
 public final void go(final HasWidgets container) {
   bind();
   container.clear();
   container.add(display.asWidget());
   display.getTextArea().setFocus(true);
 }