Search code examples
javagwtmvpuibinder

UIBinder and MVP in GWT


When using the MVP pattern as described here in GWT, how do you create a presenter associated with a view when the view is part of another uibinder-defined view.


Solution

  • You instantiate it yourself via:

    1. @UiFactory method:

      @UiFactory
      public Widget getMyView(){
      
          // here you instantiate your view & activity
          ...
      
          // your view contais a widget or is a widget
          return widget
      }
      
    2. @UiField(provided=true) field :

      @UiField(provided=true)
      public Widget myView;
      
      // then instantiate it in constructor