2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2)
3 * Copyright (C) 2014 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(
58 MessageManager.getString("label.simple_bioinformatics_rest_services"));
60 protected JButton newSbrsUrl = new JButton();
62 protected JButton editSbrsUrl = new JButton();
64 protected JButton deleteSbrsUrl = new JButton();
66 // Web service status and url table
67 protected JTable wsList = new JTable();
69 protected TitledBorder wsListTitleBorder = new TitledBorder(
70 MessageManager.getString("label.web_service_discovery_urls"));
72 protected JButton newWsUrl = new JButton();
74 protected JButton editWsUrl = new JButton();
76 protected JButton deleteWsUrl = new JButton();
78 protected JButton moveWsUrlUp = new JButton();
80 protected JButton moveWsUrlDown = new JButton();
82 protected JCheckBox indexByHost = new JCheckBox();
84 protected JCheckBox indexByType = new JCheckBox();
86 protected JCheckBox enableJws2Services = new JCheckBox();
88 protected JCheckBox enableEnfinServices = new JCheckBox();
90 protected JCheckBox displayWsWarning = new JCheckBox();
92 protected JButton refreshWs = new JButton();
94 protected JButton resetWs = new JButton();
96 protected JProgressBar progressBar = new JProgressBar();
98 JScrollPane wsListPane = new JScrollPane();
100 JPanel wsListUrlPanel = new JPanel();
102 JPanel wsListPanel = new JPanel();
104 JPanel wsListButtons = new JPanel();
106 JPanel wsListNavButs = new JPanel();
108 JScrollPane srbsListPane = new JScrollPane();
110 JPanel srbsListUrlPanel = new JPanel();
112 JPanel srbsListPanel = new JPanel();
114 JPanel srbsListButtons = new JPanel();
116 JPanel srbsListNavButs = new JPanel();
118 BorderLayout myBorderlayout = new BorderLayout();
120 BorderLayout wsListBorderlayout = new BorderLayout();
122 BorderLayout srbsListBorderlayout = new BorderLayout();
124 GridBagLayout wsPrefLayout = new GridBagLayout();
126 GridBagLayout wsListLayout = new GridBagLayout();
128 GridBagLayout srbsListLayout = new GridBagLayout();
130 GridBagLayout wsMenuLayout = new GridBagLayout();
132 JPanel wsMenuButtons = new JPanel();
134 JPanel wsMenuRefreshButs = new JPanel();
136 public GWsPreferences()
141 private void jbInit()
144 refreshWs.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
145 refreshWs.setText(MessageManager.getString("action.refresh_services"));
146 refreshWs.addActionListener(new ActionListener()
148 public void actionPerformed(ActionEvent e)
150 refreshWs_actionPerformed(e);
153 resetWs.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
154 resetWs.setText(MessageManager.getString("action.reset_services"));
156 resetWs.addActionListener(new ActionListener()
158 public void actionPerformed(ActionEvent e)
160 resetWs_actionPerformed(e);
163 indexByHost.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
164 indexByHost.setText(MessageManager.getString("label.index_by_host"));
166 .setToolTipText(MessageManager.getString("label.index_web_services_menu_by_host_site"));
167 indexByHost.addActionListener(new ActionListener()
169 public void actionPerformed(ActionEvent e)
171 indexByHost_actionPerformed(e);
174 indexByType.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
175 indexByType.setText(MessageManager.getString("label.index_by_type"));
176 indexByType.addActionListener(new ActionListener()
178 public void actionPerformed(ActionEvent e)
180 indexByType_actionPerformed(e);
184 .setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
185 enableJws2Services.setText(MessageManager.getString("label.enable_jabaws_services"));
186 enableJws2Services.addActionListener(new ActionListener()
188 public void actionPerformed(ActionEvent e)
190 enableJws2Services_actionPerformed(e);
193 displayWsWarning.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
194 displayWsWarning.setText(MessageManager.getString("label.display_warnings"));
196 .setToolTipText("<html>" + MessageManager.getString("label.option_want_informed_web_service_URL_cannot_be_accessed_jalview_when_starts_up"));
197 displayWsWarning.addActionListener(new ActionListener()
199 public void actionPerformed(ActionEvent e)
201 displayWsWarning_actionPerformed(e);
204 newWsUrl.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
205 newWsUrl.setText(MessageManager.getString("label.new_service_url"));
206 newWsUrl.addActionListener(new ActionListener()
208 public void actionPerformed(ActionEvent e)
210 newWsUrl_actionPerformed(e);
213 editWsUrl.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
214 editWsUrl.setText(MessageManager.getString("label.edit_service_url"));
215 editWsUrl.addActionListener(new ActionListener()
217 public void actionPerformed(ActionEvent e)
219 editWsUrl_actionPerformed(e);
223 deleteWsUrl.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
224 deleteWsUrl.setText(MessageManager.getString("label.delete_service_url"));
225 deleteWsUrl.addActionListener(new ActionListener()
227 public void actionPerformed(ActionEvent e)
229 deleteWsUrl_actionPerformed(e);
232 moveWsUrlUp.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
233 moveWsUrlUp.setText(MessageManager.getString("action.move_up"));
234 moveWsUrlUp.setToolTipText(MessageManager.getString("label.move_url_up"));
235 moveWsUrlUp.addActionListener(new ActionListener()
237 public void actionPerformed(ActionEvent e)
239 moveWsUrlUp_actionPerformed(e);
242 moveWsUrlDown.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
243 moveWsUrlDown.setText(MessageManager.getString("action.move_down"));
244 moveWsUrlDown.setToolTipText(MessageManager.getString("label.move_url_down"));
245 moveWsUrlDown.addActionListener(new ActionListener()
247 public void actionPerformed(ActionEvent e)
249 moveWsUrlDown_actionPerformed(e);
252 newSbrsUrl.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
253 newSbrsUrl.setText(MessageManager.getString("label.add_sbrs_definition"));
254 newSbrsUrl.addActionListener(new ActionListener()
256 public void actionPerformed(ActionEvent e)
258 newSbrsUrl_actionPerformed(e);
261 editSbrsUrl.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
262 editSbrsUrl.setText(MessageManager.getString("label.edit_sbrs_definition"));
263 editSbrsUrl.addActionListener(new ActionListener()
265 public void actionPerformed(ActionEvent e)
267 editSbrsUrl_actionPerformed(e);
271 deleteSbrsUrl.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
272 deleteSbrsUrl.setText(MessageManager.getString("label.delete_sbrs_definition"));
273 deleteSbrsUrl.addActionListener(new ActionListener()
275 public void actionPerformed(ActionEvent e)
277 deleteSbrsUrl_actionPerformed(e);
281 setLayout(myBorderlayout);
282 setPreferredSize(new Dimension(500, 400));
283 progressBar.setPreferredSize(new Dimension(450, 20));
284 progressBar.setString("");
285 wsListUrlPanel.setBorder(BorderFactory.createEtchedBorder());
286 wsListUrlPanel.setLayout(new BorderLayout());
287 wsListPane.setBorder(BorderFactory.createEtchedBorder());
288 wsListPane.getViewport().add(wsList);
289 wsList.setPreferredSize(new Dimension(482, 202));
290 wsListPane.setPreferredSize(new Dimension(380, 80));
291 wsList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
292 wsList.setColumnSelectionAllowed(false);
293 wsList.addMouseListener(new MouseListener()
296 public void mouseClicked(MouseEvent e)
298 if (e.getClickCount() > 1)
300 editWsUrl_actionPerformed(null);
305 public void mouseEntered(MouseEvent e)
310 public void mouseExited(MouseEvent e)
314 public void mousePressed(MouseEvent e)
319 public void mouseReleased(MouseEvent e)
325 wsListButtons.setLayout(new FlowLayout());
326 wsListButtons.add(newWsUrl);
327 wsListButtons.add(editWsUrl);
328 wsListButtons.add(deleteWsUrl);
329 wsListButtons.setMinimumSize(new Dimension(350, 80));
330 wsListNavButs.setSize(new Dimension(80, 80));
331 wsListNavButs.setPreferredSize(new Dimension(80, 80));
332 wsListNavButs.setLayout(new FlowLayout());
333 wsListNavButs.add(moveWsUrlUp);
334 wsListNavButs.add(moveWsUrlDown);
335 wsListUrlPanel.add(wsListPane, BorderLayout.CENTER);
336 wsListUrlPanel.add(wsListNavButs, BorderLayout.WEST);
337 wsListPanel.setBorder(wsListTitleBorder);
338 wsListPanel.setLayout(new BorderLayout());
339 wsListPanel.add(wsListUrlPanel, BorderLayout.NORTH);
340 wsListPanel.add(wsListButtons, BorderLayout.SOUTH);
342 srbsListUrlPanel.setBorder(BorderFactory.createEtchedBorder());
343 srbsListUrlPanel.setLayout(new BorderLayout());
344 srbsListPane.setBorder(BorderFactory.createEtchedBorder());
345 srbsListPane.getViewport().add(sbrsList);
346 sbrsList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
347 sbrsList.addMouseListener(new MouseListener()
350 public void mouseClicked(MouseEvent e)
352 if (e.getClickCount() > 1)
354 editSbrsUrl_actionPerformed(null);
359 public void mouseEntered(MouseEvent e)
364 public void mouseExited(MouseEvent e)
368 public void mousePressed(MouseEvent e)
373 public void mouseReleased(MouseEvent e)
379 srbsListButtons.setLayout(new FlowLayout());
380 srbsListButtons.add(newSbrsUrl);
381 srbsListButtons.add(editSbrsUrl);
382 srbsListButtons.add(deleteSbrsUrl);
383 srbsListUrlPanel.add(srbsListPane, BorderLayout.CENTER);
384 srbsListPanel.setBorder(sbrsListTitleBorder);
385 srbsListPanel.setLayout(new BorderLayout());
386 srbsListPanel.add(srbsListUrlPanel, BorderLayout.NORTH);
387 srbsListPanel.add(srbsListButtons, BorderLayout.CENTER);
389 wsMenuButtons.setLayout(new GridLayout(2, 3));
390 wsMenuButtons.add(indexByHost);
391 wsMenuButtons.add(indexByType);
392 wsMenuButtons.add(enableJws2Services);
393 wsMenuButtons.add(displayWsWarning);
394 wsMenuRefreshButs.setLayout(new FlowLayout());
395 wsMenuRefreshButs.setPreferredSize(new Dimension(480, 30));
396 wsMenuRefreshButs.setSize(new Dimension(480, 30));
397 wsMenuRefreshButs.add(refreshWs, null);
398 wsMenuRefreshButs.add(resetWs, null);
399 wsMenuRefreshButs.add(progressBar, null);
400 myBorderlayout.setHgap(3);
401 if (jalview.bin.Cache.getDefault("ENABLE_RSBS_EDITOR", false))
403 JTabbedPane listPanels = new JTabbedPane();
404 listPanels.addTab("JABAWS Servers", wsListPanel);
405 listPanels.addTab("RSB Services", srbsListPanel);
406 add(listPanels, BorderLayout.NORTH);
410 add(wsListPanel, BorderLayout.NORTH);
412 add(wsMenuButtons, BorderLayout.CENTER);
413 add(wsMenuRefreshButs, BorderLayout.SOUTH);
416 protected void deleteSbrsUrl_actionPerformed(ActionEvent e)
418 // TODO Auto-generated method stub
422 protected void editSbrsUrl_actionPerformed(ActionEvent e)
424 // TODO Auto-generated method stub
428 protected void newSbrsUrl_actionPerformed(ActionEvent e)
430 // TODO Auto-generated method stub
434 protected void displayWsWarning_actionPerformed(ActionEvent e)
436 // TODO Auto-generated method stub
440 protected void resetWs_actionPerformed(ActionEvent e)
445 protected void indexByType_actionPerformed(ActionEvent e)
450 protected void indexByHost_actionPerformed(ActionEvent e)
455 protected void newWsUrl_actionPerformed(ActionEvent e)
460 protected void editWsUrl_actionPerformed(ActionEvent e)
465 protected void deleteWsUrl_actionPerformed(ActionEvent e)
470 protected void moveWsUrlUp_actionPerformed(ActionEvent e)
475 protected void moveWsUrlDown_actionPerformed(ActionEvent e)
480 protected void enableEnfinServices_actionPerformed(ActionEvent e)
485 protected void enableJws2Services_actionPerformed(ActionEvent e)
490 protected void refreshWs_actionPerformed(ActionEvent e)