{"size": 1406, "ext": "js", "max_stars_repo_path": "force-app/main/default/staticresources/apexuml/scripts/umlcanvas/Model.js", "max_stars_repo_name": "inakithriveglobal/apex-umlcanvas", "max_stars_repo_stars_event_min_datetime": "2015-01-05T15:35:03.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-06T02:16:03.000Z", "max_issues_repo_path": "force-app/main/default/staticresources/apexuml/scripts/umlcanvas/Model.js", "max_issues_repo_name": "inakithriveglobal/apex-umlcanvas", "max_issues_repo_issues_event_min_datetime": "2015-02-05T04:07:23.000Z", "max_issues_repo_issues_event_max_datetime": "2020-04-19T17:04:18.000Z", "max_forks_repo_path": "force-app/main/default/staticresources/apexuml/scripts/umlcanvas/Model.js", "max_forks_repo_name": "inakithriveglobal/apex-umlcanvas", "max_forks_repo_forks_event_min_datetime": "2015-03-01T08:23:26.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-03T13:57:12.000Z"}
{"max_stars_count": 77, "max_issues_count": 11, "max_forks_count": 33, "avg_line_length": 24.2413793103, "max_line_length": 71, "alphanum_fraction": 0.6621621622}
// a book is called a Model, which contains diagrams in stead of sheets
// TODO plugins should be merges with Canvas2D plugins on Book
UmlCanvas.Model = Canvas2D.Book.extend( {
  init: function(UmlCanvasId) {
    this._super(UmlCanvasId);
    this.uc_plugins = {};
  },

  // TODO: move to Canvas2D::Book
  getName: function getName() {
    return this.name;
  },
  
  addPlugin: function addPlugin(plugin) {
    this.uc_plugins[plugin.getName()] = plugin;
  },

  getPlugin: function getPlugin(name) {
    return this.uc_plugins[name];
  },
  
  activatePlugins: function activatePlugins() {
    $H(this.uc_plugins).iterate( function(name, plugin) {
      plugin.activate();
    }.scope(this) );
  },
  
  addDiagram: function(diagram) {
    unless( diagram instanceof UmlCanvas.Diagram, function() {
      diagram = new UmlCanvas.Diagram();
    } );
    return this.addSheet(diagram);
  },

  // TODO: move these to Canvas2D::Book
  getWidth: function getWidth() {
    return parseInt(this.canvas.canvas.width);
  },

  getHeight: function getHeight() {
    return parseInt(this.canvas.canvas.height);
  },

  getLeft: function getLeft() {
    return this.canvas.getLeft();
  },

  getTop: function getTop() {
    return this.canvas.getTop();
  },

  setSize: function setSize(width, height) {
    this.canvas.canvas.width  = width;
    this.canvas.canvas.height = height;
    this.rePublish();
  }
} );
