use of org.cytoscape.view.vizmap.mappings.ValueTranslator in project cytoscape-impl by cytoscape.
the class PassthroughMappingFactory method createVisualMappingFunction.
@Override
@SuppressWarnings("unchecked")
public <K, V> VisualMappingFunction<K, V> createVisualMappingFunction(final String attributeName, final Class<K> attrValueType, final VisualProperty<V> vp) {
final ValueTranslator<?, ?> translator = TRANSLATORS.get(vp.getRange().getType());
final CyEventHelper eventHelper = serviceRegistrar.getService(CyEventHelper.class);
if (translator != null)
return new PassthroughMappingImpl<>(attributeName, attrValueType, vp, (ValueTranslator<K, V>) translator, eventHelper);
else
return new PassthroughMappingImpl<>(attributeName, attrValueType, vp, (ValueTranslator<K, V>) DEFAULT_TRANSLATOR, eventHelper);
}
Aggregations