-public class IdPanel extends JPanel implements MouseListener, MouseMotionListener {\r
-\r
- protected IdCanvas idCanvas;\r
- protected AlignViewport av;\r
- protected AlignmentPanel alignPanel;\r
-\r
- protected int offy;\r
- public int width;\r
- public int lastid;\r
-\r
- SequenceGroup selectedSequenceGroup;\r
-\r
- public IdPanel(AlignViewport av, AlignmentPanel parent)\r
- {\r
- this.av = av;\r
- alignPanel = parent;\r
- idCanvas = new IdCanvas(av);\r
- setLayout(new BorderLayout());\r
- add(idCanvas, BorderLayout.CENTER);\r
- addMouseListener(this);\r
- addMouseMotionListener(this);\r
- }\r
-\r
- public void mouseMoved(MouseEvent e) {}\r
-\r
- public void selectSeqs(int start, int end) {\r
- if (end < start)\r
- {\r
- int tmp = start;\r
- start = end;\r
- end = tmp;\r
- }\r
-\r
- for (int i = start; i <= end; i++)\r
- {\r
- SequenceI pickedSeq = av.getAlignment().getSequenceAt(i);\r
- if (av.getSelection().contains(pickedSeq))\r
- {\r
- av.getSelection().removeElement(pickedSeq);\r
- selectedSequenceGroup.deleteSequence(pickedSeq);\r
- }\r
- else\r
- {\r
- av.getSelection().addElement(pickedSeq);\r
- if(selectedSequenceGroup==null)\r
- {\r
- selectedSequenceGroup = new SequenceGroup();\r
- av.setRubberbandGroup( selectedSequenceGroup );\r
- // av.alignment.addGroup( selectedSequenceGroup );\r
- selectedSequenceGroup.setStartRes(0);\r
- selectedSequenceGroup.setEndRes( pickedSeq.getSequence().length());\r
- }\r
-\r
- selectedSequenceGroup.addSequence( pickedSeq );\r
- }\r
-\r
- }\r
-\r
- alignPanel.seqPanel.seqCanvas.paintFlag=true;\r
- alignPanel.repaint();\r
- repaint();\r
-\r
- }\r
-\r
- public void mouseDragged(MouseEvent e) {\r
- int y = e.getY();\r
- int seq = av.getIndex(y);\r
-\r
- if (seq < lastid)\r
- selectSeqs(lastid - 1, seq);\r
- else if (seq > lastid)\r
- selectSeqs(lastid + 1, seq);\r
-\r
- lastid = seq;\r
-\r
- return;\r
- }\r
-\r
- public void mouseClicked(MouseEvent e)\r
- {\r
- if (e.getClickCount() == 2)\r
+\r
+/**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
+public class IdPanel extends JPanel implements MouseListener,\r
+ MouseMotionListener\r
+{\r
+ protected IdCanvas idCanvas;\r
+ protected AlignViewport av;\r
+ protected AlignmentPanel alignPanel;\r
+ ScrollThread scrollThread = null;\r
+ int offy;\r
+ int width;\r
+ int lastid = -1;\r
+ boolean mouseDragging = false;\r
+\r
+ /**\r
+ * Creates a new IdPanel object.\r
+ *\r
+ * @param av DOCUMENT ME!\r
+ * @param parent DOCUMENT ME!\r
+ */\r
+ public IdPanel(AlignViewport av, AlignmentPanel parent)\r
+ {\r
+ this.av = av;\r
+ alignPanel = parent;\r
+ idCanvas = new IdCanvas(av);\r
+ setLayout(new BorderLayout());\r
+ add(idCanvas, BorderLayout.CENTER);\r
+ addMouseListener(this);\r
+ addMouseMotionListener(this);\r
+ }\r
+\r
+ /**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @param e DOCUMENT ME!\r
+ */\r
+ public void mouseMoved(MouseEvent e)\r