Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » TableTree bug
TableTree bug [message #530274] Thu, 29 April 2010 07:49 Go to next message
Patrick is currently offline PatrickFriend
Messages: 55
Registered: July 2009
Member
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 #530276 is a reply to message #530274] Thu, 29 April 2010 08:03 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 2426
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
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 #530282 is a reply to message #530276] Thu, 29 April 2010 08:13 Go to previous messageGo to next message
Patrick is currently offline PatrickFriend
Messages: 55
Registered: July 2009
Member
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 08:26 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 2426
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
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 #530289 is a reply to message #530283] Thu, 29 April 2010 08:44 Go to previous messageGo to next message
Patrick is currently offline PatrickFriend
Messages: 55
Registered: July 2009
Member
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 #530343 is a reply to message #530274] Thu, 29 April 2010 12:46 Go to previous messageGo to next message
Martijn Cremer is currently offline Martijn CremerFriend
Messages: 77
Registered: January 2010
Location: Breda
Member

Patrick wrote on Thu, 29 April 2010 09:49
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


Hi Patrick,

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.

Somtin like this picture.

Dont mind the border lines and the full selection I used a patch from https://bugs.eclipse.org/bugs/show_bug.cgi?id=232406.


hm. I've lost a machine.. literally _lost_. it responds to ping, it works completely, I just can't figure out where in my apartment it is.

[Updated on: Thu, 29 April 2010 12:50]

Report message to a moderator

Re: TableTree bug [message #530344 is a reply to message #530289] Thu, 29 April 2010 12:50 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 2426
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
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 #530351 is a reply to message #530343] Thu, 29 April 2010 13:22 Go to previous messageGo to next message
Patrick is currently offline PatrickFriend
Messages: 55
Registered: July 2009
Member
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
Re: TableTree bug [message #530352 is a reply to message #530351] Thu, 29 April 2010 13:34 Go to previous messageGo to next message
Martijn Cremer is currently offline Martijn CremerFriend
Messages: 77
Registered: January 2010
Location: Breda
Member

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.


hm. I've lost a machine.. literally _lost_. it responds to ping, it works completely, I just can't figure out where in my apartment it is.
Re: TableTree bug [message #530361 is a reply to message #530344] Thu, 29 April 2010 13:33 Go to previous messageGo to next message
Patrick is currently offline PatrickFriend
Messages: 55
Registered: July 2009
Member
OK. The only workaround I think of would be to fix the 1st column's
width at a sufficient size. However it's not feasible if the tree is
very large.

Patrick

Le 29/04/2010 14:50, Ivan Furnadjiev a écrit :
> 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.
>
>>> 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 #530362 is a reply to message #530352] Thu, 29 April 2010 13:51 Go to previous messageGo to next message
Patrick is currently offline PatrickFriend
Messages: 55
Registered: July 2009
Member
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 13:59 Go to previous messageGo to next message
Martijn Cremer is currently offline Martijn CremerFriend
Messages: 77
Registered: January 2010
Location: Breda
Member

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.


hm. I've lost a machine.. literally _lost_. it responds to ping, it works completely, I just can't figure out where in my apartment it is.
Re: TableTree bug [message #530522 is a reply to message #530344] Thu, 29 April 2010 22:53 Go to previous message
Austin Riddle is currently offline Austin RiddleFriend
Messages: 128
Registered: July 2009
Senior Member
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!

Previous Topic:Open a PDF book
Next Topic:Problem using 1.3.M6 with BIRT
Goto Forum:
  


Current Time: Fri Mar 29 14:55:36 GMT 2024

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

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

Back to the top