And if you only try to remove the currScreen ; is it removed ? 2009/2/5 Giles Baxter <[email protected]>
> I realized I didn't need the two elements that came after the content. > > So I tried add instead of insert as you suggested, but I still get the same > behavior. > > > On Wed, Feb 4, 2009 at 11:49 PM, Giles Baxter <[email protected]>wrote: > >> Seems to be consistent. >> >> Here are the screenshots - don't know if that'll help. >> http://www.engr.uvic.ca/~gbaxter/tests.html<http://www.engr.uvic.ca/%7Egbaxter/tests.html> >> >> Only problem with the code you suggested is that I want to insert the >> content at a specific point in mainInnerPanel. If I use add, content will >> be at the end... >> >> >> On Wed, Feb 4, 2009 at 11:44 PM, Damien Picard >> <[email protected]>wrote: >> >>> Your mainInnerPanel is a FlowPanel, right ? >>> >>> try something like that : >>> >>> public void setCurrScreen(Widget content) { >>> mainInnerPanel.remove(currScreen); >>> mainInnerPanel.add(content); >>> currScreen = content; >>> } >>> >>> does the problem always appears ? >>> >>> >>> >>> 2009/2/5 Giles Baxter <[email protected]> >>> >>> Sure. I used the Showcase sample as a template. They have a tree where >>>> the tree items map to different content widgets. >>>> >>>> I've created two Maps: one for history tokens and one for link texts. >>>> Here are the two listeners that use them to figure out what screen to >>>> display: >>>> >>>> final HistoryListener historyListener = new HistoryListener() { >>>> public void onHistoryChanged(String historyToken) { >>>> Composite screen = exchangerTokens.get(historyToken); >>>> app.setCurrScreen(screen); >>>> } >>>> }; >>>> >>>> History.addHistoryListener(historyListener); >>>> >>>> app.setListener(new ApplicationListener() { >>>> public void onHyperlinkClicked(Hyperlink link) { >>>> Composite content = exchangerScreenLinks.get(link.getText()); >>>> if (content != null && !content.equals(app.getCurrScreen())) { >>>> History.newItem(getCurrScreenToken(content)); >>>> } >>>> } >>>> }); >>>> >>>> And here's the setCurrScreen method that calls insert(); >>>> >>>> public void setCurrScreen(Widget content) { >>>> int currScreenIndex = mainInnerPanel.getWidgetIndex(currScreen); >>>> if (currScreenIndex > -1) { >>>> // the screen widget referenced by currScreen was found in >>>> the container >>>> mainInnerPanel.remove(currScreenIndex); >>>> mainInnerPanel.insert(content, currScreenIndex); >>>> } >>>> else { >>>> // the container had not yet been populated >>>> mainInnerPanel.insert(content, 1); >>>> } >>>> currScreen = content; >>>> >>>> } >>>> >>>> On Wed, Feb 4, 2009 at 11:15 PM, Damien Picard <[email protected] >>>> > wrote: >>>> >>>>> Hi, >>>>> >>>>> Could you copy past your code ? I think that it is probably an error in >>>>> your algorithm. >>>>> >>>>> Regards, >>>>> Damien >>>>> >>>>> 2009/2/5 Giles <[email protected]> >>>>> >>>>>> >>>>>> Hi, >>>>>> >>>>>> I'm trying to give the impression of navigating through a site by >>>>>> updating a component contained in a FlowPanel. >>>>>> >>>>>> Each time I call myPanel.insert(myComponent, index), the contents of >>>>>> myComponent are repeated. I have some screenshots from running the >>>>>> debugger in Eclipse if anyone thinks they can help. >>>>>> >>>>>> In this case, myComponent wraps another FlowPanel. After inserting >>>>>> into myPanel, the id of myComponent, the FlowPanel it wraps, and the >>>>>> WidgetCollection inside the FlowPanel are the same. But the id of the >>>>>> Widget array inside the WidgetCollection changes, and now contains the >>>>>> duplicated contents. >>>>>> >>>>>> I don't understand how the object being passed to insert() could be >>>>>> modified like this. >>>>>> >>>>>> Thanks >>>>>> Giles >>>>>> >>>>>> >>>>>> >>>>> >>>>> >>>>> >>>> >>>> >>>> >>> >>> >>> >> > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
