Gephi Toolkit Javadoc

org.gephi.preview
Class PreviewModelImpl

java.lang.Object
  extended by org.gephi.preview.PreviewModelImpl
All Implemented Interfaces:
PreviewModel

public class PreviewModelImpl
extends java.lang.Object
implements PreviewModel

Author:
Mathieu Bastian

Constructor Summary
PreviewModelImpl(Workspace workspace)
           
PreviewModelImpl(Workspace workspace, PreviewController previewController)
           
 
Method Summary
 void clear()
           
 java.awt.Dimension getDimensions()
          Returns the width and height of the graph in the graph coordinates.
 Item getItem(java.lang.String type, java.lang.Object source)
          Returns the item attached to source and with the type type.
 Item[] getItems(java.lang.Object source)
          Returns all items attached to source.
 Item[] getItems(java.lang.String type)
          Returns all items with type as type.
 java.lang.String[] getItemTypes()
           
 Renderer[] getManagedEnabledRenderers()
          Returns managedRenderers Renderers that are enabled, or null if managedRenderers is null.
 ManagedRenderer[] getManagedRenderers()
          Returns currently managed renderers, or null.
 PreviewProperties getProperties()
          Returns the preview properties attached to this model.
 java.awt.Point getTopLeftPosition()
          Returns the top left position in the graph coordinate (i.e.
 Workspace getWorkspace()
           
 void loadItems(java.lang.String type, Item[] items)
           
 void readXML(javax.xml.stream.XMLStreamReader reader)
           
 void setDimensions(java.awt.Dimension dimensions)
           
 void setManagedRenderers(ManagedRenderer[] managedRenderers)
          Sets an user-defined array of managed renderers to use when rendering.
 void setTopLeftPosition(java.awt.Point topLeftPosition)
           
 void writeXML(javax.xml.stream.XMLStreamWriter writer)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PreviewModelImpl

public PreviewModelImpl(Workspace workspace)

PreviewModelImpl

public PreviewModelImpl(Workspace workspace,
                        PreviewController previewController)
Method Detail

getProperties

public PreviewProperties getProperties()
Description copied from interface: PreviewModel
Returns the preview properties attached to this model.

Specified by:
getProperties in interface PreviewModel
Returns:
the preview properties

getItems

public Item[] getItems(java.lang.String type)
Description copied from interface: PreviewModel
Returns all items with type as type.

Default types are Item.NODE, Item.EDGE, Item.NODE_LABEL and Item.EDGE_LABEL.

Specified by:
getItems in interface PreviewModel
Parameters:
type - the item's type
Returns:
all items from this type

getItem

public Item getItem(java.lang.String type,
                    java.lang.Object source)
Description copied from interface: PreviewModel
Returns the item attached to source and with the type type.

The source is the graph object behind the item (e.g. Node or Edge) and the type a default or a custom type.

Default types are Item.NODE, Item.EDGE, Item.NODE_LABEL and Item.EDGE_LABEL.

Specified by:
getItem in interface PreviewModel
Parameters:
type - the item's type
source - the item's source object
Returns:
the item or null if not found

getItems

public Item[] getItems(java.lang.Object source)
Description copied from interface: PreviewModel
Returns all items attached to source.

The source is the graph object behind the item (e.g. Node or Edge). Multiple items can be created from the same source object. For instance both Item.NODE and Item.NODE_LABEL have the node object as source.

Specified by:
getItems in interface PreviewModel
Parameters:
source - the item's source
Returns:
all items with source as source

getItemTypes

public java.lang.String[] getItemTypes()

loadItems

public void loadItems(java.lang.String type,
                      Item[] items)

clear

public void clear()

getWorkspace

public Workspace getWorkspace()

getDimensions

public java.awt.Dimension getDimensions()
Description copied from interface: PreviewModel
Returns the width and height of the graph in the graph coordinates.

Specified by:
getDimensions in interface PreviewModel
Returns:
the graph dimensions

getTopLeftPosition

public java.awt.Point getTopLeftPosition()
Description copied from interface: PreviewModel
Returns the top left position in the graph coordinate (i.e. not the preview coordinates).

Specified by:
getTopLeftPosition in interface PreviewModel
Returns:
the top left position point

setDimensions

public void setDimensions(java.awt.Dimension dimensions)

setTopLeftPosition

public void setTopLeftPosition(java.awt.Point topLeftPosition)

getManagedRenderers

public ManagedRenderer[] getManagedRenderers()
Description copied from interface: PreviewModel

Returns currently managed renderers, or null.

If managedRenderers is set to null, all renderers will be executed when rendering, in default implementation order.

Specified by:
getManagedRenderers in interface PreviewModel
Returns:
Enabled renderers or null

setManagedRenderers

public void setManagedRenderers(ManagedRenderer[] managedRenderers)
Description copied from interface: PreviewModel

Sets an user-defined array of managed renderers to use when rendering.

Only the renderers marked as enabled will be executed when rendering, and respecting the array order

If the input array does not contain a managed renderer for some renderer existing implementation, a new not enabled managed renderer will be added to the end of the input array

If managedRenderers is set to null, all renderers will be executed when rendering, in default implementation order.

Specified by:
setManagedRenderers in interface PreviewModel
Parameters:
managedRenderers - Managed renderers for future renderings

getManagedEnabledRenderers

public Renderer[] getManagedEnabledRenderers()
Description copied from interface: PreviewModel
Returns managedRenderers Renderers that are enabled, or null if managedRenderers is null.

Specified by:
getManagedEnabledRenderers in interface PreviewModel
Returns:
Enabled renderers or null

writeXML

public void writeXML(javax.xml.stream.XMLStreamWriter writer)
              throws javax.xml.stream.XMLStreamException
Throws:
javax.xml.stream.XMLStreamException

readXML

public void readXML(javax.xml.stream.XMLStreamReader reader)
             throws javax.xml.stream.XMLStreamException
Throws:
javax.xml.stream.XMLStreamException

Gephi Toolkit Javadoc