|
Re: Border items and layout manager [message #636595 is a reply to message #636129] |
Tue, 02 November 2010 07:02 |
|
Hi Cedric,
I solved a kind of similar problem on my editor using an approach like below:
- Have a node defined to represent the block element.
- The figure of this block element is a composite with a rectangular container pane (no fill or outline) with a grid layout. This composite shape contains other rectangular panes which are meant to hold port figures when they are added dynamically. I have defined child access methods that allows me to retrieve these container panes as needed. Here you need to compose this block figure corresponding to your layout requirements (with GridLayout you can easily achieve this).
- Have nodes defined for each port.
- When mapping the block element, add child references which refer to node mappings of ports.
- Above setting will give rise to BlockEditPart and PortEditPart(s).
- On the BlockEditPart class, override the addChildVisual(EditPart childEditPart, int index) method and depending on the type of the childEditPart, add the child edit part figure to corresponding container pane of the BlockEditPart figure.
This approach worked out for me so far really well but I'm not sure if there is a better way...
- Asiri
|
|
|
Powered by
FUDForum. Page generated in 0.03689 seconds