Changeset 2586
- Timestamp:
- 02/13/13 17:14:33 (11 years ago)
- Location:
- ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/editor
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/editor/CMDComponentXMLEditor.as
r2535 r2586 41 41 public static const DRAG_NEW_ELEMENT:String = "newElement"; 42 42 public static const DRAG_NEW_ATTRIBUTE:String = "newAttribute"; 43 //private static const DRAG_ITEMS:String = "items"; 44 43 private static const DRAG_ITEMS:String = "items"; 45 44 public static const EDITOR_CHANGE_EVENT:String = "editorChange"; 46 45 … … 48 47 private var _firstComponent:CMDComponent; 49 48 50 /*[Bindable]51 private var addComponentLabel:Label; */52 53 /*private var addElementLabel:Label;*/54 55 private var _editComponentBasics:ComponentEditorBasic;49 [Bindable] 50 private var addComponentLabel:Label; 51 52 private var addElementLabel:Label; 53 54 // private var _editComponentBasics:ComponentEditorBasic; 56 55 57 56 public function CMDComponentXMLEditor() { 58 57 super(); 59 _editComponentBasics = new ComponentEditorBasic(this, _firstComponent);58 //_editComponentBasics = new ComponentEditorBasic(this, _firstComponent); 60 59 focusEnabled = true; 61 60 tabEnabled = true; 62 61 styleName = StyleConstants.XMLBROWSER; 63 _editComponentBasics.addDragEventListenersAndProcessors();64 /*addEventListener(DragEvent.DRAG_ENTER, dragEnterHandler);62 // _editComponentBasics.addDragEventListenersAndProcessors(); 63 addEventListener(DragEvent.DRAG_ENTER, dragEnterHandler); 65 64 addEventListener(DragEvent.DRAG_OVER, dragOverHandler); 66 addEventListener(DragEvent.DRAG_DROP, dragDropHandler); */65 addEventListener(DragEvent.DRAG_DROP, dragDropHandler); 67 66 addEventListener(ChildExistenceChangedEvent.CHILD_ADD, dispatchEditorChangeEvent); 68 67 addEventListener(ChildExistenceChangedEvent.CHILD_REMOVE, dispatchEditorChangeEvent); … … 124 123 } 125 124 126 /*private function dragEnterHandler(event:DragEvent):void {125 private function dragEnterHandler(event:DragEvent):void { 127 126 128 127 DragManager.acceptDragDrop(event.currentTarget as UIComponent); 129 UIComponent(event.currentTarget).drawFocus(true); *130 } */131 132 133 /*private function dragOverHandler(event:DragEvent):void {128 UIComponent(event.currentTarget).drawFocus(true); 129 } 130 131 132 private function dragOverHandler(event:DragEvent):void { 134 133 if (event.dragSource.hasFormat(DRAG_ITEMS)) { 135 134 DragManager.showFeedback(DragManager.COPY); … … 137 136 DragManager.showFeedback(DragManager.NONE); 138 137 } 139 } */140 141 /*private function dragDropHandler(event:DragEvent):void {138 } 139 140 private function dragDropHandler(event:DragEvent):void { 142 141 if (event.dragSource.hasFormat(DRAG_ITEMS)) { 143 142 var items:Array = event.dragSource.dataForFormat(DRAG_ITEMS) as Array; … … 149 148 } 150 149 } 151 } */150 } 152 151 153 152 public function set cmdSpec(cmdSpec:CMDSpec):void { … … 168 167 private function createNewEditor():void { 169 168 var start:int = getTimer(); 170 _editComponentBasics.addComponentLabel = null; 171 _editComponentBasics.addElementLabel = null 169 //_editComponentBasics.addComponentLabel = null; 170 //_editComponentBasics.addElementLabel = null; 171 addComponentLabel = null; 172 addElementLabel = null; 172 173 removeAllChildren(); 173 174 checkFirstDefiningComponent(_spec.cmdComponents); … … 176 177 addChild(createCollapseExpandBox()); 177 178 178 _editComponentBasics.handleElements(_firstComponent.cmdElements); 179 _editComponentBasics.addElementAddButton(); 180 _editComponentBasics.handleComponents(_firstComponent.cmdComponents); 181 _editComponentBasics.addComponentAddButton(); 179 //_editComponentBasics.handleElements(_firstComponent.cmdElements); 180 //_editComponentBasics.addElementAddButton(); 181 //_editComponentBasics.handleComponents(_firstComponent.cmdComponents); 182 //_editComponentBasics.addComponentAddButton(); 183 184 handleElements(_firstComponent.cmdElements); 185 addElementAddButton(); 186 handleComponents(_firstComponent.cmdComponents); 187 addComponentAddButton(); 182 188 183 189 addChild(createCollapseExpandBox()); … … 333 339 } 334 340 335 /*private function addComponentAddButton():void {341 private function addComponentAddButton():void { 336 342 addComponentLabel = new AddComponentLabelButton(); 337 343 addComponentLabel.addEventListener(MouseEvent.CLICK, function(event:MouseEvent):void { 338 344 var comp:CMDComponent = CMDComponent.createEmptyComponent(); 339 345 _firstComponent.cmdComponents.addItem(comp); 340 _editComponentBasics.addComponent(comp); 346 //_editComponentBasics.addComponent(comp); 347 addComponent(comp); 341 348 342 349 }); … … 348 355 }); 349 356 addChild(addComponentLabel); 350 } */351 352 /*private function addElementAddButton():void {357 } 358 359 private function addElementAddButton():void { 353 360 addElementLabel = new AddElementLabelButton(); 354 361 addElementLabel.addEventListener(MouseEvent.CLICK, function(event:MouseEvent):void { … … 365 372 }); 366 373 addChild(addElementLabel); 367 } */374 } 368 375 369 376 /* Not Olha: private function createOptionalGroupNameInput(spec:CMDSpec):FormItem { … … 377 384 } */ 378 385 379 /*private function handleComponents(components:ArrayCollection):void {386 private function handleComponents(components:ArrayCollection):void { 380 387 for each (var component:CMDComponent in components) { 381 _editComponentBasics.addComponent(component); 382 } 383 }*/ 384 385 /*public function addComponent(component:CMDComponent):void { 388 //_editComponentBasics.addComponent(component); 389 addComponent(component); 390 } 391 } 392 393 public function addComponent(component:CMDComponent):void { 386 394 var comp:Container = new ComponentEdit(component, this, _firstComponent); 387 395 comp.addEventListener(ComponentEdit.REMOVE_COMPONENT_EVENT, removeComponent); … … 391 399 addChildAt(comp, getChildIndex(addComponentLabel)); //Add components at the place of the button so button moves down 392 400 } 393 } */394 395 /*private function removeComponent(event:Event):void {401 } 402 403 private function removeComponent(event:Event):void { 396 404 var comp:CMDComponent = ComponentEdit(event.currentTarget).component; 397 405 _firstComponent.removeComponent(comp); 398 406 removeChild(event.currentTarget as DisplayObject); 399 } */400 401 402 /*private function handleElements(elements:ArrayCollection):void {407 } 408 409 410 private function handleElements(elements:ArrayCollection):void { 403 411 for each (var element:CMDComponentElement in elements) { 404 412 addElement(element); … … 421 429 _firstComponent.removeElement(elem); 422 430 removeChild(event.currentTarget as DisplayObject); 423 } */431 } 424 432 } 425 433 } -
ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/editor/ComponentEdit.as
r2535 r2586 30 30 [Event(name="removeComponent", type="flash.events.Event")] 31 31 public class ComponentEdit extends ItemEdit { 32 //public static const REMOVE_COMPONENT_EVENT:String = "removeComponent";33 //private static const DRAG_ITEMS:String = "items";32 public static const REMOVE_COMPONENT_EVENT:String = "removeComponent"; 33 private static const DRAG_ITEMS:String = "items"; 34 34 35 35 private var _parent:UIComponent; … … 37 37 private var _parentComponent:CMDComponent; 38 38 39 /*[Bindable]40 private var addComponentLabel:Label; */41 42 /*private var addElementLabel:Label;*/43 44 private var _editComponentBasics:ComponentEditorBasic;39 [Bindable] 40 private var addComponentLabel:Label; 41 42 private var addElementLabel:Label; 43 44 //private var _editComponentBasics:ComponentEditorBasic; 45 45 46 46 public function ComponentEdit(component:CMDComponent, parent:UIComponent, parentComponent:CMDComponent) { 47 47 super(); 48 48 _component = component; 49 _editComponentBasics = new ComponentEditorBasic(this, _component);49 //_editComponentBasics = new ComponentEditorBasic(this, _component); 50 50 _parentComponent = parentComponent; 51 51 _parent = parent; 52 52 styleName = StyleConstants.XMLBROWSER; 53 53 if (!component.componentId) { // new empty component, otherwise it would be an already existed component which cannot be edited. 54 _editComponentBasics.addDragEventListenersAndProcessors();55 /*addEventListener(DragEvent.DRAG_ENTER, dragEnterHandler);54 //_editComponentBasics.addDragEventListenersAndProcessors(); 55 addEventListener(DragEvent.DRAG_ENTER, dragEnterHandler); 56 56 addEventListener(DragEvent.DRAG_OVER, dragOverHandler); 57 addEventListener(DragEvent.DRAG_DROP, dragDropHandler); */57 addEventListener(DragEvent.DRAG_DROP, dragDropHandler); 58 58 } 59 59 } … … 67 67 } 68 68 69 /*private function dragEnterHandler(event:DragEvent):void {69 private function dragEnterHandler(event:DragEvent):void { 70 70 71 71 DragManager.acceptDragDrop(event.currentTarget as UIComponent); 72 72 UIComponent(event.currentTarget).drawFocus(true); 73 } */74 75 76 /*private function dragOverHandler(event:DragEvent):void {73 } 74 75 76 private function dragOverHandler(event:DragEvent):void { 77 77 if (event.dragSource.hasFormat(DRAG_ITEMS)) { 78 78 DragManager.showFeedback(DragManager.COPY); … … 80 80 DragManager.showFeedback(DragManager.NONE); 81 81 } 82 } */83 84 /*private function dragDropHandler(event:DragEvent):void {82 } 83 84 private function dragDropHandler(event:DragEvent):void { 85 85 if (event.dragSource.hasFormat(DRAG_ITEMS)) { 86 86 var items:Array = event.dragSource.dataForFormat(DRAG_ITEMS) as Array; … … 92 92 } 93 93 } 94 } */94 } 95 95 96 96 private function fireRemoveComponent(mouseEvent:MouseEvent):void { … … 123 123 addCardinalityInput(); 124 124 handleCMDAttributeList(); 125 _editComponentBasics.handleElements(_component.cmdElements); 126 _editComponentBasics.addElementAddButton(); 127 _editComponentBasics.handleComponents(_component.cmdComponents); //recursion 128 _editComponentBasics.addComponentAddButton(); 129 } 130 } 131 132 /*private function addComponentAddButton():void { 125 //_editComponentBasics.handleElements(_component.cmdElements); 126 //_editComponentBasics.addElementAddButton(); 127 //_editComponentBasics.handleComponents(_component.cmdComponents); //recursion 128 //_editComponentBasics.addComponentAddButton(); 129 130 131 handleElements(_component.cmdElements); 132 addElementAddButton(); 133 handleComponents(_component.cmdComponents); //recursion 134 addComponentAddButton(); 135 } 136 } 137 138 private function addComponentAddButton():void { 133 139 addComponentLabel = new AddComponentLabelButton(); 134 140 addComponentLabel.addEventListener(MouseEvent.CLICK, function(event:MouseEvent):void { 135 141 var comp:CMDComponent = CMDComponent.createEmptyComponent(); 136 142 _component.cmdComponents.addItem(comp); 137 _editComponentBasics.addComponent(comp); 143 //_editComponentBasics.addComponent(comp); 144 addComponent(comp); 138 145 }); 139 146 addComponentLabel.addEventListener(MouseEvent.MOUSE_OVER, function(event:MouseEvent):void { … … 144 151 }); 145 152 addChild(addComponentLabel); 146 } */147 148 /*private function addElementAddButton():void {153 } 154 155 private function addElementAddButton():void { 149 156 addElementLabel = new AddElementLabelButton(); 150 157 addElementLabel.addEventListener(MouseEvent.CLICK, function(event:MouseEvent):void { … … 161 168 }); 162 169 addChild(addElementLabel); 163 } */170 } 164 171 165 172 private function addConceptLink():void { … … 268 275 } 269 276 270 /*private function handleComponents(components:ArrayCollection):void {277 private function handleComponents(components:ArrayCollection):void { 271 278 for each (var component:CMDComponent in components) { 272 _editComponentBasics.addComponent(component); 273 } 274 }*/ 275 276 /*public function addComponent(component:CMDComponent):void { 279 //_editComponentBasics.addComponent(component); 280 addComponent(component); 281 } 282 } 283 284 public function addComponent(component:CMDComponent):void { 277 285 var comp:Container = new ComponentEdit(component, this, _component); 278 286 comp.addEventListener(ComponentEdit.REMOVE_COMPONENT_EVENT, removeComponent); … … 283 291 addChildAt(comp, getChildIndex(addComponentLabel)); 284 292 } 285 } */286 287 /*private function removeComponent(event:Event):void {293 } 294 295 private function removeComponent(event:Event):void { 288 296 var comp:CMDComponent = ComponentEdit(event.currentTarget).component; 289 297 _component.removeComponent(comp); 290 298 removeChild(event.currentTarget as DisplayObject); 291 } */292 293 /*private function handleElements(elements:ArrayCollection):void {299 } 300 301 private function handleElements(elements:ArrayCollection):void { 294 302 for each (var element:CMDComponentElement in elements) { 295 303 addElement(element); … … 314 322 removeChild(event.currentTarget as DisplayObject); 315 323 } 316 */324 317 325 318 326 private function createHeading():FormItem {
Note: See TracChangeset
for help on using the changeset viewer.