Hyperlink as tableitem in jface/swt table [message #330028] |
Sun, 13 July 2008 14:12  |
Eclipse User |
|
|
|
Originally posted by: zee.ali.gmail.com
Hello,
I am trying to have one column of jface table as hyperlinks. I also
have 4 other columns of normal text strings using jface
columnlabelprovider to render the text on those columns.
One of the column which I want to display as hyperlink I dont use
ColumnLabelProvider for it, instead my columnlabelprovider just retruns
empty string for it. but I use the following way to insert hyperlinks
into it.
( in a for loop){
TableItem[] tableItems = table.getItems();//get tableItems
Hyperlink link = new Hyperlink(table, SWT.WRAP);
link.setText( some text);
TableEditor editor = new TableEditor(table);
editor.setEditor(link, tableItem[n], 0);//set hyperlinks in column 0
}
The issue with above approach is that if the width of hyperlink is
longer than the column it goes into next column. Where is the desired
behaviour is that it should show ellipsis(and tool tip of hidden text)
if it goes over the width of the column. Which is the normal behaviour
of other text string columns handled by jface columnlabelprovider.
The issue is that I couldnt find any jface interface for
columnlabelprovider which would return a widget instead of string for
its string getelement() method.
Any help would be greatly appreciated.
Thanks,
Zeeshan
|
|
|
|
|
|
|
|
Re: Hyperlink as tableitem in jface/swt table [message #330142 is a reply to message #330104] |
Wed, 16 July 2008 14:13  |
Eclipse User |
|
|
|
Originally posted by: zee.ali.gmail.com
It will be a while till I implement it, for now my manager is happy with
a workaround of resizing the table column, which I did, but once I have
time eventually I will have to try your suggestion. Could be few months
before I try your suggestion.
Tom Schindl wrote:
> If you have a small snippet I'd add it to our collection. It was not the
> first time this Hyperlink-Question was asked.
>
> Tom
>
> Zeeshan Ali schrieb:
>> Tom Schindl wrote:
>>> You should use an owner draw label provider and draw the text to look
>>> like a hyperlink [1] and act on the click event with a mouse-listener
>>> or create an editor.
>>>
>>> Tom
>>>
>>> [1] http://wiki.eclipse.org/JFaceSnippets#Snippet049StyledCellLa belProvider
>>>
>>>
>>> Zeeshan Ali schrieb:
>>>>
>>>> Hello,
>>>>
>>>> I am trying to have one column of jface table as hyperlinks. I also
>>>> have 4 other columns of normal text strings using jface
>>>> columnlabelprovider to render the text on those columns.
>>>>
>>>> One of the column which I want to display as hyperlink I dont use
>>>> ColumnLabelProvider for it, instead my columnlabelprovider just
>>>> retruns empty string for it. but I use the following way to insert
>>>> hyperlinks into it.
>>>>
>>>> ( in a for loop){
>>>>
>>>> TableItem[] tableItems = table.getItems();//get tableItems
>>>>
>>>> Hyperlink link = new Hyperlink(table, SWT.WRAP);
>>>>
>>>> link.setText( some text);
>>>>
>>>>
>>>> TableEditor editor = new TableEditor(table);
>>>> editor.setEditor(link, tableItem[n], 0);//set hyperlinks in column 0
>>>>
>>>> }
>>>>
>>>> The issue with above approach is that if the width of hyperlink is
>>>> longer than the column it goes into next column. Where is the
>>>> desired behaviour is that it should show ellipsis(and tool tip of
>>>> hidden text) if it goes over the width of the column. Which is the
>>>> normal behaviour of other text string columns handled by jface
>>>> columnlabelprovider.
>>>>
>>>> The issue is that I couldnt find any jface interface for
>>>> columnlabelprovider which would return a widget instead of string
>>>> for its string getelement() method.
>>>>
>>>> Any help would be greatly appreciated.
>>>>
>>>>
>>>> Thanks,
>>>>
>>>> Zeeshan
>>>
>>>
>>
>> Thanks for your reply/advice. I will try that and update this posting to
>> let everyone know how did that go.
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.07208 seconds