de.lmu.ifi.dbs.elki.visualization
Class VisualizerContext

java.lang.Object
  extended by java.util.AbstractMap<K,V>
      extended by java.util.HashMap<K,Object>
          extended by de.lmu.ifi.dbs.elki.utilities.datastructures.AnyMap<String>
              extended by de.lmu.ifi.dbs.elki.visualization.VisualizerContext
All Implemented Interfaces:
DataStoreListener, Result, ResultListener, Serializable, Cloneable, EventListener, Map<String,Object>

public class VisualizerContext
extends AnyMap<String>
implements DataStoreListener, ResultListener, Result

Map to store context information for the visualizer. This can be any data that should to be shared among plots, such as line colors, styles etc.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
 
Field Summary
static String CLUSTERING
          Identifier for the primary clustering to use.
static String CLUSTERING_FALLBACK
          Identifier for a fallback (default) clustering.
private  Collection<VisFactory> factories
          Factories to use
private  Pattern hideVisualizers
          Visualizers to hide by default
private  EventListenerList listenerList
          The event listeners for this context.
private static Logging logger
          Logger.
private  Collection<ProjectorFactory> projectors
          Projectors to use
private  HierarchicalResult result
          The full result object
static String SELECTION
          Identifier for the selection
private static long serialVersionUID
          Serial version.
private  StyleLibrary stylelib
          The style library of this context
static String VISUALIZER_LIST
          Identifier for the visualizer list
 
Constructor Summary
VisualizerContext(HierarchicalResult result, StyleLibrary stylelib, Collection<ProjectorFactory> projectors, Collection<VisFactory> factories, Pattern hideVisualizers)
          Constructor.
 
Method Summary
 void addContextChangeListener(ContextChangeListener listener)
          Add a context change listener.
 void addDataStoreListener(DataStoreListener l)
          Adds a listener for the DataStoreEvent posted after the content changes.
 void addResultListener(ResultListener listener)
          Register a result listener.
 void contentChanged(DataStoreEvent e)
          Proxy datastore event to child listeners.
 void fireContextChange(ContextChangedEvent e)
          Trigger a context change event.
private  Clustering<Model> generateDefaultClustering()
          Generate a default (fallback) clustering.
 ResultHierarchy getHierarchy()
          Get the hierarchy object
 String getLongName()
          A "pretty" name for the result, for use in titles, captions and menus.
 Clustering<Model> getOrCreateDefaultClustering()
          Convenience method to get the clustering to use, and fall back to a default "clustering".
 HierarchicalResult getResult()
          Get the full result object
 DBIDSelection getSelection()
          Get the current selection.
 String getShortName()
          A short name for the result, useful for file names.
 StyleLibrary getStyleLibrary()
          Get the style library
 IterableIterator<VisualizationTask> iterVisualizers()
          Deprecated. Odd semantics: contains duplicates!
private  void processNewResult(HierarchicalResult baseResult, Result newResult)
          Process a particular result.
 void removeContextChangeListener(ContextChangeListener listener)
          Remove a context change listener.
 void removeDataStoreListener(DataStoreListener l)
          Removes a listener previously added with addDataStoreListener.
 void removeResultListener(ResultListener listener)
          Remove a result listener.
 void resultAdded(Result child, Result parent)
          A new derived result was added.
 void resultChanged(Result current)
          Notify that the current result has changed substantially.
 void resultRemoved(Result child, Result parent)
          A result was removed.
 void setSelection(DBIDSelection sel)
          Set a new selection.
 void setVisualizationVisibility(VisualizationTask task, boolean visibility)
          Change a visualizers visibility.
 
Methods inherited from class de.lmu.ifi.dbs.elki.utilities.datastructures.AnyMap
get, get, getGenerics
 
Methods inherited from class java.util.HashMap
clear, clone, containsKey, containsValue, entrySet, isEmpty, keySet, put, putAll, remove, size, values
 
Methods inherited from class java.util.AbstractMap
equals, hashCode, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Field Detail

serialVersionUID

private static final long serialVersionUID
Serial version.

See Also:
Constant Field Values

logger

private static final Logging logger
Logger.


result

private HierarchicalResult result
The full result object


listenerList

private EventListenerList listenerList
The event listeners for this context.


stylelib

private StyleLibrary stylelib
The style library of this context


projectors

private Collection<ProjectorFactory> projectors
Projectors to use


factories

private Collection<VisFactory> factories
Factories to use


hideVisualizers

private Pattern hideVisualizers
Visualizers to hide by default


CLUSTERING

public static final String CLUSTERING
Identifier for the primary clustering to use.

See Also:
Constant Field Values

CLUSTERING_FALLBACK

public static final String CLUSTERING_FALLBACK
Identifier for a fallback (default) clustering.

See Also:
Constant Field Values

VISUALIZER_LIST

public static final String VISUALIZER_LIST
Identifier for the visualizer list

See Also:
Constant Field Values

SELECTION

public static final String SELECTION
Identifier for the selection

See Also:
Constant Field Values
Constructor Detail

VisualizerContext

public VisualizerContext(HierarchicalResult result,
                         StyleLibrary stylelib,
                         Collection<ProjectorFactory> projectors,
                         Collection<VisFactory> factories,
                         Pattern hideVisualizers)
Constructor. We currently require a Database and a Result.

Parameters:
result - Result
stylelib - Style library
projectors - Projectors to use
factories - Visualizer Factories to use
hideVisualizers - Pattern to hide visualizers
Method Detail

getResult

public HierarchicalResult getResult()
Get the full result object

Returns:
result object

getHierarchy

public ResultHierarchy getHierarchy()
Get the hierarchy object

Returns:
hierarchy object

getStyleLibrary

public StyleLibrary getStyleLibrary()
Get the style library

Returns:
style library

getOrCreateDefaultClustering

public Clustering<Model> getOrCreateDefaultClustering()
Convenience method to get the clustering to use, and fall back to a default "clustering".

Returns:
Clustering to use

generateDefaultClustering

private Clustering<Model> generateDefaultClustering()
Generate a default (fallback) clustering.

Returns:
generated clustering

getSelection

public DBIDSelection getSelection()
Get the current selection.

Returns:
selection

setSelection

public void setSelection(DBIDSelection sel)
Set a new selection.

Parameters:
sel - Selection

setVisualizationVisibility

public void setVisualizationVisibility(VisualizationTask task,
                                       boolean visibility)
Change a visualizers visibility. When a Tool visualizer is made visible, other tools are hidden.

Parameters:
task - Visualization task
visibility - new visibility

addContextChangeListener

public void addContextChangeListener(ContextChangeListener listener)
Add a context change listener.

Parameters:
listener -

removeContextChangeListener

public void removeContextChangeListener(ContextChangeListener listener)
Remove a context change listener.

Parameters:
listener -

fireContextChange

public void fireContextChange(ContextChangedEvent e)
Trigger a context change event.

Parameters:
e - Event

addDataStoreListener

public void addDataStoreListener(DataStoreListener l)
Adds a listener for the DataStoreEvent posted after the content changes.

Parameters:
l - the listener to add
See Also:
removeDataStoreListener(de.lmu.ifi.dbs.elki.database.datastore.DataStoreListener)

removeDataStoreListener

public void removeDataStoreListener(DataStoreListener l)
Removes a listener previously added with addDataStoreListener.

Parameters:
l - the listener to remove
See Also:
addDataStoreListener(de.lmu.ifi.dbs.elki.database.datastore.DataStoreListener)

contentChanged

public void contentChanged(DataStoreEvent e)
Proxy datastore event to child listeners.

Specified by:
contentChanged in interface DataStoreListener
Parameters:
e - the update event

processNewResult

private void processNewResult(HierarchicalResult baseResult,
                              Result newResult)
Process a particular result.

Parameters:
baseResult - Base Result
newResult - Newly added Result

iterVisualizers

@Deprecated
public IterableIterator<VisualizationTask> iterVisualizers()
Deprecated. Odd semantics: contains duplicates!

Get an iterator over all visualizers.

Returns:
Iterator

addResultListener

public void addResultListener(ResultListener listener)
Register a result listener.

Parameters:
listener - Result listener.

removeResultListener

public void removeResultListener(ResultListener listener)
Remove a result listener.

Parameters:
listener - Result listener.

resultAdded

public void resultAdded(Result child,
                        Result parent)
Description copied from interface: ResultListener
A new derived result was added.

Specified by:
resultAdded in interface ResultListener
Parameters:
child - New child result added
parent - Parent result that was added to

resultChanged

public void resultChanged(Result current)
Description copied from interface: ResultListener
Notify that the current result has changed substantially.

Specified by:
resultChanged in interface ResultListener
Parameters:
current - Result that has changed.

resultRemoved

public void resultRemoved(Result child,
                          Result parent)
Description copied from interface: ResultListener
A result was removed.

Specified by:
resultRemoved in interface ResultListener
Parameters:
child - result that was removed
parent - Parent result that was removed from

getLongName

public String getLongName()
Description copied from interface: Result
A "pretty" name for the result, for use in titles, captions and menus.

Specified by:
getLongName in interface Result
Returns:
result name

getShortName

public String getShortName()
Description copied from interface: Result
A short name for the result, useful for file names.

Specified by:
getShortName in interface Result
Returns:
result name

Release 0.4.0 (2011-09-20_1324)