Hi,
why don't you create a class holding all the information which you
want to send between the GWT client and the server.
like
class DataHolder
{
Date date;
Integer firstInteger;
Integer secondInteger;
String string;
}
Then you can send an array of this class to the client without needing to cast.
/Andreas
On Sat, Jun 27, 2009 at 12:44 AM, Piotr
Kirklewski<[email protected]> wrote:
>
> Hi
> I'm using RPC in order to send the resultset to the client side.
> Unfortunately I can't send the Object array which contains Date and
> Integers as GWT is complaining about Object being to complex and
> therefore not supported.
> I need to send the array as String array so I'm loosing my data types in
> the process.
> On the client side I'm doing great job with converting Strings to
> Integers but Dates are not so easy.
> First of all the code below represents the current working version where
> I hardcoded the values into the array.
> First question would be: Why do I need to cast it to Date " Date q0 =
> (Date)dt[i][0];" when I've already made it a date: new Date(2008,1,1) ?
> The second question is: I get the new values form the result in the
> following format "2008-01-01" what do I need to do in order to convert
> it to Date in the format that GWT Viualization data structure accepts ?
>
> Regards
>
> PEter
>
>
> Object[][] dt ={
> {new Date(2008,1,1),new Integer(31000),new
> Integer(60000)},
> {new Date(2008,1,2),new Integer(43000),new
> Integer(42000)},
> {new Date(2008,1,3),new Integer(51000),new
> Integer(42000)},
> {new Date(2008,1,3),new Integer(40000),new
> Integer(70000)},
> {new Date(2008,1,4),new Integer(61000),new
> Integer(42000)},
> {new Date(2008,1,6),new Integer(91000),new
> Integer(55000)},
> {new Date(2008,1,7),new Integer(31000),new
> Integer(42000)},
> {new Date(2008,1,8),new Integer(21000),new
> Integer(80000)},
> {new Date(2008,1,9),new Integer(81000),new
> Integer(60000)},
> {new Date(2008,1,10),new Integer(51000),new
> Integer(60000)},
> {new Date(2008,1,11),new Integer(91000),new
> Integer(90000)},
> {new Date(2008,1,12),new Integer(11000),new
> Integer(60000)},
> {new Date(2008,1,13),new Integer(31000),new
> Integer(30000)},
> {new Date(2008,1,14),new Integer(81000),new
> Integer(60000)},
> {new Date(2008,1,3),new Integer(21000),new
> Integer(100000)},
> };
>
>
> try{
> for (i = 0 ; i < dt.length; i++) {
>
>
> Date q0 = (Date)dt[i][0];
> Integer q1 =(Integer)dt[i][1];
> Integer q2 =(Integer)dt[i][2];
> //String q3 =(String)dt[i][3];
>
> data.setValue(i,0,q0);
> data.setValue(i,1,q1);
> data.setValue(i,2,q2);
> //data.setValue(i,3,q3);
>
> //System.out.println((String)(dt[i][0]));
> }
>
>
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---