Hi

I'm wondering what is the best practice of using mvp and
TabLayoutPanel with the following layout of the page.
The page layout is master/details. On top it displays some properties
of the model and on the bottom in the tabs it shows some history data
related to that model object. I guess its not rare case especially in
business applications.

So the object model is pretty straightforward one presenter/view for
handling of the model object properties and bunch of presenters/views
which are handling related history data.

The problem is how to wire together TabLayoutPanel and presenters/
views it is responsible to display.
I read the MVP part I and II tutorial and there parent presenter calls
the go(HasWidgets container) on the child presenter so the child
presenter can initialize and attach its view to the display
container.
But it's not the case when the container is TabLayoutPanel since when
adding the tab I have to pass two widgets : header and tab content
widget.
On other hand TabLayoutPanel does not introduce handy interface for
that operation for example HasWidgetsAndHeaders and for obvious
reasons I would like to stick to interfaces in the presenters go()
methods not go(TabLayoutPanel container).

So I came with the following solution, my uibinder looks like this :

        <g:FlowPanel><g:Label>Master display</g:Label></g:FlowPanel>
        <g:TabLayoutPanel barHeight='3' barUnit='EM'>
                <g:tab>
                        <g:header>Tab 1</g:header>
                        <g:FlowPanel ui:field="tab1"><g:/FlowPanel>
                </g:tab>
                <g:tab>
                        <g:header>Tab 2</g:header>
                        <g:FlowPanel ui:field="tab2"><g:/FlowPanel>
                </g:tab>
        </g:TabLayoutPanel>

Then presenter holding the TabLayoutPanel listens for the tab
selection events and binds the corresponding presenter display to its
tab container.

I'm not sure if its the best approach when working with TabLayoutPanel
in MVP manner. Perhaps you have found the better solution ?
I'm sure that the are more solutions and would like to know more about
them especially since this problem is related to nested presenters,
which are stronly debated here.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to