JAL-1432 updated copyright notices
[jalview.git] / src / jalview / jbgui / GDasSourceBrowser.java
1 /*
2  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.0b1)
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 java.awt.*;
22 import java.awt.event.*;
23 import javax.swing.*;
24 import javax.swing.border.*;
25 import javax.swing.event.*;
26
27 public class GDasSourceBrowser extends JPanel
28 {
29   public GDasSourceBrowser()
30   {
31     try
32     {
33       jbInit();
34     } catch (Exception ex)
35     {
36       ex.printStackTrace();
37     }
38   }
39
40   private void jbInit() throws Exception
41   {
42     this.setLayout(gridBagLayout1);
43     refresh.setText("Refresh Available Sources");
44     refresh.addActionListener(new ActionListener()
45     {
46       public void actionPerformed(ActionEvent e)
47       {
48         refresh_actionPerformed(e);
49       }
50     });
51     progressBar.setPreferredSize(new Dimension(450, 20));
52     progressBar.setString("");
53     scrollPane.setBorder(titledBorder1);
54     scrollPane.setBorder(BorderFactory.createEtchedBorder());
55     fullDetailsScrollpane.setBorder(BorderFactory.createEtchedBorder());
56     fullDetails.addHyperlinkListener(new HyperlinkListener()
57     {
58       public void hyperlinkUpdate(HyperlinkEvent e)
59       {
60         fullDetails_hyperlinkUpdate(e);
61       }
62     });
63     fullDetails.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
64     fullDetails.setEditable(false);
65     registryLabel.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
66     registryLabel.setHorizontalAlignment(SwingConstants.TRAILING);
67     registryLabel.setText("Use Registry");
68     addLocal.setText("Add Local Source");
69     addLocal.addActionListener(new ActionListener()
70     {
71       public void actionPerformed(ActionEvent e)
72       {
73         amendLocal(true);
74       }
75     });
76     jPanel1.setLayout(flowLayout1);
77     jPanel1.setMinimumSize(new Dimension(596, 30));
78     jPanel1.setPreferredSize(new Dimension(596, 30));
79     jScrollPane2.setBorder(titledBorder3);
80     jScrollPane3.setBorder(titledBorder4);
81     jScrollPane4.setBorder(titledBorder5);
82     titledBorder2
83             .setTitleFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
84     titledBorder3
85             .setTitleFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
86     titledBorder4
87             .setTitleFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
88     filter1.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
89     filter2.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
90     filter3.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
91     table.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
92     reset.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
93     reset.setMargin(new Insets(2, 2, 2, 2));
94     reset.setText("Reset");
95     reset.addActionListener(new ActionListener()
96     {
97       public void actionPerformed(ActionEvent e)
98       {
99         reset_actionPerformed(e);
100       }
101     });
102     jPanel2.setLayout(borderLayout1);
103     borderLayout1.setHgap(5);
104     registryURL.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
105     scrollPane.getViewport().add(table);
106     fullDetailsScrollpane.getViewport().add(fullDetails);
107     jScrollPane3.getViewport().add(filter2);
108     jScrollPane4.getViewport().add(filter3);
109     jPanel1.add(refresh, null);
110     jPanel1.add(addLocal, null);
111     jPanel1.add(progressBar, null);
112     jScrollPane2.getViewport().add(filter1);
113     this.add(jPanel1, new GridBagConstraints(0, 3, 3, 1, 1.0, 1.0,
114             GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
115             new Insets(0, 0, 0, 0), 0, 0));
116     this.add(fullDetailsScrollpane, new GridBagConstraints(1, 0, 2, 1, 1.0,
117             1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH,
118             new Insets(3, 0, 0, 3), 240, 130));
119     this.add(scrollPane, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0,
120             GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(
121                     3, 2, 0, 0), 150, 130));
122     jPanel2.add(registryLabel, java.awt.BorderLayout.WEST);
123     jPanel2.add(registryURL, java.awt.BorderLayout.CENTER);
124     jPanel2.add(reset, java.awt.BorderLayout.EAST);
125     this.add(jPanel2, new GridBagConstraints(0, 2, 3, 1, 0.0, 0.0,
126             GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
127             new Insets(5, 10, 0, 10), 339, 0));
128     this.add(jScrollPane2, new GridBagConstraints(0, 1, 1, 1, 1.0, 1.0,
129             GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(
130                     0, 0, 0, 60), 80, 60));
131     this.add(jScrollPane4, new GridBagConstraints(2, 1, 1, 1, 1.0, 1.0,
132             GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(
133                     0, -80, 0, 0), 80, 60));
134     this.add(jScrollPane3, new GridBagConstraints(1, 1, 1, 1, 1.0, 1.0,
135             GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(
136                     0, -60, 0, 80), 80, 60));
137   }
138
139   protected JTable table = new JTable();
140
141   protected JEditorPane fullDetails = new JEditorPane("text/html", "");
142
143   TitledBorder titledBorder1 = new TitledBorder("Available DAS Sources");
144
145   protected JButton refresh = new JButton();
146
147   protected JProgressBar progressBar = new JProgressBar();
148
149   protected JScrollPane scrollPane = new JScrollPane();
150
151   TitledBorder titledBorder2 = new TitledBorder("Full Details");
152
153   protected JScrollPane fullDetailsScrollpane = new JScrollPane();
154
155   protected JList filter1 = new JList();
156
157   protected JList filter2 = new JList();
158
159   protected JList filter3 = new JList();
160
161   JScrollPane jScrollPane2 = new JScrollPane();
162
163   JScrollPane jScrollPane3 = new JScrollPane();
164
165   JScrollPane jScrollPane4 = new JScrollPane();
166
167   protected JTextField registryURL = new JTextField();
168
169   protected JLabel registryLabel = new JLabel();
170
171   protected JButton addLocal = new JButton();
172
173   JPanel jPanel1 = new JPanel();
174
175   FlowLayout flowLayout1 = new FlowLayout();
176
177   GridBagLayout gridBagLayout1 = new GridBagLayout();
178
179   TitledBorder titledBorder3 = new TitledBorder("Authority:");
180
181   TitledBorder titledBorder4 = new TitledBorder("Type:");
182
183   TitledBorder titledBorder5 = new TitledBorder("Label:");
184
185   JButton reset = new JButton();
186
187   JPanel jPanel2 = new JPanel();
188
189   BorderLayout borderLayout1 = new BorderLayout();
190
191   public void refresh_actionPerformed(ActionEvent e)
192   {
193
194   }
195
196   public void fullDetails_hyperlinkUpdate(HyperlinkEvent e)
197   {
198     try
199     {
200
201       if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED)
202       {
203         jalview.util.BrowserLauncher.openURL(e.getURL().toString());
204       }
205     } catch (Exception ex)
206     {
207       System.out.println(e.getURL());
208       ex.printStackTrace();
209     }
210   }
211
212   public void amendLocal(boolean newSource)
213   {
214
215   }
216
217   public void reset_actionPerformed(ActionEvent e)
218   {
219
220   }
221
222 }