Mercurial > 510Connectbot
diff src/com/five_ten_sg/connectbot/transport/TN5250.java @ 112:77ac18bc1b2f
cleanup java formatting
author | Carl Byington <carl@five-ten-sg.com> |
---|---|
date | Wed, 18 Jun 2014 13:03:01 -0700 |
parents | 171e0a977544 |
children | 477cca1e0c15 |
line wrap: on
line diff
--- a/src/com/five_ten_sg/connectbot/transport/TN5250.java Wed Jun 18 13:00:19 2014 -0700 +++ b/src/com/five_ten_sg/connectbot/transport/TN5250.java Wed Jun 18 13:03:01 2014 -0700 @@ -74,7 +74,7 @@ private HashMap<Integer, String> mnemonics; public vt320x5250() { - this(80,24); + this(80, 24); } public vt320x5250(int width, int height) { @@ -84,7 +84,6 @@ controls.put(0x09, KEY_TAB); controls.put(0x0d, KEY_ENTER); controls.put(0x1b, KEY_ESCAPE); - mnemonics = new HashMap<Integer, String>(); mnemonics.put(KEY_PAUSE , "[attn]"); mnemonics.put(KEY_F1 , "[pf1]"); @@ -147,6 +146,7 @@ @Override public void write(byte[] b) { if (bridge.monitor != null) bridge.monitor.hostData(b); + screen52.sendKeys(new String(b)); } @Override @@ -156,6 +156,7 @@ } else { if (bridge.monitor != null) bridge.monitor.hostData(b); + screen52.sendKeys(new String(new byte[] {(byte)b})); } } @@ -163,8 +164,10 @@ public void keyPressed(int keyCode, char keyChar, int modifiers) { if (mnemonics.containsKey(keyCode)) { String s = mnemonics.get(keyCode); + if (s != "") { if (bridge.monitor != null) bridge.monitor.hostData(s.getBytes()); + screen52.sendKeys(s); } } @@ -178,11 +181,13 @@ @Override public void putChar(int c, int l, char ch, int attributes) { if (bridge.monitor != null) bridge.monitor.screenChanged(l, c); + super.putChar(c, l, ch, attributes); } @Override public void setCursorPosition(int c, int l) { if (bridge.monitor != null) bridge.monitor.cursorMove(l, c); + super.setCursorPosition(c, l); redraw(); } @@ -190,23 +195,23 @@ public TN5250() { - super(); + super(); } /** * @return protocol part of the URI */ - public static String getProtocolName() { - return PROTOCOL; - } + public static String getProtocolName() { + return PROTOCOL; + } /** * Encode the current transport into a URI that can be passed via intent calls. * @return URI to host */ - public Uri getUri(String input) { + public Uri getUri(String input) { Matcher matcher = hostmask.matcher(input); if (!matcher.matches()) @@ -241,23 +246,26 @@ .append(Uri.encode(input)); Uri uri = Uri.parse(sb.toString()); return uri; - } + } - /** - * Causes transport to connect to the target host. After connecting but before a - * session is started, must call back to {@link TerminalBridge#onConnected()}. - * After that call a session may be opened. - */ - @Override - public void connect() { + /** + * Causes transport to connect to the target host. After connecting but before a + * session is started, must call back to {@link TerminalBridge#onConnected()}. + * After that call a session may be opened. + */ + @Override + public void connect() { screen52 = new Screen5250(); handler = new tnvt(screen52, true, false, bridge, manager); String encryption = host.getEncryption5250(); + if ((encryption == null) || (encryption.length() == 0)) encryption = "NONE"; + screen52.setVT(handler); screen52.setBuffer(buffer); connected = handler.connect(host.getHostname(), host.getPort(), encryption, homeDirectory, buffer); + if (connected) bridge.onConnected(); }