Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » ZEST - How to recreate DotGraph Tree on event
ZEST - How to recreate DotGraph Tree on event [message #870856] Thu, 10 May 2012 01:21 Go to next message
Menard Mabunga is currently offline Menard MabungaFriend
Messages: 7
Registered: January 2012
Junior Member
Hi all,

Im developing a program that generates genealogy tree, my problem is that I cant recreate a tree upon events.

I have a GenealogyTree views, which displays blank tree in initial run of the program.

my GenealogyTree.class
	public void createPartControl(Composite parent) {
		// TODO Auto-generated method stub
		SearchGermplasm searchGermplasm = (SearchGermplasm) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().findView(SEARCH_VIEW);
		 graph = new DotGraph(parent, SWT.NONE);
	     algorithm = new TreeLayoutAlgorithm();
	     graph.setLayoutAlgorithm(algorithm, true);
	     con = searchGermplasm.getCon();
 		myGID = new Integer(searchGermplasm.getMyGID());
 		myLEVEL = searchGermplasm.getMyLEVEL();
 		loadTree(myGID, myLEVEL);

	private void getParents(GermplasmPedigreeTreeNode currentChildNode, int level) throws QueryException
		if(level > 0)
			//get ID of this Germplasm for linking parent nodes to this child node
			Germplasm rootChildGermplasm = currentChildNode.getGermplasm();
			Integer childGermplasmID = rootChildGermplasm.getGid();

			String childGermplasmName = rootChildGermplasm.getPreferredName().getNval();
			for(GermplasmPedigreeTreeNode parentTreeNode : currentChildNode.getLinkedNodes())
				parentGermplasm = parentTreeNode.getGermplasm();
				System.out.println("Parent of : "+childGermplasmID+" is ---> " + parentGermplasm.getGid());



	public void loadTree(int GID, int level) {
		// TODO Auto-generated method stub
		try {
			tree = con.getManager().generatePedigreeTree(new Integer(GID), level);
		} catch (QueryException e) {
			// TODO Auto-generated catch block
		try {
			getParents(tree.getRoot(), level);
		} catch (QueryException e) {
			// TODO Auto-generated catch block

Now upon search events from SearchGermplasm.class, the user will define ID and LEVEL and will now the value of myGID and myLEVEL

method after clicking search button

public void setSGID(int sGID, int tLevel) throws QueryException, ConfigException
		GenealogyTree genealogyTree = new GenealogyTree();

		genealogyTree.loadTree(myGID, myLEVEL);

the method is working as its display all the list of parent and child records, but the problem is it doesnt display or recreate the tree.

Hope you all can help me with this.

Menard Mabunga
Re: ZEST - How to recreate DotGraph Tree on event [message #874349 is a reply to message #870856] Sun, 20 May 2012 16:29 Go to previous message
Fabian Steeg is currently offline Fabian SteegFriend
Messages: 76
Registered: July 2009
To provide a useful suggestion, I would probably need an isolated full working example. But in general, after you reassign the graph, you could try to set its layout (Graph#setLayout), then layout its parent (Composite#layout), and finally apply the graph layout (Graph#applyLayout). Perhaps a look into how I did something similar in the ZestGraphView can help.
Previous Topic:Refresh property view after setting another editpart
Next Topic:GEF PolylineConnection with Rounded Corners along with bend points
Goto Forum:

Current Time: Sun Jun 24 07:35:36 GMT 2018

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

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

Back to the top