Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » XWT and Custom Widget
XWT and Custom Widget [message #929429] Mon, 01 October 2012 13:03 Go to next message
Jürgen Weinberger is currently offline Jürgen WeinbergerFriend
Messages: 42
Registered: August 2012
Member
Hi! I am still playing arround with xwt more or less successfull.
I am trying to build a custom Text Widget which has already some text auto completion available.

The widget looks more or less like this:
ContentAssist Text extends Text {
private List<String> proposals;
..
protected void checkSubclass() {
}

public void setProposals(List<String> proposals) {
..
}

public List<String> getProposals() {
 return proposals: 
}

}


in my xwt:
Quote:

<z:ContentassistText proposals="{Binding path=defaultRoles}"/>


I have another combo where the binding with defaultRoles works perfect when i set it as input. Also the setter-method in my widget-class is called but the problem is that i always get an array with the binding data instead of the strings.

So do i have to look up the binding my self? I thought i should get the List without any trouble. By the way defaultRoles has a List<String> in the background.

I had another widget where i only bound a String and there it was easy.

Thanks for any help and
best regards weinma
Re: XWT and Custom Widget [message #929757 is a reply to message #929429] Mon, 01 October 2012 18:40 Go to previous messageGo to next message
Erdal Karaca is currently offline Erdal KaracaFriend
Messages: 854
Registered: July 2009
Senior Member
What do you mean by "i always get an array with the binding data"? The internal Binding object?

Jürgen Weinberger wrote on Mon, 01 October 2012 09:03
Hi! I am still playing arround with xwt more or less successfull.
I am trying to build a custom Text Widget which has already some text auto completion available.

The widget looks more or less like this:
ContentAssist Text extends Text {
private List<String> proposals;
..
protected void checkSubclass() {
}

public void setProposals(List<String> proposals) {
..
}

public List<String> getProposals() {
 return proposals: 
}

}


in my xwt:
Quote:

<z:ContentassistText proposals="{Binding path=defaultRoles}"/>


I have another combo where the binding with defaultRoles works perfect when i set it as input. Also the setter-method in my widget-class is called but the problem is that i always get an array with the binding data instead of the strings.

So do i have to look up the binding my self? I thought i should get the List without any trouble. By the way defaultRoles has a List<String> in the background.

I had another widget where i only bound a String and there it was easy.

Thanks for any help and
best regards weinma

Re: XWT and Custom Widget [message #930197 is a reply to message #929757] Tue, 02 October 2012 05:16 Go to previous messageGo to next message
Jürgen Weinberger is currently offline Jürgen WeinbergerFriend
Messages: 42
Registered: August 2012
Member
Sorry, if i was a little unclear.

If i look in the DebugMode at a breakpoint in my
public void setProposals(List<String> proposals) {
..
}


than proposals contains an ArrayList with only one element from type org.eclipse.e4.xwt.internal.core.Binding and not a list of Strings as expected. I wonder how this is solved with the Table-, Combo-, TreeViewers where i can set a List of Strings as Input without any problems.


best Regards
Weinma
Re: XWT and Custom Widget [message #930290 is a reply to message #930197] Tue, 02 October 2012 07:16 Go to previous message
Jürgen Weinberger is currently offline Jürgen WeinbergerFriend
Messages: 42
Registered: August 2012
Member
Hey! Just an update. I tried it with

public void setProposal(Object object) {
...
}


and just changed the type to Object at my CustomWidget

So now i get an correct ArrayList<Object> with the Strings and just have to do some type checks and casts.

My last question is if this is the way to do something like this or is it possible to get the a list with the right typesafe data?

Best regards
Weinma

[Updated on: Tue, 02 October 2012 07:16]

Report message to a moderator

Previous Topic:Quick Context View from Navigate Menu
Next Topic:After Juno SR1 the Wizard "Eclipse 4 Application Project" misses adding plugins
Goto Forum:
  


Current Time: Fri Mar 29 11:32:35 GMT 2024

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

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

Back to the top