Changeset 1899


Ignore:
Timestamp:
04/20/12 14:25:37 (12 years ago)
Author:
twagoo
Message:

Created AttributeNameValidator? based on ChildNameValidator? to check uniqueness of attribute names. CMDComponent and CMDComponentElement now implement new interface AttributeContainer? so that validator can work on both through this interface. AttributeListEdit? now gets attribute parent (of type AttributeContainer?) instead of just the list so that it can pass it on to the validator, and take the list from it.

Fixes #184

Location:
ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/editor
Files:
2 added
6 edited

Legend:

Unmodified
Added
Removed
  • ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/editor/AttributeListEdit.as

    r1774 r1899  
    44        import clarin.cmdi.componentregistry.common.components.AddAttributeLabelButton;
    55        import clarin.cmdi.componentregistry.common.components.RemoveLabelButton;
     6        import clarin.cmdi.componentregistry.editor.model.AttributeContainer;
    67        import clarin.cmdi.componentregistry.editor.model.CMDAttribute;
    78        import clarin.cmdi.componentregistry.editor.model.ValueSchemeInterface;
     
    2627                private var _attributes:ArrayCollection;
    2728                private var _parent:UIComponent;
     29                private var _parentContainer:AttributeContainer;
    2830                private var noAttributesLabel:Label = new Label();
    2931                [Bindable]
     
    3133                private var addAttributeLabelButton:AddAttributeLabelButton;
    3234
    33                 public function AttributeListEdit(attributes:ArrayCollection, parent:UIComponent) {
     35                public function AttributeListEdit(parentContainer:AttributeContainer, parent:UIComponent) {
    3436                        super();
    35                         _attributes = attributes;
     37                        _parentContainer = parentContainer;
     38                        _attributes = parentContainer.getAttributeList();
     39                        _parent = parent;
    3640                        hasNoAttributes = _attributes.length == 0;
    37                         _parent = parent;
    3841                        styleName = StyleConstants.XMLBROWSER;
    3942                        noAttributesLabel.text = "No Attributes";
     
    128131                        var name:NameInputLine = new NameInputLine(attribute.name, function(val:String):void {
    129132                                        attribute.name = val;
    130                                 }, InputValidators.getNameValidator());
     133                                }, new AttributeNameValidator(_parentContainer, attribute));
    131134                        name.direction = FormItemDirection.HORIZONTAL
    132135                        var removeButton:Label = new RemoveLabelButton();
  • ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/editor/CMDComponentXMLEditor.as

    r1839 r1899  
    243243                        addChild(link);
    244244                       
    245                         addChild(new AttributeListEdit(_firstComponent.attributeList, this))
     245                        addChild(new AttributeListEdit(_firstComponent, this))
    246246                }
    247247
  • ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/editor/ComponentEdit.as

    r1773 r1899  
    236236               
    237237                private function handleCMDAttributeList():void {
    238                         addChild(new AttributeListEdit(_component.attributeList, this));
     238                        addChild(new AttributeListEdit(_component, this));
    239239                }
    240240               
  • ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/editor/ElementEdit.as

    r1773 r1899  
    136136
    137137                private function handleCMDAttributeList():void {
    138                         var attributeEdit:Container = new AttributeListEdit(_element.attributeList, this);
     138                        var attributeEdit:Container = new AttributeListEdit(_element, this);
    139139                        addChild(attributeEdit);
    140140                }
  • ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/editor/model/CMDComponent.as

    r873 r1899  
    11package clarin.cmdi.componentregistry.editor.model {
    22        import clarin.cmdi.componentregistry.common.XmlAble;
    3 
     3       
    44        import mx.collections.ArrayCollection;
    55
    6         public class CMDComponent implements XmlAble {
     6        public class CMDComponent implements XmlAble, AttributeContainer {
    77
    88                //Attributes
     
    111111                        return result;
    112112                }
    113 
     113               
     114                public function getAttributeList():ArrayCollection {
     115                        return attributeList;
     116                }
    114117        }
    115118}
  • ComponentRegistry/trunk/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/editor/model/CMDComponentElement.as

    r873 r1899  
    88
    99        [Bindable]
    10         public class CMDComponentElement implements XmlAble, ValueSchemeInterface {
     10        public class CMDComponentElement implements XmlAble, ValueSchemeInterface, AttributeContainer {
    1111
    1212                //Attributes
     
    9797                }
    9898
     99                public function getAttributeList():ArrayCollection {
     100                        return attributeList;
     101                }
    99102
    100103        }
Note: See TracChangeset for help on using the changeset viewer.