Jalview 2.6 source licence
[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   protected JButton resetWs = new JButton();
76   
77   protected JProgressBar progressBar = new JProgressBar();
78
79   JScrollPane wsListPane = new JScrollPane();
80   
81   JPanel wsListUrlPanel = new JPanel();
82   
83   JPanel wsListPanel = new JPanel();
84
85   JPanel wsListButtons = new JPanel();
86   
87   JPanel wsListNavButs = new JPanel();
88
89   BorderLayout myBorderlayout = new BorderLayout();
90
91   BorderLayout wsListBorderlayout = new BorderLayout();
92
93   GridBagLayout wsPrefLayout = new GridBagLayout();
94
95   GridBagLayout wsListLayout = new GridBagLayout();
96
97   GridBagLayout wsMenuLayout = new GridBagLayout();
98
99   JPanel wsMenuButtons = new JPanel();
100   JPanel wsMenuRefreshButs = new JPanel();
101   public GWsPreferences()
102   {
103     jbInit();
104   }
105
106   private void jbInit()
107   {
108
109     refreshWs.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
110     refreshWs.setText("Refresh Services");
111     refreshWs.addActionListener(new ActionListener()
112     {
113       public void actionPerformed(ActionEvent e)
114       {
115         refreshWs_actionPerformed(e);
116       }
117     });
118     resetWs.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
119     resetWs.setText("Reset Services");
120     
121     resetWs.addActionListener(new ActionListener()
122     {
123       public void actionPerformed(ActionEvent e)
124       {
125         resetWs_actionPerformed(e);
126       }
127     });
128     indexByHost.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
129     indexByHost.setText("Index by host");
130     indexByHost
131             .setToolTipText("Index web services in menu by the host site.");
132     indexByHost.addActionListener(new ActionListener()
133     {
134       public void actionPerformed(ActionEvent e)
135       {
136         indexByHost_actionPerformed(e);
137       }
138     });
139     indexByType.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
140     indexByType.setText("Index by type");
141     indexByType.addActionListener(new ActionListener()
142     {
143       public void actionPerformed(ActionEvent e)
144       {
145         indexByType_actionPerformed(e);
146       }
147     });
148     enableEnfinServices
149             .setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
150     enableEnfinServices.setText("Enable Enfin Services");
151     enableEnfinServices.addActionListener(new ActionListener()
152     {
153       public void actionPerformed(ActionEvent e)
154       {
155         enableEnfinServices_actionPerformed(e);
156       }
157     });
158     enableJws2Services
159             .setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
160     enableJws2Services.setText("Enable JABAWS Services");
161     enableJws2Services.addActionListener(new ActionListener()
162     {
163       public void actionPerformed(ActionEvent e)
164       {
165         enableJws2Services_actionPerformed(e);
166       }
167     });
168     enableJws1Services
169             .setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
170     enableJws1Services.setText("Enable Legacy Services");
171     enableJws1Services.addActionListener(new ActionListener()
172     {
173       public void actionPerformed(ActionEvent e)
174       {
175         enableJws1Services_actionPerformed(e);
176       }
177     });
178     newWsUrl.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
179     newWsUrl.setText("New Service URL");
180     newWsUrl.addActionListener(new ActionListener()
181     {
182       public void actionPerformed(ActionEvent e)
183       {
184         newWsUrl_actionPerformed(e);
185       }
186     });
187     editWsUrl.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
188     editWsUrl.setText("Edit Service URL");
189     editWsUrl.addActionListener(new ActionListener()
190     {
191       public void actionPerformed(ActionEvent e)
192       {
193         editWsUrl_actionPerformed(e);
194       }
195     });
196
197     deleteWsUrl.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
198     deleteWsUrl.setText("Delete Service URL");
199     deleteWsUrl.addActionListener(new ActionListener()
200     {
201       public void actionPerformed(ActionEvent e)
202       {
203         deleteWsUrl_actionPerformed(e);
204       }
205     });
206     moveWsUrlUp.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
207     moveWsUrlUp.setText("Up");
208     moveWsUrlUp.setToolTipText("Move URL up");
209     moveWsUrlUp.addActionListener(new ActionListener()
210     {
211       public void actionPerformed(ActionEvent e)
212       {
213         moveWsUrlUp_actionPerformed(e);
214       }
215     });
216     moveWsUrlDown.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));
217     moveWsUrlDown.setText("Down");
218     moveWsUrlDown.setToolTipText("Move URL Down");
219     moveWsUrlDown.addActionListener(new ActionListener()
220     {
221       public void actionPerformed(ActionEvent e)
222       {
223         moveWsUrlDown_actionPerformed(e);
224       }
225     });
226
227     setLayout(myBorderlayout);
228     setPreferredSize(new Dimension(500,400));
229     progressBar.setPreferredSize(new Dimension(450, 20));
230     progressBar.setString("");
231     wsListUrlPanel.setBorder(BorderFactory.createEtchedBorder());
232     wsListUrlPanel.setLayout(new BorderLayout());
233 //    wsListUrlPanel.setPreferredSize(new Dimension(482,202));
234     wsListPane.setBorder(BorderFactory.createEtchedBorder());
235     wsListPane.getViewport().add(wsList);
236     wsListPane.setPreferredSize(new Dimension(380, 200));
237     wsList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
238     wsList.addMouseListener(new MouseListener() {
239
240       public void mouseClicked(MouseEvent e)
241       {
242         if (e.getClickCount()>1)
243         {
244           editWsUrl_actionPerformed(null);
245         }
246         
247       }
248
249       public void mouseEntered(MouseEvent e)
250       {
251         
252       }
253
254       public void mouseExited(MouseEvent e)
255       {
256       }
257
258       public void mousePressed(MouseEvent e)
259       {
260         
261       }
262
263       public void mouseReleased(MouseEvent e)
264       {
265         
266       }
267       
268     });
269 //    wsListButtons.setPreferredSize(new Dimension(480, 60));
270     wsListButtons.setLayout(new FlowLayout());
271     //wsListButtons.add(moveWsUrlUp);
272     //wsListButtons.add(moveWsUrlDown);
273     wsListButtons.add(newWsUrl);
274     wsListButtons.add(editWsUrl);
275     wsListButtons.add(deleteWsUrl);
276     wsListNavButs.setSize(new Dimension(80,80));
277     wsListNavButs.setPreferredSize(new Dimension(80,80));
278     wsListNavButs.setLayout(new FlowLayout());
279     wsListNavButs.add(moveWsUrlUp);
280     wsListNavButs.add(moveWsUrlDown);
281     wsListUrlPanel.add(wsListPane,BorderLayout.EAST);
282     wsListUrlPanel.add(wsListNavButs,BorderLayout.WEST);
283     wsListPanel.setBorder(wsListTitleBorder);
284     wsListPanel.setLayout(new BorderLayout());
285     wsListPanel.add(wsListUrlPanel, BorderLayout.NORTH);
286     wsListPanel.add(wsListButtons, BorderLayout.SOUTH);
287     wsMenuButtons.setLayout(new GridLayout(2,3));
288     wsMenuButtons.add(indexByHost);
289     wsMenuButtons.add(indexByType);
290     wsMenuButtons.add(enableJws1Services);
291     wsMenuButtons.add(enableJws2Services);
292     wsMenuButtons.add(enableEnfinServices);
293     wsMenuRefreshButs.setLayout(new FlowLayout());
294     wsMenuRefreshButs.setPreferredSize(new Dimension(480,30));
295     wsMenuRefreshButs.setSize(new Dimension(480,30));
296     wsMenuRefreshButs.add(refreshWs,null);
297     wsMenuRefreshButs.add(resetWs,null);
298     wsMenuRefreshButs.add(progressBar,null);
299     myBorderlayout.setHgap(3);
300     add(wsListPanel,BorderLayout.NORTH);
301     add(wsMenuButtons,BorderLayout.CENTER);
302     add(wsMenuRefreshButs, BorderLayout.SOUTH);
303   }
304
305   protected void resetWs_actionPerformed(ActionEvent e)
306   {
307     
308   }
309
310   protected void indexByType_actionPerformed(ActionEvent e)
311   {
312
313   }
314
315   protected void indexByHost_actionPerformed(ActionEvent e)
316   {
317
318   }
319
320   protected void newWsUrl_actionPerformed(ActionEvent e)
321   {
322
323   }
324
325   protected void editWsUrl_actionPerformed(ActionEvent e)
326   {
327
328   }
329
330   protected void deleteWsUrl_actionPerformed(ActionEvent e)
331   {
332
333   }
334
335   protected void moveWsUrlUp_actionPerformed(ActionEvent e)
336   {
337
338   }
339
340   protected void moveWsUrlDown_actionPerformed(ActionEvent e)
341   {
342
343   }
344
345   protected void enableEnfinServices_actionPerformed(ActionEvent e)
346   {
347
348   }
349
350   protected void enableJws2Services_actionPerformed(ActionEvent e)
351   {
352
353   }
354
355   protected void enableJws1Services_actionPerformed(ActionEvent e)
356   {
357
358   }
359
360   protected void refreshWs_actionPerformed(ActionEvent e)
361   {
362
363   }
364
365 }