use of org.cytoscape.model.CyTable in project cytoscape-impl by cytoscape.
the class DefaultTablesNetwork method createNodeTables.
private void createNodeTables(long suidx, CyTableFactory tableFactory, boolean pubTables, int num, SharedTableFacade sharedNodeTable) {
final CyTable defTable = tableFactory.createTable(suidx + " default node", CyIdentifiable.SUID, Long.class, false, /* all local tables are private*/
false, InitialTableSize.SMALL);
networkTableManager.setTable(networkRef.get(), CyNode.class, CyNetwork.LOCAL_ATTRS, defTable);
LocalTableFacade localTable = new LocalTableFacade(defTable, sharedNodeTable, eventHelper);
// Set the privacy of facade tables based on the given flag
localTable.setPublic(pubTables);
networkTableManager.setTable(networkRef.get(), CyNode.class, CyNetwork.DEFAULT_ATTRS, localTable);
if (eventHelper instanceof TableEventHelperFacade)
((TableEventHelperFacade) eventHelper).registerFacade(localTable);
final CyTable hiddenTable = tableFactory.createTable(suidx + " hidden node", CyIdentifiable.SUID, Long.class, false, false, InitialTableSize.SMALL);
networkTableManager.setTable(networkRef.get(), CyNode.class, CyNetwork.HIDDEN_ATTRS, hiddenTable);
defTable.createColumn(CyNetwork.NAME, String.class, true);
defTable.createColumn(CyNetwork.SELECTED, Boolean.class, true, Boolean.FALSE);
}
use of org.cytoscape.model.CyTable in project cytoscape-impl by cytoscape.
the class DefaultTablesNetwork method createEdgeTables.
private void createEdgeTables(long suidx, CyTableFactory tableFactory, boolean pubTables, int num, SharedTableFacade sharedEdgeTable) {
final CyTable defTable = tableFactory.createTable(suidx + " default edge", CyIdentifiable.SUID, Long.class, false, /* all local tables are private*/
false, InitialTableSize.SMALL);
networkTableManager.setTable(networkRef.get(), CyEdge.class, CyNetwork.LOCAL_ATTRS, defTable);
LocalTableFacade localTable = new LocalTableFacade(defTable, sharedEdgeTable, eventHelper);
// Set the privacy of facade tables based on the given flag
localTable.setPublic(pubTables);
networkTableManager.setTable(networkRef.get(), CyEdge.class, CyNetwork.DEFAULT_ATTRS, localTable);
if (eventHelper instanceof TableEventHelperFacade)
((TableEventHelperFacade) eventHelper).registerFacade(localTable);
final CyTable hiddenTable = tableFactory.createTable(suidx + " hidden edge", CyIdentifiable.SUID, Long.class, false, false, InitialTableSize.SMALL);
networkTableManager.setTable(networkRef.get(), CyEdge.class, CyNetwork.HIDDEN_ATTRS, hiddenTable);
defTable.createColumn(CyNetwork.NAME, String.class, true);
defTable.createColumn(CyNetwork.SELECTED, Boolean.class, true, Boolean.FALSE);
defTable.createColumn(CyEdge.INTERACTION, String.class, true);
}
use of org.cytoscape.model.CyTable in project cytoscape-impl by cytoscape.
the class SharedTableFacade method createListColumn.
public <T> void createListColumn(String columnName, Class<T> listElementType, boolean isImmutable, List<T> defaultValue) {
checkIfAlreadyExists(columnName);
logger.debug("adding real List column: '" + columnName + "' to table: " + shared.getTitle());
shared.createListColumn(columnName, listElementType, isImmutable, defaultValue);
for (CyTable local : localTables()) {
logger.debug("adding virtual list column: " + columnName + " to local table: " + local.getTitle());
local.addVirtualColumn(columnName, columnName, shared, CyIdentifiable.SUID, isImmutable);
}
}
use of org.cytoscape.model.CyTable in project cytoscape-impl by cytoscape.
the class SharedTableFacade method createColumn.
public <T> void createColumn(String columnName, Class<? extends T> type, boolean isImmutable, T defaultValue) {
checkIfAlreadyExists(columnName);
logger.debug("adding real column: '" + columnName + "' to table: " + shared.getTitle());
shared.createColumn(columnName, type, isImmutable, defaultValue);
for (CyTable local : localTables()) {
logger.debug("adding virtual column: " + columnName + " to local table: " + local.getTitle());
local.addVirtualColumn(columnName, columnName, shared, CyIdentifiable.SUID, isImmutable);
}
}
use of org.cytoscape.model.CyTable in project cytoscape-impl by cytoscape.
the class TableEventHelperFacade method fireEvent.
@Override
public <E extends CyEvent<?>> void fireEvent(final E event) {
final CyEventHelper eventHelper = getEventHelper();
// always propagate the actual event
eventHelper.fireEvent(event);
// make sure the source is something we care about
Object source = event.getSource();
if (!(source instanceof CyTable))
return;
Reference<LocalTableFacade> reference;
synchronized (lock) {
reference = facadeMap.get((CyTable) source);
}
if (reference == null)
return;
LocalTableFacade facade = reference.get();
if (facade == null)
return;
// create a new event for the facade table based on the actual event
CyEvent<?> facadeEvent = null;
if (event instanceof TableTitleChangedEvent) {
TableTitleChangedEvent e = (TableTitleChangedEvent) event;
facadeEvent = new TableTitleChangedEvent(facade, e.getOldTitle());
} else if (event instanceof TablePrivacyChangedEvent) {
facadeEvent = new TablePrivacyChangedEvent(facade);
} else if (event instanceof ColumnNameChangedEvent) {
ColumnNameChangedEvent e = (ColumnNameChangedEvent) event;
facadeEvent = new ColumnNameChangedEvent(facade, e.getOldColumnName(), e.getNewColumnName());
} else if (event instanceof ColumnDeletedEvent) {
ColumnDeletedEvent e = (ColumnDeletedEvent) event;
facadeEvent = new ColumnDeletedEvent(facade, e.getColumnName());
} else if (event instanceof ColumnCreatedEvent) {
ColumnCreatedEvent e = (ColumnCreatedEvent) event;
facadeEvent = new ColumnCreatedEvent(facade, e.getColumnName());
}
// fire the new facade event
if (facadeEvent != null)
eventHelper.fireEvent(facadeEvent);
}
Aggregations