Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoratikhomirov2006-02-15 09:44:26 -0500
committeratikhomirov2006-02-15 09:44:26 -0500
commited546bf950368f714ec119305262c3fe2bf6eae1 (patch)
tree28ed04de293110e5f221ff35895a8abe2b607b8a /plugins/org.eclipse.gmf.graphdef.codegen/templates/layoutData
parentbcde3e55601c71bba82a19b2f2cdc83a8c8566f3 (diff)
downloadorg.eclipse.gmf-tooling-ed546bf950368f714ec119305262c3fe2bf6eae1.tar.gz
org.eclipse.gmf-tooling-ed546bf950368f714ec119305262c3fe2bf6eae1.tar.xz
org.eclipse.gmf-tooling-ed546bf950368f714ec119305262c3fe2bf6eae1.zip
[mgolubev] #127252 layout support
Diffstat (limited to 'plugins/org.eclipse.gmf.graphdef.codegen/templates/layoutData')
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/layoutData/BorderLayoutData.javajet2
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/layoutData/CustomLayoutData.javajet5
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/layoutData/GridLayoutData.javajet5
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/layoutData/XYLayoutData.javajet33
4 files changed, 40 insertions, 5 deletions
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/layoutData/BorderLayoutData.javajet b/plugins/org.eclipse.gmf.graphdef.codegen/templates/layoutData/BorderLayoutData.javajet
index 18525aaf2..71d2d42b8 100644
--- a/plugins/org.eclipse.gmf.graphdef.codegen/templates/layoutData/BorderLayoutData.javajet
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/templates/layoutData/BorderLayoutData.javajet
@@ -36,5 +36,5 @@ switch(alignment.getValue()){
throw new IllegalArgumentException("Unknown Alignment: " + gmfLayoutData.getAlignment());
}
%>
- <%=figureVarName%>.getParent().getLayoutManager().setConstraint(<%=figureVarName%>, <%=dispatcher.getImportManager().getImportedName("org.eclipse.draw2d.BorderLayout")%>.<%=constantName%>);
+ <%=argsBundle.getManagerVariableName()%>.setConstraint(<%=figureVarName%>, <%=dispatcher.getImportManager().getImportedName("org.eclipse.draw2d.BorderLayout")%>.<%=constantName%>);
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/layoutData/CustomLayoutData.javajet b/plugins/org.eclipse.gmf.graphdef.codegen/templates/layoutData/CustomLayoutData.javajet
index 4dec5729f..64a0f1997 100644
--- a/plugins/org.eclipse.gmf.graphdef.codegen/templates/layoutData/CustomLayoutData.javajet
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/templates/layoutData/CustomLayoutData.javajet
@@ -6,5 +6,6 @@ final CustomLayoutData layoutData = (CustomLayoutData) args.getData();
final GraphDefDispatcher dispatcher = args.getDispatcher();
final String layoutImplClassName = dispatcher.getImportManager().getImportedName((String) dispatcher.getFQNSwitch().doSwitch(layoutData));
%>
-<%=layoutImplClassName%> <%=args.getLayoutVariableName()%> = new <%=layoutImplClassName%>();
-<%=dispatcher.dispatch("customAttributes", new Object[] {layoutData, dispatcher, args.getLayoutVariableName()})%>
+<%=layoutImplClassName%> <%=args.getConstraintVariableName()%> = new <%=layoutImplClassName%>();
+<%=dispatcher.dispatch("customAttributes", new Object[] {layoutData, dispatcher, args.getConstraintVariableName()})%>
+<%=args.getManagerVariableName()%>.setConstraint(<%=args.getVariableName()%>, <%=args.getConstraintVariableName()%>);
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/layoutData/GridLayoutData.javajet b/plugins/org.eclipse.gmf.graphdef.codegen/templates/layoutData/GridLayoutData.javajet
index 362940518..79de453ba 100644
--- a/plugins/org.eclipse.gmf.graphdef.codegen/templates/layoutData/GridLayoutData.javajet
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/templates/layoutData/GridLayoutData.javajet
@@ -6,7 +6,8 @@ GraphDefDispatcher.LayoutArgs argsBundle = (GraphDefDispatcher.LayoutArgs) argum
final GridLayoutData gmfLayoutData = (GridLayoutData) argsBundle.getData();
final String figureVarName = argsBundle.getVariableName();
final GraphDefDispatcher dispatcher = argsBundle.getDispatcher();
-final String layoutConstraintVarName = argsBundle.getLayoutVariableName();
+final String layoutConstraintVarName = argsBundle.getConstraintVariableName();
+final String layoutManagerVarName = argsBundle.getManagerVariableName();
final String layoutImplClassName = dispatcher.getImportManager().getImportedName((String) dispatcher.getFQNSwitch().doSwitch(gmfLayoutData));
%>
@@ -27,5 +28,5 @@ if (sizeHint != null){
<%=layoutConstraintVarName%>.verticalSpan = <%=gmfLayoutData.getVerticalSpan()%>;
<%=layoutConstraintVarName%>.grabExcessHorizontalSpace = <%=gmfLayoutData.isGrabExcessHorizontalSpace()%>;
<%=layoutConstraintVarName%>.grabExcessVerticalSpace = <%=gmfLayoutData.isGrabExcessVerticalSpace()%>;
- <%=figureVarName%>.getParent().getLayoutManager().setConstraint(<%=figureVarName%>, <%=layoutConstraintVarName%>);
+ <%=layoutManagerVarName%>.setConstraint(<%=figureVarName%>, <%=layoutConstraintVarName%>);
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/layoutData/XYLayoutData.javajet b/plugins/org.eclipse.gmf.graphdef.codegen/templates/layoutData/XYLayoutData.javajet
new file mode 100644
index 000000000..fa042a300
--- /dev/null
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/templates/layoutData/XYLayoutData.javajet
@@ -0,0 +1,33 @@
+
+<%@ jet package="org.eclipse.gmf.graphdef.codegen.templates" class="InitXYLayoutDataGenerator"
+ imports="org.eclipse.gmf.gmfgraph.* org.eclipse.gmf.graphdef.codegen.*"%>
+<%
+GraphDefDispatcher.LayoutArgs argsBundle = (GraphDefDispatcher.LayoutArgs) argument;
+final XYLayoutData gmfLayoutData = (XYLayoutData) argsBundle.getData();
+final String figureVarName = argsBundle.getVariableName();
+final GraphDefDispatcher dispatcher = argsBundle.getDispatcher();
+final String layoutConstraintVarName = argsBundle.getConstraintVariableName();
+final String layoutManagerVarName = argsBundle.getManagerVariableName();
+
+final String layoutImplClassName = dispatcher.getImportManager().getImportedName((String) dispatcher.getFQNSwitch().doSwitch(gmfLayoutData));
+%>
+ <%=layoutImplClassName%> <%=layoutConstraintVarName%> = new <%=layoutImplClassName%>();
+<%
+Point topLeft = gmfLayoutData.getTopLeft();
+if (topLeft != null){
+%>
+ <%=layoutConstraintVarName%>.x = <%=topLeft.getX()%>;
+ <%=layoutConstraintVarName%>.y = <%=topLeft.getY()%>;
+<%
+}
+%>
+<%
+Dimension size = gmfLayoutData.getSize();
+if (size != null){
+%>
+ <%=layoutConstraintVarName%>.width = <%=size.getDx()%>;
+ <%=layoutConstraintVarName%>.height = <%=size.getDy()%>;
+<%
+}
+%>
+ <%=layoutManagerVarName%>.setConstraint(<%=figureVarName%>, <%=layoutConstraintVarName%>);

Back to the top