annotate src/viewer_swing/java/com/glavsoft/viewer/CuiViewer.java @ 301:ae7deb002b5f

send and receive single display size
author oc
date Sun, 18 Jan 2015 08:36:06 +0900
parents 0b75fdbb8c11
children 3c63bc88383e
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;
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
4 import com.glavsoft.viewer.cli.Parser;
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
5 import com.glavsoft.viewer.swing.ConnectionParams;
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 import com.glavsoft.viewer.swing.ParametersHandler;
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 import com.glavsoft.viewer.swing.SwingConnectionWorkerFactory;
130
1f6bfaa3281b root selection panel
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 128
diff changeset
8
65
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 import javax.swing.*;
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 java.awt.*;
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 import java.awt.event.WindowEvent;
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
13 import java.awt.event.WindowListener;
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 import java.io.IOException;
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
15 import java.io.InputStream;
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 import java.net.Socket;
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
17 import java.util.jar.Attributes;
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
18 import java.util.jar.Manifest;
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
19 import java.util.logging.*;
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
20
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
21 import jp.ac.u_ryukyu.treevnc.CreateConnectionParam;
207
b31903e5b02d rename myRFBProto
oc
parents: 206
diff changeset
22 import jp.ac.u_ryukyu.treevnc.TreeRFBProto;
65
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
23
153
e68dfd1972ac fix bad names.
oc
parents: 148
diff changeset
24 public class CuiViewer implements Runnable, WindowListener, ViewerInterface {
65
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
25
240
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
26 private Logger logger;
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
27 private int paramsMask;
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
28 private boolean allowAppletInteractiveConnections;
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 public final ConnectionParams connectionParams;
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
31 protected String passwordFromParams;
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
32 boolean isSeparateFrame = true;
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
33 protected boolean isApplet = true;
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
34 private final ProtocolSettings settings;
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
35 protected UiSettings uiSettings;
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
36 private ConnectionPresenter connectionPresenter;
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
37 protected TreeRFBProto myRfb;
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
38 private boolean cuiVersion;
204
d9d234715853 TreeManager for each interface
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 202
diff changeset
39 private boolean showTree = false;
225
5e3594021e79 fix --width --height mode.
oc
parents: 207
diff changeset
40 public int width;
240
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
41 public int height;
65
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
42
240
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
43 public static void main(String[] args) {
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
44 Parser parser = new Parser();
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
45 ParametersHandler.completeParserOptions(parser);
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 parser.parse(args);
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
48 if (parser.isSet(ParametersHandler.ARG_HELP)) {
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
49 printUsage(parser.optionsUsage());
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
50 System.exit(0);
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
51 }
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
52 CuiViewer viewer = new CuiViewer(parser);
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
53 SwingUtilities.invokeLater(viewer);
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
54 }
65
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
55
240
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
56 public static void printUsage(String additional) {
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
57 System.out
300
0b75fdbb8c11 delete unused method
oc
parents: 267
diff changeset
58 .println("Usage: java -jar (progfilename) [hostname [port_number]] [Options]?n"
0b75fdbb8c11 delete unused method
oc
parents: 267
diff changeset
59 + " or?n"
0b75fdbb8c11 delete unused method
oc
parents: 267
diff changeset
60 + " java -jar (progfilename) [Options]?n"
0b75fdbb8c11 delete unused method
oc
parents: 267
diff changeset
61 + " or?n java -jar (progfilename) -help?n to view this help?n?n"
0b75fdbb8c11 delete unused method
oc
parents: 267
diff changeset
62 + "Where Options are:?n"
0b75fdbb8c11 delete unused method
oc
parents: 267
diff changeset
63 + additional
0b75fdbb8c11 delete unused method
oc
parents: 267
diff changeset
64 + "?nOptions format: -optionName=optionValue. Ex. -host=localhost -port=5900 -viewonly=yes?n"
0b75fdbb8c11 delete unused method
oc
parents: 267
diff changeset
65 + "Both option name and option value are case insensitive.");
240
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
66 }
65
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
67
240
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
68 public CuiViewer() {
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
69 logger = Logger.getLogger(getClass().getName());
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
70 connectionParams = new ConnectionParams();
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
71 settings = ProtocolSettings.getDefaultSettings();
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
72 uiSettings = new UiSettings();
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
73 }
65
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
74
240
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
75 private CuiViewer(Parser parser) {
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
76 this();
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
77 setLoggingLevel(parser.isSet(ParametersHandler.ARG_VERBOSE) ? Level.FINE
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
78 : parser.isSet(ParametersHandler.ARG_VERBOSE_MORE) ? Level.FINER
300
0b75fdbb8c11 delete unused method
oc
parents: 267
diff changeset
79 : Level.INFO);
65
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
80
240
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
81 paramsMask = ParametersHandler.completeSettingsFromCLI(parser,
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
82 connectionParams, settings, uiSettings);
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
83 passwordFromParams = parser.getValueFor(ParametersHandler.ARG_PASSWORD);
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
84 logger.info("TightVNC Viewer version " + ver());
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
85 isApplet = false;
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
86 }
65
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
87
240
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
88 private void setLoggingLevel(Level levelToSet) {
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
89 final Logger appLogger = Logger.getLogger("com.glavsoft");
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
90 appLogger.setLevel(levelToSet);
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
91 ConsoleHandler ch = null;
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
92 for (Handler h : appLogger.getHandlers()) {
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
93 if (h instanceof ConsoleHandler) {
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
94 ch = (ConsoleHandler) h;
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
95 break;
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
96 }
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
97 }
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
98 if (null == ch) {
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
99 ch = new ConsoleHandler();
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
100 appLogger.addHandler(ch);
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
101 }
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
102 // ch.setFormatter(new SimpleFormatter());
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
103 ch.setLevel(levelToSet);
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
104 }
65
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
105
240
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
106 @Override
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
107 public void windowClosing(WindowEvent e) {
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
108 if (e != null && e.getComponent() != null) {
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
109 final Window w = e.getWindow();
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
110 if (w != null) {
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
111 w.setVisible(false);
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
112 w.dispose();
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
113 }
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
114 }
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
115 closeApp();
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
116 }
65
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
117
240
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
118 /**
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
119 * Closes App(lication) or stops App(let).
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
120 */
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
121 public void closeApp() {
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
122 /* nop */
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
123 }
65
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
124
240
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
125 private boolean checkJsch() {
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
126 try {
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
127 Class.forName("com.jcraft.jsch.JSch");
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
128 return true;
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
129 } catch (ClassNotFoundException e) {
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
130 return false;
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
131 }
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
132 }
65
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
133
240
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
134 @Override
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
135 public void run() {
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
136 final boolean hasJsch = checkJsch();
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
137 final boolean allowInteractive = allowAppletInteractiveConnections
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
138 || !isApplet;
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
139 connectionPresenter = new ConnectionPresenter(hasJsch, allowInteractive);
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
140 connectionPresenter.addModel("ConnectionParamsModel", connectionParams);
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
141
65
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
142
240
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
143 /*
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
144 * SwingViewerWindowFactory viewerWindowFactory = new
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
145 * SwingViewerWindowFactory( isSeparateFrame, isApplet, this);
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
146 *
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
147 * connectionPresenter.setConnectionWorkerFactory(new
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
148 * SwingConnectionWorkerFactory( connectionView.getFrame(),
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
149 * passwordFromParams, connectionPresenter, viewerWindowFactory,
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
150 * myRfb));
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
151 */
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
152
65
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
153
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
154 connectionPresenter.setConnectionWorkerFactory(
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
155 new SwingConnectionWorkerFactory(null, passwordFromParams, connectionPresenter, null, myRfb));
240
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
156 connectionPresenter.setCuiVersion(true);
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
157 connectionPresenter.startConnection(settings, uiSettings, paramsMask);
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
158 }
65
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
159
240
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
160 @Override
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
161 public void windowOpened(WindowEvent e) { /* nop */
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
162 }
65
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
163
240
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
164 @Override
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
165 public void windowClosed(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 windowIconified(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 windowDeiconified(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 windowActivated(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 windowDeactivated(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 public static String ver() {
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
185 final InputStream mfStream = Viewer.class.getClassLoader()
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
186 .getResourceAsStream("META-INF/MANIFEST.MF");
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
187 if (null == mfStream) {
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
188 System.out.println("No Manifest file found.");
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
189 return "-1";
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
190 }
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
191 try {
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
192 Manifest mf = new Manifest();
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
193 mf.read(mfStream);
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
194 Attributes atts = mf.getMainAttributes();
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
195 return atts.getValue(Attributes.Name.IMPLEMENTATION_VERSION);
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
196 } catch (IOException e) {
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
197 return "-2";
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
198 }
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
199 }
65
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
200
240
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
201 public void setSocket(Socket soc) {
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
202 connectionParams.setConnectionParam(soc.getInetAddress().getHostAddress(), soc.getPort());
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 setOpenPort(int parseInt) {
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
206 }
65
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
207
240
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
208 public void setTeminationType(boolean b) {
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
209 myRfb.setTerminationType(b);
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
240
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
212 public void startTreeViewer(String hostName, boolean cui) {
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
213 CuiViewer viewer = new CuiViewer();
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
214 viewer.cuiVersion = cui;
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
215 TreeRFBProto rfb = new TreeRFBProto(false);
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
216 CreateConnectionParam cp = new CreateConnectionParam(rfb);
300
0b75fdbb8c11 delete unused method
oc
parents: 267
diff changeset
217 if (hostName==null) {
240
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
218 try {
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
219 cp.findTreeVncRoot();
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
220 } catch (InterruptedException e) {
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
221 }
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
222 } else {
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
223 cp.setHostName(hostName);
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
224 }
204
d9d234715853 TreeManager for each interface
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 202
diff changeset
225 rfb.setViewer(viewer);
240
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 {
2e1530139169 reorganization
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 153
diff changeset
250 setTeminationType(false);
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
2e1530139169 reorganization
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 153
diff changeset
257 public void inhelitClients(ViewerInterface vncProxyService, String hostName) {
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
267
5f697251860b add --filterSingleDisplay option.
oc
parents: 257
diff changeset
262 public void proxyStart(String[] args, 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 }
65
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
303 }