422
|
1 |
/*
|
|
2 |
* Copyright (c) 2006, 2007 Borland Software Corporation
|
|
3 |
*
|
|
4 |
* All rights reserved. This program and the accompanying materials
|
|
5 |
* are made available under the terms of the Eclipse Public License v1.0
|
|
6 |
* which accompanies this distribution, and is available at
|
|
7 |
* http://www.eclipse.org/legal/epl-v10.html
|
|
8 |
*
|
|
9 |
* Contributors:
|
|
10 |
* Artem Tikhomirov (Borland) - initial API and implementation
|
|
11 |
*/
|
|
12 |
|
|
13 |
«IMPORT "http://www.eclipse.org/gmf/2006/GraphicalDefinition"»
|
|
14 |
«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
|
|
15 |
«EXTENSION Util»
|
|
16 |
|
|
17 |
«DEFINE Init(EString parentFigureVariable, EString owningFigureVariable) FOR gmfgraph::LayoutData»
|
|
18 |
«ERROR "Abstract definition, there should be specific template for " + this»
|
|
19 |
«ENDDEFINE»
|
|
20 |
|
|
21 |
«DEFINE Init(EString parentFigureVariable, EString owningFigureVariable) FOR gmfgraph::BorderLayoutData»
|
|
22 |
«parentFigureVariable».add(«owningFigureVariable», org.eclipse.draw2d.BorderLayout.«borderLayoutConstant(this)»);
|
|
23 |
«ENDDEFINE»
|
|
24 |
|
|
25 |
«DEFINE Init(EString parentFigureVariable, EString owningFigureVariable) FOR gmfgraph::XYLayoutData»
|
|
26 |
«parentFigureVariable».add(«owningFigureVariable», «EXPAND newRectangle»);
|
|
27 |
«ENDDEFINE»
|
|
28 |
|
|
29 |
«DEFINE Init(EString parentFigureVariable, EString owningFigureVariable) FOR gmfgraph::CustomLayoutData»
|
|
30 |
«LET "constraint" + owningFigureVariable.toFirstUpper() AS constraintVarName-»
|
|
31 |
«qualifiedClassName» «constraintVarName» = new «qualifiedClassName»();
|
|
32 |
«EXPAND attr::CustomClass::Init(constraintVarName)»
|
|
33 |
«parentFigureVariable».add(«owningFigureVariable», «constraintVarName»);
|
|
34 |
«ENDLET-»
|
|
35 |
«ENDDEFINE»
|
|
36 |
|
|
37 |
«DEFINE Init(EString parentFigureVariable, EString owningFigureVariable) FOR gmfgraph::GridLayoutData»
|
|
38 |
«LET "constraint" + owningFigureVariable.toFirstUpper() AS constraintVarName»
|
|
39 |
«EXPAND Runtime::newInstance(constraintVarName)»
|
|
40 |
«constraintVarName».verticalAlignment = «EXPAND Runtime::fqn».«verticalAlignment.name»;«REM».literal, not .name!«ENDREM»
|
|
41 |
«constraintVarName».horizontalAlignment = «EXPAND Runtime::fqn».«horizontalAlignment.name»;
|
|
42 |
«constraintVarName».horizontalIndent = «horizontalIndent»;
|
|
43 |
«constraintVarName».horizontalSpan = «horizontalSpan»;
|
|
44 |
«constraintVarName».verticalSpan = «verticalSpan»;
|
|
45 |
«constraintVarName».grabExcessHorizontalSpace = «grabExcessHorizontalSpace»;
|
|
46 |
«constraintVarName».grabExcessVerticalSpace = «grabExcessVerticalSpace»;
|
|
47 |
«IF null != sizeHint-»
|
|
48 |
«constraintVarName».widthHint = «sizeHint.dx»;
|
|
49 |
«constraintVarName».heightHint = «sizeHint.dy»;
|
|
50 |
«ENDIF-»
|
|
51 |
«parentFigureVariable».add(«owningFigureVariable», «constraintVarName»);
|
|
52 |
«ENDLET»
|
|
53 |
«ENDDEFINE»
|
|
54 |
|
|
55 |
«DEFINE newRectangle FOR gmfgraph::XYLayoutData»
|
|
56 |
new org.eclipse.draw2d.geometry.Rectangle(«IF null != topLeft-»
|
|
57 |
«EXPAND MapMode::map FOR topLeft», «ELSE»0, 0, «ENDIF-»
|
|
58 |
«IF null != size-»
|
|
59 |
«EXPAND MapMode::map FOR size»«ELSE»0, 0«ENDIF»)
|
|
60 |
«ENDDEFINE» |