Gephi Toolkit Javadoc

org.gephi.preview.plugin.renderers
Class NodeRenderer

java.lang.Object
  extended by org.gephi.preview.plugin.renderers.NodeRenderer
All Implemented Interfaces:
Renderer

public class NodeRenderer
extends java.lang.Object
implements Renderer

Author:
Yudi Xue, Mathieu Bastian

Field Summary
protected  DependantColor defaultBorderColor
           
protected  float defaultBorderWidth
           
protected  float defaultOpacity
           
 
Constructor Summary
NodeRenderer()
           
 
Method Summary
 java.lang.String getDisplayName()
          Provides an user friendly name for the renderer.
 PreviewProperty[] getProperties()
          Returns all associated properties for this renderer.
 boolean isRendererForitem(Item item, PreviewProperties properties)
          Based on properties, determine whether this renderer is valid to render Item.
 boolean needsItemBuilder(ItemBuilder itemBuilder, PreviewProperties properties)
          Based on the itemBuilder class and the properties, determine whether this renderer needs the given itemBuilder to be executed before rendering.
 void preProcess(PreviewModel previewModel)
          This method is called before rendering for all renderers and initializes items' additional attributes or run complex algorithms.
 void render(Item item, RenderTarget target, PreviewProperties properties)
          Render item to target using the global properties and item data.
 void renderPDF(Item item, PDFTarget target, PreviewProperties properties)
           
 void renderProcessing(Item item, ProcessingTarget target, PreviewProperties properties)
           
 void renderSVG(Item item, SVGTarget target, PreviewProperties properties)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

defaultBorderWidth

protected float defaultBorderWidth

defaultBorderColor

protected DependantColor defaultBorderColor

defaultOpacity

protected float defaultOpacity
Constructor Detail

NodeRenderer

public NodeRenderer()
Method Detail

preProcess

public void preProcess(PreviewModel previewModel)
Description copied from interface: Renderer
This method is called before rendering for all renderers and initializes items' additional attributes or run complex algorithms.

This method has access to any item using the getItems() methods of the preview model.

No data should be stored in the renderer itself but put in items using Item.setData(java.lang.String, java.lang.Object). Global states can be stored in properties using PreviewProperties.putValue(java.lang.String, java.lang.Object).

Specified by:
preProcess in interface Renderer
Parameters:
previewModel - the model to get items from

render

public void render(Item item,
                   RenderTarget target,
                   PreviewProperties properties)
Description copied from interface: Renderer
Render item to target using the global properties and item data.

The target can be one of the default target ProcessingTarget, SVGTarget or PDFTarget. Each target contains an access to it's drawing canvas so the renderer can draw visual items.

Specified by:
render in interface Renderer
Parameters:
item - the item to be rendered
target - the target to render the item on
properties - the central properties

renderProcessing

public void renderProcessing(Item item,
                             ProcessingTarget target,
                             PreviewProperties properties)

renderSVG

public void renderSVG(Item item,
                      SVGTarget target,
                      PreviewProperties properties)

renderPDF

public void renderPDF(Item item,
                      PDFTarget target,
                      PreviewProperties properties)

getProperties

public PreviewProperty[] getProperties()
Description copied from interface: Renderer
Returns all associated properties for this renderer. Properties can be built using static PreviewProperty.createProperty() methods.

Specified by:
getProperties in interface Renderer
Returns:
a properties array

isRendererForitem

public boolean isRendererForitem(Item item,
                                 PreviewProperties properties)
Description copied from interface: Renderer
Based on properties, determine whether this renderer is valid to render Item.

Additional states in properties helps to make a decision, including:

Specified by:
isRendererForitem in interface Renderer
Parameters:
item - the item to be tested
properties - the current properties
Returns:
true if item can be rendered by this renderer, false otherwise

needsItemBuilder

public boolean needsItemBuilder(ItemBuilder itemBuilder,
                                PreviewProperties properties)
Description copied from interface: Renderer
Based on the itemBuilder class and the properties, determine whether this renderer needs the given itemBuilder to be executed before rendering.

This is used for avoiding building unnecessary items while refreshing preview.

You can simply return true if the builder builds items that this renderer renders, but you can also check the current properties to see if your renderer is going to produce any graphic.

Additional states in properties helps to make a decision, including:

Specified by:
needsItemBuilder in interface Renderer
Parameters:
itemBuilder - builder that your renderer may need
properties - Current properties
Returns:
true if you are going to use built items for rendering, false otherwise

getDisplayName

public java.lang.String getDisplayName()
Description copied from interface: Renderer
Provides an user friendly name for the renderer. This name will appear in the renderers manager UI.

Specified by:
getDisplayName in interface Renderer
Returns:
User friendly renderer name, not null

Gephi Toolkit Javadoc