annotate src/viewer_swing/java/com/glavsoft/viewer/Viewer.java @ 267:5f697251860b

add --filterSingleDisplay option.
author oc
date Tue, 09 Dec 2014 10:50:26 +0900
parents 17eb729d64be
children 0b75fdbb8c11
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;
192
aa00e4b2fc27 fix root viewer.
oc
parents: 188
diff changeset
33 import com.glavsoft.viewer.swing.SwingViewerWindow;
57
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.SwingViewerWindowFactory;
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
35 import com.glavsoft.viewer.swing.gui.ConnectionView;
0
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
36
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
37 import javax.swing.*;
129
a6dc674546f2 change connection param expression timing.
oc
parents: 128
diff changeset
38
0
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;
0
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
42 import java.io.IOException;
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
43 import java.io.InputStream;
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
44 import java.net.Socket;
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
45 import java.util.jar.Attributes;
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
46 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
47 import java.util.logging.*;
0
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
48
60
ac6f9e46566f proxy mode ok.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 59
diff changeset
49 import jp.ac.u_ryukyu.treevnc.CreateConnectionParam;
207
b31903e5b02d rename myRFBProto
oc
parents: 206
diff changeset
50 import jp.ac.u_ryukyu.treevnc.TreeRFBProto;
32
758d025ee24b add TextBox.java
one
parents: 11
diff changeset
51
0
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
52 @SuppressWarnings("serial")
179
c1b91dd27a13 on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 178
diff changeset
53 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
54
224
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
55 private Logger logger;
57
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
56 private int paramsMask;
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
57 private boolean allowAppletInteractiveConnections;
0
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
58
60
ac6f9e46566f proxy mode ok.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 59
diff changeset
59 public final ConnectionParams connectionParams;
59
433c79184c05 merge version2.7.2
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 57 55
diff changeset
60 protected String passwordFromParams;
57
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
61 boolean isSeparateFrame = true;
59
433c79184c05 merge version2.7.2
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 57 55
diff changeset
62 protected boolean isApplet = true;
57
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
63 private final ProtocolSettings settings;
59
433c79184c05 merge version2.7.2
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 57 55
diff changeset
64 protected UiSettings uiSettings;
57
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
65 private volatile boolean isAppletStopped = false;
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
66 private ConnectionPresenter connectionPresenter;
65
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 61
diff changeset
67 boolean isTreeVNC = false;
207
b31903e5b02d rename myRFBProto
oc
parents: 206
diff changeset
68 protected TreeRFBProto myRfb;
224
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
69 private boolean noConnection;
175
e1aa06b0d2ff on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 174
diff changeset
70 public int vncport = ConnectionParams.DEFAULT_RFB_PORT;
e1aa06b0d2ff on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 174
diff changeset
71 private int fbWidth;
224
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
72 private boolean showTree = false;
225
5e3594021e79 fix --width --height mode.
oc
parents: 224
diff changeset
73 public int width;
5e3594021e79 fix --width --height mode.
oc
parents: 224
diff changeset
74 public int height;
257
11b59b223222 add function of fixing display size
oc
parents: 256
diff changeset
75 public int fixingSizeWidth;
11b59b223222 add function of fixing display size
oc
parents: 256
diff changeset
76 public int fixingSizeHeight;
11b59b223222 add function of fixing display size
oc
parents: 256
diff changeset
77 public int frameSizeWidth;
11b59b223222 add function of fixing display size
oc
parents: 256
diff changeset
78 public int frameSizeHeight;
225
5e3594021e79 fix --width --height mode.
oc
parents: 224
diff changeset
79
139
8798f36f732b wait for FIND_ROOT_REPLY.
oc
parents: 130
diff changeset
80
57
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
81 public static void main(String[] args) {
224
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
82 Parser parser = new Parser();
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
83 ParametersHandler.completeParserOptions(parser);
0
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
84
224
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
85 parser.parse(args);
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
86 if (parser.isSet(ParametersHandler.ARG_HELP)) {
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
87 printUsage(parser.optionsUsage());
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
88 System.exit(0);
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
89 }
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
90 Viewer viewer = new Viewer(parser);
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
91 SwingUtilities.invokeLater(viewer);
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
92 }
0
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
93
57
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
94 public static void printUsage(String additional) {
224
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
95 System.out.println("Usage: java -jar (progfilename) [hostname [port_number]] [Options]Â¥n" +
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
96 " or¥n"+
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
97 " java -jar (progfilename) [Options]Â¥n" +
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
98 " or¥n java -jar (progfilename) -help¥n to view this help¥n¥n" +
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
99 "Where Options are:Â¥n" + additional +
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
100 "¥nOptions format: -optionName=optionValue. Ex. -host=localhost -port=5900 -viewonly=yes¥n" +
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
101 "Both option name and option value are case insensitive.");
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
102 }
0
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
103
224
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
104 public Viewer() {
57
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
105 logger = Logger.getLogger(getClass().getName());
224
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
106 connectionParams = new ConnectionParams();
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
107 settings = ProtocolSettings.getDefaultSettings();
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
108 uiSettings = new UiSettings();
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
109 }
0
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
110
224
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
111 private Viewer(Parser parser) {
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
112 this();
57
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
113 setLoggingLevel(parser.isSet(ParametersHandler.ARG_VERBOSE) ? Level.FINE :
224
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
114 parser.isSet(ParametersHandler.ARG_VERBOSE_MORE) ? Level.FINER :
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
115 Level.INFO);
57
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
116
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
117 paramsMask = ParametersHandler.completeSettingsFromCLI(parser, connectionParams, settings, uiSettings);
224
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
118 passwordFromParams = parser.getValueFor(ParametersHandler.ARG_PASSWORD);
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
119 logger.info("TightVNC Viewer version " + ver());
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
120 isApplet = false;
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
121 }
0
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
122
57
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
123 private void setLoggingLevel(Level levelToSet) {
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
124 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
125 appLogger.setLevel(levelToSet);
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
126 ConsoleHandler ch = null;
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
127 for (Handler h : appLogger.getHandlers()) {
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
128 if (h instanceof ConsoleHandler) {
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
129 ch = (ConsoleHandler) h;
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
130 break;
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
131 }
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
132 }
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
133 if (null == ch) {
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
134 ch = new ConsoleHandler();
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
135 appLogger.addHandler(ch);
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
136 }
224
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
137 // ch.setFormatter(new SimpleFormatter());
57
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
138 ch.setLevel(levelToSet);
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
139 }
0
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
140
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
141
57
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
142 @Override
224
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
143 public void windowClosing(WindowEvent e) {
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
144 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
145 final Window w = e.getWindow();
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
146 if (w != null) {
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
147 w.setVisible(false);
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
148 w.dispose();
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
149 }
224
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
150 }
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
151 closeApp();
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
152 }
0
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
153
224
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
154 /**
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
155 * Closes App(lication) or stops App(let).
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
156 */
57
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
157 public void closeApp() {
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
158 if (connectionPresenter != null) {
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
159 connectionPresenter.cancelConnection();
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
160 logger.info("Connections cancelled.");
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
161 }
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
162 if (isApplet) {
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
163 if ( ! isAppletStopped) {
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
164 logger.severe("Applet is stopped.");
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
165 isAppletStopped = true;
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
166 repaint();
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
167 stop();
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
168 }
224
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
169 } else {
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
170 System.exit(0);
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
171 }
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
172 }
0
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
173
224
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
174 @Override
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
175 public void paint(Graphics g) {
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
176 if ( ! isAppletStopped) {
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
177 super.paint(g);
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
178 } else {
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
179 getContentPane().removeAll();
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
180 g.clearRect(0, 0, getWidth(), getHeight());
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
181 g.drawString("Disconnected", 10, 20);
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
182 }
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
183 }
0
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
184
224
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
185 @Override
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
186 public void destroy() {
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
187 closeApp();
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
188 super.destroy();
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
189 }
0
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
190
224
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
191 @Override
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
192 public void init() {
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
193 paramsMask = ParametersHandler.completeSettingsFromApplet(this, connectionParams, settings, uiSettings);
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
194 isSeparateFrame = ParametersHandler.isSeparateFrame;
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
195 passwordFromParams = getParameter(ParametersHandler.ARG_PASSWORD);
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
196 isApplet = true;
57
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
197 allowAppletInteractiveConnections = ParametersHandler.allowAppletInteractiveConnections;
224
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
198 repaint();
57
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
199
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
200 try {
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
201 SwingUtilities.invokeAndWait(this);
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
202 } catch (Exception e) {
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
203 logger.severe(e.getMessage());
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
204 }
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
205 }
0
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
206
224
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
207 @Override
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
208 public void start() {
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
209 super.start();
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
210 }
0
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
211
57
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
212 private boolean checkJsch() {
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
213 try {
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
214 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
215 return true;
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
216 } catch (ClassNotFoundException e) {
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
217 return false;
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
218 }
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
219 }
224
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
220
85
432dac0b9dae delete Share Screen pop up in display mode.
sugi
parents: 79
diff changeset
221 public void setNoConnection(boolean c){
224
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
222 noConnection = c;
85
432dac0b9dae delete Share Screen pop up in display mode.
sugi
parents: 79
diff changeset
223 }
224
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
224
57
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
225 @Override
224
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
226 public void run() {
57
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
227 final boolean hasJsch = checkJsch();
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
228 final boolean allowInteractive = allowAppletInteractiveConnections || ! isApplet;
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
229 connectionPresenter = new ConnectionPresenter(hasJsch, allowInteractive);
85
432dac0b9dae delete Share Screen pop up in display mode.
sugi
parents: 79
diff changeset
230 connectionPresenter.setNoConnection(noConnection);
57
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
231 connectionPresenter.addModel("ConnectionParamsModel", connectionParams);
224
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
232 ConnectionView connectionView = new ConnectionView(
57
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
233 Viewer.this, // appWindowListener
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
234 connectionPresenter, hasJsch);
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
235 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
236 if (isApplet) {
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
237 connectionPresenter.addView("AppletStatusStringView", new View() {
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
238 @Override
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
239 public void showView() { /*nop*/ }
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
240 @Override
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
241 public void closeView() { /*nop*/ }
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
242 });
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
243 }
224
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
244
225
5e3594021e79 fix --width --height mode.
oc
parents: 224
diff changeset
245 SwingViewerWindowFactory viewerWindowFactory = new SwingViewerWindowFactory(isSeparateFrame, isApplet, this, width, height);
224
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
246
57
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
247 connectionPresenter.setConnectionWorkerFactory(
60
ac6f9e46566f proxy mode ok.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 59
diff changeset
248 new SwingConnectionWorkerFactory(connectionView.getFrame(), passwordFromParams, connectionPresenter, viewerWindowFactory, myRfb));
89
1503a373ab73 close client correctly in -d mode.
oc
parents: 85
diff changeset
249 connectionPresenter.setNeedReconnection(!noConnection);
57
17b702648079 version2.7.2 original version.
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 0
diff changeset
250 connectionPresenter.startConnection(settings, uiSettings, paramsMask);
224
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
251 }
0
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
252
224
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 windowOpened(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 windowClosed(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 windowIconified(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 windowDeiconified(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 windowActivated(WindowEvent e) { /* nop */ }
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
263 @Override
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
264 public void windowDeactivated(WindowEvent e) { /* nop */ }
0
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
265
224
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
266 public static String ver() {
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
267 final InputStream mfStream = Viewer.class.getClassLoader().getResourceAsStream(
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
268 "META-INF/MANIFEST.MF");
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
269 if (null == mfStream) {
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
270 System.out.println("No Manifest file found.");
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
271 return "-1";
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
272 }
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
273 try {
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
274 Manifest mf = new Manifest();
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
275 mf.read(mfStream);
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
276 Attributes atts = mf.getMainAttributes();
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
277 return atts.getValue(Attributes.Name.IMPLEMENTATION_VERSION);
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
278 } catch (IOException e) {
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
279 return "-2";
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
280 }
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
281 }
0
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
282
59
433c79184c05 merge version2.7.2
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 57 55
diff changeset
283
224
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
284 public void setSocket(Socket soc) {
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
285 connectionParams.setConnectionParam(soc.getInetAddress().getHostAddress(),soc.getPort());
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
286 }
59
433c79184c05 merge version2.7.2
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 57 55
diff changeset
287
224
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
288 public void setOpenPort(int parseInt) {
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
289 }
59
433c79184c05 merge version2.7.2
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 57 55
diff changeset
290
224
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
291 public void setTeminationType(boolean b) {
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
292 myRfb.setTerminationType(b);
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
293 }
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
294
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
295 /**
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
296 * start TreeVNC viewer
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
297 */
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
298 public void startTreeViewer(String hostName,boolean cui) {
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
299 TreeRFBProto rfb = new TreeRFBProto(false);
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
300 rfb.setCuiVersion(cui);
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
301 rfb.setHasViewer(true);
204
d9d234715853 TreeManager for each interface
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 203
diff changeset
302 rfb.setViewer(this);
177
8019a393875a proxy reorganization
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 176
diff changeset
303 rfb.createConnectionAndStart(this);
224
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
304 CreateConnectionParam cp = new CreateConnectionParam(rfb);
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
305 if (hostName!=null) {
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
306 cp.setHostName(hostName);
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
307 } else {
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
308 try {
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
309 cp.findTreeVncRoot();
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
310 } catch (InterruptedException e) {
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
311 System.out.println("cannot find TreeVNC Root "+e.getMessage());
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
312 return;
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 cp.sendWhereToConnect(this);
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
316 isTreeVNC = true;
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
317 myRfb = rfb;
121
e4408fc5679f view onlly mode set
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 106
diff changeset
318 settings.setViewOnly(true); // too avoid unnecessary upward traffic
176
fa6cfb85444e on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 175
diff changeset
319 rfb.getAcceptThread().waitForShutdown();
224
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
320 }
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
321
174
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 /**
2e1530139169 reorganization
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 159
diff changeset
324 * Start client with new parent (including reconnection)
2e1530139169 reorganization
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 159
diff changeset
325 * @param port
2e1530139169 reorganization
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 159
diff changeset
326 * @param hostname
2e1530139169 reorganization
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 159
diff changeset
327 * @throws IOException
2e1530139169 reorganization
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 159
diff changeset
328 */
224
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
329 @Override
174
2e1530139169 reorganization
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 159
diff changeset
330 public void connectToParenet(int port, String hostname) throws IOException {
2e1530139169 reorganization
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 159
diff changeset
331 setTeminationType(false);
2e1530139169 reorganization
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 159
diff changeset
332 closeApp();
179
c1b91dd27a13 on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 178
diff changeset
333 connectionParams.setConnectionParam(hostname, port);
174
2e1530139169 reorganization
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 159
diff changeset
334 run();
2e1530139169 reorganization
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 159
diff changeset
335 }
224
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
336
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
337 public void setIsTreeVNC(boolean flag) {
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
338 isTreeVNC = flag;
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
339 }
65
ffd7537cebfc cuiversion
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents: 61
diff changeset
340
224
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
341 public TreeRFBProto getRfb() {
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
342 return myRfb;
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
343 }
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
344
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
345 public boolean getCuiVersion() {
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
346 return myRfb.getCuiVersion();
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
347 }
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
348 public void setCuiVersion(boolean flag) {
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
349 myRfb.setCuiVersion(flag);
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
350 }
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
351
175
e1aa06b0d2ff on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 174
diff changeset
352 /**
e1aa06b0d2ff on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 174
diff changeset
353 * start new VNC server receiver with
e1aa06b0d2ff on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 174
diff changeset
354 * inherited clients
e1aa06b0d2ff on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 174
diff changeset
355 * @param vs
e1aa06b0d2ff on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 174
diff changeset
356 * @param hostName
e1aa06b0d2ff on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 174
diff changeset
357 */
176
fa6cfb85444e on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 175
diff changeset
358 @Override
fa6cfb85444e on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 175
diff changeset
359 public void inhelitClients(ViewerInterface vs, String hostName) {
202
22676ca0dd97 get VNC Socket.
oc
parents: 192
diff changeset
360 myRfb.vncConnected(false);
179
c1b91dd27a13 on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 178
diff changeset
361 connectionParams.setConnectionParam(hostName, vncport);
175
e1aa06b0d2ff on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 174
diff changeset
362 isApplet = true;
e1aa06b0d2ff on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 174
diff changeset
363 this.setNoConnection(false);
204
d9d234715853 TreeManager for each interface
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 203
diff changeset
364 if (myRfb.isTreeManager()) {
224
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
365 setVisible(false);
192
aa00e4b2fc27 fix root viewer.
oc
parents: 188
diff changeset
366 }
175
e1aa06b0d2ff on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 174
diff changeset
367 run();
174
2e1530139169 reorganization
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 159
diff changeset
368 }
2e1530139169 reorganization
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 159
diff changeset
369
267
5f697251860b add --filterSingleDisplay option.
oc
parents: 266
diff changeset
370 public void proxyStart(String[] argv, int width, int height, boolean showTree, boolean checkDelay, boolean addSerialNum, boolean fixingSize, boolean filterSingleDisplay) {
224
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
371 fbWidth = width;
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
372 this.showTree = showTree;
175
e1aa06b0d2ff on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 174
diff changeset
373 // input into arguments Decision
e1aa06b0d2ff on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 174
diff changeset
374 Parser parser = new Parser();
e1aa06b0d2ff on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 174
diff changeset
375 ParametersHandler.completeParserOptions(parser);
e1aa06b0d2ff on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 174
diff changeset
376 if (fbWidth == 0)
e1aa06b0d2ff on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 174
diff changeset
377 parser.parse(argv);
e1aa06b0d2ff on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 174
diff changeset
378 if (parser.isSet(ParametersHandler.ARG_HELP)) {
e1aa06b0d2ff on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 174
diff changeset
379 printUsage(parser.optionsUsage());
e1aa06b0d2ff on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 174
diff changeset
380 System.exit(0);
e1aa06b0d2ff on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 174
diff changeset
381 }
179
c1b91dd27a13 on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 178
diff changeset
382 String hostname = "localhost";
207
b31903e5b02d rename myRFBProto
oc
parents: 206
diff changeset
383 TreeRFBProto rfb = new TreeRFBProto(true);
179
c1b91dd27a13 on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 178
diff changeset
384 myRfb = rfb;
188
f176bffcdc4a add showTreeNode option.
oc
parents: 186
diff changeset
385 rfb.setShowTree(showTree);
240
7310e7d7a45f add option --checkDelay.
oc
parents: 225
diff changeset
386 rfb.setCheckDelay(checkDelay);
241
b21a7842a41d add option addSerialNum.
oc
parents: 240
diff changeset
387 rfb.setAddSerialNum(addSerialNum);
257
11b59b223222 add function of fixing display size
oc
parents: 256
diff changeset
388 rfb.setFixingSize(fixingSize);
266
17eb729d64be fix --fixingSize option correspondence -p option.
oc
parents: 257
diff changeset
389 if(fixingSize) {
17eb729d64be fix --fixingSize option correspondence -p option.
oc
parents: 257
diff changeset
390 rfb.fixingSizeWidth = fixingSizeWidth;
17eb729d64be fix --fixingSize option correspondence -p option.
oc
parents: 257
diff changeset
391 rfb.fixingSizeHeight = fixingSizeHeight;
17eb729d64be fix --fixingSize option correspondence -p option.
oc
parents: 257
diff changeset
392 }
267
5f697251860b add --filterSingleDisplay option.
oc
parents: 266
diff changeset
393 rfb.setFilterSingleDisplay(filterSingleDisplay);
179
c1b91dd27a13 on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 178
diff changeset
394 rfb.setViewer(this);
c1b91dd27a13 on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 178
diff changeset
395 rfb.setCuiVersion(false);
220
619abe65e4ff minor fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 207
diff changeset
396 rfb.setHasViewer(true); // this flag will be overwrited after this method. Do we have to set here?
179
c1b91dd27a13 on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 178
diff changeset
397 rfb.createConnectionAndStart(this);
c1b91dd27a13 on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 178
diff changeset
398 setIsTreeVNC(true);
c1b91dd27a13 on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 178
diff changeset
399 connectionParams.setConnectionParam(hostname, vncport);
c1b91dd27a13 on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 178
diff changeset
400 isApplet = true;
c1b91dd27a13 on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 178
diff changeset
401 settings.setViewOnly(true); // too avoid unnecessary upward traffic
186
f76ee760c2d2 dead lock on command line root
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 179
diff changeset
402 rfb.setReconnecting(true);
179
c1b91dd27a13 on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 178
diff changeset
403 run();
c1b91dd27a13 on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 178
diff changeset
404 }
c1b91dd27a13 on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 178
diff changeset
405
207
b31903e5b02d rename myRFBProto
oc
parents: 206
diff changeset
406 public void initRoot(TreeRFBProto myRfbProto, String hostName) {
179
c1b91dd27a13 on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 178
diff changeset
407 setIsTreeVNC(true);
c1b91dd27a13 on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 178
diff changeset
408 connectionParams.setConnectionParam(hostName, vncport);
c1b91dd27a13 on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 178
diff changeset
409 isApplet = true;
c1b91dd27a13 on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 178
diff changeset
410 myRfbProto.createConnectionAndStart(this);
186
f76ee760c2d2 dead lock on command line root
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 179
diff changeset
411 myRfbProto.setReconnecting(true);
179
c1b91dd27a13 on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 178
diff changeset
412 run();
175
e1aa06b0d2ff on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 174
diff changeset
413 }
224
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
414
192
aa00e4b2fc27 fix root viewer.
oc
parents: 188
diff changeset
415 @Override
aa00e4b2fc27 fix root viewer.
oc
parents: 188
diff changeset
416 public void setVisible(boolean b) {
224
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
417 SwingViewerWindow v = connectionPresenter.getViewer();
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
418 if (v != null)
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
419 v.setVisible(b);
192
aa00e4b2fc27 fix root viewer.
oc
parents: 188
diff changeset
420 }
188
f176bffcdc4a add showTreeNode option.
oc
parents: 186
diff changeset
421
224
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
422 @Override
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
423 public Socket getVNCSocket() {
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
424 return connectionPresenter.getSocket();
ccbc3a951961 fix indent, update mm.
oc
parents: 220
diff changeset
425 }
202
22676ca0dd97 get VNC Socket.
oc
parents: 192
diff changeset
426
204
d9d234715853 TreeManager for each interface
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 203
diff changeset
427 @Override
d9d234715853 TreeManager for each interface
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 203
diff changeset
428 public boolean getShowTree() {
d9d234715853 TreeManager for each interface
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 203
diff changeset
429 return showTree;
d9d234715853 TreeManager for each interface
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 203
diff changeset
430 }
d9d234715853 TreeManager for each interface
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 203
diff changeset
431
225
5e3594021e79 fix --width --height mode.
oc
parents: 224
diff changeset
432 @Override
5e3594021e79 fix --width --height mode.
oc
parents: 224
diff changeset
433 public void setWidth(int w) {
5e3594021e79 fix --width --height mode.
oc
parents: 224
diff changeset
434 width = w;
5e3594021e79 fix --width --height mode.
oc
parents: 224
diff changeset
435 }
5e3594021e79 fix --width --height mode.
oc
parents: 224
diff changeset
436
5e3594021e79 fix --width --height mode.
oc
parents: 224
diff changeset
437 @Override
5e3594021e79 fix --width --height mode.
oc
parents: 224
diff changeset
438 public void setHeight(int h) {
5e3594021e79 fix --width --height mode.
oc
parents: 224
diff changeset
439 height = h;
5e3594021e79 fix --width --height mode.
oc
parents: 224
diff changeset
440 }
5e3594021e79 fix --width --height mode.
oc
parents: 224
diff changeset
441
257
11b59b223222 add function of fixing display size
oc
parents: 256
diff changeset
442 @Override
11b59b223222 add function of fixing display size
oc
parents: 256
diff changeset
443 public int getFixingWidth() {
11b59b223222 add function of fixing display size
oc
parents: 256
diff changeset
444 return fixingSizeWidth;
11b59b223222 add function of fixing display size
oc
parents: 256
diff changeset
445 }
11b59b223222 add function of fixing display size
oc
parents: 256
diff changeset
446
11b59b223222 add function of fixing display size
oc
parents: 256
diff changeset
447 @Override
11b59b223222 add function of fixing display size
oc
parents: 256
diff changeset
448 public int getFixingHeight() {
11b59b223222 add function of fixing display size
oc
parents: 256
diff changeset
449 return fixingSizeHeight;
11b59b223222 add function of fixing display size
oc
parents: 256
diff changeset
450 }
11b59b223222 add function of fixing display size
oc
parents: 256
diff changeset
451
11b59b223222 add function of fixing display size
oc
parents: 256
diff changeset
452 @Override
11b59b223222 add function of fixing display size
oc
parents: 256
diff changeset
453 public void setFixingSize(int width, int height) {
11b59b223222 add function of fixing display size
oc
parents: 256
diff changeset
454 this.fixingSizeWidth = width;
11b59b223222 add function of fixing display size
oc
parents: 256
diff changeset
455 this.fixingSizeHeight = height;
11b59b223222 add function of fixing display size
oc
parents: 256
diff changeset
456 }
11b59b223222 add function of fixing display size
oc
parents: 256
diff changeset
457
11b59b223222 add function of fixing display size
oc
parents: 256
diff changeset
458 @Override
11b59b223222 add function of fixing display size
oc
parents: 256
diff changeset
459 public int getFrameWidth() {
11b59b223222 add function of fixing display size
oc
parents: 256
diff changeset
460 return frameSizeWidth;
11b59b223222 add function of fixing display size
oc
parents: 256
diff changeset
461 }
11b59b223222 add function of fixing display size
oc
parents: 256
diff changeset
462
11b59b223222 add function of fixing display size
oc
parents: 256
diff changeset
463 @Override
11b59b223222 add function of fixing display size
oc
parents: 256
diff changeset
464 public int getFrameHeight() {
11b59b223222 add function of fixing display size
oc
parents: 256
diff changeset
465 return frameSizeHeight;
11b59b223222 add function of fixing display size
oc
parents: 256
diff changeset
466 }
11b59b223222 add function of fixing display size
oc
parents: 256
diff changeset
467
11b59b223222 add function of fixing display size
oc
parents: 256
diff changeset
468 @Override
11b59b223222 add function of fixing display size
oc
parents: 256
diff changeset
469 public void setFrameSize(int width, int height) {
11b59b223222 add function of fixing display size
oc
parents: 256
diff changeset
470 this.frameSizeWidth = width;
11b59b223222 add function of fixing display size
oc
parents: 256
diff changeset
471 this.frameSizeHeight = height;
11b59b223222 add function of fixing display size
oc
parents: 256
diff changeset
472 }
11b59b223222 add function of fixing display size
oc
parents: 256
diff changeset
473
0
4689cc86d6cb create TreeViewer2 Repository
Yu Taninari <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
474 }