Add business task component

This commit is contained in:
mauriziovitale84 2016-10-24 17:14:11 +01:00
parent da27437f13
commit 2e41b9ebd8
9 changed files with 173 additions and 3 deletions

View File

@ -0,0 +1,2 @@
<diagram-task [data]="data"></diagram-task>
<diagram-icon-business-rule-task [data]="data"></diagram-icon-business-rule-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-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() {
}
}

View File

@ -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
];

View File

@ -34,6 +34,9 @@
<div *ngSwitchCase="'ScriptTask'">
<diagram-script-task [data]="element"></diagram-script-task>
</div>
<div *ngSwitchCase="'BusinessRuleTask'">
<diagram-business-rule-task [data]="element"></diagram-business-rule-task>
</div>
</div>
</div>
<div *ngFor="let flow of diagram.flows">

View File

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

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-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' ;
}
}

View File

@ -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
];

View File

@ -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
];

View File

@ -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);
}
}