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.util.MessageManager;
25 import java.awt.BorderLayout;
26 import java.awt.Dimension;
27 import java.awt.FlowLayout;
29 import java.awt.GridBagLayout;
30 import java.awt.GridLayout;
31 import java.awt.event.ActionEvent;
32 import java.awt.event.ActionListener;
33 import java.awt.event.MouseEvent;
34 import java.awt.event.MouseListener;
36 import javax.swing.BorderFactory;
37 import javax.swing.JButton;
38 import javax.swing.JCheckBox;
39 import javax.swing.JList;
40 import javax.swing.JPanel;
41 import javax.swing.JProgressBar;
42 import javax.swing.JScrollPane;
43 import javax.swing.JTabbedPane;
44 import javax.swing.JTable;
45 import javax.swing.ListSelectionModel;
46 import javax.swing.border.TitledBorder;
49 * Preference dialog for jalview web services
53 public class GWsPreferences extends JPanel
55 protected JList sbrsList = new JList();
57 protected TitledBorder sbrsListTitleBorder = new TitledBorder(
59 .getString("label.simple_bioinformatics_rest_services"));
61 protected JButton newSbrsUrl = new JButton();
63 protected JButton editSbrsUrl = new JButton();
65 protected JButton deleteSbrsUrl = new JButton();
67 // Web service status and url table
68 protected JTable wsList = new JTable();
70 protected TitledBorder wsListTitleBorder = new TitledBorder(
71 MessageManager.getString("label.web_service_discovery_urls"));
73 protected JButton newWsUrl = new JButton();
75 protected JButton editWsUrl = new JButton();
77 protected JButton deleteWsUrl = new JButton();
79 protected JButton moveWsUrlUp = new JButton();
81 protected JButton moveWsUrlDown = new JButton();
83 protected JCheckBox indexByHost = new JCheckBox();
85 protected JCheckBox indexByType = new JCheckBox();
87 protected JCheckBox enableJws2Services = new JCheckBox();
89 protected JCheckBox enableEnfinServices = new JCheckBox();
91 protected JCheckBox displayWsWarning = new JCheckBox();
93 protected JButton refreshWs = new JButton();
95 protected JButton resetWs = new JButton();
97 protected JProgressBar progressBar = new JProgressBar();
99 JScrollPane wsListPane = new JScrollPane();
101 JPanel wsListUrlPanel = new JPanel();
103 JPanel wsListPanel = new JPanel();
105 JPanel wsListButtons = new JPanel();
107 JPanel wsListNavButs = new JPanel();
109 JScrollPane srbsListPane = new JScrollPane();
111 JPanel srbsListUrlPanel = new JPanel();
113 JPanel srbsListPanel = new JPanel();
115 JPanel srbsListButtons = new JPanel();
117 JPanel srbsListNavButs = new JPanel();
119 BorderLayout myBorderlayout = new BorderLayout();
121 BorderLayout wsListBorderlayout = new BorderLayout();
123 BorderLayout srbsListBorderlayout = new BorderLayout();
125 GridBagLayout wsPrefLayout = new GridBagLayout();
127 GridBagLayout wsListLayout = new GridBagLayout();
129 GridBagLayout srbsListLayout = new GridBagLayout();
131 GridBagLayout wsMenuLayout = new GridBagLayout();
133 JPanel wsMenuButtons = new JPanel();
135 JPanel wsMenuRefreshButs = new JPanel();
137 public GWsPreferences()
142 private void jbInit()
145 refreshWs.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
146 refreshWs.setText(MessageManager.getString("action.refresh_services"));
147 refreshWs.addActionListener(new ActionListener()
149 public void actionPerformed(ActionEvent e)
151 refreshWs_actionPerformed(e);
154 resetWs.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
155 resetWs.setText(MessageManager.getString("action.reset_services"));
157 resetWs.addActionListener(new ActionListener()
159 public void actionPerformed(ActionEvent e)
161 resetWs_actionPerformed(e);
164 indexByHost.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
165 indexByHost.setText(MessageManager.getString("label.index_by_host"));
166 indexByHost.setToolTipText(MessageManager
167 .getString("label.index_web_services_menu_by_host_site"));
168 indexByHost.addActionListener(new ActionListener()
170 public void actionPerformed(ActionEvent e)
172 indexByHost_actionPerformed(e);
175 indexByType.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
176 indexByType.setText(MessageManager.getString("label.index_by_type"));
177 indexByType.addActionListener(new ActionListener()
179 public void actionPerformed(ActionEvent e)
181 indexByType_actionPerformed(e);
185 .setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
186 enableJws2Services.setText(
187 MessageManager.getString("label.enable_jabaws_services"));
188 enableJws2Services.addActionListener(new ActionListener()
190 public void actionPerformed(ActionEvent e)
192 enableJws2Services_actionPerformed(e);
195 displayWsWarning.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
197 .setText(MessageManager.getString("label.display_warnings"));
198 displayWsWarning.setToolTipText("<html>" + MessageManager.getString(
199 "label.option_want_informed_web_service_URL_cannot_be_accessed_jalview_when_starts_up"));
200 displayWsWarning.addActionListener(new ActionListener()
202 public void actionPerformed(ActionEvent e)
204 displayWsWarning_actionPerformed(e);
207 newWsUrl.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
208 newWsUrl.setText(MessageManager.getString("label.new_service_url"));
209 newWsUrl.addActionListener(new ActionListener()
211 public void actionPerformed(ActionEvent e)
213 newWsUrl_actionPerformed(e);
216 editWsUrl.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
217 editWsUrl.setText(MessageManager.getString("label.edit_service_url"));
218 editWsUrl.addActionListener(new ActionListener()
220 public void actionPerformed(ActionEvent e)
222 editWsUrl_actionPerformed(e);
226 deleteWsUrl.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
228 .setText(MessageManager.getString("label.delete_service_url"));
229 deleteWsUrl.addActionListener(new ActionListener()
231 public void actionPerformed(ActionEvent e)
233 deleteWsUrl_actionPerformed(e);
236 moveWsUrlUp.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
237 moveWsUrlUp.setText(MessageManager.getString("action.move_up"));
239 .setToolTipText(MessageManager.getString("label.move_url_up"));
240 moveWsUrlUp.addActionListener(new ActionListener()
242 public void actionPerformed(ActionEvent e)
244 moveWsUrlUp_actionPerformed(e);
247 moveWsUrlDown.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
248 moveWsUrlDown.setText(MessageManager.getString("action.move_down"));
249 moveWsUrlDown.setToolTipText(
250 MessageManager.getString("label.move_url_down"));
251 moveWsUrlDown.addActionListener(new ActionListener()
253 public void actionPerformed(ActionEvent e)
255 moveWsUrlDown_actionPerformed(e);
258 newSbrsUrl.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
260 .setText(MessageManager.getString("label.add_sbrs_definition"));
261 newSbrsUrl.addActionListener(new ActionListener()
263 public void actionPerformed(ActionEvent e)
265 newSbrsUrl_actionPerformed(e);
268 editSbrsUrl.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
270 MessageManager.getString("label.edit_sbrs_definition"));
271 editSbrsUrl.addActionListener(new ActionListener()
273 public void actionPerformed(ActionEvent e)
275 editSbrsUrl_actionPerformed(e);
279 deleteSbrsUrl.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
280 deleteSbrsUrl.setText(
281 MessageManager.getString("label.delete_sbrs_definition"));
282 deleteSbrsUrl.addActionListener(new ActionListener()
284 public void actionPerformed(ActionEvent e)
286 deleteSbrsUrl_actionPerformed(e);
290 setLayout(myBorderlayout);
291 setPreferredSize(new Dimension(500, 400));
292 progressBar.setPreferredSize(new Dimension(450, 20));
293 progressBar.setString("");
294 wsListUrlPanel.setBorder(BorderFactory.createEtchedBorder());
295 wsListUrlPanel.setLayout(new BorderLayout());
296 wsListPane.setBorder(BorderFactory.createEtchedBorder());
297 wsListPane.getViewport().add(wsList);
298 wsList.setPreferredSize(new Dimension(482, 202));
299 wsListPane.setPreferredSize(new Dimension(380, 80));
300 wsList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
301 wsList.setColumnSelectionAllowed(false);
302 wsList.addMouseListener(new MouseListener()
305 public void mouseClicked(MouseEvent e)
307 if (e.getClickCount() > 1)
309 editWsUrl_actionPerformed(null);
314 public void mouseEntered(MouseEvent e)
319 public void mouseExited(MouseEvent e)
323 public void mousePressed(MouseEvent e)
328 public void mouseReleased(MouseEvent e)
334 wsListButtons.setLayout(new FlowLayout());
335 wsListButtons.add(newWsUrl);
336 wsListButtons.add(editWsUrl);
337 wsListButtons.add(deleteWsUrl);
338 wsListButtons.setMinimumSize(new Dimension(350, 80));
339 wsListNavButs.setSize(new Dimension(80, 80));
340 wsListNavButs.setPreferredSize(new Dimension(80, 80));
341 wsListNavButs.setLayout(new FlowLayout());
342 wsListNavButs.add(moveWsUrlUp);
343 wsListNavButs.add(moveWsUrlDown);
344 wsListUrlPanel.add(wsListPane, BorderLayout.CENTER);
345 wsListUrlPanel.add(wsListNavButs, BorderLayout.WEST);
346 wsListPanel.setBorder(wsListTitleBorder);
347 wsListPanel.setLayout(new BorderLayout());
348 wsListPanel.add(wsListUrlPanel, BorderLayout.NORTH);
349 wsListPanel.add(wsListButtons, BorderLayout.SOUTH);
351 srbsListUrlPanel.setBorder(BorderFactory.createEtchedBorder());
352 srbsListUrlPanel.setLayout(new BorderLayout());
353 srbsListPane.setBorder(BorderFactory.createEtchedBorder());
354 srbsListPane.getViewport().add(sbrsList);
355 sbrsList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
356 sbrsList.addMouseListener(new MouseListener()
359 public void mouseClicked(MouseEvent e)
361 if (e.getClickCount() > 1)
363 editSbrsUrl_actionPerformed(null);
368 public void mouseEntered(MouseEvent e)
373 public void mouseExited(MouseEvent e)
377 public void mousePressed(MouseEvent e)
382 public void mouseReleased(MouseEvent e)
388 srbsListButtons.setLayout(new FlowLayout());
389 srbsListButtons.add(newSbrsUrl);
390 srbsListButtons.add(editSbrsUrl);
391 srbsListButtons.add(deleteSbrsUrl);
392 srbsListUrlPanel.add(srbsListPane, BorderLayout.CENTER);
393 srbsListPanel.setBorder(sbrsListTitleBorder);
394 srbsListPanel.setLayout(new BorderLayout());
395 srbsListPanel.add(srbsListUrlPanel, BorderLayout.NORTH);
396 srbsListPanel.add(srbsListButtons, BorderLayout.CENTER);
398 wsMenuButtons.setLayout(new GridLayout(2, 3));
399 wsMenuButtons.add(indexByHost);
400 wsMenuButtons.add(indexByType);
401 wsMenuButtons.add(enableJws2Services);
402 wsMenuButtons.add(displayWsWarning);
403 wsMenuRefreshButs.setLayout(new FlowLayout());
404 wsMenuRefreshButs.setPreferredSize(new Dimension(480, 30));
405 wsMenuRefreshButs.setSize(new Dimension(480, 30));
406 wsMenuRefreshButs.add(refreshWs, null);
407 wsMenuRefreshButs.add(resetWs, null);
408 wsMenuRefreshButs.add(progressBar, null);
409 myBorderlayout.setHgap(3);
410 if (jalview.bin.Cache.getDefault("ENABLE_RSBS_EDITOR", false))
412 JTabbedPane listPanels = new JTabbedPane();
413 listPanels.addTab("JABAWS Servers", wsListPanel);
414 listPanels.addTab("RSB Services", srbsListPanel);
415 add(listPanels, BorderLayout.NORTH);
419 add(wsListPanel, BorderLayout.NORTH);
421 add(wsMenuButtons, BorderLayout.CENTER);
422 add(wsMenuRefreshButs, BorderLayout.SOUTH);
425 protected void deleteSbrsUrl_actionPerformed(ActionEvent e)
427 // TODO Auto-generated method stub
431 protected void editSbrsUrl_actionPerformed(ActionEvent e)
433 // TODO Auto-generated method stub
437 protected void newSbrsUrl_actionPerformed(ActionEvent e)
439 // TODO Auto-generated method stub
443 protected void displayWsWarning_actionPerformed(ActionEvent e)
445 // TODO Auto-generated method stub
449 protected void resetWs_actionPerformed(ActionEvent e)
454 protected void indexByType_actionPerformed(ActionEvent e)
459 protected void indexByHost_actionPerformed(ActionEvent e)
464 protected void newWsUrl_actionPerformed(ActionEvent e)
469 protected void editWsUrl_actionPerformed(ActionEvent e)
474 protected void deleteWsUrl_actionPerformed(ActionEvent e)
479 protected void moveWsUrlUp_actionPerformed(ActionEvent e)
484 protected void moveWsUrlDown_actionPerformed(ActionEvent e)
489 protected void enableEnfinServices_actionPerformed(ActionEvent e)
494 protected void enableJws2Services_actionPerformed(ActionEvent e)
499 protected void refreshWs_actionPerformed(ActionEvent e)