1 |
iliev |
787 |
/* |
2 |
|
|
* JSampler - a java front-end for LinuxSampler |
3 |
|
|
* |
4 |
iliev |
2288 |
* Copyright (C) 2005-2011 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.JLabel; |
36 |
|
|
import javax.swing.JPanel; |
37 |
|
|
import javax.swing.JTextField; |
38 |
|
|
|
39 |
iliev |
2288 |
import net.sf.juife.swing.InformationDialog; |
40 |
iliev |
787 |
|
41 |
|
|
import org.jsampler.CC; |
42 |
|
|
|
43 |
|
|
import org.linuxsampler.lscp.ServerInfo; |
44 |
|
|
|
45 |
|
|
import static org.jsampler.view.classic.ClassicI18n.i18n; |
46 |
|
|
|
47 |
|
|
|
48 |
|
|
/** |
49 |
|
|
* |
50 |
|
|
* @author Grigor Iliev |
51 |
|
|
*/ |
52 |
|
|
public class SamplerInfoDlg extends InformationDialog { |
53 |
iliev |
1285 |
private final JLabel lLinuxSamplerLogo = new JLabel(Res.iconLinuxSamplerLogo); |
54 |
iliev |
787 |
private final JLabel lDescription = new JLabel(); |
55 |
|
|
private final JLabel lVersion = new JLabel(i18n.getLabel("SamplerInfoDlg.lVersion")); |
56 |
|
|
private final JLabel lProtocolVersion = |
57 |
|
|
new JLabel(i18n.getLabel("SamplerInfoDlg.lProtocolVersion")); |
58 |
|
|
|
59 |
iliev |
1285 |
private final JLabel lDbSupport = new JLabel(i18n.getLabel("SamplerInfoDlg.lDbSupport")); |
60 |
iliev |
787 |
private final JTextField tfVersion = new JTextField(); |
61 |
|
|
private final JTextField tfProtocolVersion = new JTextField(); |
62 |
iliev |
1285 |
private final JTextField tfDbSupport = new JTextField(); |
63 |
iliev |
787 |
|
64 |
|
|
|
65 |
|
|
/** Creates a new instance of SamplerInfoDlg */ |
66 |
|
|
public SamplerInfoDlg(Frame owner) { |
67 |
|
|
super(owner, i18n.getLabel("SamplerInfoDlg.title")); |
68 |
|
|
|
69 |
|
|
showCloseButton(false); |
70 |
|
|
setResizable(false); |
71 |
|
|
|
72 |
|
|
JPanel mainPane = new JPanel(); |
73 |
|
|
ServerInfo si = CC.getSamplerModel().getServerInfo(); |
74 |
|
|
|
75 |
|
|
if(si == null) { |
76 |
|
|
mainPane.add(new JLabel(i18n.getLabel("SamplerInfoDlg.unavailable"))); |
77 |
|
|
setMainPane(mainPane); |
78 |
|
|
return; |
79 |
|
|
} |
80 |
|
|
|
81 |
|
|
lDescription.setText(si.getDescription()); |
82 |
|
|
tfVersion.setText(si.getVersion()); |
83 |
|
|
tfProtocolVersion.setText(si.getProtocolVersion()); |
84 |
iliev |
1285 |
if(si.hasInstrumentsDbSupport()) { |
85 |
|
|
tfDbSupport.setText(i18n.getButtonLabel("yes")); |
86 |
|
|
} else { |
87 |
|
|
tfDbSupport.setText(i18n.getButtonLabel("no")); |
88 |
|
|
} |
89 |
iliev |
787 |
|
90 |
|
|
tfVersion.setEditable(false); |
91 |
iliev |
1285 |
tfVersion.setOpaque(false); |
92 |
iliev |
787 |
tfVersion.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); |
93 |
|
|
|
94 |
|
|
tfProtocolVersion.setEditable(false); |
95 |
iliev |
1285 |
tfProtocolVersion.setOpaque(false); |
96 |
iliev |
787 |
tfProtocolVersion.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); |
97 |
|
|
|
98 |
iliev |
1285 |
tfDbSupport.setEditable(false); |
99 |
|
|
tfDbSupport.setOpaque(false); |
100 |
|
|
tfDbSupport.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); |
101 |
iliev |
787 |
|
102 |
iliev |
1285 |
|
103 |
iliev |
787 |
JPanel infoPane = new JPanel(); |
104 |
|
|
|
105 |
|
|
GridBagLayout gridbag = new GridBagLayout(); |
106 |
|
|
GridBagConstraints c = new GridBagConstraints(); |
107 |
|
|
|
108 |
|
|
infoPane.setLayout(gridbag); |
109 |
|
|
|
110 |
|
|
c.gridx = 0; |
111 |
|
|
c.gridy = 0; |
112 |
|
|
c.insets = new Insets(3, 3, 3, 3); |
113 |
|
|
c.anchor = GridBagConstraints.EAST; |
114 |
|
|
gridbag.setConstraints(lVersion, c); |
115 |
|
|
infoPane.add(lVersion); |
116 |
|
|
|
117 |
|
|
c.gridx = 0; |
118 |
|
|
c.gridy = 1; |
119 |
|
|
gridbag.setConstraints(lProtocolVersion, c); |
120 |
|
|
infoPane.add(lProtocolVersion); |
121 |
|
|
|
122 |
iliev |
1285 |
c.gridx = 0; |
123 |
|
|
c.gridy = 2; |
124 |
|
|
gridbag.setConstraints(lDbSupport, c); |
125 |
|
|
infoPane.add(lDbSupport); |
126 |
|
|
|
127 |
iliev |
787 |
c.gridx = 1; |
128 |
|
|
c.gridy = 0; |
129 |
iliev |
1285 |
c.weightx = 1.0; |
130 |
|
|
c.fill = GridBagConstraints.HORIZONTAL; |
131 |
iliev |
787 |
c.anchor = GridBagConstraints.WEST; |
132 |
|
|
gridbag.setConstraints(tfVersion, c); |
133 |
|
|
infoPane.add(tfVersion); |
134 |
|
|
|
135 |
|
|
c.gridx = 1; |
136 |
|
|
c.gridy = 1; |
137 |
|
|
gridbag.setConstraints(tfProtocolVersion, c); |
138 |
|
|
infoPane.add(tfProtocolVersion); |
139 |
|
|
|
140 |
iliev |
1285 |
c.gridx = 1; |
141 |
|
|
c.gridy = 2; |
142 |
|
|
gridbag.setConstraints(tfDbSupport, c); |
143 |
|
|
infoPane.add(tfDbSupport); |
144 |
|
|
|
145 |
iliev |
787 |
//infoPane.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED)); |
146 |
|
|
infoPane.setMaximumSize(infoPane.getPreferredSize()); |
147 |
|
|
|
148 |
|
|
JPanel bodyPane = new JPanel(); |
149 |
|
|
bodyPane.setLayout(new BoxLayout(bodyPane, BoxLayout.X_AXIS)); |
150 |
|
|
bodyPane.setAlignmentX(JPanel.LEFT_ALIGNMENT); |
151 |
|
|
|
152 |
|
|
bodyPane.add(lLinuxSamplerLogo); |
153 |
|
|
bodyPane.add(Box.createRigidArea(new Dimension(6, 0))); |
154 |
|
|
bodyPane.add(infoPane); |
155 |
|
|
|
156 |
|
|
|
157 |
|
|
mainPane.setLayout(new BoxLayout(mainPane, BoxLayout.Y_AXIS)); |
158 |
|
|
|
159 |
|
|
mainPane.add(Box.createRigidArea(new Dimension(0, 6))); |
160 |
|
|
lDescription.setAlignmentX(JPanel.LEFT_ALIGNMENT); |
161 |
|
|
mainPane.add(lDescription); |
162 |
|
|
mainPane.add(Box.createRigidArea(new Dimension(0, 12))); |
163 |
|
|
|
164 |
|
|
mainPane.add(bodyPane); |
165 |
|
|
|
166 |
|
|
setMainPane(mainPane); |
167 |
|
|
} |
168 |
|
|
} |