Changeset 2586


Ignore:
Timestamp:
02/13/13 17:14:33 (11 years ago)
Author:
olhsha
Message:

rolling back to the non-refactored version of the ComponentEdit?.as and CMDComponentXMLEditor.as. They do not hav that nill -pointer exception bug 278. Tomorrow accurate step-for step refactoring.

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  
    4141                public static const DRAG_NEW_ELEMENT:String = "newElement";
    4242                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";
    4544                public static const EDITOR_CHANGE_EVENT:String = "editorChange";
    4645               
     
    4847                private var _firstComponent:CMDComponent;
    4948               
    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;
    5655               
    5756                public function CMDComponentXMLEditor() {
    5857                        super();
    59                         _editComponentBasics = new ComponentEditorBasic(this, _firstComponent);
     58                        //_editComponentBasics = new ComponentEditorBasic(this, _firstComponent);
    6059                        focusEnabled = true;
    6160                        tabEnabled = true;
    6261                        styleName = StyleConstants.XMLBROWSER;
    63                         _editComponentBasics.addDragEventListenersAndProcessors();
    64                         /*addEventListener(DragEvent.DRAG_ENTER, dragEnterHandler);
     62                        // _editComponentBasics.addDragEventListenersAndProcessors();
     63                        addEventListener(DragEvent.DRAG_ENTER, dragEnterHandler);
    6564                        addEventListener(DragEvent.DRAG_OVER, dragOverHandler);
    66                         addEventListener(DragEvent.DRAG_DROP, dragDropHandler);*/
     65                        addEventListener(DragEvent.DRAG_DROP, dragDropHandler);
    6766                        addEventListener(ChildExistenceChangedEvent.CHILD_ADD, dispatchEditorChangeEvent);
    6867                        addEventListener(ChildExistenceChangedEvent.CHILD_REMOVE, dispatchEditorChangeEvent);
     
    124123                }
    125124               
    126                 /* private function dragEnterHandler(event:DragEvent):void {
     125                private function dragEnterHandler(event:DragEvent):void {
    127126               
    128127                        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 {
    134133                        if (event.dragSource.hasFormat(DRAG_ITEMS)) {
    135134                                DragManager.showFeedback(DragManager.COPY);
     
    137136                                DragManager.showFeedback(DragManager.NONE);
    138137                        }
    139                 }*/
    140                
    141                 /*private function dragDropHandler(event:DragEvent):void {
     138                }
     139               
     140                private function dragDropHandler(event:DragEvent):void {
    142141                        if (event.dragSource.hasFormat(DRAG_ITEMS)) {
    143142                                var items:Array = event.dragSource.dataForFormat(DRAG_ITEMS) as Array;
     
    149148                                }
    150149                        }
    151                 }*/
     150                }
    152151               
    153152                public function set cmdSpec(cmdSpec:CMDSpec):void {
     
    168167                private function createNewEditor():void {
    169168                        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;
    172173                        removeAllChildren();
    173174                        checkFirstDefiningComponent(_spec.cmdComponents);
     
    176177                        addChild(createCollapseExpandBox());
    177178                       
    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();
    182188                       
    183189                        addChild(createCollapseExpandBox());
     
    333339                }
    334340               
    335                 /*private function addComponentAddButton():void {
     341                private function addComponentAddButton():void {
    336342                        addComponentLabel = new AddComponentLabelButton();
    337343                        addComponentLabel.addEventListener(MouseEvent.CLICK, function(event:MouseEvent):void {
    338344                                var comp:CMDComponent = CMDComponent.createEmptyComponent();
    339345                                _firstComponent.cmdComponents.addItem(comp);
    340                                 _editComponentBasics.addComponent(comp);
     346                                //_editComponentBasics.addComponent(comp);
     347                                addComponent(comp);
    341348                               
    342349                        });
     
    348355                        });
    349356                        addChild(addComponentLabel);
    350                 } */
    351                
    352                 /*private function addElementAddButton():void {
     357                }
     358               
     359                private function addElementAddButton():void {
    353360                        addElementLabel = new AddElementLabelButton();
    354361                        addElementLabel.addEventListener(MouseEvent.CLICK, function(event:MouseEvent):void {
     
    365372                        });
    366373                        addChild(addElementLabel);
    367                 }*/
     374                }
    368375               
    369376                /* Not Olha: private function createOptionalGroupNameInput(spec:CMDSpec):FormItem {
     
    377384                }  */
    378385               
    379                 /*private function handleComponents(components:ArrayCollection):void {
     386                private function handleComponents(components:ArrayCollection):void {
    380387                        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 {
    386394                        var comp:Container = new ComponentEdit(component, this, _firstComponent);
    387395                        comp.addEventListener(ComponentEdit.REMOVE_COMPONENT_EVENT, removeComponent);
     
    391399                                addChildAt(comp, getChildIndex(addComponentLabel)); //Add components at the place of the button so button moves down
    392400                        }
    393                 }*/
    394                
    395                 /* private function removeComponent(event:Event):void {
     401                }
     402               
     403                private function removeComponent(event:Event):void {
    396404                        var comp:CMDComponent = ComponentEdit(event.currentTarget).component;
    397405                        _firstComponent.removeComponent(comp);
    398406                        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 {
    403411                        for each (var element:CMDComponentElement in elements) {
    404412                                addElement(element);
     
    421429                        _firstComponent.removeElement(elem);
    422430                        removeChild(event.currentTarget as DisplayObject);
    423                 }*/
     431                }
    424432        }
    425433}
  • ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/editor/ComponentEdit.as

    r2535 r2586  
    3030        [Event(name="removeComponent", type="flash.events.Event")]
    3131        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";
    3434               
    3535                private var _parent:UIComponent;
     
    3737                private var _parentComponent:CMDComponent;
    3838               
    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;
    4545               
    4646                public function ComponentEdit(component:CMDComponent, parent:UIComponent, parentComponent:CMDComponent) {
    4747                        super();
    4848                        _component = component;
    49                         _editComponentBasics  = new ComponentEditorBasic(this, _component);
     49                        //_editComponentBasics  = new ComponentEditorBasic(this, _component);
    5050                        _parentComponent = parentComponent;
    5151                        _parent = parent;
    5252                        styleName = StyleConstants.XMLBROWSER;
    5353                        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);
    5656                                addEventListener(DragEvent.DRAG_OVER, dragOverHandler);
    57                                 addEventListener(DragEvent.DRAG_DROP, dragDropHandler);*/
     57                                addEventListener(DragEvent.DRAG_DROP, dragDropHandler);
    5858                        }
    5959                }
     
    6767                }
    6868               
    69                 /* private function dragEnterHandler(event:DragEvent):void {
     69                private function dragEnterHandler(event:DragEvent):void {
    7070               
    7171                DragManager.acceptDragDrop(event.currentTarget as UIComponent);
    7272                        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 {
    7777                        if (event.dragSource.hasFormat(DRAG_ITEMS)) {
    7878                                DragManager.showFeedback(DragManager.COPY);
     
    8080                                DragManager.showFeedback(DragManager.NONE);
    8181                        }
    82                 }*/
    83                
    84                 /*private function dragDropHandler(event:DragEvent):void {
     82                }
     83               
     84                private function dragDropHandler(event:DragEvent):void {
    8585                        if (event.dragSource.hasFormat(DRAG_ITEMS)) {
    8686                                var items:Array = event.dragSource.dataForFormat(DRAG_ITEMS) as Array;
     
    9292                                }
    9393                        }
    94                 }*/
     94                }
    9595               
    9696                private function fireRemoveComponent(mouseEvent:MouseEvent):void {
     
    123123                                addCardinalityInput();
    124124                                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 {
    133139                        addComponentLabel = new AddComponentLabelButton();
    134140                        addComponentLabel.addEventListener(MouseEvent.CLICK, function(event:MouseEvent):void {
    135141                                var comp:CMDComponent = CMDComponent.createEmptyComponent();
    136142                                _component.cmdComponents.addItem(comp);
    137                                 _editComponentBasics.addComponent(comp);
     143                                //_editComponentBasics.addComponent(comp);
     144                                addComponent(comp);
    138145                        });
    139146                        addComponentLabel.addEventListener(MouseEvent.MOUSE_OVER, function(event:MouseEvent):void {
     
    144151                        });
    145152                        addChild(addComponentLabel);
    146                 }*/
    147                
    148                 /*private function addElementAddButton():void {
     153                }
     154               
     155                private function addElementAddButton():void {
    149156                        addElementLabel = new AddElementLabelButton();
    150157                        addElementLabel.addEventListener(MouseEvent.CLICK, function(event:MouseEvent):void {
     
    161168                        });
    162169                        addChild(addElementLabel);
    163                 }*/
     170                }
    164171               
    165172                private function addConceptLink():void {
     
    268275                }
    269276               
    270                 /*private function handleComponents(components:ArrayCollection):void {
     277                private function handleComponents(components:ArrayCollection):void {
    271278                        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 {
    277285                        var comp:Container = new ComponentEdit(component, this, _component);
    278286                        comp.addEventListener(ComponentEdit.REMOVE_COMPONENT_EVENT, removeComponent);
     
    283291                                addChildAt(comp, getChildIndex(addComponentLabel));
    284292                        }
    285                 }*/
    286                
    287                 /*private function removeComponent(event:Event):void {
     293                }
     294               
     295                private function removeComponent(event:Event):void {
    288296                        var comp:CMDComponent = ComponentEdit(event.currentTarget).component;
    289297                        _component.removeComponent(comp);
    290298                        removeChild(event.currentTarget as DisplayObject);
    291                 }*/
    292                
    293                 /*private function handleElements(elements:ArrayCollection):void {
     299                }
     300               
     301                private function handleElements(elements:ArrayCollection):void {
    294302                        for each (var element:CMDComponentElement in elements) {
    295303                                addElement(element);
     
    314322                        removeChild(event.currentTarget as DisplayObject);
    315323                }
    316                 */
     324               
    317325               
    318326                private function createHeading():FormItem {
Note: See TracChangeset for help on using the changeset viewer.