Class |
Line # |
Actions |
|||
---|---|---|---|---|---|
GWsPreferences | 54 | 130 | 44 |
1 | /* | |
2 | * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) | |
3 | * Copyright (C) $$Year-Rel$$ The Jalview Authors | |
4 | * | |
5 | * This file is part of Jalview. | |
6 | * | |
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. | |
11 | * | |
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. | |
16 | * | |
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. | |
20 | */ | |
21 | package jalview.jbgui; | |
22 | ||
23 | import jalview.bin.Cache; | |
24 | import jalview.util.MessageManager; | |
25 | ||
26 | import java.awt.BorderLayout; | |
27 | import java.awt.Dimension; | |
28 | import java.awt.FlowLayout; | |
29 | import java.awt.Font; | |
30 | import java.awt.GridBagLayout; | |
31 | import java.awt.GridLayout; | |
32 | import java.awt.event.ActionEvent; | |
33 | import java.awt.event.ActionListener; | |
34 | import java.awt.event.MouseEvent; | |
35 | import java.awt.event.MouseListener; | |
36 | ||
37 | import javax.swing.BorderFactory; | |
38 | import javax.swing.JButton; | |
39 | import javax.swing.JCheckBox; | |
40 | import javax.swing.JList; | |
41 | import javax.swing.JPanel; | |
42 | import javax.swing.JProgressBar; | |
43 | import javax.swing.JScrollPane; | |
44 | import javax.swing.JTabbedPane; | |
45 | import javax.swing.JTable; | |
46 | import javax.swing.ListSelectionModel; | |
47 | import javax.swing.border.TitledBorder; | |
48 | ||
49 | /** | |
50 | * Preference dialog for jalview web services | |
51 | * | |
52 | * @author JimP | |
53 | */ | |
54 | public class GWsPreferences extends JPanel | |
55 | { | |
56 | protected JList sbrsList = new JList(); | |
57 | ||
58 | protected TitledBorder sbrsListTitleBorder = new TitledBorder( | |
59 | MessageManager | |
60 | .getString("label.simple_bioinformatics_rest_services")); | |
61 | ||
62 | protected JButton newSbrsUrl = new JButton(); | |
63 | ||
64 | protected JButton editSbrsUrl = new JButton(); | |
65 | ||
66 | protected JButton deleteSbrsUrl = new JButton(); | |
67 | ||
68 | // Web service status and url table | |
69 | protected JTable wsList = new JTable(); | |
70 | ||
71 | protected TitledBorder wsListTitleBorder = new TitledBorder( | |
72 | MessageManager.getString("label.web_service_discovery_urls")); | |
73 | ||
74 | protected JButton newWsUrl = new JButton(); | |
75 | ||
76 | protected JButton editWsUrl = new JButton(); | |
77 | ||
78 | protected JButton deleteWsUrl = new JButton(); | |
79 | ||
80 | protected JButton moveWsUrlUp = new JButton(); | |
81 | ||
82 | protected JButton moveWsUrlDown = new JButton(); | |
83 | ||
84 | protected JCheckBox indexByHost = new JCheckBox(); | |
85 | ||
86 | protected JCheckBox indexByType = new JCheckBox(); | |
87 | ||
88 | protected JCheckBox enableJws2Services = new JCheckBox(); | |
89 | ||
90 | protected JCheckBox enableEnfinServices = new JCheckBox(); | |
91 | ||
92 | protected JCheckBox displayWsWarning = new JCheckBox(); | |
93 | ||
94 | protected JButton refreshWs = new JButton(); | |
95 | ||
96 | protected JButton resetWs = new JButton(); | |
97 | ||
98 | protected JProgressBar progressBar = new JProgressBar(); | |
99 | ||
100 | JScrollPane wsListPane = new JScrollPane(); | |
101 | ||
102 | JPanel wsListUrlPanel = new JPanel(); | |
103 | ||
104 | JPanel wsListPanel = new JPanel(); | |
105 | ||
106 | JPanel wsListButtons = new JPanel(); | |
107 | ||
108 | JPanel wsListNavButs = new JPanel(); | |
109 | ||
110 | JScrollPane srbsListPane = new JScrollPane(); | |
111 | ||
112 | JPanel srbsListUrlPanel = new JPanel(); | |
113 | ||
114 | JPanel srbsListPanel = new JPanel(); | |
115 | ||
116 | JPanel srbsListButtons = new JPanel(); | |
117 | ||
118 | JPanel srbsListNavButs = new JPanel(); | |
119 | ||
120 | BorderLayout myBorderlayout = new BorderLayout(); | |
121 | ||
122 | BorderLayout wsListBorderlayout = new BorderLayout(); | |
123 | ||
124 | BorderLayout srbsListBorderlayout = new BorderLayout(); | |
125 | ||
126 | GridBagLayout wsPrefLayout = new GridBagLayout(); | |
127 | ||
128 | GridBagLayout wsListLayout = new GridBagLayout(); | |
129 | ||
130 | GridBagLayout srbsListLayout = new GridBagLayout(); | |
131 | ||
132 | GridBagLayout wsMenuLayout = new GridBagLayout(); | |
133 | ||
134 | JPanel wsMenuButtons = new JPanel(); | |
135 | ||
136 | JPanel wsMenuRefreshButs = new JPanel(); | |
137 | ||
138 | 0 | public GWsPreferences() |
139 | { | |
140 | 0 | jbInit(); |
141 | } | |
142 | ||
143 | 0 | private void jbInit() |
144 | { | |
145 | ||
146 | 0 | refreshWs.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10)); |
147 | 0 | refreshWs.setText(MessageManager.getString("action.refresh_services")); |
148 | 0 | refreshWs.addActionListener(new ActionListener() |
149 | { | |
150 | 0 | @Override |
151 | public void actionPerformed(ActionEvent e) | |
152 | { | |
153 | 0 | refreshWs_actionPerformed(e); |
154 | } | |
155 | }); | |
156 | 0 | resetWs.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10)); |
157 | 0 | resetWs.setText(MessageManager.getString("action.reset_services")); |
158 | ||
159 | 0 | resetWs.addActionListener(new ActionListener() |
160 | { | |
161 | 0 | @Override |
162 | public void actionPerformed(ActionEvent e) | |
163 | { | |
164 | 0 | resetWs_actionPerformed(e); |
165 | } | |
166 | }); | |
167 | 0 | indexByHost.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10)); |
168 | 0 | indexByHost.setText(MessageManager.getString("label.index_by_host")); |
169 | 0 | indexByHost.setToolTipText(MessageManager |
170 | .getString("label.index_web_services_menu_by_host_site")); | |
171 | 0 | indexByHost.addActionListener(new ActionListener() |
172 | { | |
173 | 0 | @Override |
174 | public void actionPerformed(ActionEvent e) | |
175 | { | |
176 | 0 | indexByHost_actionPerformed(e); |
177 | } | |
178 | }); | |
179 | 0 | indexByType.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10)); |
180 | 0 | indexByType.setText(MessageManager.getString("label.index_by_type")); |
181 | 0 | indexByType.addActionListener(new ActionListener() |
182 | { | |
183 | 0 | @Override |
184 | public void actionPerformed(ActionEvent e) | |
185 | { | |
186 | 0 | indexByType_actionPerformed(e); |
187 | } | |
188 | }); | |
189 | 0 | enableJws2Services |
190 | .setFont(new java.awt.Font("Verdana", Font.PLAIN, 10)); | |
191 | 0 | enableJws2Services.setText( |
192 | MessageManager.getString("label.enable_jabaws_services")); | |
193 | 0 | enableJws2Services.addActionListener(new ActionListener() |
194 | { | |
195 | 0 | @Override |
196 | public void actionPerformed(ActionEvent e) | |
197 | { | |
198 | 0 | enableJws2Services_actionPerformed(e); |
199 | } | |
200 | }); | |
201 | 0 | displayWsWarning.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10)); |
202 | 0 | displayWsWarning |
203 | .setText(MessageManager.getString("label.display_warnings")); | |
204 | 0 | displayWsWarning.setToolTipText("<html>" + MessageManager.getString( |
205 | "label.option_want_informed_web_service_URL_cannot_be_accessed_jalview_when_starts_up")); | |
206 | 0 | displayWsWarning.addActionListener(new ActionListener() |
207 | { | |
208 | 0 | @Override |
209 | public void actionPerformed(ActionEvent e) | |
210 | { | |
211 | 0 | displayWsWarning_actionPerformed(e); |
212 | } | |
213 | }); | |
214 | 0 | newWsUrl.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10)); |
215 | 0 | newWsUrl.setText(MessageManager.getString("label.new_service_url")); |
216 | 0 | newWsUrl.addActionListener(new ActionListener() |
217 | { | |
218 | 0 | @Override |
219 | public void actionPerformed(ActionEvent e) | |
220 | { | |
221 | 0 | newWsUrl_actionPerformed(e); |
222 | } | |
223 | }); | |
224 | 0 | editWsUrl.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10)); |
225 | 0 | editWsUrl.setText(MessageManager.getString("label.edit_service_url")); |
226 | 0 | editWsUrl.addActionListener(new ActionListener() |
227 | { | |
228 | 0 | @Override |
229 | public void actionPerformed(ActionEvent e) | |
230 | { | |
231 | 0 | editWsUrl_actionPerformed(e); |
232 | } | |
233 | }); | |
234 | ||
235 | 0 | deleteWsUrl.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10)); |
236 | 0 | deleteWsUrl |
237 | .setText(MessageManager.getString("label.delete_service_url")); | |
238 | 0 | deleteWsUrl.addActionListener(new ActionListener() |
239 | { | |
240 | 0 | @Override |
241 | public void actionPerformed(ActionEvent e) | |
242 | { | |
243 | 0 | deleteWsUrl_actionPerformed(e); |
244 | } | |
245 | }); | |
246 | 0 | moveWsUrlUp.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10)); |
247 | 0 | moveWsUrlUp.setText(MessageManager.getString("action.move_up")); |
248 | 0 | moveWsUrlUp |
249 | .setToolTipText(MessageManager.getString("label.move_url_up")); | |
250 | 0 | moveWsUrlUp.addActionListener(new ActionListener() |
251 | { | |
252 | 0 | @Override |
253 | public void actionPerformed(ActionEvent e) | |
254 | { | |
255 | 0 | moveWsUrlUp_actionPerformed(e); |
256 | } | |
257 | }); | |
258 | 0 | moveWsUrlDown.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10)); |
259 | 0 | moveWsUrlDown.setText(MessageManager.getString("action.move_down")); |
260 | 0 | moveWsUrlDown.setToolTipText( |
261 | MessageManager.getString("label.move_url_down")); | |
262 | 0 | moveWsUrlDown.addActionListener(new ActionListener() |
263 | { | |
264 | 0 | @Override |
265 | public void actionPerformed(ActionEvent e) | |
266 | { | |
267 | 0 | moveWsUrlDown_actionPerformed(e); |
268 | } | |
269 | }); | |
270 | 0 | newSbrsUrl.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10)); |
271 | 0 | newSbrsUrl |
272 | .setText(MessageManager.getString("label.add_sbrs_definition")); | |
273 | 0 | newSbrsUrl.addActionListener(new ActionListener() |
274 | { | |
275 | 0 | @Override |
276 | public void actionPerformed(ActionEvent e) | |
277 | { | |
278 | 0 | newSbrsUrl_actionPerformed(e); |
279 | } | |
280 | }); | |
281 | 0 | editSbrsUrl.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10)); |
282 | 0 | editSbrsUrl.setText( |
283 | MessageManager.getString("label.edit_sbrs_definition")); | |
284 | 0 | editSbrsUrl.addActionListener(new ActionListener() |
285 | { | |
286 | 0 | @Override |
287 | public void actionPerformed(ActionEvent e) | |
288 | { | |
289 | 0 | editSbrsUrl_actionPerformed(e); |
290 | } | |
291 | }); | |
292 | ||
293 | 0 | deleteSbrsUrl.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10)); |
294 | 0 | deleteSbrsUrl.setText( |
295 | MessageManager.getString("label.delete_sbrs_definition")); | |
296 | 0 | deleteSbrsUrl.addActionListener(new ActionListener() |
297 | { | |
298 | 0 | @Override |
299 | public void actionPerformed(ActionEvent e) | |
300 | { | |
301 | 0 | deleteSbrsUrl_actionPerformed(e); |
302 | } | |
303 | }); | |
304 | ||
305 | 0 | setLayout(myBorderlayout); |
306 | 0 | setPreferredSize(new Dimension(500, 400)); |
307 | 0 | progressBar.setPreferredSize(new Dimension(450, 20)); |
308 | 0 | progressBar.setString(""); |
309 | 0 | wsListUrlPanel.setBorder(BorderFactory.createEtchedBorder()); |
310 | 0 | wsListUrlPanel.setLayout(new BorderLayout()); |
311 | 0 | wsListPane.setBorder(BorderFactory.createEtchedBorder()); |
312 | 0 | wsList.setPreferredSize(new Dimension(482, 202)); |
313 | 0 | wsList.getTableHeader().setReorderingAllowed(false); |
314 | 0 | wsListPane.getViewport().add(wsList); |
315 | 0 | wsListPane.setPreferredSize(new Dimension(380, 80)); |
316 | 0 | wsList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); |
317 | 0 | wsList.setColumnSelectionAllowed(false); |
318 | 0 | wsList.addMouseListener(new MouseListener() |
319 | { | |
320 | ||
321 | 0 | @Override |
322 | public void mouseClicked(MouseEvent e) | |
323 | { | |
324 | 0 | if (e.getClickCount() > 1) |
325 | { | |
326 | 0 | editWsUrl_actionPerformed(null); |
327 | } | |
328 | ||
329 | } | |
330 | ||
331 | 0 | @Override |
332 | public void mouseEntered(MouseEvent e) | |
333 | { | |
334 | ||
335 | } | |
336 | ||
337 | 0 | @Override |
338 | public void mouseExited(MouseEvent e) | |
339 | { | |
340 | } | |
341 | ||
342 | 0 | @Override |
343 | public void mousePressed(MouseEvent e) | |
344 | { | |
345 | ||
346 | } | |
347 | ||
348 | 0 | @Override |
349 | public void mouseReleased(MouseEvent e) | |
350 | { | |
351 | ||
352 | } | |
353 | ||
354 | }); | |
355 | 0 | wsListButtons.setLayout(new FlowLayout()); |
356 | 0 | wsListButtons.add(newWsUrl); |
357 | 0 | wsListButtons.add(editWsUrl); |
358 | 0 | wsListButtons.add(deleteWsUrl); |
359 | 0 | wsListButtons.setMinimumSize(new Dimension(350, 80)); |
360 | 0 | wsListNavButs.setSize(new Dimension(80, 80)); |
361 | 0 | wsListNavButs.setPreferredSize(new Dimension(80, 80)); |
362 | 0 | wsListNavButs.setLayout(new FlowLayout()); |
363 | 0 | wsListNavButs.add(moveWsUrlUp); |
364 | 0 | wsListNavButs.add(moveWsUrlDown); |
365 | 0 | wsListUrlPanel.add(wsListPane, BorderLayout.CENTER); |
366 | 0 | wsListUrlPanel.add(wsListNavButs, BorderLayout.WEST); |
367 | 0 | wsListPanel.setBorder(wsListTitleBorder); |
368 | 0 | wsListPanel.setLayout(new BorderLayout()); |
369 | 0 | wsListPanel.add(wsListUrlPanel, BorderLayout.NORTH); |
370 | 0 | wsListPanel.add(wsListButtons, BorderLayout.SOUTH); |
371 | ||
372 | 0 | srbsListUrlPanel.setBorder(BorderFactory.createEtchedBorder()); |
373 | 0 | srbsListUrlPanel.setLayout(new BorderLayout()); |
374 | 0 | srbsListPane.setBorder(BorderFactory.createEtchedBorder()); |
375 | 0 | srbsListPane.getViewport().add(sbrsList); |
376 | 0 | sbrsList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); |
377 | 0 | sbrsList.addMouseListener(new MouseListener() |
378 | { | |
379 | ||
380 | 0 | @Override |
381 | public void mouseClicked(MouseEvent e) | |
382 | { | |
383 | 0 | if (e.getClickCount() > 1) |
384 | { | |
385 | 0 | editSbrsUrl_actionPerformed(null); |
386 | } | |
387 | ||
388 | } | |
389 | ||
390 | 0 | @Override |
391 | public void mouseEntered(MouseEvent e) | |
392 | { | |
393 | ||
394 | } | |
395 | ||
396 | 0 | @Override |
397 | public void mouseExited(MouseEvent e) | |
398 | { | |
399 | } | |
400 | ||
401 | 0 | @Override |
402 | public void mousePressed(MouseEvent e) | |
403 | { | |
404 | ||
405 | } | |
406 | ||
407 | 0 | @Override |
408 | public void mouseReleased(MouseEvent e) | |
409 | { | |
410 | ||
411 | } | |
412 | ||
413 | }); | |
414 | 0 | srbsListButtons.setLayout(new FlowLayout()); |
415 | 0 | srbsListButtons.add(newSbrsUrl); |
416 | 0 | srbsListButtons.add(editSbrsUrl); |
417 | 0 | srbsListButtons.add(deleteSbrsUrl); |
418 | 0 | srbsListUrlPanel.add(srbsListPane, BorderLayout.CENTER); |
419 | 0 | srbsListPanel.setBorder(sbrsListTitleBorder); |
420 | 0 | srbsListPanel.setLayout(new BorderLayout()); |
421 | 0 | srbsListPanel.add(srbsListUrlPanel, BorderLayout.NORTH); |
422 | 0 | srbsListPanel.add(srbsListButtons, BorderLayout.CENTER); |
423 | ||
424 | 0 | wsMenuButtons.setLayout(new GridLayout(2, 3)); |
425 | 0 | wsMenuButtons.add(indexByHost); |
426 | 0 | wsMenuButtons.add(indexByType); |
427 | 0 | wsMenuButtons.add(enableJws2Services); |
428 | 0 | wsMenuButtons.add(displayWsWarning); |
429 | 0 | wsMenuRefreshButs.setLayout(new FlowLayout()); |
430 | 0 | wsMenuRefreshButs.setPreferredSize(new Dimension(480, 30)); |
431 | 0 | wsMenuRefreshButs.setSize(new Dimension(480, 30)); |
432 | 0 | wsMenuRefreshButs.add(refreshWs, null); |
433 | 0 | wsMenuRefreshButs.add(resetWs, null); |
434 | 0 | wsMenuRefreshButs.add(progressBar, null); |
435 | 0 | myBorderlayout.setHgap(3); |
436 | 0 | if (Cache.getDefault("ENABLE_RSBS_EDITOR", false)) |
437 | { | |
438 | 0 | JTabbedPane listPanels = new JTabbedPane(); |
439 | 0 | listPanels.addTab("JABAWS Servers", wsListPanel); |
440 | 0 | listPanels.addTab("RSB Services", srbsListPanel); |
441 | 0 | add(listPanels, BorderLayout.NORTH); |
442 | } | |
443 | else | |
444 | { | |
445 | 0 | add(wsListPanel, BorderLayout.NORTH); |
446 | } | |
447 | 0 | add(wsMenuButtons, BorderLayout.CENTER); |
448 | 0 | add(wsMenuRefreshButs, BorderLayout.SOUTH); |
449 | } | |
450 | ||
451 | 0 | protected void deleteSbrsUrl_actionPerformed(ActionEvent e) |
452 | { | |
453 | // TODO Auto-generated method stub | |
454 | ||
455 | } | |
456 | ||
457 | 0 | protected void editSbrsUrl_actionPerformed(ActionEvent e) |
458 | { | |
459 | // TODO Auto-generated method stub | |
460 | ||
461 | } | |
462 | ||
463 | 0 | protected void newSbrsUrl_actionPerformed(ActionEvent e) |
464 | { | |
465 | // TODO Auto-generated method stub | |
466 | ||
467 | } | |
468 | ||
469 | 0 | protected void displayWsWarning_actionPerformed(ActionEvent e) |
470 | { | |
471 | // TODO Auto-generated method stub | |
472 | ||
473 | } | |
474 | ||
475 | 0 | protected void resetWs_actionPerformed(ActionEvent e) |
476 | { | |
477 | ||
478 | } | |
479 | ||
480 | 0 | protected void indexByType_actionPerformed(ActionEvent e) |
481 | { | |
482 | ||
483 | } | |
484 | ||
485 | 0 | protected void indexByHost_actionPerformed(ActionEvent e) |
486 | { | |
487 | ||
488 | } | |
489 | ||
490 | 0 | protected void newWsUrl_actionPerformed(ActionEvent e) |
491 | { | |
492 | ||
493 | } | |
494 | ||
495 | 0 | protected void editWsUrl_actionPerformed(ActionEvent e) |
496 | { | |
497 | ||
498 | } | |
499 | ||
500 | 0 | protected void deleteWsUrl_actionPerformed(ActionEvent e) |
501 | { | |
502 | ||
503 | } | |
504 | ||
505 | 0 | protected void moveWsUrlUp_actionPerformed(ActionEvent e) |
506 | { | |
507 | ||
508 | } | |
509 | ||
510 | 0 | protected void moveWsUrlDown_actionPerformed(ActionEvent e) |
511 | { | |
512 | ||
513 | } | |
514 | ||
515 | 0 | protected void enableEnfinServices_actionPerformed(ActionEvent e) |
516 | { | |
517 | ||
518 | } | |
519 | ||
520 | 0 | protected void enableJws2Services_actionPerformed(ActionEvent e) |
521 | { | |
522 | ||
523 | } | |
524 | ||
525 | 0 | protected void refreshWs_actionPerformed(ActionEvent e) |
526 | { | |
527 | ||
528 | } | |
529 | ||
530 | } |