Guest User

gwtclass

a guest
Jan 12th, 2016
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.11 KB | None | 0 0
  1. /**
  2.  * Entry point classes define <code>onModuleLoad()</code>.
  3.  */
  4. public class Testdialog2 implements EntryPoint {
  5.  
  6.     /**
  7.      * This is the entry point method.
  8.      */
  9.     public void onModuleLoad() {
  10.  
  11.         final TextBox nameField = new TextBox();
  12.         final Button sendButton = new Button("Send");
  13.         sendButton.addStyleName("sendButton");
  14.         sendButton.addClickHandler(new ClickHandler() {
  15.  
  16.             @Override
  17.             public void onClick(ClickEvent event) {
  18.                 sendMessage(nameField.getValue());
  19.             }
  20.         });
  21.  
  22.         nameField.setText("Message To Send Via postMessage");
  23.  
  24.         RootPanel.get().add(sendButton);
  25.         RootPanel.get().add(nameField);
  26.  
  27.         nameField.setFocus(true);
  28.         nameField.selectAll();
  29.  
  30.     }
  31.  
  32.     /**
  33.      * Sends the message to the parent window of this iframe. The parent can listen to that<br>
  34.      * events and react on it. "*" should be replaced by the
  35.      * @param message
  36.      */
  37.     public native static void sendMessage(String message) /*-{
  38.         $wnd.parent.postMessage(message, "*");
  39.     }-*/;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment