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