| | | | Browse by category |
Question
How to disable reconnecting a link to a new anchor node outside an existing SDM node?
Answer
The sample Sample.zip displays four nodes with three links between them. By default when dragging a link to a point outside a node, an anchor node is created and the link is then reconnected to the anchor node. In the program, the link endpoints can be dragged between nodes, but not to a point outside a node.
To accomplish this, a subclass of IlvSDMUtilitiesFactory is set on the SDM view. The subclass overrides the function createLinkReconnector() to return a subclass of IlvSDMLinkReconnector. This latter subclass overrides the method reconnect() so that if the node being connected to is an anchor node, the anchor node is removed and reconnect() of the superclass is not called.
Note: In order to run this sample with JViews 8.7 and later, you must call the ilog.views.util.IlvProductUtil.DeploymentLicenseRequired
method with the appropriate argument (uncomment this call in the main method in Main.java
). See the General information > Deployment licenses > Declaring the use of IBM ILOG JViews services section in the documentation for more information.