formatting
[jalview.git] / src / jalview / jbgui / GRestInputParamEditDialog.java
1 /*******************************************************************************
2  * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
3  * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, 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.Dimension;
21 import java.awt.event.KeyEvent;
22 import java.awt.event.KeyListener;
23
24 import jalview.gui.JvSwingUtils;
25 import jalview.gui.OptsAndParamsPage;
26
27 import javax.swing.*;
28 import javax.swing.border.TitledBorder;
29 import javax.swing.event.ListSelectionEvent;
30 import javax.swing.event.ListSelectionListener;
31
32 import net.miginfocom.swing.MigLayout;
33
34
35 public class GRestInputParamEditDialog
36 {
37
38   protected JPanel dpane;
39   protected JPanel okcancel;
40   protected JList typeList;
41   protected JTextField tok;
42   protected JPanel options;
43   protected JPanel optionsPanel;
44   public GRestInputParamEditDialog() 
45   {
46     jbInit();
47   }
48   protected void jbInit() {
49     dpane = new JPanel(new MigLayout("","[][][fill]","[][fill][]"));
50     dpane.setPreferredSize(new Dimension(110+100+OptsAndParamsPage.PARAM_WIDTH,400));
51     typeList = new JList();
52     typeList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
53     typeList.getSelectionModel().addListSelectionListener(new ListSelectionListener()
54     {
55       
56       @Override
57       public void valueChanged(ListSelectionEvent e)
58       {
59         type_SelectionChangedActionPerformed(e);
60       };
61     });
62     
63     tok = new JTextField();
64     tok.addKeyListener(new KeyListener()
65     {
66       
67       @Override
68       public void keyTyped(KeyEvent e)
69       {
70       }
71       
72       @Override
73       public void keyReleased(KeyEvent e)
74       {
75         tokChanged_actionPerformed();
76       }
77       
78       @Override
79       public void keyPressed(KeyEvent e)
80       {
81         
82       }
83     });
84     options = new JPanel(new MigLayout("","[grow 100,fill]",""));
85     optionsPanel = new JPanel(new MigLayout("","[fill]","[fill]"));
86     JScrollPane optionView = new JScrollPane();
87     optionView.setViewportView(options);
88     JvSwingUtils.mgAddtoLayout(dpane, "Input Parameter name", new JLabel("Name"), tok, "grow,spanx 3,wrap");
89     JPanel paramsType = new JPanel(new MigLayout("","[grow 100,fill]","[grow 100,fill]"));
90     paramsType.setBorder(new TitledBorder("Select input type"));
91     JScrollPane jlistScroller=new JScrollPane();
92     jlistScroller.setViewportView(typeList);
93     paramsType.add(jlistScroller,"spanx 2,spany 2");
94     dpane.add(paramsType);
95     optionsPanel.setBorder(new TitledBorder("Set options for type"));
96     optionsPanel.add(optionView);
97     dpane.add(optionsPanel,"wrap");
98     okcancel = new JPanel(new MigLayout("","[center][center]","[]"));
99     dpane.add(okcancel,"spanx 3,wrap");
100
101   }
102   protected void tokChanged_actionPerformed()
103   {
104     
105   }
106   protected void type_SelectionChangedActionPerformed(ListSelectionEvent e)
107   {
108   }
109   
110 }