blob: 327e6992443ed8639a35f6e74112c34f4d4a1eb0 [file] [log] [blame]
/*
* 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».addowningFigureVariable», org.eclipse.draw2d.BorderLayoutborderLayoutConstant(self)»);
«ENDDEFINE»
«DEFINE Init(parentFigureVariable : String, owningFigureVariable : String) FOR gmfgraph::XYLayoutData»
«parentFigureVariable».addowningFigureVariable», «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».addowningFigureVariable», «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 .nameENDREM»
«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».addowningFigureVariable», «constraintVarName»);
«ENDLET»
«ENDDEFINE»
«DEFINE newRectangle FOR gmfgraph::XYLayoutData»
new org.eclipse.draw2d.geometry.RectangleIF null <> topLeft
«EXPAND MapMode::_map FOR topLeft», «ELSE»0, 0, «ENDIF
«IF null <> size
«EXPAND MapMode::_map FOR size»«ELSE»0, 0«ENDIF»)
«ENDDEFINE»