project35.mda.model
Class ListFieldModel

java.lang.Object
  extended by project35.mda.model.DataFieldModel
      extended by project35.mda.model.ListFieldModel
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable
Direct Known Subclasses:
ProxyListFieldModel

public class ListFieldModel
extends DataFieldModel

Model data structure that describes a list field. Project35's model data structures are built up from a tree of records. A record can have a list field which in turn can reference one or more records. A list field can contain multiple subrecords. The list can be restricted to contain a number of types of subrecords


Copyright (c) 2008 Kevin Garwood for Project35. The original code was developed by Kevin Garwood for the University of Manchester. Revisions have been made for Project35, a project that is independent of that institution. This code is licensed under the Academic Free License version 3.0. The code attribution for the original code is included here:

Copyright (c) Kevin Garwood and University of Manchester 2007. All rights reserved. Licensed under the Academic Free License version 3.0. For more information on the terms and conditions, please see the file "LICENSE" that is included in this distribution.


Version:
1.0
Author:
Kevin Garwood (kgarwood@users.sourceforge.net)
See Also:
Serialized Form

Field Summary
 
Fields inherited from class project35.mda.model.DataFieldModel
containingRecord, isAttribute, isRequiredField
 
Constructor Summary
ListFieldModel()
          indicates whether the list should accomodate IDREFS style of writing out references or a bunch of IDREF declarations
 
Method Summary
 void addChild(java.lang.Object record)
          Adds a subrecord to the list.
 void addChildren(java.util.ArrayList recordObjects)
          for adding multiple items to a list
 java.lang.Object clone()
          used to clone the list field
 boolean containsItemDisplayName(java.lang.String candidateDisplayName)
           
 int getChildCount()
           
 java.util.ArrayList getChildren()
           
 java.lang.String[] getChildTypes()
           
 java.lang.String getIDREFSAttributeName()
           
 java.lang.String getIthFieldInstance()
          this is used to help label child record models that may not have enough information to make a unique displayName
 boolean isListPopulated()
          tells whether the list is populated or not; the result is usually used to control sensitivity of list field buttons such as "New", "Edit", "Delete"
 void removeAllChildren()
           
 void removeAllChildren(java.lang.String childType)
           
 void removeChild(java.lang.Object record)
          Removes child from the list.
 void removeChildren(java.util.ArrayList objectsToDelete)
           
 void resolveReferences()
           
 void reviseChildList(java.util.ArrayList oldChildrenList, java.util.ArrayList newChildrenList)
           
 void setChildren(java.util.ArrayList children)
          Sets the child subrecords of this list.
 void setChildTypes(java.lang.String[] childTypes)
           
 void setIDREFSAttributeName(java.lang.String idRefsAttributeName)
           
 void setSupportsReferencing(boolean supportsReferencing)
           
 boolean supportsChildType(java.lang.String candidateChildType)
           
 boolean supportsReferencing()
           
 void updateDisplayName(java.lang.String oldName, java.lang.String newName)
           
 java.lang.String validate()
          validates the list.
 
Methods inherited from class project35.mda.model.DataFieldModel
getContainingRecord, getContainingRecordClassName, getFieldViewType, getHelpLink, getName, getNameSpacePrefix, getToolTip, isAttribute, isContent, isRequiredField, populateCloneAttributes, setAttribute, setContainingRecord, setContent, setFieldViewType, setHelpLink, setName, setNameSpacePrefix, setRequiredField, setToolTipText, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ListFieldModel

public ListFieldModel()
indicates whether the list should accomodate IDREFS style of writing out references or a bunch of IDREF declarations

Method Detail

containsItemDisplayName

public boolean containsItemDisplayName(java.lang.String candidateDisplayName)

getIthFieldInstance

public java.lang.String getIthFieldInstance()
this is used to help label child record models that may not have enough information to make a unique displayName


getChildCount

public int getChildCount()

getChildren

public java.util.ArrayList getChildren()
Returns:
list of child record models

isListPopulated

public boolean isListPopulated()
tells whether the list is populated or not; the result is usually used to control sensitivity of list field buttons such as "New", "Edit", "Delete"

Returns:
true if the list field contains at least one subrecord; otherwise false

supportsChildType

public boolean supportsChildType(java.lang.String candidateChildType)

getChildTypes

public java.lang.String[] getChildTypes()
Returns:
the list of child types this list can support. These will correspond to names of record models

supportsReferencing

public boolean supportsReferencing()
Returns:
true if the list can reference at least some kind of item otherwise false

getIDREFSAttributeName

public java.lang.String getIDREFSAttributeName()

updateDisplayName

public void updateDisplayName(java.lang.String oldName,
                              java.lang.String newName)

setIDREFSAttributeName

public void setIDREFSAttributeName(java.lang.String idRefsAttributeName)

setSupportsReferencing

public void setSupportsReferencing(boolean supportsReferencing)

reviseChildList

public void reviseChildList(java.util.ArrayList oldChildrenList,
                            java.util.ArrayList newChildrenList)

addChildren

public void addChildren(java.util.ArrayList recordObjects)
for adding multiple items to a list


addChild

public void addChild(java.lang.Object record)
Adds a subrecord to the list.

Parameters:
record - child record to be added to the list

removeAllChildren

public void removeAllChildren(java.lang.String childType)

removeAllChildren

public void removeAllChildren()

removeChild

public void removeChild(java.lang.Object record)
Removes child from the list. assumes: child to be removed is in the list of children

Parameters:
record - child record to be removed from the list

removeChildren

public void removeChildren(java.util.ArrayList objectsToDelete)

setChildren

public void setChildren(java.util.ArrayList children)
Sets the child subrecords of this list.

Parameters:
children - the list of subrecords

setChildTypes

public void setChildTypes(java.lang.String[] childTypes)
Parameters:
childTypes - the child types this list can support

resolveReferences

public void resolveReferences()

validate

public java.lang.String validate()
validates the list. The only list validation that occurs is to determine whether a required list field has subrecords or not.

Returns:
an error message if validation failed or null if no errors were found

clone

public java.lang.Object clone()
used to clone the list field

Specified by:
clone in class DataFieldModel
Returns:
object that is being cloned