]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.browsing.ui.graph.impl/src/org/simantics/browsing/ui/graph/impl/ResourcePropertyFactory.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.browsing.ui.graph.impl / src / org / simantics / browsing / ui / graph / impl / ResourcePropertyFactory.java
1 /*******************************************************************************\r
2  * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
3  * in Industry THTH ry.\r
4  * All rights reserved. This program and the accompanying materials\r
5  * are made available under the terms of the Eclipse Public License v1.0\r
6  * which accompanies this distribution, and is available at\r
7  * http://www.eclipse.org/legal/epl-v10.html\r
8  *\r
9  * Contributors:\r
10  *     VTT Technical Research Centre of Finland - initial API and implementation\r
11  *******************************************************************************/\r
12 package org.simantics.browsing.ui.graph.impl;\r
13 \r
14 import org.simantics.browsing.ui.common.property.IProperty;\r
15 import org.simantics.browsing.ui.common.property.IPropertyFactory;\r
16 import org.simantics.db.Resource;\r
17 import org.simantics.db.common.ResourceArray;\r
18 import org.simantics.utils.datastructures.slice.ValueRange;\r
19 \r
20 /**\r
21  * @author Tuukka Lehtonen\r
22  */\r
23 public class ResourcePropertyFactory implements IPropertyFactory<ResourceProperty> {\r
24 \r
25     final IProperty.Type type;\r
26     final Resource       subject;\r
27     final Resource       predicate;\r
28     final Resource       value;\r
29     final ResourceArray  path;\r
30 \r
31     public ResourcePropertyFactory(IProperty.Type type, Resource subject, Resource predicate, Resource value, ResourceArray path) {\r
32         this.type = type;\r
33         this.subject = subject;\r
34         this.predicate = predicate;\r
35         this.value = value;\r
36         this.path = path;\r
37     }\r
38 \r
39     @Override\r
40     public ResourceProperty create(ValueRange range) {\r
41         if (range != null)\r
42             return new ResourceArrayProperty(type, range, subject, predicate, value, path);\r
43         return new ResourceProperty(type, subject, predicate, value, path);\r
44     }\r
45 \r
46 }\r