Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » TreeViewer RowTemplate Expander missing
TreeViewer RowTemplate Expander missing [message #1350193] Mon, 12 May 2014 14:46 Go to next message
László Erős is currently offline László Erős
Messages: 5
Registered: September 2013
Junior Member
Hello!

I would like to ask, that is there an example somewhere for a treeviewer with row template?

I am asking because i am implemented like the tableviewer example and i cannot use
the expander, because there aren't one.

I tried to create a custom image which selectable and do it by code behind with:

if (treeViewer.getExpandedState(object)) {
  treeViewer.collapseToLevel(object, AbstractTreeViewer.ALL_LEVELS);
} else {
  treeViewer.expandToLevel(object, 1);	
}		}


But i had problems when i tried to change the image when the item expanded or collapsed.

So, if i use rowtemplate can i use the default tree expander imgage and functionality somehow or i am doing something wrong and the expander shoud be there or its a bug?

Laszlo
Re: TreeViewer RowTemplate Expander missing [message #1352082 is a reply to message #1350193] Tue, 13 May 2014 09:42 Go to previous messageGo to next message
Tim Buschtoens is currently offline Tim Buschtoens
Messages: 383
Registered: July 2009
Senior Member
Hi.

Using templates on a Tree should have no effect on the expand icon. If
you managed to make it disappear somehow, please create a snippet and a
bug-report.

Greetings,
Tim


Am 12.05.2014 16:46, schrieb László Erős:
> Hello!
>
> I would like to ask, that is there an example somewhere for a treeviewer
> with row template?
>
> I am asking because i am implemented like the tableviewer example and i
> cannot use
> the expander, because there aren't one.
>
> I tried to create a custom image which selectable and do it by code
> behind with:
>
>
> if (treeViewer.getExpandedState(object)) {
> treeViewer.collapseToLevel(object, AbstractTreeViewer.ALL_LEVELS);
> } else {
> treeViewer.expandToLevel(object, 1);
> } }
>
>
> But i had problems when i tried to change the image when the item
> expanded or collapsed.
>
> So, if i use rowtemplate can i use the default tree expander imgage and
> functionality somehow or i am doing something wrong and the expander
> shoud be there or its a bug?
>
> Laszlo

--
Tim Buschtöns

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: TreeViewer RowTemplate Expander missing [message #1352201 is a reply to message #1352082] Tue, 13 May 2014 10:54 Go to previous messageGo to next message
László Erős is currently offline László Erős
Messages: 5
Registered: September 2013
Junior Member
Hello!

Thanks for the answer!

If i add a simple rowtemplate to the treeviewer the expander is disappear/not shown. I tried it even with the rap demo. Without rowtemplate everything ok works as usual.

Here are the steps i use:

	Tree tree = new Tree(parent, SWT.NONE);
	TreeViewer treeViewer = new TreeViewer(tree);
	
	TreeViewerColumn twc = new TreeViewerColumn(treeViewer, SWT.NONE);
	twc.setLabelProvider(new TreeLabelProvider());
	
	treeViewer.setContentProvider(new TestTreeContentProvider());
	
	Template test = new Template();
	TextCell textCell = new TextCell(test);
	textCell.setHorizontalAlignment(SWT.LEFT);
	textCell.setBindingIndex(0);
	textCell.setTop(0);
	textCell.setLeft(0);

	tree.setData(RWT.ROW_TEMPLATE, test);
	
	treeViewer.setInput(getRoots());


Am i doing something wrong?

I also tried with different values on textcell for example setLeft(50), but still no expander.
Please confirm is it a bug?

László

[Updated on: Tue, 13 May 2014 10:57]

Report message to a moderator

Re: TreeViewer RowTemplate Expander missing [message #1352551 is a reply to message #1352201] Tue, 13 May 2014 14:11 Go to previous messageGo to next message
Tim Buschtoens is currently offline Tim Buschtoens
Messages: 383
Registered: July 2009
Senior Member
For me that template works fine with the current master. Could you try
with RAP 2.3M3? Provide a screenshot of the issue, perhaps with the
browsers DOM explorer on the row(s) that have no expand icon?

Greetings,
Tim

Am 13.05.2014 12:54, schrieb László Erős:
> Hello!
>
> Thanks for the answer!
> If i add a simple rowtemplate to the treeviewer the expander is
> disappear. I tried it even with the rap demo.
>
> Here are the steps i use:
>
>
> Tree tree = new Tree(parent, SWT.NONE);
> TreeViewer treeViewer = new TreeViewer(tree);
>
> TreeViewerColumn twc = new TreeViewerColumn(treeViewer, SWT.NONE);
> twc.setLabelProvider(new TreeLabelProvider());
>
> treeViewer.setContentProvider(new TestTreeContentProvider());
>
> Template test = new Template();
> TextCell textCell = new TextCell(test);
> textCell.setHorizontalAlignment(SWT.LEFT);
> textCell.setBindingIndex(0);
> textCell.setTop(0);
> textCell.setLeft(0);
>
> tree.setData(RWT.ROW_TEMPLATE, test);
>
> treeViewer.setInput(getRoots());
>
>
> Am i doing something wrong?
> I also tried with different values on textcell for example setLeft(50),
> but still no expander. Please confirm is it a bug?
>
> László

--
Tim Buschtöns

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: TreeViewer RowTemplate Expander missing [message #1352724 is a reply to message #1352551] Tue, 13 May 2014 15:52 Go to previous messageGo to next message
László Erős is currently offline László Erős
Messages: 5
Registered: September 2013
Junior Member
Hello! Tried with 2.3M3, no luck:

The browser html code of the tree:

<div tabindex="-1" style="position: absolute; background: none repeat scroll 0% 0% rgb(255, 255, 255); overflow: hidden; outline: medium none; z-index: 1; border-width: 0px; border-style: none; width: 475px; height: 626px; left: 0px; top: 0px;">
   <div tabindex="1" style="position: absolute; cursor: default; overflow: hidden; outline: medium none; z-index: 1; border-width: 1px; border-style: solid; border-color: rgb(189, 189, 189); width: 475px; height: 626px; left: 0px; top: 0px;">
      <div style="position: absolute; overflow: hidden; background: none repeat scroll 0% 0% rgb(255, 255, 255); outline: medium none; width: 473px; height: 624px; top: 0px;">
         <div style="position: absolute; -moz-user-select: none; overflow: hidden; z-index: 0; color: rgb(74, 74, 74); outline: medium none; font-family: Verdana,&quot;Lucida Sans&quot;,Arial,Helvetica,sans-serif; font-size: 14px; font-weight: normal; font-style: normal; width: 473px; height: 45px; left: 0px; top: 0px;">
            <div class="rwt-cell" style="text-align: left; white-space: nowrap; text-overflow: ellipsis; position: absolute; overflow: hidden; z-index: 100; left: 21px; top: 0px; width: 200px; height: 45px; color: inherit;">Teszt1</div>
            <div style="position: absolute; overflow: hidden; z-index: 2; background: -moz-linear-gradient(-90deg, rgb(235, 235, 235) 0%, rgb(213, 213, 213) 100%) repeat scroll 0% 0% transparent; left: 0px; top: 0px; width: 473px; height: 45px; display: none;"></div>
         </div>
         <div style="position: absolute; -moz-user-select: none; overflow: hidden; z-index: 0; color: rgb(74, 74, 74); outline: medium none; font-family: Verdana,&quot;Lucida Sans&quot;,Arial,Helvetica,sans-serif; font-size: 14px; font-weight: normal; font-style: normal; width: 473px; height: 45px; left: 0px; top: 45px;">
            <div class="rwt-cell" style="text-align: left; white-space: nowrap; text-overflow: ellipsis; position: absolute; overflow: hidden; z-index: 100; left: 37px; top: 0px; width: 200px; height: 45px; color: inherit;">Teszt2</div>
            <div style="position: absolute; overflow: hidden; z-index: 2; background: -moz-linear-gradient(-90deg, rgb(235, 235, 235) 0%, rgb(213, 213, 213) 100%) repeat scroll 0% 0% transparent; left: 0px; top: 0px; width: 473px; height: 45px; display: none;"></div>
         </div>
         <div style="position: absolute; -moz-user-select: none; overflow: hidden; z-index: 0; color: rgb(74, 74, 74); outline: medium none; font-family: Verdana,&quot;Lucida Sans&quot;,Arial,Helvetica,sans-serif; font-size: 14px; font-weight: normal; font-style: normal; width: 473px; height: 45px; left: 0px; top: 90px;">
            <div class="rwt-cell" style="text-align: left; white-space: nowrap; text-overflow: ellipsis; position: absolute; overflow: hidden; z-index: 100; left: 37px; top: 0px; width: 200px; height: 45px; color: inherit;">Teszt3</div>
            <div style="position: absolute; overflow: hidden; z-index: 2; background: -moz-linear-gradient(-90deg, rgb(235, 235, 235) 0%, rgb(213, 213, 213) 100%) repeat scroll 0% 0% transparent; left: 0px; top: 0px; width: 473px; height: 45px; display: none;"></div>
         </div>
         <div style="position: absolute; -moz-user-select: none; overflow: hidden; z-index: 0; color: rgb(74, 74, 74); outline: medium none; width: 473px; height: 45px; left: 0px; top: 135px;"></div>
         <div style="position: absolute; -moz-user-select: none; overflow: hidden; z-index: 0; color: rgb(74, 74, 74); outline: medium none; width: 473px; height: 45px; left: 0px; top: 180px;"></div>
         <div style="position: absolute; -moz-user-select: none; overflow: hidden; z-index: 0; color: rgb(74, 74, 74); outline: medium none; width: 473px; height: 45px; left: 0px; top: 225px;"></div>
         <div style="position: absolute; -moz-user-select: none; overflow: hidden; z-index: 0; color: rgb(74, 74, 74); outline: medium none; width: 473px; height: 45px; left: 0px; top: 270px;"></div>
         <div style="position: absolute; -moz-user-select: none; overflow: hidden; z-index: 0; color: rgb(74, 74, 74); outline: medium none; width: 473px; height: 45px; left: 0px; top: 315px;"></div>
         <div style="position: absolute; -moz-user-select: none; overflow: hidden; z-index: 0; color: rgb(74, 74, 74); outline: medium none; width: 473px; height: 45px; left: 0px; top: 360px;"></div>
         <div style="position: absolute; -moz-user-select: none; overflow: hidden; z-index: 0; color: rgb(74, 74, 74); outline: medium none; width: 473px; height: 45px; left: 0px; top: 405px;"></div>
         <div style="position: absolute; -moz-user-select: none; overflow: hidden; z-index: 0; color: rgb(74, 74, 74); outline: medium none; width: 473px; height: 45px; left: 0px; top: 450px;"></div>
         <div style="position: absolute; -moz-user-select: none; overflow: hidden; z-index: 0; color: rgb(74, 74, 74); outline: medium none; width: 473px; height: 45px; left: 0px; top: 495px;"></div>
         <div style="position: absolute; -moz-user-select: none; overflow: hidden; z-index: 0; color: rgb(74, 74, 74); outline: medium none; width: 473px; height: 45px; left: 0px; top: 540px;"></div>
         <div style="position: absolute; -moz-user-select: none; overflow: hidden; z-index: 0; color: rgb(74, 74, 74); outline: medium none; width: 473px; height: 45px; left: 0px; top: 585px;"></div>
      </div>
      <div style="position: absolute; overflow: hidden; background: none repeat scroll 0% 0% rgb(240, 240, 240); outline: medium none; z-index: 100000000; display: none; border-width: 0px; border-style: none; width: 473px; height: 20px; left: 0px;">
         <div tabindex="1" style="position: absolute; overflow: hidden; -moz-user-select: none; cursor: default; color: rgb(74, 74, 74); text-align: center; background: url(&quot;rwt-resources/themes/images/a7b1f224.png&quot;) repeat scroll 0% 0%, none repeat scroll 0% 0% rgb(240, 240, 240); outline: medium none; border-width: 1px; border-style: solid; border-color: rgb(189, 189, 189); border-radius: 8px; width: 433px; height: 20px; left: 20px;"></div>
         <div tabindex="1" style="position: absolute; background: url(&quot;rwt-resources/themes/images/614d82cb.png&quot;) repeat scroll 0% 0% transparent; overflow: hidden; -moz-user-select: none; cursor: default; color: rgb(74, 74, 74); text-align: center; outline: medium none; border-width: 0px; border-style: none; width: 20px; height: 20px;"></div>
         <div tabindex="1" style="position: absolute; background: url(&quot;rwt-resources/themes/images/72c692fc.png&quot;) repeat scroll 0% 0% transparent; overflow: hidden; -moz-user-select: none; cursor: default; color: rgb(74, 74, 74); text-align: center; outline: medium none; border-width: 0px; border-style: none; width: 20px; height: 20px; right: 0px;"></div>
      </div>
      <div style="position: absolute; overflow: hidden; background: none repeat scroll 0% 0% rgb(240, 240, 240); outline: medium none; z-index: 100000000; display: none; border-width: 0px; border-style: none; width: 20px; height: 624px; top: 0px;">
         <div tabindex="1" style="position: absolute; overflow: hidden; -moz-user-select: none; cursor: default; color: rgb(74, 74, 74); text-align: center; background: url(&quot;rwt-resources/themes/images/a7b1f224.png&quot;) repeat scroll 0% 0%, none repeat scroll 0% 0% rgb(240, 240, 240); outline: medium none; border-width: 1px; border-style: solid; border-color: rgb(189, 189, 189); border-radius: 8px; width: 20px; height: 2699px; top: 20px;"></div>
         <div tabindex="1" style="position: absolute; background: url(&quot;rwt-resources/themes/images/67112e5c.png&quot;) repeat scroll 0% 0% transparent; overflow: hidden; -moz-user-select: none; cursor: default; color: rgb(74, 74, 74); text-align: center; outline: medium none; border-width: 0px; border-style: none; width: 20px; height: 20px;"></div>
         <div tabindex="1" style="position: absolute; background: url(&quot;rwt-resources/themes/images/f402982d.png&quot;) repeat scroll 0% 0% transparent; overflow: hidden; -moz-user-select: none; cursor: default; color: rgb(74, 74, 74); text-align: center; outline: medium none; border-width: 0px; border-style: none; width: 20px; height: 20px; bottom: 0px;"></div>
      </div>
   </div>
</div>


The screenshot:


dl.dropboxusercontent.com/u/3810298/rowtemplateerror.jpg

The content provider and the treeobject:

private static class TestTreeContentProvider implements ITreeContentProvider {

		@Override
		public void dispose() {
		}

		@Override
		public Object[] getChildren(Object parent) {
			Object[] result = new Object[0];
			if (parent instanceof TestTreeObject) {
				result = ((TestTreeObject) parent).getChildren();
			}
			return result;
		}

		@Override
		public Object[] getElements(Object parent) {
			return getChildren(parent);
		}

		@Override
		public Object getParent(Object child) {
			Object result = null;
			if (child instanceof TestTreeObject) {
				result = ((TestTreeObject) child).getParent();
			}
			return result;
		}

		@Override
		public boolean hasChildren(Object parent) {
			boolean result = false;
			if (parent instanceof TestTreeObject) {
				result = ((TestTreeObject) parent).hasChildren();
			}
			return result;
		}

		@Override
		public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
		}
	}

	private static class TestTreeObject {
		private final List<TestTreeObject> children;
		private String name;
		private TestTreeObject parent;

		public TestTreeObject(String name) {
			setName(name);
			children = new ArrayList<TestTreeObject>();
		}

		public void addChild(TestTreeObject child) {
			children.add(child);
			child.setParent(this);
		}

		public TestTreeObject[] getChildren() {
			TestTreeObject[] result = new TestTreeObject[children.size()];
			children.toArray(result);
			return result;
		}

		public TestTreeObject getParent() {
			return parent;
		}

		public String getTitle() {
			return name;
		}

		public boolean hasChildren() {
			return children.size() > 0;
		}

		public void removeChild(TestTreeObject child) {
			children.remove(child);
			child.setParent(null);
		}

		public void setName(String name) {
			this.name = name;
		}

		public void setParent(TestTreeObject parent) {
			this.parent = parent;
		}

		@Override
		public String toString() {
			return name;
		}
	}


The input:

		TestTreeObject result = new TestTreeObject("");
		TestTreeObject first = new TestTreeObject("Teszt1");
		result.addChild(first);
		first.addChild(new TestTreeObject("Teszt2"));
		first.addChild(new TestTreeObject("Teszt3"));


You can see from the html and from the screenshot, that there is no expander div for the cell.

Please help me.

László

Re: TreeViewer RowTemplate Expander missing [message #1352767 is a reply to message #1352724] Tue, 13 May 2014 16:16 Go to previous messageGo to next message
László Erős is currently offline László Erős
Messages: 5
Registered: September 2013
Junior Member
Hello again!

I found the bug! Good news, its working, bad news, if you dont set the width of the TreeColumn, the expander not shown!

so:

Expander shown:
TreeColumn treeColumn = new TreeColumn(tree, SWT.NONE);
treeColumn.setWidth(150);


Expander not shown:
TreeColumn treeColumn = new TreeColumn(tree, SWT.NONE);



Please confirm the bug.

[Updated on: Tue, 13 May 2014 16:16]

Report message to a moderator

Re: TreeViewer RowTemplate Expander missing [message #1354396 is a reply to message #1352767] Wed, 14 May 2014 08:33 Go to previous message
Tim Buschtoens is currently offline Tim Buschtoens
Messages: 383
Registered: July 2009
Senior Member
Okay, I figured it out, and it's rally a bug. I hope we can fix it in
time for the 2.3 release. Please open a bug report.

Am 13.05.2014 18:16, schrieb László Erős:
> Hello again!
>
> I found the bug! Good news, its working, bad news, if you dont set the
> width of the TreeColumn, the expander not shown!
>
> so:
>
> expander shown:
>
> TreeColumn treeColumn = new TreeColumn(tree, SWT.NONE);
> treeColumn.setWidth(150);
>
>
> Expander not shown:
>
> TreeColumn treeColumn = new TreeColumn(tree, SWT.NONE);
>
>
>
> Please confirm the bug.

--
Tim Buschtöns

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Previous Topic:Alternative Client Polling stop working when code migrated from 1.4 to 2.2
Next Topic:JFace Data Binding and SWT.Modify
Goto Forum:
  


Current Time: Wed Oct 01 00:00:17 GMT 2014

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

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