[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform] Re: Can the FilteredList have columns?

On 2/16/2009 6:42 PM, Wendell Beckwith wrote:
Well mainly we are porting a Swing UI which has a table with a text
field that filters the table entries as the user types in it. Exactly
what the FilteredList and FilteredTree do. The only difference between
the 2 is that our current UI element actually has several columns. Plus
the FilteredList/Tree classes have UI enhancements to clear the text
control, etc.

While we could try and concatenate the column strings into a single line
of text to be included in the FilteredList, the info likely will not
line up as nicely as in table columns proper. We could also create our
own composite with a text control and a tableviewer, but we was hoping
to reuse and customize the FilteredList class if possible. No need to
suffer from NIH if we don't have to.

Ah, FilteredTree is your key then. A TreeViewer can actually have multiple columns. Again, have a look at the JFace Snippets, in particular this one (I think) demonstrates a tree with multiple columns: http://wiki.eclipse.org/index.php/JFaceSnippets#Snippet027TreeLayout


In general, keep in mind that TreeViewer and TableViewer are VERY similar and share the same inheritance hierarchy.

That should get you pretty close to what you want, although I'm not certain about column-based sorting on a tree (I've only done it for a TableViewer).

Eric



Eric Rizzo wrote:
On 2/16/2009 4:00 PM, Wendell Beckwith wrote:
The FilteredList class seems to be what I need from a UI since, however,
I need several columns to be a part of the list with the associated
sorting by column. Is this class extensible in this way or via
subclassing or am I looking at creating a new Composite with the same
behavior?

Any reason you can not use a TableViewer instead? It extends StructuredViewer which supports filtering and column-based sorting. See this snippet for example: http://wiki.eclipse.org/index.php/JFaceSnippets#Snippet040TableViewerSorting


Hope this helps, Eric