use of org.knime.core.data.renderer.DefaultDataValueRendererFamily in project knime-core by knime.
the class ExtensibleUtilityFactory method getRendererFamily.
/**
* {@inheritDoc}
*/
@Override
protected final DataValueRendererFamily getRendererFamily(final DataColumnSpec spec) {
readRenderersFromExtensionPoint();
DataValueRenderer[] renderers = new DataValueRenderer[m_renderers.size()];
int i = 0;
readPreferredRendererFromPreferences();
DataValueRendererFactory prefRenderer = getPreferredRenderer();
DataValueRendererFactory defaultRenderer = getDefaultRenderer();
if (prefRenderer != null) {
renderers[i++] = prefRenderer.createRenderer(spec);
} else if (defaultRenderer != null) {
renderers[i++] = defaultRenderer.createRenderer(spec);
}
for (DataValueRendererFactory fac : m_renderers.values()) {
if (fac.equals(prefRenderer) || ((prefRenderer == null) && fac.equals(defaultRenderer))) {
continue;
}
renderers[i++] = fac.createRenderer(spec);
}
return new DefaultDataValueRendererFamily(renderers);
}
use of org.knime.core.data.renderer.DefaultDataValueRendererFamily in project knime-core by knime.
the class DataType method getRenderer.
/**
* Returns a family of all renderers that are available for this <code>DataType</code>. The returned
* {@link org.knime.core.data.renderer.DataValueRendererFamily} will contain all renderers that are supported or
* available through the compatible {@link org.knime.core.data.DataValue} interfaces. If no renderer was declared by
* the {@link org.knime.core.data.DataValue} interfaces, this method will make sure that at least a default renderer
* (using the {@link DataCell#toString()} method) is returned.
*
* <p>
* The {@link DataColumnSpec} is passed to all renderer families retrieved from the underlying
* {@link UtilityFactory}. Most of the renderer implementations won't need column domain information but some do.
* For instance a class that renders the double value in the column according to the minimum/maximum values in the
* {@link DataColumnDomain}.
*
* @param spec the column spec to the column for which the renderer will be used
* @return a family of all renderers that are available for this <code>DataType</code>
* @deprecated Replaced by {@link #getRendererFactories()}
*/
@Deprecated
public DataValueRendererFamily getRenderer(final DataColumnSpec spec) {
ArrayList<DataValueRendererFamily> list = new ArrayList<DataValueRendererFamily>();
// first add the preferred value class, if any
for (Class<? extends DataValue> cl : m_valueClasses) {
UtilityFactory fac = getUtilityFor(cl);
DataValueRendererFamily fam = fac.getRendererFamily(spec);
if (fam != null) {
list.add(fam);
}
}
for (Class<? extends DataValue> cl : m_adapterValueList) {
if (!m_valueClasses.contains(cl)) {
UtilityFactory fac = getUtilityFor(cl);
DataValueRendererFamily fam = fac.getRendererFamily(spec);
if (fam != null) {
list.add(fam);
}
}
}
if (list.isEmpty()) {
list.add(new DefaultDataValueRendererFamily());
}
return new SetOfRendererFamilies(list);
}
Aggregations