1 |
iliev |
787 |
/* |
2 |
|
|
* JSampler - a java front-end for LinuxSampler |
3 |
|
|
* |
4 |
iliev |
1143 |
* Copyright (C) 2005-2006 Grigor Iliev <grigor@grigoriliev.com> |
5 |
iliev |
787 |
* |
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.classic; |
24 |
|
|
|
25 |
|
|
import java.awt.Frame; |
26 |
|
|
|
27 |
|
|
import java.awt.Dimension; |
28 |
|
|
import java.awt.GridBagConstraints; |
29 |
|
|
import java.awt.GridBagLayout; |
30 |
|
|
import java.awt.Insets; |
31 |
|
|
|
32 |
|
|
import javax.swing.BorderFactory; |
33 |
|
|
import javax.swing.Box; |
34 |
|
|
import javax.swing.BoxLayout; |
35 |
|
|
import javax.swing.ImageIcon; |
36 |
|
|
import javax.swing.JLabel; |
37 |
|
|
import javax.swing.JPanel; |
38 |
|
|
import javax.swing.JTextField; |
39 |
|
|
|
40 |
|
|
import javax.swing.border.EtchedBorder; |
41 |
|
|
|
42 |
|
|
import net.sf.juife.InformationDialog; |
43 |
|
|
|
44 |
|
|
import org.jsampler.CC; |
45 |
|
|
|
46 |
|
|
import org.linuxsampler.lscp.ServerInfo; |
47 |
|
|
|
48 |
|
|
import static org.jsampler.view.classic.ClassicI18n.i18n; |
49 |
|
|
|
50 |
|
|
|
51 |
|
|
/** |
52 |
|
|
* |
53 |
|
|
* @author Grigor Iliev |
54 |
|
|
*/ |
55 |
|
|
public class SamplerInfoDlg extends InformationDialog { |
56 |
|
|
private final static ImageIcon iconLinuxSamplerLogo; |
57 |
|
|
|
58 |
|
|
static { |
59 |
|
|
java.net.URL url; |
60 |
|
|
url = ClassLoader.getSystemClassLoader().getResource ( |
61 |
|
|
"org/jsampler/view/classic/res/LinuxSampler-logo.png" |
62 |
|
|
); |
63 |
|
|
iconLinuxSamplerLogo = new ImageIcon(url); |
64 |
|
|
} |
65 |
|
|
|
66 |
|
|
private final JLabel lLinuxSamplerLogo = new JLabel(iconLinuxSamplerLogo); |
67 |
|
|
private final JLabel lDescription = new JLabel(); |
68 |
|
|
private final JLabel lVersion = new JLabel(i18n.getLabel("SamplerInfoDlg.lVersion")); |
69 |
|
|
private final JLabel lProtocolVersion = |
70 |
|
|
new JLabel(i18n.getLabel("SamplerInfoDlg.lProtocolVersion")); |
71 |
|
|
|
72 |
|
|
private final JTextField tfVersion = new JTextField(); |
73 |
|
|
private final JTextField tfProtocolVersion = new JTextField(); |
74 |
|
|
|
75 |
|
|
|
76 |
|
|
/** Creates a new instance of SamplerInfoDlg */ |
77 |
|
|
public SamplerInfoDlg(Frame owner) { |
78 |
|
|
super(owner, i18n.getLabel("SamplerInfoDlg.title")); |
79 |
|
|
|
80 |
|
|
showCloseButton(false); |
81 |
|
|
setResizable(false); |
82 |
|
|
|
83 |
|
|
JPanel mainPane = new JPanel(); |
84 |
|
|
ServerInfo si = CC.getSamplerModel().getServerInfo(); |
85 |
|
|
|
86 |
|
|
if(si == null) { |
87 |
|
|
mainPane.add(new JLabel(i18n.getLabel("SamplerInfoDlg.unavailable"))); |
88 |
|
|
setMainPane(mainPane); |
89 |
|
|
return; |
90 |
|
|
} |
91 |
|
|
|
92 |
|
|
lDescription.setText(si.getDescription()); |
93 |
|
|
tfVersion.setText(si.getVersion()); |
94 |
|
|
tfProtocolVersion.setText(si.getProtocolVersion()); |
95 |
|
|
|
96 |
|
|
tfVersion.setEditable(false); |
97 |
|
|
tfVersion.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); |
98 |
|
|
|
99 |
|
|
tfProtocolVersion.setEditable(false); |
100 |
|
|
tfProtocolVersion.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); |
101 |
|
|
|
102 |
|
|
|
103 |
|
|
JPanel infoPane = new JPanel(); |
104 |
|
|
|
105 |
|
|
GridBagLayout gridbag = new GridBagLayout(); |
106 |
|
|
GridBagConstraints c = new GridBagConstraints(); |
107 |
|
|
|
108 |
|
|
/*lText.setFont(lText.getFont().deriveFont(java.awt.Font.PLAIN)); |
109 |
|
|
|
110 |
|
|
ServerInfo si = CC.getSamplerModel().getServerInfo(); |
111 |
|
|
|
112 |
|
|
if(si == null) lText.setText( JSI18n.getLabel("SamplerInfoDlg.unavailable")); |
113 |
|
|
else lText.setText ( |
114 |
|
|
"<html>\n" + |
115 |
|
|
"<h3>" + si.getDescription() + "</h3><br>" + |
116 |
|
|
"<table border=0 align=left>" + |
117 |
|
|
"<tr> <th align=right>Version:</th> <td align=left>" + si.getVersion() + "</td> </tr>" + |
118 |
|
|
"<tr> <th align=right>Protocol Version:</th> <td align=left>" + si.getProtocolVersion()+ "</td> </tr>" + |
119 |
|
|
"</table>" |
120 |
|
|
); |
121 |
|
|
|
122 |
|
|
mainPane.add(lText); |
123 |
|
|
*/ |
124 |
|
|
infoPane.setLayout(gridbag); |
125 |
|
|
|
126 |
|
|
c.gridx = 0; |
127 |
|
|
c.gridy = 0; |
128 |
|
|
c.insets = new Insets(3, 3, 3, 3); |
129 |
|
|
c.anchor = GridBagConstraints.EAST; |
130 |
|
|
gridbag.setConstraints(lVersion, c); |
131 |
|
|
infoPane.add(lVersion); |
132 |
|
|
|
133 |
|
|
c.gridx = 0; |
134 |
|
|
c.gridy = 1; |
135 |
|
|
gridbag.setConstraints(lProtocolVersion, c); |
136 |
|
|
infoPane.add(lProtocolVersion); |
137 |
|
|
|
138 |
|
|
c.gridx = 1; |
139 |
|
|
c.gridy = 0; |
140 |
|
|
c.anchor = GridBagConstraints.WEST; |
141 |
|
|
gridbag.setConstraints(tfVersion, c); |
142 |
|
|
infoPane.add(tfVersion); |
143 |
|
|
|
144 |
|
|
c.gridx = 1; |
145 |
|
|
c.gridy = 1; |
146 |
|
|
gridbag.setConstraints(tfProtocolVersion, c); |
147 |
|
|
infoPane.add(tfProtocolVersion); |
148 |
|
|
|
149 |
|
|
//infoPane.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED)); |
150 |
|
|
infoPane.setMaximumSize(infoPane.getPreferredSize()); |
151 |
|
|
|
152 |
|
|
JPanel bodyPane = new JPanel(); |
153 |
|
|
bodyPane.setLayout(new BoxLayout(bodyPane, BoxLayout.X_AXIS)); |
154 |
|
|
bodyPane.setAlignmentX(JPanel.LEFT_ALIGNMENT); |
155 |
|
|
|
156 |
|
|
bodyPane.add(lLinuxSamplerLogo); |
157 |
|
|
bodyPane.add(Box.createRigidArea(new Dimension(6, 0))); |
158 |
|
|
bodyPane.add(infoPane); |
159 |
|
|
|
160 |
|
|
|
161 |
|
|
mainPane.setLayout(new BoxLayout(mainPane, BoxLayout.Y_AXIS)); |
162 |
|
|
|
163 |
|
|
mainPane.add(Box.createRigidArea(new Dimension(0, 6))); |
164 |
|
|
lDescription.setAlignmentX(JPanel.LEFT_ALIGNMENT); |
165 |
|
|
mainPane.add(lDescription); |
166 |
|
|
mainPane.add(Box.createRigidArea(new Dimension(0, 12))); |
167 |
|
|
|
168 |
|
|
mainPane.add(bodyPane); |
169 |
|
|
|
170 |
|
|
setMainPane(mainPane); |
171 |
|
|
} |
172 |
|
|
} |