Looks like we can't reproduce the issue or there's a problem in the test case provided.
  1. #1
    Sencha User
    Join Date
    Nov 2012
    Posts
    8
    Vote Rating
    0
    pitt is on a distinguished road

      0  

    Default GWTP Nested Presenter Issue

    GWTP Nested Presenter Issue


    When using GXT with gwtp framework the nested presenters are not displayed. However the html is attached to the DOM. Only doing resize or calling Container's forceLayout() displays the content.

    This happens when using GXT container (VBoxLayoutContainer) as a top-level container for nested presenter. When using native GWT panel like FlowPanel the presenter is displayed after onReveal() event without the need to resize or forcing layout.

    I would appreciate any help.

    Thank you.

  2. #2
    Sencha Premium Member
    Join Date
    Dec 2012
    Location
    Sydeny
    Posts
    5
    Vote Rating
    0
    Rob Ferguson is on a distinguished road

      0  

    Default


    Hi,

    I am using GXT, GWTP and nested Presenters without any issues. I am also using a variation of the MVP design pattern that utilises UiHandlers.

    You might like to try using a VerticalLayout as the parent container for the VBoxLayoutContainer.

    See also:

    -> http://uptick.com.au/content/working...and-uihandlers
    -> http://code.google.com/p/gwt-cx/source/browse

    Cheers
    Rob

    Kiahu.com

  3. #3
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,717
    Vote Rating
    88
    Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light

      0  

    Default


    Thanks for the reply Rob - I haven't used GWTP much, but like you, I haven't had problems with it when I did.

    pitt, I'm going to mark this as CLOSED for now, but feel free to open with a working code sample that demonstrates the issue. We have a bug template so that we can make sure to get all the important information right away instead of going back and forth a few times - please try to follow it in the future for quicker fixes.

  4. #4
    Sencha User
    Join Date
    Nov 2012
    Posts
    8
    Vote Rating
    0
    pitt is on a distinguished road

      0  

    Default


    Thanks for the info. I'll try to use VerticalLayout to see if it will redraw after adding new child.

    Thanks.

  5. #5
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,717
    Vote Rating
    88
    Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light

      0  

    Default


    When adding a new child, forceLayout() must often be invoked on the parent to inform it that its sizes have changed, and new details must be accounted for. This isn't always necessary, but depends on the type of parent being used - SimpleContainer will never need it, neither will most of its subclasses (except BorderLayoutContainer), but most containers that handle multiple children and size them will need it. When you want to wrap up this call in an AcceptsOneWidget, you usually want to make something like this:

    Code:
    foo.setDisplay(new AcceptsOneWidget() {
      public void setWidget(IsWidget widget) {
        parentContainer.clear();
        parentContainer.add(widget, new BarLayoutData(...));
        parentContainer.forceLayout();
      }
    });
    This is one of the ways that using interfaces in designing/structuring your app can be so powerful - at least the Activity/Place api in GWT uses this simple interface, allowing you to abstract out the real behavior of replacing a widget.

  6. #6
    Sencha Premium Member
    Join Date
    Dec 2012
    Location
    Sydeny
    Posts
    5
    Vote Rating
    0
    Rob Ferguson is on a distinguished road

      0  

    Default


    Hi,

    -> When adding a new child, forceLayout() must often be invoked on the parent to inform it that its sizes have changed, and new details must be accounted for. This isn't always necessary, but depends on the type of parent being used - SimpleContainer will never need it, neither will most of its subclasses (except BorderLayoutContainer), but most containers that handle multiple children and size them will need it.

    Ahh, I remember I had an issue with a nested Presenter (GWTP) that was the center panel in a BorderLayoutContainer. When changing the content I had to call the containers onResize() method:

    Code:
    // MainPageDesktopView.java
    
    
      @Override
      public void setInSlot(Object slot, Widget content) {
    
    
        if (slot == MainPagePresenter.TYPE_SetContextAreaContent) {
          if (content != null) {
    
    
            getCenterPanel().add(content);
    
    
            if (content instanceof com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer) {
              ((com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer) content).onResize();
            }
          }
        } else {
          super.setInSlot(slot, content);
        }
      }
    I haven't looked at the code for a while, however, it works as expected.

    Cheers
    Rob

    Kiahu.com

  7. #7
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,717
    Vote Rating
    88
    Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light

      0  

    Default


    Did it seem to be a bug in that? You shouldn't usually need to invoke onResize(), though according to the RequiresResize API, that's a perfectly acceptable way to inform it that sizes had changed and it should re-size itself and its children. In the case of ResizeContainer (VLC's superclass - not SimpleContainer that I mentioned in my post), onResize() calls setPixelSize, which will call onResize(int,int), which schedules a forceLayout() task. The VLC probably still has its size from when it was first added, so these should be equivalent at the end of the day...

  8. #8
    Sencha Premium Member
    Join Date
    Dec 2012
    Location
    Sydeny
    Posts
    5
    Vote Rating
    0
    Rob Ferguson is on a distinguished road

      0  

    Default


    Hi,

    I think that it may have been related to the use case where the user resized the browser window and then used the navigationPane (the west container) to navigate to another nested Presenter.

    indigo_gxt_basic_project_gwt_run.jpg

    I remember i tried a few options (including calling ForceLayout()), however, calling onResize() seemed to work - so I moved on to other things ....

    -> Did it seem to be a bug in that?
    I don't think so. I think GXT was just behaving in a way I didn't expect.

    Cheers
    Rob

    Kiahu.com