Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: f747ec7df8351eb8b9aa755eda2312f29079f50d (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
<%@ jet package="org.eclipse.gmf.graphdef.codegen.templates" class="InitBorderLayoutDataGenerator"
	imports="org.eclipse.gmf.gmfgraph.* org.eclipse.gmf.graphdef.codegen.*"%>
<%
GraphDefDispatcher.LayoutArgs argsBundle = (GraphDefDispatcher.LayoutArgs) argument;
final BorderLayoutData gmfLayoutData = (BorderLayoutData) argsBundle.getData();
final GraphDefDispatcher dispatcher = argsBundle.getDispatcher();
%>

<%
Alignment alignment = gmfLayoutData.getAlignment();
if (alignment == null){
	alignment = Alignment.CENTER_LITERAL;
}
final String constantName;
switch(alignment.getValue()){
	case Alignment.CENTER: 
	case Alignment.FILL: 
		constantName = "CENTER";
		break;
	case Alignment.BEGINNING:
		if (gmfLayoutData.isVertical()){
			constantName = "TOP";
		} else {
			constantName = "LEFT";
		}
		break;
	case Alignment.END:
		if (gmfLayoutData.isVertical()){
			constantName = "BOTTOM";
		} else {
			constantName = "RIGHT";
		}
		break;
	default:
		throw new IllegalArgumentException("Unknown Alignment: " + gmfLayoutData.getAlignment());
}
%>
	Object <%=argsBundle.getConstraintVariableName()%> = <%=dispatcher.getImportManager().getImportedName("org.eclipse.draw2d.BorderLayout")%>.<%=constantName%>;

Back to the top