Announcement

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

    Exception using ListGridField method setEditorValueMapFunction

    Hi

    I get an exception on the latest patch smartgwt pro by using ListGridField method setEditorValueMapFunction(EditorValueMapFunction editorValueMapFunction)

    SmartGWT Version: latest patch v8.3p_2013-01-31/Pro Deployment 2013-01-31
    exception throwing also by using:
    v8.3p_2013-01-30/Pro Deployment 2013-01-30
    v8.3p_2013-01-27/Pro Deployment 2013-01-27
    v8.3p_2013-01-22/Pro Deployment 2013-01-22
    (by using v8.3p_2013-01-08/Pro Deployment 2013-01-08 there is no exception)
    Browser: Mozilla Firefox 18.0.1

    code sample throwing an exception:

    Code:
     
    import java.util.HashMap;
    import java.util.Map;
    
    import com.smartgwt.client.data.RecordList;
    import com.smartgwt.client.widgets.Window;
    import com.smartgwt.client.widgets.form.fields.SelectItem;
    import com.smartgwt.client.widgets.grid.EditorValueMapFunction;
    import com.smartgwt.client.widgets.grid.ListGrid;
    import com.smartgwt.client.widgets.grid.ListGridField;
    import com.smartgwt.client.widgets.grid.ListGridRecord;
    import com.smartgwt.client.widgets.layout.HLayout;
    
    
    public class BugTestWindow extends Window {
        
        private ListGrid lgrid;
        
        private Map<String, String> map;
        
        public BugTestWindow() {
            setSize("420", "300");
            
            map = new HashMap<String, String>();
            map.put("de", "Germany");
            map.put("usa", "USA");
            map.put("es", "Spain");
            
            HLayout panel = new HLayout();
            lgrid = new ListGrid();
            ListGridField name = new ListGridField("name", "Name", 200);
            ListGridField nat = new ListGridField("nat", "Nationality", 200);
            nat.setCanEdit(true);
            SelectItem natSelItem = new SelectItem();
            natSelItem.setAddUnknownValues(false);  
            nat.setEditorValueMapFunction(new EditorValueMapFunction() { 
                @SuppressWarnings("rawtypes")
                public Map getEditorValueMap(Map values, ListGridField field, ListGrid grid) {  
                    return map;  
                }  
            });
            nat.setEditorType(natSelItem);
            nat.setValueMap(map);
            
            lgrid.setFields(name, nat);
            
            panel.addMember(lgrid);
            addItem(panel);
            
            RecordList records = new RecordList();
            lgrid.setData(records);
            
            ListGridRecord rec = new ListGridRecord();
            rec.setAttribute("name", "Max");
            rec.setAttribute("nat", "es");
            records.add(rec);
            
            show();
        }
    }
    By calling the constructor of BugTestWindow and double clicking on the only row in column "Nationality" to edit it, I get the following Exception:


    java.lang.IllegalArgumentException: convertToMap - unable to convert the passed JavaScript object to a Map. JavaScript is: {__ref: {GWT Java Obj},
    name: "Max",
    nat: "es",
    _selection_25: true}
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:532)
    at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamReader.instantiate(ServerSerializationStreamReader.java:1082)
    at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamReader.deserialize(ServerSerializationStreamReader.java:657)
    at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamReader.readObject(ServerSerializationStreamReader.java:567)
    at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamReader$ValueReader$8.readValue(ServerSerializationStreamReader.java:140)
    at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamReader.deserializeValue(ServerSerializationStreamReader.java:425)
    at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamReader.deserializeClass(ServerSerializationStreamReader.java:807)
    at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamReader.deserializeImpl(ServerSerializationStreamReader.java:878)
    at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamReader.deserialize(ServerSerializationStreamReader.java:662)
    at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamReader.readObject(ServerSerializationStreamReader.java:567)
    at com.google.gwt.user.server.rpc.core.java.util.Collection_ServerCustomFieldSerializerBase.deserialize(Collection_ServerCustomFieldSerializerBase.java:38)
    at com.google.gwt.user.server.rpc.core.java.util.Vector_ServerCustomFieldSerializer.deserialize(Vector_ServerCustomFieldSerializer.java:39)
    at com.google.gwt.user.server.rpc.core.java.util.Vector_ServerCustomFieldSerializer.deserializeInstance(Vector_ServerCustomFieldSerializer.java:53)
    at com.google.gwt.user.server.rpc.core.java.util.Vector_ServerCustomFieldSerializer.deserializeInstance(Vector_ServerCustomFieldSerializer.java:33)
    at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamReader.deserializeImpl(ServerSerializationStreamReader.java:859)
    at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamReader.deserialize(ServerSerializationStreamReader.java:662)
    at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamReader.readObject(ServerSerializationStreamReader.java:567)
    at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamReader$ValueReader$8.readValue(ServerSerializationStreamReader.java:140)
    at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamReader.deserializeValue(ServerSerializationStreamReader.java:425)
    at com.google.gwt.user.server.rpc.RPC.decodeRequest(RPC.java:312)
    at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:206)
    at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:248)
    at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1097)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1088)
    at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:360)
    at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
    at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
    at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:729)
    at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    at org.mortbay.jetty.handler.RequestLogHandler.handle(RequestLogHandler.java:49)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    at org.mortbay.jetty.Server.handle(Server.java:324)
    at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
    at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:843)
    at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:647)
    at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
    at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
    at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
    at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488)

    I would appreciate, if someone checks this.

    Ts. Vasilev

    #2
    Today's build already has this fixed.

    Comment


      #3
      I've checked this. It works.
      Thanks
      Ts. Vasilev

      Comment

      Working...
      X