| Best practice for own Shapes? [message #757486] |
Fri, 18 November 2011 10:48  |
Christian B Messages: 68 Registered: August 2011 |
Member |
|
|
Hi,
Say we have this example, a ContainerShape which has two Anchors and three child shapes.

For now if i want Access to a child or an anchor I use following code:
shapeA1 = containerA.getChildren().get(0);
shapeA2 = containerA.getChildren().get(1);
shapeA3 = containerA.getChildren().get(2);
anchorA1 = containerA.getAnchors()containerShape.get(0);
anchorA2 = containerA.getAnchors()containerShape.get(1);
But what i would like to have is a extra class for the ContainerA with methods
shapeA1 = containerA.getShapeA1();
shapeA2 = containerA.getShapeA2();
shapeA3 = containerA.getShapeA3();
anchorA1 = containerA.getAnchorA1();
anchorA2 = containerA.getAnchorA2()
So the question is, what is the best practice for adding own shapes?
Do I have to extend the peCreateService, so I can implement a method like peCreateService.createContainerA()?
thx for your help!
[Updated on: Fri, 18 November 2011 10:50] Report message to a moderator
|
|
|
|
|
| Re: Best practice for own Shapes? [message #758494 is a reply to message #757486] |
Wed, 23 November 2011 07:58  |
Michael Wenz Messages: 1272 Registered: July 2009 Location: Walldorf, Germany |
Senior Member |
|
|
In the end this turns out to be a matter of identifying shapes somehow. I
see 2 possibilities to do that:
1) Using the linking mechanism
2) Using properties as Andreas pointed out
To ease both ways a proven way to ge is introducing service methods that
retrieve the required object from another one.
HTH,
Michael
|
|
|
Powered by
FUDForum. Page generated in 0.01690 seconds