Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > PropertyChangeListener for non gui objects

Reply
Thread Tools

PropertyChangeListener for non gui objects

 
 
-
Guest
Posts: n/a
 
      07-19-2005
I have several non gui objects that has addPropertyChangeListener,
removePropertyChangeListeners and the various fire event methods.

Since there are duplicate codes, is it better if i pull up those methods
into a base class and have the non gui objects extend it?
 
Reply With Quote
 
 
 
 
Thomas Hawtin
Guest
Posts: n/a
 
      07-19-2005
- wrote:
> I have several non gui objects that has addPropertyChangeListener,
> removePropertyChangeListeners and the various fire event methods.
>
> Since there are duplicate codes, is it better if i pull up those methods
> into a base class and have the non gui objects extend it?


Possibly, but you might want to use the single inheritance for something
else. In that case I suggest introducing a support class and just
forward those two methods.

Tom Hawtin
--
Unemployed English Java programmer
 
Reply With Quote
 
 
 
 
-
Guest
Posts: n/a
 
      07-20-2005
Thomas Hawtin wrote:

> Possibly, but you might want to use the single inheritance for something
> else. In that case I suggest introducing a support class and just
> forward those two methods.


I can use the PropertyChangeSupport class and adopt the composition
pattern but isn't doing so seems like duplicating code which can be
solved by inheritance? In this case, is the duplicating of code a minor
issue since composition is more favored than inheritance?
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
PropertyChangeListener error. Don't get it? michael.rygh@gmail.com Java 2 12-12-2005 09:20 PM
GUI and non-GUI data Hal Fulton Ruby 1 08-05-2004 08:42 PM
Followup: PropertyChangeListener not recognizing changes to a putClientProperty Will Java 1 06-10-2004 06:39 PM
PropertyChangeListener not recognizing changes to a putClientProperty Will Java 3 04-29-2004 05:33 PM
Jython + propertyChangeListener?!?! Matt Newcomb Python 0 07-29-2003 05:49 PM



Advertisments