comparison src/com/five_ten_sg/connectbot/transport/TN5250.java @ 147:1350adb077b1

monitor key state tracking
author Carl Byington <carl@five-ten-sg.com>
date Sun, 22 Jun 2014 07:57:20 -0700
parents 4dfa4dd791c1
children 69333ca1563c
comparison
equal deleted inserted replaced
146:8754f293f2fd 147:1350adb077b1
143 } 143 }
144 144
145 // terminal key listener sending to local screen 145 // terminal key listener sending to local screen
146 @Override 146 @Override
147 public void write(byte[] b) { 147 public void write(byte[] b) {
148 if (bridge.monitor != null) bridge.monitor.hostData(b);
149
150 screen52.sendKeys(new String(b)); 148 screen52.sendKeys(new String(b));
151 } 149 }
152 @Override 150 @Override
153 public void write(int b) { 151 public void write(int b) {
154 if (b == 120) { 152 if (b == 120) {
159 setField(-1, -1, new char[] { '2', '3' }); 157 setField(-1, -1, new char[] { '2', '3' });
160 setField(18, 44, new char[0]); 158 setField(18, 44, new char[0]);
161 setField(-1, -1, new char[] { '4', '5' }); 159 setField(-1, -1, new char[] { '4', '5' });
162 return; 160 return;
163 } 161 }
164 if (controls.containsKey(b)) { 162 if (controls.containsKey(b)) keyPressed(controls.get(b), ' ', 0);
165 keyPressed(controls.get(b), ' ', 0); 163 else screen52.sendKeys(new String(new byte[] {(byte)b}));
166 }
167 else {
168 if (bridge.monitor != null) bridge.monitor.hostData(b);
169
170 screen52.sendKeys(new String(new byte[] {(byte)b}));
171 }
172 } 164 }
173 @Override 165 @Override
174 public void keyPressed(int keyCode, char keyChar, int modifiers) { 166 public void keyPressed(int keyCode, char keyChar, int modifiers) {
175 if (mnemonics.containsKey(keyCode)) { 167 if (mnemonics.containsKey(keyCode)) {
176 String s = mnemonics.get(keyCode); 168 String s = mnemonics.get(keyCode);
177 169 if (s != "") screen52.sendKeys(s);
178 if (s != "") {
179 if (bridge.monitor != null) bridge.monitor.hostData(s.getBytes());
180
181 screen52.sendKeys(s);
182 }
183 } 170 }
184 } 171 }
185 // 5250 writing to the screen 172 // 5250 writing to the screen
186 // test for changed screen contents 173 // test for changed screen contents
187 @Override 174 @Override
403 selection.put(HostDatabase.FIELD_HOST_PROTOCOL, PROTOCOL); 390 selection.put(HostDatabase.FIELD_HOST_PROTOCOL, PROTOCOL);
404 selection.put(HostDatabase.FIELD_HOST_NICKNAME, uri.getFragment()); 391 selection.put(HostDatabase.FIELD_HOST_NICKNAME, uri.getFragment());
405 selection.put(HostDatabase.FIELD_HOST_HOSTNAME, uri.getHost()); 392 selection.put(HostDatabase.FIELD_HOST_HOSTNAME, uri.getHost());
406 int port = uri.getPort(); 393 int port = uri.getPort();
407 394
408 if (port < 0) 395 if (port < 0) port = DEFAULT_PORT;
409 port = DEFAULT_PORT;
410 396
411 selection.put(HostDatabase.FIELD_HOST_PORT, Integer.toString(port)); 397 selection.put(HostDatabase.FIELD_HOST_PORT, Integer.toString(port));
412 } 398 }
413 399
414 400
417 HostBean host = new HostBean(); 403 HostBean host = new HostBean();
418 host.setProtocol(PROTOCOL); 404 host.setProtocol(PROTOCOL);
419 host.setHostname(uri.getHost()); 405 host.setHostname(uri.getHost());
420 int port = uri.getPort(); 406 int port = uri.getPort();
421 407
422 if (port < 0) 408 if (port < 0) port = DEFAULT_PORT;
423 port = DEFAULT_PORT;
424 409
425 host.setPort(port); 410 host.setPort(port);
426 String nickname = uri.getFragment(); 411 String nickname = uri.getFragment();
427 412
428 if (nickname == null || nickname.length() == 0) { 413 if (nickname == null || nickname.length() == 0) {