Adding properties to Domain Classes at runtime Question

Jun 18, 2008 at 3:37 PM
Great work JaDAL team,

i have a question about Adding properties to Domain Classes at runtime.

what's about properties cross all specific type of model elements !!

in other words
when i add dynamic properties to a specific model element.
then drag another model element from the same type , i does not find the properties i added to the older one.

this mean that if i wanna add some propeties to specific type of model elements (ex ..  Class, Intrface, any model element type) i must enumerate all the elements in the model and add these properties to each element, and when the user drag new class to the diagram surface he will not find these dynamic properties until i add them to this element??

Thanks again for this nice library
Jul 15, 2008 at 1:20 PM
Edited Jul 15, 2008 at 1:22 PM
Hella Anegm

First of all I’m sorry for the late answer...

The dynamic properties are made to give different properties to each instance of a Domain Class. If you need to add the same properties to every class of a given type it sounds for me you should use the build in Domain Properties.

Though I can imagine some situations where you want to add the same properties to every model element I would do it in one of the following ways:

1.) Add some code to the constructor of your domain class and create the needed properties within the Dynamic PropertyCollection.

2.) You can enter a Default Value in your DSL design for each property. Dynamic Properties support such a default value as well. Try to enter something like:

name_1="Greeting" type_1="System.String" value_1="Hello World"  name_2="date" type_2="System.DateTime" value_2="2008-05-16"

You can find this syntax in the XML file of your generated DSL Editor to copy and paste it.