Index: /ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/TestRunner.mxml
===================================================================
--- /ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/TestRunner.mxml	(revision 241)
+++ /ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/TestRunner.mxml	(revision 242)
@@ -7,4 +7,5 @@
 	<mx:Script>
 		<![CDATA[
+		    import clarin.cmdi.componentregistry.editor.model.CMDSpecTest;
 			import clarin.cmdi.componentregistry.editor.model.CMDAttributeTest;
 			import clarin.cmdi.componentregistry.editor.model.CMDComponentElementTest;
@@ -22,4 +23,5 @@
 				var testSuite:TestSuite = new TestSuite();
 
+				testSuite.addTestSuite(CMDSpecTest);
 				testSuite.addTestSuite(CMDComponentTest);
 				testSuite.addTestSuite(CMDComponentElementTest);
Index: /ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/browser/Browse.mxml
===================================================================
--- /ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/browser/Browse.mxml	(revision 241)
+++ /ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/browser/Browse.mxml	(revision 242)
@@ -24,10 +24,15 @@
 			private var deleteSrv:DeleteService = new DeleteService();
 			[Bindable]
-			private var browseMenu:BrowseContextMenu
+			private var profilesMenu:BrowseContextMenu
+			[Bindable]
+			private var componentsMenu:BrowseContextMenu
 
 			public function init():void {
-			    browseMenu = new BrowseContextMenu();
-				browseMenu.viewStack = this.parent as RegistryViewStack;
-				browseMenu.deleteService = deleteSrv;
+			    profilesMenu = new BrowseContextMenu();
+				profilesMenu.viewStack = this.parent as RegistryViewStack;
+				profilesMenu.deleteService = deleteSrv;
+			    componentsMenu = new BrowseContextMenu();
+				componentsMenu.viewStack = this.parent as RegistryViewStack;
+				componentsMenu.deleteService = deleteSrv;
 				deleteSrv.addEventListener(DeleteService.ITEM_DELETED, handleItemDeleted);
 			}
@@ -52,4 +57,5 @@
 					tabnav.selectedIndex = 1;
 				}
+//				var indeprofilesOverview.browserDataProvider.getItemIndex(desc);
 				//Need to select the correct item, can't get it to highlight at the mo
 				//profilesOverview.dataGrid.selectedIndex=2;
@@ -89,5 +95,5 @@
 											 width="100%"
 											 height="70%"
-											 browseMenu="{browseMenu}"/>
+											 browseMenu="{profilesMenu}"/>
 				<browser:ProfileInfoPage id="profileInfoPage"
 										 profile="{profileSrv.profile}"
@@ -104,5 +110,5 @@
 											 width="100%"
 											 height="50%"
-											 browseMenu="{browseMenu}"/>
+											 browseMenu="{componentsMenu}"/>
 				<browser:ComponentInfoPage id="componentInfoPage"
 										   component="{componentSrv.component}"
Index: /ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/browser/XMLBrowser.as
===================================================================
--- /ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/browser/XMLBrowser.as	(revision 241)
+++ /ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/browser/XMLBrowser.as	(revision 242)
@@ -72,6 +72,6 @@
 			addFormHeading("Header");
 			createAndAddFormChild("Name", spec.headerName);
+			createAndAddFormChild(DESCRIPTION, spec.headerDescription);
 			createAndAddFormChild("Id", spec.headerId);
-			createAndAddFormChild(DESCRIPTION, spec.headerDescription);
 		}
 
Index: /ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/editor/CMDComponentXMLEditor.as
===================================================================
--- /ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/editor/CMDComponentXMLEditor.as	(revision 241)
+++ /ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/editor/CMDComponentXMLEditor.as	(revision 242)
@@ -5,9 +5,10 @@
 	import clarin.cmdi.componentregistry.editor.model.CMDComponent;
 	import clarin.cmdi.componentregistry.editor.model.CMDSpec;
-	
+
 	import flash.display.DisplayObject;
 	import flash.events.Event;
 	import flash.utils.getTimer;
-	
+
+	import mx.binding.utils.BindingUtils;
 	import mx.collections.ArrayCollection;
 	import mx.containers.Form;
@@ -71,10 +72,9 @@
 				addComponent(emptyComp);
 			}
-
 		}
 
 		public function set cmdSpec(cmdSpec:CMDSpec):void {
 			_spec = cmdSpec;
-			createNewBrowser();
+			createNewEditor();
 			dispatchEditorChangeEvent();
 		}
@@ -89,5 +89,5 @@
 		}
 
-		private function createNewBrowser():void {
+		private function createNewEditor():void {
 			var start:int = getTimer();
 			removeAllChildren()
@@ -98,16 +98,28 @@
 
 		private function handleHeader(spec:CMDSpec):void {
+			addChild(new SelectTypeRadioButtons(spec));
+			addChild(createOptionalGroupNameInput(spec));
 			addChild(createHeading());
 			addChild(new FormItemInputLine("Name", spec.headerName, function(val:String):void {
 					spec.headerName = val;
 				}));
-			var idInput:FormItemInputLine =	new FormItemInputLine("Id", spec.headerId, function(val:String):void {
-					spec.headerId = val;
-				}, false);
-			idInput.toolTip="Id will be generated";
-			addChild(idInput);
 			addChild(new FormItemInputText(XMLBrowser.DESCRIPTION, spec.headerDescription, function(val:String):void {
 					spec.headerDescription = val;
 				}));
+			var idInput:FormItemInputLine = new FormItemInputLine("Id", spec.headerId, function(val:String):void {
+					spec.headerId = val;
+				}, false);
+			idInput.toolTip = "Id will be generated";
+			addChild(idInput);
+		}
+
+		private function createOptionalGroupNameInput(spec:CMDSpec):FormItem {
+			var result:FormItem = new FormItemInputLine("Group Name", spec.groupName, function(val:String):void {
+					spec.groupName = val;
+				})
+			BindingUtils.bindSetter(function(val:Boolean):void {
+					result.visible = !val;
+				}, spec, "isProfile");
+			return result;
 		}
 
Index: /ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/editor/Editor.mxml
===================================================================
--- /ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/editor/Editor.mxml	(revision 241)
+++ /ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/editor/Editor.mxml	(revision 242)
@@ -16,10 +16,10 @@
 		<mx:HBox width="100%"
 				 height="40">
-			<mx:Button id="createEmptyProfileBtn"
-					   label="createEmptyProfile"
-					   click="createEmptyProfile()"/>
+			<mx:Button id="clearBtn"
+					   label="clear"
+					   click="clearEditor()"/>
 			<mx:Button id="saveBtn"
 					   label="save"
-					   click="saveProfile()"/>
+					   click="saveSpec()"/>
 		</mx:HBox>
 		<mx:Text id="errorMessageField"
Index: /ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/editor/EditorAS.as
===================================================================
--- /ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/editor/EditorAS.as	(revision 241)
+++ /ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/editor/EditorAS.as	(revision 242)
@@ -60,5 +60,5 @@
 }
 
-public function createEmptyProfile():void {
+public function clearEditor():void {
 	this.cmdSpec = new CMDSpec(true);
 }
@@ -66,12 +66,17 @@
 private var ref:FileReference = new FileReference();
 
-private function saveProfile():void {
-	Alert.show(xmlEditor.cmdSpec.toXml());
+private function saveSpec():void {
+//	Alert.show(xmlEditor.cmdSpec.toXml());
 	var item:ItemDescription = new ItemDescription();
 	item.description = xmlEditor.cmdSpec.headerDescription;
 	item.name = xmlEditor.cmdSpec.headerName;
 	item.isProfile = xmlEditor.cmdSpec.isProfile;
+	item.groupName = xmlEditor.cmdSpec.groupName;
 	uploadService.addEventListener(UploadCompleteEvent.UPLOAD_COMPLETE, handleSaveComplete);
-	uploadService.submitProfile(item, xmlEditor.cmdSpec.toXml());
+	if (item.isProfile) {
+	    uploadService.submitProfile(item, xmlEditor.cmdSpec.toXml());
+	} else {
+	    uploadService.submitComponent(item, xmlEditor.cmdSpec.toXml());
+	}
 }
 
Index: /ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/editor/SelectTypeRadioButtons.as
===================================================================
--- /ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/editor/SelectTypeRadioButtons.as	(revision 242)
+++ /ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/editor/SelectTypeRadioButtons.as	(revision 242)
@@ -0,0 +1,53 @@
+package clarin.cmdi.componentregistry.editor {
+	import clarin.cmdi.componentregistry.common.StyleConstants;
+	import clarin.cmdi.componentregistry.editor.model.CMDSpec;
+	
+	import flash.events.Event;
+	import flash.events.MouseEvent;
+	
+	import mx.containers.FormItem;
+	import mx.containers.FormItemDirection;
+	import mx.controls.ButtonLabelPlacement;
+	import mx.controls.RadioButton;
+	import mx.controls.TextInput;
+
+	public class SelectTypeRadioButtons extends FormItem {
+
+		private var _spec:CMDSpec;
+
+		public function SelectTypeRadioButtons(spec:CMDSpec) {
+			styleName = StyleConstants.XMLBROWSER_FIELD;
+			_spec = spec;
+			direction = FormItemDirection.HORIZONTAL;
+		}
+
+		protected override function createChildren():void {
+			super.createChildren();
+
+			var isProfileButton:RadioButton = new RadioButton();
+			isProfileButton.groupName = "selectType";
+			isProfileButton.label = "Profile";
+			isProfileButton.selected = _spec.isProfile;
+			isProfileButton.labelPlacement = ButtonLabelPlacement.LEFT;
+			isProfileButton.addEventListener(MouseEvent.CLICK, handleIsProfile);
+			addChild(isProfileButton);
+
+			var isComponentButton:RadioButton = new RadioButton();
+			isComponentButton.groupName = "selectType";
+			isComponentButton.label = "Component";
+			isComponentButton.selected = !_spec.isProfile;
+			isComponentButton.labelPlacement = ButtonLabelPlacement.LEFT;
+			isComponentButton.addEventListener(MouseEvent.CLICK, handleIsComponent);
+			addChild(isComponentButton);
+		}
+
+		private function handleIsProfile(event:MouseEvent):void {
+			_spec.isProfile = true;
+		}
+
+		private function handleIsComponent(event:MouseEvent):void {
+			_spec.isProfile = false;
+		}
+
+	}
+}
Index: /ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/editor/model/CMDSpec.as
===================================================================
--- /ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/editor/model/CMDSpec.as	(revision 241)
+++ /ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/editor/model/CMDSpec.as	(revision 242)
@@ -14,4 +14,6 @@
 		public var headerDescription:String;
 		public var cmdComponents:ArrayCollection = new ArrayCollection();
+		
+		public var groupName:String; //Not in xml but stored in the description
 
 		public function CMDSpec(isProfile:Boolean) {
Index: /ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/editor/model/CMDSpecTest.as
===================================================================
--- /ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/editor/model/CMDSpecTest.as	(revision 242)
+++ /ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/editor/model/CMDSpecTest.as	(revision 242)
@@ -0,0 +1,31 @@
+package clarin.cmdi.componentregistry.editor.model {
+	import flexunit.framework.TestCase;
+	import flexunit.framework.TestSuite;
+
+	public class CMDSpecTest extends TestCase {
+		public function CMDSpecTest() {
+			super();
+		}
+
+		public static function suite():TestSuite {
+			return new TestSuite(CMDSpecTest);
+		}
+
+		public function testToXml():void {
+			var comp:CMDSpec = new CMDSpec(true);
+			comp.headerName = "aap";
+			comp.headerDescription = "noot";
+			comp.headerId = "";
+			var expected:XML = <CMD_ComponentSpec isProfile="true">
+					<Header>
+						<ID></ID>
+						<Name>aap</Name>
+						<Description>noot</Description>
+					</Header>
+				</CMD_ComponentSpec>
+
+			assertEquals(expected.toXMLString(), comp.toXml().toXMLString());
+
+		}
+	}
+}
Index: /ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/services/UploadService.as
===================================================================
--- /ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/services/UploadService.as	(revision 241)
+++ /ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/services/UploadService.as	(revision 242)
@@ -2,8 +2,8 @@
 	import clarin.cmdi.componentregistry.common.ItemDescription;
 	import clarin.cmdi.componentregistry.importer.UploadCompleteEvent;
-	
+
 	import com.adobe.net.URI;
 	import com.hurlant.util.Base64;
-	
+
 	import flash.events.DataEvent;
 	import flash.events.ErrorEvent;
@@ -14,9 +14,8 @@
 	import flash.net.FileFilter;
 	import flash.net.FileReference;
-	import flash.net.URLRequest;
 	import flash.net.URLVariables;
-	
+
 	import mx.controls.ProgressBar;
-	
+
 	import org.httpclient.HttpClient;
 	import org.httpclient.events.HttpDataEvent;
@@ -39,5 +38,4 @@
 		private var fileRef:FileReference;
 		private var httpClient:HttpClient;
-		private var request:URLRequest;
 		private var pb:ProgressBar;
 
@@ -46,9 +44,8 @@
 		}
 
-		private function createAndInitRequest(url:String):void {
-			request = new URLRequest(url);
+		private function createAndInitRequest():void {
 			httpClient = new HttpClient();
 			httpClient.listener.onError = httpclientErrorHandler;
-			httpClient.listener.onData = httpclientDataHandler; 
+			httpClient.listener.onData = httpclientDataHandler;
 			httpClient.listener.onComplete = httpclientCompleteHandler;
 		}
@@ -67,7 +64,6 @@
 		 */
 		public function submitProfile(description:ItemDescription, data:String = null):void {
-			createAndInitRequest(Config.instance.uploadProfileUrl);
-			var params:URLVariables = new URLVariables();
-			submit(description, params, data);
+			createAndInitRequest();
+			submit(description, data, new URI(Config.instance.uploadProfileUrl));
 		}
 
@@ -76,8 +72,6 @@
 		 */
 		public function submitComponent(description:ItemDescription, data:String = null):void {
-			createAndInitRequest(Config.instance.uploadComponentUrl);
-			var params:URLVariables = new URLVariables();
-			params.group = description.groupName;
-			submit(description, params, data);
+			createAndInitRequest();
+			submit(description, data, new URI(Config.instance.uploadComponentUrl));
 		}
 
@@ -86,5 +80,5 @@
 		}
 
-		private function submit(description:ItemDescription, params:URLVariables, data:String = null):void {
+		private function submit(description:ItemDescription, data:String, uri:URI):void {
 			message = "";
 			try {
@@ -93,8 +87,8 @@
 					parts.push(new Part("description", description.description));
 					parts.push(new Part("name", description.name));
+					parts.push(new Part("group", description.groupName));
 					parts.push(new Part("data", data, "application/octet-stream", [{name: "filename", value: description.name + ".xml"}]));
 
 					var multipart:Multipart = new Multipart(parts);
-					var uri:URI = new URI(Config.instance.uploadProfileUrl);
 					startUploadHandler();
 					var post:Post = new Post();
@@ -108,9 +102,9 @@
 						//only load if not loaded before otherwise sent the already loaded file. You can only force a reload of the file by selecting it again (it is a flash thingy).
 						fileRef.addEventListener(Event.COMPLETE, function(event:Event):void {
-								submit(description, params, new String(fileRef.data));
+								submit(description, new String(fileRef.data), uri);
 							});
 						fileRef.load();
 					} else {
-						submit(description, params, new String(fileRef.data));
+						submit(description, new String(fileRef.data), uri);
 					}
 				}
@@ -121,5 +115,4 @@
 		}
 
-
 		public function selectXmlFile(event:Event):void {
 			createAndInitFileReference();
@@ -138,5 +131,5 @@
 				addToMessage("Server Failed to handle registration. Unexpected error, try again later. (httpstatus code was: " + event.response.code + ")\n");
 			}
-            httpClient.close();
+			httpClient.close();
 		}
 
