org.mockcentral.editor.nodes.fixture_group
Class FixtureGroupModel

java.lang.Object
  extended by org.mockcentral.editor.nodes.MockCentralNodeModel
      extended by org.mockcentral.editor.nodes.MockCentralGroupNodeModel
          extended by org.mockcentral.editor.nodes.fixture_group.FixtureGroupModel
All Implemented Interfaces:
IFixtureNameEditor

public class FixtureGroupModel
extends MockCentralGroupNodeModel
implements IFixtureNameEditor

A class that models the list of Fixtures defined in the configuration file.

Author:
David Hutchinson

Field Summary
protected  FixtureGroupNode node
          The FixtureGroupNode associated with this model.
 
Fields inherited from class org.mockcentral.editor.nodes.MockCentralGroupNodeModel
observers
 
Fields inherited from class org.mockcentral.editor.nodes.MockCentralNodeModel
element
 
Constructor Summary
FixtureGroupModel(MockCentralNode node)
          Casts and assigns the MockCentralNode.
 
Method Summary
 FixtureNode createFixtureNode(java.lang.String fixtureName, java.lang.String fixtureDescription)
          Creates and returns a new FixtureNode from the supplied data.
 java.lang.String getChildNodeTypeDescription(boolean singular)
          Returns a String description of the MockCentralNode's child type, ie "Fixture", "Mock Object" etc.
 java.lang.String getDefaultNewFixtureName()
          Returns a default new Fixture name value, which will be unique.
 java.lang.String getImportingFixtureName(java.lang.String fixtureName)
          Returns the name of the first Fixture found that imports the Fixture with the supplied name.
 boolean isDuplicateFixtureName(java.lang.String fixtureName, int elementHashCode)
          Returns whether the supplied Fixture name is in use for a Fixture not identified by the supplied hashcode.
 boolean isFixtureNameInUse(java.lang.String fixtureName)
          Returns whether the supplied Fixture name is already in use within the document.
 void removeChildNode(MockCentralNode childNode)
          Deletes the indexed child MockCentralNode.
 void updateImportedFixtureName(java.lang.String oldFixtureName, java.lang.String newFixtureName)
          Updates the "importFixture" element instances for all Fixtures that import one whose name has been changed.
 
Methods inherited from class org.mockcentral.editor.nodes.MockCentralGroupNodeModel
addChildNode, addObserver, editSelectedChild, fireChildrenChanged, getChildren, getElement, loadElementData, sortChildren
 
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

node

protected FixtureGroupNode node
The FixtureGroupNode associated with this model.

Constructor Detail

FixtureGroupModel

public FixtureGroupModel(MockCentralNode node)
Casts and assigns the MockCentralNode.

Parameters:
node - the MockCentralNode containing the JDOM element whose data this class models.
Method Detail

isFixtureNameInUse

public boolean isFixtureNameInUse(java.lang.String fixtureName)
Description copied from interface: IFixtureNameEditor
Returns whether the supplied Fixture name is already in use within the document.

Specified by:
isFixtureNameInUse in interface IFixtureNameEditor
Parameters:
fixtureName - the proposed name for the Fixture.
Returns:
whether the supplied Fixture name is already in use within the document.

getDefaultNewFixtureName

public java.lang.String getDefaultNewFixtureName()
Returns a default new Fixture name value, which will be unique.

Returns:
a default new Fixture name value.

isDuplicateFixtureName

public boolean isDuplicateFixtureName(java.lang.String fixtureName,
                                      int elementHashCode)
Returns whether the supplied Fixture name is in use for a Fixture not identified by the supplied hashcode.

Parameters:
fixtureName - the proposed FixtureName
Returns:
whether the supplied Fixture name is in use for a Fixture not identified by the supplied hashcode.

getChildNodeTypeDescription

public java.lang.String getChildNodeTypeDescription(boolean singular)
Description copied from class: MockCentralGroupNodeModel
Returns a String description of the MockCentralNode's child type, ie "Fixture", "Mock Object" etc.

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

removeChildNode

public void removeChildNode(MockCentralNode childNode)
Description copied from class: MockCentralGroupNodeModel
Deletes the indexed child MockCentralNode.

Overrides:
removeChildNode in class MockCentralGroupNodeModel
Parameters:
childNode - the child MockCentralNode to delete.

createFixtureNode

public FixtureNode createFixtureNode(java.lang.String fixtureName,
                                     java.lang.String fixtureDescription)
Creates and returns a new FixtureNode from the supplied data.

Parameters:
fixtureName - the name for the new Fixture.
fixtureDescription - the description for the new Fixture.
Returns:
a new FixtureNode created from the data.

updateImportedFixtureName

public void updateImportedFixtureName(java.lang.String oldFixtureName,
                                      java.lang.String newFixtureName)
Updates the "importFixture" element instances for all Fixtures that import one whose name has been changed.

Parameters:
oldFixtureName - the old name of the imported Fixture.
newFixtureName - the new name for the imported Fixture.

getImportingFixtureName

public java.lang.String getImportingFixtureName(java.lang.String fixtureName)
Returns the name of the first Fixture found that imports the Fixture with the supplied name.

Parameters:
fixtureName - the name of the possibly imported Fixture.
Returns:
the name of the first Fixture found that imports the Fixture with the supplied name.