Me n My Programming

If Only I Have TIme

Marama Code 122 ~ How to create entity and its attributes in Marama tool model automatically

Marama tool model is the diagram used to define tool project tool meta-model. To help user define the test tool (to be used with Marama model project), user need to specify the test tool shape properties. From there, a number of test entity (based on level of test) will be create automatically.

Due to the fact that when Marama tool model there is no underlying model created for it, the normal code to create shape cannot be applied to Marama tool model, shape definer and view definer. Here is the code to create and set the entity shape for Marama tool model:

MaramaShape testShape = this.createNewShape(MaramaConstants.ENTITY_METAMODEL_SHAPE, x, y, shapeWidth, shapeHeight); // create the entity shape
testShape.setPropertyValue(“name”, “TestSuite”); // set the attribute

MaramaShape testAttribute = this.createNewShape(MaramaConstants.ATTRIBUTE_SHAPE, x + 5, y + 5, shapeWidth, shapeHeight); // create the entity attribute shape
testAttribute.setPropertyValue(“iskey”, “key”); // set the attribute
testAttribute.setPropertyValue(“name”, “tid”);
testAttribute.setPropertyValue(“type”, “String”);

        processSubshapeAdded(testAttribute);

Hope you will understand it. Cheers.

p/s: credit to Jun for showing it to me

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Information

This entry was posted on October 3, 2011 by in Java, Life on Marama.
%d bloggers like this: