com.rolemodelsoft.drawlet.shapes
Class FilledShape

java.lang.Object
  |
  +--com.rolemodelsoft.drawlet.basics.AbstractPaintable
        |
        +--com.rolemodelsoft.drawlet.basics.AbstractFigure
              |
              +--com.rolemodelsoft.drawlet.shapes.AbstractShape
                    |
                    +--com.rolemodelsoft.drawlet.shapes.FilledShape
Direct Known Subclasses:
AbstractRectangleShape, PolygonShape

public abstract class FilledShape
extends AbstractShape

This provides basic default functionality for Figures that draw shapes which may be opaque. It provides most of its functionality based on its getBounds(), and forces concrete subclasses to define, at a minimum: paintStrokes(Graphics); paintFilled(Graphics); getBounds(); basicTranslate(int,int); basicReshape(int,int,int,int);

See Also:
Serialized Form

Field Summary
protected  java.awt.Color fillColor
          The fill color for drawing the figure is cached here.
protected  java.awt.Color lineColor
          The line color for drawing the figure is cached here.
 
Fields inherited from class com.rolemodelsoft.drawlet.basics.AbstractFigure
listeners, locationListeners
 
Constructor Summary
FilledShape()
           
 
Method Summary
protected  void basicReshape(int x, int y, int width, int height)
          Reshapes the receiver to the specified bounding box.
protected  void basicTranslate(int x, int y)
          Moves the receiver in the x and y direction.
protected  java.awt.Color defaultFillColor()
          Answer the default/initial value for fillColor
protected  java.awt.Color defaultLineColor()
          Answer the default/initial value for lineColor
abstract  java.awt.Rectangle getBounds()
          Returns the current bounds of the receiver.
 java.awt.Color getFillColor()
          Answer the Color to use when filling the shape.
 java.awt.Color getLineColor()
          Answer the Color to use when drawing lines.
 DrawingStyle getStyle()
          Answer the DrawingStyle which defines how to paint the figure.
 boolean isOpaque()
          Answer whether the receiver fills in its inside (obscuring things underneath) or not.
 boolean isStroked()
          Answer whether the receiver draws its lines (obscuring things underneath) or not.
 void paint(java.awt.Graphics g)
          Paints the figure.
 void paintFilled(java.awt.Graphics g)
          Paint the shape, filling all contained area
 void paintStrokes(java.awt.Graphics g)
          Paint the outline of the shape
 void setFillColor(java.awt.Color color)
          Set the Color to use when filling the shape.
 void setLineColor(java.awt.Color color)
          Set the Color to use when drawing lines.
 void setStyle(DrawingStyle style)
          Set the DrawingStyle defining how to paint the figure.
 
Methods inherited from class com.rolemodelsoft.drawlet.shapes.AbstractShape
basicResize, getHandles, resetBoundsCache, resetSizeCache, reshapedPolygon, reshapedPolygon, setBounds, setSize
 
Methods inherited from class com.rolemodelsoft.drawlet.basics.AbstractFigure
addPropertyChangeListener, addRelatedLocationListener, basicMove, changedLocation, changedShape, changedSize, contains, contains, contains, deleteLocationListeners, disconnect, duplicate, duplicateIn, editTool, estimatedDuplicateSize, figureFromLocator, fireLocationChange, firePropertyChange, firePropertyChange, fireRelationChange, fireShapeChange, fireSizeChange, getLocation, getLocator, intersects, intersects, isObsolete, isWithin, isWithin, locatorAt, move, move, postDuplicate, relatedLocationListeners, removePropertyChangeListener, removeRelatedLocationListener, requestConnection, resetLocationCache, setSize, translate
 
Methods inherited from class com.rolemodelsoft.drawlet.basics.AbstractPaintable
getBottom, getHeight, getLeft, getRight, getSize, getTop, getWidth
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

lineColor

protected java.awt.Color lineColor
The line color for drawing the figure is cached here.

fillColor

protected java.awt.Color fillColor
The fill color for drawing the figure is cached here.
Constructor Detail

FilledShape

public FilledShape()
Method Detail

basicReshape

protected void basicReshape(int x,
                            int y,
                            int width,
                            int height)
Reshapes the receiver to the specified bounding box. Subclasses should probably provide synchronized versions if they're modifying attributes of the receiver.
Overrides:
basicReshape in class AbstractShape
Parameters:
x - the x coordinate
y - the y coordinate
width - the width of the figure
height - the height of the figure

basicTranslate

protected void basicTranslate(int x,
                              int y)
Moves the receiver in the x and y direction.
Overrides:
basicTranslate in class AbstractFigure
Parameters:
x - amount to move in the x direction
y - amount to move in the y direction

defaultFillColor

protected java.awt.Color defaultFillColor()
Answer the default/initial value for fillColor
Returns:
the default/initial value for fillColor

defaultLineColor

protected java.awt.Color defaultLineColor()
Answer the default/initial value for lineColor
Returns:
the default/initial value for lineColor

getBounds

public abstract java.awt.Rectangle getBounds()
Returns the current bounds of the receiver.
Overrides:
getBounds in class AbstractFigure
Returns:
a Rectangle representing the current bounds of the receiver.

getFillColor

public java.awt.Color getFillColor()
Answer the Color to use when filling the shape.
Returns:
the Color to use when filling the shape

getLineColor

public java.awt.Color getLineColor()
Answer the Color to use when drawing lines.
Returns:
the Color to use when drawing lines

getStyle

public DrawingStyle getStyle()
Answer the DrawingStyle which defines how to paint the figure.
Overrides:
getStyle in class AbstractFigure
Returns:
the DrawingStyle which defines how to paint the figure.

isOpaque

public boolean isOpaque()
Answer whether the receiver fills in its inside (obscuring things underneath) or not.
Returns:
boolean value of true if the receiver fills in its inside; false otherwise.

isStroked

public boolean isStroked()
Answer whether the receiver draws its lines (obscuring things underneath) or not.
Returns:
boolean value of true if the receiver draws its lines; false otherwise.

paint

public void paint(java.awt.Graphics g)
Paints the figure.
Overrides:
paint in class AbstractFigure
Parameters:
g - the specified Graphics window

paintFilled

public void paintFilled(java.awt.Graphics g)
Paint the shape, filling all contained area
Parameters:
g - the specified Graphics window

paintStrokes

public void paintStrokes(java.awt.Graphics g)
Paint the outline of the shape
Parameters:
g - the specified Graphics window

setFillColor

public void setFillColor(java.awt.Color color)
Set the Color to use when filling the shape.
Parameters:
color - the color

setLineColor

public void setLineColor(java.awt.Color color)
Set the Color to use when drawing lines.
Parameters:
color - the color

setStyle

public void setStyle(DrawingStyle style)
Set the DrawingStyle defining how to paint the figure.
Overrides:
setStyle in class AbstractFigure
Parameters:
style - the specified DrawingStyle.