Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Entry point classes define <code>onModuleLoad()</code>.
- */
- public class Testdialog2 implements EntryPoint {
- /**
- * This is the entry point method.
- */
- public void onModuleLoad() {
- final TextBox nameField = new TextBox();
- final Button sendButton = new Button("Send");
- sendButton.addStyleName("sendButton");
- sendButton.addClickHandler(new ClickHandler() {
- @Override
- public void onClick(ClickEvent event) {
- sendMessage(nameField.getValue());
- }
- });
- nameField.setText("Message To Send Via postMessage");
- RootPanel.get().add(sendButton);
- RootPanel.get().add(nameField);
- nameField.setFocus(true);
- nameField.selectAll();
- }
- /**
- * Sends the message to the parent window of this iframe. The parent can listen to that<br>
- * events and react on it. "*" should be replaced by the
- * @param message
- */
- public native static void sendMessage(String message) /*-{
- $wnd.parent.postMessage(message, "*");
- }-*/;
- }
Advertisement
Add Comment
Please, Sign In to add comment