Gephi Toolkit Javadoc

Package org.gephi.preview.spi

Interfaces for creating new renderers, item builders and render targets.

See:
          Description

Interface Summary
ItemBuilder Builds and returns new Item instances.
PreviewUI SPI interface to add UI settings components to the Preview.
Renderer Renderer describes how a particular Item object is rendered on a particular RenderTarget instance.
RenderTargetBuilder Builds and returns new RenderTarget instances.
 

Package org.gephi.preview.spi Description

Interfaces for creating new renderers, item builders and render targets.

Create a new Item Builder

  1. Create a new module and set Preview API, Graph API, AttributesAPI and Lookup as dependencies.
  2. Create a new item class which implements Item or extends AbstractItem. The AbstractItem class is located in the PreviewPlugin module so add it as dependency first. An item should be very simple but has a unique identifier returned by its getType() method.
  3. Create a new builder class that implements ItemBuilder
  4. Implement the getType() method and returns the same identifier than the Item you created earlier.
  5. Implement the getItems() method by retrieving objects from the given graph.
  6. Add @ServiceProvider annotation to your builder, that it can be found by the system. Set ItemBuilder as the annotation parameter.

Create a new Renderer

  1. Create a new module and set Preview API, GraphAPI, Processing Wrapper, iText Wrapper and Lookup as dependencies.
  2. Create a new class that implements Renderer.
  3. Implement the renderer methods.
  4. Add @ServiceProvider annotation to your builder, that it can be found by the system. Set Renderer as the annotation parameter.

Add data to an existing item

To add an additional data attribute to a Node or Edge item, you need to create a new item builder for the specific type. For instance if one want to add a new attribute to nodes create a new ItemBuilder for the type Item.Node. Simply return item objects with the data you want to add. The system will automatically merge your new data to node items.

Override a Renderer

Default renderers can be completely replaced by custom implementations. The implementation needs to customize its @ServiceProvider annotation with the renderer path it is overriding:

Add a new PreviewUI settings panel

Plug-ins can add UI components to the Preview Settings module. Additional components are placed in new tabs and have access to the current PreviewModel and therefore PreviewProperties.
  1. Create a new module and set Preview API and Lookup as dependencies.
  2. Create a new class that implements PreviewUI and implements methods.
  3. Add @ServiceProvider annotation to your builder, that it can be found by the system. Set PreviewUI as the 'service' annotation parameter.


Gephi Toolkit Javadoc