]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.graphviz/src/org/simantics/graphviz/Cluster.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.graphviz / src / org / simantics / graphviz / Cluster.java
diff --git a/bundles/org.simantics.graphviz/src/org/simantics/graphviz/Cluster.java b/bundles/org.simantics.graphviz/src/org/simantics/graphviz/Cluster.java
new file mode 100644 (file)
index 0000000..fbf644d
--- /dev/null
@@ -0,0 +1,80 @@
+/*******************************************************************************\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.graphviz;\r
+\r
+/**\r
+ * A special kind of subgraph that is laid out separately.\r
+ * A rectangle is drawn around the cluster and it is\r
+ * labeled, if the cluster is given a label.\r
+ * \r
+ * @author Hannu Niemistö\r
+ */\r
+public class Cluster extends Subgraph {\r
+\r
+    public Cluster(IGraph parent) {\r
+        super(parent);\r
+        id = "cluster_" + id;\r
+    }\r
+\r
+    public Cluster(IGraph parent, String label) {\r
+        super(parent);\r
+        id = "cluster_" + id;\r
+        setLabel(label);\r
+    }\r
+\r
+    /**\r
+     * Text label attached to objects. \r
+     */\r
+    public void setLabel(String label) {\r
+        set("label", label);        \r
+    }\r
+    \r
+    /**\r
+     * <p>\r
+     * Basic drawing color for graphics, not text. For the latter, use the\r
+     * fontcolor attribute. For edges, the value can either be a single color or\r
+     * a colorList. In the latter case, the edge is drawn using parallel splines\r
+     * or lines, one for each color in the list, in the order given. The head\r
+     * arrow, if any, is drawn using the first color in the list, and the tail\r
+     * arrow, if any, the second color. This supports the common case of drawing\r
+     * opposing edges, but using parallel splines instead of separately routed\r
+     * multiedges.\r
+     * </p>\r
+     * <p>Supports arbitrary RGB(A) colors in format #xxxxxx, where\r
+     * each x is a hex digit. Supports also color names in x11 color chart.</p>\r
+     */\r
+    public void setColor(String color) {\r
+        set("color", color);\r
+    }\r
+    \r
+    /**\r
+     * Color used for text.\r
+     */\r
+    public void setFontColor(String color) {\r
+        set("fontcolor", color);\r
+    }\r
+    \r
+    /**\r
+     * Color used to fill the background of a node or cluster assuming style=filled. If fillcolor is not defined, color is used. (For clusters, if color is not defined, bgcolor is used.) If this is not defined, the default is used, except for shape=point or when the output format is MIF, which use black by default. Note that a cluster inherits the root graph's attributes if defined. Thus, if the root graph has defined a fillcolor, this will override a color or bgcolor attribute set for the cluster.\r
+     */\r
+    public void setFillColor(String color) {\r
+        set("fillcolor", color);\r
+    }\r
+    \r
+    /**\r
+     * Set style for node or edge. For cluster subgraph, if "filled", the cluster box's background is filled.\r
+     */\r
+    public void setStyle(String style) {\r
+        set("style", style);\r
+    }\r
+\r
+}\r