|
|||||||||
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
This abstract class is the base for all BioScope engine classes and defines the basic API's that all engine classes must implement.
An object of this class will generate the following property change events:
EngineProp.ID
,
EngineProp.DELETED
,
EngineProp.LOCKED_STATE
Field Summary | |
static int |
AUTOMATIC_LOCKED
Automatic lock value. |
static java.lang.String |
AUTOMATIC_LOCKED_STRING
|
protected org.concord.biologica.engine.LocalPropertyChangeSupport |
changes
Utility object which manages property change events and listeners. |
protected boolean |
deleted
Indicates if this object has been deleted and is waiting for garbage collection. |
protected static java.lang.Boolean |
FALSE
FALSE Boolean object. |
protected int |
id
Identifier for engine object, used when saving and restoring the object to and from a file. |
protected int |
lockedState
Current locked state of this object - see above LOCKED statics. |
static int |
MANUAL_AND_AUTOMATIC_LOCKED
Manual and automatic locked value. |
static java.lang.String |
MANUAL_AND_AUTOMATIC_LOCKED_STRING
|
static int |
MANUAL_LOCKED
Manual locked value. |
static java.lang.String |
MANUAL_LOCKED_STRING
|
static int |
NULL_ID
Null ID value. |
protected static java.lang.Boolean |
TRUE
TRUE Boolean object. |
static int |
UNLOCKED
Unlocked locked value. |
static java.lang.String |
UNLOCKED_STRING
|
protected ElementContext |
xmlElementContext
XML Element context used when reading an element this object from a file. |
Constructor Summary | |
EngineObject()
Creates engine object, giving the object a proper ID. |
Method Summary | |
void |
addPropertyChangeListener(java.beans.PropertyChangeListener aListener)
Add a property change listener for properties. |
abstract void |
delete()
Deletes the object, notifying any containing objects and deleting any child objects. |
int |
getID()
Returns the ID of this object. |
int |
getLockedState()
Get locked state of this object. |
java.lang.String |
getLockedStateAsString()
Get locked state of this object as a string. |
abstract World |
getWorld()
Get the world containing this object. |
boolean |
isAutomaticLocked()
Is the object automatic locked? Ignores other components of the locked state. |
boolean |
isDeleted()
Get whether or not this object is deleted. |
boolean |
isLocked()
Get locked state as a boolean. |
boolean |
isManualLocked()
Is the object manual locked? Ignores other components of the locked state. |
void |
notifySelected(boolean oldSelectedState,
boolean newSelectedState)
Notify listeners that the selected state of this object has changed. |
void |
release()
|
void |
removePropertyChangeListener(java.beans.PropertyChangeListener aListener)
Remove a property change listener for properties. |
void |
setAutomaticLocked(boolean automaticLocked)
Set or unset the automatic locked state of this object, leaving other components of the locked state untouched. |
void |
setID(int anID)
Set the id of the object. |
void |
setLockedState(int aLockedState)
Set the locked state of the object. |
void |
setLockedStateAsString(java.lang.String aLockedState)
Set locked state of this object using a string. |
void |
setManualLocked(boolean manualLocked)
Set or unset the manual locked state of this object, leaving other components of the locked state untouched. |
abstract java.lang.String |
toString()
Return a string representation of this object, usually the object's name. |
abstract void |
writeToStream(java.io.PrintWriter stream)
Writes this object to the given stream in XML format. |
Methods inherited from class org.xml.sax.HandlerBase |
characters, endDocument, endElement, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, startDocument, startElement, 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 NULL_ID
public static final int UNLOCKED
public static final java.lang.String UNLOCKED_STRING
public static final int MANUAL_LOCKED
public static final java.lang.String MANUAL_LOCKED_STRING
public static final int AUTOMATIC_LOCKED
public static final java.lang.String AUTOMATIC_LOCKED_STRING
public static final int MANUAL_AND_AUTOMATIC_LOCKED
public static final java.lang.String MANUAL_AND_AUTOMATIC_LOCKED_STRING
protected static final java.lang.Boolean TRUE
protected static final java.lang.Boolean FALSE
protected int id
When this property is changed, a property change event is generated for the property named EngineProp.ID.
protected boolean deleted
When this property is changed, a property change event is generated for the property named EngineProp.DELETED. It is up to the derived class to fire this event.
protected int lockedState
protected transient ElementContext xmlElementContext
protected transient org.concord.biologica.engine.LocalPropertyChangeSupport changes
Constructor Detail |
public EngineObject()
Method Detail |
public final int getID()
public void setID(int anID)
When this property is changed, a property change event is fired for the property named EngineProp.ID.
anID
- int - new ID for object.public final boolean isDeleted()
public void setAutomaticLocked(boolean automaticLocked)
It's expected that most derived classes will override this method and recursively lock their children.
automaticLocked
- boolean - object should be automatic locked (true) or not (false)public void setManualLocked(boolean manualLocked)
It's expected that most derived classes will override this method and recursively lock their children.
manualLocked
- boolean - object should be manually locked (true) or not (false)public void setLockedState(int aLockedState)
When this property is changed, a property change event is fired for the property named EngineProp.LOCKED_STATE.
It's expected that most derived classes will override this method and recursively lock their children.
aLockedState
- int - new locked state of this objectjava.lang.IllegalArgumentException
- - new locked state invalidpublic final void setLockedStateAsString(java.lang.String aLockedState)
aLockedState
- String - locked state as a stringjava.lang.IllegalArgumentException
- - new locked state invalidpublic final boolean isLocked()
public final boolean isAutomaticLocked()
public final boolean isManualLocked()
public final int getLockedState()
public final java.lang.String getLockedStateAsString()
public final void notifySelected(boolean oldSelectedState, boolean newSelectedState)
oldSelectedState
- boolean - old selected statenewSelectedState
- boolean - new selected statepublic abstract World getWorld()
public abstract void delete()
A default method could be supplied, but every derived class must implement this method, so we chose not to implement one to force the compiler to complain if the derived class doesn't implement this method.
A derived class's implementation of this method should at least have:
id = NULL_ID; deleted = true;When this method is called, the implementing class must fire a property change event for the property named EngineProp.DELETED.
public void release()
public abstract java.lang.String toString()
toString
in class java.lang.Object
public abstract 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.
stream
- PrintWriter - print streamjava.lang.IllegalArgumentException
- - input arguments illegaljava.io.IOException
- - an IO error occurred in java librariespublic void addPropertyChangeListener(java.beans.PropertyChangeListener aListener)
aListener
- PropertyChangeListener - a new listenerpublic void removePropertyChangeListener(java.beans.PropertyChangeListener aListener)
aListener
- PropertyChangeListener - a listener to remove
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |