added svcapi ui and camunda code
[it/otf.git] / otf-frontend / client / src / app / layout / modeler / color-picker / ColoredRenderer.js
diff --git a/otf-frontend/client/src/app/layout/modeler/color-picker/ColoredRenderer.js b/otf-frontend/client/src/app/layout/modeler/color-picker/ColoredRenderer.js
new file mode 100644 (file)
index 0000000..957e8b9
--- /dev/null
@@ -0,0 +1,67 @@
+/*  Copyright (c) 2019 AT&T Intellectual Property.                             #\r
+#                                                                              #\r
+#   Licensed under the Apache License, Version 2.0 (the "License");            #\r
+#   you may not use this file except in compliance with the License.           #\r
+#   You may obtain a copy of the License at                                    #\r
+#                                                                              #\r
+#       http://www.apache.org/licenses/LICENSE-2.0                             #\r
+#                                                                              #\r
+#   Unless required by applicable law or agreed to in writing, software        #\r
+#   distributed under the License is distributed on an "AS IS" BASIS,          #\r
+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #\r
+#   See the License for the specific language governing permissions and        #\r
+#   limitations under the License.                                             #\r
+##############################################################################*/\r
+\r
+\r
+import inherits from 'inherits';\r
+\r
+import {\r
+  attr as svgAttr\r
+} from 'tiny-svg';\r
+\r
+import BpmnRenderer from 'bpmn-js/lib/draw/BpmnRenderer';\r
+\r
+import {\r
+  is\r
+} from 'bpmn-js/lib/util/ModelUtil';\r
+\r
+\r
+export default function ColoredRenderer(\r
+    config, eventBus, styles,\r
+    pathMap, canvas, textRenderer) {\r
+\r
+  BpmnRenderer.call(\r
+    this,\r
+    config, eventBus, styles,\r
+    pathMap, canvas, textRenderer,\r
+    1400\r
+  );\r
+\r
+  this.canRender = function(element) {\r
+    return is(element, 'bpmn:BaseElement') && element.color;\r
+  };\r
+\r
+  this.drawShape = function(parent, shape) {\r
+\r
+    var bpmnShape = this.drawBpmnShape(parent, shape);\r
+\r
+    svgAttr(bpmnShape, { fill: shape.color });\r
+\r
+    return bpmnShape;\r
+  };\r
+}\r
+\r
+inherits(ColoredRenderer, BpmnRenderer);\r
+\r
+ColoredRenderer.prototype.drawBpmnShape = BpmnRenderer.prototype.drawShape;\r
+\r
+\r
+ColoredRenderer.$inject = [\r
+  'config.bpmnRenderer',\r
+  'eventBus',\r
+  'styles',\r
+  'pathMap',\r
+  'canvas',\r
+  'textRenderer'\r
+];
\ No newline at end of file