Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoratikhomirov2006-02-13 12:36:07 -0500
committeratikhomirov2006-02-13 12:36:07 -0500
commitf8757a97d7e3a5e73cbc0be2d438e3921bc2a2e8 (patch)
treec3712afb5d03429a0b1f9a44a2694d1fb180ef5b /plugins/org.eclipse.gmf.graphdef.codegen/templates/new
parent80e4035d3bf83b8a35983bc23587f49485a14d3e (diff)
downloadorg.eclipse.gmf-tooling-f8757a97d7e3a5e73cbc0be2d438e3921bc2a2e8.tar.gz
org.eclipse.gmf-tooling-f8757a97d7e3a5e73cbc0be2d438e3921bc2a2e8.tar.xz
org.eclipse.gmf-tooling-f8757a97d7e3a5e73cbc0be2d438e3921bc2a2e8.zip
[mgolubev] #127252 layout support
Diffstat (limited to 'plugins/org.eclipse.gmf.graphdef.codegen/templates/new')
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/new/Figure.javajet5
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/new/Layout.javajet21
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/new/LayoutData.javajet16
3 files changed, 40 insertions, 2 deletions
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/new/Figure.javajet b/plugins/org.eclipse.gmf.graphdef.codegen/templates/new/Figure.javajet
index eecabf0fd..39bff0a20 100644
--- a/plugins/org.eclipse.gmf.graphdef.codegen/templates/new/Figure.javajet
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/templates/new/Figure.javajet
@@ -1,5 +1,5 @@
<%@ jet package="org.eclipse.gmf.graphdef.codegen.templates" class="NewFigureGenerator"
- imports="org.eclipse.gmf.gmfgraph.* org.eclipse.gmf.graphdef.codegen.GraphDefDispatcher"%>
+ imports="org.eclipse.gmf.gmfgraph.* org.eclipse.gmf.graphdef.codegen.*"%>
<%
GraphDefDispatcher.Args args = (GraphDefDispatcher.Args) argument;
final Figure figureInstance = args.getFigure();
@@ -10,4 +10,5 @@ final String figureClassName = dispatcher.getImportManager().getImportedName((St
// PRODUCES instance AND (!) initializes attributes
%>
<%=figureClassName%> <%=figureVarName%> = new <%=figureClassName%>();
-<%=args.getDispatcher().dispatch(figureInstance, args)%> \ No newline at end of file
+<%=args.getDispatcher().dispatch(figureInstance, args)%>
+<%=args.getDispatcher().dispatch("createLayout", dispatcher.createLayoutArgs(args))%>
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/new/Layout.javajet b/plugins/org.eclipse.gmf.graphdef.codegen/templates/new/Layout.javajet
new file mode 100644
index 000000000..ac8bd568b
--- /dev/null
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/templates/new/Layout.javajet
@@ -0,0 +1,21 @@
+<%@ jet package="org.eclipse.gmf.graphdef.codegen.templates" class="NewLayoutGenerator"
+ imports="org.eclipse.gmf.gmfgraph.* org.eclipse.gmf.graphdef.codegen.*"%>
+<%
+GraphDefDispatcher.LayoutArgs argsBundle = (GraphDefDispatcher.LayoutArgs) argument;
+final FigureMarker figureMarker = argsBundle.getFigure();
+final String figureVarName = argsBundle.getVariableName();
+final String layouterVarName = argsBundle.getLayoutVariableName();
+final GraphDefDispatcher dispatcher = argsBundle.getDispatcher();
+%>
+
+<%
+Layout gmfLayout= figureMarker.getLayout();
+if (gmfLayout != null){
+ final String layouterImplClass = dispatcher.getImportManager().getImportedName((String) dispatcher.getFQNSwitch().doSwitch(gmfLayout));
+%>
+ <%=layouterImplClass%> <%=layouterVarName%> = new <%=layouterImplClass%>();
+ <%=argsBundle.getDispatcher().dispatch(gmfLayout, argsBundle)%>
+ <%=figureVarName%>.setLayoutManager(<%=layouterVarName%>);
+<%
+}
+%>
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/new/LayoutData.javajet b/plugins/org.eclipse.gmf.graphdef.codegen/templates/new/LayoutData.javajet
new file mode 100644
index 000000000..efe9f349f
--- /dev/null
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/templates/new/LayoutData.javajet
@@ -0,0 +1,16 @@
+<%@ jet package="org.eclipse.gmf.graphdef.codegen.templates" class="NewLayoutDataGenerator"
+ imports="org.eclipse.gmf.gmfgraph.* org.eclipse.gmf.graphdef.codegen.*"%>
+<%
+// NOTE: this code expects that constrainted figure is already added to its parent
+
+GraphDefDispatcher.LayoutArgs argsBundle = (GraphDefDispatcher.LayoutArgs) argument;
+final GraphDefDispatcher dispatcher = argsBundle.getDispatcher();
+final LayoutData gmfLayoutData = argsBundle.getData();
+final Figure figureInstance = argsBundle.getFigure();
+
+// merely makes sure layoutData present
+// and parent figure got chance to have layout initialized
+
+if (gmfLayoutData != null && figureInstance.getParent() != null && figureInstance.getParent().getLayout() != null) {%>
+<%=dispatcher.dispatch(gmfLayoutData, argsBundle)%>
+<%}%>

Back to the top