use of org.cytoscape.filter.internal.filters.column.ColumnElement in project cytoscape-impl by cytoscape.
the class ModelMonitor method handleEvent.
@Override
public void handleEvent(ColumnNameChangedEvent event) {
synchronized (lock) {
if (network == null) {
return;
}
CyTable nodeTable = network.getDefaultNodeTable();
CyTable edgeTable = network.getDefaultEdgeTable();
CyTable table = event.getSource();
CyColumn column = table.getColumn(event.getNewColumnName());
Class<?> type;
if (table == nodeTable) {
type = CyNode.class;
} else if (table == edgeTable) {
type = CyEdge.class;
} else {
return;
}
for (int i = 0; i < columnNames.size(); i++) {
ColumnElement element = columnNames.get(i);
if (element.getName().equals(event.getOldColumnName()) && type.equals(element.getTableType())) {
columnNames.remove(i);
columnNames.add(new ColumnElement(element.getTableType(), column));
break;
}
}
Collections.sort(columnNames);
updateColumnViews();
}
}
use of org.cytoscape.filter.internal.filters.column.ColumnElement in project cytoscape-impl by cytoscape.
the class ModelMonitor method addFilterElements.
private void addFilterElements(CyTable table, Class<? extends CyIdentifiable> type) {
if (table == null) {
return;
}
for (CyColumn column : table.getColumns()) {
Class<?> elementType = column.getType();
Class<?> listElementType = column.getListElementType();
if (List.class.equals(elementType) && (String.class.equals(listElementType) || Number.class.isAssignableFrom(listElementType) || Boolean.class.equals(listElementType))) {
columnNames.add(new ColumnElement(type, column));
} else if (String.class.equals(elementType) || Number.class.isAssignableFrom(elementType) || Boolean.class.equals(elementType)) {
columnNames.add(new ColumnElement(type, column));
}
}
}
use of org.cytoscape.filter.internal.filters.column.ColumnElement in project cytoscape-impl by cytoscape.
the class ModelMonitor method handleEvent.
@Override
public void handleEvent(ColumnCreatedEvent event) {
synchronized (lock) {
if (network == null) {
return;
}
CyTable nodeTable = network.getDefaultNodeTable();
CyTable edgeTable = network.getDefaultEdgeTable();
CyTable table = event.getSource();
Class<?> type;
if (table == nodeTable) {
type = CyNode.class;
} else if (table == edgeTable) {
type = CyEdge.class;
} else {
return;
}
CyColumn column = table.getColumn(event.getColumnName());
columnNames.add(new ColumnElement(type, column));
Collections.sort(columnNames);
updateColumnViews();
}
}
use of org.cytoscape.filter.internal.filters.column.ColumnElement in project cytoscape-impl by cytoscape.
the class ModelMonitor method handleEvent.
@Override
public void handleEvent(ColumnDeletedEvent event) {
synchronized (lock) {
if (network == null) {
return;
}
CyTable nodeTable = network.getDefaultNodeTable();
CyTable edgeTable = network.getDefaultEdgeTable();
CyTable table = event.getSource();
Class<?> type;
if (table == nodeTable) {
type = CyNode.class;
} else if (table == edgeTable) {
type = CyEdge.class;
} else {
return;
}
for (int i = 0; i < columnNames.size(); i++) {
ColumnElement element = columnNames.get(i);
if (element.getName().equals(event.getColumnName()) && type.equals(element.getTableType())) {
columnNames.remove(i);
break;
}
}
updateColumnViews();
}
}
Aggregations