2 * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3 * Copyright (C) $$Year-Rel$$ The Jalview Authors
5 * This file is part of Jalview.
7 * Jalview is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation, either version 3
10 * of the License, or (at your option) any later version.
12 * Jalview is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19 * The Jalview Authors are detailed in the 'AUTHORS' file.
21 package jalview.jbgui;
23 import jalview.util.MessageManager;
25 import java.awt.BorderLayout;
26 import java.awt.Dimension;
27 import java.awt.FlowLayout;
29 import java.awt.GridBagConstraints;
30 import java.awt.GridBagLayout;
31 import java.awt.Insets;
32 import java.awt.event.ActionEvent;
33 import java.awt.event.ActionListener;
35 import javax.swing.BorderFactory;
36 import javax.swing.JButton;
37 import javax.swing.JEditorPane;
38 import javax.swing.JLabel;
39 import javax.swing.JList;
40 import javax.swing.JPanel;
41 import javax.swing.JProgressBar;
42 import javax.swing.JScrollPane;
43 import javax.swing.JTable;
44 import javax.swing.JTextField;
45 import javax.swing.SwingConstants;
46 import javax.swing.border.TitledBorder;
47 import javax.swing.event.HyperlinkEvent;
48 import javax.swing.event.HyperlinkListener;
50 public class GDasSourceBrowser extends JPanel
52 public GDasSourceBrowser()
57 } catch (Exception ex)
63 private void jbInit() throws Exception
65 this.setLayout(gridBagLayout1);
67 MessageManager.getString("label.refresh_available_sources"));
68 refresh.addActionListener(new ActionListener()
70 public void actionPerformed(ActionEvent e)
72 refresh_actionPerformed(e);
75 progressBar.setPreferredSize(new Dimension(450, 20));
76 progressBar.setString("");
77 scrollPane.setBorder(titledBorder1);
78 scrollPane.setBorder(BorderFactory.createEtchedBorder());
79 fullDetailsScrollpane.setBorder(BorderFactory.createEtchedBorder());
80 fullDetails.addHyperlinkListener(new HyperlinkListener()
82 public void hyperlinkUpdate(HyperlinkEvent e)
84 fullDetails_hyperlinkUpdate(e);
87 fullDetails.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
88 fullDetails.setEditable(false);
89 registryLabel.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
90 registryLabel.setHorizontalAlignment(SwingConstants.TRAILING);
91 registryLabel.setText(MessageManager.getString("label.use_registry"));
92 addLocal.setText(MessageManager.getString("label.add_local_source"));
93 addLocal.addActionListener(new ActionListener()
95 public void actionPerformed(ActionEvent e)
100 jPanel1.setLayout(flowLayout1);
101 jPanel1.setMinimumSize(new Dimension(596, 30));
102 jPanel1.setPreferredSize(new Dimension(596, 30));
103 jScrollPane2.setBorder(titledBorder3);
104 jScrollPane3.setBorder(titledBorder4);
105 jScrollPane4.setBorder(titledBorder5);
107 .setTitleFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
109 .setTitleFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
111 .setTitleFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
112 filter1.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
113 filter2.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
114 filter3.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
115 table.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
116 reset.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
117 reset.setMargin(new Insets(2, 2, 2, 2));
118 reset.setText(MessageManager.getString("action.reset"));
119 reset.addActionListener(new ActionListener()
121 public void actionPerformed(ActionEvent e)
123 reset_actionPerformed(e);
126 jPanel2.setLayout(borderLayout1);
127 borderLayout1.setHgap(5);
128 registryURL.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
129 scrollPane.getViewport().add(table);
130 fullDetailsScrollpane.getViewport().add(fullDetails);
131 jScrollPane3.getViewport().add(filter2);
132 jScrollPane4.getViewport().add(filter3);
133 jPanel1.add(refresh, null);
134 jPanel1.add(addLocal, null);
135 jPanel1.add(progressBar, null);
136 jScrollPane2.getViewport().add(filter1);
137 this.add(jPanel1, new GridBagConstraints(0, 3, 3, 1, 1.0, 1.0,
138 GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
139 new Insets(0, 0, 0, 0), 0, 0));
140 this.add(fullDetailsScrollpane,
141 new GridBagConstraints(1, 0, 2, 1, 1.0, 1.0,
142 GridBagConstraints.CENTER, GridBagConstraints.BOTH,
143 new Insets(3, 0, 0, 3), 240, 130));
145 new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0,
146 GridBagConstraints.CENTER, GridBagConstraints.BOTH,
147 new Insets(3, 2, 0, 0), 150, 130));
148 jPanel2.add(registryLabel, java.awt.BorderLayout.WEST);
149 jPanel2.add(registryURL, java.awt.BorderLayout.CENTER);
150 jPanel2.add(reset, java.awt.BorderLayout.EAST);
151 this.add(jPanel2, new GridBagConstraints(0, 2, 3, 1, 0.0, 0.0,
152 GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
153 new Insets(5, 10, 0, 10), 339, 0));
154 this.add(jScrollPane2,
155 new GridBagConstraints(0, 1, 1, 1, 1.0, 1.0,
156 GridBagConstraints.CENTER, GridBagConstraints.BOTH,
157 new Insets(0, 0, 0, 60), 80, 60));
158 this.add(jScrollPane4,
159 new GridBagConstraints(2, 1, 1, 1, 1.0, 1.0,
160 GridBagConstraints.CENTER, GridBagConstraints.BOTH,
161 new Insets(0, -80, 0, 0), 80, 60));
162 this.add(jScrollPane3,
163 new GridBagConstraints(1, 1, 1, 1, 1.0, 1.0,
164 GridBagConstraints.CENTER, GridBagConstraints.BOTH,
165 new Insets(0, -60, 0, 80), 80, 60));
168 protected JTable table = new JTable();
170 protected JEditorPane fullDetails = new JEditorPane("text/html", "");
172 TitledBorder titledBorder1 = new TitledBorder(
173 MessageManager.getString("label.available_das_sources"));
175 protected JButton refresh = new JButton();
177 protected JProgressBar progressBar = new JProgressBar();
179 protected JScrollPane scrollPane = new JScrollPane();
181 TitledBorder titledBorder2 = new TitledBorder(
182 MessageManager.getString("label.full_details"));
184 protected JScrollPane fullDetailsScrollpane = new JScrollPane();
186 protected JList filter1 = new JList();
188 protected JList filter2 = new JList();
190 protected JList filter3 = new JList();
192 JScrollPane jScrollPane2 = new JScrollPane();
194 JScrollPane jScrollPane3 = new JScrollPane();
196 JScrollPane jScrollPane4 = new JScrollPane();
198 protected JTextField registryURL = new JTextField();
200 protected JLabel registryLabel = new JLabel();
202 protected JButton addLocal = new JButton();
204 JPanel jPanel1 = new JPanel();
206 FlowLayout flowLayout1 = new FlowLayout();
208 GridBagLayout gridBagLayout1 = new GridBagLayout();
210 TitledBorder titledBorder3 = new TitledBorder(
211 MessageManager.getString("label.authority") + ":");
213 TitledBorder titledBorder4 = new TitledBorder(
214 MessageManager.getString("label.type") + ":");
216 TitledBorder titledBorder5 = new TitledBorder(
217 MessageManager.getString("label.label") + ":");
219 JButton reset = new JButton();
221 JPanel jPanel2 = new JPanel();
223 BorderLayout borderLayout1 = new BorderLayout();
225 public void refresh_actionPerformed(ActionEvent e)
230 public void fullDetails_hyperlinkUpdate(HyperlinkEvent e)
235 if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED)
237 jalview.util.BrowserLauncher.openURL(e.getURL().toString());
239 } catch (Exception ex)
241 System.out.println(e.getURL());
242 ex.printStackTrace();
246 public void amendLocal(boolean newSource)
251 public void reset_actionPerformed(ActionEvent e)