use of org.cytoscape.model.events.TableAboutToBeDeletedEvent in project cytoscape-impl by cytoscape.
the class CyTableManagerImpl method reset.
@Override
public void reset() {
Collection<CyTable> values;
synchronized (lock) {
values = tables.values();
}
final CyEventHelper eventHelper = serviceRegistrar.getService(CyEventHelper.class);
for (CyTable table : values) {
eventHelper.fireEvent(new TableAboutToBeDeletedEvent(this, table));
}
synchronized (lock) {
tables.clear();
}
}
use of org.cytoscape.model.events.TableAboutToBeDeletedEvent in project cytoscape-impl by cytoscape.
the class CyTableManagerImpl method deleteTableInternal.
void deleteTableInternal(final long suid, boolean force) {
CyTable table;
synchronized (lock) {
table = tables.get(suid);
if (table == null) {
return;
}
}
final CyEventHelper eventHelper = serviceRegistrar.getService(CyEventHelper.class);
eventHelper.fireEvent(new TableAboutToBeDeletedEvent(this, table));
synchronized (lock) {
table = tables.get(suid);
if (table == null) {
return;
}
if (!force && (table.getMutability() != Mutability.MUTABLE)) {
throw new IllegalArgumentException("can't delete an immutable table.");
}
if (table instanceof CyTableImpl)
((CyTableImpl) table).removeAllVirtColumns();
tables.remove(suid);
}
eventHelper.fireEvent(new TableDeletedEvent(this));
logger.debug("CyTable removed: table ID = " + table.getSUID());
table = null;
}
Aggregations