org.ascape.util.vis
Class DrawColorFeature

java.lang.Object
  extended by org.ascape.util.vis.DrawFeature
      extended by org.ascape.util.vis.DrawColorFeature
All Implemented Interfaces:
java.io.Serializable, HasName, ColorFeature, PlatformDrawFeature
Direct Known Subclasses:
FillCellFeature

public class DrawColorFeature
extends DrawFeature
implements ColorFeature

A class using a color feature to determine the color to use to draw a feature.

Since:
1.0
Version:
1.2
Author:
Miles Parker
See Also:
Serialized Form

Field Summary
protected  ColorFeature colorFeature
          The color feature to use for drawing this feature.
 
Fields inherited from class org.ascape.util.vis.DrawFeature
name, nestedFeature
 
Constructor Summary
DrawColorFeature()
          Constructs a DrawColorFeature.
DrawColorFeature(DrawFeature nestedFeature)
          Constructs a DrawColorFeature with a nested feature.
DrawColorFeature(java.lang.String name)
          Constructs the feature with the supplied name.
DrawColorFeature(java.lang.String name, ColorFeature colorFeature)
          Constructs the feature with a name and color feature.
DrawColorFeature(java.lang.String name, DrawFeature nestedFeature)
          Constructs the feature with a name and nested feature.
 
Method Summary
 void draw(java.awt.Graphics g, java.lang.Object object, int width, int height)
          Draws a graphic interpreation of the object into the supplied graphics port, (typically) within the supplied dimensions.
 java.awt.Color getColor(java.lang.Object object)
          Returns the color feature's color interpretation of the object.
 ColorFeature getColorFeature()
          Returns the color feature this object is using to interpret the object's color.
 java.lang.String getName()
          Returns the user relevant name of this feature.
 void setColorFeature(ColorFeature colorFeature)
          Sets the color feature this object uses to interpret the object's color.
 
Methods inherited from class org.ascape.util.vis.DrawFeature
getNestedFeature, setName, setNestedFeature
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

colorFeature

protected ColorFeature colorFeature
The color feature to use for drawing this feature. By default, black.

Constructor Detail

DrawColorFeature

public DrawColorFeature()
Constructs a DrawColorFeature.


DrawColorFeature

public DrawColorFeature(java.lang.String name)
Constructs the feature with the supplied name.

Parameters:
name - the name of this draw feature

DrawColorFeature

public DrawColorFeature(java.lang.String name,
                        ColorFeature colorFeature)
Constructs the feature with a name and color feature.

Parameters:
name - the name of this draw feature

DrawColorFeature

public DrawColorFeature(java.lang.String name,
                        DrawFeature nestedFeature)
Constructs the feature with a name and nested feature.

Parameters:
name - the name of this draw feature
nestedFeature - the feature to nest within this feature

DrawColorFeature

public DrawColorFeature(DrawFeature nestedFeature)
Constructs a DrawColorFeature with a nested feature.

Parameters:
nestedFeature - the feature to nest
Method Detail

draw

public void draw(java.awt.Graphics g,
                 java.lang.Object object,
                 int width,
                 int height)
Draws a graphic interpreation of the object into the supplied graphics port, (typically) within the supplied dimensions. Views which use this class are responsible for translating the graphics so that the object is drawn at the approriate location. Please let us know if you think you need a directly addressed alternative.

Specified by:
draw in class DrawFeature
Parameters:
g - the Graphics context to draw into
object - the object to interpret for drawing
width - the width of the space that should be drawn into
height - the height of the space that should be drawn into

getColor

public final java.awt.Color getColor(java.lang.Object object)
Returns the color feature's color interpretation of the object.

Specified by:
getColor in interface ColorFeature
Parameters:
object - the object to interpret color for

getColorFeature

public ColorFeature getColorFeature()
Returns the color feature this object is using to interpret the object's color.


setColorFeature

public void setColorFeature(ColorFeature colorFeature)
Sets the color feature this object uses to interpret the object's color.

Parameters:
colorFeature - the feature to use for coloring

getName

public java.lang.String getName()
Returns the user relevant name of this feature. "Unnamed", the name of the nested feature, or the name of the color feature, by default. Override or set name to provide a name.

Specified by:
getName in interface HasName
Overrides:
getName in class DrawFeature


Copyright © 1998-2008 The Brookings Institution, NuTech Solutions, Metascape, LLC All Rights Reserved.