Mercurial > hg > Database > Alice
diff src/main/java/alice/test/topology/aquarium/fx/SetTranslate.java @ 377:ca093d55a886 multicast
Aquarium for javaFX worked But Only one Node.
author | sugi |
---|---|
date | Mon, 09 Jun 2014 20:15:46 +0900 |
parents | |
children | 878d397904da |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/alice/test/topology/aquarium/fx/SetTranslate.java Mon Jun 09 20:15:46 2014 +0900 @@ -0,0 +1,37 @@ +package alice.test.topology.aquarium.fx; + +import javafx.application.Platform; +import javafx.scene.Group; +import alice.codesegment.CodeSegment; +import alice.datasegment.CommandType; +import alice.datasegment.Receiver; + +public class SetTranslate extends CodeSegment { + + private Receiver info = ids.create(CommandType.TAKE); // object instance + private Receiver info1 = ids.create(CommandType.TAKE); // fish position information + private boolean executed = false; + public SetTranslate(String key) { + info.setKey(key); + info1.setKey(key+"Position"); + } + + @Override + public void run() { + if (!executed) { + executed = true; + // javafx's Scene can be accessed only FX application thread. + Platform.runLater(this); + } else { + Group fish = info.asClass(Group.class); + FishInfo fp = info1.asClass(FishInfo.class); + + fish.setTranslateX(fish.getTranslateX()+fp.getX()); + fish.setTranslateY(fish.getTranslateY()+fp.getY()); + fish.setTranslateZ(fish.getTranslateZ()+fp.getZ()); + ods.flip(info); + new SetTranslate(info.key); + } + } + +}