Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 366964 - TreeTableRidget ignores empty string from column formatter in 3.0
Summary: TreeTableRidget ignores empty string from column formatter in 3.0
Status: RESOLVED WORKSFORME
Alias: None
Product: Riena
Classification: RT
Component: ridget (show other bugs)
Version: 3.0.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Stefan Liebig CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-16 12:20 EST by Benno Baumgartner CLA
Modified: 2012-01-25 02:41 EST (History)
1 user (show)

See Also:


Attachments
Tree 2.0 compared to 3.0 (2.90 KB, image/png)
2011-12-16 12:20 EST, Benno Baumgartner CLA
no flags Details
Snippet trying to reproduce the bug (3.69 KB, text/plain)
2012-01-10 02:43 EST, Stefan Liebig CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
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