Announcement

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

    Layout bugs in 6.1d

    SmartClient Version: SNAPSHOT_v11.1d_2016-12-12/LGPL Development Only (built 2016-12-12)
    Windows 10 - Chrome Version 54.0.2840.99 m

    We are trying out SmartGWT 6.1d, as it fixes all the problems we have with: http://forums.smartclient.com/forum/...id-java-object

    There either seems to have been some drastic changes to the way Layouts works, or they are currently not working correctly. We noticed that a lot of elements suddenly did not fit correctly with the layouts.
    Some places the elements would stretch to take up the whole page. While at other places elements would be "eaten" up by others, even when their defined sizes should not allow them to do so.

    We have been able to create two reproducible examples, however my guess is that they both are from the same problems.
    From what I can tell, it seems there are certain problems when you have a Layout with a percentage size, containing an element which has no defined size until after it has been added to the Layout.


    First example is something which happened with our custom buttons(Which are extended from Labels).
    Essentially, the buttons which were given setWidth100() inside a Layout which also had setWidth100(), which again was inside a layout with a 100px wid, would always act as if they had the whole page. In addition, they would ignore resize event to the parent layout or the page itself.
    Code:
        /**
         * Giving a percentage width to a layout, contained in a layout of fixed width, causes the content to believe it has PAGE width.
         */
    final Layout mainLayout = new HLayout();
            mainLayout.setWidth100();
            mainLayout.draw();
            
            new Timer() {
                
                @Override
                public void run() {
                    //Left
                    Layout leftLayout = new HLayout();
                    Label leftLabel = new Label("Left");
                    leftLayout.setMembers(leftLabel);
                    
                    //Middle
                    Layout middleLayout = new HLayout();
                    middleLayout.setWidth(100);
                    Layout labelLayout2 = new HLayout();
                    labelLayout2.setWidth100();
                    Label testLabel = new Label("Label 1");
                    //testLabel.setWidth100(); //Setting this here causes the middle layout to have correct width
                    //However, 'Left' then seems to take much more than 100px width.
                    
                    middleLayout.setMembers(labelLayout2);
                    labelLayout2.setMembers(testLabel);
                    
                    //Right
                    Layout rightLayout = new HLayout();
                    Label testLabel2 = new Label("Label 2");
                    rightLayout.setMembers(testLabel2);
                    testLabel2.setWidth100();
                    
                    
                    mainLayout.setMembers(leftLayout, middleLayout, rightLayout);
                    
                    testLabel.setWidth("100%"); //Takes percentage of PAGE width, rather than middleLayout's width.
                    leftLayout.setWidth(100);
                    rightLayout.setWidth(300);
                    
                }
            }.schedule(1000);
    Expected Behavior
    The left layout would take up 100 pixels, the middle would take up 100 pixels, the right layout would take up 300 pixels.

    Observed Behavior
    The left layout takes up 100 pixels.
    The middle takes up 100% of page width, pushing the right layout outside the page.
    The right layout takes up 300 pixels.


    The other problem seems to be mostly the same, just with the height.
    We have a setup where there is content below a Tabset, with the Tabset having a Set height, and the content around resizing to fit depending on things like width/height ratio.
    We noticed that the tabs would more often than not be given a height of 1px, even though we explicitly gave it 38px. The only solution we found in our specific case, was to give the content element height-38px.
    The example seems a bit easier to fix, as simply giving it a height BEFORE adding it to the layout, allows it to maintain the height:
    Code:
    /**
         * The Tabs are forced into a height of 1px.
         * Any height set AFTER being added to the layouts, are ignored.
         */
    final Layout mainLayout = new VLayout();
            mainLayout.setHeight100();
            mainLayout.setWidth100();
            mainLayout.draw();
            
            new Timer() {
    
                @Override
                public void run() {
                    HLayout splitter = new HLayout();
                    splitter.setHeight100();
                    VLayout left = new VLayout();
                    left.setShowResizeBar(true);
                    left.setHeight100();
                    
                    VLayout right = new VLayout();
                    TabSet tabs = new TabSet();
                    tabs.addTab(new Tab("tab1"));
                    tabs.addTab(new Tab("tab2"));
                    tabs.setHeight100();
                    //tabs.setHeight(38); //Setting a specific height here works
                    
                    Layout tabContent = new HLayout();
                    tabContent.setHeight100();
                    Layout innerLayout = new VLayout();
                    innerLayout.setHeight100();
                    Canvas content = new Canvas();
                    content.setContents("TEST");
                    
                    tabContent.addMember(innerLayout);
                    innerLayout.addMember(content);
                    right.setMembers(tabs, tabContent);
                    
                    splitter.setMembers(left, right);
                    mainLayout.addMember(splitter);
                    
                    tabs.setHeight(38);
                    content.setHeight100();
                }
                
            }.schedule(1000);
    Expected Behavior
    The top Tabs would take up 38 pixels of height.
    The content layout would take up the remaining height.

    Observed Behavior
    The top Tabs get's 1 pixel of height, making them invisible and useless.
    The content layout takes everything, "eating up" the tabs.



    Hopefully you guys are able to take a look at this :)
    Last edited by wildex999; 12 Dec 2016, 04:38. Reason: Added expected and observed behavior

    #2
    We see the issues that you have reported and are investigating. We'll update this thread when any fixes have been made.

    Comment


      #3
      We've addressed the regression in SGWT 6.1d that you have observed - both samples were affected by the same issue. The fix will be in the nightly builds dated 2016-12-18 and beyond.

      Comment

      Working...
      X