Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private Element htmlElement;
- //the model contains all the information of the window
- private E model;
- //unique ID for each window
- private String randomId = ""+Random.nextInt();
- public MyClass(E model) {
- this.model = model;
- htmlElement = DOM.createInputText();
- htmlElement.setAttribute("value", model.getName());
- htmlElement.setId(randomId)
- setupTitleOnChange(htmlElement);
- }
- public final Canvas createWindow() {
- Window window = new Window();
- window.setTitle(htmlElement.getString())
- ...
- }
- //This method save the Title of the window and has to be called in the native method
- private void OnChangeTitle(String randomId) {
- eventBus.fireEvent(new WindowNameChangeEvent(model, DOM.getElementById(randomId).getAttribute("value")));
- }
- public native void setupTitleOnChange(Element element) /*-{
- // TODO implement JSNI method to change the title of the window
- }-*/;
Add Comment
Please, Sign In to add comment