annotate src/main/java/jp/ac/u_ryukyu/treevnc/CreateConnectionParam.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 b1ace1c5d37a
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
67
2908e4b95b0a add file
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 package jp.ac.u_ryukyu.treevnc;
2908e4b95b0a add file
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2
153
e68dfd1972ac fix bad names.
oc
parents: 149
diff changeset
3 import com.glavsoft.viewer.ViewerInterface;
130
1f6bfaa3281b root selection panel
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 128
diff changeset
4 import com.glavsoft.viewer.swing.ConnectionParams;
1f6bfaa3281b root selection panel
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 128
diff changeset
5
67
2908e4b95b0a add file
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 public class CreateConnectionParam {
513
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 510
diff changeset
7
67
2908e4b95b0a add file
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
8 private String hostName;
130
1f6bfaa3281b root selection panel
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 128
diff changeset
9 private int portNumber = ConnectionParams.DEFAULT_VNC_ROOT;
207
b31903e5b02d rename myRFBProto
oc
parents: 206
diff changeset
10 private TreeRFBProto rfb;
145
649794dfb9d5 add my hostname to handle multiple network
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 144
diff changeset
11 private String myHostName;
399
28d67bbfa9f1 Implement SelectionPanel processing
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 398
diff changeset
12 private boolean rootMode = false;
28d67bbfa9f1 Implement SelectionPanel processing
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 398
diff changeset
13
28d67bbfa9f1 Implement SelectionPanel processing
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 398
diff changeset
14 private boolean displayMode = false;
28d67bbfa9f1 Implement SelectionPanel processing
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 398
diff changeset
15
207
b31903e5b02d rename myRFBProto
oc
parents: 206
diff changeset
16 public CreateConnectionParam(TreeRFBProto rfb) {
67
2908e4b95b0a add file
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
17 this.rfb = rfb;
329
230038d5127d change reconnect new node instead of lost child node.
oc
parents: 327
diff changeset
18 rfb.setConnectionParam(this);
67
2908e4b95b0a add file
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
19 }
2908e4b95b0a add file
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
20
604
668ff8c17f46 fix Find root
riono
parents: 514
diff changeset
21
67
2908e4b95b0a add file
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
22
134
128cce60c43c where to connect command
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 130
diff changeset
23 /**
128cce60c43c where to connect command
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 130
diff changeset
24 * To find parent, send WHERE_TO_CONNECT command to the TreeVNC root
128cce60c43c where to connect command
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 130
diff changeset
25 * Incoming CONNECT_TO message is handled in MyRFBProto
128cce60c43c where to connect command
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 130
diff changeset
26 * @param v
128cce60c43c where to connect command
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 130
diff changeset
27 */
177
8019a393875a proxy reorganization
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 176
diff changeset
28 public void sendWhereToConnect(ViewerInterface v) {
176
fa6cfb85444e on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 157
diff changeset
29 rfb.setConnectionParam(this);
134
128cce60c43c where to connect command
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 130
diff changeset
30 TreeVncProtocol echo = new TreeVncProtocol(hostName,portNumber);
344
f2921fd4ac96 fix whereToConnect value
oc
parents: 343
diff changeset
31 echo.whereToConnect(myHostName,rfb.getAcceptPort());
343
f1721ec54899 add remoteRootStart
oc
parents: 331
diff changeset
32 }
f1721ec54899 add remoteRootStart
oc
parents: 331
diff changeset
33
145
649794dfb9d5 add my hostname to handle multiple network
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 144
diff changeset
34 public synchronized void setHostName(String _hostName, int port, String _myHostName) {
130
1f6bfaa3281b root selection panel
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 128
diff changeset
35 hostName = _hostName;
1f6bfaa3281b root selection panel
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 128
diff changeset
36 portNumber = port;
145
649794dfb9d5 add my hostname to handle multiple network
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 144
diff changeset
37 myHostName = _myHostName;
144
1e004d9c599d notify connection panel
oc
parents: 143
diff changeset
38 notify();
130
1f6bfaa3281b root selection panel
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 128
diff changeset
39 }
1f6bfaa3281b root selection panel
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 128
diff changeset
40
1f6bfaa3281b root selection panel
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 128
diff changeset
41 public void setHostName(String hostAndPort) {
1f6bfaa3281b root selection panel
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 128
diff changeset
42 int i = hostAndPort.indexOf(':');
1f6bfaa3281b root selection panel
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 128
diff changeset
43 if (i>0) {
1f6bfaa3281b root selection panel
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 128
diff changeset
44 portNumber = Integer.parseInt(hostAndPort.substring(i+1));
1f6bfaa3281b root selection panel
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 128
diff changeset
45 hostName = hostAndPort.substring(0,i);
1f6bfaa3281b root selection panel
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 128
diff changeset
46 } else
1f6bfaa3281b root selection panel
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 128
diff changeset
47 hostName = hostAndPort;
176
fa6cfb85444e on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 157
diff changeset
48 // who sets myHostName?
377
877008c86e85 Add direct option
innparusu
parents: 345
diff changeset
49 }
67
2908e4b95b0a add file
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
50
145
649794dfb9d5 add my hostname to handle multiple network
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 144
diff changeset
51 public String getMyHostName() {
649794dfb9d5 add my hostname to handle multiple network
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 144
diff changeset
52 return myHostName;
649794dfb9d5 add my hostname to handle multiple network
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 144
diff changeset
53 }
149
1291cf1122ca panel will not open ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 145
diff changeset
54
176
fa6cfb85444e on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 157
diff changeset
55 public int getPort() {
fa6cfb85444e on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 157
diff changeset
56 return portNumber;
149
1291cf1122ca panel will not open ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 145
diff changeset
57 }
176
fa6cfb85444e on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 157
diff changeset
58
fa6cfb85444e on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 157
diff changeset
59 public String getHostName() {
fa6cfb85444e on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 157
diff changeset
60 return hostName;
fa6cfb85444e on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 157
diff changeset
61 }
fa6cfb85444e on going ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 157
diff changeset
62
398
b3ef6d14b2b7 Select Mode to start Panel
innparusu
parents: 377
diff changeset
63 public void setRootMode() {
399
28d67bbfa9f1 Implement SelectionPanel processing
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 398
diff changeset
64 rootMode = true;
28d67bbfa9f1 Implement SelectionPanel processing
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 398
diff changeset
65 }
28d67bbfa9f1 Implement SelectionPanel processing
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 398
diff changeset
66
28d67bbfa9f1 Implement SelectionPanel processing
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 398
diff changeset
67 public boolean isRootMode() {
28d67bbfa9f1 Implement SelectionPanel processing
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 398
diff changeset
68 return rootMode;
28d67bbfa9f1 Implement SelectionPanel processing
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 398
diff changeset
69 }
398
b3ef6d14b2b7 Select Mode to start Panel
innparusu
parents: 377
diff changeset
70
b3ef6d14b2b7 Select Mode to start Panel
innparusu
parents: 377
diff changeset
71 public void setDisplayMode() {
399
28d67bbfa9f1 Implement SelectionPanel processing
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 398
diff changeset
72 displayMode = true;
398
b3ef6d14b2b7 Select Mode to start Panel
innparusu
parents: 377
diff changeset
73 }
399
28d67bbfa9f1 Implement SelectionPanel processing
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 398
diff changeset
74
28d67bbfa9f1 Implement SelectionPanel processing
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 398
diff changeset
75 public boolean isDisplayMode() {
28d67bbfa9f1 Implement SelectionPanel processing
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 398
diff changeset
76 return displayMode;
28d67bbfa9f1 Implement SelectionPanel processing
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 398
diff changeset
77 }
28d67bbfa9f1 Implement SelectionPanel processing
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 398
diff changeset
78
28d67bbfa9f1 Implement SelectionPanel processing
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 398
diff changeset
79 public synchronized void restart() {
28d67bbfa9f1 Implement SelectionPanel processing
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 398
diff changeset
80 notify();
28d67bbfa9f1 Implement SelectionPanel processing
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 398
diff changeset
81 }
513
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 510
diff changeset
82
605
b1ace1c5d37a fix wait
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 604
diff changeset
83 public synchronized void waitTreeVNCServer() throws InterruptedException {
b1ace1c5d37a fix wait
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 604
diff changeset
84 wait();
b1ace1c5d37a fix wait
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 604
diff changeset
85 }
67
2908e4b95b0a add file
Taninari YU <you@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
86 }