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