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.

78 lines
3.5 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.data.MemoryProxy"></div>/**
  16. * @class Ext.data.MemoryProxy
  17. * @extends Ext.data.DataProxy
  18. * An implementation of Ext.data.DataProxy that simply passes the data specified in its constructor
  19. * to the Reader when its load method is called.
  20. * @constructor
  21. * @param {Object} data The data object which the Reader uses to construct a block of Ext.data.Records.
  22. */
  23. Ext.data.MemoryProxy = function(data){
  24. // Must define a dummy api with "read" action to satisfy DataProxy#doRequest and Ext.data.Api#prepare *before* calling super
  25. var api = {};
  26. api[Ext.data.Api.actions.read] = true;
  27. Ext.data.MemoryProxy.superclass.constructor.call(this, {
  28. api: api
  29. });
  30. this.data = data;
  31. };
  32. Ext.extend(Ext.data.MemoryProxy, Ext.data.DataProxy, {
  33. <div id="event-Ext.data.MemoryProxy-loadexception"></div>/**
  34. * @event loadexception
  35. * Fires if an exception occurs in the Proxy during data loading. Note that this event is also relayed
  36. * through {@link Ext.data.Store}, so you can listen for it directly on any Store instance.
  37. * @param {Object} this
  38. * @param {Object} arg The callback's arg object passed to the {@link #load} function
  39. * @param {Object} null This parameter does not apply and will always be null for MemoryProxy
  40. * @param {Error} e The JavaScript Error object caught if the configured Reader could not read the data
  41. */
  42. <div id="method-Ext.data.MemoryProxy-doRequest"></div>/**
  43. * MemoryProxy implementation of DataProxy#doRequest
  44. * @param {String} action
  45. * @param {Ext.data.Record/Ext.data.Record[]} rs If action is load, rs will be null
  46. * @param {Object} params An object containing properties which are to be used as HTTP parameters
  47. * for the request to the remote server.
  48. * @param {Ext.data.DataReader} reader The Reader object which converts the data
  49. * object into a block of Ext.data.Records.
  50. * @param {Function} callback The function into which to pass the block of Ext.data.Records.
  51. * The function must be passed <ul>
  52. * <li>The Record block object</li>
  53. * <li>The "arg" argument from the load function</li>
  54. * <li>A boolean success indicator</li>
  55. * </ul>
  56. * @param {Object} scope The scope (<code>this</code> reference) in which the callback function is executed. Defaults to the browser window.
  57. * @param {Object} arg An optional argument which is passed to the callback as its second parameter.
  58. */
  59. doRequest : function(action, rs, params, reader, callback, scope, arg) {
  60. // No implementation for CRUD in MemoryProxy. Assumes all actions are 'load'
  61. params = params || {};
  62. var result;
  63. try {
  64. result = reader.readRecords(this.data);
  65. }catch(e){
  66. // @deprecated loadexception
  67. this.fireEvent("loadexception", this, null, arg, e);
  68. this.fireEvent('exception', this, 'response', action, arg, null, e);
  69. callback.call(scope, null, arg, false);
  70. return;
  71. }
  72. callback.call(scope, result, arg, true);
  73. }
  74. });</pre>
  75. </body>
  76. </html>