AlignViewport av;\r
boolean resizing = false;\r
int oldY, mouseX;\r
- static String ADDNEW = "Add new row";\r
+ static String EDITNAME = "Edit label/description";\r
static String HIDE = "Hide this row";\r
static String DELETE = "Delete this row";\r
static String SHOWALL = "Show all hidden rows";\r
\r
Tooltip tooltip;\r
\r
+ Dialog editNameDialog;\r
+ Button okDialog = new Button("Accept");\r
+ Button cancelDialog = new Button("Cancel");\r
+\r
+\r
public AnnotationLabels(AlignmentPanel ap)\r
{\r
this.ap = ap;\r
setLayout(null);\r
addMouseListener(this);\r
addMouseMotionListener(this);\r
+ okDialog.addActionListener(this);\r
+ cancelDialog.addActionListener(this);\r
}\r
\r
public AnnotationLabels(AlignViewport av)\r
{\r
AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();\r
\r
+ if(evt.getActionCommand().equals(EDITNAME))\r
+ {\r
+ TextField id = new TextField(aa[selectedRow].label, 40);\r
+ TextField description = new TextField(aa[selectedRow].description, 40);\r
+ Panel panel = new Panel(new BorderLayout());\r
+ Panel panel2 = new Panel(new BorderLayout());\r
+ panel2.add(new Label(" Annotation Label "), BorderLayout.WEST);\r
+ panel2.add(id, BorderLayout.CENTER);\r
+ panel.add(panel2, BorderLayout.NORTH);\r
+ panel2 = new Panel(new BorderLayout());\r
+ panel2.add(new Label("Annotation Description "), BorderLayout.WEST);\r
+ panel2.add(description, BorderLayout.CENTER);\r
+ panel.add(panel2, BorderLayout.CENTER);\r
+\r
+ panel2 = new Panel(new FlowLayout());\r
+\r
+ panel2.add(okDialog);\r
+ panel2.add(cancelDialog);\r
+\r
+ panel.add(panel2, BorderLayout.SOUTH);\r
+\r
+ editNameDialog = new Dialog(ap.alignFrame,\r
+ "Edit Annotation Name / Description",\r
+ true);\r
+\r
+ editNameDialog.add(panel, BorderLayout.NORTH);\r
+\r
+ editNameDialog.setBounds(ap.alignFrame.getBounds().x\r
+ +(ap.alignFrame.getSize().width-500)/2 ,\r
+ ap.alignFrame.getBounds().y\r
+ +(ap.alignFrame.getSize().height-120)/2,\r
+ 500, 130);\r
+\r
+ editNameDialog.show();\r
+\r
+ if (editNameDialog != null)\r
+ {\r
+ aa[selectedRow].label=id.getText();\r
+ aa[selectedRow].description=description.getText();\r
+ repaint();\r
+ }\r
+\r
+ }\r
if (evt.getActionCommand().equals(HIDE))\r
{\r
aa[selectedRow].visible = false;\r
}\r
+ else if (evt.getSource() == okDialog || evt.getSource() == cancelDialog)\r
+ {\r
+ editNameDialog.setVisible(false);\r
+ if (evt.getSource() == cancelDialog)\r
+ editNameDialog = null;\r
+ }\r
else if (evt.getActionCommand().equals(SHOWALL))\r
{\r
for (int i = 0; i < aa.length; i++)\r
AlignmentAnnotation[] aa = ap.av.alignment.getAlignmentAnnotation();\r
\r
PopupMenu pop = new PopupMenu("Annotations");\r
- MenuItem item = new MenuItem(HIDE);\r
+\r
+ MenuItem item = new MenuItem(EDITNAME);\r
+ item.addActionListener(this);\r
+ pop.add(item);\r
+ item = new MenuItem(HIDE);\r
item.addActionListener(this);\r
pop.add(item);\r
item = new MenuItem(SHOWALL);\r