From 2e41b9ebd83e46cbb5457fe2e5787d4ffdb476e1 Mon Sep 17 00:00:00 2001 From: mauriziovitale84 Date: Mon, 24 Oct 2016 17:14:11 +0100 Subject: [PATCH] Add business task component --- .../diagram-business-rule-task.component.html | 2 + .../diagram-business-rule-task.component.ts | 40 +++++++++++ .../components/diagrams/activities/index.ts | 5 +- .../diagrams/diagram.component.html | 3 + ...ram-icon-business-rule-task.component.html | 2 + ...agram-icon-business-rule-task.component.ts | 46 +++++++++++++ .../src/components/diagrams/icons/index.ts | 5 +- .../src/components/raphael/icons/index.ts | 5 +- .../raphael-icon-business-rule.component.ts | 68 +++++++++++++++++++ 9 files changed, 173 insertions(+), 3 deletions(-) create mode 100644 ng2-components/ng2-activiti-analytics/src/components/diagrams/activities/diagram-business-rule-task.component.html create mode 100644 ng2-components/ng2-activiti-analytics/src/components/diagrams/activities/diagram-business-rule-task.component.ts create mode 100644 ng2-components/ng2-activiti-analytics/src/components/diagrams/icons/diagram-icon-business-rule-task.component.html create mode 100644 ng2-components/ng2-activiti-analytics/src/components/diagrams/icons/diagram-icon-business-rule-task.component.ts create mode 100644 ng2-components/ng2-activiti-analytics/src/components/raphael/icons/raphael-icon-business-rule.component.ts diff --git a/ng2-components/ng2-activiti-analytics/src/components/diagrams/activities/diagram-business-rule-task.component.html b/ng2-components/ng2-activiti-analytics/src/components/diagrams/activities/diagram-business-rule-task.component.html new file mode 100644 index 0000000000..c336058d68 --- /dev/null +++ b/ng2-components/ng2-activiti-analytics/src/components/diagrams/activities/diagram-business-rule-task.component.html @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/ng2-components/ng2-activiti-analytics/src/components/diagrams/activities/diagram-business-rule-task.component.ts b/ng2-components/ng2-activiti-analytics/src/components/diagrams/activities/diagram-business-rule-task.component.ts new file mode 100644 index 0000000000..1484e02044 --- /dev/null +++ b/ng2-components/ng2-activiti-analytics/src/components/diagrams/activities/diagram-business-rule-task.component.ts @@ -0,0 +1,40 @@ +/*! + * @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-business-rule-task', + templateUrl: './diagram-business-rule-task.component.html', + styleUrls: ['./diagram-business-rule-task.component.css'] +}) +export class DiagramBusinessRuleTaskComponent { + @Input() + data: any; + + @Output() + onError = new EventEmitter(); + + constructor(public elementRef: ElementRef, + private diagramColorService: DiagramColorService) {} + + ngOnInit() { + + } +} diff --git a/ng2-components/ng2-activiti-analytics/src/components/diagrams/activities/index.ts b/ng2-components/ng2-activiti-analytics/src/components/diagrams/activities/index.ts index 19e90bb12c..3bafb65341 100644 --- a/ng2-components/ng2-activiti-analytics/src/components/diagrams/activities/index.ts +++ b/ng2-components/ng2-activiti-analytics/src/components/diagrams/activities/index.ts @@ -29,6 +29,7 @@ import { DiagramGoogleDrivePublishTaskComponent } from './diagram-google-drive-p import { DiagramBoxPublishTaskComponent } from './diagram-box-publish-task.component'; import { DiagramReceiveTaskComponent } from './diagram-receive-task.component'; import { DiagramScriptTaskComponent } from './diagram-script-task.component'; +import { DiagramBusinessRuleTaskComponent } from './diagram-business-rule-task.component'; // primitives export * from './diagram-container-service-task.component'; @@ -45,6 +46,7 @@ export * from './diagram-google-drive-publish-task.component'; export * from './diagram-box-publish-task.component'; export * from './diagram-receive-task.component'; export * from './diagram-script-task.component'; +export * from './diagram-business-rule-task.component'; export const DIAGRAM_ACTIVITIES_DIRECTIVES: any[] = [ DiagramContainerServiceTaskComponent, @@ -60,5 +62,6 @@ export const DIAGRAM_ACTIVITIES_DIRECTIVES: any[] = [ DiagramGoogleDrivePublishTaskComponent, DiagramBoxPublishTaskComponent, DiagramReceiveTaskComponent, - DiagramScriptTaskComponent + DiagramScriptTaskComponent, + DiagramBusinessRuleTaskComponent ]; 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 bc390d89c4..3d50a010b2 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 @@ -34,6 +34,9 @@
+
+ +
diff --git a/ng2-components/ng2-activiti-analytics/src/components/diagrams/icons/diagram-icon-business-rule-task.component.html b/ng2-components/ng2-activiti-analytics/src/components/diagrams/icons/diagram-icon-business-rule-task.component.html new file mode 100644 index 0000000000..fe8358e3e3 --- /dev/null +++ b/ng2-components/ng2-activiti-analytics/src/components/diagrams/icons/diagram-icon-business-rule-task.component.html @@ -0,0 +1,2 @@ + \ No newline at end of file diff --git a/ng2-components/ng2-activiti-analytics/src/components/diagrams/icons/diagram-icon-business-rule-task.component.ts b/ng2-components/ng2-activiti-analytics/src/components/diagrams/icons/diagram-icon-business-rule-task.component.ts new file mode 100644 index 0000000000..53b946dfaa --- /dev/null +++ b/ng2-components/ng2-activiti-analytics/src/components/diagrams/icons/diagram-icon-business-rule-task.component.ts @@ -0,0 +1,46 @@ +/*! + * @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-icon-business-rule-task', + templateUrl: './diagram-icon-business-rule-task.component.html', + styleUrls: ['./diagram-icon-business-rule-task.component.css'] +}) +export class DiagramIconBusinessRuleTaskComponent { + @Input() + data: any; + + @Output() + onError = new EventEmitter(); + + position: any; + + options: any = {stroke: '', fillColors: '', fillOpacity: '', strokeWidth: ''}; + + constructor(public elementRef: ElementRef, + private diagramColorService: DiagramColorService) {} + + ngOnInit() { + this.position = {x: this.data.x + 4, y: this.data.y + 4}; + this.options.stroke = 'none' ; + this.options.fillColors = '#72a7d0' ; + } +} diff --git a/ng2-components/ng2-activiti-analytics/src/components/diagrams/icons/index.ts b/ng2-components/ng2-activiti-analytics/src/components/diagrams/icons/index.ts index c6104382b2..01585c1b42 100644 --- a/ng2-components/ng2-activiti-analytics/src/components/diagrams/icons/index.ts +++ b/ng2-components/ng2-activiti-analytics/src/components/diagrams/icons/index.ts @@ -27,6 +27,7 @@ import { DiagramIconGoogleDrivePublishTaskComponent } from './diagram-icon-googl import { DiagramIconBoxPublishTaskComponent } from './diagram-icon-box-publish-task.component'; import { DiagramIconReceiveTaskComponent } from './diagram-icon-receive-task.component'; import { DiagramIconScriptTaskComponent } from './diagram-icon-script-task.component'; +import { DiagramIconBusinessRuleTaskComponent } from './diagram-icon-business-rule-task.component'; // primitives export * from './diagram-icon-service-task.component'; @@ -41,6 +42,7 @@ export * from './diagram-icon-google-drive-publish-task.component'; export * from './diagram-icon-box-publish-task.component'; export * from './diagram-icon-receive-task.component'; export * from './diagram-icon-script-task.component'; +export * from './diagram-icon-business-rule-task.component'; export const DIAGRAM_ICONS_DIRECTIVES: any[] = [ DiagramIconServiceTaskComponent, @@ -54,5 +56,6 @@ export const DIAGRAM_ICONS_DIRECTIVES: any[] = [ DiagramIconGoogleDrivePublishTaskComponent, DiagramIconBoxPublishTaskComponent, DiagramIconReceiveTaskComponent, - DiagramIconScriptTaskComponent + DiagramIconScriptTaskComponent, + DiagramIconBusinessRuleTaskComponent ]; diff --git a/ng2-components/ng2-activiti-analytics/src/components/raphael/icons/index.ts b/ng2-components/ng2-activiti-analytics/src/components/raphael/icons/index.ts index 61f8ab8b89..8edbc173d8 100644 --- a/ng2-components/ng2-activiti-analytics/src/components/raphael/icons/index.ts +++ b/ng2-components/ng2-activiti-analytics/src/components/raphael/icons/index.ts @@ -27,6 +27,7 @@ import { RaphaelIconGoogleDrivePublishDirective } from './raphael-icon-google-dr import { RaphaelIconBoxPublishDirective } from './raphael-icon-box-publish.component'; import { RaphaelIconReceiveDirective } from './raphael-icon-receive.component'; import { RaphaelIconScriptDirective } from './raphael-icon-script.component'; +import { RaphaelIconBusinessRuleDirective } from './raphael-icon-business-rule.component'; // primitives export * from './raphael-icon-service.component'; @@ -41,6 +42,7 @@ export * from './raphael-icon-google-drive-publish.component'; export * from './raphael-icon-box-publish.component'; export * from './raphael-icon-receive.component'; export * from './raphael-icon-script.component'; +export * from './raphael-icon-business-rule.component'; export const RAPHAEL_ICONS_DIRECTIVES: any[] = [ RaphaelIconServiceDirective, @@ -54,5 +56,6 @@ export const RAPHAEL_ICONS_DIRECTIVES: any[] = [ RaphaelIconGoogleDrivePublishDirective, RaphaelIconBoxPublishDirective, RaphaelIconReceiveDirective, - RaphaelIconScriptDirective + RaphaelIconScriptDirective, + RaphaelIconBusinessRuleDirective ]; diff --git a/ng2-components/ng2-activiti-analytics/src/components/raphael/icons/raphael-icon-business-rule.component.ts b/ng2-components/ng2-activiti-analytics/src/components/raphael/icons/raphael-icon-business-rule.component.ts new file mode 100644 index 0000000000..c782593f0c --- /dev/null +++ b/ng2-components/ng2-activiti-analytics/src/components/raphael/icons/raphael-icon-business-rule.component.ts @@ -0,0 +1,68 @@ +/*! + * @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 { Directive, OnInit, ElementRef, Input, Output, EventEmitter } from '@angular/core'; +import { Point } from './../models/point'; +import { RaphaelBase } from './../raphael-base'; +import { RaphaelService } from './../raphael.service'; + +@Directive({selector: 'raphael-icon-business-rule'}) +export class RaphaelIconBusinessRuleDirective extends RaphaelBase implements OnInit { + @Input() + paper: any; + + @Input() + position: Point; + + @Input() + text: string; + + @Output() + onError = new EventEmitter(); + + @Input() + strokeWidth: number; + + @Input() + fillColors: any; + + @Input() + stroke: any; + + @Input() + fillOpacity: any; + + constructor(public elementRef: ElementRef, + raphaelService: RaphaelService) { + super(elementRef, raphaelService); + } + + ngOnInit() { + console.log(this.elementRef); + this.draw(this.position); + } + + public draw(position: Point) { + let path1 = this.paper.path(`m 1,2 0,14 16,0 0,-14 z m 1.45458,5.6000386 2.90906,0 0,2.7999224 -2.90906,0 z m 4.36364,0 8.72718,0 + 0,2.7999224 -8.72718,0 z m -4.36364,4.1998844 2.90906,0 0,2.800116 -2.90906,0 z m + 4.36364,0 8.72718,0 0,2.800116 -8.72718,0 z`).attr({ + 'stroke': this.stroke, + 'fill': this.fillColors + }); + return path1.transform('T' + position.x + ',' + position.y); + } +}