/[svn]/jsampler/trunk/src/org/jsampler/view/ParameterTable.java
ViewVC logotype

Contents of /jsampler/trunk/src/org/jsampler/view/ParameterTable.java

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1496 - (show annotations) (download)
Mon Nov 19 22:22:22 2007 UTC (16 years, 4 months ago) by iliev
File size: 2672 byte(s)
* Added option for turning off the custom window decoration
  (choose Edit/Preferences, then click the `View' tab)
* Added new menu item: Help/Online Tutorial
* Fantasia: first step of implementing a theme manager
* Fantasia: fixed the view of the channel's stream/voice count statistic
* some minor GUI fixes and enhancements

1 /*
2 * JSampler - a java front-end for LinuxSampler
3 *
4 * Copyright (C) 2005-2006 Grigor Iliev <grigor@grigoriliev.com>
5 *
6 * This file is part of JSampler.
7 *
8 * JSampler is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2
10 * as published by the Free Software Foundation.
11 *
12 * JSampler is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with JSampler; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
20 * MA 02111-1307 USA
21 */
22
23 package org.jsampler.view;
24
25 import javax.swing.DefaultCellEditor;
26 import javax.swing.JComponent;
27 import javax.swing.JComboBox;
28 import javax.swing.JTable;
29 import javax.swing.table.TableCellEditor;
30 import javax.swing.table.TableCellRenderer;
31 import javax.swing.table.TableModel;
32
33 import org.linuxsampler.lscp.Parameter;
34 import org.linuxsampler.lscp.ParameterType;
35
36
37 /**
38 * A table for representing LSCP parameters.
39 * @author Grigor Iliev
40 */
41 public class ParameterTable extends JTable {
42
43 /** Creates a new instance of <code>ParameterTable</code>. */
44 public
45 ParameterTable() { super(new ParameterTableModel(new Parameter[0])); }
46
47 /**
48 * Gets the <code>ParameterTableModel</code> that
49 * provides the data displayed by this <code>ParameterTable</code>.
50 * @return The <code>ParameterTableModel</code> that
51 * provides the data displayed by this <code>ParameterTable</code>.
52 */
53 public ParameterTableModel
54 getModel() { return (ParameterTableModel) super.getModel(); }
55
56 /**
57 * Sets the data model for this table to <code>dataModel</code>.
58 * @param dataModel The new data source for this table.
59 */
60 public void
61 setModel(ParameterTableModel dataModel) { super.setModel(dataModel); }
62
63 public TableCellEditor
64 getCellEditor(int row, int column) {
65 TableCellEditor editor = getModel().getCellEditor(row, column);
66 return editor != null ? editor : super.getCellEditor(row, column);
67 }
68
69 public TableCellRenderer
70 getCellRenderer(int row, int column) {
71 TableCellRenderer r = getModel().getCellRenderer(row, column);
72 if(r == null) r = super.getCellRenderer(row, column);
73
74 JComponent c = (JComponent)r;
75 Parameter p = getModel().getParameter(row);
76 if(column == 1 && p.getStringValue().length() > 15) {
77 c.setToolTipText(p.getStringValue());
78 } else {
79 c.setToolTipText(p.getDescription());
80 }
81
82 return r;
83 }
84 }

  ViewVC Help
Powered by ViewVC