org.ascape.util.vis
Class DrawFeature

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

public abstract class DrawFeature
extends java.lang.Object
implements PlatformDrawFeature, java.io.Serializable

An class providing a drawing method for a given object. Special Note: We have moved this clas temporarily to .model to fix a dependency issue. This will be adressed in a better way soon. A DrawFeature is just some interpretation of an object's state as a paintable figure. Provides the abstract capability to nest features. At the moment, this is really only used to provide a way to set a color and draw a feature with the same draw sources, and is intended to support user customization. This will be fleshed out in the future as user customization becomes more important, but isn't a very important feature at the moment. For now, you would typically just set a color and draw a figure within the same draw feature.

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

Field Summary
protected  java.lang.String name
          The user mnemonic name for this feature.
protected  DrawFeature nestedFeature
          A nested feature.
 
Constructor Summary
DrawFeature()
          Constructs the feature.
DrawFeature(DrawFeature nestedFeature)
          Constructs the feature with a nested feature.
DrawFeature(java.lang.String name)
          Constructs the feature with the provided name.
DrawFeature(java.lang.String name, DrawFeature nestedFeature)
          Constructs the feature with a name and nested feature.
 
Method Summary
abstract  void draw(java.awt.Graphics g, java.lang.Object object, int width, int height)
          Draws a graphic interpretation of the object into the supplied graphics port, (typically) within the supplied dimensions.
 java.lang.String getName()
          Returns the user relevant name of this feature.
 DrawFeature getNestedFeature()
          Returns the feature nested inside this one.
 void setName(java.lang.String name)
          Sets the user relevant name for this feature.
 void setNestedFeature(DrawFeature nestedFeature)
          Sets the feature nested inside of this one.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

nestedFeature

protected DrawFeature nestedFeature
A nested feature.


name

protected java.lang.String name
The user mnemonic name for this feature.

Constructor Detail

DrawFeature

public DrawFeature()
Constructs the feature.


DrawFeature

public DrawFeature(java.lang.String name)
Constructs the feature with the provided name.

Parameters:
name - a name for this draw feature

DrawFeature

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

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

DrawFeature

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

Parameters:
nestedFeature - the feature to nest within this feature
Method Detail

getNestedFeature

public DrawFeature getNestedFeature()
Returns the feature nested inside this one.


setNestedFeature

public void setNestedFeature(DrawFeature nestedFeature)
Sets the feature nested inside of this one.

Parameters:
nestedFeature - the feature to nest

draw

public abstract void draw(java.awt.Graphics g,
                          java.lang.Object object,
                          int width,
                          int height)
Draws a graphic interpretation 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.

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

getName

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

Specified by:
getName in interface HasName

setName

public void setName(java.lang.String name)
Sets the user relevant name for this feature. (Typically, it is quicker and more simple to override the getName method, since you will be creating a subclass anyway.)

Parameters:
name - the user


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