]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.diagram/src/org/simantics/diagram/profile/SCLTextGridStyle.java
Fixed the number of parameters for DIA.SCLTextGridStyle_texts function
[simantics/platform.git] / bundles / org.simantics.diagram / src / org / simantics / diagram / profile / SCLTextGridStyle.java
index 4401f2213c51aa0a58b0b0c8170ab5e9636d281c..3a6b688a394140ba69d63483f8e5e497a34ba500 100644 (file)
@@ -17,7 +17,7 @@ import org.simantics.diagram.stubs.G2DResource;
 import org.simantics.diagram.synchronization.graph.DiagramGraphUtil;
 import org.simantics.modeling.ModelingResources;
 import org.simantics.scl.runtime.function.Function1;
-import org.simantics.scl.runtime.tuple.Tuple3;
+import org.simantics.scl.runtime.tuple.Tuple4;
 import org.simantics.utils.datastructures.Pair;
 
 /**
@@ -25,13 +25,12 @@ import org.simantics.utils.datastructures.Pair;
  */
 public class SCLTextGridStyle extends TextGridStyle {
 
-       final Resource style;
        final Font font;
 
        public SCLTextGridStyle(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 {
@@ -53,7 +52,7 @@ public class SCLTextGridStyle extends TextGridStyle {
 
        @Override
        protected Object getIdentity(Resource entry) {
-               return new Pair<Resource, Resource>(style, entry);
+               return new Pair<Resource, Resource>(getResource(), entry);
        }
 
        @Override
@@ -81,9 +80,9 @@ public class SCLTextGridStyle extends TextGridStyle {
                if (moduleVariable == null)
                        return null;
 
-               Variable styleVariable = Variables.getVariable(graph, style);
-               Function1<Variable,Tuple3> function = styleVariable.getPossiblePropertyValue(graph, DIA.SCLTextGridStyle_texts);
-               Tuple3 result = Simantics.applySCLRead(graph, function, moduleVariable);
+               Variable styleVariable = Variables.getVariable(graph, getResource());
+               Function1<Variable,Tuple4> function = styleVariable.getPossiblePropertyValue(graph, DIA.SCLTextGridStyle_texts);
+               Tuple4 result = Simantics.applySCLRead(graph, function, moduleVariable);
                
                AffineTransform transform = DiagramGraphUtil.getAffineTransform(graph, element);
                Vec2d offset = DiagramGraphUtil.getOffset(graph, element);
@@ -97,7 +96,7 @@ public class SCLTextGridStyle extends TextGridStyle {
 
        @Override
        public String getNodeName() {
-               return "" + style.getResourceId();
+               return "" + getResource().getResourceId();
        }
 
 }