use of org.knime.core.data.property.ColorHandler.ColorModel in project knime-core by knime.
the class ColorExtractNodeModel method extractColorTable.
private DataTable extractColorTable(final DataTableSpec colorSpec) throws InvalidSettingsException {
// first column has column handler (convention in ColorHandlerPO)
ColorHandler clrHdl = colorSpec.getColumnSpec(0).getColorHandler();
final ColorModel model = clrHdl.getColorModel();
if (model.getClass() == ColorModelNominal.class) {
ColorModelNominal nom = (ColorModelNominal) model;
return extractColorTable(nom);
} else if (model.getClass() == ColorModelRange.class) {
ColorModelRange range = (ColorModelRange) model;
return extractColorTable(range);
} else {
throw new InvalidSettingsException("Unknown ColorModel class: " + model.getClass());
}
}
Aggregations