Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 316103

Summary: TreeTableRidget does not take image from column formatter after node is expanded
Product: [RT] Riena Reporter: Benno Baumgartner <benno.baumgartner>
Component: ridgetAssignee: Elias Volanakis <elias>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: christian.campo
Version: 2.0.0   
Target Milestone: 3.0.0.M4   
Hardware: PC   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:
Attachments:
Description Flags
Example to reproduct issue none

Description Benno Baumgartner CLA 2010-06-08 04:54:42 EDT
2.0.0RC3

1. Run following snipped:
MyTreeElement root1= new MyTreeElement(null, "Root1", DateUtils.getNow());
MyTreeElement root1a= new MyTreeElement(root1, "Root1 A", DateUtils.getNow());
MyTreeElement root1aa= new MyTreeElement(root1a, "Root1 Aa", DateUtils.getNow());
MyTreeElement root1b= new MyTreeElement(root1, "Root1 B", DateUtils.getNow());
MyTreeElement root2= new MyTreeElement(null, "Root2", DateUtils.getNow());

Tree tree= new Tree(parent, SWT.FULL_SELECTION | SWT.MULTI);
TreeColumn tc1= new TreeColumn(tree, SWT.DEFAULT);
tc1.setWidth(200);
TreeColumn tc2= new TreeColumn(tree, SWT.DEFAULT);
tc2.setWidth(200);

ITreeTableRidget treeTableRidget= (ITreeTableRidget) SwtRidgetFactory.createRidget(tree);
String[] columnValues= new String[] { "column1", "column2" }; //$NON-NLS-1$//$NON-NLS-2$
treeTableRidget.setColumnFormatter(0, new ColumnFormatter() {
	@Override
	public Image getImage(Object element) {
		return UIBundleActivator.getImageDescriptor("icons/actions/open.png").createImage();
	}
});
treeTableRidget.bindToModel(new MyTreeElement[] { root1, root2 }, MyTreeElement.class, "children", "parent", columnValues, null);

IS: The tree shows the image returned from the column formatter at the beginning, but after a node is expanded, the column formatter is ignored and the image LnfKeyConstants.SUB_MODULE_TREE_FOLDER_OPEN_ICON is used for the icon
SHOULD: Always use the icon from the column formatter

I think the bug is in org.eclipse.riena.internal.ui.ridgets.swt.TreeRidgetLabelProvider.UpdateIconsTreeListener.updateIcon(TreeItem, boolean). There the icon is taken without consulting the column formatter. 
Unfortunately the enhancement from bug#290586 does not work for TreeTables.
Comment 1 Elias Volanakis CLA 2010-07-26 20:41:28 EDT
Reproducible. The analysis is correct. If the column formatter returns an image, this should be preferred instead of the default icon. Fixing...
Comment 2 Elias Volanakis CLA 2010-07-27 15:14:25 EDT
Created attachment 175344 [details]
Example to reproduct issue
Comment 3 Elias Volanakis CLA 2010-11-18 12:36:11 EST
Resolved