OSDN Git Service

mask action UI with local XML.
authorOlyutorskii <olyutorskii@users.osdn.me>
Thu, 19 Mar 2020 17:19:28 +0000 (02:19 +0900)
committerOlyutorskii <olyutorskii@users.osdn.me>
Thu, 19 Mar 2020 17:19:28 +0000 (02:19 +0900)
src/main/java/jp/sfjp/jindolf/Controller.java
src/main/java/jp/sfjp/jindolf/view/ActionManager.java

index eee1361..6d301fb 100644 (file)
@@ -120,6 +120,8 @@ public class Controller
     private final ChangeListener filterWatcher =
             new FilterWatcher();
 
+    private boolean isLocalXml = false;
+
     private final Executor executor = Executors.newCachedThreadPool();
     private volatile boolean isBusyNow;
 
@@ -1225,6 +1227,7 @@ public class Controller
                 return;
             }
             EventQueue.invokeLater(() -> {
+                this.isLocalXml = true;
                 selectedVillage(village);
             });
         }, "XML読み込み中", "XML読み込み完了");
@@ -1412,7 +1415,11 @@ public class Controller
      */
     private void selectedVillage(Village village){
         setFrameTitle(village.getVillageFullName());
-        this.actionManager.exposeVillage(true);
+        if(this.isLocalXml){
+            this.actionManager.exposeVillageLocal(true);
+        }else{
+            this.actionManager.exposeVillage(true);
+        }
 
         Runnable task = () -> {
             try{
@@ -1694,6 +1701,13 @@ public class Controller
                 if(periodView == null) hasCurrentPeriod = false;
                 else                   hasCurrentPeriod = true;
                 Controller.this.actionManager.exposePeriod(hasCurrentPeriod);
+                if(hasCurrentPeriod){
+                    if(Controller.this.isLocalXml){
+                        Controller.this.actionManager.exposeVillageLocal(hasCurrentPeriod);
+                    }else{
+                        Controller.this.actionManager.exposeVillage(hasCurrentPeriod);
+                    }
+                }
             }
 
             return;
@@ -1734,6 +1748,7 @@ public class Controller
                 selectedLand(land);
             }else if(selObj instanceof Village){
                 Village village = (Village) selObj;
+                Controller.this.isLocalXml = false;
                 selectedVillage(village);
             }
 
index 5138521..9113544 100644 (file)
@@ -527,13 +527,11 @@ public class ActionManager{
     }
 
     /**
-     * Periodã\81\8cé\81¸æ\8a\9e表示ã\81\95ã\82\8cã\81¦ã\81\84ã\82\8bç\8a¶æ³\81ã\81\8bé\80\9aç\9f¥ã\82\92å\8f\97ã\81\91る。
+     * Periodã\81®é\81¸æ\8a\9e表示ç\8a¶æ³\81ã\81«å¿\9cã\81\98ã\81¦UIã\82\92ã\83\9eã\82¹ã\82¯ã\81\99る。
      *
-     * @param appear 表示されているときはtrue
+     * @param appear Periodタブが選択されているときはtrue
      */
     private void exposePeriodImpl(boolean appear){
-        if(appear) exposeVillageImpl(appear);
-
         this.menuEdit.setEnabled(appear);
         this.menuDay .setEnabled(appear);
 
@@ -546,9 +544,9 @@ public class ActionManager{
     }
 
     /**
-     * Periodã\81\8cé\81¸æ\8a\9e表示ã\81\95ã\82\8cã\81¦ã\81\84ã\82\8bç\8a¶æ³\81ã\81\8bé\80\9aç\9f¥ã\82\92å\8f\97ã\81\91る。
+     * Periodã\81®é\81¸æ\8a\9e表示ç\8a¶æ³\81ã\81«å¿\9cã\81\98ã\81¦UIã\82\92ã\83\9eã\82¹ã\82¯ã\81\99る。
      *
-     * @param appear 表示されているときはtrue
+     * @param appear Periodタブが選択されているときはtrue
      */
     public void exposePeriod(boolean appear){
         exposePeriodImpl(appear);
@@ -556,22 +554,25 @@ public class ActionManager{
     }
 
     /**
-     * æ\9d\91ã\81\8cé\81¸æ\8a\9e表示ã\81\95ã\82\8cã\81¦ã\81\84ã\82\8bç\8a¶æ³\81ã\81\8bé\80\9aç\9f¥ã\82\92å\8f\97ã\81\91る。
+     * æ\9d\91ã\83\84ã\83ªã\83¼ã\81®é\81¸æ\8a\9e表示ç\8a¶æ³\81ã\81«å¿\9cã\81\98ã\81¦UIã\82\92ã\83\9eã\82¹ã\82¯ã\81\99る。
      *
-     * @param appear 表示されているときはtrue
+     * @param appear 村ノードが選択されているときはtrue
      */
     private void exposeVillageImpl(boolean appear){
-        if( ! appear) exposePeriodImpl(appear);
-
         this.menuVillage.setEnabled(appear);
 
+        getMenuItem(CMD_RELOAD)    .setEnabled(appear);
+        getMenuItem(CMD_ALLPERIOD) .setEnabled(appear);
+
+        getToolButton(CMD_RELOAD)  .setEnabled(appear);
+
         return;
     }
 
     /**
-     * æ\9d\91ã\81\8cé\81¸æ\8a\9e表示ã\81\95ã\82\8cã\81¦ã\81\84ã\82\8bç\8a¶æ³\81ã\81\8bé\80\9aç\9f¥ã\82\92å\8f\97ã\81\91る。
+     * æ\9d\91ã\83\84ã\83ªã\83¼ã\81®é\81¸æ\8a\9e表示ç\8a¶æ³\81ã\81«å¿\9cã\81\98ã\81¦UIã\82\92ã\83\9eã\82¹ã\82¯ã\81\99る。
      *
-     * @param appear 表示されているときはtrue
+     * @param appear 村ノードが選択されているときはtrue
      */
     public void exposeVillage(boolean appear){
         exposeVillageImpl(appear);
@@ -579,29 +580,29 @@ public class ActionManager{
     }
 
     /**
-     * ã\83­ã\83¼ã\82«ã\83«XMLæ\9d\91ã\81\8cé\81¸æ\8a\9e表示ã\81\95ã\82\8cã\81¦ã\81\84ã\82\8bç\8a¶æ³\81ã\81\8bé\80\9aç\9f¥ã\82\92å\8f\97ã\81\91る。
+     * ã\83­ã\83¼ã\82«ã\83«XMLæ\9d\91ã\81®è¡¨ç¤ºç\8a¶æ³\81ã\81«å¿\9cã\81\98ã\81¦UIã\82\92ã\83\9eã\82¹ã\82¯ã\81\99る。
      *
      * <p>単一および全日程Periodの強制読み込みが抑止される。
      *
-     * @param appear 表示されているときはtrue
+     * @param appear ローカルXMLが表示されているときはtrue
      */
     private void exposeVillageLocalImpl(boolean appear){
-        if( ! appear) exposePeriodImpl(appear);
-
         this.menuVillage.setEnabled(appear);
 
-        getMenuItem(CMD_RELOAD).setEnabled(appear);
-        getMenuItem(CMD_ALLPERIOD).setEnabled(appear);
+        getMenuItem(CMD_RELOAD)    .setEnabled( ! appear);
+        getMenuItem(CMD_ALLPERIOD) .setEnabled( ! appear);
 
-        getToolButton(CMD_RELOAD).setEnabled(appear);
+        getToolButton(CMD_RELOAD)  .setEnabled( ! appear);
 
         return;
     }
 
     /**
-     * ローカルXML村が選択表示されている状況か通知を受ける。
+     * ローカルXML村の表示状況に応じてUIをマスクする。
+     *
+     * <p>単一および全日程Periodの強制読み込みが抑止される。
      *
-     * @param appear 表示されているときはtrue
+     * @param appear ローカルXMLが表示されているときはtrue
      */
     public void exposeVillageLocal(boolean appear){
         exposeVillageLocalImpl(appear);