Example #1
0
  /** Factory method which creates the right NodeView for the model. */
  NodeView newNodeView(MindMapNode model, int position, MapView map, Container parent) {
    NodeView newView = new NodeView(model, position, map, parent);

    if (model.isRoot()) {
      final MainView mainView = new RootMainView();
      newView.setMainView(mainView);
      newView.setLayout(VerticalRootNodeViewLayout.getInstance());

    } else {
      newView.setMainView(newMainView(model));
      if (newView.isLeft()) {
        newView.setLayout(LeftNodeViewLayout.getInstance());
      } else {
        newView.setLayout(RightNodeViewLayout.getInstance());
      }
    }

    model.addViewer(newView);
    newView.update();
    fireNodeViewCreated(newView);
    return newView;
  }