use of org.cytoscape.group.CyGroup in project cytoscape-impl by cytoscape.
the class CyGroupSettingsImpl method handleEvent.
public void handleEvent(NetworkAddedEvent e) {
CyNetwork net = e.getNetwork();
Set<CyGroup> groupSet = cyGroupManager.getGroupSet(net);
if (groupSet == null || groupSet.size() == 0)
return;
for (CyGroup group : groupSet) {
loadSettingsFromTable(group, net);
}
}
use of org.cytoscape.group.CyGroup in project cytoscape-impl by cytoscape.
the class GroupDataCollapseHandler method handleEvent.
public void handleEvent(GroupAboutToCollapseEvent e) {
CyNetwork network = e.getNetwork();
CyGroup group = e.getSource();
if (e.collapsing()) {
// Are we aggregating
if (!cyGroupSettings.getEnableAttributeAggregation(group))
return;
// Yup -- all of our information is in the settings...
CyTable nodeTable = network.getDefaultNodeTable();
for (CyColumn column : nodeTable.getColumns()) {
Class<?> type = column.getType();
if (column.isPrimaryKey())
continue;
// Skip over our own columns
if (CyGroupSettingsImpl.AGGREGATION_SETTINGS.equals(column.getName()))
continue;
if (CyGroupSettingsImpl.AGGREGATION_OVERRIDE_SETTINGS.equals(column.getName()))
continue;
if (CyGroupSettingsImpl.VIEW_SETTINGS.equals(column.getName()))
continue;
if (CyGroupImpl.CHILDREN_ATTR.equals(column.getName()))
continue;
if (CyGroupImpl.DESCENDENTS_ATTR.equals(column.getName()))
continue;
// Don't aggregate the name or shared name columns by default
if (CyNetwork.NAME.equals(column.getName())) {
if (!haveOverride(group, column))
continue;
}
if (CyRootNetwork.SHARED_NAME.equals(column.getName())) {
if (!haveOverride(group, column))
continue;
}
// Do we have an override for this group and column?
Aggregator<?> agg = cyGroupSettings.getAggregator(group, column);
if (agg == null) {
continue;
}
// OK, aggregate
agg.aggregate(nodeTable, group, column);
}
}
}
use of org.cytoscape.group.CyGroup in project cytoscape-impl by cytoscape.
the class GroupUtil method getGroups.
public Set<CyGroup> getGroups(final Collection<CyNetwork> networks) {
final Set<CyGroup> groups = new HashSet<>();
final CyGroupManager groupMgr = serviceRegistrar.getService(CyGroupManager.class);
for (final CyNetwork net : networks) groups.addAll(groupMgr.getGroupSet(net));
return groups;
}
use of org.cytoscape.group.CyGroup in project cytoscape-impl by cytoscape.
the class GroupUtil method getExternalEdges.
public List<CyEdge> getExternalEdges(final CyNetwork network) {
// Get all of our groups in this network
final CyGroupManager groupMgr = serviceRegistrar.getService(CyGroupManager.class);
Set<CyGroup> groupSet = groupMgr.getGroupSet(network);
List<CyEdge> externalEdges = new ArrayList<>();
for (CyGroup group : groupSet) {
// Don't need to worry about this for expanded groups
if (group.isCollapsed(network))
externalEdges.addAll(group.getExternalEdgeList());
}
return externalEdges;
}
use of org.cytoscape.group.CyGroup in project cytoscape-impl by cytoscape.
the class GroupUtil method prepareGroupsForSerialization.
public void prepareGroupsForSerialization(final Collection<CyNetwork> networks) {
if (networks == null)
return;
addedNodes = new HashMap<>();
for (CyNetwork net : networks) {
if (!(net instanceof CySubNetwork))
continue;
// Get all of our groups
final CyGroupManager groupMgr = serviceRegistrar.getService(CyGroupManager.class);
Set<CyGroup> groupSet = groupMgr.getGroupSet(net);
// For each group, save the list of external edges
for (CyGroup group : groupSet) {
updateExternalEdgeAttribute(group);
updateCollapsedGroupsAttribute(group);
updateGroupAttribute(net, group);
}
}
}
Aggregations