Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoratikhomirov2006-05-02 11:44:15 +0000
committeratikhomirov2006-05-02 11:44:15 +0000
commitd10419d8617a229fbcc45f3a0358566d8a4aaf75 (patch)
tree4e9903d690354a25a05f88b4183c3039d11fc849 /plugins/org.eclipse.gmf.graphdef.codegen/src
parentd1df87d283ceb73df7175d9266c9742a262c26c1 (diff)
downloadorg.eclipse.gmf-tooling-d10419d8617a229fbcc45f3a0358566d8a4aaf75.tar.gz
org.eclipse.gmf-tooling-d10419d8617a229fbcc45f3a0358566d8a4aaf75.tar.xz
org.eclipse.gmf-tooling-d10419d8617a229fbcc45f3a0358566d8a4aaf75.zip
[mgolubev] #139139 Compilation error in the generated diagram code if DiagramLabel points to the deep Label
Add getters/setters for each figure that is being used by any diagram element
Diffstat (limited to 'plugins/org.eclipse.gmf.graphdef.codegen/src')
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/FigureChildrenGenerator.java139
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/InitBorderLayoutDataGenerator.java19
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/InitCustomLayoutDataGenerator.java11
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/InitGridLayoutDataGenerator.java13
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/InitXYLayoutDataGenerator.java13
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/NewLayoutDataGenerator.java10
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/TopFigureGenerator.java103
7 files changed, 139 insertions, 169 deletions
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/FigureChildrenGenerator.java b/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/FigureChildrenGenerator.java
index 0ea64e276..04b5ae89e 100644
--- a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/FigureChildrenGenerator.java
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/FigureChildrenGenerator.java
@@ -2,6 +2,9 @@ package org.eclipse.gmf.graphdef.codegen.templates;
import org.eclipse.gmf.gmfgraph.*;
import org.eclipse.gmf.graphdef.codegen.*;
+import org.eclipse.gmf.common.codegen.*;
+import org.eclipse.gmf.gmfgraph.util.*;
+import org.eclipse.emf.codegen.util.CodeGenUtil;
import java.util.*;
public class FigureChildrenGenerator
@@ -16,63 +19,131 @@ public class FigureChildrenGenerator
}
protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
- protected final String TEXT_1 = "";
+ protected final String TEXT_1 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate void createContents(){";
protected final String TEXT_2 = NL + "\t\t";
- protected final String TEXT_3 = NL + "\t\t";
- protected final String TEXT_4 = ".add(";
- protected final String TEXT_5 = ");" + NL + "\t\t";
- protected final String TEXT_6 = NL;
+ protected final String TEXT_3 = NL + "\t\tsetFigure";
+ protected final String TEXT_4 = "(";
+ protected final String TEXT_5 = ");";
+ protected final String TEXT_6 = NL + "\t\t";
+ protected final String TEXT_7 = NL + "\t\t";
+ protected final String TEXT_8 = ".add(";
+ protected final String TEXT_9 = ", ";
+ protected final String TEXT_10 = ");";
+ protected final String TEXT_11 = NL + "\t}" + NL + "\t";
+ protected final String TEXT_12 = NL + "\t\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate ";
+ protected final String TEXT_13 = " f";
+ protected final String TEXT_14 = "; " + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic ";
+ protected final String TEXT_15 = " getFigure";
+ protected final String TEXT_16 = "() {" + NL + "\t\treturn f";
+ protected final String TEXT_17 = ";" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate void setFigure";
+ protected final String TEXT_18 = "(";
+ protected final String TEXT_19 = " fig){" + NL + "\t\tf";
+ protected final String TEXT_20 = " = fig;" + NL + "\t}" + NL;
+ protected final String TEXT_21 = NL;
public String generate(Object argument)
{
final StringBuffer stringBuffer = new StringBuffer();
-Object[] args = (Object[]) argument;
-List/*<Figure>*/ figureChildren = (List) args[0];
-final GraphDefDispatcher dispatcher = (GraphDefDispatcher) args[1];
-GraphDefDispatcher.LayoutArgs parentArgs = (GraphDefDispatcher.LayoutArgs) args[2];
+GraphDefDispatcher.LayoutArgs parentArgs = (GraphDefDispatcher.LayoutArgs) argument;
+final Figure root = parentArgs.getFigure();
+final GraphDefDispatcher dispatcher = parentArgs.getDispatcher();
+final ImportAssistant importManager = dispatcher.getImportManager();
+
+final List/*<Figure>*/ fieldsRequired = new LinkedList/*<Figure>*/();
+final Stack/*GraphDefDispatcher.LayoutArgs*/ contextStack = new Stack/*GraphDefDispatcher.LayoutArgs*/();
+final LinkedList queue = new LinkedList();
+final Object marker = new Object();
+
+class FieldSupport {
+ private final Figure myRoot;
+
+ public FieldSupport(Figure root){
+ myRoot = root;
+ }
+
+ public boolean isFieldRequired(Figure descendant){
+ return myRoot.equals(descendant.getParent()) || !descendant.getReferencingElements().isEmpty();
+ }
+}
+final FieldSupport fieldSupport = new FieldSupport(root);
+
stringBuffer.append(TEXT_1);
-LinkedList l = new LinkedList();
-l.addAll(figureChildren);
-final Object marker = new Object();
-Stack figureVarNamesStack = new Stack();
+queue.addAll(root.getChildren());
int figureCount = 0;
-while (!l.isEmpty()) {
- Object _nxt = l.removeFirst();
- if (_nxt == marker) {
- parentArgs = (GraphDefDispatcher.LayoutArgs) figureVarNamesStack.pop();
+while (!queue.isEmpty()){
+ Object _nxt = queue.removeFirst();
+ if (_nxt == marker){
+ parentArgs = (GraphDefDispatcher.LayoutArgs)contextStack.pop();
continue;
}
- final FigureMarker figureMarker = (FigureMarker) _nxt;
- if (figureMarker instanceof FigureRef) {
+ if (_nxt instanceof FigureRef) {
throw new IllegalStateException("FIXME: sorry, don't support FigureRef for a while");
}
- final String figureVarName = "fig_" + figureCount;
- final String layoutManagerVarName = "layouter" + figureCount;
- final String layoutDataVarName = "layData" + figureCount;
+ final Figure nextChild = (Figure) _nxt;
+ final String childVarName = "fig_" + figureCount;
+ final String childLayoutManager = "layouter" + figureCount;
+ final String childConstraint = "layData" + figureCount;
figureCount++;
- // FIXME instantiate - FigureRef - dispatch to 'instantiate' template?
- GraphDefDispatcher.LayoutArgs nextLevelArgs = dispatcher.createLayoutArgs((Figure) figureMarker, figureVarName, layoutManagerVarName, layoutDataVarName);
+
+ // FIXME instantiate - FigureRef - dispatch to 'instantiate' template?
+ GraphDefDispatcher.LayoutArgs nextLevelArgs = dispatcher.createLayoutArgs(nextChild, childVarName, childLayoutManager, childConstraint);
stringBuffer.append(TEXT_2);
stringBuffer.append(dispatcher.dispatch("instantiate", nextLevelArgs));
+
+if (fieldSupport.isFieldRequired(nextChild)){
+ fieldsRequired.add(nextChild);
stringBuffer.append(TEXT_3);
- stringBuffer.append(parentArgs.getVariableName());
+ stringBuffer.append(nextChild.getName());
stringBuffer.append(TEXT_4);
- stringBuffer.append(figureVarName);
+ stringBuffer.append(childVarName);
stringBuffer.append(TEXT_5);
- stringBuffer.append(dispatcher.dispatch("createLayoutData", dispatcher.createLayoutArgs(nextLevelArgs, parentArgs.getManagerVariableName(), layoutDataVarName)));
+ }
+ stringBuffer.append(TEXT_6);
+ stringBuffer.append(dispatcher.dispatch("createLayoutData", nextLevelArgs));
+ stringBuffer.append(TEXT_7);
+ stringBuffer.append(parentArgs.getVariableName());
+ stringBuffer.append(TEXT_8);
+ stringBuffer.append(childVarName);
+ stringBuffer.append(TEXT_9);
+ stringBuffer.append(childConstraint);
+ stringBuffer.append(TEXT_10);
-if (_nxt instanceof Figure && !((Figure) _nxt).getChildren().isEmpty()) {
- l.addFirst(marker);
- l.addAll(0, ((Figure) _nxt).getChildren());
- figureVarNamesStack.push(parentArgs);
- parentArgs = nextLevelArgs; // go on processing children of new parentFigure
-} // if
+ if (!nextChild.getChildren().isEmpty()) {
+ queue.addFirst(marker);
+ queue.addAll(0, nextChild.getChildren());
+ contextStack.push(parentArgs);
+ parentArgs = nextLevelArgs; // go on processing children of new parentFigure
+ }
} // while
- stringBuffer.append(TEXT_6);
+ stringBuffer.append(TEXT_11);
+
+ final FigureQualifiedNameSwitch fqnSwitch = dispatcher.getFQNSwitch();
+ for (Iterator fieldFigures = fieldsRequired.iterator(); fieldFigures.hasNext();){
+ Figure next = (Figure)fieldFigures.next();
+ final String nextClassName = fqnSwitch.get(next, importManager);
+ stringBuffer.append(TEXT_12);
+ stringBuffer.append(nextClassName);
+ stringBuffer.append(TEXT_13);
+ stringBuffer.append(CodeGenUtil.capName(next.getName()));
+ stringBuffer.append(TEXT_14);
+ stringBuffer.append(nextClassName);
+ stringBuffer.append(TEXT_15);
+ stringBuffer.append(next.getName());
+ stringBuffer.append(TEXT_16);
+ stringBuffer.append(CodeGenUtil.capName(next.getName()));
+ stringBuffer.append(TEXT_17);
+ stringBuffer.append(next.getName());
+ stringBuffer.append(TEXT_18);
+ stringBuffer.append(nextClassName);
+ stringBuffer.append(TEXT_19);
+ stringBuffer.append(CodeGenUtil.capName(next.getName()));
+ stringBuffer.append(TEXT_20);
+ }
+ stringBuffer.append(TEXT_21);
return stringBuffer.toString();
}
}
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/InitBorderLayoutDataGenerator.java b/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/InitBorderLayoutDataGenerator.java
index b288e56ef..c714a12c2 100644
--- a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/InitBorderLayoutDataGenerator.java
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/InitBorderLayoutDataGenerator.java
@@ -16,12 +16,11 @@ public class InitBorderLayoutDataGenerator
protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
protected final String TEXT_1 = "";
- protected final String TEXT_2 = NL + "\t\t";
- protected final String TEXT_3 = ".setConstraint(";
- protected final String TEXT_4 = ", ";
- protected final String TEXT_5 = ".";
- protected final String TEXT_6 = ");" + NL;
- protected final String TEXT_7 = NL;
+ protected final String TEXT_2 = NL + "\tObject ";
+ protected final String TEXT_3 = " = ";
+ protected final String TEXT_4 = ".";
+ protected final String TEXT_5 = ";" + NL;
+ protected final String TEXT_6 = NL;
public String generate(Object argument)
{
@@ -63,15 +62,13 @@ switch(alignment.getValue()){
}
stringBuffer.append(TEXT_2);
- stringBuffer.append(argsBundle.getManagerVariableName());
+ stringBuffer.append(argsBundle.getConstraintVariableName());
stringBuffer.append(TEXT_3);
- stringBuffer.append(figureVarName);
- stringBuffer.append(TEXT_4);
stringBuffer.append(dispatcher.getImportManager().getImportedName("org.eclipse.draw2d.BorderLayout"));
- stringBuffer.append(TEXT_5);
+ stringBuffer.append(TEXT_4);
stringBuffer.append(constantName);
+ stringBuffer.append(TEXT_5);
stringBuffer.append(TEXT_6);
- stringBuffer.append(TEXT_7);
return stringBuffer.toString();
}
}
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/InitCustomLayoutDataGenerator.java b/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/InitCustomLayoutDataGenerator.java
index 87edfebed..837a3456f 100644
--- a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/InitCustomLayoutDataGenerator.java
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/InitCustomLayoutDataGenerator.java
@@ -21,10 +21,7 @@ public class InitCustomLayoutDataGenerator
protected final String TEXT_4 = "();";
protected final String TEXT_5 = NL;
protected final String TEXT_6 = NL;
- protected final String TEXT_7 = ".setConstraint(";
- protected final String TEXT_8 = ", ";
- protected final String TEXT_9 = ");";
- protected final String TEXT_10 = NL;
+ protected final String TEXT_7 = NL;
public String generate(Object argument)
{
@@ -45,13 +42,7 @@ final String layoutImplClassName = dispatcher.getFQNSwitch().get(layoutData, dis
stringBuffer.append(TEXT_5);
stringBuffer.append(dispatcher.dispatch("customAttributes", new Object[] {layoutData, dispatcher, args.getConstraintVariableName()}));
stringBuffer.append(TEXT_6);
- stringBuffer.append(args.getManagerVariableName());
stringBuffer.append(TEXT_7);
- stringBuffer.append(args.getVariableName());
- stringBuffer.append(TEXT_8);
- stringBuffer.append(args.getConstraintVariableName());
- stringBuffer.append(TEXT_9);
- stringBuffer.append(TEXT_10);
return stringBuffer.toString();
}
}
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/InitGridLayoutDataGenerator.java b/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/InitGridLayoutDataGenerator.java
index f962d02ac..dc1a87f59 100644
--- a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/InitGridLayoutDataGenerator.java
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/InitGridLayoutDataGenerator.java
@@ -38,11 +38,8 @@ public class InitGridLayoutDataGenerator
protected final String TEXT_21 = ".grabExcessHorizontalSpace = ";
protected final String TEXT_22 = ";" + NL + "\t\t\t";
protected final String TEXT_23 = ".grabExcessVerticalSpace = ";
- protected final String TEXT_24 = ";" + NL + "\t\t\t";
- protected final String TEXT_25 = ".setConstraint(";
- protected final String TEXT_26 = ", ";
- protected final String TEXT_27 = ");" + NL;
- protected final String TEXT_28 = NL;
+ protected final String TEXT_24 = ";" + NL;
+ protected final String TEXT_25 = NL;
public String generate(Object argument)
{
@@ -109,13 +106,7 @@ if (sizeHint != null){
stringBuffer.append(TEXT_23);
stringBuffer.append(gmfLayoutData.isGrabExcessVerticalSpace());
stringBuffer.append(TEXT_24);
- stringBuffer.append(layoutManagerVarName);
stringBuffer.append(TEXT_25);
- stringBuffer.append(figureVarName);
- stringBuffer.append(TEXT_26);
- stringBuffer.append(layoutConstraintVarName);
- stringBuffer.append(TEXT_27);
- stringBuffer.append(TEXT_28);
return stringBuffer.toString();
}
}
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/InitXYLayoutDataGenerator.java b/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/InitXYLayoutDataGenerator.java
index 098ef367e..d4d5c53b2 100644
--- a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/InitXYLayoutDataGenerator.java
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/InitXYLayoutDataGenerator.java
@@ -29,11 +29,7 @@ public class InitXYLayoutDataGenerator
protected final String TEXT_12 = ";" + NL + "\t\t\t";
protected final String TEXT_13 = ".height = ";
protected final String TEXT_14 = ";";
- protected final String TEXT_15 = NL + "\t\t\t";
- protected final String TEXT_16 = ".setConstraint(";
- protected final String TEXT_17 = ", ";
- protected final String TEXT_18 = ");";
- protected final String TEXT_19 = NL;
+ protected final String TEXT_15 = NL;
public String generate(Object argument)
{
@@ -88,13 +84,6 @@ if (size != null){
}
stringBuffer.append(TEXT_15);
- stringBuffer.append(layoutManagerVarName);
- stringBuffer.append(TEXT_16);
- stringBuffer.append(figureVarName);
- stringBuffer.append(TEXT_17);
- stringBuffer.append(layoutConstraintVarName);
- stringBuffer.append(TEXT_18);
- stringBuffer.append(TEXT_19);
return stringBuffer.toString();
}
}
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/NewLayoutDataGenerator.java b/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/NewLayoutDataGenerator.java
index f494c2eeb..46b2373c9 100644
--- a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/NewLayoutDataGenerator.java
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/NewLayoutDataGenerator.java
@@ -17,7 +17,9 @@ public class NewLayoutDataGenerator
protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
protected final String TEXT_1 = "";
protected final String TEXT_2 = "\t\t\t";
- protected final String TEXT_3 = NL;
+ protected final String TEXT_3 = NL + "\t\tObject ";
+ protected final String TEXT_4 = " = null;";
+ protected final String TEXT_5 = NL;
public String generate(Object argument)
{
@@ -37,8 +39,12 @@ if (gmfLayoutData != null && figureInstance.eContainer() instanceof Figure && ((
stringBuffer.append(TEXT_1);
stringBuffer.append(dispatcher.dispatch(gmfLayoutData, argsBundle));
stringBuffer.append(TEXT_2);
- }
+ } else {
stringBuffer.append(TEXT_3);
+ stringBuffer.append(argsBundle.getConstraintVariableName());
+ stringBuffer.append(TEXT_4);
+ }
+ stringBuffer.append(TEXT_5);
return stringBuffer.toString();
}
}
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/TopFigureGenerator.java b/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/TopFigureGenerator.java
index a32256d44..bee432d14 100644
--- a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/TopFigureGenerator.java
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/TopFigureGenerator.java
@@ -25,36 +25,14 @@ public class TopFigureGenerator
protected final String TEXT_5 = "() {";
protected final String TEXT_6 = "\t" + NL + "\t\t";
protected final String TEXT_7 = NL + "\t\t";
- protected final String TEXT_8 = NL + "\t\t" + NL + "\t\t";
- protected final String TEXT_9 = " ";
- protected final String TEXT_10 = " = createFigure";
- protected final String TEXT_11 = "();" + NL + "\t\tsetFigure";
- protected final String TEXT_12 = "(";
- protected final String TEXT_13 = ");" + NL + "\t\tadd(";
- protected final String TEXT_14 = ");" + NL + "\t\t";
- protected final String TEXT_15 = "\t\t";
- protected final String TEXT_16 = NL + "\t}" + NL;
- protected final String TEXT_17 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate ";
- protected final String TEXT_18 = " f";
- protected final String TEXT_19 = "; " + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic ";
- protected final String TEXT_20 = " getFigure";
- protected final String TEXT_21 = "() {" + NL + "\t\treturn f";
- protected final String TEXT_22 = ";" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void setFigure";
- protected final String TEXT_23 = "(";
- protected final String TEXT_24 = " figure) {" + NL + "\t\tf";
- protected final String TEXT_25 = " = figure;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate ";
- protected final String TEXT_26 = " createFigure";
- protected final String TEXT_27 = "() {";
- protected final String TEXT_28 = NL;
- protected final String TEXT_29 = NL;
- protected final String TEXT_30 = NL + "\t\treturn ";
- protected final String TEXT_31 = ";" + NL + "\t}" + NL;
- protected final String TEXT_32 = NL;
- protected final String TEXT_33 = NL;
- protected final String TEXT_34 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate boolean myUseLocalCoordinates = ";
- protected final String TEXT_35 = ";" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected boolean useLocalCoordinates() {" + NL + "\t\treturn myUseLocalCoordinates;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void setUseLocalCoordinates(boolean useLocalCoordinates) {" + NL + "\t\tmyUseLocalCoordinates = useLocalCoordinates;" + NL + "\t}" + NL + "\t";
- protected final String TEXT_36 = NL + "}";
- protected final String TEXT_37 = NL;
+ protected final String TEXT_8 = NL + "\t\tcreateContents();" + NL + "\t}" + NL;
+ protected final String TEXT_9 = NL;
+ protected final String TEXT_10 = NL;
+ protected final String TEXT_11 = NL;
+ protected final String TEXT_12 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate boolean myUseLocalCoordinates = ";
+ protected final String TEXT_13 = ";" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected boolean useLocalCoordinates() {" + NL + "\t\treturn myUseLocalCoordinates;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void setUseLocalCoordinates(boolean useLocalCoordinates) {" + NL + "\t\tmyUseLocalCoordinates = useLocalCoordinates;" + NL + "\t}" + NL + "\t";
+ protected final String TEXT_14 = NL + "}";
+ protected final String TEXT_15 = NL;
public String generate(Object argument)
{
@@ -82,65 +60,12 @@ GraphDefDispatcher.LayoutArgs dispatcherArgs = dispatcher.createLayoutArgs(figur
stringBuffer.append(dispatcher.dispatch("createLayout", dispatcherArgs));
stringBuffer.append(TEXT_7);
stringBuffer.append(dispatcher.dispatch(figure, dispatcherArgs));
-
-for (Iterator it = figure.getChildren().iterator(); it.hasNext();) {
- Figure next = (Figure) it.next();
- final String childVarName = "child" + next.getName();
stringBuffer.append(TEXT_8);
- stringBuffer.append(fqnSwitch.get(next, importManager));
stringBuffer.append(TEXT_9);
- stringBuffer.append(childVarName);
+ stringBuffer.append(dispatcher.dispatch("Children", dispatcherArgs));
stringBuffer.append(TEXT_10);
- stringBuffer.append(next.getName());
- stringBuffer.append(TEXT_11);
- stringBuffer.append(next.getName());
- stringBuffer.append(TEXT_12);
- stringBuffer.append(childVarName);
- stringBuffer.append(TEXT_13);
- stringBuffer.append(childVarName);
- stringBuffer.append(TEXT_14);
- stringBuffer.append(dispatcher.dispatch("createLayoutData", dispatcher.createLayoutArgs(next, childVarName, dispatcherArgs.getManagerVariableName(), "layoutData" + next.getName())));
- stringBuffer.append(TEXT_15);
- }
- stringBuffer.append(TEXT_16);
-
-int fc = 0;
-for (Iterator it = figure.getChildren().iterator(); it.hasNext(); fc++) {
- Figure next = (Figure) it.next();
- final String nextClassName = fqnSwitch.get(next, importManager);
- stringBuffer.append(TEXT_17);
- stringBuffer.append(nextClassName);
- stringBuffer.append(TEXT_18);
- stringBuffer.append(next.getName());
- stringBuffer.append(TEXT_19);
- stringBuffer.append(nextClassName);
- stringBuffer.append(TEXT_20);
- stringBuffer.append(next.getName());
- stringBuffer.append(TEXT_21);
- stringBuffer.append(next.getName());
- stringBuffer.append(TEXT_22);
- stringBuffer.append(next.getName());
- stringBuffer.append(TEXT_23);
- stringBuffer.append(nextClassName);
- stringBuffer.append(TEXT_24);
- stringBuffer.append(next.getName());
- stringBuffer.append(TEXT_25);
- stringBuffer.append(nextClassName);
- stringBuffer.append(TEXT_26);
- stringBuffer.append(next.getName());
- stringBuffer.append(TEXT_27);
- GraphDefDispatcher.LayoutArgs childFigureArgs = dispatcher.createLayoutArgs(next, next.getName(), "layoutManager" + next.getName(), null);
- stringBuffer.append(TEXT_28);
- stringBuffer.append(dispatcher.dispatch("instantiate", childFigureArgs));
- stringBuffer.append(TEXT_29);
- stringBuffer.append(dispatcher.dispatch("Children", new Object[] {next.getChildren(), dispatcher, childFigureArgs}));
- stringBuffer.append(TEXT_30);
- stringBuffer.append(next.getName());
- stringBuffer.append(TEXT_31);
- }
- stringBuffer.append(TEXT_32);
if (false == figure instanceof Polyline) {/*no much sense to define useLocalCoordinates for polyline and its descendants*/
- stringBuffer.append(TEXT_33);
+ stringBuffer.append(TEXT_11);
// simple heuristic to detect need for local coordinates
boolean useLocalDefaultValue = false;
@@ -151,13 +76,13 @@ for (java.util.Iterator it = figure.getChildren().iterator(); it.hasNext(); ) {
}
}
- stringBuffer.append(TEXT_34);
+ stringBuffer.append(TEXT_12);
stringBuffer.append(useLocalDefaultValue);
- stringBuffer.append(TEXT_35);
+ stringBuffer.append(TEXT_13);
}
- stringBuffer.append(TEXT_36);
+ stringBuffer.append(TEXT_14);
importManager.emitSortedImports();
- stringBuffer.append(TEXT_37);
+ stringBuffer.append(TEXT_15);
return stringBuffer.toString();
}
}

Back to the top