org.formaria.editor.data.pojo
Class PojoModelVis

java.lang.Object
  extended by org.formaria.aria.data.DataModel
      extended by org.formaria.editor.data.pojo.PojoModelVis
All Implemented Interfaces:
ModelVis, TreeNodeCaption
Direct Known Subclasses:
PojoMethodArg, PojoMethodArgs, PojoModelEx

public abstract class PojoModelVis
extends DataModel
implements TreeNodeCaption, ModelVis

An abstract class representing design-time pojo model (for use by "data visualiser")

Copyright (c) Formaria Ltd., 2001-2007, 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.


Field Summary
protected  PojoAdapterEx adapter
           
static int ATTRIB_COMBO
           
static int ATTRIB_FREETEXT
           
static int ATTRIB_NEDITABLE
           
protected  PojoDataSourceEx dataSource
           
protected  java.lang.Class[] getterSig
           
protected  int hashcode
           
static int ID_ATTRIBUTE
           
protected  java.lang.String idAttrib
           
static int NUM_FIXED_ATTRIBUTE
           
protected  java.lang.Object pojo
           
protected  java.lang.Class pojoClass
           
protected  PojoModelVis[] pojoCollection
           
protected  java.lang.reflect.Method pojoGetter
           
protected  java.lang.reflect.Method pojoSetter
           
protected  java.lang.Class[] setterSig
           
static int VALUE_ATTRIBUTE
           
protected  java.lang.String valueAttrib
           
 
Fields inherited from class org.formaria.aria.data.DataModel
parentModel, tagName
 
Constructor Summary
PojoModelVis(DataModel pr, java.lang.Class clazz, PojoDataSourceEx ds)
          Creates a new instance of PojoModelVis
PojoModelVis(DataModel pr, java.lang.reflect.Method gtr, java.lang.reflect.Method str, PojoDataSourceEx ds)
          Creates a new instance of PojoModelVis class.
PojoModelVis(DataModel pr, java.lang.Object pj, PojoDataSourceEx ds)
          Creates a new instance of PojoModelVis
PojoModelVis(DataModel pr, PojoDataSourceEx ds)
          Creates a new instance of PojoModelVis class.
 
Method Summary
 void append(DataModel xModel)
          Append a node
 java.lang.Object append(java.lang.String string)
          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
 PojoAdapterEx getAdapter()
          Gets the adapter of this model node
 java.lang.String[] getAttribAvailableValues(int i)
           
 java.lang.String getAttribName(int i)
          Retrieve the name of the attribute at the specified index
 boolean getAttribRuntime(int i)
          Indicates whether the attribute will be available in the run-time mode.
 int getAttribType(int i)
           
 int getAttribute(java.lang.String string)
          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)
          Retrieve the value of the attribute at the specified index, convert it to a double and return it.
 double getAttribValueAsDouble(int i, char c, char c0)
          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.util.Vector getBindingAttributes()
          Gest the binding attributes that this model node can provide.
 java.lang.String getBindingPath()
          Gets the runtime binding path of this model node
 java.lang.String getCaption()
          Gets the visualiser tree caption of this node.
 java.lang.String getId()
          Gets the ID attribute of this node
 int getNumAttributes()
          Gets the number of attributes
 java.lang.Class getPojoClass()
           
 PojoProperties getProperties()
          Gets the properties of the encapsulated POJO
 double getValueAsDouble(java.lang.String string)
          Retrieve the named child, convert it's value to a double and return it.
 int getValueAsInt(java.lang.String string)
          Retrieve the named child, convert it's value to an int and return it.
 java.lang.String getValueAsString(java.lang.String string)
          Retrieve the named child, convert it's value to a String and return it.
 int hashCode()
          The hashcode of this instance.
 boolean isAttribEditable(int i)
           
 boolean isDirty()
          Gets the value of the dirty property
 void set(java.lang.Object obj)
          Sets the model value
 void set(java.lang.String string, java.lang.Object object)
          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 string, java.lang.Object object)
          Sets the attribute name and value
 void setCaption(java.lang.String caption)
          Sets the caption of this node which will be shown in the model visualiser tree.
 void setDirty(boolean state)
          Sets the dirty flag of this model node.
 void setId(java.lang.String newId)
          Sets the ID attribute
protected  void setPojo(java.lang.Object aPojo)
          Sets the underlying pojo of this model node
protected  void setPojoClass(java.lang.Class clazz)
          Sets the type of the underlying pojo.
protected  void setPojoGetter(java.lang.reflect.Method aMethod)
          Sets the method being used to obtain the pojo of this node.
protected  void setPojoSetter(java.lang.reflect.Method aMethod)
          Sets the method being used to set the pojo of this node
 
Methods inherited from class org.formaria.aria.data.DataModel
addModelListener, clear, fireModelUpdated, get, getNumChildren, getParent, getTagName, hasAutoId, hasAutoId, prefixOutputPath, removeChildren, reset, resetAttributes, setNumAttributes, setNumChildren, setParent, setTagName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ATTRIB_NEDITABLE

public static final int ATTRIB_NEDITABLE
See Also:
Constant Field Values

ATTRIB_COMBO

public static final int ATTRIB_COMBO
See Also:
Constant Field Values

ATTRIB_FREETEXT

public static final int ATTRIB_FREETEXT
See Also:
Constant Field Values

ID_ATTRIBUTE

public static final int ID_ATTRIBUTE
See Also:
Constant Field Values

VALUE_ATTRIBUTE

public static final int VALUE_ATTRIBUTE
See Also:
Constant Field Values

NUM_FIXED_ATTRIBUTE

public static final int NUM_FIXED_ATTRIBUTE
See Also:
Constant Field Values

hashcode

protected volatile int hashcode

idAttrib

protected java.lang.String idAttrib

valueAttrib

protected java.lang.String valueAttrib

dataSource

protected PojoDataSourceEx dataSource

pojo

protected java.lang.Object pojo

pojoCollection

protected PojoModelVis[] pojoCollection

pojoClass

protected java.lang.Class pojoClass

pojoGetter

protected java.lang.reflect.Method pojoGetter

getterSig

protected java.lang.Class[] getterSig

pojoSetter

protected java.lang.reflect.Method pojoSetter

setterSig

protected java.lang.Class[] setterSig

adapter

protected PojoAdapterEx adapter
Constructor Detail

PojoModelVis

public PojoModelVis(DataModel pr,
                    java.lang.Object pj,
                    PojoDataSourceEx ds)
Creates a new instance of PojoModelVis

Parameters:
pr - the parent model node.
pojo - Object being wrapped by this model node.
ds - the data source object.

PojoModelVis

public PojoModelVis(DataModel pr,
                    java.lang.reflect.Method gtr,
                    java.lang.reflect.Method str,
                    PojoDataSourceEx ds)
Creates a new instance of PojoModelVis class.

Parameters:
pr - the parent mode node
mth - the getter method being used to obtain the pojo to be wrapped by this model node.
ds - the data source object.

PojoModelVis

public PojoModelVis(DataModel pr,
                    java.lang.Class clazz,
                    PojoDataSourceEx ds)
Creates a new instance of PojoModelVis

Parameters:
pr - the parent model node
clazz - the type of the underlying pojo.
ds - the data source object.

PojoModelVis

public PojoModelVis(DataModel pr,
                    PojoDataSourceEx ds)
Creates a new instance of PojoModelVis class.

Parameters:
pr - the parent model node
Method Detail

getProperties

public PojoProperties getProperties()
Gets the properties of the encapsulated POJO

Returns:
PojoProperties object

setPojo

protected void setPojo(java.lang.Object aPojo)
Sets the underlying pojo of this model node

Parameters:
aPojo - the new pojo

getAdapter

public PojoAdapterEx getAdapter()
Gets the adapter of this model node

Returns:
the adapter

setPojoGetter

protected void setPojoGetter(java.lang.reflect.Method aMethod)
Sets the method being used to obtain the pojo of this node.

Parameters:
aMethod - the getter method

setPojoSetter

protected void setPojoSetter(java.lang.reflect.Method aMethod)
Sets the method being used to set the pojo of this node

Parameters:
aMethod - the setter

setPojoClass

protected void setPojoClass(java.lang.Class clazz)
Sets the type of the underlying pojo.

Parameters:
clazz - the type of the underlying pojo

getPojoClass

public java.lang.Class getPojoClass()

setDirty

public void setDirty(boolean state)
Sets the dirty flag of this model node.

Parameters:
state - the new value of the dirty flag

isDirty

public boolean isDirty()
Gets the value of the dirty property


getBindingPath

public java.lang.String getBindingPath()
Gets the runtime binding path of this model node

Specified by:
getBindingPath in interface ModelVis
Returns:
the runtime binding path

getCaption

public java.lang.String getCaption()
Gets the visualiser tree caption of this node.

Specified by:
getCaption in interface TreeNodeCaption
Returns:
the caption.

setCaption

public void setCaption(java.lang.String caption)
Sets the caption of this node which will be shown in the model visualiser tree.

Specified by:
setCaption in interface TreeNodeCaption
Parameters:
caption - the caption to be set

getId

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

Specified by:
getId in class DataModel
Returns:
the id

setId

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

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

getNumAttributes

public int getNumAttributes()
Gets the number of attributes

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

getAttribName

public java.lang.String getAttribName(int i)
Description copied from class: DataModel
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

getAttribValue

public java.lang.Object getAttribValue(int i)
Description copied from class: DataModel
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

getAttribValueAsString

public java.lang.String getAttribValueAsString(int i)
Description copied from class: DataModel
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

hashCode

public int hashCode()
The hashcode of this instance. Based on the ID String

Specified by:
hashCode in class DataModel
Returns:
The hashcode of this instance

getBindingAttributes

public java.util.Vector getBindingAttributes()
Gest the binding attributes that this model node can provide. By default this method returns an empty Vector object.

Specified by:
getBindingAttributes in interface ModelVis
Returns:
Vector containing binding attributes.

set

public void set(java.lang.String string,
                java.lang.Object object)
Description copied from class: DataModel
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:
string - The path to the DataModel in the format 'base/foo
object - The new value of the DataModel

getAttribute

public int getAttribute(java.lang.String string)
Description copied from class: DataModel
returns the index of the attribiteNames array whose value is the same as the attribName

Specified by:
getAttribute in class DataModel
Parameters:
string - 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.String string,
                           java.lang.Object object)
Description copied from class: DataModel
Sets the attribute name and value

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

get

public java.lang.Object get()
Description copied from class: DataModel
gets the value attribute

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

getAttribValueAsDouble

public double getAttribValueAsDouble(int i)
Description copied from class: DataModel
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 c,
                                     char c0)
Description copied from class: DataModel
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
c - the decimal separator
c0 - the grouping (thousands) separator
Returns:
The double value of the attributeValues array at position i

getAttribValueAsInt

public int getAttribValueAsInt(int i)
Description copied from class: DataModel
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 string)
Description copied from class: DataModel
Retrieve the named child, convert it's value to a double and return it.

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

getValueAsInt

public int getValueAsInt(java.lang.String string)
Description copied from class: DataModel
Retrieve the named child, convert it's value to an int and return it.

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

getValueAsString

public java.lang.String getValueAsString(java.lang.String string)
Description copied from class: DataModel
Retrieve the named child, convert it's value to a String and return it.

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

append

public void append(DataModel xModel)
Description copied from class: DataModel
Append a node

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

append

public java.lang.Object append(java.lang.String string)
Description copied from class: DataModel
Append a new node with the specified name. This method does not replace any existing nodes.

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

get

public DataModel get(int i)
Description copied from class: DataModel
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

set

public void set(java.lang.Object obj)
Description copied from class: DataModel
Sets the model value

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

getAttribRuntime

public boolean getAttribRuntime(int i)
Indicates whether the attribute will be available in the run-time mode.

Parameters:
i - the index of the attribute
Returns:
true if the attribute will be available in the runtime mode, false otherwise

getAttribType

public int getAttribType(int i)

getAttribAvailableValues

public java.lang.String[] getAttribAvailableValues(int i)

isAttribEditable

public boolean isAttribEditable(int i)

setAttribValue

public void setAttribValue(int i,
                           java.lang.Object value)
Description copied from class: DataModel
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