summaryrefslogtreecommitdiff
path: root/src/js/shape/mxStencilRegistry.js
diff options
context:
space:
mode:
authorAdhitya Kamakshidasan2016-04-04 20:02:27 +0530
committerAdhitya Kamakshidasan2016-04-04 20:02:27 +0530
commit5d474b6e265806c9df3fc80e06f8b4dd7fe16aea (patch)
treef64a5027d57f49b9833a8eea48acbd0905a1ceb3 /src/js/shape/mxStencilRegistry.js
downloadxcos-on-web-5d474b6e265806c9df3fc80e06f8b4dd7fe16aea.tar.gz
xcos-on-web-5d474b6e265806c9df3fc80e06f8b4dd7fe16aea.tar.bz2
xcos-on-web-5d474b6e265806c9df3fc80e06f8b4dd7fe16aea.zip
Initial Commit
Diffstat (limited to 'src/js/shape/mxStencilRegistry.js')
-rw-r--r--src/js/shape/mxStencilRegistry.js53
1 files changed, 53 insertions, 0 deletions
diff --git a/src/js/shape/mxStencilRegistry.js b/src/js/shape/mxStencilRegistry.js
new file mode 100644
index 0000000..7621573
--- /dev/null
+++ b/src/js/shape/mxStencilRegistry.js
@@ -0,0 +1,53 @@
+/**
+ * $Id: mxStencilRegistry.js,v 1.2 2011-07-15 12:57:50 gaudenz Exp $
+ * Copyright (c) 2006-2010, JGraph Ltd
+ *
+ * Code to add stencils.
+ *
+ * (code)
+ * var req = mxUtils.load('test/stencils.xml');
+ * var root = req.getDocumentElement();
+ * var shape = root.firstChild;
+ *
+ * while (shape != null)
+ * {
+ * if (shape.nodeType == mxConstants.NODETYPE_ELEMENT)
+ * {
+ * mxStencilRegistry.addStencil(shape.getAttribute('name'), new mxStencil(shape));
+ * }
+ *
+ * shape = shape.nextSibling;
+ * }
+ * (end)
+ */
+var mxStencilRegistry =
+{
+ /**
+ * Class: mxStencilRegistry
+ *
+ * A singleton class that provides a registry for stencils and the methods
+ * for painting those stencils onto a canvas or into a DOM.
+ */
+ stencils: [],
+
+ /**
+ * Function: addStencil
+ *
+ * Adds the given <mxStencil>.
+ */
+ addStencil: function(name, stencil)
+ {
+ mxStencilRegistry.stencils[name] = stencil;
+ },
+
+ /**
+ * Function: getStencil
+ *
+ * Returns the <mxStencil> for the given name.
+ */
+ getStencil: function(name)
+ {
+ return mxStencilRegistry.stencils[name];
+ }
+
+};