label.inmenu = In Menu
label.id = ID
label.urltooltip = Only one url, which must use a sequence id, can be selected for the 'On Click' option
-label.edit_sequence_url_link = Edit sequence URL link
\ No newline at end of file
+label.edit_sequence_url_link = Edit sequence URL link
+warn.name_cannot_be_duplicate = URL names must be unique
+label.invalid_name = Invalid Name !
\ No newline at end of file
label.inmenu = In Menu
label.id = ID
label.urltooltip = Only one url, which must use a sequence id, can be selected for the 'On Click' option
-label.edit_sequence_url_link = Edit sequence URL link
\ No newline at end of file
+label.edit_sequence_url_link = Edit sequence URL link
+warn.name_cannot_be_duplicate = URL names must be unique
+label.invalid_name = Invalid Name !
\ No newline at end of file
{
if (link.checkValid())
{
- ((UrlLinkTableModel) linkUrlTable.getModel()).insertRow(
- link.getName(), link.getURL());
- valid = true;
+ if (((UrlLinkTableModel) linkUrlTable.getModel())
+ .isUniqueName(link.getName()))
+ {
+ ((UrlLinkTableModel) linkUrlTable.getModel()).insertRow(
+ link.getName(), link.getURL());
+ valid = true;
+ }
+ else
+ {
+ link.notifyDuplicate();
+ continue;
+ }
}
}
else
{
if (link.checkValid())
{
- linkUrlTable.setValueAt(link.getName(), index, 0);
- linkUrlTable.setValueAt(link.getURL(), index, 1);
- valid = true;
+ if (((UrlLinkTableModel) linkUrlTable.getModel())
+ .isUniqueName(link.getName()))
+ {
+ linkUrlTable.setValueAt(link.getName(), index, 0);
+ linkUrlTable.setValueAt(link.getURL(), index, 1);
+ valid = true;
+ }
+ else
+ {
+ link.notifyDuplicate();
+ continue;
+ }
}
}
else
return false;
}
+ public void notifyDuplicate()
+ {
+ JOptionPane.showInternalMessageDialog(jalview.gui.Desktop.desktop,
+ MessageManager.getString("warn.name_cannot_be_duplicate"),
+ MessageManager.getString("label.invalid_name"),
+ JOptionPane.WARNING_MESSAGE);
+ }
+
public void nameTB_keyTyped(KeyEvent e)
{
if (e.getKeyChar() == '|')
return dataProvider
.isUserEntry(entry.getStringValue(UrlLinkDisplay.ID));
}
+
+ public boolean isUniqueName(String name)
+ {
+ return !dataProvider.contains(name);
+ }
}