blob: b6fb677ef917011e8eccb04833c56e68af3a533e [file] [log] [blame]
<HTML>
<HEAD>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<LINK REL="Stylesheet" HREF="https://netbeans.org/netbeans.css" TYPE="text/css">
<TITLE>netbeans.org : NetBeans Graph Library 1.0</TITLE>
</HEAD>
<BODY>
<h1>NetBeans Graph Library 1.0 - FAQ</h1>
This document lists questions and answers on NetBeans Graph Library.
<p>
<b>Q:&nbsp;How do I link nodes?</b><br>
<b>A:&nbsp;</b>Nodes cannot be linked directly. A link could be attached to ports only.
The only way is to create ports, attach them to appropriate nodes.
Then create a link and call its setSourcePort and setTargetPort. Of course all nodes and
the link has to be added into the document. For example look at the <a href="http://graph.netbeans.org/source/browse/graph/examples/src/org/netbeans/graph/examples/Document1.java?rev=graph1&content-type=text/vnd.viewcvs-markup">examples.Document1</a> class.
<p>
<b>Q:&nbsp;How to control whether a user can create a link?</b><br>
<b>A:&nbsp;</b>If you are using built-in implementation of ports (GraphPort class), there
is setSource and setTarget method. Using them you can set whether a library can use the
port are a possible source and/or target. When an user performs "linking" action from
a valid source port to a valid target port, when a IGraphEventHandler.isLinkCreatable method
is called by the library to resolve whether a link could be create between these two ports.
If it returns true, then the library calls IGraphEventHandler.createLink to actual creation.
<hr>
If you would like to include your question here, please send it to <a href="mailto:users@graph.netbeans.org">users@graph.netbeans.org</a> mailing list.
</BODY>
</HTML>