use of org.cytoscape.model.subnetwork.CySubNetwork 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);
}
}
}
use of org.cytoscape.model.subnetwork.CySubNetwork in project clusterMaker2 by RBVI.
the class ClusterManagerImpl method createGroup.
public CyGroup createGroup(CyNetwork network, String name, List<CyNode> nodeList, List<CyEdge> edgeList, boolean registerGroup) {
CyGroup group = groupFactory.createGroup(network, nodeList, edgeList, registerGroup);
if (group != null) {
CyRootNetwork rootNetwork = ((CySubNetwork) network).getRootNetwork();
// The name of the group node is the name of the group
rootNetwork.getRow(group.getGroupNode()).set(CyNetwork.NAME, name);
rootNetwork.getRow(group.getGroupNode(), CyRootNetwork.SHARED_ATTRS).set(CyRootNetwork.SHARED_NAME, name);
}
return group;
}
use of org.cytoscape.model.subnetwork.CySubNetwork in project clusterMaker2 by RBVI.
the class ClusterManagerImpl method unlinkNetworkSelection.
public void unlinkNetworkSelection(CyNetwork network) {
if (!isLinked(network))
return;
CyRootNetwork rootNetwork = ((CySubNetwork) network).getRootNetwork();
unregisterService(linkedNetworks.get(rootNetwork), RowsSetListener.class);
linkedNetworks.remove(rootNetwork);
}
use of org.cytoscape.model.subnetwork.CySubNetwork in project clusterMaker2 by RBVI.
the class ClusterManagerImpl method linkNetworkSelection.
public void linkNetworkSelection(CyNetwork network) {
if (isLinked(network))
return;
CyRootNetwork rootNetwork = ((CySubNetwork) network).getRootNetwork();
CyEventHelper helper = serviceRegistrar.getService(CyEventHelper.class);
NetworkSelectionLinker linker = new NetworkSelectionLinker(rootNetwork, helper, this);
registerService(linker, RowsSetListener.class, new Properties());
linkedNetworks.put(rootNetwork, linker);
}
use of org.cytoscape.model.subnetwork.CySubNetwork in project clusterMaker2 by RBVI.
the class NetworkSelectionLinker method handleEvent.
public void handleEvent(RowsSetEvent e) {
if (!e.containsColumn(CyNetwork.SELECTED) || ignoreSelection)
return;
// System.out.println("Select");
CyNetworkView currentNetworkView = clusterManager.getNetworkView();
ignoreSelection = true;
Map<CyNetwork, Boolean> stateMap = new HashMap<CyNetwork, Boolean>();
for (CySubNetwork subNetwork : rootNetwork.getSubNetworkList()) {
if (e.getSource().equals(subNetwork.getTable(CyNode.class, CyNetwork.LOCAL_ATTRS))) {
for (RowSetRecord record : e.getColumnRecords(CyNetwork.SELECTED)) {
Long suid = record.getRow().get(CyIdentifiable.SUID, Long.class);
Boolean value = (Boolean) record.getValue();
for (CySubNetwork sub2 : rootNetwork.getSubNetworkList()) {
if (subNetwork.equals(sub2) || sub2.getDefaultNodeTable().getRow(suid) == null)
continue;
// System.out.println("Selecting row "+suid);
sub2.getDefaultNodeTable().getRow(suid).set(CyNetwork.SELECTED, value);
}
}
}
if (viewManager.viewExists(subNetwork)) {
for (CyNetworkView view : viewManager.getNetworkViews(subNetwork)) {
if (!view.equals(currentNetworkView)) {
view.updateView();
}
}
}
}
eventHelper.flushPayloadEvents();
ignoreSelection = false;
}
Aggregations