Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Ext User
    Join Date
    Sep 2010
    Posts
    1
    Vote Rating
    0
    zalant is on a distinguished road

      0  

    Default [FNR] BeanModelGenerator wrap list in a list on set() for non BeanModel items

    [FNR] BeanModelGenerator wrap list in a list on set() for non BeanModel items


    GXT v2.2.0

    When set a list in BeanModel and items of this list are not instances of BeanModel then the list is wrapped in a new list.

    Code:
    public class TestBean implements BeanModelTag {
    
        private List<String> list;
    
        public List<String> getList() {
            return list;
        }
    
        public void setList(List<String> list) {
            this.list = list;
        }
    }
    
    public class Test implements EntryPoint {
    
        @Override
        public void onModuleLoad() {
            TestBean bean = new TestBean();
            BeanModel beanModel = BeanModelLookup.get().getFactory(TestBean.class).createModel(bean);
            List<String> originalList = new ArrayList<String>();
            originalList.add("Hello");
            originalList.add("World");
            
            beanModel.set("list", originalList);
            List<?> resultList = beanModel.get("list");
            
            GWT.log("originalList: " + originalList.toString());
            GWT.log("resultList: " + resultList.toString());
        }
    }
    Output:
    originalList: [Hello, World]
    resultList: [[Hello, World], [Hello, World]]

    The problem is in BeanModelGenerator.createSetMethods line 296:
    Code:
    protected void createSetMethods(List<JMethod> properties, SourceWriter sw, String typeName) {
        . . .
        sw.println("} else if (obj instanceof java.util.List) {");
          sw.println("java.util.List list = new java.util.ArrayList();");
          sw.println("for(Object o : (java.util.List) obj) {");
            sw.println("if(o instanceof BeanModel) {");
              sw.println("list.add(((BeanModel) o).getBean());");
            sw.println("} else {");
            sw.println("list.add(obj);");       // NOTE: Here should be "list.add(o);"
            sw.println("}");
          sw.println("}");
          sw.println("obj = list;");
        sw.println("}");
        . . .

  2. #2
    Software Architect
    Join Date
    Sep 2007
    Posts
    13,971
    Vote Rating
    132
    sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light

      0  

    Default


    Thanks for the report. there was already a patch pending. Fixed in SVN as of revision 2232

Similar Threads

  1. Combobox inner list not aligning list items propertly ?
    By ritesh.kapse in forum Ext 2.x: Help & Discussion
    Replies: 13
    Last Post: 29 Oct 2010, 5:29 AM
  2. Replies: 1
    Last Post: 30 Aug 2010, 7:22 AM
  3. [FNR] Grid stripes break row class name list
    By pointserve in forum Ext GWT: Bugs (2.x)
    Replies: 1
    Last Post: 3 Mar 2010, 4:41 AM
  4. Replies: 1
    Last Post: 19 Nov 2009, 5:54 AM
  5. [FNR] DND List-to-List INSERT 1.2.4 demo throwing JS errors
    By Baby Dingo in forum Ext GWT: Bugs (1.x)
    Replies: 2
    Last Post: 12 May 2009, 3:05 PM

Thread Participants: 1

Tags for this Thread

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi