From 13df7bafa69202f914567346235f16a2daee0bb6 Mon Sep 17 00:00:00 2001 From: tjc <tjc@ee4ac58c-ac51-4696-9907-e4b3aa274f04> Date: Fri, 8 Apr 2005 13:51:40 +0000 Subject: [PATCH] select non-matching regions git-svn-id: svn+ssh://svn.internal.sanger.ac.uk/repos/svn/pathsoft/artemis/trunk@2387 ee4ac58c-ac51-4696-9907-e4b3aa274f04 --- .../sanger/artemis/components/SelectMenu.java | 34 ++++++++++++++++--- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/uk/ac/sanger/artemis/components/SelectMenu.java b/uk/ac/sanger/artemis/components/SelectMenu.java index 2ffa2865d..59d050869 100644 --- a/uk/ac/sanger/artemis/components/SelectMenu.java +++ b/uk/ac/sanger/artemis/components/SelectMenu.java @@ -20,7 +20,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * $Header: //tmp/pathsoft/artemis/uk/ac/sanger/artemis/components/SelectMenu.java,v 1.2 2005-04-07 16:27:51 tjc Exp $ + * $Header: //tmp/pathsoft/artemis/uk/ac/sanger/artemis/components/SelectMenu.java,v 1.3 2005-04-08 13:51:40 tjc Exp $ **/ package uk.ac.sanger.artemis.components; @@ -50,7 +50,7 @@ import javax.swing.*; * "Select by key". * * @author Kim Rutherford - * @version $Id: SelectMenu.java,v 1.2 2005-04-07 16:27:51 tjc Exp $ + * @version $Id: SelectMenu.java,v 1.3 2005-04-08 13:51:40 tjc Exp $ **/ public class SelectMenu extends SelectionMenu @@ -99,6 +99,11 @@ public class SelectMenu extends SelectionMenu **/ final private int MAX_FEATURE_TO_SELECT_COUNT = 10000; + /** busy cursor */ + private Cursor cbusy = new Cursor(Cursor.WAIT_CURSOR); + /** done cursor */ + private Cursor cdone = new Cursor(Cursor.DEFAULT_CURSOR); + /** * Create a new SelectMenu object and all it's menu items. @@ -171,7 +176,9 @@ public class SelectMenu extends SelectionMenu { public void actionPerformed(ActionEvent event) { + frame.setCursor(cbusy); selectAll(); + frame.setCursor(cdone); } }); @@ -182,7 +189,9 @@ public class SelectMenu extends SelectionMenu { public void actionPerformed(ActionEvent event) { + frame.setCursor(cbusy); selectAllBases(); + frame.setCursor(cdone); } }); @@ -196,6 +205,7 @@ public class SelectMenu extends SelectionMenu { public void actionPerformed(ActionEvent event) { + frame.setCursor(cbusy); Vector diffs = null; if(alignQueryViewer == null || alignSubjectViewer == null) { @@ -213,6 +223,7 @@ public class SelectMenu extends SelectionMenu if(diffs != null) selectAllFeatures(diffs); + frame.setCursor(cdone); } }); @@ -436,6 +447,13 @@ public class SelectMenu extends SelectionMenu } } + + /** + * + * Select all features in a given collection of regions. + * @param regions Vector of coordinates. + * + */ private void selectAllFeatures(final Vector regions) { @@ -444,6 +462,10 @@ public class SelectMenu extends SelectionMenu public boolean testPredicate(final Feature feature) { final Location loc = feature.getLocation(); + Key key = feature.getKey(); + if(key.equals("source")) + return false; + final int feat_start = loc.getFirstBase(); final int feat_end = loc.getLastBase(); @@ -453,9 +475,13 @@ public class SelectMenu extends SelectionMenu final Integer coords[] = (Integer[])eDiffs.nextElement(); final int start = coords[0].intValue(); final int end = coords[1].intValue(); - if( (start > feat_start && start < feat_end) || - (end > feat_start && end < feat_end) ) + if( (feat_start >= start && feat_start <= end) || + (feat_end >= start && feat_end <= end) || + (start >= feat_start && start <= feat_end) || + (end >= feat_start&& end <= feat_end ) ) return true; + else if(start > feat_end) + return false; } return false; -- GitLab