import java.awt.geom.AffineTransform;\r
import java.awt.geom.Rectangle2D;\r
import java.util.List;\r
+\r
+import org.simantics.db.ReadGraph;\r
+import org.simantics.db.Resource;\r
+import org.simantics.db.exception.DatabaseException;\r
import org.simantics.h2d.action.IAction;\r
import org.simantics.h2d.editor.IDiagramEditor;\r
import org.simantics.h2d.element.IElement;\r
import org.simantics.h2d.node.TextNode;\r
import org.simantics.objmap.annotations.GraphType;\r
import org.simantics.objmap.annotations.RelatedValue;\r
+import org.simantics.objmap.annotations.UpdateMethod;\r
import org.simantics.scenegraph.g2d.G2DParentNode;\r
+import org.simantics.sysdyn.SysdynResource;\r
\r
@GraphType("http://www.simantics.org/Sysdyn-1.0/Auxiliary")\r
public class TextElement extends RectangularElement implements Movable, Connectable, IEventHandler {\r
} \r
\r
boolean oldHasEquation = false;\r
+\r
boolean hasEquation = true;\r
- /*\r
- boolean hasEquation = false;\r
+ String oldLabel = label;\r
\r
@UpdateMethod\r
- boolean readHasExpression(ReadGraph g, Resource resource) {\r
- SysdynResource sr = SysdynResource.getInstance(g);\r
- try {\r
- hasEquation = \r
- !g.getObjects(resource, sr.HasExpression).isEmpty();\r
- if(oldHasEquation != hasEquation) \r
- update(); \r
- } catch (DatabaseException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- } \r
+ boolean updateCheck(ReadGraph g, Resource resource) {\r
+// SysdynResource sr = SysdynResource.getInstance(g);\r
+ boolean update = false;\r
+// try {\r
+// hasEquation = \r
+// !g.getObjects(resource, sr.HasExpression).isEmpty();\r
+// if(oldHasEquation != hasEquation) \r
+// update = true;\r
+ if(!label.equals(oldLabel)) {\r
+ oldLabel = label; \r
+ update = true;\r
+ }\r
+ if(update) \r
+ update();\r
+// } catch (DatabaseException e) {\r
+// e.printStackTrace();\r
+// } \r
return false;\r
}\r
- */\r
+ \r
}\r