Home » Eclipse Projects » Remote Application Platform (RAP) » TableTree bug
TableTree bug [message #530274] |
Thu, 29 April 2010 03:49  |
Eclipse User |
|
|
|
Hello,
I use a table-tree implemented with a TreeViewer and a ITableLabelProvider.
But I have a problem, when I expand nodes, labels of the first column
overlap with other columns.
Do you experience the same problem?
Thanks,
--
Patrick
|
|
| |
Re: TableTree bug [message #530282 is a reply to message #530276] |
Thu, 29 April 2010 04:13   |
Eclipse User |
|
|
|
Hi Ivan,
I use a recent (last week) version from CVS. I didn't update today
because I have to do a demo this morning.
Here is a snippet, try to expand the nodes:
public class View extends ViewPart implements ITableLabelProvider,
ITreeContentProvider
{
public static final String ID = View.class.getName ();
private static final Random random = new Random ();
public View () {
}
public void createPartControl (Composite parent) {
TreeViewer tree = new TreeViewer (parent, SWT.NONE);
tree.setLabelProvider (this);
tree.setContentProvider (this);
tree.getTree ().setHeaderVisible (true);
TreeColumn column = new TreeColumn (tree.getTree (), SWT.NONE);
column.setText ("A");
column.setWidth (40);
column = new TreeColumn (tree.getTree (), SWT.NONE);
column.setText ("B");
column.setWidth (40);
tree.setInput ("");
}
public void setFocus () {
}
public Image getColumnImage (Object element, int columnIndex) {
return null;
}
public String getColumnText (Object element, int columnIndex) {
return String.valueOf (random.nextInt ());
}
public boolean isLabelProperty (Object element, String property) {
return false;
}
public Object[] getChildren (Object parentElement) {
return getElements (parentElement);
}
public Object getParent (Object element) {
return null;
}
public boolean hasChildren (Object element) {
return true;
}
public Object[] getElements (Object inputElement) {
return new Object[] {"", ""};
}
public void inputChanged (Viewer viewer, Object oldInput, Object
newInput) {
}
public void addListener (ILabelProviderListener listener) {
}
public void removeListener (ILabelProviderListener listener) {
}
public void dispose () {
}
}
Le 29/04/2010 10:03, Ivan Furnadjiev a écrit :
> Hi Patrick,
>
> which version of RAP are you using? A code snippet will be useful to
> check and reproduce it.
>
> Best,
> Ivan
>
> On 04/29/2010 10:49 AM, Patrick wrote:
>> Hello,
>> I use a table-tree implemented with a TreeViewer and a
>> ITableLabelProvider.
>> But I have a problem, when I expand nodes, labels of the first column
>> overlap with other columns.
>> Do you experience the same problem?
>> Thanks,
|
|
|
Re: TableTree bug [message #530283 is a reply to message #530282] |
Thu, 29 April 2010 04:26   |
Eclipse User |
|
|
|
Hi Patrick,
I think that you run into this bug:
284763: [Tree] Cell text doesn't clip if column is too narrow
https://bugs.eclipse.org/bugs/show_bug.cgi?id=284763
Best,
Ivan
On 04/29/2010 11:13 AM, Patrick wrote:
> Hi Ivan,
>
> I use a recent (last week) version from CVS. I didn't update today
> because I have to do a demo this morning.
>
> Here is a snippet, try to expand the nodes:
>
> public class View extends ViewPart implements ITableLabelProvider,
> ITreeContentProvider
> {
> public static final String ID = View.class.getName ();
> private static final Random random = new Random ();
> public View () {
> }
> public void createPartControl (Composite parent) {
> TreeViewer tree = new TreeViewer (parent, SWT.NONE);
> tree.setLabelProvider (this);
> tree.setContentProvider (this);
> tree.getTree ().setHeaderVisible (true);
> TreeColumn column = new TreeColumn (tree.getTree (), SWT.NONE);
> column.setText ("A");
> column.setWidth (40);
> column = new TreeColumn (tree.getTree (), SWT.NONE);
> column.setText ("B");
> column.setWidth (40);
> tree.setInput ("");
> }
> public void setFocus () {
> }
> public Image getColumnImage (Object element, int columnIndex) {
> return null;
> }
> public String getColumnText (Object element, int columnIndex) {
> return String.valueOf (random.nextInt ());
> }
> public boolean isLabelProperty (Object element, String property) {
> return false;
> }
> public Object[] getChildren (Object parentElement) {
> return getElements (parentElement);
> }
> public Object getParent (Object element) {
> return null;
> }
> public boolean hasChildren (Object element) {
> return true;
> }
> public Object[] getElements (Object inputElement) {
> return new Object[] {"", ""};
> }
> public void inputChanged (Viewer viewer, Object oldInput, Object
> newInput) {
> }
> public void addListener (ILabelProviderListener listener) {
> }
> public void removeListener (ILabelProviderListener listener) {
> }
> public void dispose () {
> }
> }
>
>
> Le 29/04/2010 10:03, Ivan Furnadjiev a écrit :
>> Hi Patrick,
>>
>> which version of RAP are you using? A code snippet will be useful to
>> check and reproduce it.
>>
>> Best,
>> Ivan
>>
>> On 04/29/2010 10:49 AM, Patrick wrote:
>>> Hello,
>>> I use a table-tree implemented with a TreeViewer and a
>>> ITableLabelProvider.
>>> But I have a problem, when I expand nodes, labels of the first column
>>> overlap with other columns.
>>> Do you experience the same problem?
>>> Thanks,
>
|
|
| | |
Re: TableTree bug [message #530344 is a reply to message #530289] |
Thu, 29 April 2010 08:50   |
Eclipse User |
|
|
|
Roland,
I'm sorry to say, but there is no a workaround. With the current client
side implementation (qooxdoo Tree widget) it is very hard to fix it. We
are planning a new client-side Tree implementation ( see bug 309519 ),
but this will not be part of 1.3 release.
Best,
Ivan
On 04/29/2010 11:44 AM, Patrick wrote:
> OK thanks. Do you know if there is a workaround, or better, a plan for
> a patch?
>
> Regards,
> Patrick
>
> Le 29/04/2010 10:26, Ivan Furnadjiev a écrit :
>>
>> I think that you run into this bug:
>> 284763: [Tree] Cell text doesn't clip if column is too narrow
>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=284763
>
|
|
| |
Re: TableTree bug [message #530352 is a reply to message #530351] |
Thu, 29 April 2010 09:34   |
Eclipse User |
|
|
|
Patrick wrote on Thu, 29 April 2010 15:22 | Le 29/04/2010 14:46, Martijn Cremer a écrit :
> Patrick wrote on Thu, 29 April 2010 09:49
>> I use a table-tree implemented with a TreeViewer and a
>> ITableLabelProvider.
>> But I have a problem, when I expand nodes, labels of the first column
>> overlap with other columns.
>
> Can you be a tad clearer. Do you mean something in the lines of this
> situation.
> Your columns are closly fitting yet the tree go's on.
No, it looks like this:
https://bugs.eclipse.org/bugs/attachment.cgi?id=142667
|
And if you try this:
public void createPartControl (Composite parent) {
TreeViewer tree = new TreeViewer (parent, SWT.NONE);
tree.setLabelProvider (this);
tree.setContentProvider (this);
tree.getTree ().setHeaderVisible (true);
TreeColumnLayout mainCompositeTreeColumnLayout = new TreeColumnLayout();
parent .setLayout(mainCompositeTreeColumnLayout);
TreeColumn column = new TreeColumn (tree.getTree (), SWT.NONE);
mainCompositeTreeColumnLayout.setColumnData(column, new ColumnWeightData(40, true));
column.setText ("A");
column = new TreeColumn (tree.getTree (), SWT.NONE);
mainCompositeTreeColumnLayout.setColumnData(column, new ColumnWeightData(40, true));
column.setText ("B");
tree.setInput ("");
This will make the colums overlap and not preasure the words together.
|
|
| |
Re: TableTree bug [message #530362 is a reply to message #530352] |
Thu, 29 April 2010 09:51   |
Eclipse User |
|
|
|
Le 29/04/2010 15:34, Martijn Cremer a écrit :
> Patrick wrote on Thu, 29 April 2010 15:22
>> No, it looks like this:
>> https://bugs.eclipse.org/bugs/attachment.cgi?id=142667
>
> And if you try this:
>
> public void createPartControl (Composite parent) {
> TreeViewer tree = new TreeViewer (parent, SWT.NONE);
> tree.setLabelProvider (this);
> tree.setContentProvider (this);
> tree.getTree ().setHeaderVisible (true);
>
> TreeColumnLayout mainCompositeTreeColumnLayout = new TreeColumnLayout();
> parent .setLayout(mainCompositeTreeColumnLayout);
>
> TreeColumn column = new TreeColumn (tree.getTree (), SWT.NONE);
> mainCompositeTreeColumnLayout.setColumnData(column, new
> ColumnWeightData(40, true));
> column.setText ("A");
>
> column = new TreeColumn (tree.getTree (), SWT.NONE);
> mainCompositeTreeColumnLayout.setColumnData(column, new
> ColumnWeightData(40, true));
> column.setText ("B");
> tree.setInput ("");
>
>
> This will make the colums overlap and not preasure the words together.
Sorry, but the problem is still there if you expand the tree...
Thanks for the help anyway.
|
|
|
Re: TableTree bug [message #530364 is a reply to message #530362] |
Thu, 29 April 2010 09:59   |
Eclipse User |
|
|
|
Patrick wrote on Thu, 29 April 2010 15:51 | Le 29/04/2010 15:34, Martijn Cremer a écrit :
> Patrick wrote on Thu, 29 April 2010 15:22
>> No, it looks like this:
>> https://bugs.eclipse.org/bugs/attachment.cgi?id=142667
>
> And if you try this:
>
> public void createPartControl (Composite parent) {
> TreeViewer tree = new TreeViewer (parent, SWT.NONE);
> tree.setLabelProvider (this);
> tree.setContentProvider (this);
> tree.getTree ().setHeaderVisible (true);
>
> TreeColumnLayout mainCompositeTreeColumnLayout = new TreeColumnLayout();
> parent .setLayout(mainCompositeTreeColumnLayout);
>
> TreeColumn column = new TreeColumn (tree.getTree (), SWT.NONE);
> mainCompositeTreeColumnLayout.setColumnData(column, new
> ColumnWeightData(40, true));
> column.setText ("A");
>
> column = new TreeColumn (tree.getTree (), SWT.NONE);
> mainCompositeTreeColumnLayout.setColumnData(column, new
> ColumnWeightData(40, true));
> column.setText ("B");
> tree.setInput ("");
>
>
> This will make the colums overlap and not preasure the words together.
Sorry, but the problem is still there if you expand the tree...
Thanks for the help anyway.
|
Weaerd becouse I am using a JTree constantly in a table like way. And never saw taht problem. Witch is why I toucht that should work.
|
|
|
Re: TableTree bug [message #530522 is a reply to message #530344] |
Thu, 29 April 2010 18:53  |
Eclipse User |
|
|
|
Hello,
That is an annoying bug. If you go to TreeItem.js and replace the updateColumnsWidth function with the following:
updateColumnsWidth : function() {
var columnWidth = new Array();
var fullWidth = this.getTree().getParent().getColumnsWidth();
this.setWidth( fullWidth );
for( var c = 0; c < this.getTree().getParent()._columns.length; c++ ) {
columnWidth[ c ] = this.getTree().getParent()._columns[ c ].getWidth();
}
if( columnWidth.length > 0 ) {
var iconObj = this.getIconObject();
var iconWidth = this._images[ 0 ] == null ? 0 : this.getIconObject().getWidth();
var checkBoxWidth = this._checkBox == null ? 0 : 16; // 13 width + 3 checkbox margin
var spacing = iconWidth > 0 ? iconObj.getMarginRight() : 0;
var labelObj = this.getLabelObject();
labelObj.setWidth( columnWidth[ 0 ]
- ( this.getLevel() * 19 ) // TODO: [bm] replace with computed indent width
- checkBoxWidth
- iconWidth
- spacing );
if (iconWidth == 0 && checkBoxWidth == 0) {
var indentObj = this.getIndentObject();
var indentObjWidth = indentObj.getWidth();
var firstCell = indentObj.getWidth()+checkBoxWidth+iconWidth+spacing;
if (firstCell > columnWidth[0]) {
indentObj.setClipWidth(columnWidth[0]);
indentObj.setWidth(columnWidth[0]);
iconObj.setVisibility(false);
}
else {
indentObj.setClipWidth(columnWidth[0]);
iconObj.setVisibility(true);
this._updateIndent();
}
}
var coLabel;
for( var i = 1; i < columnWidth.length; i++ ) {
coLabel = this._colLabels[ i - 1 ];
iconWidth = this._images[ i ] == null ? 0 : 16;
spacing = iconWidth > 0 ? coLabel.getSpacing() : 0;
if( coLabel != null && coLabel.getLabelObject() != null ) {
coLabel.getLabelObject().setWidth( columnWidth[ i ]
- iconWidth
- spacing );
}
}
}
},
AND add the following function:
flushTree : function() {
this.base(arguments);
this.updateColumnsWidth();
}
Then the first column in the previously posted test snippet will not encroach on the other columns when expanded.
However, this is a solution that currently only works for tree tables without icons or checkboxes. That is another whole can of worms.
A little late for the demo, but Enjoy!
|
|
|
Goto Forum:
Current Time: Sat Jul 19 19:39:43 EDT 2025
Powered by FUDForum. Page generated in 0.04387 seconds
|