use of org.cytoscape.model.events.TableAddedEvent in project cytoscape-impl by cytoscape.
the class CyTableTest method setUp.
@Before
public void setUp() {
eventHelper = new DummyCyEventHelper();
compiler = new EquationCompilerImpl(new EquationParserImpl(serviceRegistrar));
final Interpreter interpreter = new InterpreterImpl();
when(serviceRegistrar.getService(CyEventHelper.class)).thenReturn(eventHelper);
when(serviceRegistrar.getService(CyNetworkNaming.class)).thenReturn(namingUtil);
when(serviceRegistrar.getService(EquationCompiler.class)).thenReturn(compiler);
when(serviceRegistrar.getService(Interpreter.class)).thenReturn(interpreter);
table = new CyTableImpl("homer", CyIdentifiable.SUID, Long.class, false, true, SavePolicy.SESSION_FILE, eventHelper, ColumnDataFactory.createDefaultFactory(), interpreter, 1000);
attrs = table.getRow(1L);
table2 = new CyTableImpl("marge", CyIdentifiable.SUID, Long.class, false, true, SavePolicy.SESSION_FILE, eventHelper, ColumnDataFactory.createDefaultFactory(), interpreter, 1000);
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.events.TableAddedEvent 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.events.TableAddedEvent in project cytoscape-impl by cytoscape.
the class CyTableManagerImpl method addTable.
@Override
public void addTable(final CyTable t) {
boolean fireEvent = false;
synchronized (lock) {
if (t == null)
throw new NullPointerException("added table is null");
final Long suid = t.getSUID();
if (tables.get(suid) == null) {
tables.put(suid, t);
fireEvent = true;
}
}
if (fireEvent) {
final CyEventHelper eventHelper = serviceRegistrar.getService(CyEventHelper.class);
eventHelper.fireEvent(new TableAddedEvent(this, t));
}
}
Aggregations