Add subprocess component and fix start/end event icon

This commit is contained in:
mauriziovitale84 2016-10-25 15:08:38 +01:00
parent 602d44f2fa
commit 7b44819326
13 changed files with 185 additions and 16 deletions

View File

@ -2,7 +2,7 @@
<div *ngFor="let element of diagram.elements"> <div *ngFor="let element of diagram.elements">
<div [ngSwitch]="element.type"> <div [ngSwitch]="element.type">
<div *ngSwitchCase="'StartEvent'"> <div *ngSwitchCase="'StartEvent'">
<diagram-event [data]="element" [radius]="15" [strokeWidth]="1"></diagram-event> <diagram-start-event [data]="element"></diagram-start-event>
</div> </div>
<div *ngSwitchCase="'ExclusiveGateway'"> <div *ngSwitchCase="'ExclusiveGateway'">
<diagram-exclusive-gateway [data]="element"></diagram-exclusive-gateway> <diagram-exclusive-gateway [data]="element"></diagram-exclusive-gateway>
@ -17,7 +17,7 @@
<diagram-parallel-gateway [data]="element"></diagram-parallel-gateway> <diagram-parallel-gateway [data]="element"></diagram-parallel-gateway>
</div> </div>
<div *ngSwitchCase="'EndEvent'"> <div *ngSwitchCase="'EndEvent'">
<diagram-event [data]="element" [radius]="14" [strokeWidth]="4"></diagram-event> <diagram-end-event [data]="element"></diagram-end-event>
</div> </div>
<div *ngSwitchCase="'UserTask'"> <div *ngSwitchCase="'UserTask'">
<diagram-user-task [data]="element"></diagram-user-task> <diagram-user-task [data]="element"></diagram-user-task>
@ -49,6 +49,9 @@
<div *ngSwitchCase="'SubProcess'"> <div *ngSwitchCase="'SubProcess'">
<diagram-subprocess [data]="element"></diagram-subprocess> <diagram-subprocess [data]="element"></diagram-subprocess>
</div> </div>
<div *ngSwitchCase="'EventSubProcess'">
<diagram-event-subprocess [data]="element"></diagram-event-subprocess>
</div>
</div> </div>
</div> </div>
<div *ngFor="let flow of diagram.flows"> <div *ngFor="let flow of diagram.flows">

View File

@ -0,0 +1 @@
<diagram-event [data]="data" [options]="options" [iconFillColor]="iconFillColor"></diagram-event>

View File

@ -0,0 +1,51 @@
/*!
* @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-end-event',
templateUrl: './diagram-end-event.component.html',
styleUrls: ['./diagram-end-event.component.css']
})
export class DiagramEndEventComponent {
@Input()
data: any;
@Output()
onError = new EventEmitter();
options: any = {stroke: '', fillColors: '', fillOpacity: '', strokeWidth: '', radius: ''};
iconFillColor: any;
constructor(public elementRef: ElementRef,
private diagramColorService: DiagramColorService) {}
ngOnInit() {
console.log(this.elementRef);
this.options.radius = 14;
this.options.strokeWidth = 4;
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();
this.iconFillColor = 'black';
}
}

View File

@ -1,2 +1,4 @@
<raphael-circle [center]="center" [radius]="options.radius" [strokeWidth]="options.strokeWidth" [stroke]="options.stroke" <raphael-circle [center]="center" [radius]="options.radius" [strokeWidth]="options.strokeWidth" [stroke]="options.stroke"
[fillColors]="options.fillColors" [fillOpacity]="options.fillOpacity"></raphael-circle> [fillColors]="options.fillColors" [fillOpacity]="options.fillOpacity"></raphael-circle>
<diagram-container-icon-event [data]="data" [type]="data.eventDefinition && data.eventDefinition.type"
[fillColor]="iconFillColor"></diagram-container-icon-event>

View File

@ -29,16 +29,15 @@ export class DiagramEventComponent {
data: any; data: any;
@Input() @Input()
strokeWidth: number; options: any = {stroke: '', fillColors: '', fillOpacity: '', strokeWidth: '', radius: ''};
@Input() @Input()
radius: number; iconFillColor: any;
@Output() @Output()
onError = new EventEmitter(); onError = new EventEmitter();
center: any = {}; center: any = {};
options: any = {stroke: '', fillColors: '', fillOpacity: '', strokeWidth: '', radius: ''};
constructor(public elementRef: ElementRef, constructor(public elementRef: ElementRef,
private diagramColorService: DiagramColorService) {} private diagramColorService: DiagramColorService) {}
@ -47,11 +46,5 @@ export class DiagramEventComponent {
console.log(this.elementRef); console.log(this.elementRef);
this.center.x = this.data.x + (this.data.width / 2); this.center.x = this.data.x + (this.data.width / 2);
this.center.y = this.data.y + (this.data.height / 2); this.center.y = this.data.y + (this.data.height / 2);
this.options.radius = this.radius;
this.options.strokeWidth = this.strokeWidth;
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 @@
<diagram-event [data]="data" [options]="options" [iconFillColor]="iconFillColor"></diagram-event>

View File

@ -0,0 +1,51 @@
/*!
* @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-start-event',
templateUrl: './diagram-start-event.component.html',
styleUrls: ['./diagram-start-event.component.css']
})
export class DiagramStartEventComponent {
@Input()
data: any;
@Output()
onError = new EventEmitter();
options: any = {stroke: '', fillColors: '', fillOpacity: '', strokeWidth: '', radius: ''};
iconFillColor: any;
constructor(public elementRef: ElementRef,
private diagramColorService: DiagramColorService) {}
ngOnInit() {
console.log(this.elementRef);
this.options.radius = 15;
this.options.strokeWidth = 1;
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();
this.iconFillColor = 'none';
}
}

View File

@ -16,10 +16,16 @@
*/ */
import { DiagramEventComponent } from './diagram-event.component'; import { DiagramEventComponent } from './diagram-event.component';
import { DiagramStartEventComponent } from './diagram-start-event.component';
import { DiagramEndEventComponent } from './diagram-end-event.component';
// primitives // primitives
export * from './diagram-event.component'; export * from './diagram-event.component';
export * from './diagram-start-event.component';
export * from './diagram-end-event.component';
export const DIAGRAM_EVENTS_DIRECTIVES: any[] = [ export const DIAGRAM_EVENTS_DIRECTIVES: any[] = [
DiagramEventComponent DiagramEventComponent,
DiagramStartEventComponent,
DiagramEndEventComponent
]; ];

View File

@ -3,7 +3,7 @@
<diagram-icon-timer [data]="data"></diagram-icon-timer> <diagram-icon-timer [data]="data"></diagram-icon-timer>
</div> </div>
<div *ngSwitchCase="'error'"> <div *ngSwitchCase="'error'">
<diagram-icon-error [data]="data"></diagram-icon-error> <diagram-icon-error [data]="data" [fillColor]="fillColor"></diagram-icon-error>
</div> </div>
<div *ngSwitchCase="'signal'"> <div *ngSwitchCase="'signal'">
<diagram-icon-signal [data]="data" [fillColor]="fillColor"></diagram-icon-signal> <diagram-icon-signal [data]="data" [fillColor]="fillColor"></diagram-icon-signal>

View File

@ -28,6 +28,9 @@ export class DiagramIconErrorComponent {
@Input() @Input()
data: any; data: any;
@Input()
fillColor: string;
@Output() @Output()
onError = new EventEmitter(); onError = new EventEmitter();
@ -42,7 +45,7 @@ export class DiagramIconErrorComponent {
this.position = {x: this.data.x - 1, y: this.data.y - 1}; this.position = {x: this.data.x - 1, y: this.data.y - 1};
this.options.stroke = 'black'; this.options.stroke = 'black';
this.options.fillColors = 'none'; this.options.fillColors = this.fillColor;
this.options.strokeWidth = 1; this.options.strokeWidth = 1;
} }
} }

View File

@ -0,0 +1,3 @@
<raphael-rect [leftCorner]="rectLeftCorner" [width]="width" [height]="height" [radius]="options.radius"
[stroke]="options.stroke" [strokeWidth]="options.strokeWidth"
[fillColors]="options.fillColors" [fillOpacity]="options.fillOpacity"></raphael-rect>

View File

@ -0,0 +1,52 @@
/*!
* @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-event-subprocess',
templateUrl: './diagram-event-subprocess.component.html',
styleUrls: ['./diagram-event-subprocess.component.css']
})
export class DiagramEventSubprocessComponent {
@Input()
data: any;
@Output()
onError = new EventEmitter();
rectLeftCorner: any;
width: any;
height: any;
options: any = {stroke: '', fillColors: '', fillOpacity: '', strokeWidth: '', radius: 4};
constructor(public elementRef: ElementRef,
private diagramColorService: DiagramColorService) {}
ngOnInit() {
this.rectLeftCorner = {x: this.data.x, y: this.data.y};
this.width = this.data.width;
this.height = this.data.height;
this.options.fillColors = 'none';
this.options.stroke = this.diagramColorService.getBpmnColor(this.data, DiagramColorService.MAIN_STROKE_COLOR);
this.options.strokeWidth = 1;
}
}

View File

@ -16,10 +16,13 @@
*/ */
import { DiagramSubprocessComponent } from './diagram-subprocess.component'; import { DiagramSubprocessComponent } from './diagram-subprocess.component';
import { DiagramEventSubprocessComponent } from './diagram-event-subprocess.component';
// primitives // primitives
export * from './diagram-subprocess.component'; export * from './diagram-subprocess.component';
export * from './diagram-event-subprocess.component';
export const DIAGRAM_STRUCTURAL_DIRECTIVES: any[] = [ export const DIAGRAM_STRUCTURAL_DIRECTIVES: any[] = [
DiagramSubprocessComponent DiagramSubprocessComponent,
DiagramEventSubprocessComponent
]; ];