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