Changeset 242
- Timestamp:
- 03/17/10 16:19:20 (14 years ago)
- Location:
- ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex
- Files:
-
- 2 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/TestRunner.mxml
r224 r242 7 7 <mx:Script> 8 8 <![CDATA[ 9 import clarin.cmdi.componentregistry.editor.model.CMDSpecTest; 9 10 import clarin.cmdi.componentregistry.editor.model.CMDAttributeTest; 10 11 import clarin.cmdi.componentregistry.editor.model.CMDComponentElementTest; … … 22 23 var testSuite:TestSuite = new TestSuite(); 23 24 25 testSuite.addTestSuite(CMDSpecTest); 24 26 testSuite.addTestSuite(CMDComponentTest); 25 27 testSuite.addTestSuite(CMDComponentElementTest); -
ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/browser/Browse.mxml
r206 r242 24 24 private var deleteSrv:DeleteService = new DeleteService(); 25 25 [Bindable] 26 private var browseMenu:BrowseContextMenu 26 private var profilesMenu:BrowseContextMenu 27 [Bindable] 28 private var componentsMenu:BrowseContextMenu 27 29 28 30 public function init():void { 29 browseMenu = new BrowseContextMenu(); 30 browseMenu.viewStack = this.parent as RegistryViewStack; 31 browseMenu.deleteService = deleteSrv; 31 profilesMenu = new BrowseContextMenu(); 32 profilesMenu.viewStack = this.parent as RegistryViewStack; 33 profilesMenu.deleteService = deleteSrv; 34 componentsMenu = new BrowseContextMenu(); 35 componentsMenu.viewStack = this.parent as RegistryViewStack; 36 componentsMenu.deleteService = deleteSrv; 32 37 deleteSrv.addEventListener(DeleteService.ITEM_DELETED, handleItemDeleted); 33 38 } … … 52 57 tabnav.selectedIndex = 1; 53 58 } 59 // var indeprofilesOverview.browserDataProvider.getItemIndex(desc); 54 60 //Need to select the correct item, can't get it to highlight at the mo 55 61 //profilesOverview.dataGrid.selectedIndex=2; … … 89 95 width="100%" 90 96 height="70%" 91 browseMenu="{ browseMenu}"/>97 browseMenu="{profilesMenu}"/> 92 98 <browser:ProfileInfoPage id="profileInfoPage" 93 99 profile="{profileSrv.profile}" … … 104 110 width="100%" 105 111 height="50%" 106 browseMenu="{ browseMenu}"/>112 browseMenu="{componentsMenu}"/> 107 113 <browser:ComponentInfoPage id="componentInfoPage" 108 114 component="{componentSrv.component}" -
ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/browser/XMLBrowser.as
r238 r242 72 72 addFormHeading("Header"); 73 73 createAndAddFormChild("Name", spec.headerName); 74 createAndAddFormChild(DESCRIPTION, spec.headerDescription); 74 75 createAndAddFormChild("Id", spec.headerId); 75 createAndAddFormChild(DESCRIPTION, spec.headerDescription);76 76 } 77 77 -
ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/editor/CMDComponentXMLEditor.as
r238 r242 5 5 import clarin.cmdi.componentregistry.editor.model.CMDComponent; 6 6 import clarin.cmdi.componentregistry.editor.model.CMDSpec; 7 7 8 8 import flash.display.DisplayObject; 9 9 import flash.events.Event; 10 10 import flash.utils.getTimer; 11 11 12 import mx.binding.utils.BindingUtils; 12 13 import mx.collections.ArrayCollection; 13 14 import mx.containers.Form; … … 71 72 addComponent(emptyComp); 72 73 } 73 74 74 } 75 75 76 76 public function set cmdSpec(cmdSpec:CMDSpec):void { 77 77 _spec = cmdSpec; 78 createNew Browser();78 createNewEditor(); 79 79 dispatchEditorChangeEvent(); 80 80 } … … 89 89 } 90 90 91 private function createNew Browser():void {91 private function createNewEditor():void { 92 92 var start:int = getTimer(); 93 93 removeAllChildren() … … 98 98 99 99 private function handleHeader(spec:CMDSpec):void { 100 addChild(new SelectTypeRadioButtons(spec)); 101 addChild(createOptionalGroupNameInput(spec)); 100 102 addChild(createHeading()); 101 103 addChild(new FormItemInputLine("Name", spec.headerName, function(val:String):void { 102 104 spec.headerName = val; 103 105 })); 104 var idInput:FormItemInputLine = new FormItemInputLine("Id", spec.headerId, function(val:String):void {105 spec.headerId = val;106 }, false);107 idInput.toolTip="Id will be generated";108 addChild(idInput);109 106 addChild(new FormItemInputText(XMLBrowser.DESCRIPTION, spec.headerDescription, function(val:String):void { 110 107 spec.headerDescription = val; 111 108 })); 109 var idInput:FormItemInputLine = new FormItemInputLine("Id", spec.headerId, function(val:String):void { 110 spec.headerId = val; 111 }, false); 112 idInput.toolTip = "Id will be generated"; 113 addChild(idInput); 114 } 115 116 private function createOptionalGroupNameInput(spec:CMDSpec):FormItem { 117 var result:FormItem = new FormItemInputLine("Group Name", spec.groupName, function(val:String):void { 118 spec.groupName = val; 119 }) 120 BindingUtils.bindSetter(function(val:Boolean):void { 121 result.visible = !val; 122 }, spec, "isProfile"); 123 return result; 112 124 } 113 125 -
ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/editor/Editor.mxml
r238 r242 16 16 <mx:HBox width="100%" 17 17 height="40"> 18 <mx:Button id="c reateEmptyProfileBtn"19 label="c reateEmptyProfile"20 click="c reateEmptyProfile()"/>18 <mx:Button id="clearBtn" 19 label="clear" 20 click="clearEditor()"/> 21 21 <mx:Button id="saveBtn" 22 22 label="save" 23 click="save Profile()"/>23 click="saveSpec()"/> 24 24 </mx:HBox> 25 25 <mx:Text id="errorMessageField" -
ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/editor/EditorAS.as
r224 r242 60 60 } 61 61 62 public function c reateEmptyProfile():void {62 public function clearEditor():void { 63 63 this.cmdSpec = new CMDSpec(true); 64 64 } … … 66 66 private var ref:FileReference = new FileReference(); 67 67 68 private function save Profile():void {69 Alert.show(xmlEditor.cmdSpec.toXml());68 private function saveSpec():void { 69 // Alert.show(xmlEditor.cmdSpec.toXml()); 70 70 var item:ItemDescription = new ItemDescription(); 71 71 item.description = xmlEditor.cmdSpec.headerDescription; 72 72 item.name = xmlEditor.cmdSpec.headerName; 73 73 item.isProfile = xmlEditor.cmdSpec.isProfile; 74 item.groupName = xmlEditor.cmdSpec.groupName; 74 75 uploadService.addEventListener(UploadCompleteEvent.UPLOAD_COMPLETE, handleSaveComplete); 75 uploadService.submitProfile(item, xmlEditor.cmdSpec.toXml()); 76 if (item.isProfile) { 77 uploadService.submitProfile(item, xmlEditor.cmdSpec.toXml()); 78 } else { 79 uploadService.submitComponent(item, xmlEditor.cmdSpec.toXml()); 80 } 76 81 } 77 82 -
ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/editor/model/CMDSpec.as
r206 r242 14 14 public var headerDescription:String; 15 15 public var cmdComponents:ArrayCollection = new ArrayCollection(); 16 17 public var groupName:String; //Not in xml but stored in the description 16 18 17 19 public function CMDSpec(isProfile:Boolean) { -
ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/services/UploadService.as
r238 r242 2 2 import clarin.cmdi.componentregistry.common.ItemDescription; 3 3 import clarin.cmdi.componentregistry.importer.UploadCompleteEvent; 4 4 5 5 import com.adobe.net.URI; 6 6 import com.hurlant.util.Base64; 7 7 8 8 import flash.events.DataEvent; 9 9 import flash.events.ErrorEvent; … … 14 14 import flash.net.FileFilter; 15 15 import flash.net.FileReference; 16 import flash.net.URLRequest;17 16 import flash.net.URLVariables; 18 17 19 18 import mx.controls.ProgressBar; 20 19 21 20 import org.httpclient.HttpClient; 22 21 import org.httpclient.events.HttpDataEvent; … … 39 38 private var fileRef:FileReference; 40 39 private var httpClient:HttpClient; 41 private var request:URLRequest;42 40 private var pb:ProgressBar; 43 41 … … 46 44 } 47 45 48 private function createAndInitRequest(url:String):void { 49 request = new URLRequest(url); 46 private function createAndInitRequest():void { 50 47 httpClient = new HttpClient(); 51 48 httpClient.listener.onError = httpclientErrorHandler; 52 httpClient.listener.onData = httpclientDataHandler; 49 httpClient.listener.onData = httpclientDataHandler; 53 50 httpClient.listener.onComplete = httpclientCompleteHandler; 54 51 } … … 67 64 */ 68 65 public function submitProfile(description:ItemDescription, data:String = null):void { 69 createAndInitRequest(Config.instance.uploadProfileUrl); 70 var params:URLVariables = new URLVariables(); 71 submit(description, params, data); 66 createAndInitRequest(); 67 submit(description, data, new URI(Config.instance.uploadProfileUrl)); 72 68 } 73 69 … … 76 72 */ 77 73 public function submitComponent(description:ItemDescription, data:String = null):void { 78 createAndInitRequest(Config.instance.uploadComponentUrl); 79 var params:URLVariables = new URLVariables(); 80 params.group = description.groupName; 81 submit(description, params, data); 74 createAndInitRequest(); 75 submit(description, data, new URI(Config.instance.uploadComponentUrl)); 82 76 } 83 77 … … 86 80 } 87 81 88 private function submit(description:ItemDescription, params:URLVariables, data:String = null):void {82 private function submit(description:ItemDescription, data:String, uri:URI):void { 89 83 message = ""; 90 84 try { … … 93 87 parts.push(new Part("description", description.description)); 94 88 parts.push(new Part("name", description.name)); 89 parts.push(new Part("group", description.groupName)); 95 90 parts.push(new Part("data", data, "application/octet-stream", [{name: "filename", value: description.name + ".xml"}])); 96 91 97 92 var multipart:Multipart = new Multipart(parts); 98 var uri:URI = new URI(Config.instance.uploadProfileUrl);99 93 startUploadHandler(); 100 94 var post:Post = new Post(); … … 108 102 //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). 109 103 fileRef.addEventListener(Event.COMPLETE, function(event:Event):void { 110 submit(description, params, new String(fileRef.data));104 submit(description, new String(fileRef.data), uri); 111 105 }); 112 106 fileRef.load(); 113 107 } else { 114 submit(description, params, new String(fileRef.data));108 submit(description, new String(fileRef.data), uri); 115 109 } 116 110 } … … 121 115 } 122 116 123 124 117 public function selectXmlFile(event:Event):void { 125 118 createAndInitFileReference(); … … 138 131 addToMessage("Server Failed to handle registration. Unexpected error, try again later. (httpstatus code was: " + event.response.code + ")\n"); 139 132 } 140 133 httpClient.close(); 141 134 } 142 135
Note: See TracChangeset
for help on using the changeset viewer.