42 |
import javax.swing.JOptionPane; |
import javax.swing.JOptionPane; |
43 |
import javax.swing.JPanel; |
import javax.swing.JPanel; |
44 |
import javax.swing.JScrollPane; |
import javax.swing.JScrollPane; |
45 |
|
import javax.swing.JSpinner; |
46 |
import javax.swing.JTextField; |
import javax.swing.JTextField; |
47 |
|
import javax.swing.SpinnerNumberModel; |
48 |
|
|
49 |
import javax.swing.event.ListSelectionEvent; |
import javax.swing.event.ListSelectionEvent; |
50 |
import javax.swing.event.ListSelectionListener; |
import javax.swing.event.ListSelectionListener; |
73 |
private final JCheckBox checkManualSelect = |
private final JCheckBox checkManualSelect = |
74 |
new JCheckBox(i18n.getLabel("JSConnectionPropsPane.checkManualSelect")); |
new JCheckBox(i18n.getLabel("JSConnectionPropsPane.checkManualSelect")); |
75 |
|
|
76 |
|
private final JLabel lReadTimeout = |
77 |
|
new JLabel(i18n.getLabel("JSConnectionPropsPane.lReadTimeout")); |
78 |
|
|
79 |
|
private final JSpinner spinnerTimeout = new JSpinner(new SpinnerNumberModel(0, 0, 2000, 1)); |
80 |
|
|
81 |
private final ServerListPane serverListPane; |
private final ServerListPane serverListPane; |
82 |
|
|
83 |
|
|
92 |
checkManualSelect.setAlignmentX(LEFT_ALIGNMENT); |
checkManualSelect.setAlignmentX(LEFT_ALIGNMENT); |
93 |
add(checkManualSelect); |
add(checkManualSelect); |
94 |
add(Box.createRigidArea(new Dimension(0, 6))); |
add(Box.createRigidArea(new Dimension(0, 6))); |
95 |
|
|
96 |
|
JPanel p = new JPanel(); |
97 |
|
p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS)); |
98 |
|
|
99 |
|
p.add(lReadTimeout); |
100 |
|
p.add(Box.createRigidArea(new Dimension(6, 0))); |
101 |
|
|
102 |
|
int i = preferences().getIntProperty(SOCKET_READ_TIMEOUT); |
103 |
|
spinnerTimeout.setValue(i); |
104 |
|
p.add(spinnerTimeout); |
105 |
|
|
106 |
|
p.setAlignmentX(LEFT_ALIGNMENT); |
107 |
|
p.setMaximumSize(new Dimension(Short.MAX_VALUE, p.getPreferredSize().height)); |
108 |
|
add(p); |
109 |
|
add(Box.createRigidArea(new Dimension(0, 6))); |
110 |
|
|
111 |
serverListPane = createServerListPane(); |
serverListPane = createServerListPane(); |
112 |
add(serverListPane); |
add(serverListPane); |
113 |
setMaximumSize(new Dimension(Short.MAX_VALUE, Short.MAX_VALUE)); |
setMaximumSize(new Dimension(Short.MAX_VALUE, Short.MAX_VALUE)); |
129 |
private static JSPrefs |
private static JSPrefs |
130 |
preferences() { return CC.getViewConfig().preferences(); } |
preferences() { return CC.getViewConfig().preferences(); } |
131 |
|
|
132 |
|
/** |
133 |
|
* Gets the read timeout in seconds. |
134 |
|
*/ |
135 |
|
public int |
136 |
|
getReadTimeout() { return Integer.parseInt(spinnerTimeout.getValue().toString()); } |
137 |
|
|
138 |
public void |
public void |
139 |
apply() { |
apply() { |
140 |
boolean b = checkManualSelect.isSelected(); |
boolean b = checkManualSelect.isSelected(); |
141 |
preferences().setBoolProperty(MANUAL_SERVER_SELECT_ON_STARTUP, b); |
preferences().setBoolProperty(MANUAL_SERVER_SELECT_ON_STARTUP, b); |
142 |
|
|
143 |
|
preferences().setIntProperty(SOCKET_READ_TIMEOUT, getReadTimeout()); |
144 |
|
|
145 |
|
CC.setClientReadTimeout(getReadTimeout()); |
146 |
|
|
147 |
int i = serverListPane.serverTable.getSelectedRow(); |
int i = serverListPane.serverTable.getSelectedRow(); |
148 |
if(i != -1) preferences().setIntProperty(SERVER_INDEX, i); |
if(i != -1) preferences().setIntProperty(SERVER_INDEX, i); |
149 |
} |
} |