Add boundary event component

This commit is contained in:
mauriziovitale84 2016-10-25 10:18:03 +01:00
parent 2e41b9ebd8
commit 2b907348d5
12 changed files with 281 additions and 3 deletions

View File

@ -0,0 +1,5 @@
<raphael-circle [center]="center" [radius]="circleRadiusInner" [strokeWidth]="options.strokeWidth" [stroke]="options.stroke"
[fillColors]="options.fillColors" [fillOpacity]="options.fillOpacity"></raphael-circle>
<raphael-circle [center]="center" [radius]="circleRadiusOuter" [strokeWidth]="options.strokeWidth" [stroke]="options.stroke"
[fillColors]="options.fillColors" [fillOpacity]="options.fillOpacity"></raphael-circle>
<diagram-container-icon-event [data]="data" [type]="data.eventDefinition.type"></diagram-container-icon-event>

View File

@ -0,0 +1,54 @@
/*!
* @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-boundary-event',
templateUrl: './diagram-boundary-event.component.html',
styleUrls: ['./diagram-boundary-event.component.css']
})
export class DiagramBoundaryEventComponent {
@Input()
data: any;
@Output()
onError = new EventEmitter();
center: any = {};
options: any = {stroke: '', fillColors: '', fillOpacity: '', strokeWidth: 1};
circleRadiusInner: number;
circleRadiusOuter: number;
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.circleRadiusInner = 12;
this.circleRadiusOuter = 15;
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();
}
}

View File

@ -0,0 +1,25 @@
/*!
* @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 { DiagramBoundaryEventComponent } from './diagram-boundary-event.component';
// primitives
export * from './diagram-boundary-event.component';
export const DIAGRAM_BOUNDARY_EVENTS_DIRECTIVES: any[] = [
DiagramBoundaryEventComponent
];

View File

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

View File

@ -0,0 +1,5 @@
<div [ngSwitch]="type">
<div *ngSwitchCase="'timer'">
<diagram-icon-timer [data]="data"></diagram-icon-timer>
</div>
</div>

View File

@ -0,0 +1,42 @@
/*!
* @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-container-icon-event',
templateUrl: './diagram-container-icon-event.component.html',
styleUrls: ['./diagram-container-icon-event.component.css']
})
export class DiagramContainerIconEventTaskComponent {
@Input()
data: any;
@Input()
type: string;
@Output()
onError = new EventEmitter();
constructor(public elementRef: ElementRef,
private diagramColorService: DiagramColorService) {}
ngOnInit() {
}
}

View File

@ -0,0 +1,4 @@
<raphael-circle [center]="center" [radius]="circleRadius" [strokeWidth]="circleOptions.strokeWidth" [stroke]="circleOptions.stroke"
[fillColors]="circleOptions.fillColors" [fillOpacity]="circleOptions.fillOpacity"></raphael-circle>
<raphael-icon-timer [position]="position" [stroke]="timerOptions.stroke" [strokeWidth]="timerOptions.strokeWidth"
[fillColors]="timerOptions.fillColors" [fillOpacity]="timerOptions.fillOpacity"></raphael-icon-timer>

View File

@ -0,0 +1,56 @@
/*!
* @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-timer',
templateUrl: './diagram-icon-timer.component.html',
styleUrls: ['./diagram-icon-timer.component.css']
})
export class DiagramIconTimerComponent {
@Input()
data: any;
@Output()
onError = new EventEmitter();
center: any = {};
position: any;
circleRadius: number;
circleOptions: any = {stroke: '', fillColors: '', fillOpacity: '', strokeWidth: ''};
timerOptions: any = {stroke: '', fillColors: '', fillOpacity: '', strokeWidth: ''};
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.circleRadius = 10;
this.position = {x: this.data.x + 5, y: this.data.y + 5};
this.circleOptions.stroke = 'black' ;
this.circleOptions.fillColors = 'none' ;
this.timerOptions.stroke = 'none' ;
this.timerOptions.fillColors = '#585858' ;
}
}

View File

@ -28,6 +28,8 @@ import { DiagramIconBoxPublishTaskComponent } from './diagram-icon-box-publish-t
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';
import { DiagramContainerIconEventTaskComponent } from './diagram-container-icon-event.component';
import { DiagramIconTimerComponent } from './diagram-icon-timer.component';
// primitives
export * from './diagram-icon-service-task.component';
@ -43,6 +45,8 @@ 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 * from './diagram-container-icon-event.component';
export * from './diagram-icon-timer.component';
export const DIAGRAM_ICONS_DIRECTIVES: any[] = [
DiagramIconServiceTaskComponent,
@ -57,5 +61,7 @@ export const DIAGRAM_ICONS_DIRECTIVES: any[] = [
DiagramIconBoxPublishTaskComponent,
DiagramIconReceiveTaskComponent,
DiagramIconScriptTaskComponent,
DiagramIconBusinessRuleTaskComponent
DiagramIconBusinessRuleTaskComponent,
DiagramContainerIconEventTaskComponent,
DiagramIconTimerComponent
];

View File

@ -21,6 +21,7 @@ import { DIAGRAM_ACTIVITIES_DIRECTIVES } from './activities/index';
import { DIAGRAM_EVENTS_DIRECTIVES } from './events/index';
import { DIAGRAM_GATEWAY_DIRECTIVES } from './gateways/index';
import { DIAGRAM_ICONS_DIRECTIVES } from './icons/index';
import { DIAGRAM_BOUNDARY_EVENTS_DIRECTIVES } from './boundary-events/index';
import { DiagramColorService } from './services/diagram-color.service';
@ -30,6 +31,7 @@ export * from './events/index';
export * from './activities/index';
export * from './icons/index';
export * from './diagram-sequence-flow.component';
export * from './boundary-events/index';
export const DIAGRAM_DIRECTIVES: any[] = [
DiagramComponent,
@ -37,7 +39,8 @@ export const DIAGRAM_DIRECTIVES: any[] = [
DIAGRAM_ACTIVITIES_DIRECTIVES,
DiagramSequenceFlowComponent,
DIAGRAM_GATEWAY_DIRECTIVES,
DIAGRAM_ICONS_DIRECTIVES
DIAGRAM_ICONS_DIRECTIVES,
DIAGRAM_BOUNDARY_EVENTS_DIRECTIVES
];
export const DIAGRAM_PROVIDERS: any[] = [

View File

@ -28,6 +28,7 @@ import { RaphaelIconBoxPublishDirective } from './raphael-icon-box-publish.compo
import { RaphaelIconReceiveDirective } from './raphael-icon-receive.component';
import { RaphaelIconScriptDirective } from './raphael-icon-script.component';
import { RaphaelIconBusinessRuleDirective } from './raphael-icon-business-rule.component';
import { RaphaelIconTimerDirective } from './raphael-icon-timer.component';
// primitives
export * from './raphael-icon-service.component';
@ -43,6 +44,7 @@ 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 * from './raphael-icon-timer.component';
export const RAPHAEL_ICONS_DIRECTIVES: any[] = [
RaphaelIconServiceDirective,
@ -57,5 +59,6 @@ export const RAPHAEL_ICONS_DIRECTIVES: any[] = [
RaphaelIconBoxPublishDirective,
RaphaelIconReceiveDirective,
RaphaelIconScriptDirective,
RaphaelIconBusinessRuleDirective
RaphaelIconBusinessRuleDirective,
RaphaelIconTimerDirective
];

View File

@ -0,0 +1,72 @@
/*!
* @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-timer'})
export class RaphaelIconTimerDirective 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 10 0 C 4.4771525 0 0 4.4771525 0 10 C 0 15.522847 4.4771525 20 10 20 C 15.522847 20 20 15.522847 20
10 C 20 4.4771525 15.522847 1.1842379e-15 10 0 z M 9.09375 1.03125 C 9.2292164 1.0174926 9.362825 1.0389311 9.5 1.03125 L 9.5 3.5
L 10.5 3.5 L 10.5 1.03125 C 15.063526 1.2867831 18.713217 4.9364738 18.96875 9.5 L 16.5 9.5 L 16.5 10.5 L 18.96875 10.5 C 18.713217
15.063526 15.063526 18.713217 10.5 18.96875 L 10.5 16.5 L 9.5 16.5 L 9.5 18.96875 C 4.9364738 18.713217 1.2867831 15.063526 1.03125
10.5 L 3.5 10.5 L 3.5 9.5 L 1.03125 9.5 C 1.279102 5.0736488 4.7225326 1.4751713 9.09375 1.03125 z M 9.5 5 L 9.5 8.0625 C 8.6373007
8.2844627 8 9.0680195 8 10 C 8 11.104569 8.8954305 12 10 12 C 10.931981 12 11.715537 11.362699 11.9375 10.5 L 14 10.5 L 14 9.5
L 11.9375 9.5 C 11.756642 8.7970599 11.20294 8.2433585 10.5 8.0625 L 10.5 5 L 9.5 5 z`).attr({
'stroke': this.stroke,
'fill': this.fillColors
});
return path1.transform('T' + position.x + ',' + position.y);
}
}