org.mockcentral.editor.nodes
Class MockCentralNodeModel

java.lang.Object
  extended by org.mockcentral.editor.nodes.MockCentralNodeModel
Direct Known Subclasses:
ExpectationModel, FixtureModel, MockCentralGroupNodeModel, MockObjectModel

public abstract class MockCentralNodeModel
extends java.lang.Object

Base for classes representing the model in the MVC structure used for editing the data in the JDOM Element instances that comprise the domain model. Each instance of this class is associated with a specific instance of the MockCentralNode class; the loadElementData method gets called to populate the model using the current contents of the node's Element when the node is activated.

Author:
David Hutchinson

Field Summary
protected  org.jdom.Element element
          The JDOM Element containing the modeled data.
protected  MockCentralNode node
          The associated MockCentralNode.
protected  java.util.List<java.lang.Object> observers
          A List of observers to be notified when the model changes.
 
Constructor Summary
MockCentralNodeModel(MockCentralNode node)
          Creates a new instance.
 
Method Summary
 void addObserver(java.lang.Object observer)
          Adds an observer to the list.
 org.jdom.Element getElement()
          Returns the JDOM Element containing the modeled data.
 FixtureNode getEnclosingFixtureNode()
          Returns the enclosing FixtureNode.
 MockCentralNode getNode()
          Returns the MockCentralNode.
 java.lang.String getNotRemovableMessage()
          Returns a message for display indicating why the corresposing MockCentralNode instance cannot be deleted, or null (as this default implementation does).
 java.util.List<java.lang.Object> getObservers()
          Returns the list of observers.
abstract  void loadElementData(boolean refreshUI)
          Loads the data from the JDOM Element provided by the MockCentralNode into the model.
protected  void registerChanges(boolean refreshUI)
          Updates the IMockCentralEditorOutline display and notifies the editor when the document receives changes.
 void removeObserver(java.lang.Object observer)
          Removes an observer from the list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

node

protected MockCentralNode node
The associated MockCentralNode.


element

protected org.jdom.Element element
The JDOM Element containing the modeled data.


observers

protected java.util.List<java.lang.Object> observers
A List of observers to be notified when the model changes.

Constructor Detail

MockCentralNodeModel

public MockCentralNodeModel(MockCentralNode node)
Creates a new instance.

Parameters:
node - associated MockCentralNode.
Method Detail

getNode

public MockCentralNode getNode()
Returns the MockCentralNode.

Returns:
the MockCentralNode.

getElement

public org.jdom.Element getElement()
Returns the JDOM Element containing the modeled data.

Returns:
the JDOM Element containing the modeled data.

getObservers

public java.util.List<java.lang.Object> getObservers()
Returns the list of observers.

Returns:
the list of observers.

loadElementData

public abstract void loadElementData(boolean refreshUI)
Loads the data from the JDOM Element provided by the MockCentralNode into the model.

Parameters:
refreshUI - whether to send notification to ui components to update the display.

addObserver

public void addObserver(java.lang.Object observer)
Adds an observer to the list.

Parameters:
observer - the Object interested in changes to the model to add to the list.

removeObserver

public void removeObserver(java.lang.Object observer)
Removes an observer from the list.

Parameters:
observer - the Object interested in changes to the model to remove from the list.

getNotRemovableMessage

public java.lang.String getNotRemovableMessage()
Returns a message for display indicating why the corresposing MockCentralNode instance cannot be deleted, or null (as this default implementation does).

Returns:
a message for display indicating why the corresposing MockCentralNode instance cannot be deleted, or null.

getEnclosingFixtureNode

public FixtureNode getEnclosingFixtureNode()
Returns the enclosing FixtureNode.

Returns:
the enclosing FixtureNode.

registerChanges

protected void registerChanges(boolean refreshUI)
Updates the IMockCentralEditorOutline display and notifies the editor when the document receives changes.

Parameters:
refreshUI - whether to send notification to ui components to update the display.