categories of additional tags for roads
[potlatch2.git] / net / systemeD / potlatch2 / TagViewer.mxml
index 064cd25..bdcf17e 100644 (file)
@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <mx:VBox
-       xmlns:mx="http://www.adobe.com/2006/mxml" 
+       xmlns:mx="http://www.adobe.com/2006/mxml"
+       xmlns:flexlib="flexlib.containers.*"
     backgroundColor="white"
     creationComplete="loadFeatures()">
 
@@ -14,7 +15,9 @@
         </mx:VBox>
         <mx:LinkButton label="?" click="openDescription()" id="helpLabel"/>
     </mx:HBox>
-    <mx:VBox width="100%" id="editorBox" paddingLeft="2" paddingRight="2"/>
+    <flexlib:SuperTabNavigator id="editorStack" width="100%" height="100%" paddingLeft="2" paddingRight="2"
+        allowTabSqueezing="false" minTabWidth="10" closePolicy="close_never"
+        scrollSpeed="20"/>
   </mx:VBox>
 
   <mx:VBox width="100%" height="100%" label="Advanced" initialize="checkAdvanced()" verticalGap="1">
       }
 
       private function initialiseEditors():void {
-          editorBox.removeAllChildren();
+          editorStack.removeAllChildren();
           if ( selectedEntity == null || feature == null )
               return;
-              
+          
+          var editorBox:VBox = createEditorBox();
+          editorBox.label = "Basic";
+          editorStack.addChild(editorBox);
+          
+          var tabs:Object = {};
+          
           for each (var factory:EditorFactory in feature.editors) {
-              var editor:DisplayObject = factory.createEditorInstance(selectedEntity);
-              if ( editor != null )
-                 editorBox.addChild(editor);
+              if ( factory.presence.isEditorPresent(factory, selectedEntity, null) ) {
+                  var editor:DisplayObject = factory.createEditorInstance(selectedEntity);
+                  if ( editor != null )
+                      editorBox.addChild(editor);
+              }
+              var category:String = factory.category;
+              var tab:VBox = tabs[category];
+              if ( tab == null ) {
+                  tab = createEditorBox();
+                  tab.label = category;
+                  editorStack.addChild(tab);
+                  tabs[category] = tab;
+              }
+              var catEditor:DisplayObject = factory.createEditorInstance(selectedEntity);
+              if ( catEditor != null )
+                  tab.addChild(catEditor);
           }
       }
       
+      private function createEditorBox():VBox {
+          var box:VBox = new VBox();
+          box.percentWidth = 100;
+          box.percentHeight = 100;
+          return box;
+      }
+
       private function checkAdvanced():void {
           if ( selectedEntity != null )
              setupAdvanced(selectedEntity);