sm
Class SMNamedTag

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

public class SMNamedTag
extends SMExtensionalTag

A SMNamedTag tag is a SMVolatileTag. A SMNamedTag tag is a set of shapes having the same label.

Author:
Caroline Appert

Constructor Summary
SMNamedTag(java.lang.String n, SMCanvas c)
          Constructs a SMNamedTag tag.
 
Method Summary
 java.lang.String getName()
          Returns the name of this tag.
static SMNamedTag getTag(java.lang.String t)
          Returns the tag object given its name.
static java.util.LinkedList getTaggedShapes(java.lang.String t)
          Returns the list of shapes that have a given tag.
 boolean hasNext()
          Tests if there is other shapes tagged by this tag.
 SMShape nextShape()
           
 void reset()
          Inits the tag's iterator.
 boolean setName(java.lang.String n)
          Sets the name of this tag.
 
Methods inherited from class sm.SMExtensionalTag
added, addTo, removed, removeFrom
 
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

SMNamedTag

public SMNamedTag(java.lang.String n,
                  SMCanvas c)
Constructs a SMNamedTag tag. Note that if a tag with the same name already exists, this new tag is not registered with the canvas, and the results are undefined. Use the method SMCanvas#newTag to create tags to avoid this problem. This constructor is left public and does not throw an exception in order to make it possible to create anonymous classes derived from Tag.

Parameters:
n - The name of the tag
Method Detail

getTaggedShapes

public static java.util.LinkedList getTaggedShapes(java.lang.String t)
Returns the list of shapes that have a given tag.

Parameters:
t - The name of the tag
Returns:
The list of shapes.

getTag

public static SMNamedTag getTag(java.lang.String t)
Returns the tag object given its name.

Parameters:
t - The name of the tag
Returns:
The tag, or null if no such tag exists.

reset

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

Specified by:
reset in class SMExtensionalTag

hasNext

public 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 SMExtensionalTag

getName

public java.lang.String getName()
Returns the name of this tag.

Returns:
Returns the name of this tag.

setName

public boolean setName(java.lang.String n)
Sets the name of this tag. The name can only be changed if no existing tag by this name already exists.

Parameters:
n - The name.
Returns:
Returns true if the name could be change, false otherwise.

nextShape

public SMShape nextShape()
Specified by:
nextShape in class SMExtensionalTag