Web Interface For Lite Argus Control modules
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.

105 lines
4.8 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  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.grid.GridDragZone"></div>/**
  16. * @class Ext.grid.GridDragZone
  17. * @extends Ext.dd.DragZone
  18. * <p>A customized implementation of a {@link Ext.dd.DragZone DragZone} which provides default implementations of two of the
  19. * template methods of DragZone to enable dragging of the selected rows of a GridPanel.</p>
  20. * <p>A cooperating {@link Ext.dd.DropZone DropZone} must be created who's template method implementations of
  21. * {@link Ext.dd.DropZone#onNodeEnter onNodeEnter}, {@link Ext.dd.DropZone#onNodeOver onNodeOver},
  22. * {@link Ext.dd.DropZone#onNodeOut onNodeOut} and {@link Ext.dd.DropZone#onNodeDrop onNodeDrop}</p> are able
  23. * to process the {@link #getDragData data} which is provided.
  24. */
  25. Ext.grid.GridDragZone = function(grid, config){
  26. this.view = grid.getView();
  27. Ext.grid.GridDragZone.superclass.constructor.call(this, this.view.mainBody.dom, config);
  28. this.scroll = false;
  29. this.grid = grid;
  30. this.ddel = document.createElement('div');
  31. this.ddel.className = 'x-grid-dd-wrap';
  32. };
  33. Ext.extend(Ext.grid.GridDragZone, Ext.dd.DragZone, {
  34. ddGroup : "GridDD",
  35. <div id="method-Ext.grid.GridDragZone-getDragData"></div>/**
  36. * <p>The provided implementation of the getDragData method which collects the data to be dragged from the GridPanel on mousedown.</p>
  37. * <p>This data is available for processing in the {@link Ext.dd.DropZone#onNodeEnter onNodeEnter}, {@link Ext.dd.DropZone#onNodeOver onNodeOver},
  38. * {@link Ext.dd.DropZone#onNodeOut onNodeOut} and {@link Ext.dd.DropZone#onNodeDrop onNodeDrop} methods of a cooperating {@link Ext.dd.DropZone DropZone}.</p>
  39. * <p>The data object contains the following properties:<ul>
  40. * <li><b>grid</b> : Ext.Grid.GridPanel<div class="sub-desc">The GridPanel from which the data is being dragged.</div></li>
  41. * <li><b>ddel</b> : htmlElement<div class="sub-desc">An htmlElement which provides the "picture" of the data being dragged.</div></li>
  42. * <li><b>rowIndex</b> : Number<div class="sub-desc">The index of the row which receieved the mousedown gesture which triggered the drag.</div></li>
  43. * <li><b>selections</b> : Array<div class="sub-desc">An Array of the selected Records which are being dragged from the GridPanel.</div></li>
  44. * </ul></p>
  45. */
  46. getDragData : function(e){
  47. var t = Ext.lib.Event.getTarget(e);
  48. var rowIndex = this.view.findRowIndex(t);
  49. if(rowIndex !== false){
  50. var sm = this.grid.selModel;
  51. if(!sm.isSelected(rowIndex) || e.hasModifier()){
  52. sm.handleMouseDown(this.grid, rowIndex, e);
  53. }
  54. return {grid: this.grid, ddel: this.ddel, rowIndex: rowIndex, selections:sm.getSelections()};
  55. }
  56. return false;
  57. },
  58. <div id="method-Ext.grid.GridDragZone-onInitDrag"></div>/**
  59. * <p>The provided implementation of the onInitDrag method. Sets the <tt>innerHTML</tt> of the drag proxy which provides the "picture"
  60. * of the data being dragged.</p>
  61. * <p>The <tt>innerHTML</tt> data is found by calling the owning GridPanel's {@link Ext.grid.GridPanel#getDragDropText getDragDropText}.</p>
  62. */
  63. onInitDrag : function(e){
  64. var data = this.dragData;
  65. this.ddel.innerHTML = this.grid.getDragDropText();
  66. this.proxy.update(this.ddel);
  67. // fire start drag?
  68. },
  69. <div id="method-Ext.grid.GridDragZone-afterRepair"></div>/**
  70. * An empty immplementation. Implement this to provide behaviour after a repair of an invalid drop. An implementation might highlight
  71. * the selected rows to show that they have not been dragged.
  72. */
  73. afterRepair : function(){
  74. this.dragging = false;
  75. },
  76. <div id="method-Ext.grid.GridDragZone-getRepairXY"></div>/**
  77. * <p>An empty implementation. Implement this to provide coordinates for the drag proxy to slide back to after an invalid drop.</p>
  78. * <p>Called before a repair of an invalid drop to get the XY to animate to.</p>
  79. * @param {EventObject} e The mouse up event
  80. * @return {Array} The xy location (e.g. [100, 200])
  81. */
  82. getRepairXY : function(e, data){
  83. return false;
  84. },
  85. onEndDrag : function(data, e){
  86. // fire end drag?
  87. },
  88. onValidDrop : function(dd, e, id){
  89. // fire drag drop?
  90. this.hideProxy();
  91. },
  92. beforeInvalidDrop : function(e, id){
  93. }
  94. });
  95. </pre>
  96. </body>
  97. </html>