Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » JFace » treeviewer with 2 columns
treeviewer with 2 columns [message #1015501] Thu, 28 February 2013 21:08 Go to next message
Mokhtar Abdu is currently offline Mokhtar Abdu
Messages: 104
Registered: November 2011
Senior Member
Hi,

my model is an arraylist of 2 objects, each has an arraylist field of some sub-objects that in turn each has an arraylist of sub-objects. so my tree looks like:

root1>
-----sub1.1
---------sub1.1.1
---------sub1.1.2
root2>
-----sub2.1
---------sub2.1.1
---------sub2.1.2

can i get the tree with 2 columns ? like this
root1>...............root2>
-----sub1.1...............-----sub2.1...............
---------sub1.1.1...............---------sub2.1.1...............
---------sub1.1.2...............---------sub2.1.2...............
I tried but I failed. this is what my method looks like:
@Override
	public Object[] getElements(Object inputElement) {
		return getChildren(inputElement);
	}

	@Override
	public Object[] getChildren(Object parentElement) {
		if (parentElement instanceof AnalysisResultsModel)
			return ((AnalysisResultsModel) parentElement).getResults().toArray();
		if (parentElement instanceof ResultsVersion)
			return ((ResultsVersion) parentElement).getCandidates().toArray();
		if (parentElement instanceof Candidate)
			return ((Candidate) parentElement).getElements().toArray();
		
		return null;
	}

Thanks a lot,
Mok
Re: treeviewer with 2 columns [message #1028686 is a reply to message #1015501] Thu, 28 March 2013 15:56 Go to previous message
Timur Achmetow is currently offline Timur Achmetow
Messages: 38
Registered: April 2012
Member
Look here:
http://www.vogella.com/articles/EclipseJFaceTree/article.html
Previous Topic:CoolBar on Windows does not works in Eclipse
Next Topic:Remove / Change Highlight-Color of ListViewer
Goto Forum:
  


Current Time: Fri Sep 19 20:10:55 GMT 2014

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

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