Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Trees and Tables
Trees and Tables [message #486282] Thu, 17 September 2009 06:59 Go to next message
T. Wilhelm is currently offline T. WilhelmFriend
Messages: 129
Registered: July 2009
Senior Member
Hey all,

i have a general question about Trees and Tables. I wondering why Trees
and Tables are derived from composite and do not have a common base (or
interface) class where methods like getItemHeight(), getHeaderHeight(),
getColumn() and so on are placed. In JFace i found a better structured
hierachy, because there is the
StructuredViewer->ColumnViewer->Table/TreeViewer.

Maybe i overlooked something? Or is there any good reason for that design?

Thanks alot
Thomas
Re: Trees and Tables [message #486412 is a reply to message #486282] Thu, 17 September 2009 14:19 Go to previous messageGo to next message
Grant Gayed is currently offline Grant GayedFriend
Messages: 2150
Registered: July 2009
Senior Member
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


"T. Wilhelm" <t.wilhelm@msh.de> wrote in message
news:dd9923ea4cf4a9c73867b0054da72eb7$1@www.eclipse.org...
> Hey all,
>
> i have a general question about Trees and Tables. I wondering why Trees
> and Tables are derived from composite and do not have a common base (or
> interface) class where methods like getItemHeight(), getHeaderHeight(),
> getColumn() and so on are placed. In JFace i found a better structured
> hierachy, because there is the
> StructuredViewer->ColumnViewer->Table/TreeViewer.
>
> Maybe i overlooked something? Or is there any good reason for that design?
>
> Thanks alot
> Thomas
>
Re: Trees and Tables [message #486536 is a reply to message #486412] Fri, 18 September 2009 05:33 Go to previous messageGo to next message
T. Wilhelm is currently offline T. WilhelmFriend
Messages: 129
Registered: July 2009
Senior Member
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
Re: Trees and Tables [message #486545 is a reply to message #486536] Fri, 18 September 2009 07:04 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
Is there a reason you are not using the JFace Table/Tree layout classes?

Tom

T. Wilhelm schrieb:
> 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
>
>
>
Re: Trees and Tables [message #486579 is a reply to message #486545] Fri, 18 September 2009 09:58 Go to previous messageGo to next message
T. Wilhelm is currently offline T. WilhelmFriend
Messages: 129
Registered: July 2009
Senior Member
There is a quite simple reason: I didnt know that they are exists :-) or
that they can help me with my use case. Are there snippets about that
topic?

What i want is that my columns are as large as my table, i dont like the
last empty column. Can this be down via the layout classes?

Thanks a lot
Thomas
Re: Trees and Tables [message #486580 is a reply to message #486579] Fri, 18 September 2009 10:03 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
http://wiki.eclipse.org/JFaceSnippets#Layout
T. Wilhelm schrieb:
> There is a quite simple reason: I didnt know that they are exists :-) or
> that they can help me with my use case. Are there snippets about that
> topic?
> What i want is that my columns are as large as my table, i dont like the
> last empty column. Can this be down via the layout classes?
>
> Thanks a lot
> Thomas
>
Re: Trees and Tables [message #486621 is a reply to message #486580] Fri, 18 September 2009 12:46 Go to previous messageGo to next message
T. Wilhelm is currently offline T. WilhelmFriend
Messages: 129
Registered: July 2009
Senior Member
Ok i looked at the snippets and found some interessting things.

Anyway i cant start any of the interessting snippets because i miss a
bunch of classes, i.e.

TableViewerFocusCellManager focusCellManager = new
TableViewerFocusCellManager(v,new CursorCellHighlighter(v,new
TableCursor(v)));

I cant get the CursorCellHighlighter class and the Tablecursor has
different constructors. So is there maybe a version problem? Or do i just
miss some bundles? I use Galileo 3.5.

Thanks alot
Greetz
Thomas
Re: Trees and Tables [message #486622 is a reply to message #486621] Fri, 18 September 2009 13:07 Go to previous messageGo to next message
Daniel Krügler is currently offline Daniel KrüglerFriend
Messages: 853
Registered: July 2009
Senior Member
T. Wilhelm wrote:
> Ok i looked at the snippets and found some interessting things.
> Anyway i cant start any of the interessting snippets because i miss a
> bunch of classes, i.e.
>
> TableViewerFocusCellManager focusCellManager = new
> TableViewerFocusCellManager(v,new CursorCellHighlighter(v,new
> TableCursor(v)));
>
> I cant get the CursorCellHighlighter class and the Tablecursor has
> different constructors. So is there maybe a version problem? Or do i
> just miss some bundles? I use Galileo 3.5.

I assume you have a Java project created that contains a copy of
this snippet. Now mark the project, select from the context menu
"Properties", select Java Build Path, Tab libraries, Select
external Libraries, browse to you Eclipse installation (if not
already there) and choose depending plug-in jars, You will
need several, e.g.

org.eclipse.swt_*
org.eclipse.swt_{os}* // {os} = win32, ...
org.eclipse.jface
org.eclipse.ui

and maybe some more. Personally I have usually also added

org.eclipse.core.commands
org.eclipse.core.databinding

as well. Now try to start and check for any errors, it may be
that still something is missing. If you don't know where this
entity belongs to, press Ctrl+Shift+T in Eclipse and check for
the type. If you have found it, you can either recognize from
the package name or by simply pressing the link button in
the Package Explorer which Plug-in Dependency it belongs to
and add this as library as well in the same manner as you did
it before.

HTH & Greetings from Bremen,

Daniel Krügler
Re: Trees and Tables [message #486636 is a reply to message #486621] Fri, 18 September 2009 13:16 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
T. Wilhelm schrieb:
> Ok i looked at the snippets and found some interessting things.
> Anyway i cant start any of the interessting snippets because i miss a
> bunch of classes, i.e.
>
> TableViewerFocusCellManager focusCellManager = new
> TableViewerFocusCellManager(v,new CursorCellHighlighter(v,new
> TableCursor(v)));
>

They are part of the snippets project. The best thing is to simply check
out the complete project from CVS.

Tom
Re: Trees and Tables [message #486637 is a reply to message #486622] Fri, 18 September 2009 13:16 Go to previous messageGo to next message
T. Wilhelm is currently offline T. WilhelmFriend
Messages: 129
Registered: July 2009
Senior Member
Hey,

oh everyone german in here ;-)

I created a Plugin Project, and everything works (so my imports are ok),
except the class "CursorCellHighlighter". In which bundle is it?

Second thing is the constructor of the class TableCursor(). I can only
find the constructor new TableCursor(Table parent, int style) and NOT new
TableCursor(Columnviewer v)

As dependencies i added the two bundles "org.eclipse.runtime" and
"org.eclipse.ui".

Greetz from Stuttgart
Thomas


Daniel Krügler wrote:



> I assume you have a Java project created that contains a copy of
> this snippet. Now mark the project, select from the context menu
> "Properties", select Java Build Path, Tab libraries, Select
> external Libraries, browse to you Eclipse installation (if not
> already there) and choose depending plug-in jars, You will
> need several, e.g.

> org.eclipse.swt_*
> org.eclipse.swt_{os}* // {os} = win32, ...
> org.eclipse.jface
> org.eclipse.ui

> and maybe some more. Personally I have usually also added

> org.eclipse.core.commands
> org.eclipse.core.databinding

> as well. Now try to start and check for any errors, it may be
> that still something is missing. If you don't know where this
> entity belongs to, press Ctrl+Shift+T in Eclipse and check for
> the type. If you have found it, you can either recognize from
> the package name or by simply pressing the link button in
> the Package Explorer which Plug-in Dependency it belongs to
> and add this as library as well in the same manner as you did
> it before.

> HTH & Greetings from Bremen,

> Daniel Krügler
Re: Trees and Tables [message #486638 is a reply to message #486636] Fri, 18 September 2009 13:19 Go to previous message
T. Wilhelm is currently offline T. WilhelmFriend
Messages: 129
Registered: July 2009
Senior Member
Oh ok,

thanks, too bad that i cannot check out from here :-( I dont know why, the
automatic updates works but if i try to check out a project from cvs i
cant connect to the cvs server. Maybe the firewall block it.

Anyway thanks Tom, and have a nice Weekend ;-)
Greetz
Thomas



> T. Wilhelm schrieb:
>> Ok i looked at the snippets and found some interessting things.
>> Anyway i cant start any of the interessting snippets because i miss a
>> bunch of classes, i.e.
>>
>> TableViewerFocusCellManager focusCellManager = new
>> TableViewerFocusCellManager(v,new CursorCellHighlighter(v,new
>> TableCursor(v)));
>>

> They are part of the snippets project. The best thing is to simply check
> out the complete project from CVS.

> Tom
Previous Topic:Using two foreground colors in Tree column
Next Topic:Treeviewer losing expand/collapse boxes when jarred
Goto Forum:
  


Current Time: Thu Mar 28 09:38:53 GMT 2024

Powered by FUDForum. Page generated in 0.04548 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top