]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.graphviz/src/org/simantics/graphviz/Cluster.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.graphviz / src / org / simantics / graphviz / Cluster.java
1 /*******************************************************************************
2  * Copyright (c) 2007, 2010 Association for Decentralized Information Management
3  * in Industry THTH ry.
4  * All rights reserved. This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License v1.0
6  * which accompanies this distribution, and is available at
7  * http://www.eclipse.org/legal/epl-v10.html
8  *
9  * Contributors:
10  *     VTT Technical Research Centre of Finland - initial API and implementation
11  *******************************************************************************/
12 package org.simantics.graphviz;
13
14 /**
15  * A special kind of subgraph that is laid out separately.
16  * A rectangle is drawn around the cluster and it is
17  * labeled, if the cluster is given a label.
18  * 
19  * @author Hannu Niemistö
20  */
21 public class Cluster extends Subgraph {
22
23     public Cluster(IGraph parent) {
24         super(parent);
25         id = "cluster_" + id;
26     }
27
28     public Cluster(IGraph parent, String label) {
29         super(parent);
30         id = "cluster_" + id;
31         setLabel(label);
32     }
33
34     /**
35      * Text label attached to objects. 
36      */
37     public void setLabel(String label) {
38         set("label", label);        
39     }
40     
41     /**
42      * <p>
43      * Basic drawing color for graphics, not text. For the latter, use the
44      * fontcolor attribute. For edges, the value can either be a single color or
45      * a colorList. In the latter case, the edge is drawn using parallel splines
46      * or lines, one for each color in the list, in the order given. The head
47      * arrow, if any, is drawn using the first color in the list, and the tail
48      * arrow, if any, the second color. This supports the common case of drawing
49      * opposing edges, but using parallel splines instead of separately routed
50      * multiedges.
51      * </p>
52      * <p>Supports arbitrary RGB(A) colors in format #xxxxxx, where
53      * each x is a hex digit. Supports also color names in x11 color chart.</p>
54      */
55     public void setColor(String color) {
56         set("color", color);
57     }
58     
59     /**
60      * Color used for text.
61      */
62     public void setFontColor(String color) {
63         set("fontcolor", color);
64     }
65     
66     /**
67      * 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.
68      */
69     public void setFillColor(String color) {
70         set("fillcolor", color);
71     }
72     
73     /**
74      * Set style for node or edge. For cluster subgraph, if "filled", the cluster box's background is filled.
75      */
76     public void setStyle(String style) {
77         set("style", style);
78     }
79
80 }