Clover icon

Coverage Report

  1. Project Clover database Wed Nov 13 2024 18:27:33 GMT
  2. Package jalview.jbgui

File GRestServiceEditorPane.java

 

Coverage histogram

../../img/srcFileCovDistChart0.png
59% of files have more coverage

Code metrics

4
118
36
1
524
365
38
0.32
3.28
36
1.06

Classes

Class Line # Actions
GRestServiceEditorPane 46 118 38
0.00%
 

Contributing tests

No tests hitting this source file were found.

Source view

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.gui.JvSwingUtils;
24    import jalview.util.MessageManager;
25   
26    import java.awt.BorderLayout;
27    import java.awt.event.ActionEvent;
28    import java.awt.event.ActionListener;
29    import java.awt.event.MouseEvent;
30    import java.awt.event.MouseListener;
31   
32    import javax.swing.JButton;
33    import javax.swing.JCheckBox;
34    import javax.swing.JComboBox;
35    import javax.swing.JLabel;
36    import javax.swing.JList;
37    import javax.swing.JPanel;
38    import javax.swing.JScrollPane;
39    import javax.swing.JTabbedPane;
40    import javax.swing.JTextArea;
41    import javax.swing.ListSelectionModel;
42    import javax.swing.border.TitledBorder;
43   
44    import net.miginfocom.swing.MigLayout;
45   
 
46    public class GRestServiceEditorPane extends JPanel
47    {
48   
49    protected JTabbedPane panels;
50   
51    protected JPanel details, inputs, paste;
52   
53    protected JTextArea urldesc, url, urlsuff, name, descr, parseRes;
54   
55    protected JComboBox action, gapChar;
56   
57    JLabel acttype;
58   
59    protected JButton okButton;
60   
61    protected JButton cancelButton;
62   
63    JPanel svcattribs;
64   
65    JPanel status;
66   
67    protected JList iprms;
68   
69    protected JList rdata;
70   
71    JScrollPane iprmVp, rdataVp, parseResVp, urlVp, descrVp, urldescVp;
72   
73    JButton rdataAdd, rdataRem, rdataNdown, rdataNup;
74   
75    JButton iprmsAdd, iprmsRem;
76   
77    protected JCheckBox hSeparable;
78   
79    protected JCheckBox vSeparable;
80   
81    protected JPanel parseWarnings;
82   
 
83  0 toggle public GRestServiceEditorPane()
84    {
85  0 jbInit();
86    }
87   
 
88  0 toggle protected void jbInit()
89    {
90  0 details = new JPanel();
91  0 details.setName(MessageManager.getString("label.details"));
92  0 details.setLayout(new MigLayout());
93  0 inputs = new JPanel();
94  0 inputs.setName(MessageManager.getString("label.input_output"));
95  0 inputs.setLayout(new MigLayout("", "[grow 85,fill][]", ""));
96  0 paste = new JPanel();
97  0 paste.setName(MessageManager.getString("label.cut_paste"));
98  0 paste.setLayout(
99    new MigLayout("", "[grow 100, fill]", "[][grow 100,fill]"));
100   
101  0 panels = new JTabbedPane();
102  0 panels.addTab(details.getName(), details);
103  0 panels.addTab(inputs.getName(), inputs);
104  0 panels.addTab(paste.getName(), paste);
105   
106  0 JPanel cpanel;
107   
108    // Name and URL Panel
109  0 cpanel = details;
110  0 name = new JTextArea(1, 12);
111   
112  0 JvSwingUtils.mgAddtoLayout(cpanel,
113    MessageManager
114    .getString("label.short_descriptive_name_for_service"),
115    new JLabel(MessageManager.getString("label.name")), name,
116    "wrap");
117  0 action = new JComboBox();
118  0 JvSwingUtils.mgAddtoLayout(cpanel,
119    MessageManager.getString("label.function_service_performs"),
120    new JLabel(MessageManager.getString("label.service_action")),
121    action, "wrap");
122  0 descr = new JTextArea(4, 60);
123  0 descrVp = new JScrollPane();
124  0 descrVp.setViewportView(descr);
125  0 JvSwingUtils.mgAddtoLayout(cpanel,
126    MessageManager.getString("label.brief_description_service"),
127    new JLabel(MessageManager.getString("label.description")),
128    descrVp, "wrap");
129   
130  0 url = new JTextArea(2, 60);
131  0 urlVp = new JScrollPane();
132  0 urlVp.setViewportView(url);
133  0 JvSwingUtils.mgAddtoLayout(cpanel,
134    MessageManager.getString("label.url_post_data_service"),
135    new JLabel(MessageManager.getString("label.post_url")), urlVp,
136    "wrap");
137   
138  0 urlsuff = new JTextArea();
139  0 urlsuff.setColumns(60);
140   
141  0 JvSwingUtils.mgAddtoLayout(cpanel,
142    MessageManager.getString("label.optional_suffix"),
143    new JLabel(MessageManager.getString("label.url_suffix")),
144    urlsuff, "wrap");
145   
146    // input options
147    // details.add(cpanel = new JPanel(), BorderLayout.CENTER);
148    // cpanel.setLayout(new FlowLayout());
149  0 hSeparable = new JCheckBox(MessageManager.getString("label.per_seq"));
150  0 hSeparable.setToolTipText(JvSwingUtils.wrapTooltip(true,
151    MessageManager.getString("label.job_created_when_checked")));
152  0 hSeparable.addActionListener(new ActionListener()
153    {
154   
 
155  0 toggle @Override
156    public void actionPerformed(ActionEvent arg0)
157    {
158  0 hSeparable_actionPerformed(arg0);
159   
160    }
161    });
162  0 vSeparable = new JCheckBox(
163    MessageManager.getString("label.result_vertically_separable"));
164  0 vSeparable.setToolTipText(
165    JvSwingUtils.wrapTooltip(true, MessageManager.getString(
166    "label.when_checked_job_visible_region_and_results")));
167  0 vSeparable.addActionListener(new ActionListener()
168    {
169   
 
170  0 toggle @Override
171    public void actionPerformed(ActionEvent arg0)
172    {
173  0 vSeparable_actionPerformed(arg0);
174   
175    }
176    });
177  0 gapChar = new JComboBox();
178  0 JvSwingUtils.mgAddtoLayout(cpanel,
179    MessageManager.getString("label.preferred_gap_character"),
180    new JLabel(
181    MessageManager.getString("label.gap_character") + ":"),
182    gapChar, "wrap");
183   
184  0 cpanel.add(hSeparable);
185  0 cpanel.add(vSeparable);
186   
187    // Input and Output lists
188    // Inputparams
189  0 JPanel iprmsList = new JPanel();
190  0 iprmsList.setBorder(new TitledBorder(
191    MessageManager.getString("label.data_input_parameters")));
192  0 iprmsList.setLayout(new MigLayout("", "[grow 90, fill][]"));
193  0 iprmVp = new JScrollPane();
194  0 iprmVp.getViewport().setView(iprms = new JList());
195  0 iprmsList.add(iprmVp);
196  0 iprms.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
197  0 iprms.addMouseListener(new MouseListener()
198    {
199   
 
200  0 toggle @Override
201    public void mouseReleased(MouseEvent e)
202    {
203    // TODO Auto-generated method stub
204   
205    }
206   
 
207  0 toggle @Override
208    public void mousePressed(MouseEvent e)
209    {
210    // TODO Auto-generated method stub
211   
212    }
213   
 
214  0 toggle @Override
215    public void mouseExited(MouseEvent e)
216    {
217    // TODO Auto-generated method stub
218   
219    }
220   
 
221  0 toggle @Override
222    public void mouseEntered(MouseEvent e)
223    {
224    // TODO Auto-generated method stub
225   
226    }
227   
 
228  0 toggle @Override
229    public void mouseClicked(MouseEvent e)
230    {
231  0 if (e.getClickCount() > 1)
232    {
233  0 iprmListSelection_doubleClicked();
234    }
235   
236    }
237    });
238  0 JPanel iprmButs = new JPanel();
239  0 iprmButs.setLayout(new MigLayout());
240   
241  0 iprmsAdd = JvSwingUtils.makeButton("+",
242    MessageManager.getString("action.add_input_parameter"),
243    new ActionListener()
244    {
245   
 
246  0 toggle @Override
247    public void actionPerformed(ActionEvent e)
248    {
249  0 iprmsAdd_actionPerformed(e);
250   
251    }
252    });
253  0 iprmsRem = JvSwingUtils.makeButton("-",
254    MessageManager.getString("action.remove_input_parameter"),
255    new ActionListener()
256    {
257   
 
258  0 toggle @Override
259    public void actionPerformed(ActionEvent e)
260    {
261  0 iprmsRem_actionPerformed(e);
262   
263    }
264    });
265   
266  0 iprmButs.add(iprmsAdd, "wrap");
267  0 iprmButs.add(iprmsRem, "wrap");
268  0 iprmsList.add(iprmButs, "wrap");
269  0 inputs.add(iprmsList, "wrap");
270   
271    // Return Parameters
272   
273  0 rdataAdd = JvSwingUtils.makeButton("+",
274    MessageManager.getString("action.add_return_datatype"),
275    new ActionListener()
276    {
277   
 
278  0 toggle @Override
279    public void actionPerformed(ActionEvent e)
280    {
281  0 rdataAdd_actionPerformed(e);
282   
283    }
284    });
285  0 rdataRem = JvSwingUtils.makeButton("-",
286    MessageManager.getString("action.remove_return_datatype"),
287    new ActionListener()
288    {
289   
 
290  0 toggle @Override
291    public void actionPerformed(ActionEvent e)
292    {
293  0 rdataRem_actionPerformed(e);
294   
295    }
296    });
297  0 rdataNup = JvSwingUtils.makeButton(
298    MessageManager.getString("action.move_up"),
299    MessageManager.getString("label.move_return_type_up_order"),
300    new ActionListener()
301    {
302   
 
303  0 toggle @Override
304    public void actionPerformed(ActionEvent e)
305    {
306  0 rdataNup_actionPerformed(e);
307   
308    }
309    });
310  0 rdataNdown = JvSwingUtils.makeButton(
311    MessageManager.getString("action.move_down"),
312    MessageManager.getString("label.move_return_type_down_order"),
313    new ActionListener()
314    {
315   
 
316  0 toggle @Override
317    public void actionPerformed(ActionEvent e)
318    {
319  0 rdataNdown_actionPerformed(e);
320   
321    }
322    });
323   
324  0 JPanel rparamList = new JPanel();
325  0 rparamList.setBorder(new TitledBorder(
326    MessageManager.getString("label.data_returned_by_service")));
327  0 rparamList.setLayout(new MigLayout("", "[grow 90, fill][]"));
328  0 rdata = new JList();
329  0 rdata.setToolTipText(MessageManager.getString(
330    "label.right_click_to_edit_currently_selected_parameter"));
331  0 rdata.addMouseListener(new MouseListener()
332    {
333   
 
334  0 toggle @Override
335    public void mouseReleased(MouseEvent arg0)
336    {
337    // TODO Auto-generated method stub
338   
339    }
340   
 
341  0 toggle @Override
342    public void mousePressed(MouseEvent arg0)
343    {
344   
345    }
346   
 
347  0 toggle @Override
348    public void mouseExited(MouseEvent arg0)
349    {
350    // TODO Auto-generated method stub
351   
352    }
353   
 
354  0 toggle @Override
355    public void mouseEntered(MouseEvent arg0)
356    {
357    // TODO Auto-generated method stub
358   
359    }
360   
 
361  0 toggle @Override
362    public void mouseClicked(MouseEvent arg0)
363    {
364  0 if (arg0.getButton() == MouseEvent.BUTTON3)
365    {
366  0 rdata_rightClicked(arg0);
367    }
368   
369    }
370    });
371  0 rdataVp = new JScrollPane();
372  0 rdataVp.getViewport().setView(rdata);
373  0 rparamList.add(rdataVp);
374  0 JPanel rparamButs = new JPanel();
375  0 rparamButs.setLayout(new MigLayout());
376  0 rparamButs.add(rdataAdd, "wrap");
377  0 rparamButs.add(rdataRem, "wrap");
378  0 rparamButs.add(rdataNup, "wrap");
379  0 rparamButs.add(rdataNdown, "wrap");
380  0 rparamList.add(rparamButs, "wrap");
381  0 inputs.add(rparamList, "wrap");
382   
383    // Parse flat-text to a service
384   
385  0 urldesc = new JTextArea(4, 60);
386  0 urldesc.setEditable(true);
387  0 urldesc.setWrapStyleWord(true);
388  0 urldescVp = new JScrollPane();
389  0 urldescVp.setViewportView(urldesc);
390  0 JPanel urldescPane = new JPanel();
391  0 urldescPane.setLayout(
392    new MigLayout("", "[grow 100, fill]", "[grow 100, fill]"));
393  0 urldescPane.setBorder(new TitledBorder(
394    MessageManager.getString("label.rsbs_encoded_service")));
395  0 urldescPane.add(urldescVp, "span");
396  0 paste.add(urldescPane, "span");
397  0 urldescPane.setToolTipText(JvSwingUtils.wrapTooltip(true,
398    MessageManager.getString("label.flat_file_representation")));
399   
400  0 parseRes = new JTextArea();
401  0 parseResVp = new JScrollPane();
402  0 parseResVp.setViewportView(parseRes);
403  0 parseRes.setWrapStyleWord(true);
404  0 parseRes.setColumns(60);
405  0 parseWarnings = new JPanel(
406    new MigLayout("", "[grow 100, fill]", "[grow 100, fill]"));
407  0 parseWarnings.setBorder(new TitledBorder(
408    MessageManager.getString("label.parsing_errors")));
409  0 parseWarnings.setToolTipText(JvSwingUtils.wrapTooltip(true,
410    MessageManager.getString("label.result_of_parsing_rsbs")));
411  0 parseWarnings.add(parseResVp, "center");
412  0 parseRes.setEditable(false);
413  0 paste.add(parseWarnings, "span");
414  0 setLayout(new BorderLayout());
415  0 add(panels, BorderLayout.CENTER);
416  0 okButton = JvSwingUtils.makeButton(
417    MessageManager.getString("action.ok"), "", new ActionListener()
418    {
419   
 
420  0 toggle @Override
421    public void actionPerformed(ActionEvent e)
422    {
423  0 ok_actionPerformed();
424    }
425    });
426  0 cancelButton = JvSwingUtils.makeButton(
427    MessageManager.getString("action.cancel"), "",
428    new ActionListener()
429    {
430   
 
431  0 toggle @Override
432    public void actionPerformed(ActionEvent e)
433    {
434  0 cancel_actionPerformed();
435    }
436    });
437   
438    }
439   
 
440  0 toggle protected void rdata_rightClicked(MouseEvent arg0)
441    {
442    // TODO Auto-generated method stub
443   
444    }
445   
 
446  0 toggle protected void iprmListSelection_doubleClicked()
447    {
448    // TODO Auto-generated method stub
449   
450    }
451   
 
452  0 toggle protected void hSeparable_actionPerformed(ActionEvent arg0)
453    {
454    // TODO Auto-generated method stub
455   
456    }
457   
 
458  0 toggle protected void vSeparable_actionPerformed(ActionEvent arg0)
459    {
460    // TODO Auto-generated method stub
461   
462    }
463   
 
464  0 toggle protected void cancel_actionPerformed()
465    {
466    // TODO Auto-generated method stub
467   
468    }
469   
 
470  0 toggle protected void ok_actionPerformed()
471    {
472    // TODO Auto-generated method stub
473   
474    }
475   
 
476  0 toggle protected void iprmsAdd_actionPerformed(ActionEvent e)
477    {
478    // TODO Auto-generated method stub
479   
480    }
481   
 
482  0 toggle protected void iprmsRem_actionPerformed(ActionEvent e)
483    {
484    // TODO Auto-generated method stub
485   
486    }
487   
 
488  0 toggle protected void rdataAdd_actionPerformed(ActionEvent e)
489    {
490    // TODO Auto-generated method stub
491   
492    }
493   
 
494  0 toggle protected void rdataRem_actionPerformed(ActionEvent e)
495    {
496    // TODO Auto-generated method stub
497   
498    }
499   
 
500  0 toggle protected void rdataNup_actionPerformed(ActionEvent e)
501    {
502    // TODO Auto-generated method stub
503   
504    }
505   
 
506  0 toggle protected void rdataNdown_actionPerformed(ActionEvent e)
507    {
508    // TODO Auto-generated method stub
509   
510    }
511   
 
512  0 toggle protected void ok_actionPerformed(ActionEvent e)
513    {
514    // TODO Auto-generated method stub
515   
516    }
517   
 
518  0 toggle protected void cancel_actionPerformed(ActionEvent e)
519    {
520    // TODO Auto-generated method stub
521   
522    }
523   
524    }