info.aduna.clustermap
Class ClusterMap

java.lang.Object
  extended by info.aduna.clustermap.ClusterMap

public class ClusterMap
extends Object

A ClusterMap generates a cluster map visualisation of a ClusterModel.

The visual properties of a ClusterMap can be configured through a key-(subject-)value-based mechanism. See the ClusterMapConstants interface for a list of possible keys and some values. Their use is described in detail in the documentation provided with the Cluster Map library.

Changes to the ClusterMap can be observed through the ClusterMapListener interface.


Constructor Summary
ClusterMap()
          Create a new ClusterMap, initially showing an empty ClusterModel.
 
Method Summary
 void addClusterMapListener(ClusterMapListener listener)
          Add a ClusterMapListener to this ClusterMap, which is notified about various changes to this ClusterMap.
 void applyProperties()
          Applies the properties that have been set on this ClusterMap since the last invocation of this method.
 void exportImageMap(Writer writer, boolean fullHtmlDocument, String mapName, String title, String imageFileName)
          Exports the clickable regions of the current contents of the ClusterMap as an HTML image map to the specified Writer.
 void exportImageMap(Writer writer, Properties properties)
          Exports the clickable regions of the current contents of the ClusterMap as an HTML image map to the specified Writer.
 void exportPngImage(File file)
          Exports the visual graph in PNG format to the specified File.
 void exportPngImage(OutputStream stream)
          Exports the current contents of the ClusterMap to the specified stream as a PNG image.
 void exportXmlImageMap(Writer writer)
          Exports the clickable regions of the current contents of the ClusterMap as a XML image map to the specified Writer, very similar to a HTML image map.
 void firePropertyChanged(String property, Object subject)
          Sends a "property changed" event with 'this' as argument to all ClusterMapListeners.
 ClusterModel getClusterModel()
          Returns the current ClusterModel.
 Graph getGraph()
           
 LayoutManager getLayoutManager()
           
 Object getProperty(String key, Object subject)
          Returns the value of the property indicated by the specified key and optionally the specified subject.
 Object getPropertyDefault(String key, Object subject)
          Returns the default value of the property indicated by the specified key and optionally the specified subject.
 RenderingProperties getRenderingProperties()
           
 Collection<?> getSelection()
          Returns the set of currently selected objects.
 String getVersion()
          Returns a String representation of the version of the library.
 void removeClusterMapListener(ClusterMapListener listener)
          Remove a ClusterMapListener from this ClusterMap.
 void selectRenderers(Collection<VertexRenderer> renderers)
          Utility method that allows for specifying selections at the graph level.
 void setClusterModel(ClusterModel clusterModel)
          Sets the ClusterModel that should be visualised by this ClusterMap.
 void setContent(ClusterModel clusterModel, Graph graph)
          Sets the content (the ClusterModel and the Graph) at once.
 void setProperty(String key, Object subject, Object value)
          Sets the property indicated by the specified key and optionally the specified subject to the specified value.
 void setSelection(Collection<?> objects)
          Let the specified set of objects appear to be selected.
 void updateGraph()
          Updates the contents of the ClusterMap so that it visualises the current ClusterModel.
 void updateLayout()
          Invokes the LayoutManager and updates the rendering coordinates.
 void updateRenderer()
          Updates the GraphRenderer and sends an event to all ClusterMapListeners.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClusterMap

public ClusterMap()
Create a new ClusterMap, initially showing an empty ClusterModel.

Method Detail

setClusterModel

public void setClusterModel(ClusterModel clusterModel)
                     throws IllegalArgumentException
Sets the ClusterModel that should be visualised by this ClusterMap. The ClusterModel will only become visible after the invocation of the updateGraph method.

Parameters:
model - The ClusterModel that will be visualised in this ClusterMap.
Throws:
IllegalArgumentException - when the specified model is 'null'.
See Also:
updateGraph()

getClusterModel

public ClusterModel getClusterModel()
Returns the current ClusterModel.


getGraph

public Graph getGraph()

getLayoutManager

public LayoutManager getLayoutManager()

getRenderingProperties

public RenderingProperties getRenderingProperties()

updateGraph

public void updateGraph()
Updates the contents of the ClusterMap so that it visualises the current ClusterModel. This may be an expensive operation, depending on the number of Clusters in the ClusterModel and the use of the heuristic, incremental layout algorithm.

See Also:
setClusterModel(info.aduna.clustermap.ClusterModel)

updateLayout

public void updateLayout()
Invokes the LayoutManager and updates the rendering coordinates. This only affects the layout of the Graph, i.e. it does not create a new Graph, nor does is inherit an existing layout from another Graph.


updateRenderer

public void updateRenderer()
Updates the GraphRenderer and sends an event to all ClusterMapListeners.


setSelection

public void setSelection(Collection<?> objects)
Let the specified set of objects appear to be selected. These can be Classifications, Clusters or Objects contained in Classifications or Clusters. All ClusterMapListeners are notified about the selection changes. No separate rendering changed event is sent.


selectRenderers

public void selectRenderers(Collection<VertexRenderer> renderers)
Utility method that allows for specifying selections at the graph level.


getSelection

public Collection<?> getSelection()
Returns the set of currently selected objects. These can be Classifications, Clusters or Objects contained in Classifications or Clusters.


setContent

public void setContent(ClusterModel clusterModel,
                       Graph graph)
Sets the content (the ClusterModel and the Graph) at once. The layout manager is not invoked. This is used for realizing browser history-like functionality.


setProperty

public void setProperty(String key,
                        Object subject,
                        Object value)
                 throws IllegalArgumentException
Sets the property indicated by the specified key and optionally the specified subject to the specified value. The possible keys and some symbolic values are defined in ClusterMapConstants.

The specified settings will be parsed immediately but will only become effective when the applyProperties method is invoked. This strategy allows efficient updates of several properties at once.

Throws:
IllegalArgumentException - when the key or subject is unknown or when the value is illegal.
See Also:
ClusterMapConstants

getProperty

public Object getProperty(String key,
                          Object subject)
                   throws IllegalArgumentException
Returns the value of the property indicated by the specified key and optionally the specified subject.

Throws:
IllegalArgumentException - in case of unknown keys or subjects.

getPropertyDefault

public Object getPropertyDefault(String key,
                                 Object subject)
                          throws IllegalArgumentException
Returns the default value of the property indicated by the specified key and optionally the specified subject.

Throws:
IllegalArgumentException - in case of unknown keys or subjects.

applyProperties

public void applyProperties()
Applies the properties that have been set on this ClusterMap since the last invocation of this method.


getVersion

public String getVersion()
Returns a String representation of the version of the library.


addClusterMapListener

public void addClusterMapListener(ClusterMapListener listener)
Add a ClusterMapListener to this ClusterMap, which is notified about various changes to this ClusterMap.


removeClusterMapListener

public void removeClusterMapListener(ClusterMapListener listener)
Remove a ClusterMapListener from this ClusterMap. Nothing changes when the listener is not registered.


firePropertyChanged

public void firePropertyChanged(String property,
                                Object subject)
Sends a "property changed" event with 'this' as argument to all ClusterMapListeners.


exportPngImage

public void exportPngImage(File file)
                    throws IOException
Exports the visual graph in PNG format to the specified File. The image will display the Aduna logo.

Parameters:
file - The File to which the PNG image will be saved.
Throws:
IOException - if an I/O error occurs.

exportPngImage

public void exportPngImage(OutputStream stream)
                    throws IOException
Exports the current contents of the ClusterMap to the specified stream as a PNG image. The image will display the Aduna logo.

Parameters:
stream - The OutputStream to which the PNG image will be send.
Throws:
IOException - if an I/O error occurs.

exportImageMap

public void exportImageMap(Writer writer,
                           Properties properties)
                    throws IOException
Exports the clickable regions of the current contents of the ClusterMap as an HTML image map to the specified Writer. This can be used in combination with exportPngImage to create a clickable image map.

Various properties of the desired output can be indicated to the ClusterMap through the specified Properties instance. See the documentation provided with the Cluster Map library for possible keys and values.

Parameters:
writer - The Writer to which the HTML (fragment) will be written.
properties - A Properties instance containing key-value pairs that indicate desired characteristics of the HTML source. See class documentation for allowed keys and values. This property may be null, indicating that all default properties are used. Unknown keys or values in this Properties are ignored.
Throws:
IOException - If an I/O error occurs.

exportImageMap

public void exportImageMap(Writer writer,
                           boolean fullHtmlDocument,
                           String mapName,
                           String title,
                           String imageFileName)
Exports the clickable regions of the current contents of the ClusterMap as an HTML image map to the specified Writer. This can be used in combination with exportPngImage to create a clickable image map.

Various properties of the desired output can be indicated to the ClusterMap through the specified Properties instance. See the documentation provided with the Cluster Map library for possible keys and values.

Parameters:
writer - The Writer to which the HTML (fragment) will be written.
fullHtmlDocument - Indicates whether a complete HTML document needs to be generated or only the MAP element.
mapName - The name used for the MAP element.
title - The title of the HTML document, if a full document is to be generated.
imageFileName - The name of the referred image, if a full document is to be generated.
Throws:
IOException - If an I/O error occurs.

exportXmlImageMap

public void exportXmlImageMap(Writer writer)
                       throws IOException
Exports the clickable regions of the current contents of the ClusterMap as a XML image map to the specified Writer, very similar to a HTML image map. This can be used in combination with exportPngImage to create a clickable image map that can more flexibly be integrated than a HTML image map.

Throws:
IOException - if an I/O error occurs.


Copyright © 1997-2008 Aduna. All Rights Reserved.