2 * Copyright (c) 2017 ZTE Corporation.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * and the Apache License 2.0 which both accompany this distribution,
6 * and are available at http://www.eclipse.org/legal/epl-v10.html
7 * and http://www.apache.org/licenses/LICENSE-2.0
10 * ZTE - initial API and implementation and/or initial documentation
13 import { AfterViewInit, Component } from '@angular/core';
14 import { TreeNode } from 'primeng/primeng';
16 import { SequenceFlow } from '../../model/workflow/sequence-flow';
17 import { BroadcastService } from '../../services/broadcast.service';
18 import { JsPlumbService } from '../../services/jsplumb.service';
19 import { ModelService } from '../../services/model.service';
20 import { NodeType } from '../../model/workflow/node-type.enum';
23 * property component presents information of a workflow node.
24 * the presented information can be edit in this component.
25 * it may load information dynamically. the content may be different for different node type.
28 selector: 'wfm-sequence-flow',
29 styleUrls: ['./sequence-flow.component.css'],
30 templateUrl: 'sequence-flow.component.html',
32 export class SequenceFlowComponent implements AfterViewInit {
33 public sequenceFlow: SequenceFlow;
36 constructor(private broadcastService: BroadcastService,
37 private modelService: ModelService,
38 private jsPlumbService: JsPlumbService) {
42 public ngAfterViewInit() {
43 this.broadcastService.showProperty$.subscribe(element => {
44 if (element && !this.modelService.isNode(element)) {
45 this.sequenceFlow = element as SequenceFlow;
53 public showCondition(sourceRef: string): boolean {
55 let node = this.modelService.getNodeMap().get(sourceRef);
56 if (node && (NodeType[NodeType.parallelGateway] === node.type || NodeType[NodeType.exclusiveGateway] === node.type)) {
66 public nameChanged(name: string) {
67 this.sequenceFlow.name = name;
68 this.jsPlumbService.setLabel(this.sequenceFlow.sourceRef, this.sequenceFlow.targetRef, name);
73 this.modelService.deleteConnection(this.sequenceFlow.sourceRef, this.sequenceFlow.targetRef);
74 this.jsPlumbService.deleteConnect(this.sequenceFlow.sourceRef, this.sequenceFlow.targetRef);