Hi Peter,
The VMD style is defined to be used by GraphPinScene where edges are
defined as a connection between two pins. Pins are attached to
particular nodes.
The anchor shapes are actually painted as a part of VMDConnectionWidget,
so they appear automatically only when a connection is shown. For the
code, see:
graph/lib/src/org/netbeans/api/visual/vmd/VMDConnectionWidget.java
file and POINT_SHAPE_IMAGE static field which is used by calling
"ConnectionWidget.setEndPointShape(POINT_SHAPE_IMAGE)" method.
If you want to show them always then you would have to create your own
VMDPinWidget or VMDNodeWidget which will contain even an ImageWidget
which uses
"graph/lib/src/org/netbeans/modules/visual/resources/vmd-pin.png" image.
A problem of the library is that it contains only one pre-defined style
(the VMD style) which has limited usage. Therefore if you have an
idea/implementation of another style I would be happy to integrate it
into the library.
Regards,
David
Holger Brandl wrote:
Hi David,
thank you for your help so far.
If you like VMD style, then you can write your own VMDGraphScene - you
even do not have use this class at all. You can use just the
VMDNodeWidget, ... classes and create your own GraphPinScene where you
can use them.
I've tried to implement my own scene based on GraphPinScene.
Unfortunately I was not able to add these nice rectangular anchor
ports (from the vmd-demos) to a given node.
Although there are methods to attach such anchor ports to a scene (cf
GraphPinScene.attachEdgeSourceAnchor()), this seems only possible when
connecting two nodes.
Is it possible to add such an rectangular anchor port directly as a
child of an already added node? Or would it be necessary to define an
own node-type (which would define to be just a rectangular anchor port)?
Which class defines these rectangular anchors?
Best regards,
Holger