Can somebody please look into this ?
Can somebody please look into this ?
Please help.
Can somebody please look into this ?
Please help.
DataSourceTextField nombre = new DataSourceTextField(menuEnum.NOMBRE.getValue(), menuEnum.NOMBRE.getDesc(), 300); DataSourceIntegerField NODEID = new DataSourceIntegerField (menuEnum.NODEID.getValue(), menuEnum.NODEID.getDesc()); NODEID.setPrimaryKey (true); NODEID.setRequired (true); DataSourceIntegerField PARENTNODE = new DataSourceIntegerField (menuEnum.PARENTNODE.getValue(),menuEnum.PARENTNODE.getDesc()); PARENTNODE.setForeignKey(id+"."+menuEnum.NODEID.getValue()); PARENTNODE.setRequired (true); PARENTNODE.setRootValue(0); DataSourceTextField NOMBRE_VISTA = new DataSourceTextField(menuEnum.NOMBRE_VISTA.getValue(), menuEnum.NOMBRE_VISTA.getDesc(), 300); setFields(nombre,NODEID,PARENTNODE,NOMBRE_VISTA);
@Override protected void transformResponse(DSResponse response, DSRequest request, Object data) { switch(request.getOperationType()) { case UPDATE: request.setData(request.getOldValues()); break; } super.transformResponse(response, request, data); }
public class TestDataSource extends GwtRpcDataSource { public TestDataSource () { DataSourceField field; field = new DataSourceIntegerField ("id", "ID"); field.setPrimaryKey (true); field.setRequired (false); addField (field); field = new DataSourceTextField ("name", "NAME"); field.setRequired (true); addField (field); field = new DataSourceDateField ("date", "DATE"); field.setRequired (false); addField (field); } @Override protected void executeFetch (final String requestId, final DSRequest request, final DSResponse response) { TestServiceAsync service = GWT.create (TestService.class); service.fetch (new AsyncCallback<List<TestRecord>> () { public void onFailure (Throwable caught) { response.setStatus (RPCResponse.STATUS_FAILURE); processResponse (requestId, response); } public void onSuccess (List<TestRecord> result) { ListGridRecord[] list = new ListGridRecord[result.size ()]; for (int i = 0; i < list.length; i++) { ListGridRecord record = new ListGridRecord (); copyValues (result.get (i), record); list[i] = record; } response.setData (list); processResponse (requestId, response); } }); } @Override protected void executeAdd (final String requestId, final DSRequest request, final DSResponse response) { JavaScriptObject data = request.getData (); ListGridRecord rec = new ListGridRecord (data); TestRecord testRec = new TestRecord (); copyValues (rec, testRec); TestServiceAsync service = GWT.create (TestService.class); service.add (testRec, new AsyncCallback<TestRecord> () { public void onFailure (Throwable caught) { response.setStatus (RPCResponse.STATUS_FAILURE); processResponse (requestId, response); } public void onSuccess (TestRecord result) { ListGridRecord[] list = new ListGridRecord[1]; ListGridRecord newRec = new ListGridRecord (); copyValues (result, newRec); list[0] = newRec; response.setData (list); processResponse (requestId, response); } }); } @Override protected void executeUpdate (final String requestId, final DSRequest request, final DSResponse response) { JavaScriptObject data = request.getData (); ListGridRecord rec = new ListGridRecord (data); ListGrid grid = (ListGrid) Canvas.getById (request.getComponentId ()); int index = grid.getRecordIndex (rec); rec = (ListGridRecord) grid.getEditedRecord (index); TestRecord testRec = new TestRecord (); copyValues (rec, testRec); TestServiceAsync service = GWT.create (TestService.class); service.update (testRec, new AsyncCallback<TestRecord> () { public void onFailure (Throwable caught) { response.setStatus (RPCResponse.STATUS_FAILURE); processResponse (requestId, response); } public void onSuccess (TestRecord result) { ListGridRecord[] list = new ListGridRecord[1]; ListGridRecord updRec = new ListGridRecord (); copyValues (result, updRec); list[0] = updRec; response.setData (list); processResponse (requestId, response); } }); } @Override protected void executeRemove (final String requestId, final DSRequest request, final DSResponse response) { JavaScriptObject data = request.getData (); final ListGridRecord rec = new ListGridRecord (data); TestRecord testRec = new TestRecord (); copyValues (rec, testRec); TestServiceAsync service = GWT.create (TestService.class); service.remove (testRec, new AsyncCallback () { public void onFailure (Throwable caught) { response.setStatus (RPCResponse.STATUS_FAILURE); processResponse (requestId, response); } public void onSuccess (Object result) { ListGridRecord[] list = new ListGridRecord[1]; list[0] = rec; response.setData (list); processResponse (requestId, response); } }); } private static void copyValues (ListGridRecord from, TestRecord to) { to.setId (from.getAttributeAsInt ("id")); to.setName (from.getAttributeAsString ("name")); to.setDate (from.getAttributeAsDate ("date")); } private static void copyValues (TestRecord from, ListGridRecord to) { to.setAttribute ("id", from.getId ()); to.setAttribute ("name", from.getName ()); to.setAttribute ("date", from.getDate ()); } }
public class ProbandoDataSource implements EntryPoint { public void onModuleLoad() { final DataSource dataSource = new TestDataSource(); final ListGrid listGrid = new ListGrid() { @Override protected Canvas getExpansionComponent(final ListGridRecord record) { final ListGrid grid = this; VLayout layout = new VLayout(2); final DynamicForm df = new DynamicForm(); df.setNumCols(2); df.setDataSource(dataSource); df.addDrawHandler(new DrawHandler() { public void onDraw(DrawEvent event) { df.editRecord(record); } }); IButton saveButton = new IButton("Save"); saveButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { df.saveData(); //I m using this to update the record on the grid ( the view) record.setAttribute("id", (Integer) df.getValue("id")); record.setAttribute("name", (String) df.getValue("name")); record.setAttribute("date", (Date) df.getValue("date")); //dataSource.updateData(record); fails // grid.updateData(record); fails } }); IButton cancelButton = new IButton("Done"); cancelButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { grid.collapseRecord(record); } }); HLayout hLayout = new HLayout(10); hLayout.addMember(saveButton); hLayout.addMember(cancelButton); layout.addMember(df); layout.addMember(hLayout); return layout; } }; listGrid.setCanExpandRecords(true); listGrid.setAutoFetchData(true); listGrid.setDataSource(dataSource); ListGridField itemNameField = new ListGridField("name"); ListGridField skuField = new ListGridField("id"); listGrid.setFields(itemNameField, skuField); listGrid.draw(); } }
dataSource.updateData(record); grid.updateData(record);
IButton buttonDel = new IButton("delete invoices"); buttonDel.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { ListGridRecord[] recordsToDelete = openInvoicesGrid .getSelection(); for (ListGridRecord record : recordsToDelete) { datasource.removeData(record); } } }); canvas.addChild(buttonDel);
XXXService.Util.getInstance().doit(arg, callback)
[ERROR] com.google.gwt.user.client.rpc.SerializationException [ERROR] at com.google.gwt.user.client.rpc.impl.SerializerBase.check(SerializerBase.java:161) [ERROR] at com.google.gwt.user.client.rpc.impl.SerializerBase.serialize(SerializerBase.java:145) [ERROR] at com.google.gwt.user.client.rpc.impl.ClientSerializationStreamWriter.serialize(ClientSerializationStreamWriter.java:199) [ERROR] at com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamWriter.writeObject(AbstractSerializationStreamWriter.java:129) [ERROR] at nl.kees.test.db.client.util.criteria.GWTCriterion_FieldSerializer.serialize(GWTCriterion_FieldSerializer.java:32) [ERROR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [ERROR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [ERROR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [ERROR] at java.lang.reflect.Method.invoke(Method.java:592) [ERROR] at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103) [ERROR] at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71) [ERROR] at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:157) [ERROR] at com.google.gwt.dev.shell.BrowserChannel.reactToMessagesWhileWaitingForReturn(BrowserChannel.java:1713) [ERROR] at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:165) [ERROR] at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:120) [ERROR] at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:507) [ERROR] at com.google.gwt.dev.shell.ModuleSpace.invokeNativeVoid(ModuleSpace.java:284) [ERROR] at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid(JavaScriptHost.java:107) [ERROR] at com.google.gwt.user.client.rpc.impl.SerializerBase$MethodMap$.serialize$(SerializerBase.java) [ERROR] at com.google.gwt.user.client.rpc.impl.SerializerBase.serialize(SerializerBase.java:147) [ERROR] at com.google.gwt.user.client.rpc.impl.ClientSerializationStreamWriter.serialize(ClientSerializationStreamWriter.java:199) [ERROR] at com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamWriter.writeObject(AbstractSerializationStreamWriter.java:129) [ERROR] at nl.kees.test.db.client.admin.AdminDataService_Proxy.fetch(AdminDataService_Proxy.java:52) [ERROR] at nl.kees.test.db.client.util.DynamicDataSource.executeFetch(DynamicDataSource.java:90) [ERROR] at nl.kees.test.db.client.util.GwtRpcDataSource.transformRequest(GwtRpcDataSource.java:105) [ERROR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [ERROR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [ERROR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [ERROR] at java.lang.reflect.Method.invoke(Method.java:592) [ERROR] at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103) [ERROR] at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71) [ERROR] at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:157) [ERROR] at com.google.gwt.dev.shell.BrowserChannel.reactToMessages(BrowserChannel.java:1668) [ERROR] at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:401) [ERROR] at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:222) [ERROR] at java.lang.Thread.run(Thread.java:595)
Comment