Re: Pass a Java Object between to Opener Window

2010-06-17 Thread Stefan Bachert
Hi,

you may run into browser incompatibilities and security issues with
such an approach.

Did you consider to pass the object via the url. Maybe as query part?

Stefan Bachert
http://gwtworld.de

On Jun 16, 7:21 pm, keyvez  wrote:
> Hi,
>
> I am trying to pass a custom Java object to the another window to
> which I have a reference using $wnd.opener.
>
> When I call $wnd.opener.callback(); or $wnd.opener.callback('string'),
> it works, however, when I pass
> $wnd.opener.callback(@com.package.Class::staticField), the staticField
> is received as null by callback.
>
> Here's my code:
>
> Main Window:
>
> -
>     public native void registerCallback() /*-{
>         $wnd.callback =
> $entry(@com.application.web.client.Tv::javaCallback(Lcom/application/
> web/model/User;));
>     }-*/;
>
>     public static void javaCallback( User registeredUser ) {
>
>         Window.alert(Boolean.toString(registeredUser == null));
>         Window.alert(user.getFirstname());
>
>     }
> -
> Child Window:
> -
>      Window.addWindowClosingHandler(new ClosingHandler() {
>
>             @Override
>             public native void onWindowClosing( ClosingEvent event ) /
> *-{
>                if($wnd.opener != null) {
>                     alert('sending request');
>                     var obj =
> @com.application.web.authentication.OAuth::registeredUser;
>                     $wnd.opener.callback(obj);
>                }
>             }-*/;
>       });
> -
>
> Any help is appreciated.
>
> Thanks,

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: Pass a Java Object between to Opener Window

2010-06-16 Thread Sky
I'm not really sure... but you could try passing the static field
directly into the native method onWindowClosing and then pass it into
the callback method...

Sorry I can't help more than that... :(

On Jun 16, 12:21 pm, keyvez  wrote:
> Hi,
>
> I am trying to pass a custom Java object to the another window to
> which I have a reference using $wnd.opener.
>
> When I call $wnd.opener.callback(); or $wnd.opener.callback('string'),
> it works, however, when I pass
> $wnd.opener.callback(@com.package.Class::staticField), the staticField
> is received as null by callback.
>
> Here's my code:
>
> Main Window:
>
> -
>     public native void registerCallback() /*-{
>         $wnd.callback =
> $entry(@com.application.web.client.Tv::javaCallback(Lcom/application/
> web/model/User;));
>     }-*/;
>
>     public static void javaCallback( User registeredUser ) {
>
>         Window.alert(Boolean.toString(registeredUser == null));
>         Window.alert(user.getFirstname());
>
>     }
> -
> Child Window:
> -
>      Window.addWindowClosingHandler(new ClosingHandler() {
>
>             @Override
>             public native void onWindowClosing( ClosingEvent event ) /
> *-{
>                if($wnd.opener != null) {
>                     alert('sending request');
>                     var obj =
> @com.application.web.authentication.OAuth::registeredUser;
>                     $wnd.opener.callback(obj);
>                }
>             }-*/;
>       });
> -
>
> Any help is appreciated.
>
> Thanks,

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Pass a Java Object between to Opener Window

2010-06-16 Thread keyvez
Hi,

I am trying to pass a custom Java object to the another window to
which I have a reference using $wnd.opener.

When I call $wnd.opener.callback(); or $wnd.opener.callback('string'),
it works, however, when I pass
$wnd.opener.callback(@com.package.Class::staticField), the staticField
is received as null by callback.

Here's my code:

Main Window:

-
public native void registerCallback() /*-{
$wnd.callback =
$entry(@com.application.web.client.Tv::javaCallback(Lcom/application/
web/model/User;));
}-*/;

public static void javaCallback( User registeredUser ) {

Window.alert(Boolean.toString(registeredUser == null));
Window.alert(user.getFirstname());

}
-
Child Window:
-
 Window.addWindowClosingHandler(new ClosingHandler() {

@Override
public native void onWindowClosing( ClosingEvent event ) /
*-{
   if($wnd.opener != null) {
alert('sending request');
var obj =
@com.application.web.authentication.OAuth::registeredUser;
$wnd.opener.callback(obj);
   }
}-*/;
  });
-

Any help is appreciated.

Thanks,

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.