Changeset 206
- Timestamp:
- 03/03/10 12:01:16 (14 years ago)
- Location:
- ComponentRegistry/trunk/ComponentBrowserGui
- Files:
-
- 19 added
- 2 deleted
- 18 edited
- 1 copied
- 3 moved
Legend:
- Unmodified
- Added
- Removed
-
ComponentRegistry/trunk/ComponentBrowserGui/pom.xml
r168 r206 11 11 <properties> 12 12 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 13 <targetPlayer>10.0.0</targetPlayer> 13 14 </properties> 14 15 … … 17 18 <groupId>com.adobe.flex.framework</groupId> 18 19 <artifactId>flex-framework</artifactId> 19 <version>3. 2.0.3958</version>20 <version>3.5.0.12683</version> 20 21 <type>pom</type> 22 <exclusions> 23 <exclusion> 24 <groupId>com.adobe.flex.framework</groupId> 25 <artifactId>playerglobal</artifactId> 26 </exclusion> 27 </exclusions> 21 28 </dependency> 29 <dependency> 30 <groupId>com.adobe.flex.framework</groupId> 31 <artifactId>playerglobal</artifactId> 32 <version>3.5.0.12683</version> 33 <classifier>10</classifier> 34 <type>swc</type> 35 </dependency> 36 <dependency> 37 <groupId>org.httpclient</groupId> 38 <artifactId>as3httpclientlib</artifactId> 39 <version>1.0.6</version> 40 <type>swc</type> 41 </dependency> 42 <dependency> 43 <groupId>com.adobe</groupId> 44 <artifactId>as3corelib</artifactId> 45 <version>0.92.1</version> 46 <type>swc</type> 47 </dependency> 48 <dependency> 49 <groupId>com.hurlant</groupId> 50 <artifactId>as3crypto</artifactId> 51 <version>1.3</version> 52 <type>swc</type> 53 </dependency> 22 54 </dependencies> 23 55 … … 28 60 <groupId>org.sonatype.flexmojos</groupId> 29 61 <artifactId>flexmojos-maven-plugin</artifactId> 62 <version>3.5.0</version> 30 63 <extensions>true</extensions> 31 64 <configuration> 32 65 <debug>true</debug> 33 66 </configuration> 67 <dependencies> 68 <dependency> 69 <groupId>com.adobe.flex</groupId> 70 <artifactId>compiler</artifactId> 71 <version>3.5.0.12683</version> 72 <type>pom</type> 73 </dependency> 74 </dependencies> 34 75 </plugin> 35 76 </plugins> -
ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/browser/Browse.mxml
r134 r206 3 3 xmlns:local="clarin.cmdi.componentregistry.services.*" 4 4 xmlns:browser="clarin.cmdi.componentregistry.browser.*" 5 initialize="init()" 5 6 creationComplete="refresh()" 6 7 width="100%" 7 8 height="100%" 8 label="Browse..." 9 > 9 label="Browse..."> 10 10 11 11 <mx:Script> 12 12 <![CDATA[ 13 import clarin.cmdi.componentregistry.services.ComponentListService; 13 import clarin.cmdi.componentregistry.common.components.RegistryViewStack; 14 import clarin.cmdi.componentregistry.common.components.BrowseContextMenu; 15 import clarin.cmdi.componentregistry.services.DeleteService; 16 import clarin.cmdi.componentregistry.services.ComponentListService; 14 17 import clarin.cmdi.componentregistry.common.ItemDescription; 15 18 import mx.controls.Alert; 16 19 import clarin.cmdi.componentregistry.browser.BrowserSelectionEvent; 17 20 import clarin.cmdi.componentregistry.common.Profile; 18 21 19 22 [Bindable] 20 23 private var componentsSrv:ComponentListService = ComponentListService.instance; 24 private var deleteSrv:DeleteService = new DeleteService(); 25 [Bindable] 26 private var browseMenu:BrowseContextMenu 27 28 public function init():void { 29 browseMenu = new BrowseContextMenu(); 30 browseMenu.viewStack = this.parent as RegistryViewStack; 31 browseMenu.deleteService = deleteSrv; 32 deleteSrv.addEventListener(DeleteService.ITEM_DELETED, handleItemDeleted); 33 } 21 34 22 35 public function refresh():void { … … 34 47 35 48 public function setSelectedDescription(desc:ItemDescription):void { 36 if (desc.isProfile) { 37 tabnav.selectedIndex = 0; 38 } else { 39 tabnav.selectedIndex = 1; 40 } 41 //Need to select the correct item, can't get it to highlight at the mo 42 //profilesOverview.dataGrid.selectedIndex=2; 43 //profilesOverview.dataGrid.validateNow(); 44 //profilesOverview.dataGrid.scrollToIndex(2); 49 if (desc.isProfile) { 50 tabnav.selectedIndex = 0; 51 } else { 52 tabnav.selectedIndex = 1; 53 } 54 //Need to select the correct item, can't get it to highlight at the mo 55 //profilesOverview.dataGrid.selectedIndex=2; 56 //profilesOverview.dataGrid.validateNow(); 57 //profilesOverview.dataGrid.scrollToIndex(2); 58 } 59 60 private function handleItemDeleted(event:Event):void { 61 refresh(); 45 62 } 46 63 ]]> … … 62 79 height="100%" 63 80 color="0x323232" 64 y="59" borderStyle="outset"> 81 y="59" 82 borderStyle="outset"> 65 83 <mx:VDividedBox label="Profiles" 66 84 width="100%"> 67 85 <browser:BrowserOverviewList id="profilesOverview" 68 browserDataProvider="{profilesSrv.itemDescriptions}" 69 browserItemSelected="{loadProfileInfoPage(event)}" 70 browserColumns="{browserColumns.getProfileColumns()}" 71 width="100%" 72 height="70%"/> 86 browserDataProvider="{profilesSrv.itemDescriptions}" 87 browserItemSelected="{loadProfileInfoPage(event)}" 88 browserColumns="{browserColumns.getProfileColumns()}" 89 width="100%" 90 height="70%" 91 browseMenu="{browseMenu}"/> 73 92 <browser:ProfileInfoPage id="profileInfoPage" 74 75 76 93 profile="{profileSrv.profile}" 94 width="100%" 95 height="50%"/> 77 96 </mx:VDividedBox> 78 97 … … 80 99 width="100%"> 81 100 <browser:BrowserOverviewList id="componentsOverview" 82 browserDataProvider="{componentsSrv.itemDescriptions}" 83 browserItemSelected="{loadComponentInfoPage(event)}" 84 browserColumns="{browserColumns.getComponentColumns()}" 85 width="100%" 86 height="50%"/> 101 browserDataProvider="{componentsSrv.itemDescriptions}" 102 browserItemSelected="{loadComponentInfoPage(event)}" 103 browserColumns="{browserColumns.getComponentColumns()}" 104 width="100%" 105 height="50%" 106 browseMenu="{browseMenu}"/> 87 107 <browser:ComponentInfoPage id="componentInfoPage" 88 component="{componentSrv.component}"89 width="100%"90 height="50%"/>108 component="{componentSrv.component}" 109 width="100%" 110 height="50%"/> 91 111 92 112 </mx:VDividedBox> -
ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/browser/BrowserOverviewList.mxml
r161 r206 16 16 <mx:Script> 17 17 <![CDATA[ 18 import clarin.cmdi.componentregistry.common.components.BrowseContextMenu; 18 19 import mx.collections.ArrayCollection; 19 20 import mx.events.CollectionEvent; … … 22 23 23 24 private var currentSelectedItem:ItemDescription; 24 25 [Bindable] 26 private var menu:BrowseContextMenu; 25 27 26 28 private function dispatchBrowserSelectionEvent():void { … … 34 36 } 35 37 } 38 39 public function set browseMenu(browseMenu:BrowseContextMenu):void { 40 this.menu = browseMenu; 41 menu.dataGrid= dataGrid; 42 } 43 44 private function handleKeyUp(event:KeyboardEvent):void { 45 if (event.keyCode == Keyboard.DELETE) { 46 menu.deleteSelectedItems(); 47 } 48 } 36 49 ]]> 37 50 </mx:Script> 38 51 39 <comp:DownloadMenu id="menu"40 dataGrid="{dataGrid}" viewStack="{this.parentApplication.viewStack}"/>41 52 <mx:HBox horizontalAlign="center" 42 53 verticalAlign="middle" … … 47 58 48 59 <comp:FilteringDataGrid id="dataGrid" 49 50 51 52 53 click="{dispatchBrowserSelectionEvent()}"54 55 56 57 allowMultipleSelection="false"58 59 >60 x="0" 61 y="112" 62 width="100%" 63 height="100%" 64 click="dispatchBrowserSelectionEvent()" 65 dataProvider="{browserDataProvider}" 66 columns="{browserColumns}" 67 contextMenu="{menu.cm}" 68 allowMultipleSelection="true" 69 searchInput="{searchBox}" 70 keyUp="handleKeyUp(event)"> 60 71 </comp:FilteringDataGrid> 61 72 </mx:VBox> -
ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/browser/infoPage.mxml
r161 r206 10 10 verticalAlign="middle" 11 11 width="100%"> 12 <mx:Label id="header" 12 <mx:Label id="header" 13 13 text="{headerLabel}" 14 14 fontWeight="bold" -
ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/browser/xmlBrowsePanel.mxml
r161 r206 2 2 <mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" 3 3 xmlns:comp="clarin.cmdi.componentregistry.common.components.*" > 4 5 <mx:Script> 6 <![CDATA[ 7 // seting focus manually when a user clicks, this is the best I can do at the moment. 8 //A form handles focus differently then for instance a list or a TextArea so scrolling using keys is a bit inconsistent among the different view at the moment. 9 private function setFocusOnClick(event:MouseEvent):void { 10 setFocus(); 11 } 12 ]]> 13 </mx:Script> 4 <mx:Script> 5 <![CDATA[ 6 import clarin.cmdi.componentregistry.editor.model.CMDModelFactory; 7 ]]> 8 </mx:Script> 14 9 15 10 <mx:XML id="cmdComponent"/> 16 11 <comp:CMDComponentXMLBrowser id="xmlBrowse" 17 xml="{cmdComponent}"12 cmdSpec="{CMDModelFactory.createModel(cmdComponent)}" 18 13 width="100%" 19 14 height="100%" 20 click="setFocusOnClick(event);"21 15 /> 22 16 </mx:Canvas> -
ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/common/ComponentMD.as
r134 r206 20 20 public static const ATTRIBUTE:String = "Attribute"; 21 21 public static const ATTRIBUTE_LIST:String = "AttributeList"; 22 public static const DESCRIPTION:String = "Description"; 22 23 //Attribute Names 23 24 public static const APP_INFO:String = "AppInfo"; … … 25 26 26 27 public var name:String; 27 public var attributeList:XMLList;28 public var cmdElements:Array = new Array();29 28 30 29 … … 42 41 } 43 42 } 44 43 45 44 } -
ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/common/Profile.as
r120 r206 6 6 7 7 public var description:ItemDescription; 8 public var components:ArrayCollection; 8 public var components:ArrayCollection;//ComponentMD 9 9 public var nrOfComponents:int; 10 10 public var profileSource:XML; -
ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/common/StyleConstants.as
r161 r206 7 7 public static const XMLBROWSER_FIELD_VALUE:String = "xmlBrowserValueLabel"; 8 8 public static const XMLBROWSER_HEADER:String = "xmlBrowserHeader"; 9 public static const XMLBROWSER_HEADER_ CMD_ELEMENT:String = "xmlBrowserHeaderCmdelement";9 public static const XMLBROWSER_HEADER_SMALL:String = "xmlBrowserHeaderSmall"; 10 10 public static const XMLEDITOR_EDIT_FIELD:String = "xmlEditorFieldEditField"; 11 11 public static const EXPANDING_COMPONENT:String = "borderStyles"; -
ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/common/components/BrowseContextMenu.as
r121 r206 1 1 package clarin.cmdi.componentregistry.common.components { 2 2 import clarin.cmdi.componentregistry.common.ItemDescription; 3 import clarin.cmdi.componentregistry. common.components.RegistryViewStack;3 import clarin.cmdi.componentregistry.services.DeleteService; 4 4 5 5 import flash.events.ContextMenuEvent; 6 import flash.events.Event; 6 7 import flash.events.MouseEvent; 7 8 import flash.ui.ContextMenu; 8 9 import flash.ui.ContextMenuItem; 9 10 11 import mx.controls.Alert; 10 12 import mx.controls.DataGrid; 11 13 import mx.events.ListEvent; 12 14 13 15 14 public class DownloadMenu {16 public class BrowseContextMenu { 15 17 16 18 [Bindable] … … 19 21 [Bindable] 20 22 public var viewStack:RegistryViewStack; 23 [Bindable] 24 public var deleteService:DeleteService; 21 25 22 26 [Bindable] … … 26 30 private var saveItemDialog:SaveItemDialog = new SaveItemDialog(); 27 31 28 public function DownloadMenu() {32 public function BrowseContextMenu() { 29 33 cm = new ContextMenu(); 30 34 cm.hideBuiltInItems(); … … 43 47 cmi = new ContextMenuItem("Create New Profile..."); 44 48 cmi.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, createNewProfile); 49 result.push(cmi); 50 cmi = new ContextMenuItem("Delete..."); 51 cmi.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, handleDelete); 45 52 result.push(cmi); 46 53 … … 77 84 } 78 85 86 private function handleDelete(event:ContextMenuEvent):void { 87 deleteSelectedItems(); 88 } 89 90 public function deleteSelectedItems():void { 91 for each (var item:ItemDescription in _dataGrid.selectedItems) { 92 deleteService.deleteItem(item); 93 } 94 } 95 79 96 } 80 97 } -
ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/common/components/CMDComponentXMLBrowser.as
r134 r206 5 5 import flash.display.DisplayObject; 6 6 7 import mx.co ntainers.FormItem;7 import mx.collections.XMLListCollection; 8 8 import mx.controls.ComboBox; 9 9 … … 15 15 16 16 public function CMDComponentXMLBrowser() { 17 super(); 17 18 styleName = StyleConstants.XMLBROWSER; 18 19 } 19 20 20 protected override function handleCMDAttributeList(atributeList:XML):void { 21 for each (var cmdAttribute:XML in atributeList.descendants(ComponentMD.ATTRIBUTE)) { 22 handleCMDAttributes(cmdAttribute.elements()); 23 } 24 } 25 26 private function handleCMDAttributes(cmdAttribute:XMLList):void { 27 var name:FormItem = createFormItem(cmdAttribute[0].name(), cmdAttribute[0].text()); //The name 28 addFormChild(name); 29 var item:FormItem = createFormItem(cmdAttribute[1].name(), cmdAttribute[1].text(), cmdAttribute[1]); //type or valueScheme 30 addFormChild(item); 31 } 32 33 protected override function createFormItemFieldValue(name:String, value:String, xmlElement:XML = null):DisplayObject { 34 if (name == ComponentMD.CONCEPTLINK) { 21 protected override function createFormItemFieldValue(name:String, value:String):DisplayObject { 22 if (name == CONCEPTLINK) { 35 23 return createConceptLinkLabel(value); 36 } else if (name == C omponentMD.COMPONENTID) {24 } else if (name == COMPONENT_ID) { 37 25 return createComponentIdLabel(value); 38 } else if (name == ComponentMD.VALUE_SCHEME && xmlElement != null) {39 if (xmlElement.hasOwnProperty(ComponentMD.ENUMERATION)) {40 return createEnumeration(xmlElement.elements(ComponentMD.ENUMERATION));41 } else {42 return super.createFormItemFieldValue(name, xmlElement.elements(ComponentMD.PATTERN)[0].text());43 }44 26 } else { 45 27 return super.createFormItemFieldValue(name, value); … … 60 42 } 61 43 62 63 private function createEnumeration(enumeration:XMLList):DisplayObject {64 var result:ComboBox = new ComboBox();65 result.dataProvider = enumeration.item;66 result.labelFunction = function(item:Object):String {67 var xmlItem:XML = item as XML;68 if (item..hasOwnProperty("@" + ComponentMD.APP_INFO)) {69 return xmlItem.attribute(ComponentMD.APP_INFO) + " - " + xmlItem.text();70 } else {71 return xmlItem.text();72 }73 };74 return result;75 }76 77 44 } 78 45 } -
ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/common/components/CMDComponentXMLEditor.as
r134 r206 1 1 package clarin.cmdi.componentregistry.common.components { 2 import clarin.cmdi.componentregistry.common.ComponentMD; 2 import clarin.cmdi.componentregistry.editor.CMDSpecRenderer; 3 import clarin.cmdi.componentregistry.common.ItemDescription; 3 4 import clarin.cmdi.componentregistry.common.StyleConstants; 5 import clarin.cmdi.componentregistry.editor.ComponentEdit; 6 import clarin.cmdi.componentregistry.editor.FormItemInputLine; 7 import clarin.cmdi.componentregistry.editor.FormItemInputText; 8 import clarin.cmdi.componentregistry.editor.model.CMDComponent; 9 import clarin.cmdi.componentregistry.editor.model.CMDSpec; 4 10 5 11 import flash.display.DisplayObject; 12 import flash.events.Event; 13 import flash.events.MouseEvent; 14 import flash.utils.getTimer; 6 15 16 import mx.collections.ArrayCollection; 17 import mx.containers.Form; 7 18 import mx.containers.FormItem; 8 9 public class CMDComponentXMLEditor extends XMLBrowser { 10 19 import mx.controls.Button; 20 import mx.core.Container; 21 import mx.core.UIComponent; 22 import mx.events.ChildExistenceChangedEvent; 23 import mx.events.DragEvent; 24 import mx.managers.DragManager; 25 import mx.managers.IFocusManagerComponent; 26 27 [Event(name="editorChange", type="flash.events.Event")] 28 public class CMDComponentXMLEditor extends Form implements IFocusManagerComponent, CMDSpecRenderer { 29 30 public static const EDITOR_CHANGE_EVENT:String = "editorChange"; 31 private var _spec:CMDSpec; 11 32 12 33 public function CMDComponentXMLEditor() { 34 super(); 35 focusEnabled = true; 36 tabEnabled = true; 13 37 styleName = StyleConstants.XMLBROWSER; 14 } 15 16 protected override function createFormItem(name:String, value:String = null, xmlElement:XML = null):FormItem { 17 var component:FormItem; 18 if (name == ComponentMD.COMPONENTID) { 19 component = createComponentIdLabel(name, value); 38 addEventListener(DragEvent.DRAG_ENTER, dragEnterHandler); 39 addEventListener(DragEvent.DRAG_OVER, dragOverHandler); 40 addEventListener(DragEvent.DRAG_DROP, dragDropHandler); 41 addEventListener(ChildExistenceChangedEvent.CHILD_ADD, dispatchEditorChangeEvent); 42 addEventListener(ChildExistenceChangedEvent.CHILD_REMOVE, dispatchEditorChangeEvent); 43 } 44 45 private function dragEnterHandler(event:DragEvent):void { 46 DragManager.acceptDragDrop(event.currentTarget as UIComponent); 47 UIComponent(event.currentTarget).drawFocus(true); 48 } 49 50 private function dragOverHandler(event:DragEvent):void { 51 if (event.dragSource.hasFormat("items")) { 52 DragManager.showFeedback(DragManager.COPY); 53 } 54 } 55 56 private function dragDropHandler(event:DragEvent):void { 57 var items:Array = event.dragSource.dataForFormat("items") as Array; 58 for each (var item:ItemDescription in items) { 59 var comp:CMDComponent = new CMDComponent(); 60 comp.componentId = item.id; 61 _spec.cmdComponents.addItem(comp); 62 addComponent(comp); 63 } 64 } 65 66 public function set cmdSpec(cmdSpec:CMDSpec):void { 67 _spec = cmdSpec; 68 createNewBrowser(); 69 dispatchEditorChangeEvent(); 70 } 71 72 private function dispatchEditorChangeEvent(event:Event=null):void { 73 dispatchEvent(new Event(EDITOR_CHANGE_EVENT)); 74 } 75 76 [Bindable] 77 public function get cmdSpec():CMDSpec { 78 return _spec; 79 } 80 81 private function createNewBrowser():void { 82 var start:int = getTimer(); 83 removeAllChildren() 84 handleHeader(_spec); 85 handleComponents(_spec.cmdComponents); 86 trace("Created browser2 view in " + (getTimer() - start) + " ms."); 87 } 88 89 private function handleHeader(spec:CMDSpec):void { 90 addChild(createHeading()); 91 addChild(new FormItemInputLine("Name", spec.headerName, function(val:String):void { 92 spec.headerName = val; 93 })); 94 addChild(new FormItemInputLine("Id", spec.headerId, function(val:String):void { 95 spec.headerId = val; 96 })); 97 addChild(new FormItemInputText(XMLBrowser.DESCRIPTION, spec.headerDescription, function(val:String):void { 98 spec.headerDescription = val; 99 })); 100 } 101 102 private function createHeading():FormItem { 103 var heading:FormItem = new FormItem(); 104 heading.label = "Header"; 105 heading.styleName = StyleConstants.XMLBROWSER_HEADER; 106 return heading; 107 } 108 109 private function handleComponents(components:ArrayCollection):void { 110 for each (var component:CMDComponent in components) { 111 addComponent(component); 112 } 113 var btn:Button = new Button(); 114 btn.label = "add Component"; 115 btn.addEventListener(MouseEvent.CLICK, handleAddComponentClick); 116 btn.addEventListener(MouseEvent.MOUSE_OVER, function(event:MouseEvent):void {drawFocus(true);}); 117 btn.addEventListener(MouseEvent.MOUSE_OUT, function(event:MouseEvent):void {drawFocus(false);}); 118 addChild(btn); 119 } 120 121 private function handleAddComponentClick(event:MouseEvent):void { 122 var comp:CMDComponent = new CMDComponent(); 123 _spec.cmdComponents.addItem(comp); 124 var index:int = getChildIndex(event.currentTarget as DisplayObject); 125 addComponent(comp, index); 126 } 127 128 129 130 public function addComponent(component:CMDComponent, index:int=-1):void { 131 var comp:Container = new ComponentEdit(component, this); 132 comp.addEventListener(ComponentEdit.REMOVE_COMPONENT_EVENT, removeComponent); 133 if (index == -1) { 134 addChild(comp); 20 135 } else { 21 component = createDefaultEditField(name, value, xmlElement); 22 } 23 return component; 24 } 25 26 27 private function createDefaultEditField(name:String, value:String, xmlElement:XML):FormItem { 28 var field:XMLEditorField = new XMLEditorField(xmlElement, name); 29 field.label = name; 30 field.styleName = StyleConstants.XMLBROWSER_FIELD; 31 field.editField = value; 32 return field; 33 } 34 35 private function createComponentIdLabel(name:String, value:String):FormItem { 36 var fi:FormItem = new FormItem(); 37 fi.label = name; 38 fi.styleName = StyleConstants.XMLBROWSER_FIELD; 39 var componentLabel:ExpandingComponentLabel = new ExpandingComponentLabel(value, true); 40 fi.addChild(componentLabel); 41 return fi; 42 } 43 136 addChildAt(comp, index); 137 } 138 } 139 140 private function removeComponent(event:Event):void { 141 var comp:CMDComponent = ComponentEdit(event.currentTarget).component; 142 _spec.removeComponent(comp); 143 removeChild(event.currentTarget as DisplayObject); 144 } 145 146 // protected override function createFormHeading(name:String):UIComponent { 147 // var heading:UIComponent = super.createFormHeading(name); 148 // if (name == COMPONENT) { 149 // var editBar:HBox = new HBox(); 150 // editBar.addChild(heading); 151 // editBar.percentWidth = 100; 152 // var spacer:Spacer = new Spacer(); 153 // spacer.percentWidth = 90; 154 // editBar.addChild(spacer); 155 // var removeButton:Button = new Button(); 156 // removeButton.height = 20; 157 // removeButton.label = "X"; 158 // removeButton.addEventListener(MouseEvent.CLICK, removeComponent); 159 // editBar.addChild(removeButton); 160 // return editBar; 161 // } else { 162 // return heading; 163 // } 164 // } 165 // 166 // protected override function createAndAddFormChild(name:String, value:String, bindingFunction:Function = null):void { 167 // addFormChild(createFormItem(name, value, bindingFunction)); //Always add all children so they can be edited 168 // } 169 // 170 // private function removeComponent(event:MouseEvent):void { 171 // Alert.show("Fire remove!"); 172 // } 173 // 174 // protected override function createFormItemFieldValue(name:String, value:String, bindingFunction:Function = null):DisplayObject { 175 // if (name == COMPONENT_ID) { 176 // return createComponentIdLabel(value); 177 // } else { 178 // return createDefaultEditField(name, value, bindingFunction); 179 // } 180 // } 181 // 182 // private function createDefaultEditField(name:String, value:String, bindingFunction:Function = null):UIComponent { 183 // var result:UIComponent; 184 // if (name == DESCRIPTION) { 185 // var editArea:TextArea = new TextArea(); 186 // editArea.text = value; 187 // editArea.styleName = StyleConstants.XMLEDITOR_EDIT_FIELD; 188 // editArea.width = 400; 189 // result = editArea; 190 // } else { 191 // var editField:TextInput = new TextInput(); 192 // editField.text = value; 193 // editField.styleName = StyleConstants.XMLEDITOR_EDIT_FIELD; 194 // editField.width = 400; 195 // result = editField; 196 // BindingUtils.bindSetter(bindingFunction, editField, "text"); 197 // } 198 // return result; 199 // } 200 // 201 // private function createComponentIdLabel(value:String):ExpandingComponentLabel { 202 // var componentLabel:ExpandingComponentLabel = new ExpandingComponentLabel(value, true); 203 // return componentLabel; 204 // } 205 // 44 206 } 45 207 -
ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/common/components/ExpandingComponentLabel.as
r161 r206 1 1 package clarin.cmdi.componentregistry.common.components { 2 import clarin.cmdi.componentregistry.editor.CMDSpecRenderer; 2 3 import clarin.cmdi.componentregistry.common.Component; 3 4 import clarin.cmdi.componentregistry.common.ItemDescription; 4 5 import clarin.cmdi.componentregistry.common.StyleConstants; 6 import clarin.cmdi.componentregistry.editor.model.CMDModelFactory; 5 7 import clarin.cmdi.componentregistry.services.ComponentInfoService; 6 8 import clarin.cmdi.componentregistry.services.ComponentListService; … … 27 29 super(); 28 30 this.editable = editable; 31 this.componentId = componentId; 32 styleName = StyleConstants.EXPANDING_COMPONENT; 33 } 34 35 protected override function createChildren():void { 36 super.createChildren(); 29 37 var id:Label = new Label(); 30 38 id.text = componentId; 31 this.componentId = componentId;32 addChild(id);33 39 id.addEventListener(MouseEvent.CLICK, handleClick); 34 40 id.addEventListener(MouseEvent.MOUSE_OVER, mouseOver); 35 41 id.addEventListener(MouseEvent.MOUSE_OUT, mouseOut); 36 styleName = StyleConstants.EXPANDING_COMPONENT;42 addChild(id); 37 43 } 38 44 39 45 private function handleClick(event:MouseEvent):void { 40 46 if (isExpanded) { … … 48 54 49 55 private function unexpand():void { 50 51 56 if (expanded != null) { 57 removeChild(expanded); 52 58 } 53 59 } … … 56 62 var item:ItemDescription = ComponentListService.instance.lookUpDescription(componentId); 57 63 if (item != null) { 58 59 64 componentSrv.addEventListener(ComponentInfoService.COMPONENT_LOADED, handleComponentLoaded); 65 componentSrv.load(item); 60 66 } else { 61 67 Alert.show("Error: component cannot be found"); 62 68 } 63 69 } … … 65 71 private function handleComponentLoaded(event:Event):void { 66 72 var comp:Component = componentSrv.component; 67 var expandedComponent:XMLBrowser;68 73 if (editable) { 69 expanded Component= new CMDComponentXMLEditor();74 expanded = new CMDComponentXMLEditor(); 70 75 } else { 71 expanded Component= new CMDComponentXMLBrowser();76 expanded = new CMDComponentXMLBrowser(); 72 77 } 73 expandedComponent.xml = comp.componentMD.xml; 74 expanded = expandedComponent; 78 (expanded as CMDSpecRenderer).cmdSpec = CMDModelFactory.createModel(comp.componentMD.xml); 75 79 addChild(expanded); 76 80 isExpanded = true; -
ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/common/components/RegistryViewStack.as
r134 r206 4 4 import clarin.cmdi.componentregistry.common.Login; 5 5 import clarin.cmdi.componentregistry.editor.Editor; 6 import clarin.cmdi.componentregistry. register.Register;7 6 import clarin.cmdi.componentregistry.importer.Importer; 7 8 8 import flash.display.DisplayObject; 9 9 import flash.events.Event; 10 10 11 11 import mx.containers.ViewStack; 12 import mx.events.FlexEvent;13 12 14 13 public class RegistryViewStack extends ViewStack { 15 14 private var browse:Browse = new Browse(); 16 private var register:Register = new Register();15 private var importer:Importer = new Importer(); 17 16 private var editor:Editor = new Editor(); 18 17 … … 26 25 addChild(browse); //everyone can browse 27 26 28 register.addEventListener(FlexEvent.SHOW, checkLogin);29 addChild( register);27 //register.addEventListener(FlexEvent.SHOW, checkLogin); 28 addChild(importer); 30 29 31 editor.addEventListener(FlexEvent.SHOW, checkLogin);30 // editor.addEventListener(FlexEvent.SHOW, checkLogin); 32 31 addChild(editor); 33 32 } -
ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/editor/Editor.mxml
r134 r206 7 7 height="100%" 8 8 label="Editor..." 9 creationComplete=" {init();}">9 creationComplete="init()"> 10 10 11 11 <mx:Script source="EditorAS.as"/> … … 19 19 label="createEmptyProfile" 20 20 click="createEmptyProfile()"/> 21 <mx:Button id="saveBtn" 22 label="save" 23 click="saveProfile()"/> 21 24 </mx:HBox> 25 <mx:Text id="errorMessageField" 26 text="{uploadService.message}" visible='{uploadService.message != ""}' includeInLayout='{uploadService.message != ""}' /> 27 <mx:ProgressBar id="uploadProgress" 28 label="" 29 mode="manual" 30 visible="false" 31 includeInLayout="false"/> 22 32 23 <mx: HBox width="100%"33 <mx:VBox width="100%" 24 34 height="80%"> 25 35 <comp:CMDComponentXMLEditor id="xmlEditor" 26 xml="{cmdComponent}"36 cmdSpec="{cmdSpec}" 27 37 width="50%" 28 dragEnter="{dragEnterHandler(event)}" 29 dragOver="{dragOverHandler(event)}" 30 dragDrop="{dragDropHandler(event)}" 31 toolTip="drag components from list to add..."/> 38 toolTip="drag components from list to add..." editorChange="handleEditorChange(event)" /> 32 39 <mx:DataGrid id="dataGrid" 33 width=" 100%"40 width="50%" 34 41 dragEnabled="true" 35 42 dataProvider="{componentsSrv.itemDescriptions}" … … 37 44 allowMultipleSelection="true"/> 38 45 39 </mx: HBox>40 < !--<mx:HBox width="100%"46 </mx:VBox> 47 <mx:HBox width="100%" 41 48 height="300"> 42 <comp:XMLTextArea id="textView"43 styleName="xmlTextArea"44 editable="true"45 xmlData="{cmdComponent}"46 width="50%"47 height="300"/>48 49 <comp:ScrollableTextArea id="infoTextArea" 49 50 styleName="xmlTextArea" 50 51 editable="false" 51 text="{cmd Component}"52 text="{cmdSpec.toXml()}" 52 53 width="50%" 53 54 height="300"/> 54 </mx:HBox> -->55 </mx:HBox> 55 56 </mx:VBox> 56 57 -
ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/editor/EditorAS.as
r134 r206 2 2 import clarin.cmdi.componentregistry.browser.BrowserColumns; 3 3 import clarin.cmdi.componentregistry.common.ItemDescription; 4 import clarin.cmdi.componentregistry.editor.model.CMDModelFactory; 5 import clarin.cmdi.componentregistry.editor.model.CMDSpec; 6 import clarin.cmdi.componentregistry.importer.UploadCompleteEvent; 4 7 import clarin.cmdi.componentregistry.services.ComponentInfoService; 5 8 import clarin.cmdi.componentregistry.services.ComponentListService; 6 9 import clarin.cmdi.componentregistry.services.ProfileInfoService; 10 import clarin.cmdi.componentregistry.services.UploadService; 7 11 8 12 import flash.events.Event; 13 import flash.net.FileReference; 9 14 10 import mx.core.UIComponent;11 import mx.events.DragEvent;12 import mx.managers.DragManager;13 15 14 16 private var currentDescription:ItemDescription; … … 19 21 private var componentsSrv:ComponentListService = ComponentListService.instance; 20 22 21 22 private static const emptyProfile:XML = <CMD_ComponentSpec isProfile="true"> 23 <Header> 24 <ID>p_1234</ID> 25 <Name>Profile1</Name> 26 <Description>MyDesc</Description> 27 </Header> 28 </CMD_ComponentSpec>; 29 23 [Bindable] 24 public var cmdComponent:XML; 30 25 31 26 [Bindable] 32 p ublic var cmdComponent:XML = emptyProfile;27 private var cmdSpec:CMDSpec = new CMDSpec(true); 33 28 34 29 [Bindable] 35 30 private var browserColumns:BrowserColumns = new BrowserColumns(); 31 32 [Bindable] 33 private var uploadService:UploadService = new UploadService(); 36 34 37 35 … … 39 37 profileSrv.addEventListener(ProfileInfoService.PROFILE_LOADED, profileLoaded); 40 38 componentsSrv.load(); 41 } 42 43 private function dragEnterHandler(event:DragEvent):void { 44 DragManager.acceptDragDrop(event.currentTarget as UIComponent); 45 } 46 47 private function dragOverHandler(event:DragEvent):void { 48 if (event.dragSource.hasFormat("items")) { 49 DragManager.showFeedback(DragManager.COPY); 50 } 51 } 52 53 private function dragDropHandler(event:DragEvent):void { 54 var items:Array = event.dragSource.dataForFormat("items") as Array; 55 addComponents(items); 39 uploadService.init(uploadProgress); 56 40 } 57 41 58 42 private function profileLoaded(event:Event):void { 59 cmdComponent = profileSrv.profile.profileSource; 43 var cmdComponent:XML = profileSrv.profile.profileSource; 44 this.cmdSpec = CMDModelFactory.createModel(cmdComponent); 60 45 } 61 46 … … 68 53 69 54 public function createEmptyProfile():void { 70 cmdComponent = <CMD_ComponentSpec isProfile="true"> 71 <Header> 72 <ID>p_1</ID> 73 <Name>Profile1</Name> 74 <Description>MyDesc</Description> 75 </Header> 76 </CMD_ComponentSpec>; 55 this.cmdSpec = new CMDSpec(true); 77 56 } 78 57 79 public function addComponents(items:Array):void { 80 var temp:XML = xmlEditor.xml.copy(); 81 for each (var item:ItemDescription in items) { 82 var comp:XML =<CMD_Component ComponentId={item.id}/> 83 temp.appendChild(comp); 84 } 85 cmdComponent = temp; 58 private var ref:FileReference = new FileReference(); 59 60 private function saveProfile():void { 61 //Alert.show(xmlEditor.cmdSpec.toXml()); 62 var item:ItemDescription = new ItemDescription(); 63 item.description = xmlEditor.cmdSpec.headerDescription; 64 item.name = xmlEditor.cmdSpec.headerName; 65 item.isProfile = xmlEditor.cmdSpec.isProfile; 66 uploadService.addEventListener(UploadCompleteEvent.UPLOAD_COMPLETE, handleSaveComplete); 67 uploadService.submitProfile(item, xmlEditor.cmdSpec.toXml()); 68 } 69 70 private function handleSaveComplete(event:UploadCompleteEvent):void { 71 parentApplication.viewStack.switchToBrowse(event.itemDescription); 72 } 73 74 private function handleEditorChange(event:Event):void { 75 errorMessageField.text = ""; 76 uploadProgress.visible = false; 77 uploadProgress.includeInLayout = false; 86 78 } 87 79 88 80 89 81 90 -
ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/editor/model/CMDComponentElement.as
r134 r206 1 package clarin.cmdi.componentregistry.common { 1 package clarin.cmdi.componentregistry.editor.model { 2 import clarin.cmdi.componentregistry.common.XmlAble; 3 4 import mx.collections.ArrayCollection; 2 5 import mx.collections.XMLListCollection; 3 6 4 [Bindable] 5 public class ComponentElement { 7 public class CMDComponentElement implements XmlAble { 6 8 9 //Attributes 7 10 public var name:String; 8 public var valueScheme:Object;9 11 public var conceptLink:String; 12 public var valueSchemeSimple:String; 13 public var cardinalityMin:String = "1"; 14 public var cardinalityMax:String = "1"; 10 15 11 public function ComponentElement() { 16 17 //elements 18 public var attributeList:ArrayCollection = new ArrayCollection(); 19 public var valueSchemeComplex:XMLListCollection; 20 21 public function CMDComponentElement() { 12 22 } 13 23 14 private static function setValueScheme(value:XML, item:ComponentElement):void {15 if (value.hasOwnProperty(ComponentMD.VALUE_SCHEME)) {16 if (value.ValueScheme.hasOwnProperty(ComponentMD.PATTERN)) {17 var d:Object = value.ValueScheme.pattern18 item.valueScheme = d.name() + "(" + d.text().toXMLString() + ")";19 } else if (value.ValueScheme.hasOwnProperty(ComponentMD.ENUMERATION)) {20 item.valueScheme = new XMLListCollection(value.ValueScheme.enumeration.*);21 }22 } else if (value.hasOwnProperty("@"+ComponentMD.VALUE_SCHEME)) {23 item.valueScheme = value.@ValueScheme;24 } else if (value.hasOwnProperty(ComponentMD.TYPE)) {25 item.valueScheme = value.Type;26 }27 }28 24 29 public static function createAttributeItem(attribute:XML):ComponentElement {30 var item:ComponentElement = new ComponentElement();31 item.name = attribute.Name;32 item.valueScheme = attribute.Type;33 return item;34 }35 25 36 public static function createElementItem(element:XML):ComponentElement { 37 var item:ComponentElement = new ComponentElement(); 38 item.name = element.@name; 39 setValueScheme(element, item); 40 item.conceptLink = element.@ConceptLink; 41 return item; 26 public function toXml():XML { 27 return <CMD_Element></CMD_Element>;//TODO PD implement 42 28 } 43 29 -
ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/importer/Importer.mxml
r117 r206 4 4 width="100%" 5 5 height="100%" 6 label=" Register...">6 label="Import..."> 7 7 8 8 <mx:Script> … … 10 10 import clarin.cmdi.componentregistry.common.ItemDescription; 11 11 12 private static const BTN_PROFILE_LABEL:String = "Select profile xml.. ";13 private static const BTN_COMPONENT_LABEL:String = "Select component xml.. ";12 private static const BTN_PROFILE_LABEL:String = "Select profile xml..."; 13 private static const BTN_COMPONENT_LABEL:String = "Select component xml..."; 14 14 15 15 [Bindable] … … 21 21 var item:ItemDescription = new ItemDescription(); 22 22 item.description = description.text; 23 item.creatorName = creatorName.text;24 23 item.name = nameInput.text; 25 24 item.isProfile = isProfile; … … 52 51 <mx:Form> 53 52 <mx:HBox> 54 <mx:FormHeading label=" Register"/>55 <mx:RadioButton groupName=" registerType"53 <mx:FormHeading label="Import"/> 54 <mx:RadioButton groupName="importType" 56 55 id="profileType" 57 56 label="Profile" 58 57 click="setIsProfile(true)" 59 58 selected="true"/> 60 <mx:RadioButton groupName=" registerType"59 <mx:RadioButton groupName="importType" 61 60 id="componentType" 62 61 label="Component" … … 78 77 </mx:FormItem> 79 78 <mx:FormItem label="Creator Name"> 80 <mx:Text Input id="creatorName"/>79 <mx:Text id="creatorName" text="loginName"/> 81 80 </mx:FormItem> 82 81 <mx:FormItem label="Group Name" -
ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/importer/UploadCompleteEvent.as
r117 r206 1 package clarin.cmdi.componentregistry. register {1 package clarin.cmdi.componentregistry.importer { 2 2 import clarin.cmdi.componentregistry.common.ItemDescription; 3 3 -
ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/services/ProfileInfoService.as
r121 r206 3 3 import clarin.cmdi.componentregistry.common.ItemDescription; 4 4 import clarin.cmdi.componentregistry.common.Profile; 5 5 6 6 import flash.events.Event; 7 7 import flash.events.EventDispatcher; 8 8 9 import mx.collections.ArrayCollection; 9 10 import mx.messaging.messages.HTTPRequestMessage; … … 16 17 17 18 [Event(name="ProfileLoaded", type="flash.events.Event")] 18 public class ProfileInfoService {19 public class ProfileInfoService extends EventDispatcher { 19 20 public static const PROFILE_LOADED:String = "ProfileLoaded"; 20 21 -
ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/services/UploadService.as
r117 r206 1 1 package clarin.cmdi.componentregistry.services { 2 2 import clarin.cmdi.componentregistry.common.ItemDescription; 3 import clarin.cmdi.componentregistry.register.UploadCompleteEvent; 3 import clarin.cmdi.componentregistry.importer.UploadCompleteEvent; 4 5 import com.adobe.net.URI; 6 import com.hurlant.util.Base64; 4 7 5 8 import flash.events.DataEvent; 6 9 import flash.events.Event; 7 10 import flash.events.HTTPStatusEvent; 11 import flash.events.IOErrorEvent; 8 12 import flash.events.ProgressEvent; 13 import flash.events.SecurityErrorEvent; 9 14 import flash.net.FileFilter; 10 15 import flash.net.FileReference; 11 16 import flash.net.URLRequest; 12 import flash.net.URLRequestMethod;13 17 import flash.net.URLVariables; 14 18 15 19 import mx.controls.ProgressBar; 16 import mx.core.UIComponent; 17 18 [Event(name="uploadComplete", type="clarin.cmdi.componentregistry.register.UploadCompleteEvent")] 19 public class UploadService { 20 21 import org.httpclient.HttpClient; 22 import org.httpclient.events.HttpDataEvent; 23 import org.httpclient.events.HttpErrorEvent; 24 import org.httpclient.events.HttpStatusEvent; 25 import org.httpclient.http.Post; 26 import org.httpclient.http.multipart.Multipart; 27 import org.httpclient.http.multipart.Part; 28 29 [Event(name="uploadComplete", type="clarin.cmdi.componentregistry.importer.UploadCompleteEvent")] 30 public class UploadService { 20 31 21 32 public function UploadService() { … … 28 39 29 40 private var fileRef:FileReference; 41 private var httpClient:HttpClient; 30 42 private var request:URLRequest; 31 43 private var pb:ProgressBar; … … 33 45 public function init(progressBar:ProgressBar):void { 34 46 pb = progressBar; 47 } 48 49 private function createAndInitRequest(url:String):void { 50 request = new URLRequest(url); 51 httpClient = new HttpClient(); 52 httpClient.listener.onError = httpclientErrorHandler; 53 httpClient.listener.onData = httpclientDataHandler; 54 httpClient.listener.onStatus = httpclientStatusHandler; 55 } 56 57 private function createAndInitFileReference():void { 35 58 fileRef = new FileReference(); 36 59 fileRef.addEventListener(Event.SELECT, selectHandler); 37 fileRef.addEventListener(HTTPStatusEvent.HTTP_STATUS, errorHandler);38 60 fileRef.addEventListener(DataEvent.UPLOAD_COMPLETE_DATA, responseHandler); 39 61 fileRef.addEventListener(ProgressEvent.PROGRESS, progressHandler); 40 fileRef.addEventListener(Event.OPEN, startUploadHandler); 41 } 42 43 public function submitProfile(description:ItemDescription):void { 44 request = new URLRequest(Config.instance.uploadProfileUrl); 62 fileRef.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler); 63 fileRef.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler); 64 65 } 66 67 /** 68 * submits a profile, data parameter can be null which implies a file was selected using selectXmlFile(); 69 */ 70 public function submitProfile(description:ItemDescription, data:String = null):void { 71 createAndInitRequest(Config.instance.uploadProfileUrl); 45 72 var params:URLVariables = new URLVariables(); 46 submit(description, params); 47 } 48 49 public function submitComponent(description:ItemDescription):void { 50 request = new URLRequest(Config.instance.uploadComponentUrl); 73 submit(description, params, data); 74 } 75 76 /** 77 * submits a component, data parameter can be null which implies a file was selected using selectXmlFile(); 78 */ 79 public function submitComponent(description:ItemDescription, data:String = null):void { 80 createAndInitRequest(Config.instance.uploadComponentUrl); 51 81 var params:URLVariables = new URLVariables(); 52 82 params.group = description.groupName; 53 submit(description, params); 54 } 55 56 public function submit(description:ItemDescription, params:URLVariables):void { 83 submit(description, params, data); 84 } 85 86 private function getCredentials():String { 87 return Base64.encode("tomcat:tomcat"); 88 } 89 90 private function submit(description:ItemDescription, params:URLVariables, data:String = null):void { 57 91 message = ""; 58 92 try { 59 request.method = URLRequestMethod.POST; 60 params.creatorName = description.creatorName; 61 params.description = description.description; 62 params.name = description.name; 63 request.data = params; 64 fileRef.upload(request, "data"); 93 if (data != null) { 94 var parts:Array = new Array(); 95 parts.push(new Part("description", description.description)); 96 parts.push(new Part("name", description.name)); 97 parts.push(new Part("data", data, "application/octet-stream", [{name: "filename", value: description.name + ".xml"}])); 98 99 var multipart:Multipart = new Multipart(parts); 100 var uri:URI = new URI(Config.instance.uploadProfileUrl); 101 startUploadHandler(); 102 var post:Post = new Post(); 103 post.addHeader("Authorization", "BASIC " + getCredentials()); 104 post.setMultipart(multipart); 105 httpClient.request(uri, post); 106 } else { 107 // Cannot sent credentials with FileReference.upload so just load the data and then submit through HttpClient 108 startUploadHandler(); 109 if (fileRef.data == null) { 110 //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). 111 fileRef.addEventListener(Event.COMPLETE, function(event:Event):void { 112 submit(description, params, new String(fileRef.data)); 113 }); 114 fileRef.load(); 115 } else { 116 submit(description, params, new String(fileRef.data)); 117 } 118 } 65 119 } catch (error:Error) { 66 trace("Unable to upload file."); 67 } 68 } 120 trace("Unable to upload file. Error: " + error); 121 throw error; 122 } 123 } 124 69 125 70 126 public function selectXmlFile(event:Event):void { 127 createAndInitFileReference(); 71 128 var filter:FileFilter = new FileFilter("Xml Files (*.xml)", "*.xml"); 72 129 fileRef.browse(new Array(filter)); … … 76 133 selectedFile = fileRef.name; 77 134 message = ""; 78 pb.visible=false; 79 } 80 81 private function errorHandler(event:HTTPStatusEvent):void { 82 message = "Server Failed to handle registration. Unexpected error, try again later. (httpstatus code was: " + event.status + ")"; 135 pb.visible = false; 136 } 137 138 private function httpclientStatusHandler(event:HttpStatusEvent):void { 139 if (event.code != "200") { 140 addToMessage("Server Failed to handle registration. Unexpected error, try again later. (httpstatus code was: " + event.code + ")\n"); 141 } 142 } 143 144 private function httpclientDataHandler(event:HttpDataEvent):void { 145 uploadComplete(); 146 var response:XML = new XML(event.bytes); 147 handleResponse(response); 148 } 149 150 private function httpclientErrorHandler(event:HttpErrorEvent):void { 151 addToMessage("Server Failed to handle registration. Unexpected error, try again later. (error: " + event.text + ")\n"); 152 } 153 154 private function securityErrorHandler(event:SecurityErrorEvent):void { 155 addToMessage("Server Failed to handle registration. Unexpected error, try again later. (error: " + event.text + ")\n"); 156 } 157 158 private function ioErrorHandler(event:IOErrorEvent):void { 159 addToMessage("Unable to load file. (error: " + event.text + ")\n"); 83 160 } 84 161 … … 88 165 } 89 166 90 private function startUploadHandler(event:Event):void { 167 168 private function responseHandler(event:DataEvent):void { 169 uploadComplete(); 170 var response:XML = new XML(event.data); 171 handleResponse(response); 172 } 173 174 private function startUploadHandler():void { 91 175 trace("uploading start"); 92 176 pb.label = "uploading %3%%"; 93 pb.visible=true; 94 } 95 96 97 private function responseHandler(event:DataEvent):void { 98 pb.label = "Upload complete"; 99 var response:XML = new XML(event.data); 177 pb.visible = true; 178 pb.includeInLayout = true; 179 } 180 181 private function handleResponse(response:XML):void { 100 182 if (response.@registered == true) { 101 183 var item:ItemDescription = new ItemDescription(); … … 109 191 createErrorMessage(response); 110 192 } 193 194 } 195 196 private function uploadComplete():void { 197 pb.label = "Upload complete"; 198 pb.setProgress(100, 100); 111 199 } 112 200 113 201 private function createErrorMessage(response:XML):void { 114 message = "Failed to register:";202 addToMessage("Failed to register:"); 115 203 var errors:XMLList = response.errors.error; 116 204 for each (var error:XML in errors) { … … 118 206 } 119 207 } 208 209 private function addToMessage(text:String):void { 210 message += text; 211 } 212 120 213 } 121 214 } -
ComponentRegistry/trunk/ComponentBrowserGui/src/main/resources/assets/css/main.css
r161 r206 32 32 33 33 .xmlBrowserHeader { 34 labelWidth: 50; 34 fontWeight: bold; 35 fontSize: 12; 35 36 } 36 37 37 .xmlBrowserHeader Cmdelement{38 labelWidth: 70;38 .xmlBrowserHeaderSmall { 39 fontWeight: bold; 39 40 } 40 41
Note: See TracChangeset
for help on using the changeset viewer.