Merge remote-tracking branch 'gravitystorm/i18n' into staging
[potlatch2.git] / net / systemeD / potlatch2 / TagViewer.mxml
index bade4b8033d720f9e443635cf9a2dbea0d431c34..b107fe0da2988a5bc608f1cca9a4a3c257da73f7 100644 (file)
                                } else {
                                        iconText.htmlText = "<b>No tags set</b><br/><font size='10pt'>Please use the menu below to define what this "+entity.getType()+" is</font>";
                                }
+                               currentCategorySelector.setSelectedFeature(null);
                        }
 
                        // Set it as the popup, and make sure it's visible
              setupAdvanced(selectedEntity);
       }
 
-      /**
-      * When you enter a new tag and press enter, the focus moves to the add button
-      * Adding an event listener to the button and listening for + means that you
-      * can add two consecutive tags with the same keypress. This relies on focus
-      * moving to the "add" button, though, so it's not robust to rearranging the UI.
-      */
-      private function advancedAddButtonKeyboardEvent(event:KeyboardEvent):void {
-          switch (event.keyCode) {
-            case 187:   addNewTag(); break;                          // + - add tag
-            case 107:   addNewTag(); break;                          // numpad plus
-          }
-      }
-
       private var listeningToRelations:Array = [];
 
       private function setupAdvanced(entity:Entity):void {
                if (!advancedTagGrid) advancedContainer.createComponentsFromDescriptors();      // if Flex hasn't created it, force it
                advancedTagGrid.init(entity);
-        advancedAddButton.addEventListener(KeyboardEvent.KEY_DOWN, advancedAddButtonKeyboardEvent, false, 0, true);
-        advancedDeleteButton.addEventListener(KeyboardEvent.KEY_DOWN, advancedAddButtonKeyboardEvent, false, 0, true);
 
                if ( entity == null ) {
                        advancedID.htmlText = "";
                        for each (var entity:Entity in EntityCollection(selectedEntity).entities) {
                                var indexes:Array=relation.findEntityMemberIndexes(entity);
                                for each (var index:int in indexes) {
-                                       relation.setMember(index, new RelationMember(entity,newRole));
+                                       relation.setMember(index, new RelationMember(entity,newRole), MainUndoStack.getGlobalStack().addAction);
                                }
                        }
                } else {
-                       relation.setMember(props['index'], new RelationMember(selectedEntity,newRole));
+                       relation.setMember(props['index'], new RelationMember(selectedEntity,newRole), MainUndoStack.getGlobalStack().addAction);
                }
       }
 
        }
 
       private function tagChanged(event:TagEvent):void {
-             if(selectedEntity != null && selectedEntity is EntityCollection) {
-                       setupMultiAdvanced(selectedEntity);
-                   return;
-                 }
-
           refreshFeatureIcon();
-          // ** FIXME - changing tags on Advanced tab should update simple view
-          // (but putting initialiseEditors here breaks other stuff, because it causes
-          // the Basic pane to be selected)
-
-          // if the advancedTagGrid has already been set up, it needs to be refreshed.
-          // FIXME make this better, maybe advancedTagGrid should be event listening.
-          if(advancedContainer.initialized) {
-            checkAdvanced();
-          }
       }
 
       public function loadFeatures():void {