use of org.knime.core.data.renderer.DataValueRendererFamily in project knime-core by knime.
the class TableContentView method getAvailableRenderers.
/**
* Get the description of all available renderers in a column. The returned
* array simply contains all description in the
* <code>DataValueRendererFamily</code> (which should be the default
* renderer in each column.)
*
* @param column the column of interest.
* @return a new array containing the description of all available renderer
* or an empty array to address no available renderer
* @throws IndexOutOfBoundsException if <code>column</code> violates its
* range
*/
public String[] getAvailableRenderers(final int column) {
final TableColumn tableColumn = getColumnModel().getColumn(column);
TableCellRenderer curRen = tableColumn.getCellRenderer();
String[] availRenderer;
if (curRen instanceof DataValueRendererFamily) {
DataValueRendererFamily renFamily = (DataValueRendererFamily) curRen;
availRenderer = renFamily.getRendererDescriptions();
} else {
availRenderer = new String[0];
}
return availRenderer;
}
use of org.knime.core.data.renderer.DataValueRendererFamily 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