showCPT(newNode);
}
break;
case CREATE_UTILITY_NODE: {
newNode = controller.insertUtilityNode(e.getX(), e.getY());
UShapeUtilityNode shape = new UShapeUtilityNode(
this,
newNode,
(int) newNode.getPosition().x - newNode.getWidth() / 2,
(int) newNode.getPosition().y - newNode.getHeight() / 2,
newNode.getWidth(), newNode.getHeight());
addShape(shape);
shape.setState(UShape.STATE_SELECTED, null);
showCPT(newNode);
}
break;
case ADD_PLUGIN_NODE: {
// build new node
newNode = this.getNodeDataTransferObject().getNodeBuilder()
.buildNode();
newNode.setPosition(e.getX(), e.getY());
// add new node into network
this.controller.getNetwork().addNode(newNode);
// build a new shape for new node
UShape shape = null;
try {
shape = this.getNodeDataTransferObject().getShapeBuilder()
.build().getUShape(newNode, this);
} catch (IllegalAccessException e1) {
throw new RuntimeException(e1);
} catch (InstantiationException e1) {
throw new RuntimeException(e1);
}
// add shape into this pane (canvas)
addShape(shape);
// set this node/shape as selected
shape.setState(UShape.STATE_SELECTED, null);
shape.update();
// notify the probability function panel's builder that a new
// node is currently "selected" as owner
this.getNodeDataTransferObject()
.getProbabilityFunctionPanelBuilder()