comparison src/com/five_ten_sg/connectbot/service/TerminalBridge.java @ 112:77ac18bc1b2f

cleanup java formatting
author Carl Byington <carl@five-ten-sg.com>
date Wed, 18 Jun 2014 13:03:01 -0700
parents e1c43d50f9d8
children cb3b9b660b3d
comparison
equal deleted inserted replaced
111:6a0ad4d384ea 112:77ac18bc1b2f
174 float hostFontSize; 174 float hostFontSize;
175 this.manager = manager; 175 this.manager = manager;
176 this.host = host; 176 this.host = host;
177 this.homeDirectory = homeDirectory; 177 this.homeDirectory = homeDirectory;
178 emulation = host.getHostEmulation(); 178 emulation = host.getHostEmulation();
179
179 if ((emulation == null) || (emulation.length() == 0)) emulation = manager.getEmulation(); 180 if ((emulation == null) || (emulation.length() == 0)) emulation = manager.getEmulation();
181
180 // create prompt helper to relay password and hostkey requests up to gui 182 // create prompt helper to relay password and hostkey requests up to gui
181 promptHelper = new PromptHelper(this); 183 promptHelper = new PromptHelper(this);
182 // create our default paint 184 // create our default paint
183 defaultPaint = new Paint(); 185 defaultPaint = new Paint();
184 defaultPaint.setAntiAlias(true); 186 defaultPaint.setAntiAlias(true);
215 protected void startConnection() { 217 protected void startConnection() {
216 transport = TransportFactory.getTransport(host.getProtocol()); 218 transport = TransportFactory.getTransport(host.getProtocol());
217 transport.setLinks(manager, this, homeDirectory, host, emulation); 219 transport.setLinks(manager, this, homeDirectory, host, emulation);
218 buffer = transport.getTransportBuffer(); 220 buffer = transport.getTransportBuffer();
219 keyListener = transport.getTerminalKeyListener(); 221 keyListener = transport.getTerminalKeyListener();
220
221 String monitor_init = host.getMonitor(); 222 String monitor_init = host.getMonitor();
223
222 if ((monitor_init != null) && (monitor_init.length() > 0)) { 224 if ((monitor_init != null) && (monitor_init.length() > 0)) {
223 monitor = new TerminalMonitor(manager, buffer, keyListener, parent, monitor_init); 225 monitor = new TerminalMonitor(manager, buffer, keyListener, parent, monitor_init);
224 } 226 }
225 227
226 transport.setCompression(host.getCompression()); 228 transport.setCompression(host.getCompression());
260 /** 262 /**
261 * @return charset in use by bridge 263 * @return charset in use by bridge
262 */ 264 */
263 public Charset getCharset() { 265 public Charset getCharset() {
264 if (relay != null) return relay.getCharset(); 266 if (relay != null) return relay.getCharset();
267
265 return keyListener.getCharset(); 268 return keyListener.getCharset();
266 } 269 }
267 270
268 /** 271 /**
269 * Sets the encoding used by the terminal. If the connection is live, 272 * Sets the encoding used by the terminal. If the connection is live,
270 * then the character set is changed for the next read. 273 * then the character set is changed for the next read.
271 * @param encoding the canonical name of the character encoding 274 * @param encoding the canonical name of the character encoding
272 */ 275 */
273 public void setCharset(String encoding) { 276 public void setCharset(String encoding) {
274 if (relay != null) relay.setCharset(encoding); 277 if (relay != null) relay.setCharset(encoding);
278
275 keyListener.setCharset(encoding); 279 keyListener.setCharset(encoding);
276 } 280 }
277 281
278 /** 282 /**
279 * Convenience method for writing a line into the underlying MUD buffer. 283 * Convenience method for writing a line into the underlying MUD buffer.
417 disconnectPromptThread.start(); 421 disconnectPromptThread.start();
418 } 422 }
419 423
420 // close the monitor 424 // close the monitor
421 if (monitor != null) monitor.Disconnect(); 425 if (monitor != null) monitor.Disconnect();
426
422 monitor = null; 427 monitor = null;
423 } 428 }
424 429
425 public void setSelectingForCopy(boolean selectingForCopy) { 430 public void setSelectingForCopy(boolean selectingForCopy) {
426 this.selectingForCopy = selectingForCopy; 431 this.selectingForCopy = selectingForCopy;
1383 keyCode == KeyEvent.KEYCODE_BACK) { 1388 keyCode == KeyEvent.KEYCODE_BACK) {
1384 dismiss(); 1389 dismiss();
1385 return true; 1390 return true;
1386 } 1391 }
1387 } 1392 }
1393
1388 return super.dispatchKeyEvent(event); 1394 return super.dispatchKeyEvent(event);
1389 } 1395 }
1390 }; 1396 };
1391 cpd.show(); 1397 cpd.show();
1392 return true; 1398 return true;