annotate src/viewer_swing/java/com/glavsoft/viewer/CuiViewer.java @ 455:6f3d3da40940

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