eb1a3486830ff556ff07a26eef12274eac39967c
[jalview.git] / src / jalview / jbgui / GRestInputParamEditDialog.java
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.gui.OptsAndParamsPage;
25 import jalview.util.MessageManager;
26
27 import java.awt.Dimension;
28 import java.awt.event.KeyEvent;
29 import java.awt.event.KeyListener;
30
31 import javax.swing.JLabel;
32 import javax.swing.JList;
33 import javax.swing.JPanel;
34 import javax.swing.JScrollPane;
35 import javax.swing.JTextField;
36 import javax.swing.ListSelectionModel;
37 import javax.swing.border.TitledBorder;
38 import javax.swing.event.ListSelectionEvent;
39 import javax.swing.event.ListSelectionListener;
40
41 import net.miginfocom.swing.MigLayout;
42
43 public class GRestInputParamEditDialog
44 {
45
46   protected JPanel dpane;
47
48   protected JPanel okcancel;
49
50   protected JList typeList;
51
52   protected JTextField tok;
53
54   protected JPanel options;
55
56   protected JPanel optionsPanel;
57
58   public GRestInputParamEditDialog()
59   {
60     jbInit();
61   }
62
63   protected void jbInit()
64   {
65     dpane = new JPanel(new MigLayout("", "[][][fill]", "[][fill][]"));
66     dpane.setPreferredSize(new Dimension(
67             110 + 100 + OptsAndParamsPage.PARAM_WIDTH, 400));
68     typeList = new JList();
69     typeList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
70     typeList.getSelectionModel().addListSelectionListener(
71             new ListSelectionListener()
72             {
73
74               @Override
75               public void valueChanged(ListSelectionEvent e)
76               {
77                 type_SelectionChangedActionPerformed(e);
78               };
79             });
80
81     tok = new JTextField();
82     tok.addKeyListener(new KeyListener()
83     {
84
85       @Override
86       public void keyTyped(KeyEvent e)
87       {
88       }
89
90       @Override
91       public void keyReleased(KeyEvent e)
92       {
93         tokChanged_actionPerformed();
94       }
95
96       @Override
97       public void keyPressed(KeyEvent e)
98       {
99
100       }
101     });
102     options = new JPanel(new MigLayout("", "[grow 100,fill]", ""));
103     optionsPanel = new JPanel(new MigLayout("", "[fill]", "[fill]"));
104     JScrollPane optionView = new JScrollPane();
105     optionView.setViewportView(options);
106     JvSwingUtils.mgAddtoLayout(dpane,
107             MessageManager.getString("label.input_parameter_name"),
108             new JLabel(MessageManager.getString("label.name")), tok,
109             "grow,spanx 3,wrap");
110     JPanel paramsType = new JPanel(new MigLayout("", "[grow 100,fill]",
111             "[grow 100,fill]"));
112     paramsType.setBorder(new TitledBorder(MessageManager
113             .getString("label.select_input_type")));
114     JScrollPane jlistScroller = new JScrollPane();
115     jlistScroller.setViewportView(typeList);
116     paramsType.add(jlistScroller, "spanx 2,spany 2");
117     dpane.add(paramsType);
118     optionsPanel.setBorder(new TitledBorder(MessageManager
119             .getString("label.set_options_for_type")));
120     optionsPanel.add(optionView);
121     dpane.add(optionsPanel, "wrap");
122     okcancel = new JPanel(new MigLayout("", "[center][center]", "[]"));
123     dpane.add(okcancel, "spanx 3,wrap");
124
125   }
126
127   protected void tokChanged_actionPerformed()
128   {
129
130   }
131
132   protected void type_SelectionChangedActionPerformed(ListSelectionEvent e)
133   {
134   }
135
136 }