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);
66 refresh.setText(MessageManager
67 .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, new GridBagConstraints(1, 0, 2, 1, 1.0,
141 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH,
142 new Insets(3, 0, 0, 3), 240, 130));
143 this.add(scrollPane, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0,
144 GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(
145 3, 2, 0, 0), 150, 130));
146 jPanel2.add(registryLabel, java.awt.BorderLayout.WEST);
147 jPanel2.add(registryURL, java.awt.BorderLayout.CENTER);
148 jPanel2.add(reset, java.awt.BorderLayout.EAST);
149 this.add(jPanel2, new GridBagConstraints(0, 2, 3, 1, 0.0, 0.0,
150 GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
151 new Insets(5, 10, 0, 10), 339, 0));
152 this.add(jScrollPane2, new GridBagConstraints(0, 1, 1, 1, 1.0, 1.0,
153 GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(
154 0, 0, 0, 60), 80, 60));
155 this.add(jScrollPane4, new GridBagConstraints(2, 1, 1, 1, 1.0, 1.0,
156 GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(
157 0, -80, 0, 0), 80, 60));
158 this.add(jScrollPane3, new GridBagConstraints(1, 1, 1, 1, 1.0, 1.0,
159 GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(
160 0, -60, 0, 80), 80, 60));
163 protected JTable table = new JTable();
165 protected JEditorPane fullDetails = new JEditorPane("text/html", "");
167 TitledBorder titledBorder1 = new TitledBorder(
168 MessageManager.getString("label.available_das_sources"));
170 protected JButton refresh = new JButton();
172 protected JProgressBar progressBar = new JProgressBar();
174 protected JScrollPane scrollPane = new JScrollPane();
176 TitledBorder titledBorder2 = new TitledBorder(
177 MessageManager.getString("label.full_details"));
179 protected JScrollPane fullDetailsScrollpane = new JScrollPane();
181 protected JList filter1 = new JList();
183 protected JList filter2 = new JList();
185 protected JList filter3 = new JList();
187 JScrollPane jScrollPane2 = new JScrollPane();
189 JScrollPane jScrollPane3 = new JScrollPane();
191 JScrollPane jScrollPane4 = new JScrollPane();
193 protected JTextField registryURL = new JTextField();
195 protected JLabel registryLabel = new JLabel();
197 protected JButton addLocal = new JButton();
199 JPanel jPanel1 = new JPanel();
201 FlowLayout flowLayout1 = new FlowLayout();
203 GridBagLayout gridBagLayout1 = new GridBagLayout();
205 TitledBorder titledBorder3 = new TitledBorder(
206 MessageManager.getString("label.authority") + ":");
208 TitledBorder titledBorder4 = new TitledBorder(
209 MessageManager.getString("label.type") + ":");
211 TitledBorder titledBorder5 = new TitledBorder(
212 MessageManager.getString("label.label") + ":");
214 JButton reset = new JButton();
216 JPanel jPanel2 = new JPanel();
218 BorderLayout borderLayout1 = new BorderLayout();
220 public void refresh_actionPerformed(ActionEvent e)
225 public void fullDetails_hyperlinkUpdate(HyperlinkEvent e)
230 if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED)
232 jalview.util.BrowserLauncher.openURL(e.getURL().toString());
234 } catch (Exception ex)
236 System.out.println(e.getURL());
237 ex.printStackTrace();
241 public void amendLocal(boolean newSource)
246 public void reset_actionPerformed(ActionEvent e)