Split Panels Inside A Closed Disclosure Panel Don't Work Properly

8 views
Skip to first unread message

Ian Bambury

unread,
Aug 20, 2008, 1:24:45 PM8/20/08
to Google Web Toolkit
If you do something like this...
 

        DisclosurePanel p = new DisclosurePanel("Header", false);
        RootPanel.get().add(p);
        HorizontalSplitPanel s = new HorizontalSplitPanel();
        p.setContent(s);
        s.setSize("100px", "100px");
        s.setLeftWidget(new HTML("Hello"));
        s.setRightWidget(new HTML("World"));
 
 
then the splitter is right over on the left when you open the disclosure panel.
 
It's OK if the disclosure panel is open.
 
Anyone know of a workaround? (Other than creating it open and closing it with a DeferredCommand which gives a 'pop' of the open panel)
 
Cheers,

Ian Bambury

unread,
Aug 22, 2008, 2:28:10 PM8/22/08
to Google Web Toolkit
Any ideas gratefully welcomed...

2008/8/20 Ian Bambury <ianba...@gmail.com>



--
Ian
http://examples.roughian.com
_______________________________________

Stuff the environment - Print this email
_______________________________________

gregor

unread,
Aug 22, 2008, 4:28:10 PM8/22/08
to Google Web Toolkit


DisclosurePanel p = new DisclosurePanel("Header", false);
HorizontalSplitPanel s = new HorizontalSplitPanel();
public void onModuleLoad() {
p.addEventHandler(new DisclosureHandler() {
public void onClose(DisclosureEvent event) { }
public void onOpen(DisclosureEvent event) {
s.setSplitPosition("50%");
}
});
RootPanel.get().add(p);
p.setContent(s);
s.setSize("100px", "100px");
s.setLeftWidget(new HTML("Hello"));
s.setRightWidget(new HTML("World"));
}

regards
gregor

On Aug 22, 7:28 pm, "Ian Bambury" <ianbamb...@gmail.com> wrote:
> Any ideas gratefully welcomed...
>
> 2008/8/20 Ian Bambury <ianbamb...@gmail.com>
>
>
>
> > If you do something like this...
>
> > DisclosurePanel p = new DisclosurePanel("Header", false);
> > RootPanel.get().add(p);
> > HorizontalSplitPanel s = new HorizontalSplitPanel();
> > p.setContent(s);
> > s.setSize("100px", "100px");
> > s.setLeftWidget(new HTML("Hello"));
> > s.setRightWidget(new HTML("World"));
>
> > then the splitter is right over on the left when you open the disclosure
> > panel.
>
> > It's OK if the disclosure panel is open.
>
> > Anyone know of a workaround? (Other than creating it open and closing it
> > with a DeferredCommand which gives a 'pop' of the open panel)
>
> > Cheers,
> > Ian
> > --
>
> >http://examples.roughian.com
>
> --
> Ianhttp://examples.roughian.com

Ian Bambury

unread,
Aug 22, 2008, 5:29:42 PM8/22/08
to Google-We...@googlegroups.com
Thanks gregor,
 
Unfortunately, the disclosure panel has no knowledge about what it is enclosing - it's just some HTML which may or may not have a slot in it, and that slot may or may not contain 1 or more split panels and/or other things. And the Split panel may or may not be enclosed.
 
So I'm very grateful for your reply, but I'm going to have to keep looking. Split panels are final, which doesn't help.
 
I'll post here if I get anything.
 
Cheers,
 
Ian

2008/8/22 gregor <greg.p...@googlemail.com>

Ian Bambury

unread,
Aug 23, 2008, 5:33:02 PM8/23/08
to Google-We...@googlegroups.com
Actually, SplitPanels are worse that I thought - fine if you put them in a visible slot or widget, but unusable if you want to move them about (because the two panels and the splitter are absolute and don't follow the splitpanel outer to its new location)
 
That also appears to be the cause of not being able to create them in closed DisclosurePanel - because they are not attached when they are set up, there are no width/height/left/top values.
 
If you add a SplitPanel to one slot and move it to another, the innards end up at 0,0
 
Or am I doing something wrong?
 
Ian
 
/*
 * Set up the html
 */
String str = "";
str += "<div id='temp'";
str += " style='border:1px solid red;'>";
str += "x";
str += "</div>";
str += "x";
str += "<div id='temp2'";
str += " style='border:1px solid red;'>";
str += "x";
str += "</div>";
RootPanel.getBodyElement().setInnerHTML(str);
/*
 * Create a splitpanel
 */
final HorizontalSplitPanel s = new HorizontalSplitPanel();
DOM.setStyleAttribute(s.getElement(), "border", "1px solid black");
RootPanel.get("temp").add(s);

s.setSize("100px", "100px");
/*
 * Add the left and right panel
 */
HTML html;
html = new HTML("Hello");
s.setLeftWidget(html);
DOM.setStyleAttribute(html.getElement(), "border", "1px dashed blue");
html = new HTML("World");
s.setRightWidget(html);
DOM.setStyleAttribute(html.getElement(), "border", "1px dashed blue");
/*
 * Stop for a look
 */
Window.alert("stop");
/*
 * Move it
 */
RootPanel.get("temp2").add(s);

Ian Bambury

unread,
Aug 30, 2008, 8:16:50 PM8/30/08
to Google-We...@googlegroups.com
As well as doing this in DisclosurePanels, it also happens in StackPanels.
 
For both:
 
 * If closed when created, the SplitPanel sets up with the head panel sized to 0,0
 * If closed when attached it will do the same
 * If open when attached it will reset to 50% and scroll positions will be lost
 * It also seems that other absolute elements will disappear (get moved?) if they are on the same swapped out panel as the SplitPanel. For some reason dragging and highlighting the whole page gets mine back, as does double-clicking where they were. I have no idea why that might be.
 
If someone will confirm this, I'll log it as an error
 
Ian

Ian Bambury

unread,
Feb 17, 2009, 7:58:58 PM2/17/09
to Google-We...@googlegroups.com
No-one bothered to confirm or deny this, but I still get it in 1.6.

Are there any plans to fix this?
Reply all
Reply to author
Forward
0 new messages