return action;
}
public void createNode(Node newNode) {
UShape shape = null;
if (newNode instanceof IPluginNode) {
try {
INodeClassDataTransferObject q = this.getPluginNodeManager().getPluginNodeInformation(newNode.getClass());
IPluginUShapeBuilder a = q.getShapeBuilder();
IPluginUShape f = this.getPluginNodeManager().getPluginNodeInformation(newNode.getClass()).getShapeBuilder().build();
shape =
this.getPluginNodeManager().getPluginNodeInformation(newNode.getClass()).getShapeBuilder().build()
.getUShape(newNode, this);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
} catch (InstantiationException e) {
throw new RuntimeException(e);
}
}
// TODO stop using if-instanceof structure and start using object
// binding to a UShape builder.
if (shape == null) {
// if we could not find a plugin node, start testing ordinal nodes
if (newNode instanceof ContinuousNode) {
shape = new UShapeGMMNode(this, newNode,
(int) newNode.getPosition().x, (int) newNode
.getPosition().y, newNode.getWidth(), newNode
.getHeight());
} else if (newNode instanceof ProbabilisticNode) {
shape = new UShapeProbabilisticNode(this, newNode,
(int) newNode.getPosition().x, (int) newNode
.getPosition().y, newNode.getWidth(), newNode
.getHeight());
} else if (newNode instanceof DecisionNode) {
shape = new UShapeDecisionNode(this, newNode, (int) newNode
.getPosition().x, (int) newNode.getPosition().y,
newNode.getWidth(), newNode.getHeight());
} else if (newNode instanceof UtilityNode) {
shape = new UShapeUtilityNode(this, newNode, (int) newNode
.getPosition().x, (int) newNode.getPosition().y,
newNode.getWidth(), newNode.getHeight());
}
}
if (shape != null) {
try {
addShape(shape);
shape.setState(UShape.STATE_SELECTED, null);
} catch (NullPointerException e) {
throw new RuntimeException(
"Could not find or set a shape for node: "
+ newNode.getName(), e);
}