annotate src/viewer_swing/java/com/glavsoft/viewer/Viewer.java @ 630:7071b01621c2 default tip

Determine ipv4 or ipv6 and fix scond display
author riono <e165729@ie.u-ryukyu.ac.jp>
date Tue, 28 Apr 2020 19:49:38 +0900
parents c67f0f6eae90
children
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;
383
7d55adebcacb impliment changeDirectConnectedWithSocket
kkb
parents: 379
diff changeset
28 import com.glavsoft.transport.Reader;
7d55adebcacb impliment changeDirectConnectedWithSocket
kkb
parents: 379
diff changeset
29 import com.glavsoft.transport.Writer;
0
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
30 import com.glavsoft.viewer.cli.Parser;
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: 441
diff changeset
31 import com.glavsoft.viewer.swing.ConnectionParams;
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: 441
diff changeset
32 import com.glavsoft.viewer.swing.ParametersHandler;
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: 441
diff changeset
33 import com.glavsoft.viewer.swing.SwingViewerWindow;
514
887ebd993b3d separate rfb broadcast
mir3636
parents: 513
diff changeset
34 import jp.ac.u_ryukyu.treevnc.BroadcastRFBListener;
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: 441
diff changeset
35 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: 441
diff changeset
36 import jp.ac.u_ryukyu.treevnc.TreeRFBProto;
0
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
37
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
38 import javax.swing.*;
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
39 import java.awt.*;
57
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
40 import java.awt.event.WindowEvent;
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
41 import java.awt.event.WindowListener;
626
b37ae3e512cc try to use affin transform for retina display
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 604
diff changeset
42 import java.awt.geom.AffineTransform;
b37ae3e512cc try to use affin transform for retina display
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 604
diff changeset
43 import java.awt.geom.Point2D;
0
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
44 import java.io.IOException;
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
45 import java.io.InputStream;
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
46 import java.net.Socket;
301
ae7deb002b5f send and receive single display size
oc
parents: 300
diff changeset
47 import java.util.ArrayList;
458
4ea47640942a intoroduce retina scaled frame buffer postion
innparusu
parents: 457
diff changeset
48 import java.util.Comparator;
0
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
49 import java.util.jar.Attributes;
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
50 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: 441
diff changeset
51 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: 441
diff changeset
52 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: 441
diff changeset
53 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: 441
diff changeset
54 import java.util.logging.Logger;
32
758d025ee24b add TextBox.java
one
parents: 11
diff changeset
55
0
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
56 @SuppressWarnings("serial")
179
c1b91dd27a13 on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 178
diff changeset
57 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
58
224
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
59 private Logger logger;
368
b60780e1fafc Add ServerChangeThread to inhelitClients method
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 366
diff changeset
60 public int paramsMask;
b60780e1fafc Add ServerChangeThread to inhelitClients method
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 366
diff changeset
61 public boolean allowAppletInteractiveConnections;
0
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
62
60
ac6f9e46566f proxy mode ok.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 59
diff changeset
63 public final ConnectionParams connectionParams;
368
b60780e1fafc Add ServerChangeThread to inhelitClients method
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 366
diff changeset
64 public String passwordFromParams;
b60780e1fafc Add ServerChangeThread to inhelitClients method
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 366
diff changeset
65 public boolean isSeparateFrame = true;
b60780e1fafc Add ServerChangeThread to inhelitClients method
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 366
diff changeset
66 public boolean isApplet = true;
b60780e1fafc Add ServerChangeThread to inhelitClients method
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 366
diff changeset
67 public final ProtocolSettings settings;
b60780e1fafc Add ServerChangeThread to inhelitClients method
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 366
diff changeset
68 public UiSettings uiSettings;
57
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
69 private volatile boolean isAppletStopped = false;
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
70 private ConnectionPresenter connectionPresenter;
65
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 61
diff changeset
71 boolean isTreeVNC = false;
368
b60780e1fafc Add ServerChangeThread to inhelitClients method
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 366
diff changeset
72 public TreeRFBProto myRfb;
b60780e1fafc Add ServerChangeThread to inhelitClients method
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 366
diff changeset
73 public boolean noConnection;
175
e1aa06b0d2ff on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 174
diff changeset
74 public int vncport = ConnectionParams.DEFAULT_RFB_PORT;
e1aa06b0d2ff on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 174
diff changeset
75 private int fbWidth;
224
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
76 private boolean showTree = false;
225
5e3594021e79 fix --width --height mode.
oc
parents: 224
diff changeset
77 public int width;
5e3594021e79 fix --width --height mode.
oc
parents: 224
diff changeset
78 public int height;
257
11b59b223222 add function of fixing display size
oc
parents: 256
diff changeset
79 public int fixingSizeWidth;
11b59b223222 add function of fixing display size
oc
parents: 256
diff changeset
80 public int fixingSizeHeight;
512
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 506
diff changeset
81 private boolean useMulticast;
514
887ebd993b3d separate rfb broadcast
mir3636
parents: 513
diff changeset
82 static public BroadcastRFBListener broadcastRFBListener = new BroadcastRFBListener();
139
8798f36f732b wait for FIND_ROOT_REPLY.
oc
parents: 130
diff changeset
83
57
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
84 public static void main(String[] args) {
224
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
85 Parser parser = new Parser();
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
86 ParametersHandler.completeParserOptions(parser);
0
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
87
224
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
88 parser.parse(args);
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
89 if (parser.isSet(ParametersHandler.ARG_HELP)) {
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
90 printUsage(parser.optionsUsage());
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
91 System.exit(0);
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
92 }
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
93 Viewer viewer = new Viewer(parser);
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
94 SwingUtilities.invokeLater(viewer);
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
95 }
0
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
96
57
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
97 public static void printUsage(String additional) {
224
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
98 System.out.println("Usage: java -jar (progfilename) [hostname [port_number]] [Options]Â¥n" +
368
b60780e1fafc Add ServerChangeThread to inhelitClients method
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 366
diff changeset
99 " or¥n" +
224
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
100 " java -jar (progfilename) [Options]Â¥n" +
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
101 " or¥n java -jar (progfilename) -help¥n to view this help¥n¥n" +
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
102 "Where Options are:Â¥n" + additional +
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
103 "¥nOptions format: -optionName=optionValue. Ex. -host=localhost -port=5900 -viewonly=yes¥n" +
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
104 "Both option name and option value are case insensitive.");
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
105 }
0
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
106
224
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
107 public Viewer() {
57
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
108 logger = Logger.getLogger(getClass().getName());
224
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
109 connectionParams = new ConnectionParams();
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
110 settings = ProtocolSettings.getDefaultSettings();
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
111 uiSettings = new UiSettings();
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
112 }
0
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
113
224
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
114 private Viewer(Parser parser) {
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
115 this();
57
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
116 setLoggingLevel(parser.isSet(ParametersHandler.ARG_VERBOSE) ? Level.FINE :
402
73c96a1d4a3a Fix wasteful thread start
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 401
diff changeset
117 parser.isSet(ParametersHandler.ARG_VERBOSE_MORE) ? Level.FINER :
73c96a1d4a3a Fix wasteful thread start
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 401
diff changeset
118 Level.INFO);
57
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
119
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
120 paramsMask = ParametersHandler.completeSettingsFromCLI(parser, connectionParams, settings, uiSettings);
224
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
121 passwordFromParams = parser.getValueFor(ParametersHandler.ARG_PASSWORD);
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
122 logger.info("TightVNC Viewer version " + ver());
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
123 isApplet = false;
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
124 }
0
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
125
57
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
126 private void setLoggingLevel(Level levelToSet) {
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
127 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
128 appLogger.setLevel(levelToSet);
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
129 ConsoleHandler ch = null;
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
130 for (Handler h : appLogger.getHandlers()) {
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
131 if (h instanceof ConsoleHandler) {
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
132 ch = (ConsoleHandler) h;
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
133 break;
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
134 }
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
135 }
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
136 if (null == ch) {
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
137 ch = new ConsoleHandler();
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
138 appLogger.addHandler(ch);
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
139 }
224
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
140 // ch.setFormatter(new SimpleFormatter());
57
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
141 ch.setLevel(levelToSet);
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
142 }
0
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
143
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
144
57
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
145 @Override
224
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
146 public void windowClosing(WindowEvent e) {
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
147 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
148 final Window w = e.getWindow();
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
149 if (w != null) {
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
150 w.setVisible(false);
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
151 w.dispose();
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
152 }
224
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
153 }
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
154 closeApp();
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
155 }
0
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
156
224
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
157 /**
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
158 * Closes App(lication) or stops App(let).
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
159 */
57
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
160 public void closeApp() {
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
161 if (connectionPresenter != null) {
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
162 connectionPresenter.cancelConnection();
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
163 logger.info("Connections cancelled.");
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
164 }
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
165 if (isApplet) {
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
166 if ( ! isAppletStopped) {
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
167 logger.severe("Applet is stopped.");
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
168 isAppletStopped = true;
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
169 repaint();
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
170 stop();
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
171 }
224
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
172 } else {
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
173 System.exit(0);
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
174 }
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
175 }
0
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
176
224
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
177 @Override
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
178 public void paint(Graphics g) {
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
179 if ( ! isAppletStopped) {
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
180 super.paint(g);
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
181 } else {
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
182 getContentPane().removeAll();
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
183 g.clearRect(0, 0, getWidth(), getHeight());
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
184 g.drawString("Disconnected", 10, 20);
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
185 }
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
186 }
0
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
187
224
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
188 @Override
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
189 public void destroy() {
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
190 closeApp();
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
191 super.destroy();
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
192 }
0
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
193
224
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
194 @Override
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
195 public void init() {
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
196 paramsMask = ParametersHandler.completeSettingsFromApplet(this, connectionParams, settings, uiSettings);
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
197 isSeparateFrame = ParametersHandler.isSeparateFrame;
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
198 passwordFromParams = getParameter(ParametersHandler.ARG_PASSWORD);
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
199 isApplet = true;
57
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
200 allowAppletInteractiveConnections = ParametersHandler.allowAppletInteractiveConnections;
224
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
201 repaint();
57
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
202
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
203 try {
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
204 SwingUtilities.invokeAndWait(this);
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
205 } catch (Exception e) {
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
206 logger.severe(e.getMessage());
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
207 }
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
208 }
0
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
209
224
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
210 @Override
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
211 public void start() {
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
212 super.start();
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
213 }
0
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
214
368
b60780e1fafc Add ServerChangeThread to inhelitClients method
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 366
diff changeset
215 public boolean checkJsch() {
57
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
216 try {
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
217 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
218 return true;
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
219 } catch (ClassNotFoundException e) {
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
220 return false;
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
221 }
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
222 }
224
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
223
85
432dac0b9dae delete Share Screen pop up in display mode.
sugi
parents: 79
diff changeset
224 public void setNoConnection(boolean c){
224
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
225 noConnection = c;
85
432dac0b9dae delete Share Screen pop up in display mode.
sugi
parents: 79
diff changeset
226 }
224
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
227
57
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
228 @Override
224
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
229 public void run() {
57
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
230 final boolean hasJsch = checkJsch();
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
231 final boolean allowInteractive = allowAppletInteractiveConnections || ! isApplet;
368
b60780e1fafc Add ServerChangeThread to inhelitClients method
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 366
diff changeset
232 connectionPresenter = new ConnectionPresenter(hasJsch, allowInteractive);
540
5812a47e293a fix mouse behave
riono
parents: 514
diff changeset
233 connectionPresenter.setIsTreeVNC(isTreeVNC);
512
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 506
diff changeset
234 connectionPresenter.setMulticast(useMulticast);
488
101b8a3ed8e4 reconnectionId
oshiro
parents: 469
diff changeset
235 connectionPresenter.setReconnectingId(myRfb.getId());
85
432dac0b9dae delete Share Screen pop up in display mode.
sugi
parents: 79
diff changeset
236 connectionPresenter.setNoConnection(noConnection);
57
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
237 connectionPresenter.addModel("ConnectionParamsModel", connectionParams);
395
704ac9e79e25 Call startVNCConnectionWithSocket for directedServerChangeReqeust
innparusu
parents: 383
diff changeset
238 connectionPresenter.startVNCConnection(this, false, null, null);
224
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
239 }
0
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
240
224
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
241 @Override
370
2c61e6d434ff Fix VncConnectionWorkers
innparusu
parents: 369
diff changeset
242 public ConnectionPresenter getConnectionPresenter() {
2c61e6d434ff Fix VncConnectionWorkers
innparusu
parents: 369
diff changeset
243 return connectionPresenter;
363
bc5624e3e9c5 Add newVNCConnection method to Viewer
innparusu
parents: 345
diff changeset
244 }
bc5624e3e9c5 Add newVNCConnection method to Viewer
innparusu
parents: 345
diff changeset
245
bc5624e3e9c5 Add newVNCConnection method to Viewer
innparusu
parents: 345
diff changeset
246 @Override
370
2c61e6d434ff Fix VncConnectionWorkers
innparusu
parents: 369
diff changeset
247 public void setConnectionPresenter(ConnectionPresenter connectionPresenter) {
2c61e6d434ff Fix VncConnectionWorkers
innparusu
parents: 369
diff changeset
248 this.connectionPresenter = connectionPresenter;
369
2d01ec1c02d2 Fix ReConnectingFlag
innparusu
parents: 368
diff changeset
249 }
2d01ec1c02d2 Fix ReConnectingFlag
innparusu
parents: 368
diff changeset
250
2d01ec1c02d2 Fix ReConnectingFlag
innparusu
parents: 368
diff changeset
251 @Override
224
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
252 public void windowOpened(WindowEvent e) { /* nop */ }
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
253 @Override
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
254 public void windowClosed(WindowEvent e) { /* nop */ }
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
255 @Override
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
256 public void windowIconified(WindowEvent e) { /* nop */ }
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
257 @Override
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
258 public void windowDeiconified(WindowEvent e) { /* nop */ }
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
259 @Override
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
260 public void windowActivated(WindowEvent e) { /* nop */ }
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
261 @Override
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
262 public void windowDeactivated(WindowEvent e) { /* nop */ }
0
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
263
224
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
264 public static String ver() {
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
265 final InputStream mfStream = Viewer.class.getClassLoader().getResourceAsStream(
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
266 "META-INF/MANIFEST.MF");
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
267 if (null == mfStream) {
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
268 System.out.println("No Manifest file found.");
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
269 return "-1";
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
270 }
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
271 try {
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
272 Manifest mf = new Manifest();
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
273 mf.read(mfStream);
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
274 Attributes atts = mf.getMainAttributes();
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
275 return atts.getValue(Attributes.Name.IMPLEMENTATION_VERSION);
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
276 } catch (IOException e) {
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
277 return "-2";
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
278 }
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
279 }
0
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
280
59
433c79184c05 merge version2.7.2
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 57 55
diff changeset
281
224
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
282 public void setSocket(Socket soc) {
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
283 connectionParams.setConnectionParam(soc.getInetAddress().getHostAddress(),soc.getPort());
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
284 }
59
433c79184c05 merge version2.7.2
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 57 55
diff changeset
285
224
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
286 public void setOpenPort(int parseInt) {
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
287 }
59
433c79184c05 merge version2.7.2
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 57 55
diff changeset
288
328
1a2ab6bd5ba3 add function lost child node, remove deadChild nodeList.
oc
parents: 327
diff changeset
289 public void setTerminationType(boolean b) {
224
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
290 myRfb.setTerminationType(b);
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
291 }
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
292
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
293 /**
174
2e1530139169 reorganization
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 159
diff changeset
294 * Start client with new parent (including reconnection)
2e1530139169 reorganization
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 159
diff changeset
295 * @param port
2e1530139169 reorganization
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 159
diff changeset
296 * @param hostname
2e1530139169 reorganization
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 159
diff changeset
297 * @throws IOException
2e1530139169 reorganization
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 159
diff changeset
298 */
224
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
299 @Override
334
dff2f92ae3ff change lost left/right child to lost child.
oc
parents: 328
diff changeset
300 public void connectToParenet(int port, String hostname) throws IOException {
328
1a2ab6bd5ba3 add function lost child node, remove deadChild nodeList.
oc
parents: 327
diff changeset
301 setTerminationType(false);
174
2e1530139169 reorganization
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 159
diff changeset
302 closeApp();
179
c1b91dd27a13 on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 178
diff changeset
303 connectionParams.setConnectionParam(hostname, port);
174
2e1530139169 reorganization
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 159
diff changeset
304 run();
2e1530139169 reorganization
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 159
diff changeset
305 }
224
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
306
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
307 public void setIsTreeVNC(boolean flag) {
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
308 isTreeVNC = flag;
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
309 }
65
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 61
diff changeset
310
224
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
311 public TreeRFBProto getRfb() {
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
312 return myRfb;
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
313 }
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
314
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
315 public boolean getCuiVersion() {
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
316 return myRfb.getCuiVersion();
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
317 }
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
318 public void setCuiVersion(boolean flag) {
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
319 myRfb.setCuiVersion(flag);
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
320 }
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
321
377
877008c86e85 Add direct option
innparusu
parents: 375
diff changeset
322 public void setVncport(int vncport) {
877008c86e85 Add direct option
innparusu
parents: 375
diff changeset
323 this.vncport = vncport;
877008c86e85 Add direct option
innparusu
parents: 375
diff changeset
324 }
877008c86e85 Add direct option
innparusu
parents: 375
diff changeset
325
175
e1aa06b0d2ff on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 174
diff changeset
326 /**
e1aa06b0d2ff on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 174
diff changeset
327 * start new VNC server receiver with
e1aa06b0d2ff on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 174
diff changeset
328 * inherited clients
e1aa06b0d2ff on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 174
diff changeset
329 * @param hostName
369
2d01ec1c02d2 Fix ReConnectingFlag
innparusu
parents: 368
diff changeset
330 * @param newVNCServerId
428
f6a828dd37b0 Change timing for setting share screen info
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 427
diff changeset
331 * @param x
f6a828dd37b0 Change timing for setting share screen info
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 427
diff changeset
332 * @param y
f6a828dd37b0 Change timing for setting share screen info
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 427
diff changeset
333 * @param width
f6a828dd37b0 Change timing for setting share screen info
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 427
diff changeset
334 * @param height
f6a828dd37b0 Change timing for setting share screen info
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 427
diff changeset
335 * @param scale
175
e1aa06b0d2ff on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 174
diff changeset
336 */
176
fa6cfb85444e on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 175
diff changeset
337 @Override
428
f6a828dd37b0 Change timing for setting share screen info
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 427
diff changeset
338 public void inhelitClients(String hostName, short newVNCServerId, int x, int y, int width, int height, int scale) {
f6a828dd37b0 Change timing for setting share screen info
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 427
diff changeset
339 final ConnectionPresenter connectionPresenter = createNewConnectionPresenter(hostName, newVNCServerId, x, y, width, height, scale);
383
7d55adebcacb impliment changeDirectConnectedWithSocket
kkb
parents: 379
diff changeset
340 isApplet = true;
7d55adebcacb impliment changeDirectConnectedWithSocket
kkb
parents: 379
diff changeset
341 this.setNoConnection(false);
7d55adebcacb impliment changeDirectConnectedWithSocket
kkb
parents: 379
diff changeset
342 final Viewer v = this;
7d55adebcacb impliment changeDirectConnectedWithSocket
kkb
parents: 379
diff changeset
343 new Thread(new Runnable() {
7d55adebcacb impliment changeDirectConnectedWithSocket
kkb
parents: 379
diff changeset
344 @Override
7d55adebcacb impliment changeDirectConnectedWithSocket
kkb
parents: 379
diff changeset
345 public void run() {
395
704ac9e79e25 Call startVNCConnectionWithSocket for directedServerChangeReqeust
innparusu
parents: 383
diff changeset
346 connectionPresenter.startVNCConnection(v, false, null, null);
383
7d55adebcacb impliment changeDirectConnectedWithSocket
kkb
parents: 379
diff changeset
347 }
7d55adebcacb impliment changeDirectConnectedWithSocket
kkb
parents: 379
diff changeset
348 }, "ServerChangeThread").start();
7d55adebcacb impliment changeDirectConnectedWithSocket
kkb
parents: 379
diff changeset
349 }
7d55adebcacb impliment changeDirectConnectedWithSocket
kkb
parents: 379
diff changeset
350
428
f6a828dd37b0 Change timing for setting share screen info
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 427
diff changeset
351 public void changeToDirectConnectedServer(String hostName, Reader is, Writer os, int x, int y, int width, int height, int scale) {
f6a828dd37b0 Change timing for setting share screen info
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 427
diff changeset
352 final ConnectionPresenter connectionPresenter = createNewConnectionPresenter(hostName, (short) -1, x, y, width, height, scale);
395
704ac9e79e25 Call startVNCConnectionWithSocket for directedServerChangeReqeust
innparusu
parents: 383
diff changeset
353 connectionPresenter.startVNCConnection(this, true, is, os);
441
cee43ceac9b3 send thatscreen position INIT_DATA
one
parents: 428
diff changeset
354 }
383
7d55adebcacb impliment changeDirectConnectedWithSocket
kkb
parents: 379
diff changeset
355
512
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 506
diff changeset
356 @Override
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 506
diff changeset
357 public void setUseMulticast(boolean useMulticast) {
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 506
diff changeset
358 this.useMulticast = useMulticast;
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 506
diff changeset
359 }
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 506
diff changeset
360
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 506
diff changeset
361 @Override
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 506
diff changeset
362 public boolean getUseMulticast() {
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 506
diff changeset
363 return useMulticast;
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 506
diff changeset
364 }
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 506
diff changeset
365
514
887ebd993b3d separate rfb broadcast
mir3636
parents: 513
diff changeset
366 @Override
887ebd993b3d separate rfb broadcast
mir3636
parents: 513
diff changeset
367 public BroadcastRFBListener getRfbBroadcastListener() {
887ebd993b3d separate rfb broadcast
mir3636
parents: 513
diff changeset
368 return broadcastRFBListener;
887ebd993b3d separate rfb broadcast
mir3636
parents: 513
diff changeset
369 }
887ebd993b3d separate rfb broadcast
mir3636
parents: 513
diff changeset
370
551
e912db2ab778 fix RetinaDisplay API for java9 and above
e165729 <e165729@ie.u-ryukyu.ac.jp>
parents: 540
diff changeset
371 @Override
e912db2ab778 fix RetinaDisplay API for java9 and above
e165729 <e165729@ie.u-ryukyu.ac.jp>
parents: 540
diff changeset
372 public boolean getIsRetinaDisplay(int shareScreenNumber) {
626
b37ae3e512cc try to use affin transform for retina display
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 604
diff changeset
373 AffineTransform defaultTransform = getAffineTransform(shareScreenNumber);
b37ae3e512cc try to use affin transform for retina display
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 604
diff changeset
374 return ! defaultTransform.isIdentity();
b37ae3e512cc try to use affin transform for retina display
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 604
diff changeset
375 }
b37ae3e512cc try to use affin transform for retina display
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 604
diff changeset
376
b37ae3e512cc try to use affin transform for retina display
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 604
diff changeset
377 private AffineTransform getAffineTransform(int shareScreenNumber) {
551
e912db2ab778 fix RetinaDisplay API for java9 and above
e165729 <e165729@ie.u-ryukyu.ac.jp>
parents: 540
diff changeset
378 GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
e912db2ab778 fix RetinaDisplay API for java9 and above
e165729 <e165729@ie.u-ryukyu.ac.jp>
parents: 540
diff changeset
379 final GraphicsDevice[] devices = env.getScreenDevices();
e912db2ab778 fix RetinaDisplay API for java9 and above
e165729 <e165729@ie.u-ryukyu.ac.jp>
parents: 540
diff changeset
380 GraphicsConfiguration conf = devices[shareScreenNumber].getDefaultConfiguration();
626
b37ae3e512cc try to use affin transform for retina display
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 604
diff changeset
381 return conf.getDefaultTransform();
551
e912db2ab778 fix RetinaDisplay API for java9 and above
e165729 <e165729@ie.u-ryukyu.ac.jp>
parents: 540
diff changeset
382 }
e912db2ab778 fix RetinaDisplay API for java9 and above
e165729 <e165729@ie.u-ryukyu.ac.jp>
parents: 540
diff changeset
383
428
f6a828dd37b0 Change timing for setting share screen info
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 427
diff changeset
384 private ConnectionPresenter createNewConnectionPresenter(String hostName, short newVNCServerId, int x, int y, int width, int height, int scale) {
368
b60780e1fafc Add ServerChangeThread to inhelitClients method
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 366
diff changeset
385 final boolean hasJsch = checkJsch();
b60780e1fafc Add ServerChangeThread to inhelitClients method
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 366
diff changeset
386 final boolean allowInteractive = allowAppletInteractiveConnections || ! isApplet;
506
3fe7e1a372df Multicast CUI
toubaru
parents: 488
diff changeset
387 final ConnectionPresenter connectionPresenter1 = new ConnectionPresenter(hasJsch, allowInteractive);
368
b60780e1fafc Add ServerChangeThread to inhelitClients method
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 366
diff changeset
388 ConnectionParams connectionParams = new ConnectionParams();
179
c1b91dd27a13 on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 178
diff changeset
389 connectionParams.setConnectionParam(hostName, vncport);
506
3fe7e1a372df Multicast CUI
toubaru
parents: 488
diff changeset
390 connectionPresenter1.addModel("ConnectionParamsModel", connectionParams);
3fe7e1a372df Multicast CUI
toubaru
parents: 488
diff changeset
391 connectionPresenter1.setConnectionParams(connectionParams);
3fe7e1a372df Multicast CUI
toubaru
parents: 488
diff changeset
392 connectionPresenter1.setReconnectingId(newVNCServerId);
3fe7e1a372df Multicast CUI
toubaru
parents: 488
diff changeset
393 connectionPresenter1.setIsTreeVNC(true);
3fe7e1a372df Multicast CUI
toubaru
parents: 488
diff changeset
394 connectionPresenter1.setNoConnection(false);
3fe7e1a372df Multicast CUI
toubaru
parents: 488
diff changeset
395 connectionPresenter1.setX(x);
3fe7e1a372df Multicast CUI
toubaru
parents: 488
diff changeset
396 connectionPresenter1.setY(y);
3fe7e1a372df Multicast CUI
toubaru
parents: 488
diff changeset
397 connectionPresenter1.setSingleWidth(width);
3fe7e1a372df Multicast CUI
toubaru
parents: 488
diff changeset
398 connectionPresenter1.setSingleHeight(height);
3fe7e1a372df Multicast CUI
toubaru
parents: 488
diff changeset
399 connectionPresenter1.setRetinaScale(scale);
562
87ae979b88cd -p mode use ScreenSelectionPanel. Blocking is not working yet, but we can debug it in -p mode.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 551
diff changeset
400 connectionPresenter1.setMulticast(myRfb.multicastBlocking);
460
c6058c4e2a79 remove debug message
mir3636
parents: 459
diff changeset
401 // System.out.println("Sarver change accepted from id :" + newVNCServerId);
513
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 512
diff changeset
402 return connectionPresenter1;
174
2e1530139169 reorganization
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 159
diff changeset
403 }
2e1530139169 reorganization
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 159
diff changeset
404
343
f1721ec54899 add remoteRootStart
oc
parents: 334
diff changeset
405 /**
f1721ec54899 add remoteRootStart
oc
parents: 334
diff changeset
406 * start TreeVNC viewer
f1721ec54899 add remoteRootStart
oc
parents: 334
diff changeset
407 */
379
ea324e42bc78 Add arguments to startTreeViewer method
innparusu
parents: 377
diff changeset
408 public void startTreeViewer(String hostName, boolean cui, boolean addSerialNum) {
343
f1721ec54899 add remoteRootStart
oc
parents: 334
diff changeset
409 TreeRFBProto rfb = new TreeRFBProto(false, this);
f1721ec54899 add remoteRootStart
oc
parents: 334
diff changeset
410 rfb.setCuiVersion(cui);
379
ea324e42bc78 Add arguments to startTreeViewer method
innparusu
parents: 377
diff changeset
411 rfb.setAddSerialNum(addSerialNum);
343
f1721ec54899 add remoteRootStart
oc
parents: 334
diff changeset
412 rfb.setHasViewer(true);
f1721ec54899 add remoteRootStart
oc
parents: 334
diff changeset
413 rfb.createConnectionAndStart(this);
f1721ec54899 add remoteRootStart
oc
parents: 334
diff changeset
414 CreateConnectionParam cp = new CreateConnectionParam(rfb);
f1721ec54899 add remoteRootStart
oc
parents: 334
diff changeset
415 if (hostName!=null) {
f1721ec54899 add remoteRootStart
oc
parents: 334
diff changeset
416 cp.setHostName(hostName);
f1721ec54899 add remoteRootStart
oc
parents: 334
diff changeset
417 } else {
604
668ff8c17f46 fix Find root
riono
parents: 566
diff changeset
418 findTreeVncRoot(rfb,cp);
401
94c520535ef1 Fix selection panel
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 400
diff changeset
419 // selected "Start Display Mode" or "Start as TreeVNC Root" for start selection panel
94c520535ef1 Fix selection panel
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 400
diff changeset
420 if (cp.isDisplayMode() || cp.isRootMode()) {
400
845698fd6fb6 Remove synchronized
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 399
diff changeset
421 myRfb = rfb;
402
73c96a1d4a3a Fix wasteful thread start
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 401
diff changeset
422 myRfb.setIsTreeManager(true);
399
28d67bbfa9f1 Implement SelectionPanel processing
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 395
diff changeset
423 return;
28d67bbfa9f1 Implement SelectionPanel processing
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 395
diff changeset
424 }
343
f1721ec54899 add remoteRootStart
oc
parents: 334
diff changeset
425 }
488
101b8a3ed8e4 reconnectionId
oshiro
parents: 469
diff changeset
426
101b8a3ed8e4 reconnectionId
oshiro
parents: 469
diff changeset
427 if (rfb.isTreeManager()) {
101b8a3ed8e4 reconnectionId
oshiro
parents: 469
diff changeset
428 rfb.setId((short) rfb.getNewNodeId());
101b8a3ed8e4 reconnectionId
oshiro
parents: 469
diff changeset
429 }
343
f1721ec54899 add remoteRootStart
oc
parents: 334
diff changeset
430 cp.sendWhereToConnect(this);
f1721ec54899 add remoteRootStart
oc
parents: 334
diff changeset
431 isTreeVNC = true;
f1721ec54899 add remoteRootStart
oc
parents: 334
diff changeset
432 myRfb = rfb;
f1721ec54899 add remoteRootStart
oc
parents: 334
diff changeset
433 settings.setViewOnly(true); // too avoid unnecessary upward traffic
f1721ec54899 add remoteRootStart
oc
parents: 334
diff changeset
434 rfb.getAcceptThread().waitForShutdown();
f1721ec54899 add remoteRootStart
oc
parents: 334
diff changeset
435 }
f1721ec54899 add remoteRootStart
oc
parents: 334
diff changeset
436
566
e93a8058344d several fixes
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 563
diff changeset
437 public void proxyStart(String[] argv, String hostName, int width, int height, boolean showTree, boolean checkDelay, boolean addSerialNum, boolean fixingSize, boolean filterSingleDisplay, boolean hasViewer, boolean connect) {
224
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
438 fbWidth = width;
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
439 this.showTree = showTree;
175
e1aa06b0d2ff on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 174
diff changeset
440 Parser parser = new Parser();
e1aa06b0d2ff on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 174
diff changeset
441 ParametersHandler.completeParserOptions(parser);
e1aa06b0d2ff on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 174
diff changeset
442 if (fbWidth == 0)
e1aa06b0d2ff on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 174
diff changeset
443 parser.parse(argv);
e1aa06b0d2ff on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 174
diff changeset
444 if (parser.isSet(ParametersHandler.ARG_HELP)) {
e1aa06b0d2ff on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 174
diff changeset
445 printUsage(parser.optionsUsage());
e1aa06b0d2ff on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 174
diff changeset
446 System.exit(0);
e1aa06b0d2ff on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 174
diff changeset
447 }
402
73c96a1d4a3a Fix wasteful thread start
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 401
diff changeset
448
73c96a1d4a3a Fix wasteful thread start
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 401
diff changeset
449 // myRfb is null if use command line option "-d" "-p"
73c96a1d4a3a Fix wasteful thread start
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 401
diff changeset
450 // myRfb not null if use start panel
73c96a1d4a3a Fix wasteful thread start
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 401
diff changeset
451 if (myRfb == null) {
73c96a1d4a3a Fix wasteful thread start
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 401
diff changeset
452 myRfb = new TreeRFBProto(true, this);
73c96a1d4a3a Fix wasteful thread start
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 401
diff changeset
453 }
455
6f3d3da40940 fix cui and hasViewer flag
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 454
diff changeset
454 myRfb.setCuiVersion(!hasViewer);
6f3d3da40940 fix cui and hasViewer flag
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 454
diff changeset
455 myRfb.setHasViewer(hasViewer);
402
73c96a1d4a3a Fix wasteful thread start
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 401
diff changeset
456 myRfb.setShowTree(showTree);
73c96a1d4a3a Fix wasteful thread start
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 401
diff changeset
457 myRfb.setCheckDelay(checkDelay);
73c96a1d4a3a Fix wasteful thread start
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 401
diff changeset
458 myRfb.setAddSerialNum(addSerialNum);
73c96a1d4a3a Fix wasteful thread start
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 401
diff changeset
459 myRfb.setFixingSize(fixingSize);
266
17eb729d64be fix --fixingSize option correspondence -p option.
oc
parents: 257
diff changeset
460 if(fixingSize) {
402
73c96a1d4a3a Fix wasteful thread start
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 401
diff changeset
461 myRfb.fixingSizeWidth = fixingSizeWidth;
73c96a1d4a3a Fix wasteful thread start
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 401
diff changeset
462 myRfb.fixingSizeHeight = fixingSizeHeight;
266
17eb729d64be fix --fixingSize option correspondence -p option.
oc
parents: 257
diff changeset
463 }
402
73c96a1d4a3a Fix wasteful thread start
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 401
diff changeset
464 if (myRfb.getAcceptThread() == null) {
73c96a1d4a3a Fix wasteful thread start
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 401
diff changeset
465 myRfb.createConnectionAndStart(this);
73c96a1d4a3a Fix wasteful thread start
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 401
diff changeset
466 } else {
73c96a1d4a3a Fix wasteful thread start
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 401
diff changeset
467 myRfb.startTreeRootFindThread();
73c96a1d4a3a Fix wasteful thread start
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 401
diff changeset
468 }
179
c1b91dd27a13 on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 178
diff changeset
469 setIsTreeVNC(true);
377
877008c86e85 Add direct option
innparusu
parents: 375
diff changeset
470 if (hostName == null) {
877008c86e85 Add direct option
innparusu
parents: 375
diff changeset
471 hostName = "localhost";
877008c86e85 Add direct option
innparusu
parents: 375
diff changeset
472 }
877008c86e85 Add direct option
innparusu
parents: 375
diff changeset
473 connectionParams.setConnectionParam(hostName, vncport);
179
c1b91dd27a13 on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 178
diff changeset
474 isApplet = true;
449
d5bcae14c2cd reuse FrameUpdateRequest for all code
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 448
diff changeset
475 settings.setViewOnly(true); // to avoid unnecessary upward traffic
566
e93a8058344d several fixes
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 563
diff changeset
476 if (connect)
e93a8058344d several fixes
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 563
diff changeset
477 createScreenSelectionPanel(null);
562
87ae979b88cd -p mode use ScreenSelectionPanel. Blocking is not working yet, but we can debug it in -p mode.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 551
diff changeset
478 myRfb.getAcceptThread().waitForShutdown();
179
c1b91dd27a13 on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 178
diff changeset
479 }
c1b91dd27a13 on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 178
diff changeset
480
207
b31903e5b02d rename myRFBProto
oc
parents: 206
diff changeset
481 public void initRoot(TreeRFBProto myRfbProto, String hostName) {
179
c1b91dd27a13 on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 178
diff changeset
482 setIsTreeVNC(true);
c1b91dd27a13 on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 178
diff changeset
483 connectionParams.setConnectionParam(hostName, vncport);
c1b91dd27a13 on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 178
diff changeset
484 isApplet = true;
c1b91dd27a13 on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 178
diff changeset
485 myRfbProto.createConnectionAndStart(this);
c1b91dd27a13 on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 178
diff changeset
486 run();
175
e1aa06b0d2ff on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 174
diff changeset
487 }
224
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
488
192
aa00e4b2fc27 fix root viewer.
oc
parents: 188
diff changeset
489 @Override
aa00e4b2fc27 fix root viewer.
oc
parents: 188
diff changeset
490 public void setVisible(boolean b) {
366
2d83bea06f00 Check connectionPresenter
innparusu
parents: 363
diff changeset
491 if(connectionPresenter == null) return;
224
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
492 SwingViewerWindow v = connectionPresenter.getViewer();
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
493 if (v != null)
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
494 v.setVisible(b);
192
aa00e4b2fc27 fix root viewer.
oc
parents: 188
diff changeset
495 }
188
f176bffcdc4a add showTreeNode option.
oc
parents: 186
diff changeset
496
224
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
497 @Override
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
498 public Socket getVNCSocket() {
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
499 return connectionPresenter.getSocket();
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
500 }
202
22676ca0dd97 get VNC Socket.
oc
parents: 192
diff changeset
501
204
d9d234715853 TreeManager for each interface
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 203
diff changeset
502 @Override
d9d234715853 TreeManager for each interface
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 203
diff changeset
503 public boolean getShowTree() {
d9d234715853 TreeManager for each interface
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 203
diff changeset
504 return showTree;
d9d234715853 TreeManager for each interface
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 203
diff changeset
505 }
d9d234715853 TreeManager for each interface
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 203
diff changeset
506
225
5e3594021e79 fix --width --height mode.
oc
parents: 224
diff changeset
507 @Override
5e3594021e79 fix --width --height mode.
oc
parents: 224
diff changeset
508 public void setWidth(int w) {
5e3594021e79 fix --width --height mode.
oc
parents: 224
diff changeset
509 width = w;
5e3594021e79 fix --width --height mode.
oc
parents: 224
diff changeset
510 }
5e3594021e79 fix --width --height mode.
oc
parents: 224
diff changeset
511
5e3594021e79 fix --width --height mode.
oc
parents: 224
diff changeset
512 @Override
5e3594021e79 fix --width --height mode.
oc
parents: 224
diff changeset
513 public void setHeight(int h) {
5e3594021e79 fix --width --height mode.
oc
parents: 224
diff changeset
514 height = h;
5e3594021e79 fix --width --height mode.
oc
parents: 224
diff changeset
515 }
5e3594021e79 fix --width --height mode.
oc
parents: 224
diff changeset
516
257
11b59b223222 add function of fixing display size
oc
parents: 256
diff changeset
517 @Override
11b59b223222 add function of fixing display size
oc
parents: 256
diff changeset
518 public void setFixingSize(int width, int height) {
11b59b223222 add function of fixing display size
oc
parents: 256
diff changeset
519 this.fixingSizeWidth = width;
11b59b223222 add function of fixing display size
oc
parents: 256
diff changeset
520 this.fixingSizeHeight = height;
11b59b223222 add function of fixing display size
oc
parents: 256
diff changeset
521 }
301
ae7deb002b5f send and receive single display size
oc
parents: 300
diff changeset
522
ae7deb002b5f send and receive single display size
oc
parents: 300
diff changeset
523 @Override
458
4ea47640942a intoroduce retina scaled frame buffer postion
innparusu
parents: 457
diff changeset
524 public ArrayList<FbRectangle> getScreenRectangles() {
314
e95cb9a3dd9b change code, delete firstTime.
oc
parents: 306
diff changeset
525 // New screen server has one or more screens.
e95cb9a3dd9b change code, delete firstTime.
oc
parents: 306
diff changeset
526 // Screens are numbered in the order from left.
e95cb9a3dd9b change code, delete firstTime.
oc
parents: 306
diff changeset
527 // put screens in an ArrayList.
301
ae7deb002b5f send and receive single display size
oc
parents: 300
diff changeset
528 ArrayList<Rectangle> rectangles = new ArrayList<Rectangle>();
ae7deb002b5f send and receive single display size
oc
parents: 300
diff changeset
529 GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
ae7deb002b5f send and receive single display size
oc
parents: 300
diff changeset
530 GraphicsDevice[] gs = ge.getScreenDevices();
417
c225c7963778 Send screen position
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 402
diff changeset
531
314
e95cb9a3dd9b change code, delete firstTime.
oc
parents: 306
diff changeset
532 for (GraphicsDevice gd : gs) {
e95cb9a3dd9b change code, delete firstTime.
oc
parents: 306
diff changeset
533 for (GraphicsConfiguration r : gd.getConfigurations()) {
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: 441
diff changeset
534 Rectangle rect = r.getBounds();
563
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 562
diff changeset
535 //System.out.println("screen "+ rectangles.length() +":"+rect);
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: 441
diff changeset
536 rectangles.add(rect);
301
ae7deb002b5f send and receive single display size
oc
parents: 300
diff changeset
537 }
ae7deb002b5f send and receive single display size
oc
parents: 300
diff changeset
538 }
458
4ea47640942a intoroduce retina scaled frame buffer postion
innparusu
parents: 457
diff changeset
539 Point offset = getScreenOffset(rectangles);
4ea47640942a intoroduce retina scaled frame buffer postion
innparusu
parents: 457
diff changeset
540 ArrayList<FbRectangle> fbRectangles = new ArrayList<FbRectangle>();
4ea47640942a intoroduce retina scaled frame buffer postion
innparusu
parents: 457
diff changeset
541 int screenNumber = 0;
4ea47640942a intoroduce retina scaled frame buffer postion
innparusu
parents: 457
diff changeset
542 for (Rectangle rect : rectangles) {
626
b37ae3e512cc try to use affin transform for retina display
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 604
diff changeset
543 AffineTransform aft = getAffineTransform(screenNumber);
b37ae3e512cc try to use affin transform for retina display
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 604
diff changeset
544 FbRectangle fbrect = new FbRectangle(rect.x, rect.y, rect.width, rect.height, screenNumber, (int)aft.getScaleX(), !aft.isIdentity(),aft);
461
b7d43b12651c fix getFbRectangles x may have minus value now, but xFb is always plus
kono
parents: 460
diff changeset
545 fbrect.setXfb(rect.x + offset.x);
466
8d636adb292c fix getFbRectangles
kono
parents: 461
diff changeset
546 fbrect.setYfb(rect.y + offset.y);
461
b7d43b12651c fix getFbRectangles x may have minus value now, but xFb is always plus
kono
parents: 460
diff changeset
547 fbRectangles.add(fbrect);
458
4ea47640942a intoroduce retina scaled frame buffer postion
innparusu
parents: 457
diff changeset
548 screenNumber++;
4ea47640942a intoroduce retina scaled frame buffer postion
innparusu
parents: 457
diff changeset
549 }
459
9f5cd8ca0ebc Without retina scale to calcoffset
one
parents: 458
diff changeset
550
563
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 562
diff changeset
551 fbRectangles.sort((t0, t1) -> t0.getX() < t1.getX() ? -1 : t0.getX() == t1.getX() ? 0 : 1);
458
4ea47640942a intoroduce retina scaled frame buffer postion
innparusu
parents: 457
diff changeset
552
4ea47640942a intoroduce retina scaled frame buffer postion
innparusu
parents: 457
diff changeset
553 int retinaOffsetX = 0;
4ea47640942a intoroduce retina scaled frame buffer postion
innparusu
parents: 457
diff changeset
554 FbRectangle fbRectanglesPrev = fbRectangles.get(0);
4ea47640942a intoroduce retina scaled frame buffer postion
innparusu
parents: 457
diff changeset
555 for (int i = 1; i < fbRectangles.size(); i++) {
4ea47640942a intoroduce retina scaled frame buffer postion
innparusu
parents: 457
diff changeset
556 FbRectangle fbRect = fbRectangles.get(i);
630
7071b01621c2 Determine ipv4 or ipv6 and fix scond display
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 628
diff changeset
557 if (fbRectanglesPrev.getRetinaScale() != 1) {
469
3332879d1bd0 fix retina frame buffer position
mir3636
parents: 468
diff changeset
558 if (fbRectanglesPrev.x + fbRectanglesPrev.width <= fbRect.x) {
458
4ea47640942a intoroduce retina scaled frame buffer postion
innparusu
parents: 457
diff changeset
559 // previous screen is touch with this screen, fix retina scale offset
4ea47640942a intoroduce retina scaled frame buffer postion
innparusu
parents: 457
diff changeset
560 retinaOffsetX += fbRectanglesPrev.getWidth() * (fbRectanglesPrev.retinaScale - 1);
4ea47640942a intoroduce retina scaled frame buffer postion
innparusu
parents: 457
diff changeset
561 }
4ea47640942a intoroduce retina scaled frame buffer postion
innparusu
parents: 457
diff changeset
562 }
461
b7d43b12651c fix getFbRectangles x may have minus value now, but xFb is always plus
kono
parents: 460
diff changeset
563 fbRect.setXfb((int) (fbRect.getXfb() + retinaOffsetX));
458
4ea47640942a intoroduce retina scaled frame buffer postion
innparusu
parents: 457
diff changeset
564 fbRectanglesPrev = fbRect;
4ea47640942a intoroduce retina scaled frame buffer postion
innparusu
parents: 457
diff changeset
565 }
4ea47640942a intoroduce retina scaled frame buffer postion
innparusu
parents: 457
diff changeset
566
563
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 562
diff changeset
567 fbRectangles.sort((t0, t1) -> t0.getY() < t1.getY() ? -1 : t0.getY() == t1.getY() ? 0 : 1);
459
9f5cd8ca0ebc Without retina scale to calcoffset
one
parents: 458
diff changeset
568
458
4ea47640942a intoroduce retina scaled frame buffer postion
innparusu
parents: 457
diff changeset
569 int retinaOffsetY = 0;
4ea47640942a intoroduce retina scaled frame buffer postion
innparusu
parents: 457
diff changeset
570 fbRectanglesPrev = fbRectangles.get(0);
4ea47640942a intoroduce retina scaled frame buffer postion
innparusu
parents: 457
diff changeset
571 for (int i = 1; i < fbRectangles.size(); i++) {
4ea47640942a intoroduce retina scaled frame buffer postion
innparusu
parents: 457
diff changeset
572 FbRectangle fbRect = fbRectangles.get(i);
630
7071b01621c2 Determine ipv4 or ipv6 and fix scond display
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 628
diff changeset
573 if (fbRectanglesPrev.getRetinaScale() != 1) {
469
3332879d1bd0 fix retina frame buffer position
mir3636
parents: 468
diff changeset
574 if (fbRectanglesPrev.y + fbRectanglesPrev.height <= fbRect.y) {
458
4ea47640942a intoroduce retina scaled frame buffer postion
innparusu
parents: 457
diff changeset
575 // previous screen is touch with this screen, fix retina scale offset
4ea47640942a intoroduce retina scaled frame buffer postion
innparusu
parents: 457
diff changeset
576 retinaOffsetY += fbRectanglesPrev.getHeight() * (fbRectanglesPrev.retinaScale - 1);
4ea47640942a intoroduce retina scaled frame buffer postion
innparusu
parents: 457
diff changeset
577 }
4ea47640942a intoroduce retina scaled frame buffer postion
innparusu
parents: 457
diff changeset
578 }
461
b7d43b12651c fix getFbRectangles x may have minus value now, but xFb is always plus
kono
parents: 460
diff changeset
579 fbRect.setYfb((int) (fbRect.getYfb() + retinaOffsetY));
458
4ea47640942a intoroduce retina scaled frame buffer postion
innparusu
parents: 457
diff changeset
580 fbRectanglesPrev = fbRect;
4ea47640942a intoroduce retina scaled frame buffer postion
innparusu
parents: 457
diff changeset
581 }
628
c67f0f6eae90 remove retina scale debug message
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 627
diff changeset
582 /*
c67f0f6eae90 remove retina scale debug message
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 627
diff changeset
583 for (int i = 0; i < fbRectangles.size(); i++) {
626
b37ae3e512cc try to use affin transform for retina display
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 604
diff changeset
584 FbRectangle rect = fbRectangles.get(i);
b37ae3e512cc try to use affin transform for retina display
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 604
diff changeset
585 double[] r = { rect.x, rect.y , rect.x+rect.width, rect.y+rect.height};
627
ryokka
parents: 626
diff changeset
586 Point2D p = rect.aft.transform( new Point2D.Double((double) rect.x, (double) rect.y ), null);
ryokka
parents: 626
diff changeset
587 Point2D q = rect.aft.transform(new Point2D.Double((double) rect.x+rect.width, (double) rect.y+rect.height), null);
ryokka
parents: 626
diff changeset
588 System.out.println("fbRectangle " +rect+ "p " +p+ " q" +q);
628
c67f0f6eae90 remove retina scale debug message
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 627
diff changeset
589 } */
458
4ea47640942a intoroduce retina scaled frame buffer postion
innparusu
parents: 457
diff changeset
590 return fbRectangles;
301
ae7deb002b5f send and receive single display size
oc
parents: 300
diff changeset
591 }
ae7deb002b5f send and receive single display size
oc
parents: 300
diff changeset
592
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: 441
diff changeset
593 public Point getScreenOffset(ArrayList<Rectangle> rectangles) {
451
65ffb64cfb51 try to fix scroll y in fitScreen
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 449
diff changeset
594 // position of screen may negative, but RFBscreen position is always positive
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: 441
diff changeset
595 // compute offset to make them positive
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: 441
diff changeset
596 int offsetx = 0;
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: 441
diff changeset
597 int offsety = 0;
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: 441
diff changeset
598 for (Rectangle rect : rectangles) {
459
9f5cd8ca0ebc Without retina scale to calcoffset
one
parents: 458
diff changeset
599 if (rect.x < offsetx) offsetx = rect.x;
9f5cd8ca0ebc Without retina scale to calcoffset
one
parents: 458
diff changeset
600 if (rect.y < offsety) offsety = rect.y;
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: 441
diff changeset
601 }
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: 441
diff changeset
602 return new Point(-offsetx,-offsety);
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: 441
diff changeset
603 }
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: 441
diff changeset
604
626
b37ae3e512cc try to use affin transform for retina display
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 604
diff changeset
605 @Override
456
34277b436cac Using retina scale to share screnn if minus postion
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 455
diff changeset
606 public int retinaScale(int shareScreenNumber) {
34277b436cac Using retina scale to share screnn if minus postion
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 455
diff changeset
607 int scale = 1;
34277b436cac Using retina scale to share screnn if minus postion
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 455
diff changeset
608 GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
34277b436cac Using retina scale to share screnn if minus postion
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 455
diff changeset
609 final GraphicsDevice[] devices = env.getScreenDevices();
551
e912db2ab778 fix RetinaDisplay API for java9 and above
e165729 <e165729@ie.u-ryukyu.ac.jp>
parents: 540
diff changeset
610 GraphicsConfiguration conf = devices[shareScreenNumber].getDefaultConfiguration();
e912db2ab778 fix RetinaDisplay API for java9 and above
e165729 <e165729@ie.u-ryukyu.ac.jp>
parents: 540
diff changeset
611 scale = (int)conf.getDefaultTransform().getScaleX();
630
7071b01621c2 Determine ipv4 or ipv6 and fix scond display
riono <e165729@ie.u-ryukyu.ac.jp>
parents: 628
diff changeset
612 System.out.println("scale:" + scale + "\n\n");
456
34277b436cac Using retina scale to share screnn if minus postion
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 455
diff changeset
613 return scale;
34277b436cac Using retina scale to share screnn if minus postion
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 455
diff changeset
614 }
363
bc5624e3e9c5 Add newVNCConnection method to Viewer
innparusu
parents: 345
diff changeset
615
317
3c63bc88383e always fit screen, -d mode.
oc
parents: 314
diff changeset
616 @Override
3c63bc88383e always fit screen, -d mode.
oc
parents: 314
diff changeset
617 public void setFitScreen() {
3c63bc88383e always fit screen, -d mode.
oc
parents: 314
diff changeset
618 SwingViewerWindow v = connectionPresenter.getViewer();
3c63bc88383e always fit screen, -d mode.
oc
parents: 314
diff changeset
619 if (v != null) {
441
cee43ceac9b3 send thatscreen position INIT_DATA
one
parents: 428
diff changeset
620 v.fitScreen();
317
3c63bc88383e always fit screen, -d mode.
oc
parents: 314
diff changeset
621 }
3c63bc88383e always fit screen, -d mode.
oc
parents: 314
diff changeset
622 }
3c63bc88383e always fit screen, -d mode.
oc
parents: 314
diff changeset
623
0
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
624 }