use of org.cytoscape.model.events.RowSetRecord in project cytoscape-impl by cytoscape.
the class CyTableTest method testVirtualColumnSet.
@Test
public void testVirtualColumnSet() {
table.createColumn("real", String.class, false);
table2.addVirtualColumn("virtual", "real", table, table.getPrimaryKey().getName(), true);
CyRow row = table2.getRow(1L);
row.set("virtual", "foo");
for (Object payload : eventHelper.getAllPayloads()) {
if (payload instanceof RowSetRecord) {
RowSetRecord record = (RowSetRecord) payload;
CyTable affectedTable = record.getRow().getTable();
if (affectedTable == table) {
assertEquals("real", record.getColumn());
}
if (affectedTable == table2) {
assertEquals("virtual", record.getColumn());
}
}
}
}
use of org.cytoscape.model.events.RowSetRecord in project cytoscape-impl by cytoscape.
the class CyTableTest method testSetWithAnEvaluableCompatibleEquation.
@Test
public void testSetWithAnEvaluableCompatibleEquation() {
table.createColumn("strings", String.class, false);
final Map<String, Class<?>> varnameToTypeMap = new HashMap<String, Class<?>>();
compiler.compile("=\"one\"", new HashMap<String, Class<?>>());
final Equation eqn = compiler.getEquation();
attrs.set("strings", eqn);
Object last = eventHelper.getLastPayload();
assertNotNull(last);
assertTrue(last instanceof RowSetRecord);
}
use of org.cytoscape.model.events.RowSetRecord in project cytoscape-impl by cytoscape.
the class NetworkNameSetListener method updateSubNetworkTableNames.
private void updateSubNetworkTableNames(Collection<RowSetRecord> payloadCollection, CyTable sourceTable) {
for (CyNetwork net : rootNetwork.getSubNetworkList()) {
if (sourceTable.equals(net.getDefaultNetworkTable())) {
for (RowSetRecord record : payloadCollection) {
// assume payload collection is for same column
final Object name = record.getValue();
setTablesName(name.toString() + " default ", net.getDefaultEdgeTable(), net.getDefaultNodeTable(), net.getDefaultNetworkTable());
// assuming that this even is fired only for a single row
return;
}
}
}
}
use of org.cytoscape.model.events.RowSetRecord in project cytoscape-impl by cytoscape.
the class NetworkNameSetListener method updateRootNetworkTableNames.
private void updateRootNetworkTableNames(Collection<RowSetRecord> payloadCollection) {
for (RowSetRecord record : payloadCollection) {
// assume payload collection is for same column
final Object name = record.getValue();
setTablesName(name + " root shared ", rootNetwork.getSharedEdgeTable(), rootNetwork.getSharedNodeTable(), rootNetwork.getSharedNetworkTable());
setTablesName(name + " root default ", rootNetwork.getDefaultEdgeTable(), rootNetwork.getDefaultNodeTable(), rootNetwork.getDefaultNetworkTable());
return;
}
}
use of org.cytoscape.model.events.RowSetRecord in project cytoscape-impl by cytoscape.
the class TableEventHelperFacade method addEventPayload.
@Override
@SuppressWarnings("unchecked")
public <S, P, E extends CyPayloadEvent<S, P>> void addEventPayload(S source, P payload, Class<E> eventType) {
final CyEventHelper eventHelper = getEventHelper();
// always propagate the payload from the original source
eventHelper.addEventPayload(source, payload, eventType);
// only propagate the payload with a facade source if it's one we care about
if (source instanceof CyTable) {
Reference<LocalTableFacade> reference;
synchronized (lock) {
reference = facadeMap.get((CyTable) source);
}
if (reference == null)
return;
LocalTableFacade facade = reference.get();
if (facade == null)
return;
if (payload instanceof RowSetRecord) {
P newRSC = (P) new RowSetRecord(facade.getRow(((RowSetRecord) payload).getRow().get(CyNetwork.SUID, Long.class)), ((RowSetRecord) payload).getColumn(), ((RowSetRecord) payload).getValue(), ((RowSetRecord) payload).getRawValue());
eventHelper.addEventPayload((S) facade, newRSC, eventType);
} else {
eventHelper.addEventPayload((S) facade, payload, eventType);
}
}
}
Aggregations