2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2)
3 * Copyright (C) 2014 The Jalview Authors
5 * This file is part of Jalview.
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.
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.
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.
21 package jalview.jbgui;
23 import java.awt.Dimension;
24 import java.awt.event.KeyEvent;
25 import java.awt.event.KeyListener;
27 import jalview.gui.JvSwingUtils;
28 import jalview.gui.OptsAndParamsPage;
29 import jalview.util.MessageManager;
32 import javax.swing.border.TitledBorder;
33 import javax.swing.event.ListSelectionEvent;
34 import javax.swing.event.ListSelectionListener;
36 import net.miginfocom.swing.MigLayout;
38 public class GRestInputParamEditDialog
41 protected JPanel dpane;
43 protected JPanel okcancel;
45 protected JList typeList;
47 protected JTextField tok;
49 protected JPanel options;
51 protected JPanel optionsPanel;
53 public GRestInputParamEditDialog()
58 protected void jbInit()
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()
70 public void valueChanged(ListSelectionEvent e)
72 type_SelectionChangedActionPerformed(e);
76 tok = new JTextField();
77 tok.addKeyListener(new KeyListener()
81 public void keyTyped(KeyEvent e)
86 public void keyReleased(KeyEvent e)
88 tokChanged_actionPerformed();
92 public void keyPressed(KeyEvent e)
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]",
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");
122 protected void tokChanged_actionPerformed()
127 protected void type_SelectionChangedActionPerformed(ListSelectionEvent e)