2 * Jalview - A Sequence Alignment Editor and Viewer
\r
3 * Copyright (C) 2005 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
21 import javax.swing.*;
\r
22 import javax.swing.border.TitledBorder;
\r
23 import java.awt.event.ActionListener;
\r
24 import java.awt.event.ActionEvent;
\r
26 import javax.swing.BorderFactory;
\r
27 import javax.swing.event.HyperlinkListener;
\r
28 import javax.swing.event.HyperlinkEvent;
\r
29 import java.awt.Dimension;
\r
31 public class GDasSourceBrowser
\r
34 public GDasSourceBrowser()
\r
40 catch (Exception ex)
\r
42 ex.printStackTrace();
\r
46 private void jbInit()
\r
49 this.setLayout(gridBagLayout1);
\r
50 refresh.setText("Refresh Available Sources");
\r
51 refresh.addActionListener(new ActionListener()
\r
53 public void actionPerformed(ActionEvent e)
\r
55 refresh_actionPerformed(e);
\r
58 progressBar.setPreferredSize(new Dimension(450, 20));
\r
59 progressBar.setString("");
\r
60 scrollPane.setBorder(titledBorder1);
\r
61 scrollPane.setBorder(BorderFactory.createEtchedBorder());
\r
62 fullDetailsScrollpane.setBorder(BorderFactory.createEtchedBorder());
\r
63 fullDetails.addHyperlinkListener(new HyperlinkListener()
\r
65 public void hyperlinkUpdate(HyperlinkEvent e)
\r
67 fullDetails_hyperlinkUpdate(e);
\r
70 fullDetails.setEditable(false);
\r
71 registryLabel.setHorizontalAlignment(SwingConstants.TRAILING);
\r
72 registryLabel.setText("Use Registry");
\r
73 addLocal.setText("Add Local Source");
\r
74 addLocal.addActionListener(new ActionListener()
\r
76 public void actionPerformed(ActionEvent e)
\r
81 jPanel1.setLayout(flowLayout1);
\r
82 jPanel1.setMinimumSize(new Dimension(596, 30));
\r
83 jPanel1.setPreferredSize(new Dimension(596, 30));
\r
84 jScrollPane2.setBorder(titledBorder3);
\r
85 jScrollPane3.setBorder(titledBorder4);
\r
86 jScrollPane4.setBorder(titledBorder5);
\r
87 scrollPane.getViewport().add(table);
\r
88 fullDetailsScrollpane.getViewport().add(fullDetails);
\r
89 jScrollPane3.getViewport().add(filter2);
\r
90 jScrollPane4.getViewport().add(filter3);
\r
91 jPanel1.add(refresh, null);
\r
92 jPanel1.add(addLocal, null);
\r
93 jPanel1.add(progressBar, null);
\r
94 jScrollPane2.getViewport().add(filter1);
\r
95 this.add(registryLabel, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0
\r
96 , GridBagConstraints.WEST, GridBagConstraints.NONE,
\r
97 new Insets(11, 2, 0, 0), 9, 2));
\r
98 this.add(registryURL, new GridBagConstraints(1, 2, 4, 1, 1.0, 0.0
\r
99 , GridBagConstraints.WEST,
\r
100 GridBagConstraints.HORIZONTAL,
\r
101 new Insets(6, 7, 0, 10), 393,
\r
103 this.add(jPanel1, new GridBagConstraints(0, 3, 5, 1, 1.0, 1.0
\r
104 , GridBagConstraints.CENTER,
\r
105 GridBagConstraints.HORIZONTAL,
\r
106 new Insets(0, 0, 0, 0), 0, 0));
\r
107 this.add(fullDetailsScrollpane, new GridBagConstraints(2, 0, 3, 1, 1.0, 1.0
\r
108 , GridBagConstraints.CENTER, GridBagConstraints.BOTH,
\r
109 new Insets(3, 0, 0, 3), 240, 130));
\r
110 this.add(jScrollPane3, new GridBagConstraints(2, 1, 1, 1, 1.0, 1.0
\r
111 , GridBagConstraints.CENTER,
\r
112 GridBagConstraints.BOTH,
\r
113 new Insets(0, 0, 0, 0), 80,
\r
115 this.add(jScrollPane4, new GridBagConstraints(4, 1, 1, 1, 1.0, 1.0
\r
116 , GridBagConstraints.CENTER,
\r
117 GridBagConstraints.BOTH,
\r
118 new Insets(0, 0, 0, 0), 80,
\r
120 this.add(jScrollPane2, new GridBagConstraints(0, 1, 2, 1, 1.0, 1.0
\r
121 , GridBagConstraints.CENTER,
\r
122 GridBagConstraints.BOTH,
\r
123 new Insets(0, 0, 0, 0), 80,
\r
125 this.add(scrollPane, new GridBagConstraints(0, 0, 2, 1, 1.0, 1.0
\r
126 , GridBagConstraints.CENTER,
\r
127 GridBagConstraints.BOTH,
\r
128 new Insets(3, 2, 0, 0), 150,
\r
132 protected JTable table = new JTable();
\r
133 protected JEditorPane fullDetails = new JEditorPane("text/html", "");
\r
134 TitledBorder titledBorder1 = new TitledBorder("Available DAS Sources");
\r
135 protected JButton refresh = new JButton();
\r
136 protected JProgressBar progressBar = new JProgressBar();
\r
137 protected JScrollPane scrollPane = new JScrollPane();
\r
138 TitledBorder titledBorder2 = new TitledBorder("Full Details");
\r
139 protected JScrollPane fullDetailsScrollpane = new JScrollPane();
\r
140 protected JList filter1 = new JList();
\r
141 protected JList filter2 = new JList();
\r
142 protected JList filter3 = new JList();
\r
143 JScrollPane jScrollPane2 = new JScrollPane();
\r
144 JScrollPane jScrollPane3 = new JScrollPane();
\r
145 JScrollPane jScrollPane4 = new JScrollPane();
\r
146 protected JTextField registryURL = new JTextField();
\r
147 protected JLabel registryLabel = new JLabel();
\r
148 protected JButton addLocal = new JButton();
\r
149 JPanel jPanel1 = new JPanel();
\r
150 FlowLayout flowLayout1 = new FlowLayout();
\r
151 GridBagLayout gridBagLayout1 = new GridBagLayout();
\r
152 TitledBorder titledBorder3 = new TitledBorder("Authority:");
\r
153 TitledBorder titledBorder4 = new TitledBorder("Type:");
\r
154 TitledBorder titledBorder5 = new TitledBorder("Label:");
\r
155 public void refresh_actionPerformed(ActionEvent e)
\r
160 public void fullDetails_hyperlinkUpdate(HyperlinkEvent e)
\r
164 if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED)
\r
165 jalview.util.BrowserLauncher.openURL(e.getURL().toString());
\r
167 catch(Exception ex)
\r
169 System.out.println(e.getURL());
\r
170 ex.printStackTrace();
\r
174 public void amendLocal(boolean newSource)
\r