From da27437f1342176ddb8d4d26c3a008be54d60c33 Mon Sep 17 00:00:00 2001 From: mauriziovitale84 Date: Mon, 24 Oct 2016 17:04:29 +0100 Subject: [PATCH] Add script task component --- .../diagram-script-task.component.html | 2 + .../diagram-script-task.component.ts | 40 +++++++++++ .../components/diagrams/activities/index.ts | 5 +- .../diagrams/diagram.component.html | 3 + .../diagram-icon-script-task.component.html | 2 + .../diagram-icon-script-task.component.ts | 46 +++++++++++++ .../src/components/diagrams/icons/index.ts | 5 +- .../src/components/raphael/icons/index.ts | 5 +- .../icons/raphael-icon-script.component.ts | 68 +++++++++++++++++++ 9 files changed, 173 insertions(+), 3 deletions(-) create mode 100644 ng2-components/ng2-activiti-analytics/src/components/diagrams/activities/diagram-script-task.component.html create mode 100644 ng2-components/ng2-activiti-analytics/src/components/diagrams/activities/diagram-script-task.component.ts create mode 100644 ng2-components/ng2-activiti-analytics/src/components/diagrams/icons/diagram-icon-script-task.component.html create mode 100644 ng2-components/ng2-activiti-analytics/src/components/diagrams/icons/diagram-icon-script-task.component.ts create mode 100644 ng2-components/ng2-activiti-analytics/src/components/raphael/icons/raphael-icon-script.component.ts diff --git a/ng2-components/ng2-activiti-analytics/src/components/diagrams/activities/diagram-script-task.component.html b/ng2-components/ng2-activiti-analytics/src/components/diagrams/activities/diagram-script-task.component.html new file mode 100644 index 0000000000..3636798f8d --- /dev/null +++ b/ng2-components/ng2-activiti-analytics/src/components/diagrams/activities/diagram-script-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-script-task.component.ts b/ng2-components/ng2-activiti-analytics/src/components/diagrams/activities/diagram-script-task.component.ts new file mode 100644 index 0000000000..f30752b07f --- /dev/null +++ b/ng2-components/ng2-activiti-analytics/src/components/diagrams/activities/diagram-script-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-script-task', + templateUrl: './diagram-script-task.component.html', + styleUrls: ['./diagram-script-task.component.css'] +}) +export class DiagramScriptTaskComponent { + @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 d6d8d400af..19e90bb12c 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 @@ -28,6 +28,7 @@ import { DiagramRestCallTaskComponent } from './diagram-rest-call-task.component import { DiagramGoogleDrivePublishTaskComponent } from './diagram-google-drive-publish-task.component'; import { DiagramBoxPublishTaskComponent } from './diagram-box-publish-task.component'; import { DiagramReceiveTaskComponent } from './diagram-receive-task.component'; +import { DiagramScriptTaskComponent } from './diagram-script-task.component'; // primitives export * from './diagram-container-service-task.component'; @@ -43,6 +44,7 @@ export * from './diagram-rest-call-task.component'; 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 const DIAGRAM_ACTIVITIES_DIRECTIVES: any[] = [ DiagramContainerServiceTaskComponent, @@ -57,5 +59,6 @@ export const DIAGRAM_ACTIVITIES_DIRECTIVES: any[] = [ DiagramRestCallTaskComponent, DiagramGoogleDrivePublishTaskComponent, DiagramBoxPublishTaskComponent, - DiagramReceiveTaskComponent + DiagramReceiveTaskComponent, + DiagramScriptTaskComponent ]; 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 2e13f391b3..bc390d89c4 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 @@ -31,6 +31,9 @@
+
+ +
diff --git a/ng2-components/ng2-activiti-analytics/src/components/diagrams/icons/diagram-icon-script-task.component.html b/ng2-components/ng2-activiti-analytics/src/components/diagrams/icons/diagram-icon-script-task.component.html new file mode 100644 index 0000000000..d3a6cacdc3 --- /dev/null +++ b/ng2-components/ng2-activiti-analytics/src/components/diagrams/icons/diagram-icon-script-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-script-task.component.ts b/ng2-components/ng2-activiti-analytics/src/components/diagrams/icons/diagram-icon-script-task.component.ts new file mode 100644 index 0000000000..3b034af4ab --- /dev/null +++ b/ng2-components/ng2-activiti-analytics/src/components/diagrams/icons/diagram-icon-script-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-script-task', + templateUrl: './diagram-icon-script-task.component.html', + styleUrls: ['./diagram-icon-script-task.component.css'] +}) +export class DiagramIconScriptTaskComponent { + @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 f4d3f719be..c6104382b2 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 @@ -26,6 +26,7 @@ import { DiagramIconRestCallTaskComponent } from './diagram-icon-rest-call-task. import { DiagramIconGoogleDrivePublishTaskComponent } from './diagram-icon-google-drive-publish-task.component'; 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'; // primitives export * from './diagram-icon-service-task.component'; @@ -39,6 +40,7 @@ export * from './diagram-icon-rest-call-task.component'; 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 const DIAGRAM_ICONS_DIRECTIVES: any[] = [ DiagramIconServiceTaskComponent, @@ -51,5 +53,6 @@ export const DIAGRAM_ICONS_DIRECTIVES: any[] = [ DiagramIconRestCallTaskComponent, DiagramIconGoogleDrivePublishTaskComponent, DiagramIconBoxPublishTaskComponent, - DiagramIconReceiveTaskComponent + DiagramIconReceiveTaskComponent, + DiagramIconScriptTaskComponent ]; 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 fa124e96cd..61f8ab8b89 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 @@ -26,6 +26,7 @@ import { RaphaelIconRestCallDirective } from './raphael-icon-rest-call.component import { RaphaelIconGoogleDrivePublishDirective } from './raphael-icon-google-drive-publish.component'; import { RaphaelIconBoxPublishDirective } from './raphael-icon-box-publish.component'; import { RaphaelIconReceiveDirective } from './raphael-icon-receive.component'; +import { RaphaelIconScriptDirective } from './raphael-icon-script.component'; // primitives export * from './raphael-icon-service.component'; @@ -39,6 +40,7 @@ export * from './raphael-icon-rest-call.component'; 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 const RAPHAEL_ICONS_DIRECTIVES: any[] = [ RaphaelIconServiceDirective, @@ -51,5 +53,6 @@ export const RAPHAEL_ICONS_DIRECTIVES: any[] = [ RaphaelIconRestCallDirective, RaphaelIconGoogleDrivePublishDirective, RaphaelIconBoxPublishDirective, - RaphaelIconReceiveDirective + RaphaelIconReceiveDirective, + RaphaelIconScriptDirective ]; diff --git a/ng2-components/ng2-activiti-analytics/src/components/raphael/icons/raphael-icon-script.component.ts b/ng2-components/ng2-activiti-analytics/src/components/raphael/icons/raphael-icon-script.component.ts new file mode 100644 index 0000000000..beee45747b --- /dev/null +++ b/ng2-components/ng2-activiti-analytics/src/components/raphael/icons/raphael-icon-script.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-script'}) +export class RaphaelIconScriptDirective 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 5,2 0,0.094 c 0.23706,0.064 0.53189,0.1645 0.8125,0.375 0.5582,0.4186 1.05109,1.228 1.15625,2.5312 + l 8.03125,0 1,0 1,0 c 0,-3 -2,-3 -2,-3 l -10,0 z M 4,3 4,13 2,13 c 0,3 2,3 2,3 l 9,0 c 0,0 2,0 2,-3 L 15,6 6,6 6,5.5 C 6,4.1111 + 5.5595,3.529 5.1875,3.25 4.8155,2.971 4.5,3 4.5,3 L 4,3 z`).attr({ + 'stroke': this.stroke, + 'fill': this.fillColors + }); + return path1.transform('T' + position.x + ',' + position.y); + } +}