Mercurial > hg > Applications > TreeVNC
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 |
rev | line source |
---|---|
67 | 1 package jp.ac.u_ryukyu.treevnc; |
2 | |
153 | 3 import com.glavsoft.viewer.ViewerInterface; |
130 | 4 import com.glavsoft.viewer.swing.ConnectionParams; |
5 | |
67 | 6 public class CreateConnectionParam { |
513 | 7 |
67 | 8 private String hostName; |
130 | 9 private int portNumber = ConnectionParams.DEFAULT_VNC_ROOT; |
207 | 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 | 16 public CreateConnectionParam(TreeRFBProto rfb) { |
67 | 17 this.rfb = rfb; |
329 | 18 rfb.setConnectionParam(this); |
67 | 19 } |
20 | |
604 | 21 |
67 | 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 | 28 public void sendWhereToConnect(ViewerInterface v) { |
176 | 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 | 31 echo.whereToConnect(myHostName,rfb.getAcceptPort()); |
343 | 32 } |
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 | 35 hostName = _hostName; |
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 | 38 notify(); |
130 | 39 } |
40 | |
41 public void setHostName(String hostAndPort) { | |
42 int i = hostAndPort.indexOf(':'); | |
43 if (i>0) { | |
44 portNumber = Integer.parseInt(hostAndPort.substring(i+1)); | |
45 hostName = hostAndPort.substring(0,i); | |
46 } else | |
47 hostName = hostAndPort; | |
176 | 48 // who sets myHostName? |
377 | 49 } |
67 | 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 | 55 public int getPort() { |
56 return portNumber; | |
149
1291cf1122ca
panel will not open ...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
145
diff
changeset
|
57 } |
176 | 58 |
59 public String getHostName() { | |
60 return hostName; | |
61 } | |
62 | |
398 | 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 | 70 |
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 | 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 | 82 |
605 | 83 public synchronized void waitTreeVNCServer() throws InterruptedException { |
84 wait(); | |
85 } | |
67 | 86 } |