figureC.setInteractor(si);
// Add a layer listener to the drag interactor.
// The listener just tells both connectors to reroute themselves.
DragInteractor i = controller.getDragInteractor();
i.addLayerListener(new LayerAdapter() {
public void mouseDragged(LayerEvent e) {
connectorA.reroute();
connectorB.reroute();
connectorC.reroute();
connectorD.reroute();
}
});
// The connector selection interactor uses the same selection model
SelectionInteractor ci = new SelectionInteractor(si.getSelectionModel());
connectorA.setInteractor(ci);
connectorB.setInteractor(ci);
connectorC.setInteractor(ci);
connectorD.setInteractor(ci);
// Tell the selection dragger to select connectors too
controller.getSelectionDragger().addSelectionInteractor(ci);
// Create a manipulator to give resize handles on figures
BoundsManipulator figureManipulator = new BoundsManipulator();
controller.setSelectionManipulator(figureManipulator);
// Make resizing reroute the connectors too
DragInteractor j = figureManipulator.getHandleInteractor();
j.addLayerListener(new LayerAdapter() {
public void mouseDragged(LayerEvent e) {
connectorA.reroute();
connectorB.reroute();
connectorC.reroute();
connectorD.reroute();