/* * Jalview - A Sequence Alignment Editor and Viewer * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ package jalview.jbgui; import javax.swing.*; import javax.swing.border.TitledBorder; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import java.awt.*; import javax.swing.BorderFactory; import javax.swing.event.HyperlinkListener; import javax.swing.event.HyperlinkEvent; import java.awt.Dimension; public class GDasSourceBrowser extends JPanel { public GDasSourceBrowser() { try { jbInit(); } catch (Exception ex) { ex.printStackTrace(); } } private void jbInit() throws Exception { this.setLayout(gridBagLayout1); refresh.setText("Refresh Available Sources"); refresh.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { refresh_actionPerformed(e); } }); progressBar.setPreferredSize(new Dimension(450, 20)); progressBar.setString(""); scrollPane.setBorder(titledBorder1); scrollPane.setBorder(BorderFactory.createEtchedBorder()); fullDetailsScrollpane.setBorder(BorderFactory.createEtchedBorder()); fullDetails.addHyperlinkListener(new HyperlinkListener() { public void hyperlinkUpdate(HyperlinkEvent e) { fullDetails_hyperlinkUpdate(e); } }); fullDetails.setEditable(false); jLabel1.setText("

Show sources serving

"); jLabel2.setText("and"); jLabel3.setHorizontalAlignment(SwingConstants.RIGHT); jLabel3.setText("

using coordinates

"); registryLabel.setHorizontalAlignment(SwingConstants.TRAILING); registryLabel.setText("Use Registry"); addLocal.setText("Add Local Source"); addLocal.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { amendLocal(true); } }); jPanel1.setLayout(flowLayout1); jPanel1.setMinimumSize(new Dimension(596, 30)); jPanel1.setPreferredSize(new Dimension(596, 30)); scrollPane.getViewport().add(table); fullDetailsScrollpane.getViewport().add(fullDetails); jScrollPane3.getViewport().add(coords1); jScrollPane2.getViewport().add(capabilities); jScrollPane4.getViewport().add(coords2); jPanel1.add(refresh, null); jPanel1.add(addLocal, null); jPanel1.add(progressBar, null); this.add(registryLabel, new GridBagConstraints(0, 2, 2, 1, 0.0, 0.0 , GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(11, 2, 0, 0), 9, 2)); this.add(registryURL, new GridBagConstraints(2, 2, 5, 1, 1.0, 0.0 , GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(6, 7, 0, 10), 393, 3)); this.add(jLabel2, new GridBagConstraints(5, 1, 1, 1, 0.0, 0.0 , GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(36, 7, 35, 0), 5, 21)); this.add(jLabel3, new GridBagConstraints(3, 1, 1, 1, 0.0, 0.0 , GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(33, 0, 29, 0), 5, 16)); this.add(jLabel1, new GridBagConstraints(0, 1, 1, GridBagConstraints.REMAINDER, 0.0, 0.0 , GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets( -60, 2, 0, 0), 5, 20)); this.add(jPanel1, new GridBagConstraints(0, 3, 7, 1, 1.0, 1.0 , GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); this.add(fullDetailsScrollpane, new GridBagConstraints(3, 0, 4, 1, 1.0, 1.0 , GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(3, 0, 0, 3), 240, 130)); this.add(scrollPane, new GridBagConstraints(0, 0, 3, 1, 1.0, 1.0 , GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(3, 2, 0, 0), 150, 130)); this.add(jScrollPane3, new GridBagConstraints(4, 1, 1, 1, 1.0, 1.0 , GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(9, 0, 0, 0), 80, 0)); this.add(jScrollPane2, new GridBagConstraints(1, 1, 2, 1, 1.0, 1.0 , GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(9, 0, 0, 0), 80, 0)); this.add(jScrollPane4, new GridBagConstraints(6, 1, 1, 1, 1.0, 1.0 , GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(9, 0, 0, 9), 80, 0)); } protected JTable table = new JTable(); protected JEditorPane fullDetails = new JEditorPane("text/html", ""); TitledBorder titledBorder1 = new TitledBorder("Available DAS Sources"); protected JButton refresh = new JButton(); protected JProgressBar progressBar = new JProgressBar(); protected JScrollPane scrollPane = new JScrollPane(); TitledBorder titledBorder2 = new TitledBorder("Full Details"); protected JScrollPane fullDetailsScrollpane = new JScrollPane(); protected JList capabilities = new JList(); protected JList coords1 = new JList(); protected JList coords2 = new JList(); JLabel jLabel1 = new JLabel(); JLabel jLabel2 = new JLabel(); JLabel jLabel3 = new JLabel(); JScrollPane jScrollPane2 = new JScrollPane(); JScrollPane jScrollPane3 = new JScrollPane(); JScrollPane jScrollPane4 = new JScrollPane(); protected JTextField registryURL = new JTextField(); protected JLabel registryLabel = new JLabel(); protected JButton addLocal = new JButton(); JPanel jPanel1 = new JPanel(); FlowLayout flowLayout1 = new FlowLayout(); GridBagLayout gridBagLayout1 = new GridBagLayout(); public void refresh_actionPerformed(ActionEvent e) { } public void fullDetails_hyperlinkUpdate(HyperlinkEvent e) { try{ if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) jalview.util.BrowserLauncher.openURL(e.getURL().toString()); } catch(Exception ex) { System.out.println(e.getURL()); ex.printStackTrace(); } } public void amendLocal(boolean newSource) { } }