UNPKG

nakedobjects.spa

Version:

Single Page Application client for a Naked Objects application.

87 lines 3.4 kB
var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); import { Command } from './Command'; import * as Usermessages from '../user-messages'; import * as Models from '../models'; var Clipboard = (function (_super) { __extends(Clipboard, _super); function Clipboard() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.shortCommand = "cl"; _this.fullCommand = Usermessages.clipboardCommand; _this.helpText = Usermessages.clipboardHelp; _this.minArguments = 1; _this.maxArguments = 1; return _this; } Clipboard.prototype.isAvailableInCurrentContext = function () { return true; }; Clipboard.prototype.doExecute = function (args, chained) { var sub = this.argumentAsString(args, 0); if (sub === undefined) { return this.returnResult("", Usermessages.clipboardError); } if (Usermessages.clipboardCopy.indexOf(sub) === 0) { return this.copy(); } else if (Usermessages.clipboardShow.indexOf(sub) === 0) { return this.show(); } else if (Usermessages.clipboardGo.indexOf(sub) === 0) { return this.go(); } else if (Usermessages.clipboardDiscard.indexOf(sub) === 0) { return this.discard(); } else { return this.returnResult("", Usermessages.clipboardError); } }; ; Clipboard.prototype.copy = function () { var _this = this; if (!this.isObject()) { return this.returnResult("", Usermessages.clipboardContextError); } return this.getObject().then(function (obj) { _this.ciceroContext.ciceroClipboard = obj; var label = Models.typePlusTitle(obj); return _this.returnResult("", Usermessages.clipboardContents(label)); }); }; Clipboard.prototype.show = function () { if (this.ciceroContext.ciceroClipboard) { var label = Models.typePlusTitle(this.ciceroContext.ciceroClipboard); return this.returnResult("", Usermessages.clipboardContents(label)); } else { return this.returnResult("", Usermessages.clipboardEmpty); } }; Clipboard.prototype.go = function () { var _this = this; var link = this.ciceroContext.ciceroClipboard && this.ciceroContext.ciceroClipboard.selfLink(); if (link) { return this.returnResult("", "", function () { return _this.urlManager.setItem(link); }); } else { return this.show(); } }; Clipboard.prototype.discard = function () { this.ciceroContext.ciceroClipboard = null; return this.show(); }; return Clipboard; }(Command)); export { Clipboard }; //# sourceMappingURL=clipboard.js.map