Set blank tags as black, and use that to debug some flawed logic
authorAndy Allan <andy@gravitystorm.co.uk>
Mon, 4 Jul 2011 16:22:29 +0000 (17:22 +0100)
committerAndy Allan <andy@gravitystorm.co.uk>
Mon, 4 Jul 2011 16:22:29 +0000 (17:22 +0100)
net/systemeD/potlatch2/panels/BackgroundMergeFieldComponent.as
net/systemeD/potlatch2/panels/BackgroundMergePanel.mxml

index 08a0ada..39d226d 100644 (file)
@@ -11,8 +11,12 @@ package net.systemeD.potlatch2.panels {
         if(value != null)
         {
             super.data = value;
-            textField.background = true;
-            textField.backgroundColor = BackgroundMergePanel(listData.owner.parent).getColorFor(listData.rowIndex);
+            if (listData.label != ' ') { // yes, a space. No, neither null nor empty string. I hate you, adobe
+                textField.background = true;
+                textField.backgroundColor = BackgroundMergePanel(listData.owner.parent).getColorFor(listData.rowIndex);
+            } else {
+                textField.background = false;
+            }
         }
      }
   }
index ebc3f49..70c5554 100644 (file)
           editableEntity.setTag(key, backgroundEntity.getTag(key), MainUndoStack.getGlobalStack().addAction);
       }
 
+      // Don't call this for things you don't want coloured in. Like for empty tags.
       public function getColorFor(i:int):int {
           if (tagDataProvider[i].e == tagDataProvider[i].b) {
               return 0xDDFFDD; // matching, green
            } else if (tagDataProvider[i].e == null) {
               return 0xDDDDFF; // new value, blue
-           } else {
+           } else if (tagDataProvider[i].b) {
               return 0xFFDDDD; // conflicting, red
            }
+           return NaN; // which is interpretted as black
       }
   ]]>
   </mx:Script>