sm
Class SMExtensionalTag

java.lang.Object
  extended bysm.SMTag
      extended bysm.SMExtensionalTag
All Implemented Interfaces:
InteractiveObject, java.util.Iterator
Direct Known Subclasses:
SMNamedTag

public abstract class SMExtensionalTag
extends SMTag

A SMExtensionalTag tag is a tag that can be explicitely attached to and detached from a shape, i.e. a shape can be added to or removed to the tag's collection.

Author:
Caroline Appert

Constructor Summary
SMExtensionalTag(SMCanvas c)
          Builds a SMTag that can tag the shapes displayed on the canvas c.
 
Method Summary
 void added(SMShape s)
          Method called when this tag is added to an SMShape.
 SMExtensionalTag addTo(SMShape s)
          Adds the shape s to the collection containing all the shapes that have this tag.
abstract  boolean hasNext()
          Tests if there is other shapes tagged by this tag.
abstract  SMShape nextShape()
           
 void removed(SMShape s)
          Method called when this tag is removed from an SMShape.
 SMExtensionalTag removeFrom(SMShape s)
          Removes the shape s from the collection containing all the shapes that have this tag.
abstract  void reset()
          Inits the tag's iterator.
 
Methods inherited from class sm.SMTag
above, aboveAll, action, action, addGhost, addTag, addTag, and, and, attachSM, below, belowAll, contains, contains, contains, contains, containsPoint, containsPoint, detachSM, firstShape, getAntialiasedShapes, getCanvas, getCollection, getFilledShapes, getFirstAntialiasedShape, getFirstFilledShape, getFirstHavingTag, getFirstOutlinedShape, getGlobalBoundingBox, getOutlinedShapes, hasTag, hasTag, intersects, intersects, isAntialiased, isDrawable, isFilled, isOnOutline, isOutlined, isPickable, next, or, or, remove, removeGhost, removeTag, removeTag, rotateBy, rotateTo, scaleBy, scaleBy, scaleTo, scaleTo, setAntialiased, setClip, setDrawable, setFilled, setFillPaint, setOutlined, setOutlinePaint, setParent, setPickable, setReferencePoint, setShape, setStroke, setTransparency, size, tagsShape, translateBy, translateTo
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SMExtensionalTag

public SMExtensionalTag(SMCanvas c)
Builds a SMTag that can tag the shapes displayed on the canvas c. This tag can be explicitely removed to any shape displayed on c.

Parameters:
c - The canvas.
Method Detail

reset

public abstract void reset()
Description copied from class: SMTag
Inits the tag's iterator.

Specified by:
reset in class SMTag

hasNext

public abstract boolean hasNext()
Description copied from class: SMTag
Tests if there is other shapes tagged by this tag.

Specified by:
hasNext in interface java.util.Iterator
Specified by:
hasNext in class SMTag
Returns:
Returns true if there is other shapes tagged by this tag, false otherwise.
See Also:
Iterator.hasNext()

nextShape

public abstract SMShape nextShape()
Specified by:
nextShape in class SMTag

added

public void added(SMShape s)
Method called when this tag is added to an SMShape. By default, this method does nothing. Redefine it in a subclass to specify side effects, such as changing the color of the attached SMShape.

Parameters:
s - The SMShape

removed

public void removed(SMShape s)
Method called when this tag is removed from an SMShape. By default, this method does nothing. Redefine it in a subclass to specify side effects, such as changing the color of the attached SMShape.

Parameters:
s - The SMShape

addTo

public SMExtensionalTag addTo(SMShape s)
Adds the shape s to the collection containing all the shapes that have this tag. This method calls begin(SMShape), which can be redefined in subclasses to specify side effects, such as changing the color of the attached object when the tag is added.

Parameters:
s - The SMShape
Returns:
Returns this tag
See Also:
added(SMShape)

removeFrom

public SMExtensionalTag removeFrom(SMShape s)
Removes the shape s from the collection containing all the shapes that have this tag. This method calls end(SMShape), which can be redefined in subclasses to specify side effects, such as changing the color of the attached object when the tag is removed.

Parameters:
s - The SMShape
Returns:
Returns this tag
See Also:
removed(SMShape)