Guest User

Untitled

a guest
Dec 9th, 2016
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. private Element htmlElement;
  2. //the model contains all the information of the window
  3. private E model;
  4. //unique ID for each window
  5. private String randomId = ""+Random.nextInt();
  6.  
  7. public MyClass(E model) {
  8. this.model = model;
  9. htmlElement = DOM.createInputText();
  10. htmlElement.setAttribute("value", model.getName());
  11. htmlElement.setId(randomId)
  12. setupTitleOnChange(htmlElement);
  13. }
  14.  
  15. public final Canvas createWindow() {
  16. Window window = new Window();
  17. window.setTitle(htmlElement.getString())
  18. ...
  19. }
  20.  
  21. //This method save the Title of the window and has to be called in the native method
  22. private void OnChangeTitle(String randomId) {
  23. eventBus.fireEvent(new WindowNameChangeEvent(model, DOM.getElementById(randomId).getAttribute("value")));
  24. }
  25.  
  26. public native void setupTitleOnChange(Element element) /*-{
  27. // TODO implement JSNI method to change the title of the window
  28. }-*/;
Add Comment
Please, Sign In to add comment