[Gephi-plugins] extending NodeDraftImpl ?

T B phreakocious at gmail.com
Tue Oct 18 19:26:45 CEST 2011

Gephi folks,

I am working on a new plugin which consumes JSON data via Jackson to
generate graphs.  The documented mechanism for adding new nodes is to
retrieve a NodeDraft object from the factory class, use the setters for its
parameters, and add it to the ContainerLoader:

ContainerLoader cldr = container.getLoader();
NodeDraft nodeDraft = cldr.factory().newNodeDraft();
nodeDraft.setLabel("this is mynode");

Since Jackson's deserialization process will create objects for each node as
a part of its processing, it seems logical to extend the NodeDraft
functionality into those objects, rather than fetching them from the
factory.  I currently have exposed the ContainerLoader, and added a
NodeDraft object to mine:

public class MyNode {

    public NodeDraft nodeDraft;

    MyNode() {
        ContainerLoader cldr =
        nodeDraft = cldr.factory().newNodeDraft();
        AttributeTable nodeAttributeTable =

NodeDraftImpl in the Import API is not marked as public, and reimplementing
all that code seems a bit ugly.  Would it be possible to extend
NodeDraftImpl and reproduce the function of factory().newNodeDraft() in the

Any thoughts are welcome.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://gephi.org/pipermail/gephi-plugins/attachments/20111018/88b7b5b0/attachment.html>

More information about the gephi-plugins mailing list