Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » RAP Tree - moveable columns not working(setMoveable(true) for Tree columns doesn't work)
RAP Tree - moveable columns not working [message #1018755] Thu, 14 March 2013 08:21 Go to next message
John Gymer is currently offline John Gymer
Messages: 187
Registered: November 2012
Location: UK
Senior Member
Before I open a bug, could someone confirm if this is indeed a bug, or working as designed in RAP... basically I have a Tree which has setMoveable(true) for all columns, but if I try to actually drag the columns around to change their order, the 'ghost' of the column header gets left on the display and no re-ordering is done.
Same code works ok in SWT.

Just to note, I'm using quite a recent Nightly of RAP from a few days ago.

Snippet:

/* DEMONSTRATES RAP ISSUE WITH COLUMN MOVE IN RAP */
package bug.snippet;

import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.TreeColumn;
import org.eclipse.swt.widgets.TreeItem;

public class Bugsy {
	private Display display;
	private Shell shell;
	private Tree tree;
	
	public void begin() {
		System.out.println("BugSnippy Starting...");
		
		// create Shell
		display = new Display();
		shell = new Shell(display, SWT.TITLE|SWT.BORDER|SWT.CLOSE);
		shell.setText("Bug Snippet");
		shell.setBackground(new Color(null, new RGB(192,192,192)));
		FormLayout layout = new FormLayout();
		layout.marginWidth = 0;
		layout.marginHeight = 0;
		layout.marginLeft = 10;
		layout.marginTop = 10;
		layout.marginRight = 10;
		layout.marginBottom = 10;
		layout.spacing = 0;
		shell.setLayout(layout);

		// create the Tree
		tree = new Tree(shell, SWT.MULTI|SWT.FULL_SELECTION);
		tree.setHeaderVisible(true);
		tree.setLinesVisible(true);
		FormData fd = new FormData();
		fd.left = new FormAttachment(0, 10);
		fd.top = new FormAttachment(0, 10);
		fd.width = 800;
		fd.height = 600;
		tree.setLayoutData(fd);

		// create the columns
		for (int j = 0; j < 10; j++) {
			TreeColumn tc = new TreeColumn(tree, SWT.NONE);
			tc.setMoveable(true);
			tc.setResizable(true);
			tc.setText("Col"+j);
			tc.setWidth(100+j*5);
		}
		
		// populate some data
		for (int i = 0; i < 100; i++) {
			TreeItem it = new TreeItem(tree, SWT.NONE);
			String[] data = new String[10];
			for (int j = 0; j < 10; j++) {
				data[j] = "Row"+i+" Col"+j;
			}
			it.setText(data);
		}

		shell.layout();

		shell.open();
		//SWT ONLY: while (!shell.isDisposed()) {
		//SWT ONLY: if (!display.readAndDispatch())
		//SWT ONLY: 	display.sleep();
		//SWT ONLY: }
		//SWT ONLY: display.dispose();

		System.out.println("BugSnippy Done!");
	}

}


Thanks, John


---
Just because you can doesn't mean you should
Re: RAP Tree - moveable columns not working [message #1018826 is a reply to message #1018755] Thu, 14 March 2013 10:39 Go to previous messageGo to next message
Tim Buschtoens is currently offline Tim Buschtoens
Messages: 382
Registered: July 2009
Senior Member
Hi.

Your snippet works fine for me in FF, IE and Chrome. What browser/OS are
you using? Can you give a screenshot?

Greetings,
Tim

Am 14.03.2013 13:21, schrieb John Gymer:
> Before I open a bug, could someone confirm if this is indeed a bug, or
> working as designed in RAP... basically I have a Tree which has
> setMoveable(true) for all columns, but if I try to actually drag the
> columns around to change their order, the 'ghost' of the column header
> gets left on the display and no re-ordering is done.
> Same code works ok in SWT.
>
> Just to note, I'm using quite a recent Nightly of RAP from a few days ago.
>
> Snippet:
>
>
> /* DEMONSTRATES RAP ISSUE WITH COLUMN MOVE IN RAP */
> package bug.snippet;
>
> import org.eclipse.swt.SWT;
> import org.eclipse.swt.graphics.Color;
> import org.eclipse.swt.graphics.RGB;
> import org.eclipse.swt.layout.FormAttachment;
> import org.eclipse.swt.layout.FormData;
> import org.eclipse.swt.layout.FormLayout;
> import org.eclipse.swt.widgets.Display;
> import org.eclipse.swt.widgets.Shell;
> import org.eclipse.swt.widgets.Tree;
> import org.eclipse.swt.widgets.TreeColumn;
> import org.eclipse.swt.widgets.TreeItem;
>
> public class Bugsy {
> private Display display;
> private Shell shell;
> private Tree tree;
>
> public void begin() {
> System.out.println("BugSnippy Starting...");
>
> // create Shell
> display = new Display();
> shell = new Shell(display, SWT.TITLE|SWT.BORDER|SWT.CLOSE);
> shell.setText("Bug Snippet");
> shell.setBackground(new Color(null, new RGB(192,192,192)));
> FormLayout layout = new FormLayout();
> layout.marginWidth = 0;
> layout.marginHeight = 0;
> layout.marginLeft = 10;
> layout.marginTop = 10;
> layout.marginRight = 10;
> layout.marginBottom = 10;
> layout.spacing = 0;
> shell.setLayout(layout);
>
> // create the Tree
> tree = new Tree(shell, SWT.MULTI|SWT.FULL_SELECTION);
> tree.setHeaderVisible(true);
> tree.setLinesVisible(true);
> FormData fd = new FormData();
> fd.left = new FormAttachment(0, 10);
> fd.top = new FormAttachment(0, 10);
> fd.width = 800;
> fd.height = 600;
> tree.setLayoutData(fd);
>
> // create the columns
> for (int j = 0; j < 10; j++) {
> TreeColumn tc = new TreeColumn(tree, SWT.NONE);
> tc.setMoveable(true);
> tc.setResizable(true);
> tc.setText("Col"+j);
> tc.setWidth(100+j*5);
> }
>
> // populate some data
> for (int i = 0; i < 100; i++) {
> TreeItem it = new TreeItem(tree, SWT.NONE);
> String[] data = new String[10];
> for (int j = 0; j < 10; j++) {
> data[j] = "Row"+i+" Col"+j;
> }
> it.setText(data);
> }
>
> shell.layout();
>
> shell.open();
> //SWT ONLY: while (!shell.isDisposed()) {
> //SWT ONLY: if (!display.readAndDispatch())
> //SWT ONLY: display.sleep();
> //SWT ONLY: }
> //SWT ONLY: display.dispose();
>
> System.out.println("BugSnippy Done!");
> }
>
> }
>
>
> Thanks, John
>

--
Tim Buschtöns

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

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: RAP Tree - moveable columns not working [message #1018885 is a reply to message #1018826] Thu, 14 March 2013 12:06 Go to previous messageGo to next message
John Gymer is currently offline John Gymer
Messages: 187
Registered: November 2012
Location: UK
Senior Member
Hi Tim,

Sure... I'm running RAP from Eclipse Juno/AndroidADT IDE on Win7 x64.
I have tried Chrome 25 and IE9 and FF7.0.1 on that same Win7 machine, as well as connecting Chrome on a Nexus7 Android - they all behave the same way. I can drag a column heading left/right, but when I let go of it, it just leaves the ghost at that position.
Screen shot of IE9 and Chrome from Win7:

IE9:
index.php/fa/13864/0/

Chrome25:
index.php/fa/13865/0/

Best regards, John


---
Just because you can doesn't mean you should
Re: RAP Tree - moveable columns not working [message #1018897 is a reply to message #1018885] Thu, 14 March 2013 12:33 Go to previous messageGo to next message
Tim Buschtoens is currently offline Tim Buschtoens
Messages: 382
Registered: July 2009
Senior Member
Hi.

Just a wild guess before i dive deeper into that issue:
Do you run your application in SWT Mode[1]? That would explain this
behavior completely, since you have no main loop in your snippet.
How do you launch the snippet? Does inserting the main loop again fix it?

Greetings,
Tim

[1]
eclipse.org/rap/developers-guide/devguide.php?topic=application-setup.html


Am 14.03.2013 17:06, schrieb John Gymer:
> Hi Tim,
>
> Sure... I'm running RAP from Eclipse Juno/AndroidADT IDE on Win7 x64.
> I have tried Chrome 25 and IE9 and FF7.0.1 on that same Win7 machine, as well as connecting Chrome on a Nexus7 Android - they all behave the same way. I can drag a column heading left/right, but when I let go of it, it just leaves the ghost at that position.
> Screen shot of IE9 and Chrome from Win7:
>
> IE9:
>
>
> Chrome25:
>
>
> Best regards, John
>

--
Tim Buschtöns

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

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: RAP Tree - moveable columns not working [message #1018906 is a reply to message #1018897] Thu, 14 March 2013 13:05 Go to previous messageGo to next message
John Gymer is currently offline John Gymer
Messages: 187
Registered: November 2012
Location: UK
Senior Member
STUPID ME! Shocked
Sorry Tim, you are absolutely correct... I add and remove that main loop constantly in my BugSnippet code as I'm constantly trying things out in SWT, RAP and Tabris! Just forgot to do it on this occasion!
Totally my fault... adding the loop back in sorts it out!
RED FACE Embarrassed
John


---
Just because you can doesn't mean you should
Re: RAP Tree - moveable columns not working [message #1018980 is a reply to message #1018906] Thu, 14 March 2013 16:41 Go to previous messageGo to next message
Ralf Sternberg is currently offline Ralf Sternberg
Messages: 1290
Registered: July 2009
Senior Member

John, you're not alone ;-) Everyone walks into that trap.

We introduced AbstractEntryPoint in 2.0, mostly to avoid this problem.
If you base your snippets on this class, you don't have to care for the
main loop anymore.

Regards,
Ralf

--
Ralf Sternberg

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

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: RAP Tree - moveable columns not working [message #1019214] Fri, 15 March 2013 04:52 Go to previous messageGo to next message
John Gymer is currently offline John Gymer
Messages: 187
Registered: November 2012
Location: UK
Senior Member
Thanks Ralf!
Glad I'm not alone.
I'll take a look at AbstractEntryPoint.
Cheers, John


---
Just because you can doesn't mean you should
Re: RAP Tree - moveable columns not working [message #1019366 is a reply to message #1018906] Fri, 15 March 2013 10:49 Go to previous message
Tim Buschtoens is currently offline Tim Buschtoens
Messages: 382
Registered: July 2009
Senior Member
Yeah, well, it happens a lot around here, but we have not yet found a
way to warn the user when this happens. Just use AbstractEntryPoint all
the time, then it should always work.

Am 14.03.2013 18:05, schrieb John Gymer:
> STUPID ME! 8o Sorry Tim, you are absolutely correct... I add and remove
> that main loop constantly in my BugSnippet code as I'm constantly trying
> things out in SWT, RAP and Tabris! Just forgot to do it on this occasion!
> Totally my fault... adding the loop back in sorts it out!
> RED FACE :blush: John
>

--
Tim Buschtöns

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

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Previous Topic:No un-/redeploy possible in Tomcat and WebSphere
Next Topic:org.json package missing from build
Goto Forum:
  


Current Time: Sat Aug 30 20:42:46 EDT 2014

Powered by FUDForum. Page generated in 0.02066 seconds