StorageLibrary.js 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. // $Id = DriveFile.js,v 1.12 2010-01-02 09 =45 =14 gaudenz Exp $
  2. // Copyright (c) 2006-2014, JGraph Ltd
  3. /**
  4. * Constructs a new point for the optional x and y coordinates. If no
  5. * coordinates are given, then the default values for <x> and <y> are used.
  6. * @constructor
  7. * @class Implements a basic 2D point. Known subclassers = {@link mxRectangle}.
  8. * @param {number} x X-coordinate of the point.
  9. * @param {number} y Y-coordinate of the point.
  10. */
  11. StorageLibrary = function(ui, data, title)
  12. {
  13. StorageFile.call(this, ui, data, title);
  14. };
  15. //Extends mxEventSource
  16. mxUtils.extend(StorageLibrary, StorageFile);
  17. /**
  18. * Translates this point by the given vector.
  19. *
  20. * @param {number} dx X-coordinate of the translation.
  21. * @param {number} dy Y-coordinate of the translation.
  22. */
  23. StorageLibrary.prototype.isAutosave = function()
  24. {
  25. return true;
  26. };
  27. /**
  28. * Overridden to avoid updating data with current file.
  29. */
  30. StorageLibrary.prototype.saveAs = function(title, success, error)
  31. {
  32. this.saveFile(title, false, success, error);
  33. };
  34. /**
  35. * Translates this point by the given vector.
  36. *
  37. * @param {number} dx X-coordinate of the translation.
  38. * @param {number} dy Y-coordinate of the translation.
  39. */
  40. StorageLibrary.prototype.getHash = function()
  41. {
  42. return 'L' + encodeURIComponent(this.title);
  43. };
  44. /**
  45. * Translates this point by the given vector.
  46. *
  47. * @param {number} dx X-coordinate of the translation.
  48. * @param {number} dy Y-coordinate of the translation.
  49. */
  50. StorageLibrary.prototype.getTitle = function()
  51. {
  52. return (this.title == '.scratchpad') ? mxResources.get('scratchpad') : this.title;
  53. };
  54. /**
  55. * Overridden to avoid updating data with current file.
  56. */
  57. StorageLibrary.prototype.isRenamable = function(title, success, error)
  58. {
  59. return this.title != '.scratchpad';
  60. };
  61. /**
  62. * Returns the location as a new object.
  63. * @type mx.Point
  64. */
  65. StorageLibrary.prototype.open = function()
  66. {
  67. // Do nothing - this should never be called
  68. };