org.mockcentral.editor.nodes
Class MockCentralGroupNodeModel

java.lang.Object
  extended by org.mockcentral.editor.nodes.MockCentralNodeModel
      extended by org.mockcentral.editor.nodes.MockCentralGroupNodeModel
Direct Known Subclasses:
ExpectationGroupModel, FixtureGroupModel, MockObjectGroupModel

public abstract class MockCentralGroupNodeModel
extends MockCentralNodeModel

The model component within the MVC structure that includes the MockCentralGroupNodeController and IMockCentralNodeView classes.

Author:
David Hutchinson

Field Summary
protected  java.util.List<IMockCentralGroupNodeModelObserver> observers
          The list of IMockCentralGroupNodeModelObserver instances listening for changes to this model.
 
Fields inherited from class org.mockcentral.editor.nodes.MockCentralNodeModel
element, node
 
Constructor Summary
MockCentralGroupNodeModel(MockCentralNode node)
          Creates a new instance, assigning the references to the MockCentralNode and its JDOM Element.
 
Method Summary
 void addChildNode(int index, MockCentralNode child)
          Adds the supplied MockCentralNode to the list of children.
 void addObserver(IMockCentralGroupNodeModelObserver observer)
          Adds an entry to the list of IMockCentralGroupNodeModelObserver instances listening for changes to this model
 void editSelectedChild(java.lang.Object selected)
          Activates the selected child MockCentralNode for editing.
 void fireChildrenChanged()
          Notifies the registered IMockCentralGroupNodeModelObserver instances that the list of children has changed.
abstract  java.lang.String getChildNodeTypeDescription(boolean singular)
          Returns a String description of the MockCentralNode's child type, ie "Fixture", "Mock Object" etc.
 java.util.List<MockCentralNode> getChildren()
          Returns the List of child MockCentralNode instances.
 org.jdom.Element getElement()
          Returns the JDOM Element containing the modeled data.
 void loadElementData(boolean refreshUI)
          Loads the data from the JDOM Element provided by the MockCentralNode into the model.
 void removeChildNode(MockCentralNode childNode)
          Deletes the indexed child MockCentralNode.
 void sortChildren(java.util.Comparator<java.lang.Object> comparator)
          Sorts the MockCentralNode children.
 
Methods inherited from class org.mockcentral.editor.nodes.MockCentralNodeModel
addObserver, getEnclosingFixtureNode, getNode, getNotRemovableMessage, getObservers, registerChanges, removeObserver
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

observers

protected java.util.List<IMockCentralGroupNodeModelObserver> observers
The list of IMockCentralGroupNodeModelObserver instances listening for changes to this model.

Constructor Detail

MockCentralGroupNodeModel

public MockCentralGroupNodeModel(MockCentralNode node)
Creates a new instance, assigning the references to the MockCentralNode and its JDOM Element.

Parameters:
node - the MockCentralNode associated with this model.
Method Detail

loadElementData

public void loadElementData(boolean refreshUI)
Description copied from class: MockCentralNodeModel
Loads the data from the JDOM Element provided by the MockCentralNode into the model.

Specified by:
loadElementData in class MockCentralNodeModel
Parameters:
refreshUI - whether to send notification to ui components to update the display.

getElement

public org.jdom.Element getElement()
Description copied from class: MockCentralNodeModel
Returns the JDOM Element containing the modeled data.

Overrides:
getElement in class MockCentralNodeModel
Returns:
the JDOM Element containing the modeled data.

getChildren

public java.util.List<MockCentralNode> getChildren()
Returns the List of child MockCentralNode instances.

Returns:
the List of child MockCentralNode instances.

getChildNodeTypeDescription

public abstract java.lang.String getChildNodeTypeDescription(boolean singular)
Returns a String description of the MockCentralNode's child type, ie "Fixture", "Mock Object" etc.

Parameters:
singular - value for whether the String should be in singular form.
Returns:
a String description of the MockCentralNode type.

addChildNode

public void addChildNode(int index,
                         MockCentralNode child)
Adds the supplied MockCentralNode to the list of children.

Parameters:
index - the index at which to add the child.
child - the MockCentralNode to add.

editSelectedChild

public void editSelectedChild(java.lang.Object selected)
Activates the selected child MockCentralNode for editing.

Parameters:
selected - the MockCentralNode to activate.

removeChildNode

public void removeChildNode(MockCentralNode childNode)
Deletes the indexed child MockCentralNode.

Parameters:
childNode - the child MockCentralNode to delete.

sortChildren

public void sortChildren(java.util.Comparator<java.lang.Object> comparator)
Sorts the MockCentralNode children.

Parameters:
comparator - a Comparator to use for sorting, or null if standard sorting is to be used.

addObserver

public void addObserver(IMockCentralGroupNodeModelObserver observer)
Adds an entry to the list of IMockCentralGroupNodeModelObserver instances listening for changes to this model

Parameters:
observer - the observer to add.

fireChildrenChanged

public void fireChildrenChanged()
Notifies the registered IMockCentralGroupNodeModelObserver instances that the list of children has changed.