changeset 38:99dc7f13ed80

*** empty log message ***
author pin
date Fri, 06 Apr 2007 02:36:23 +0900
parents 7f346cf2a07b
children 188f09aff2be
files bin/remoteeditor/editors/RemoteEditor.class bin/remoteeditor/network/REP.class src/remoteeditor/editors/RemoteEditor.java src/remoteeditor/network/REP.java src/remoteeditor/ui/REPSelectWindow.java
diffstat 5 files changed, 23 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
Binary file bin/remoteeditor/editors/RemoteEditor.class has changed
Binary file bin/remoteeditor/network/REP.class has changed
--- a/src/remoteeditor/editors/RemoteEditor.java	Fri Apr 06 01:36:23 2007 +0900
+++ b/src/remoteeditor/editors/RemoteEditor.java	Fri Apr 06 02:36:23 2007 +0900
@@ -93,7 +93,7 @@
 		REPCommand temp = repreceive.unpack();
 		myeid = temp.eid; mysid = temp.sid;
 		repreceive.addCommandListener(this);
-		
+		repsend.send(new REPCommand(REP.REPCMD_READ, mysid, myeid, myseq, 0, 0, ""));
 	}
 	
 	public void dispose() {
@@ -205,6 +205,22 @@
 					e.printStackTrace();
 				}
 			break;
+		case REP.REPCMD_READ:
+			try {
+					receiveReadCMD();
+				} catch (BadLocationException e) {
+					e.printStackTrace();
+				}
+			break;
+		}
+	}
+
+	private void receiveReadCMD() throws BadLocationException {
+		for(int i = 0; i < document.getNumberOfLines(); i++){
+			int offset = document.getLineOffset(i);
+			int length = document.getLineLength(i);
+			String text = document.get(offset, length);
+			repsend.send(new REPCommand(REP.REP_INSERT_CMD, mysid, myeid, myseq, i, text.length(), text));
 		}
 	}
 }
--- a/src/remoteeditor/network/REP.java	Fri Apr 06 01:36:23 2007 +0900
+++ b/src/remoteeditor/network/REP.java	Fri Apr 06 02:36:23 2007 +0900
@@ -27,6 +27,9 @@
 	int seqid;
 	int textsiz;
 	
+
+    public static final int REPCMD_READ		= 3;
+    public static final int REPCMD_READ_ACK	= 4;
 	public static final int REP_INSERT_CMD = 6;
 	public static final int REP_INSERT_ACK_CMD = 7;
 	public static final int REP_DELETE_CMD = 9;
--- a/src/remoteeditor/ui/REPSelectWindow.java	Fri Apr 06 01:36:23 2007 +0900
+++ b/src/remoteeditor/ui/REPSelectWindow.java	Fri Apr 06 02:36:23 2007 +0900
@@ -69,7 +69,7 @@
 	    
 	    button1.addSelectionListener(new SelectionAdapter(){
 	    	public void widgetSelected(SelectionEvent e){
-	    		MessageBox mesBox = new MessageBox(shell);
+	    		//MessageBox mesBox = new MessageBox(shell);
 	    		if(combo.getSelectionIndex() == 0){
 	    			put();
 	    			select();
@@ -77,8 +77,8 @@
 	    			mysid = combo.getSelectionIndex() - 1;
 	    			select();
 	    		}
-	    		mesBox.setMessage("select : " + combo.getText());
-	    		mesBox.open();
+	    		//mesBox.setMessage("select : " + combo.getText());
+	    		//mesBox.open();
 	    		shell.close();
 	    	}
 	    });