aboutsummaryrefslogtreecommitdiff
path: root/src/documents/Documents.ts
diff options
context:
space:
mode:
authorbob <bcz@cs.brown.edu>2019-01-17 16:56:03 -0500
committerbob <bcz@cs.brown.edu>2019-01-17 16:56:03 -0500
commitbec89018d0ee73a8abaa5e01f2262bd95bc687f7 (patch)
tree6e7842ad46a50b40bc07f190e337adb73bf3ce01 /src/documents/Documents.ts
parent7943126ce9694af8e53d2997481c18ca0c17754c (diff)
added collectionfreeformview
Diffstat (limited to 'src/documents/Documents.ts')
-rw-r--r--src/documents/Documents.ts21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/documents/Documents.ts b/src/documents/Documents.ts
index 20d4596fd..bba678bbd 100644
--- a/src/documents/Documents.ts
+++ b/src/documents/Documents.ts
@@ -68,4 +68,25 @@ export namespace Documents {
doc.SetField(KeyStore.Data, new TextField(url));
return doc;
}
+
+ let collectionProto:Document;
+ function GetCollectionPrototype(): Document {
+ if(!collectionProto) {
+ collectionProto = new Document();
+ collectionProto.SetField(KeyStore.X, new NumberField(150));
+ collectionProto.SetField(KeyStore.Y, new NumberField(0));
+ collectionProto.SetField(KeyStore.Width, new NumberField(300));
+ collectionProto.SetField(KeyStore.Height, new NumberField(300));
+ collectionProto.SetField(KeyStore.Layout, new TextField('<CollectionFreeFormView doc={doc} fieldKey={DataKey}/>'));
+ collectionProto.SetField(KeyStore.LayoutKeys, new ListField([KeyStore.Data]));
+ }
+ return collectionProto;
+ }
+
+ export function CollectionDocument( documents: Array<Document>, options:DocumentOptions = {}): Document {
+ let doc = GetCollectionPrototype().MakeDelegate();
+ setupOptions(doc, options);
+ doc.SetField(KeyStore.Data, new ListField(documents));
+ return doc;
+ }
} \ No newline at end of file