-/*******************************************************************************\r
- * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- * VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.g2d.diagram.participant;\r
-\r
-import org.simantics.g2d.canvas.ICanvasContext;\r
-import org.simantics.g2d.canvas.impl.DependencyReflection.Dependency;\r
-import org.simantics.g2d.diagram.IDiagram;\r
-import org.simantics.g2d.element.IElement;\r
-import org.simantics.g2d.element.handler.Heartbeat;\r
-import org.simantics.g2d.participant.TimeParticipant;\r
-import org.simantics.scenegraph.g2d.events.TimeEvent;\r
-import org.simantics.scenegraph.g2d.events.EventHandlerReflection.EventHandler;\r
-\r
-/**\r
- * This participant sends time events to Heartbeat element handlers.\r
- * \r
- * @See {@link Heartbeat}\r
- * @author Toni Kalajainen\r
- */\r
-public class ElementHeartbeater extends AbstractDiagramParticipant {\r
-\r
- @Dependency TimeParticipant time;\r
-\r
- @Override\r
- public void addedToContext(ICanvasContext ctx) {\r
- super.addedToContext(ctx);\r
- time.registerForEvents(getClass());\r
- }\r
-\r
- @Override\r
- public void removedFromContext(ICanvasContext ctx) {\r
- time.unregisterForEvents(getClass());\r
- super.removedFromContext(ctx);\r
- }\r
-\r
- @EventHandler(priority = 0)\r
- public boolean handleHeartbeat(TimeEvent te) {\r
- IDiagram d = diagram;\r
- if (d==null) return false;\r
- for (IElement e : d.getSnapshot())\r
- {\r
- for (Heartbeat hb : e.getElementClass().getItemsByClass(Heartbeat.class))\r
- hb.heartbeat(e, te.time, te.interval, getContext());\r
- }\r
- return false;\r
- }\r
-\r
-}\r
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 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
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * VTT Technical Research Centre of Finland - initial API and implementation
+ *******************************************************************************/
+package org.simantics.g2d.diagram.participant;
+
+import org.simantics.g2d.canvas.ICanvasContext;
+import org.simantics.g2d.canvas.impl.DependencyReflection.Dependency;
+import org.simantics.g2d.diagram.IDiagram;
+import org.simantics.g2d.element.IElement;
+import org.simantics.g2d.element.handler.Heartbeat;
+import org.simantics.g2d.participant.TimeParticipant;
+import org.simantics.scenegraph.g2d.events.TimeEvent;
+import org.simantics.scenegraph.g2d.events.EventHandlerReflection.EventHandler;
+
+/**
+ * This participant sends time events to Heartbeat element handlers.
+ *
+ * @See {@link Heartbeat}
+ * @author Toni Kalajainen
+ */
+public class ElementHeartbeater extends AbstractDiagramParticipant {
+
+ @Dependency TimeParticipant time;
+
+ @Override
+ public void addedToContext(ICanvasContext ctx) {
+ super.addedToContext(ctx);
+ time.registerForEvents(getClass());
+ }
+
+ @Override
+ public void removedFromContext(ICanvasContext ctx) {
+ time.unregisterForEvents(getClass());
+ super.removedFromContext(ctx);
+ }
+
+ @EventHandler(priority = 0)
+ public boolean handleHeartbeat(TimeEvent te) {
+ IDiagram d = diagram;
+ if (d==null) return false;
+ for (IElement e : d.getSnapshot())
+ {
+ for (Heartbeat hb : e.getElementClass().getItemsByClass(Heartbeat.class))
+ hb.heartbeat(e, te.time, te.interval, getContext());
+ }
+ return false;
+ }
+
+}