Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » Nebula GridViewerTable alignment(How to align the image to the center of the GridViewerTable )
Nebula GridViewerTable alignment [message #1386520] Wed, 18 June 2014 05:59 Go to next message
veeresh hipparagi is currently offline veeresh hipparagiFriend
Messages: 2
Registered: June 2014
Junior Member
Hi All,

I am working on the GridViewerTable alignment.I am facing the difficultis to get the image to the center of the table.I use the following code but i am unsuccessful.Taht will great one can post the related code.

testTable.addListener(SWT.PaintItem, new Listener() {

@Override
public void handleEvent(Event event) {
// Am I on collumn I need..?
if(event.index == 5) {
Image tmpImage = IMAGE_TEST_PASS;
int tmpWidth = 0;
int tmpHeight = 0;
int tmpX = 0;
int tmpY = 0;

tmpWidth = testTable.getColumn(event.index).getWidth();
tmpHeight = ((TableItem)event.item).getBounds().height;

tmpX = tmpImage.getBounds().width;
tmpX = (tmpWidth / 2 - tmpX / 2);
tmpY = tmpImage.getBounds().height;
tmpY = (tmpHeight / 2 - tmpY / 2);
if(tmpX <= 0) tmpX = event.x;
else tmpX += event.x;
if(tmpY <= 0) tmpY = event.y;
else tmpY += event.y;
event.gc.drawImage(tmpImage, tmpX, tmpY);
}
}
});
Re: Nebula GridViewerTable alignment [message #1386579 is a reply to message #1386520] Wed, 18 June 2014 11:15 Go to previous message
Steffen Zschaler is currently offline Steffen ZschalerFriend
Messages: 266
Registered: July 2009
Senior Member
Are you sure you're in the right group?

Steffen

On 18/06/2014 12:09, veeresh hipparagi wrote:
> Hi All,
>
> I am working on the GridViewerTable alignment.I am facing the
> difficultis to get the image to the center of the table.I use the
> following code but i am unsuccessful.Taht will great one can post the
> related code.
>
> testTable.addListener(SWT.PaintItem, new Listener() {
>
> @Override
> public void handleEvent(Event event) {
> // Am I on collumn I need..?
> if(event.index == 5) {
> Image tmpImage = IMAGE_TEST_PASS;
> int tmpWidth = 0;
> int tmpHeight = 0;
> int tmpX = 0;
> int tmpY = 0;
>
> tmpWidth = testTable.getColumn(event.index).getWidth();
> tmpHeight = ((TableItem)event.item).getBounds().height;
>
> tmpX = tmpImage.getBounds().width;
> tmpX = (tmpWidth / 2 - tmpX / 2);
> tmpY = tmpImage.getBounds().height;
> tmpY = (tmpHeight / 2 - tmpY / 2);
> if(tmpX <= 0) tmpX = event.x;
> else tmpX += event.x;
> if(tmpY <= 0) tmpY = event.y;
> else tmpY += event.y;
> event.gc.drawImage(tmpImage, tmpX, tmpY);
> }
> }
> });
Previous Topic:Input parameter in epl
Next Topic:[Workflow] ANT workflow store intermediate models
Goto Forum:
  


Current Time: Fri Apr 26 15:33:57 GMT 2024

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

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

Back to the top