UrlLibrary.js 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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. UrlLibrary = function(ui, data, title)
  12. {
  13. StorageFile.call(this, ui, data, title);
  14. var fname = title;
  15. var last = fname.lastIndexOf('/');
  16. if (last >= 0)
  17. {
  18. fname = fname.substring(last + 1);
  19. }
  20. this.fname = fname;
  21. };
  22. //Extends mxEventSource
  23. mxUtils.extend(UrlLibrary, StorageFile);
  24. /**
  25. * Translates this point by the given vector.
  26. *
  27. * @param {number} dx X-coordinate of the translation.
  28. * @param {number} dy Y-coordinate of the translation.
  29. */
  30. UrlLibrary.prototype.getHash = function()
  31. {
  32. return 'U' + encodeURIComponent(this.title);
  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. UrlLibrary.prototype.getTitle = function()
  41. {
  42. return this.fname;
  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. UrlLibrary.prototype.isAutosave = function()
  51. {
  52. return false;
  53. };
  54. /**
  55. * Overridden to avoid updating data with current file.
  56. */
  57. UrlLibrary.prototype.isEditable = function(title, success, error)
  58. {
  59. return false;
  60. };
  61. /**
  62. * Overridden to avoid updating data with current file.
  63. */
  64. UrlLibrary.prototype.saveAs = function(title, success, error)
  65. {
  66. // Cannot be saved
  67. };
  68. /**
  69. * Returns the location as a new object.
  70. * @type mx.Point
  71. */
  72. UrlLibrary.prototype.open = function()
  73. {
  74. // Do nothing - this should never be called
  75. };