Index: lams_central/src/flash/org/lamsfoundation/lams/authoring/tb/ToolbarView.as =================================================================== diff -u -ra5f020da4ebf1e963cb702839ea96302ff984a97 -rd00484527529f7fca485b8203aaa8ec91041e62d --- lams_central/src/flash/org/lamsfoundation/lams/authoring/tb/ToolbarView.as (.../ToolbarView.as) (revision a5f020da4ebf1e963cb702839ea96302ff984a97) +++ lams_central/src/flash/org/lamsfoundation/lams/authoring/tb/ToolbarView.as (.../ToolbarView.as) (revision d00484527529f7fca485b8203aaa8ec91041e62d) @@ -36,7 +36,8 @@ //Toolbar clip private var _toolbar_mc:MovieClip; private var _tm:ThemeManager; - + private var btnOffset_X:Number = 4; + private var btnOffset_Y:Number = 6; private var new_btn:Button; private var open_btn:Button; private var save_btn:Button; @@ -49,6 +50,8 @@ private var branch_btn:Button; private var group_btn:Button; private var preview_btn:Button; + private var _toolbarMenu:Array; + //private var btn_text:TextField; private var bkg_pnl:Panel; private var flow_bkg_pnl:Panel; private var _dictionary:Dictionary; @@ -70,7 +73,8 @@ mx.events.EventDispatcher.initialize(this); _tm = ThemeManager.getInstance(); _dictionary = Dictionary.getInstance(); - _dictionary.addEventListener('init',Proxy.create(this,setupLabels)); + //_dictionary.addEventListener('init',Proxy.create(this,setupButtons)); + //_dictionary.addEventListener('init',Proxy.create(this,setupLabels)); } /** @@ -84,12 +88,20 @@ } public function showHideAssets(v:Boolean){ - trace("Method Called") + _toolbar_mc.branch_btn.enabled = false; _toolbar_mc.gate_btn.visible = v; _toolbar_mc.branch_btn.visible = v; _toolbar_mc.flow_bkg_pnl.visible = v; + var flowW:Number = _toolbar_mc.flow_btn.width + var gateW:Number = _toolbar_mc.gate_btn.width + var branchW:Number = _toolbar_mc.branch_btn.width + var maxWidth:Number = Math.max(flowW, gateW, maxWidth) + trace("flow width: "+flowW+" gate width: "+gateW+" branch width: "+branchW+" and max button width: "+maxWidth) + _toolbar_mc.flow_bkg_pnl.setSize(maxWidth+6, 95) + _toolbar_mc.flow_bkg_pnl._x = _toolbar_mc.branch_btn._x-3; + } /* @@ -124,6 +136,7 @@ //Now that view is setup dispatch loaded event dispatchEvent({type:'load',target:this}); } + public function setupLabels(){ _toolbar_mc.new_btn.label = Dictionary.getValue('new_btn'); @@ -139,6 +152,40 @@ _toolbar_mc.group_btn.label = Dictionary.getValue('group_btn'); _toolbar_mc.preview_btn.label = Dictionary.getValue('preview_btn'); + } + + public function setupButtons(tm:ToolbarModel, menuList:Array){ + trace("setupButtons Called") + _toolbarMenu = new Array(); + this.createTextField("btn_text", this.getNextHighestDepth(), btnOffset_X, -100, 10, 18); + for (var i=0; i= menuList.length-2){ + _toolbarMenu[i]._x = this.flow_btn._x; + _toolbarMenu[i]._y = (_toolbarMenu[i-1]._y+_toolbarMenu[i-1].height)+btnOffset_Y + } + if (i == menuList.length){ + btn_text.removeTextField(); + } + } + } /* * Updates state of the Toolbar, called by Toolbar Model @@ -161,6 +208,9 @@ case 'BUTTON' : setState(tm, infoObj); break; + case 'SETMENU' : + setupButtons(tm, infoObj.data); + break; default : Debugger.log('unknown update type :' + infoObj.updateType,Debugger.CRITICAL,'update','org.lamsfoundation.lams.ToolbarView'); }