Miquel
Miquel

Reputation: 15675

Getting a GWT PopupPanel with glass to fade in and out

I would like to fade a PopupPanel into my page. I can get the PopupPanel element and animate the opacity myself, but I don't have access to the glass element. This is not really a technical problem, but a limitation (I would say) on what the PopupPanel chooses to expose.

Does anyone know of a workaround or alternative? Thanks!

Upvotes: 1

Views: 967

Answers (2)

sidney3172
sidney3172

Reputation: 86

Basically all glass panels looks like

<div class="gwt-PopupPanelGlass" style="..."></div>

So if you really need to get this element and animate it you can do something like this via jsni:

elements = document.getElementsByClassName("gwt-PopupPanelGlass")

and after that change element style like you want. But this is some kind of workaround and you need to test it on various browsers.

Upvotes: 2

appbootup
appbootup

Reputation: 9537

Solution 1 - Deferred Bindings

Sample - https://developers.google.com/web-toolkit/doc/latest/DevGuideCodingBasicsDeferred#example Theory - https://code.google.com/p/google-web-toolkit/wiki/DeferredBindingsForJRE

Solution 2 - Hacking with Java Classpath

When java encounter duplicate java files in same package hierarchy it picks the one from the jar which is ahead of the others in the classpath. We use this class overriding technique on some occasions to alter what GWT classes chooses to expose. We copy the PopupPanel java files into our code base in the exact package as GWT i.e com.google.gwt.user.client.ui.

We need to ensure GWT Compiler sees our version of PopupPanel in the classpath ahead of gwt-user.jar . This means GWT Compiler picks up our version and not gwt's!!! You can go ahead and edit PopupPanels attribute/methods scope from private to higher.

Note - You need to ensure the PopupPanel java files is synced to every GWT release.

Upvotes: 1

Related Questions