Skip to main content

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
David Song is currently offline David SongFriend
Messages: 217
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() {
			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;
			        	  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

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: Fri Nov 27 09:13:42 GMT 2020

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

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

Back to the top