Best practices for notifications [message #327633] |
Sun, 27 April 2008 18:27 ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Fabio M![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=fabio.mancinelli%40gmail.com) Messages: 25 Registered: July 2009 |
Junior Member |
|
|
Dear all,
I was wondering what is the best way to implement this use case, and if
the Eclipse platform already provides an implementation. The use case is
simple: I would like to have some kind of notifications that trigger
platform UI elements refreshing.
For example, imagine a view that contains a list of defined
"connections" to a server. These connection can be in an online/offline
state, each one corresponding to a different rendering: online
connections have bold text, offline connections are grayed for example.
Now when the connection state changes, I would like all the UI elements
that show "connections" to refresh the connection that changed its state
in order to be in synch with the graphical representation.
I did this by implementing a "notification center" for my application,
with (custom) listeners and events. I subscribe the UI elements as
listeners to this center and I handle notifications, for example by
refreshing the item corresponding to the connection when a state change
event is received.
Of course this works, but I was wondering if Eclipse already provides an
infrastructure for handling custom events and notifications. Something
like selection changes but for things that are not selections :) I have
the impression of having re-invented the wheel and maybe I just didn't
notice what is already available at the platform level.
Thanks,
Fabio
|
|
|
Re: Best practices for notifications [message #327658 is a reply to message #327633] |
Mon, 28 April 2008 11:54 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Originally posted by: merks.ca.ibm.com
Fabio,
Probably the closest corresponding thing in the platform is the data
binding frameworks in JFace. Certainly label providers support the
receiving end of the notifications though not the producing end, which
is done by your model itself. EMF-based models produce notifications
when they change, so it provides all the things you've described.
Fabio Mancinelli wrote:
> Dear all,
>
> I was wondering what is the best way to implement this use case, and
> if the Eclipse platform already provides an implementation. The use
> case is simple: I would like to have some kind of notifications that
> trigger platform UI elements refreshing.
>
> For example, imagine a view that contains a list of defined
> "connections" to a server. These connection can be in an
> online/offline state, each one corresponding to a different rendering:
> online connections have bold text, offline connections are grayed for
> example.
>
> Now when the connection state changes, I would like all the UI
> elements that show "connections" to refresh the connection that
> changed its state in order to be in synch with the graphical
> representation.
>
> I did this by implementing a "notification center" for my application,
> with (custom) listeners and events. I subscribe the UI elements as
> listeners to this center and I handle notifications, for example by
> refreshing the item corresponding to the connection when a state
> change event is received.
>
> Of course this works, but I was wondering if Eclipse already provides
> an infrastructure for handling custom events and notifications.
> Something like selection changes but for things that are not
> selections :) I have the impression of having re-invented the wheel
> and maybe I just didn't notice what is already available at the
> platform level.
>
> Thanks,
> Fabio
|
|
|
Powered by
FUDForum. Page generated in 0.05399 seconds