12345678910111213141516171819202122232425262728293031323334353637 |
- import React from 'react';
- import {Node, Link, Graph} from '../helpers/graph'
- import {TreeNode, Tree} from '../helpers/tree'
- function log(...m) {
- console.log(...m);
- }
- export class ViewNode extends TreeNode {
- constructor(viewName) {
- super(viewName);
- this.viewName = viewName;
- }
- }
- export default class ViewSystem {
- constructor() {
- this.rootNode = new ViewNode('Root');
- this.topology = new Tree(this.rootNode);
- }
- add(node, parent = this.rootNode) {
- this.topology.insert(node, parent);
- }
- move(node, parent = this.rootNode) {
- this.topology.changeParent(node, parent);
- }
- print() {
- log("Printing View Tree: ", this.viewName);
- this.topology.print()
- }
- }
|