Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: thomaskilian on October 21, 2005, 12:54:23 am

Title: Generate code from Screens
Post by: thomaskilian on October 21, 2005, 12:54:23 am
Hi,
has anyone succesfully generated (PHP-)code from Screens? I managed to create code for a single screen when using a stereotype. But I was not able to get hold of Screen Elements (Buttons, etc.). The template InnerClass does not recognize them as classes, so no code is generated. What I currently can do is to change theses element types to Class, but that's not my intention. I could also live (better?) with a transformation. But the Screen/elements are not transformed at all to anything.

Clueless ???
Title: Re: Generate code from Screens
Post by: Eve on October 23, 2005, 04:30:40 pm
Hi Thomas,

I haven't tried much, but I briefly modified the C# transformation to force everything to become classes and UI controls were transformed.

Try something like this in your class template.

Quote
%if elemType == "Screen"%
Class
{
$comment="This is a cut down example of what a transformed screen should look like"
  %TRANSFORM_REFERENCE("Class")%
  %TRANSFORM_CURRENT("language")%
  language="PHP"
%list="InnerClass" @separator="\n" @indent="  "%
}
%elseIf elemType=="GUIElement"%
Class
{
$comment="This is a cut down example of what a transformed ui control should look like"
  %TRANSFORM_REFERENCE("Class")%
  %TRANSFORM_CURRENT("language")%
  language="PHP"
%list="InnerClass" @separator="\n" @indent="  "%
}
%endIf%
Title: Re: Generate code from Screens
Post by: thomaskilian on October 24, 2005, 02:27:39 am
Thanks, Simon. That did the trick :)

I'll have to read your discussion with SF_It about transformation reference...