Announcement

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

    SelectItem displays "No items to show" in all languages

    Here's the code example (from edited showcase):
    Code:
     
    /*
     * Isomorphic SmartGWT web presentation layer
     * Copyright 2000 and beyond Isomorphic Software, Inc.
     *
     * OWNERSHIP NOTICE
     * Isomorphic Software owns and reserves all rights not expressly granted in this source code,
     * including all intellectual property rights to the structure, sequence, and format of this code
     * and to all designs, interfaces, algorithms, schema, protocols, and inventions expressed herein.
     *
     *  If you have any questions, please email <sourcecode@isomorphic.com>.
     *
     *  This entire comment must accompany any portion of Isomorphic Software source code that is
     *  copied or moved from this file.
     */
    package com.smartgwt.sample.showcase.client.dataintegration.java.hibernate.relations;
    
    import com.smartgwt.client.data.DataSource;
    import com.smartgwt.client.types.ListGridEditEvent;
    import com.smartgwt.client.widgets.Canvas;
    import com.smartgwt.client.widgets.form.DynamicForm;
    import com.smartgwt.client.widgets.form.fields.ComboBoxItem;
    import com.smartgwt.client.widgets.form.fields.SelectItem;
    import com.smartgwt.client.widgets.grid.ListGrid;
    import com.smartgwt.client.widgets.grid.ListGridField;
    import com.smartgwt.client.widgets.layout.VLayout;
    import com.smartgwt.sample.showcase.client.PanelFactory;
    import com.smartgwt.sample.showcase.client.ShowcasePanel;
    import com.smartgwt.sample.showcase.client.SourceEntity;
    
    public class HBIncludeFrom extends ShowcasePanel {
    
        private static final String DESCRIPTION = "You can include fields from related data sources. Just declare a field with \"includeFrom\" " +
                "property pointing to field in related data source. Target field can be included from another " +
                "data srouce. For example City DS includes field \"continentNam\" from Country DS which is " +
                "included from Continent DS." +
                "<p/>" +
                "You can specify a different field name or you can omit it. In this case field name will default " +
                "to the name of the included field.";
    
        public static class Factory implements PanelFactory {
    
            private String id;
    
            public Canvas create() {
                HBIncludeFrom panel = new HBIncludeFrom();
                id = panel.getID();
                return panel;
            }
    
            public String getID() {
                return id;
            }
    
            public String getDescription() {
                return DESCRIPTION;
            }
        }
    
        protected boolean isTopIntro() {
            return true;
        }
    
        public Canvas getViewPanel() {
        	
        	
            final ListGrid listGrid = new ListGrid();
            listGrid.setDataSource(DataSource.get("cityIncludeFromHB"));
            listGrid.setWidth(700);
            listGrid.setHeight(224);
            listGrid.setShowFilterEditor(true);
            listGrid.setAlternateRecordStyles(true);
            listGrid.setAutoFetchData(true);
            listGrid.setDataPageSize(50);
            listGrid.setCanEdit(true);
            listGrid.setEditEvent(ListGridEditEvent.CLICK);
            listGrid.setFields(new ListGridField("cityName", "City"),
                    new ListGridField("country", "Country") {{
                        setDisplayField("countryName");
                        setEditorType(new ComboBoxItem() {{
                            setValueField("countryId");
                            setOptionDataSource(DataSource.get("countryIncludeFromHB"));
                        }});
                    }},
                    new ListGridField("continent", "Continent"));
    
            //Here's the probem =================
            DataSource dataSource = new DataSource();
    		dataSource.setID("fakeId");
    		dataSource.setClientOnly(true);
           
    		
    		final SelectItem test = new SelectItem( "MyName", "My english title");
    		test.setRequired(true);
    		test.setOptionDataSource(dataSource);
    		
    		DynamicForm form = new DynamicForm();
            form.setItems(test);
    		//==================================
    		
            VLayout layout = new VLayout(15);
            layout.addMember(listGrid);
            layout.addMember(form);
            
    
            return layout;
        }
    
        public String getIntro() {
            return DESCRIPTION;
        }
    
        public SourceEntity[] getSourceUrls() {
        // Do not remove commented lines.
        // Forces GenerateSourceFiles to generate DataURLRecords for both data sources.
        // Generated DataURLRecords are used in 'View source' window for showing data source configuration.
    //        DataSource.get("cityIncludeFromHB");
    //        DataSource.get("countryIncludeFromHB");
    //        DataSource.get("continentIncludeFromHB");
            return new SourceEntity[]{
                    new SourceEntity("CityManyToOneSimple.java", JAVA, "source/beans/CityManyToOneSimple.java.html", true),
                    new SourceEntity("CountryManyToOneSimple.java", JAVA, "source/beans/CountryManyToOneSimple.java.html", true),
                    new SourceEntity("ContinentManyToOneSimple.java", JAVA, "source/beans/ContinentManyToOneSimple.java.html", true)
                };
        }
    }
    As you can see I added SelectItem with faked DataSource.
    If you click on this item you will see ALWAYS English string "No items to show". This happened in all languages.
    The string is coming from:
    SmartGwtMessages.properties file:
    Code:
    listGrid_emptyMessage=No items to show.
    I checked the same string in SmartGwtMessages_fr.properties
    Code:
    listGrid_emptyMessage=Aucune donn\u00e9e \u00e0 afficher.
    it exist there as well as in Portuguese - Brasil : SmartGwtMessages_pt_BR.properties
    Code:
    listGrid_emptyMessage=N\u00e3o existem itens para mostrar.
    As well I checked German and Dutch - the string exist in all languages translation, but somehow only English text is used for the SelectItem.
    See the attached image for the outlook.

    SmartClient Version: v9.0p_2014-04-23/PowerEdition Deployment (built 2014-04-23)
    Attached Files

    #2
    We're taking a look. We'll let you know what we find

    Regards
    Isomorphic Software

    Comment


      #3
      Oh - actually - before we get stuck into this, can you confirm whether this is a problem for you with the latest nightly build? It appears you're using an older version of SmartGWT.

      Thanks
      Isomorphic Software

      Comment


        #4
        This is support of our older versions. We use :
        SmartClient Version: v9.0p_2014-04-23/PowerEdition Deployment (built 2014-04-23).

        Comment


          #5
          I used
          Code:
           test.setHideEmptyPickList(true);
          to hide the empty select list in all languages, which seems to work for us now, as well we can add our own translation of the "No items to show" with
          Code:
           test.setHideEmptyPickList(false);
          test.setEmptyPickListMessage(translatedMessage)
          This will hide not translated value, provided by sgwt, but i still think the issue should be investigated and fixed on the sgwt side.

          Comment


            #6
            Glad to hear you have a workaround.
            We are also investigating to see if we can reproduce a problem on the framework side with the current codebase.

            Regards
            Isomorphic Software

            Comment


              #7
              Hi aafros,

              Originally posted by aafros View Post
              I used
              Code:
               test.setHideEmptyPickList(false);
              test.setEmptyPickListMessage(translatedMessage)
              This will hide not translated value, provided by sgwt, but i still think the issue should be investigated and fixed on the sgwt side.
              I don't know if you are doing this anyway, but with

              Code:
              SelectItem test = new SelectItem();
              test.setHideEmptyPickList(false);
              test.setEmptyPickListMessage(translatedMessage)
              [URL=http://www.smartclient.com/smartgwtee/javadoc/com/smartgwt/client/widgets/form/fields/SelectItem.html#setDefaultProperties%28com.smartgwt.client.widgets.form.fields.SelectItem%29]SelectItem.setDefaultProperties[/URL](test);
              before any draw you'll need your line one once in the whole application.

              Best regards,
              Blama

              Comment

              Working...
              X