5

I need to make some adjustment on a div css. But I can't do this on method onBind() or onReveal() because the html isn't loaded when this two method is called.

So I was wondering some way to automatically call a method right when the modification of my html(When a Presenter is called the html has to modify because new widgets will be add) load.

This is the method that I have to call:

private void hidePopup(){
  $(".olLayerGooglePoweredBy, .olLayerGoogleV3, .gmnoprint").
    css(CSS.VISIBILITY.with
      (com.google.gwt.dom.client.Style.Visibility.HIDDEN));
}
Bernardo Vale
  • 3,224
  • 4
  • 21
  • 34

2 Answers2

2

I'm not sure I fully understand your question, but it seems to me like you are looking for a way to know when a widget has been added to the DOM.

If that is the case, I think the onLoad() method might be what you're looking for: http://google-web-toolkit.googlecode.com/svn/javadoc/2.5/com/google/gwt/user/client/ui/Widget.html#onLoad%28%29

Shiv16
  • 116
  • 3
1

The EntryPoint method onModuleLoad() is that method - this will be called when the rest of the page has loaded. GWT doesn't start up quite like most JS frameworks, where you can write JS while the page is still loading. Instead, it can be assumed that when onModuleLoad is invoked, the rest of the page is already ready to go.

Colin Alworth
  • 17,801
  • 2
  • 26
  • 39
  • It can't be done. I'm using GWT-Platform, the method onModuleLoad() is called only ONE time by the programmer, and it load all the app. I need a method to execute or in the Presenter or in the ViewImpl. [Check Presenter LifeCycle](http://code.google.com/p/gwt-platform/wiki/GettingStarted#Presenter_lifecycle) – Bernardo Vale Jan 21 '13 at 18:22
  • Right - the html page only loads once, then onModuleLoad gets invoked. If each of your presenters changes it, that doesn't cause the page to be reloaded, just some new content to be drawn. As soon as you add those widgets to the page, that new html is 'loaded' and can be manipulated like this. Your question (right now) asks how to call something when the page loads - it sounds like what you *want* is to know "when does anything change" or "when did my app load a new presenter/view". – Colin Alworth Jan 21 '13 at 19:41
  • It load once but it's content changes if you call a presenter. I agree with you, I will modify my question. – Bernardo Vale Jan 21 '13 at 19:48