Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » XWT callback to specific instance(XWT)
XWT callback to specific instance [message #520304] 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 #520424 is a reply to message #520304] Fri, 12 March 2010 05:48 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 #520499 is a reply to message #520424] 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 #520579 is a reply to message #520499] Fri, 12 March 2010 20:56 Go to previous messageGo to next 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.
Re: XWT callback to specific instance [message #520580 is a reply to message #520579] Fri, 12 March 2010 21:02 Go to previous message
Yves YANG is currently offline Yves YANGFriend
Messages: 688
Registered: July 2009
Senior Member
Precisely, you can look at the class XWTAbstractPart in
org.eclipse.e4.xwt.ui.workbench:
newOptions.put(XWTLoader.CLASS_PROPERTY, this);

Regards
Yves

"Yves YANG" <yves.yang@soyatec.com> wrote in message
news:hne9qj$2h6$1@build.eclipse.org...
> 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.
>
>
Re: XWT callback to specific instance [message #570336 is a reply to message #520579] Fri, 12 March 2010 21:02 Go to previous message
Yves YANG is currently offline Yves YANGFriend
Messages: 688
Registered: July 2009
Senior Member
Precisely, you can look at the class XWTAbstractPart in
org.eclipse.e4.xwt.ui.workbench:
newOptions.put(XWTLoader.CLASS_PROPERTY, this);

Regards
Yves

"Yves YANG" <yves.yang@soyatec.com> wrote in message
news:hne9qj$2h6$1@build.eclipse.org...
> 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:XWT callback to specific instance
Next Topic:XWT. How to set absolute (null) layout?
Goto Forum:
  


Current Time: Mon Dec 22 03:35:02 GMT 2014

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

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