2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.0b1)
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 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/>.
17 * The Jalview Authors are detailed in the 'AUTHORS' file.
19 package jalview.jbgui;
21 import jalview.util.MessageManager;
23 import java.awt.BorderLayout;
24 import java.awt.Dimension;
25 import java.awt.FlowLayout;
27 import java.awt.GridBagLayout;
28 import java.awt.GridLayout;
29 import java.awt.event.ActionEvent;
30 import java.awt.event.ActionListener;
31 import java.awt.event.MouseEvent;
32 import java.awt.event.MouseListener;
34 import javax.swing.BorderFactory;
35 import javax.swing.JButton;
36 import javax.swing.JCheckBox;
37 import javax.swing.JList;
38 import javax.swing.JPanel;
39 import javax.swing.JProgressBar;
40 import javax.swing.JScrollPane;
41 import javax.swing.JTabbedPane;
42 import javax.swing.JTable;
43 import javax.swing.ListSelectionModel;
44 import javax.swing.border.TitledBorder;
47 * Preference dialog for jalview web services
51 public class GWsPreferences extends JPanel
53 protected JList sbrsList = new JList();
55 protected TitledBorder sbrsListTitleBorder = new TitledBorder(
56 MessageManager.getString("label.simple_bioinformatics_rest_services"));
58 protected JButton newSbrsUrl = new JButton();
60 protected JButton editSbrsUrl = new JButton();
62 protected JButton deleteSbrsUrl = new JButton();
64 // Web service status and url table
65 protected JTable wsList = new JTable();
67 protected TitledBorder wsListTitleBorder = new TitledBorder(
68 MessageManager.getString("label.web_service_discovery_urls"));
70 protected JButton newWsUrl = new JButton();
72 protected JButton editWsUrl = new JButton();
74 protected JButton deleteWsUrl = new JButton();
76 protected JButton moveWsUrlUp = new JButton();
78 protected JButton moveWsUrlDown = new JButton();
80 protected JCheckBox indexByHost = new JCheckBox();
82 protected JCheckBox indexByType = new JCheckBox();
84 protected JCheckBox enableJws2Services = new JCheckBox();
86 protected JCheckBox enableEnfinServices = new JCheckBox();
88 protected JCheckBox displayWsWarning = new JCheckBox();
90 protected JButton refreshWs = new JButton();
92 protected JButton resetWs = new JButton();
94 protected JProgressBar progressBar = new JProgressBar();
96 JScrollPane wsListPane = new JScrollPane();
98 JPanel wsListUrlPanel = new JPanel();
100 JPanel wsListPanel = new JPanel();
102 JPanel wsListButtons = new JPanel();
104 JPanel wsListNavButs = new JPanel();
106 JScrollPane srbsListPane = new JScrollPane();
108 JPanel srbsListUrlPanel = new JPanel();
110 JPanel srbsListPanel = new JPanel();
112 JPanel srbsListButtons = new JPanel();
114 JPanel srbsListNavButs = new JPanel();
116 BorderLayout myBorderlayout = new BorderLayout();
118 BorderLayout wsListBorderlayout = new BorderLayout();
120 BorderLayout srbsListBorderlayout = new BorderLayout();
122 GridBagLayout wsPrefLayout = new GridBagLayout();
124 GridBagLayout wsListLayout = new GridBagLayout();
126 GridBagLayout srbsListLayout = new GridBagLayout();
128 GridBagLayout wsMenuLayout = new GridBagLayout();
130 JPanel wsMenuButtons = new JPanel();
132 JPanel wsMenuRefreshButs = new JPanel();
134 public GWsPreferences()
139 private void jbInit()
142 refreshWs.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
143 refreshWs.setText(MessageManager.getString("action.refresh_services"));
144 refreshWs.addActionListener(new ActionListener()
146 public void actionPerformed(ActionEvent e)
148 refreshWs_actionPerformed(e);
151 resetWs.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
152 resetWs.setText(MessageManager.getString("action.reset_services"));
154 resetWs.addActionListener(new ActionListener()
156 public void actionPerformed(ActionEvent e)
158 resetWs_actionPerformed(e);
161 indexByHost.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
162 indexByHost.setText(MessageManager.getString("label.index_by_host"));
164 .setToolTipText(MessageManager.getString("label.index_web_services_menu_by_host_site"));
165 indexByHost.addActionListener(new ActionListener()
167 public void actionPerformed(ActionEvent e)
169 indexByHost_actionPerformed(e);
172 indexByType.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
173 indexByType.setText(MessageManager.getString("label.index_by_type"));
174 indexByType.addActionListener(new ActionListener()
176 public void actionPerformed(ActionEvent e)
178 indexByType_actionPerformed(e);
182 .setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
183 enableJws2Services.setText(MessageManager.getString("label.enable_jabaws_services"));
184 enableJws2Services.addActionListener(new ActionListener()
186 public void actionPerformed(ActionEvent e)
188 enableJws2Services_actionPerformed(e);
191 displayWsWarning.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
192 displayWsWarning.setText(MessageManager.getString("label.display_warnings"));
194 .setToolTipText("<html>" + MessageManager.getString("label.option_want_informed_web_service_URL_cannot_be_accessed_jalview_when_starts_up"));
195 displayWsWarning.addActionListener(new ActionListener()
197 public void actionPerformed(ActionEvent e)
199 displayWsWarning_actionPerformed(e);
202 newWsUrl.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
203 newWsUrl.setText(MessageManager.getString("label.new_service_url"));
204 newWsUrl.addActionListener(new ActionListener()
206 public void actionPerformed(ActionEvent e)
208 newWsUrl_actionPerformed(e);
211 editWsUrl.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
212 editWsUrl.setText(MessageManager.getString("label.edit_service_url"));
213 editWsUrl.addActionListener(new ActionListener()
215 public void actionPerformed(ActionEvent e)
217 editWsUrl_actionPerformed(e);
221 deleteWsUrl.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
222 deleteWsUrl.setText(MessageManager.getString("label.delete_service_url"));
223 deleteWsUrl.addActionListener(new ActionListener()
225 public void actionPerformed(ActionEvent e)
227 deleteWsUrl_actionPerformed(e);
230 moveWsUrlUp.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
231 moveWsUrlUp.setText(MessageManager.getString("action.move_up"));
232 moveWsUrlUp.setToolTipText(MessageManager.getString("label.move_url_up"));
233 moveWsUrlUp.addActionListener(new ActionListener()
235 public void actionPerformed(ActionEvent e)
237 moveWsUrlUp_actionPerformed(e);
240 moveWsUrlDown.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
241 moveWsUrlDown.setText(MessageManager.getString("action.move_down"));
242 moveWsUrlDown.setToolTipText(MessageManager.getString("label.move_url_down"));
243 moveWsUrlDown.addActionListener(new ActionListener()
245 public void actionPerformed(ActionEvent e)
247 moveWsUrlDown_actionPerformed(e);
250 newSbrsUrl.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
251 newSbrsUrl.setText(MessageManager.getString("label.add_sbrs_definition"));
252 newSbrsUrl.addActionListener(new ActionListener()
254 public void actionPerformed(ActionEvent e)
256 newSbrsUrl_actionPerformed(e);
259 editSbrsUrl.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
260 editSbrsUrl.setText(MessageManager.getString("label.edit_sbrs_definition"));
261 editSbrsUrl.addActionListener(new ActionListener()
263 public void actionPerformed(ActionEvent e)
265 editSbrsUrl_actionPerformed(e);
269 deleteSbrsUrl.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
270 deleteSbrsUrl.setText(MessageManager.getString("label.delete_sbrs_definition"));
271 deleteSbrsUrl.addActionListener(new ActionListener()
273 public void actionPerformed(ActionEvent e)
275 deleteSbrsUrl_actionPerformed(e);
279 setLayout(myBorderlayout);
280 setPreferredSize(new Dimension(500, 400));
281 progressBar.setPreferredSize(new Dimension(450, 20));
282 progressBar.setString("");
283 wsListUrlPanel.setBorder(BorderFactory.createEtchedBorder());
284 wsListUrlPanel.setLayout(new BorderLayout());
285 wsListPane.setBorder(BorderFactory.createEtchedBorder());
286 wsListPane.getViewport().add(wsList);
287 wsList.setPreferredSize(new Dimension(482, 202));
288 wsListPane.setPreferredSize(new Dimension(380, 80));
289 wsList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
290 wsList.setColumnSelectionAllowed(false);
291 wsList.addMouseListener(new MouseListener()
294 public void mouseClicked(MouseEvent e)
296 if (e.getClickCount() > 1)
298 editWsUrl_actionPerformed(null);
303 public void mouseEntered(MouseEvent e)
308 public void mouseExited(MouseEvent e)
312 public void mousePressed(MouseEvent e)
317 public void mouseReleased(MouseEvent e)
323 wsListButtons.setLayout(new FlowLayout());
324 wsListButtons.add(newWsUrl);
325 wsListButtons.add(editWsUrl);
326 wsListButtons.add(deleteWsUrl);
327 wsListButtons.setMinimumSize(new Dimension(350, 80));
328 wsListNavButs.setSize(new Dimension(80, 80));
329 wsListNavButs.setPreferredSize(new Dimension(80, 80));
330 wsListNavButs.setLayout(new FlowLayout());
331 wsListNavButs.add(moveWsUrlUp);
332 wsListNavButs.add(moveWsUrlDown);
333 wsListUrlPanel.add(wsListPane, BorderLayout.CENTER);
334 wsListUrlPanel.add(wsListNavButs, BorderLayout.WEST);
335 wsListPanel.setBorder(wsListTitleBorder);
336 wsListPanel.setLayout(new BorderLayout());
337 wsListPanel.add(wsListUrlPanel, BorderLayout.NORTH);
338 wsListPanel.add(wsListButtons, BorderLayout.SOUTH);
340 srbsListUrlPanel.setBorder(BorderFactory.createEtchedBorder());
341 srbsListUrlPanel.setLayout(new BorderLayout());
342 srbsListPane.setBorder(BorderFactory.createEtchedBorder());
343 srbsListPane.getViewport().add(sbrsList);
344 sbrsList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
345 sbrsList.addMouseListener(new MouseListener()
348 public void mouseClicked(MouseEvent e)
350 if (e.getClickCount() > 1)
352 editSbrsUrl_actionPerformed(null);
357 public void mouseEntered(MouseEvent e)
362 public void mouseExited(MouseEvent e)
366 public void mousePressed(MouseEvent e)
371 public void mouseReleased(MouseEvent e)
377 srbsListButtons.setLayout(new FlowLayout());
378 srbsListButtons.add(newSbrsUrl);
379 srbsListButtons.add(editSbrsUrl);
380 srbsListButtons.add(deleteSbrsUrl);
381 srbsListUrlPanel.add(srbsListPane, BorderLayout.CENTER);
382 srbsListPanel.setBorder(sbrsListTitleBorder);
383 srbsListPanel.setLayout(new BorderLayout());
384 srbsListPanel.add(srbsListUrlPanel, BorderLayout.NORTH);
385 srbsListPanel.add(srbsListButtons, BorderLayout.CENTER);
387 wsMenuButtons.setLayout(new GridLayout(2, 3));
388 wsMenuButtons.add(indexByHost);
389 wsMenuButtons.add(indexByType);
390 wsMenuButtons.add(enableJws2Services);
391 wsMenuButtons.add(displayWsWarning);
392 wsMenuRefreshButs.setLayout(new FlowLayout());
393 wsMenuRefreshButs.setPreferredSize(new Dimension(480, 30));
394 wsMenuRefreshButs.setSize(new Dimension(480, 30));
395 wsMenuRefreshButs.add(refreshWs, null);
396 wsMenuRefreshButs.add(resetWs, null);
397 wsMenuRefreshButs.add(progressBar, null);
398 myBorderlayout.setHgap(3);
399 if (jalview.bin.Cache.getDefault("ENABLE_RSBS_EDITOR", false))
401 JTabbedPane listPanels = new JTabbedPane();
402 listPanels.addTab("JABAWS Servers", wsListPanel);
403 listPanels.addTab("RSB Services", srbsListPanel);
404 add(listPanels, BorderLayout.NORTH);
408 add(wsListPanel, BorderLayout.NORTH);
410 add(wsMenuButtons, BorderLayout.CENTER);
411 add(wsMenuRefreshButs, BorderLayout.SOUTH);
414 protected void deleteSbrsUrl_actionPerformed(ActionEvent e)
416 // TODO Auto-generated method stub
420 protected void editSbrsUrl_actionPerformed(ActionEvent e)
422 // TODO Auto-generated method stub
426 protected void newSbrsUrl_actionPerformed(ActionEvent e)
428 // TODO Auto-generated method stub
432 protected void displayWsWarning_actionPerformed(ActionEvent e)
434 // TODO Auto-generated method stub
438 protected void resetWs_actionPerformed(ActionEvent e)
443 protected void indexByType_actionPerformed(ActionEvent e)
448 protected void indexByHost_actionPerformed(ActionEvent e)
453 protected void newWsUrl_actionPerformed(ActionEvent e)
458 protected void editWsUrl_actionPerformed(ActionEvent e)
463 protected void deleteWsUrl_actionPerformed(ActionEvent e)
468 protected void moveWsUrlUp_actionPerformed(ActionEvent e)
473 protected void moveWsUrlDown_actionPerformed(ActionEvent e)
478 protected void enableEnfinServices_actionPerformed(ActionEvent e)
483 protected void enableJws2Services_actionPerformed(ActionEvent e)
488 protected void refreshWs_actionPerformed(ActionEvent e)