1 /*******************************************************************************
2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7)
3 * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle
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 *******************************************************************************/
18 package jalview.jbgui;
20 import java.awt.Dimension;
21 import java.awt.event.KeyEvent;
22 import java.awt.event.KeyListener;
24 import jalview.gui.JvSwingUtils;
25 import jalview.gui.OptsAndParamsPage;
28 import javax.swing.border.TitledBorder;
29 import javax.swing.event.ListSelectionEvent;
30 import javax.swing.event.ListSelectionListener;
32 import net.miginfocom.swing.MigLayout;
35 public class GRestInputParamEditDialog
38 protected JPanel dpane;
39 protected JPanel okcancel;
40 protected JList typeList;
41 protected JTextField tok;
42 protected JPanel options;
43 protected JPanel optionsPanel;
44 public GRestInputParamEditDialog()
48 protected void jbInit() {
49 dpane = new JPanel(new MigLayout("","[][][fill]","[][fill][]"));
50 dpane.setPreferredSize(new Dimension(110+100+OptsAndParamsPage.PARAM_WIDTH,400));
51 typeList = new JList();
52 typeList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
53 typeList.getSelectionModel().addListSelectionListener(new ListSelectionListener()
57 public void valueChanged(ListSelectionEvent e)
59 type_SelectionChangedActionPerformed(e);
63 tok = new JTextField();
64 tok.addKeyListener(new KeyListener()
68 public void keyTyped(KeyEvent e)
73 public void keyReleased(KeyEvent e)
75 tokChanged_actionPerformed();
79 public void keyPressed(KeyEvent e)
84 options = new JPanel(new MigLayout("","[grow 100,fill]",""));
85 optionsPanel = new JPanel(new MigLayout("","[fill]","[fill]"));
86 JScrollPane optionView = new JScrollPane();
87 optionView.setViewportView(options);
88 JvSwingUtils.mgAddtoLayout(dpane, "Input Parameter name", new JLabel("Name"), tok, "grow,spanx 3,wrap");
89 JPanel paramsType = new JPanel(new MigLayout("","[grow 100,fill]","[grow 100,fill]"));
90 paramsType.setBorder(new TitledBorder("Select input type"));
91 JScrollPane jlistScroller=new JScrollPane();
92 jlistScroller.setViewportView(typeList);
93 paramsType.add(jlistScroller,"spanx 2,spany 2");
94 dpane.add(paramsType);
95 optionsPanel.setBorder(new TitledBorder("Set options for type"));
96 optionsPanel.add(optionView);
97 dpane.add(optionsPanel,"wrap");
98 okcancel = new JPanel(new MigLayout("","[center][center]","[]"));
99 dpane.add(okcancel,"spanx 3,wrap");
102 protected void tokChanged_actionPerformed()
106 protected void type_SelectionChangedActionPerformed(ListSelectionEvent e)