2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.0b1)
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 of the License, or (at your option) any later version.
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.
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.
19 package jalview.jbgui;
21 import java.awt.Dimension;
22 import java.awt.event.KeyEvent;
23 import java.awt.event.KeyListener;
25 import jalview.gui.JvSwingUtils;
26 import jalview.gui.OptsAndParamsPage;
27 import jalview.util.MessageManager;
30 import javax.swing.border.TitledBorder;
31 import javax.swing.event.ListSelectionEvent;
32 import javax.swing.event.ListSelectionListener;
34 import net.miginfocom.swing.MigLayout;
36 public class GRestInputParamEditDialog
39 protected JPanel dpane;
41 protected JPanel okcancel;
43 protected JList typeList;
45 protected JTextField tok;
47 protected JPanel options;
49 protected JPanel optionsPanel;
51 public GRestInputParamEditDialog()
56 protected void jbInit()
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()
68 public void valueChanged(ListSelectionEvent e)
70 type_SelectionChangedActionPerformed(e);
74 tok = new JTextField();
75 tok.addKeyListener(new KeyListener()
79 public void keyTyped(KeyEvent e)
84 public void keyReleased(KeyEvent e)
86 tokChanged_actionPerformed();
90 public void keyPressed(KeyEvent e)
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]",
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");
116 protected void tokChanged_actionPerformed()
121 protected void type_SelectionChangedActionPerformed(ListSelectionEvent e)