org.knime.core.node
Class NodeFactory<T extends NodeModel>

java.lang.Object
  extended by org.knime.core.node.NodeFactory<T>
Type Parameters:
T - the concrete type of the NodeModel
Direct Known Subclasses:
AccuracyScorerNodeFactory, AggregateOutputNodeFactory, AppendedRowsNodeFactory, AppendVariableToTableNodeFactory, ARFFReaderNodeFactory, ARFFWriterNodeFactory, BinnerNodeFactory, BitVectorGeneratorNodeFactory, BoxPlotNodeFactory, BWElimFilterNodeFactory, BWElimLoopEndNodeFactory, BWElimLoopStart1NodeFactory, BWElimLoopStart2NodeFactory, CacheNodeFactory, CAIMDiscretization2NodeFactory, CaseConvertNodeFactory, CellSplitterByPosNodeFactory, CellSplitterNodeFactory, ClusterAssignerNodeFactory, ClusterNodeFactory, ColCombineNodeFactory, ColConvertNodeFactory, CollectionCreateNodeFactory, CollectionSplitNodeFactory, ColorAppender2NodeFactory, ColorManager2NodeFactory, ColumnComparatorNodeFactory, ColumnFilterRefNodeFactory, ColumnResorterNodeFactory, ConditionalBoxPlotNodeFactory, CSVWriterNodeFactory, DatabaseLoopingNodeFactory, DBColumnFilterNodeFactory, DBConnectionNodeFactory, DBConnectionWriterNodeFactory, DBQueryNodeFactory, DBReaderConnectionNodeFactory, DBReaderNodeFactory, DBRowFilterNodeFactory, DBWriterNodeFactory, DecisionTreeLearnerNodeFactory, DecTreePredictorNodeFactory, DefaultTableNodeFactory, Discretization2ApplyNodeFactory, DomainNodeFactory, DoubleToIntNodeFactory, EnrichmentPlotterFactory, ExtractVariablesNodeFactory, FileReaderNodeFactory, FilterColumnNodeFactory, FixedColumnHistogramNodeFactory, FuzzyBasisFunctionLearnerNodeFactory, FuzzyBasisFunctionPredictorNodeFactory, FuzzyClusterNodeFactory, GroupByNodeFactory, HierarchicalClusterNodeFactory, HiLiteCollectorNodeFactory, HiliteFilterNodeFactory, HistogramNodeFactory, InjectVariablesNodeFactory, KnnNodeFactory, LiftChartNodeFactory, LinePlotterNodeFactory, LinRegLearnerNodeFactory, LoopEndConditionNodeFactory, LoopEndNodeFactory, LoopStartCountNodeFactory, LoopStartGenericNodeFactory, LoopStartIntervalNodeFactory, LoopStartVariableNodeFactory, LowVarFilterNodeFactory, Many2OneColNodeFactory, MDSNodeFactory, MDSProjectionNodeFactory, MissingValueHandlingNodeFactory, MLPPredictorNodeFactory, NaiveBayesLearnerNodeFactory, NaiveBayesPredictorNodeFactory, NewEntropyNodeFactory, NewJoinerNodeFactory, NominalValueRowFilterNodeFactory, NormalizerApplyNodeFactory, NormalizerNodeFactory, NumberToStringNodeFactory, NumericRowSplitterNodeFactory, One2ManyColNodeFactory, ParallelCoordinateNodeFactory, PartitionNodeFactory, PCAApplyNodeFactory, PCAComputeNodeFactory, PCANodeFactory, PCAReverseNodeFactory, PieNodeFactory, PivotNodeFactory, PMCCFilterNodeFactory, PMCCNodeFactory, PMMLReaderNodeFactory, PMMLWriterNodeFactory, PolyRegLearnerNodeFactory, PortObjectReaderNodeFactory, PortObjectWriterNodeFactory, RadialBasisFunctionLearnerNodeFactory, RadialBasisFunctionPredictorNodeFactory, ReadTableNodeFactory, RegexSplitNodeFactory, RegressionPredictorNodeFactory, RenameNodeFactory, ROCNodeFactory, RowFilter2PortNodeFactory, RowFilterNodeFactory, RowFilterRefNodeFactory, RowKeyNodeFactory, RPropNodeFactory, RuleEngineNodeFactory, SampleDataNodeFactory, SamplingNodeFactory, ScatterMatrixNodeFactory, ScatterPlotterNodeFactory, SearchReplaceDictNodeFactory, SetOperatorNodeFactory, ShapeAppenderNodeFactory, ShapeManagerNodeFactory, ShuffleNodeFactory, SizeAppenderNodeFactory, SizeManager2NodeFactory, SmoteNodeFactory, SorterNodeFactory, SotaLearnerNodeFactory, SotaPredictorNodeFactory, SplitNodeFactory, Statistics2NodeFactory, StringReplacerNodeFactory, StringToNumberNodeFactory, SubgroupMinerFactory, SVMLearnerNodeFactory, SVMPredictorNodeFactory, TableNodeFactory, TableToVariableNodeFactory, TransposeTableNodeFactory, UnpivotNodeFactory, ValueCounterNodeFactory, VariableFileReaderNodeFactory, VariableToTableNodeFactory, WriteTableNodeFactory, XValidatePartitionerFactory

public abstract class NodeFactory<T extends NodeModel>
extends Object

Interface for NodeFactorys summarizing NodeModel, NodeView, and NodeDialogPane for a specific Node implementation.

Author:
Michael Berthold, University of Konstanz

Nested Class Summary
static class NodeFactory.NodeType
          Enum for all node types.
 
Constructor Summary
protected NodeFactory()
          Creates a new NodeFactory and tries to read to properties file named Node.xml in the same package as the factory.
 
Method Summary
static void addLoadedFactory(Class<? extends NodeFactory> factoryClass)
          Adds the given factory class to the list of loaded factory classes.
(package private)  T callCreateNodeModel()
          Access method for createNodeModel().
 AbstractNodeView<T> createAbstractNodeView(int viewIndex, T nodeModel)
          Generalization of createNodeView(int, NodeModel) to allow for creation of a more flexible AbstractNodeView.
protected abstract  NodeDialogPane createNodeDialogPane()
          Creates and returns a new node dialog pane, if hasDialog() returns true.
abstract  T createNodeModel()
          Creates and returns a new instance of the node's corresponding model.
abstract  NodeView<T> createNodeView(int viewIndex, T nodeModel)
          Creates and returns a new node view for the given index.
static URL getDefaultIcon()
          Returns the default icon for nodes that do not define their own.
 URL getIcon()
          Returns the icon for the node.
 String getInportDescription(int index)
          Returns a description for an input port.
 String getInportName(int index)
          Returns a name for an input port.
static List<String> getLoadedNodeFactories()
          Returns a collection of all loaded node factories.
 String getNodeName()
          Returns the name of this node.
protected  String getNodeViewName(int index)
          Returns the node name as view name, the index is not considered.
protected abstract  int getNrNodeViews()
          Returns the number of possible views or 0 if no view is available.
 String getOutportDescription(int index)
          Returns a description for an output port.
 String getOutportName(int index)
          Returns a name for an output port.
 NodeFactory.NodeType getType()
          Returns the type of the node.
protected  String getViewDescription(int index)
          Returns a description for a view.
 Element getXMLDescription()
          The XML description can be used with the NodeFactoryHTMLCreator in order to get a converted HTML description of it, which fits the overall KNIME HTML style.
protected abstract  boolean hasDialog()
          Returns true if this node provides a dialog to adjust node specific settings.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NodeFactory

protected NodeFactory()
Creates a new NodeFactory and tries to read to properties file named Node.xml in the same package as the factory.

Method Detail

getXMLDescription

public Element getXMLDescription()
The XML description can be used with the NodeFactoryHTMLCreator in order to get a converted HTML description of it, which fits the overall KNIME HTML style.

Returns:
XML description of this node

getNodeName

public final String getNodeName()
Returns the name of this node.

Returns:
the node's name.

getInportName

public String getInportName(int index)
Returns a name for an input port.

Parameters:
index - the index of the input port, starting at 0
Returns:
an input port description

getOutportName

public String getOutportName(int index)
Returns a name for an output port.

Parameters:
index - the index of the output port, starting at 0
Returns:
an output port description

getInportDescription

public final String getInportDescription(int index)
Returns a description for an input port.

Parameters:
index - the index of the input port, starting at 0
Returns:
an input port description

getOutportDescription

public final String getOutportDescription(int index)
Returns a description for an output port.

Parameters:
index - the index of the output port, starting at 0
Returns:
an output port description

getViewDescription

protected final String getViewDescription(int index)
Returns a description for a view.

Parameters:
index - the index of the view, starting at 0
Returns:
a view description

createNodeModel

public abstract T createNodeModel()
Creates and returns a new instance of the node's corresponding model.

Returns:
A new NodeModel for this node. Never null!

callCreateNodeModel

final T callCreateNodeModel()
Access method for createNodeModel(). This method will also do sanity checks for the correct labeling of the port description: The port count (in, out) is only available in the NodeModel. The first time, this method is called, the port count is retrieved from the NodeModel and the xml description is validated against the info from the model. If inconsistencies are identified, log messages will be written and the full description of the node is adapted such that the user (preferably the implementor) immediately sees the problem.

Returns:
The model as from createNodeModel()

getNrNodeViews

protected abstract int getNrNodeViews()
Returns the number of possible views or 0 if no view is available.

Returns:
number of views available for this node
See Also:
createNodeView(int,NodeModel)

getNodeViewName

protected final String getNodeViewName(int index)
Returns the node name as view name, the index is not considered.

Parameters:
index - The view index,
Returns:
A node view name.

createNodeView

public abstract NodeView<T> createNodeView(int viewIndex,
                                           T nodeModel)
Creates and returns a new node view for the given index.

Parameters:
viewIndex - The index for the view to create.
nodeModel - the underlying model
Returns:
a new node view for the given index
Throws:
IndexOutOfBoundsException - If the viewIndex is smaller 0 or greater or equal to the values returned by getNrNodeViews()
See Also:
getNrNodeViews()

createAbstractNodeView

public AbstractNodeView<T> createAbstractNodeView(int viewIndex,
                                                  T nodeModel)
Generalization of createNodeView(int, NodeModel) to allow for creation of a more flexible AbstractNodeView. Implementations will typically overwrite the createNodeView(int, NodeModel) method unless they wish to return, e.g. an ExternalApplicationNodeView.

Note:This method is going to be removed in KNIME v3.0, whereby the return type of the createNodeView(int, NodeModel) will be changed to AbstractNodeView. (This change is postponed to v3.0 in order to ensure binary compatibility of 2.0.x plugins with the 2.x series).

Parameters:
viewIndex - The index for the view to create
nodeModel - the underlying model
Returns:
a new node view for the given index
Throws:
IndexOutOfBoundsException - If the viewIndex is smaller 0 or greater or equal to the values returned by getNrNodeViews()
Since:
2.1

hasDialog

protected abstract boolean hasDialog()
Returns true if this node provides a dialog to adjust node specific settings.

Returns:
true if a NodeDialogPane is available
See Also:
createNodeDialogPane()

createNodeDialogPane

protected abstract NodeDialogPane createNodeDialogPane()
Creates and returns a new node dialog pane, if hasDialog() returns true.

Returns:
node dialog pane
See Also:
hasDialog()

getIcon

public final URL getIcon()
Returns the icon for the node.

Returns:
the node's icon

getType

public NodeFactory.NodeType getType()
Returns the type of the node.

Returns:
the node's type

getDefaultIcon

public static URL getDefaultIcon()
Returns the default icon for nodes that do not define their own.

Returns:
an URL to the default icon

getLoadedNodeFactories

public static List<String> getLoadedNodeFactories()
Returns a collection of all loaded node factories.

Returns:
a collection array of fully qualified node factory class names

addLoadedFactory

public static void addLoadedFactory(Class<? extends NodeFactory> factoryClass)
Adds the given factory class to the list of loaded factory classes.

Parameters:
factoryClass - a factory class


Copyright, 2003 - 2010. All rights reserved.
University of Konstanz, Germany.
Chair for Bioinformatics and Information Mining, Prof. Dr. Michael R. Berthold.
You may not modify, publish, transmit, transfer or sell, reproduce, create derivative works from, distribute, perform, display, or in any way exploit any of the content, in whole or in part, except as otherwise expressly permitted in writing by the copyright owner or as specified in the license file distributed with this product.