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

Annotation of /jsampler/trunk/src/org/jsampler/view/fantasia/FantasiaInstrumentsDbTree.java

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2288 - (hide annotations) (download)
Wed Nov 23 21:19:44 2011 UTC (12 years, 6 months ago) by iliev
File size: 2309 byte(s)
* Added option to select a sampler engine in Add/Edit Instrument dialog
* Moved all Swing dependent code outside the JSampler core

1 iliev 1743 /*
2     * JSampler - a java front-end for LinuxSampler
3     *
4 iliev 2288 * Copyright (C) 2005-2011 Grigor Iliev <grigor@grigoriliev.com>
5 iliev 1743 *
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.fantasia;
24    
25     import java.awt.Component;
26    
27     import javax.swing.JTree;
28    
29 iliev 2288 import org.jsampler.view.swing.DbDirectoryTreeNode;
30     import org.jsampler.view.swing.InstrumentsDbTreeModel;
31 iliev 1743
32     import org.jsampler.view.std.JSInstrumentsDbTree;
33    
34 iliev 2146 import org.pushingpixels.substance.api.renderers.SubstanceDefaultTreeCellRenderer;
35 iliev 1743
36     /**
37     *
38     * @author Grigor Iliev
39     */
40     public class FantasiaInstrumentsDbTree extends JSInstrumentsDbTree {
41    
42     /** Creates a new instance of <code>FantasiaInstrumentsDbTree</code> */
43     public
44     FantasiaInstrumentsDbTree(InstrumentsDbTreeModel model) {
45     super(model);
46     CellRenderer renderer = new CellRenderer();
47     setCellRenderer(renderer);
48     }
49    
50    
51    
52     private class CellRenderer extends SubstanceDefaultTreeCellRenderer {
53     public Component
54     getTreeCellRendererComponent (
55     JTree tree,
56     Object value,
57     boolean sel,
58     boolean expanded,
59     boolean leaf,
60     int row,
61     boolean hasFocus
62     ) {
63     super.getTreeCellRendererComponent (
64     tree, value, sel,expanded, leaf, row,hasFocus
65     );
66    
67     DbDirectoryTreeNode node = (DbDirectoryTreeNode)value;
68     if(node.getInfo().getName() == "/") setIcon(getView().getRootIcon());
69     else if(leaf) setIcon(getView().getInstrumentIcon());
70     else if(expanded) setIcon(getView().getOpenIcon());
71     else setIcon(getView().getClosedIcon());
72    
73     String s = node.getInfo().getDescription();
74     if(s != null && s.length() > 0) setToolTipText(s);
75     else setToolTipText(null);
76    
77     return this;
78     }
79     }
80     }

  ViewVC Help
Powered by ViewVC