In the specific case I'm trying to implement this, the phonebook app, in the ListContactsPanel I have a createLink, and this is how I replace the current panel to the new one :
IndexPage idxPage = (IndexPage)getPage();
MarkupContainer tab = (MarkupContainer)idxPage.get("tabs");
EditContactPanel editPanel = new EditContactPanel((Panel)tab.get("panel"),
getParent().getId(), 0);
tab.replace(editPanel);
idxPage.setPanel(editPanel);
where IndexPage has the tabs and it has an instance variable, panel, that contains the last accesed panel for tab 1 (it could have a Map for each tab).
The problem is that I find the above code too complicated and something very similar has to be used in each place I replace a panel. Besides in the case of the UserActionPanel I had to change the constructor to pass it a reference to the ListContactsPanel.
Any tips?
Thanks,
Jaime.
>>ITab is a factory for tab panels - it is there as a level of indirection so you dont >>have to create/populate panels for each tab until the user selects the tab.
>>there is nothing special you need for state management - wicket takes care of >>it for you.
>>to keep the state of previous tabs instead of always creating a new panel in >>your ITab impl, keep the ref to the old one, see PanelCachingTab which does >>just that.
>>also instead of using getParent().replace() it might be cleaner to use >>component.replaceWith()
>>-Igor
>>So, if I use the Panels approach I'd need just one page and the navigation >>inside a tab would be using the replace method of MarkupContainer right?, and >>in this case how could I manage state in each tab?
>>One thing of TabbedPanel implmentation I don't understand is why tabs are >>added first to a list and then added to the TabbedPanel, also why Tab is not a >>MarkupContainer since is supossed to contain a panel?
>>Thanks and Regards,
>>Jaime.
>>yes, have everything be a panel. there is absolutely nothing wrong with that. >>wicket makes very little distinction between a page and a panel - a page is just >>a top level container.
>>if you create a basepage or something similar you will lose previous state - like >>selected tab, etc. it is simly much easier to work with panels.
>>-Igor
>>>>On 10/9/06, Jaime De La Jara <[EMAIL PROTECTED]> wrote: And in the case of a>>>> web app that handles, for example, invoices and vendors with this >>>>navigation flow :
>>>> Invoice Search -> List of Invoices -> Invoice detail -> Invoice edition
>>>> Vendors Search -> List of Vendors -> Vendor detail -> Vendor edition
>>>>and I'd like to create two tabs, one for Invoices and the other for Vendors. >>>>Would I have to convert each Page to a panel and instead of >>>>setResponsePage use replace and the corresponding code to retrieve a >>>>parent and all that?
>>>>What if I created a BasePage that contained the tabs and have each page to>>>> inherit from this page to add the specific markup and take care of tab >>>>selection?
>>>>How hard would be to extend TabbedPanel and ITab to manage the above >>>>situation? Besides one would have to consider what happens to a tab state >>>>when the user changes the selected tabs and returns to the first tab, it'd >>>>have to redisplay the first page of the flow or redisplay the last page?
>>>>Thanks,
>>>>Jaime.
>>To work with panels and component replacement. That way you would
>>hardly ever work with setReponsePage, but rather with
>>Component#replaceWith or MarkupContainer#replace in Wicket 1.2.x, or
>>in Wicket 2.0, you would just create the new component with the proper
>>parent or in case you'd want to reuse an older instance, you can use
>>Component#reAttach
>>Eelco
>>On 10/5/06, Jaime De La Jara < [EMAIL PROTECTED]> wrote:
>>> What could be the preferred way to have an application with tabs and have a
>>> bunch of pages inside one of the tabs so the navigation between them is
>>> equivalent as a navigation between standalone pages? Besides of extending
>>> from Panel, What would be the analog of setResponsePage() ?
>>>
>>> Thanks.
>>>
>>> Jaime.
>>>
>>>
>>> ________________________________
>>> Talk is cheap. Use Yahoo! Messenger to make PC-to-Phone calls. Great >>rates
>>> starting at 1ยข/min.
>>>
>>>
>>> -------------------------------------------------------------------------
>>> Take Surveys. Earn Cash. Influence the Future of IT
>>> Join SourceForge.net's
>>> What could be the preferred way to have an application with tabs and have a
>>> bunch of pages inside one of the tabs so the navigation between them is
>>> equivalent as a navigation between standalone pages? Besides of extending
>>> from Panel, What would be the analog of setResponsePage() ?
>>>
>>> Thanks.
>>>
>>> Jaime.
>>>
>>>
>>> ________________________________
>>> Talk is cheap. Use Yahoo! Messenger to make PC-to-Phone calls. Great >>rates
>>> starting at 1ยข/min.
>>>
>>>
>>> -------------------------------------------------------------------------
>>> Take Surveys. Earn Cash. Influence the Future of IT
>>> Join SourceForge.net's
Do you Yahoo!?
Get on board. You're invited to try the new Yahoo! Mail.
------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user