Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: c631dc4e94e8a3efc8ee59f345feda44dff42c57 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
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, ELSE0, 0, ENDIF-
IF null <> size-
EXPAND MapMode::_map FOR sizeELSE0, 0ENDIF)
ENDDEFINE

Back to the top