Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package org.jboss.errai.demo.grocery.client.local;
 
 
@Templated("#main")
public class GroceryListClient extends Composite {
  private Button addStoreButton;
  public void clientMain() {
    RootPanel.get().add(this);
  }

  
Shows the store form in a popup when the "+" button is pressed.

Parameters:
event the click event (ignored)
  @EventHandler("addStoreButton")
  public void onStoreAddButtonClick(ClickEvent event) {
    final StoreForm storeForm = .lookupBean(StoreForm.class).getInstance();
    popover.setTitleHtml(new SafeHtmlBuilder().appendEscaped("New Store").toSafeHtml());
    popover.setBodyWidget(storeForm);
    popover.show();
    // hide store form when new store is saved
    storeForm.setAfterSaveAction(new Runnable() {
      @Override
      public void run() {
        popover.hide();
        .destroyBean(popover);
        .destroyBean(storeForm);
      }
    });
  }
New to GrepCode? Check out our FAQ X