simtools.shapes
Class CompoundShape

java.lang.Object
  extended by simtools.shapes.AbstractShape
      extended by simtools.shapes.CompoundShape
All Implemented Interfaces:
java.awt.Shape, java.io.Serializable, java.lang.Cloneable, Resizable, ShapeListener, NamedProperties

public class CompoundShape
extends AbstractShape
implements java.io.Serializable, java.lang.Cloneable, Resizable, ShapeListener

A class to group other shapes into

Version:
1.0 2001
Author:
Claude Cazenave
See Also:
Serialized Form

Nested Class Summary
 class CompoundShape.ShapeAndSize
           
 
Nested classes/interfaces inherited from class simtools.shapes.AbstractShape
AbstractShape.AbstractShapePropertiesNames
 
Field Summary
protected  java.util.Vector _shapes
           
 
Fields inherited from class simtools.shapes.AbstractShape
_h, _ox, _oy, _propertyNames, _w, _x, _y, ANTI_ALIASING, currentDialogBox, FONT_NAMES, listeners, REFRESH_PERIOD
 
Constructor Summary
CompoundShape()
          Creates a new shape
 
Method Summary
 void addShape(AbstractShape as)
          Adds a shape into
 void addShapes(java.util.Vector shapes)
          Adds a set of shapes into
protected  AbstractShape cloneShape()
          Performs a copy of the shape
protected  void computeAnchor()
           
protected  void computeBounds()
           
 boolean contains(AbstractShape as)
           
 void draw(java.awt.Graphics2D g)
          Draws the shape
 java.lang.String[] getPropertyNames()
          Get the list of property names
 java.lang.Object getPropertyValue(java.lang.String name)
          Get the value of the property named name
 AbstractShape getShape(int i)
           
 void removeShape(AbstractShape as)
          Removes a shape
 void removeShapes(java.util.Vector shapes)
          Removes a set of shapes
 void resize(int dx, int dy)
          Resizes the shape
 java.util.Vector retainShapes(java.util.Vector shapes)
          Retains only the shapes that are contained in a set of shapes
 void setPropertyValue(java.lang.String name, java.lang.Object value)
          Assigns value to the property named name
 void shapeChanged(AbstractShape shape, java.awt.Rectangle changedArea)
          Listen to our shapes
 int size()
           
 void synchroSizes()
           
 void translate(int dx, int dy)
          Translates the shape
 
Methods inherited from class simtools.shapes.AbstractShape
addListener, contains, contains, contains, contains, getAnchor, getBounds, getBounds2D, getInnerProperties, getMax, getMaxTranslated, getMin, getPathIterator, getPathIterator, intersects, intersects, notifyChange, notifyChange, refresh, removeListener, setAnchor, setAnchor, setProperties, wipeOff
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_shapes

protected java.util.Vector _shapes
Constructor Detail

CompoundShape

public CompoundShape()
Creates a new shape

Method Detail

cloneShape

protected AbstractShape cloneShape()
Performs a copy of the shape

Overrides:
cloneShape in class AbstractShape
Returns:
a copy of the shape

size

public int size()

contains

public boolean contains(AbstractShape as)

getShape

public AbstractShape getShape(int i)

addShape

public void addShape(AbstractShape as)
Adds a shape into


addShapes

public void addShapes(java.util.Vector shapes)
Adds a set of shapes into


removeShape

public void removeShape(AbstractShape as)
Removes a shape


removeShapes

public void removeShapes(java.util.Vector shapes)
Removes a set of shapes


retainShapes

public java.util.Vector retainShapes(java.util.Vector shapes)
Retains only the shapes that are contained in a set of shapes

Returns:
shapes that have been removed

resize

public void resize(int dx,
                   int dy)
Resizes the shape

Specified by:
resize in interface Resizable
Parameters:
dx - value on x axis
dy - value on y axis

translate

public void translate(int dx,
                      int dy)
Translates the shape

Overrides:
translate in class AbstractShape

draw

public void draw(java.awt.Graphics2D g)
Draws the shape

Specified by:
draw in class AbstractShape
Parameters:
g - the graphics context

synchroSizes

public void synchroSizes()

computeBounds

protected void computeBounds()

computeAnchor

protected void computeAnchor()

shapeChanged

public void shapeChanged(AbstractShape shape,
                         java.awt.Rectangle changedArea)
Listen to our shapes

Specified by:
shapeChanged in interface ShapeListener
See Also:
ShapeListener.shapeChanged(simtools.shapes.AbstractShape, java.awt.Rectangle)

getPropertyNames

public java.lang.String[] getPropertyNames()
Description copied from interface: NamedProperties
Get the list of property names

Specified by:
getPropertyNames in interface NamedProperties
Overrides:
getPropertyNames in class AbstractShape

getPropertyValue

public java.lang.Object getPropertyValue(java.lang.String name)
Description copied from class: AbstractShape
Get the value of the property named name

Specified by:
getPropertyValue in interface NamedProperties
Overrides:
getPropertyValue in class AbstractShape
Parameters:
name - the name of the property to get
Returns:
the property value
See Also:
AbstractShape.getPropertyValue(String)

setPropertyValue

public void setPropertyValue(java.lang.String name,
                             java.lang.Object value)
Description copied from class: AbstractShape
Assigns value to the property named name

Specified by:
setPropertyValue in interface NamedProperties
Overrides:
setPropertyValue in class AbstractShape
Parameters:
name - the name of the property to get
value - its new value
See Also:
AbstractShape.setPropertyValue(String, Object)