Announcement

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

    DynamicForm.setColWidths("*", 25) no longer works in production on Jan 16th 3.1p

    I think the Jan 16th build (or earlier) introduced a problem with Dynamicform.setColdWidths(Object ... objects); method.

    Intro:
    - We were caught by the FireFox 18 vs. SmartGWT issue and updated to Jan 16th SmartGWT 3.1p version. This upgrade fixed our ToolStrip twice-the-height issue, but the upgrade caused us to see this new issue.

    Issue 1:
    - We have a custom CanvasItem widget which shows a device/resource picker in a ListGrid table. The CanvasItem consists of a DynamicForm showing a TextItem and a ButtonItem.
    - When showing the application in production, the TextItem no longer stretches to fill the available space in the DynamicForm cell.
    - When showing the application in development mode, debugging in eclipse, the TextItem shows just fine like it used to before upgrading to SmartGWT 3.1p Jan 16 2013.

    (Attached are two images showing the difference.)

    I think I have narrowed it down to the following line of code:

    Code:
    form.setColWidths(new Object[]{
                new String("*"),
                new Integer(25)});
    The idea is that the button should be 25 pixels wide, and the rest of the form area should stretch to fill the space. This has worked fine for months.

    I am not able to find a workaround for this and thus reaching out here.


    Issue 2:
    Similar to issue 1 issue was found and fixed on our end:
    We had an issue regarding a Window which showed a TextAreaItem which filled the entire screen. After the upgrade on the 16th, we noticed that the TextAreaItem no longer filled the screen. It filled the height properly, but centered itself in the window, only showing about 160px wide. (see TextArea attachements).

    We fixed this issue by commenting out one line of code in the following code snippet:

    Code:
    TexAreaItem item = new TextAreaItem();
    item.setWidth("*");
    item.setHeight("*");
    item.setAlign(Alignment.CENTER);
    
    item.setColSpan(1);
    item.setRowSpan(1);
    item.setShowTitle(false);
    
    DynamicForm form = new DynamicForm();    
    form.setNumCols(1);
    form.setPadding(0);
    form.setWidth(CCStringUtils.ASTERISK_STRING);
    
    // commented this line out to make the TextAreaItem stretch across the drop in form:
    //form.setColWidths("*");
    
    form.setFields(item);
    Once that line was commented out, the TextAreaItem filled the window again. Please note that this issue also showed up only in production. In eclipse debugging it was filling the window as it did before the Jan 16th upgrade.

    I apologize for not including a complete standalone sample but I hope you have an example in the showcase you can test with. Thank you in advance for looking at this.
    Attached Files
    Last edited by jornn; 17 Jan 2013, 14:32.

    #2
    For your second issue, it's not clear what CCStringUtils.ASTERISK_STRING is, but if it's "*" then that's your problem - if you make the form's width "100%" instead, that will address the issue.

    You didn't show the code for your fist issue, but it is likely to be the same problem - the form has width "*" and so does the field. This code appears to do what you want, does this work for you?

    Code:
    	TextAreaItem item = new TextAreaItem();
    	item.setWidth("*");
    	item.setHeight("*");
    	item.setAlign(Alignment.CENTER);
    	item.setColSpan(1);
    	item.setRowSpan(1);
    	item.setShowTitle(false);
    
    	DynamicForm form = new DynamicForm();
    	form.setNumCols(1);
    	form.setPadding(0);
    	form.setWidth("100%");
    	form.setColWidths("*");
    	form.setFields(item);	
    	form.draw();

    Comment


      #3
      Yes, sorry, the CCStringUtils.ASTERISK_STRING = "*". That was not supposed to be in the code example. My bad.

      I will give your suggestions a try.

      Thanks for the quick response.

      Comment


        #4
        To clarify - all three FormItems in use in these two examples should be declared with width "*" - so, in your first example, the form has colWidths specified, and setting both FormItems to "*" will cause them size to the width of the columns they live in.

        Comment


          #5
          Originally posted by Isomorphic View Post
          For your second issue, it's not clear what CCStringUtils.ASTERISK_STRING is, but if it's "*" then that's your problem - if you make the form's width "100%" instead, that will address the issue.

          You didn't show the code for your fist issue, but it is likely to be the same problem - the form has width "*" and so does the field. This code appears to do what you want, does this work for you?

          Code:
          	TextAreaItem item = new TextAreaItem();
          	item.setWidth("*");
          	item.setHeight("*");
          	item.setAlign(Alignment.CENTER);
          	item.setColSpan(1);
          	item.setRowSpan(1);
          	item.setShowTitle(false);
          
          	DynamicForm form = new DynamicForm();
          	form.setNumCols(1);
          	form.setPadding(0);
          	form.setWidth("100%");
          	form.setColWidths("*");
          	form.setFields(item);	
          	form.draw();
          The above code works fine if I run inside eclipse... In deployed mode the view still shows up with a narrow centered TextArea.

          If I commented out this one line of code:

          Code:
          // form.setColWidths("*");
          ... then deployed mode works fine as well... :-?

          As a side note, not sure if this matters at all, but when I run the code in production with form.setColWidths("*"), then when using firebug to inspect the element, I see that the narrow TextArea element shows no width specified at all.

          If I comment this line out (form.setColWidths("*")) then the TextArea is stretched properly to the width of the DynamicForm and shows a proper width in Firebug inspector.

          In ...ok_width you see that the element has a width. In ...no_width_TextAreaSelection, you will see that the element has no width at all specified.

          I included a 3rd screenshot (...no_width_ParentContainerSelected), which shows you the width of the parent panel the TextArea is supposed to stretch into.

          I will now go through the first issue I had, and see if I can get that to work in production. I did not include code for the first example, since there is a lot of code involved in that CanvasItem class, and I hoped that the 2nd issue would be the same issue and easier to identify and fix. :-)

          Thanks for looking at this.
          Attached Files

          Comment


            #6
            Updated to SmartGWT 3.1p Jan 18th (todays build) and issues are now gone.

            I'm not sure what changed between Jan 16th and today, but whatever was done fixed the issues. Both the TextArea and CanvasItem in grid (with TextItem + Button) are fixed.

            Nice work and thanks for looking into this today for me.

            Jorn

            Comment

            Working...
            X