createNodeView(int, NodeModel)

Creates and returns a new node view for the given index. The index is used to make several views per node possible. See for example the Linear Regression node, which has The NodeModel is passed to the contructor of the NodeView. Usually, this method just returns a new view as in Example#1, but it may also check the index to return several views dependent on the index as in Example#2.

Example #1:

public NodeView createNodeView(>int index, NodeModel model){
     return new ExampleNodeView(model);
}

Example #2:

    public NodeView createNodeView(final int index, final NodeModel model) {
        LinRegLearnerNodeModel m = (LinRegLearnerNodeModel)model;
        switch (index) {
        case 0:
            return new LinRegLearnerNodeView(m);
        case 1:
            return new LinRegLineNodeView(m);
        default:
            throw new IndexOutOfBoundsException();
        }
    }
LinkedInTwitterShare

What are you looking for?