]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/ComponentTypePropertiesResultRequest.java
Support for creating shared ontology dump to git
[simantics/platform.git] / bundles / org.simantics.modeling.ui / src / org / simantics / modeling / ui / componentTypeEditor / ComponentTypePropertiesResultRequest.java
1 package org.simantics.modeling.ui.componentTypeEditor;
2
3 import java.util.Collection;
4
5 import org.simantics.db.ReadGraph;
6 import org.simantics.db.Resource;
7 import org.simantics.db.exception.DatabaseException;
8 import org.simantics.modeling.utils.ComponentTypeViewerPropertyInfo;
9 import org.simantics.modeling.utils.HeadlessComponentTypePropertiesResultRequest;
10
11 public class ComponentTypePropertiesResultRequest extends HeadlessComponentTypePropertiesResultRequest {
12     
13     private final Collection<ComponentTypeViewerSection> sections;
14
15     /**
16      * @param componentTypeViewer
17      */
18     public ComponentTypePropertiesResultRequest(Resource componentType, Collection<ComponentTypeViewerSection> sections) {
19         super(componentType);
20         this.sections = sections;
21     }
22     
23     @Override
24     protected void readSectionSpecificData(ReadGraph graph, ComponentTypeViewerPropertyInfo info) throws DatabaseException {
25         
26         Object sectionSpecificData = null;
27         double priority = Double.NEGATIVE_INFINITY;
28         if(sections != null) {
29             for(ComponentTypeViewerSection section : sections) {
30                 Object temp = section.getSectionSpecificData(graph, info);
31                 if(temp != null) {
32                     double sectionPriority = section.getDataPriority();
33                     if(sectionPriority > priority) {
34                         sectionSpecificData = temp;
35                         priority = sectionPriority;
36                     }
37                 }
38             }
39         }
40         
41         info.sectionSpecificData = sectionSpecificData;
42
43     }
44
45 }