From 66cbc4f64b7e3fbcad0b92eedf866180dd7862d1 Mon Sep 17 00:00:00 2001 From: mauriziovitale84 Date: Fri, 21 Oct 2016 12:15:51 +0100 Subject: [PATCH] Add inclusive gatway component --- .../diagrams/diagram.component.html | 3 ++ .../diagram-inclusive-gateway.component.html | 3 ++ .../diagram-inclusive-gateway.component.ts | 50 +++++++++++++++++++ .../src/components/diagrams/gateway/index.ts | 3 ++ .../src/components/raphael/raphael.service.ts | 6 +-- 5 files changed, 62 insertions(+), 3 deletions(-) create mode 100644 ng2-components/ng2-activiti-analytics/src/components/diagrams/gateway/diagram-inclusive-gateway.component.html create mode 100644 ng2-components/ng2-activiti-analytics/src/components/diagrams/gateway/diagram-inclusive-gateway.component.ts diff --git a/ng2-components/ng2-activiti-analytics/src/components/diagrams/diagram.component.html b/ng2-components/ng2-activiti-analytics/src/components/diagrams/diagram.component.html index 787c3e43cc..17c7db8080 100644 --- a/ng2-components/ng2-activiti-analytics/src/components/diagrams/diagram.component.html +++ b/ng2-components/ng2-activiti-analytics/src/components/diagrams/diagram.component.html @@ -7,6 +7,9 @@
+
+ +
diff --git a/ng2-components/ng2-activiti-analytics/src/components/diagrams/gateway/diagram-inclusive-gateway.component.html b/ng2-components/ng2-activiti-analytics/src/components/diagrams/gateway/diagram-inclusive-gateway.component.html new file mode 100644 index 0000000000..f0c51dc5c1 --- /dev/null +++ b/ng2-components/ng2-activiti-analytics/src/components/diagrams/gateway/diagram-inclusive-gateway.component.html @@ -0,0 +1,3 @@ + + \ No newline at end of file diff --git a/ng2-components/ng2-activiti-analytics/src/components/diagrams/gateway/diagram-inclusive-gateway.component.ts b/ng2-components/ng2-activiti-analytics/src/components/diagrams/gateway/diagram-inclusive-gateway.component.ts new file mode 100644 index 0000000000..51a421d2c9 --- /dev/null +++ b/ng2-components/ng2-activiti-analytics/src/components/diagrams/gateway/diagram-inclusive-gateway.component.ts @@ -0,0 +1,50 @@ +/*! + * @license + * Copyright 2016 Alfresco Software, Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { Component, ElementRef, Input, Output, EventEmitter } from '@angular/core'; +import { DiagramColorService } from './../services/diagram-color.service'; + +@Component({ + moduleId: module.id, + selector: 'diagram-inclusive-gateway', + templateUrl: './diagram-inclusive-gateway.component.html', + styleUrls: ['./diagram-inclusive-gateway.component.css'] +}) +export class DiagramInclusiveGatewayComponent { + @Input() + data: any; + + @Output() + onError = new EventEmitter(); + + center: any = {}; + width: any; + height: any; + options: any = {stroke: '', fillColors: '', fillOpacity: '', strokeWidth: 2.5, radius: 9.75}; + + constructor(public elementRef: ElementRef, + private diagramColorService: DiagramColorService) {} + + ngOnInit() { + this.center.x = this.data.x + (this.data.width / 2); + this.center.y = this.data.y + (this.data.height / 2); + + this.options.stroke = this.diagramColorService.getBpmnColor(this.data, DiagramColorService.MAIN_STROKE_COLOR); + this.options.fillColors = this.diagramColorService.getFillColour(this.data.id); + this.options.fillOpacity = this.diagramColorService.getFillOpacity(); + } +} diff --git a/ng2-components/ng2-activiti-analytics/src/components/diagrams/gateway/index.ts b/ng2-components/ng2-activiti-analytics/src/components/diagrams/gateway/index.ts index 771c6af1cb..e226fd0224 100644 --- a/ng2-components/ng2-activiti-analytics/src/components/diagrams/gateway/index.ts +++ b/ng2-components/ng2-activiti-analytics/src/components/diagrams/gateway/index.ts @@ -17,15 +17,18 @@ import { DiagramGatewayComponent } from './diagram-gateway.component'; import { DiagramExclusiveGatewayComponent } from './diagram-exclusive-gateway.component'; +import { DiagramInclusiveGatewayComponent } from './diagram-inclusive-gateway.component'; import { DiagramParallelGatewayComponent } from './diagram-parallel-gateway.component'; // primitives export * from './diagram-gateway.component'; export * from './diagram-exclusive-gateway.component'; +export * from './diagram-inclusive-gateway.component'; export * from './diagram-parallel-gateway.component'; export const DIAGRAM_GATEWAY_DIRECTIVES: any[] = [ DiagramGatewayComponent, DiagramExclusiveGatewayComponent, + DiagramInclusiveGatewayComponent, DiagramParallelGatewayComponent ]; diff --git a/ng2-components/ng2-activiti-analytics/src/components/raphael/raphael.service.ts b/ng2-components/ng2-activiti-analytics/src/components/raphael/raphael.service.ts index 8908461502..c948d918e8 100644 --- a/ng2-components/ng2-activiti-analytics/src/components/raphael/raphael.service.ts +++ b/ng2-components/ng2-activiti-analytics/src/components/raphael/raphael.service.ts @@ -43,9 +43,9 @@ export class RaphaelService { if (typeof Raphael === 'undefined') { throw new Error('ng2-charts configuration issue: Embedding Chart.js lib is mandatory'); } - let paper = new Raphael(ctx, 583, 344.08374193550003); - paper.setViewBox(0, 0, 583, 344.08374193550003, false); - paper.renderfix(); + let paper = new Raphael(ctx, 1000, 500); + // paper.setViewBox(0, 0, 583, 344.08374193550003, false); + // paper.renderfix(); return paper; }