1 /* |
1 /* |
2 * Copyright (c) 2000 - 2006 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2000 - 2006 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
3 * All rights reserved. |
4 * This component and the accompanying materials are made available |
4 * This component and the accompanying materials are made available |
5 * under the terms of "Eclipse Public License v1.0" |
5 * under the terms of the License "Eclipse Public License v1.0" |
6 * which accompanies this distribution, and is available |
6 * which accompanies this distribution, and is available |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
8 * |
8 * |
9 * Initial Contributors: |
9 * Initial Contributors: |
10 * Nokia Corporation - initial contribution. |
10 * Nokia Corporation - initial contribution. |
11 * |
11 * |
12 * Contributors: |
12 * Contributors: |
13 * |
13 * |
14 * Description: |
14 * Description: |
15 * |
15 * |
16 */ |
16 */ |
17 |
|
18 |
17 |
19 package com.nokia.epdt.plugins.s60.pan; |
18 package com.nokia.epdt.plugins.s60.pan; |
20 |
19 |
21 /* java.awt */ |
20 /* java.awt */ |
22 import java.awt.Component; |
21 import java.awt.Component; |
23 import java.awt.BorderLayout; |
22 import java.awt.GridBagConstraints; |
24 import java.awt.GridBagLayout; |
23 import java.awt.GridBagLayout; |
25 import java.awt.GridBagConstraints; |
|
26 |
|
27 /* java.awt.event */ |
|
28 import java.awt.event.ActionEvent; |
24 import java.awt.event.ActionEvent; |
29 import java.awt.event.ActionListener; |
25 import java.awt.event.ActionListener; |
30 |
26 |
31 /* javax.swing */ |
27 import javax.swing.ButtonGroup; |
32 import javax.swing.Icon; |
28 import javax.swing.JComboBox; |
33 import javax.swing.JOptionPane; |
29 import javax.swing.JLabel; |
34 import javax.swing.JPanel; |
30 import javax.swing.JPanel; |
35 import javax.swing.JLabel; |
|
36 import javax.swing.JComboBox; |
|
37 import javax.swing.JRadioButton; |
31 import javax.swing.JRadioButton; |
38 import javax.swing.ButtonGroup; |
|
39 |
|
40 /* javax.swing.border */ |
|
41 import javax.swing.border.EmptyBorder; |
32 import javax.swing.border.EmptyBorder; |
42 import javax.swing.border.TitledBorder; |
33 import javax.swing.border.TitledBorder; |
43 |
34 |
44 /* com.nokia.wtk.util.gui */ |
35 import org.apache.log4j.Logger; |
|
36 |
|
37 import com.nokia.epdt.core.CoreUtils; |
|
38 import com.nokia.wtk.util.gui.BorderPanel; |
45 import com.nokia.wtk.util.gui.GUI; |
39 import com.nokia.wtk.util.gui.GUI; |
46 import com.nokia.wtk.util.gui.BorderPanel; |
|
47 |
40 |
48 /** |
41 /** |
49 * PanPluginJPanel |
42 * PanPluginJPanel |
50 * |
43 * |
51 * @version 1.0 |
44 * @version 1.0 |
52 */ |
45 */ |
53 class PanPluginJPanel extends JPanel |
46 class PanPluginJPanel extends JPanel { |
54 { |
47 private static Logger log = Logger.getLogger(PanPluginJPanel.class); |
55 private static final int GAP = 6; |
48 private static final int GAP = 6; |
56 private static final String AUTO_PORT = "auto"; |
49 private static final String AUTO_PORT = "auto"; |
57 private static final String[] HCI_MODULES = new String[]{"BCSP", "H4", |
50 private static final String[] HCI_MODULES = new String[] { "BCSP"/*, "H4", "USB"*/ }; |
58 "USB"}; |
|
59 private static final int HCI_USB_INDEX = 2; |
51 private static final int HCI_USB_INDEX = 2; |
60 private static final int MAX_COM_PORTS = 16; |
52 private static final int MAX_COM_PORTS = 16; |
61 |
53 |
62 private PanModel panModel; |
54 private PanModel panModel; |
63 private PanPlugin panPlugin; |
55 private PanPlugin panPlugin; |
65 private boolean updateInProgress = false; |
57 private boolean updateInProgress = false; |
66 private JComboBox bluetoothComPortJComboBox; |
58 private JComboBox bluetoothComPortJComboBox; |
67 private JRadioButton bluetoothDisableJRadioButton; |
59 private JRadioButton bluetoothDisableJRadioButton; |
68 private JRadioButton bluetoothEnableJRadioButton; |
60 private JRadioButton bluetoothEnableJRadioButton; |
69 private JComboBox bluetoothHciJComboBox; |
61 private JComboBox bluetoothHciJComboBox; |
70 private JComboBox irdaComPortJComboBox; |
|
71 private JRadioButton irdaDisableJRadioButton; |
|
72 private JRadioButton irdaEnableJRadioButton; |
|
73 |
62 |
74 /** |
63 /** |
75 * Creates new form PanPluginJPanel |
64 * Creates new form PanPluginJPanel |
76 * @param plugin the plugin that creates this panel |
65 * @param plugin the plugin that creates this panel |
77 * @param connected <code>true</code> if we are connected to the emulator |
66 * @param connected <code>true</code> if we are connected to the emulator |
78 */ |
67 */ |
79 PanPluginJPanel(PanPlugin plugin) |
68 PanPluginJPanel(PanPlugin plugin) { |
80 { |
|
81 super(new GridBagLayout()); |
69 super(new GridBagLayout()); |
82 panPlugin = plugin; |
70 panPlugin = plugin; |
83 panModel = plugin.getModel(); |
71 panModel = plugin.getModel(); |
84 initComponents(); |
72 initComponents(); |
85 } |
73 } |
86 |
74 |
87 private static String getResString(String key) |
75 private static String getResString(String key) { |
88 { |
|
89 return PanResourceBundle.getInstance().getValue(key); |
76 return PanResourceBundle.getInstance().getValue(key); |
90 } |
77 } |
91 |
78 |
92 JPanel buildOnePanel(String t, JRadioButton b1, JRadioButton b2, JPanel c) |
79 JPanel buildOnePanel(String t, JRadioButton b1, JRadioButton b2, JPanel c) { |
93 { |
|
94 BorderPanel bp = new BorderPanel(b2); |
80 BorderPanel bp = new BorderPanel(b2); |
95 bp.getContentPanel().add(c); |
81 bp.getContentPanel().add(c); |
96 |
82 |
97 JPanel p = new JPanel(new GridBagLayout()); |
83 JPanel p = new JPanel(new GridBagLayout()); |
98 GridBagConstraints gbc = new GridBagConstraints(); |
84 GridBagConstraints gbc = new GridBagConstraints(); |
118 } |
104 } |
119 |
105 |
120 /** This method is called from within the constructor to |
106 /** This method is called from within the constructor to |
121 * initialize the form. |
107 * initialize the form. |
122 */ |
108 */ |
123 private void initComponents() |
109 private void initComponents() { |
124 { |
|
125 Object[] btComPorts = new Object[MAX_COM_PORTS]; |
110 Object[] btComPorts = new Object[MAX_COM_PORTS]; |
126 Object[] irdaComPorts = new Object[MAX_COM_PORTS]; |
111 for (int i = 0; i < MAX_COM_PORTS; i++) { |
127 for (int i = 0; i < MAX_COM_PORTS; i++) |
|
128 { |
|
129 String label = Integer.toString(i + 1); |
112 String label = Integer.toString(i + 1); |
130 btComPorts[i] = new ComPortItem(label); |
113 btComPorts[i] = new ComPortItem(label); |
131 irdaComPorts[i] = label; |
|
132 } |
114 } |
133 |
115 |
134 bluetoothDisableJRadioButton = new JRadioButton( |
116 bluetoothDisableJRadioButton = new JRadioButton( |
135 getResString(PanConstants.BLUETOOTH_DISABLE_LABEL)); |
117 getResString(PanConstants.BLUETOOTH_DISABLE_LABEL)); |
136 bluetoothEnableJRadioButton = new JRadioButton( |
118 bluetoothEnableJRadioButton = new JRadioButton( |
137 getResString(PanConstants.BLUETOOTH_ENABLE_LABEL)); |
119 getResString(PanConstants.BLUETOOTH_ENABLE_LABEL)); |
138 bluetoothComPortJComboBox = new JComboBox(btComPorts); |
120 bluetoothComPortJComboBox = new JComboBox(btComPorts); |
139 bluetoothHciJComboBox = new JComboBox(HCI_MODULES); |
121 bluetoothHciJComboBox = new JComboBox(HCI_MODULES); |
140 irdaDisableJRadioButton = new JRadioButton( |
|
141 getResString(PanConstants.IRDA_DISABLE_LABEL)); |
|
142 irdaEnableJRadioButton = new JRadioButton( |
|
143 getResString(PanConstants.IRDA_ENABLE_LABEL)); |
|
144 irdaComPortJComboBox = new JComboBox(irdaComPorts); |
|
145 |
122 |
146 // Bluetooth |
123 // Bluetooth |
147 JPanel bluetoothEnableJPanel = GUI |
124 JPanel bluetoothEnableJPanel = GUI |
148 .createRowPanel(new Component[]{ |
125 .createRowPanel(new Component[] { |
149 new JLabel( |
126 new JLabel( |
150 getResString(PanConstants.BLUETOOTH_COM_PORT_LABEL)), |
127 getResString(PanConstants.BLUETOOTH_COM_PORT_LABEL)), |
151 bluetoothComPortJComboBox, |
128 bluetoothComPortJComboBox, |
152 new JLabel( |
129 new JLabel( |
153 getResString(PanConstants.BLUETOOTH_COM_HCI_LABEL)), |
130 getResString(PanConstants.BLUETOOTH_COM_HCI_LABEL)), |
154 bluetoothHciJComboBox}); |
131 bluetoothHciJComboBox }); |
155 |
132 |
156 JPanel bluetoothJPanel = buildOnePanel( |
133 JPanel bluetoothJPanel = buildOnePanel( |
157 getResString(PanConstants.BLUETOOTH_BORDER_TITLE), |
134 getResString(PanConstants.BLUETOOTH_BORDER_TITLE), |
158 bluetoothDisableJRadioButton, bluetoothEnableJRadioButton, |
135 bluetoothDisableJRadioButton, bluetoothEnableJRadioButton, |
159 bluetoothEnableJPanel); |
136 bluetoothEnableJPanel); |
160 |
137 |
161 ButtonGroup bluetoothButtonGroup = new ButtonGroup(); |
138 ButtonGroup bluetoothButtonGroup = new ButtonGroup(); |
162 bluetoothButtonGroup.add(bluetoothDisableJRadioButton); |
139 bluetoothButtonGroup.add(bluetoothDisableJRadioButton); |
163 bluetoothDisableJRadioButton.addActionListener(new ActionListener() |
140 bluetoothDisableJRadioButton.addActionListener(new ActionListener() { |
164 { |
141 public void actionPerformed(ActionEvent evt) { |
165 public void actionPerformed(ActionEvent evt) |
|
166 { |
|
167 bluetoothDisableJRadioButtonActionPerformed(evt); |
142 bluetoothDisableJRadioButtonActionPerformed(evt); |
168 } |
143 } |
169 }); |
144 }); |
170 |
145 |
171 bluetoothButtonGroup.add(bluetoothEnableJRadioButton); |
146 bluetoothButtonGroup.add(bluetoothEnableJRadioButton); |
172 bluetoothEnableJRadioButton.addActionListener(new ActionListener() |
147 bluetoothEnableJRadioButton.addActionListener(new ActionListener() { |
173 { |
148 public void actionPerformed(ActionEvent evt) { |
174 public void actionPerformed(ActionEvent evt) |
|
175 { |
|
176 bluetoothEnableJRadioButtonActionPerformed(evt); |
149 bluetoothEnableJRadioButtonActionPerformed(evt); |
177 } |
150 } |
178 }); |
151 }); |
179 |
152 |
180 bluetoothComPortJComboBox.addActionListener(new ActionListener() |
153 bluetoothComPortJComboBox.addActionListener(new ActionListener() { |
181 { |
154 public void actionPerformed(ActionEvent evt) { |
182 public void actionPerformed(ActionEvent evt) |
|
183 { |
|
184 bluetoothComPortJComboBoxActionPerformed(evt); |
155 bluetoothComPortJComboBoxActionPerformed(evt); |
185 } |
156 } |
186 }); |
157 }); |
187 |
158 |
188 bluetoothHciJComboBox.addActionListener(new ActionListener() |
159 bluetoothHciJComboBox.addActionListener(new ActionListener() { |
189 { |
160 public void actionPerformed(ActionEvent evt) { |
190 public void actionPerformed(ActionEvent evt) |
|
191 { |
|
192 bluetoothHciJComboBoxActionPerformed(evt); |
161 bluetoothHciJComboBoxActionPerformed(evt); |
193 } |
|
194 }); |
|
195 |
|
196 // IRDA |
|
197 JPanel irdaEnableJPanel = GUI.createRowPanel(new Component[]{ |
|
198 new JLabel(getResString(PanConstants.IRDA_COM_PORT_LABEL)), |
|
199 irdaComPortJComboBox}); |
|
200 |
|
201 JPanel irdaJPanel = buildOnePanel( |
|
202 getResString(PanConstants.IRDA_BORDER_TITLE), |
|
203 irdaDisableJRadioButton, irdaEnableJRadioButton, |
|
204 irdaEnableJPanel); |
|
205 |
|
206 ButtonGroup irdaButtonGroup = new ButtonGroup(); |
|
207 irdaButtonGroup.add(irdaDisableJRadioButton); |
|
208 irdaDisableJRadioButton.addActionListener(new ActionListener() |
|
209 { |
|
210 public void actionPerformed(ActionEvent evt) |
|
211 { |
|
212 irdaDisableJRadioButtonActionPerformed(evt); |
|
213 } |
|
214 }); |
|
215 |
|
216 irdaButtonGroup.add(irdaEnableJRadioButton); |
|
217 irdaEnableJRadioButton.addActionListener(new ActionListener() |
|
218 { |
|
219 public void actionPerformed(ActionEvent evt) |
|
220 { |
|
221 irdaEnableJRadioButtonActionPerformed(evt); |
|
222 } |
|
223 }); |
|
224 |
|
225 irdaComPortJComboBox.addActionListener(new ActionListener() |
|
226 { |
|
227 public void actionPerformed(ActionEvent evt) |
|
228 { |
|
229 irdaComPortJComboBoxActionPerformed(evt); |
|
230 } |
162 } |
231 }); |
163 }); |
232 |
164 |
233 JPanel row = new JPanel(new GridBagLayout()); |
165 JPanel row = new JPanel(new GridBagLayout()); |
234 GridBagConstraints gbc = new GridBagConstraints(); |
166 GridBagConstraints gbc = new GridBagConstraints(); |
253 |
184 |
254 setBorder(new EmptyBorder(GAP, GAP, GAP, GAP)); |
185 setBorder(new EmptyBorder(GAP, GAP, GAP, GAP)); |
255 |
186 |
256 //Set the initial values, obtained from .esk files: |
187 //Set the initial values, obtained from .esk files: |
257 update(); |
188 update(); |
|
189 log.debug("Done initComponents"); |
258 } |
190 } |
259 |
191 |
260 /** |
192 /** |
261 * Update UI components from Model: |
193 * Update UI components from Model: |
262 */ |
194 */ |
263 public void update() |
195 public void update() { |
264 { |
196 log.debug("update() updateInProgress: " + updateInProgress); |
265 // Update Bluetooth panel |
197 // Update Bluetooth panel |
266 if (!updateInProgress) |
198 try { |
267 {//If the function is not called as the result of components updates, |
199 if (!updateInProgress) |
268 //i.e. there is no update ongiong already |
200 log.debug("Inside if loop of update"); |
269 updateInProgress = true; |
201 {//If the function is not called as the result of components updates, |
270 boolean bluetoothEnabled = panModel.isBluetoothEnabled(); |
202 //i.e. there is no update ongiong already |
271 int hci = panModel.getBluetoothHci(); |
203 updateInProgress = true; |
272 boolean usb = (hci == HCI_USB_INDEX); |
204 boolean bluetoothEnabled = panModel.isBluetoothEnabled(); |
273 bluetoothDisableJRadioButton.setSelected(!bluetoothEnabled); |
205 log.debug("bluetooth Enable: " + bluetoothEnabled); |
274 bluetoothEnableJRadioButton.setSelected(bluetoothEnabled); |
206 int hci = panModel.getBluetoothHci(); |
275 bluetoothHciJComboBox.setSelectedIndex(bluetoothEnabled ? hci : -1); |
207 boolean usb = (hci == HCI_USB_INDEX); |
276 bluetoothHciJComboBox.setEnabled(bluetoothEnabled); |
208 log.debug("hci USB index: " + hci); |
277 bluetoothComPortJComboBox.setEnabled(bluetoothEnabled); |
209 bluetoothDisableJRadioButton.setSelected(!bluetoothEnabled); |
278 bluetoothComPortJComboBox.setSelectedIndex(panModel |
210 bluetoothEnableJRadioButton.setSelected(bluetoothEnabled); |
279 .getBluetoothComPort()); |
211 bluetoothHciJComboBox.setSelectedIndex(bluetoothEnabled ? hci |
280 bluetoothComPortJComboBox.setEnabled(bluetoothEnabled && !usb); |
212 : -1); |
281 |
213 bluetoothHciJComboBox.setEnabled(bluetoothEnabled); |
282 // Update IRDA panel |
214 bluetoothComPortJComboBox.setEnabled(bluetoothEnabled); |
283 boolean irdaEnabled = panModel.isIrdaEnabled(); |
215 log.debug("bluetooth COM port: " + panModel.getBluetoothComPort()); |
284 irdaDisableJRadioButton.setSelected(!irdaEnabled); |
216 bluetoothComPortJComboBox.setSelectedIndex(panModel |
285 irdaEnableJRadioButton.setSelected(irdaEnabled); |
217 .getBluetoothComPort()); |
286 irdaComPortJComboBox.setEnabled(irdaEnabled); |
218 bluetoothComPortJComboBox.setEnabled(bluetoothEnabled && !usb); |
287 irdaComPortJComboBox.setSelectedIndex(panModel.getIrdaComPort()); |
219 |
288 updateInProgress = false; |
220 updateInProgress = false; |
289 } |
221 log.debug("If loop over"); |
290 } |
222 } |
291 |
223 } catch (RuntimeException e) { |
292 private void irdaComPortJComboBoxActionPerformed(ActionEvent evt) |
224 log.debug("Runtime Exception: " + e.getMessage()); |
293 { |
225 e.printStackTrace(); |
294 if (!updateInProgress) |
226 } |
295 {//I.e. if update came from UI |
227 } |
296 if (panModel.getBluetoothHci() == panModel.BT_HCI_USB_INDEX || |
228 |
297 //HCI is not USB, where com port is selected automatically |
229 private void bluetoothEnableJRadioButtonActionPerformed(ActionEvent evt) { |
298 irdaComPortJComboBox.getSelectedIndex() != panModel |
230 if (!updateInProgress) {//I.e. if update came from UI |
299 .getBluetoothComPort()) |
231 |
300 //or com ports are different |
232 log.debug(CoreUtils.EpocRoot() + FindAvailablePort.EXECUTABLE_FILE_NAME); |
301 { |
233 |
302 panModel |
234 FindAvailablePort availPort = FindAvailablePort.findAvailablePort(); |
303 .setIrdaComPort(irdaComPortJComboBox.getSelectedIndex()); |
235 String port = null; |
304 panPlugin.pluginModelChangedAction(); |
236 try { |
305 } else |
237 port = availPort.getAvailablePortForBT(CoreUtils.EpocRoot() |
306 { |
238 + FindAvailablePort.EXECUTABLE_FILE_NAME); |
307 irdaComPortJComboBox |
239 |
308 .setSelectedIndex(panModel.getIrdaComPort()); |
240 if (port == null) { |
309 JOptionPane.showMessageDialog(this, |
241 log.debug(FindAvailablePort.NO_AVAILABLE_PORT_MESSAGE); |
310 getResString("comPortEqualWarning"), |
242 // We set the default values of com ports (COM 1) when |
311 getResString("dialogTitle"), JOptionPane.ERROR_MESSAGE); |
243 // switching from disabled mode |
312 } |
244 panModel.setBluetoothComPort(0); |
313 } |
245 } else { |
314 } |
246 log.debug(FindAvailablePort.AVAILABLE_PORT_MESSAGE + port); |
315 |
247 // Set the port |
316 private void irdaEnableJRadioButtonActionPerformed(ActionEvent evt) |
248 int setTempPort = Integer.parseInt(port.trim())-1; |
317 { |
249 panModel.setBluetoothComPort(setTempPort); |
318 if (!updateInProgress) |
250 System.out.println("Output: " + port); |
319 {//I.e. if update came from UI |
251 } |
320 //We set the default values of com ports (COM 1) when switching |
252 } catch (Exception e) { |
321 //from disabled mode |
253 log.debug("Error reading COM port. BT enabled. Port set to 1."); |
322 panModel.setIrdaComPort(0); |
254 // Set the default port 1 as a BT port and enable the BT |
|
255 panModel.setBluetoothComPort(0); |
|
256 e.printStackTrace(); |
|
257 } |
|
258 |
323 panPlugin.pluginModelChangedAction(); |
259 panPlugin.pluginModelChangedAction(); |
324 update(); |
260 update(); |
325 } |
261 } |
326 } |
262 } |
327 |
263 |
328 private void irdaDisableJRadioButtonActionPerformed(ActionEvent evt) |
264 private void bluetoothDisableJRadioButtonActionPerformed(ActionEvent evt) { |
329 { |
265 if (!updateInProgress) {//I.e. if update came from UI |
330 if (!updateInProgress) |
|
331 {//I.e. if update came from UI |
|
332 //Setting com port to -1 means disabling it |
|
333 panModel.setIrdaComPort(-1); |
|
334 panPlugin.pluginModelChangedAction(); |
|
335 update(); |
|
336 } |
|
337 } |
|
338 |
|
339 private void bluetoothEnableJRadioButtonActionPerformed(ActionEvent evt) |
|
340 { |
|
341 if (!updateInProgress) |
|
342 {//I.e. if update came from UI |
|
343 //We set the default values of com ports (COM 1) when switching |
|
344 //from disabled mode |
|
345 panModel.setBluetoothComPort(0); |
|
346 panPlugin.pluginModelChangedAction(); |
|
347 update(); |
|
348 } |
|
349 } |
|
350 |
|
351 private void bluetoothDisableJRadioButtonActionPerformed(ActionEvent evt) |
|
352 { |
|
353 if (!updateInProgress) |
|
354 {//I.e. if update came from UI |
|
355 //Setting com port to -1 means disabling it |
266 //Setting com port to -1 means disabling it |
356 panModel.setBluetoothComPort(-1); |
267 panModel.setBluetoothComPort(-1); |
357 panPlugin.pluginModelChangedAction(); |
268 panPlugin.pluginModelChangedAction(); |
358 update(); |
269 update(); |
359 } |
270 } |
360 } |
271 } |
361 |
272 |
362 private void bluetoothHciJComboBoxActionPerformed(ActionEvent evt) |
273 private void bluetoothHciJComboBoxActionPerformed(ActionEvent evt) { |
363 { |
274 if (!updateInProgress) {//I.e. if update came from UI |
364 if (!updateInProgress) |
|
365 {//I.e. if update came from UI |
|
366 int index = bluetoothHciJComboBox.getSelectedIndex(); |
275 int index = bluetoothHciJComboBox.getSelectedIndex(); |
367 if (index >= 0) |
276 if (index >= 0) { |
368 { |
|
369 panModel.setBluetoothHci(index); |
277 panModel.setBluetoothHci(index); |
370 panPlugin.pluginModelChangedAction(); |
278 panPlugin.pluginModelChangedAction(); |
371 update(); |
279 update(); |
372 } |
280 } |
373 } |
281 } |
374 } |
282 } |
375 |
283 |
376 private void bluetoothComPortJComboBoxActionPerformed(ActionEvent evt) |
284 private void bluetoothComPortJComboBoxActionPerformed(ActionEvent evt) { |
377 { |
285 if (!updateInProgress) {//I.e. if update came from UI |
378 if (!updateInProgress) |
286 |
379 {//I.e. if update came from UI |
287 panModel.setBluetoothComPort(bluetoothComPortJComboBox |
380 if (bluetoothComPortJComboBox.getSelectedIndex() != panModel |
288 .getSelectedIndex()); |
381 .getIrdaComPort()) |
289 panPlugin.pluginModelChangedAction(); |
382 { |
290 } |
383 panModel.setBluetoothComPort(bluetoothComPortJComboBox |
291 } |
384 .getSelectedIndex()); |
292 |
385 panPlugin.pluginModelChangedAction(); |
293 private class ComPortItem { |
386 } else |
|
387 { |
|
388 bluetoothComPortJComboBox.setSelectedIndex(panModel |
|
389 .getBluetoothComPort()); |
|
390 JOptionPane.showMessageDialog(this, |
|
391 getResString("comPortEqualWarning"), |
|
392 getResString("dialogTitle"), JOptionPane.ERROR_MESSAGE); |
|
393 } |
|
394 } |
|
395 } |
|
396 |
|
397 private class ComPortItem |
|
398 { |
|
399 private String comPortNumber; |
294 private String comPortNumber; |
400 ComPortItem(String label) |
295 |
401 { |
296 ComPortItem(String label) { |
402 comPortNumber = label; |
297 comPortNumber = label; |
403 } |
298 } |
404 public String toString() |
299 |
405 { |
300 public String toString() { |
406 return panModel.getBluetoothHci() == HCI_USB_INDEX |
301 |
407 ? AUTO_PORT |
302 return panModel.getBluetoothHci() == HCI_USB_INDEX ? AUTO_PORT |
408 : comPortNumber; |
303 : comPortNumber; |
409 } |
304 } |
410 } |
305 } |
411 |
306 |
412 } |
307 } |