org.mockcentral.editor.viewers
Class MockCentralTreeModel

java.lang.Object
  extended by org.mockcentral.editor.viewers.MockCentralTreeModel

public class MockCentralTreeModel
extends java.lang.Object

A Class used to model Mock Central node data that is to be displayed in a tree structure.

Author:
David Hutchinson

Constructor Summary
MockCentralTreeModel(org.jdom.Document document, boolean load)
          Creates a new instance.
 
Method Summary
 java.util.List<NodeProblem> collectNodeProblems()
          Returns a list of all current NodeProblem instances in the model.
 boolean exists(MockCentralNode node)
          Returns whether the supplied MockCentralNode exists within the model.
 java.lang.Object getChild(java.lang.Object parentNode, int index)
          Returns the child MockCentralNode at the supplied index within the indicated parent.
 int getChildCount(java.lang.Object parentNode)
          Returns the number of child MockCentralNode instances within the supplied parent.
 org.jdom.Document getDocument()
          Returns the JDOM Document.
 int getIndexOfChild(java.lang.Object parentNode, java.lang.Object childNode)
          Returns the index within the indicated parent MockCentralNode of the child MockCentralNode.
 FixtureNode getNamedFixtureNode(java.lang.String fixtureName)
          Returns the FixtureNode which defines a Fixture with the supplied name, if any.
 java.lang.Object getParent(java.lang.Object childNode)
          Returns the parent MockCentralNode for the supplied child MockCentralNode.
 java.lang.Object getRoot()
          Returns the root of the model.
 void setDocument(org.jdom.Document document)
          Sets the JDOM Document.
 void setRoot(java.lang.Object root)
          Sets the root of the model.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MockCentralTreeModel

public MockCentralTreeModel(org.jdom.Document document,
                            boolean load)
Creates a new instance.

Parameters:
document - the JDOM Document containing the data for this model.
Method Detail

setDocument

public void setDocument(org.jdom.Document document)
Sets the JDOM Document.

Parameters:
document - the JDOM Document.

getDocument

public org.jdom.Document getDocument()
Returns the JDOM Document.

Returns:
the JDOM Document.

setRoot

public void setRoot(java.lang.Object root)
Sets the root of the model.

Parameters:
root - the Object to set as the root.

getRoot

public java.lang.Object getRoot()
Returns the root of the model.

Returns:
the root of the model.

exists

public boolean exists(MockCentralNode node)
Returns whether the supplied MockCentralNode exists within the model.

Parameters:
node - the MockCentralNode to test for existence.
Returns:
whether the supplied MockCentralNode exists within this model.

getChild

public java.lang.Object getChild(java.lang.Object parentNode,
                                 int index)
Returns the child MockCentralNode at the supplied index within the indicated parent.

Parameters:
parentNode - the parent MockCentralNode.
index - the index.
Returns:
the child MockCentralNode at the supplied index within the indicated parent MockCentralNode.

getChildCount

public int getChildCount(java.lang.Object parentNode)
Returns the number of child MockCentralNode instances within the supplied parent.

Parameters:
parentNode - the parent MockCentralNode.
Returns:
the number of child MockCentralNode instances within the indicated parent MockCentralNode.

getIndexOfChild

public int getIndexOfChild(java.lang.Object parentNode,
                           java.lang.Object childNode)
Returns the index within the indicated parent MockCentralNode of the child MockCentralNode.

Parameters:
parentNode - the parent MockCentralNode.
childNode - the child MockCentralNode.
Returns:
the index within the indicated parent MockCentralNode of the child MockCentralNode.

getParent

public java.lang.Object getParent(java.lang.Object childNode)
Returns the parent MockCentralNode for the supplied child MockCentralNode.

Parameters:
childNode - the child MockCentralNode whose parent MockCentralNode is to be returned.
Returns:
parent MockCentralNode for the supplied child MockCentralNode.

getNamedFixtureNode

public FixtureNode getNamedFixtureNode(java.lang.String fixtureName)
Returns the FixtureNode which defines a Fixture with the supplied name, if any.

Parameters:
fixtureName - the name of Fixture.
Returns:
the FixtureNode which defines a Fixture with the supplied name, if any.

collectNodeProblems

public java.util.List<NodeProblem> collectNodeProblems()
Returns a list of all current NodeProblem instances in the model.

Returns:
a list of all current NodeProblem instances in the model.