Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Help to draw different images in table according element data?
Help to draw different images in table according element data? [message #777215] Tue, 10 January 2012 04:03
Song David is currently offline Song DavidFriend
Messages: 191
Registered: April 2011
Senior Member
Hi all,

I am going to draw diffrent icons in my tableviewer's last column according tableviewer's provider data. But how to get the entry model data in my code?

table.addListener(SWT.PaintItem, new Listener() {
			@Override
			public void handleEvent(Event event) {
				Image up = Activator.getImageDescriptor("icons/Thumb-Up-icon.png").createImage();
				Image down = Activator.getImageDescriptor("icons/Thumb-Down-icon.png").createImage();
				if (event.index == 7) {
			          GC gc = event.gc;
			          TableItem item = (TableItem)event.item;
			          
					  //how to get the row data model entry?
					  Repay repay = ...
			          
					  int x = event.x = 1;
			          if(repay.getActive().equals(RepayStatus.WAITING)){
			        	  gc.drawImage(down, x, event.height+5);
			          }else if(repay.getActive().equals(RepayStatus.OVER_DUE)){
			        	  gc.drawImage(down, x, event.height+5);
			          }else if(repay.getActive().equals(RepayStatus.FINISHED)){
			        	  gc.drawImage(up, x, event.height+5);
			          }
				 }
			}
});



Thank you very much

David
Previous Topic:Problem with Views using jNetPcap library
Next Topic:[re-opened] Order of mixed 'action' and 'command' menu items in RCP
Goto Forum:
  


Current Time: Sun Dec 21 19:27:10 GMT 2014

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

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