Changeset 1577


Ignore:
Timestamp:
10/17/11 14:33:09 (13 years ago)
Author:
twagoo
Message:

Enabled attribute list editing for all components (refs #125)

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

    r1264 r1577  
    237237                        link.enabled = false;
    238238                        addChild(link);
     239                       
     240                        addChild(new AttributeListEdit(_firstComponent.attributeList, this))
    239241                }
    240242
  • ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/editor/ComponentEdit.as

    r873 r1577  
    2727        import mx.events.DragEvent;
    2828        import mx.managers.DragManager;
    29 
     29       
    3030        [Event(name="removeComponent", type="flash.events.Event")]
    3131        public class ComponentEdit extends Form {
    3232                public static const REMOVE_COMPONENT_EVENT:String = "removeComponent";
    3333                private static const DRAG_ITEMS:String = "items";
    34 
     34               
    3535                private var _parent:UIComponent;
    3636                private var _component:CMDComponent;
     
    3838                private var addComponentLabel:Label
    3939                private var addElementLabel:Label
    40 
    41 
     40               
     41               
    4242                public function ComponentEdit(component:CMDComponent, parent:UIComponent, parentComponent:CMDComponent) {
    4343                        super();
     
    5252                        }
    5353                }
    54 
     54               
    5555                public function get component():CMDComponent {
    5656                        return _component;
     
    5858               
    5959                public function get parentComponent():CMDComponent {
    60                     return _parentComponent;
     60                        return _parentComponent;
    6161                }
    6262               
     
    6565                        UIComponent(event.currentTarget).drawFocus(true);
    6666                }
    67 
    68 
     67               
     68               
    6969                private function dragOverHandler(event:DragEvent):void {
    7070                        if (event.dragSource.hasFormat(DRAG_ITEMS)) {
     
    7474                        }
    7575                }
    76 
     76               
    7777                private function dragDropHandler(event:DragEvent):void {
    7878                        if (event.dragSource.hasFormat(DRAG_ITEMS)) {
     
    8686                        }
    8787                }
    88 
     88               
    8989                private function fireRemoveComponent(mouseEvent:MouseEvent):void {
    9090                        drawFocus(false);
     
    9292                        dispatchEvent(event);
    9393                }
    94 
     94               
    9595                protected override function createChildren():void {
    9696                        super.createChildren();
    9797                        addRuler();
    9898                        createComponentEditBar();
    99 
     99                       
    100100                        var componentLink:FormItem = createComponentLink(_component);
    101101                        if (componentLink != null) {
     
    113113                        }
    114114                }
    115 
     115               
    116116                private function addComponentAddButton():void {
    117117                        addComponentLabel = new AddComponentLabelButton();
    118118                        addComponentLabel.addEventListener(MouseEvent.CLICK, function(event:MouseEvent):void {
    119                                         var comp:CMDComponent = CMDComponent.createEmptyComponent();
    120                                         _component.cmdComponents.addItem(comp);
    121                                         addComponent(comp);
    122                                 });
     119                                var comp:CMDComponent = CMDComponent.createEmptyComponent();
     120                                _component.cmdComponents.addItem(comp);
     121                                addComponent(comp);
     122                        });
    123123                        addComponentLabel.addEventListener(MouseEvent.MOUSE_OVER, function(event:MouseEvent):void {
    124                                         drawFocus(true);
    125                                 });
     124                                drawFocus(true);
     125                        });
    126126                        addComponentLabel.addEventListener(MouseEvent.MOUSE_OUT, function(event:MouseEvent):void {
    127                                         drawFocus(false);
    128                                 });
     127                                drawFocus(false);
     128                        });
    129129                        addChild(addComponentLabel);
    130130                }
    131 
     131               
    132132                private function addElementAddButton():void {
    133133                        addElementLabel = new AddElementLabelButton();
    134134                        addElementLabel.addEventListener(MouseEvent.CLICK, function(event:MouseEvent):void {
    135                                         var element:CMDComponentElement = CMDComponentElement.createEmptyElement();
    136                                         _component.cmdElements.addItem(element);
    137                                         addElement(element);
    138 
    139                                 });
     135                                var element:CMDComponentElement = CMDComponentElement.createEmptyElement();
     136                                _component.cmdElements.addItem(element);
     137                                addElement(element);
     138                               
     139                        });
    140140                        addElementLabel.addEventListener(MouseEvent.MOUSE_OVER, function(event:MouseEvent):void {
    141                                         drawFocus(true);
    142                                 });
     141                                drawFocus(true);
     142                        });
    143143                        addElementLabel.addEventListener(MouseEvent.MOUSE_OUT, function(event:MouseEvent):void {
    144                                         drawFocus(false);
    145                                 });
     144                                drawFocus(false);
     145                        });
    146146                        addChild(addElementLabel);
    147147                }
    148 
     148               
    149149                private function addConceptLink():void {
    150150                        addChild(new ConceptLinkInput(LabelConstants.CONCEPTLINK, _component.conceptLink, function(val:String):void {
    151                                         _component.conceptLink = val;
    152                                 }));
    153                 }
    154 
     151                                _component.conceptLink = val;
     152                        }));
     153                }
     154               
    155155                private function addRuler():void {
    156156                        var ruler:HRule = new HRule();
     
    158158                        addChild(ruler);
    159159                }
    160 
     160               
    161161                private function addNameInput():void {
    162162                        var nameInput:FormItemInputLine = new NameInputLine(_component.name, function(val:String):void {
    163                                         _component.name = val;
    164                                 });
     163                                _component.name = val;
     164                        });
    165165                        addChild(nameInput);
    166166                }
    167 
     167               
    168168                private function addCardinalityInput():void {
    169169                        addChild(new CardinalityInput(LabelConstants.CARDINALITY_MIN, _component.cardinalityMin, function(val:String):void {
    170                                         _component.cardinalityMin = val;
    171                                 }));
     170                                _component.cardinalityMin = val;
     171                        }));
    172172                        addChild(new CardinalityInput(LabelConstants.CARDINALITY_MAX, _component.cardinalityMax, function(val:String):void {
    173                                         _component.cardinalityMax = val;
    174                                 }));
    175                 }
    176 
     173                                _component.cardinalityMax = val;
     174                        }));
     175                }
     176               
    177177                private function createComponentEditBar():void {
    178178                        var editBar:HBox = new HBox();
     
    181181                        addFocusListeners(removeButton).addEventListener(MouseEvent.CLICK, fireRemoveComponent);
    182182                        editBar.addChild(removeButton);
    183 
     183                       
    184184                        var downButton:Button = new DownIconButton();
    185185                        addFocusListeners(downButton).addEventListener(MouseEvent.CLICK, moveDownComponent);
    186186                        editBar.addChild(downButton);
    187 
     187                       
    188188                        var upButton:Button = new UpIconButton();
    189189                        addFocusListeners(upButton).addEventListener(MouseEvent.CLICK, moveUpComponent);
     
    202202                        }
    203203                }
    204 
     204               
    205205                private function moveUpComponent(event:Event):void {
    206206                        var comp:CMDComponent = component;
     
    213213                        }
    214214                }
    215 
     215               
    216216                private function addFocusListeners(comp:UIComponent):UIComponent {
    217217                        comp.addEventListener(MouseEvent.MOUSE_OVER, function(event:MouseEvent):void {
    218                                         drawFocus(true);
    219                                 });
     218                                drawFocus(true);
     219                        });
    220220                        comp.addEventListener(MouseEvent.MOUSE_OUT, function(event:MouseEvent):void {
    221                                         drawFocus(false);
    222                                 });
     221                                drawFocus(false);
     222                        });
    223223                        return comp;
    224224                }
    225 
     225               
    226226                private function createComponentLink(component:CMDComponent):FormItem {
    227227                        if (component.componentId != "" && component.componentId != null) {
     
    234234                        return null;
    235235                }
    236 
     236               
    237237                private function handleCMDAttributeList():void {
    238                         if (_component.attributeList.length > 0)
    239                                 addChild(new AttributeListEdit(_component.attributeList, this));
    240                 }
    241 
     238                        addChild(new AttributeListEdit(_component.attributeList, this));
     239                }
     240               
    242241                private function handleComponents(components:ArrayCollection):void {
    243242                        for each (var component:CMDComponent in components) {
     
    245244                        }
    246245                }
    247 
     246               
    248247                public function addComponent(component:CMDComponent):void {
    249248                        var comp:Container = new ComponentEdit(component, this, _component);
     
    256255                        }
    257256                }
    258 
     257               
    259258                private function removeComponent(event:Event):void {
    260259                        var comp:CMDComponent = ComponentEdit(event.currentTarget).component;
     
    262261                        removeChild(event.currentTarget as DisplayObject);
    263262                }
    264 
     263               
    265264                private function handleElements(elements:ArrayCollection):void {
    266265                        for each (var element:CMDComponentElement in elements) {
     
    268267                        }
    269268                }
    270 
     269               
    271270                public function addElement(element:CMDComponentElement):void {
    272271                        var elem:Container = new ElementEdit(element, this, _component);
     
    279278                        }
    280279                }
    281 
     280               
    282281                private function removeElement(event:Event):void {
    283282                        var elem:CMDComponentElement = ElementEdit(event.currentTarget).element;
     
    285284                        removeChild(event.currentTarget as DisplayObject);
    286285                }
    287 
     286               
    288287                private function createHeading():FormItem {
    289288                        var heading:FormItem = new FormItem();
     
    292291                        return heading;
    293292                }
    294 
    295 
     293               
     294               
    296295        }
    297296}
Note: See TracChangeset for help on using the changeset viewer.