onRevealDisplay with TabPanel

23 views
Skip to first unread message

jmccartie

unread,
Jul 8, 2010, 11:49:55 AM7/8/10
to GWT Presenter
I'm using the "replace" branch.

I've got a view with a tab panel.

Selecting each tab updates the url. Example, clicking the first tab
changes reveals the first tab and the url correctly changes to:

http://127.0.0.1:8888/main.html?gwt.codesvr=127.0.0.1:9997#user;tab=0

Here's my code for that:

@Override
protected void onBind() {

display.getTabPanel().addSelectionHandler( new SelectionHandler() {
@Override
public void onSelection(SelectionEvent event) {
setCurrentTab(event.getSelectedItem().toString());
revealDisplay(currentTab, currentProjectId);
}
});

However, I can't use direct HREF's in my app. If I set a link to:

http://127.0.0.1:8888/main.html?gwt.codesvr=127.0.0.1:9997#user;tab=2

... the presenter won't go to tab 2. No problem, right? I'll just
programmatically select tab 2. However, if I add this:

@Override
protected void onRevealDisplay() {
if (this.currentTab.equals("2")) {
display.getTabePanel().selectTab(2);


... I end up in an infinite loop which crashes the browser. I can get
this to work by removing the "revealDisplay" call in my click Handler,
but then clicking the tabs doesn't work.

What's the best way to handle this?

Thanks!!
Reply all
Reply to author
Forward
0 new messages