2019-07-13 03:23:19 +00:00
|
|
|
class EditorNode extends EditorInputBase {
|
2019-07-12 01:05:04 +00:00
|
|
|
constructor(id, label) {
|
2019-07-13 03:23:19 +00:00
|
|
|
super(id, label);
|
2019-07-03 01:42:17 +00:00
|
|
|
|
|
|
|
|
this.elem_.classList.add('node');
|
|
|
|
|
this.input_.placeholder = 'node name';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
serialize() {
|
2019-07-13 03:23:19 +00:00
|
|
|
return super.serialize({
|
2019-07-03 01:42:17 +00:00
|
|
|
type: 'node',
|
2019-07-13 03:23:19 +00:00
|
|
|
});
|
2019-07-03 01:42:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
isSoft() {
|
|
|
|
|
// Nested nodes are presumed to be references to other nodes if they exist
|
|
|
|
|
for (let iter = this.elem_.parentElement; iter; iter = iter.parentElement) {
|
|
|
|
|
if (iter.xArchObj) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static unserialize(ser) {
|
2019-07-12 01:05:04 +00:00
|
|
|
let node = new EditorNode(ser.id);
|
2019-07-03 01:42:17 +00:00
|
|
|
node.setLabel(ser.label);
|
2019-07-10 23:19:39 +00:00
|
|
|
node.setHighlight(ser.highlight);
|
2019-07-03 01:42:17 +00:00
|
|
|
return node.getElement();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|