use of org.knime.core.node.NodeModel in project knime-core by knime.
the class RepositoryFactory method createNode.
/**
* Creates a new node repository object. Throws an exception, if this fails
*
* @param element Configuration element from the contributing plugin
* @return NodeTemplate object to be used within the repository.
* @throws IllegalArgumentException If the element is not compatible (e.g.
* wrong attributes, or factory class not found)
*/
@SuppressWarnings("unchecked")
public static NodeTemplate createNode(final IConfigurationElement element) {
// Try to load the node factory class...
NodeFactory<? extends NodeModel> factory;
// this ensures that the class is loaded by the correct eclipse
// classloaders
GlobalClassCreator.lock.lock();
try {
factory = (NodeFactory<? extends NodeModel>) element.createExecutableExtension("factory-class");
} catch (Throwable e) {
throw new IllegalArgumentException("Can't load factory class for node: " + element.getAttribute("factory-class"), e);
} finally {
GlobalClassCreator.lock.unlock();
}
if (factory instanceof DynamicNodeFactory) {
throw new IllegalArgumentException("Dynamic node factory '" + element.getAttribute("factory-class") + "'" + " registered as normal node factory.");
}
String pluginID = element.getDeclaringExtension().getNamespaceIdentifier();
NodeTemplate node = new NodeTemplate((Class<NodeFactory<? extends NodeModel>>) factory.getClass(), factory.getNodeName(), pluginID);
node.setAfterID(str(element.getAttribute("after"), ""));
node.setType(factory.getType());
if (!Boolean.valueOf(System.getProperty("java.awt.headless", "false"))) {
// Load images from declaring plugin
Image icon = ImageRepository.getIconImage(factory);
node.setIcon(icon);
}
node.setCategoryPath(str(element.getAttribute("category-path"), "/"));
return node;
}
use of org.knime.core.node.NodeModel in project knime-core by knime.
the class JoinerJoinAnyTest method setUp.
/**
* @throws java.lang.Exception
*/
@Before
public void setUp() throws Exception {
NodeFactory<NodeModel> dummyFactory = (NodeFactory) new VirtualParallelizedChunkPortObjectInNodeFactory(new PortType[0]);
m_exec = new ExecutionContext(new DefaultNodeProgressMonitor(), new Node(dummyFactory), SingleNodeContainer.MemoryPolicy.CacheOnDisc, new HashMap<Integer, ContainerTable>());
}
use of org.knime.core.node.NodeModel in project knime-core by knime.
the class ConditionalBoxPlotNodeView method modelChanged.
/**
* {@inheritDoc}
*/
@Override
protected void modelChanged() {
NodeModel model = getNodeModel();
if (model != null && model instanceof ConditionalBoxPlotNodeModel) {
ConditionalBoxPlotNodeModel nodemodel = (ConditionalBoxPlotNodeModel) model;
m_plotter.reset();
m_plotter.setHiLiteHandler(nodemodel.getInHiLiteHandler(0));
m_plotter.setAntialiasing(true);
m_plotter.setDataProvider(nodemodel);
m_plotter.updatePaintModel();
m_plotter.fitToScreen();
boolean hasNumColSpec = nodemodel.hasNumColSpec();
m_plotter.setNormalizeTabCheckboxEnabled(hasNumColSpec);
if (!hasNumColSpec) {
m_plotter.setNormalizeTabCheckboxToolTip("New settings are available. Please reset and execute" + " the node to enable normalization.");
} else {
m_plotter.setToolTipText("");
}
m_plotter.setNormalizeTabCheckboxSelected(false);
}
}
use of org.knime.core.node.NodeModel in project knime-core by knime.
the class BoxPlotNodeView method modelChanged.
/**
* {@inheritDoc}
*/
@Override
protected void modelChanged() {
if (getNodeModel() != null) {
NodeModel model = getNodeModel();
m_plotter.reset();
m_plotter.setHiLiteHandler(model.getInHiLiteHandler(0));
m_plotter.setAntialiasing(true);
m_plotter.setDataProvider((DataProvider) model);
m_plotter.updatePaintModel();
m_plotter.fitToScreen();
}
}
use of org.knime.core.node.NodeModel in project knime-core by knime.
the class HierarchicalClusterNodeView method modelChanged.
/**
* {@inheritDoc}
*/
@Override
public void modelChanged() {
if (getNodeModel() == null || ((DataProvider) getNodeModel()).getDataArray(0) == null || ((DataProvider) getNodeModel()).getDataArray(0).size() == 0) {
return;
}
NodeModel model = getNodeModel();
m_dendroPlotter.reset();
m_distancePlotter.reset();
m_dendroPlotter.setHiLiteHandler(model.getInHiLiteHandler(0));
m_dendroPlotter.setAntialiasing(false);
m_dendroPlotter.setDataProvider((DataProvider) model);
m_distancePlotter.setDataProvider((DataProvider) model);
m_distancePlotter.setHiLiteHandler(model.getInHiLiteHandler(0));
DendrogramNode rootNode = getNodeModel().getRootNode();
DataArray distanceTable = ((DataProvider) getNodeModel()).getDataArray(0);
m_dendroPlotter.setRootNode(rootNode);
m_distancePlotter.createXCoordinate(((DoubleValue) distanceTable.getDataTableSpec().getColumnSpec(0).getDomain().getLowerBound()).getDoubleValue(), ((DoubleValue) distanceTable.getDataTableSpec().getColumnSpec(0).getDomain().getUpperBound()).getDoubleValue());
m_distancePlotter.createYCoordinate(((DoubleValue) distanceTable.getDataTableSpec().getColumnSpec(1).getDomain().getLowerBound()).getDoubleValue(), ((DoubleValue) distanceTable.getDataTableSpec().getColumnSpec(1).getDomain().getUpperBound()).getDoubleValue());
((BasicDrawingPane) m_distancePlotter.getDrawingPane()).clearPlot();
m_distancePlotter.addLine(distanceTable, 0, 1, Color.BLACK, new BasicStroke(m_thickness));
// m_distancePlotter.getXAxis().getCoordinate().setPolicy(
// DescendingNumericTickPolicyStrategy.getInstance());
m_distancePlotter.updatePaintModel();
m_dendroPlotter.updatePaintModel();
}
Aggregations