NodeFactory

The NodeFactory bundles the NodeModel, NodeDialog, NodeView(s) , and the description XML (which must have the same name as the factory). The factory is also used to register the node via the org.knime.workbench.repository.nodes extension point to appear in the node repository view. The methods are shortly explained in the following:

createNodeDialogPane()

Create here the dialog for the node.

createNodeModel()

Create and return a new instance of the node's NodeModel here.

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 the Linear Regression node, for example, that returns different views for each out-port. The NodeModel is passed to the constructor 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(final int index, 
        final LinRegLearnerNodeModel model) {
    // always return a new instance of a NodeView
    return new ExampleNodeView(model);
}

Example #2:

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

getNrNodeViews()

Return the number of views or 0 if the node doesn't have a view.

hasDialog()

Return true if the node has a dialog , or false if it doesn't have a dialog.