Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » XWT callback to specific instance
XWT callback to specific instance [message #569731] Thu, 11 March 2010 21:11 Go to next message
No real name is currently offline No real nameFriend
Messages: 17
Registered: March 2010
Junior Member
I am trying out XWT and running into some confusion.
My foo.xwt has a tag referencing the Java class providing callback support.
For example,
<Composite ... x:Class="Foo">
. . .
<Button x:style="SWT.PUSH" text="Bar" SelectionEvent="selection" ></Button>


with a file Foo.java containing the callback handler

public class Foo extends Composite {

public XwtComponent1(Composite parent, int style) {
super(parent, style);
}

protected void selection(Event event) {
. . . }
}

Now, from Bar.java I am loading the XWT to open the GUI. I'd like to have
the button click go to a method in my BAR.java class and to
the *instance* of BAR which opened the GUI.
What are the mechanics of this or am I going down the wrong path completely?
Re: XWT callback to specific instance [message #570148 is a reply to message #569731] Fri, 12 March 2010 10:25 Go to previous messageGo to next message
Yves YANG is currently offline Yves YANGFriend
Messages: 688
Registered: July 2009
Senior Member
<allygirl@mailinator.com> wrote in message
news:hnbmao$iks$1@build.eclipse.org...
>
> I am trying out XWT and running into some confusion.
> My foo.xwt has a tag referencing the Java class providing callback
> support. For example,
> <Composite ... x:Class="Foo">
The class must be complete name.

You can find more example codes in org.eclipse.e4.xwt.tests.

Regards
Yves
> . . .
> <Button x:style="SWT.PUSH" text="Bar" SelectionEvent="selection"
> ></Button>
>
>
> with a file Foo.java containing the callback handler
>
> public class Foo extends Composite {
>
> public XwtComponent1(Composite parent, int style) {
> super(parent, style);
> }
>
> protected void selection(Event event) {
> . . . }
> }
>
> Now, from Bar.java I am loading the XWT to open the GUI. I'd like to have
> the button click go to a method in my BAR.java class and to
> the *instance* of BAR which opened the GUI. What are the mechanics of this
> or am I going down the wrong path completely?
Re: XWT callback to specific instance [message #570218 is a reply to message #570148] Fri, 12 March 2010 16:05 Go to previous messageGo to next message
No real name is currently offline No real nameFriend
Messages: 17
Registered: March 2010
Junior Member
Thank you for your response. Perhaps I oversimplified the first part of my post. Yes, the class would be fully qualified.... The core part of my question is the second half regarding having the widget callback (selection(...) ) either 1) go to an instanceof x.y.Foo that is known by my code (vs. a new instance created by the XWT engine) or 2) the callback goes to the instance which requested XWT to open the GUI spec to begin with. I reviewed many of the test examples and nothing is jumping out as addressing this question. Can you point me to an example?
i.e. a button on the XWT created GUI which calls back into the code which opened that XWT GUI.
Many thanks for any assistance you can provide.
Re: XWT callback to specific instance [message #570322 is a reply to message #570218] Fri, 12 March 2010 20:56 Go to previous message
Yves YANG is currently offline Yves YANGFriend
Messages: 688
Registered: July 2009
Senior Member
You can specify BAR directly in x:Class.

Regards
yves
<allygirl@mailinator.com> wrote in message
news:hndonv$h8b$1@build.eclipse.org...
> Thank you for your response. Perhaps I oversimplified the first part of my
> post. Yes, the class would be fully qualified.... The core part of my
> question is the second half regarding having the widget callback
> (selection(...) ) either 1) go to an instanceof x.y.Foo that is known by
> my code (vs. a new instance created by the XWT engine) or 2) the callback
> goes to the instance which requested XWT to open the GUI spec to begin
> with. I reviewed many of the test examples and nothing is jumping out as
> addressing this question. Can you point me to an example?
> i.e. a button on the XWT created GUI which calls back into the code which
> opened that XWT GUI.
> Many thanks for any assistance you can provide.
Previous Topic:The way XWT should work
Next Topic:XWT callback to specific instance
Goto Forum:
  


Current Time: Thu Apr 25 22:21:49 GMT 2024

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

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

Back to the top