Re: Calling a Java Method from Handwritten JavaScript

2011-08-09 Thread ASlak
It still cannot find OnModuleLoad. I will try moving the method to a
different class(without onModuleLoad) to see if I can get it to work
from there.

On Aug 9, 11:02 am, Alain Ekambi  wrote:
> I think you need to add
>
> @Export
> on the class itself
>
> Note that the method you want to export needs to be public
>
> Try this :
>
> @ExportPackage("test")
> @Export
> public class myClass implements EntryPoint, Exportable{
>
>  @Export("sendRequest")
>  public void sendRequest(...){
>
> in the js you will need something like
>
> var v  = new test.MyClass();
> t.sendRequest();
>
> This should work
>
> Best,
>
> Alain
>
> 2011/8/9 ASlak 
>
>
>
> > Hi Alain,
>
> > So I tried using GwtExporter.  I edited my *.get.xml to include what
> > they had on their "getting started" guide. I also added their library
> > to the project.
>
> > Then I changed my class to look like:
> >  public class myClass implements EntryPoint, Exportable{
>
> > And my method to look like this:
> >  @Export("sendRequest")
> >  private void sendRequest(...){
>
> > The problem is that when I try to compile i get this error:
> > "Could not find entry method 'onModuleLoad()' method in entry point
> > class"
>
> > The onModuleLoad() is right where it should be and was working before
> > I made the changes to include the GwtExporter.
>
> > Any idea how to fix this? I obviously can't use GwtExporter if my
> > project won't even compile with it.
>
> > On Aug 9, 10:31 am, Alain Ekambi  wrote:
> > > You r welcome.
> > > GwtExporter is a good solution  for the type of things you are trying to
> > > do.
> > > Why going through all the pain when somebody allready did it for u.
> > > Or maybe i m just lazy ? :)
>
> > > And dont forget this is GWT. You dont use a module it wont end up in the
> > > generated code. So i dont see the problem by adding it to your project.
>
> > > 2011/8/9 ASlak 
>
> > > > Thanks Alain,
>
> > > > I would prefer to avoid adding extra dependencies to my application,
> > > > but I will look into this if I cannot find another way to resolve this
> > > > issue.
>
> > > > On Aug 9, 10:06 am, Alain Ekambi  wrote:
> > > > > Maybe you want to check  http://code.google.com/p/gwt-exporter/
> > > > > it will take care of the exporting for you.
>
> > > > > 2011/8/9 ASlak 
>
> > > > > > Thanks karim! Firebug is a great tool.
>
> > > > > > I have learned from it that my method is accessible from the html
> > > > > > where I am calling it from and the variable that I want included in
> > > > > > the call is being included, however there is still a problem.
>
> > > > > > According to firebug it looks like everything should be working
> > fine,
> > > > > > but my java method is still not actually being executed.  To me
> > this
> > > > > > indicates a problem with the path provided by the exportMethod()
> > > > > > perhaps, but I have checked this many times and it seems to be
> > > > > > correct.
>
> > > > > > My methods are not static.  I would prefer to leave them that way,
> > but
> > > > > > I could possibly change them (the java method I need to call is
> > > > > > dependent on many other methods and variables that I would also
> > need
> > > > > > to make static in order to use).  I feel like this should work
> > > > > > regardless of whether or not the methods are static, but if someone
> > > > > > else can confirm what Paul said about the methods having to be
> > static
> > > > > > I can try that.
>
> > > > > > Thanks everyone.
>
> > > > > > On Aug 9, 5:20 am, karim duran  wrote:
> > > > > > > Hi ASlak,
>
> > > > > > > It should work. I already  did that.
>
> > > > > > > Don't forget that, finally, all your java code will be translated
> > in
> > > > > > > optimized javascript.
> > > > > > > I haven't enough element about your problem to really help you.
>
> > > > > > > So, here's my proposition.
>
> > > > > > > 1) build your application as you usually do
> > > > > > > 2) run it in firefox
>

Re: Calling a Java Method from Handwritten JavaScript

2011-08-09 Thread ASlak
Hi Alain,

So I tried using GwtExporter.  I edited my *.get.xml to include what
they had on their "getting started" guide. I also added their library
to the project.

Then I changed my class to look like:
  public class myClass implements EntryPoint, Exportable{

And my method to look like this:
  @Export("sendRequest")
  private void sendRequest(...){

The problem is that when I try to compile i get this error:
"Could not find entry method 'onModuleLoad()' method in entry point
class"

The onModuleLoad() is right where it should be and was working before
I made the changes to include the GwtExporter.

Any idea how to fix this? I obviously can't use GwtExporter if my
project won't even compile with it.

On Aug 9, 10:31 am, Alain Ekambi  wrote:
> You r welcome.
> GwtExporter is a good solution  for the type of things you are trying to
> do.
> Why going through all the pain when somebody allready did it for u.
> Or maybe i m just lazy ? :)
>
> And dont forget this is GWT. You dont use a module it wont end up in the
> generated code. So i dont see the problem by adding it to your project.
>
> 2011/8/9 ASlak 
>
>
>
> > Thanks Alain,
>
> > I would prefer to avoid adding extra dependencies to my application,
> > but I will look into this if I cannot find another way to resolve this
> > issue.
>
> > On Aug 9, 10:06 am, Alain Ekambi  wrote:
> > > Maybe you want to check  http://code.google.com/p/gwt-exporter/
> > > it will take care of the exporting for you.
>
> > > 2011/8/9 ASlak 
>
> > > > Thanks karim! Firebug is a great tool.
>
> > > > I have learned from it that my method is accessible from the html
> > > > where I am calling it from and the variable that I want included in
> > > > the call is being included, however there is still a problem.
>
> > > > According to firebug it looks like everything should be working fine,
> > > > but my java method is still not actually being executed.  To me this
> > > > indicates a problem with the path provided by the exportMethod()
> > > > perhaps, but I have checked this many times and it seems to be
> > > > correct.
>
> > > > My methods are not static.  I would prefer to leave them that way, but
> > > > I could possibly change them (the java method I need to call is
> > > > dependent on many other methods and variables that I would also need
> > > > to make static in order to use).  I feel like this should work
> > > > regardless of whether or not the methods are static, but if someone
> > > > else can confirm what Paul said about the methods having to be static
> > > > I can try that.
>
> > > > Thanks everyone.
>
> > > > On Aug 9, 5:20 am, karim duran  wrote:
> > > > > Hi ASlak,
>
> > > > > It should work. I already  did that.
>
> > > > > Don't forget that, finally, all your java code will be translated in
> > > > > optimized javascript.
> > > > > I haven't enough element about your problem to really help you.
>
> > > > > So, here's my proposition.
>
> > > > > 1) build your application as you usually do
> > > > > 2) run it in firefox
> > > > > 3) install firebug, a firefox extension wich provide a javascript
> > debuger
> > > > > with breakpoint management and step debuging
> > > > > 4) open tab "javascript" in firebug and set a breakpoint where your
> > > > > javascipt method is called
> > > > > 5) watch your variables, fields...etc...and try  to analyse what is
> > > > > happening.
>
> > > > > I used this methodology to track some jsni method behaviour,
> > difficult to
> > > > > debug, from the point of view of java.
>
> > > > > I hope it helps.
>
> > > > > Regards.
>
> > > > > Karim Duran
>
> > > > > 2011/8/8 ASlak 
>
> > > > > > I have some code in my host html page that I would like to call one
> > of
> > > > > > my java methods from.
>
> > > > > > The relevant part of the html looks like:
> > > > > > 
> > > > > > if(myCondition){
> > > > > > sendRequest(myVar);
> > > > > > }
> > > > > > 
>
> > > > > > I have a method in my java code for my gwt project that is called
> > > > > > sendRequest.
>
> > > > > > I am al

Re: Calling a Java Method from Handwritten JavaScript

2011-08-09 Thread ASlak
Thanks Alain,

I would prefer to avoid adding extra dependencies to my application,
but I will look into this if I cannot find another way to resolve this
issue.

On Aug 9, 10:06 am, Alain Ekambi  wrote:
> Maybe you want to check  http://code.google.com/p/gwt-exporter/
> it will take care of the exporting for you.
>
> 2011/8/9 ASlak 
>
>
>
> > Thanks karim! Firebug is a great tool.
>
> > I have learned from it that my method is accessible from the html
> > where I am calling it from and the variable that I want included in
> > the call is being included, however there is still a problem.
>
> > According to firebug it looks like everything should be working fine,
> > but my java method is still not actually being executed.  To me this
> > indicates a problem with the path provided by the exportMethod()
> > perhaps, but I have checked this many times and it seems to be
> > correct.
>
> > My methods are not static.  I would prefer to leave them that way, but
> > I could possibly change them (the java method I need to call is
> > dependent on many other methods and variables that I would also need
> > to make static in order to use).  I feel like this should work
> > regardless of whether or not the methods are static, but if someone
> > else can confirm what Paul said about the methods having to be static
> > I can try that.
>
> > Thanks everyone.
>
> > On Aug 9, 5:20 am, karim duran  wrote:
> > > Hi ASlak,
>
> > > It should work. I already  did that.
>
> > > Don't forget that, finally, all your java code will be translated in
> > > optimized javascript.
> > > I haven't enough element about your problem to really help you.
>
> > > So, here's my proposition.
>
> > > 1) build your application as you usually do
> > > 2) run it in firefox
> > > 3) install firebug, a firefox extension wich provide a javascript debuger
> > > with breakpoint management and step debuging
> > > 4) open tab "javascript" in firebug and set a breakpoint where your
> > > javascipt method is called
> > > 5) watch your variables, fields...etc...and try  to analyse what is
> > > happening.
>
> > > I used this methodology to track some jsni method behaviour, difficult to
> > > debug, from the point of view of java.
>
> > > I hope it helps.
>
> > > Regards.
>
> > > Karim Duran
>
> > > 2011/8/8 ASlak 
>
> > > > I have some code in my host html page that I would like to call one of
> > > > my java methods from.
>
> > > > The relevant part of the html looks like:
> > > > 
> > > > if(myCondition){
> > > > sendRequest(myVar);
> > > > }
> > > > 
>
> > > > I have a method in my java code for my gwt project that is called
> > > > sendRequest.
>
> > > > I am also using a method that looks like:
> > > > public native void exportMethod(myApp app)/*-{
> > > > $wnd.sendRequest =
> > > > $entry(a...@com.myCompany.myProject.client.myClass::sendRequest(Ljava/
> > > > lang/String;));
> > > > }-*/;
>
> > > > This is based off of what I found in the gwt documentation here:http://
> > > > code.google.com/webtoolkit/doc/latest/DevGuideCodingBasicsJSNI.html
>
> > > > The problem is that this is not working, and I am not sure why.
>
> > > > I would appreciate it if anyone could give me a hint.
>
> > > > 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-toolkit@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.
>
> > --
> > 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-toolkit@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.
>
> --
>
> GWT API for  non Java based 
> platformshttp://code.google.com/p/gwt4air/http://www.gwt4air.appspot.com/

-- 
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-toolkit@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: Calling a Java Method from Handwritten JavaScript

2011-08-09 Thread ASlak


I think I have found the problem. After setting up a breakpoint with
firebug and using the "step into" ability I found a piece of code that
is generating an exception.

in *.cache.html:

_.sendRequest_0 = function sendRequest(id, pw){
$sendRequest(this, id, pw);
}

The problem is that _.sendRequest_0 is undefined. The exception is
Java.util.NoSuchElementException {castable TypeMap = $object}

This part of the code is automatically generated, so I must be making
a mistake somewhere else that is causing this.

Any ideas?

-- 
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-toolkit@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: Calling a Java Method from Handwritten JavaScript

2011-08-09 Thread ASlak
Thanks karim! Firebug is a great tool.

I have learned from it that my method is accessible from the html
where I am calling it from and the variable that I want included in
the call is being included, however there is still a problem.

According to firebug it looks like everything should be working fine,
but my java method is still not actually being executed.  To me this
indicates a problem with the path provided by the exportMethod()
perhaps, but I have checked this many times and it seems to be
correct.

My methods are not static.  I would prefer to leave them that way, but
I could possibly change them (the java method I need to call is
dependent on many other methods and variables that I would also need
to make static in order to use).  I feel like this should work
regardless of whether or not the methods are static, but if someone
else can confirm what Paul said about the methods having to be static
I can try that.

Thanks everyone.

On Aug 9, 5:20 am, karim duran  wrote:
> Hi ASlak,
>
> It should work. I already  did that.
>
> Don't forget that, finally, all your java code will be translated in
> optimized javascript.
> I haven't enough element about your problem to really help you.
>
> So, here's my proposition.
>
> 1) build your application as you usually do
> 2) run it in firefox
> 3) install firebug, a firefox extension wich provide a javascript debuger
> with breakpoint management and step debuging
> 4) open tab "javascript" in firebug and set a breakpoint where your
> javascipt method is called
> 5) watch your variables, fields...etc...and try  to analyse what is
> happening.
>
> I used this methodology to track some jsni method behaviour, difficult to
> debug, from the point of view of java.
>
> I hope it helps.
>
> Regards.
>
> Karim Duran
>
> 2011/8/8 ASlak 
>
> > I have some code in my host html page that I would like to call one of
> > my java methods from.
>
> > The relevant part of the html looks like:
> > 
> > if(myCondition){
> > sendRequest(myVar);
> > }
> > 
>
> > I have a method in my java code for my gwt project that is called
> > sendRequest.
>
> > I am also using a method that looks like:
> > public native void exportMethod(myApp app)/*-{
> > $wnd.sendRequest =
> > $entry(a...@com.myCompany.myProject.client.myClass::sendRequest(Ljava/
> > lang/String;));
> > }-*/;
>
> > This is based off of what I found in the gwt documentation here:http://
> > code.google.com/webtoolkit/doc/latest/DevGuideCodingBasicsJSNI.html
>
> > The problem is that this is not working, and I am not sure why.
>
> > I would appreciate it if anyone could give me a hint.
>
> > 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-toolkit@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.

-- 
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-toolkit@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: Calling a Java Method from Handwritten JavaScript

2011-08-08 Thread ASlak
yes I call it in onModuleLoad()

it looks like:

MyClass app =  this;
exportMethod(app);

On Aug 8, 4:12 pm, Jens  wrote:
> Have you called your JSNI method once on app startup? If you do not call it
> once, $wnd.sendRequest won't point to your JSNI method.
>
> -- J.

-- 
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-toolkit@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.



Calling a Java Method from Handwritten JavaScript

2011-08-08 Thread ASlak
I have some code in my host html page that I would like to call one of
my java methods from.

The relevant part of the html looks like:

if(myCondition){
sendRequest(myVar);
}


I have a method in my java code for my gwt project that is called
sendRequest.

I am also using a method that looks like:
public native void exportMethod(myApp app)/*-{
$wnd.sendRequest =
$entry(app.@com.myCompany.myProject.client.myClass::sendRequest(Ljava/
lang/String;));
}-*/;


This is based off of what I found in the gwt documentation here:http://
code.google.com/webtoolkit/doc/latest/DevGuideCodingBasicsJSNI.html

The problem is that this is not working, and I am not sure why.

I would appreciate it if anyone could give me a hint.

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-toolkit@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: button with image and text

2011-07-21 Thread ASlak
So I learned that I can change the z-index.  I tried making the index
of my button Label -1, which made it disappear completely from the
screen.  My guess was that it happened because it had gone behind the
background image, however when I set the image of the background image
to -2 the Label did not reappear.

Any ideas?

Thanks again.

-- 
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-toolkit@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: button with image and text

2011-07-21 Thread ASlak
Thanks for your fast response!

I am very new to gwt, so I may be wrong, but from what I understand
you need to use gwt-ext to change the z index of components. I am
trying to only use standard gwt.  If it is in fact possible to change
the z index with standard gwt then I have not been able to find how to
do it.  I am using eclipse for my project and I have tried the
"order"  >  "send to back" option for the label in the design window,
but this does not solve the problem.

As for solution 2, I do need some of the features that PushButton
provides, such as the UpHovering property, so I am not sure that that
is a viable option.

So, is it possible to change the z-index in standard gwt? Or is there
another way to solve my issue?

Thanks

On Jul 21, 10:46 am, Jeff Larsen  wrote:
> Solution 1. Change the z index of the button to have it be on top of the
> text.
>
> Solution 2: Use Button instead of PushButton and create a SafeHtml Template
> for your text+image. (this is the better option if you don't need all the
> stuff that PushButton provides)

-- 
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-toolkit@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.



button with image and text

2011-07-21 Thread ASlak
My goal is to make a button that has transparency, to look nice, and
text on top so the user knows what the button does.

I currently am using a pushbutton for the image part and that works
fine. The issue is how I am adding the text. Right now I have a label
with the text that I want located behind the pushbutton.  This appears
as I want it to visually, however if I mouse over the label it brings
up the text selector cursor and no longer allows me to click the
button.

Effectively this makes most of the button unclickable(the parts of the
button outside of the label area work as expected).

Is there a way to fix this so the text does not interfere with the
button's function?  Or is there a completely different approach to
this task that would work better?

Thanks in advance.

-- 
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-toolkit@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.



RequestBuilder

2011-07-20 Thread ASlak
I am having a problem with requestbuilder.

I am trying to do this:

RequestBuilder requestbuilder = new RequestBuilder("POST", "/blah/
blah");

Eclipse marks it with an error which says "The constructor
RequestBuilder(String, String) is not visible"

Does anyone have any idea why this is happening?

-- 
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-toolkit@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.