JAL-1503 update version in GPL header
[jalview.git] / src / jalview / jbgui / GDasSourceBrowser.java
1 /*
2  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.1)
3  * Copyright (C) 2014 The Jalview Authors
4  * 
5  * This file is part of Jalview.
6  * 
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 of the License, or (at your option) any later version.
10  *  
11  * Jalview is distributed in the hope that it will be useful, but 
12  * WITHOUT ANY WARRANTY; without even the implied warranty 
13  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
14  * PURPOSE.  See the GNU General Public License for more details.
15  * 
16  * You should have received a copy of the GNU General Public License along with Jalview.  If not, see <http://www.gnu.org/licenses/>.
17  * The Jalview Authors are detailed in the 'AUTHORS' file.
18  */
19 package jalview.jbgui;
20
21 import jalview.util.MessageManager;
22
23 import java.awt.*;
24 import java.awt.event.*;
25 import javax.swing.*;
26 import javax.swing.border.*;
27 import javax.swing.event.*;
28
29 public class GDasSourceBrowser extends JPanel
30 {
31   public GDasSourceBrowser()
32   {
33     try
34     {
35       jbInit();
36     } catch (Exception ex)
37     {
38       ex.printStackTrace();
39     }
40   }
41
42   private void jbInit() throws Exception
43   {
44     this.setLayout(gridBagLayout1);
45     refresh.setText(MessageManager.getString("label.refresh_available_sources"));
46     refresh.addActionListener(new ActionListener()
47     {
48       public void actionPerformed(ActionEvent e)
49       {
50         refresh_actionPerformed(e);
51       }
52     });
53     progressBar.setPreferredSize(new Dimension(450, 20));
54     progressBar.setString("");
55     scrollPane.setBorder(titledBorder1);
56     scrollPane.setBorder(BorderFactory.createEtchedBorder());
57     fullDetailsScrollpane.setBorder(BorderFactory.createEtchedBorder());
58     fullDetails.addHyperlinkListener(new HyperlinkListener()
59     {
60       public void hyperlinkUpdate(HyperlinkEvent e)
61       {
62         fullDetails_hyperlinkUpdate(e);
63       }
64     });
65     fullDetails.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
66     fullDetails.setEditable(false);
67     registryLabel.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
68     registryLabel.setHorizontalAlignment(SwingConstants.TRAILING);
69     registryLabel.setText(MessageManager.getString("label.use_registry"));
70     addLocal.setText(MessageManager.getString("label.add_local_source"));
71     addLocal.addActionListener(new ActionListener()
72     {
73       public void actionPerformed(ActionEvent e)
74       {
75         amendLocal(true);
76       }
77     });
78     jPanel1.setLayout(flowLayout1);
79     jPanel1.setMinimumSize(new Dimension(596, 30));
80     jPanel1.setPreferredSize(new Dimension(596, 30));
81     jScrollPane2.setBorder(titledBorder3);
82     jScrollPane3.setBorder(titledBorder4);
83     jScrollPane4.setBorder(titledBorder5);
84     titledBorder2
85             .setTitleFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
86     titledBorder3
87             .setTitleFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
88     titledBorder4
89             .setTitleFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
90     filter1.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
91     filter2.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
92     filter3.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
93     table.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
94     reset.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
95     reset.setMargin(new Insets(2, 2, 2, 2));
96     reset.setText(MessageManager.getString("action.reset"));
97     reset.addActionListener(new ActionListener()
98     {
99       public void actionPerformed(ActionEvent e)
100       {
101         reset_actionPerformed(e);
102       }
103     });
104     jPanel2.setLayout(borderLayout1);
105     borderLayout1.setHgap(5);
106     registryURL.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
107     scrollPane.getViewport().add(table);
108     fullDetailsScrollpane.getViewport().add(fullDetails);
109     jScrollPane3.getViewport().add(filter2);
110     jScrollPane4.getViewport().add(filter3);
111     jPanel1.add(refresh, null);
112     jPanel1.add(addLocal, null);
113     jPanel1.add(progressBar, null);
114     jScrollPane2.getViewport().add(filter1);
115     this.add(jPanel1, new GridBagConstraints(0, 3, 3, 1, 1.0, 1.0,
116             GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
117             new Insets(0, 0, 0, 0), 0, 0));
118     this.add(fullDetailsScrollpane, new GridBagConstraints(1, 0, 2, 1, 1.0,
119             1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH,
120             new Insets(3, 0, 0, 3), 240, 130));
121     this.add(scrollPane, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0,
122             GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(
123                     3, 2, 0, 0), 150, 130));
124     jPanel2.add(registryLabel, java.awt.BorderLayout.WEST);
125     jPanel2.add(registryURL, java.awt.BorderLayout.CENTER);
126     jPanel2.add(reset, java.awt.BorderLayout.EAST);
127     this.add(jPanel2, new GridBagConstraints(0, 2, 3, 1, 0.0, 0.0,
128             GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
129             new Insets(5, 10, 0, 10), 339, 0));
130     this.add(jScrollPane2, new GridBagConstraints(0, 1, 1, 1, 1.0, 1.0,
131             GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(
132                     0, 0, 0, 60), 80, 60));
133     this.add(jScrollPane4, new GridBagConstraints(2, 1, 1, 1, 1.0, 1.0,
134             GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(
135                     0, -80, 0, 0), 80, 60));
136     this.add(jScrollPane3, new GridBagConstraints(1, 1, 1, 1, 1.0, 1.0,
137             GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(
138                     0, -60, 0, 80), 80, 60));
139   }
140
141   protected JTable table = new JTable();
142
143   protected JEditorPane fullDetails = new JEditorPane("text/html", "");
144
145   TitledBorder titledBorder1 = new TitledBorder(MessageManager.getString("label.available_das_sources"));
146
147   protected JButton refresh = new JButton();
148
149   protected JProgressBar progressBar = new JProgressBar();
150
151   protected JScrollPane scrollPane = new JScrollPane();
152
153   TitledBorder titledBorder2 = new TitledBorder(MessageManager.getString("label.full_details"));
154
155   protected JScrollPane fullDetailsScrollpane = new JScrollPane();
156
157   protected JList filter1 = new JList();
158
159   protected JList filter2 = new JList();
160
161   protected JList filter3 = new JList();
162
163   JScrollPane jScrollPane2 = new JScrollPane();
164
165   JScrollPane jScrollPane3 = new JScrollPane();
166
167   JScrollPane jScrollPane4 = new JScrollPane();
168
169   protected JTextField registryURL = new JTextField();
170
171   protected JLabel registryLabel = new JLabel();
172
173   protected JButton addLocal = new JButton();
174
175   JPanel jPanel1 = new JPanel();
176
177   FlowLayout flowLayout1 = new FlowLayout();
178
179   GridBagLayout gridBagLayout1 = new GridBagLayout();
180
181   TitledBorder titledBorder3 = new TitledBorder(MessageManager.getString("label.authority") + ":");
182
183   TitledBorder titledBorder4 = new TitledBorder(MessageManager.getString("label.type") + ":");
184
185   TitledBorder titledBorder5 = new TitledBorder(MessageManager.getString("label.label") + ":");
186
187   JButton reset = new JButton();
188
189   JPanel jPanel2 = new JPanel();
190
191   BorderLayout borderLayout1 = new BorderLayout();
192
193   public void refresh_actionPerformed(ActionEvent e)
194   {
195
196   }
197
198   public void fullDetails_hyperlinkUpdate(HyperlinkEvent e)
199   {
200     try
201     {
202
203       if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED)
204       {
205         jalview.util.BrowserLauncher.openURL(e.getURL().toString());
206       }
207     } catch (Exception ex)
208     {
209       System.out.println(e.getURL());
210       ex.printStackTrace();
211     }
212   }
213
214   public void amendLocal(boolean newSource)
215   {
216
217   }
218
219   public void reset_actionPerformed(ActionEvent e)
220   {
221
222   }
223
224 }