craftleft.gif (3002 bytes)QuickTable
Home | API | Tutorial | Download | Support | Contact topblack.gif (108 bytes)


QuickTable User Cp  |  Register  |  Members  |  Search  |  Help
    |- QuickTable Discussion Forums > Events/Actions Post New Topic   Post A Reply
Events in QuickTable (Class instead Interface) printer friendly version
next newest post | next oldest post
Author Messages
brunorobertson
Unregistered
Edit or delete this message Reply w/Quote
Posted Monday, March 26, 2007 @ 22:43:51  

Hi,

I have a question: Why your events aren't interfaces? They are all Classes.
IMHO is better to create a simple couple of class and interfaces and use the ACTUAL classes as implementation of the interface. This will allow us to create one unique class to perfor any event within the table. (Its only a suggestion, if have any restrictions do do it, please let me know).

For example:

For the "DatabaseChangeListener" class:

My Suggestion is that this class should be an Interface:

public interface DatabaseChangeListener {
void afterDelete(int row) ;

...other methods

}
And you have an ADAPTER class that is the same class used today:

public class DatabaseChangeAdapter implements DatabaseChangeListener {
here goes the same code as your DatabaseChangeListener CLASS today.
}

This is only a suggestion and is a Standard way that java uses this kind of components (patterns).

This will allow people to have one class only and implements all the table interface events!!! That will be great.

For now, How can I have in one class various events for the table? Like DatabaseChangeListener and DBTableEventListener

Thanks a lot!!

i hope that my suggestion could be useful.

Bruno

Admin
Board Owner

Gender: Unspecified
Location:
Registered: Jul 2003
Status: Offline
Posts: 9

Click here to see the profile for Admin Send email to Admin Send private message to Admin Find more posts by Admin Edit or delete this message Reply w/Quote
Posted Tuesday, March 27, 2007 @ 15:52:31  

The main reason to have classes instead of interface is to minimize the number of methods you need to implement when you create your implementation. If you are interested in afterDelete() only, then no need to implement all the unnecessary other methods.

Your idea to have interface and adaptor is also good one. Simplicity is the goal behind quicktable. You are the first one to ask this feature, If we get this request from many developers we will definitely add this feature.

brunorobertson
Unregistered
Edit or delete this message Reply w/Quote
Posted Tuesday, March 27, 2007 @ 23:18:20  

Ok no problem. Thanks for attention.

I am asking because you cant extends two classes at same time...but you can implement as many interfaces as needed...

An adapter class is very simple to create and configure...and you could do it whitouht affect code change...

Is like the MouseAdapter..Java has a lot of Adapter class to do what you saw...

Exatcly: You dont need to implement a lot of method, just overload whatever you want.

Again, thanks for your attention...

Bruno

optotronic
Unregistered
Edit or delete this message Reply w/Quote
Posted Friday, March 19, 2010 @ 08:11:06  

Consider this another vote for implementing the events as interfaces. As Bruno noted, you could keep your existing classes as implementations of the interfaces, so I think this would have no impact on existing users.
Post New Topic   Post A Reply Jump to:
Contact Us | QuickTable - A Java DBGrid | Privacy Policy All times are GMT -5 Hours.
Welcome to QuickTable Forums, Guest!  
Login
Username :
Password :
In order to fully utilize the abilities of this board, you are required to register as a member. Registration is free, and allows you to do lots of things including turning on or off certain features of this board. Register now!
Powered by CuteCast v2.0 BETA 2
Copyright © 2001-2003 ArtsCore Studios