Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    ResizeBar not working correctly after calling show

    Hi,
    we use smartgwt 2.5 and i have following showcase:

    Code:
    public class SmartGwtTest implements EntryPoint {
    
    	public void onModuleLoad() {
    		HLayout layout1 = new HLayout();
    		layout1.setWidth100();
    		Layout child1 = new Layout();
    		child1.setWidth("*");
    		child1.setBorder("1px solid");
    		child1.setMembers(new Label("child1"));
    		child1.setShowResizeBar(true);
    		child1.setDefaultResizeBars(LayoutResizeBarPolicy.MARKED);
    		child1.setResizeBarTarget("next");
    		final Layout child2 = new Layout();
    		child2.setBorder("1px solid");
    		child2.setMembers(new Label("child2"));
    		child2.setVisible(false);
    
    		final Layout layout2 = new Layout();
    		layout2.setBorder("1px solid");
    		layout2.setMembers(new Label("layout2"));
    		layout2.addClickHandler(new ClickHandler() {
    			public void onClick(ClickEvent clickEvent) {
    				layout2.hide();
    				child2.show();
    			}
    		});
    
    		child2.addVisibilityChangedHandler(new VisibilityChangedHandler() {
    			public void onVisibilityChanged(VisibilityChangedEvent visibilityChangedEvent) {
    				if (visibilityChangedEvent.getIsVisible()) {
    					layout2.hide();
    				} else {
    					layout2.show();
    				}
    			}
    		});
    
    		HLayout layout = new HLayout();
    		layout.setMembers(layout1, layout2);
    		layout.setWidth100();
    		layout1.setMembers(child1, child2);
    		layout.draw();
    	}
    }

    The problem is that after clicking on layout2 the child2 cannot be drag-resized anymore(Maybe you need to drag-resize it first). The click-to-collapse behavior is ok. Is this a bug or are we doing this improper way?

    Thanks

    #2
    This appears to be a usage issue.
    Basically you have the following setup:

    Layout1 contains 2 members, Child1 and Child2.
    Child1 is showing a resizeBar and has resizeBarTarget set to next. This means when dragged it'll resize the next member of the parent (so it'll resize Child2).

    When Child2 is showing, in our testing this all works fine.


    Layout1 is itself a member of an outer layout (just "layout"), and has another member "Layout2", and your app is setup such that child2 and layout2 are pretty much mutually exclusive in terms of visibility -- clicking on layout2 will show child2 and hide layout2, clicking on the resize bar will hide child2, which shows layout2.

    When child2 is hidden, and layout2 is visible, the resize bar on the right of child1 remains visible but it will not resize layout2.
    This is actually expected behavior -- the resize bar is attached to child1 and causes the *next member* of child1's layout to resize. In this scenario there is no visible next member -- layout2 is not a member of the same layout as child1.

    In terms of getting the behavior you need within your actual application, we don't know your exact use-case but it would seem that the obvious option would be to remove the outer layout, so you have a single HLayout containing child1, child2 and layout2 as members.

    Alternatively - if you need to retain the nesting you currently have, you could dynamically show a resizebar on layout1 when showing layout2, and hide the resizeBar on child1 at the same time (and obviously vice versa).

    If you can't get the behavior you're after, it may be easiest if you lay out exactly what you're trying to achieve and we may be able to suggest something.

    Comment


      #3
      Thanks, but the behavior we want to achieve is following(the test case does not cover it 100%):

      The child2 is a side menu and layout2 is a side bar. When child2 is visible layout2 is hidden and vice versa. But the resize bar should always apply to child2. So when its clicked the child2 collapses and layout2 is shown but cannot be resized. When the resize bar is clicked again child2 is shown and layout 2 hidden. The problem is in the second request: When layout2 is clicked child2 should be shown and layout2 hidden and if child2 is clicked child2 is hidden and layout2 is show. This causes child2 to be unresizable although clicking on the resize bar to show and hide works.

      Thanks a lot

      Comment


        #4
        Do you have any clues?

        Comment


          #5
          We've made a change to the framework that should resolve this. Please try the next nightly (2.5p, 3.0p and 3.1d branches will all have this change)

          Regards
          Isomorphic Software

          Comment


            #6
            Great it works, thanks

            Comment

            Working...
            X