Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoratikhomirov2006-02-06 13:10:22 -0500
committeratikhomirov2006-02-06 13:10:22 -0500
commitab3cbec7ac30ebc2acac1565d3a11e5de969c32b (patch)
tree6975082a424975a565a3ea20368f2279f968c1c2 /plugins/org.eclipse.gmf.graphdef.codegen/templates/attr
parent6e7a0cab3de84e293361d07e3545872589e22f68 (diff)
downloadorg.eclipse.gmf-tooling-ab3cbec7ac30ebc2acac1565d3a11e5de969c32b.tar.gz
org.eclipse.gmf-tooling-ab3cbec7ac30ebc2acac1565d3a11e5de969c32b.tar.xz
org.eclipse.gmf-tooling-ab3cbec7ac30ebc2acac1565d3a11e5de969c32b.zip
major refactoring of gmfgraph codegen utilizing dispatcher infrastructure
Diffstat (limited to 'plugins/org.eclipse.gmf.graphdef.codegen/templates/attr')
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/Figure.javajet19
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/Label.javajet11
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/PolylgonDecoration.javajet7
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/Polyline.javajet16
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/PolylineDecoration.javajet21
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/RoundedRectangle.javajet11
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/Shape.javajet24
7 files changed, 109 insertions, 0 deletions
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/Figure.javajet b/plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/Figure.javajet
new file mode 100644
index 000000000..7cd0f28ef
--- /dev/null
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/Figure.javajet
@@ -0,0 +1,19 @@
+<%@ jet package="org.eclipse.gmf.graphdef.codegen.templates" class="FigureAttrGenerator"
+ imports="org.eclipse.gmf.gmfgraph.* org.eclipse.gmf.common.codegen.* org.eclipse.gmf.graphdef.codegen.Dispatcher"%>
+<%
+Dispatcher.Args args = (Dispatcher.Args) argument;
+final Figure figureInstance = args.getFigure();
+final String figureVarName = args.getVariableName();
+final ImportAssistant importManager = args.getImportManager();
+%>
+<%Color colorVal;
+if (figureInstance.eIsSet(GMFGraphPackage.eINSTANCE.getFigure_ForegroundColor())) {
+ colorVal = figureInstance.getForegroundColor();%>
+ <%=figureVarName%>.setForegroundColor(<%@ include file="../Color.jetinc"%>);
+<%} if (figureInstance.eIsSet(GMFGraphPackage.eINSTANCE.getFigure_BackgroundColor())) {
+ colorVal = figureInstance.getBackgroundColor();%>
+ <%=figureVarName%>.setBackgroundColor(<%@ include file="../Color.jetinc"%>);
+<%} if (figureInstance.eIsSet(GMFGraphPackage.eINSTANCE.getFigure_PreferredSize())) {
+ Dimension d = figureInstance.getPreferredSize();%>
+ <%=figureVarName%>.setPreferredSize(getMapMode().DPtoLP(<%=d.getDx()%>), getMapMode().DPtoLP(<%=d.getDy()%>));
+<%}%> \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/Label.javajet b/plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/Label.javajet
new file mode 100644
index 000000000..8d8582514
--- /dev/null
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/Label.javajet
@@ -0,0 +1,11 @@
+<%@ jet package="org.eclipse.gmf.graphdef.codegen.templates" class="LabelAttrGenerator"
+ imports="org.eclipse.gmf.gmfgraph.* org.eclipse.gmf.graphdef.codegen.Dispatcher"%>
+<%
+Dispatcher.Args args = (Dispatcher.Args) argument;
+final Label figureInstance = (Label) args.getFigure();
+final String figureVarName = args.getVariableName();
+final Dispatcher dispatcher = args.getDispatcher();
+%>
+<%if (figureInstance.eIsSet(GMFGraphPackage.eINSTANCE.getLabel_Text())) {%>
+<%=figureVarName%>.setText("<%=figureInstance.getText()%>");
+<%}%><%=dispatcher.dispatch("Figure", args)%> \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/PolylgonDecoration.javajet b/plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/PolylgonDecoration.javajet
new file mode 100644
index 000000000..11eec09bb
--- /dev/null
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/PolylgonDecoration.javajet
@@ -0,0 +1,7 @@
+<%@ jet package="org.eclipse.gmf.graphdef.codegen.templates" class="PolygonDecorationAttrGenerator"
+ imports="org.eclipse.gmf.graphdef.codegen.Dispatcher"%>
+<%
+Dispatcher.Args args = (Dispatcher.Args) argument;
+final Dispatcher dispatcher = args.getDispatcher();
+%>
+<%=dispatcher.dispatch("PolylineDecoration", args)%> \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/Polyline.javajet b/plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/Polyline.javajet
new file mode 100644
index 000000000..497789253
--- /dev/null
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/Polyline.javajet
@@ -0,0 +1,16 @@
+<%@ jet package="org.eclipse.gmf.graphdef.codegen.templates" class="PolylineAttrGenerator"
+ imports="org.eclipse.gmf.gmfgraph.* org.eclipse.gmf.common.codegen.* org.eclipse.gmf.graphdef.codegen.Dispatcher"%>
+<%
+Dispatcher.Args args = (Dispatcher.Args) argument;
+final Polyline figureInstance = (Polyline) args.getFigure();
+final String figureVarName = args.getVariableName();
+final ImportAssistant importManager = args.getImportManager();
+final Dispatcher dispatcher = args.getDispatcher();
+%>
+<%=dispatcher.dispatch("Shape", args)%>
+<%if (!figureInstance.getTemplate().isEmpty()) {
+ final String pointClassName = importManager.getImportedName("org.eclipse.draw2d.geometry.Point");
+ for (java.util.Iterator pointIt = figureInstance.getTemplate().iterator(); pointIt.hasNext(); ) {
+ Point p = (Point) pointIt.next();%>
+ <%=figureVarName%>.addPoint(new <%=pointClassName%>(<%=p.getX()%>, <%=p.getY()%>));
+<%}}%> \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/PolylineDecoration.javajet b/plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/PolylineDecoration.javajet
new file mode 100644
index 000000000..0a4b53871
--- /dev/null
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/PolylineDecoration.javajet
@@ -0,0 +1,21 @@
+<%@ jet package="org.eclipse.gmf.graphdef.codegen.templates" class="PolylineDecorationAttrGenerator"
+ imports="org.eclipse.gmf.gmfgraph.* org.eclipse.gmf.common.codegen.* org.eclipse.gmf.graphdef.codegen.Dispatcher java.util.*"%>
+<%
+Dispatcher.Args args = (Dispatcher.Args) argument;
+// not PolylineDecoration, as we use same template from PolygonDecoration
+final Polyline figureInstance = (Polyline) args.getFigure();
+final String figureVarName = args.getVariableName();
+final ImportAssistant importManager = args.getImportManager();
+final Dispatcher dispatcher = args.getDispatcher();
+%>
+// dispatchNext?
+<%=dispatcher.dispatch("Shape", args)%>
+<%if (!figureInstance.getTemplate().isEmpty()) {%>
+ <%=importManager.getImportedName("org.eclipse.draw2d.geometry.PointList")%> pl = new <%=importManager.getImportedName("org.eclipse.draw2d.geometry.PointList")%>();
+<% for (Iterator pointIt = figureInstance.getTemplate().iterator(); pointIt.hasNext(); ) {
+ Point p = (Point) pointIt.next();%>
+ pl.addPoint(<%=p.getX()%>, <%=p.getY()%>);
+<% } /*for*/ %>
+ <%=figureVarName%>.setTemplate(pl);
+ <%=figureVarName%>.setScale(getMapMode().DPtoLP(7), getMapMode().DPtoLP(3));
+<% } /*!if getTemplate().isEmpty()*/ %>
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/RoundedRectangle.javajet b/plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/RoundedRectangle.javajet
new file mode 100644
index 000000000..fd4a27459
--- /dev/null
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/RoundedRectangle.javajet
@@ -0,0 +1,11 @@
+<%@ jet package="org.eclipse.gmf.graphdef.codegen.templates" class="RoundedRectAttrGenerator"
+ imports="org.eclipse.gmf.gmfgraph.* org.eclipse.gmf.common.codegen.* org.eclipse.gmf.graphdef.codegen.Dispatcher"%>
+<%
+Dispatcher.Args args = (Dispatcher.Args) argument;
+final RoundedRectangle figureInstance = (RoundedRectangle) args.getFigure();
+final String figureVarName = args.getVariableName();
+final ImportAssistant importManager = args.getImportManager();
+final Dispatcher dispatcher = args.getDispatcher();
+%>
+<%=dispatcher.dispatch("Shape", args)%>
+<%=figureVarName%>.setCornerDimensions(new <%=importManager.getImportedName("org.eclipse.draw2d.geometry.Dimension")%>(getMapMode().DPtoLP(<%=figureInstance.getCornerWidth()%>), getMapMode().DPtoLP(<%=figureInstance.getCornerHeight()%>))); \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/Shape.javajet b/plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/Shape.javajet
new file mode 100644
index 000000000..288fe8fb7
--- /dev/null
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/templates/attr/Shape.javajet
@@ -0,0 +1,24 @@
+<%@ jet package="org.eclipse.gmf.graphdef.codegen.templates" class="ShapeAttrGenerator"
+ imports="org.eclipse.gmf.gmfgraph.* org.eclipse.gmf.common.codegen.* org.eclipse.gmf.graphdef.codegen.Dispatcher"%>
+<%
+Dispatcher.Args args = (Dispatcher.Args) argument;
+final Shape figureInstance = (Shape) args.getFigure();
+final String figureVarName = args.getVariableName();
+final ImportAssistant importManager = args.getImportManager();
+final Dispatcher dispatcher = args.getDispatcher();
+%>
+<%
+// PERHAPS, do this with reflection?
+%><%if (figureInstance.eIsSet(GMFGraphPackage.eINSTANCE.getShape_Fill())) {%>
+ <%=figureVarName%>.setFill(<%=figureInstance.isFill()%>);
+<%} if (figureInstance.eIsSet(GMFGraphPackage.eINSTANCE.getShape_Outline())) {%>
+ <%=figureVarName%>.setOutline(<%=figureInstance.isOutline()%>);
+<%} if (figureInstance.eIsSet(GMFGraphPackage.eINSTANCE.getShape_LineWidth())) {%>
+ <%=figureVarName%>.setLineWidth(<%=figureInstance.getLineWidth()%>);
+<%} if (figureInstance.eIsSet(GMFGraphPackage.eINSTANCE.getShape_LineKind())) {%>
+ <%=figureVarName%>.setLineStyle(<%=importManager.getImportedName("org.eclipse.draw2d.Graphics")%>.<%=figureInstance.getLineKind().getName()%>);
+<%} if (figureInstance.eIsSet(GMFGraphPackage.eINSTANCE.getShape_XorFill())) {%>
+ <%=figureVarName%>.setFillXOR(<%=figureInstance.isXorFill()%>);
+<%} if (figureInstance.eIsSet(GMFGraphPackage.eINSTANCE.getShape_XorOutline())) {%>
+ <%=figureVarName%>.setOutlineXOR(<%=figureInstance.isXorOutline()%>);
+<%}%><%=dispatcher.dispatch("Figure", args)%> \ No newline at end of file

Back to the top