How to avoid freezing with CellTable?
Hi everybody, I'm creating a website with GWT. I want to add CellTable into my project. The problem is that I have a lot of data to put into the tables. So, my website freeze and show my table after 2-3 minutes. I find on internet that multi-threads are impossible with GWT. So, what is the solution? Even if the user have to wait 2-3 minutes, I want to avoid the fact that it's freezing. Any Ideas? Thank you. My code, maybe I can optimize it simply? public void refreshTable(final ArrayListString arrListFilters, final ArrayListString arrListAll, String url) { // Get the CQ result RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, url); try { Request response = builder.sendRequest(null, new RequestCallback() { public void onError(Request request, Throwable exception) { } public void onResponseReceived(Request request, Response response) { final json json = JsonUtils.unsafeEval(response.getText()); int i = 0; int j = 0; int tot; // If there are too many results if (json.getResultslength() 1) { tot = 1; } else { tot = json.getResultslength(); } // Fill the list of rows while (j tot) { i = 1; ListString rowTemp = new ArrayListString(); rowTemp.add(json.getDate(j)); // Get the data to get a price result for a specific // customer query arrListLnNb.add(json.getLineNb(j)); arrListId.add(json.getId(j)); arrListCqid.add(json.getCqid(j)); while (i arrListFilters.size()) { rowTemp.add(json.getResults(j, arrListAll.indexOf(arrListFilters.get(i; i = i + 1; } rowTemp.add(); rows.add(rowTemp); j = j + 1; } // Provide rows to the table table.setRowCount(rows.size(), true); table.setRowData(0, rows); final ListDataProviderListString provider = new ListDataProviderListString(rows); provider.addDataDisplay(table); // Handler to sort the columns ListListString list1 = provider.getList(); ListHandlerListString columnSortHandler = new ListHandlerListString(list1); i = 0; while (i table.getColumnCount()) { final int columnIndex = i; columnSortHandler.setComparator(table.getColumn(i), new ComparatorListString() { public int compare(ListString o1, ListString o2) { if (o1 == o2) { return 0; } // Compare the name columns. if (o1 != null) { return (o2 != null) ? o1.get(columnIndex).compareTo(o2.get(columnIndex)) : 1; } return -1; } }); i = i + 1; } table.addColumnSortHandler(columnSortHandler); i = 0; while (i table.getColumnCount()) { table.getColumnSortList().push(table.getColumn(i)); i = i + 1; } } }); } catch (RequestException e) { } } -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscr...@googlegroups.com. To post to this group, send email to google-web-toolkit@googlegroups.com. Visit this group at http://groups.google.com/group/google-web-toolkit. For more options, visit https://groups.google.com/groups/opt_out.
Re: Get Data CellTable
Nobody? Le mercredi 29 mai 2013 14:46:48 UTC-4, sebastie...@isen-lille.fr a écrit : Hi everyone, I have a simple CellTable with editable cells. I add a button save outside of the table. So, I want to be able to save the change of the final user. I want to do something like that: If the button is cliked: int i=0; int j=0; while(itable.getRowCount()){ while(jtable.getColumnCount(){ *myList = table.getCellText(i,j) ??? ( I don't know how to do that )** * j=j+1; } i=i+1; j=0; } I don't know how to get a cell individually... Can you help me? Thanks. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscr...@googlegroups.com. To post to this group, send email to google-web-toolkit@googlegroups.com. Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Get Data CellTable
Now I understand why you talk about refresh() or updateRowData(...). The first method doesn't do anything for me and my provider dosen't know the second method updateRowData. I don't find a solution on google. This is a part of my code: public ArrayListListString rows = new ArrayListListString(); ListDataProviderListString provider; //... *public widget * // fill the rows //add the IndexedColumn table.setRowCount(rows.size(), true); table.setRowData(0, rows); provider = new ListDataProviderListString(rows); provider.addDataDisplay(table); //... // Save handler if (item.getText() == Save) { int i=0; provider.refresh(); while(itable.getRowCount()){ System.out.println(provider.getList().get(i)); // I can't see the changes of the final user here! i=i+1; } } *IndexedColumn:* // Method to add column dynamically to the table class IndexedColumn extends ColumnListString, String { private final int index; public IndexedColumn(int index) { super(new EditTextCell()); this.index = index; } @Override public String getValue(ListString object) { return object.get(this.index); } } Can somebody help me please? Thanks :) Le vendredi 31 mai 2013 18:15:13 UTC-4, sebastie...@isen-lille.fr a écrit : Thanks for your answer! In fact, I don't want to refresh my table. I just want to get all the data which are in my table. My table is editable by the final user. Le vendredi 31 mai 2013 17:59:38 UTC-4, David a écrit : The cells are reused so there's no way to get a specific rendered cell from the CellTable. Update the object in your data provider and call refresh() or updateRowData(...). On Friday, May 31, 2013 3:44:08 PM UTC-5, sebastie...@isen-lille.frwrote: Maybe there is an other way to do that? I don't find a solution... Le jeudi 30 mai 2013 14:14:33 UTC-4, sebastie...@isen-lille.fr a écrit : I don't find a method to simply get the text in a cell. It's very weird! Le mercredi 29 mai 2013 14:46:48 UTC-4, sebastie...@isen-lille.fr a écrit : Hi everyone, I have a simple CellTable with editable cells. I add a button save outside of the table. So, I want to be able to save the change of the final user. I want to do something like that: If the button is cliked: int i=0; int j=0; while(itable.getRowCount()){ while(jtable.getColumnCount(){ *myList = table.getCellText(i,j) ??? ( I don't know how to do that )** * j=j+1; } i=i+1; j=0; } I don't know how to get a cell individually... Can you help me? Thanks. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscr...@googlegroups.com. To post to this group, send email to google-web-toolkit@googlegroups.com. Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Get Data CellTable
Maybe there is an other way to do that? I don't find a solution... Le jeudi 30 mai 2013 14:14:33 UTC-4, sebastie...@isen-lille.fr a écrit : I don't find a method to simply get the text in a cell. It's very weird! Le mercredi 29 mai 2013 14:46:48 UTC-4, sebastie...@isen-lille.fr a écrit : Hi everyone, I have a simple CellTable with editable cells. I add a button save outside of the table. So, I want to be able to save the change of the final user. I want to do something like that: If the button is cliked: int i=0; int j=0; while(itable.getRowCount()){ while(jtable.getColumnCount(){ *myList = table.getCellText(i,j) ??? ( I don't know how to do that )** * j=j+1; } i=i+1; j=0; } I don't know how to get a cell individually... Can you help me? Thanks. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscr...@googlegroups.com. To post to this group, send email to google-web-toolkit@googlegroups.com. Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Get Data CellTable
Thanks for your answer! In fact, I don't want to refresh my table. I just want to get all the data which are in my table. My table is editable by the final user. Le vendredi 31 mai 2013 17:59:38 UTC-4, David a écrit : The cells are reused so there's no way to get a specific rendered cell from the CellTable. Update the object in your data provider and call refresh() or updateRowData(...). On Friday, May 31, 2013 3:44:08 PM UTC-5, sebastie...@isen-lille.fr wrote: Maybe there is an other way to do that? I don't find a solution... Le jeudi 30 mai 2013 14:14:33 UTC-4, sebastie...@isen-lille.fr a écrit : I don't find a method to simply get the text in a cell. It's very weird! Le mercredi 29 mai 2013 14:46:48 UTC-4, sebastie...@isen-lille.fr a écrit : Hi everyone, I have a simple CellTable with editable cells. I add a button save outside of the table. So, I want to be able to save the change of the final user. I want to do something like that: If the button is cliked: int i=0; int j=0; while(itable.getRowCount()){ while(jtable.getColumnCount(){ *myList = table.getCellText(i,j) ??? ( I don't know how to do that )** * j=j+1; } i=i+1; j=0; } I don't know how to get a cell individually... Can you help me? Thanks. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscr...@googlegroups.com. To post to this group, send email to google-web-toolkit@googlegroups.com. Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Get Data CellTable
I don't find a method to simply get the text in a cell. It's very weird! Le mercredi 29 mai 2013 14:46:48 UTC-4, sebastie...@isen-lille.fr a écrit : Hi everyone, I have a simple CellTable with editable cells. I add a button save outside of the table. So, I want to be able to save the change of the final user. I want to do something like that: If the button is cliked: int i=0; int j=0; while(itable.getRowCount()){ while(jtable.getColumnCount(){ *myList = table.getCellText(i,j) ??? ( I don't know how to do that )** * j=j+1; } i=i+1; j=0; } I don't know how to get a cell individually... Can you help me? Thanks. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscr...@googlegroups.com. To post to this group, send email to google-web-toolkit@googlegroups.com. Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Get Data CellTable
Hi everyone, I have a simple CellTable with editable cells. I add a button save outside of the table. So, I want to be able to save the change of the final user. I want to do something like that: If the button is cliked: int i=0; int j=0; while(itable.getRowCount()){ while(jtable.getColumnCount(){ *myList = table.getCellText(i,j) ??? ( I don't know how to do that )** * j=j+1; } i=i+1; j=0; } I don't know how to get a cell individually... Can you help me? Thanks. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscr...@googlegroups.com. To post to this group, send email to google-web-toolkit@googlegroups.com. Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Theme GWT, how does it works?
Thank you for your answer. I choose a theme and I have the same result. When I look the network requests, all seems OK. My WebContent folder contain: - folder myproject (with the theme GWT/clean ) - folder META-INF - folder WEB-INF -flavicon.ico -Myproject.css -Myproject.html Le jeudi 25 avril 2013 14:49:39 UTC-4, sebastie...@isen-lille.fr a écrit : Hi, My web application has serveral widgets like datePicker, dynamicDecorator... If I run my project with eclipse, widgets are ok. I want to build my project on lighthttpd, so I just copy my folder on my server. When I open website with a web broswer, it works but all my widgets have no style. ( for example, there are only the numbers for the datePicker: no color, no background...). I guess that the theme doesn't work without eclipse but in my gwt.xml I have: inherits name='com.google.gwt.user.theme.clean.Clean'/ inherits name='com.google.gwt.user.theme.standard.Standard'/ Do I really need to fill my CSS file to do the same thing with or without eclipse? Can I use the GWT theme without eclipse? I don't really understand the connections between the themes and the CSS.. Thank you in advance! -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscr...@googlegroups.com. To post to this group, send email to google-web-toolkit@googlegroups.com. Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Theme GWT, how does it works?
I'm using lighthttpd, is it possible that it's the problem? Le jeudi 25 avril 2013 14:49:39 UTC-4, sebastie...@isen-lille.fr a écrit : Hi, My web application has serveral widgets like datePicker, dynamicDecorator... If I run my project with eclipse, widgets are ok. I want to build my project on lighthttpd, so I just copy my folder on my server. When I open website with a web broswer, it works but all my widgets have no style. ( for example, there are only the numbers for the datePicker: no color, no background...). I guess that the theme doesn't work without eclipse but in my gwt.xml I have: inherits name='com.google.gwt.user.theme.clean.Clean'/ inherits name='com.google.gwt.user.theme.standard.Standard'/ Do I really need to fill my CSS file to do the same thing with or without eclipse? Can I use the GWT theme without eclipse? I don't really understand the connections between the themes and the CSS.. Thank you in advance! -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscr...@googlegroups.com. To post to this group, send email to google-web-toolkit@googlegroups.com. Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Theme GWT, how does it works?
If I delete: inherits name='com.google.gwt.user.theme.clean.Clean'/ inherits name='com.google.gwt.user.theme.standard.Standard'/ and if I run the project with eclipse, my project just use the CSS. And if I copy the same project on the server, the CSS doesn't do anything. In fact, if I put the 2 line (for the theme) in the gwt.xml or if I don't do that, and if I delete the CSS on my server, I have the same result. The theme and the CSS don't do anything. Why? I just copy my file on the server, and I open the .html in a web browser, I have to do something else to make it works with theme and CSS? Le jeudi 25 avril 2013 14:49:39 UTC-4, sebastie...@isen-lille.fr a écrit : Hi, My web application has serveral widgets like datePicker, dynamicDecorator... If I run my project with eclipse, widgets are ok. I want to build my project on lighthttpd, so I just copy my folder on my server. When I open website with a web broswer, it works but all my widgets have no style. ( for example, there are only the numbers for the datePicker: no color, no background...). I guess that the theme doesn't work without eclipse but in my gwt.xml I have: inherits name='com.google.gwt.user.theme.clean.Clean'/ inherits name='com.google.gwt.user.theme.standard.Standard'/ Do I really need to fill my CSS file to do the same thing with or without eclipse? Can I use the GWT theme without eclipse? I don't really understand the connections between the themes and the CSS.. Thank you in advance! -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscr...@googlegroups.com. To post to this group, send email to google-web-toolkit@googlegroups.com. Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: columnSortHandler on a Dynamic CellTable
Thank you very much! Le mercredi 24 avril 2013 15:54:06 UTC-4, sebastie...@isen-lille.fr a écrit : Hi everybody, I create a dynamic CellTable this way: for (int column = 0; column arrListFilters.size(); column++) { IndexedColumn IColumn= new IndexedColumn(column); IColumn.setSortable(true); table.addColumn(IColumn, arrListFilters.get(column)); } final ListDataProviderListString provider = new ListDataProviderListString(rows); provider.addDataDisplay(table); for (String row: rowsArray) { rows.add(Arrays.asList(row));} It works well, but I want to add comparator to my table. So I do that, but it doesn't work: ListHandlerListString(rows); i=0; while(itable.getColumnCount()){ columnSortHandler.setComparator(table.getColumn(i), new ComparatorListString() { public int compare(ListString o1,ListString o2) { if (o1 == o2) { return 0; } * if (o1 != null) { return (o2 != null) ? o1.get(0).compareTo(o2.get(0)) : 1; } * } }); i=i+1; } table.addColumnSortHandler(columnSortHandler); i=0; while(itable.getColumnCount()){ table.getColumnSortList().push(table.getColumn(i)); i=i+1; } I know that the problem is here, but I don't know how to what I want. *if (o1 != null) {* * return (o2 != null) ? o1.get(0).compareTo(o2.get(0)) : 1; * * } * Any ideas? Thanks a lot! -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscr...@googlegroups.com. To post to this group, send email to google-web-toolkit@googlegroups.com. Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Theme GWT, how does it works?
Hi, My web application has serveral widgets like datePicker, dynamicDecorator... If I run my project with eclipse, widgets are ok. I want to build my project on lighthttpd, so I just copy my folder on my server. When I open website with a web broswer, it works but all my widgets have no style. ( for example, there are only the numbers for the datePicker: no color, no background...). I guess that the theme doesn't work without eclipse but in my gwt.xml I have: inherits name='com.google.gwt.user.theme.clean.Clean'/ inherits name='com.google.gwt.user.theme.standard.Standard'/ Do I really need to fill my CSS file to do the same thing with or without eclipse? Can I use the GWT theme without eclipse? I don't really understand the connections between the themes and the CSS.. Thank you in advance! -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscr...@googlegroups.com. To post to this group, send email to google-web-toolkit@googlegroups.com. Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
columnSortHandler on a Dynamic CellTable
Hi everybody, I create a dynamic CellTable this way: for (int column = 0; column arrListFilters.size(); column++) { IndexedColumn IColumn= new IndexedColumn(column); IColumn.setSortable(true); table.addColumn(IColumn, arrListFilters.get(column)); } final ListDataProviderListString provider = new ListDataProviderListString(rows); provider.addDataDisplay(table); for (String row: rowsArray) { rows.add(Arrays.asList(row));} It works well, but I want to add comparator to my table. So I do that, but it doesn't work: ListHandlerListString(rows); i=0; while(itable.getColumnCount()){ columnSortHandler.setComparator(table.getColumn(i), new ComparatorListString() { public int compare(ListString o1,ListString o2) { if (o1 == o2) { return 0; } * if (o1 != null) { return (o2 != null) ? o1.get(0).compareTo(o2.get(0)) : 1; } * } }); i=i+1; } table.addColumnSortHandler(columnSortHandler); i=0; while(itable.getColumnCount()){ table.getColumnSortList().push(table.getColumn(i)); i=i+1; } I know that the problem is here, but I don't know how to what I want. *if (o1 != null) {* * return (o2 != null) ? o1.get(0).compareTo(o2.get(0)) : 1; * * } * Any ideas? Thanks a lot! -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscr...@googlegroups.com. To post to this group, send email to google-web-toolkit@googlegroups.com. Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: columnSortHandler on a Dynamic CellTable
Thanks for your answer. I didn't know what to do, so I test with the 0th entry. I know that it is not the solution. In your answer, columnIndex is my i I guess? I can't get it, it must be final. I try to do that, but it doesn't work too: i=0; while(itable.getColumnCount()){ *final ColumnListString, ? column= table.getColumn(i); *columnSortHandler.setComparator(*column*,new ComparatorListString() { public int compare(ListString o1,ListString o2) { if (o1 == o2) { return 0; } if (o1 != null) { *return (o2 != null) ? o1.get(table.getColumnIndex(column))**.compareTo(o2.get(table.getColumnIndex(column))) : 1; *} return -1; } }); i=i+1; } Le mercredi 24 avril 2013 16:24:36 UTC-4, Jens a écrit : Why do you always compare the 0th entry? Shouldn't it match the column the comparator is responsible for, e.g. o1.get(columnIndex).compareTo(o2.get(columnIndex))? -- J. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscr...@googlegroups.com. To post to this group, send email to google-web-toolkit@googlegroups.com. Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: columnSortHandler on a Dynamic CellTable
In https://groups.google.com/forum/?start=hl=en#!topic/google-web-toolkit/7CFHEhWUjQA[1-25-false] I don't know what is verbColumn in my exemple. In http://stackoverflow.com/questions/16146094/gwt-columnsorthandler-setcomparator-for-all-columns-in-a-loop-make-the-sorting I try to do the same thing, but I don't know how can this example can works because k is not final! My try: ListHandlerListString columnSortHandler = new ListHandlerListString(rows); for (int column = 0; column arrListFilters.size(); column++) { IndexedColumn IColumn= new IndexedColumn(column); IColumn.setSortable(true); table.addColumn(IColumn, arrListFilters.get(column)); columnSortHandler.setComparator(IColumn, new ComparatorListString() { public int compare(ListString o1, ListString o2) { if (o1 == o2) { return 0; } // Compare the column. if (o1 != null) { return (o2 != null) ? o1.get(*column*).compareTo(o2.get(* column*)) : 1; } return -1; } I have an error, column is not final...Cannot refer to a non-final variable column inside an inner class defined in a different method Le mercredi 24 avril 2013 17:10:03 UTC-4, Andrea Boscolo a écrit : Also, it looks like https://groups.google.com/forum/?start=hl=en#!topic/google-web-toolkit/7CFHEhWUjQA[1-25-false] and http://stackoverflow.com/questions/16146094/gwt-columnsorthandler-setcomparator-for-all-columns-in-a-loop-make-the-sorting Le mercredi 24 avril 2013 17:24:08 UTC-4, sebastie...@isen-lille.fr a écrit : Thanks for your answer. I didn't know what to do, so I test with the 0th entry. I know that it is not the solution. In your answer, columnIndex is my i I guess? I can't get it, it must be final. I try to do that, but it doesn't work too: i=0; while(itable.getColumnCount()){ *final ColumnListString, ? column= table.getColumn(i); *columnSortHandler.setComparator(*column*,new ComparatorListString() { public int compare(ListString o1,ListString o2) { if (o1 == o2) { return 0; } if (o1 != null) { *return (o2 != null) ? o1.get(table.getColumnIndex(column))**.compareTo(o2.get(table.getColumnIndex(column))) : 1; *} return -1; } }); i=i+1; } Le mercredi 24 avril 2013 16:24:36 UTC-4, Jens a écrit : Why do you always compare the 0th entry? Shouldn't it match the column the comparator is responsible for, e.g. o1.get(columnIndex).compareTo(o2.get(columnIndex))? -- J. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscr...@googlegroups.com. To post to this group, send email to google-web-toolkit@googlegroups.com. Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Complex JSON and overlay types
Thank you for your answers. - Thomas: Yes, it works. But the problem is that I don't know John. It can be anything else. For example the JSON can be: *{records: [{names: {Cedric: [50, H, US], Jean: [50, H, US]}, style: TR}]} *or {records: *[{names: {Blabla: [50, H, US]}, style: TR}]}. *To get the lists, I have to get the names first. And I don't know how to do. - Stefan: I try to do that but I get *null *even for *bean.as().getStyle().* I don't understand how this method can get the properties.. *interface Message { ListPerson getRecords(); }* *interface Person { MapString, ListString getNames(); String getStyle(); }* * // Declare the factory type interface MyFactory extends AutoBeanFactory { AutoBeanMessage message(); AutoBeanPerson person(); }* *public class HelloWorld implements IsWidget,EntryPoint { public Widget asWidget() { String url=data.json; RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, url); try { Request response = builder.sendRequest(null, new RequestCallback() { public void onError(Request request, Throwable exception) { // Code omitted for clarity }* * public void onResponseReceived(Request request, Response response) { MyFactory factory = GWT.create(MyFactory.class); AutoBeanPerson bean = AutoBeanCodex.decode(factory, Person.class, response.getText()); System.out.println(oui + bean.as().getNames()); * * }* * }); } catch (RequestException e) { } return null; }* *@Override public void onModuleLoad() { asWidget(); } } * Le mardi 2 avril 2013 04:00:02 UTC-4, Thomas Broyer a écrit : On Monday, April 1, 2013 5:51:26 PM UTC+2, sebastie...@isen-lille.frwrote: Thank you for your answer. If I do that: *public final native JsArrayjson getTest() /*-{ return this.records[0].names.John; }-*/;* * *I get *50,H,US, *so it's OK for that. But I'm not supposed to know John or Jack, so how can I get them? Does *this.records[0].names[John]* works? If so, there shouldn't be any problem replacing the John with a method argument. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscr...@googlegroups.com. To post to this group, send email to google-web-toolkit@googlegroups.com. Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Decoding complex JSON
Hi everybody, I want to read this kind of JSON with GWT: {records: [{names: {John: [50, H, US], Jack: [50, H, US]}, style: TR}]} I use overlay for that. If I use that, I get TR: public final native String getStyle() /*-{ return this.records[0].style; }-*/; So, it's work. Now I want to get John and the list 50,H,US. If I use that I get null: public final native String getNames(String i) /*-{ return this.records[0].names[i]; }-*/; For the same thing, I try to do that and I get no result: (json is the of my class which is extended by JavaScriptObject) public final native JsArrayjson getArray(String key) /*-{ return this[key] ? this[key] : new Array(); }-*/; and result.getArray(names).toString() Have you any idea to do what I want? Thank you in advance ! -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscr...@googlegroups.com. To post to this group, send email to google-web-toolkit@googlegroups.com. Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Complex JSON and overlay types
Thank you for your answer. If I do that: *public final native JsArrayjson getTest() /*-{ return this.records[0].names.John; }-*/;* * *I get *50,H,US, *so it's OK for that. But I'm not supposed to know John or Jack, so how can I get them? Le samedi 30 mars 2013 12:00:06 UTC-4, Patrick Tucker a écrit : It looks like your array is defined at: records[0].names.John -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscr...@googlegroups.com. To post to this group, send email to google-web-toolkit@googlegroups.com. Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Complex JSON and overlay types
Thanks. I try it, but I don't undestand how does it works... Do you have simple examples or tutorials? I try to do it: *interface Person { Names getNames(); String getStyle(); }* * interface Names { // Other properties, as above String getProp1(); String getProp2(); String getProp3();* * }* * // Declare the factory type interface MyFactory extends AutoBeanFactory { AutoBeanNames names(); AutoBeanPerson person(); }* *public class HelloWorld implements IsWidget,EntryPoint { public Widget asWidget() { String url=data.json; RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, url); //builder.setHeader(Access-Control-Allow-Origin, *); try { Request response = builder.sendRequest(null, new RequestCallback() { public void onError(Request request, Throwable exception) { // Code omitted for clarity }* * public void onResponseReceived(Request request, Response response) { MyFactory factory = GWT.create(MyFactory.class); AutoBeanPerson bean = AutoBeanCodex.decode(factory, Person.class, response.getText()); System.out.println(oui + bean.as().getNames()); * * }* * }); } catch (RequestException e) { } return null; }* *@Override public void onModuleLoad() { asWidget(); } }* I get *null*. What do you think? *I'm still interested by a method with overlay type (= Javascript)*, just to get Jack and John in *{records: [{names: {John: [50, H, US], Jack: [50, H, US]}, style: TR}]}.* Le lundi 1 avril 2013 12:43:37 UTC-4, Stefan Ollinger a écrit : Hi, you could take a look at http://code.google.com/p/google-web-toolkit/wiki/AutoBean Regards, Stefan On 29.03.2013 14:18, sebastie...@isen-lille.fr javascript: wrote: Hi everybody, I want to read this kind of JSON with GWT: *{records: [{names: {John: [50, H, US], Jack: [50, H, US]}, style: TR}]}* I use overlay for that. If I use that, I get *TR*: * public final native String getStyle() /*-{ return this.records[0].style; }-*/;* So, it's work. Now I want to get *John *and the list *50,H,US.* If I use that I get *null:* *public final native String getNames(String i) /*-{ return this.records[0].names[i]; }-*/;* For the same thing, I try to do that and I get no result: (json is the of my class which is extended by JavaScriptObject) * public final native JsArrayjson getArray(String key) /*-{ return this[key] ? this[key] : new Array(); }-*/;* and *result.getArray(names).toString()* ** Have you any idea to do what I want? Thank you in advance ! -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscr...@googlegroups.com javascript:. To post to this group, send email to google-we...@googlegroups.comjavascript: . Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en. For more options, visit https://groups.google.com/groups/opt_out. -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscr...@googlegroups.com. To post to this group, send email to google-web-toolkit@googlegroups.com. Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Complex JSON Overlay
Hi all, I try to use overlay type on this kind of JSON: {records: [{names: {John: [50, H, US], Jack: [40, H, EN]}, style: TR}]} So, to get the value of style, I do that and it works: public final native String getStyle() /*-{ return this.records[0].style; }-*/; Now I want to get the values of names. I do that and what I get is always* null*. public final native String getNames(final int i) /*-{ return this.records[0].names[i]; }-*/; Why? Is it the good way to get the names and their properties? (like [50, H, US]) Thank you in advance :) -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscr...@googlegroups.com. To post to this group, send email to google-web-toolkit@googlegroups.com. Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Complex JSON and overlay types
Hi everybody, I want to read this kind of JSON with GWT: *{records: [{names: {John: [50, H, US], Jack: [50, H, US]}, style: TR}]}* I use overlay for that. If I use that, I get *TR*: * public final native String getStyle() /*-{ return this.records[0].style; }-*/;* So, it's work. Now I want to get *John *and the list *50,H,US.* If I use that I get *null:* *public final native String getNames(String i) /*-{ return this.records[0].names[i]; }-*/;* For the same thing, I try to do that and I get no result: (json is the of my class which is extended by JavaScriptObject) * public final native JsArrayjson getArray(String key) /*-{ return this[key] ? this[key] : new Array(); }-*/;* and *result.getArray(names).toString()* ** Have you any idea to do what I want? Thank you in advance ! -- You received this message because you are subscribed to the Google Groups Google Web Toolkit group. To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscr...@googlegroups.com. To post to this group, send email to google-web-toolkit@googlegroups.com. Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en. For more options, visit https://groups.google.com/groups/opt_out.