annotate src/viewer_swing/java/com/glavsoft/viewer/CuiViewer.java @ 395:704ac9e79e25

Call startVNCConnectionWithSocket for directedServerChangeReqeust
author innparusu
date Tue, 29 Sep 2015 18:46:45 +0900
parents 7d55adebcacb
children ed15f0bd8dfa
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
65
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 package com.glavsoft.viewer;
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
3 import com.glavsoft.rfb.protocol.ProtocolSettings;
383
7d55adebcacb impliment changeDirectConnectedWithSocket
kkb
parents: 379
diff changeset
4 import com.glavsoft.transport.Reader;
7d55adebcacb impliment changeDirectConnectedWithSocket
kkb
parents: 379
diff changeset
5 import com.glavsoft.transport.Writer;
65
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 import com.glavsoft.viewer.cli.Parser;
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 import com.glavsoft.viewer.swing.ConnectionParams;
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
8 import com.glavsoft.viewer.swing.ParametersHandler;
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 import com.glavsoft.viewer.swing.SwingConnectionWorkerFactory;
130
1f6bfaa3281b root selection panel
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 128
diff changeset
10
65
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
11 import javax.swing.*;
130
1f6bfaa3281b root selection panel
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 128
diff changeset
12
65
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
13 import java.awt.*;
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 import java.awt.event.WindowEvent;
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
15 import java.awt.event.WindowListener;
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 import java.io.IOException;
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
17 import java.io.InputStream;
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
18 import java.net.Socket;
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
19 import java.util.jar.Attributes;
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
20 import java.util.jar.Manifest;
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
21 import java.util.logging.*;
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
22
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
23 import jp.ac.u_ryukyu.treevnc.CreateConnectionParam;
207
b31903e5b02d rename myRFBProto
oc
parents: 206
diff changeset
24 import jp.ac.u_ryukyu.treevnc.TreeRFBProto;
65
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
25
153
e68dfd1972ac fix bad names.
oc
parents: 148
diff changeset
26 public class CuiViewer implements Runnable, WindowListener, ViewerInterface {
65
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
27
240
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
28 private Logger logger;
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
29 private int paramsMask;
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
30 private boolean allowAppletInteractiveConnections;
65
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
31
240
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
32 public final ConnectionParams connectionParams;
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
33 protected String passwordFromParams;
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
34 boolean isSeparateFrame = true;
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
35 protected boolean isApplet = true;
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
36 private final ProtocolSettings settings;
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
37 protected UiSettings uiSettings;
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
38 private ConnectionPresenter connectionPresenter;
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
39 protected TreeRFBProto myRfb;
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
40 private boolean cuiVersion;
204
d9d234715853 TreeManager for each interface
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 202
diff changeset
41 private boolean showTree = false;
225
5e3594021e79 fix --width --height mode.
oc
parents: 207
diff changeset
42 public int width;
240
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
43 public int height;
65
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
44
240
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
45 public static void main(String[] args) {
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
46 Parser parser = new Parser();
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
47 ParametersHandler.completeParserOptions(parser);
65
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
48
240
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
49 parser.parse(args);
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
50 if (parser.isSet(ParametersHandler.ARG_HELP)) {
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
51 printUsage(parser.optionsUsage());
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
52 System.exit(0);
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
53 }
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
54 CuiViewer viewer = new CuiViewer(parser);
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
55 SwingUtilities.invokeLater(viewer);
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
56 }
65
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
57
240
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
58 public static void printUsage(String additional) {
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
59 System.out
300
0b75fdbb8c11 delete unused method
oc
parents: 267
diff changeset
60 .println("Usage: java -jar (progfilename) [hostname [port_number]] [Options]?n"
0b75fdbb8c11 delete unused method
oc
parents: 267
diff changeset
61 + " or?n"
0b75fdbb8c11 delete unused method
oc
parents: 267
diff changeset
62 + " java -jar (progfilename) [Options]?n"
0b75fdbb8c11 delete unused method
oc
parents: 267
diff changeset
63 + " or?n java -jar (progfilename) -help?n to view this help?n?n"
0b75fdbb8c11 delete unused method
oc
parents: 267
diff changeset
64 + "Where Options are:?n"
0b75fdbb8c11 delete unused method
oc
parents: 267
diff changeset
65 + additional
0b75fdbb8c11 delete unused method
oc
parents: 267
diff changeset
66 + "?nOptions format: -optionName=optionValue. Ex. -host=localhost -port=5900 -viewonly=yes?n"
0b75fdbb8c11 delete unused method
oc
parents: 267
diff changeset
67 + "Both option name and option value are case insensitive.");
240
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
68 }
65
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
69
240
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
70 public CuiViewer() {
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
71 logger = Logger.getLogger(getClass().getName());
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
72 connectionParams = new ConnectionParams();
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
73 settings = ProtocolSettings.getDefaultSettings();
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
74 uiSettings = new UiSettings();
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
75 }
65
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
76
240
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
77 private CuiViewer(Parser parser) {
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
78 this();
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
79 setLoggingLevel(parser.isSet(ParametersHandler.ARG_VERBOSE) ? Level.FINE
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
80 : parser.isSet(ParametersHandler.ARG_VERBOSE_MORE) ? Level.FINER
300
0b75fdbb8c11 delete unused method
oc
parents: 267
diff changeset
81 : Level.INFO);
65
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
82
240
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
83 paramsMask = ParametersHandler.completeSettingsFromCLI(parser,
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
84 connectionParams, settings, uiSettings);
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
85 passwordFromParams = parser.getValueFor(ParametersHandler.ARG_PASSWORD);
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
86 logger.info("TightVNC Viewer version " + ver());
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
87 isApplet = false;
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
88 }
65
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
89
240
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
90 private void setLoggingLevel(Level levelToSet) {
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
91 final Logger appLogger = Logger.getLogger("com.glavsoft");
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
92 appLogger.setLevel(levelToSet);
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
93 ConsoleHandler ch = null;
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
94 for (Handler h : appLogger.getHandlers()) {
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
95 if (h instanceof ConsoleHandler) {
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
96 ch = (ConsoleHandler) h;
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
97 break;
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
98 }
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
99 }
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
100 if (null == ch) {
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
101 ch = new ConsoleHandler();
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
102 appLogger.addHandler(ch);
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
103 }
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
104 // ch.setFormatter(new SimpleFormatter());
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
105 ch.setLevel(levelToSet);
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
106 }
65
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
107
240
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
108 @Override
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
109 public void windowClosing(WindowEvent e) {
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
110 if (e != null && e.getComponent() != null) {
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
111 final Window w = e.getWindow();
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
112 if (w != null) {
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
113 w.setVisible(false);
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
114 w.dispose();
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
115 }
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
116 }
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
117 closeApp();
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
118 }
65
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
119
240
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
120 /**
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
121 * Closes App(lication) or stops App(let).
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
122 */
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
123 public void closeApp() {
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
124 /* nop */
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
125 }
65
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
126
240
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
127 private boolean checkJsch() {
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
128 try {
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
129 Class.forName("com.jcraft.jsch.JSch");
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
130 return true;
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
131 } catch (ClassNotFoundException e) {
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
132 return false;
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
133 }
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
134 }
65
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
135
240
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
136 @Override
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
137 public void run() {
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
138 final boolean hasJsch = checkJsch();
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
139 final boolean allowInteractive = allowAppletInteractiveConnections
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
140 || !isApplet;
363
bc5624e3e9c5 Add newVNCConnection method to Viewer
innparusu
parents: 328
diff changeset
141 ConnectionPresenter connectionPresenter = new ConnectionPresenter(hasJsch, allowInteractive);
240
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
142 connectionPresenter.addModel("ConnectionParamsModel", connectionParams);
65
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
143 connectionPresenter.setConnectionWorkerFactory(
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
144 new SwingConnectionWorkerFactory(null, passwordFromParams, connectionPresenter, null, myRfb));
240
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
145 connectionPresenter.setCuiVersion(true);
395
704ac9e79e25 Call startVNCConnectionWithSocket for directedServerChangeReqeust
innparusu
parents: 383
diff changeset
146 connectionPresenter.startConnection(settings, uiSettings, paramsMask, false, null, null);
240
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
147 }
65
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
148
240
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
149 @Override
370
2c61e6d434ff Fix VncConnectionWorkers
innparusu
parents: 369
diff changeset
150 public ConnectionPresenter getConnectionPresenter() {
2c61e6d434ff Fix VncConnectionWorkers
innparusu
parents: 369
diff changeset
151 return connectionPresenter;
363
bc5624e3e9c5 Add newVNCConnection method to Viewer
innparusu
parents: 328
diff changeset
152 }
bc5624e3e9c5 Add newVNCConnection method to Viewer
innparusu
parents: 328
diff changeset
153
bc5624e3e9c5 Add newVNCConnection method to Viewer
innparusu
parents: 328
diff changeset
154 @Override
370
2c61e6d434ff Fix VncConnectionWorkers
innparusu
parents: 369
diff changeset
155 public void setConnectionPresenter(ConnectionPresenter connectionPresenter) {
2c61e6d434ff Fix VncConnectionWorkers
innparusu
parents: 369
diff changeset
156 this.connectionPresenter = connectionPresenter;
369
2d01ec1c02d2 Fix ReConnectingFlag
innparusu
parents: 363
diff changeset
157 }
2d01ec1c02d2 Fix ReConnectingFlag
innparusu
parents: 363
diff changeset
158
2d01ec1c02d2 Fix ReConnectingFlag
innparusu
parents: 363
diff changeset
159 @Override
383
7d55adebcacb impliment changeDirectConnectedWithSocket
kkb
parents: 379
diff changeset
160 public void changeToDirectConnectedServer(String hostName, Reader is, Writer os) {
7d55adebcacb impliment changeDirectConnectedWithSocket
kkb
parents: 379
diff changeset
161
7d55adebcacb impliment changeDirectConnectedWithSocket
kkb
parents: 379
diff changeset
162 }
7d55adebcacb impliment changeDirectConnectedWithSocket
kkb
parents: 379
diff changeset
163
7d55adebcacb impliment changeDirectConnectedWithSocket
kkb
parents: 379
diff changeset
164 @Override
240
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
165 public void windowOpened(WindowEvent e) { /* nop */
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
166 }
65
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
167
240
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
168 @Override
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
169 public void windowClosed(WindowEvent e) { /* nop */
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
170 }
65
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
171
240
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
172 @Override
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
173 public void windowIconified(WindowEvent e) { /* nop */
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
174 }
65
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
175
240
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
176 @Override
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
177 public void windowDeiconified(WindowEvent e) { /* nop */
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
178 }
65
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
179
240
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
180 @Override
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
181 public void windowActivated(WindowEvent e) { /* nop */
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
182 }
65
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
183
240
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
184 @Override
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
185 public void windowDeactivated(WindowEvent e) { /* nop */
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
186 }
65
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
187
240
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
188 public static String ver() {
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
189 final InputStream mfStream = Viewer.class.getClassLoader()
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
190 .getResourceAsStream("META-INF/MANIFEST.MF");
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
191 if (null == mfStream) {
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
192 System.out.println("No Manifest file found.");
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
193 return "-1";
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
194 }
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
195 try {
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
196 Manifest mf = new Manifest();
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
197 mf.read(mfStream);
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
198 Attributes atts = mf.getMainAttributes();
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
199 return atts.getValue(Attributes.Name.IMPLEMENTATION_VERSION);
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
200 } catch (IOException e) {
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
201 return "-2";
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
202 }
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
203 }
65
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
204
240
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
205 public void setSocket(Socket soc) {
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
206 connectionParams.setConnectionParam(soc.getInetAddress().getHostAddress(), soc.getPort());
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
207 }
65
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
208
240
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
209 public void setOpenPort(int parseInt) {
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
210 }
65
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
211
328
1a2ab6bd5ba3 add function lost child node, remove deadChild nodeList.
oc
parents: 327
diff changeset
212 public void setTerminationType(boolean b) {
240
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
213 myRfb.setTerminationType(b);
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
214 }
65
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
215
379
ea324e42bc78 Add arguments to startTreeViewer method
innparusu
parents: 377
diff changeset
216 public void startTreeViewer(String hostName, boolean cui, boolean addSerialNum) {
240
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
217 CuiViewer viewer = new CuiViewer();
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
218 viewer.cuiVersion = cui;
327
293c35aa902b add error message, add assure stream close, delete firstTime value in TreeRFBProto.
oc
parents: 317
diff changeset
219 TreeRFBProto rfb = new TreeRFBProto(false, this);
240
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
220 CreateConnectionParam cp = new CreateConnectionParam(rfb);
300
0b75fdbb8c11 delete unused method
oc
parents: 267
diff changeset
221 if (hostName==null) {
327
293c35aa902b add error message, add assure stream close, delete firstTime value in TreeRFBProto.
oc
parents: 317
diff changeset
222 cp.findTreeVncRoot();
240
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
223 } else {
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
224 cp.setHostName(hostName);
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
225 }
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
226 rfb.createConnectionAndStart(this);
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
227 cp.sendWhereToConnect(viewer);
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
228 rfb.setCuiVersion(cui);
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
229 viewer.myRfb = rfb;
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
230 SwingUtilities.invokeLater(viewer);
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
231 }
65
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
232
240
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
233 public void setIsTreeVNC(boolean flag) {
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
234 }
65
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
235
240
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
236 public TreeRFBProto getRfb() {
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
237 return myRfb;
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
238 }
65
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
239
240
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
240 public boolean getCuiVersion() {
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
241 return cuiVersion;
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
242 }
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
243
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
244 public void setCuiVersion(boolean flag) {
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
245 // nop
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
246 }
130
1f6bfaa3281b root selection panel
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 128
diff changeset
247
1f6bfaa3281b root selection panel
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 128
diff changeset
248 @Override
174
2e1530139169 reorganization
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 153
diff changeset
249 public void connectToParenet(int port, String hostname) throws IOException {
328
1a2ab6bd5ba3 add function lost child node, remove deadChild nodeList.
oc
parents: 327
diff changeset
250 setTerminationType(false);
174
2e1530139169 reorganization
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 153
diff changeset
251 closeApp();
179
c1b91dd27a13 on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 177
diff changeset
252 connectionParams.setConnectionParam(hostname, port);
174
2e1530139169 reorganization
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 153
diff changeset
253 run();
2e1530139169 reorganization
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 153
diff changeset
254 }
2e1530139169 reorganization
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 153
diff changeset
255
2e1530139169 reorganization
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 153
diff changeset
256 @Override
369
2d01ec1c02d2 Fix ReConnectingFlag
innparusu
parents: 363
diff changeset
257 public void inhelitClients(ViewerInterface vncProxyService, String hostName, short newVNCServerId) {
240
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
258
174
2e1530139169 reorganization
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 153
diff changeset
259 }
2e1530139169 reorganization
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 153
diff changeset
260
2e1530139169 reorganization
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 153
diff changeset
261 @Override
377
877008c86e85 Add direct option
innparusu
parents: 370
diff changeset
262 public void proxyStart(String[] args, String hostName, int width, int height, boolean showTree, boolean checkDelay, boolean addSerialNum, boolean fixingSize, boolean filterSingleDisplay) {
240
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
263
174
2e1530139169 reorganization
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 153
diff changeset
264 }
2e1530139169 reorganization
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 153
diff changeset
265
176
fa6cfb85444e on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 175
diff changeset
266 @Override
fa6cfb85444e on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 175
diff changeset
267 public void setNoConnection(boolean noConnection) {
240
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
268
176
fa6cfb85444e on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 175
diff changeset
269 }
fa6cfb85444e on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 175
diff changeset
270
240
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
271 @Override
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
272 public void setVisible(boolean b) {
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
273 }
192
aa00e4b2fc27 fix root viewer.
oc
parents: 188
diff changeset
274
240
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
275 @Override
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
276 public Socket getVNCSocket() {
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
277 return connectionPresenter.getSocket();
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
278 }
202
22676ca0dd97 get VNC Socket.
oc
parents: 192
diff changeset
279
204
d9d234715853 TreeManager for each interface
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 202
diff changeset
280 @Override
d9d234715853 TreeManager for each interface
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 202
diff changeset
281 public boolean getShowTree() {
d9d234715853 TreeManager for each interface
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 202
diff changeset
282 return showTree;
d9d234715853 TreeManager for each interface
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 202
diff changeset
283 }
d9d234715853 TreeManager for each interface
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 202
diff changeset
284
225
5e3594021e79 fix --width --height mode.
oc
parents: 207
diff changeset
285 @Override
5e3594021e79 fix --width --height mode.
oc
parents: 207
diff changeset
286 public void setWidth(int w) {
240
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
287 width = w;
225
5e3594021e79 fix --width --height mode.
oc
parents: 207
diff changeset
288 }
5e3594021e79 fix --width --height mode.
oc
parents: 207
diff changeset
289
5e3594021e79 fix --width --height mode.
oc
parents: 207
diff changeset
290 @Override
5e3594021e79 fix --width --height mode.
oc
parents: 207
diff changeset
291 public void setHeight(int h) {
300
0b75fdbb8c11 delete unused method
oc
parents: 267
diff changeset
292 height = h;
257
11b59b223222 add function of fixing display size
oc
parents: 256
diff changeset
293 }
11b59b223222 add function of fixing display size
oc
parents: 256
diff changeset
294
11b59b223222 add function of fixing display size
oc
parents: 256
diff changeset
295 @Override
11b59b223222 add function of fixing display size
oc
parents: 256
diff changeset
296 public void setFixingSize(int width, int height) {
11b59b223222 add function of fixing display size
oc
parents: 256
diff changeset
297 }
301
ae7deb002b5f send and receive single display size
oc
parents: 300
diff changeset
298
ae7deb002b5f send and receive single display size
oc
parents: 300
diff changeset
299 @Override
ae7deb002b5f send and receive single display size
oc
parents: 300
diff changeset
300 public java.util.ArrayList<Rectangle> getScreenRectangles() {
ae7deb002b5f send and receive single display size
oc
parents: 300
diff changeset
301 return null;
ae7deb002b5f send and receive single display size
oc
parents: 300
diff changeset
302 }
317
3c63bc88383e always fit screen, -d mode.
oc
parents: 301
diff changeset
303
3c63bc88383e always fit screen, -d mode.
oc
parents: 301
diff changeset
304 @Override
3c63bc88383e always fit screen, -d mode.
oc
parents: 301
diff changeset
305 public void setFitScreen() {
3c63bc88383e always fit screen, -d mode.
oc
parents: 301
diff changeset
306 // TODO Auto-generated method stub
3c63bc88383e always fit screen, -d mode.
oc
parents: 301
diff changeset
307
3c63bc88383e always fit screen, -d mode.
oc
parents: 301
diff changeset
308 }
65
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
309 }