Can the FilteredList have columns? [message #334538] |
Mon, 16 February 2009 16:00  |
Eclipse User |
|
|
|
Originally posted by: wbeckwith.gmail.com
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?
Wb
|
|
|
|
|
Re: Can the FilteredList have columns? [message #334553 is a reply to message #334543] |
Tue, 17 February 2009 10:56   |
Eclipse User |
|
|
|
Originally posted by: eclipse-news.rizzoweb.com
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#Snippet027Tr eeLayout
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#Snippet040Ta bleViewerSorting
>>
>>
>> Hope this helps,
>> Eric
|
|
|
Re: Can the FilteredList have columns? [message #334809 is a reply to message #334553] |
Fri, 27 February 2009 18:57  |
Eclipse User |
|
|
|
Originally posted by: wbeckwith.gmail.com
Thanks for the help, I was able to get the FilteredTree to work with a
few caveats. 1st, I had to create my own FilteredTreeColumnLayout class
and add a "Tree getTree(Scrollable)" method since the takes a
scrollable and always casts it to a Tree, but it the Scrollable is a
FilteredTree then we need to get the Tree from that composite and return
that. I'll see about submitting a patch. The other caveat is that even
though I was using the FilteredTree as a list with no children the 1st
column had space reserved for the toggle handles which made the strings
look centered.
I'll look at the FilteredList next to see if I can make a similar change
to remove the 2nd caveat. Otherwise it was/is working fine.
Wb
Eric Rizzo wrote:
> 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#Snippet027Tr eeLayout
>
> 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#Snippet040Ta bleViewerSorting
>>>
>>>
>>>
>>> Hope this helps,
>>> Eric
>
|
|
|
Powered by
FUDForum. Page generated in 0.06440 seconds