2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.6)
3 * Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
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/>.
18 package jalview.jbgui;
20 import java.awt.BorderLayout;
21 import java.awt.Dimension;
22 import java.awt.FlowLayout;
24 import java.awt.GridBagLayout;
25 import java.awt.GridLayout;
26 import java.awt.event.ActionEvent;
27 import java.awt.event.ActionListener;
28 import java.awt.event.MouseEvent;
29 import java.awt.event.MouseListener;
31 import javax.swing.BorderFactory;
32 import javax.swing.JButton;
33 import javax.swing.JCheckBox;
34 import javax.swing.JList;
35 import javax.swing.JPanel;
36 import javax.swing.JProgressBar;
37 import javax.swing.JScrollPane;
38 import javax.swing.ListSelectionModel;
39 import javax.swing.SwingConstants;
40 import javax.swing.border.TitledBorder;
43 * Preference dialog for jalview web services
47 public class GWsPreferences extends JPanel
49 protected JList wsList = new JList();
51 protected TitledBorder wsListTitleBorder = new TitledBorder(
52 "Web Service Discovery URLS");
54 protected JButton newWsUrl = new JButton();
56 protected JButton editWsUrl = new JButton();
58 protected JButton deleteWsUrl = new JButton();
60 protected JButton moveWsUrlUp = new JButton();
62 protected JButton moveWsUrlDown = new JButton();
64 protected JCheckBox indexByHost = new JCheckBox();
66 protected JCheckBox indexByType = new JCheckBox();
68 protected JCheckBox enableJws1Services = new JCheckBox();
70 protected JCheckBox enableJws2Services = new JCheckBox();
72 protected JCheckBox enableEnfinServices = new JCheckBox();
74 protected JButton refreshWs = new JButton();
76 protected JButton resetWs = new JButton();
78 protected JProgressBar progressBar = new JProgressBar();
80 JScrollPane wsListPane = new JScrollPane();
82 JPanel wsListUrlPanel = new JPanel();
84 JPanel wsListPanel = new JPanel();
86 JPanel wsListButtons = new JPanel();
88 JPanel wsListNavButs = new JPanel();
90 BorderLayout myBorderlayout = new BorderLayout();
92 BorderLayout wsListBorderlayout = new BorderLayout();
94 GridBagLayout wsPrefLayout = new GridBagLayout();
96 GridBagLayout wsListLayout = new GridBagLayout();
98 GridBagLayout wsMenuLayout = new GridBagLayout();
100 JPanel wsMenuButtons = new JPanel();
102 JPanel wsMenuRefreshButs = new JPanel();
104 public GWsPreferences()
109 private void jbInit()
112 refreshWs.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
113 refreshWs.setText("Refresh Services");
114 refreshWs.addActionListener(new ActionListener()
116 public void actionPerformed(ActionEvent e)
118 refreshWs_actionPerformed(e);
121 resetWs.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
122 resetWs.setText("Reset Services");
124 resetWs.addActionListener(new ActionListener()
126 public void actionPerformed(ActionEvent e)
128 resetWs_actionPerformed(e);
131 indexByHost.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
132 indexByHost.setText("Index by host");
134 .setToolTipText("Index web services in menu by the host site.");
135 indexByHost.addActionListener(new ActionListener()
137 public void actionPerformed(ActionEvent e)
139 indexByHost_actionPerformed(e);
142 indexByType.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
143 indexByType.setText("Index by type");
144 indexByType.addActionListener(new ActionListener()
146 public void actionPerformed(ActionEvent e)
148 indexByType_actionPerformed(e);
152 .setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
153 enableEnfinServices.setText("Enable Enfin Services");
154 enableEnfinServices.addActionListener(new ActionListener()
156 public void actionPerformed(ActionEvent e)
158 enableEnfinServices_actionPerformed(e);
162 .setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
163 enableJws2Services.setText("Enable JABAWS Services");
164 enableJws2Services.addActionListener(new ActionListener()
166 public void actionPerformed(ActionEvent e)
168 enableJws2Services_actionPerformed(e);
172 .setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
173 enableJws1Services.setText("Enable Legacy Services");
174 enableJws1Services.addActionListener(new ActionListener()
176 public void actionPerformed(ActionEvent e)
178 enableJws1Services_actionPerformed(e);
181 newWsUrl.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
182 newWsUrl.setText("New Service URL");
183 newWsUrl.addActionListener(new ActionListener()
185 public void actionPerformed(ActionEvent e)
187 newWsUrl_actionPerformed(e);
190 editWsUrl.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
191 editWsUrl.setText("Edit Service URL");
192 editWsUrl.addActionListener(new ActionListener()
194 public void actionPerformed(ActionEvent e)
196 editWsUrl_actionPerformed(e);
200 deleteWsUrl.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
201 deleteWsUrl.setText("Delete Service URL");
202 deleteWsUrl.addActionListener(new ActionListener()
204 public void actionPerformed(ActionEvent e)
206 deleteWsUrl_actionPerformed(e);
209 moveWsUrlUp.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
210 moveWsUrlUp.setText("Up");
211 moveWsUrlUp.setToolTipText("Move URL up");
212 moveWsUrlUp.addActionListener(new ActionListener()
214 public void actionPerformed(ActionEvent e)
216 moveWsUrlUp_actionPerformed(e);
219 moveWsUrlDown.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
220 moveWsUrlDown.setText("Down");
221 moveWsUrlDown.setToolTipText("Move URL Down");
222 moveWsUrlDown.addActionListener(new ActionListener()
224 public void actionPerformed(ActionEvent e)
226 moveWsUrlDown_actionPerformed(e);
230 setLayout(myBorderlayout);
231 setPreferredSize(new Dimension(500, 400));
232 progressBar.setPreferredSize(new Dimension(450, 20));
233 progressBar.setString("");
234 wsListUrlPanel.setBorder(BorderFactory.createEtchedBorder());
235 wsListUrlPanel.setLayout(new BorderLayout());
236 // wsListUrlPanel.setPreferredSize(new Dimension(482,202));
237 wsListPane.setBorder(BorderFactory.createEtchedBorder());
238 wsListPane.getViewport().add(wsList);
239 wsListPane.setPreferredSize(new Dimension(380, 200));
240 wsList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
241 wsList.addMouseListener(new MouseListener()
244 public void mouseClicked(MouseEvent e)
246 if (e.getClickCount() > 1)
248 editWsUrl_actionPerformed(null);
253 public void mouseEntered(MouseEvent e)
258 public void mouseExited(MouseEvent e)
262 public void mousePressed(MouseEvent e)
267 public void mouseReleased(MouseEvent e)
273 // wsListButtons.setPreferredSize(new Dimension(480, 60));
274 wsListButtons.setLayout(new FlowLayout());
275 // wsListButtons.add(moveWsUrlUp);
276 // wsListButtons.add(moveWsUrlDown);
277 wsListButtons.add(newWsUrl);
278 wsListButtons.add(editWsUrl);
279 wsListButtons.add(deleteWsUrl);
280 wsListNavButs.setSize(new Dimension(80, 80));
281 wsListNavButs.setPreferredSize(new Dimension(80, 80));
282 wsListNavButs.setLayout(new FlowLayout());
283 wsListNavButs.add(moveWsUrlUp);
284 wsListNavButs.add(moveWsUrlDown);
285 wsListUrlPanel.add(wsListPane, BorderLayout.EAST);
286 wsListUrlPanel.add(wsListNavButs, BorderLayout.WEST);
287 wsListPanel.setBorder(wsListTitleBorder);
288 wsListPanel.setLayout(new BorderLayout());
289 wsListPanel.add(wsListUrlPanel, BorderLayout.NORTH);
290 wsListPanel.add(wsListButtons, BorderLayout.SOUTH);
291 wsMenuButtons.setLayout(new GridLayout(2, 3));
292 wsMenuButtons.add(indexByHost);
293 wsMenuButtons.add(indexByType);
294 wsMenuButtons.add(enableJws1Services);
295 wsMenuButtons.add(enableJws2Services);
296 wsMenuButtons.add(enableEnfinServices);
297 wsMenuRefreshButs.setLayout(new FlowLayout());
298 wsMenuRefreshButs.setPreferredSize(new Dimension(480, 30));
299 wsMenuRefreshButs.setSize(new Dimension(480, 30));
300 wsMenuRefreshButs.add(refreshWs, null);
301 wsMenuRefreshButs.add(resetWs, null);
302 wsMenuRefreshButs.add(progressBar, null);
303 myBorderlayout.setHgap(3);
304 add(wsListPanel, BorderLayout.NORTH);
305 add(wsMenuButtons, BorderLayout.CENTER);
306 add(wsMenuRefreshButs, BorderLayout.SOUTH);
309 protected void resetWs_actionPerformed(ActionEvent e)
314 protected void indexByType_actionPerformed(ActionEvent e)
319 protected void indexByHost_actionPerformed(ActionEvent e)
324 protected void newWsUrl_actionPerformed(ActionEvent e)
329 protected void editWsUrl_actionPerformed(ActionEvent e)
334 protected void deleteWsUrl_actionPerformed(ActionEvent e)
339 protected void moveWsUrlUp_actionPerformed(ActionEvent e)
344 protected void moveWsUrlDown_actionPerformed(ActionEvent e)
349 protected void enableEnfinServices_actionPerformed(ActionEvent e)
354 protected void enableJws2Services_actionPerformed(ActionEvent e)
359 protected void enableJws1Services_actionPerformed(ActionEvent e)
364 protected void refreshWs_actionPerformed(ActionEvent e)