|
|||||||||
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.OrganismImage
This class represents a portion of the image used to draw an organism. A single OrganismImage maintains a reference to a single SpeciesImage and a reference to a single cell in that SpeciesImage. That single cell is one, probably of many, cells used to draw an organism.
For example, if we have an organism of species dragon and we have a SpeciesImage named "bodies" which contains all the images of bodies used for the dragon species, then an OrganismImage for that organism would contain a reference to the "bodies" SpeciesImage and the row and column integer numbers of the cell that represents the body for that organism. The organism would have multiple OrganismImage objects - the bodies one and others for other parts of the dragaon (head, wings, scales, etc.). An OrganismImage also knows how to draw itself if given a Graphics object and a location. In other words, an organism draws itself by walking through its OrganismImage list asking each OrganismImage to draw itself at the appropriate location. An object of this class will generate the following property change events:
EngineProp.COLUMN_INDEX
,
EngineProp.DELETED
,
EngineProp.ID
,
EngineProp.LOCKED_STATE
,
EngineProp.ROW_INDEX
,
PropertyChangeListener
, Serialized FormField Summary | |
static int |
NO_CELL
Indicates image should not draw anything, as there was no cell in the speciesImage which should be drawn for this organism. |
boolean |
organismImageDirty
|
Fields 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 | |
OrganismImage(Organism anOrganism,
SpeciesImage aSpeciesImage)
Creates a new organism image given an organism and a species image. |
|
OrganismImage(Organism anOrganism,
java.lang.String anElementName,
int anElementID,
com.sun.xml.parser.Parser anXMLParser,
ImportContext importContext)
Create a new organism image and start handling XML parsing events to set the properties of this object. |
Method Summary | |
void |
characters(char[] ch,
int start,
int length)
Receive notification of character data. |
void |
clearDirtyBit()
|
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. |
int |
getColumnIndex()
Return the column index of this organism image in its corresponding species image. |
int |
getImageType()
Get the image type for this organism image. |
Organism |
getOrganism()
Return the organism of this object. |
int |
getRowIndex()
Return the row index of this organism image in its corresponding species image. |
SpeciesImage |
getSpeciesImage()
Return the species image of this object. |
World |
getWorld()
Get the world containing this object. |
void |
ignorableWhitespace(char[] ch,
int start,
int length)
Receive notification of ignorable white space character data. |
void |
propertyChange(java.beans.PropertyChangeEvent event)
Handle property change events. |
void |
setColumnAndRowIndices(int aColumnIndex,
int aRowIndex)
Sets the column and row indices of this organism image. |
void |
setColumnIndex(int aColumnIndex)
Sets the column index of this organism image. |
void |
setRowIndex(int aRowIndex)
Sets the row index of this organism image. |
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 |
Field Detail |
public static final int NO_CELL
public boolean organismImageDirty
Constructor Detail |
public OrganismImage(Organism anOrganism, SpeciesImage aSpeciesImage)
anOrganism
- Organism - the organism containing this image, may not be nullaSpeciesImage
- SpeciesImage - the species image corresponding to this objectjava.lang.IllegalArgumentException
- - input argument(s) illegalpublic OrganismImage(Organism anOrganism, java.lang.String anElementName, int anElementID, com.sun.xml.parser.Parser anXMLParser, ImportContext importContext)
anOrganism
- Organism - the enclosing organism for this new organism imageanElementName
- 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 Organism getOrganism()
public SpeciesImage getSpeciesImage()
public World getWorld()
getWorld
in class EngineObject
public int getRowIndex()
public void setRowIndex(int aRowIndex)
When this method is successful, a property change event is fired for the property named EngineProp.ROW.
aRowIndex
- int - new row index, may not be < NO_CELLjava.lang.IllegalArgumentException
- - input argument illegalpublic int getColumnIndex()
public void setColumnIndex(int aColumnIndex)
When this method is successful, a property change event is fired for the property named EngineProp.ROW.
aColumnIndex
- int - new column index, may not be < NO_CELLjava.lang.IllegalArgumentException
- - input argument illegalpublic void setColumnAndRowIndices(int aColumnIndex, int aRowIndex)
When this method is successful, two property change events are fired - one for the property named EngineProp.COLUMN and another named EngineProp.ROW.
aColumnIndex
- int - new column index, may not be < NO_CELLaRowIndex
- int - new row index, may not be < NO_CELLjava.lang.IllegalArgumentException
- - input argument illegalpublic int getImageType()
public 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 librariespublic void clearDirtyBit()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |