Mercurial > hg > Applications > TreeVNC
changeset 179:c1b91dd27a13
on going ...
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 23 Jun 2014 10:40:32 +0900 |
parents | 34b7558aeffa |
children | 96fcfe560edb |
files | src/main/java/jp/ac/u_ryukyu/treevnc/MyRfbProto.java src/main/java/jp/ac/u_ryukyu/treevnc/server/VncProxyService.java src/viewer_swing/java/com/glavsoft/viewer/CuiViewer.java src/viewer_swing/java/com/glavsoft/viewer/Viewer.java src/viewer_swing/java/com/glavsoft/viewer/ViewerInterface.java src/viewer_swing/java/com/glavsoft/viewer/swing/ConnectionParams.java src/viewer_swing/java/com/glavsoft/viewer/swing/SwingRfbConnectionWorker.java |
diffstat | 7 files changed, 39 insertions(+), 66 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/jp/ac/u_ryukyu/treevnc/MyRfbProto.java Sun Jun 22 19:05:04 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/treevnc/MyRfbProto.java Mon Jun 23 10:40:32 2014 +0900 @@ -50,7 +50,7 @@ ViewerInterface viewer; private short id; private boolean leader; - private TreeManagement treeManager; + public TreeManagement treeManager; private TreeVncCommandChannelListener acceptThread; private boolean firstTime = true; private TreeRootFinderListener getCast; @@ -649,12 +649,6 @@ thread.start(); } - public void initRoot(ViewerInterface vncProxyService, String hostName) { - treeManager = new TreeManagement(hostName, ConnectionParams.DEFAULT_VNC_ROOT); - vncProxyService.initRootViewer(hostName); - createConnectionAndStart(vncProxyService); - } - public TreeVncCommandChannelListener getAcceptThread() { return acceptThread; }
--- a/src/main/java/jp/ac/u_ryukyu/treevnc/server/VncProxyService.java Sun Jun 22 19:05:04 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/treevnc/server/VncProxyService.java Mon Jun 23 10:40:32 2014 +0900 @@ -51,7 +51,7 @@ System.exit(0); } VncProxyService vps = new VncProxyService(); - vps.myRfb.initRoot(vps, "localhost"); + vps.initRoot(vps.myRfb, "localhost"); }
--- a/src/viewer_swing/java/com/glavsoft/viewer/CuiViewer.java Sun Jun 22 19:05:04 2014 +0900 +++ b/src/viewer_swing/java/com/glavsoft/viewer/CuiViewer.java Mon Jun 23 10:40:32 2014 +0900 @@ -197,10 +197,7 @@ } public void setSocket(Socket soc) { - setConnectionParam(soc.getInetAddress().getHostAddress(), soc.getPort()); - // Thread accThread = new Thread(new AcceptThread(myRfb, - // soc.getPort())); - // accThread.start(); + connectionParams.setConnectionParam(soc.getInetAddress().getHostAddress(), soc.getPort()); } public void setOpenPort(int parseInt) { @@ -231,11 +228,6 @@ SwingUtilities.invokeLater(viewer); } - public void setConnectionParam(String hostName, int port) { - connectionParams.setHostName(hostName); - connectionParams.setPortNumber(port); - } - public void setIsTreeVNC(boolean flag) { } @@ -255,7 +247,7 @@ public void connectToParenet(int port, String hostname) throws IOException { setTeminationType(false); closeApp(); - setConnectionParam(hostname, port); + connectionParams.setConnectionParam(hostname, port); run(); } @@ -265,11 +257,6 @@ } @Override - public void initRootViewer(String hostName) { - - } - - @Override public void proxyStart(String[] args, int width, int height) { }
--- a/src/viewer_swing/java/com/glavsoft/viewer/Viewer.java Sun Jun 22 19:05:04 2014 +0900 +++ b/src/viewer_swing/java/com/glavsoft/viewer/Viewer.java Mon Jun 23 10:40:32 2014 +0900 @@ -49,9 +49,10 @@ import jp.ac.u_ryukyu.treevnc.MyRfbProto; import jp.ac.u_ryukyu.treevnc.client.MyRfbProtoClient; import jp.ac.u_ryukyu.treevnc.server.MyRfbProtoProxy; +import jp.ac.u_ryukyu.treevnc.server.TreeManagement; @SuppressWarnings("serial") -public class Viewer extends JApplet implements Runnable, WindowListener , ViewerInterface{ +public class Viewer extends JApplet implements Runnable, WindowListener , ViewerInterface { private Logger logger; private int paramsMask; @@ -275,7 +276,7 @@ public void setSocket(Socket soc) { - setConnectionParam(soc.getInetAddress().getHostAddress(),soc.getPort()); + connectionParams.setConnectionParam(soc.getInetAddress().getHostAddress(),soc.getPort()); } public void setOpenPort(int parseInt) { @@ -323,15 +324,10 @@ public void connectToParenet(int port, String hostname) throws IOException { setTeminationType(false); closeApp(); - setConnectionParam(hostname, port); + connectionParams.setConnectionParam(hostname, port); run(); } - public void setConnectionParam(String hostName, int port) { - connectionParams.setHostName(hostName); - connectionParams.setPortNumber(port); - } - public void setIsTreeVNC(boolean flag) { isTreeVNC = flag; } @@ -346,15 +342,7 @@ public void setCuiVersion(boolean flag) { myRfb.setCuiVersion(flag); } - - @Override - public void initRootViewer(String hostName) { - isApplet = false; - setIsTreeVNC(true); - setConnectionParam(hostName,vncport); - isApplet = true; - run(); - } + /** * start new VNC server receiver with * inherited clients @@ -364,7 +352,7 @@ @Override public void inhelitClients(ViewerInterface vs, String hostName) { myRfb.setReadyReconnect(false); - setConnectionParam(hostName,vncport); + connectionParams.setConnectionParam(hostName, vncport); isApplet = true; this.setNoConnection(false); run(); @@ -386,8 +374,27 @@ printUsage(parser.optionsUsage()); System.exit(0); } - myRfb = new MyRfbProtoProxy(); - myRfb.setViewer(this); - myRfb.initRoot(this, "localhost"); + String hostname = "localhost"; + MyRfbProtoProxy rfb = new MyRfbProtoProxy(); + myRfb = rfb; + rfb.setTreeManager(new TreeManagement(hostname, ConnectionParams.DEFAULT_VNC_ROOT)); + rfb.setViewer(this); + rfb.setCuiVersion(false); + rfb.setHasViewer(true); + rfb.createConnectionAndStart(this); + setIsTreeVNC(true); + connectionParams.setConnectionParam(hostname, vncport); + isApplet = true; + settings.setViewOnly(true); // too avoid unnecessary upward traffic + run(); + } + + public void initRoot(MyRfbProto myRfbProto, String hostName) { + myRfbProto.setTreeManager(new TreeManagement(hostName, ConnectionParams.DEFAULT_VNC_ROOT)); + setIsTreeVNC(true); + connectionParams.setConnectionParam(hostName, vncport); + isApplet = true; + myRfbProto.createConnectionAndStart(this); + run(); } }
--- a/src/viewer_swing/java/com/glavsoft/viewer/ViewerInterface.java Sun Jun 22 19:05:04 2014 +0900 +++ b/src/viewer_swing/java/com/glavsoft/viewer/ViewerInterface.java Mon Jun 23 10:40:32 2014 +0900 @@ -13,8 +13,6 @@ public void closeApp(); - public void setConnectionParam(String parentsAddress, int portNumber); - public void setSocket(Socket soc); public void run(); @@ -31,8 +29,6 @@ public void inhelitClients(ViewerInterface vncProxyService, String hostName); - public void initRootViewer(String hostName); - public void proxyStart(String[] args, int width, int height); public void setNoConnection(boolean noConnection);
--- a/src/viewer_swing/java/com/glavsoft/viewer/swing/ConnectionParams.java Sun Jun 22 19:05:04 2014 +0900 +++ b/src/viewer_swing/java/com/glavsoft/viewer/swing/ConnectionParams.java Mon Jun 23 10:40:32 2014 +0900 @@ -90,9 +90,6 @@ } catch (NumberFormatException e) { /*nop*/ } } - public void setHostName(String hostName) { - this.hostName = hostName; - } public String getHostName() { return this.hostName; } @@ -101,10 +98,6 @@ this.parseRfbPortNumber(port); } - public void setPortNumber(int port) { - this.portNumber = port; - } - public int getPortNumber() { return 0 == portNumber ? DEFAULT_RFB_PORT : portNumber; } @@ -220,4 +213,9 @@ sshUserName = null; sshPortNumber = 0; } + + public void setConnectionParam(String hostname, int port) { + this.hostName = hostname; + this.portNumber = port; + } }
--- a/src/viewer_swing/java/com/glavsoft/viewer/swing/SwingRfbConnectionWorker.java Sun Jun 22 19:05:04 2014 +0900 +++ b/src/viewer_swing/java/com/glavsoft/viewer/swing/SwingRfbConnectionWorker.java Mon Jun 23 10:40:32 2014 +0900 @@ -117,17 +117,8 @@ rfbSettings.addListener(clipboardController); if(!myRfb.getCuiVersion()) viewerWindow = viewerWindowFactory.createViewerWindow(workingProtocol, rfbSettings, uiSettings, connectionString, presenter); - if(myRfb.isRoot()) - workingProtocol.startNormalHandling(this, viewerWindow.getSurface(), clipboardController, myRfb); - else if(!myRfb.isRoot()) { - myRfb.setProtocolContext(workingProtocol); - if(!myRfb.getCuiVersion()) - workingProtocol.startNormalHandling(this, viewerWindow.getSurface(), clipboardController,myRfb); - else - workingProtocol.startNormalHandling(this,null,clipboardController,myRfb); - } else { - workingProtocol.startNormalHandling(this, viewerWindow.getSurface(), clipboardController); - } + myRfb.setProtocolContext(workingProtocol); + workingProtocol.startNormalHandling(this, viewerWindow.getSurface(), clipboardController, myRfb); presenter.showMessage("Started"); if(!myRfb.getCuiVersion())