I have for example a tabpanel, where the contents of the tabs can be
quite big.
The tabpanel should always be as big as the browser window, even when
it is resized.
The different tab contents, can be bigger than the browser window, so I
want to put them in a scrollpanel, so that the user can scroll the
contents.
Setting the width and height of the scrollpanels to 100% does not work,
no scrollbars are ever shown and the tabbed panel becomes bigger than
the window. If I set the size of the tabbedpanel with a fixed pixel
size, then the scrollbars are correctly shown.
Is there a way to keep the tabbed panel at 100% size of the browser
window and still have the scrollbars behaving correctly ? Note that the
contents of the tabbed also contain dynamic content, so the size
changes depending on user interactions.
I found a solution with a Window ResizeListener, but I do not want to
pile up all the event listeners when the GUI becomes even more complex
- removing the listeners is also not simple since I can not override
the onDetach method of Widget.
Any ideas how to solve this ellegantly and in a browser independant way
? I was hoping that GWT would shield off these differences between
browsers but it does not.
David
I see no reason that you can't override onDetach(), so long as you
call the super method to prevent memory leaks. I updated the feature
request with an example:
http://code.google.com/p/google-web-toolkit/issues/detail?id=74
--
Mat Gessel
http://www.asquare.net
The reason why not is because the JavaDoc says we can not override it.
I know that I can override and call the super implementation, but if
the docs already tells me not to do this, I might run into troubles
with newer versions of GWT.
David
On Nov 15, 7:44 pm, "Mat Gessel" <mat.ges...@gmail.com> wrote:
> On 11/15/06, stuckagain <david.no...@gmail.com> wrote:
>
> > I found a solution with a Window ResizeListener, but I do not want to
> > pile up all the event listeners when the GUI becomes even more complex
> > - removing the listeners is also not simple since I can not override
> > the onDetach method of Widget.I see no reason that you can't override onDetach(), so long as you
It looks like scrollpanels are a real pain to use unless I set them at
a fixed size.
In an application where you have a complex Widget tree, and the
scrollpane should fill a certain (yet dynamic) portion of the window,
it becomes nearly impossible to implement this correctly.
In a Swing application you just set a ScrollPane around an existing
one, and the layout manager will just adjust the size of the scrollpane
(and thus also the scrollbars) depending on the layout manager of the
parent container. When the user resizes the window everything happens
automatically.
This is not possible in GWT at this point.
David
Yes I did, and that works OK for simple applications like the email
demo client that is available with GWT. There they have implemented a
WindowResizeListener in the main application code and resizes 2
components by calculating the size correctly. In this demo it is fairly
easy since the main application knows exactly where the resizeable area
must be positioned (they have hardcoded the bottom border to make it
work).
But what if you want (for example) scrollbars inside a tabbed panel
(not using up the full window, since that would again be easy). I need
scrollbars inside every tabbed panel and it must persist its
scroll-position and must take up all the window estate that it should
logically take.
In Swing you do not need to bother with all this. You just put the
scrollpanel around the component and you put it in a layout manager and
everything works, no mather how complicated the component hierarchy
becomes.
David
On Nov 17, 12:18 pm, "Andre Freller" <andre.frel...@gmail.com> wrote:
> Did you try to implement the WindowResizeListener interface an used
> the Window.addWindowResizeListener to be notified on all window
> resizes? This way you can change the size of your panel by event
> notification.
>
> Freller
>
> On 11/17/06, stuckagain <david.no...@gmail.com> wrote:
>
>
>
>
>
> > It looks like scrollpanels are a real pain to use unless I set them at
> > a fixed size.- Hide quoted text -- Show quoted text -
It seems that GWT is desperately in need of some real layout management
code. I was thinking about creating some classes to handle this but
from what I can seem, it's not possible to have access to all the info
that one would require to accomplish this task. It doesn't seem to be
possible to get the information about the full box model from the
panels and other widgets i.e. you can find out how much space a widget
takes in total (using getOffsetWidth/getOffsetHeight) but there's no
way to know what the size of the inside area is once you've removed the
padding, border, etc...
Am I missing something here?
Pascal
stuckagain a écrit :
The only thing I need is a WindowListener per ScrollPanel.
The WindowListener is installed in the onLoad() and again removed by
the overloaded onDetach (due to a lack of onUnload()). This way I avoid
that too many listeners are registered. In most situations I only have
one or 2 scrollpanels active.
Whenever the window is resized I set the size of the scrollpanel to the
offsetheight/width of the parent component. This assumes that the
parent does not have any padding/margin/border, but that is easy to fix
by putting an extra DIV if needed.
There is one little problem with this mechanism:
When you use a TabPanel, then the onLoad is triggered for all the
panels that are registered. The result is that I set the size to 0,0 on
the invisible panels. The only way of fixing this was to add a tab
listener and triggering the onWindowResize off the scrollpanels.
It would be nice if the a GWT widget would have a generic way of
knowing when it becomes visible. Its not because onLoad is called that
you can assume that the user sees the widget.
A real layout manager would ofcourse be even better!
The problem is that scroll panels only work when you set the size in
pixels. That basically rules out the possibility to have a modern GUI
that can maximize the use of the screen estate when the window is
resized.
In a simple application, like the mail example in the GWT developer
tookit, this is not an isue. The application knows all the scrollbars
and implements a Window listener that modifies the size of the
scrollpanels in the application. In a bigger, structured application
you do not know, or even have access to all the ScrollPanels at
startup. An in many cases you do not even know how to calculate the
exact size that the scrollpane should have, due to complex auto sizing
behaviour of the browser (offsetHeight alone does not help you here).
But by using the Absolute Panel I do have a fix. If you put a
ScrollPanel inside it, that ScrollPanel is not contributing to the size
of the absolute panel. So I can set the absolute panel to 100% of its
parent. when the window is resized I just request the offset size of
the absolute panel and change the size of the scrollpanel to be
identical. This fixes the problem for me.
I'll see if I find some time to show whats wrong with a ScrollPanel.
David
ScrollPanel sp = new ScrollPanel();
tp.add(sp, "Panel");
sp.setSize("100%", "100%");
sp.setAlwaysShowScrollBars(true);
sp.add(new HTML("Lorem ipsum dolor sit amet,"
+ " consectetuer adipiscing elit. Morbi"
+ " gravida libero nec velit. Morbi"
+ " scelerisque luctus velit. Etiam dui"
+ " sem, fermentum vitae, sagittis id,"
+ " malesuada in, quam. Proin mattis"
+ " lacinia justo. Vestibulum facilisis"
+ " auctor urna. Aliquam in lorem sit amet"
+ " leo accumsan lacinia. Integer rutrum,"
+ " orci vestibulum ullamcorper ultricies,"
+ " lacus quam ultricies odio, vitae placerat"
+ " pede sem sit amet enim. Phasellus et"
+ " lorem id felis nonummy placerat. Fusce"
+ " dui leo, imperdiet in, aliquam sit amet,"
+ " feugiat eu, orci. Aenean vel massa quis"
+ " mauris vehicula lacinia. Quisque tincidunt"
+ " scelerisque libero. Maecenas libero. Etiam"
+ " dictum tincidunt diam. Donec ipsum massa,"
+ " ullamcorper in, auctor et, scelerisque sed,"
+ " est. Suspendisse nisl. Sed convallis magna"
+ " eu sem. Cras pede libero, dapibus nec,"
+ " pretium sit amet, tempor quis, urna. "));
tp.selectTab(0);
public void onModuleLoad()
{
VerticalPanel mainPanel = new VerticalPanel();
RootPanel.get().add(mainPanel);
mainPanel.setSize("100%", "100%");
mainPanel.setBorderWidth (5);
HorizontalPanel topPanel = new HorizontalPanel();
mainPanel.add(topPanel);
mainPanel.setCellHeight(topPanel, "50%");
topPanel.setHeight("100%");
topPanel.setBorderWidth
(3);
ScrollPanel topLeft = getScrollPanel();
topPanel.add(topLeft);
topPanel.setCellWidth(topLeft, "33%");
ScrollPanel topMiddle = getScrollPanel();
topPanel.add
(topMiddle);
topPanel.setCellWidth(topMiddle, "33%");
ScrollPanel topRight = getScrollPanel();
topPanel.add(topRight);
topPanel.setCellWidth(topRight, "33%");
TabPanel tp = new TabPanel();
mainPanel.add(tp);
tp.setSize("100%", "100%");
tp.getDeckPanel().setSize("100%", "100%");
tp.add(getScrollPanel(), "One");
tp.add(getScrollPanel(), "Two");
tp.selectTab(0);
}
private ScrollPanel getScrollPanel() {
ScrollPanel panel = new ScrollPanel(new HTML("Lorem ipsum dolor sit amet,"
panel.setSize
("100%", "100%");
return panel;
}
No, its not a waste of time, its just that I do not have internet
access on my development machine,
so I have to run around with a memory stick and I'm on a deadline (but
who isn't ? :-))
Your example already shows the weakness of the ScrollPanel component.
I'm using IE6 SP1 (I don't know if it works the same in FireFox).
Just resize the browser window to a point where the contents of the
tabs no longer fit in the browser window.
The vertical scrollbar never becomes active, its always grayed out, but
the tabpanel becomes bigger than the
browser window.
Your example has data in the tabs that reflows very easy. With complex
user interfaces, the contents are not
reflowable HTML but other UI components that have to stay in the same
position, so even the horizontal size
becomes bigger than the browser window.
Hopes this explains my problem a bit ? I know what the cause of the
issue is the browser and CSS specifications
for overflow, but I tought we were trying to create rich desktop like
GUIs in a browser window. There is a lot of
information to be shown in a business application and it is very
important that we can decide on the reflow and
scrolling behaviour to put as much as possible on one page.
David
My problem is that I have a Dynamic TabPanel where users can create any
number of Tabs. Now when the number of Tabs increases beyond a certain
number, the TabBar grows beyond the a size that can be fitted on the
screen. In Swing/MFC or other UI frameworks, when that happens the
TABBAR displays ScrollPanel with buttons on the right so that you can
scroll from one TabBar Item to the other. GWT does not seem to have the
capabbility however. To make matters worse, you cannot simply subclass
the TabBar class because then there is no way of assigning a custom
TabBar object to a TabPanel.
Does anybody know of a way or some workaround for allowing scrolling on
the TabBar that is part of a TabPanel?
I really would also like the ability to subclass TabBar as do some
mouse event processing for example I want the user to rightclick on a
TabBar Item and get a popup menu one of whose options is to close that
tab. Anyway to do that that somebody knows.
Thanks,
Melody