\r
import java.util.*;\r
\r
-public class Selection {\r
+public class Selection\r
+{\r
+\r
Vector selected = new Vector();\r
+ AlignViewport av;\r
\r
- public void addElement(DrawableSequence seq) {\r
- addElement((SequenceI)seq);\r
+ public Selection(AlignViewport av)\r
+ {\r
+ this.av = av;\r
}\r
+\r
public void addElement(SequenceI seq) {\r
selected.addElement(seq);\r
- }\r
+ SequenceGroup sg = av.getRubberbandGroup();\r
+ if(sg==null)\r
+ {\r
+ sg = new SequenceGroup();\r
+ sg.setEndRes(av.alignment.getWidth()-1);\r
+ av.setRubberbandGroup(sg);\r
+ }\r
+\r
+ sg.addSequence(seq);\r
\r
- public void removeElement(DrawableSequence seq) {\r
- removeElement((SequenceI)seq);\r
}\r
\r
public void clear() {\r
}\r
\r
public void removeElement(SequenceI seq) {\r
- if (selected.contains(seq)) {\r
+ if (selected.contains(seq))\r
selected.removeElement(seq);\r
- } else {\r
+ else\r
System.err.println("WARNING: Tried to remove SequenceI NOT in Selection");\r
- }\r
- }\r
\r
- public boolean contains(DrawableSequence seq) {\r
- return contains((SequenceI)seq);\r
+ SequenceGroup sg = av.getRubberbandGroup();\r
+ if (sg != null)\r
+ sg.deleteSequence(seq);\r
+\r
+\r
}\r
+\r
public boolean contains(SequenceI seq) {\r
return selected.contains(seq);\r
}\r