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';
15 import { BroadcastService } from '../../services/broadcast.service';
16 import { JsPlumbService } from '../../services/jsplumb.service';
17 import { ActivatedRoute } from "@angular/router";
18 import { DataAccessService } from "../../services/data-access/data-access.service";
19 import { WorkflowService } from "../../services/workflow.service";
20 import { Workflow } from "../../model/workflow";
23 * main canvas, it contains two parts: canvas and node property component
24 * bpmn task nodes can be dropped into this canvas, and then the workflow can be edit
27 selector: 'b4t-canvas',
28 styleUrls: ['./canvas.component.css'],
29 templateUrl: 'canvas.component.html',
31 export class CanvasComponent implements AfterViewInit {
33 constructor(private broadcastService: BroadcastService,
34 private dataAccessService: DataAccessService,
35 private jsPlumbService: JsPlumbService,
36 private route: ActivatedRoute,
37 private workflowService: WorkflowService) {
41 this.route.queryParams.subscribe(params => {
43 this.dataAccessService.catalogService.loadWorkflow(params.id).subscribe(workflow => {
44 this.workflowService.workflow = workflow;
50 public ngAfterViewInit() {
51 this.jsPlumbService.buttonDroppable();
54 public canvasClick() {
55 this.broadcastService.broadcast(this.broadcastService.showProperty, false);
59 public getWorkflow(): Workflow {
60 return this.workflowService.workflow;