📄 automaticdemo.js
字号:
vertical: "middle" }, text: this._msg["AutomaticDemo.StopMessage"], events: { action: Core.method(this, this._stop) } }) ] })); } }, _stop: function(e) { this.fireEvent({ type: "stop", source: this }); }});/** * Core.Web.Scheduler.Runnable to launch various screens at intervals for the automatic demo. */DemoApp.AutomaticDemo.Runnable = Core.extend(Core.Web.Scheduler.Runnable, { $static: { ALL_TRANSITIONS: [ Extras.TransitionPane.TYPE_FADE, Extras.TransitionPane.TYPE_CAMERA_PAN_UP, Extras.TransitionPane.TYPE_CAMERA_PAN_LEFT, Extras.TransitionPane.TYPE_CAMERA_PAN_RIGHT, Extras.TransitionPane.TYPE_CAMERA_PAN_DOWN ], PAN_TRANSITIONS: [ Extras.TransitionPane.TYPE_CAMERA_PAN_UP, Extras.TransitionPane.TYPE_CAMERA_PAN_LEFT, Extras.TransitionPane.TYPE_CAMERA_PAN_RIGHT, Extras.TransitionPane.TYPE_CAMERA_PAN_DOWN ] }, _screens: null, _launcher: null, _lastExec: 0, _count: 0, _performanceTest: false, _startTime: null, $construct: function(launcher, stopDialog, sections, performanceTest, interval, randomOrder, transitionStyle) { this._launcher = launcher; this._stopDialog = stopDialog; this._performanceTest = performanceTest; this._interval = interval; this._randomOrder = randomOrder; this._transitionStyle = transitionStyle; this._screens = []; for (var i = 0; i < sections.length; ++i) { for (var j = 0; j < sections[i].screens.length; ++j) { this._screens.push(sections[i].screens[j]); } } this._count = 0; }, repeat: true, timeInterval: null, run: function() { if (this._performanceTest && this._startTime == null) { this._startTime = new Date().getTime(); } if (this._stopDialog.fpsLabel) { if (this._count === 0) { this._lastExec = new Date().getTime(); } ++this._count; if (this._count % 10 === 0) { var time = new Date().getTime(); this._stopDialog.fpsLabel.set("text", Math.round(100000 / (time - this._lastExec)) / 10); this._lastExec = time; if (this._performanceTest && time > this._startTime + 30000) { var averageFps = (this._count - 1) / ((time - this._startTime) / 1000); this._launcher.stopAutomaticDemo(averageFps); return; } } } this.timeInterval = this._interval; switch (this._transitionStyle) { case "Random": this._launcher.setTransition(DemoApp.Util.randomItem(DemoApp.AutomaticDemo.Runnable.ALL_TRANSITIONS), true); break; case "RandomPan": this._launcher.setTransition(DemoApp.Util.randomItem(DemoApp.AutomaticDemo.Runnable.PAN_TRANSITIONS), true); break; case "Fade": this._launcher.setTransition(Extras.TransitionPane.TYPE_FADE, true); break; case "PanRight": this._launcher.setTransition(Extras.TransitionPane.TYPE_CAMERA_PAN_RIGHT, true); break; case "None": this._launcher.setTransition(Extras.TransitionPane.TYPE_IMMEDIATE, true); break; } if (this._randomOrder) { this._launcher.launchScreen(DemoApp.Util.randomItem(this._screens)); } else { this._launcher.launchScreen(this._launcher.getNextScreen()); } }});/** * Dialog to launch performance test. */DemoApp.AutomaticDemo.PerformanceTestDialog = Core.extend(Echo.WindowPane, { _msg: null, _workspace: null, $construct: function(workspace) { this._workspace = workspace; this._msg = DemoApp.getMessages(); Echo.WindowPane.call(this, { styleName: DemoApp.pref.windowStyleName, modal: true, width: 400, height: 300, title: this._msg["PerformanceTest.WindowTitle"], icon: "image/Icon16Performance.gif", iconInsets: "6px 10px", events: { close: Core.method(this, this._close) }, children: [ new Echo.SplitPane({ autoPositioned: true, orientation: Echo.SplitPane.ORIENTATION_VERTICAL_BOTTOM_TOP, children: [ new Echo.Row({ styleName: "ControlPane", children: [ new Echo.Button({ styleName: "ControlPane.Button", text: this._msg["Generic.Start"], icon: "image/Icon24Play.gif", events: { action: Core.method(this, this._start) } }), new Echo.Button({ styleName: "ControlPane.Button", text: this._msg["Generic.Cancel"], icon: "image/Icon24No.gif", events: { action: Core.method(this, this._close) } }) ] }), new Echo.Column({ insets: "10px 30px", cellSpacing: 15, children: [ new Echo.Label({ text: this._msg["PerformanceTest.Description"] }) ] }) ] }) ] }); }, _start: function(e) { this._workspace.startAutomaticDemo(true); this.parent.remove(this); }, _close: function(e) { this.parent.remove(this); }});/** * Dialog to display performance test results. */DemoApp.AutomaticDemo.PerformanceTestResultDialog = Core.extend(Echo.WindowPane, { _msg: null, $construct: function(fps) { this._msg = DemoApp.getMessages(); fps = Math.round(fps * 10) / 10; Echo.WindowPane.call(this, { styleName: DemoApp.pref.windowStyleName, modal: true, positionX: "50%", positionY: "50%", width: 550, height: 142, resizable: false, title: this._msg["PerformanceTest.WindowTitle"], icon: "image/Icon16Performance.gif", iconInsets: "6px 10px", events: { close: Core.method(this, this._close) }, children: [ new Echo.SplitPane({ autoPositioned: true, orientation: Echo.SplitPane.ORIENTATION_VERTICAL_BOTTOM_TOP, children: [ new Echo.Row({ styleName: "ControlPane", children: [ new Echo.Button({ styleName: "ControlPane.Button", text: this._msg["Generic.Ok"], icon: "image/Icon24Yes.gif", events: { action: Core.method(this, this._close) } }) ] }), new Echo.Row({ layoutData: { backgroundImage: "image/FpsBackground.png" }, insets: "10px 30px", cellSpacing: 8, foreground: "#ffffff", children: [ new Echo.Label({ text: this._msg["PerformanceTest.ResultPre"] }), new Echo.Label({ font: { size: 30 }, text: fps }), new Echo.Label({ text: this._msg["PerformanceTest.ResultPost"] }) ] }) ] }) ] }); }, _close: function(e) { this.parent.remove(this); }});
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -