LOGGER.trace("Process " + event.getEventType() + " of type " + event.getTarget());
final EditorModel editorModel = getModel(EditorModel.class);
final BallModel targetBallModel = getModel(BallModel.class, event);
editorModel.registerBall(targetBallModel);
if (editorModel.retrieveBall(targetBallModel.getEventModel().getSource()) == null) {
// it's the application node, we shall center it !!! minus 70 because it's the globalFacade node that resides in the center
targetBallModel.getView().getRootNode().layoutXProperty().bind(editorModel.getView().getRootNode().widthProperty().divide(2).subtract(70).subtract(24));
targetBallModel.getView().getRootNode().layoutYProperty().bind(editorModel.getView().getRootNode().heightProperty().divide(2).subtract(24));
} else {
final BallModel sourceBallModel = editorModel.retrieveBall(targetBallModel.getEventModel().getSource());
// All other nodes shall be positionned relatively to their parent
/*
* System.out.println("Create " + targetBallModel.getEventModel().getTarget().getSimpleName() + " From : " + targetBallModel.getEventModel().getSource().getSimpleName() + " x=" +
* sourceBallModel.getView().getRootNode().getCenterX() + " trX=" + sourceBallModel.getView().getRootNode().getTranslateX() + " y=" + sourceBallModel.getView().getRootNode().getCenterY() +
* " trY=" + sourceBallModel.getView().getRootNode().getTranslateY());
*/
targetBallModel.getView().getRootNode()
.layoutXProperty().bind(sourceBallModel.getView().getRootNode().layoutXProperty().add(sourceBallModel.getView().getRootNode().translateXProperty()));
targetBallModel.getView().getRootNode()
.layoutYProperty().bind(sourceBallModel.getView().getRootNode().layoutYProperty().add(sourceBallModel.getView().getRootNode().translateYProperty()));
}
targetBallModel.show();
}