Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » customize gridlayout(how to access mynode data in grid applyLayout....)
customize gridlayout [message #1014355] Mon, 25 February 2013 16:42 Go to next message
Mokhtar Alshubei is currently offline Mokhtar AlshubeiFriend
Messages: 121
Registered: November 2011
Location: Germany
Senior Member
Embarrassed sorry first that i posted this in another forum...
Hi,

so far, I have copied the impl. of GridlyoutAlgo to my class and added one parameter to the constructor. From that, I could restrict the row and col number of my gridlayout to what i want. But i got stuck when I looked to the folowing method:
Code: [Select all] [Show/ hide]
@Override
	protected synchronized void applyLayoutInternal(InternalNode[] entitiesToLayout,
			InternalRelationship[] relationshipsToConsider, double boundsX,
			double boundsY, double boundsWidth, double boundsHeight) {
		int index = 0;
		for (int i = 0; i < rows; i++) {
			for (int j = 0; j < cols; j++) {
				if ((i * cols + j) < numChildren) {
					// find new position for child
					InternalNode sn = entitiesToLayout[index++];
					double xmove = boundsX + j * colWidth + offsetX;
					double ymove = boundsY + i * rowHeight + offsetY;
					sn.setInternalLocation(xmove, ymove);
					sn.setInternalSize(Math.max(w, MIN_ENTITY_SIZE), Math.max(h, MIN_ENTITY_SIZE));
				}
			}
			fireProgressEvent(2 + i, totalProgress);
		}
		updateLayoutLocations(entitiesToLayout);
		fireProgressEvent(totalProgress, totalProgress);
		
	}


The nodes of my graph are of type CandidateNode (subclass of GraphNode + some fields). How can I now access those "some fields" inside this method????
InternalNode.getGraphData() doesn't seem to work.

Thanks,
Mok

[Updated on: Mon, 25 February 2013 16:43]

Report message to a moderator

Re: customize gridlayout [message #1014358 is a reply to message #1014355] Mon, 25 February 2013 16:49 Go to previous messageGo to next message
Zoltan Ujhelyi is currently offline Zoltan UjhelyiFriend
Messages: 392
Registered: July 2015
Senior Member
Hi,

if you are using Zest2 or GEF4 Zest, than support for reaching the original nodes was re-introduced by fixing issue https://bugs.eclipse.org/bugs/show_bug.cgi?id=337144

For Zest 1.x, the original description shows the solution:
InternalNode sn = entitiesToLayout[x];
GraphNode node = (GraphNode)sn.getLayoutEntity().getGraphData();


Hope this helps,
Zoltán
Re: customize gridlayout [message #1014446 is a reply to message #1014358] Mon, 25 February 2013 20:59 Go to previous message
Mokhtar Alshubei is currently offline Mokhtar AlshubeiFriend
Messages: 121
Registered: November 2011
Location: Germany
Senior Member
Hi Zoltán,
yes that helped and now I can have the row and column original objects and I hope I can use this info to shoot the figures to their places, having gaps if must.

Thank you!
Mok
Previous Topic:BendpointEditPolicy - incorrect location after zooming
Next Topic:draw2d without GEF in an e4 environment
Goto Forum:
  


Current Time: Wed Apr 24 23:34:01 GMT 2024

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

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

Back to the top