| 1 |
// Copyright 2008 The Closure Library Authors. All Rights Reserved. |
| 2 |
// |
| 3 |
// Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 |
// you may not use this file except in compliance with the License. |
| 5 |
// You may obtain a copy of the License at |
| 6 |
// |
| 7 |
// http://www.apache.org/licenses/LICENSE-2.0 |
| 8 |
// |
| 9 |
// Unless required by applicable law or agreed to in writing, software |
| 10 |
// distributed under the License is distributed on an "AS-IS" BASIS, |
| 11 |
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 |
// See the License for the specific language governing permissions and |
| 13 |
// limitations under the License. |
| 14 |
|
| 15 |
/** |
| 16 |
* @fileoverview Menu item observing the filter text in a |
| 17 |
* {@link goog.ui.FilteredMenu}. The observer method is called when the filter |
| 18 |
* text changes and allows the menu item to update its content and state based |
| 19 |
* on the filter. |
| 20 |
* |
| 21 |
* @author [email protected] (Emil A Eklund) |
| 22 |
*/ |
| 23 |
|
| 24 |
goog.provide('goog.ui.FilterObservingMenuItemRenderer'); |
| 25 |
|
| 26 |
goog.require('goog.ui.MenuItemRenderer'); |
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
/** |
| 31 |
* Default renderer for {@link goog.ui.FilterObservingMenuItem}s. Each item has |
| 32 |
* the following structure: |
| 33 |
* |
| 34 |
* <div class="goog-filterobsmenuitem"><div>...(content)...</div></div> |
| 35 |
* |
| 36 |
* @constructor |
| 37 |
* @extends {goog.ui.MenuItemRenderer} |
| 38 |
* @final |
| 39 |
*/ |
| 40 |
goog.ui.FilterObservingMenuItemRenderer = function() { |
| 41 |
goog.ui.MenuItemRenderer.call(this); |
| 42 |
}; |
| 43 |
goog.inherits( |
| 44 |
goog.ui.FilterObservingMenuItemRenderer, goog.ui.MenuItemRenderer); |
| 45 |
goog.addSingletonGetter(goog.ui.FilterObservingMenuItemRenderer); |
| 46 |
|
| 47 |
|
| 48 |
/** |
| 49 |
* CSS class name the renderer applies to menu item elements. |
| 50 |
* @type {string} |
| 51 |
*/ |
| 52 |
goog.ui.FilterObservingMenuItemRenderer.CSS_CLASS = |
| 53 |
goog.getCssName('goog-filterobsmenuitem'); |
| 54 |
|
| 55 |
|
| 56 |
/** |
| 57 |
* Returns the CSS class to be applied to menu items rendered using this |
| 58 |
* renderer. |
| 59 |
* @return {string} Renderer-specific CSS class. |
| 60 |
* @override |
| 61 |
*/ |
| 62 |
goog.ui.FilterObservingMenuItemRenderer.prototype.getCssClass = function() { |
| 63 |
return goog.ui.FilterObservingMenuItemRenderer.CSS_CLASS; |
| 64 |
}; |