Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » TreeItem.getImageBounds not working in RAP1.4
TreeItem.getImageBounds not working in RAP1.4 [message #799706] Thu, 16 February 2012 07:56 Go to next message
Fred Kandler is currently offline Fred KandlerFriend
Messages: 6
Registered: February 2012
Junior Member
To control the position of an image in a tablecolumn in an TableViewer, one can overwrite TableItem.getImageBounds().
This does not work for TreeViewer and TreeItem.getImageBounds.

Is there an other possibility to control the position of an Image in a treecolumn.
I have an tree with multiple columns and want to center my Images in the column. SWT.CENTER at the TreeViewerColumn only works for text, not images.
Re: TreeItem.getImageBounds not working in RAP1.4 [message #799756 is a reply to message #799706] Thu, 16 February 2012 09:17 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 2426
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
Hi Fred,
could you provide some code snippet that demonstrate your image bounds
overriding? Does your snippet work in RCP? I doubt that this is possible
in SWT.
Best,
Ivan

On 2/16/2012 9:56 AM, Fred Kandler wrote:
> To control the position of an image in a tablecolumn in an
> TableViewer, one can overwrite TableItem.getImageBounds().
> This does not work for TreeViewer and TreeItem.getImageBounds.
>
> Is there an other possibility to control the position of an Image in a
> treecolumn.
> I have an tree with multiple columns and want to center my Images in
> the column. SWT.CENTER at the TreeViewerColumn only works for text,
> not images.

--
Ivan Furnadjiev

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: TreeItem.getImageBounds not working in RAP1.4 [message #799886 is a reply to message #799706] Thu, 16 February 2012 12:35 Go to previous messageGo to next message
Ralf Sternberg is currently offline Ralf SternbergFriend
Messages: 1313
Registered: July 2009
Senior Member

Hi,

Since the CENTER style flag also affects only the texts in SWT, we
should not change this behavior in RAP. And as extending TableItems or
TreeItems is discouraged in SWT, I don't consider overriding
getImageBounds() an acceptable practice, although I admit that it is a
creative approach!

Maybe markup will be an alternative: RAP 1.5 will support texts with
markup in Tree and Table. This will allow you to insert the images into
the texts using an <img> element. Does that sound like a possible solution?

Regards, Ralf


--
Ralf Sternberg

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: TreeItem.getImageBounds not working in RAP1.4 [message #800559 is a reply to message #799886] Fri, 17 February 2012 08:12 Go to previous messageGo to next message
Fred Kandler is currently offline Fred KandlerFriend
Messages: 6
Registered: February 2012
Junior Member
Hi

Thanks for the replies.
The reason I want this is that i have a Tree with multiple columns and the last 2 Columns are boolean values (Checkboxes).
I want this Checkboxes be centered in the column. Is there a way with TreeViewer to do this?

Regards, Fred
Re: TreeItem.getImageBounds not working in RAP1.4 [message #800562 is a reply to message #799886] Fri, 17 February 2012 08:12 Go to previous messageGo to next message
Fred Kandler is currently offline Fred KandlerFriend
Messages: 6
Registered: February 2012
Junior Member
Hi

Thanks for the replies.
The reason I want this is that i have a Tree with multiple columns and the last 2 Columns are boolean values (Checkboxes).
I want this Checkboxes be centered in the column. Is there a way with TreeViewer to do this?

Regards, Fred
Re: TreeItem.getImageBounds not working in RAP1.4 [message #800679 is a reply to message #800559] Fri, 17 February 2012 10:46 Go to previous messageGo to next message
Ralf Sternberg is currently offline Ralf SternbergFriend
Messages: 1313
Registered: July 2009
Senior Member

Hi Fred,

that's challenging. In SWT, the typical approach is to draw those
checkboxes into the cells using GC. In RAP 1.5, I#d suggest the markup
approach I already described.

In RAP 1.4, the only solution I could think of would be to create an
image with enough whitespace padding to appear centered. Of course,
this only works for fixed column widths.

As an alternative, you could only display colorized texts and open a
checkbox cell editor on pressing Return.

Regards, Ralf


--
Ralf Sternberg

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: TreeItem.getImageBounds not working in RAP1.4 [message #803389 is a reply to message #800679] Tue, 21 February 2012 09:29 Go to previous message
Fred Kandler is currently offline Fred KandlerFriend
Messages: 6
Registered: February 2012
Junior Member
The solution with the Image with transparent background and enough space left and right works. Its not my preferred solution but the only that works in RAP 1.4
Thanks for the replays.

Regards, fred
Previous Topic:TreeItem.getImageBounds not working in RAP1.4
Next Topic:Eclipse RAP editor
Goto Forum:
  


Current Time: Thu Apr 25 00:44:40 GMT 2024

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

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

Back to the top