use of org.knime.core.node.port.viewproperty.SizeHandlerPortObject in project knime-core by knime.
the class SizeManager2NodeModel method execute.
/**
* Is invoked during the node's execution to make the size settings.
*
* @param data the input data array
* @param exec the execution monitor
* @return the same input data table whereby the DataTableSpec contains
* additional size infos
* @throws CanceledExecutionException if user canceled execution
*
* @see NodeModel#execute(BufferedDataTable[],ExecutionContext)
*/
@Override
protected PortObject[] execute(final PortObject[] data, final ExecutionContext exec) throws CanceledExecutionException {
final DataTableSpec inSpec = (DataTableSpec) data[INPORT].getSpec();
final String columnName = m_column.getStringValue();
final DataColumnSpec cspec = inSpec.getColumnSpec(columnName);
SizeHandler sizeHandler = createSizeHandler(cspec);
final DataTableSpec newSpec = appendSizeHandler(inSpec, columnName, sizeHandler);
BufferedDataTable changedSpecTable = exec.createSpecReplacerTable((BufferedDataTable) data[INPORT], newSpec);
DataTableSpec modelSpec = new DataTableSpec(newSpec.getColumnSpec(m_column.getStringValue()));
SizeHandlerPortObject viewPort = new SizeHandlerPortObject(modelSpec, sizeHandler.toString() + " based on column \"" + m_column.getStringValue() + "\"");
return new PortObject[] { changedSpecTable, viewPort };
}
Aggregations