Hi Litty,

> But it will require code change to all
> the popups that use a glass panel. And also in future some developer may
> forget to fire a Deffered command when the size changes.... So i dont think
> its such a good method....
>

I'm not sure how you can avoid that, Litty. I mean either the viewport
widget has to tell the glass panel its size has changed or the glass
panel has got to repeatedly poll the viewport to see if it has changed
- I can't think of any other alternatives.

AFAIK there is no HTML event specified to be fired if an Element' size
is changed. There is a DOMAttrModified event but a) I believe IE does
not implement it, and b) in any case it is only fired if a property
itself is actually changed. E.g. if the height attribute of an Element
is set to 100%,  then if the browser increases the height of the
element to accommodate new content, the property remains 100%
therefore no event fired. I think the offsetHeight is calculated on
the fly from whatever the pixel height happens to be at the time.

If I understand you correctly, you have a number of viewports each of
which has a glass panel that need to cover its exact area. If you had
a lot of these, then the Timer polling option doesn't seem such a good
idea (lots of timers polling away for little purpose most of the
time). I think I would design my own base class that included both a
viewport widget and its glass panel (possibly optionally instantiated)
and use a custom method to add additional content to the viewport that
fired a DeferredCommand to resize the glass panel (deferred so that it
does it after the resizing of the viewport's Element is complete and
offset height & offset width return true values). All the viewports
could be extended from that.

regards
gregor














> I am working with pure GWT. Basically I am using the glass panels for modal
> popups. I set the size of the glass panel as the current view port size just
> before dispalying it. Then the popup is dispalyed. Now on the popup, the
> user actions causes the size of the popup to change. If the size becomes
> larger than the previous view port size then the view port size will
> automatically increase, but the glass panel size remains the same which
> causes the bottom region of the viewport to be not covered by glass panel.
> Please not that this change of size will not cause a window resize event as
> the window size is not changed, only the document size got changed. (BTW i
> have a windowresize listener on the glass panel so that part is take care
> of.)
>
> Hope this explains my problem.
>
> Thanks,
> Litty Preeth
>
> On Thu, Dec 4, 2008 at 4:57 PM, gregor <[EMAIL PROTECTED]> wrote:
>
> > I'm not sure I understand your situation right, but:
>
> > if your panel "knows" at run time that it's size has changed (e.g.
> > from a method that adds the new widget to it) then it could fire a
> > change event via DeferrerdCommand. The glass panel could be registered
> > as a listener with it and obtain new width/height offsets.
>
> > On Dec 4, 4:25 am, "Litty Preeth" <[EMAIL PROTECTED]> wrote:
> > > At run time I add widgets to the page which causes the size of the panel
> > > (scrollable size) to change.
>
> > > Regards,
> > > Litty Preeth
>
> > > On Wed, Dec 3, 2008 at 7:22 PM, gregor <[EMAIL PROTECTED]>
> > wrote:
>
> > > > Oh, I see. How is the size of your RootPanel changed then if not by
> > > > changing the size of the browser window?
>
> > > > On Dec 3, 1:15 pm, "Litty Preeth" <[EMAIL PROTECTED]> wrote:
> > > > > WindowResizeListener will listen for window resize events only. It
> > wont
> > > > be
> > > > > invoked if ur scrollable page size is changed. It ll be notified only
> > if
> > > > the
> > > > > WINDOW itself is mazximized, resized etc.
>
> > > > > Regards,
> > > > > Litty Preeth
>
> > > > > On Wed, Dec 3, 2008 at 4:31 PM, gregor <[EMAIL PROTECTED]
>
> > > > wrote:
>
> > > > > > Hi Litty,
>
> > > > > > I use something like this:
>
> > > > > > public class MdDem implements EntryPoint {
>
> > > > > >    private MainPage main = new MainPage();
> > > > > >    private ResizeListener windowListener = new ResizeListener();
>
> > > > > >    public void onModuleLoad() {
> > > > > >        RootPanel.get().add(main);
> > > > > >        Window.addWindowResizeListener(windowListener);
> > > > > >        // initial sizing call if you need it
> > > > > >        windowListener.onWindowResized(Window.getClientWidth(),
> > > > > > Window.getClientHeight());
> > > > > >    }
>
> > > > > >    // window resize listener
> > > > > >    private class ResizeListener implements WindowResizeListener {
>
> > > > > >        private int width, height;
> > > > > >        private boolean pending;
> > > > > >        private Command command;
>
> > > > > >        ResizeListener() {
> > > > > >            command = new Command() {
> > > > > >                public void execute() {
> > > > > >                    pending = false;
> > > > > >                    main.adjustSize(width, height);
> > > > > >                }
> > > > > >            };
> > > > > >        }
>
> > > > > >        public void onWindowResized(int width, int height) {
> > > > > >            this.width = width;
> > > > > >            this.height = height;
> > > > > >            if (pending == false) {
> > > > > >                pending = true;
> > > > > >                DeferredCommand.addCommand(command);
> > > > > >            }
> > > > > >        }
> > > > > >    }
>
> > > > > > }
>
> > > > > > regards
> > > > > > gregor
>
> > > > > > On Dec 3, 7:33 am, "alex.d" <[EMAIL PROTECTED]> wrote:
> > > > > > > Basically you have to listen to browser "change size" events (not
> > > > sure
> > > > > > > how reliable this is in all supported browsers) and forward new
> > size
> > > > > > > to your widgets. Ext GWT (and probably GWT Ext) for example,
> > already
> > > > > > > has ViewPort implementation.
>
> > > > > > > On 3 Dez., 05:11, Litty Preeth <[EMAIL PROTECTED]> wrote:
>
> > > > > > > > Hi friends,
>
> > > > > > > > Anybody has any ideas on this?
>
> > > > > > > > Thanks and Regards,
> > > > > > > > Litty Preeth
>
> > > > > > > > On Dec 2, 4:42 pm, "Litty Preeth" <[EMAIL PROTECTED]>
> > wrote:
>
> > > > > > > > > Hi All,
>
> > > > > > > > > Anybody know how to implement a viewport resize listener?
> > > > Basically I
> > > > > > have a
> > > > > > > > > glass panel (light box effect). I want to notify this glass
> > panel
> > > > > > whenever
> > > > > > > > > my RootPanel size gets changed so that I can resize my glass
> > > > panel to
> > > > > > fillup
> > > > > > > > > the area.
>
> > > > > > > > > Regards,
> > > > > > > > > Litty Preeth
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to