changeset 175:e1aa06b0d2ff

on going ...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sun, 22 Jun 2014 11:35:01 +0900
parents 2e1530139169
children fa6cfb85444e
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/TreeViewer.java src/viewer_swing/java/com/glavsoft/viewer/Viewer.java src/viewer_swing/java/com/glavsoft/viewer/ViewerInterface.java
diffstat 6 files changed, 49 insertions(+), 62 deletions(-) [+]
line wrap: on
line diff
--- a/src/main/java/jp/ac/u_ryukyu/treevnc/MyRfbProto.java	Sun Jun 22 11:22:52 2014 +0900
+++ b/src/main/java/jp/ac/u_ryukyu/treevnc/MyRfbProto.java	Sun Jun 22 11:35:01 2014 +0900
@@ -17,7 +17,6 @@
 import jp.ac.u_ryukyu.treevnc.server.RequestScreenThread;
 import jp.ac.u_ryukyu.treevnc.server.TreeManagement;
 import jp.ac.u_ryukyu.treevnc.server.TreeRootFinderListener;
-import jp.ac.u_ryukyu.treevnc.server.VncProxyService;
 
 import com.glavsoft.exceptions.TransportException;
 import com.glavsoft.rfb.client.ClientToServerMessage;
@@ -659,7 +658,6 @@
 
     public void initRoot(ViewerInterface vncProxyService, String hostName) {
     	treeManager = new TreeManagement(hostName, ConnectionParams.DEFAULT_VNC_ROOT,this);
-        vncProxyService.setTreeManager(treeManager);
         vncProxyService.initRootViewer(hostName);
     	createConnectionAndStart(vncProxyService);
     }
--- a/src/main/java/jp/ac/u_ryukyu/treevnc/server/VncProxyService.java	Sun Jun 22 11:22:52 2014 +0900
+++ b/src/main/java/jp/ac/u_ryukyu/treevnc/server/VncProxyService.java	Sun Jun 22 11:35:01 2014 +0900
@@ -3,14 +3,12 @@
 import java.awt.event.*;
 import java.util.logging.Logger;
 
-import jp.ac.u_ryukyu.treevnc.MyRfbProto;
 import com.glavsoft.core.SettingsChangedEvent;
 import com.glavsoft.rfb.IChangeSettingsListener;
 import com.glavsoft.rfb.IRfbSessionListener;
 import com.glavsoft.rfb.protocol.ProtocolSettings;
 import com.glavsoft.viewer.Viewer;
 import com.glavsoft.viewer.cli.Parser;
-import com.glavsoft.viewer.swing.ConnectionParams;
 import com.glavsoft.viewer.swing.ParametersHandler;
 
 public class VncProxyService extends Viewer implements Runnable,
@@ -24,10 +22,7 @@
 	public static Logger logger = Logger.getLogger("com.glavsoft");
 	private boolean forceReconnection;
 	private String reconnectionReason;
-	public TreeManagement clients;
 	static VncProxyService currentVps;
-	private int fbWidth = 0;
-    public int vncport = ConnectionParams.DEFAULT_RFB_PORT;
 
 	public VncProxyService() {
 	ProtocolSettings.getDefaultSettings();
@@ -40,7 +35,6 @@
 		myRfb = vps.myRfb;
 		forceReconnection = vps.forceReconnection;
 		reconnectionReason = vps.reconnectionReason;
-		clients = vps.clients;
 	}
 
 	public static void main(String[] argv) {
@@ -60,47 +54,8 @@
 		vps.myRfb.initRoot(vps, "localhost");
 	}
 
-	/**
-	 * start new VNC server receiver with
-	 * inherited clients
-	 * @param vs
-	 * @param hostName
-	 */
-	public void inhelitClients(VncProxyService vs, String hostName) {
-		myRfb.setReadyReconnect(false);
-		setConnectionParam(hostName,vncport);
-		isApplet = true;
-		this.setNoConnection(false);
-		run();
-		myRfb.createConnectionAndStart(this);
-	}
-
-	public void proxyStart(String[] argv, int width, int height) {
-		fbWidth = width;
-		proxyStart(argv);
-	}
 
-	public void proxyStart(String[] argv) {
-		// input into arguments Decision
-		Parser parser = new Parser();
-		ParametersHandler.completeParserOptions(parser);
-		if (fbWidth == 0)
-			parser.parse(argv);
-		if (parser.isSet(ParametersHandler.ARG_HELP)) {
-			printUsage(parser.optionsUsage());
-			System.exit(0);
-		}
-        myRfb = new MyRfbProtoProxy();
-		myRfb.initRoot(this, "localhost");
-	}
 
-    public void initRootViewer(String hostName) {
-        isApplet = false;
-        setIsTreeVNC(true);
-        setConnectionParam(hostName,vncport);
-        isApplet = true;
-        run();
-    }
 	@Override
 	public void destroy() {
 
--- a/src/viewer_swing/java/com/glavsoft/viewer/CuiViewer.java	Sun Jun 22 11:22:52 2014 +0900
+++ b/src/viewer_swing/java/com/glavsoft/viewer/CuiViewer.java	Sun Jun 22 11:35:01 2014 +0900
@@ -21,7 +21,6 @@
 import jp.ac.u_ryukyu.treevnc.CreateConnectionParam;
 import jp.ac.u_ryukyu.treevnc.MyRfbProto;
 import jp.ac.u_ryukyu.treevnc.client.MyRfbProtoClient;
-import jp.ac.u_ryukyu.treevnc.server.TreeManagement;
 
 public class CuiViewer implements Runnable, WindowListener, ViewerInterface {
 
@@ -288,12 +287,12 @@
     }
 
     @Override
-    public void setTreeManager(TreeManagement treeManager) {
+    public void initRootViewer(String hostName) {
         
     }
 
     @Override
-    public void initRootViewer(String hostName) {
+    public void proxyStart(String[] args, int width, int height) {
         
     }
 
--- a/src/viewer_swing/java/com/glavsoft/viewer/TreeViewer.java	Sun Jun 22 11:22:52 2014 +0900
+++ b/src/viewer_swing/java/com/glavsoft/viewer/TreeViewer.java	Sun Jun 22 11:35:01 2014 +0900
@@ -20,7 +20,7 @@
 	private void vncStart(String[] args) {
 	    modeSelect(args);
 	    VncProxyService vps = null;
-        if (treeProxy) {
+        if (treeProxy && !viewer) {
 	        vps = new VncProxyService();
 	        vps.setNoConnection(noConnection);
 	        vps.proxyStart(args,width,height);
@@ -29,6 +29,9 @@
 	    ViewerInterface v;
 	    if (viewer) {
 	        v = cui ? new CuiViewer() : new Viewer();
+	        if (treeProxy) {
+	            v.proxyStart(args,width,height);
+	        }
 	        if(hostName!=null) {
 	            v.startTreeViewer(hostName,true);
 	        } else {
--- a/src/viewer_swing/java/com/glavsoft/viewer/Viewer.java	Sun Jun 22 11:22:52 2014 +0900
+++ b/src/viewer_swing/java/com/glavsoft/viewer/Viewer.java	Sun Jun 22 11:35:01 2014 +0900
@@ -48,7 +48,9 @@
 import jp.ac.u_ryukyu.treevnc.CreateConnectionParam;
 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;
+import jp.ac.u_ryukyu.treevnc.server.VncProxyService;
 
 @SuppressWarnings("serial")
 public class Viewer extends JApplet implements Runnable, WindowListener , ViewerInterface{
@@ -68,6 +70,8 @@
     boolean isTreeVNC = false;
     protected MyRfbProto myRfb;
 	private boolean noConnection;
+    public int vncport = ConnectionParams.DEFAULT_RFB_PORT;
+    private int fbWidth;
 
     public static void main(String[] args) {
 		Parser parser = new Parser();
@@ -379,17 +383,46 @@
         // TODO Auto-generated method stub
         
     }
-
+    
     @Override
-    public void setTreeManager(TreeManagement treeManager) {
-        // TODO Auto-generated method stub
-        
+    public void initRootViewer(String hostName) {
+        isApplet = false;
+        setIsTreeVNC(true);
+        setConnectionParam(hostName,vncport);
+        isApplet = true;
+        run();
+    }
+    /**
+     * start new VNC server receiver with
+     * inherited clients
+     * @param vs
+     * @param hostName
+     */
+    public void inhelitClients(VncProxyService vs, String hostName) {
+        myRfb.setReadyReconnect(false);
+        setConnectionParam(hostName,vncport);
+        isApplet = true;
+        this.setNoConnection(false);
+        run();
+        myRfb.createConnectionAndStart(this);
     }
 
-    @Override
-    public void initRootViewer(String hostName) {
-        // TODO Auto-generated method stub
-        
+    public void proxyStart(String[] argv, int width, int height) {
+        fbWidth = width;
+        proxyStart(argv);
     }
 
+    public void proxyStart(String[] argv) {
+        // input into arguments Decision
+        Parser parser = new Parser();
+        ParametersHandler.completeParserOptions(parser);
+        if (fbWidth == 0)
+            parser.parse(argv);
+        if (parser.isSet(ParametersHandler.ARG_HELP)) {
+            printUsage(parser.optionsUsage());
+            System.exit(0);
+        }
+        myRfb = new MyRfbProtoProxy();
+        myRfb.initRoot(this, "localhost");
+    }
 }
--- a/src/viewer_swing/java/com/glavsoft/viewer/ViewerInterface.java	Sun Jun 22 11:22:52 2014 +0900
+++ b/src/viewer_swing/java/com/glavsoft/viewer/ViewerInterface.java	Sun Jun 22 11:35:01 2014 +0900
@@ -4,7 +4,6 @@
 import java.net.Socket;
 
 import jp.ac.u_ryukyu.treevnc.MyRfbProto;
-import jp.ac.u_ryukyu.treevnc.server.TreeManagement;
 
 public interface ViewerInterface extends Runnable {
 
@@ -40,8 +39,8 @@
 
     public void inhelitClients(ViewerInterface vncProxyService, String hostName);
 
-    public void setTreeManager(TreeManagement treeManager);
-
     public void initRootViewer(String hostName);
 
+    public void proxyStart(String[] args, int width, int height);
+
 }