Package org.gvt.action

Source Code of org.gvt.action.HighlightWithRefAction

package org.gvt.action;

import org.eclipse.jface.action.Action;
import org.gvt.ChisioMain;
import org.gvt.model.BioPAXGraph;
import org.patika.mada.graph.Node;
import org.patika.mada.util.XRef;

import java.util.Collection;

/**
* Highlights object in the given view if they contain the given xref.
*
* @author Ozgun Babur
*
* Copyright: Bilkent Center for Bioinformatics, 2007 - present
*/
public class HighlightWithRefAction extends Action
{
  ChisioMain main;
  BioPAXGraph pgraph;
  Collection<XRef> refs;

  public HighlightWithRefAction(ChisioMain main, BioPAXGraph pgraph, Collection<XRef> refs)
  {
    this.main = main;
    this.pgraph = pgraph;
    this.refs = refs;
  }

  public void run()
  {
    for (Object o : pgraph.getNodes())
    {
      if (o instanceof Node)
      {
        Node node = (Node) o;

        for (XRef ref : refs)
        {
          if (node.getReferences().contains(ref))
          {
            node.setHighlight(true);
          }
        }
      }
    }
  }
}
TOP

Related Classes of org.gvt.action.HighlightWithRefAction

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.