edu.iris.dmc.pdcc.gui
Class PdccBlocketteObject

java.lang.Object
  extended byjavax.swing.tree.DefaultMutableTreeNode
      extended byedu.iris.dmc.pdcc.gui.PdccObject
          extended byedu.iris.dmc.pdcc.gui.PdccBlocketteObject
All Implemented Interfaces:
java.lang.Cloneable, edu.iris.dmc.isis.Displayable, edu.iris.dmc.isis.Editable, edu.iris.dmc.isis.Listable, javax.swing.tree.MutableTreeNode, edu.iris.dmc.isis.ObjectController, java.io.Serializable, javax.swing.tree.TreeNode

public class PdccBlocketteObject
extends PdccObject

Blockette variant of PdccObject.

Version:
3/6/2006
Author:
Robert Casey, IRIS DMC
See Also:
Serialized Form

Field Summary
 
Fields inherited from class edu.iris.dmc.pdcc.gui.PdccObject
allowedChildTypes, boundContainer, boundObject, defaultTreeModel, insertAt, originalString, ourParent, uniqueId, userGeneratedObject, validatedString
 
Fields inherited from class javax.swing.tree.DefaultMutableTreeNode
allowsChildren, children, EMPTY_ENUMERATION, parent, userObject
 
Fields inherited from interface edu.iris.dmc.isis.Listable
DEFAULT_ICON
 
Constructor Summary
PdccBlocketteObject(Blockette blk)
          Create a new instance of PDCC object, mapped to the indicated blockette instance.
 
Method Summary
 void addDictionaryLookup(int fieldNum, PdccObject newDictionary)
          Add a new dictionary reference and associate to the indicated fieldNum.
protected  edu.iris.dmc.isis.ObjectController constructController()
           
protected  edu.iris.dmc.isis.EditPanel constructEditPanel()
           
 void dbUpdate(int fieldNum, int fieldIndex)
          Update indicated field (and index) value to the db export builder.
 void deleteGroupRow(int rowNum, int fromField)
          An editing function that allows deletion of a row in a repeat group.
 PdccObject getChild(int index, int currentNumberOfChildren)
          return a PdccObject child of the current object at index makes a new PdccObject at that index if one does not already exist
 java.util.Vector getChildren()
          return a Vector of child PdccObjects associated with us
 PdccObject getDictionaryObject(int fieldNum)
          return the PdccObject representing the dictionary referenced by this object's field.
 PdccObject getDictionaryObject(int fieldNum, int fieldIndex)
          return a new copy dictionary PdccObject representing the dictionary referenced by this object's field and repeat group field index.
 int getDictionaryReferenceType(int fieldNum)
          return the type number of the referenced dictionary object for the indicated field number.
 java.lang.String getDictionaryReferenceVal()
          return the dictionary reference index value of this object, provided that it is a dictionary object...return 0 if we are not a dictionary object or we do not have a reference value
 java.util.Vector getDictionaryVector(int fieldNum, int fieldIndex)
          this version returns a Vector of PdccObjects, appropriate for cases where a blockette references a repeat list within a repeat list of dictionary references, such as with Blockette 60.
 java.lang.String getFieldLength(int fieldNum)
          return a string representation of the length of the indicated field number, which is either a single integer, or two integers separated by a hyphen, which suggests a min and max length.
 java.lang.String getFieldName(int fieldNum)
          return the field name string from the indicated field number in the bound data object.
 java.lang.String getFieldType(int fieldNum)
          return a string representing the data type of the indicated field number of the bound data object.
 java.lang.String getFieldValue(int fieldNum)
          return a String representation of the value contained in the indicated field number of the bound data object
 java.lang.String getFieldValue(int fieldNum, int fieldIndex)
          in the case of multiple values being present in a given field, return a string representation of the value at the specified index.
 int getId()
          return a unique ID number for this object, perhaps identical to the unique ID of the bound data object.
 java.lang.String getName()
          return the name of the type of the bound data object
 int getNumFields()
          return an integer indicating the number of fields *expected* in the bound data object
 int getNumFieldValues(int fieldNum)
          get the number of values available for this field.
 java.lang.String getRepeatGroupName(int fieldNum)
          for the indicated field, which should be a repeating field, return the appropriate blockette label representing the entire repeat group.
 int getRepeatGroupSize(int fieldNum)
          get the number of fields in this repeat group, starting at the indicated field number...this represents the 'width' size of the group, or number of columns.
 int getSortField()
          Return the field number to sort objects by, specific response based on Blockette type.
static int getSortField(int type)
          Return the field number to sort objects by, specific response based on Blockette type.
 int getType()
          return an integer representing the 'type' of the bound data object
 void insertGroupRow(int rowNum, int fromField)
          An editing function that allows insertion of a new row to a repeat group.
 boolean isDictionaryField(int fieldNum)
          return true if this field references a dictionary object (referencing field)
 boolean isDictionaryReference(int fieldNum)
          return true if this field is the reference number field of a dictionary blockette (referenced field)
 boolean isRepeatingField(int fieldNum)
          return true if this field is part of a repeat group ...
 int numberOfChildren()
          return the number of child objects associated with this object
 void refreshTreeModel()
          send a notification to the tree model that the node represented by this object is in need of a refresh on the display An override of the PdccObject implementation
protected  void releaseEditPanel()
           
 void removeBoundObject()
          override PdccObject method of the same name...add the facility to mark the associated database record with DELETE.
 void restoreOriginal(java.lang.Object restoreObj, int start, int end)
          restore original values from the start to end fields
 void setId(int id)
          Overrides PdccObject setId().
 java.lang.String toString()
          Overrides PdccObject.toString();
 void updateDictionaryLookup(int fieldNum, int fieldIndex, PdccObject newDictionary)
          update this object with a new dictionary reference based on the lookup value at the indicated fieldnum.
 void updateDictionaryLookup(int fieldNum, PdccObject newDictionary)
          update this object with a new dictionary reference based on the lookup value at the indicated fieldnum.
 int validate(java.lang.String value, int fieldNum, int fieldIndex)
          Validate the offered string value against the field specification of the given field number and fieldIndex.
 int validate(java.lang.String value, int fieldNum, int fieldIndex, int listIndex)
          expanded version of validate that accomodates list fields, which are sub-groups within a repeat group.
 
Methods inherited from class edu.iris.dmc.pdcc.gui.PdccObject
canHaveChild, getBoundObject, getContainer, getController, getDictionaryListCount, getDisplayPanel, getEditPanel, getObjectContainer, getOriginalString, getParentNode, getValidatedString, handleObject, isUserGenerated, listIcon, listString, registerDefaultTreeModel, registerObjectContainer, releaseDisplayPanel, resolveDictionaryLookup, resolveDictionaryLookup, resolveDictionaryLookup, setInsertAt, setParentNode, setUserGenerated, validate
 
Methods inherited from class javax.swing.tree.DefaultMutableTreeNode
add, breadthFirstEnumeration, children, clone, depthFirstEnumeration, getAllowsChildren, getChildAfter, getChildAt, getChildBefore, getChildCount, getDepth, getFirstChild, getFirstLeaf, getIndex, getLastChild, getLastLeaf, getLeafCount, getLevel, getNextLeaf, getNextNode, getNextSibling, getParent, getPath, getPathToRoot, getPreviousLeaf, getPreviousNode, getPreviousSibling, getRoot, getSharedAncestor, getSiblingCount, getUserObject, getUserObjectPath, insert, isLeaf, isNodeAncestor, isNodeChild, isNodeDescendant, isNodeRelated, isNodeSibling, isRoot, pathFromAncestorEnumeration, postorderEnumeration, preorderEnumeration, remove, remove, removeAllChildren, removeFromParent, setAllowsChildren, setParent, setUserObject
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PdccBlocketteObject

public PdccBlocketteObject(Blockette blk)
Create a new instance of PDCC object, mapped to the indicated blockette instance.

Parameters:
blk -
Method Detail

toString

public java.lang.String toString()
Overrides PdccObject.toString();

Overrides:
toString in class PdccObject

setId

public void setId(int id)
Overrides PdccObject setId(). sets the unique Id value for this object, perhaps specific to the type of data object bound to us.

Overrides:
setId in class PdccObject

getId

public int getId()
return a unique ID number for this object, perhaps identical to the unique ID of the bound data object.

Specified by:
getId in class PdccObject

getType

public int getType()
return an integer representing the 'type' of the bound data object

Specified by:
getType in class PdccObject

getName

public java.lang.String getName()
                         throws SeedException
return the name of the type of the bound data object

Specified by:
getName in class PdccObject
Throws:
SeedException

getNumFields

public int getNumFields()
                 throws SeedException
return an integer indicating the number of fields *expected* in the bound data object

Specified by:
getNumFields in class PdccObject
Throws:
SeedException

getFieldName

public java.lang.String getFieldName(int fieldNum)
                              throws SeedException
return the field name string from the indicated field number in the bound data object.

Specified by:
getFieldName in class PdccObject
Throws:
SeedException

getFieldValue

public java.lang.String getFieldValue(int fieldNum)
return a String representation of the value contained in the indicated field number of the bound data object

Specified by:
getFieldValue in class PdccObject

getFieldValue

public java.lang.String getFieldValue(int fieldNum,
                                      int fieldIndex)
in the case of multiple values being present in a given field, return a string representation of the value at the specified index.

Specified by:
getFieldValue in class PdccObject

getFieldType

public java.lang.String getFieldType(int fieldNum)
                              throws SeedException
return a string representing the data type of the indicated field number of the bound data object.

Specified by:
getFieldType in class PdccObject
Throws:
SeedException

getFieldLength

public java.lang.String getFieldLength(int fieldNum)
                                throws SeedException
return a string representation of the length of the indicated field number, which is either a single integer, or two integers separated by a hyphen, which suggests a min and max length.

Specified by:
getFieldLength in class PdccObject
Throws:
SeedException

isDictionaryField

public boolean isDictionaryField(int fieldNum)
return true if this field references a dictionary object (referencing field)

Specified by:
isDictionaryField in class PdccObject

isDictionaryReference

public boolean isDictionaryReference(int fieldNum)
return true if this field is the reference number field of a dictionary blockette (referenced field)

Specified by:
isDictionaryReference in class PdccObject

getDictionaryReferenceType

public int getDictionaryReferenceType(int fieldNum)
return the type number of the referenced dictionary object for the indicated field number.

Specified by:
getDictionaryReferenceType in class PdccObject

getDictionaryReferenceVal

public java.lang.String getDictionaryReferenceVal()
return the dictionary reference index value of this object, provided that it is a dictionary object...return 0 if we are not a dictionary object or we do not have a reference value

Specified by:
getDictionaryReferenceVal in class PdccObject

getDictionaryObject

public PdccObject getDictionaryObject(int fieldNum)
                               throws java.lang.Exception
return the PdccObject representing the dictionary referenced by this object's field.

Specified by:
getDictionaryObject in class PdccObject
Throws:
java.lang.Exception

getDictionaryObject

public PdccObject getDictionaryObject(int fieldNum,
                                      int fieldIndex)
                               throws java.lang.Exception
return a new copy dictionary PdccObject representing the dictionary referenced by this object's field and repeat group field index. can also be called by the dictionary PdccObject itself with fieldNum == 0 to return a copy of itself, referencing the same bound object -- good for reference GUI popups

Specified by:
getDictionaryObject in class PdccObject
Throws:
java.lang.Exception

getDictionaryVector

public java.util.Vector getDictionaryVector(int fieldNum,
                                            int fieldIndex)
                                     throws java.lang.Exception
this version returns a Vector of PdccObjects, appropriate for cases where a blockette references a repeat list within a repeat list of dictionary references, such as with Blockette 60. If not a list field, then a Vector of size 1 will be returned. A vector of size 0 is returned if no dictionary objects are referenced. A null value is returned if the fieldNum or fieldIndex is too high or references a null value.

Specified by:
getDictionaryVector in class PdccObject
Throws:
java.lang.Exception

updateDictionaryLookup

public void updateDictionaryLookup(int fieldNum,
                                   PdccObject newDictionary)
update this object with a new dictionary reference based on the lookup value at the indicated fieldnum. Use this only when there is an existing dictionary reference number.

Specified by:
updateDictionaryLookup in class PdccObject

updateDictionaryLookup

public void updateDictionaryLookup(int fieldNum,
                                   int fieldIndex,
                                   PdccObject newDictionary)
update this object with a new dictionary reference based on the lookup value at the indicated fieldnum. Use this only when there is an existing dictionary reference number.


addDictionaryLookup

public void addDictionaryLookup(int fieldNum,
                                PdccObject newDictionary)
Add a new dictionary reference and associate to the indicated fieldNum. This is necessary for fields that previously had no reference.

Parameters:
fieldNum -
newDictionary -

isRepeatingField

public boolean isRepeatingField(int fieldNum)
                         throws SeedException
return true if this field is part of a repeat group ... it does not mean that the field contains any values, only that it might contain multiple values.

Specified by:
isRepeatingField in class PdccObject
Throws:
SeedException

getRepeatGroupName

public java.lang.String getRepeatGroupName(int fieldNum)
                                    throws SeedException
for the indicated field, which should be a repeating field, return the appropriate blockette label representing the entire repeat group.

Specified by:
getRepeatGroupName in class PdccObject
Throws:
SeedException

getNumFieldValues

public int getNumFieldValues(int fieldNum)
                      throws SeedException
get the number of values available for this field. this only reports what the repeat count field shows, it doesn't count the repeats to verify.

Specified by:
getNumFieldValues in class PdccObject
Throws:
SeedException

getRepeatGroupSize

public int getRepeatGroupSize(int fieldNum)
                       throws SeedException
get the number of fields in this repeat group, starting at the indicated field number...this represents the 'width' size of the group, or number of columns.

Specified by:
getRepeatGroupSize in class PdccObject
Throws:
SeedException

validate

public int validate(java.lang.String value,
                    int fieldNum,
                    int fieldIndex)
Validate the offered string value against the field specification of the given field number and fieldIndex. Return 0 if the string is validated successfully. Place the validated string so that it can be accessed by getValidatedString(). Else, return 1 if there is an error and place the error message in the same holding place to be accessed by getValidatedString(). Return 2 if there is no change detected between the current value and the new value.

Specified by:
validate in class PdccObject

validate

public int validate(java.lang.String value,
                    int fieldNum,
                    int fieldIndex,
                    int listIndex)
expanded version of validate that accomodates list fields, which are sub-groups within a repeat group.

Specified by:
validate in class PdccObject

dbUpdate

public void dbUpdate(int fieldNum,
                     int fieldIndex)
              throws java.lang.Exception
Update indicated field (and index) value to the db export builder. fieldIndex can be set to zero for non-repeat fields.

Throws:
java.lang.Exception

restoreOriginal

public void restoreOriginal(java.lang.Object restoreObj,
                            int start,
                            int end)
                     throws java.lang.Exception
restore original values from the start to end fields

Specified by:
restoreOriginal in class PdccObject
Throws:
java.lang.Exception

numberOfChildren

public int numberOfChildren()
                     throws java.lang.Exception
return the number of child objects associated with this object

Specified by:
numberOfChildren in class PdccObject
Throws:
java.lang.Exception

getChild

public PdccObject getChild(int index,
                           int currentNumberOfChildren)
                    throws java.lang.Exception
return a PdccObject child of the current object at index makes a new PdccObject at that index if one does not already exist

Parameters:
index - index of child to return
currentNumberOfChildren - the current known number of children attached to this parent
Returns:
PdccObject child of the current object at index OR null if child not present at that index
Throws:
java.lang.Exception

getChildren

public java.util.Vector getChildren()
                             throws java.lang.Exception
return a Vector of child PdccObjects associated with us

Specified by:
getChildren in class PdccObject
Throws:
java.lang.Exception

removeBoundObject

public void removeBoundObject()
                       throws java.lang.Exception
override PdccObject method of the same name...add the facility to mark the associated database record with DELETE.

Overrides:
removeBoundObject in class PdccObject
Throws:
java.lang.Exception

insertGroupRow

public void insertGroupRow(int rowNum,
                           int fromField)
                    throws java.lang.Exception
An editing function that allows insertion of a new row to a repeat group. rowNum counts from 0 as the first row. Having a value less than 0 means that we are adding the first row. implementation of an abstract method.

Specified by:
insertGroupRow in class PdccObject
Throws:
java.lang.Exception

deleteGroupRow

public void deleteGroupRow(int rowNum,
                           int fromField)
                    throws java.lang.Exception
An editing function that allows deletion of a row in a repeat group. rowNum counts from 0 as the first row. Implementation of an abstract method.

Specified by:
deleteGroupRow in class PdccObject
Throws:
java.lang.Exception

refreshTreeModel

public void refreshTreeModel()
send a notification to the tree model that the node represented by this object is in need of a refresh on the display An override of the PdccObject implementation

Overrides:
refreshTreeModel in class PdccObject

getSortField

public int getSortField()
Return the field number to sort objects by, specific response based on Blockette type. Overrides PdccObject implementation. Returns a -1 if there is no specific field.

Overrides:
getSortField in class PdccObject

getSortField

public static int getSortField(int type)
Return the field number to sort objects by, specific response based on Blockette type. Overrides PdccObject implementation. Returns a -1 if there is no specific field.


constructEditPanel

protected edu.iris.dmc.isis.EditPanel constructEditPanel()
Specified by:
constructEditPanel in class PdccObject

releaseEditPanel

protected void releaseEditPanel()
Specified by:
releaseEditPanel in class PdccObject

constructController

protected edu.iris.dmc.isis.ObjectController constructController()
Specified by:
constructController in class PdccObject


brought to you by Incorporated Research Institutions for Seismology
June 29 2006