# src/scripts/CDP/UI/listview/PageProfile.js

## Maintainability

76.26

## Lines of code

127

## Difficulty

42.16

## Estimated Errors

0.81

## Function weight

### By Complexity

### By SLOC

var CDP; (function (CDP) { var UI; (function (UI) { var TAG = "[CDP.UI.PageProfile] "; /** * @class PageProfile * @brief 1 ページに関するプロファイルクラス * framework が使用する * 本クラスでは直接 DOM を操作してはいけない */ var PageProfile = /** @class */ (function () { function PageProfile() { this._index = 0; //!< page index this._offset = 0; //!< page の Top からのオフセット this._height = 0; //!< page の高さ this._lines = []; //!< page 内で管理される LineProfile this._status = "inactive"; //!< page の状態 [ inactive | hidden | active ] } /////////////////////////////////////////////////////////////////////// // public methods //! 有効化 PageProfile.prototype.activate = function () { if ("active" !== this._status) { this._lines.forEach(function (line) { line.activate(); }); } this._status = "active"; }; //! 無可視化 PageProfile.prototype.hide = function () { if ("hidden" !== this._status) { this._lines.forEach(function (line) { line.hide(); }); } this._status = "hidden"; }; //! 無効化 PageProfile.prototype.inactivate = function () { if ("inactive" !== this._status) { this._lines.forEach(function (line) { line.inactivate(); }); } this._status = "inactive"; }; //! LineProfile を設定 PageProfile.prototype.push = function (line) { this._lines.push(line); this._height += line.height; }; //! 配下の LineProfile すべてが有効でない場合、Page ステータスを無効にする PageProfile.prototype.normalize = function () { var enableAll = _.every(this._lines, function (line) { return line.isActive(); }); if (!enableAll) { this._status = "inactive"; } }; //! LineProfile を取得 PageProfile.prototype.getLineProfile = function (index) { if (0 <= index && index < this._lines.length) { return this._lines[index]; } else { return null; } }; //! 最初の LineProfile を取得 PageProfile.prototype.getLineProfileFirst = function () { return this.getLineProfile(0); }; //! 最後の LineProfile を取得 PageProfile.prototype.getLineProfileLast = function () { return this.getLineProfile(this._lines.length - 1); }; Object.defineProperty(PageProfile.prototype, "index", { /////////////////////////////////////////////////////////////////////// // getter/setter methods //! getter: page index get: function () { return this._index; }, //! setter: page index set: function (index) { this._index = index; }, enumerable: true, configurable: true }); Object.defineProperty(PageProfile.prototype, "offset", { //! getter: page offset get: function () { return this._offset; }, //! setter: page offset set: function (offset) { this._offset = offset; }, enumerable: true, configurable: true }); Object.defineProperty(PageProfile.prototype, "height", { //! getter: 実際にページに割り当てられている高さ get: function () { return this._height; }, enumerable: true, configurable: true }); Object.defineProperty(PageProfile.prototype, "status", { //! getter: 状態取得 get: function () { return this._status; }, enumerable: true, configurable: true }); return PageProfile; }()); UI.PageProfile = PageProfile; })(UI = CDP.UI || (CDP.UI = {})); })(CDP || (CDP = {})); //# sourceMappingURL=data:application/json;base64,