Search in sources :

Example 6 with CyTableImpl

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));
}
Also used : EquationParserImpl(org.cytoscape.equations.internal.EquationParserImpl) EquationCompilerImpl(org.cytoscape.equations.internal.EquationCompilerImpl) CyNetworkManagerImpl(org.cytoscape.model.internal.CyNetworkManagerImpl) CyNetworkTableManagerImpl(org.cytoscape.model.internal.CyNetworkTableManagerImpl) TableAddedEvent(org.cytoscape.model.events.TableAddedEvent) EquationCompiler(org.cytoscape.equations.EquationCompiler) CyTableManagerImpl(org.cytoscape.model.internal.CyTableManagerImpl) CyTableImpl(org.cytoscape.model.internal.CyTableImpl) Before(org.junit.Before)

Example 7 with CyTableImpl

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");
}
Also used : CyRow(org.cytoscape.model.CyRow) CyTableImpl(org.cytoscape.model.internal.CyTableImpl)

Example 8 with CyTableImpl

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));
}
Also used : InterpreterImpl(org.cytoscape.equations.internal.interpreter.InterpreterImpl) CyRow(org.cytoscape.model.CyRow) CyTableImpl(org.cytoscape.model.internal.CyTableImpl) Test(org.junit.Test)

Example 9 with CyTableImpl

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();
}
Also used : CyTableImpl(org.cytoscape.model.internal.CyTableImpl) Test(org.junit.Test)

Aggregations

CyTableImpl (org.cytoscape.model.internal.CyTableImpl)9 CyRow (org.cytoscape.model.CyRow)5 Test (org.junit.Test)5 InterpreterImpl (org.cytoscape.equations.internal.interpreter.InterpreterImpl)4 ArrayList (java.util.ArrayList)3 CyApplicationManager (org.cytoscape.application.CyApplicationManager)2 Interpreter (org.cytoscape.equations.Interpreter)2 EquationCompilerImpl (org.cytoscape.equations.internal.EquationCompilerImpl)2 EquationParserImpl (org.cytoscape.equations.internal.EquationParserImpl)2 CyNetwork (org.cytoscape.model.CyNetwork)2 CyNode (org.cytoscape.model.CyNode)2 NetworkAddedEvent (org.cytoscape.model.events.NetworkAddedEvent)2 TableAddedEvent (org.cytoscape.model.events.TableAddedEvent)2 CyNetworkManagerImpl (org.cytoscape.model.internal.CyNetworkManagerImpl)2 CyNetworkTableManagerImpl (org.cytoscape.model.internal.CyNetworkTableManagerImpl)2 CySubNetworkImpl (org.cytoscape.model.internal.CySubNetworkImpl)2 CyTableManagerImpl (org.cytoscape.model.internal.CyTableManagerImpl)2 CyServiceRegistrar (org.cytoscape.service.util.CyServiceRegistrar)2 CyNetworkNaming (org.cytoscape.session.CyNetworkNaming)2 NewNetworkSelectedNodesOnlyTask (org.cytoscape.task.internal.network.NewNetworkSelectedNodesOnlyTask)2