Cytoscape 2.6.2 (c) 2006,2007 ISB, MSKCC, UCSD

cytoscape.visual.mappings
Class DiscreteMapping

java.lang.Object
  extended by cytoscape.visual.SubjectBase
      extended by cytoscape.visual.mappings.DiscreteMapping
All Implemented Interfaces:
ObjectMapping, Cloneable

public class DiscreteMapping
extends SubjectBase
implements ObjectMapping

Implements a lookup table mapping data to values of a particular class. The data value is extracted from a bundle of attributes by using a specified data attribute name.


Field Summary
 
Fields inherited from interface cytoscape.visual.mappings.ObjectMapping
EDGE_MAPPING, NODE_MAPPING
 
Constructor Summary
DiscreteMapping(Object defObj, byte mapType)
          Constructor.
DiscreteMapping(Object defObj, String attrName, byte mapType)
          Constructor.
 
Method Summary
 void applyProperties(Properties props, String baseKey, ValueParser parser)
          Customizes this object by applying mapping defintions described by the supplied Properties argument.
 Object calculateRangeValue(Map attrBundle)
          Calculates the Range Value.
 Object clone()
          Clones the Object.
 Class[] getAcceptedDataClasses()
          Gets Accepted Data Classes.
 Map getAll()
          gets all map values
 String getControllingAttributeName()
          Gets the Name of the Controlling Attribute.
 Object getLastKeyModified()
          Gets the Last Modified Key.
 JPanel getLegend(String visualAttr, byte b)
          Deprecated. Use getLegend(VisualPropertyType) instead. Gone 5/2008.
 JPanel getLegend(VisualPropertyType vpt)
          DOCUMENT ME!
 Object getMapValue(Object key)
          Gets Value for Specified Key.
 Properties getProperties(String baseKey)
          Returns a Properties object with entries suitable for customizing this object via the applyProperties method.
 Class getRangeClass()
          Gets the Range Class.
 JPanel getUI(JDialog parent, CyNetwork network)
          Gets the UI Object Associated with the Mapper.
 void putAll(Map<Object,Object> map)
          Adds All Members of Specified Map.
 void putMapValue(Object key, Object value)
          Puts New Key/Value in Map.
 void setControllingAttributeName(String attrName, CyNetwork n, boolean preserveMapping)
          Call whenever the controlling attribute changes.
 
Methods inherited from class cytoscape.visual.SubjectBase
addChangeListener, fireStateChanged, removeChangeListener
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface cytoscape.visual.mappings.ObjectMapping
addChangeListener, removeChangeListener
 

Constructor Detail

DiscreteMapping

public DiscreteMapping(Object defObj,
                       byte mapType)
Constructor.

Parameters:
defObj - Default Object.
mapType - Map Type, ObjectMapping.EDGE_MAPPING or ObjectMapping.NODE_MAPPING.

DiscreteMapping

public DiscreteMapping(Object defObj,
                       String attrName,
                       byte mapType)
Constructor.

Parameters:
defObj - Default Object.
attrName - Controlling Attribute Name.
mapType - Map Type, ObjectMapping.EDGE_MAPPING or ObjectMapping.NODE_MAPPING.
Method Detail

clone

public Object clone()
Clones the Object.

Specified by:
clone in interface ObjectMapping
Overrides:
clone in class Object
Returns:
DiscreteMapping Object.

getMapValue

public Object getMapValue(Object key)
Gets Value for Specified Key.

Parameters:
key - String Key.
Returns:
Object.

putMapValue

public void putMapValue(Object key,
                        Object value)
Puts New Key/Value in Map.

Parameters:
key - Key Object.
value - Value Object.

getLastKeyModified

public Object getLastKeyModified()
Gets the Last Modified Key.

Returns:
Key Object.

putAll

public void putAll(Map<Object,Object> map)
Adds All Members of Specified Map.

Parameters:
map - Map.

getAll

public Map getAll()
gets all map values


getRangeClass

public Class getRangeClass()
Gets the Range Class. Required by the ObjectMapping interface.

Specified by:
getRangeClass in interface ObjectMapping
Returns:
Class object.

getAcceptedDataClasses

public Class[] getAcceptedDataClasses()
Gets Accepted Data Classes. Required by the ObjectMapping interface.

Specified by:
getAcceptedDataClasses in interface ObjectMapping
Returns:
ArrayList of Class objects.

getControllingAttributeName

public String getControllingAttributeName()
Gets the Name of the Controlling Attribute. Required by the ObjectMapping interface.

Specified by:
getControllingAttributeName in interface ObjectMapping
Returns:
Attribue Name.

setControllingAttributeName

public void setControllingAttributeName(String attrName,
                                        CyNetwork n,
                                        boolean preserveMapping)
Call whenever the controlling attribute changes. If preserveMapping is true, all the currently stored mappings are unchanged; otherwise all the mappings are cleared. In either case, this method calls getUI(javax.swing.JDialog, cytoscape.CyNetwork) to rebuild the UI for this mapping, which in turn calls loadKeys to load the current data values for the new attribute.

Called by event handler from AbstractCalculator AbstractCalculator.

Specified by:
setControllingAttributeName in interface ObjectMapping
Parameters:
attrName - The name of the new attribute to map to

applyProperties

public void applyProperties(Properties props,
                            String baseKey,
                            ValueParser parser)
Customizes this object by applying mapping defintions described by the supplied Properties argument. Required by the ObjectMapping interface.

Specified by:
applyProperties in interface ObjectMapping
Parameters:
props - Properties Object.
baseKey - Base Key for finding properties.
parser - ValueParser Object.

getProperties

public Properties getProperties(String baseKey)
Returns a Properties object with entries suitable for customizing this object via the applyProperties method. Required by the ObjectMapping interface.

Specified by:
getProperties in interface ObjectMapping
Parameters:
baseKey - Base Key for creating properties.
Returns:
Properties Object.

calculateRangeValue

public Object calculateRangeValue(Map attrBundle)
Calculates the Range Value. Required by the ObjectMapping interface.

Specified by:
calculateRangeValue in interface ObjectMapping
Parameters:
attrBundle - A Bundle of Attributes.
Returns:
Mapping object.

getUI

public JPanel getUI(JDialog parent,
                    CyNetwork network)
Gets the UI Object Associated with the Mapper. Required by the ObjectMapping interface.

Specified by:
getUI in interface ObjectMapping
Parameters:
parent - Parent Dialog.
network - CyNetwork.
Returns:
JPanel Object.

getLegend

@Deprecated
public JPanel getLegend(String visualAttr,
                                   byte b)
Deprecated. Use getLegend(VisualPropertyType) instead. Gone 5/2008.

Returns a JPanel containing a legend for this mapping.

Specified by:
getLegend in interface ObjectMapping
Parameters:
visualAttr - The name of the visual attribute using this mapping.
Returns:
JPanel Object.

getLegend

public JPanel getLegend(VisualPropertyType vpt)
DOCUMENT ME!

Specified by:
getLegend in interface ObjectMapping
Parameters:
vpt - DOCUMENT ME!
Returns:
DOCUMENT ME!

www.cytoscape.org