123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- /**
- * Licensed Materials - Property of IBM IBM Cognos Products: Modeling UI (C) Copyright IBM Corp. 2016, 2018 US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP
- * Schedule Contract with IBM Corp.
- */
- define([
- 'underscore',
- 'bi/commons/ui/core/Class'
- ], function (_, Class) {
- var DiagramNode = Class.extend({
- contentProvider: null,
- identifier: null,
- label: null,
- tableRowCount: 0,
- x: 0,
- y: 0,
- adjacentLinks: null,
- statisticsLoading: false,
- init: function(options) {
- DiagramNode.inherited('init', this);
- _.extend(this, options);
- this.adjacentLinks = [];
- this.identifier = options.moserObject.getIdentifier();
- this.label = options.moserObject.getLabel();
- this.comment = options.moserObject.getComment();
- this.screenTip = options.moserObject.getScreenTip();
- this.hidden = options.moserObject.isHidden();
- this.displayTableInfo = options.isDetailsVisible;
- this.tableRowCount = options.tableRowCount;
- this.statisticsLoading = options.statisticsLoading;
- this.x = options.position.x;
- this.y = options.position.y;
- if (this.fixed) {
- this.fx = this.x;
- this.fy = this.y;
- } else {
- this.fx = null;
- this.fy = null;
- }
- },
- /**
- * Add a refernce by ID to an adjacent link on a node
- *
- * @param {string}
- * linkID - The identifier of a link
- */
- addAdjacentLink: function(linkID) {
- this.adjacentLinks = _.union(this.adjacentLinks, [
- linkID
- ]);
- },
- /**
- * Return a list of current adjacent links and empty the current list
- */
- pullAdjacentLinks: function() {
- return this.adjacentLinks.splice(0, this.adjacentLinks.length);
- },
- /**
- * Sets the label of the node
- *
- * @param {string}
- * newValue - The new label to pass to the node
- */
- setLabel: function(newValue) {
- this.label = newValue;
- },
- /**
- * Sets whether the node is visible or not
- *
- * @param {boolean}
- * isHidden - true if the object is to be hidden
- */
- setHidden: function(isHidden) {
- this.hidden = isHidden;
- },
- /**
- * Set the instanceType on the node.
- *
- * @param {String}
- * instanceType The instance type
- */
- setInstanceType: function(instanceType) {
- this.instanceType = instanceType;
- }
- });
- return DiagramNode;
- });
|