2 * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3 * Copyright (C) $$Year-Rel$$ 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 jalview.gui.JvSwingUtils;
24 import jalview.gui.OptsAndParamsPage;
25 import jalview.util.MessageManager;
27 import java.awt.Dimension;
28 import java.awt.event.KeyEvent;
29 import java.awt.event.KeyListener;
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;
41 import net.miginfocom.swing.MigLayout;
43 public class GRestInputParamEditDialog
46 protected JPanel dpane;
48 protected JPanel okcancel;
50 protected JList typeList;
52 protected JTextField tok;
54 protected JPanel options;
56 protected JPanel optionsPanel;
58 public GRestInputParamEditDialog()
63 protected void jbInit()
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()
75 public void valueChanged(ListSelectionEvent e)
77 type_SelectionChangedActionPerformed(e);
81 tok = new JTextField();
82 tok.addKeyListener(new KeyListener()
86 public void keyTyped(KeyEvent e)
91 public void keyReleased(KeyEvent e)
93 tokChanged_actionPerformed();
97 public void keyPressed(KeyEvent e)
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]",
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");
127 protected void tokChanged_actionPerformed()
132 protected void type_SelectionChangedActionPerformed(ListSelectionEvent e)