Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.gmf.graphdef.codegen/templates/LayoutData.xpt')
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/LayoutData.xpt60
1 files changed, 60 insertions, 0 deletions
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/LayoutData.xpt b/plugins/org.eclipse.gmf.graphdef.codegen/templates/LayoutData.xpt
new file mode 100644
index 000000000..c631dc4e9
--- /dev/null
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/templates/LayoutData.xpt
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2006, 2007 Borland Software Corporation
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Artem Tikhomirov (Borland) - initial API and implementation
+ */
+
+«IMPORT 'http://www.eclipse.org/gmf/2006/GraphicalDefinition'»
+«IMPORT 'http://www.eclipse.org/emf/2002/Ecore'»
+«EXTENSION Util»
+
+«DEFINE Init(parentFigureVariable : String, owningFigureVariable : String) FOR gmfgraph::LayoutData»
+«ERROR 'Abstract definition, there should be specific template for ' + self.repr()»
+«ENDDEFINE»
+
+«DEFINE Init(parentFigureVariable : String, owningFigureVariable : String) FOR gmfgraph::BorderLayoutData»
+«parentFigureVariable».add(«owningFigureVariable», org.eclipse.draw2d.BorderLayout.«borderLayoutConstant(self)»);
+«ENDDEFINE»
+
+«DEFINE Init(parentFigureVariable : String, owningFigureVariable : String) FOR gmfgraph::XYLayoutData»
+«parentFigureVariable».add(«owningFigureVariable», «EXPAND newRectangle»);
+«ENDDEFINE»
+
+«DEFINE Init(parentFigureVariable : String, owningFigureVariable : String) FOR gmfgraph::CustomLayoutData»
+«LET 'constraint' + owningFigureVariable.firstToUpper() AS constraintVarName-»
+«qualifiedClassName» «constraintVarName» = new «qualifiedClassName»();
+«EXPAND attr::CustomClass::Init(constraintVarName)»
+«parentFigureVariable».add(«owningFigureVariable», «constraintVarName»);
+«ENDLET-»
+«ENDDEFINE»
+
+«DEFINE Init(parentFigureVariable : String, owningFigureVariable : String) FOR gmfgraph::GridLayoutData»
+«LET 'constraint' + owningFigureVariable.firstToUpper() AS constraintVarName»
+«EXPAND Runtime::newInstance(constraintVarName)»
+«constraintVarName».verticalAlignment = «EXPAND Runtime::fqn».«verticalAlignment.repr()»;«REM».literal, not .name!«ENDREM»
+«constraintVarName».horizontalAlignment = «EXPAND Runtime::fqn».«horizontalAlignment.repr()»;
+«constraintVarName».horizontalIndent = «horizontalIndent»;
+«constraintVarName».horizontalSpan = «horizontalSpan»;
+«constraintVarName».verticalSpan = «verticalSpan»;
+«constraintVarName».grabExcessHorizontalSpace = «grabExcessHorizontalSpace»;
+«constraintVarName».grabExcessVerticalSpace = «grabExcessVerticalSpace»;
+«IF null <> sizeHint-»
+«constraintVarName».widthHint = «sizeHint.dx»;
+«constraintVarName».heightHint = «sizeHint.dy»;
+«ENDIF-»
+«parentFigureVariable».add(«owningFigureVariable», «constraintVarName»);
+«ENDLET»
+«ENDDEFINE»
+
+«DEFINE newRectangle FOR gmfgraph::XYLayoutData»
+new org.eclipse.draw2d.geometry.Rectangle(«IF null <> topLeft-»
+«EXPAND MapMode::_map FOR topLeft», «ELSE»0, 0, «ENDIF-»
+«IF null <> size-»
+«EXPAND MapMode::_map FOR size»«ELSE»0, 0«ENDIF»)
+«ENDDEFINE» \ No newline at end of file

Back to the top