Announcement

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

    Strange behaviour show/hide canvasitem in form in Firefox

    Smartgwt pro 5.0-p20160409, Firefox any version

    Hello, i have an issue where calling show/hide on a canvasitem in a form seems to make other fields disappear. I have an example to illustrate. (in reality it's a layout with a mapwidget inside, but i've simplified it to make it easier to run)

    You can see that if you click on any row besides "japan" the canvasitem becomes hidden, but half of the fields seem to be hidden under something. In my own project, all fields become hidden...

    Would be great if you could look into it, it looks strange, and kinda makes us not being able to support Firefox:

    Code:
    public class Test2 implements EntryPoint {
    
        VLayout mainLayout;
    
        BooleanItem member;
        TextItem name;
    
        public void onModuleLoad() {
            /*
            Runnable onLoad = new Runnable() {
                @Override
                public void run() {
                    initLayout();
                }
            };
            MapLoader.loadMapApi(onLoad);*/
            initLayout();
        }
    
        public void initLayout(){
            try {
                mainLayout = new VLayout();
                mainLayout.setMembersMargin(20);
    
                final ListGrid grid = new ListGrid();
                grid.setWidth(500);
                grid.setHeight(224);
                grid.setShowAllRecords(true);
    
                ListGridField countryCodeField = new ListGridField("countryCode", "Code", 40);
                ListGridField nameField = new ListGridField("countryName", "Country");
                ListGridField independenceField = new ListGridField("independence", "Nationhood", 225);
                independenceField.setType(ListGridFieldType.DATE);
                ListGridField populationField = new ListGridField("population", "Population");
                populationField.setType(ListGridFieldType.INTEGER);
                ListGridField gdpField = new ListGridField("gdp", "GDP ($B)");
                gdpField.setType(ListGridFieldType.FLOAT);
    
                grid.setFields(countryCodeField, nameField, independenceField,
                    populationField, gdpField);
                grid.setCanResizeFields(true);
                grid.setData(CountrySampleData.getRecords());
    
                name = new TextItem("countryName", "Country");
                FormItem pop = new TextItem("population", "Population");
                member = new BooleanItem("member_g8", "Member G8");
    
                final TestCanvasItem item = new TestCanvasItem();
    
                final DynamicForm form = new DynamicForm();
                form.setAutoWidth();
                form.setFields(name, pop, item);
                mainLayout.setDefaultLayoutAlign(Alignment.CENTER);
                grid.addRecordClickHandler(new RecordClickHandler() {
                    public void onRecordClick(RecordClickEvent event) {
                        form.reset();
                        form.editSelectedData(grid);
                        if(!name.getValue().equals("Japan")){
                            item.hide();
                        }else{
                            item.show();
                        }
                    }
                });
    
                mainLayout.addMember(grid);
                mainLayout.addMember(form);
                mainLayout.draw();
            } catch (Exception e) {
                e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
            }
        }
    
    
        private class TestCanvasItem extends CanvasItem {
    
            //public MapWidget map;
            public VLayout mapLayout;
            public HTMLFlow text;
    
            public TestCanvasItem() {
                super("Position");
    
                mapLayout = new VLayout();
                mapLayout.setBorder("1px solid blue");
                mapLayout.setStyleName("paddingTopItem");
                mapLayout.setWidth(230);
                mapLayout.setHeight(200);
                mapLayout.setAlign(Alignment.LEFT);
                setAlign(Alignment.LEFT);
                setWidth(230);
    
                text = new HTMLFlow();
                mapLayout.addMember(text);
                text.setContents("hello there");
                text.setCanSelectText(false);
                text.setCanFocus(true);
                setCanEdit(false);
    
                setAlign(Alignment.CENTER);
                setColSpan(2);
                setShowTitle(false);
                setCanvas(mapLayout);
                this.setShouldSaveValue(false);
            }
            public Canvas getCanvas() {
                return mapLayout;
            }
    
        }

    #2
    Hi mathias,

    I think your sample is working for me using FF26 Dev Mode:
    Click image for larger version

Name:	Animation.gif
Views:	116
Size:	89.8 KB
ID:	237375


    Best regards
    Blama

    Comment


      #3
      This is strange. I was actually running Firefox24, so i upgraded to 26. I still get the same behavior. Could it be GWT? Which version of GWT are you building with?

      Comment


        #4
        I was using recent 5.1 (not 5.0) with GWT 2.7.0.

        Comment


          #5
          Okiedokie... i am running 5.0 and 2.6. I will try with newer versions and see if it's fixed.

          Comment


            #6
            I'd 1st change the SmartGWT version, most likely it's not an GWT issue (and Isomorphic recommends 2.6.1 anyway).

            Comment


              #7
              Well, it's 2.6.1 i'm running actually. Will try smartgwt.

              Comment


                #8
                Oh man.... :( I upgraded to 5.1. You are right in that my testcase works when i upgrade, it seems to have been fixed from 5.0.

                However, what i *really* have in my canvasitems are gwt maps components, i set up this test case for illustration purposes. More specifically, i have components that use the branflake maps gwt components. (see here https://github.com/branflake2267/GWT-Maps-V3-Api)

                When i switched jars to 5.1 i don't get any exceptions or anything, but the actual map canvases are just completely blank. I tried clearing, building and deploying in tomcat, still nothing. GAH. Guess i will have to make another test case...

                Comment

                Working...
                X