*/
boolean editLabelDescription(AlignmentAnnotation annotation)
{
- JLabel idlabel = new JLabel( " Annotation Label ");
- JLabel desclabel = new JLabel("Annotation Description ");
- idlabel.setFont(new Font("Courier", Font.PLAIN, 12));
- desclabel.setFont(new Font("Courier", Font.PLAIN, 12));
- JTextField id = new JTextField(annotation.label, 40);
- JTextField description = new JTextField(annotation.description, 40);
- JPanel panel = new JPanel(new BorderLayout());
- JPanel panel2 = new JPanel(new BorderLayout());
- panel2.add(idlabel, BorderLayout.WEST);
- panel2.add(id, BorderLayout.CENTER);
- panel.add(panel2, BorderLayout.NORTH);
- panel2 = new JPanel(new BorderLayout());
- panel2.add(desclabel, BorderLayout.WEST);
- panel2.add(description, BorderLayout.CENTER);
- panel.add(panel2, BorderLayout.SOUTH);
-
-
- int reply = JOptionPane.showInternalConfirmDialog(Desktop.desktop,
- panel, "Edit Annotation Name/Description",
- JOptionPane.OK_CANCEL_OPTION );
-
-
- if (reply != JOptionPane.OK_OPTION )
- {
- return false;
- }
+ EditNameDialog dialog = new EditNameDialog(annotation.label,
+ annotation.description,
+ " Annotation Name ",
+ "Annotation Description ",
+ "Edit Annotation Name/Description");
+ if (!dialog.accept)
+ {
+ return false;
+ }
- annotation.label = id.getText().trim();
+ annotation.label = dialog.getName();
- String text = description.getText().trim();
+ String text = dialog.getDescription();
if(text.length()==0)
text = null;
annotation.description = text;
getSelectedRow(evt.getY() - scrollOffset);
- if(selectedRow>-1)
+ if(selectedRow>-1
+ && ap.av.alignment.getAlignmentAnnotation().length>selectedRow)
{
String desc = ap.av.alignment.
getAlignmentAnnotation()[selectedRow].description;
- if (desc != null && !desc.equals("New Description"))
+ if (desc != null && !desc.equals("New description"))
setToolTipText(ap.av.alignment.
getAlignmentAnnotation()[selectedRow].description);