annotate src/viewer_swing/java/com/glavsoft/viewer/Viewer.java @ 179:c1b91dd27a13

on going ...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 23 Jun 2014 10:40:32 +0900
parents 34b7558aeffa
children f76ee760c2d2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
57
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
1 // Copyright (C) 2010, 2011, 2012, 2013 GlavSoft LLC.
0
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2 // All rights reserved.
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
3 //
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
4 //-------------------------------------------------------------------------
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
5 // This file is part of the TightVNC software. Please visit our Web site:
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 //
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 // http://www.tightvnc.com/
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
8 //
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 // This program is free software; you can redistribute it and/or modify
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
10 // it under the terms of the GNU General Public License as published by
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
11 // the Free Software Foundation; either version 2 of the License, or
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 // (at your option) any later version.
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
13 //
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 // This program is distributed in the hope that it will be useful,
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
15 // but WITHOUT ANY WARRANTY; without even the implied warranty of
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
17 // GNU General Public License for more details.
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
18 //
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
19 // You should have received a copy of the GNU General Public License along
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
20 // with this program; if not, write to the Free Software Foundation, Inc.,
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
21 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
22 //-------------------------------------------------------------------------
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
23 //
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
24
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
25 package com.glavsoft.viewer;
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
26
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
27 import com.glavsoft.rfb.protocol.ProtocolSettings;
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
28 import com.glavsoft.viewer.cli.Parser;
57
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
29 import com.glavsoft.viewer.mvp.View;
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
30 import com.glavsoft.viewer.swing.ConnectionParams;
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
31 import com.glavsoft.viewer.swing.ParametersHandler;
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
32 import com.glavsoft.viewer.swing.SwingConnectionWorkerFactory;
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
33 import com.glavsoft.viewer.swing.SwingViewerWindowFactory;
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
34 import com.glavsoft.viewer.swing.gui.ConnectionView;
0
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
35
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
36 import javax.swing.*;
129
a6dc674546f2 change connection param expression timing.
oc
parents: 128
diff changeset
37
0
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
38 import java.awt.*;
57
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
39 import java.awt.event.WindowEvent;
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
40 import java.awt.event.WindowListener;
0
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
41 import java.io.IOException;
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
42 import java.io.InputStream;
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
43 import java.net.Socket;
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
44 import java.util.jar.Attributes;
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
45 import java.util.jar.Manifest;
57
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
46 import java.util.logging.*;
0
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
47
60
ac6f9e46566f proxy mode ok.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 59
diff changeset
48 import jp.ac.u_ryukyu.treevnc.CreateConnectionParam;
ac6f9e46566f proxy mode ok.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 59
diff changeset
49 import jp.ac.u_ryukyu.treevnc.MyRfbProto;
59
433c79184c05 merge version2.7.2
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 57 55
diff changeset
50 import jp.ac.u_ryukyu.treevnc.client.MyRfbProtoClient;
175
e1aa06b0d2ff on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 174
diff changeset
51 import jp.ac.u_ryukyu.treevnc.server.MyRfbProtoProxy;
179
c1b91dd27a13 on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 178
diff changeset
52 import jp.ac.u_ryukyu.treevnc.server.TreeManagement;
32
758d025ee24b add TextBox.java
one
parents: 11
diff changeset
53
0
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
54 @SuppressWarnings("serial")
179
c1b91dd27a13 on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 178
diff changeset
55 public class Viewer extends JApplet implements Runnable, WindowListener , ViewerInterface {
0
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
56
57
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
57 private Logger logger;
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
58 private int paramsMask;
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
59 private boolean allowAppletInteractiveConnections;
0
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
60
60
ac6f9e46566f proxy mode ok.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 59
diff changeset
61 public final ConnectionParams connectionParams;
59
433c79184c05 merge version2.7.2
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 57 55
diff changeset
62 protected String passwordFromParams;
57
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
63 boolean isSeparateFrame = true;
59
433c79184c05 merge version2.7.2
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 57 55
diff changeset
64 protected boolean isApplet = true;
57
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
65 private final ProtocolSettings settings;
59
433c79184c05 merge version2.7.2
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 57 55
diff changeset
66 protected UiSettings uiSettings;
57
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
67 private volatile boolean isAppletStopped = false;
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
68 private ConnectionPresenter connectionPresenter;
65
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 61
diff changeset
69 boolean isTreeVNC = false;
61
d9cf08c6415c During implementation change screen.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 60
diff changeset
70 protected MyRfbProto myRfb;
85
432dac0b9dae delete Share Screen pop up in display mode.
sugi
parents: 79
diff changeset
71 private boolean noConnection;
175
e1aa06b0d2ff on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 174
diff changeset
72 public int vncport = ConnectionParams.DEFAULT_RFB_PORT;
e1aa06b0d2ff on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 174
diff changeset
73 private int fbWidth;
139
8798f36f732b wait for FIND_ROOT_REPLY.
oc
parents: 130
diff changeset
74
57
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
75 public static void main(String[] args) {
0
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
76 Parser parser = new Parser();
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
77 ParametersHandler.completeParserOptions(parser);
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
78
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
79 parser.parse(args);
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
80 if (parser.isSet(ParametersHandler.ARG_HELP)) {
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
81 printUsage(parser.optionsUsage());
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
82 System.exit(0);
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
83 }
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
84 Viewer viewer = new Viewer(parser);
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
85 SwingUtilities.invokeLater(viewer);
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
86 }
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
87
57
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
88 public static void printUsage(String additional) {
59
433c79184c05 merge version2.7.2
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 57 55
diff changeset
89 System.out.println("Usage: java -jar (progfilename) [hostname [port_number]] [Options]Â¥n" +
433c79184c05 merge version2.7.2
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 57 55
diff changeset
90 " or¥n"+
433c79184c05 merge version2.7.2
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 57 55
diff changeset
91 " java -jar (progfilename) [Options]Â¥n" +
433c79184c05 merge version2.7.2
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 57 55
diff changeset
92 " or¥n java -jar (progfilename) -help¥n to view this help¥n¥n" +
433c79184c05 merge version2.7.2
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 57 55
diff changeset
93 "Where Options are:Â¥n" + additional +
433c79184c05 merge version2.7.2
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 57 55
diff changeset
94 "¥nOptions format: -optionName=optionValue. Ex. -host=localhost -port=5900 -viewonly=yes¥n" +
0
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
95 "Both option name and option value are case insensitive.");
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
96 }
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
97
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
98 public Viewer() {
57
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
99 logger = Logger.getLogger(getClass().getName());
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
100 connectionParams = new ConnectionParams();
0
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
101 settings = ProtocolSettings.getDefaultSettings();
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
102 uiSettings = new UiSettings();
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
103 }
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
104
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
105 private Viewer(Parser parser) {
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
106 this();
57
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
107 setLoggingLevel(parser.isSet(ParametersHandler.ARG_VERBOSE) ? Level.FINE :
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
108 parser.isSet(ParametersHandler.ARG_VERBOSE_MORE) ? Level.FINER :
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
109 Level.INFO);
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
110
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
111 paramsMask = ParametersHandler.completeSettingsFromCLI(parser, connectionParams, settings, uiSettings);
0
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
112 passwordFromParams = parser.getValueFor(ParametersHandler.ARG_PASSWORD);
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
113 logger.info("TightVNC Viewer version " + ver());
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
114 isApplet = false;
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
115 }
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
116
57
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
117 private void setLoggingLevel(Level levelToSet) {
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
118 final Logger appLogger = Logger.getLogger("com.glavsoft");
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
119 appLogger.setLevel(levelToSet);
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
120 ConsoleHandler ch = null;
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
121 for (Handler h : appLogger.getHandlers()) {
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
122 if (h instanceof ConsoleHandler) {
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
123 ch = (ConsoleHandler) h;
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
124 break;
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
125 }
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
126 }
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
127 if (null == ch) {
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
128 ch = new ConsoleHandler();
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
129 appLogger.addHandler(ch);
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
130 }
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
131 // ch.setFormatter(new SimpleFormatter());
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
132 ch.setLevel(levelToSet);
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
133 }
0
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
134
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
135
57
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
136 @Override
0
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
137 public void windowClosing(WindowEvent e) {
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
138 if (e != null && e.getComponent() != null) {
57
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
139 final Window w = e.getWindow();
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
140 if (w != null) {
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
141 w.setVisible(false);
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
142 w.dispose();
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
143 }
0
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
144 }
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
145 closeApp();
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
146 }
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
147
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
148 /**
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
149 * Closes App(lication) or stops App(let).
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
150 */
57
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
151 public void closeApp() {
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
152 if (connectionPresenter != null) {
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
153 connectionPresenter.cancelConnection();
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
154 logger.info("Connections cancelled.");
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
155 }
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
156 if (isApplet) {
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
157 if ( ! isAppletStopped) {
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
158 logger.severe("Applet is stopped.");
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
159 isAppletStopped = true;
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
160 repaint();
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
161 stop();
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
162 }
0
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
163 } else {
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
164 System.exit(0);
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
165 }
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
166 }
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
167
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
168 @Override
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
169 public void paint(Graphics g) {
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
170 if ( ! isAppletStopped) {
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
171 super.paint(g);
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
172 } else {
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
173 getContentPane().removeAll();
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
174 g.clearRect(0, 0, getWidth(), getHeight());
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
175 g.drawString("Disconnected", 10, 20);
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
176 }
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
177 }
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
178
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
179 @Override
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
180 public void destroy() {
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
181 closeApp();
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
182 super.destroy();
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
183 }
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
184
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
185 @Override
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
186 public void init() {
57
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
187 paramsMask = ParametersHandler.completeSettingsFromApplet(this, connectionParams, settings, uiSettings);
0
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
188 isSeparateFrame = ParametersHandler.isSeparateFrame;
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
189 passwordFromParams = getParameter(ParametersHandler.ARG_PASSWORD);
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
190 isApplet = true;
57
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
191 allowAppletInteractiveConnections = ParametersHandler.allowAppletInteractiveConnections;
0
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
192 repaint();
57
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
193
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
194 try {
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
195 SwingUtilities.invokeAndWait(this);
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
196 } catch (Exception e) {
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
197 logger.severe(e.getMessage());
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
198 }
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
199 }
0
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
200
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
201 @Override
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
202 public void start() {
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
203 super.start();
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
204 }
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
205
57
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
206 private boolean checkJsch() {
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
207 try {
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
208 Class.forName("com.jcraft.jsch.JSch");
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
209 return true;
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
210 } catch (ClassNotFoundException e) {
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
211 return false;
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
212 }
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
213 }
85
432dac0b9dae delete Share Screen pop up in display mode.
sugi
parents: 79
diff changeset
214
432dac0b9dae delete Share Screen pop up in display mode.
sugi
parents: 79
diff changeset
215 public void setNoConnection(boolean c){
432dac0b9dae delete Share Screen pop up in display mode.
sugi
parents: 79
diff changeset
216 noConnection = c;
432dac0b9dae delete Share Screen pop up in display mode.
sugi
parents: 79
diff changeset
217 }
432dac0b9dae delete Share Screen pop up in display mode.
sugi
parents: 79
diff changeset
218
57
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
219 @Override
0
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
220 public void run() {
57
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
221 final boolean hasJsch = checkJsch();
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
222 final boolean allowInteractive = allowAppletInteractiveConnections || ! isApplet;
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
223 connectionPresenter = new ConnectionPresenter(hasJsch, allowInteractive);
85
432dac0b9dae delete Share Screen pop up in display mode.
sugi
parents: 79
diff changeset
224 connectionPresenter.setNoConnection(noConnection);
57
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
225 connectionPresenter.addModel("ConnectionParamsModel", connectionParams);
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
226 final ConnectionView connectionView = new ConnectionView(
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
227 Viewer.this, // appWindowListener
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
228 connectionPresenter, hasJsch);
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
229 connectionPresenter.addView(ConnectionPresenter.CONNECTION_VIEW, connectionView);
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
230 if (isApplet) {
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
231 connectionPresenter.addView("AppletStatusStringView", new View() {
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
232 @Override
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
233 public void showView() { /*nop*/ }
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
234 @Override
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
235 public void closeView() { /*nop*/ }
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
236 });
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
237 }
60
ac6f9e46566f proxy mode ok.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 59
diff changeset
238
57
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
239 SwingViewerWindowFactory viewerWindowFactory = new SwingViewerWindowFactory(isSeparateFrame, isApplet, this);
61
d9cf08c6415c During implementation change screen.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 60
diff changeset
240
57
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
241 connectionPresenter.setConnectionWorkerFactory(
60
ac6f9e46566f proxy mode ok.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 59
diff changeset
242 new SwingConnectionWorkerFactory(connectionView.getFrame(), passwordFromParams, connectionPresenter, viewerWindowFactory, myRfb));
89
1503a373ab73 close client correctly in -d mode.
oc
parents: 85
diff changeset
243 connectionPresenter.setNeedReconnection(!noConnection);
57
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
244 connectionPresenter.startConnection(settings, uiSettings, paramsMask);
0
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
245 }
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
246
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
247 @Override
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
248 public void windowOpened(WindowEvent e) { /* nop */ }
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
249 @Override
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
250 public void windowClosed(WindowEvent e) { /* nop */ }
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
251 @Override
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
252 public void windowIconified(WindowEvent e) { /* nop */ }
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
253 @Override
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
254 public void windowDeiconified(WindowEvent e) { /* nop */ }
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
255 @Override
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
256 public void windowActivated(WindowEvent e) { /* nop */ }
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
257 @Override
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
258 public void windowDeactivated(WindowEvent e) { /* nop */ }
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
259
57
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
260 public static String ver() {
0
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
261 final InputStream mfStream = Viewer.class.getClassLoader().getResourceAsStream(
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
262 "META-INF/MANIFEST.MF");
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
263 if (null == mfStream) {
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
264 System.out.println("No Manifest file found.");
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
265 return "-1";
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
266 }
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
267 try {
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
268 Manifest mf = new Manifest();
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
269 mf.read(mfStream);
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
270 Attributes atts = mf.getMainAttributes();
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
271 return atts.getValue(Attributes.Name.IMPLEMENTATION_VERSION);
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
272 } catch (IOException e) {
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
273 return "-2";
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
274 }
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
275 }
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
276
59
433c79184c05 merge version2.7.2
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 57 55
diff changeset
277
61
d9cf08c6415c During implementation change screen.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 60
diff changeset
278 public void setSocket(Socket soc) {
179
c1b91dd27a13 on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 178
diff changeset
279 connectionParams.setConnectionParam(soc.getInetAddress().getHostAddress(),soc.getPort());
59
433c79184c05 merge version2.7.2
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 57 55
diff changeset
280 }
433c79184c05 merge version2.7.2
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 57 55
diff changeset
281
433c79184c05 merge version2.7.2
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 57 55
diff changeset
282 public void setOpenPort(int parseInt) {
433c79184c05 merge version2.7.2
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 57 55
diff changeset
283 }
433c79184c05 merge version2.7.2
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 57 55
diff changeset
284
433c79184c05 merge version2.7.2
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 57 55
diff changeset
285 public void setTeminationType(boolean b) {
61
d9cf08c6415c During implementation change screen.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 60
diff changeset
286 myRfb.setTerminationType(b);
59
433c79184c05 merge version2.7.2
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 57 55
diff changeset
287 }
433c79184c05 merge version2.7.2
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 57 55
diff changeset
288
121
e4408fc5679f view onlly mode set
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 106
diff changeset
289 /**
176
fa6cfb85444e on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 175
diff changeset
290 * start TreeVNC viewer
130
1f6bfaa3281b root selection panel
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 129
diff changeset
291 */
148
8d01028906c4 on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 143
diff changeset
292 public void startTreeViewer(String hostName,boolean cui) {
65
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 61
diff changeset
293 MyRfbProtoClient rfb = new MyRfbProtoClient();
106
01c0fd20c0b4 share screen enable cui flag.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 97
diff changeset
294 rfb.setCuiVersion(cui);
178
34b7558aeffa remove TreeTask, StartTreeHandling
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 177
diff changeset
295 rfb.setHasViewer(true);
177
8019a393875a proxy reorganization
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 176
diff changeset
296 rfb.createConnectionAndStart(this);
65
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 61
diff changeset
297 CreateConnectionParam cp = new CreateConnectionParam(rfb);
176
fa6cfb85444e on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 175
diff changeset
298 if (hostName!=null) {
fa6cfb85444e on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 175
diff changeset
299 cp.setHostName(hostName);
fa6cfb85444e on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 175
diff changeset
300 } else {
fa6cfb85444e on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 175
diff changeset
301 try {
fa6cfb85444e on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 175
diff changeset
302 cp.findTreeVncRoot();
fa6cfb85444e on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 175
diff changeset
303 } catch (InterruptedException e) {
fa6cfb85444e on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 175
diff changeset
304 System.out.println("cannot find TreeVNC Root "+e.getMessage());
fa6cfb85444e on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 175
diff changeset
305 return;
fa6cfb85444e on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 175
diff changeset
306 }
fa6cfb85444e on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 175
diff changeset
307 }
177
8019a393875a proxy reorganization
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 176
diff changeset
308 cp.sendWhereToConnect(this);
79
015321785ddf remove setType()
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 69
diff changeset
309 isTreeVNC = true;
015321785ddf remove setType()
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 69
diff changeset
310 rfb.setViewer(this);
015321785ddf remove setType()
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 69
diff changeset
311 myRfb = rfb;
121
e4408fc5679f view onlly mode set
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 106
diff changeset
312 settings.setViewOnly(true); // too avoid unnecessary upward traffic
176
fa6cfb85444e on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 175
diff changeset
313 rfb.getAcceptThread().waitForShutdown();
65
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 61
diff changeset
314 }
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 61
diff changeset
315
174
2e1530139169 reorganization
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 159
diff changeset
316
2e1530139169 reorganization
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 159
diff changeset
317 /**
2e1530139169 reorganization
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 159
diff changeset
318 * Start client with new parent (including reconnection)
2e1530139169 reorganization
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 159
diff changeset
319 * @param port
2e1530139169 reorganization
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 159
diff changeset
320 * @param hostname
2e1530139169 reorganization
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 159
diff changeset
321 * @throws IOException
2e1530139169 reorganization
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 159
diff changeset
322 */
2e1530139169 reorganization
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 159
diff changeset
323 @Override
2e1530139169 reorganization
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 159
diff changeset
324 public void connectToParenet(int port, String hostname) throws IOException {
2e1530139169 reorganization
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 159
diff changeset
325 setTeminationType(false);
2e1530139169 reorganization
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 159
diff changeset
326 closeApp();
179
c1b91dd27a13 on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 178
diff changeset
327 connectionParams.setConnectionParam(hostname, port);
174
2e1530139169 reorganization
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 159
diff changeset
328 run();
2e1530139169 reorganization
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 159
diff changeset
329 }
65
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 61
diff changeset
330
60
ac6f9e46566f proxy mode ok.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 59
diff changeset
331 public void setIsTreeVNC(boolean flag) {
ac6f9e46566f proxy mode ok.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 59
diff changeset
332 isTreeVNC = flag;
ac6f9e46566f proxy mode ok.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 59
diff changeset
333 }
61
d9cf08c6415c During implementation change screen.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 60
diff changeset
334
d9cf08c6415c During implementation change screen.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 60
diff changeset
335 public MyRfbProto getRfb() {
d9cf08c6415c During implementation change screen.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 60
diff changeset
336 return myRfb;
d9cf08c6415c During implementation change screen.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 60
diff changeset
337 }
65
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 61
diff changeset
338
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 61
diff changeset
339 public boolean getCuiVersion() {
106
01c0fd20c0b4 share screen enable cui flag.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 97
diff changeset
340 return myRfb.getCuiVersion();
65
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 61
diff changeset
341 }
68
e6550afe663b delete video feedback.
one
parents: 65
diff changeset
342 public void setCuiVersion(boolean flag) {
106
01c0fd20c0b4 share screen enable cui flag.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 97
diff changeset
343 myRfb.setCuiVersion(flag);
68
e6550afe663b delete video feedback.
one
parents: 65
diff changeset
344 }
179
c1b91dd27a13 on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 178
diff changeset
345
175
e1aa06b0d2ff on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 174
diff changeset
346 /**
e1aa06b0d2ff on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 174
diff changeset
347 * start new VNC server receiver with
e1aa06b0d2ff on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 174
diff changeset
348 * inherited clients
e1aa06b0d2ff on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 174
diff changeset
349 * @param vs
e1aa06b0d2ff on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 174
diff changeset
350 * @param hostName
e1aa06b0d2ff on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 174
diff changeset
351 */
176
fa6cfb85444e on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 175
diff changeset
352 @Override
fa6cfb85444e on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 175
diff changeset
353 public void inhelitClients(ViewerInterface vs, String hostName) {
175
e1aa06b0d2ff on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 174
diff changeset
354 myRfb.setReadyReconnect(false);
179
c1b91dd27a13 on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 178
diff changeset
355 connectionParams.setConnectionParam(hostName, vncport);
175
e1aa06b0d2ff on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 174
diff changeset
356 isApplet = true;
e1aa06b0d2ff on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 174
diff changeset
357 this.setNoConnection(false);
e1aa06b0d2ff on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 174
diff changeset
358 run();
e1aa06b0d2ff on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 174
diff changeset
359 myRfb.createConnectionAndStart(this);
174
2e1530139169 reorganization
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 159
diff changeset
360 }
2e1530139169 reorganization
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 159
diff changeset
361
175
e1aa06b0d2ff on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 174
diff changeset
362 public void proxyStart(String[] argv, int width, int height) {
e1aa06b0d2ff on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 174
diff changeset
363 fbWidth = width;
e1aa06b0d2ff on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 174
diff changeset
364 proxyStart(argv);
174
2e1530139169 reorganization
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 159
diff changeset
365 }
2e1530139169 reorganization
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 159
diff changeset
366
175
e1aa06b0d2ff on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 174
diff changeset
367 public void proxyStart(String[] argv) {
e1aa06b0d2ff on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 174
diff changeset
368 // input into arguments Decision
e1aa06b0d2ff on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 174
diff changeset
369 Parser parser = new Parser();
e1aa06b0d2ff on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 174
diff changeset
370 ParametersHandler.completeParserOptions(parser);
e1aa06b0d2ff on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 174
diff changeset
371 if (fbWidth == 0)
e1aa06b0d2ff on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 174
diff changeset
372 parser.parse(argv);
e1aa06b0d2ff on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 174
diff changeset
373 if (parser.isSet(ParametersHandler.ARG_HELP)) {
e1aa06b0d2ff on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 174
diff changeset
374 printUsage(parser.optionsUsage());
e1aa06b0d2ff on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 174
diff changeset
375 System.exit(0);
e1aa06b0d2ff on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 174
diff changeset
376 }
179
c1b91dd27a13 on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 178
diff changeset
377 String hostname = "localhost";
c1b91dd27a13 on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 178
diff changeset
378 MyRfbProtoProxy rfb = new MyRfbProtoProxy();
c1b91dd27a13 on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 178
diff changeset
379 myRfb = rfb;
c1b91dd27a13 on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 178
diff changeset
380 rfb.setTreeManager(new TreeManagement(hostname, ConnectionParams.DEFAULT_VNC_ROOT));
c1b91dd27a13 on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 178
diff changeset
381 rfb.setViewer(this);
c1b91dd27a13 on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 178
diff changeset
382 rfb.setCuiVersion(false);
c1b91dd27a13 on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 178
diff changeset
383 rfb.setHasViewer(true);
c1b91dd27a13 on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 178
diff changeset
384 rfb.createConnectionAndStart(this);
c1b91dd27a13 on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 178
diff changeset
385 setIsTreeVNC(true);
c1b91dd27a13 on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 178
diff changeset
386 connectionParams.setConnectionParam(hostname, vncport);
c1b91dd27a13 on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 178
diff changeset
387 isApplet = true;
c1b91dd27a13 on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 178
diff changeset
388 settings.setViewOnly(true); // too avoid unnecessary upward traffic
c1b91dd27a13 on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 178
diff changeset
389 run();
c1b91dd27a13 on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 178
diff changeset
390 }
c1b91dd27a13 on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 178
diff changeset
391
c1b91dd27a13 on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 178
diff changeset
392 public void initRoot(MyRfbProto myRfbProto, String hostName) {
c1b91dd27a13 on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 178
diff changeset
393 myRfbProto.setTreeManager(new TreeManagement(hostName, ConnectionParams.DEFAULT_VNC_ROOT));
c1b91dd27a13 on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 178
diff changeset
394 setIsTreeVNC(true);
c1b91dd27a13 on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 178
diff changeset
395 connectionParams.setConnectionParam(hostName, vncport);
c1b91dd27a13 on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 178
diff changeset
396 isApplet = true;
c1b91dd27a13 on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 178
diff changeset
397 myRfbProto.createConnectionAndStart(this);
c1b91dd27a13 on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 178
diff changeset
398 run();
175
e1aa06b0d2ff on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 174
diff changeset
399 }
0
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
400 }