Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Custom widget
Custom widget [message #43930] Wed, 29 August 2007 18:11 Go to next message
Eclipse UserFriend
Originally posted by: giuliapo.gmail.com

Hi all.

I'm in the middle of a custom widget. And I'm trying to pass an
Integer[][] from java to javascript using the LCA class.

I have managed to pass a String, an int and Integer[].

But what I really need is to pass an Integer [][].

I'm using the same method for the several types that I managed to pass
in the LCA class. It is like this:

writer.set(ChartLCA.PROP_ADDRESS, ChartLCA.JS_PROP_ADDRESS,
Object)c.getInt());

the getInt() returns the supposed Integer[][].

Any ideas? Anyone needs more information?

Thank you all for the time.
Re: Custom widget [message #43999 is a reply to message #43930] Thu, 30 August 2007 19:12 Go to previous message
Eclipse UserFriend
Originally posted by: rherrmann.innoopract.com

Bruno,

the JSWriter methods currently only handle one-dimensional arrays. You
would have to construct the two-dimensional array by yourself. The code
snippet below shows how this would look like.

static void set( JSWriter writer,
String functionName,
Integer[][] array )
throws IOException
{
StringBuffer buffer = new StringBuffer();
buffer.append( "[" );
for( int i = 0; i < array.length; i++ ) {
buffer.append( "[" );
for( int k = 0; k < array[ i ].length; k++ ) {
Integer value = array[ i ][ k ];
buffer.append( value );
if( k < array[ i ].length - 1 ) {
buffer.append( "," );
}
}
buffer.append( "]" );
if( i < array.length - 1 ) {
buffer.append( "," );
}
}
buffer.append( "]" );
// wrap in JSVar to prevent JSWriter from quoting the string
Object[] args = new Object[] { new JSVar( buffer.toString() ) };
writer.call( functionName, args );
}

Please note that you still would have to determine if the integer array
has changed and thus writing the JavaScript code is necessary at all.

HTH
Rüdiger


Bruno Vieira wrote:
> Hi all.
>
> I'm in the middle of a custom widget. And I'm trying to pass an
> Integer[][] from java to javascript using the LCA class.
>
> I have managed to pass a String, an int and Integer[].
>
> But what I really need is to pass an Integer [][].
>
> I'm using the same method for the several types that I managed to pass
> in the LCA class. It is like this:
>
> writer.set(ChartLCA.PROP_ADDRESS, ChartLCA.JS_PROP_ADDRESS,
> Object)c.getInt());
>
> the getInt() returns the supposed Integer[][].
>
> Any ideas? Anyone needs more information?
>
> Thank you all for the time.
Previous Topic:Installation problem
Next Topic:Include rcp SDK in Targetplattform?
Goto Forum:
  


Current Time: Tue Apr 23 08:05:22 GMT 2024

Powered by FUDForum. Page generated in 0.03012 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top