Author: koen.aers(a)jboss.com
Date: 2008-07-29 09:55:37 -0400 (Tue, 29 Jul 2008)
New Revision: 9394
Added:
trunk/flow/plugins/org.jboss.tools.flow.common.graph/src/org/jboss/tools/flow/editor/core/DefaultNodeWrapper.java
Modified:
trunk/flow/plugins/org.jboss.tools.flow.common.graph/META-INF/MANIFEST.MF
Log:
create a DefaultNodeWrapper implementation
Modified: trunk/flow/plugins/org.jboss.tools.flow.common.graph/META-INF/MANIFEST.MF
===================================================================
--- trunk/flow/plugins/org.jboss.tools.flow.common.graph/META-INF/MANIFEST.MF 2008-07-29
13:48:25 UTC (rev 9393)
+++ trunk/flow/plugins/org.jboss.tools.flow.common.graph/META-INF/MANIFEST.MF 2008-07-29
13:55:37 UTC (rev 9394)
@@ -6,6 +6,7 @@
Bundle-Activator: org.jboss.tools.flow.JBossToolsProcessPlugin
Bundle-Vendor: JBoss
Require-Bundle:
+ org.jboss.tools.flow.common.core;bundle-version="1.0.0",
org.eclipse.ui.views,
org.eclipse.draw2d,
org.eclipse.gef,
Added:
trunk/flow/plugins/org.jboss.tools.flow.common.graph/src/org/jboss/tools/flow/editor/core/DefaultNodeWrapper.java
===================================================================
---
trunk/flow/plugins/org.jboss.tools.flow.common.graph/src/org/jboss/tools/flow/editor/core/DefaultNodeWrapper.java
(rev 0)
+++
trunk/flow/plugins/org.jboss.tools.flow.common.graph/src/org/jboss/tools/flow/editor/core/DefaultNodeWrapper.java 2008-07-29
13:55:37 UTC (rev 9394)
@@ -0,0 +1,60 @@
+package org.jboss.tools.flow.editor.core;
+
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.jboss.tools.flow.common.core.Node;
+import org.jboss.tools.flow.editor.core.AbstractConnectionWrapper;
+import org.jboss.tools.flow.editor.core.AbstractNodeWrapper;
+import org.jboss.tools.flow.editor.core.NodeWrapper;
+
+public abstract class DefaultNodeWrapper extends AbstractNodeWrapper {
+
+ public void setNode(Node node) {
+ setElement(node);
+ }
+
+ public Node getNode() {
+ return (Node) getElement();
+ }
+
+ public String getId() {
+ long id = getNode().getId();
+ return id == -1 ? null : getNode().getId() + "";
+ }
+
+ public String getName() {
+ return getNode().getName();
+ }
+
+ public void internalSetName(String name) {
+ getNode().setName(name);
+ notifyListeners(CHANGE_VISUAL);
+ }
+
+ protected void internalSetConstraint(Rectangle constraint) {
+ Node node = getNode();
+ node.setMetaData("x", constraint.x);
+ node.setMetaData("y", constraint.y);
+ node.setMetaData("width", constraint.width);
+ node.setMetaData("height", constraint.height);
+ }
+
+ public Rectangle internalGetConstraint() {
+ Node node = getNode();
+ Integer x = (Integer) node.getMetaData("x");
+ Integer y = (Integer) node.getMetaData("y");
+ Integer width = (Integer) node.getMetaData("width");
+ Integer height = (Integer) node.getMetaData("height");
+ return new Rectangle(x == null ? 0 : x, y == null ? 0 : y,
+ width == null ? -1 : width, height == null ? -1 : height);
+ }
+
+ public boolean acceptsIncomingConnection(
+ AbstractConnectionWrapper connection, NodeWrapper source) {
+ return true;
+ }
+
+ public boolean acceptsOutgoingConnection(
+ AbstractConnectionWrapper connection, NodeWrapper target) {
+ return true;
+ }
+}
Show replies by date