From: <cos...@us...> - 2012-03-27 01:42:02
|
Revision: 6125 http://jaffa.svn.sourceforge.net/jaffa/?rev=6125&view=rev Author: cosbor11 Date: 2012-03-27 01:41:52 +0000 (Tue, 27 Mar 2012) Log Message: ----------- Added support for multiple startMenu instances on one screen. Moved the filterMenu function from the finderHeader to the startMenu so that the startMenu can exist independently without a Header. Modified Paths: -------------- trunk/JaffaRIA/source/html/js/extjs/jaffa/dashboard/MenuIndex.js trunk/JaffaRIA/source/html/js/extjs/jaffa/finder/FinderHeader.js trunk/JaffaRIA/source/html/js/extjs/ux/StartMenu.js Modified: trunk/JaffaRIA/source/html/js/extjs/jaffa/dashboard/MenuIndex.js =================================================================== (Binary files differ) Modified: trunk/JaffaRIA/source/html/js/extjs/jaffa/finder/FinderHeader.js =================================================================== --- trunk/JaffaRIA/source/html/js/extjs/jaffa/finder/FinderHeader.js 2012-03-26 15:51:36 UTC (rev 6124) +++ trunk/JaffaRIA/source/html/js/extjs/jaffa/finder/FinderHeader.js 2012-03-27 01:41:52 UTC (rev 6125) @@ -76,11 +76,6 @@ */ userId: 'unknown', - /** @cfg {number} maxSearchResults - * Number of search results to limit the results to when looking for commands. Default is 8. - */ - maxSearchResults: 8, - /** @cfg {String} rootMenuText * Text for root menu for all screens */ @@ -430,13 +425,13 @@ * * This include a default extension to set the width to 100% on render */ - tbTitle: function (config) { + tbTitle: function(config) { if (config) { this.headerTitle = config.headerTitle || this.headerTitle || config.title || this.title || ''; } return { xtype:'tbtext', - id: 'headerTitle', + id: (config && config.id) ? config.id : 'headerTitle', cls: 'headerTitle', text: '<span>' + this.headerTitle +'</span>', listeners : { @@ -454,10 +449,12 @@ * Only when the start menu is displayed does it attempt an AJAX query to get all the menu options. * So there may be a delay seeing the 'All Screens' option on initial render. */ - tbStartMenu: function () { - + tbStartMenu: function (config) { + config = config || {}; return { + ref: 'startMenu', xtype:'button', + style: config.style, iconCls: 'startMenu', menu: new Ext.ux.StartMenu({ iconCls: 'startMenu-user', @@ -493,7 +490,7 @@ } }], items: [{ - id: 'start-menu', + ref: 'programMenu', text: 'All Programs', iconCls:'startMenu-screen', menu: [] @@ -503,18 +500,19 @@ width:180, listeners:{ 'keyup' : { - fn: this.filterMenu, - scope: this, - buffer: 350 + buffer: 350, + fn: function(fld,evt){ + // Make sure this is the correct type of event, seems there are many misfires! + if(evt.type!='keyup') return; + this.ownerCt.filterMenu(fld.getValue()); + } } } }], listeners: { 'beforerender' : function() { - console.debug("Before Render of Start Menu",this); - this.rootNode = new Jaffa.dashboard.MenuIndex({appCtx:params.appCtx}); this.ownerCt.ownerCt.ownerCt.startMenu = this; - console.debug("Before Render of Start Menu",this,this.ownerCt.ownerCt); + this.rootNode = new Jaffa.dashboard.MenuIndex({appCtx:params.appCtx, startMenu: this}); }, 'render': function(){ var appVersion; @@ -557,88 +555,6 @@ }, /** - * @private - * This method is used to filter the menu options when a search criteria is supplied - * - * The first time this is called it builds a sorted list of all screens for optimized - * repeated searches - */ - filterMenu: function(fld,evt) { - // Make sure this is the correct type of event, seems there are many misfires! - if(evt.type!='keyup') return; - - // Get the sorted list of leaf nodes from the cache, or build it and cache it. - var n = this.startMenu.nodeList; - if(!n) { - n = this.startMenu.rootNode.getLeaves(this.startMenu.rootNode,this.startMenu.rootNode); - console.debug("Nodes",n); - if(n.length>0) { - n.sort(function(a, b){ - if(!a.lc) a.lc=a.text.toLowerCase(); - if(!b.lc) b.lc=b.text.toLowerCase(); - if (a.lc>b.lc) - return 1; - else - return -1; - }); - } - this.startMenu.nodeList = n; - } - - // Make sure we are not doing the same search again because of an event mis-fire! - var v = fld.getValue(); - if(this.startMenu && this.startMenu.prevSearch == v) - return; - this.startMenu.prevSearch = v; - - // Now get the filtered list, we can stop when we reach our default limit - var f = []; - if(v) { - v = v.toLowerCase(); - for(var i=0;i<n.length && f.length<this.maxSearchResults;i++) { - if(n[i].lc.match(v)) { - var addNew = true; - for (var j=0;j<f.length;j++){ - var fData=f[j].attributes.data; - var nData=n[i].attributes.data; - if (fData.component == nData.component - && fData.label == nData.label - && fData.params == nData.params - && fData.target == nData.target - && fData.url == nData.url){ - addNew=false; - } - } - if (addNew) f.push(n[i]); - console.debug("filtered",n[i]); - } - } - } - // Delete old values - var opts = this.startMenu.find('menuSearchOption', true); - if(opts) - for(var i=0;i<opts.length;i++) { - this.startMenu.remove(opts[i],true); - console.debug('Remove option',opts[i].text); - } - - // Add currently found options - for(var i=0;i<f.length;i++) { - var opt = { - xtype: 'button', - template: Ext.Button.menuStyleTemplate, - //id: f[i].id, - text:f[i].text, - menuSearchOption : true, - menuNode: f[i].attributes.data, - handler: Jaffa.dashboard.MenuIndex.invokeOption.createCallback(f[i].attributes.data) - }; - console.debug("Add Option ",opt); - this.startMenu.add(opt); - } - - }, - /** * If the header has custom stuff beyond what is in the panel * then this function can be overridden to deal with that. * Modified: trunk/JaffaRIA/source/html/js/extjs/ux/StartMenu.js =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |