1 /***
2 * EdgeFactory.java
3 *
4 * Project: Dependency Tool
5 *
6 * WHEN WHO WHAT
7 * 06.06.2003 pko initial public release
8 *
9 * Copyright 2003 ELCA Informatique SA
10 * Av. de la Harpe 22-24, 1000 Lausanne 13, Switzerland
11 * www.elca.ch
12 *
13 * This library is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU Lesser General Public License
15 * as published by the Free Software Foundation; either version 2.1 of
16 * the License, or (at your option) any later version.
17 *
18 * This library is distributed in the hope that it will be useful, but
19 * WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 * Lesser General Public License for more details.
22 *
23 * You should have received a copy of the GNU Lesser General Public
24 * License along with this library; if not, write to the Free Software
25 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
26 * USA
27 */
28
29 package ch.elca.dependency.adapter.grappa;
30
31 import java.util.Hashtable;
32
33 import att.grappa.Subgraph;
34 import att.grappa.Edge;
35 import att.grappa.GrappaConstants;
36 import att.grappa.Node;
37
38 /***
39 * The <code>att.grappa.Edge</code> needs to be adapted to the needs
40 * of the Dependency Tool. This class <code>EdgeAdapter</code>
41 * presets some properties of the <code>att.grappa.Edge</code>, so
42 * that it can be used by the Dependency Tool.
43 *
44 * @author Pawel Kowalski
45 * @version 1.0-beta
46 */
47 public class EdgeFactory implements GrappaConstants {
48
49 /***
50 * Create a new <code>att.grappa.Edge</code> with values preset,
51 * so that we can use it within the Dependency Tool.
52 *
53 * @param subg a <code>Subgraph</code> value
54 * @param tail a <code>Node</code> value
55 * @param head a <code>Node</code> value
56 * @return an <code>Edge</code> value
57 */
58 public static Edge createNewEdge(Subgraph subg, Node tail, Node head) {
59 Edge edge = new Edge(subg,tail,null,head,null,null,null);
60 edge.object = new Hashtable();
61 return edge;
62 }
63
64 /***
65 * Create a new invisible <code>att.grappa.Edge</code> which
66 * purpose is to force layouting according to the specified
67 * layering.
68 *
69 * @param subg a <code>Subgraph</code> value
70 * @param tail a <code>Node</code> value
71 * @param head a <code>Node</code> value
72 * @return an <code>Edge</code> value
73 */
74 public static Edge createLayerEdge(Subgraph subg, Node tail, Node head) {
75 Edge edge = new Edge(subg,tail,null,head,null,null,null);
76 edge.object = new Hashtable();
77 edge.setAttribute(STYLE_ATTR, "invis");
78 edge.setAttribute("constraint", "true");
79 return edge;
80 }
81 }
82
This page was automatically generated by Maven