]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.browsing.ui.swt/src/org/simantics/browsing/ui/swt/NodeContextValueBean.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.browsing.ui.swt / src / org / simantics / browsing / ui / swt / NodeContextValueBean.java
1 /*******************************************************************************
2  * Copyright (c) 2012 Association for Decentralized Information Management in
3  * Industry THTH ry.
4  * All rights reserved. This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License v1.0
6  * which accompanies this distribution, and is available at
7  * http://www.eclipse.org/legal/epl-v10.html
8  *
9  * Contributors:
10  *     VTT Technical Research Centre of Finland - initial API and implementation
11  *******************************************************************************/
12 package org.simantics.browsing.ui.swt;
13
14 import java.util.Collections;
15 import java.util.List;
16
17 import org.simantics.browsing.ui.model.nodetypes.EntityNodeType;
18 import org.simantics.browsing.ui.model.nodetypes.SpecialNodeType;
19 import org.simantics.databoard.util.Bean;
20 import org.simantics.db.Resource;
21
22 public class NodeContextValueBean extends Bean {
23
24         public String name;
25         public Resource resource;
26         public List<Resource> resources;
27         public String className = "";
28         
29         public NodeContextValueBean(EntityNodeType ent) {
30                 name = EntityNodeType.class.getName();
31                 resource = ent.entityTypes.get(0);
32                 resources = ent.entityTypes;
33         }
34
35         public NodeContextValueBean(SpecialNodeType ent) {
36                 assert(ent.resource != null);
37                 name = SpecialNodeType.class.getName();
38                 resource = ent.resource;
39                 resources = Collections.singletonList(ent.resource);
40                 className = ent.getContentType().getName();
41         }
42
43         public NodeContextValueBean(Resource resource) {
44                 assert(resource != null);
45                 name = Resource.class.getName();
46                 this.resource = resource;
47                 this.resources = Collections.singletonList(resource);
48         }
49         
50 }