[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform.swt] Re: Trees and Tables

Hey Grant,

i dont know if my use case is compelling. I need it because i wrote a method which calculates the width of a table, then it calculates the minimum width of all columns and if there is space left, the columns will be enlarged proportionally. I want to use this method for my tables, as well as for my trees which also have some columns. In my method i need methods like getItemheight(), getColumn(index i), getHeaderText() and so on, and i saw that both controls have these methods but anyway i cant use it because the superclass composite doesnt have it. So i thought if the two controls have all these common methods it would make sense to introduce an interface or another superclass.

I solved my problem by creating a ColumnManager class which is subclassed by a TreeColumnManager and a TableColumnManager, but i thought i would make generally sense to introduce an interface.

Greetz
Thomas

Grant Gayed wrote:

Hi,

You aren't overlooking anything, the hierarchy is what it is.  I don't think
there was a specific reason, other than there not being a clear advantage to
them having a common supertype, since usually you know if you have a handle
to a Table vs. a Tree.  SWT does not generally implement extra
classes/interfaces like this, though there have been some requests in the
past for them.  I would suggest logging a Feature Request for this, but
based on previous ones I don't think it would be implemented.  Unless you
have a very compelling use case (?).

Grant