source: other-projects/trunk/gs3-release-maker/tasks/sshtaskdef/src/mindbright/application/MindTerm.java@ 14627

Last change on this file since 14627 was 14627, checked in by oranfry, 17 years ago

initial import of the gs3-release-maker

File size: 22.0 KB
Line 
1/******************************************************************************
2 *
3 * Copyright (c) 1998,99 by Mindbright Technology AB, Stockholm, Sweden.
4 * www.mindbright.se, [email protected]
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 *****************************************************************************
17 * $Author: mats $
18 * $Date: 2000/08/01 20:37:08 $
19 * $Name: rel1-2-1 $
20 *****************************************************************************/
21package mindbright.application;
22
23import java.io.*;
24
25import java.applet.Applet;
26
27import java.awt.*;
28import java.awt.event.*;
29import java.util.NoSuchElementException;
30import java.util.Properties;
31import java.util.Hashtable;
32import java.util.Enumeration;
33
34import mindbright.ssh.*;
35import mindbright.security.*;
36import mindbright.terminal.*;
37
38public class MindTerm extends Applet implements Runnable {
39
40 static Properties paramTermProps = new Properties();
41 static Properties paramSSHProps = new Properties();
42
43 public static String javaVersion = "<unknown>";
44 public static String javaVendor = "<unknown>";
45 public static String osName = "<unknown>";
46 public static String osArch = "<unknown>";
47 public static String osVersion = "<unknown>";
48
49 Frame frame;
50 TerminalWin term;
51 SSHInteractiveClient client;
52 SSHInteractiveClient sshClone;
53 SSHStdIO console;
54 Thread clientThread;
55
56 boolean mergedTermProps;
57 Properties sshProps;
58 Properties termProps;
59
60 String[] cmdLineArgs;
61
62 String commandLine = null;
63 String sshHomeDir = null;
64 String propsFile = null;
65
66 boolean usePopMenu = false;
67 boolean haveMenus = true;
68 boolean haveGUI = true;
69 boolean cmdsh = false;
70 boolean quiet = true;
71
72 boolean helpinfo = true;
73 String startupMsg = null;
74
75 boolean doSCP = false;
76 boolean recursiveSCP = false;
77 boolean toRemote = true;
78 int firstArg = 0;
79
80 boolean autoSaveProps = true;
81 boolean autoLoadProps = true;
82
83 boolean savePasswords = false;
84
85 int popButtonNum = 3;
86
87 boolean isClosing = false;
88
89 // !!!
90 boolean separateFrame = true;
91 boolean weAreAnApplet = false;
92
93 static Hashtable terminals = new Hashtable();
94
95 static synchronized boolean isLastTerminal() {
96 return terminals.isEmpty();
97 }
98
99 static synchronized void addTerminal(MindTerm mindterm) {
100 terminals.put(mindterm, mindterm);
101 }
102
103 static synchronized void removeTerminal(MindTerm mindterm) {
104 terminals.remove(mindterm);
105 }
106
107 public MindTerm() {
108 super();
109 this.sshProps = paramSSHProps;
110 this.termProps = paramTermProps;
111 addTerminal(this);
112 }
113
114 public MindTerm(Properties sshProps, Properties termProps) {
115 this.sshProps = sshProps;
116 this.termProps = termProps;
117 addTerminal(this);
118 }
119
120 public static void main(String[] argv) {
121 MindTerm controller = new MindTerm(paramSSHProps, paramTermProps);
122 controller.cmdLineArgs = argv;
123
124 try {
125 controller.getApplicationParams();
126 } catch (Exception e) {
127 System.out.println("Error: " + e.getMessage());
128 System.exit(1);
129 }
130
131 try {
132 controller.run();
133 } catch (Exception e) {
134 System.out.println("Error, please mail below stack-trace to [email protected]");
135 e.printStackTrace();
136 }
137 }
138
139 public void init() {
140 if(SSH.NETSCAPE_SECURITY_MODEL) {
141 try {
142 netscape.security.PrivilegeManager.enablePrivilege("TerminalEmulator");
143 } catch (netscape.security.ForbiddenTargetException e) {
144 // !!!
145 }
146 }
147 weAreAnApplet = true;
148 autoSaveProps = false;
149 autoLoadProps = false;
150 savePasswords = false;
151
152 getAppletParams();
153 (new Thread(this)).start();
154 }
155
156 public void run() {
157 try {
158 if(sshClone != null) {
159 client = new SSHInteractiveClient(sshClone);
160 sshClone = null;
161 } else {
162 // Default when running single command is not to allocate a PTY
163 //
164 if(commandLine != null && sshProps.getProperty("forcpty") == null) {
165 sshProps.put("forcpty", "false");
166 }
167
168 SSHPropertyHandler propsHandler = new SSHPropertyHandler(sshProps);
169
170 if(propsFile != null) {
171 // !!! REMOVE (todo: fix password!)
172 try {
173 propsHandler = SSHPropertyHandler.fromFile(propsFile, "");
174 } catch (SSHClient.AuthFailException e) {
175 throw new Exception("Sorry, can only use passwordless settings files for now");
176 }
177 propsHandler.mergeProperties(sshProps);
178 }
179
180 client = new SSHInteractiveClient(quiet, cmdsh, propsHandler);
181 }
182
183 console = (SSHStdIO)client.getConsole();
184
185 if(SSHInteractiveClient.licensed) {
186 client.wantHelpInfo = helpinfo;
187 client.customStartMessage = startupMsg;
188 }
189
190 // If we loaded a specific property-file we merge the termProps from there
191 //
192 if(client.getPropertyHandler().getInitTerminalProperties() != null) {
193 Properties newTermProps =
194 new Properties(client.getPropertyHandler().getInitTerminalProperties());
195 if(termProps != null && !termProps.isEmpty()) {
196 Enumeration enum = termProps.keys();
197 while(enum.hasMoreElements()) {
198 String name = (String)enum.nextElement();
199 newTermProps.put(name, termProps.getProperty(name));
200 }
201 mergedTermProps = true;
202 }
203 termProps = newTermProps;
204 }
205
206 // First we initialize the GUI if we have one (to be able to set
207 // properties to terminal
208 //
209 if(haveGUI) {
210 initGUI();
211 console.setTerminal(term);
212 console.setOwnerContainer(frame);
213 console.setOwnerName(SSH.VER_MINDTERM);
214 console.updateTitle();
215 try {
216 while(!frame.isShowing())
217 Thread.sleep(50);
218 } catch(InterruptedException e) {
219 // !!!
220 }
221
222 // !!! When we are in the Panel of the Applet we don't get a componentShown event
223 // so we have to "emulate" it since we depend on it to be correctly drawn
224 //
225 if(!separateFrame) {
226 term.emulateComponentShown();
227 }
228 }
229
230 client.printCopyright();
231
232 client.getPropertyHandler().setSSHHomeDir(sshHomeDir);
233 client.getPropertyHandler().setAutoSaveProps(autoLoadProps);
234 client.getPropertyHandler().setAutoLoadProps(autoSaveProps);
235 client.getPropertyHandler().setSavePasswords(savePasswords);
236 client.updateMenus();
237
238 if(commandLine != null) {
239 if(!doSCP) {
240 client.doSingleCommand(commandLine, false, 0);
241 } else {
242 if((cmdLineArgs.length - firstArg) < 2)
243 throw new Exception("scp must have at least two arguments (<source> <destination>)");
244 String[] fileList = new String[cmdLineArgs.length - firstArg - 1];
245 String target, source = commandLine.substring(0, commandLine.lastIndexOf(' '));
246 for(int i = firstArg; i < cmdLineArgs.length - 1; i++) {
247 fileList[i - firstArg] = cmdLineArgs[i];
248 }
249 target = cmdLineArgs[cmdLineArgs.length - 1];
250 String srvHost = client.getPropertyHandler().getSrvHost();
251 int srvPort = client.getPropertyHandler().getSrvPort();
252 SSHSCP scp = new SSHSCP(srvHost, srvPort, client.getPropertyHandler(),
253 new File("."), SSH.DEBUG, recursiveSCP);
254 if(SSH.DEBUG) {
255 scp.setInteractor(client);
256 scp.setIndicator(new SSHSCPStdoutIndicator());
257 }
258 if(toRemote) {
259 scp.copyToRemote(fileList, target);
260 } else {
261 scp.copyToLocal(target, source);
262 }
263 }
264 } else {
265 try {
266 clientThread = new Thread(client);
267 clientThread.start();
268 clientThread.join();
269 } catch(InterruptedException e) {
270 // !!!
271 }
272 }
273
274 } catch (IllegalArgumentException ae) {
275 if(client != null)
276 client.alert(ae.getMessage());
277 System.out.println(ae.getMessage());
278 } catch (FileNotFoundException fe) {
279 System.out.println("Settings-file not found: " + fe.getMessage());
280 } catch (Exception e) {
281 if(client != null)
282 client.alert("Error: " + e.getMessage());
283 System.out.println("Error: " + e.getMessage());
284 if(SSH.DEBUGMORE) {
285 System.out.println("Please send the below stack-trace to [email protected]");
286 e.printStackTrace();
287 }
288 }
289
290 windowClosing(null);
291 if(isLastTerminal())
292 doExit();
293 }
294
295 public void getAppletParams() {
296 String name;
297 String value;
298 String param;
299 int i;
300
301 try {
302 separateFrame = (new Boolean(getParameter("sepframe"))).booleanValue();
303 } catch (Exception e) {
304 separateFrame = true;
305 }
306 try {
307 SSH.DEBUG = (new Boolean(getParameter("verbose"))).booleanValue();
308 } catch (Exception e) {
309 SSH.DEBUG = false;
310 }
311
312 try {
313 SSH.DEBUGMORE = (new Boolean(getParameter("debug"))).booleanValue();
314 SSH.DEBUG = SSH.DEBUGMORE;
315 } catch (Exception e) {
316 }
317
318 try {
319 quiet = (new Boolean(getParameter("quiet"))).booleanValue();
320 } catch (Exception e) {
321 quiet = true;
322 }
323
324 try {
325 savePasswords = (new Boolean(getParameter("savepasswords"))).booleanValue();
326 } catch (Exception e) {
327 savePasswords = false;
328 }
329
330 try {
331 cmdsh = (new Boolean(getParameter("cmdsh"))).booleanValue();
332 } catch (Exception e) {
333 cmdsh = false;
334 }
335
336 try {
337 helpinfo = (new Boolean(getParameter("helpinfo"))).booleanValue();
338 } catch (Exception e) {
339 helpinfo = true;
340 }
341
342 startupMsg = getParameter("startmsg");
343
344 param = getParameter("menus");
345 if(param != null) {
346 if(param.equals("no"))
347 haveMenus = false;
348 else if(param.startsWith("pop")) {
349 getPopupButtonNumber(param);
350 usePopMenu = true;
351 }
352 }
353
354 param = getParameter("autoprops");
355 if(param != null) {
356 if(param.equals("save")) {
357 autoSaveProps = true;
358 autoLoadProps = false;
359 } else if(param.equals("load")) {
360 autoSaveProps = false;
361 autoLoadProps = true;
362 } else if(param.equals("both")) {
363 autoSaveProps = true;
364 autoLoadProps = true;
365 }
366 }
367
368 sshHomeDir = getParameter("sshhome");
369 propsFile = getParameter("propsfile");
370 commandLine = getParameter("commandline");
371
372 getDefaultParams();
373
374 for(i = 0; i < SSHPropertyHandler.defaultPropDesc.length; i++) {
375 name = SSHPropertyHandler.defaultPropDesc[i][SSHPropertyHandler.PROP_NAME];
376 value = getParameter(name);
377 if(value != null)
378 paramSSHProps.put(name, value);
379 }
380 i = 0;
381 while((value = getParameter("local" + i)) != null) {
382 paramSSHProps.put("local" + i, value);
383 i++;
384 }
385 i = 0;
386 while((value = getParameter("remote" + i)) != null) {
387 paramSSHProps.put("remote" + i, value);
388 i++;
389 }
390
391 for(i = 0; i < TerminalDefProps.defaultPropDesc.length; i++) {
392 name = TerminalDefProps.defaultPropDesc[i][TerminalDefProps.PROP_NAME];
393 value = getParameter(name);
394 if(value != null)
395 termProps.put(name, value);
396 }
397
398 param = getParameter("appletbg");
399 if(param != null) {
400 Color c;
401 try {
402 c = TerminalWin.getTermColor(param);
403 } catch (IllegalArgumentException e) {
404 try {
405 c = TerminalWin.getTermRGBColor(param);
406 } catch (Throwable t) {
407 c = null;
408 // !!!
409 }
410 }
411 if(c != null)
412 this.setBackground(c);
413 }
414 }
415
416 public void getApplicationParams() throws Exception {
417 String name;
418 String value;
419 int numOfOpts;
420 int i;
421
422 // First we check the MindTerm options (i.e. not the ssh/terminal-properties)
423 //
424 try {
425 for(i = 0; i < cmdLineArgs.length; i++) {
426 String arg = cmdLineArgs[i];
427 if(!arg.startsWith("--"))
428 break;
429 switch(arg.charAt(2)) {
430 case 'h':
431 sshHomeDir = cmdLineArgs[++i];
432 break;
433 case 'f':
434 propsFile = cmdLineArgs[++i];
435 break;
436 case 'c':
437 cmdsh = true;
438 break;
439 case 'd':
440 haveGUI = false;
441 break;
442 case 'm': {
443 String typ = cmdLineArgs[++i];
444 if(typ.equals("no"))
445 haveMenus = false;
446 else if(typ.startsWith("pop")) {
447 getPopupButtonNumber(typ);
448 usePopMenu = true;
449 } else
450 throw new Exception("value of '--m' must be 'no', 'pop1', 'pop2', or 'pop3'");
451 break;
452 }
453 case 'p': {
454 String typ = cmdLineArgs[++i];
455 if(typ.equals("save")) {
456 autoSaveProps = true;
457 } else if(typ.equals("load")) {
458 autoLoadProps = true;
459 } else if(typ.equals("both")) {
460 autoSaveProps = true;
461 autoLoadProps = true;
462 } else if(typ.equals("none")) {
463 autoSaveProps = false;
464 autoLoadProps = false;
465 } else
466 throw new Exception("value of '--p' must be 'save', 'load', 'both', or 'none'");
467 break;
468 }
469 case 'q':
470 String val = cmdLineArgs[++i];
471 if(val.equalsIgnoreCase("true") || val.equalsIgnoreCase("false")) {
472 quiet = Boolean.valueOf(val).booleanValue();
473 } else {
474 throw new Exception("value of '--q' must be 'true' or 'false'");
475 }
476 break;
477 case 'r':
478 recursiveSCP = true;
479 break;
480 case 's':
481 haveGUI = false;
482 doSCP = true;
483 String direction = cmdLineArgs[++i];
484 if(direction.equalsIgnoreCase("toremote")) {
485 toRemote = true;
486 } else if(direction.equalsIgnoreCase("tolocal")) {
487 toRemote = false;
488 } else {
489 throw new Exception("value of '--s' must be 'toremote' or 'tolocal'");
490 }
491 break;
492 case 'v':
493 System.out.println("verbose mode selected...");
494 SSH.DEBUG = true;
495 break;
496 case 'x':
497 savePasswords = true;
498 break;
499 case 'V':
500 System.out.println(SSH.VER_MINDTERM);
501 System.out.println("SSH protocol version " + SSH.SSH_VER_MAJOR + "." + SSH.SSH_VER_MINOR);
502 System.exit(0);
503 break;
504 case 'D':
505 SSH.DEBUG = true;
506 SSH.DEBUGMORE = true;
507 break;
508 case '?':
509 printHelp();
510 System.exit(0);
511 default:
512 throw new Exception("unknown parameter '" + arg + "'");
513 }
514 }
515 } catch (Exception e) {
516 printHelp();
517 throw e;
518 }
519
520 getDefaultParams();
521
522 numOfOpts = i;
523 for(i = numOfOpts; i < cmdLineArgs.length; i += 2) {
524 name = cmdLineArgs[i];
525 if((name.charAt(0) != '-') || ((i + 1) == cmdLineArgs.length))
526 break;
527 name = name.substring(1);
528 value = cmdLineArgs[i + 1];
529 if(SSHPropertyHandler.isProperty(name))
530 paramSSHProps.put(name, value);
531 else if(TerminalDefProps.isProperty(name))
532 paramTermProps.put(name, value);
533 else
534 System.out.println("Unknown property '" + name + "'");
535 }
536
537 if(i < cmdLineArgs.length) {
538 firstArg = i;
539 commandLine = "";
540 for(; i < cmdLineArgs.length; i++) {
541 commandLine += cmdLineArgs[i] + " ";
542 }
543 commandLine = commandLine.trim();
544 }
545 }
546
547 void printHelp() {
548 System.out.println("usage: MindTerm [options] [properties] [command]");
549 System.out.println("Options:");
550 System.out.println(" --c Enable local command-shell.");
551 System.out.println(" --d No terminal-window, only dumb command-line and port-forwarding.");
552 System.out.println(" --f <file> Use settings from the given file.");
553 System.out.println(" --h dir Name of the MindTerm home-dir (default: ~/mindterm/).");
554 System.out.println(" --m <no | pop | popN>");
555 System.out.println(" Use no menus or popup (on mouse-button N) menu instead of menubar.");
556 System.out.println(" --p <save | load | both | none>");
557 System.out.println(" Sets automatic save/load flags for property-files.");
558 System.out.println(" --q <true | false>");
559 System.out.println(" Quiet; don't query for server/username if given.");
560 System.out.println(" --v Verbose; display verbose messages.");
561 System.out.println(" --x Save passwords in property-files.");
562 System.out.println(" --D Debug; display extra debug info.");
563 System.out.println(" --V Version; display version number only.");
564 System.out.println(" --? Help; display this help.");
565 }
566
567 void getPopupButtonNumber(String param) {
568 if(param.length() == 4) {
569 try {
570 popButtonNum = Integer.valueOf(param.substring(3)).intValue();
571 if(popButtonNum < 1 || popButtonNum > 3)
572 popButtonNum = 3;
573 } catch (NumberFormatException e) {
574 // !!!
575 }
576 }
577 }
578
579 void getDefaultParams() {
580 try {
581 if(sshHomeDir == null) {
582 String hDir = System.getProperty("user.home");
583 if(hDir == null)
584 hDir = System.getProperty("user.dir");
585 if(hDir == null)
586 hDir = System.getProperty("java.home");
587 sshHomeDir = (hDir + File.separator + "mindterm" + File.separator);
588 }
589 } catch (Throwable t) {
590 // !!!
591 }
592 if(weAreAnApplet)
593 paramSSHProps.put("server", getCodeBase().getHost());
594 try {
595 if(!quiet)
596 paramSSHProps.put("usrname", System.getProperty("user.name", ""));
597 } catch (Throwable t) {
598 // !!!
599 }
600 try {
601 javaVersion = System.getProperty("java.version");
602 javaVendor = System.getProperty("java.vendor");
603 osName = System.getProperty("os.name");
604 osArch = System.getProperty("os.arch");
605 osVersion = System.getProperty("os.version");
606 } catch (Throwable t) {
607 // !!!
608 }
609
610 }
611
612 public void initGUI() {
613 Container container;
614 MenuBar menubar = null;
615 if(separateFrame) {
616 frame = new Frame();
617 frame.addWindowListener(new WindowAdapter() {
618 public void windowClosing(WindowEvent e) { MindTerm.this.windowClosing(e); }
619 public void windowDeiconified(WindowEvent e) { term.requestFocus(); }
620 });
621 container = frame;
622 if(haveMenus && !usePopMenu) {
623 menubar = new MenuBar();
624 frame.setMenuBar(menubar);
625 frame.addNotify();
626 frame.validate();
627 }
628 } else {
629 Component comp = this;
630 do {
631 comp = comp.getParent();
632 } while(!(comp instanceof Frame));
633 frame = (Frame)comp;
634 container = this;
635 }
636
637 term = new TerminalWin(frame, new TerminalXTerm(), termProps);
638
639 if(mergedTermProps)
640 term.setPropsChanged(true);
641
642 if(haveMenus) {
643 SSHMenuHandler menus;
644 TerminalMenuHandler tmenus;
645 try {
646 Class c;
647 c = Class.forName("mindbright.ssh.SSHMenuHandlerFull");
648 menus = (SSHMenuHandler)c.newInstance();
649 menus.init(this, client, frame, term);
650 c = Class.forName("mindbright.terminal.TerminalMenuHandlerFull");
651 tmenus = (TerminalMenuHandler)c.newInstance();
652 tmenus.setTerminalWin(term);
653 term.setMenus(tmenus);
654 client.setMenus(menus);
655 if(menubar == null) {
656 PopupMenu popupmenu = term.getPopupMenu("MindTerm Menu");
657 menus.preparePopupMenu(popupmenu);
658 menus.setPopupButton(popButtonNum);
659 } else {
660 menus.prepareMenuBar(menubar);
661 }
662 tmenus.setTerminalMenuListener(menus);
663 } catch (Throwable t) {
664 System.out.println("Full menus can't be enabled since classes are missing");
665 term.setMenus(null);
666 client.setMenus(null);
667 }
668 }
669
670 container.setLayout(new BorderLayout());
671 container.add(term.getPanelWithScrollbar(), BorderLayout.CENTER);
672
673 frame.pack();
674 frame.show();
675
676 term.requestFocus();
677 }
678
679 public synchronized void windowClosing(WindowEvent e) {
680 if(isClosing)
681 return;
682 isClosing = true;
683
684 if(!confirmClose()) {
685 isClosing = false;
686 return;
687 }
688
689 if(separateFrame && haveGUI && frame != null) {
690 frame.dispose();
691 }
692
693 if(clientThread != null && clientThread.isAlive())
694 clientThread.stop();
695
696 removeTerminal(this);
697 }
698
699 public void doExit() {
700 System.out.println("Thank you for using MindTerm...");
701 if(!separateFrame && term != null) {
702 int i;
703 try {
704 term.cursorSetPos(term.rows() - 1, 0, false);
705 for(i = 0; i < term.rows(); i++) {
706 term.write("\n\r");
707 Thread.sleep(50);
708 }
709 term.cursorSetPos(0, 0, false);
710 for(i = 0; i < term.rows() - 1; i++) {
711 term.write(".\n\r");
712 Thread.sleep(50);
713 }
714 term.write("Thank you for using MindTerm...");
715 for(i = 0; i < term.rows() - 1; i++) {
716 term.write("\n\r");
717 Thread.sleep(50);
718 }
719 term.cursorSetPos(2, 0, false);
720 term.setAttribute(TerminalWin.ATTR_BOLD, true);
721 term.write("Visit <http://www.mindbright.se/mindterm> for more information.");
722 term.cursorSetPos(term.rows() - 1, term.cols() - 1, false);
723 } catch (Exception ee) {
724 // !!!
725 }
726 }
727 if(SSH.secureRandom != null && SSH.secureRandom().updater != null && SSH.secureRandom().updater.isAlive())
728 SSH.secureRandom().updater.stop();
729 if(!weAreAnApplet) {
730 System.exit(0);
731 }
732 }
733
734 boolean confirmedClose = false;
735 public boolean confirmClose() {
736 if(client != null && !confirmedClose) {
737 try {
738 client.getPropertyHandler().checkSave();
739 } catch(IOException ee) {
740 client.alert("Error saving settings: " + ee.getMessage());
741 }
742 if(client.isOpened() &&
743 !client.askConfirmation("Do you really want to disconnect from " +
744 client.getPropertyHandler().getProperty("server") + "?", false))
745 confirmedClose = false;
746 else
747 confirmedClose = true;
748 }
749 return confirmedClose;
750 }
751
752 void initParams(MindTerm mindterm) {
753 this.sshHomeDir = mindterm.sshHomeDir;
754 this.propsFile = mindterm.propsFile;
755 this.usePopMenu = mindterm.usePopMenu;
756 this.haveMenus = mindterm.haveMenus;
757 this.haveGUI = mindterm.haveGUI;
758 this.cmdsh = mindterm.cmdsh;
759 this.quiet = mindterm.quiet;
760 this.separateFrame = true;
761 this.weAreAnApplet = mindterm.weAreAnApplet;
762 this.autoLoadProps = mindterm.autoLoadProps;
763 this.popButtonNum = mindterm.popButtonNum;
764 }
765
766 public void cloneWindow() {
767 MindTerm mindterm = new MindTerm(this.sshProps, this.termProps);
768 mindterm.initParams(this);
769 mindterm.sshClone = this.client;
770 (new Thread(mindterm)).start();
771 }
772
773 public void newWindow() {
774 MindTerm mindterm = new MindTerm(paramSSHProps, paramTermProps);
775 mindterm.initParams(this);
776 (new Thread(mindterm)).start();
777 }
778
779 public void close() {
780 if(!confirmClose())
781 return;
782 clientThread.stop();
783 }
784
785 public void exit() {
786 if(!confirmClose())
787 return;
788 Enumeration enum = terminals.elements();
789 while(enum.hasMoreElements()) {
790 MindTerm mt = (MindTerm)enum.nextElement();
791 if(mt.clientThread != null) {
792 mt.clientThread.stop();
793 }
794 }
795 }
796
797}
798
Note: See TracBrowser for help on using the repository browser.