Home » Eclipse Projects » GEF » Exception when Edge created
|
Re: Exception when Edge created [message #216371 is a reply to message #215891] |
Wed, 17 May 2006 17:53 |
richbk Messages: 6 Registered: July 2009 |
Junior Member |
|
|
Hi All,
Here is the exception producing code reduced to the fewest lines that still
fail:
----------------
NodeList nodes = new NodeList();
EdgeList edges = new EdgeList();
Subgraph a = new Subgraph("a");
nodes.add(a);
Node b = new Node("b", a);
nodes.add(b);
Node c = new Node("c");
nodes.add(c);
edges.add(new Edge(c, a));
CompoundDirectedGraph graph = new CompoundDirectedGraph();
graph.nodes = nodes;
graph.edges = edges;
new CompoundDirectedGraphLayout().visit(graph);
----------------
Thanks for any help,
Rick
"Rick Kissh" <richbk@hotmail.com> wrote in message
news:e3upq4$9of$1@utils.eclipse.org...
>
> Hi,
>
> I get an exception in the included code. If I don't create the Edge I
> don't get the exception. I'm using 3.2M5a. It's not obvious to me that
> I'm doing anything wrong.
>
> Thanks,
> Rick
>
> Caused by: java.lang.NullPointerException
> at
> org.eclipse.draw2d.graph.GraphUtilities.isConstrained(GraphU tilities.java:141)
> at org.eclipse.draw2d.graph.RankSorter.swap(RankSorter.java:183 )
> at org.eclipse.draw2d.graph.RankSorter.sort(RankSorter.java:171 )
> at
> org.eclipse.draw2d.graph.RankSorter.sortRankIncoming(RankSor ter.java:140)
> at org.eclipse.draw2d.graph.MinCross.solve(MinCross.java:43)
> at org.eclipse.draw2d.graph.MinCross.visit(MinCross.java:60)
> at
> org.eclipse.draw2d.graph.DirectedGraphLayout.visit(DirectedG raphLayout.java:99)
>
>
> NodeList nodes = new NodeList();
> EdgeList edges = new EdgeList();
>
> // start paste
> Insets pad = new Insets(50, 50, 110, 50);
> Subgraph WineOrder_Joe = new Subgraph("WineOrder.Joe");
> nodes.add(WineOrder_Joe);
> Node WineOrder_Joe_variety = new Node("WineOrder.Joe.variety",
> WineOrder_Joe);
> WineOrder_Joe_variety.width = 178;
> WineOrder_Joe_variety.height = 79;
> WineOrder_Joe_variety.setPadding(pad);
> nodes.add(WineOrder_Joe_variety);
> Node EntreeOrder_Joe = new Node("EntreeOrder.Joe");
> nodes.add(EntreeOrder_Joe);
> EntreeOrder_Joe.width = 134;
> EntreeOrder_Joe.height = 61;
> EntreeOrder_Joe.setPadding(pad);
> edges.add(new Edge(EntreeOrder_Joe, WineOrder_Joe));
> // stop paste
>
> CompoundDirectedGraph graph = new CompoundDirectedGraph();
> graph.nodes = nodes;
> graph.edges = edges;
>
> new CompoundDirectedGraphLayout().visit(graph);
>
>
|
|
|
Re: Exception when Edge created [message #216552 is a reply to message #216371] |
Fri, 19 May 2006 14:22 |
Steven R. Shaw Messages: 128 Registered: July 2009 |
Senior Member |
|
|
This is a multi-part message in MIME format.
------=_NextPart_000_00F2_01C67B2E.28579BA0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Probably the CompoundDirectGraph should provide a more descriptive =
exception... however, the problem seems to be that the =
CompoundDirectGraph expects Subgraphs to be the top level parent of all =
the nodes. I fixed your graph by introducing a SubGraph "top":
NodeList nodes =3D new NodeList();
EdgeList edges =3D new EdgeList();
Subgraph top =3D new Subgraph("top");
nodes.add(top);
Subgraph a =3D new Subgraph("a", top);
nodes.add(a);
Node b =3D new Node("b", a);
nodes.add(b);
Node c =3D new Node("c", top);
nodes.add(c);
edges.add(new Edge(c, a));
CompoundDirectedGraph graph =3D new CompoundDirectedGraph();
graph.nodes =3D nodes;
graph.edges =3D edges;
new CompoundDirectedGraphLayout().visit(graph);
"richbk" <richbk@hotmail.com> wrote in message =
news:e4fnuf$tgl$1@utils.eclipse.org...
> Hi All,
>=20
> Here is the exception producing code reduced to the fewest lines that =
still=20
> fail:
>=20
> ----------------
> NodeList nodes =3D new NodeList();
> EdgeList edges =3D new EdgeList();
>=20
> Subgraph a =3D new Subgraph("a");
> nodes.add(a);
> Node b =3D new Node("b", a);
> nodes.add(b);
> Node c =3D new Node("c");
> nodes.add(c);
> edges.add(new Edge(c, a));
>=20
> CompoundDirectedGraph graph =3D new CompoundDirectedGraph();
> graph.nodes =3D nodes;
> graph.edges =3D edges;
>=20
> new CompoundDirectedGraphLayout().visit(graph);
> ----------------
>=20
> Thanks for any help,
> Rick
>=20
>=20
>=20
> "Rick Kissh" <richbk@hotmail.com> wrote in message=20
> news:e3upq4$9of$1@utils.eclipse.org...
> >
> > Hi,
> >
> > I get an exception in the included code. If I don't create the Edge =
I=20
> > don't get the exception. I'm using 3.2M5a. It's not obvious to me =
that=20
> > I'm doing anything wrong.
> >
> > Thanks,
> > Rick
> >
> > Caused by: java.lang.NullPointerException
> > at=20
> > =
org.eclipse.draw2d.graph.GraphUtilities.isConstrained(GraphU tilities.java=
:141)
> > at org.eclipse.draw2d.graph.RankSorter.swap(RankSorter.java:183 )
> > at org.eclipse.draw2d.graph.RankSorter.sort(RankSorter.java:171 )
> > at=20
> > =
org.eclipse.draw2d.graph.RankSorter.sortRankIncoming(RankSor ter.java:140)=
> > at org.eclipse.draw2d.graph.MinCross.solve(MinCross.java:43)
> > at org.eclipse.draw2d.graph.MinCross.visit(MinCross.java:60)
> > at=20
> > =
org.eclipse.draw2d.graph.DirectedGraphLayout.visit(DirectedG raphLayout.ja=
va:99)
> >
> >
> > NodeList nodes =3D new NodeList();
> > EdgeList edges =3D new EdgeList();
> >
> > // start paste
> > Insets pad =3D new Insets(50, 50, 110, 50);
> > Subgraph WineOrder_Joe =3D new Subgraph("WineOrder.Joe");
> > nodes.add(WineOrder_Joe);
> > Node WineOrder_Joe_variety =3D new Node("WineOrder.Joe.variety",=20
> > WineOrder_Joe);
> > WineOrder_Joe_variety.width =3D 178;
> > WineOrder_Joe_variety.height =3D 79;
> > WineOrder_Joe_variety.setPadding(pad);
> > nodes.add(WineOrder_Joe_variety);
> > Node EntreeOrder_Joe =3D new Node("EntreeOrder.Joe");
> > nodes.add(EntreeOrder_Joe);
> > EntreeOrder_Joe.width =3D 134;
> > EntreeOrder_Joe.height =3D 61;
> > EntreeOrder_Joe.setPadding(pad);
> > edges.add(new Edge(EntreeOrder_Joe, WineOrder_Joe));
> > // stop paste
> >
> > CompoundDirectedGraph graph =3D new CompoundDirectedGraph();
> > graph.nodes =3D nodes;
> > graph.edges =3D edges;
> >
> > new CompoundDirectedGraphLayout().visit(graph);
> >
> >=20
>=20
>
------=_NextPart_000_00F2_01C67B2E.28579BA0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1543" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face=3DArial size=3D2>Probably the CompoundDirectGraph should =
provide a=20
more descriptive exception... however, the problem seems to be that the=20
CompoundDirectGraph expects Subgraphs to be the top level parent of all =
the=20
nodes. I fixed your graph by introducing a SubGraph =
"top":</FONT></DIV>
<DIV><FONT face=3D"Courier New" size=3D2></FONT> </DIV>
<DIV><FONT face=3D"Courier New" size=3D2>NodeList nodes =3D new=20
NodeList();</FONT></DIV>
<DIV><FONT face=3D"Courier New" size=3D2>EdgeList edges =3D new=20
EdgeList();</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3D"Courier New" size=3D2>Subgraph top =3D new=20
Subgraph("top");</FONT></DIV>
<DIV><FONT face=3D"Courier New" size=3D2>nodes.add(top);</FONT></DIV>
<DIV><FONT face=3D"Courier New" size=3D2>Subgraph a =3D new =
Subgraph("a",=20
top);</FONT></DIV>
<DIV><FONT face=3D"Courier New" size=3D2>nodes.add(a);</FONT></DIV>
<DIV><FONT face=3D"Courier New" size=3D2>Node b =3D new Node("b", =
a);</FONT></DIV>
<DIV><FONT face=3D"Courier New" size=3D2>nodes.add(b);</FONT></DIV>
<DIV><FONT face=3D"Courier New" size=3D2>Node c =3D new Node("c", =
top);</FONT></DIV>
<DIV><FONT face=3D"Courier New" size=3D2>nodes.add(c);</FONT></DIV>
<DIV><FONT face=3D"Courier New" size=3D2>edges.add(new Edge(c, =
a));</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3D"Courier New" size=3D2>CompoundDirectedGraph graph =3D =
new=20
CompoundDirectedGraph();</FONT></DIV>
<DIV><FONT face=3D"Courier New" size=3D2>graph.nodes =3D =
nodes;</FONT></DIV>
<DIV><FONT face=3D"Courier New" size=3D2>graph.edges =3D =
edges;</FONT></DIV>
<DIV>
<P align=3Dleft><FONT face=3D"Courier New" size=3D2></FONT></P>
<P><FONT face=3D"Courier New" size=3D2>new=20
CompoundDirectedGraphLayout().visit(graph);</FONT></P></DIV >
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>"richbk" <</FONT><A=20
href=3D"mailto:richbk@hotmail.com"><FONT face=3DArial=20
size=3D2>richbk@hotmail.com</FONT></A><FONT face=3DArial size=3D2>> =
wrote in=20
message </FONT><A href=3D"news:e4fnuf$tgl$1@utils.eclipse.org"><FONT =
face=3DArial=20
size=3D2>news:e4fnuf$tgl$1@utils.eclipse.org</FONT></A><FONT =
face=3DArial=20
size=3D2>...</FONT></DIV><FONT face=3DArial size=3D2>> Hi =
All,<BR>> <BR>>=20
Here is the exception producing code reduced to the fewest lines that =
still=20
<BR>> fail:<BR>> <BR>> ----------------<BR>> NodeList =
nodes =3D=20
new NodeList();<BR>> EdgeList edges =3D new EdgeList();<BR>> =
<BR>>=20
Subgraph a =3D new Subgraph("a");<BR>> =
nodes.add(a);<BR>>=20
Node b =3D new Node("b", a);<BR>> nodes.add(b);<BR>> =
Node=20
c =3D new Node("c");<BR>> nodes.add(c);<BR>> =
edges.add(new=20
Edge(c, a));<BR>> <BR>> CompoundDirectedGraph graph =3D new=20
CompoundDirectedGraph();<BR>> graph.nodes =3D nodes;<BR>>=20
graph.edges =3D edges;<BR>> <BR>> new=20
CompoundDirectedGraphLayout().visit(graph);<BR>> =
----------------<BR>>=20
<BR>> Thanks for any help,<BR>> Rick<BR>> <BR>> <BR>> =
<BR>>=20
"Rick Kissh" <</FONT><A href=3D"mailto:richbk@hotmail.com"><FONT =
face=3DArial=20
size=3D2>richbk@hotmail.com</FONT></A><FONT face=3DArial size=3D2>> =
wrote in=20
message <BR>> </FONT><A =
href=3D"news:e3upq4$9of$1@utils.eclipse.org"><FONT=20
face=3DArial =
size=3D2>news:e3upq4$9of$1@utils.eclipse.org</FONT></A><FONT =
face=3DArial=20
size=3D2>...<BR>> ><BR>> > Hi,<BR>> ><BR>> > I =
get an=20
exception in the included code. If I don't create the Edge I =
<BR>> >=20
don't get the exception. I'm using 3.2M5a. It's not obvious =
to me=20
that <BR>> > I'm doing anything wrong.<BR>> ><BR>> >=20
Thanks,<BR>> > Rick<BR>> ><BR>> > Caused by:=20
java.lang.NullPointerException<BR>> > at <BR>> >=20
org.eclipse.draw2d.graph.GraphUtilities.isConstrained(GraphU tilities.java=
:141)<BR>>=20
> at =
org.eclipse.draw2d.graph.RankSorter.swap(RankSorter.java:183 ) <BR>>=20
> at =
org.eclipse.draw2d.graph.RankSorter.sort(RankSorter.java:171 ) <BR>>=20
> at <BR>> >=20
org.eclipse.draw2d.graph.RankSorter.sortRankIncoming(RankSor ter.java:140)=
<BR>>=20
> at =
org.eclipse.draw2d.graph.MinCross.solve(MinCross.java:43)<BR >> >=20
at org.eclipse.draw2d.graph.MinCross.visit(MinCross.java:60)<BR >> =
> at=20
<BR>> >=20
org.eclipse.draw2d.graph.DirectedGraphLayout.visit(DirectedG raphLayout.ja=
va:99)<BR>>=20
><BR>> ><BR>> > NodeList nodes =3D new =
NodeList();<BR>> >=20
EdgeList edges =3D new EdgeList();<BR>> ><BR>> > // start=20
paste<BR>> > Insets pad =3D new Insets(50, 50, 110, =
50);<BR>> >=20
Subgraph WineOrder_Joe =3D new Subgraph("WineOrder.Joe");<BR>> >=20
nodes.add(WineOrder_Joe);<BR>> > Node WineOrder_Joe_variety =3D =
new=20
Node("WineOrder.Joe.variety", <BR>> > WineOrder_Joe);<BR>> > =
WineOrder_Joe_variety.width =3D 178;<BR>> > =
WineOrder_Joe_variety.height =3D=20
79;<BR>> > WineOrder_Joe_variety.setPadding(pad);<BR>> >=20
nodes.add(WineOrder_Joe_variety);<BR>> > Node EntreeOrder_Joe =3D =
new=20
Node("EntreeOrder.Joe");<BR>> > =
nodes.add(EntreeOrder_Joe);<BR>> >=20
EntreeOrder_Joe.width =3D 134;<BR>> > EntreeOrder_Joe.height =3D =
61;<BR>>=20
> EntreeOrder_Joe.setPadding(pad);<BR>> > edges.add(new=20
Edge(EntreeOrder_Joe, WineOrder_Joe));<BR>> > // stop =
paste<BR>>=20
><BR>> > CompoundDirectedGraph graph =3D new=20
CompoundDirectedGraph();<BR>> > graph.nodes =3D nodes;<BR>> =
>=20
graph.edges =3D edges;<BR>> ><BR>> > new=20
CompoundDirectedGraphLayout().visit(graph);<BR>> ><BR>> > =
<BR>>=20
<BR>> </FONT></BODY></HTML>
------=_NextPart_000_00F2_01C67B2E.28579BA0--
|
|
| |
Goto Forum:
Current Time: Sun Jan 19 19:43:20 GMT 2025
Powered by FUDForum. Page generated in 0.02564 seconds
|