Changeset 2076


Ignore:
Timestamp:
08/14/12 09:45:54 (12 years ago)
Author:
twagoo
Message:

Item state in BrowseContextMenu? now depend on selected space (private/public); "Edit Item as New" is now visible in the public space, where the private has "Edit Item" so that the option matches the available edit button

File:
1 edited

Legend:

Unmodified
Added
Removed
  • ComponentRegistry/branches/ComponentRegistry-1.12.0/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/common/components/BrowseContextMenu.as

    r1090 r2076  
    22        import clarin.cmdi.componentregistry.common.ItemDescription;
    33        import clarin.cmdi.componentregistry.common.ShowInfoPopUp;
     4        import clarin.cmdi.componentregistry.services.Config;
    45        import clarin.cmdi.componentregistry.services.DeleteService;
    56        import clarin.cmdi.componentregistry.services.SaveItemDialog;
    6 
     7       
    78        import flash.events.ContextMenuEvent;
    89        import flash.geom.Point;
    910        import flash.ui.ContextMenu;
    1011        import flash.ui.ContextMenuItem;
    11 
     12       
    1213        import mx.controls.Alert;
    1314        import mx.controls.DataGrid;
     
    3132                private var saveItemDialog:SaveItemDialog = new SaveItemDialog();
    3233                private var isComponent:Boolean = false;
     34               
     35                private var editMenuItem:ContextMenuItem;
     36                private var editAsNewMenuItem:ContextMenuItem;
    3337
    3438                public function BrowseContextMenu(isComponent:Boolean = false) {
     
    3741                        cm.hideBuiltInItems();
    3842                        cm.customItems = createMenuItems();
     43                        setItemStates();
     44                       
     45                        Config.instance.addEventListener(Config.USER_SPACE_TOGGLE_EVENT, setItemStates);
    3946                }
    4047
     
    5259                                result.push(cmi);
    5360                        }
    54                         cmi = new ContextMenuItem("Edit Item...");
    55                         cmi.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, editItem);
    56                         result.push(cmi);
     61                        editMenuItem = new ContextMenuItem("Edit Item...");
     62                        editMenuItem.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, editItem);
     63                        result.push(editMenuItem);
     64                       
     65                        editAsNewMenuItem = new ContextMenuItem("Edit Item as New...");
     66                        editAsNewMenuItem.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, editItem);
     67                        result.push(editAsNewMenuItem);
     68                       
    5769                        cmi = new ContextMenuItem("Delete Item...", true);
    5870                        cmi.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, handleDelete);
     
    6173                        return result;
    6274                }
     75               
     76                private function setItemStates(event:Event = null):void {
     77                        editMenuItem.visible = Config.instance.userSpace;
     78                        editAsNewMenuItem.visible = !Config.instance.userSpace;
     79                }
    6380
    6481                public function set dataGrid(dataGrid:DataGrid):void {
    6582                        _dataGrid = dataGrid;
    6683                }
    67 
    68 
    6984
    7085                private function showInfo(event:ContextMenuEvent):void {
Note: See TracChangeset for help on using the changeset viewer.