2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.6)
3 * Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
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 of the License, or (at your option) any later version.
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.
16 * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
18 package jalview.jbgui;
20 import java.awt.BorderLayout;
21 import java.awt.Dimension;
22 import java.awt.FlowLayout;
24 import java.awt.GridBagLayout;
25 import java.awt.GridLayout;
26 import java.awt.event.ActionEvent;
27 import java.awt.event.ActionListener;
28 import java.awt.event.MouseEvent;
29 import java.awt.event.MouseListener;
31 import javax.swing.BorderFactory;
32 import javax.swing.JButton;
33 import javax.swing.JCheckBox;
34 import javax.swing.JList;
35 import javax.swing.JPanel;
36 import javax.swing.JProgressBar;
37 import javax.swing.JScrollPane;
38 import javax.swing.ListSelectionModel;
39 import javax.swing.SwingConstants;
40 import javax.swing.border.TitledBorder;
43 * Preference dialog for jalview web services
47 public class GWsPreferences extends JPanel
49 protected JList wsList = new JList();
51 protected TitledBorder wsListTitleBorder = new TitledBorder(
52 "Web Service Discovery URLS");
54 protected JButton newWsUrl = new JButton();
56 protected JButton editWsUrl = new JButton();
58 protected JButton deleteWsUrl = new JButton();
60 protected JButton moveWsUrlUp = new JButton();
62 protected JButton moveWsUrlDown = new JButton();
64 protected JCheckBox indexByHost = new JCheckBox();
66 protected JCheckBox indexByType = new JCheckBox();
68 protected JCheckBox enableJws1Services = new JCheckBox();
70 protected JCheckBox enableJws2Services = new JCheckBox();
72 protected JCheckBox enableEnfinServices = new JCheckBox();
74 protected JCheckBox displayWsWarning = new JCheckBox();
76 protected JButton refreshWs = new JButton();
78 protected JButton resetWs = new JButton();
80 protected JProgressBar progressBar = new JProgressBar();
82 JScrollPane wsListPane = new JScrollPane();
84 JPanel wsListUrlPanel = new JPanel();
86 JPanel wsListPanel = new JPanel();
88 JPanel wsListButtons = new JPanel();
90 JPanel wsListNavButs = new JPanel();
92 BorderLayout myBorderlayout = new BorderLayout();
94 BorderLayout wsListBorderlayout = new BorderLayout();
96 GridBagLayout wsPrefLayout = new GridBagLayout();
98 GridBagLayout wsListLayout = new GridBagLayout();
100 GridBagLayout wsMenuLayout = new GridBagLayout();
102 JPanel wsMenuButtons = new JPanel();
104 JPanel wsMenuRefreshButs = new JPanel();
106 public GWsPreferences()
111 private void jbInit()
114 refreshWs.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
115 refreshWs.setText("Refresh Services");
116 refreshWs.addActionListener(new ActionListener()
118 public void actionPerformed(ActionEvent e)
120 refreshWs_actionPerformed(e);
123 resetWs.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
124 resetWs.setText("Reset Services");
126 resetWs.addActionListener(new ActionListener()
128 public void actionPerformed(ActionEvent e)
130 resetWs_actionPerformed(e);
133 indexByHost.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
134 indexByHost.setText("Index by host");
136 .setToolTipText("Index web services in menu by the host site.");
137 indexByHost.addActionListener(new ActionListener()
139 public void actionPerformed(ActionEvent e)
141 indexByHost_actionPerformed(e);
144 indexByType.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
145 indexByType.setText("Index by type");
146 indexByType.addActionListener(new ActionListener()
148 public void actionPerformed(ActionEvent e)
150 indexByType_actionPerformed(e);
154 .setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
155 enableEnfinServices.setText("Enable Enfin Services");
156 enableEnfinServices.addActionListener(new ActionListener()
158 public void actionPerformed(ActionEvent e)
160 enableEnfinServices_actionPerformed(e);
164 .setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
165 enableJws2Services.setText("Enable JABAWS Services");
166 enableJws2Services.addActionListener(new ActionListener()
168 public void actionPerformed(ActionEvent e)
170 enableJws2Services_actionPerformed(e);
174 .setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
175 enableJws1Services.setText("Enable Legacy Services");
176 enableJws1Services.addActionListener(new ActionListener()
178 public void actionPerformed(ActionEvent e)
180 enableJws1Services_actionPerformed(e);
183 displayWsWarning.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
184 displayWsWarning.setText("Display warnings");
186 .setToolTipText("<html>Check this option if you want to be informed<br>when a web service URL cannot be accessed by Jalview<br>when it starts up");
187 displayWsWarning.addActionListener(new ActionListener()
189 public void actionPerformed(ActionEvent e)
191 displayWsWarning_actionPerformed(e);
194 newWsUrl.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
195 newWsUrl.setText("New Service URL");
196 newWsUrl.addActionListener(new ActionListener()
198 public void actionPerformed(ActionEvent e)
200 newWsUrl_actionPerformed(e);
203 editWsUrl.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
204 editWsUrl.setText("Edit Service URL");
205 editWsUrl.addActionListener(new ActionListener()
207 public void actionPerformed(ActionEvent e)
209 editWsUrl_actionPerformed(e);
213 deleteWsUrl.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
214 deleteWsUrl.setText("Delete Service URL");
215 deleteWsUrl.addActionListener(new ActionListener()
217 public void actionPerformed(ActionEvent e)
219 deleteWsUrl_actionPerformed(e);
222 moveWsUrlUp.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
223 moveWsUrlUp.setText("Up");
224 moveWsUrlUp.setToolTipText("Move URL up");
225 moveWsUrlUp.addActionListener(new ActionListener()
227 public void actionPerformed(ActionEvent e)
229 moveWsUrlUp_actionPerformed(e);
232 moveWsUrlDown.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
233 moveWsUrlDown.setText("Down");
234 moveWsUrlDown.setToolTipText("Move URL Down");
235 moveWsUrlDown.addActionListener(new ActionListener()
237 public void actionPerformed(ActionEvent e)
239 moveWsUrlDown_actionPerformed(e);
243 setLayout(myBorderlayout);
244 setPreferredSize(new Dimension(500, 400));
245 progressBar.setPreferredSize(new Dimension(450, 20));
246 progressBar.setString("");
247 wsListUrlPanel.setBorder(BorderFactory.createEtchedBorder());
248 wsListUrlPanel.setLayout(new BorderLayout());
249 // wsListUrlPanel.setPreferredSize(new Dimension(482,202));
250 wsListPane.setBorder(BorderFactory.createEtchedBorder());
251 wsListPane.getViewport().add(wsList);
252 wsListPane.setPreferredSize(new Dimension(380, 200));
253 wsList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
254 wsList.addMouseListener(new MouseListener()
257 public void mouseClicked(MouseEvent e)
259 if (e.getClickCount() > 1)
261 editWsUrl_actionPerformed(null);
266 public void mouseEntered(MouseEvent e)
271 public void mouseExited(MouseEvent e)
275 public void mousePressed(MouseEvent e)
280 public void mouseReleased(MouseEvent e)
286 // wsListButtons.setPreferredSize(new Dimension(480, 60));
287 wsListButtons.setLayout(new FlowLayout());
288 // wsListButtons.add(moveWsUrlUp);
289 // wsListButtons.add(moveWsUrlDown);
290 wsListButtons.add(newWsUrl);
291 wsListButtons.add(editWsUrl);
292 wsListButtons.add(deleteWsUrl);
293 wsListNavButs.setSize(new Dimension(80, 80));
294 wsListNavButs.setPreferredSize(new Dimension(80, 80));
295 wsListNavButs.setLayout(new FlowLayout());
296 wsListNavButs.add(moveWsUrlUp);
297 wsListNavButs.add(moveWsUrlDown);
298 wsListUrlPanel.add(wsListPane, BorderLayout.EAST);
299 wsListUrlPanel.add(wsListNavButs, BorderLayout.WEST);
300 wsListPanel.setBorder(wsListTitleBorder);
301 wsListPanel.setLayout(new BorderLayout());
302 wsListPanel.add(wsListUrlPanel, BorderLayout.NORTH);
303 wsListPanel.add(wsListButtons, BorderLayout.SOUTH);
304 wsMenuButtons.setLayout(new GridLayout(2, 3));
305 wsMenuButtons.add(indexByHost);
306 wsMenuButtons.add(indexByType);
307 wsMenuButtons.add(enableJws1Services);
308 wsMenuButtons.add(enableJws2Services);
309 wsMenuButtons.add(enableEnfinServices);
310 wsMenuButtons.add(displayWsWarning);
311 wsMenuRefreshButs.setLayout(new FlowLayout());
312 wsMenuRefreshButs.setPreferredSize(new Dimension(480, 30));
313 wsMenuRefreshButs.setSize(new Dimension(480, 30));
314 wsMenuRefreshButs.add(refreshWs, null);
315 wsMenuRefreshButs.add(resetWs, null);
316 wsMenuRefreshButs.add(progressBar, null);
317 myBorderlayout.setHgap(3);
318 add(wsListPanel, BorderLayout.NORTH);
319 add(wsMenuButtons, BorderLayout.CENTER);
320 add(wsMenuRefreshButs, BorderLayout.SOUTH);
323 protected void displayWsWarning_actionPerformed(ActionEvent e)
325 // TODO Auto-generated method stub
329 protected void resetWs_actionPerformed(ActionEvent e)
334 protected void indexByType_actionPerformed(ActionEvent e)
339 protected void indexByHost_actionPerformed(ActionEvent e)
344 protected void newWsUrl_actionPerformed(ActionEvent e)
349 protected void editWsUrl_actionPerformed(ActionEvent e)
354 protected void deleteWsUrl_actionPerformed(ActionEvent e)
359 protected void moveWsUrlUp_actionPerformed(ActionEvent e)
364 protected void moveWsUrlDown_actionPerformed(ActionEvent e)
369 protected void enableEnfinServices_actionPerformed(ActionEvent e)
374 protected void enableJws2Services_actionPerformed(ActionEvent e)
379 protected void enableJws1Services_actionPerformed(ActionEvent e)
384 protected void refreshWs_actionPerformed(ActionEvent e)