use of org.cytoscape.model.internal.CyTableImpl in project cytoscape-impl by cytoscape.
the class TableTestSupportTest method setUp.
@Before
public void setUp() {
eventHelper = support.getDummyCyEventHelper();
EquationCompiler compiler = new EquationCompilerImpl(new EquationParserImpl(serviceRegistrar));
when(serviceRegistrar.getService(CyEventHelper.class)).thenReturn(eventHelper);
when(serviceRegistrar.getService(CyNetworkNaming.class)).thenReturn(namingUtil);
when(serviceRegistrar.getService(EquationCompiler.class)).thenReturn(compiler);
table = factory.createTable(Integer.toString(rand.nextInt(10000)), CyIdentifiable.SUID, Long.class, false, true);
table2 = factory.createTable(Integer.toString(rand.nextInt(10000)), CyIdentifiable.SUID, Long.class, false, true);
attrs = table.getRow(1l);
CyTableManagerImpl tblMgr = new CyTableManagerImpl(new CyNetworkTableManagerImpl(), new CyNetworkManagerImpl(serviceRegistrar), serviceRegistrar);
tblMgr.addTable(table);
((CyTableImpl) table).handleEvent(new TableAddedEvent(tblMgr, table));
tblMgr.addTable(table2);
((CyTableImpl) table2).handleEvent(new TableAddedEvent(tblMgr, table2));
}
use of org.cytoscape.model.internal.CyTableImpl in project cytoscape-impl by cytoscape.
the class BrowserTableTest method createTable.
void createTable() {
sharedTable = new CyTableImpl("shared table", CyNetwork.SUID, Long.class, false, true, SavePolicy.DO_NOT_SAVE, eventHelper, ColumnDataFactory.createDefaultFactory(), mock(Interpreter.class), 0);
sharedTable.createColumn(SHARED_NAME, String.class, true);
table = new CyTableImpl("test table", CyNetwork.SUID, Long.class, true, true, SavePolicy.DO_NOT_SAVE, eventHelper, ColumnDataFactory.createDefaultFactory(), mock(Interpreter.class), 0);
table.createColumn(CyNetwork.NAME, String.class, true);
table.createColumn(CyNetwork.SELECTED, Boolean.class, true, false);
table.addVirtualColumn(SHARED_NAME, SHARED_NAME, sharedTable, CyNetwork.SUID, true);
tableManager.addTable(table);
Long id = (long) 1;
CyRow row1 = table.getRow(id);
row1.set(CyNetwork.NAME, "row1");
CyRow sharedRow1 = sharedTable.getRow(id);
sharedRow1.set(SHARED_NAME, "yek");
CyRow row2 = table.getRow(id + 1);
row2.set(CyNetwork.NAME, "row2");
CyRow row3 = table.getRow(id + 2);
row3.set(CyNetwork.NAME, "row3");
CyRow sharedRow3 = sharedTable.getRow(id + 2);
sharedRow3.set(SHARED_NAME, "se");
}
use of org.cytoscape.model.internal.CyTableImpl in project cytoscape-impl by cytoscape.
the class MapTableToNetworkTableTaskTest method testMappingTableToNetwork.
@Test
public void testMappingTableToNetwork() throws Exception {
stm.addTunableHandlerFactory(syncTunableHandlerFactory, syncFactoryProp);
net1 = support.getNetwork();
node1 = net1.addNode();
node2 = net1.addNode();
net1.addEdge(node1, node2, true);
net1.getDefaultNodeTable().getRow(node1.getSUID()).set(CyRootNetwork.SHARED_NAME, node1Name);
net1.getDefaultNodeTable().getRow(node2.getSUID()).set(CyRootNetwork.SHARED_NAME, node2Name);
netMgr.addNetwork(net1);
table1 = new CyTableImpl("dummy table", "ID", String.class, true, true, SavePolicy.DO_NOT_SAVE, eventHelper, ColumnDataFactory.createDefaultFactory(), new InterpreterImpl(), 2);
table1.createColumn("col1", String.class, false);
CyRow row1 = table1.getRow(node1Name);
row1.set("col1", "col1 row1");
CyRow row2 = table1.getRow(node2Name);
row2.set("col1", "col1 row2");
mapping(table1, net1, false);
assertNotNull(net1.getDefaultNodeTable().getColumn("col1"));
assertEquals("col1 row1", net1.getRow(node1).get("col1", String.class));
}
use of org.cytoscape.model.internal.CyTableImpl in project cytoscape-impl by cytoscape.
the class JoinTablesTaskTest method testJoinTableToRootNetwork.
@Test
public void testJoinTableToRootNetwork() throws Exception {
stm.addTunableHandlerFactory(syncTunableHandlerFactory, syncFactoryProp);
creatNetwork();
final CyTableImpl table1 = (CyTableImpl) createTable("col1", "listCol1");
join(table1, net1, root, root.getDefaultNodeTable().getColumn(CyRootNetwork.SHARED_NAME), false);
testJoinTableToRootNetworkColumn();
testJoinTableToRootNetworkListColumn();
testSubnetworkAfterJointoRoot();
}
Aggregations