use of org.cytoscape.group.CyGroupSettingsManager.DoubleClickAction in project cytoscape-impl by cytoscape.
the class GroupViewDoubleClickListener method createTaskIterator.
@Override
public TaskIterator createTaskIterator(View<CyNode> nodeView, CyNetworkView networkView) {
CyNode node = nodeView.getModel();
CyNetwork net = networkView.getModel();
CyGroup group = null;
// Get the double click action for this group
if (cyGroupManager.isGroup(node, net))
group = cyGroupManager.getGroup(node, net);
else {
List<CyGroup> groups = cyGroupManager.getGroupsForNode(node);
for (CyGroup g : groups) {
// Make sure we're in the right network
if (cyGroupManager.isGroup(g.getGroupNode(), net)) {
group = g;
break;
}
}
}
DoubleClickAction action = cyGroupSettings.getDoubleClickAction(group);
if (action == DoubleClickAction.EXPANDCONTRACT) {
// that group.
return new TaskIterator(new CollapseGroupTask(nodeView, networkView));
} else if (action == DoubleClickAction.SELECT) {
// If all members of the group are selected, deselect that group
return new TaskIterator(new SelectGroupTask(nodeView, networkView));
} else {
return new TaskIterator(new NullTask());
}
}
Aggregations