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(
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(MessageManager
187 .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));
196 displayWsWarning.setText(MessageManager
197 .getString("label.display_warnings"));
199 .setToolTipText("<html>"
201 .getString("label.option_want_informed_web_service_URL_cannot_be_accessed_jalview_when_starts_up"));
202 displayWsWarning.addActionListener(new ActionListener()
204 public void actionPerformed(ActionEvent e)
206 displayWsWarning_actionPerformed(e);
209 newWsUrl.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
210 newWsUrl.setText(MessageManager.getString("label.new_service_url"));
211 newWsUrl.addActionListener(new ActionListener()
213 public void actionPerformed(ActionEvent e)
215 newWsUrl_actionPerformed(e);
218 editWsUrl.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
219 editWsUrl.setText(MessageManager.getString("label.edit_service_url"));
220 editWsUrl.addActionListener(new ActionListener()
222 public void actionPerformed(ActionEvent e)
224 editWsUrl_actionPerformed(e);
228 deleteWsUrl.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
229 deleteWsUrl.setText(MessageManager
230 .getString("label.delete_service_url"));
231 deleteWsUrl.addActionListener(new ActionListener()
233 public void actionPerformed(ActionEvent e)
235 deleteWsUrl_actionPerformed(e);
238 moveWsUrlUp.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
239 moveWsUrlUp.setText(MessageManager.getString("action.move_up"));
240 moveWsUrlUp.setToolTipText(MessageManager
241 .getString("label.move_url_up"));
242 moveWsUrlUp.addActionListener(new ActionListener()
244 public void actionPerformed(ActionEvent e)
246 moveWsUrlUp_actionPerformed(e);
249 moveWsUrlDown.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
250 moveWsUrlDown.setText(MessageManager.getString("action.move_down"));
251 moveWsUrlDown.setToolTipText(MessageManager
252 .getString("label.move_url_down"));
253 moveWsUrlDown.addActionListener(new ActionListener()
255 public void actionPerformed(ActionEvent e)
257 moveWsUrlDown_actionPerformed(e);
260 newSbrsUrl.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
261 newSbrsUrl.setText(MessageManager
262 .getString("label.add_sbrs_definition"));
263 newSbrsUrl.addActionListener(new ActionListener()
265 public void actionPerformed(ActionEvent e)
267 newSbrsUrl_actionPerformed(e);
270 editSbrsUrl.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
271 editSbrsUrl.setText(MessageManager
272 .getString("label.edit_sbrs_definition"));
273 editSbrsUrl.addActionListener(new ActionListener()
275 public void actionPerformed(ActionEvent e)
277 editSbrsUrl_actionPerformed(e);
281 deleteSbrsUrl.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
282 deleteSbrsUrl.setText(MessageManager
283 .getString("label.delete_sbrs_definition"));
284 deleteSbrsUrl.addActionListener(new ActionListener()
286 public void actionPerformed(ActionEvent e)
288 deleteSbrsUrl_actionPerformed(e);
292 setLayout(myBorderlayout);
293 setPreferredSize(new Dimension(500, 400));
294 progressBar.setPreferredSize(new Dimension(450, 20));
295 progressBar.setString("");
296 wsListUrlPanel.setBorder(BorderFactory.createEtchedBorder());
297 wsListUrlPanel.setLayout(new BorderLayout());
298 wsListPane.setBorder(BorderFactory.createEtchedBorder());
299 wsListPane.getViewport().add(wsList);
300 wsList.setPreferredSize(new Dimension(482, 202));
301 wsListPane.setPreferredSize(new Dimension(380, 80));
302 wsList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
303 wsList.setColumnSelectionAllowed(false);
304 wsList.addMouseListener(new MouseListener()
307 public void mouseClicked(MouseEvent e)
309 if (e.getClickCount() > 1)
311 editWsUrl_actionPerformed(null);
316 public void mouseEntered(MouseEvent e)
321 public void mouseExited(MouseEvent e)
325 public void mousePressed(MouseEvent e)
330 public void mouseReleased(MouseEvent e)
336 wsListButtons.setLayout(new FlowLayout());
337 wsListButtons.add(newWsUrl);
338 wsListButtons.add(editWsUrl);
339 wsListButtons.add(deleteWsUrl);
340 wsListButtons.setMinimumSize(new Dimension(350, 80));
341 wsListNavButs.setSize(new Dimension(80, 80));
342 wsListNavButs.setPreferredSize(new Dimension(80, 80));
343 wsListNavButs.setLayout(new FlowLayout());
344 wsListNavButs.add(moveWsUrlUp);
345 wsListNavButs.add(moveWsUrlDown);
346 wsListUrlPanel.add(wsListPane, BorderLayout.CENTER);
347 wsListUrlPanel.add(wsListNavButs, BorderLayout.WEST);
348 wsListPanel.setBorder(wsListTitleBorder);
349 wsListPanel.setLayout(new BorderLayout());
350 wsListPanel.add(wsListUrlPanel, BorderLayout.NORTH);
351 wsListPanel.add(wsListButtons, BorderLayout.SOUTH);
353 srbsListUrlPanel.setBorder(BorderFactory.createEtchedBorder());
354 srbsListUrlPanel.setLayout(new BorderLayout());
355 srbsListPane.setBorder(BorderFactory.createEtchedBorder());
356 srbsListPane.getViewport().add(sbrsList);
357 sbrsList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
358 sbrsList.addMouseListener(new MouseListener()
361 public void mouseClicked(MouseEvent e)
363 if (e.getClickCount() > 1)
365 editSbrsUrl_actionPerformed(null);
370 public void mouseEntered(MouseEvent e)
375 public void mouseExited(MouseEvent e)
379 public void mousePressed(MouseEvent e)
384 public void mouseReleased(MouseEvent e)
390 srbsListButtons.setLayout(new FlowLayout());
391 srbsListButtons.add(newSbrsUrl);
392 srbsListButtons.add(editSbrsUrl);
393 srbsListButtons.add(deleteSbrsUrl);
394 srbsListUrlPanel.add(srbsListPane, BorderLayout.CENTER);
395 srbsListPanel.setBorder(sbrsListTitleBorder);
396 srbsListPanel.setLayout(new BorderLayout());
397 srbsListPanel.add(srbsListUrlPanel, BorderLayout.NORTH);
398 srbsListPanel.add(srbsListButtons, BorderLayout.CENTER);
400 wsMenuButtons.setLayout(new GridLayout(2, 3));
401 wsMenuButtons.add(indexByHost);
402 wsMenuButtons.add(indexByType);
403 wsMenuButtons.add(enableJws2Services);
404 wsMenuButtons.add(displayWsWarning);
405 wsMenuRefreshButs.setLayout(new FlowLayout());
406 wsMenuRefreshButs.setPreferredSize(new Dimension(480, 30));
407 wsMenuRefreshButs.setSize(new Dimension(480, 30));
408 wsMenuRefreshButs.add(refreshWs, null);
409 wsMenuRefreshButs.add(resetWs, null);
410 wsMenuRefreshButs.add(progressBar, null);
411 myBorderlayout.setHgap(3);
412 if (jalview.bin.Cache.getDefault("ENABLE_RSBS_EDITOR", false))
414 JTabbedPane listPanels = new JTabbedPane();
415 listPanels.addTab("JABAWS Servers", wsListPanel);
416 listPanels.addTab("RSB Services", srbsListPanel);
417 add(listPanels, BorderLayout.NORTH);
421 add(wsListPanel, BorderLayout.NORTH);
423 add(wsMenuButtons, BorderLayout.CENTER);
424 add(wsMenuRefreshButs, BorderLayout.SOUTH);
427 protected void deleteSbrsUrl_actionPerformed(ActionEvent e)
429 // TODO Auto-generated method stub
433 protected void editSbrsUrl_actionPerformed(ActionEvent e)
435 // TODO Auto-generated method stub
439 protected void newSbrsUrl_actionPerformed(ActionEvent e)
441 // TODO Auto-generated method stub
445 protected void displayWsWarning_actionPerformed(ActionEvent e)
447 // TODO Auto-generated method stub
451 protected void resetWs_actionPerformed(ActionEvent e)
456 protected void indexByType_actionPerformed(ActionEvent e)
461 protected void indexByHost_actionPerformed(ActionEvent e)
466 protected void newWsUrl_actionPerformed(ActionEvent e)
471 protected void editWsUrl_actionPerformed(ActionEvent e)
476 protected void deleteWsUrl_actionPerformed(ActionEvent e)
481 protected void moveWsUrlUp_actionPerformed(ActionEvent e)
486 protected void moveWsUrlDown_actionPerformed(ActionEvent e)
491 protected void enableEnfinServices_actionPerformed(ActionEvent e)
496 protected void enableJws2Services_actionPerformed(ActionEvent e)
501 protected void refreshWs_actionPerformed(ActionEvent e)