Cleaned up how components print messages and how the Computer component overrides their notice/print/println methods (in preparation for new Computer overrides)

This commit is contained in:
Jeff Parsons 2017-06-28 10:53:44 -07:00 committed by Jeff Parsons
commit d4d3448fd5
20 changed files with 954 additions and 910 deletions

View file

@ -177,9 +177,11 @@ class Computer8080 extends Component {
*/
var iComponent, component;
var aComponents = Component.getComponents(this.id);
this.panel = /** @type {Panel8080} */ (Component.getComponentByType("Panel", this.id));
if (this.panel && this.panel.controlPrint) {
this.panel = /** @type {Panel8080} */ (Component.getComponentByType("Panel", this.id));
this.controlPrint = this.panel && this.panel.bindings['print'];
if (this.controlPrint) {
for (iComponent = 0; iComponent < aComponents.length; iComponent++) {
component = aComponents[iComponent];
/*
@ -188,8 +190,8 @@ class Computer8080 extends Component {
* too darn convenient to slam those overrides into the components directly.
*/
component.notice = this.panel.notice;
component.print = this.panel.print;
component.println = this.panel.println;
component.controlPrint = this.panel.controlPrint;
}
}
@ -277,6 +279,18 @@ class Computer8080 extends Component {
if (!fSuspended && this.fAutoPower) this.wait(this.powerOn);
}
/**
* clearPanel()
*
* @this {Computer8080}
*/
clearPanel()
{
if (this.controlPrint) {
this.controlPrint.value = "";
}
}
/**
* getMachineID()
*