OSDN Git Service

add isLocalArchive() to Village.
authorOlyutorskii <olyutorskii@users.osdn.me>
Mon, 30 Mar 2020 15:40:28 +0000 (00:40 +0900)
committerOlyutorskii <olyutorskii@users.osdn.me>
Mon, 30 Mar 2020 15:40:28 +0000 (00:40 +0900)
src/main/java/jp/sfjp/jindolf/Controller.java
src/main/java/jp/sfjp/jindolf/data/Village.java

index 6d301fb..da98bef 100644 (file)
@@ -120,8 +120,6 @@ public class Controller
     private final ChangeListener filterWatcher =
             new FilterWatcher();
 
-    private boolean isLocalXml = false;
-
     private final Executor executor = Executors.newCachedThreadPool();
     private volatile boolean isBusyNow;
 
@@ -1227,7 +1225,7 @@ public class Controller
                 return;
             }
             EventQueue.invokeLater(() -> {
-                this.isLocalXml = true;
+                village.setLocalArchive(true);
                 selectedVillage(village);
             });
         }, "XML読み込み中", "XML読み込み完了");
@@ -1415,7 +1413,7 @@ public class Controller
      */
     private void selectedVillage(Village village){
         setFrameTitle(village.getVillageFullName());
-        if(this.isLocalXml){
+        if(village.isLocalArchive()){
             this.actionManager.exposeVillageLocal(true);
         }else{
             this.actionManager.exposeVillage(true);
@@ -1702,7 +1700,8 @@ public class Controller
                 else                   hasCurrentPeriod = true;
                 Controller.this.actionManager.exposePeriod(hasCurrentPeriod);
                 if(hasCurrentPeriod){
-                    if(Controller.this.isLocalXml){
+                    Village village = getVillage();
+                    if(village.isLocalArchive()){
                         Controller.this.actionManager.exposeVillageLocal(hasCurrentPeriod);
                     }else{
                         Controller.this.actionManager.exposeVillage(hasCurrentPeriod);
@@ -1748,7 +1747,7 @@ public class Controller
                 selectedLand(land);
             }else if(selObj instanceof Village){
                 Village village = (Village) selObj;
-                Controller.this.isLocalXml = false;
+                village.setLocalArchive(false);
                 selectedVillage(village);
             }
 
index 5e763ed..9b33a3c 100644 (file)
@@ -56,6 +56,8 @@ public class Village{
     private final Map<Avatar, BufferedImage> bodyMonoImageMap =
             new HashMap<>();
 
+    private boolean isLocalArchive = false;
+
 
     /**
      * Villageを生成する。
@@ -563,6 +565,25 @@ public class Village{
     }
 
     /**
+     * この村がローカルなアーカイブに由来するものであるか判定する。
+     *
+     * @return ローカルなアーカイブによる村であればtrue
+     */
+    public boolean isLocalArchive(){
+        return this.isLocalArchive;
+    }
+
+    /**
+     * この村がローカルなアーカイブに由来するものであるか設定する。
+     *
+     * @param flag ローカルなアーカイブによる村であればtrue
+     */
+    public void setLocalArchive(boolean flag){
+        this.isLocalArchive = flag;
+        return;
+    }
+
+    /**
      * {@inheritDoc}
      *
      * <p>村の文字列表現を返す。