don't show tag editor when multiple items are selected
authorRichard Fairhurst <richard@systemed.net>
Sat, 13 Nov 2010 10:46:51 +0000 (10:46 +0000)
committerRichard Fairhurst <richard@systemed.net>
Sat, 13 Nov 2010 10:46:51 +0000 (10:46 +0000)
net/systemeD/potlatch2/EditController.as
net/systemeD/potlatch2/RelationEditorPanel.mxml
net/systemeD/potlatch2/TagViewer.mxml

index 9e51c7b..e27b05d 100644 (file)
@@ -57,11 +57,10 @@ package net.systemeD.potlatch2 {
             return _connection;
         }
         
-        public function updateSelectionUI():void {
-                       var entity:Entity=state.firstSelected;
-            tagViewer.setEntity(entity);
+               public function updateSelectionUI():void {
+                       tagViewer.setEntity(state.selection);
                        toolbox.updateSelectionUI();
-        }
+               }
         
         private function keyDownHandler(event:KeyboardEvent):void {
                        keys[event.keyCode]=true;
index 9c602f6..1f33cfe 100644 (file)
@@ -24,7 +24,7 @@
 
         public function checkRelation():void {
             if ( _relation != null )
-                tagViewer.setEntity(_relation);
+                tagViewer.setEntity([_relation]);
         }
     ]]></mx:Script>    
 </mx:TitleWindow>
index 1a57bfe..deabda7 100644 (file)
                        enabled="{editorStack is SuperTabNavigator &amp;&amp; stack.selectedIndex==0}" />
          </mx:HBox>
   </mx:VBox>
+
+  <mx:VBox id="multiplePanel" width="100%" height="100%" horizontalScrollPolicy="off" styleName="dndPanelVbox">
+    <mx:Text id="multiplePanelText" text="You have selected multiple items." width="100%" styleName="helpInfo" />
+  </mx:VBox>
 </mx:ViewStack>
 
   <mx:Script><![CDATA[
       private var tw:CategorySelector = null;
       private var feature:Feature = null;
 
-      public function setEntity(entity:Entity):void {
-          UIComponent.suspendBackgroundProcessing();
-          if ( selectedEntity != entity ) {
-              if ( selectedEntity != null )
-                  selectedEntity.removeEventListener(Connection.TAG_CHANGED, tagChanged);
-              selectedEntity = entity;
-              if ( selectedEntity != null )
-                  selectedEntity.addEventListener(Connection.TAG_CHANGED, tagChanged);
-          }
-
-          if ( advancedID != null )
-              setupAdvanced(entity);
-          if (entity is Relation) {
-              stack.addChild(membersVBox);
-          }
-          refreshFeatureIcon(); 
-          if (selectedEntity == null) {
-            sidebar.selectedChild = dndPanel;
-          } else {
-            initialiseEditors();
-            sidebar.selectedChild = tagsPanel;
-          }
-          UIComponent.resumeBackgroundProcessing();
+         public function setEntity(entities:Array):void {
+               UIComponent.suspendBackgroundProcessing();
+               
+               var firstSelected:Entity=null;
+               if (entities.length==1) { firstSelected=entities[0]; }
+               
+               if (selectedEntity!=firstSelected && selectedEntity!=null) {
+                       selectedEntity.removeEventListener(Connection.TAG_CHANGED, tagChanged);
+               }
+               
+               if (entities.length==0) {
+                       // Nothing selected, so show drag-and-drop panel
+                       sidebar.selectedChild = dndPanel;
+               
+               } else if (entities.length==1) {
+                       // Single entity selected, so show tag panel
+                       selectedEntity=firstSelected;
+                       if (selectedEntity!=null) { selectedEntity.addEventListener(Connection.TAG_CHANGED, tagChanged); }
+                       if (advancedID!=null) { setupAdvanced(firstSelected); }
+                       if (firstSelected is Relation) { stack.addChild(membersVBox); }
+                       refreshFeatureIcon(); 
+                       initialiseEditors();
+                       sidebar.selectedChild = tagsPanel;
+               
+               } else {
+                       // Multiple selection, so for now show a largely blank panel/
+                       // ** TODO - proper multiple selection tagging
+                       sidebar.selectedChild = multiplePanel;
+               }
+               UIComponent.resumeBackgroundProcessing();
       }
 
       private function refreshFeatureIcon():void {