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;
29 import javax.swing.border.TitledBorder;
30 import javax.swing.event.ListSelectionEvent;
31 import javax.swing.event.ListSelectionListener;
33 import net.miginfocom.swing.MigLayout;
35 public class GRestInputParamEditDialog
38 protected JPanel dpane;
40 protected JPanel okcancel;
42 protected JList typeList;
44 protected JTextField tok;
46 protected JPanel options;
48 protected JPanel optionsPanel;
50 public GRestInputParamEditDialog()
55 protected void jbInit()
57 dpane = new JPanel(new MigLayout("", "[][][fill]", "[][fill][]"));
58 dpane.setPreferredSize(new Dimension(
59 110 + 100 + OptsAndParamsPage.PARAM_WIDTH, 400));
60 typeList = new JList();
61 typeList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
62 typeList.getSelectionModel().addListSelectionListener(
63 new ListSelectionListener()
67 public void valueChanged(ListSelectionEvent e)
69 type_SelectionChangedActionPerformed(e);
73 tok = new JTextField();
74 tok.addKeyListener(new KeyListener()
78 public void keyTyped(KeyEvent e)
83 public void keyReleased(KeyEvent e)
85 tokChanged_actionPerformed();
89 public void keyPressed(KeyEvent e)
94 options = new JPanel(new MigLayout("", "[grow 100,fill]", ""));
95 optionsPanel = new JPanel(new MigLayout("", "[fill]", "[fill]"));
96 JScrollPane optionView = new JScrollPane();
97 optionView.setViewportView(options);
98 JvSwingUtils.mgAddtoLayout(dpane, "Input Parameter name", new JLabel(
99 "Name"), tok, "grow,spanx 3,wrap");
100 JPanel paramsType = new JPanel(new MigLayout("", "[grow 100,fill]",
102 paramsType.setBorder(new TitledBorder("Select input type"));
103 JScrollPane jlistScroller = new JScrollPane();
104 jlistScroller.setViewportView(typeList);
105 paramsType.add(jlistScroller, "spanx 2,spany 2");
106 dpane.add(paramsType);
107 optionsPanel.setBorder(new TitledBorder("Set options for type"));
108 optionsPanel.add(optionView);
109 dpane.add(optionsPanel, "wrap");
110 okcancel = new JPanel(new MigLayout("", "[center][center]", "[]"));
111 dpane.add(okcancel, "spanx 3,wrap");
115 protected void tokChanged_actionPerformed()
120 protected void type_SelectionChangedActionPerformed(ListSelectionEvent e)