Add receive task component

This commit is contained in:
mauriziovitale84
2016-10-24 16:52:24 +01:00
parent 8bcd8b43a2
commit 156f227ffb
9 changed files with 172 additions and 3 deletions

View File

@@ -0,0 +1,2 @@
<diagram-task [data]="data"></diagram-task>
<diagram-icon-receive-task [data]="data"></diagram-icon-receive-task>

View File

@@ -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-receive-task',
templateUrl: './diagram-receive-task.component.html',
styleUrls: ['./diagram-receive-task.component.css']
})
export class DiagramReceiveTaskComponent {
@Input()
data: any;
@Output()
onError = new EventEmitter();
constructor(public elementRef: ElementRef,
private diagramColorService: DiagramColorService) {}
ngOnInit() {
}
}

View File

@@ -27,6 +27,7 @@ import { DiagramAlfrescoPublishTaskComponent } from './diagram-alfresco-publish-
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';
// primitives
export * from './diagram-container-service-task.component';
@@ -41,6 +42,7 @@ export * from './diagram-alfresco-publish-task.component';
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 const DIAGRAM_ACTIVITIES_DIRECTIVES: any[] = [
DiagramContainerServiceTaskComponent,
@@ -54,5 +56,6 @@ export const DIAGRAM_ACTIVITIES_DIRECTIVES: any[] = [
DiagramAlfrescoPublishTaskComponent,
DiagramRestCallTaskComponent,
DiagramGoogleDrivePublishTaskComponent,
DiagramBoxPublishTaskComponent
DiagramBoxPublishTaskComponent,
DiagramReceiveTaskComponent
];

View File

@@ -28,6 +28,9 @@
<div *ngSwitchCase="'ServiceTask'">
<diagram-container-service-task [data]="element"></diagram-container-service-task>
</div>
<div *ngSwitchCase="'ReceiveTask'">
<diagram-receive-task [data]="element"></diagram-receive-task>
</div>
</div>
</div>
<div *ngFor="let flow of diagram.flows">

View File

@@ -0,0 +1,2 @@
<raphael-icon-receive [position]="position" [stroke]="options.stroke" [strokeWidth]="options.strokeWidth"
[fillColors]="options.fillColors" [fillOpacity]="options.fillOpacity"></raphael-icon-receive>

View File

@@ -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-receive-task',
templateUrl: './diagram-icon-receive-task.component.html',
styleUrls: ['./diagram-icon-receive-task.component.css']
})
export class DiagramIconReceiveTaskComponent {
@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 + 2};
this.options.stroke = 'none' ;
this.options.fillColors = '#16964d' ;
}
}

View File

@@ -25,6 +25,7 @@ import { DiagramIconAlfrescoPublishTaskComponent } from './diagram-icon-alfresco
import { DiagramIconRestCallTaskComponent } from './diagram-icon-rest-call-task.component';
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';
// primitives
export * from './diagram-icon-service-task.component';
@@ -37,6 +38,7 @@ export * from './diagram-icon-alfresco-publish-task.component';
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 const DIAGRAM_ICONS_DIRECTIVES: any[] = [
DiagramIconServiceTaskComponent,
@@ -48,5 +50,6 @@ export const DIAGRAM_ICONS_DIRECTIVES: any[] = [
DiagramIconAlfrescoPublishTaskComponent,
DiagramIconRestCallTaskComponent,
DiagramIconGoogleDrivePublishTaskComponent,
DiagramIconBoxPublishTaskComponent
DiagramIconBoxPublishTaskComponent,
DiagramIconReceiveTaskComponent
];

View File

@@ -25,6 +25,7 @@ import { RaphaelIconAlfrescoPublishDirective } from './raphael-icon-alfresco-pub
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';
// primitives
export * from './raphael-icon-service.component';
@@ -37,6 +38,7 @@ export * from './raphael-icon-alfresco-publish.component';
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 const RAPHAEL_ICONS_DIRECTIVES: any[] = [
RaphaelIconServiceDirective,
@@ -48,5 +50,6 @@ export const RAPHAEL_ICONS_DIRECTIVES: any[] = [
RaphaelIconAlfrescoPublishDirective,
RaphaelIconRestCallDirective,
RaphaelIconGoogleDrivePublishDirective,
RaphaelIconBoxPublishDirective
RaphaelIconBoxPublishDirective,
RaphaelIconReceiveDirective
];

View File

@@ -0,0 +1,67 @@
/*!
* @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-receive'})
export class RaphaelIconReceiveDirective 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 0.5,2.5 0,13 17,0 0,-13 z M 2,4 6.5,8.5 2,13 z M 4,4 14,4 9,9 z m 12,0 0,9 -4.5,-4.5 z
M 7.5,9.5 9,11 10.5,9.5 15,14 3,14 z`).attr({
'stroke': this.stroke,
'fill': this.fillColors
});
return path1.transform('T' + position.x + ',' + position.y);
}
}