W
Will
Michael Rauscher wrote on April 29, 2004 (as part of a very helpful
post clarifying the difference between client properties and bound
properties):
First of all, thank you for the helpful post -- I'm sorry I missed it
when you originally wrote it, but as far as showing appreciation,
better late than never.
I now have a question about style. If I have an object, let's say,
SpaceShip, with a number of properties, such as power, heading,
location, etc., which are displayed by my UI, and I want the display
updated each time those attributes are updated, is it stylistically OK
to add PropertyChangeSupport to my SpaceShip class, and have the UI
respond to PropertyChangeEvents or would this violate object-oriented
programming principles? (I'm not so conversant with OOP lingo, so I
can't name the principle; it just feels off, somehow.)
Thanks again,
Will
post clarifying the difference between client properties and bound
properties):
The font property e.g. is a so called "bound property". A bound property
is a property that fires PropertyChangeEvents whenever its value is
changed. Class java.beans.PropertyChangeSupport may be used to support
bound properties in your bean.
First of all, thank you for the helpful post -- I'm sorry I missed it
when you originally wrote it, but as far as showing appreciation,
better late than never.
I now have a question about style. If I have an object, let's say,
SpaceShip, with a number of properties, such as power, heading,
location, etc., which are displayed by my UI, and I want the display
updated each time those attributes are updated, is it stylistically OK
to add PropertyChangeSupport to my SpaceShip class, and have the UI
respond to PropertyChangeEvents or would this violate object-oriented
programming principles? (I'm not so conversant with OOP lingo, so I
can't name the principle; it just feels off, somehow.)
Thanks again,
Will