- This topic has 5 replies, 2 voices, and was last updated 13 years, 9 months ago by jkennedy.
-
AuthorPosts
-
rdennisjMemberI posted this question under the ‘Feature Request’ forum on 1/20, but got no response, so I am trying it here also:
In an earlier post you provided a breakdown of the Spring DSL artifacts used as input to code generation. Specifically, the ‘.datatype’ was used to generate Flex client-side actionscript and mxml. In reviewing all the DSL artifacts, the file ‘.datatypebinding’ also contains properties for join criteria for a ‘many-to-one’ relationship. This would be useful when attempting to modify the code generator to make a column from a ‘child’ table have a lookup capability (the PICKER function you have in the GWT generator). Is it possible to ‘redirect’ the generator to use an input source OTHER than .datatype, when generating Flex code? In another earlier post, you mentioned it is possible to extend the model, by writing an Eclipse plugin. Is this the recommended approach to accomplish what I am referring to here?
jkennedyMemberThe model that is used for code generation in this case is a “layered extension” model in that each of our “core” types can have model extensions added (by our code or yours). And so in this case, the Core is the DataType, and the CoreExtension is the DataTypeBinding which holds the persistence information. You can access all of the CoreExtensions from the Core using our APIs.
In java code, if you had a DataType variable called dt you could get at its DataTypeBinding by calling dt.getExtension(DataTypeBinding.class);
In a Jet template, you can load a model extension into a Jet variable for use in your template using our getModelExtension jet tag.
The basic form would be:<sw:getModelExtension select=”$model” extension=”datatypebinding” var=”dtBinding” />
This should let you use the information in the DataTypeBinding model extension that is tied to the DataType in the $model variable.
If you look through our templates, especially the DataType.jet templates, you will see other more specific tags that we use to get information about the DataType and the annotations we are generating.You may also want to look at the GWT templates to see how the pickers are being created as you may be able to borrow from these templates.
Let me know if this helps.
Thanks
Jack
rdennisjMemberThanks for the added insights. It’s great to see you added this extension capability! I assume that if I created a ‘mydatatypebinding’ and placed it in the same folder as the other DSL artifacts, then used the jet tag:
<sw:getModelExtension select=”$model” extension=”mydatatypebinding” var=”myDtBinding” />
it would allow me to access additional properties during code generation? Is there any documenation related to the additional jet tags you have created, and how they are used?
jkennedyMemberYou can review this tutorial for more information: http://www.myeclipseide.com/documentation/quickstarts/ME4STutorialCustomization/m4secustomizationarticle.html#resources
The end of the document has a link to the Java doc for the tags: http://www.skywayperspectives.org/documentation/me4s86/javadoc/TagsJavaDoc/
The java doc is “lite” but it does give you a good overview of the tags that are available. To see them in use you can search for the Tag in the .jet templates. (The tag name is usually the Class name sans the word Tag if Tag is in the classname.
Regarding the question about adding your own CoreExtensions (in your example adding a mydatatypebinding) there is more too it than this. We don’t provide a way to override the core model through the use of a customization project. You can definitely do this by writing your own eclipse plugin and using our extension points to add a CoreExtension which is just an EMF model and a set of implemented extension points etc, but this is an investment. If you intend on creating your own Eclipse plugins and extensions let me know and we can try to offer guidance along the way.
Thanks,
Jack
rdennisjMemberJack,
I created a customization template, and on reviewing the MasterDetail.jet template, I’m having difficulty interpreting some of the tags:
/**
* A Master/Detail style UI that presents a list of <sw:javaType select=”$model” alias=”gwtdatatype” package=”false”/>s with a “New” button to create new records as well as a Tab area
* to allow multiple records to be edited at the same time. Also provides the ability to delete records.
<sw:generated />
*/
public class <sw:javaType select=”$model” alias=”gwtmasterdetail” package=”false”/> implements <java:import><sw:javaType select=”$model/project” alias=”gwtcrudsection” package=”true”/></java:import> {Questions:
1. The first line references: alias=”gwtdatatype”. How is this used? The javadoc says the alias property is ‘an optional alias that identifies which artifact definition to use’ but I don’t see any references to it in any of the .springDSL artifacts.
2. Likewise for the aliases for ‘gwtmasterdetail’ and ‘gwtcrudsection’
3. The last line above references: select=”$model/project”. I can see how $model retrieves a reference to the model’s core name, but how is the ‘project’ part of it used?Thanks again
jkennedyMemberPlease see the response on this thread, thanks.
https://www.genuitec.com/forums/topic/question-about-customization-template/ -
AuthorPosts