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

Bug 366964

Summary: TreeTableRidget ignores empty string from column formatter in 3.0
Product: [RT] Riena Reporter: Benno Baumgartner <benno.baumgartner>
Component: ridgetAssignee: Stefan Liebig <Stefan.Liebig>
Status: RESOLVED WORKSFORME QA Contact:
Severity: normal    
Priority: P3 CC: christian.campo
Version: 3.0.0   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Tree 2.0 compared to 3.0
none
Snippet trying to reproduce the bug none

Description Benno Baumgartner CLA 2011-12-16 12:20:11 EST
Created attachment 208497 [details]
Tree 2.0 compared to 3.0

In: org.eclipse.riena.ui.ridgets.swt_3.0.0.v20110614_3_0_0_0.jar

Hi Riena Team

I have an issue with the TreeTableRidget in Riena 3.0.

Given following code (TestTreeNode is straight forward):

Composite tableComposite= new Composite(parent, SWT.NONE);
GridData layoutData2= new GridData(SWT.FILL, SWT.FILL, true, true);
tableComposite.setLayoutData(layoutData2);

Tree tree= new Tree(tableComposite, SWT.MULTI | SWT.FULL_SELECTION | SWT.BORDER);
GridData layoutData= new GridData(SWT.FILL, SWT.FILL, true, true);
layoutData.heightHint= 100;
tree.setLayoutData(layoutData);
tree.setLinesVisible(true);
tree.setHeaderVisible(true);

TreeColumnLayout columnLayout= new TreeColumnLayout();
TreeColumn tableColumn= new TreeColumn(tree, SWT.FILL);
tableColumn.setText("Test");
columnLayout.setColumnData(tableColumn, new ColumnWeightData(10, 100));
tableComposite.setLayout(columnLayout);

ITreeTableRidget treeRiget= (ITreeTableRidget) SwtRidgetFactory.createRidget(tree);
treeRiget.setSelectionType(SelectionType.MULTI);

treeRiget.setColumnFormatter(0, new ColumnFormatter() {
	@Override
	public String getText(Object element) {
		TestTreeNode node= (TestTreeNode) element;
		if (node.getName() == null)
			return "";
		return node.getName();
	}
});

Object[] roots= new Object[] { new TestTreeNode(null), new TestTreeNode("name") };
treeRiget.bindToModel(roots, TestTreeNode.class, "children", "parent", new String[] { "name" }, new String[] { "Name" });


*IS: In Riena 2.0 the column for the node with the Null name shows "" (empty string) in Riena 3.0 the column shows "null"
*SHOULD: Behave consistent and respect the ColumnFormatter

That's not nice because all our trees show null now everywhere when we update to Riena 3.0. Workaround is to return " " (space) in the column formatter.

See screen shot.

Looks like the issue is in TreeRidgetLabelProvider.getColumnText(Object, int)

Thanks for your Time
Benno
Comment 1 Stefan Liebig CLA 2012-01-10 02:43:22 EST
Created attachment 209244 [details]
Snippet trying to reproduce the bug
Comment 2 Stefan Liebig CLA 2012-01-10 02:47:02 EST
Hi Benno,

I created a snippet from your bug report and with the current version of Riena (4.0 M3) I can not reproduce your problem.
Could you please verify this with a newer version of Riena?

Tschüß,
Stefan
Comment 3 Christian Campo CLA 2012-01-25 02:41:01 EST
Benno, can you please try the snippet and see if that also works for you or if there is still an open problem ?

thanks
christian