Cytoscape 2.8.0 API

cytoscape.visual.calculators
Class AbstractCalculator

java.lang.Object
  extended by cytoscape.visual.calculators.AbstractCalculator
All Implemented Interfaces:
Calculator, Cloneable
Direct Known Subclasses:
BasicCalculator

public abstract class AbstractCalculator
extends Object
implements Calculator


Nested Class Summary
protected  class AbstractCalculator.CalculatorUI
          Deprecated. Do not use. This UI was replaced by new VizMap GUI.
 
Field Summary
protected  Vector acceptedDataClasses
          The domain classes accepted by the mappings underlying this calculator.
protected  ChangeEvent changeEvent
          Only one ChangeEvent is needed per calculator instance since the event's only state is the source property.
protected  List changeListeners
          keep track of interested UI classes.
protected  Vector<ObjectMapping> mappings
          Vector of all mappings contained by this calculator.
protected  String name
           
protected  VisualPropertyType type
          Type of this visual property.
 
Fields inherited from interface cytoscape.visual.calculators.Calculator
ID
 
Constructor Summary
AbstractCalculator(String name, ObjectMapping m, VisualPropertyType type)
          Creates a new AbstractCalculator object.
 
Method Summary
 void addChangeListener(ChangeListener l)
          Add a ChangeListener to the calcaultor.
 void addMapping(ObjectMapping m)
          Add a mapping to the mappings contained by the calculator.
 void apply(Appearance appr, Edge e, CyNetwork net)
          DOCUMENT ME!
 void apply(Appearance appr, Node n, CyNetwork net)
          DOCUMENT ME!
 Object clone()
          Clone the calculator.
protected  void fireStateChanged()
          Notifies all listeners that have registered interest for notification on this event type.
protected  Map<String,Object> getAttrBundle(String canonicalName)
           
protected  Map<String,Object> getAttrBundle(String canonicalName, CyAttributes cyAttrs)
          Returns a map of attribute names to single values.
protected  String getClassName()
          This exists so that it can be overridden in legacy classes (GenericNodeSizeCalculator, GenericColorCalculator, GenericArrowCalculator) such that they return the a new class name instead of a legacy class name.
 int getDupeCount()
          Get how many times this calculator has been duplicated.
 ObjectMapping getMapping(int i)
          Get the mapping at a specific index in this calculator.
 Vector<ObjectMapping> getMappings()
          Get all mappings contained by this calculator.
 Properties getProperties()
          Returns a properties description of this calculator.
protected  Object getRangeValue(GraphObject obj)
           
protected  JPanel getUI(CyAttributes attr, JDialog parent, CyNetwork network)
          Deprecated. will be removed in the next release (2.8 or 3.0)
 JPanel getUI(JDialog parent, CyNetwork network)
          Deprecated. Will be removed next release (2.8 or 3.0)
 VisualPropertyType getVisualPropertyType()
          Replaces the following 3 methods: public byte getType(); public String getTypeName(); public String getPropertyLabel(); The returned enum VisualPropertyType has replacement for these methods.
 void removeChangeListener(ChangeListener l)
          Remove a ChangeListener from the calcaultor.
 void setName(String newName)
          Set the name of this calculator.
 String toString()
          Get the name of this calculator.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

mappings

protected Vector<ObjectMapping> mappings
Vector of all mappings contained by this calculator. Usually small. Contains ObjectMapping objects.


acceptedDataClasses

protected Vector acceptedDataClasses
The domain classes accepted by the mappings underlying this calculator. Contains an array of classes - each representing the appropriate domain classes of the mapping in the mappings vector at the same index.


name

protected String name

type

protected VisualPropertyType type
Type of this visual property. (New in version 2.5)


changeListeners

protected List changeListeners
keep track of interested UI classes.


changeEvent

protected transient ChangeEvent changeEvent
Only one ChangeEvent is needed per calculator instance since the event's only state is the source property.

Constructor Detail

AbstractCalculator

public AbstractCalculator(String name,
                          ObjectMapping m,
                          VisualPropertyType type)
Creates a new AbstractCalculator object.

Parameters:
name - DOCUMENT ME!
m - DOCUMENT ME!
c - DOCUMENT ME!
type - DOCUMENT ME!
Method Detail

addMapping

public void addMapping(ObjectMapping m)
Add a mapping to the mappings contained by the calculator.

Parameters:
m - Mapping to add.

getMappings

public Vector<ObjectMapping> getMappings()
Get all mappings contained by this calculator.

Specified by:
getMappings in interface Calculator
Returns:
Vector of all mappings contained in this calculator

getMapping

public ObjectMapping getMapping(int i)
Get the mapping at a specific index in this calculator.

Specified by:
getMapping in interface Calculator
Parameters:
i - index of mapping to retrieve
Returns:
ObjectMapping at index i

getDupeCount

public int getDupeCount()
Get how many times this calculator has been duplicated.

Returns:
Calculator duplication count

clone

public Object clone()
             throws CloneNotSupportedException
Clone the calculator. AbstractCalculator makes an independent clone of itself but DOES NOT ensure that a unique name is created. Whoever is cloning the calculator should enter the new calculator in the catalog and create an appropriate name for it if needed.

Specified by:
clone in interface Calculator
Overrides:
clone in class Object
Returns:
Clone of this calculator
Throws:
CloneNotSupportedException - if something is seriously borked.

toString

public final String toString()
Get the name of this calculator.

Specified by:
toString in interface Calculator
Overrides:
toString in class Object
Returns:
the calculator's name

setName

public void setName(String newName)
Set the name of this calculator. Should only be done by the CalculatorCatalog after checking that name will not be duplicated.

Specified by:
setName in interface Calculator
Parameters:
newName - the new name for this calculator. Must be unique.

getProperties

public Properties getProperties()
Returns a properties description of this calculator. Adds the keyword ".mapping" to the supplied base key and calls the getProperties method of MappingFactory with the ObjectMapping and the augmented base key.

Specified by:
getProperties in interface Calculator

getClassName

protected String getClassName()
This exists so that it can be overridden in legacy classes (GenericNodeSizeCalculator, GenericColorCalculator, GenericArrowCalculator) such that they return the a new class name instead of a legacy class name. This will help prevent legacy classes from persisting in vizmap.props files.


getUI

@Deprecated
public JPanel getUI(JDialog parent,
                               CyNetwork network)
Deprecated. Will be removed next release (2.8 or 3.0)

Get the UI for the calculator.

Specified by:
getUI in interface Calculator
Parameters:
parent - Parent JDialog for the UI
network - CyNetwork object containing underlying graph data

getUI

@Deprecated
protected JPanel getUI(CyAttributes attr,
                                  JDialog parent,
                                  CyNetwork network)
Deprecated. will be removed in the next release (2.8 or 3.0)

Get the UI for calculators. Display a JComboBox with attributes in the given CyAttributes whose data are instances of the classes accepted by each ObjectMapping. The resulting JComboBox calls updateAttribute(String, CyNetwork, int) when frobbed.

Parameters:
attr - CyAttributes to look up attributes from
Returns:
UI with controlling attribute selection facilities

addChangeListener

public void addChangeListener(ChangeListener l)
Add a ChangeListener to the calcaultor. When the state underlying the calculator changes, all ChangeListeners will be notified. This is used in the UI classes to ensure that the UI panes stay consistent with the data held in the mappings.

Specified by:
addChangeListener in interface Calculator
Parameters:
l - ChangeListener to add

removeChangeListener

public void removeChangeListener(ChangeListener l)
Remove a ChangeListener from the calcaultor. When the state underlying the calculator changes, all ChangeListeners will be notified. This is used in the UI classes to ensure that the UI panes stay consistent with the data held in the mappings.

Specified by:
removeChangeListener in interface Calculator
Parameters:
l - ChangeListener to add

fireStateChanged

protected void fireStateChanged()
Notifies all listeners that have registered interest for notification on this event type. The event instance is lazily created. UI classes should attach themselves with a listener to the calculator to be notified about changes in the underlying data structures that require the UI classes to fetch a new copy of the UI and display it.


getAttrBundle

protected Map<String,Object> getAttrBundle(String canonicalName,
                                           CyAttributes cyAttrs)
Returns a map of attribute names to single values.

Parameters:
canonicalName - The attribute name returned from the CyNode or CyEdge.
Returns:
Map of the attribute names to values.

getAttrBundle

protected Map<String,Object> getAttrBundle(String canonicalName)

apply

public void apply(Appearance appr,
                  Edge e,
                  CyNetwork net)
DOCUMENT ME!

Specified by:
apply in interface Calculator
Parameters:
appr - DOCUMENT ME!
e - DOCUMENT ME!
net - DOCUMENT ME!

apply

public void apply(Appearance appr,
                  Node n,
                  CyNetwork net)
DOCUMENT ME!

Specified by:
apply in interface Calculator
Parameters:
appr - DOCUMENT ME!
n - DOCUMENT ME!
net - DOCUMENT ME!

getRangeValue

protected Object getRangeValue(GraphObject obj)

getVisualPropertyType

public VisualPropertyType getVisualPropertyType()
Replaces the following 3 methods: The returned enum VisualPropertyType has replacement for these methods.

Specified by:
getVisualPropertyType in interface Calculator
Returns:

Cytoscape 2.8.0 API

Copyright 2010 Cytoscape Consortium. All rights reserved.