Fix bugs in attribute outputs page
[sdc.git] / catalog-ui / src / app / models / data-type-properties.ts
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20
21 /**
22  * Created by rcohen on 9/25/2016.
23  */
24 'use strict';
25 import {SchemaPropertyGroupModel} from "./schema-property";
26 import {PropertyModel} from "./properties";
27
28 export class DataTypePropertyModel extends PropertyModel{
29     //custom
30     simpleType:string;
31     valueObjectRef:any;
32     childrenProperties:Array<DataTypePropertyModel>;
33     isAllChildrenLevelsCalculated:boolean;
34     treeNodeId:string;
35     parent:DataTypePropertyModel;
36     expandedChildPropertyId:string;
37
38     constructor(property?:PropertyModel);
39     constructor(name:string, type:string, treeNodeId:string, parent:DataTypePropertyModel, valueObjectRef:any, schema?:SchemaPropertyGroupModel);
40     constructor(nameOrPropertyObj?:string | PropertyModel, type?:string, treeNodeId?:string, parent?:DataTypePropertyModel, valueObjectRef?:any, schema?:SchemaPropertyGroupModel){
41         super(typeof nameOrPropertyObj === "string" ? null : nameOrPropertyObj);
42         if ( typeof nameOrPropertyObj === "string" ) {
43             this.name = nameOrPropertyObj;
44             this.type = type;
45             this.treeNodeId = treeNodeId;
46             this.parent = parent;
47             this.valueObjectRef = valueObjectRef;
48             this.schema = schema;
49         }
50     }
51
52     public updateExpandedChildPropertyId = (childPropertyId:string):void =>{
53         if(this.expandedChildPropertyId == childPropertyId){
54             this.expandedChildPropertyId = "";
55         }else{
56             this.expandedChildPropertyId = childPropertyId;
57         }
58     }
59 }