StorageLibrary.js 1.9 KB

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