Mercurial > hg > Members > riono > TreeVNC_ja_comment
changeset 79:015321785ddf
remove setType()
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Wed, 30 Apr 2014 11:52:34 +0900 |
parents | fc984746f958 |
children | 2951dd85e9fc |
files | .classpath src/main/java/jp/ac/u_ryukyu/treevnc/client/MyVncClient.java src/main/java/jp/ac/u_ryukyu/treevnc/client/TextBoxClient.java src/viewer_swing/java/com/glavsoft/viewer/CuiViewer.java src/viewer_swing/java/com/glavsoft/viewer/TreeConnectionManager.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/ViewerImpl.java |
diffstat | 8 files changed, 43 insertions(+), 138 deletions(-) [+] |
line wrap: on
line diff
--- a/.classpath Wed Apr 30 10:34:07 2014 +0900 +++ b/.classpath Wed Apr 30 11:52:34 2014 +0900 @@ -1,10 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> - <classpathentry kind="output" path="bin"/> <classpathentry kind="src" path="src/main/java"/> <classpathentry kind="src" path="src/viewer_swing/java"/> <classpathentry kind="src" path="src/viewer_swing/resources"/> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER" exported="true"/> - <classpathentry kind="lib" path="/Users/one/Documents/workspace/TreeVNC/src/libs/jsch-0.1.50.jar" exported="true"/> - <classpathentry kind="lib" path="/Applications/eclipse/Eclipse.app/Contents/MacOS/unresolved dependency - junit junit 4.+" exported="true"/> + <classpathentry exported="true" kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> + <classpathentry kind="lib" path="src/libs/jsch-0.1.50.jar"/> + <classpathentry kind="output" path="bin"/> </classpath>
--- a/src/main/java/jp/ac/u_ryukyu/treevnc/client/MyVncClient.java Wed Apr 30 10:34:07 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/treevnc/client/MyVncClient.java Wed Apr 30 11:52:34 2014 +0900 @@ -8,7 +8,6 @@ import com.glavsoft.rfb.IChangeSettingsListener; import com.glavsoft.rfb.IRfbSessionListener; import com.glavsoft.rfb.protocol.ProtocolSettings; -import com.glavsoft.viewer.TreeConnectionManager; import com.glavsoft.viewer.Viewer; import com.glavsoft.viewer.cli.Parser; import com.glavsoft.viewer.swing.ParametersHandler; @@ -24,7 +23,6 @@ public static final int DEFAULT_PORT = 5900; public static Logger logger = Logger.getLogger("com.glavsoft"); private final ProtocolSettings settings; - private TreeConnectionManager treeConnectionManager; public MyVncClient() { @@ -56,16 +54,9 @@ System.exit(0); } MyVncClient myClient = new MyVncClient(parser); - myClient.setType(); - //SwingUtilities.invokeLater(myClient); new Thread(myClient).start(); } - public void setType() { - super.setType(treeConnectionManager,new MyRfbProtoClient()); - } - - public void startClient(String[] argv) { String[] mainArgs = argv; System.out.println(mainArgs.length); @@ -78,8 +69,6 @@ System.exit(0); } MyVncClient myClient = new MyVncClient(parser); - myClient.setType(); - //SwingUtilities.invokeLater(myClient); new Thread(myClient).start(); }
--- a/src/main/java/jp/ac/u_ryukyu/treevnc/client/TextBoxClient.java Wed Apr 30 10:34:07 2014 +0900 +++ b/src/main/java/jp/ac/u_ryukyu/treevnc/client/TextBoxClient.java Wed Apr 30 11:52:34 2014 +0900 @@ -144,8 +144,8 @@ port = temp[1]; } else { port = temp[0]; - System.out.println("port=" + port); - hostAddress = temp[3]; + System.out.println("root=" + str); + hostAddress = temp[1]; } }
--- a/src/viewer_swing/java/com/glavsoft/viewer/CuiViewer.java Wed Apr 30 10:34:07 2014 +0900 +++ b/src/viewer_swing/java/com/glavsoft/viewer/CuiViewer.java Wed Apr 30 11:52:34 2014 +0900 @@ -2,13 +2,9 @@ import com.glavsoft.rfb.protocol.ProtocolSettings; import com.glavsoft.viewer.cli.Parser; -import com.glavsoft.viewer.mvp.View; import com.glavsoft.viewer.swing.ConnectionParams; import com.glavsoft.viewer.swing.ParametersHandler; import com.glavsoft.viewer.swing.SwingConnectionWorkerFactory; -import com.glavsoft.viewer.swing.SwingViewerWindowFactory; -import com.glavsoft.viewer.swing.gui.ConnectionView; - import javax.swing.*; import java.awt.*; import java.awt.event.WindowEvent; @@ -20,11 +16,8 @@ import java.util.jar.Manifest; import java.util.logging.*; -import jp.ac.u_ryukyu.treevnc.AcceptThread; import jp.ac.u_ryukyu.treevnc.CreateConnectionParam; import jp.ac.u_ryukyu.treevnc.MyRfbProto; -import jp.ac.u_ryukyu.treevnc.client.GetDataClient; -import jp.ac.u_ryukyu.treevnc.client.GetHostClient; import jp.ac.u_ryukyu.treevnc.client.MyRfbProtoClient; public class CuiViewer implements Runnable, WindowListener, ViewerImpl { @@ -39,9 +32,7 @@ protected boolean isApplet = true; private final ProtocolSettings settings; protected UiSettings uiSettings; - private volatile boolean isAppletStopped = false; private ConnectionPresenter connectionPresenter; - private boolean isTreeVNC = false; protected MyRfbProto myRfb; private boolean cuiVersion; @@ -203,11 +194,6 @@ } } - public void setType(TreeConnectionManager treeConnectionManager, - MyRfbProtoClient myRfbProtoClient) { - // must write - } - public void setSocket(Socket soc) { setConnectionParam(soc.getInetAddress().getHostAddress(), soc.getPort()); // Thread accThread = new Thread(new AcceptThread(myRfb, @@ -230,7 +216,6 @@ CreateConnectionParam cp = new CreateConnectionParam(rfb); cp.communicationToProxy(); cp.createConnectionParam(viewer); - viewer.isTreeVNC = true; rfb.setViewer(viewer); viewer.myRfb = rfb; SwingUtilities.invokeLater(viewer); @@ -243,7 +228,6 @@ CreateConnectionParam cp = new CreateConnectionParam(rfb); cp.setHostName(hostName); cp.createConnectionParam(viewer); - viewer.isTreeVNC = true; rfb.setViewer(viewer); rfb.setCuiVersion(true); viewer.myRfb = rfb; @@ -256,7 +240,6 @@ } public void setIsTreeVNC(boolean flag) { - isTreeVNC = flag; } public MyRfbProto getRfb() {
--- a/src/viewer_swing/java/com/glavsoft/viewer/TreeConnectionManager.java Wed Apr 30 10:34:07 2014 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,70 +0,0 @@ -package com.glavsoft.viewer; - -import java.awt.event.WindowListener; -import java.io.IOException; -import java.net.Socket; -import java.net.UnknownHostException; - -import jp.ac.u_ryukyu.treevnc.MyRfbProto; -import jp.ac.u_ryukyu.treevnc.client.GetDataClient; -import jp.ac.u_ryukyu.treevnc.client.GetHostClient; -import jp.ac.u_ryukyu.treevnc.client.EchoClient; - -import com.glavsoft.rfb.protocol.ProtocolSettings; -import com.glavsoft.viewer.swing.ParametersHandler; - -public class TreeConnectionManager { - - /* - private static final long serialVersionUID = 1L; - - public TreeConnectionManager(WindowListener appWindowListener, - boolean isApplet) { - super(appWindowListener, isApplet); - } - - @Override - public Socket connectToHost(final ParametersHandler.ConnectionParams connectionParams, - ProtocolSettings settings, MyRfbProto rfb) { - Socket socket = null; - GetHostClient bCast = new GetHostClient("who"); - bCast.getHost(); - GetDataClient getBcast = new GetDataClient(); - Thread runBcast = new Thread(getBcast); - runBcast.start(); - connectionParams.hostName = getBcast.textAddress(); - getBcast.interrupt(); - if("notFound".equals(connectionParams.hostName)) { - // connectionParams.portNumber = Integer.parseInt(getBcast.textPort()); - connectionParams.portNumber = 5900; - } else { - // getBcast.ipRegister(); - EchoClient echo = new EchoClient(getBcast.textAddress(),9999); - rfb.setEcho(echo); - rfb.setProxyAddr(getBcast.textAddress()); - echo.getParentName(); - connectionParams.hostName = echo.getParentsAddress(); - connectionParams.portNumber = Integer.parseInt(getBcast.textPort()); // I should get port number - // connectionParams.hostName = getBcast.textAddress(); - // connectionParams.portNumber = Integer.parseInt(getBcast.textPort()); - // connectionParams.portNumber = 5900; - } - Viewer.logger.info("Connecting to host " + connectionParams.hostName + ":" + connectionParams.portNumber); - try { - socket = new Socket(connectionParams.hostName, connectionParams.portNumber); - socket.setReuseAddress(true); - } catch (UnknownHostException e) { - Viewer.logger.severe("Unknown host: " + connectionParams.hostName); - showConnectionErrorDialog("Unknown host: '" + connectionParams.hostName + "'"); - } catch (IOException e) { - Viewer.logger.severe("Couldn't connect to: " + - connectionParams.hostName + ":" + connectionParams.portNumber + - ": " + e.getMessage()); - showConnectionErrorDialog("Couldn't connect to: '" + connectionParams.hostName + - "'\n" + e.getMessage()); - } - return socket; - } - */ - -}
--- a/src/viewer_swing/java/com/glavsoft/viewer/TreeViewer.java Wed Apr 30 10:34:07 2014 +0900 +++ b/src/viewer_swing/java/com/glavsoft/viewer/TreeViewer.java Wed Apr 30 11:52:34 2014 +0900 @@ -5,6 +5,7 @@ public class TreeViewer { private boolean treeProxy; private boolean viewer; + private boolean cui = false; private int width; private int height; private String hostName = null; @@ -14,18 +15,20 @@ } private void vncStart(String[] args) { - modeSelect(args); - if (treeProxy) { - VncProxyService vps = new VncProxyService(); - vps.proxyStart(args,width,height); - } - if(hostName!=null) { - CuiViewer v = new CuiViewer(); - v.startViewer(hostName,true); - } else if (viewer) { - Viewer v = new Viewer(); - v.startViewer(); - } + modeSelect(args); + if (treeProxy) { + VncProxyService vps = new VncProxyService(); + vps.proxyStart(args,width,height); + } + ViewerImpl v; + if (viewer) { + v = cui ? new CuiViewer() : new Viewer(); + if(hostName!=null) { + v.startViewer(hostName,true); + } else { + v.startViewer(); + } + } } private void modeSelect(String[] args) { @@ -36,11 +39,14 @@ // relay rfb update to clients. treeProxy = true; viewer = false; - } else if ("-d".equals(args[i])) { - // behave as root with display. - // use this on main display such as large tv. - treeProxy = true; - viewer = true; + } else if ("-d".equals(args[i])) { + // behave as root with display. + // use this on main display such as large tv. + treeProxy = true; + viewer = true; + } else if ("--cui".equals(args[i])) { + // use cui viewer + cui = true; } else if ("-v".equals(args[i]) || "-c".equals(args[i])) { // behave as client. // open display and connect to some tree node.
--- a/src/viewer_swing/java/com/glavsoft/viewer/Viewer.java Wed Apr 30 10:34:07 2014 +0900 +++ b/src/viewer_swing/java/com/glavsoft/viewer/Viewer.java Wed Apr 30 11:52:34 2014 +0900 @@ -264,10 +264,6 @@ } } - public void setType(TreeConnectionManager treeConnectionManager, - MyRfbProtoClient myRfbProtoClient) { - // must write - } public void setSocket(Socket soc) { setConnectionParam(soc.getInetAddress().getHostAddress(),soc.getPort()); @@ -285,28 +281,26 @@ } public void startViewer() { - Viewer viewer = new Viewer(); MyRfbProtoClient rfb = new MyRfbProtoClient(); CreateConnectionParam cp = new CreateConnectionParam(rfb); cp.communicationToProxy(); - cp.createConnectionParam(viewer); - viewer.isTreeVNC = true; - rfb.setViewer(viewer); - viewer.myRfb = rfb; - SwingUtilities.invokeLater(viewer); + cp.createConnectionParam(this); + isTreeVNC = true; + rfb.setViewer(this); + myRfb = rfb; + SwingUtilities.invokeLater(this); } public void startViewer(String hostName,boolean cui) { - Viewer viewer = new Viewer(); - viewer.cuiVersion = cui; + cuiVersion = cui; MyRfbProtoClient rfb = new MyRfbProtoClient(); CreateConnectionParam cp = new CreateConnectionParam(rfb); cp.setHostName(hostName); - cp.createConnectionParam(viewer); - viewer.isTreeVNC = true; - rfb.setViewer(viewer); - viewer.myRfb = rfb; - SwingUtilities.invokeLater(viewer); + cp.createConnectionParam(this); + isTreeVNC = true; + rfb.setViewer(this); + myRfb = rfb; + SwingUtilities.invokeLater(this); }
--- a/src/viewer_swing/java/com/glavsoft/viewer/ViewerImpl.java Wed Apr 30 10:34:07 2014 +0900 +++ b/src/viewer_swing/java/com/glavsoft/viewer/ViewerImpl.java Wed Apr 30 11:52:34 2014 +0900 @@ -23,4 +23,8 @@ public void setTeminationType(boolean b); public void setCuiVersion(boolean flag); + + public void startViewer(String hostName, boolean b); + + public void startViewer(); }