Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » JFace » How to bind a list-size to a label
How to bind a list-size to a label [message #1006843] Sat, 02 February 2013 18:57 Go to next message
Jens Mayer is currently offline Jens MayerFriend
Messages: 19
Registered: September 2009
Location: Hamburg
Junior Member
Hi,

maybe this is a dumb question but I am stuck:

i want to bind the size of a WritableList to a label to show how many entries the list actually has.

The label-sided part of the Binding is easy, but I wonder how to create the IObservableValue for the size of the list...

Can anyone help me please?

Thanks in advance,

Jens
Re: How to bind a list-size to a label [message #1008408 is a reply to message #1006843] Tue, 12 February 2013 11:15 Go to previous messageGo to next message
Nigel Westbury is currently offline Nigel WestburyFriend
Messages: 18
Registered: July 2009
Junior Member
Use a computed value. The model side of the binding would be:

new ComputedValue() {
protected Object calculate() {
return myWritableList.size();
}
};

Note that ObservableList.size() is a tracked getter (annotated with
@TrackedGetter and if you look at the implementation you will see it
calls getterCalled method).

Nigel Westbury

On 02/02/2013 18:57, Jens Mayer wrote:
> Hi,
>
> maybe this is a dumb question but I am stuck:
>
> i want to bind the size of a WritableList to a label to show how many
> entries the list actually has.
>
> The label-sided part of the Binding is easy, but I wonder how to create
> the IObservableValue for the size of the list...
>
> Can anyone help me please?
>
> Thanks in advance,
>
> Jens
Re: How to bind a list-size to a label [message #1008547 is a reply to message #1006843] Tue, 12 February 2013 22:30 Go to previous message
Jens Mayer is currently offline Jens MayerFriend
Messages: 19
Registered: September 2009
Location: Hamburg
Junior Member
Hi Nigel,

works like a charm.

Thank you!

Jens
Previous Topic:Mouse Scroll does not work in my propertysheet tab
Next Topic:Arrays as dynamic properties (TableViewer Databinding)
Goto Forum:
  


Current Time: Fri Apr 19 13:27:12 GMT 2024

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

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

Back to the top