Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Exception when Edge created
Exception when Edge created [message #215891] Thu, 11 May 2006 07:40 Go to next message
richbk is currently offline richbkFriend
Messages: 6
Registered: July 2009
Junior Member
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 #216371 is a reply to message #215891] Wed, 17 May 2006 17:53 Go to previous messageGo to next message
richbk is currently offline richbkFriend
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 Go to previous messageGo to next message
Steven R. Shaw is currently offline Steven R. ShawFriend
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.&nbsp; I fixed your graph by introducing a SubGraph =
"top":</FONT></DIV>
<DIV><FONT face=3D"Courier New" size=3D2></FONT>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>"richbk" &lt;</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>&gt; =
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>&gt; Hi =
All,<BR>&gt; <BR>&gt;=20
Here is the exception producing code reduced to the fewest lines that =
still=20
<BR>&gt; fail:<BR>&gt; <BR>&gt; ----------------<BR>&gt; &nbsp;NodeList =
nodes =3D=20
new NodeList();<BR>&gt; &nbsp;EdgeList edges =3D new EdgeList();<BR>&gt; =
<BR>&gt;=20
&nbsp;Subgraph a =3D new Subgraph("a");<BR>&gt; =
&nbsp;nodes.add(a);<BR>&gt;=20
&nbsp;Node b =3D new Node("b", a);<BR>&gt; &nbsp;nodes.add(b);<BR>&gt; =
&nbsp;Node=20
c =3D new Node("c");<BR>&gt; &nbsp;nodes.add(c);<BR>&gt; =
&nbsp;edges.add(new=20
Edge(c, a));<BR>&gt; <BR>&gt; &nbsp;CompoundDirectedGraph graph =3D new=20
CompoundDirectedGraph();<BR>&gt; &nbsp;graph.nodes =3D nodes;<BR>&gt;=20
&nbsp;graph.edges =3D edges;<BR>&gt; <BR>&gt; &nbsp;new=20
CompoundDirectedGraphLayout().visit(graph);<BR>&gt; =
----------------<BR>&gt;=20
<BR>&gt; Thanks for any help,<BR>&gt; Rick<BR>&gt; <BR>&gt; <BR>&gt; =
<BR>&gt;=20
"Rick Kissh" &lt;</FONT><A href=3D"mailto:richbk@hotmail.com"><FONT =
face=3DArial=20
size=3D2>richbk@hotmail.com</FONT></A><FONT face=3DArial size=3D2>&gt; =
wrote in=20
message <BR>&gt; </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>&gt; &gt;<BR>&gt; &gt; Hi,<BR>&gt; &gt;<BR>&gt; &gt; I =
get an=20
exception in the included code.&nbsp; If I don't create the Edge I =
<BR>&gt; &gt;=20
don't get the exception.&nbsp; I'm using 3.2M5a.&nbsp; It's not obvious =
to me=20
that <BR>&gt; &gt; I'm doing anything wrong.<BR>&gt; &gt;<BR>&gt; &gt;=20
Thanks,<BR>&gt; &gt; Rick<BR>&gt; &gt;<BR>&gt; &gt; Caused by:=20
java.lang.NullPointerException<BR>&gt; &gt; at <BR>&gt; &gt;=20
org.eclipse.draw2d.graph.GraphUtilities.isConstrained(GraphU tilities.java=
:141)<BR>&gt;=20
&gt; at =
org.eclipse.draw2d.graph.RankSorter.swap(RankSorter.java:183 ) <BR>&gt;=20
&gt; at =
org.eclipse.draw2d.graph.RankSorter.sort(RankSorter.java:171 ) <BR>&gt;=20
&gt; at <BR>&gt; &gt;=20
org.eclipse.draw2d.graph.RankSorter.sortRankIncoming(RankSor ter.java:140)=
<BR>&gt;=20
&gt; at =
org.eclipse.draw2d.graph.MinCross.solve(MinCross.java:43)<BR >&gt; &gt;=20
at org.eclipse.draw2d.graph.MinCross.visit(MinCross.java:60)<BR >&gt; =
&gt; at=20
<BR>&gt; &gt;=20
org.eclipse.draw2d.graph.DirectedGraphLayout.visit(DirectedG raphLayout.ja=
va:99)<BR>&gt;=20
&gt;<BR>&gt; &gt;<BR>&gt; &gt; NodeList nodes =3D new =
NodeList();<BR>&gt; &gt;=20
EdgeList edges =3D new EdgeList();<BR>&gt; &gt;<BR>&gt; &gt; // start=20
paste<BR>&gt; &gt;&nbsp; Insets pad =3D new Insets(50, 50, 110, =
50);<BR>&gt; &gt;=20
Subgraph WineOrder_Joe =3D new Subgraph("WineOrder.Joe");<BR>&gt; &gt;=20
nodes.add(WineOrder_Joe);<BR>&gt; &gt; Node WineOrder_Joe_variety =3D =
new=20
Node("WineOrder.Joe.variety", <BR>&gt; &gt; WineOrder_Joe);<BR>&gt; &gt; =

WineOrder_Joe_variety.width =3D 178;<BR>&gt; &gt; =
WineOrder_Joe_variety.height =3D=20
79;<BR>&gt; &gt; WineOrder_Joe_variety.setPadding(pad);<BR>&gt; &gt;=20
nodes.add(WineOrder_Joe_variety);<BR>&gt; &gt; Node EntreeOrder_Joe =3D =
new=20
Node("EntreeOrder.Joe");<BR>&gt; &gt; =
nodes.add(EntreeOrder_Joe);<BR>&gt; &gt;=20
EntreeOrder_Joe.width =3D 134;<BR>&gt; &gt; EntreeOrder_Joe.height =3D =
61;<BR>&gt;=20
&gt; EntreeOrder_Joe.setPadding(pad);<BR>&gt; &gt; edges.add(new=20
Edge(EntreeOrder_Joe, WineOrder_Joe));<BR>&gt; &gt; // stop =
paste<BR>&gt;=20
&gt;<BR>&gt; &gt; CompoundDirectedGraph graph =3D new=20
CompoundDirectedGraph();<BR>&gt; &gt; graph.nodes =3D nodes;<BR>&gt; =
&gt;=20
graph.edges =3D edges;<BR>&gt; &gt;<BR>&gt; &gt; new=20
CompoundDirectedGraphLayout().visit(graph);<BR>&gt; &gt;<BR>&gt; &gt; =
<BR>&gt;=20
<BR>&gt; </FONT></BODY></HTML>

------=_NextPart_000_00F2_01C67B2E.28579BA0--
Sorry [message #216727 is a reply to message #215891] Wed, 24 May 2006 01:50 Go to previous message
Eclipse UserFriend
Originally posted by: ysanchezp.estudiantes.uci.cu

I dont speak english but I am programming a equations editor in java languaje. Can I use GEF for do it?

Pleasse send a message to: ysanchezp@estudiantes.uci.cu
Previous Topic:CompoundDirectedGraphLayout creates Edge that shoots out to the side
Next Topic:EditPart controling a sub-figure ?
Goto Forum:
  


Current Time: Thu Apr 25 16:36:41 GMT 2024

Powered by FUDForum. Page generated in 0.03336 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top