use of org.cytoscape.view.vizmap.gui.MappingFunctionFactoryManager in project cytoscape-impl by cytoscape.
the class MappingFunctionFactoryProxy method getMappingFactories.
public Set<VisualMappingFunctionFactory> getMappingFactories() {
final SortedSet<VisualMappingFunctionFactory> set = new TreeSet<VisualMappingFunctionFactory>(new Comparator<VisualMappingFunctionFactory>() {
@Override
public int compare(final VisualMappingFunctionFactory f1, final VisualMappingFunctionFactory f2) {
// Locale-specific sorting
final Collator collator = Collator.getInstance(Locale.getDefault());
collator.setStrength(Collator.PRIMARY);
return collator.compare(f1.toString(), f2.toString());
}
});
final MappingFunctionFactoryManager mappingFactoryMgr = servicesUtil.get(MappingFunctionFactoryManager.class);
set.addAll(mappingFactoryMgr.getFactories());
if (currentColumnName != null && currentTargetDataType != null) {
// Remove the factories that don't make sense for the current column type
final CyApplicationManager appMgr = servicesUtil.get(CyApplicationManager.class);
final CyNetwork net = appMgr.getCurrentNetwork();
if (net != null) {
final CyTable table = net.getTable(currentTargetDataType, CyNetwork.DEFAULT_ATTRS);
final CyColumn column = table.getColumn(currentColumnName);
if (column != null && !Number.class.isAssignableFrom(column.getType()))
set.remove(mappingFactoryMgr.getFactory(ContinuousMapping.class));
}
}
return set;
}
Aggregations