Plugins (1083)


Training and Consulting (44)



EPIC Poll

What is your favourite developer portal?

[ Results | Polls ]

Votes: 540
Comments: 0

Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
gamby
Post subject: Switching from TableViewer to TreeViewer at running time  PostPosted: Dec 13, 2007 - 09:38 AM



Joined: Aug 11, 2006
Posts: 11
Location: Bologna - Italy
Hi all,

I would like to be able to switch (pushing a button for example) from a TableViewer to a TreeViewer and viceversa inside the same View obviously.

In this way I could provide the user with a double way to access data.

I'm able to show both viewer, but I don't able to show ONLY one viewer once

There isn't a method like "removeCurrentViewer()"...

Any hint would be appreciated,
thanks in advance and best regards
Gamby
 
 View user's profile Send private message  
Reply with quote Back to top
tlorbeer
Post subject:   PostPosted: Dec 16, 2007 - 06:00 PM



Joined: Dec 13, 2007
Posts: 1

Hi,

1. set your viewer to null
2. dispose the underlying control
3. create the new control on same parent
4. create the new viewer

Thomas
 
 View user's profile Send private message  
Reply with quote Back to top
gamby
Post subject:   PostPosted: Jan 09, 2008 - 11:24 AM



Joined: Aug 11, 2006
Posts: 11
Location: Bologna - Italy
Quote:

1. set your viewer to null
2. dispose the underlying control
3. create the new control on same parent
4. create the new viewer


Hi, thanks....but I have already followed that "pattern"...

My doubts are about the content, which is unique and it is set one time to table viewer and on time to tree viewer.

But, when I dispose a control, also the content input is destroyed...and so, to preserve it, I clone it then dispose the control...

However, I'm able only to switch the first time from table to tree, then, switching to table again, I don't see the content...

Any hint?
Thanks in advance.
Best regards.
Raffaele
 
 View user's profile Send private message  
Reply with quote Back to top
Andrea_Casarella
Post subject: Switching from TableViewer to TreeViewer  PostPosted: Apr 07, 2008 - 06:39 PM



Joined: Apr 06, 2008
Posts: 1
Location: Lugano
Sorry but I had the same problem but although the suggestion I cannot manage this view transition.

I create a method
ClassTableViewer.this.changeView();

where I create a new instance of a TableTreeViewer but I can't see any result.

Java snipped:
Control control = viewer.getControl();
control.setParent(parent);
// viewer is an instance of a TableViewer which is already shown
viewer = null;
control.dispose();

ttv = new TableTreeViewer(control.getParent());
ttv.getTableTree().setLayoutData(new GridData(GridData.FILL_BOTH));
// Set up the table
Table table = ttv.getTableTree().getTable();
new TableColumn(table, SWT.LEFT).setText("Package");
new TableColumn(table, SWT.LEFT).setText("Classes");
new TableColumn(table, SWT.RIGHT).setText("YADDA");
new TableColumn(table, SWT.RIGHT).setText("LOREM");
new TableColumn(table, SWT.RIGHT).setText("IPSUM");

// Expand everything
ttv.expandAll();

// Pack the columns
for (int i = 0, n = table.getColumnCount(); i < n; i++) {
table.getColumn(i).pack();
}

// Turn on the header and the lines
table.setHeaderVisible(true);
table.setLinesVisible(true);

}
Can anyone help me!!
 
 View user's profile Send private message Visit poster's website  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT - 6 Hours
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2004 The PNphpBB Group
Credits