Mercurial > hg > Database > Christie
changeset 225:401981622a1e
Provisional completion Editor's communication
author | ichikitakahiro <e165713@ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 27 Dec 2019 16:09:10 +0900 |
parents | 0c74d9168aff |
children | 218ad6b9ba87 b312656c7ec0 |
files | src/main/java/christie/remotingTextEditor/GetOpponentMessage.java src/main/java/christie/remotingTextEditor/SetEditorCommunication.java src/main/java/christie/remotingTextEditor/SetInstance.java src/main/java/christie/textEditor/NewTextEditor.java |
diffstat | 4 files changed, 20 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/christie/remotingTextEditor/GetOpponentMessage.java Tue Dec 24 19:33:50 2019 +0900 +++ b/src/main/java/christie/remotingTextEditor/GetOpponentMessage.java Fri Dec 27 16:09:10 2019 +0900 @@ -10,7 +10,10 @@ public class GetOpponentMessage extends CodeGear { @Take - Message offset; + int offset; + + @Take + String string; @Peek NewTextEditor myEditor; @@ -21,7 +24,9 @@ @Override protected void run(CodeGearManager cgm) { - System.out.println( topoDG.getNodeName() + " catch Offest:" + offset); + System.out.println( topoDG.getNodeName() + " gave:" + string + " on " + offset); + myEditor.prohibitDL(); + myEditor.insertMessage(offset, string); cgm.setup(new GetOpponentMessage()); } }
--- a/src/main/java/christie/remotingTextEditor/SetEditorCommunication.java Tue Dec 24 19:33:50 2019 +0900 +++ b/src/main/java/christie/remotingTextEditor/SetEditorCommunication.java Fri Dec 27 16:09:10 2019 +0900 @@ -25,9 +25,11 @@ } } int sendOffset = myEditor.getOffset(); + String sendString = myEditor.getString(); System.out.println(topoDG.getNodeName()+ ":catchoffset=: " + sendOffset); -// put("opponent", "offset", new Message()); myEditor.changeToFalseSendPermmision(); + put("opponent", "offset", sendOffset); + put("opponent", "string", sendString); cgm.setup(new SetEditorCommunication()); }
--- a/src/main/java/christie/remotingTextEditor/SetInstance.java Tue Dec 24 19:33:50 2019 +0900 +++ b/src/main/java/christie/remotingTextEditor/SetInstance.java Fri Dec 27 16:09:10 2019 +0900 @@ -15,6 +15,8 @@ import java.io.FileWriter; +import static christie.codegear.StartCodeGear.createCGM; + public class SetInstance extends CodeGear { @@ -28,17 +30,17 @@ NewTextEditor Editor0 = new NewTextEditor(); Editor0.StartEditor(topoDG.getNodeName()); System.out.println("node0"); - //cgm.setup(new GetOpponentMessage()); cgm.setup(new SetEditorCommunication()); cgm.getLocalDGM().put("myEditor", Editor0); + cgm.setup(new GetOpponentMessage()); }else if(topoDG.getNodeName().equals("node1")){ NewTextEditor Editor1 = new NewTextEditor(); Editor1.StartEditor(topoDG.getNodeName()); System.out.println("node1"); - //cgm.setup(new GetOpponentMessage()); cgm.setup(new SetEditorCommunication()); cgm.getLocalDGM().put("myEditor", Editor1); + cgm.setup(new GetOpponentMessage()); } //cgm.setup(new CatchDG());
--- a/src/main/java/christie/textEditor/NewTextEditor.java Tue Dec 24 19:33:50 2019 +0900 +++ b/src/main/java/christie/textEditor/NewTextEditor.java Fri Dec 27 16:09:10 2019 +0900 @@ -14,11 +14,6 @@ TextFrame textFrame = new TextFrame(); static JTextArea textArea = new JTextArea(); - - public void callInner(){ - textFrame.insertText(); - } - public boolean checkPermission(){ return textFrame.SendPermission(); } @@ -27,10 +22,16 @@ return textFrame.returnOffset(); } + public String getString(){return textFrame.returnString();} + + public void prohibitDL(){textFrame.prohibitDL();} + public void changeToFalseSendPermmision(){ textFrame.changeToFalseSend(); } + public void insertMessage(int offset, String str){textFrame.insertText(offset, str);} + // public static void main(String[] args){ // NewTextEditor editor = new NewTextEditor(); //