org.formaria.editor.netbeans.visualizer
Class NbDebuggerModel

java.lang.Object
  extended by org.formaria.aria.data.DataModel
      extended by org.formaria.editor.visualizer.VisualiserDebuggerModel
          extended by org.formaria.editor.netbeans.visualizer.NbDebuggerModel

public class NbDebuggerModel
extends VisualiserDebuggerModel

A wrapper for the debugger node.

Copyright (c) Formaria Ltd., 2001-2006, This software is licensed under the GNU Public License (GPL), please see license.txt for more details. If you make commercial use of this software you must purchase a commercial license from Formaria.

$Revision: 1.9 $


Field Summary
 
Fields inherited from class org.formaria.aria.data.DataModel
parentModel, tagName
 
Constructor Summary
NbDebuggerModel(JPDADebugger jpdaDebugger, ObjectVariable objVar)
          Creates a new instance of JPDAModelNode
 
Method Summary
 void append(DataModel childNode)
          Append a node
 java.lang.Object append(java.lang.String elementName)
          Append a new node with the specified name.
 java.lang.Object get()
          gets the value attribute
 DataModel get(int i)
          Get the DataModel at element i
 java.lang.Object get(java.lang.String element)
          Get the value of the element located at the path in the element parameter If the attribName parameter is not null we get the value of the attributeValues
 java.lang.String getAttribName(int i)
          Retrieve the name of the attribute at the specified index
 int getAttribute(java.lang.String attribName)
          Returns the index of the attribiteNames array whose value is the same as the attribName
 java.lang.Object getAttribValue(int i)
          Retrieve the value of the attribute at the specified index and return it.
 double getAttribValueAsDouble(int i)
          Deprecated. use getAttribValueAsDouble( i, decimalSeparator, groupingSeparator ) instead, if the locale is different from the locale used to write the values to the model, then the parsed value may be incorrect.
 double getAttribValueAsDouble(int i, char decimalSeparator, char groupingSeparator)
          Convert the attribute at the specified index to a double and return it
 int getAttribValueAsInt(int i)
          Retrieve the value of the attribute at the specified index, convert it to an int and return it.
 java.lang.String getAttribValueAsString(int i)
          Retrieve the value of the attribute at the specified index, convert it to a String and return it.
 java.lang.String getId()
          Gets the value of the ID attribute
 java.lang.String getNodeString()
          Calls the getToStringValue() method on the encapsulated object and returns its value.
 int getNumAttributes()
          Gets the number of attributes of this node
 int getNumChildren()
          Gets the number of immediate children of this node
 DataModel getParent()
          retrieve the parent DataModel of this DataModel instance
 java.lang.String getTagName()
          Gets the model element tag name, e.g.
 double getValueAsDouble(java.lang.String elementName)
          Retrieve the named child, convert it's value to a double and return it.
 int getValueAsInt(java.lang.String elementName)
          Retrieve the named child, convert it's value to an int and return it.
 java.lang.String getValueAsString(java.lang.String elementName)
          Retrieve the named child, convert it's value to a String and return it.
 boolean hasAutoId()
          Determine if there is no id set for this model in the datasource
 void hasAutoId(boolean b)
          Used for elements which need a name assigned temporarily because one doesn't exist in the DataSource.
 int hashCode()
          Get a hash code for the node.
 void insertChildAt(DataModel newNode, int idx)
          Insert a node at a specified index in the list of children
 void removeChild(DataModel childNode)
          Remove a child node
 void removeChild(java.lang.String name)
          Remove a child
 DataModel reset()
          Reset the whole model, giving a new root node and a new hierarchy 'deprecated since 1.0.3
 void set(java.lang.Object s)
          Sets the model value
 void set(java.lang.String elementName, java.lang.Object newObject)
          Set the named attribute value of this DataModel node.
 void setAttribValue(int i, java.lang.Object value)
          Sets the attribute value
 void setAttribValue(int i, java.lang.String attribName, java.lang.Object value)
          Sets the attribute name and value
 void setId(java.lang.String newId)
          Sets the ID attribute
 void setNumChildren(int num)
          Set the number of children of this node
 void setObjectVariable(DataModel node)
           
 void setTagName(java.lang.String name)
          Sets the model element tag name, e.g.
 
Methods inherited from class org.formaria.aria.data.DataModel
addModelListener, clear, fireModelUpdated, prefixOutputPath, removeChildren, reset, resetAttributes, setNumAttributes, setParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NbDebuggerModel

public NbDebuggerModel(JPDADebugger jpdaDebugger,
                       ObjectVariable objVar)
Creates a new instance of JPDAModelNode

Method Detail

getNodeString

public java.lang.String getNodeString()
Calls the getToStringValue() method on the encapsulated object and returns its value. This method is used to determine class which instance is wrapped by JPDAModelNode object.

Specified by:
getNodeString in class VisualiserDebuggerModel
Returns:
String containing name of the wrapped class.

setObjectVariable

public void setObjectVariable(DataModel node)

reset

public DataModel reset()
Reset the whole model, giving a new root node and a new hierarchy 'deprecated since 1.0.3

Returns:
The base model

setTagName

public void setTagName(java.lang.String name)
Description copied from class: DataModel
Sets the model element tag name, e.g. 'Component' from the XML fragment
Overrides:
setTagName in class DataModel
Parameters:
name - Set the name of the tag which should be set when outputting the DataModel

getTagName

public java.lang.String getTagName()
Gets the model element tag name, e.g. 'Component' from the XML fragment
Overrides:
getTagName in class DataModel
Returns:
the model name

hasAutoId

public boolean hasAutoId()
Determine if there is no id set for this model in the datasource

Overrides:
hasAutoId in class DataModel
Returns:
true if there was no name for the element in the DataSource, an example of this is the annonymouse nodes used to represent the record of a table e.g. ......

getId

public java.lang.String getId()
Gets the value of the ID attribute

Specified by:
getId in class DataModel
Returns:
the ID attribute

setId

public void setId(java.lang.String newId)
Sets the ID attribute

Overrides:
setId in class DataModel
Parameters:
newId - the new name

get

public java.lang.Object get(java.lang.String element)
Get the value of the element located at the path in the element parameter If the attribName parameter is not null we get the value of the attributeValues

Overrides:
get in class DataModel
Parameters:
element - The path to the DataModel we require
Returns:
The value of the DataModel or the attribute

set

public void set(java.lang.String elementName,
                java.lang.Object newObject)
Set the named attribute value of this DataModel node. If the attribName is null then this node's value is updated.

Specified by:
set in class DataModel
Parameters:
elementName - The path to the DataModel in the format 'base/foo
newObject - The new value of the DataModel

getAttribute

public int getAttribute(java.lang.String attribName)
Returns the index of the attribiteNames array whose value is the same as the attribName

Specified by:
getAttribute in class DataModel
Parameters:
attribName - The name of the attribute we are trying to locate
Returns:
The index of the attributeNames array containg the name

setAttribValue

public void setAttribValue(int i,
                           java.lang.Object value)
Sets the attribute value

Specified by:
setAttribValue in class DataModel
Parameters:
i - The index of the attributeValues array whose value we want
value - the value object

setAttribValue

public void setAttribValue(int i,
                           java.lang.String attribName,
                           java.lang.Object value)
Sets the attribute name and value

Specified by:
setAttribValue in class DataModel
Parameters:
i - The index of the attributeValues array whose value we want
attribName - the name of the attribute
value - the value object

get

public DataModel get(int i)
Get the DataModel at element i

Specified by:
get in class DataModel
Parameters:
i - The index of the values array
Returns:
The DataModel at location i

getParent

public DataModel getParent()
retrieve the parent DataModel of this DataModel instance

Overrides:
getParent in class DataModel
Returns:
The parent DataModel to which this instance belongs

get

public java.lang.Object get()
gets the value attribute

Specified by:
get in class DataModel
Returns:
the value of the model

set

public void set(java.lang.Object s)
Sets the model value

Specified by:
set in class DataModel
Parameters:
s - the new value

hasAutoId

public void hasAutoId(boolean b)
Used for elements which need a name assigned temporarily because one doesn't exist in the DataSource.

Overrides:
hasAutoId in class DataModel
Parameters:
b - true if there was no name in the DataSource

getAttribName

public java.lang.String getAttribName(int i)
Retrieve the name of the attribute at the specified index

Specified by:
getAttribName in class DataModel
Parameters:
i - The index of the attributeNames array whose value we want
Returns:
The string value of the attributeNames array at position i

getAttribValueAsString

public java.lang.String getAttribValueAsString(int i)
Retrieve the value of the attribute at the specified index, convert it to a String and return it.

Specified by:
getAttribValueAsString in class DataModel
Parameters:
i - The index of the attributeValues array whose value we want
Returns:
The string value of the attributeValues array at position i

getAttribValue

public java.lang.Object getAttribValue(int i)
Retrieve the value of the attribute at the specified index and return it.

Specified by:
getAttribValue in class DataModel
Parameters:
i - The index of the attributeValues array whose value we want
Returns:
The string value of the attributeValues array at position i

getAttribValueAsDouble

public double getAttribValueAsDouble(int i)
Deprecated. use getAttribValueAsDouble( i, decimalSeparator, groupingSeparator ) instead, if the locale is different from the locale used to write the values to the model, then the parsed value may be incorrect.

Retrieve the value of the attribute at the specified index, convert it to a double and return it.

Specified by:
getAttribValueAsDouble in class DataModel
Parameters:
i - The index of the attributeValues array whose value we want
Returns:
The double value of the attributeValues array at position i

getAttribValueAsDouble

public double getAttribValueAsDouble(int i,
                                     char decimalSeparator,
                                     char groupingSeparator)
Convert the attribute at the specified index to a double and return it

Specified by:
getAttribValueAsDouble in class DataModel
Parameters:
i - The index of the attributeValues array whose value we want
decimalSeparator - the decimal separator
groupingSeparator - the grouping (thousands) separator
Returns:
The double value of the attributeValues array at position i

getAttribValueAsInt

public int getAttribValueAsInt(int i)
Retrieve the value of the attribute at the specified index, convert it to an int and return it.

Specified by:
getAttribValueAsInt in class DataModel
Parameters:
i - The index of the attributeValues array whose value we want
Returns:
The int value of the attributeValues array at position i

getValueAsDouble

public double getValueAsDouble(java.lang.String elementName)
Retrieve the named child, convert it's value to a double and return it.

Specified by:
getValueAsDouble in class DataModel
Parameters:
elementName - The name of the child whose value is required
Returns:
the value as a double

getValueAsInt

public int getValueAsInt(java.lang.String elementName)
Retrieve the named child, convert it's value to an int and return it.

Specified by:
getValueAsInt in class DataModel
Parameters:
elementName - The name of the child to be retrieved
Returns:
the value as an int

getValueAsString

public java.lang.String getValueAsString(java.lang.String elementName)
Retrieve the named child, convert it's value to a String and return it.

Specified by:
getValueAsString in class DataModel
Parameters:
elementName - The name of the child whose value is required
Returns:
the value as a string

hashCode

public int hashCode()
Get a hash code for the node.

Specified by:
hashCode in class DataModel
Returns:
the node's hash code

getNumChildren

public int getNumChildren()
Gets the number of immediate children of this node

Overrides:
getNumChildren in class DataModel
Returns:
the number of child nodes

getNumAttributes

public int getNumAttributes()
Gets the number of attributes of this node

Overrides:
getNumAttributes in class DataModel
Returns:
the number of attributes

setNumChildren

public void setNumChildren(int num)
Set the number of children of this node

Overrides:
setNumChildren in class DataModel
Parameters:
num - the new number of children

append

public void append(DataModel childNode)
Append a node

Specified by:
append in class DataModel
Parameters:
childNode - the child node

append

public java.lang.Object append(java.lang.String elementName)
Append a new node with the specified name. This method does not replace any existing nodes.

Specified by:
append in class DataModel
Parameters:
elementName - The immediate path to the DataModel required
Returns:
The value of the DataModel or the attribute

removeChild

public void removeChild(java.lang.String name)
Remove a child

Specified by:
removeChild in class VisualiserDebuggerModel
Parameters:
name - the ID or name of the node

removeChild

public void removeChild(DataModel childNode)
Remove a child node

Specified by:
removeChild in class VisualiserDebuggerModel
Parameters:
child - the child to be removed

insertChildAt

public void insertChildAt(DataModel newNode,
                          int idx)
Insert a node at a specified index in the list of children

Parameters:
newNode - the new model node
idx - the index at which to insert