Changeset 2115


Ignore:
Timestamp:
08/17/12 13:39:15 (12 years ago)
Author:
twagoo
Message:

Added collapse all/expand all buttons to component editor

Location:
ComponentRegistry/branches/ComponentRegistry-1.12.0/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • ComponentRegistry/branches/ComponentRegistry-1.12.0/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/editor/CMDComponentXMLEditor.as

    r2096 r2115  
    66        import clarin.cmdi.componentregistry.common.components.AddComponentLabelButton;
    77        import clarin.cmdi.componentregistry.common.components.AddElementLabelButton;
     8        import clarin.cmdi.componentregistry.common.components.LabelButton;
    89        import clarin.cmdi.componentregistry.common.components.RemoveLabelButton;
    910        import clarin.cmdi.componentregistry.editor.model.CMDComponent;
     
    2223        import mx.containers.FormItem;
    2324        import mx.containers.FormItemDirection;
     25        import mx.containers.HBox;
    2426        import mx.controls.Alert;
    2527        import mx.controls.Label;
     
    163165                        checkFirstDefiningComponent(_spec.cmdComponents);
    164166                        handleHeader(_spec);
     167                       
     168                        var collapseExpandBox:HBox = new HBox();
     169                        collapseExpandBox.addChild(createCollapseAllButton());
     170                        collapseExpandBox.addChild(createExpandAllButton());
     171                        addChild(collapseExpandBox);
     172                       
    165173                        handleElements(_firstComponent.cmdElements);
    166174                        addElementAddButton();
    167175                        handleComponents(_firstComponent.cmdComponents);
    168176                        addComponentAddButton();
     177                                               
    169178                        trace("Created editor view in " + (getTimer() - start) + " ms.");
     179                }
     180               
     181                private function createCollapseAllButton():UIComponent{
     182                        var button:LabelButton = new LabelButton(collapseAll,  "Collapse all");
     183                        button.setStyle("color","blue");
     184                        return button;
     185                }
     186               
     187                private function collapseAll(event:Event):void{
     188                        for(var i:int=0;i<numChildren;i++){
     189                                var child:Object = getChildAt(i);
     190                                if(child is ElementEdit || child is ComponentEdit){
     191                                        ItemEdit(child).collapseAll();
     192                                }
     193                        }
     194                }
     195               
     196                private function createExpandAllButton():UIComponent{
     197                        var button:LabelButton = new LabelButton(expandAll,  "Expand all");
     198                        button.setStyle("color","blue");
     199                        return button;
     200                }               
     201               
     202                private function expandAll(event:Event):void{
     203                        for(var i:int=0;i<numChildren;i++){
     204                                var child:Object = getChildAt(i);
     205                                if(child is ElementEdit || child is ComponentEdit){
     206                                        ItemEdit(child).expandAll();
     207                                }
     208                        }
    170209                }
    171210               
  • ComponentRegistry/branches/ComponentRegistry-1.12.0/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/editor/ItemEdit.as

    r2113 r2115  
    4949                        hideableForm.addChild(child);
    5050                }
     51               
     52                public function setDetailsVisibleState(visibleState:Boolean):void{
     53                        showToggleBox.visibleState = visibleState;
     54                }
     55               
     56               
     57               
     58                protected function setAllVisibleState(visibleState:Boolean):void{
     59                        setDetailsVisibleState(visibleState);
     60                        for(var i:int=0;i<numChildren;i++){
     61                                var child:Object = getChildAt(i);
     62                                if(child is ElementEdit || child is ComponentEdit){
     63                                        ItemEdit(child).setAllVisibleState(visibleState);
     64                                }
     65                        }
     66                }
     67               
     68                public function collapseAll():void{
     69                        setAllVisibleState(false);
     70                }
     71               
     72                public function expandAll():void{
     73                        setAllVisibleState(true);
     74                }
    5175        }
    5276}
  • ComponentRegistry/branches/ComponentRegistry-1.12.0/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/editor/ShowToggleBox.mxml

    r2111 r2115  
    4949                                        visibleContainer.includeInLayout = visibleState;
    5050                                        if(visibleState){
    51                                                 invisibleContainer.drawFocus(false);
     51                                                if(invisibleContainer != null){
     52                                                        invisibleContainer.drawFocus(false);
     53                                                }
    5254                                                visibleContainer.drawFocus(true);
    5355                                        }
     
    5860                                        invisibleContainer.includeInLayout = !visibleState;
    5961                                        if(!visibleState){
    60                                                 visibleContainer.drawFocus(false);
     62                                                if(visibleContainer != null){
     63                                                        visibleContainer.drawFocus(false);
     64                                                }
    6165                                                invisibleContainer.drawFocus(true);
    6266                                        }                                       
Note: See TracChangeset for help on using the changeset viewer.