Hi,
I posted this on Stackoverflow, but there does not seem to be anyone with the skills. Very happy if someone could help out.
I am using GWT 2.4, GWTP 0.7 and Chrome 22.0.1229.94 for testing. I have struggled with this issue for days.
I use a default custom Gatekeeper. On startup the gatekeeper forces the presentation of a PopupDialog through RevealRootPopupContentEvent.fire(...). The presenter is based on PresenterWidget using a view that has extended PopupViewImpl. In an overridden onReveal() method in the presenter I center the dialog. I have noticed that the GWTP implementation of PopupViewImpl centers first synchronously and then deferred using scheduleDeferred to circumvent an IE behaviour.
In development mode and running complied on local server everything works as expected: the popup dialog is always rendered and centered correctly. I have also tested this in IE.
However, when deploying to the live web server on the Internet I notice that when I refresh using F5, sometimes the CSS is not applied before the script tries to center the dialog. This results in the measurements being wrong and the dialog is not placed in the center. Interestingly this only seems to happen now and then, typically when the browser is not fast enough in rendering all (CSS) resources before the scheduled deferred command is invoked.
So, I have already tried the following:
I notice the same behaviour in Chrome and IE so I have the feeling that it might not be a browser issue. My question is where to put my "center"-call to ensure that it is called after the all CSS has been properly applied or if there is anything else I can do to force the CSS to render?
Thanks!
Here is the onReveal code in the Presenter extending PresenterWidget:
@Override
protected void onReveal() {
super.onReveal();
// Hide loading image
fireEvent(new HideApplicationLoadingImageEvent());
// Reset message
getView().setStatusMessage(null);
// Center the popup
getView().center();
}
--
addToPopupSlot(presenter, true);
Hi again,
Here is some code and explanation of how my application is designed.
The default place is defined in the gin module (extending AbstractPresenterModule):
bindConstant().annotatedWith(DefaultPlace.class).to(NameTokens.newsPage);
A default gate keeper is defined in the ginjector
@DefaultGatekeeper
FestivitasPortalGatekeeper getFestivitasPortalGatekeeper();
Then, the place manager:
public class FPlaceManager extends PlaceManagerImpl {
private final PlaceRequest defaultPlaceRequest;
private final LoginPopupPresenter loginPopupPresenter;
@Inject
public FPlaceManager(
final EventBus eventBus,
final TokenFormatter tokenFormatter,
LoginPopupPresenter loginPopupPresenter,
@DefaultPlace String defaultNameToken,
final LoggerPopupPresenter loggerPopupPresenter) {
super(eventBus, tokenFormatter);
this.defaultPlaceRequest = new PlaceRequest(defaultNameToken);
this.loginPopupPresenter = loginPopupPresenter;
eventBus.addHandler(ShowPortalEvent.TYPE, new ShowPortalEvent.ShowPortalHandler() {
@Override
public void onShowPortal(ShowPortalEvent event) {
// Reveal the default place
revealDefaultPlace();
// Allow animations
AnimationsEnabledEvent.fire(FPlaceManager.this, true);
}
});
/**
* Take proper action when application loading image shall be removed.
*/
eventBus.addHandler(HideApplicationLoadingImageEvent.TYPE, new HideApplicationLoadingImageHandler() {
@Override
public void onHideApplicationLoadingImage(
HideApplicationLoadingImageEvent event) {
Element loadingElement = DOM.getElementById("applicationLoadingImage");
if (loadingElement != null)
DOM.removeChild(RootPanel.getBodyElement(), DOM.getElementById("applicationLoadingImage"));
}
});
}
@Override
public void revealDefaultPlace() {
// Reveal the default presenter.
// The actual default is defined in {@link FModule} using a NameToken.
// Pass false as second parameter to prevent another token to be
// inserted into the browser history.
// TODO: Show the place the user prefers, i.e. place when logged out or a custom start page.
revealPlace( defaultPlaceRequest, false);
}
@Override
public void revealUnauthorizedPlace(String unauthorizedHistoryToken) {
// If not authorized, show login dialog
RevealRootPopupContentEvent.fire(this, loginPopupPresenter);
}
}
The LoginPopupPresenter extends PresenterWidget and has an overridden onBind (with super.onBind() and then registration of some click handlers) and the overridden onReveal (code as in original post).
In the LoginPopupView I have, for testing purposes, overridden the center() method as such:
@Override
public void center() {
// TODO Auto-generated method stub
super.center();
// We center again in a deferred command to solve a bug in IE where newly
// created window are sometimes not centered.
Scheduler.get().scheduleDeferred(new Command() {
@Override
public void execute() {
Window.alert("Deferred centering");
asPopupPanel().center();
//
}
});
}
So, the presenter that is to be displayed when first visiting the site is the loginPopupPresenter (due to the gate keeper), which, certainly, it is. However, the CSS is not always completely rendered before the onReveal() code is fired. And the question is how this can be?
Is there any more code needed?
I have been able to replicate the problem in a stripped down project. The source code is attached.I have deployed it to my server. Visit http://www.festivitas.se/gwtptest/GWTPTest.html and keep pressing Esc->F5 until you notice that the border around the "Log in" button is not visible behind the Chrome popup dialog.This demonstrates that sometimes the CSS is not completely rendered before the onReveal() code is reached.--
Thanks, but I succeeded after deleting the war folder so I am quite sure it is beacuse there where javascript files in the war folder. Smart filtering ;-).
--
Hm, it seems we now discuss different things ;o)... I was talking about the failed attempt to uploading code to the thread. I succeeded uploading after deleting the war folder containing JavaScript code. The original problem that is the subject of the thread unfortunately still exists as demonstrated in the uploaded code and the instructions in the post to which I first tried to attach the code.
--
--
--
You received this message because you are subscribed to the Google Groups "GWTP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gwt-platform...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.