|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.xml.sax.HandlerBase | +--org.concord.biologica.engine.EngineObject | +--org.concord.biologica.engine.SpeciesImageRow
This class represents a row of a SpeciesImage. Specifically, this object maintains an understanding of what species characteristics are valid for this row of a SpeciesImage.
An object of this class will generate the following property change events:
EngineProp.CHARACTERISTIC_ADDED_TO_ROW
,
EngineProp.CHARACTERISTIC_REMOVED_FROM_ROW
,
EngineProp.DELETED
,
EngineProp.ID
,
EngineProp.LOCKED_STATE
,
EngineProp.NAME
,
org.concord.biologica.engine.EngineProp#ROW_GENDER
,
EngineProp.XXSMALL_HOTSPOT
,
EngineProp.XSMALL_HOTSPOT
,
EngineProp.SMALL_HOTSPOT
,
EngineProp.MEDIUM_HOTSPOT
,
EngineProp.LARGE_HOTSPOT
,
EngineProp.XLARGE_HOTSPOT
,
PropertyChangeListener
, Serialized FormFields inherited from class org.concord.biologica.engine.EngineObject |
AUTOMATIC_LOCKED, AUTOMATIC_LOCKED_STRING, changes, deleted, FALSE, id, lockedState, MANUAL_AND_AUTOMATIC_LOCKED, MANUAL_AND_AUTOMATIC_LOCKED_STRING, MANUAL_LOCKED, MANUAL_LOCKED_STRING, NULL_ID, TRUE, UNLOCKED, UNLOCKED_STRING, xmlElementContext |
Constructor Summary | |
SpeciesImageRow(SpeciesImage aSpeciesImage,
java.lang.String aName)
Creates a new species image row. |
|
SpeciesImageRow(SpeciesImage aSpeciesImage,
java.lang.String anElementName,
int anElementID,
com.sun.xml.parser.Parser anXMLParser,
ImportContext importContext)
Create a new SpeciesImageRow and start handling XML parsing events to set the properties of this object. |
Method Summary | |
void |
addCharacteristic(Characteristic aCharacteristic)
Adds a characteristic to the row. |
void |
characters(char[] ch,
int start,
int length)
Receive notification of character data. |
void |
delete()
Delete this object, notifying parent objects and deleting any child objects. |
void |
delete(boolean notifyChange)
|
void |
endElement(java.lang.String anElementName)
Handle notification that the parsing of the given element has ended. |
java.util.Enumeration |
getCharacteristics()
Returns an enumeration over the vector of characteristics in this row. |
int |
getGender()
Return the gender of images in this row, which will be one of Species.FEMALE_AND_MALE, Species.FEMALE_ONLY or Species.MALE_ONLY. |
java.lang.String |
getGenderAsString()
Return the gender of images in this row, which will be one of Species.FEMALE_AND_MALE_STRING, Species.FEMALE_ONLY_STRING or Species.MALE_ONLY_STRING. |
java.awt.Point |
getHotspot(int imageSize)
Get the given hotspot location. |
java.awt.Point |
getLargeHotspot()
Get the large hotspot location. |
java.awt.Point |
getMediumHotspot()
Get the medium hotspot location. |
java.lang.String |
getName()
Return the name of this species image row. |
int |
getNumberOfCharacteristics()
Return the number of characteristics in this row. |
java.awt.Point |
getSmallHotspot()
Get the small hotspot location. |
Species |
getSpecies()
Return the Species of this object. |
SpeciesImage |
getSpeciesImage()
Return the SpeciesImage of this object. |
World |
getWorld()
Get the world containing this object. |
java.awt.Point |
getXLargeHotspot()
Get the xLarge hotspot location. |
java.awt.Point |
getXSmallHotspot()
Get the xSmall hotspot location. |
java.awt.Point |
getXXSmallHotspot()
Get the xxSmall hotspot location. |
void |
ignorableWhitespace(char[] ch,
int start,
int length)
Receive notification of ignorable white space character data. |
boolean |
isOnHotspot(int organismImageSize,
int x,
int y)
Return whether the given coordinates are on the hotspot for this image row |
void |
propertyChange(java.beans.PropertyChangeEvent event)
Handle property change events |
boolean |
removeCharacteristic(Characteristic aCharacteristic)
Removes a characteristic from the row. |
void |
replaceCharacteristic(Characteristic oldCharacteristic,
Characteristic newCharacteristic)
Replace the given old Characteristic with the given new Characteristic. |
void |
setGender(int aGender)
Set the gender of the images in this row. |
void |
setGenderAsString(java.lang.String aGenderString)
Set the gender of the images in this row as a string. |
void |
setLargeHotspot(java.awt.Point aHotspot)
Set the large hotspot location. |
void |
setMediumHotspot(java.awt.Point aHotspot)
Set the medium hotspot location. |
void |
setName(java.lang.String aName)
Set the name of this species image row. |
void |
setSmallHotspot(java.awt.Point aHotspot)
Set the small hotspot location. |
void |
setXLargeHotspot(java.awt.Point aHotspot)
Set the xLarge hotspot location. |
void |
setXSmallHotspot(java.awt.Point aHotspot)
Set the xSmall hotspot location. |
void |
setXXSmallHotspot(java.awt.Point aHotspot)
Set the xxSmall hotspot location. |
void |
startElement(java.lang.String anElementName,
org.xml.sax.AttributeList amap)
Handle notification that the parser has hit the start of a new element with the given name and attributes. |
java.lang.String |
toString()
Return a string representation of this object. |
void |
writeToStream(java.io.PrintWriter stream)
Writes this object to the given stream in XML format. |
Methods inherited from class org.concord.biologica.engine.EngineObject |
addPropertyChangeListener, getID, getLockedState, getLockedStateAsString, isAutomaticLocked, isDeleted, isLocked, isManualLocked, notifySelected, release, removePropertyChangeListener, setAutomaticLocked, setID, setLockedState, setLockedStateAsString, setManualLocked |
Methods inherited from class org.xml.sax.HandlerBase |
endDocument, error, fatalError, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, startDocument, unparsedEntityDecl, warning |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public SpeciesImageRow(SpeciesImage aSpeciesImage, java.lang.String aName)
aSpeciesImage
- SpeciesImage - the species image containing this object, may not be nullaName
- String - the species image row name, may not be nulljava.lang.IllegalArgumentException
- - input argument(s) illegalpublic SpeciesImageRow(SpeciesImage aSpeciesImage, java.lang.String anElementName, int anElementID, com.sun.xml.parser.Parser anXMLParser, ImportContext importContext)
aSpeciesImage
- SpeciesImage - the enclosing species image for this new species image rowanElementName
- String - the element nameanElementID
- int - the element idanXMLParser
- com.sun.xml.parser.Parser - the element parserimportContext
- ImportContext - import context for mapping ids from file to this worldjava.lang.IllegalArgumentException
- - input arguments illegalMethod Detail |
public void startElement(java.lang.String anElementName, org.xml.sax.AttributeList amap) throws org.xml.sax.SAXException
For internal elements (elements that are non-EngineObject instance variables of this object), call xmlElementContext.startElement() and xmlElementContext will receive the remaining element notifications. For external elements (elements that are EngineObject instance variables of this object), create an object of the appropriate class and that object will receive the remaining element notifications.
startElement
in class org.xml.sax.HandlerBase
anElementName
- String - name of elementamap
- AttributeList - an attribute listpublic void characters(char[] ch, int start, int length) throws org.xml.sax.SAXException
characters
in class org.xml.sax.HandlerBase
ch
- char[] - charactersstart
- int - start of stringlength
- int - length of stringpublic void ignorableWhitespace(char[] ch, int start, int length) throws org.xml.sax.SAXException
ignorableWhitespace
in class org.xml.sax.HandlerBase
ch
- char[] - charactersstart
- int - start of stringlength
- int - length of stringpublic void endElement(java.lang.String anElementName) throws org.xml.sax.SAXException
endElement
in class org.xml.sax.HandlerBase
anElementName
- String - the element namepublic void delete()
When this method is successful, a property change event is generated for the property named EngineProp.DELETED.
delete
in class EngineObject
public void delete(boolean notifyChange)
public java.lang.String toString()
toString
in class EngineObject
public SpeciesImage getSpeciesImage()
public Species getSpecies()
public World getWorld()
getWorld
in class EngineObject
public java.lang.String getName()
public void setName(java.lang.String aName)
When this method is successful, a property change event is fired for the property named EngineProp.NAME.
aName
- String - the new name of this species image row, may not be nulljava.lang.IllegalArgumentException
- - input argument illegalObjectDeletedException
- - object is deleted and cannot be modifiedObjectLockedException
- - object is locked and cannot be modifiedpublic int getGender()
Species.FEMALE_AND_MALE
,
Species.FEMALE_ONLY
,
Species.MALE_ONLY
public java.lang.String getGenderAsString()
Species.FEMALE_AND_MALE_STRING
,
Species.FEMALE_ONLY_STRING
,
Species.MALE_ONLY_STRING
public void setGender(int aGender)
The new gender must be one of Species.FEMALE_AND_MALE, Species.FEMALE_ONLY or Species.MALE_ONLY.
When this method is successful, a property change event is fired for the property named EngineProp.ROW_GENDER.
aGender
- int - the new gender of this species image rowjava.lang.IllegalArgumentException
- - input argument illegalObjectDeletedException
- - object is deleted and cannot be modifiedObjectLockedException
- - object is locked and cannot be modifiedSpecies.FEMALE_AND_MALE
,
Species.FEMALE_ONLY
,
Species.MALE_ONLY
public void setGenderAsString(java.lang.String aGenderString)
The new gender must be one of Species.FEMALE_AND_MALE_STRING, Species.FEMALE_ONLY_STRING or Species.MALE_ONLY_STRING.
When this method is successful, a property change event is fired for the property named EngineProp.ROW_GENDER.
aGenderString
- String - the new gender of this species image row as a stringjava.lang.IllegalArgumentException
- - input argument illegalObjectDeletedException
- - object is deleted and cannot be modifiedObjectLockedException
- - object is locked and cannot be modifiedSpecies.FEMALE_AND_MALE
,
Species.FEMALE_ONLY
,
Species.MALE_ONLY
public java.util.Enumeration getCharacteristics()
public int getNumberOfCharacteristics()
public void addCharacteristic(Characteristic aCharacteristic)
aCharacteristic
- Characteristic - a new characteristic, may not be nulljava.lang.IllegalArgumentException
- - input argument illegalpublic boolean removeCharacteristic(Characteristic aCharacteristic)
aCharacteristic
- Characteristic - a characteristic, may not be nulljava.lang.IllegalArgumentException
- - input argument illegalpublic void replaceCharacteristic(Characteristic oldCharacteristic, Characteristic newCharacteristic)
If the oldCharacteristic is null or not found, then we just add the newCharacteristic on to the end of the list of characteristics.
If the newCharacteristic is null, then we just remove the oldCharacteristic.
If both the oldCharacteristic and the newCharacteristic are null or not found, do nothing.
Characteristic
- oldCharacteristic - characteristic to remove, may be nullCharacteristic
- newCharacteristic - characteristic to add, may be nullpublic java.awt.Point getHotspot(int imageSize)
imageSize
- int - image sizepublic java.awt.Point getXXSmallHotspot()
public void setXXSmallHotspot(java.awt.Point aHotspot)
aHotspot
- Point - a new hotspot location, may not be nulljava.lang.IllegalArgumentException
- - input argument(s) illegalpublic java.awt.Point getXSmallHotspot()
public void setXSmallHotspot(java.awt.Point aHotspot)
aHotspot
- Point - a new hotspot location, may not be nulljava.lang.IllegalArgumentException
- - input argument(s) illegalpublic java.awt.Point getSmallHotspot()
public void setSmallHotspot(java.awt.Point aHotspot)
aHotspot
- Point - a new hotspot location, may not be nulljava.lang.IllegalArgumentException
- - input argument(s) illegalpublic java.awt.Point getMediumHotspot()
public void setMediumHotspot(java.awt.Point aHotspot)
aHotspot
- Point - a new hotspot location, may not be nulljava.lang.IllegalArgumentException
- - input argument(s) illegalpublic java.awt.Point getLargeHotspot()
public void setLargeHotspot(java.awt.Point aHotspot)
aHotspot
- Point - a new hotspot location, may not be nulljava.lang.IllegalArgumentException
- - input argument(s) illegalpublic java.awt.Point getXLargeHotspot()
public void setXLargeHotspot(java.awt.Point aHotspot)
aHotspot
- Point - a new hotspot location, may not be nulljava.lang.IllegalArgumentException
- - input argument(s) illegalpublic boolean isOnHotspot(int organismImageSize, int x, int y)
organismImageSize
- int - organism image sizex
- int - x coordinatey
- int - y coordinatepublic void propertyChange(java.beans.PropertyChangeEvent event)
propertyChange
in interface java.beans.PropertyChangeListener
event
- PropertyChangeEvent - the property change eventpublic void writeToStream(java.io.PrintWriter stream) throws java.io.IOException
We could supply a default implementation that knows how to write the id value. But that convenience is not chosen because it's never correct to use just this implementation of these methods, so I'd rather have a compilation fail if a derived class fails to implement this method.
The inverse of this method is a constructor that takes a org.xml.sax.Parser argument and other arguments.
writeToStream
in class EngineObject
stream
- PrintWriter - print streamjava.lang.IllegalArgumentException
- - input arguments illegaljava.io.IOException
- - an IO error occurred in java libraries
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |