]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.diagram/src/org/simantics/diagram/profile/ResourceSCLTextGridStyle.java
Fix diagram profiles to work with latest DB changes
[simantics/platform.git] / bundles / org.simantics.diagram / src / org / simantics / diagram / profile / ResourceSCLTextGridStyle.java
index 3bbbf8081dea77cfbb7792d0c1ecbd97d3e2a1ed..c9a83ff8b087a9d801ad0bbfa96a664edefc2e95 100644 (file)
@@ -23,13 +23,12 @@ import org.simantics.utils.datastructures.Pair;
  */
 public class ResourceSCLTextGridStyle extends TextGridStyle {
 
-       final Resource style;
        final Font font;
 
        public ResourceSCLTextGridStyle(ReadGraph graph, Resource style) throws DatabaseException {
-               this.style = style;
+               super(style);
                G2DResource G2D = G2DResource.getInstance(graph);
-        Resource fontR = graph.getPossibleObject(style, G2D.HasFont);
+               Resource fontR = graph.getPossibleObject(style, G2D.HasFont);
                if(fontR != null) {
                        font = G2DUtils.getFont(graph, fontR);
                } else {
@@ -51,7 +50,7 @@ public class ResourceSCLTextGridStyle extends TextGridStyle {
 
        @Override
        protected Object getIdentity(Resource entry) {
-               return new Pair<Resource, Resource>(style, entry);
+               return new Pair<Resource, Resource>(getResource(), entry);
        }
 
        @Override
@@ -63,10 +62,10 @@ public class ResourceSCLTextGridStyle extends TextGridStyle {
        public MonitorTextGridResult calculateStyle(ReadGraph graph, Resource runtimeDiagram, Resource entry, Resource element, Variable configuration) throws DatabaseException {
                DiagramResource DIA = DiagramResource.getInstance(graph);
 
-               Variable styleVariable = Variables.getVariable(graph, style);
+               Variable styleVariable = Variables.getVariable(graph, getResource());
                Function1<Resource,Tuple3> function = styleVariable.getPossiblePropertyValue(graph, DIA.ResourceSCLTextGridStyle_texts);
                Tuple3 result = Simantics.applySCLRead(graph, function, element);
-               
+
                AffineTransform transform = DiagramGraphUtil.getAffineTransform(graph, element);
                Vec2d offset = DiagramGraphUtil.getOffset(graph, element);
                boolean enabled = !DiagramGraphUtil.getProfileMonitorsHidden(graph, element);
@@ -79,7 +78,7 @@ public class ResourceSCLTextGridStyle extends TextGridStyle {
 
        @Override
        public String getNodeName() {
-               return "" + style.getResourceId();
+               return "" + getResource().getResourceId();
        }
 
 }