source: trunk/web/addons/job_monarch/lib/extjs/source/widgets/menu/Adapter.js @ 619

Last change on this file since 619 was 619, checked in by ramonb, 15 years ago

lib/:

  • added new AJAX dependancies: ExtJS, pChart, Lightbox2
File size: 1.6 KB
Line 
1/*
2 * Ext JS Library 2.2.1
3 * Copyright(c) 2006-2009, Ext JS, LLC.
4 * licensing@extjs.com
5 *
6 * http://extjs.com/license
7 */
8
9/**
10 * @class Ext.menu.Adapter
11 * @extends Ext.menu.BaseItem
12 * A base utility class that adapts a non-menu component so that it can be wrapped by a menu item and added to a menu.
13 * It provides basic rendering, activation management and enable/disable logic required to work in menus.
14 * @constructor
15 * Creates a new Adapter
16 * @param {Ext.Component} component The component being adapted to render into a menu
17 * @param {Object} config Configuration options
18 */
19Ext.menu.Adapter = function(component, config){
20    Ext.menu.Adapter.superclass.constructor.call(this, config);
21    this.component = component;
22};
23Ext.extend(Ext.menu.Adapter, Ext.menu.BaseItem, {
24    // private
25    canActivate : true,
26
27    // private
28    onRender : function(container, position){
29        this.component.render(container);
30        this.el = this.component.getEl();
31    },
32
33    // private
34    activate : function(){
35        if(this.disabled){
36            return false;
37        }
38        this.component.focus();
39        this.fireEvent("activate", this);
40        return true;
41    },
42
43    // private
44    deactivate : function(){
45        this.fireEvent("deactivate", this);
46    },
47
48    // private
49    disable : function(){
50        this.component.disable();
51        Ext.menu.Adapter.superclass.disable.call(this);
52    },
53
54    // private
55    enable : function(){
56        this.component.enable();
57        Ext.menu.Adapter.superclass.enable.call(this);
58    }
59});
Note: See TracBrowser for help on using the repository browser.