aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/DocumentManager.tsx
diff options
context:
space:
mode:
authorMonika Hedman <monika_hedman@brown.edu>2019-02-13 15:31:29 -0500
committerMonika Hedman <monika_hedman@brown.edu>2019-02-13 15:31:29 -0500
commite8bd54161e55b8ed429a3c99e05be8ea89653194 (patch)
treebdc3e73833fbe0f90fbd6e2ba61524436353d959 /src/client/views/DocumentManager.tsx
parent39a61758f87f59366a3464b72fdf249a39a78955 (diff)
nav beginning
Diffstat (limited to 'src/client/views/DocumentManager.tsx')
-rw-r--r--src/client/views/DocumentManager.tsx51
1 files changed, 51 insertions, 0 deletions
diff --git a/src/client/views/DocumentManager.tsx b/src/client/views/DocumentManager.tsx
new file mode 100644
index 000000000..b69d40148
--- /dev/null
+++ b/src/client/views/DocumentManager.tsx
@@ -0,0 +1,51 @@
+import React = require('react')
+import { observer } from 'mobx-react';
+import { observable, action } from 'mobx';
+import { DocumentView } from './nodes/DocumentView';
+import { Document } from "../../fields/Document"
+
+
+export class DocumentManager {
+
+ //global holds all of the nodes (regardless of which collection they're in)
+ @observable
+ public DocumentViews: DocumentView[];
+
+ // singleton instance
+ private static _instance: DocumentManager;
+
+ // create one and only one instance of NodeManager
+ public static get Instance(): DocumentManager {
+ return this._instance || (this._instance = new this());
+ }
+
+ //private constructor so no other class can create a nodemanager
+ private constructor() {
+ this.DocumentViews = new Array<DocumentView>();
+ }
+
+ public getDocumentView(toFind: Document): DocumentView | null {
+
+ let toReturn: DocumentView | null;
+ toReturn = null;
+
+ DocumentManager.Instance.DocumentViews.map(view => {
+ let doc = view.props.Document;
+ if (Object.is(doc, toFind)) {
+ toReturn = view;
+ return;
+ }
+ })
+
+ return (toReturn);
+ }
+
+ public centerNode(doc: DocumentView) {
+
+ }
+
+ public setPosition(doc: DocumentView) {
+
+ }
+
+} \ No newline at end of file