use of org.cytoscape.model.events.RowSetRecord in project cytoscape-impl by cytoscape.
the class ModelMonitor method handleEvent.
@Override
public void handleEvent(RowsSetEvent event) {
CyTable table = event.getSource();
synchronized (lock) {
if (!enabled) {
return;
}
if (network == null || table != network.getDefaultNodeTable() && table != network.getDefaultEdgeTable()) {
return;
}
Map<String, double[]> ranges;
// We may not be the first writer, so check again.
if (table == network.getDefaultNodeTable()) {
ranges = nodeColumnRanges;
} else if (table == network.getDefaultEdgeTable()) {
ranges = edgeColumnRanges;
} else {
return;
}
boolean changed = false;
for (RowSetRecord record : event.getPayloadCollection()) {
String name = record.getColumn();
double[] range = ranges.get(name);
if (range == null) {
continue;
}
Object value = record.getValue();
if (value == null) {
continue;
}
CyColumn column = table.getColumn(name);
Class<?> type = column.getType();
if (List.class.equals(type) && Number.class.isAssignableFrom(column.getListElementType())) {
updateRange(range, (List<?>) value);
} else if (Number.class.isAssignableFrom(type)) {
updateRange(range, (Number) value);
}
changed = true;
}
if (changed) {
updateColumnSliders();
}
}
}
Aggregations