Mercurial > hg > Database > Alice
changeset 407:4b38d3e6520e dispose
bug fix
author | sugi |
---|---|
date | Tue, 24 Jun 2014 14:56:35 +0900 |
parents | d28b1216d615 |
children | 8cb64ce1ed21 |
files | src/main/java/alice/test/topology/aquarium/fx/AddObject.java src/main/java/alice/test/topology/aquarium/fx/CheckAllFishInfoExist.java src/main/java/alice/test/topology/aquarium/fx/CreateObject.java src/main/java/alice/test/topology/aquarium/fx/FishInfo.java |
diffstat | 4 files changed, 11 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/alice/test/topology/aquarium/fx/AddObject.java Tue Jun 24 14:31:11 2014 +0900 +++ b/src/main/java/alice/test/topology/aquarium/fx/AddObject.java Tue Jun 24 14:56:35 2014 +0900 @@ -22,6 +22,8 @@ @Override public void run() { + + if (!executed) { executed = true; // javafx's Scene can be accessed only FX application thread. @@ -36,8 +38,10 @@ if (n.getId().equals(obj.getId())) duplication = true; } + if (!duplication) { root.getChildren().add(obj); + System.out.println(obj.getId()+" add"); ods.put(obj.getId()+"Fish", obj); // controlled own fish @@ -52,7 +56,7 @@ ods.put("register", fishInfo); } ods.flip(info); - + new AddObject(); } }
--- a/src/main/java/alice/test/topology/aquarium/fx/CheckAllFishInfoExist.java Tue Jun 24 14:31:11 2014 +0900 +++ b/src/main/java/alice/test/topology/aquarium/fx/CheckAllFishInfoExist.java Tue Jun 24 14:56:35 2014 +0900 @@ -36,7 +36,7 @@ for (Value v : fishInfoList){ boolean exist = false; FishInfo info = msg.convert(v, FishInfo.class); - if (info.name == null) { + if (info.name != null) { for (Node n : root.getChildren()) { if (info.name.equals(n.getId())) { exist = true; @@ -45,6 +45,7 @@ } if (!exist) { + info.fromCheckExist = true; ods.put("fishData", info); } }
--- a/src/main/java/alice/test/topology/aquarium/fx/CreateObject.java Tue Jun 24 14:31:11 2014 +0900 +++ b/src/main/java/alice/test/topology/aquarium/fx/CreateObject.java Tue Jun 24 14:56:35 2014 +0900 @@ -38,7 +38,8 @@ obj.setId(fishInfo.name); ods.put("addOffer", obj); - new SendDataOthers(info, "fishData"); + if (!fishInfo.fromCheckExist) + new SendDataOthers(info, "fishData"); new CreateObject(); }
--- a/src/main/java/alice/test/topology/aquarium/fx/FishInfo.java Tue Jun 24 14:31:11 2014 +0900 +++ b/src/main/java/alice/test/topology/aquarium/fx/FishInfo.java Tue Jun 24 14:56:35 2014 +0900 @@ -17,6 +17,8 @@ public double rolZ = 0; public double rotate = 0; + public boolean fromCheckExist = false; + public FishInfo(){ // this constructor is nothing to do, but need for serializing with MessagePack }