Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » enforce node position n gridlayout(enforce node position n gridlayout)
enforce node position n gridlayout [message #1007942] Fri, 08 February 2013 11:06 Go to next message
Mokhtar Alshubei is currently offline Mokhtar AlshubeiFriend
Messages: 121
Registered: November 2011
Location: Germany
Senior Member
Hello all,

Could you help me as how to enforce the position of a certain node in a certain column and row (i.e. cell) in a GridlayoutAlgoritm?

I had got valuable help [message #1007779]

Thanks,
Mok
Re: enforce node position n gridlayout [message #1008004 is a reply to message #1007942] Fri, 08 February 2013 15:00 Go to previous messageGo to next message
Zoltan Ujhelyi is currently offline Zoltan UjhelyiFriend
Messages: 392
Registered: July 2015
Senior Member
Hi,

The algorithm does not support direct positioning. However, by ordering the nodes using a comparator it might be possible to put each element to its space. If not, than you have to implement your own changes - that should not be too hard.

Cheers,
Zoltán
Re: enforce node position n gridlayout [message #1009786 is a reply to message #1008004] Fri, 15 February 2013 17:56 Go to previous messageGo to next message
Mokhtar Alshubei is currently offline Mokhtar AlshubeiFriend
Messages: 121
Registered: November 2011
Location: Germany
Senior Member
Hi,
i set a comparator to my gridlayout algo object like this:
public void customizeLayout(ArrayList<ResultsVersion> resultsVersions) {
		EvolutionGridLayoutAlgo glayoutAlg = new EvolutionGridLayoutAlgo(resultsVersions);
		glayoutAlg.setComparator(new Comparator<CandidateNode>() {
			
			@Override
			public int compare(CandidateNode o1, CandidateNode o2) {
				String id1 = o1.getCandidate().getIdentity();
				String id2 = o2.getCandidate().getIdentity();
				
			      return id1.compareTo(id2);
			}
		});
		setLayoutAlgorithm(glayoutAlg, true);
	}


but i am still missing something as it didn't work. Is this the way you set a comparator? the
CandidateNode
class extends GraphNode. Should I rather make my CandidateNode implements Comparable and the rest is automatically doable by the grid logic itsef?
thank you,
Mok
Re: enforce node position n gridlayout [message #1010185 is a reply to message #1009786] Sat, 16 February 2013 20:25 Go to previous message
Zoltan Ujhelyi is currently offline Zoltan UjhelyiFriend
Messages: 392
Registered: July 2015
Senior Member
Hi,

it seems I wasn't clear about my intentions with the comparator. I was asking to try to use the GraphViewer#setComparator method, as it will order the nodes before they are added to the algorithm (at least if I am not mistaken).

Of course, a layout algorithm may also offer a comparator support, but in that case it is their responsibility to handle the data. The GridLayoutAlgorithm does not do this, but relies on the external ordering created by the GraphViewer before.

I hope, it will work now.

Cheers,
Zoltán
Previous Topic:Draw2D & GEF: qualified associations
Next Topic:Create Pie chart Figure
Goto Forum:
  


Current Time: Fri Apr 19 22:10:19 GMT 2024

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

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

Back to the top