Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » table viewer and possibility to change columns header
table viewer and possibility to change columns header [message #333671] Mon, 22 December 2008 15:22 Go to next message
Carmelo  is currently offline Carmelo Friend
Messages: 224
Registered: July 2009
Senior Member
Hi all,
I have got a table which displays a list of items ...

now I would like to re-use the same table to display list items of different
nature ...

I mean ...

table viewer 1 [ column A B C D E ]
table viewer 2 [ column E F G H ]

now what is the best approach to achieve this?
I can use different views and enable every time the one I need (but this
mean having double table, double provider(s))

is there anyway to change at runtime the table column header (sure the
providers could make the difference depending on the input element)

Thanks
Kar
Re: table viewer and possibility to change columns header [message #333690 is a reply to message #333671] Tue, 23 December 2008 14:39 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: eclipse-news.rizzoweb.com

On 12/22/2008 10:22 AM, Kar wrote:
> Hi all,
> I have got a table which displays a list of items ...
>
> now I would like to re-use the same table to display list items of
> different nature ...
>
> I mean ...
>
> table viewer 1 [ column A B C D E ]
> table viewer 2 [ column E F G H ]
>
> now what is the best approach to achieve this?
> I can use different views and enable every time the one I need (but this
> mean having double table, double provider(s))
>
> is there anyway to change at runtime the table column header (sure the
> providers could make the difference depending on the input element)

There is probably a way to to it by some column size manipulation (you
can "hide" a column by settings its size/width to 0), but I don't see a
compelling reason not to use two separate table viewers. There is really
no significant resource usage unless you have LOTS of viewers or LOTS of
rows or LOTS of columns (by LOTS I mean hundreds or thousands).
It really seems like a much simpler solution than trying to manipulate
the columns; I always strive for small, simple classes that do one thing
well, rather than complex ones that try to do a lot.

Hope this helps,
Eric
Re: table viewer and possibility to change columns header [message #333819 is a reply to message #333690] Wed, 07 January 2009 15:13 Go to previous messageGo to next message
Carmelo  is currently offline Carmelo Friend
Messages: 224
Registered: July 2009
Senior Member
Yes indeed ....
don't know why I was even trying to do this ...

one ore question ... what is the best layout to use for doing this kind of
replacement ...
I mean I need to have one container that will display the table and
depending on the event I have to switch to the second table ...

thanks


"Eric Rizzo" <eclipse-news@rizzoweb.com> wrote in message
news:giqt6i$7bi$1@build.eclipse.org...
> On 12/22/2008 10:22 AM, Kar wrote:
>> Hi all,
>> I have got a table which displays a list of items ...
>>
>> now I would like to re-use the same table to display list items of
>> different nature ...
>>
>> I mean ...
>>
>> table viewer 1 [ column A B C D E ]
>> table viewer 2 [ column E F G H ]
>>
>> now what is the best approach to achieve this?
>> I can use different views and enable every time the one I need (but this
>> mean having double table, double provider(s))
>>
>> is there anyway to change at runtime the table column header (sure the
>> providers could make the difference depending on the input element)
>
> There is probably a way to to it by some column size manipulation (you can
> "hide" a column by settings its size/width to 0), but I don't see a
> compelling reason not to use two separate table viewers. There is really
> no significant resource usage unless you have LOTS of viewers or LOTS of
> rows or LOTS of columns (by LOTS I mean hundreds or thousands).
> It really seems like a much simpler solution than trying to manipulate the
> columns; I always strive for small, simple classes that do one thing well,
> rather than complex ones that try to do a lot.
>
> Hope this helps,
> Eric
Re: table viewer and possibility to change columns header [message #333832 is a reply to message #333819] Wed, 07 January 2009 22:11 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: eclipse-news.rizzoweb.com

On 1/7/2009 10:13 AM, Kar wrote:
> Yes indeed ....
> don't know why I was even trying to do this ...
>
> one ore question ... what is the best layout to use for doing this kind
> of replacement ...
> I mean I need to have one container that will display the table and
> depending on the event I have to switch to the second table ...

org.eclipse.swt.custom.StackLayout is exactly what you want. See the
example code in the class Javadoc.

Hope this helps,
Eric



> "Eric Rizzo" <eclipse-news@rizzoweb.com> wrote in message
> news:giqt6i$7bi$1@build.eclipse.org...
>> On 12/22/2008 10:22 AM, Kar wrote:
>>> Hi all,
>>> I have got a table which displays a list of items ...
>>>
>>> now I would like to re-use the same table to display list items of
>>> different nature ...
>>>
>>> I mean ...
>>>
>>> table viewer 1 [ column A B C D E ]
>>> table viewer 2 [ column E F G H ]
>>>
>>> now what is the best approach to achieve this?
>>> I can use different views and enable every time the one I need (but this
>>> mean having double table, double provider(s))
>>>
>>> is there anyway to change at runtime the table column header (sure the
>>> providers could make the difference depending on the input element)
>>
>> There is probably a way to to it by some column size manipulation (you
>> can "hide" a column by settings its size/width to 0), but I don't see
>> a compelling reason not to use two separate table viewers. There is
>> really no significant resource usage unless you have LOTS of viewers
>> or LOTS of rows or LOTS of columns (by LOTS I mean hundreds or
>> thousands).
>> It really seems like a much simpler solution than trying to manipulate
>> the columns; I always strive for small, simple classes that do one
>> thing well, rather than complex ones that try to do a lot.
>>
>> Hope this helps,
>> Eric
>
Re: table viewer and possibility to change columns header [message #333839 is a reply to message #333832] Thu, 08 January 2009 09:45 Go to previous message
Carmelo  is currently offline Carmelo Friend
Messages: 224
Registered: July 2009
Senior Member
Thanks Eric
:-)

"Eric Rizzo" <eclipse-news@rizzoweb.com> wrote in message
news:gk39b7$jsp$1@build.eclipse.org...
> On 1/7/2009 10:13 AM, Kar wrote:
>> Yes indeed ....
>> don't know why I was even trying to do this ...
>>
>> one ore question ... what is the best layout to use for doing this kind
>> of replacement ...
>> I mean I need to have one container that will display the table and
>> depending on the event I have to switch to the second table ...
>
> org.eclipse.swt.custom.StackLayout is exactly what you want. See the
> example code in the class Javadoc.
>
> Hope this helps,
> Eric
>
>
>
>> "Eric Rizzo" <eclipse-news@rizzoweb.com> wrote in message
>> news:giqt6i$7bi$1@build.eclipse.org...
>>> On 12/22/2008 10:22 AM, Kar wrote:
>>>> Hi all,
>>>> I have got a table which displays a list of items ...
>>>>
>>>> now I would like to re-use the same table to display list items of
>>>> different nature ...
>>>>
>>>> I mean ...
>>>>
>>>> table viewer 1 [ column A B C D E ]
>>>> table viewer 2 [ column E F G H ]
>>>>
>>>> now what is the best approach to achieve this?
>>>> I can use different views and enable every time the one I need (but
>>>> this
>>>> mean having double table, double provider(s))
>>>>
>>>> is there anyway to change at runtime the table column header (sure the
>>>> providers could make the difference depending on the input element)
>>>
>>> There is probably a way to to it by some column size manipulation (you
>>> can "hide" a column by settings its size/width to 0), but I don't see
>>> a compelling reason not to use two separate table viewers. There is
>>> really no significant resource usage unless you have LOTS of viewers
>>> or LOTS of rows or LOTS of columns (by LOTS I mean hundreds or
>>> thousands).
>>> It really seems like a much simpler solution than trying to manipulate
>>> the columns; I always strive for small, simple classes that do one
>>> thing well, rather than complex ones that try to do a lot.
>>>
>>> Hope this helps,
>>> Eric
>>
>
Previous Topic:AssertionFailedException in editor
Next Topic:Avoid two scroll bars in Editor
Goto Forum:
  


Current Time: Fri Apr 26 04:52:22 GMT 2024

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

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

Back to the top