Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Listen for items added to List
Listen for items added to List [message #461084] Thu, 15 September 2005 20:10 Go to next message
David Frischknecht is currently offline David FrischknechtFriend
Messages: 6
Registered: July 2009
Junior Member
Hello,

I'm converting an application from Swing to SWT and I'm getting hung up
on the fact that I can't seem to find an SWT alternative to the Swing
ListDataListener. I need my application to be able to listen for items
being added or removed from the list. Much thanks in advance.

Dave
Re: Listen for items added to List [message #461102 is a reply to message #461084] Fri, 16 September 2005 07:10 Go to previous messageGo to next message
arne anka is currently offline arne ankaFriend
Messages: 133
Registered: July 2009
Senior Member
you might want to use ListViewer (jface) instead of a plain SWT List -- see
http://www.java2s.com/ExampleCode/SWT-JFace-Eclipse/SampleLi stViewer.htm
for an example.
public static class Language {

public void inputChanged(
Viewer viewer,
Object oldInput,
Object newInput) {
//here your action on insertion/removal
}

regards
Re: Listen for items added to List [message #461155 is a reply to message #461102] Sat, 17 September 2005 19:58 Go to previous messageGo to next message
David Frischknecht is currently offline David FrischknechtFriend
Messages: 6
Registered: July 2009
Junior Member
arne anka wrote:
> you might want to use ListViewer (jface) instead of a plain SWT List -- see
> http://www.java2s.com/ExampleCode/SWT-JFace-Eclipse/SampleLi stViewer.htm
> for an example.
> public static class Language {
>
> public void inputChanged(
> Viewer viewer,
> Object oldInput,
> Object newInput) {
> //here your action on insertion/removal
> }
>
> regards

Thanks for your reply. However, it won't work in my situation since I'm
developing a standalone SWT app. If there's a standalone jFace jar that
I can distribute with my app, I'd be more than willing to use the
ListViewer. Right now I'm working around it by calling a private method
from within each method that makes a change to the items in the List.

Dave
Re: Listen for items added to List [message #461156 is a reply to message #461155] Sat, 17 September 2005 20:23 Go to previous messageGo to next message
James Leotta is currently offline James LeottaFriend
Messages: 202
Registered: July 2009
Senior Member
There are jars for everything in Eclipse.

Dave wrote:
> arne anka wrote:
>
>>you might want to use ListViewer (jface) instead of a plain SWT List -- see
>> http://www.java2s.com/ExampleCode/SWT-JFace-Eclipse/SampleLi stViewer.htm
>>for an example.
>>public static class Language {
>>
>> public void inputChanged(
>> Viewer viewer,
>> Object oldInput,
>> Object newInput) {
>> //here your action on insertion/removal
>> }
>>
>>regards
>
>
> Thanks for your reply. However, it won't work in my situation since I'm
> developing a standalone SWT app. If there's a standalone jFace jar that
> I can distribute with my app, I'd be more than willing to use the
> ListViewer. Right now I'm working around it by calling a private method
> from within each method that makes a change to the items in the List.
>
> Dave
Re: Listen for items added to List [message #461188 is a reply to message #461155] Mon, 19 September 2005 12:36 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Dave wrote:
>
> Thanks for your reply. However, it won't work in my situation since I'm
> developing a standalone SWT app. If there's a standalone jFace jar that
> I can distribute with my app, I'd be more than willing to use the
> ListViewer. Right now I'm working around it by calling a private method
> from within each method that makes a change to the items in the List.
>
> Dave

The JFace jar will run outside of eclipse, you can use them in a
stand-alone SWT app. You might have to copy the jars out of the eclipse
plugins directory, though.

Later,
PW


Re: Listen for items added to List [message #461584 is a reply to message #461084] Mon, 26 September 2005 22:37 Go to previous messageGo to next message
Steve Northover is currently offline Steve NorthoverFriend
Messages: 1636
Registered: July 2009
Senior Member
If you are adding the items to the list, can't you do the extra processing
you need at that time? (sorry, no idea what ListDataListener is)

"Dave" <fishnet37222@gmail.com> wrote in message
news:dgckfk$664$1@news.eclipse.org...
> Hello,
>
> I'm converting an application from Swing to SWT and I'm getting hung up
> on the fact that I can't seem to find an SWT alternative to the Swing
> ListDataListener. I need my application to be able to listen for items
> being added or removed from the list. Much thanks in advance.
>
> Dave
Re: Listen for items added to List [message #461695 is a reply to message #461584] Tue, 27 September 2005 12:02 Go to previous messageGo to next message
David Frischknecht is currently offline David FrischknechtFriend
Messages: 6
Registered: July 2009
Junior Member
Steve Northover wrote:
> If you are adding the items to the list, can't you do the extra processing
> you need at that time? (sorry, no idea what ListDataListener is)
>
> "Dave" <fishnet37222@gmail.com> wrote in message
> news:dgckfk$664$1@news.eclipse.org...
>
>>Hello,
>>
>>I'm converting an application from Swing to SWT and I'm getting hung up
>>on the fact that I can't seem to find an SWT alternative to the Swing
>>ListDataListener. I need my application to be able to listen for items
>>being added or removed from the list. Much thanks in advance.
>>
>>Dave
>
>
>

Steve,

In Swing, a ListDataListener is an interface that a class implements when it
wants to be notified of changes in a List's data items. Having a feature like
that in SWT would be more convenient since I'm changing the list's data items in
more than one place in my code. With a ListDataListener, all the processing for
changes in a List's data items takes place in one place.

Dave
Re: Listen for items added to List [message #462008 is a reply to message #461695] Wed, 05 October 2005 01:26 Go to previous message
Steve Northover is currently offline Steve NorthoverFriend
Messages: 1636
Registered: July 2009
Senior Member
Since SWT is a thin layer over the operating system and most operating
systems don't have this concept, I don't think we should add it. It should
be easy enough to change your code to go through a "create list item" method
that creates/configures it.

"Dave" <fishnet37222@gmail.com> wrote in message
news:dhbccq$8gu$1@news.eclipse.org...
> Steve Northover wrote:
> > If you are adding the items to the list, can't you do the extra
processing
> > you need at that time? (sorry, no idea what ListDataListener is)
> >
> > "Dave" <fishnet37222@gmail.com> wrote in message
> > news:dgckfk$664$1@news.eclipse.org...
> >
> >>Hello,
> >>
> >>I'm converting an application from Swing to SWT and I'm getting hung up
> >>on the fact that I can't seem to find an SWT alternative to the Swing
> >>ListDataListener. I need my application to be able to listen for items
> >>being added or removed from the list. Much thanks in advance.
> >>
> >>Dave
> >
> >
> >
>
> Steve,
>
> In Swing, a ListDataListener is an interface that a class implements when
it
> wants to be notified of changes in a List's data items. Having a feature
like
> that in SWT would be more convenient since I'm changing the list's data
items in
> more than one place in my code. With a ListDataListener, all the
processing for
> changes in a List's data items takes place in one place.
>
> Dave
Previous Topic:cant see Decorations borders in swt-gtk
Next Topic:Is this a SWT bug?
Goto Forum:
  


Current Time: Fri Mar 29 09:29:34 GMT 2024

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

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

Back to the top