Mercurial > hg > Database > Christie
changeset 243:9d0b932ad84f
tweak
author | ichikitakahiro <e165713@ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 23 Jan 2020 02:10:00 +0900 |
parents | faff3236236d |
children | e6632043c58a |
files | src/main/java/christie/remoteTextEditor/CheckCommand.java src/main/java/christie/remoteTextEditor/Command.java src/main/java/christie/remoteTextEditor/Insert.java src/main/java/christie/remoteTextEditor/receiveCommand.java src/main/java/christie/remoteTextEditor/test.java src/main/java/christie/textEditor/NewTextEditor.java src/main/java/christie/textEditor/textFrame.java |
diffstat | 7 files changed, 41 insertions(+), 29 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/christie/remoteTextEditor/CheckCommand.java Thu Jan 23 01:06:29 2020 +0900 +++ b/src/main/java/christie/remoteTextEditor/CheckCommand.java Thu Jan 23 02:10:00 2020 +0900 @@ -19,12 +19,11 @@ int sendOffset; String sendString; if(myEditor.checkPermission() == true) { - Command cmd = new Insert(myEditor.returnOffset(), myEditor.returnString()); + Insert ins = new Insert(myEditor.returnOffset(), myEditor.returnString()); myEditor.changeToFalseSendPermmision(); - put("partner", "cmd", new Message()); + put("partner", "cmd", ins); System.out.println(topoDG.getNodeName() + " :catch,offset = " + myEditor.returnOffset()); -// opponentは単語として不適切。 // insert,deleteなどの命令を飛ばす。その中にoffset,stringが含まれる。コマンドパターン。 // get,setの単語は紛らわしいのでよくない。 cgm.setup(new CheckCommand());
--- a/src/main/java/christie/remoteTextEditor/Command.java Thu Jan 23 01:06:29 2020 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ -package christie.remoteTextEditor; - -import christie.textEditor.NewTextEditor; - -public interface Command { - public abstract void execute(NewTextEditor myEditor); - -}
--- a/src/main/java/christie/remoteTextEditor/Insert.java Thu Jan 23 01:06:29 2020 +0900 +++ b/src/main/java/christie/remoteTextEditor/Insert.java Thu Jan 23 02:10:00 2020 +0900 @@ -2,25 +2,25 @@ import christie.textEditor.NewTextEditor; -public class Insert implements Command { +import java.io.Serializable; + +@org.msgpack.annotation.Message +public class Insert { + String string; int fastOffset; - - int endOffset; - - NewTextEditor myEditor; - //myEditorは入れない。 - +// +// int endOffset; +// +// public Insert(int fastOffset, String string){ this.string = string; this.fastOffset = fastOffset; } - - - @Override - public void execute(NewTextEditor myEditor) { - this.myEditor = myEditor; - myEditor.insertMessage(this.fastOffset, this.string); - } +// +// +// public void execute(NewTextEditor myEditor) { +// System.out.println("used insert"); +// } }
--- a/src/main/java/christie/remoteTextEditor/receiveCommand.java Thu Jan 23 01:06:29 2020 +0900 +++ b/src/main/java/christie/remoteTextEditor/receiveCommand.java Thu Jan 23 02:10:00 2020 +0900 @@ -5,11 +5,10 @@ import christie.codegear.CodeGear; import christie.codegear.CodeGearManager; import christie.textEditor.NewTextEditor; -import org.msgpack.annotation.Message; public class receiveCommand extends CodeGear { @Take - Message cmd; + Insert cmd; @Peek NewTextEditor myEditor; @@ -17,6 +16,7 @@ @Override protected void run(CodeGearManager cgm) { // cmd.execute(myEditor); - System.out.println("キャッチ"); + System.out.println("this is " + cmd); + cgm.setup(new receiveCommand()); } }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/christie/remoteTextEditor/test.java Thu Jan 23 02:10:00 2020 +0900 @@ -0,0 +1,20 @@ +package christie.remoteTextEditor; + +import christie.annotation.Peek; +import christie.annotation.Take; +import christie.codegear.CodeGear; +import christie.codegear.CodeGearManager; +import christie.textEditor.NewTextEditor; + +public class test extends CodeGear { + @Peek + NewTextEditor myEditor; + + @Take + NewTextEditor myEditor2; + + @Override + protected void run(CodeGearManager cgm) { + System.out.println(myEditor2); + } +}
--- a/src/main/java/christie/textEditor/NewTextEditor.java Thu Jan 23 01:06:29 2020 +0900 +++ b/src/main/java/christie/textEditor/NewTextEditor.java Thu Jan 23 02:10:00 2020 +0900 @@ -9,6 +9,7 @@ import javax.swing.text.StyleContext; import java.awt.*; +@org.msgpack.annotation.Message public class NewTextEditor extends JFrame { private static boolean canSend = false; TextFrame textFrame = new TextFrame();
--- a/src/main/java/christie/textEditor/textFrame.java Thu Jan 23 01:06:29 2020 +0900 +++ b/src/main/java/christie/textEditor/textFrame.java Thu Jan 23 02:10:00 2020 +0900 @@ -12,7 +12,7 @@ import javax.swing.text.Document; import javax.swing.text.StyleContext; - +@org.msgpack.annotation.Message public class TextFrame extends JInternalFrame { private JTextArea textArea;