Search in sources :

Example 1 with ShapeHandlerPortObject

use of org.knime.core.node.port.viewproperty.ShapeHandlerPortObject in project knime-core by knime.

the class ShapeManagerNodeModel method execute.

/**
 * Is invoked during the node's execution to make the shape settings.
 *
 * @param data the input data array
 * @param exec the execution monitor
 * @return the same input data table with assigned shapes to one column
 * @throws CanceledExecutionException if user canceled execution
 *
 * @see NodeModel#execute(BufferedDataTable[],ExecutionContext)
 */
@Override
protected PortObject[] execute(final PortObject[] data, final ExecutionContext exec) throws CanceledExecutionException {
    BufferedDataTable inData = (BufferedDataTable) data[INPORT];
    ShapeHandler shapeHandler = new ShapeHandler(new ShapeModelNominal(m_map));
    final DataTableSpec newSpec = appendShapeHandler(inData.getSpec(), m_column, shapeHandler);
    BufferedDataTable changedSpecTable = exec.createSpecReplacerTable(inData, newSpec);
    DataTableSpec modelSpec = new DataTableSpec(newSpec.getColumnSpec(m_column));
    ShapeHandlerPortObject viewPort = new ShapeHandlerPortObject(modelSpec, shapeHandler.toString() + " based on column \"" + m_column + "\"");
    return new PortObject[] { changedSpecTable, viewPort };
}
Also used : DataTableSpec(org.knime.core.data.DataTableSpec) BufferedDataTable(org.knime.core.node.BufferedDataTable) ShapeHandler(org.knime.core.data.property.ShapeHandler) ShapeHandlerPortObject(org.knime.core.node.port.viewproperty.ShapeHandlerPortObject) ShapeHandlerPortObject(org.knime.core.node.port.viewproperty.ShapeHandlerPortObject) PortObject(org.knime.core.node.port.PortObject) ShapeModelNominal(org.knime.core.data.property.ShapeModelNominal)

Aggregations

DataTableSpec (org.knime.core.data.DataTableSpec)1 ShapeHandler (org.knime.core.data.property.ShapeHandler)1 ShapeModelNominal (org.knime.core.data.property.ShapeModelNominal)1 BufferedDataTable (org.knime.core.node.BufferedDataTable)1 PortObject (org.knime.core.node.port.PortObject)1 ShapeHandlerPortObject (org.knime.core.node.port.viewproperty.ShapeHandlerPortObject)1