Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 47a062230f71b7497a8e6622dcde7770619b09b0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<%@ jet package="org.eclipse.gmf.graphdef.codegen.templates" class="TopShapeGenerator" 
	imports="org.eclipse.gmf.gmfgraph.* org.eclipse.gmf.gmfgraph.util.* org.eclipse.gmf.common.codegen.* org.eclipse.gmf.graphdef.codegen.* java.util.*"%>
<%
Object[] args = (Object[]) argument;
Shape figure = (Shape) args[0];
final ImportAssistant importManager = (ImportAssistant) args[1];
final FigureQualifiedNameSwitch fqnSwitch = (FigureQualifiedNameSwitch) args[2];
final GraphDefDispatcher dispatcher = (GraphDefDispatcher) args[3];
%>

<%importManager.markImportLocation(stringBuffer);%>

/**
 * @generated
 */
public class <%=figure.getName()%> extends <%=fqnSwitch.get(figure, importManager)%> {

	/**
	 * @generated
	 */
	public <%=figure.getName()%>() {
<%
GraphDefDispatcher.LayoutArgs dispatcherArgs = dispatcher.createLayoutArgs(figure, "this", "myGenLayoutManager", null);
%>	
		<%=dispatcher.dispatch("createLayout", dispatcherArgs)%>
		<%=dispatcher.dispatch(figure, dispatcherArgs)%>
<%
for (Iterator it = figure.getResolvedChildren().iterator(); it.hasNext();) {
		Figure next = (Figure) it.next();
		final String childVarName = "child" + next.getName();%>
		
		<%=fqnSwitch.get(next, importManager)%> <%=childVarName%> = createFigure<%=next.getName()%>();
		setFigure<%=next.getName()%>(<%=childVarName%>);
		add(<%=childVarName%>);
		<%=dispatcher.dispatch("createLayoutData", dispatcher.createLayoutArgs(next, childVarName, dispatcherArgs.getManagerVariableName(), "layoutData" + next.getName()))%>		
<%}%>
	}

<%
int fc = 0;
for (Iterator it = figure.getResolvedChildren().iterator(); it.hasNext(); fc++) {
	Figure next = (Figure) it.next();
	final String nextClassName = fqnSwitch.get(next, importManager);%>

	/**
	 * @generated
	 */
	private <%=nextClassName%> f<%=next.getName()%>; 

	/**
	 * @generated
	 */
	public <%=nextClassName%> getFigure<%=next.getName()%>() {
		return f<%=next.getName()%>;
	}

	/**
	 * @generated
	 */
	protected void setFigure<%=next.getName()%>(<%=nextClassName%> figure) {
		f<%=next.getName()%> = figure;
	}

	/**
	 * @generated
	 */
	private <%=nextClassName%> createFigure<%=next.getName()%>() {
<% GraphDefDispatcher.LayoutArgs childFigureArgs = dispatcher.createLayoutArgs(next, next.getName(), "layoutManager" + next.getName(), null);%>
<%=dispatcher.dispatch("instantiate", childFigureArgs)%>
<%=dispatcher.dispatch("Children", new Object[] {next.getChildren(), dispatcher, childFigureArgs})%>
		return <%=next.getName()%>;
	}

<%}%>

<%if (false == figure instanceof Polyline) {/*no much sense to define useLocalCoordinates for polyline and its descendants*/%>
<%@ include file="localCoordinates.jetinc"%>
<%}%>
}<%importManager.emitSortedImports();%>

Back to the top