importJava "org.simantics.diagram.elements.SVGMeasurementContext" where
data SVGMeasurementContext
getBoundingBox :: SVGMeasurementContext -> String -> <Proc> Maybe BoundingBox
+ modifyText :: SVGMeasurementContext -> String -> String -> <Proc> ()
getBoundingBoxX :: BoundingBox -> Double
getBoundingBoxX (x,_,_,_) = x
/*******************************************************************************
- * Copyright (c) 2007, 2010 Association for Decentralized Information Management
+ * Copyright (c) 2007, 2017 Association for Decentralized Information Management
* in Industry THTH ry.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
import org.simantics.scenegraph.g2d.nodes.SVGNodeAssignment;
import org.simantics.scenegraph.g2d.nodes.SingleElementNode;
import org.simantics.scenegraph.utils.NodeUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import com.kitfox.svg.SVGDiagram;
import com.kitfox.svg.SVGException;
+import com.kitfox.svg.Text;
+import com.kitfox.svg.Tspan;
@RasterOutputWidget
public class SVGNode extends org.simantics.scenegraph.g2d.nodes.SVGNode {
+ private static final Logger LOGGER = LoggerFactory.getLogger(SVGNode.class);
+
private static final long serialVersionUID = 4735066193941274186L;
transient EditorStateManager esm = null;
return EventTypes.KeyPressedMask | EventTypes.MouseClickMask | EventTypes.CommandMask;
}
+ public void modifyTextElement(String id, String newText) {
+ Text text = (Text) diagramCache.getElement(id);
+
+ EditorState es = new EditorState();
+ es.base = new EditorStateStatic();
+ es.base.textElementId = text.getId();
+
+ Tspan span = (Tspan)text.getContent().get(0);
+
+ try {
+ span.setText(newText);
+ text.rebuild();
+ diagramCache.updateTime(0);
+ } catch (SVGException e) {
+ LOGGER.error("Failed to update text span element " + id + " with text " + newText, e);
+ }
+ }
+
}
SEL.StandardProperties.BrowseContextStandardChildren.Var : MOD.ModelingBrowseContext.VariablePropertyRule
MOD.ModelingBrowseContext.VariablePropertyRule.RequireProperty "HasStandardPropertyInfo"
@L0.assert VP.BrowseContext.HasChildContribution
- _ : VP.ChildContribution
+ SEL.StandardProperties.BrowseContextStandardChildren.CatContribution : VP.ChildContribution
VP.ChildContribution.HasParentNodeType MOD.ModelingBrowseContext.Variable
VP.ChildContribution.HasChildNodeType SEL.CategoryNode
VP.ChildContribution.HasRule
SelectionViewResources SEL = SelectionViewResources.getInstance(graph);
Resource categoryResource = info.getPossibleRepresents(graph);
- if(SEL.CategoryHidden.equals(categoryResource)) {
+ //if(SEL.CategoryHidden.equals(categoryResource)) {
Variable property = info.getParent(graph);
Variable parent = property.getParent(graph);
} finally {
sclContext.put("graph", oldGraph);
}
- }
+ //}
return null;