Saturday, 15 August 2015

gwt - GWTP implementation of TabContainer for PresenterWidget -


I am using GWTP for an application. In this app, I often need to do PresenterWidget , which contain tabs with PresenterWidget in each tab

Container one PresenterWidget , I can not use the class TabContainerPresenter , so I'm implementing my own.

I encounter: manage the life cycle of PresenterWidget contained in onReveal () , onHide () etc.) Some problems while trying to

First question : In this special case, call it manually OnRival () , onHide () Recommended?

The second question : I tried to manage those methods without the need to manage the lifecycle of the call

I do this: When a user clicks on a tab , Call the main presenter setInSlot (index, presenter widget) to call related to PresenterWidget right tab.

But: When I click on a tab, the caller is called at on PresenterWidget (Good!) Then OnReset () is called at all PresenterWidget : Why all? I hope that onReset () is called on the active tab only on PresenterWidget .

= & gt; setInSlot () Is this the right way to call?

It may be of help:

  1. I used the lifecycle method Do not advise to call manually Without it, they should work fine.
  2. You want to use the setInSlot () method because only one PresenterWidget is active at any point < P> Although you are using different SLOTs for each PresenterWidget , the way setInSlot () works, it changes the place which is PresenterWidget was assigned to that slot. Because you use different slots for each tab, it will not remove the other PresenterWidgets Other Presentation widget remain in their slots and probably this is the reason that OnReset () is called on them.
    You have 2 options:
    • If you want to put different slots, you can remove all code without any visible PresenterWidgets on removeFromSlot Calling on .
    • Specify only one slot (TAB_CONTENT) and simply use setInSlot ()

No comments:

Post a Comment