773fd5c1a6
The render method now returns a promise. Once this promise is resolved, the _position method for that node will be called (if applicable). This promise must be resolved only after all subordinate nodes have completed their render phase (the promise returned by subordinate node's render method has resolved). Node that do not have subordinates can return the result of calling terminalRender, and proxied renders only need to return the result of calling proxy. With this change, it is no longer necessary to explicitly position subordinate nodes. They will already be positioned once their render promise is resolved.
32 lines
632 B
JavaScript
32 lines
632 B
JavaScript
import _ from 'lodash';
|
|
import Q from 'q';
|
|
import Base from './base.js';
|
|
|
|
export default _.extend({}, Base, {
|
|
type: 'charset',
|
|
|
|
_render() {
|
|
this.renderLabeledBox(this.invert() ? 'None of:' : 'One of:');
|
|
|
|
this.partContainer = this.container.group();
|
|
|
|
return Q.all(_.map(this.parts.elements, (part => {
|
|
return part.render(this.partContainer.group());
|
|
}).bind(this)));
|
|
},
|
|
|
|
_position() {
|
|
this.spaceVertically(this.parts.elements, {
|
|
padding: 5
|
|
});
|
|
|
|
this.positionLabeledBox(this.partContainer, {
|
|
padding: 5
|
|
});
|
|
},
|
|
|
|
invert() {
|
|
return this._invert.textValue !== '';
|
|
}
|
|
});
|