Search in sources :

Example 1 with DoubleClickAction

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());
    }
}
Also used : CyGroup(org.cytoscape.group.CyGroup) TaskIterator(org.cytoscape.work.TaskIterator) DoubleClickAction(org.cytoscape.group.CyGroupSettingsManager.DoubleClickAction) CyNetwork(org.cytoscape.model.CyNetwork) CyNode(org.cytoscape.model.CyNode)

Aggregations

CyGroup (org.cytoscape.group.CyGroup)1 DoubleClickAction (org.cytoscape.group.CyGroupSettingsManager.DoubleClickAction)1 CyNetwork (org.cytoscape.model.CyNetwork)1 CyNode (org.cytoscape.model.CyNode)1 TaskIterator (org.cytoscape.work.TaskIterator)1