Web UI for ARGUS server
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

126 lines
4.9 KiB

6 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  4. <title>The source code</title>
  5. <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
  6. <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
  7. </head>
  8. <body onload="prettyPrint();">
  9. <pre class="prettyprint lang-js">/*!
  10. * Ext JS Library 3.3.1
  11. * Copyright(c) 2006-2010 Sencha Inc.
  12. * licensing@sencha.com
  13. * http://www.sencha.com/license
  14. */
  15. <div id="cls-Ext.menu.CheckItem"></div>/**
  16. * @class Ext.menu.CheckItem
  17. * @extends Ext.menu.Item
  18. * Adds a menu item that contains a checkbox by default, but can also be part of a radio group.
  19. * @constructor
  20. * Creates a new CheckItem
  21. * @param {Object} config Configuration options
  22. * @xtype menucheckitem
  23. */
  24. Ext.menu.CheckItem = Ext.extend(Ext.menu.Item, {
  25. <div id="cfg-Ext.menu.CheckItem-group"></div>/**
  26. * @cfg {String} group
  27. * All check items with the same group name will automatically be grouped into a single-select
  28. * radio button group (defaults to '')
  29. */
  30. <div id="cfg-Ext.menu.CheckItem-itemCls"></div>/**
  31. * @cfg {String} itemCls The default CSS class to use for check items (defaults to "x-menu-item x-menu-check-item")
  32. */
  33. itemCls : "x-menu-item x-menu-check-item",
  34. <div id="cfg-Ext.menu.CheckItem-groupClass"></div>/**
  35. * @cfg {String} groupClass The default CSS class to use for radio group check items (defaults to "x-menu-group-item")
  36. */
  37. groupClass : "x-menu-group-item",
  38. <div id="cfg-Ext.menu.CheckItem-checked"></div>/**
  39. * @cfg {Boolean} checked True to initialize this checkbox as checked (defaults to false). Note that
  40. * if this checkbox is part of a radio group (group = true) only the first item in the group that is
  41. * initialized with checked = true will be rendered as checked.
  42. */
  43. checked: false,
  44. // private
  45. ctype: "Ext.menu.CheckItem",
  46. initComponent : function(){
  47. Ext.menu.CheckItem.superclass.initComponent.call(this);
  48. this.addEvents(
  49. <div id="event-Ext.menu.CheckItem-beforecheckchange"></div>/**
  50. * @event beforecheckchange
  51. * Fires before the checked value is set, providing an opportunity to cancel if needed
  52. * @param {Ext.menu.CheckItem} this
  53. * @param {Boolean} checked The new checked value that will be set
  54. */
  55. "beforecheckchange" ,
  56. <div id="event-Ext.menu.CheckItem-checkchange"></div>/**
  57. * @event checkchange
  58. * Fires after the checked value has been set
  59. * @param {Ext.menu.CheckItem} this
  60. * @param {Boolean} checked The checked value that was set
  61. */
  62. "checkchange"
  63. );
  64. <div id="method-Ext.menu.CheckItem-checkHandler"></div>/**
  65. * A function that handles the checkchange event. The function is undefined by default, but if an implementation
  66. * is provided, it will be called automatically when the checkchange event fires.
  67. * @param {Ext.menu.CheckItem} this
  68. * @param {Boolean} checked The checked value that was set
  69. * @method checkHandler
  70. */
  71. if(this.checkHandler){
  72. this.on('checkchange', this.checkHandler, this.scope);
  73. }
  74. Ext.menu.MenuMgr.registerCheckable(this);
  75. },
  76. // private
  77. onRender : function(c){
  78. Ext.menu.CheckItem.superclass.onRender.apply(this, arguments);
  79. if(this.group){
  80. this.el.addClass(this.groupClass);
  81. }
  82. if(this.checked){
  83. this.checked = false;
  84. this.setChecked(true, true);
  85. }
  86. },
  87. // private
  88. destroy : function(){
  89. Ext.menu.MenuMgr.unregisterCheckable(this);
  90. Ext.menu.CheckItem.superclass.destroy.apply(this, arguments);
  91. },
  92. <div id="method-Ext.menu.CheckItem-setChecked"></div>/**
  93. * Set the checked state of this item
  94. * @param {Boolean} checked The new checked value
  95. * @param {Boolean} suppressEvent (optional) True to prevent the checkchange event from firing (defaults to false)
  96. */
  97. setChecked : function(state, suppressEvent){
  98. var suppress = suppressEvent === true;
  99. if(this.checked != state && (suppress || this.fireEvent("beforecheckchange", this, state) !== false)){
  100. Ext.menu.MenuMgr.onCheckChange(this, state);
  101. if(this.container){
  102. this.container[state ? "addClass" : "removeClass"]("x-menu-item-checked");
  103. }
  104. this.checked = state;
  105. if(!suppress){
  106. this.fireEvent("checkchange", this, state);
  107. }
  108. }
  109. },
  110. // private
  111. handleClick : function(e){
  112. if(!this.disabled && !(this.checked && this.group)){// disable unselect on radio item
  113. this.setChecked(!this.checked);
  114. }
  115. Ext.menu.CheckItem.superclass.handleClick.apply(this, arguments);
  116. }
  117. });
  118. Ext.reg('menucheckitem', Ext.menu.CheckItem);</pre>
  119. </body>
  120. </html>