2 * Jalview - A Sequence Alignment Editor and Viewer
\r
3 * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
\r
5 * This program is free software; you can redistribute it and/or
\r
6 * modify it under the terms of the GNU General Public License
\r
7 * as published by the Free Software Foundation; either version 2
\r
8 * of the License, or (at your option) any later version.
\r
10 * This program is distributed in the hope that it will be useful,
\r
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
13 * GNU General Public License for more details.
\r
15 * You should have received a copy of the GNU General Public License
\r
16 * along with this program; if not, write to the Free Software
\r
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
\r
19 package jalview.jbgui;
\r
22 import java.awt.event.*;
\r
23 import javax.swing.*;
\r
25 public class GSequenceLink
\r
28 public GSequenceLink()
\r
34 catch (Exception ex)
\r
36 ex.printStackTrace();
\r
40 private void jbInit()
\r
43 this.setLayout(gridBagLayout1);
\r
44 nameTB.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
\r
45 nameTB.setBounds(new Rectangle(77, 10, 310, 23));
\r
46 nameTB.addKeyListener(new KeyAdapter()
\r
48 public void keyTyped(KeyEvent e)
\r
53 urlTB.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
\r
54 urlTB.setText("http://www.");
\r
55 urlTB.setBounds(new Rectangle(78, 40, 309, 23));
\r
56 urlTB.addKeyListener(new KeyAdapter()
\r
58 public void keyTyped(KeyEvent e)
\r
63 jLabel1.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
\r
64 jLabel1.setHorizontalAlignment(SwingConstants.TRAILING);
\r
65 jLabel1.setText("Link Name");
\r
66 jLabel1.setBounds(new Rectangle(4, 10, 71, 24));
\r
67 jLabel2.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));
\r
68 jLabel2.setHorizontalAlignment(SwingConstants.TRAILING);
\r
69 jLabel2.setText("URL");
\r
70 jLabel2.setBounds(new Rectangle(17, 37, 54, 27));
\r
71 jLabel3.setFont(new java.awt.Font("Verdana", Font.ITALIC, 11));
\r
72 jLabel3.setText("Use $SEQUENCE_ID$ to specify where sequence id is in URL");
\r
73 jLabel3.setBounds(new Rectangle(21, 72, 351, 15));
\r
74 jPanel1.setBorder(BorderFactory.createEtchedBorder());
\r
75 jPanel1.setLayout(null);
\r
76 jPanel1.add(jLabel1);
\r
77 jPanel1.add(nameTB);
\r
79 jPanel1.add(jLabel2);
\r
80 jPanel1.add(jLabel3);
\r
81 this.add(jPanel1, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0
\r
82 , GridBagConstraints.CENTER,
\r
83 GridBagConstraints.BOTH,
\r
84 new Insets(5, 4, 6, 5), 390, 100));
\r
87 public void setName(String name)
\r
89 nameTB.setText(name);
\r
92 public void setURL(String url)
\r
97 public String getName()
\r
99 return nameTB.getText();
\r
102 public String getURL()
\r
104 return urlTB.getText();
\r
107 public boolean checkValid()
\r
109 if (urlTB.getText().indexOf("$SEQUENCE_ID$") == -1)
\r
111 JOptionPane.showInternalMessageDialog(jalview.gui.Desktop.desktop,
\r
112 "Sequence URL must contain $SEQUENCE_ID$",
\r
114 JOptionPane.WARNING_MESSAGE);
\r
120 JTextField nameTB = new JTextField();
\r
121 JTextField urlTB = new JTextField();
\r
122 JLabel jLabel1 = new JLabel();
\r
123 JLabel jLabel2 = new JLabel();
\r
124 JLabel jLabel3 = new JLabel();
\r
125 JPanel jPanel1 = new JPanel();
\r
126 GridBagLayout gridBagLayout1 = new GridBagLayout();
\r
127 public void nameTB_keyTyped(KeyEvent e)
\r
129 if (e.getKeyChar() == '|')
\r
135 public void urlTB_keyTyped(KeyEvent e)
\r
137 if (e.getKeyChar() == '|' || e.getKeyChar() == ' ')
\r