Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » using a hyperlink with a Table/TableViewer/TreeViewer - options and performance
using a hyperlink with a Table/TableViewer/TreeViewer - options and performance [message #310469] Tue, 05 December 2006 00:31 Go to next message
Eclipse UserFriend
I'm writing a search facility for my product. When searching, it's
possible for hundreds of results to be returned. Each result is shown
as a table row with up to 3 links in it (to various levels of the
hierarchy representing the result). The table is shown through a dialog
of a few rows.

Previously this all worked fine (except without the hyperlinks) by
having a TableViewer. The scrolling and resizing was fast, even if
there were thousands of results.

Now I'm trying to add the links. I see the following options:

1) Using a plain Table with a TableEditor (which refers to a Link
control). This worked reasonably well, except for performance. It's
unusable with more than a small number of rows. There is also this bug:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=166720

So this option won't work (unless I'm doing it wrong or there is another
way to do it).

2) TableViewer - I don't think it's possible to have an arbitrary
control for rendering a table cell in use with a TableViewer unless I
subclass it. Creating a CellEditor does no good, as this replaces the
control only when the cell is edited.

My next step is to consider subclassing TableViewer and having it use a
TableEditor referring to a Link, however, I'm concerned I will run into
the same issues I have with option 1.

3) Use a TreeViewer. The search results can be represented as a tree,
where each node then has only one link in it. I have not looked into
this, but I would assume I will have to subclass TreeViewer as in option
2 to have it render a Link.

Are there other options? Am I missing something obvious?

TIA,

Francis
Re: using a hyperlink with a Table/TableViewer/TreeViewer - options and performance [message #310470 is a reply to message #310469] Tue, 05 December 2006 02:54 Go to previous messageGo to next message
Eclipse UserFriend
Francis Upton schrieb:
> I'm writing a search facility for my product. When searching, it's
> possible for hundreds of results to be returned. Each result is shown
> as a table row with up to 3 links in it (to various levels of the
> hierarchy representing the result). The table is shown through a dialog
> of a few rows.
>
> Previously this all worked fine (except without the hyperlinks) by
> having a TableViewer. The scrolling and resizing was fast, even if
> there were thousands of results.
>
> Now I'm trying to add the links. I see the following options:
>
> 1) Using a plain Table with a TableEditor (which refers to a Link
> control). This worked reasonably well, except for performance. It's
> unusable with more than a small number of rows. There is also this bug:
>
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=166720
>
> So this option won't work (unless I'm doing it wrong or there is another
> way to do it).
>

Well if you really have so many results that's a problem because your
Table has to handle very many Widgets whereas is in TableViewer there
aren't hardly any!

> 2) TableViewer - I don't think it's possible to have an arbitrary
> control for rendering a table cell in use with a TableViewer unless I
> subclass it. Creating a CellEditor does no good, as this replaces the
> control only when the cell is edited.
>
> My next step is to consider subclassing TableViewer and having it use a
> TableEditor referring to a Link, however, I'm concerned I will run into
> the same issues I have with option 1.
>

Why does it have to be a TableEditor. You could make the String look
like a link (underlining maybe is a problem but you can resolve it using
custom drawing).

To change the foreground color ITableColorProvider and to underline an
item you can look at the owner draw support:

Owner Draw is shown in:
- http://www.eclipse.org/swt/snippets/
-
http://www.eclipse.org/articles/Article-CustomDrawingTableAn dTreeItems/customDraw.htm

If you want to open a link when the user clicks one of the emulated
links you only need to track mouse clicks on your like shown in this
snippet.

http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/org. eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet110 .java

If you are using 3.3 for development and there is/will be a bunch of new
API which make all the above fairly easy.

OwnerDraw:
http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jface.s nippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippet s/viewers/Snippet010OwnerDraw.java?rev=HEAD&content-type =text/vnd.viewcvs-markup
(broken if you run it against current CVS)
CellSelection:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=151377

> 3) Use a TreeViewer. The search results can be represented as a tree,
> where each node then has only one link in it. I have not looked into
> this, but I would assume I will have to subclass TreeViewer as in option
> 2 to have it render a Link.
>
> Are there other options? Am I missing something obvious?
>

The same as for TableViewer.

> TIA,
>
> Francis
Re: using a hyperlink with a Table/TableViewer/TreeViewer - options and performance [message #310472 is a reply to message #310470] Tue, 05 December 2006 04:19 Go to previous messageGo to next message
Eclipse UserFriend
Thanks Tom, I was thinking along the lines you suggested. I will make a
link by changing the color and drawing a line using owner draw.

I decided to handle the clicking by just responding to the selection
event on the TableViewer (thus allowing keyboard selection).

It would be nice if there was a simpler way to include links using the
Viewers, since the TableEditor solution is so impractical.

Thanks again for your help!

Francis

Tom Schindl wrote:
> Francis Upton schrieb:
>> I'm writing a search facility for my product. When searching, it's
>> possible for hundreds of results to be returned. Each result is shown
>> as a table row with up to 3 links in it (to various levels of the
>> hierarchy representing the result). The table is shown through a dialog
>> of a few rows.
>>
>> Previously this all worked fine (except without the hyperlinks) by
>> having a TableViewer. The scrolling and resizing was fast, even if
>> there were thousands of results.
>>
>> Now I'm trying to add the links. I see the following options:
>>
>> 1) Using a plain Table with a TableEditor (which refers to a Link
>> control). This worked reasonably well, except for performance. It's
>> unusable with more than a small number of rows. There is also this bug:
>>
>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=166720
>>
>> So this option won't work (unless I'm doing it wrong or there is another
>> way to do it).
>>
>
> Well if you really have so many results that's a problem because your
> Table has to handle very many Widgets whereas is in TableViewer there
> aren't hardly any!
>
>> 2) TableViewer - I don't think it's possible to have an arbitrary
>> control for rendering a table cell in use with a TableViewer unless I
>> subclass it. Creating a CellEditor does no good, as this replaces the
>> control only when the cell is edited.
>>
>> My next step is to consider subclassing TableViewer and having it use a
>> TableEditor referring to a Link, however, I'm concerned I will run into
>> the same issues I have with option 1.
>>
>
> Why does it have to be a TableEditor. You could make the String look
> like a link (underlining maybe is a problem but you can resolve it using
> custom drawing).
>
> To change the foreground color ITableColorProvider and to underline an
> item you can look at the owner draw support:
>
> Owner Draw is shown in:
> - http://www.eclipse.org/swt/snippets/
> -
> http://www.eclipse.org/articles/Article-CustomDrawingTableAn dTreeItems/customDraw.htm
>
> If you want to open a link when the user clicks one of the emulated
> links you only need to track mouse clicks on your like shown in this
> snippet.
>
> http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/org. eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet110 .java
>
> If you are using 3.3 for development and there is/will be a bunch of new
> API which make all the above fairly easy.
>
> OwnerDraw:
> http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jface.s nippets/Eclipse%20JFace%20Snippets/org/eclipse/jface/snippet s/viewers/Snippet010OwnerDraw.java?rev=HEAD&content-type =text/vnd.viewcvs-markup
> (broken if you run it against current CVS)
> CellSelection:
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=151377
>
>> 3) Use a TreeViewer. The search results can be represented as a tree,
>> where each node then has only one link in it. I have not looked into
>> this, but I would assume I will have to subclass TreeViewer as in option
>> 2 to have it render a Link.
>>
>> Are there other options? Am I missing something obvious?
>>
>
> The same as for TableViewer.
>
>> TIA,
>>
>> Francis
Re: using a hyperlink with a Table/TableViewer/TreeViewer - options and performance [message #310474 is a reply to message #310472] Tue, 05 December 2006 04:38 Go to previous messageGo to next message
Eclipse UserFriend
Francis Upton schrieb:
> Thanks Tom, I was thinking along the lines you suggested. I will make a
> link by changing the color and drawing a line using owner draw.
>
> I decided to handle the clicking by just responding to the selection
> event on the TableViewer (thus allowing keyboard selection).
>

Well but if you have 3 different links in one line where from you know
which of the links has been clicker?

And once more in 3.3 we will add API for the Keyboard Navigation and
CellSelections using the API mentionned in bug 151377. I expect to have
the whole stuff integrate in M5
(https://bugs.eclipse.org/bugs/show_bug.cgi?id=151295).


> It would be nice if there was a simpler way to include links using the
> Viewers, since the TableEditor solution is so impractical.
>
> Thanks again for your help!

The problem with Links and other Widgets is that as you discovered the
performance impact for big tables is very high.

The corresponding feature request is:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=36977

To solve the performance impact we need to provide some logic to only
keep the widgets who are visible. If you want a Table holding native
widgets I can point you to the nebula project which provides a control
called CompositeTable which works with native widgets and has the great
advantage that it holds the logic to only create/hold as many widgets it
needs to fill the table area. I think you need to check it out from the
CVS-Repository.

Tom
Re: using a hyperlink with a Table/TableViewer/TreeViewer - options and performance [message #310475 is a reply to message #310474] Tue, 05 December 2006 05:48 Go to previous message
Eclipse UserFriend
Tom Schindl wrote:

>
> Well but if you have 3 different links in one line where from you know
> which of the links has been clicker?

I decided to abandon this part of the requirement, so I will treat the
entire row as a single link (to the lowest level item). In my product,
it's easy to get to the higher level items through other means.

>
> And once more in 3.3 we will add API for the Keyboard Navigation and
> CellSelections using the API mentionned in bug 151377. I expect to have
> the whole stuff integrate in M5
> (https://bugs.eclipse.org/bugs/show_bug.cgi?id=151295).

This will help helpful when I provide complete keyboard support (and go
up to 3.3).

>

> The corresponding feature request is:
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=36977

Thanks for this, this made interesting reading; for a link in
particular, it's important to give a native look and feel for visual
niceness. My drawing the underline trick will not look the same as true
underlined text.

>
> To solve the performance impact we need to provide some logic to only
> keep the widgets who are visible. If you want a Table holding native
> widgets I can point you to the nebula project which provides a control
> called CompositeTable which works with native widgets and has the great
> advantage that it holds the logic to only create/hold as many widgets it
> needs to fill the table area. I think you need to check it out from the
> CVS-Repository.

Somehow, I thought this was the point of the Viewers, to only add
underlying Tree/TableItems as they are needed. Of course, I think the
implementation keeps them once they are initially added. It would be
nice to have them go away when they are not needed.

The CompositeTable will be an SWT-level component then? So this goes
along way in solving 36977, at least for tables.

I will have a look at this, thanks.

Francis
Previous Topic:Eclipse 3.1.1 and jbosside building workspace problems
Next Topic:3.02 plugin versions
Goto Forum:
  


Current Time: Sun Jun 01 16:00:52 EDT 2025

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

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

Back to the top