Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » TableViewer Column resized event
TableViewer Column resized event [message #510173] Tue, 26 January 2010 15:46 Go to next message
Edin Edin is currently offline Edin EdinFriend
Messages: 101
Registered: January 2010
Senior Member
Hi, is there any way to listen to a TableColumn of a TableViewer to get informed if the size has changed?

have placed some textfields over the TableViewer and want to resize them when size of the tableviewer columns have changed.

Well what i actually need are the bounds of the table header fields, for each one. so when some of them resize, i want to resize the textfield

THx

[Updated on: Tue, 26 January 2010 16:07]

Report message to a moderator

Re: TableViewer Column resized event [message #510190 is a reply to message #510173] Tue, 26 January 2010 16:08 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 1854
Registered: July 2009
Senior Member
Hi,

you can use TableColumn#addControlListener for listening of column
resize event.

HTH,
Ivan

On 1/26/2010 5:46 PM, ededagic wrote:
> Hi, is there any way to listen to a TableColumn of a TableViewer to
> get informed if the size has changed?
>
> have placed some textfields over the TableViewer and want to resize
> them when size of the tableviewer columns have changed.
>
> THx
Re: TableViewer Column resized event [message #510257 is a reply to message #510190] Tue, 26 January 2010 23:24 Go to previous messageGo to next message
Edin Edin is currently offline Edin EdinFriend
Messages: 101
Registered: January 2010
Senior Member
Thx,

but is there any way to find to get the bounds of the TableColum? or at least the x coordinate of a column ? i want to place exactly over each column search text fields and they should reisze together with the corresponding column. only value that i can get from the TableColum is width, but i need the x position after the column is resized. Or do you know another way to realize that ?

Thx, Edin
Re: TableViewer Column resized event [message #510310 is a reply to message #510257] Wed, 27 January 2010 08:14 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 1854
Registered: July 2009
Senior Member
Hi Edin,

you have to calculate the x position of the column yourself - see
TableColumn#getLeft.

HTH,
Ivan

On 1/27/2010 1:24 AM, ededagic wrote:
> Thx,
>
> but is there any way to find to get the bounds of the TableColum? or
> at least the x coordinate of a column ? i want to place exactly over
> each column search text fields and they should reisze together with
> the corresponding column. only value that i can get from the
> TableColum is width, but i need the x position after the column is
> resized. Or do you know another way to realize that ?
>
> Thx, Edin
Re: TableViewer Column resized event [message #510321 is a reply to message #510310] Wed, 27 January 2010 09:20 Go to previous messageGo to next message
Edin Edin is currently offline Edin EdinFriend
Messages: 101
Registered: January 2010
Senior Member
Hi, Ivan

there is no getLeft method for the TableColumn class. Do you think about this one? http://help.eclipse.org/help32/index.jsp?topic=/org.eclipse. platform.doc.isv/reference/api/org/eclipse/swt/widgets/Table Column.html
That is the class that im using. Do i have to cast it to some other class?

THx, Edin
Re: TableViewer Column resized event [message #510342 is a reply to message #510321] Wed, 27 January 2010 10:22 Go to previous messageGo to next message
Edin Edin is currently offline Edin EdinFriend
Messages: 101
Registered: January 2010
Senior Member
i solved it, i hold the first item of the table, then i use the get bounds(int i) method on it to get the rectangle for the cell at that position and then i take my x, y, width, height whatever.

Thx, Edin
Re: TableViewer Column resized event [message #510355 is a reply to message #510321] Wed, 27 January 2010 10:24 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 1854
Registered: July 2009
Senior Member
Hi Edin,

I'm speeking about RAP class TableColumn... and its private method
getLeft(). You can do it in a similar way in your code.
-----
final int getLeft() {
int result = 0;
TableColumn[] columns = parent.getColumns();
int[] columnOrder = parent.getColumnOrder();
int orderedIndex = -1;
for( int i = 0; orderedIndex == -1 && i < columnOrder.length; i++ ) {
if( columnOrder[ i ] == parent.indexOf( this ) ) {
orderedIndex = i;
}
}
for( int i = 0; i < orderedIndex; i++ ) {
result += columns[ columnOrder[ i ] ].getWidth();
}
return result;
}
------

Best,
Ivan

On 1/27/2010 11:20 AM, ededagic wrote:
> Hi, Ivan
>
> there is no getLeft method for the TableColumn class. Do you think
> about this one?
> http://help.eclipse.org/help32/index.jsp?topic=/org.eclipse. platform.doc.isv/reference/api/org/eclipse/swt/widgets/Table Column.html
>
> That is the class that im using. Do i have to cast it to some other
> class?
>
> THx, Edin
Re: TableViewer Column resized event [message #559746 is a reply to message #510355] Fri, 17 September 2010 20:37 Go to previous messageGo to next message
Jatin is currently offline JatinFriend
Messages: 7
Registered: April 2010
Location: United States
Junior Member
Hi Ivan

Could you elaborate more on getLeft() implementation. I don't see parent(Table).indexOf() method. I need to compute bounds for a clicked TableColumn() in a Table.

Thanks
Jatin Vasa
Re: TableViewer Column resized event [message #559870 is a reply to message #510173] Mon, 20 September 2010 07:44 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 1854
Registered: July 2009
Senior Member
Hi Jatin,
Table class has a public method indexOf( TableColumn).
Best,
Ivan
Re: TableViewer Column resized event [message #775077 is a reply to message #559870] Thu, 05 January 2012 09:36 Go to previous message
Edin Edin is currently offline Edin EdinFriend
Messages: 101
Registered: January 2010
Senior Member
Hey guys, thnx for your help,

that is exactly what im looking for (overview and posibillity to see how the actual default theme is defined). Anyway, when i try to change Menu element, it has no effect for me. It stays gray. Im actually working with standalone version of RAP 1.5. so i have to create the shell on my own, and then add Menu instance. The MenuItems are correctly changed.
In my css im using this:
Menu {
color: #FFFFFF;
background-color: #0099CC;
}

And the menu is created on this way:
this.shell = new Shell(Display.getCurrent(), SWT.NO_TRIM);
Menu menuBar = new Menu(shell, SWT.BAR); //this remains gray, css has no affect!
MenuItem mainMenuHeader = new MenuItem(menuBar, SWT.CASCADE); //this works fine!

ANy idea why?

Is there a posibillity for a Widget to get its theme settings programatically and change them on the runtime. For example i have TableItem and if table is editable then css pointer property should be different then if its not editable. Or just simply to change the color and backgroundcolor (without setting it over SWT SYSTEM COLOR)?



[Updated on: Thu, 05 January 2012 10:27]

Report message to a moderator

Previous Topic:E4 Status
Next Topic:Re: TableViewer Column resized event
Goto Forum:
  


Current Time: Mon Nov 24 16:26:29 GMT 2014

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

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