Archive

Archive for October 3, 2011

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

October 3, 2011 Leave a comment

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

Categories: Java, Life on Marama

Marama Code 121 ~ How to get or set shape size

October 3, 2011 Leave a comment

Today I’ll explain how to get or set shape’s size. This can be done using this code:

Dimension maramaShape_size = maramaShape.getSize();

It will return the shape’s size in Dimension. You can set the shape’s size with this code:

Dimension newSize = new Dimension(int width, int height);

maramaShape.setSize(newSize);

Categories: Java, Life on Marama
Follow

Get every new post delivered to your Inbox.