+/**\r
+ * Copyright (c) 2017 ZTE Corporation.\r
+ * All rights reserved. This program and the accompanying materials\r
+ * are made available under the terms of the Eclipse Public License v1.0\r
+ * and the Apache License 2.0 which both accompany this distribution,\r
+ * and are available at http://www.eclipse.org/legal/epl-v10.html\r
+ * and http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Contributors:\r
+ * ZTE - initial API and implementation and/or initial documentation\r
+ */\r
+\r
+import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';\r
+\r
+import { ValueSource } from '../../model/value-source.enum';\r
+import { Parameter } from '../../model/workflow/parameter';\r
+import { DataAccessService } from "../../services/data-access/data-access.service";\r
+\r
+/**\r
+ * this component contains in property component if the corresponding node has parameter properties\r
+ * eg. task node have input and output params, start event node has input param\r
+ */\r
+@Component({\r
+ selector: 'b4t-parameter',\r
+ templateUrl: 'parameter.component.html',\r
+})\r
+export class ParameterComponent implements OnInit {\r
+ @Input() public param: Parameter;\r
+ @Input() public valueSource: ValueSource[];\r
+ @Input() public canEditName: boolean;\r
+ @Input() public showLabel = true;\r
+ @Input() public canDelete: boolean;\r
+ @Output() public paramChange = new EventEmitter<Parameter>();\r
+ @Output() delete: EventEmitter<Parameter> = new EventEmitter<Parameter>();\r
+\r
+ public sourceEnum = ValueSource;\r
+ public valueGroupClass;\r
+ public valueClass;\r
+ public showValueSource: boolean = true;\r
+\r
+ constructor(private dataAccessService: DataAccessService) { }\r
+\r
+ public ngOnInit(): void {\r
+ if (1 === this.valueSource.length) {\r
+ this.showValueSource = false;\r
+ }\r
+ this.valueClass = {\r
+ 'col-md-9': this.showValueSource,\r
+ 'col-md-12': !this.showValueSource\r
+ };\r
+\r
+ this.valueGroupClass = {\r
+ 'col-md-7': this.canDelete,\r
+ 'col-md-9': !this.canDelete\r
+ };\r
+ }\r
+\r
+ public deleteParam(): void {\r
+ this.delete.emit();\r
+ }\r
+\r
+ public modelChange(value: any) {\r
+ this.param.value = value;\r
+ this.paramChange.emit(this.param)\r
+ }\r
+\r
+}\r