Search in sources :

Example 1 with ValueTranslator

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);
}
Also used : CyEventHelper(org.cytoscape.event.CyEventHelper) ValueTranslator(org.cytoscape.view.vizmap.mappings.ValueTranslator)

Aggregations

CyEventHelper (org.cytoscape.event.CyEventHelper)1 ValueTranslator (org.cytoscape.view.vizmap.mappings.ValueTranslator)1