2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8)
3 * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, 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/>.
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;
34 public class GRestInputParamEditDialog
37 protected JPanel dpane;
39 protected JPanel okcancel;
41 protected JList typeList;
43 protected JTextField tok;
45 protected JPanel options;
47 protected JPanel optionsPanel;
49 public GRestInputParamEditDialog()
54 protected void jbInit()
56 dpane = new JPanel(new MigLayout("", "[][][fill]", "[][fill][]"));
57 dpane.setPreferredSize(new Dimension(
58 110 + 100 + OptsAndParamsPage.PARAM_WIDTH, 400));
59 typeList = new JList();
60 typeList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
61 typeList.getSelectionModel().addListSelectionListener(
62 new ListSelectionListener()
66 public void valueChanged(ListSelectionEvent e)
68 type_SelectionChangedActionPerformed(e);
72 tok = new JTextField();
73 tok.addKeyListener(new KeyListener()
77 public void keyTyped(KeyEvent e)
82 public void keyReleased(KeyEvent e)
84 tokChanged_actionPerformed();
88 public void keyPressed(KeyEvent e)
93 options = new JPanel(new MigLayout("", "[grow 100,fill]", ""));
94 optionsPanel = new JPanel(new MigLayout("", "[fill]", "[fill]"));
95 JScrollPane optionView = new JScrollPane();
96 optionView.setViewportView(options);
97 JvSwingUtils.mgAddtoLayout(dpane, "Input Parameter name", new JLabel(
98 "Name"), tok, "grow,spanx 3,wrap");
99 JPanel paramsType = new JPanel(new MigLayout("", "[grow 100,fill]",
101 paramsType.setBorder(new TitledBorder("Select input type"));
102 JScrollPane jlistScroller = new JScrollPane();
103 jlistScroller.setViewportView(typeList);
104 paramsType.add(jlistScroller, "spanx 2,spany 2");
105 dpane.add(paramsType);
106 optionsPanel.setBorder(new TitledBorder("Set options for type"));
107 optionsPanel.add(optionView);
108 dpane.add(optionsPanel, "wrap");
109 okcancel = new JPanel(new MigLayout("", "[center][center]", "[]"));
110 dpane.add(okcancel, "spanx 3,wrap");
114 protected void tokChanged_actionPerformed()
119 protected void type_SelectionChangedActionPerformed(ListSelectionEvent e)