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

Annotation of /jsampler/trunk/src/org/jsampler/view/std/JSDbInstrumentPropsPane.java

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1286 - (hide annotations) (download)
Fri Aug 10 20:24:23 2007 UTC (16 years, 9 months ago) by iliev
File size: 8123 byte(s)
- Updated to version 0.6a. The Fantasia distribution is now
  capable of controlling all features available in LinuxSampler

1 iliev 1286 /*
2     * JSampler - a java front-end for LinuxSampler
3     *
4     * Copyright (C) 2005-2007 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.std;
24    
25     import java.awt.Dimension;
26     import java.awt.GridBagConstraints;
27     import java.awt.GridBagLayout;
28     import java.awt.Insets;
29    
30     import javax.swing.BorderFactory;
31     import javax.swing.JLabel;
32     import javax.swing.JPanel;
33     import javax.swing.JSeparator;
34     import javax.swing.JTextArea;
35    
36     import org.linuxsampler.lscp.DbInstrumentInfo;
37    
38     import static org.jsampler.view.std.StdI18n.i18n;
39    
40    
41     /**
42     *
43     * @author Grigor Iliev
44     */
45     public class JSDbInstrumentPropsPane extends JPanel {
46     private final JLabel lName = new JLabel(i18n.getLabel("JSDbInstrumentPropsPane.lName"));
47     private final JLabel lLocation =
48     new JLabel(i18n.getLabel("JSDbInstrumentPropsPane.lLocation"));
49    
50     private final JLabel lSize = new JLabel(i18n.getLabel("JSDbInstrumentPropsPane.lSize"));
51    
52     private final JLabel lFormat = new JLabel(i18n.getLabel("JSDbInstrumentPropsPane.lFormat"));
53     private final JLabel lType = new JLabel(i18n.getLabel("JSDbInstrumentPropsPane.lType"));
54     private final JLabel lDesc = new JLabel(i18n.getLabel("JSDbInstrumentPropsPane.lDesc"));
55     private final JLabel lCreated =
56     new JLabel(i18n.getLabel("JSDbInstrumentPropsPane.lCreated"));
57     private final JLabel lModified =
58     new JLabel(i18n.getLabel("JSDbInstrumentPropsPane.lModified"));
59    
60     private final JLabel lFile = new JLabel(i18n.getLabel("JSDbInstrumentPropsPane.lFile"));
61     private final JLabel lIndex = new JLabel(i18n.getLabel("JSDbInstrumentPropsPane.lIndex"));
62     private final JLabel lProduct = new JLabel(i18n.getLabel("JSDbInstrumentPropsPane.lProduct"));
63     private final JLabel lArtists = new JLabel(i18n.getLabel("JSDbInstrumentPropsPane.lArtists"));
64     private final JLabel lKeywords =
65     new JLabel(i18n.getLabel("JSDbInstrumentPropsPane.lKeywords"));
66    
67     private final TextArea taName = new TextArea();
68     private final TextArea taLocation = new TextArea();
69     private final TextArea taSize = new TextArea();
70     private final TextArea taFormat = new TextArea();
71     private final TextArea taType = new TextArea();
72     private final TextArea taDesc = new TextArea();
73     private final TextArea taCreated = new TextArea();
74     private final TextArea taModified = new TextArea();
75     private final TextArea taFile = new TextArea();
76     private final TextArea taIndex = new TextArea();
77     private final TextArea taProduct = new TextArea();
78     private final TextArea taArtists = new TextArea();
79     private final TextArea taKeywords = new TextArea();
80    
81     /**
82     * Creates a new instance of <code>JSDbInstrumentPropsPane</code>
83     */
84     public JSDbInstrumentPropsPane(DbInstrumentInfo instrInfo) {
85     setInstrumentInfo(instrInfo);
86    
87     GridBagLayout gridbag = new GridBagLayout();
88     GridBagConstraints c = new GridBagConstraints();
89    
90     setLayout(gridbag);
91    
92     c.fill = GridBagConstraints.NONE;
93    
94     c.gridx = 0;
95     c.gridy = 0;
96     c.anchor = GridBagConstraints.NORTHEAST;
97     c.insets = new Insets(3, 3, 3, 3);
98     gridbag.setConstraints(lName, c);
99     add(lName);
100    
101     c.gridx = 0;
102     c.gridy = 2;
103     gridbag.setConstraints(lLocation, c);
104     add(lLocation);
105    
106     c.gridx = 0;
107     c.gridy = 3;
108     gridbag.setConstraints(lSize, c);
109     add(lSize);
110    
111     c.gridx = 0;
112     c.gridy = 4;
113     gridbag.setConstraints(lFormat, c);
114     add(lFormat);
115    
116     c.gridx = 0;
117     c.gridy = 5;
118     gridbag.setConstraints(lType, c);
119     add(lType);
120    
121     c.gridx = 0;
122     c.gridy = 6;
123     gridbag.setConstraints(lDesc, c);
124     add(lDesc);
125    
126     c.gridx = 0;
127     c.gridy = 8;
128     gridbag.setConstraints(lCreated, c);
129     add(lCreated);
130    
131     c.gridx = 0;
132     c.gridy = 9;
133     gridbag.setConstraints(lModified, c);
134     add(lModified);
135    
136     c.gridx = 0;
137     c.gridy = 11;
138     gridbag.setConstraints(lFile, c);
139     add(lFile);
140    
141     c.gridx = 0;
142     c.gridy = 12;
143     gridbag.setConstraints(lIndex, c);
144     add(lIndex);
145    
146     c.gridx = 0;
147     c.gridy = 14;
148     gridbag.setConstraints(lProduct, c);
149     add(lProduct);
150    
151     c.gridx = 0;
152     c.gridy = 15;
153     gridbag.setConstraints(lArtists, c);
154     add(lArtists);
155    
156     c.gridx = 0;
157     c.gridy = 16;
158     gridbag.setConstraints(lKeywords, c);
159     add(lKeywords);
160    
161     c.fill = GridBagConstraints.HORIZONTAL;
162     c.gridx = 1;
163     c.gridy = 0;
164     c.weightx = 1.0;
165     c.anchor = GridBagConstraints.NORTHWEST;
166     gridbag.setConstraints(taName, c);
167     add(taName);
168    
169     c.gridx = 1;
170     c.gridy = 2;
171     gridbag.setConstraints(taLocation, c);
172     add(taLocation);
173    
174     c.gridx = 1;
175     c.gridy = 3;
176     gridbag.setConstraints(taSize, c);
177     add(taSize);
178    
179     c.gridx = 1;
180     c.gridy = 4;
181     gridbag.setConstraints(taFormat, c);
182     add(taFormat);
183    
184     c.gridx = 1;
185     c.gridy = 5;
186     gridbag.setConstraints(taType, c);
187     add(taType);
188    
189     c.gridx = 1;
190     c.gridy = 6;
191     gridbag.setConstraints(taDesc, c);
192     add(taDesc);
193    
194     c.gridx = 1;
195     c.gridy = 8;
196     gridbag.setConstraints(taCreated, c);
197     add(taCreated);
198    
199     c.gridx = 1;
200     c.gridy = 9;
201     gridbag.setConstraints(taModified, c);
202     add(taModified);
203    
204     c.gridx = 1;
205     c.gridy = 11;
206     gridbag.setConstraints(taFile, c);
207     add(taFile);
208    
209     c.gridx = 1;
210     c.gridy = 12;
211     gridbag.setConstraints(taIndex, c);
212     add(taIndex);
213    
214     c.gridx = 1;
215     c.gridy = 14;
216     gridbag.setConstraints(taProduct, c);
217     add(taProduct);
218    
219     c.gridx = 1;
220     c.gridy = 15;
221     gridbag.setConstraints(taArtists, c);
222     add(taArtists);
223    
224     c.gridx = 1;
225     c.gridy = 16;
226     gridbag.setConstraints(taKeywords, c);
227     add(taKeywords);
228    
229     JSeparator sep = new JSeparator();
230     c.gridx = 0;
231     c.gridy = 1;
232     c.gridwidth = 2;
233     gridbag.setConstraints(sep, c);
234     add(sep);
235    
236     sep = new JSeparator();
237     c.gridx = 0;
238     c.gridy = 7;
239     gridbag.setConstraints(sep, c);
240     add(sep);
241    
242     sep = new JSeparator();
243     c.gridx = 0;
244     c.gridy = 10;
245     gridbag.setConstraints(sep, c);
246     add(sep);
247    
248     sep = new JSeparator();
249     c.gridx = 0;
250     c.gridy = 13;
251     gridbag.setConstraints(sep, c);
252     add(sep);
253    
254     JPanel p = new JPanel();
255     p.setOpaque(false);
256     c.gridx = 0;
257     c.gridy = 17;
258     c.weightx = 1.0;
259     c.weighty = 1.0;
260     c.fill = GridBagConstraints.BOTH;
261     gridbag.setConstraints(p, c);
262     add(p);
263    
264     Dimension d = getPreferredSize();
265     int w = d.width > 300 ? d.width : 300;
266     int h = d.height > 300 ? d.height : 300;
267     setPreferredSize(new Dimension(w, h));
268     }
269    
270     public void
271     setInstrumentInfo(DbInstrumentInfo instrInfo) {
272     taName.setText(instrInfo.getName());
273     taLocation.setText(instrInfo.getDirectoryPath());
274    
275     String s = instrInfo.getFormatedSize();
276     s += " (" + String.valueOf(instrInfo.getSize()) + " bytes)";
277     taSize.setText(s);
278    
279     s = instrInfo.getFormatFamily();
280     if(s.equals("GIG")) s = "GigaSampler";
281     String ver = instrInfo.getFormatVersion();
282     if(ver != null & ver.length() > 0) s += ", version " + ver;
283     taFormat.setText(s);
284    
285     if(instrInfo.isDrum()) taType.setText(i18n.getLabel("JSDbInstrumentPropsPane.drum"));
286     else taType.setText(i18n.getLabel("JSDbInstrumentPropsPane.chromatic"));
287    
288     taDesc.setText(instrInfo.getDescription());
289     taCreated.setText(instrInfo.getDateCreated().toString());
290     taModified.setText(instrInfo.getDateModified().toString());
291     taFile.setText(instrInfo.getFilePath());
292     taIndex.setText(String.valueOf(instrInfo.getInstrumentIndex()));
293     taProduct.setText(instrInfo.getProduct());
294     taArtists.setText(instrInfo.getArtists());
295     taKeywords.setText(instrInfo.getKeywords());
296     }
297    
298     private class
299     TextArea extends JTextArea {
300     TextArea() {
301     setLineWrap(true);
302     setEditable(false);
303     setOpaque(false);
304     setBorder(BorderFactory.createEmptyBorder());
305     }
306     }
307     }

  ViewVC Help
Powered by ViewVC