Creation and interaction of multi-points links in Diagrammer application

Article ID: 2341
Last updated: 29 May, 2018
Article ID: 2341
Last updated: 29 May, 2018
Revision: 3
Views: 471
Posted: 18 Jun, 2010
by Dean J.
Updated: 29 May, 2018
by Gargani A.

Question

How to create and interact with multi-points links in my Diagrammer application?

Answer

Creation of Multi-Points Links 

By default, IlvMakeSDMLinkInteractor interactor will create straight line links of type IlvGeneralLink. To enable the creation of multi-points links, you need to set the following flag on the interactor: 

IlvMakeSDMLinkInteractor.setAllowingMultiplePoints(true); 

IlvGeneralLink is a subclass of IlvEnhancedPolylineLinkImage, hence it is both crossing aware and can represent multi-point polylines. 

However, as soon as the interactor commits the new link to the model, the created points are lost. 
To avoid this behavior:

  • Create a CSS rule to represent the link intermediate points. 

    link[intermediateLinkPoints] { 
       intermediateLinkPoints : "@intermediateLinkPoints"; 
    } 
  • Override IlvMakeSDMLinkInteractor.createObject() method to store the created link points as model property of the link. 
    The model property name is "intermediateLinkPoints" (because of the CSS rule above).

This custom IlvMakeSDMLinkInteractor will store the model property "intermediateLinkPoints" for the link while committing the new link to the model. When the link is rerendered, the new CSS rule makes sure that this model property is respected. 

Note that creating points of links interactively makes sense only if graph layout and link layout are disabled. This will ensure the links will not be reshaped by the layout.. 

Interaction with Multi-Points Links 

By default, SDM only supports interaction with links in a straight line mode. 
You cannot modify the link (intermediate) points interactively after creation. 

To be able to interact with intermediate points of links, you need to set an IlvPolyPointsEdition object interactor on the links. 
A basic way to enable a polypoint interaction is to reset the usual selection handles by disabling the highlighting selection flag from SDM. 
(see IlvSDMEngine.setHighlightingSelection() javadoc) 

However, the default polypoint interactor will only update the link 'visually' and won't commit any changes to the model. 
To avoid this behavior:

  • Override IlvPolyPointsEdition to update the "intermediateLinksPoints" property defined in the above step. 
  • Ceate a custom selection factory to trigger our custom polypoint interactor. (see IlvSelectionFactory javadoc)

Note that using this custom polypoint interactor, 
- Ctrl+Click on a intermediate point's link removes the point. 
- Ctrl+Click on the link will add a point at the given mouse location. 


You can download this sample MultiPointLinks.zip which illustrates both creation and interaction features.

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. See the General information > Deployment licenses > Declaring the use of IBM ILOG JViews services section in the documentation for more information.

This article was:   Helpful | Not helpful
Report an issue
Article ID: 2341
Last updated: 29 May, 2018
Revision: 3
Views: 471
Posted: 18 Jun, 2010 by Dean J.
Updated: 29 May, 2018 by Gargani A.
Attached files

Also listed in


Others in this category