📄 main.js
字号:
setContent: function(content) { this.removeAll(); this.add(content); }});/** * Label component which renders arbitrary HTML. */DemoApp.HtmlLabel = Core.extend(EchoApp.Component, { componentType: "DemoApp.HtmlLabel"});/** * Synchronization peer for HtmlLabel component. */DemoApp.HtmlLabelSync = Core.extend(EchoRender.ComponentSync, { $load: function() { EchoRender.registerPeer("DemoApp.HtmlLabel", this); }, renderAdd: function(update, parentElement) { this._spanElement = document.createElement("span"); EchoAppRender.Font.render(this.component.render("font"), this._spanElement); EchoAppRender.Color.renderFB(this.component, this._spanElement); this._spanElement.innerHTML = this.component.render("html", ""); parentElement.appendChild(this._spanElement); }, renderDispose: function(update) { this._spanElement = null; }, renderUpdate: function(update) { var element = this._spanElement; var containerElement = element.parentNode; this.renderDispose(update); containerElement.removeChild(element); this.renderAdd(update, containerElement); return false; // Child elements not supported: safe to return false. }});/** * Dialog to launch performance test. */DemoApp.PerformanceTestDialog = Core.extend(EchoApp.WindowPane, { _msg: null, _workspace: null, $construct: function(workspace) { this._workspace = workspace; this._msg = DemoApp.Messages.get(null); EchoApp.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 EchoApp.SplitPane({ styleName: "ControlPane.Container.Bottom", children: [ new EchoApp.Row({ styleName: "ControlPane", children: [ new EchoApp.Button({ styleName: "ControlPane.Button", text: this._msg["Generic.Start"], icon: "image/Icon24Play.gif", events: { action: Core.method(this, this._start) } }), new EchoApp.Button({ styleName: "ControlPane.Button", text: this._msg["Generic.Cancel"], icon: "image/Icon24No.gif", events: { action: Core.method(this, this._close) } }) ] }), new EchoApp.Column({ insets: "10px 30px", cellSpacing: 15, children: [ new EchoApp.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.PerformanceTestResultDialog = Core.extend(EchoApp.WindowPane, { _msg: null, $construct: function(fps) { this._msg = DemoApp.Messages.get(null); fps = parseInt(fps * 10) / 10; EchoApp.WindowPane.call(this, { styleName: DemoApp.pref.windowStyleName, modal: true, positionX: 32767, positionY: 32767, 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 EchoApp.SplitPane({ styleName: "ControlPane.Container.Bottom", children: [ new EchoApp.Row({ styleName: "ControlPane", children: [ new EchoApp.Button({ styleName: "ControlPane.Button", text: this._msg["Generic.Ok"], icon: "image/Icon24Yes.gif", events: { action: Core.method(this, this._close) } }) ] }), new EchoApp.Row({ layoutData: { backgroundImage: "image/FpsBackground.png" }, insets: "10px 30px", cellSpacing: 8, foreground: "#ffffff", children: [ new EchoApp.Label({ text: this._msg["PerformanceTest.ResultPre"] }), new EchoApp.Label({ font: { size: 30 }, text: fps }), new EchoApp.Label({ text: this._msg["PerformanceTest.ResultPost"] }) ] }) ] }) ] }); }, _close: function(e) { this.parent.remove(this); }});/** * Dialog for editing user application preferences. */DemoApp.PreferencesDialog = Core.extend(EchoApp.WindowPane, { _transitionsEnabled: null, _sourceViewerForeground: null, _sourceViewerBackground: null, _windowStyleNameSelect: null, $construct: function() { this._msg = DemoApp.Messages.get(null); var groupAnimatedScreenTransitions = EchoApp.generateUid(); EchoApp.WindowPane.call(this, { styleName: DemoApp.pref.windowStyleName, modal: true, width: 500, height: 400, title: this._msg["PrefDialog.WindowTitle"], icon: "image/Icon16Preferences.gif", iconInsets: "6px 10px", events: { close: Core.method(this, this._close) }, children: [ new EchoApp.SplitPane({ styleName: "ControlPane.Container.Bottom", children: [ new EchoApp.Row({ styleName: "ControlPane", children: [ new EchoApp.Button({ styleName: "ControlPane.Button", text: this._msg["Generic.Ok"], icon: "image/Icon24Yes.gif", events: { action: Core.method(this, this._apply) } }), new EchoApp.Button({ styleName: "ControlPane.Button", text: this._msg["Generic.Cancel"], icon: "image/Icon24No.gif", events: { action: Core.method(this, this._close) } }) ] }), new EchoApp.Column({ insets: "10px 30px", cellSpacing: 15, children: [ new EchoApp.Column({ styleName: "PreferencesColumn", children: [ new EchoApp.Label({ styleName: "PreferencesTitle", text: this._msg["PrefDialog.PromptAnimations"] }), new EchoApp.Row({ cellSpacing: 40, children: [ this._transitionsEnabled = new EchoApp.RadioButton({ group: groupAnimatedScreenTransitions, text: this._msg["Generic.Enabled"], selected: DemoApp.pref.transitionsEnabled }), new EchoApp.RadioButton({ group: groupAnimatedScreenTransitions, text: this._msg["Generic.Disabled"], selected: !DemoApp.pref.transitionsEnabled }) ] }) ] }), new EchoApp.Column({ styleName: "PreferencesColumn", children: [ new EchoApp.Label({ styleName: "PreferencesTitle", text: this._msg["PrefDialog.PromptWindowAppearance"] }), this._windowStyleNameSelect = new EchoApp.SelectField({ items: [ { id: "Default", text: this._msg["PrefDialog.WindowStyle.BlueShadow"] }, { id: "GlassBlue2", text: this._msg["PrefDialog.WindowStyle.GlassBlueDark"] }, { id: "GlassBlue", text: this._msg["PrefDialog.WindowStyle.GlassBlueLight"] }, { id: "TransGreen", text: this._msg["PrefDialog.WindowStyle.TransGreen"] }, { id: "None", text: this._msg["PrefDialog.WindowStyle.Default"] } ], selectedId: DemoApp.pref.windowStyleName == null ? "None" : DemoApp.pref.windowStyleName }) ] }), new EchoApp.Column({ styleName: "PreferencesColumn", children: [ new EchoApp.Label({ styleName: "PreferencesTitle", text: this._msg["PrefDialog.PromptSourceViewerColors"] }), new EchoApp.Row({ cellSpacing: 40, children: [ new EchoApp.Row({ cellSpacing: 10, children: [ new EchoApp.Label({ text: this._msg["PrefDialog.PromptForeground"] }), this._sourceViewerForeground = new DemoApp.ColorSelectButton( DemoApp.pref.sourceViewerForeground) ] }), new EchoApp.Row({ cellSpacing: 10, children: [ new EchoApp.Label({ text: this._msg["PrefDialog.PromptBackground"] }), this._sourceViewerBackground = new DemoApp.ColorSelectButton( DemoApp.pref.sourceViewerBackground) ] }) ] })
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -