1. #1
    Ext User
    Join Date
    Jul 2008
    Posts
    6
    Vote Rating
    0
    AlexPdro is on a distinguished road

      0  

    Default [FIXED] [gxt 1.1] BaseModel map equals() doesn't work anymore

    [FIXED] [gxt 1.1] BaseModel map equals() doesn't work anymore


    - BaseModel map equals() method doesn't work anymore
    - GXT 1.1 alpha1 & 2
    - Host mode & web mode
    - Windows XP

    Sample code :
    Code:
    import com.extjs.gxt.ui.client.data.BaseModel;
    
    
    public class TestBug extends BaseModel {
    
        
        public TestBug(String name, Double dbl) {
            this.set("name", name);
            this.set("value", dbl);
        }
        
        /**
         * @param args
         */
        public static void main(String[] args) {
            TestBug m1 = new TestBug("alfredo shsfhsf",new Double(23));
            TestBug m2 = new TestBug("alfredo shsfhsf",new Double(23));
            System.out.println(m1.equals(m2));
        }
        
        @Override
        public boolean equals(Object object) {
            if (object==null) return false;
            
            if (!(object instanceof TestBug)) return false;
            
            TestBug ref = (TestBug) object;
            
            return this.map.equals(ref.map);
            
        }
    
    }
    With gxt 1.0 this code display : true but with 1.1 it displays false.

    (I think but I'm not sure that a side effect of that is that some methods of the API doesn't work anymore, I have had some troubles selecting Model from Data widget and removing them. But I'm not yet sure it was because of this because I have noticed that with grids so I can't compare with gxt 1.0. )

  2. #2
    Sencha - GXT Dev Team darrellmeyer's Avatar
    Join Date
    May 2007
    Location
    Washington, DC
    Posts
    2,242
    Vote Rating
    2
    darrellmeyer is on a distinguished road

      0  

    Default


    I am not sure how this worked before as equals was never overridden. Nonetheless, I have changed BaseModelData to override equals and hashCode and delegate the calls to the internal map. So your code will work as expected. I have also changed the BeanModel generator to override the same methods and delegate to the wrapped bean. Changes are in SVN.

  3. #3
    Ext User
    Join Date
    Jul 2008
    Posts
    6
    Vote Rating
    0
    AlexPdro is on a distinguished road

      0  

    Default


    Great!

    Thanks Darell

Thread Participants: 1