apply jalview code style
[jalview.git] / src / jalview / jbgui / GWsPreferences.java
1 /*
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
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 of the License, or (at your option) any later version.
10  * 
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.
15  * 
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  */
18 package jalview.jbgui;
19
20 import java.awt.BorderLayout;
21 import java.awt.Dimension;
22 import java.awt.FlowLayout;
23 import java.awt.Font;
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;
30
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;
41
42 /**
43  * Preference dialog for jalview web services
44  * 
45  * @author JimP
46  */
47 public class GWsPreferences extends JPanel
48 {
49   protected JList wsList = new JList();
50
51   protected TitledBorder wsListTitleBorder = new TitledBorder(
52           "Web Service Discovery URLS");
53
54   protected JButton newWsUrl = new JButton();
55
56   protected JButton editWsUrl = new JButton();
57
58   protected JButton deleteWsUrl = new JButton();
59
60   protected JButton moveWsUrlUp = new JButton();
61
62   protected JButton moveWsUrlDown = new JButton();
63
64   protected JCheckBox indexByHost = new JCheckBox();
65
66   protected JCheckBox indexByType = new JCheckBox();
67
68   protected JCheckBox enableJws1Services = new JCheckBox();
69
70   protected JCheckBox enableJws2Services = new JCheckBox();
71
72   protected JCheckBox enableEnfinServices = new JCheckBox();
73
74   protected JButton refreshWs = new JButton();
75
76   protected JButton resetWs = new JButton();
77
78   protected JProgressBar progressBar = new JProgressBar();
79
80   JScrollPane wsListPane = new JScrollPane();
81
82   JPanel wsListUrlPanel = new JPanel();
83
84   JPanel wsListPanel = new JPanel();
85
86   JPanel wsListButtons = new JPanel();
87
88   JPanel wsListNavButs = new JPanel();
89
90   BorderLayout myBorderlayout = new BorderLayout();
91
92   BorderLayout wsListBorderlayout = new BorderLayout();
93
94   GridBagLayout wsPrefLayout = new GridBagLayout();
95
96   GridBagLayout wsListLayout = new GridBagLayout();
97
98   GridBagLayout wsMenuLayout = new GridBagLayout();
99
100   JPanel wsMenuButtons = new JPanel();
101
102   JPanel wsMenuRefreshButs = new JPanel();
103
104   public GWsPreferences()
105   {
106     jbInit();
107   }
108
109   private void jbInit()
110   {
111
112     refreshWs.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
113     refreshWs.setText("Refresh Services");
114     refreshWs.addActionListener(new ActionListener()
115     {
116       public void actionPerformed(ActionEvent e)
117       {
118         refreshWs_actionPerformed(e);
119       }
120     });
121     resetWs.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
122     resetWs.setText("Reset Services");
123
124     resetWs.addActionListener(new ActionListener()
125     {
126       public void actionPerformed(ActionEvent e)
127       {
128         resetWs_actionPerformed(e);
129       }
130     });
131     indexByHost.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
132     indexByHost.setText("Index by host");
133     indexByHost
134             .setToolTipText("Index web services in menu by the host site.");
135     indexByHost.addActionListener(new ActionListener()
136     {
137       public void actionPerformed(ActionEvent e)
138       {
139         indexByHost_actionPerformed(e);
140       }
141     });
142     indexByType.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
143     indexByType.setText("Index by type");
144     indexByType.addActionListener(new ActionListener()
145     {
146       public void actionPerformed(ActionEvent e)
147       {
148         indexByType_actionPerformed(e);
149       }
150     });
151     enableEnfinServices
152             .setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
153     enableEnfinServices.setText("Enable Enfin Services");
154     enableEnfinServices.addActionListener(new ActionListener()
155     {
156       public void actionPerformed(ActionEvent e)
157       {
158         enableEnfinServices_actionPerformed(e);
159       }
160     });
161     enableJws2Services
162             .setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
163     enableJws2Services.setText("Enable JABAWS Services");
164     enableJws2Services.addActionListener(new ActionListener()
165     {
166       public void actionPerformed(ActionEvent e)
167       {
168         enableJws2Services_actionPerformed(e);
169       }
170     });
171     enableJws1Services
172             .setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
173     enableJws1Services.setText("Enable Legacy Services");
174     enableJws1Services.addActionListener(new ActionListener()
175     {
176       public void actionPerformed(ActionEvent e)
177       {
178         enableJws1Services_actionPerformed(e);
179       }
180     });
181     newWsUrl.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
182     newWsUrl.setText("New Service URL");
183     newWsUrl.addActionListener(new ActionListener()
184     {
185       public void actionPerformed(ActionEvent e)
186       {
187         newWsUrl_actionPerformed(e);
188       }
189     });
190     editWsUrl.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
191     editWsUrl.setText("Edit Service URL");
192     editWsUrl.addActionListener(new ActionListener()
193     {
194       public void actionPerformed(ActionEvent e)
195       {
196         editWsUrl_actionPerformed(e);
197       }
198     });
199
200     deleteWsUrl.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
201     deleteWsUrl.setText("Delete Service URL");
202     deleteWsUrl.addActionListener(new ActionListener()
203     {
204       public void actionPerformed(ActionEvent e)
205       {
206         deleteWsUrl_actionPerformed(e);
207       }
208     });
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()
213     {
214       public void actionPerformed(ActionEvent e)
215       {
216         moveWsUrlUp_actionPerformed(e);
217       }
218     });
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()
223     {
224       public void actionPerformed(ActionEvent e)
225       {
226         moveWsUrlDown_actionPerformed(e);
227       }
228     });
229
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()
242     {
243
244       public void mouseClicked(MouseEvent e)
245       {
246         if (e.getClickCount() > 1)
247         {
248           editWsUrl_actionPerformed(null);
249         }
250
251       }
252
253       public void mouseEntered(MouseEvent e)
254       {
255
256       }
257
258       public void mouseExited(MouseEvent e)
259       {
260       }
261
262       public void mousePressed(MouseEvent e)
263       {
264
265       }
266
267       public void mouseReleased(MouseEvent e)
268       {
269
270       }
271
272     });
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);
307   }
308
309   protected void resetWs_actionPerformed(ActionEvent e)
310   {
311
312   }
313
314   protected void indexByType_actionPerformed(ActionEvent e)
315   {
316
317   }
318
319   protected void indexByHost_actionPerformed(ActionEvent e)
320   {
321
322   }
323
324   protected void newWsUrl_actionPerformed(ActionEvent e)
325   {
326
327   }
328
329   protected void editWsUrl_actionPerformed(ActionEvent e)
330   {
331
332   }
333
334   protected void deleteWsUrl_actionPerformed(ActionEvent e)
335   {
336
337   }
338
339   protected void moveWsUrlUp_actionPerformed(ActionEvent e)
340   {
341
342   }
343
344   protected void moveWsUrlDown_actionPerformed(ActionEvent e)
345   {
346
347   }
348
349   protected void enableEnfinServices_actionPerformed(ActionEvent e)
350   {
351
352   }
353
354   protected void enableJws2Services_actionPerformed(ActionEvent e)
355   {
356
357   }
358
359   protected void enableJws1Services_actionPerformed(ActionEvent e)
360   {
361
362   }
363
364   protected void refreshWs_actionPerformed(ActionEvent e)
365   {
366
367   }
368
369 }