Additional DIVs appearing after integrating GWTP MVP

138 views
Skip to first unread message

Charlie M

unread,
Jul 6, 2010, 11:58:50 AM7/6/10
to GWTP
Hi All,

I am currently integrating an existing fairly complex GWT app with
GWTP MVP.

I have got a few pages of my app now using GWTP. My app loads as
expected, however in Chrome and Firefox none of the text boxes and
buttons are clickable nor is the page text selectable. They all work
correctly in IE. Using Chrome's DOM inspection I have managed to work
out why. Below is what gets add to the bottom of the Body Tag.


<div style="position: absolute; z-index: -32767; left: -20cm; top:
-20cm; width: 10cm; height: 10cm; ">&nbsp;</div>

<div style="position: absolute; left: 0px; top: 0px; right: 0px;
bottom: 0px; "><div style="position: absolute; z-index: -32767; left:
-20em; top: -20ex; width: 10em; height: 10ex; ">&nbsp;</div>

</div></body>


Those large divs transparently fill the entire screen and therefore
capture all the mouse and keyboard events. The don't appear before
GWTP MVP was integrated and they aren't in my root html page.

Where are they coming from in GWTP and how do I disable them?

Thanks,

Charlie M

Christian Goudreau

unread,
Jul 6, 2010, 12:12:07 PM7/6/10
to gwt-pl...@googlegroups.com
Are you using a root layout presenter ? I had this problem before when my root layer presenter wasn't correctly implemented.

Can you show me a little bit of your AppPresenter and your Gin modules to see if it's linked to that ?

Else here is how to implement the rootlayoutpresenter correctly : 

In your AppPresenter : 
  @Override
  protected void revealInParent() {
    RevealRootContentEvent.fire(eventBus, this); //or RevealRootLayoutContentEvent.fire(eventBus, this);
  }

In your GinModule :
bind(RootPresenter.class).asEagerSingleton();

Regards,
--
Christian Goudreau

Charlie M

unread,
Jul 7, 2010, 5:18:08 AM7/7/10
to GWTP
Thanks for the info. I was using the built in RootPresenter that I had
to make changes to. My app requires it to add all the content in to a
DIV in the host page rather than the Body tag its self.

I have now written my own RootPresenter and bound that in Gin instead.
Its now working fine.

Thanks,

Charlie M


On Jul 6, 5:12 pm, Christian Goudreau <goudreau.christ...@gmail.com>
wrote:

Philippe Beaudoin

unread,
Jul 7, 2010, 11:28:04 AM7/7/10
to gwt-pl...@googlegroups.com
Excellent idea. I never thought of that use case, but I believe this
shows why dependency injection is a good practice, and not only for
testing!

We should probably document that idea, though, as it makes it possible
to "embed" a GWTP app in a larger webpage. I've added an issue for
this:
http://code.google.com/p/gwt-platform/issues/detail?id=127

Cheers,

Philippe

marius andreiana

unread,
Sep 22, 2010, 6:24:31 PM9/22/10
to gwt-pl...@googlegroups.com
Hi,

I have the same issue which is reproducible in gwtp basic sample. I
get two extra divs along body tag:
<div style="display: none;"></div>


<div style="position: absolute; z-index: -32767; left: -20cm; top:
-20cm; width: 10cm; height: 10cm;">&nbsp;</div>

I've checked and it does NOT use any layout panel. I can't see why the
extra divs appear, since in plain GWT sample they aren't.

marius andreiana

unread,
Sep 27, 2010, 4:13:41 PM9/27/10
to GWTP
On Sep 23, 1:24 am, marius andreiana <marius.andrei...@gmail.com>
wrote:
> Hi,
>
> I have the same issue which is reproducible in gwtp basic sample. I
> get two extra divs along body tag:
> <div style="display: none;"></div>
> <div style="position: absolute; z-index: -32767; left: -20cm; top:
> -20cm; width: 10cm; height: 10cm;">&nbsp;</div>
I'm wondering if these are caused by RootPresenter.setInSlot()
Even if !usingRootLayoutPanel, it will still do
RootLayoutPanel.get().clear();

I understand it's a workaround for the case one uses Layout widgets
with RootPanel. As GWT doesn't support this, is it a real use case?
Could RootLayoutPanel.get().clear(); be removed if not using GWT
Layouts?

Thanks

Philippe Beaudoin

unread,
Sep 27, 2010, 4:22:05 PM9/27/10
to gwt-pl...@googlegroups.com
It's used in PuzzleBazar. I have an issue somewhere to revisit that
and try to fix upstream in GWT... You can take a look.

marius andreiana

unread,
Sep 27, 2010, 4:56:18 PM9/27/10
to GWTP
On Sep 27, 11:22 pm, Philippe Beaudoin <philippe.beaud...@gmail.com>
wrote:
> It's used in PuzzleBazar. I have an issue somewhere to revisit that
> and try to fix upstream in GWT... You can take a look.
Saw it, http://code.google.com/p/google-web-toolkit/issues/detail?id=4737

Could CSS be used in PuzzleBazar instead of GWT layout widgets?
What do you think about http://www.zackgrossbart.com/hackito/antiptrn-gwt2/
> 4th pattern?

marius andreiana

unread,
Sep 27, 2010, 4:59:38 PM9/27/10
to GWTP
On Sep 27, 11:56 pm, marius andreiana <marius.andrei...@gmail.com>
wrote:
> On Sep 27, 11:22 pm, Philippe Beaudoin <philippe.beaud...@gmail.com>
> wrote:> It's used in PuzzleBazar. I have an issue somewhere to revisit that
> > and try to fix upstream in GWT... You can take a look.
>
> Saw it,http://code.google.com/p/google-web-toolkit/issues/detail?id=4737
>
> Could CSS be used in PuzzleBazar instead of GWT layout widgets?
Actually, PuzzleBazar has proper RevealRootLayoutContentEvent.fire()
events.

I was proposing to remove this workaround only for non-Layout
presenters, e.g. change this
==
if (usingRootLayoutPanel) {
// TODO Next 3 lines are a dirty workaround for
// http://code.google.com/p/google-web-toolkit/issues/detail?id=4737
RootPanel.get().clear();
RootLayoutPanel.get().clear();
RootPanel.get().add(RootLayoutPanel.get());
if (content != null) {
RootLayoutPanel.get().add(content);
}
} else {
// TODO Next 2 lines are a dirty workaround for
// http://code.google.com/p/google-web-toolkit/issues/detail?id=4737
RootLayoutPanel.get().clear();
RootPanel.get().clear();
if (content != null) {
RootPanel.get().add(content);
}
==

to
==
if (usingRootLayoutPanel) {
// TODO Next 3 lines are a dirty workaround for
// http://code.google.com/p/google-web-toolkit/issues/detail?id=4737
RootPanel.get().clear();
RootLayoutPanel.get().clear();
RootPanel.get().add(RootLayoutPanel.get());
if (content != null) {
RootLayoutPanel.get().add(content);
}
} else {
if (content != null) {
RootPanel.get().add(content);
}
==

Philippe Beaudoin

unread,
Sep 27, 2010, 5:31:02 PM9/27/10
to gwt-pl...@googlegroups.com
The problem is that the workaround is needed from swapping to and from
layout panels in the same application. This has nothing to do with
GWTP, it's a GWT bug. You can reproduce it in a few lines of code
without GWTP.

I totally disagree with the GWT anti-pattern blog on the topic of
layout panels. (I disagree with him on most of his topics, actually.)

LayoutPanels have made my life incredibly easier, especially by
ensuring clean full-screen behavior across browsers. Sure, I use
plenty of CSS (see BookedIn), just not for layout.

Philippe

marius andreiana

unread,
Sep 27, 2010, 5:45:46 PM9/27/10
to GWTP
Thanks for details.
I'll continue learning and experimenting with GWT and discover the
need for LayoutPanels by myself :)

On Sep 28, 12:31 am, Philippe Beaudoin <philippe.beaud...@gmail.com>
wrote:
> The problem is that the workaround is needed from swapping to and from
> layout panels in the same application. This has nothing to do with
> GWTP, it's a GWT bug. You can reproduce it in a few lines of code
> without GWTP.
>
> I totally disagree with the GWT anti-pattern blog on the topic of
> layout panels. (I disagree with him on most of his topics, actually.)
>
> LayoutPanels have made my life incredibly easier, especially by
> ensuring clean full-screen behavior across browsers. Sure, I use
> plenty of CSS (see BookedIn), just not for layout.
>
>    Philippe
>
> On Mon, Sep 27, 2010 at 1:59 PM, marius andreiana
>
>
>
> <marius.andrei...@gmail.com> wrote:
> > On Sep 27, 11:56 pm, marius andreiana <marius.andrei...@gmail.com>
> > wrote:
> >> On Sep 27, 11:22 pm, Philippe Beaudoin <philippe.beaud...@gmail.com>
> >> wrote:> It's used in PuzzleBazar. I have an issue somewhere to revisit that
> >> > and try to fix upstream in GWT... You can take a look.
>
> >> Saw it,http://code.google.com/p/google-web-toolkit/issues/detail?id=4737
>
> >> Could CSS be used in PuzzleBazar instead of GWT layout widgets?
> > Actually, PuzzleBazar has proper RevealRootLayoutContentEvent.fire()
> > events.
>
> > I was proposing to remove this workaround only for non-Layout
> > presenters, e.g. change this
> > ==
> >      if (usingRootLayoutPanel) {
> >        // TODO Next 3 lines are a dirty workaround for
> >        //http://code.google.com/p/google-web-toolkit/issues/detail?id=4737
> >        RootPanel.get().clear();
> >        RootLayoutPanel.get().clear();
> >        RootPanel.get().add(RootLayoutPanel.get());
> >        if (content != null) {
> >          RootLayoutPanel.get().add(content);
> >        }
> >      } else {
> >        // TODO Next 2 lines are a dirty workaround for
> >        //http://code.google.com/p/google-web-toolkit/issues/detail?id=4737
> >        RootLayoutPanel.get().clear();
> >        RootPanel.get().clear();
> >        if (content != null) {
> >          RootPanel.get().add(content);
> >        }
> > ==
>
> > to
> > ==
> >      if (usingRootLayoutPanel) {
> >        // TODO Next 3 lines are a dirty workaround for
> >        //http://code.google.com/p/google-web-toolkit/issues/detail?id=4737

Pablo Nussembaum

unread,
Mar 7, 2015, 10:15:00 AM3/7/15
to gwt-pl...@googlegroups.com
Hi guys,
I found this issue following this documentation : http://dev.arcbees.com/gwtp/otherusefulinformation/Website-Embedding.html
Below I pasted my fix to avoid making the RootLayoutPanel not visible as a workaround. I wonder if this solution is sound or there is a more elegant one.

Thanks and regards,
--
Pablo

=====================

public class MyRootPresenter extends RootPresenter {
    public static final class MyRootView extends RootView {
        @Override
        protected RootPanel getAppRootPanel() {
            return RootPanel.get("mainContent");
        }

        // Inherited to fix:
        // https://groups.google.com/forum/#!topic/gwt-platform/c83t7TECpjI
        @Override
        public void setInSlot(Object slot, IsWidget content) {
            super.setInSlot(slot, content);
            RootLayoutPanel.get().setVisible(false);
        }
    }

    @Inject
    MyRootPresenter(EventBus eventBus, MyRootView myRootView) {
        super(eventBus, myRootView);
    }
}

=====================
Reply all
Reply to author
Forward
0 new messages