Mercurial > hg > Members > riono > TreeVNC_ja_comment
changeset 177:8019a393875a
proxy reorganization
root display panel is not opened yet
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Sun, 22 Jun 2014 16:48:38 +0900 |
parents | fa6cfb85444e |
children | 34b7558aeffa |
files | src/main/java/jp/ac/u_ryukyu/treevnc/CreateConnectionParam.java src/main/java/jp/ac/u_ryukyu/treevnc/MyRfbProto.java src/viewer_swing/java/com/glavsoft/viewer/CuiViewer.java src/viewer_swing/java/com/glavsoft/viewer/TreeViewer.java src/viewer_swing/java/com/glavsoft/viewer/Viewer.java src/viewer_swing/java/com/glavsoft/viewer/ViewerInterface.java |
diffstat | 6 files changed, 21 insertions(+), 57 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/jp/ac/u_ryukyu/treevnc/CreateConnectionParam.java Sun Jun 22 15:08:45 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/treevnc/CreateConnectionParam.java Sun Jun 22 16:48:38 2014 +0900 @@ -31,7 +31,7 @@ * Incoming CONNECT_TO message is handled in MyRFBProto * @param v */ - public void createConnectionParam(ViewerInterface v) { + public void sendWhereToConnect(ViewerInterface v) { rfb.setConnectionParam(this); TreeVncProtocol echo = new TreeVncProtocol(hostName,portNumber); try {
--- a/src/main/java/jp/ac/u_ryukyu/treevnc/MyRfbProto.java Sun Jun 22 15:08:45 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/treevnc/MyRfbProto.java Sun Jun 22 16:48:38 2014 +0900 @@ -52,7 +52,7 @@ private boolean leader; private TreeManagement treeManager; private TreeVncCommandChannelListener acceptThread; - private boolean firstTime = false; + private boolean firstTime = true; private TreeRootFinderListener getCast; private CreateConnectionParam cp; @@ -150,7 +150,7 @@ System.out.println("Root server change request :" + newHostName); // please remove these numbers. if (viewer != null) { - viewer.changeVNCServer(newHostName, 3200, 1980, id); + changeVNCServer(viewer, newHostName, 3200, 1980, id); } } else { continue;
--- a/src/viewer_swing/java/com/glavsoft/viewer/CuiViewer.java Sun Jun 22 15:08:45 2014 +0900 +++ b/src/viewer_swing/java/com/glavsoft/viewer/CuiViewer.java Sun Jun 22 16:48:38 2014 +0900 @@ -210,31 +210,23 @@ myRfb.setTerminationType(b); } - public void startTreeViewer() { - CuiViewer viewer = new CuiViewer(); - MyRfbProtoClient rfb = new MyRfbProtoClient(); - CreateConnectionParam cp = new CreateConnectionParam(rfb); - rfb.createConnectionAndStart(this); - try { - cp.findTreeVncRoot(); - } catch (InterruptedException e) { - } - cp.createConnectionParam(viewer); - rfb.setViewer(viewer); - viewer.myRfb = rfb; - SwingUtilities.invokeLater(viewer); - } - public void startTreeViewer(String hostName, boolean cui) { CuiViewer viewer = new CuiViewer(); viewer.cuiVersion = cui; MyRfbProtoClient rfb = new MyRfbProtoClient(); CreateConnectionParam cp = new CreateConnectionParam(rfb); - cp.setHostName(hostName); + if (hostName==null) { + try { + cp.findTreeVncRoot(); + } catch (InterruptedException e) { + } + } else { + cp.setHostName(hostName); + } rfb.createConnectionAndStart(this); - cp.createConnectionParam(viewer); + cp.sendWhereToConnect(viewer); rfb.setViewer(viewer); - rfb.setCuiVersion(true); + rfb.setCuiVersion(cui); viewer.myRfb = rfb; SwingUtilities.invokeLater(viewer); } @@ -268,16 +260,6 @@ } @Override - public void changeVNCServer(String newHostName, int i, int j, short id) { - - } - - @Override - public void initRoot(String hostName, MyRfbProto myRfb) { - - } - - @Override public void inhelitClients(ViewerInterface vncProxyService, String hostName) { }
--- a/src/viewer_swing/java/com/glavsoft/viewer/TreeViewer.java Sun Jun 22 15:08:45 2014 +0900 +++ b/src/viewer_swing/java/com/glavsoft/viewer/TreeViewer.java Sun Jun 22 16:48:38 2014 +0900 @@ -24,8 +24,8 @@ vps = new VncProxyService(); vps.setNoConnection(noConnection); vps.proxyStart(args,width,height); - if (!permitChangeScreen ) vps.getRfb().setPermitChangeScreen(false); - vps.getRfb().getAcceptThread().waitForShutdown(); + if (!permitChangeScreen ) vps.getRfb().setPermitChangeScreen(false); + vps.getRfb().getAcceptThread().waitForShutdown(); return; } ViewerInterface v; @@ -33,9 +33,11 @@ v = cui ? new CuiViewer() : new Viewer(); if (treeProxy) { v.setNoConnection(noConnection); - v.proxyStart(args,width,height); + v.proxyStart(args,width,height); + if (!permitChangeScreen ) v.getRfb().setPermitChangeScreen(false); + v.getRfb().getAcceptThread().waitForShutdown(); } else { - v.startTreeViewer(hostName,cui); + v.startTreeViewer(hostName,cui); } } }
--- a/src/viewer_swing/java/com/glavsoft/viewer/Viewer.java Sun Jun 22 15:08:45 2014 +0900 +++ b/src/viewer_swing/java/com/glavsoft/viewer/Viewer.java Sun Jun 22 16:48:38 2014 +0900 @@ -41,7 +41,6 @@ import java.io.IOException; import java.io.InputStream; import java.net.Socket; -import java.net.UnknownHostException; import java.util.jar.Attributes; import java.util.jar.Manifest; import java.util.logging.*; @@ -292,6 +291,7 @@ public void startTreeViewer(String hostName,boolean cui) { MyRfbProtoClient rfb = new MyRfbProtoClient(); rfb.setCuiVersion(cui); + rfb.createConnectionAndStart(this); CreateConnectionParam cp = new CreateConnectionParam(rfb); if (hostName!=null) { cp.setHostName(hostName); @@ -303,8 +303,7 @@ return; } } - rfb.createConnectionAndStart(this); - cp.createConnectionParam(this); + cp.sendWhereToConnect(this); isTreeVNC = true; rfb.setViewer(this); myRfb = rfb; @@ -348,20 +347,6 @@ } @Override - public void changeVNCServer(String newHostName, int i, int j, short id) throws UnknownHostException, IOException, InterruptedException { - myRfb.changeVNCServer(this, newHostName, i, j, id); - } - - @Override - public void initRoot(String hostName, MyRfbProto myRfb) { - isApplet = false; - setIsTreeVNC(true); - setConnectionParam(hostName,ConnectionParams.DEFAULT_RFB_PORT); - isApplet = true; - run(); - } - - @Override public void initRootViewer(String hostName) { isApplet = false; setIsTreeVNC(true);
--- a/src/viewer_swing/java/com/glavsoft/viewer/ViewerInterface.java Sun Jun 22 15:08:45 2014 +0900 +++ b/src/viewer_swing/java/com/glavsoft/viewer/ViewerInterface.java Sun Jun 22 16:48:38 2014 +0900 @@ -2,7 +2,6 @@ import java.io.IOException; import java.net.Socket; -import java.net.UnknownHostException; import jp.ac.u_ryukyu.treevnc.MyRfbProto; @@ -30,10 +29,6 @@ public void connectToParenet(int port, String hostname) throws IOException; - public void changeVNCServer(String newHostName, int i, int j, short id) throws UnknownHostException, IOException, InterruptedException; - - public void initRoot(String hostName, MyRfbProto myRfb); - public void inhelitClients(ViewerInterface vncProxyService, String hostName); public void initRootViewer(String hostName);