public class PopupMenu extends JPopupMenu\r
{\r
JMenu groupMenu = new JMenu();\r
- JMenuItem copyGroup = new JMenuItem();\r
- JMenuItem moveGroup = new JMenuItem();\r
- JMenuItem deleteSequences = new JMenuItem();\r
JMenuItem analyze = new JMenuItem();\r
JMenu defineMenu = new JMenu();\r
JMenuItem groupName = new JMenuItem();\r
private void jbInit() throws Exception\r
{\r
groupMenu.setText("Group");\r
- copyGroup.setText("Copy region to new Alignment");\r
- copyGroup.addActionListener(new java.awt.event.ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent e)\r
- {\r
- copyGroup_actionPerformed(e);\r
- }\r
- });\r
- moveGroup.setText("Move sequences to new Alignment");\r
- moveGroup.addActionListener(new java.awt.event.ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent e)\r
- {\r
- moveGroup_actionPerformed(e);\r
- }\r
- });\r
- deleteSequences.setText("Delete sequences");\r
- deleteSequences.addActionListener(new java.awt.event.ActionListener()\r
- {\r
- public void actionPerformed(ActionEvent e)\r
- {\r
- deleteSequences_actionPerformed(e);\r
- }\r
- });\r
analyze.setText("Analyze");\r
analyze.addActionListener(new java.awt.event.ActionListener()\r
{\r
groupMenu.add(defineMenu);\r
groupMenu.add(unGroupMenuItem);\r
groupMenu.addSeparator();\r
- groupMenu.add(copyGroup);\r
- groupMenu.add(moveGroup);\r
- groupMenu.add(deleteSequences);\r
- groupMenu.addSeparator();\r
groupMenu.add(analyze);\r
defineMenu.add(groupName);\r
defineMenu.add(groupAnnotation);\r
groupName.setText(reply);\r
}\r
\r
- protected void copyGroup_actionPerformed(ActionEvent e)\r
- {\r
- SequenceGroup sg = ap.av.getRubberbandGroup();\r
-\r
- SequenceI[] s = new Sequence[sg.sequences.size()];\r
- for (int i=0; i < sg.sequences.size(); i++)\r
- {\r
- s[i] = new Sequence( sg.getSequenceAt(i));\r
- s[i].setSequence( s[i].getSequence(sg.getStartRes(), sg.getEndRes()+1) );\r
- }\r
- AlignFrame af = new AlignFrame(new Alignment(s));\r
- int newHeight = s.length * af.viewport.getCharHeight() + 200;\r
- if (newHeight > 500)\r
- newHeight = 500;\r
- Desktop.addInternalFrame(af, "Copied sequences", 700, newHeight);\r
- }\r
-\r
- protected void moveGroup_actionPerformed(ActionEvent e)\r
- {\r
- SequenceGroup sg = ap.av.getRubberbandGroup();\r
-\r
- SequenceI[] s = new Sequence[sg.sequences.size()];\r
-\r
- for (int i=0; i < sg.sequences.size(); i++)\r
- s[i] = new Sequence( sg.getSequenceAt(i));\r
-\r
- AlignFrame af = new AlignFrame(new Alignment(s));\r
- int newHeight = s.length * af.viewport.getCharHeight() + 200;\r
- if(newHeight>500)\r
- newHeight=500;\r
- Desktop.addInternalFrame(af, "Copied sequences", 700,newHeight);\r
-\r
-\r
- for (int i=0; i < sg.sequences.size(); i++)\r
- ap.av.alignment.deleteSequence(sg.getSequenceAt(i));\r
-\r
-\r
- ap.av.resetSeqLimits(ap.seqPanel.seqCanvas.getHeight());\r
- ap.RefreshPanels();\r
-\r
-\r
- }\r
-\r
- protected void deleteSequences_actionPerformed(ActionEvent e)\r
- {\r
- SequenceGroup sg = ap.av.getRubberbandGroup();\r
- for (int i=0;i < sg.sequences.size(); i++)\r
- ap.av.getAlignment().deleteSequence(sg.getSequenceAt(i));\r
-\r
- ap.av.alignment.deleteGroup(sg);\r
- ap.av.resetSeqLimits(ap.seqPanel.seqCanvas.getHeight());\r
- ap.RefreshPanels();\r
-\r
- }\r
\r
protected void analyze_actionPerformed(ActionEvent e)\r
{\r