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.bin.Cache;
24 import jalview.util.MessageManager;
26 import java.awt.BorderLayout;
27 import java.awt.Dimension;
28 import java.awt.FlowLayout;
30 import java.awt.GridBagLayout;
31 import java.awt.GridLayout;
32 import java.awt.event.ActionEvent;
33 import java.awt.event.ActionListener;
34 import java.awt.event.MouseEvent;
35 import java.awt.event.MouseListener;
37 import javax.swing.BorderFactory;
38 import javax.swing.JButton;
39 import javax.swing.JCheckBox;
40 import javax.swing.JList;
41 import javax.swing.JPanel;
42 import javax.swing.JProgressBar;
43 import javax.swing.JScrollPane;
44 import javax.swing.JTabbedPane;
45 import javax.swing.JTable;
46 import javax.swing.ListSelectionModel;
47 import javax.swing.border.TitledBorder;
50 * Preference dialog for jalview web services
54 public class GWsPreferences extends JPanel
56 protected JList sbrsList = new JList();
58 protected TitledBorder sbrsListTitleBorder = new TitledBorder(
60 .getString("label.simple_bioinformatics_rest_services"));
62 protected JButton newSbrsUrl = new JButton();
64 protected JButton editSbrsUrl = new JButton();
66 protected JButton deleteSbrsUrl = new JButton();
68 // Web service status and url table
69 protected JTable wsList = new JTable();
71 protected TitledBorder wsListTitleBorder = new TitledBorder(
72 MessageManager.getString("label.web_service_discovery_urls"));
74 protected JButton newWsUrl = new JButton();
76 protected JButton editWsUrl = new JButton();
78 protected JButton deleteWsUrl = new JButton();
80 protected JButton moveWsUrlUp = new JButton();
82 protected JButton moveWsUrlDown = new JButton();
84 protected JCheckBox indexByHost = new JCheckBox();
86 protected JCheckBox indexByType = new JCheckBox();
88 protected JCheckBox enableJws2Services = new JCheckBox();
90 protected JCheckBox enableEnfinServices = new JCheckBox();
92 protected JCheckBox displayWsWarning = new JCheckBox();
94 protected JButton refreshWs = new JButton();
96 protected JButton resetWs = new JButton();
98 protected JProgressBar progressBar = new JProgressBar();
100 JScrollPane wsListPane = new JScrollPane();
102 JPanel wsListUrlPanel = new JPanel();
104 JPanel wsListPanel = new JPanel();
106 JPanel wsListButtons = new JPanel();
108 JPanel wsListNavButs = new JPanel();
110 JScrollPane srbsListPane = new JScrollPane();
112 JPanel srbsListUrlPanel = new JPanel();
114 JPanel srbsListPanel = new JPanel();
116 JPanel srbsListButtons = new JPanel();
118 JPanel srbsListNavButs = new JPanel();
120 BorderLayout myBorderlayout = new BorderLayout();
122 BorderLayout wsListBorderlayout = new BorderLayout();
124 BorderLayout srbsListBorderlayout = new BorderLayout();
126 GridBagLayout wsPrefLayout = new GridBagLayout();
128 GridBagLayout wsListLayout = new GridBagLayout();
130 GridBagLayout srbsListLayout = new GridBagLayout();
132 GridBagLayout wsMenuLayout = new GridBagLayout();
134 JPanel wsMenuButtons = new JPanel();
136 JPanel wsMenuRefreshButs = new JPanel();
138 public GWsPreferences()
143 private void jbInit()
146 refreshWs.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
147 refreshWs.setText(MessageManager.getString("action.refresh_services"));
148 refreshWs.addActionListener(new ActionListener()
151 public void actionPerformed(ActionEvent e)
153 refreshWs_actionPerformed(e);
156 resetWs.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
157 resetWs.setText(MessageManager.getString("action.reset_services"));
159 resetWs.addActionListener(new ActionListener()
162 public void actionPerformed(ActionEvent e)
164 resetWs_actionPerformed(e);
167 indexByHost.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
168 indexByHost.setText(MessageManager.getString("label.index_by_host"));
169 indexByHost.setToolTipText(MessageManager
170 .getString("label.index_web_services_menu_by_host_site"));
171 indexByHost.addActionListener(new ActionListener()
174 public void actionPerformed(ActionEvent e)
176 indexByHost_actionPerformed(e);
179 indexByType.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
180 indexByType.setText(MessageManager.getString("label.index_by_type"));
181 indexByType.addActionListener(new ActionListener()
184 public void actionPerformed(ActionEvent e)
186 indexByType_actionPerformed(e);
190 .setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
191 enableJws2Services.setText(
192 MessageManager.getString("label.enable_jabaws_services"));
193 enableJws2Services.addActionListener(new ActionListener()
196 public void actionPerformed(ActionEvent e)
198 enableJws2Services_actionPerformed(e);
201 displayWsWarning.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
203 .setText(MessageManager.getString("label.display_warnings"));
204 displayWsWarning.setToolTipText("<html>" + MessageManager.getString(
205 "label.option_want_informed_web_service_URL_cannot_be_accessed_jalview_when_starts_up"));
206 displayWsWarning.addActionListener(new ActionListener()
209 public void actionPerformed(ActionEvent e)
211 displayWsWarning_actionPerformed(e);
214 newWsUrl.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
215 newWsUrl.setText(MessageManager.getString("label.new_service_url"));
216 newWsUrl.addActionListener(new ActionListener()
219 public void actionPerformed(ActionEvent e)
221 newWsUrl_actionPerformed(e);
224 editWsUrl.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
225 editWsUrl.setText(MessageManager.getString("label.edit_service_url"));
226 editWsUrl.addActionListener(new ActionListener()
229 public void actionPerformed(ActionEvent e)
231 editWsUrl_actionPerformed(e);
235 deleteWsUrl.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
237 .setText(MessageManager.getString("label.delete_service_url"));
238 deleteWsUrl.addActionListener(new ActionListener()
241 public void actionPerformed(ActionEvent e)
243 deleteWsUrl_actionPerformed(e);
246 moveWsUrlUp.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
247 moveWsUrlUp.setText(MessageManager.getString("action.move_up"));
249 .setToolTipText(MessageManager.getString("label.move_url_up"));
250 moveWsUrlUp.addActionListener(new ActionListener()
253 public void actionPerformed(ActionEvent e)
255 moveWsUrlUp_actionPerformed(e);
258 moveWsUrlDown.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
259 moveWsUrlDown.setText(MessageManager.getString("action.move_down"));
260 moveWsUrlDown.setToolTipText(
261 MessageManager.getString("label.move_url_down"));
262 moveWsUrlDown.addActionListener(new ActionListener()
265 public void actionPerformed(ActionEvent e)
267 moveWsUrlDown_actionPerformed(e);
270 newSbrsUrl.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
272 .setText(MessageManager.getString("label.add_sbrs_definition"));
273 newSbrsUrl.addActionListener(new ActionListener()
276 public void actionPerformed(ActionEvent e)
278 newSbrsUrl_actionPerformed(e);
281 editSbrsUrl.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
283 MessageManager.getString("label.edit_sbrs_definition"));
284 editSbrsUrl.addActionListener(new ActionListener()
287 public void actionPerformed(ActionEvent e)
289 editSbrsUrl_actionPerformed(e);
293 deleteSbrsUrl.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
294 deleteSbrsUrl.setText(
295 MessageManager.getString("label.delete_sbrs_definition"));
296 deleteSbrsUrl.addActionListener(new ActionListener()
299 public void actionPerformed(ActionEvent e)
301 deleteSbrsUrl_actionPerformed(e);
305 setLayout(myBorderlayout);
306 setPreferredSize(new Dimension(500, 400));
307 progressBar.setPreferredSize(new Dimension(450, 20));
308 progressBar.setString("");
309 wsListUrlPanel.setBorder(BorderFactory.createEtchedBorder());
310 wsListUrlPanel.setLayout(new BorderLayout());
311 wsListPane.setBorder(BorderFactory.createEtchedBorder());
312 wsList.setPreferredSize(new Dimension(482, 202));
313 wsList.getTableHeader().setReorderingAllowed(false);
314 wsListPane.getViewport().add(wsList);
315 wsListPane.setPreferredSize(new Dimension(380, 80));
316 wsList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
317 wsList.setColumnSelectionAllowed(false);
318 wsList.addMouseListener(new MouseListener()
322 public void mouseClicked(MouseEvent e)
324 if (e.getClickCount() > 1)
326 editWsUrl_actionPerformed(null);
332 public void mouseEntered(MouseEvent e)
338 public void mouseExited(MouseEvent e)
343 public void mousePressed(MouseEvent e)
349 public void mouseReleased(MouseEvent e)
355 wsListButtons.setLayout(new FlowLayout());
356 wsListButtons.add(newWsUrl);
357 wsListButtons.add(editWsUrl);
358 wsListButtons.add(deleteWsUrl);
359 wsListButtons.setMinimumSize(new Dimension(350, 80));
360 wsListNavButs.setSize(new Dimension(80, 80));
361 wsListNavButs.setPreferredSize(new Dimension(80, 80));
362 wsListNavButs.setLayout(new FlowLayout());
363 wsListNavButs.add(moveWsUrlUp);
364 wsListNavButs.add(moveWsUrlDown);
365 wsListUrlPanel.add(wsListPane, BorderLayout.CENTER);
366 wsListUrlPanel.add(wsListNavButs, BorderLayout.WEST);
367 wsListPanel.setBorder(wsListTitleBorder);
368 wsListPanel.setLayout(new BorderLayout());
369 wsListPanel.add(wsListUrlPanel, BorderLayout.NORTH);
370 wsListPanel.add(wsListButtons, BorderLayout.SOUTH);
372 srbsListUrlPanel.setBorder(BorderFactory.createEtchedBorder());
373 srbsListUrlPanel.setLayout(new BorderLayout());
374 srbsListPane.setBorder(BorderFactory.createEtchedBorder());
375 srbsListPane.getViewport().add(sbrsList);
376 sbrsList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
377 sbrsList.addMouseListener(new MouseListener()
381 public void mouseClicked(MouseEvent e)
383 if (e.getClickCount() > 1)
385 editSbrsUrl_actionPerformed(null);
391 public void mouseEntered(MouseEvent e)
397 public void mouseExited(MouseEvent e)
402 public void mousePressed(MouseEvent e)
408 public void mouseReleased(MouseEvent e)
414 srbsListButtons.setLayout(new FlowLayout());
415 srbsListButtons.add(newSbrsUrl);
416 srbsListButtons.add(editSbrsUrl);
417 srbsListButtons.add(deleteSbrsUrl);
418 srbsListUrlPanel.add(srbsListPane, BorderLayout.CENTER);
419 srbsListPanel.setBorder(sbrsListTitleBorder);
420 srbsListPanel.setLayout(new BorderLayout());
421 srbsListPanel.add(srbsListUrlPanel, BorderLayout.NORTH);
422 srbsListPanel.add(srbsListButtons, BorderLayout.CENTER);
424 wsMenuButtons.setLayout(new GridLayout(2, 3));
425 wsMenuButtons.add(indexByHost);
426 wsMenuButtons.add(indexByType);
427 wsMenuButtons.add(enableJws2Services);
428 wsMenuButtons.add(displayWsWarning);
429 wsMenuRefreshButs.setLayout(new FlowLayout());
430 wsMenuRefreshButs.setPreferredSize(new Dimension(480, 30));
431 wsMenuRefreshButs.setSize(new Dimension(480, 30));
432 wsMenuRefreshButs.add(refreshWs, null);
433 wsMenuRefreshButs.add(resetWs, null);
434 wsMenuRefreshButs.add(progressBar, null);
435 myBorderlayout.setHgap(3);
436 if (Cache.getDefault("ENABLE_RSBS_EDITOR", false))
438 JTabbedPane listPanels = new JTabbedPane();
439 listPanels.addTab("JABAWS Servers", wsListPanel);
440 listPanels.addTab("RSB Services", srbsListPanel);
441 add(listPanels, BorderLayout.NORTH);
445 add(wsListPanel, BorderLayout.NORTH);
447 add(wsMenuButtons, BorderLayout.CENTER);
448 add(wsMenuRefreshButs, BorderLayout.SOUTH);
451 protected void deleteSbrsUrl_actionPerformed(ActionEvent e)
453 // TODO Auto-generated method stub
457 protected void editSbrsUrl_actionPerformed(ActionEvent e)
459 // TODO Auto-generated method stub
463 protected void newSbrsUrl_actionPerformed(ActionEvent e)
465 // TODO Auto-generated method stub
469 protected void displayWsWarning_actionPerformed(ActionEvent e)
471 // TODO Auto-generated method stub
475 protected void resetWs_actionPerformed(ActionEvent e)
480 protected void indexByType_actionPerformed(ActionEvent e)
485 protected void indexByHost_actionPerformed(ActionEvent e)
490 protected void newWsUrl_actionPerformed(ActionEvent e)
495 protected void editWsUrl_actionPerformed(ActionEvent e)
500 protected void deleteWsUrl_actionPerformed(ActionEvent e)
505 protected void moveWsUrlUp_actionPerformed(ActionEvent e)
510 protected void moveWsUrlDown_actionPerformed(ActionEvent e)
515 protected void enableEnfinServices_actionPerformed(ActionEvent e)
520 protected void enableJws2Services_actionPerformed(ActionEvent e)
525 protected void refreshWs_actionPerformed(ActionEvent e)