|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.ibm.commons.iloader.node.DataNode
public class DataNode
As the name suggests this class is the primary component in the DataNode framework. This class is responsible for executing commands to modify the underlying model, and for firing notification of the occurance of such events. This class a long with the IClassDef and ILoader interfaces comprise the major parts of the framework.
IClassDef
,
ILoader
Nested Class Summary | |
---|---|
static class |
DataNode.AttributeComparator
Compares attributes in the model |
static class |
DataNode.Comparator
A comparator used to compare the attributes in the model |
static class |
DataNode.ComputedField
An attribute whose values may or may not have a direct bearing on the underlying model. |
static interface |
DataNode.Factory
A factory object that creates new instances of the supported data type. |
static class |
DataNode.Filter
Allows the client to filter certain values from the model |
protected class |
DataNode.MapTable
Internal attribute table |
Constructor Summary | |
---|---|
DataNode()
Creates a new instance of this class. |
Method Summary | |
---|---|
boolean |
add(java.lang.Object object)
|
boolean |
add(java.lang.Object object,
DataNodeListener exclude)
|
void |
addComputedField(DataNode.ComputedField field)
Adds a computed field to the DataNode. |
void |
addDataNodeListener(DataNodeListener listener)
Add a new listener. |
void |
addDataNodeUpdaterListener(DataNodeUpdaterListener listener)
Adds a DataNodeUpdateListener. |
void |
addDataNodeVetoListener(DataNodeVetoListener listener)
Add a new veto listener. |
boolean |
canDelete()
|
boolean |
canDelete(int index)
|
boolean |
canDeleteAll()
|
boolean |
canEdit()
|
boolean |
canFirst()
Check if the data node can be positionned to the first item. |
boolean |
canInsert()
|
boolean |
canInsert(int index)
|
boolean |
canLast()
Check if the data node current record can be set to the last one. |
boolean |
canNext()
Check if the data node current record can be set to the next one. |
boolean |
canPrev()
Check if the data node current record can be set to the previous one. |
boolean |
canSetCurrentItem(int index)
Check if the system can be set to a specific item. |
java.lang.Object |
createObject()
|
java.lang.Object |
createObject(java.lang.String namespaceUri,
java.lang.String className)
|
boolean |
delete()
|
boolean |
delete(int[] indexes,
DataNodeListener exclude)
Delete a list of items in the datanode. |
boolean |
delete(int index,
DataNodeListener exclude)
|
boolean |
deleteAll()
|
boolean |
deleteAll(DataNodeListener exclude)
Delete all items in the datanode. |
boolean |
doCanDeleteAll()
|
protected boolean |
doEdit()
|
boolean |
edit(IEditor editor)
|
boolean |
first()
Set the new current record to the first one. |
boolean |
flush(boolean force)
|
IClassDef |
getClassDef()
Returns the IClassDef associated with the current model. |
DataNode.Comparator |
getComparator()
Returns an attribute comparator for the data node. |
java.util.ArrayList<DataNode.ComputedField> |
getComputedFields()
Returns all of the computed fields associated with this DataNode. |
java.lang.Object |
getCurrentObject()
Get the current object. |
int |
getCurrentRow()
Get the current item index. |
DataChangeNotifier |
getDataChangeNotifier()
Returns the DataChangeNotifer for the current DataNode |
IObjectCollection |
getDataProvider()
Returns a direct link to the model that the DataNode is operating on. |
int |
getDefaultCurrentRow()
Get the default index when the node is reset. |
DataNode.Factory |
getFactory()
Returns the factory associated with the current DataNode, may be null. |
DataNode.Filter |
getFilter()
Returns the DataNode filter, may be null. |
ILoader |
getLoader()
Returns the ILoader for the current model. |
protected DataNode.MapTable |
getMapTable()
|
IMember |
getMember(java.lang.String name)
Returns the property (member) with the given name. |
java.util.Iterator<IMember> |
getMembers()
Returns all of the properties of the IClassDef plus any extra ComputedFields that have been added to the DataNode via addComputedField(ComputedField) . |
java.lang.Object |
getObject(int index)
Returns the object at the given index. |
java.lang.Object |
getObject(java.lang.Object instance,
IAttribute attribute)
Returns an object based on a given attribute and model. |
IObjectCollection |
getObjectCollection(java.lang.Object instance,
ICollection collection)
Returns an object collection for the given property. |
int |
getObjectCount()
Get the number of available items. |
DataNode |
getParentNode()
Get the parent node. |
DataNode |
getRootNode()
Get the root node. |
java.lang.String |
getValue(IAttribute attribute)
Returns the value of the given attribute. |
java.lang.String |
getValue(int index,
IAttribute attribute)
Returns the value of the requested attribute at the requested index. |
java.lang.String |
getValue(java.lang.Object instance,
IAttribute attribute)
Returns the value of the given attribute in the provided model. |
IValueCollection |
getValueCollection(java.lang.Object instance,
ICollection collection)
Returns a value collection for a particular complex property. |
protected void |
initMapTable()
|
boolean |
insert(int index,
java.lang.Object object)
|
boolean |
insert(int index,
java.lang.Object object,
DataNodeListener exclude)
|
boolean |
isAutoInsert()
Indicate if the data is in auto insert mode. |
boolean |
isCurrent(int row)
Check if a row is the current one. |
boolean |
isModelModified()
Check if the current row had been modified. |
boolean |
isNotifyListeners()
Indicates if the listeners must be notified of events. |
boolean |
isReadOnly()
Indicate if the data is in read-only mode. |
boolean |
isValidData()
Check if the current item can be accessed safetly for reading. |
boolean |
isValidData(int index)
Check if an item can be accessed safetly for reading. |
boolean |
isValidMetaData()
Check if an the datanode has a valid meta data. |
boolean |
isValidState()
Returns if the DataNode is in a valid state. |
boolean |
last()
Set the new current record to the last one. |
void |
linkTo(DataNodeBinding parent,
java.lang.String propertyName)
Link to a parent node. |
int |
logicalToPhysical(int index)
|
boolean |
next()
Set the new current record to the next one. |
boolean |
notifyCanDelete(int index)
|
boolean |
notifyCanDeleteAll()
|
boolean |
notifyCanEdit()
|
boolean |
notifyCanInsert(int index)
|
boolean |
notifyCanSetCurrentItem(int newItem)
|
boolean |
notifyCanSetValue(java.lang.String attributeName,
java.lang.String value,
java.lang.String oldValue)
|
void |
notifyCurrentChanged(DataNodeListener exclude)
|
void |
notifyInvalidate(DataNodeListener exclude)
|
void |
notifyItemInserted(int pos,
DataNodeListener exclude)
|
void |
notifyItemRemoved(int pos,
DataNodeListener exclude)
|
void |
notifyMetaDataChanged(DataNodeListener exclude)
|
void |
notifyModifiedChanged(DataNodeListener exclude)
|
void |
notifyReadOnlyChanged(DataNodeListener exclude)
|
void |
notifyUserNotification(java.lang.String key,
java.lang.Object param,
DataNodeListener exclude)
|
void |
notifyValueChanged(int record,
java.lang.Object object,
IMember member,
DataNodeListener exclude)
|
int |
physicalToLogical(int index)
|
boolean |
prev()
Set the new current record to the previous one. |
void |
removeComputedField(DataNode.ComputedField field)
Removes a computed field from the DataNode. |
void |
removeDataNodeListener(DataNodeListener listener)
Remove an existing listener. |
void |
removeDataNodeUpdaterListener(DataNodeUpdaterListener listener)
Removes the model listener. |
void |
removeDataNodeVetoListener(DataNodeVetoListener listener)
Remove an existing veto listener. |
void |
resetCurrentRow()
Notify listeners that the current items have changed. |
void |
resetData()
Completely reset the data node. |
void |
resetRow(int row)
Notify listeners that a specific row have changed. |
void |
setAutoInsert(boolean autoInsert)
Change the autoInsert mode. |
void |
setClassDef(IClassDef classDef)
Sets the IClassDef associated with the current DataNode. |
void |
setComparator(DataNode.Comparator comparator)
Sets an attribute comparator for the data node. |
boolean |
setCurrentRow(int newCurrent,
DataNodeListener exclude)
Set the current item index. |
void |
setDataChangeNotifier(DataChangeNotifier notifier)
Sets the DataChangeNotifier for the current DataNode. |
void |
setDataProvider(IObjectCollection dataProvider)
Sets the data model that the DataNode operates on. |
void |
setDefaultCurrentItem(int index)
Set the default static current item. |
void |
setFactory(DataNode.Factory factory)
Sets a Factory object to be used in conjunction with this DataNode. |
void |
setFilter(DataNode.Filter filter)
Sets a filter on the DataNode. |
void |
setModelModified(boolean modified)
Sets the modified flag. |
void |
setNotifyListeners(boolean notifyListeners)
|
void |
setObject(java.lang.Object instance,
IAttribute attribute,
java.lang.Object value,
DataChangeNotifier notifier)
Sets an object value for a particular property in the model. |
void |
setReadOnly(boolean readOnly)
Set the read-only mode. |
boolean |
setValue(IAttribute attribute,
java.lang.String value,
DataNodeListener exclude)
Sets the given value in the given attribute. |
boolean |
setValue(int index,
IAttribute attribute,
java.lang.String value,
DataNodeListener exclude)
Sets the value of a given attribute at a given index in the model. |
void |
setValue(java.lang.Object instance,
IAttribute attribute,
java.lang.String value,
DataChangeNotifier notifier)
Sets the value of the given attribute, with the given value. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DataNode()
Method Detail |
---|
public boolean isReadOnly()
public void setReadOnly(boolean readOnly)
com.ibm.commons.iloader.node.DataNodeListener#onReadOnlyChanged(DataNode)
to be fired.
readonly
- the read-only modepublic boolean isAutoInsert()
public void setAutoInsert(boolean autoInsert)
autoInsert
- the new auto insert modepublic boolean isModelModified()
public void setModelModified(boolean modified)
modified
- the new modified statepublic ILoader getLoader()
public IClassDef getClassDef()
public void setClassDef(IClassDef classDef)
com.ibm.commons.iloader.node.DataNodeListener.onMetaDataChanged(DataNode)
event to be fired.
classDef
- the new IClassDef that is to be associated with the DataNodepublic java.util.Iterator<IMember> getMembers()
addComputedField(ComputedField)
.
public IMember getMember(java.lang.String name)
name
- the name of the property being sought
public java.lang.String getValue(java.lang.Object instance, IAttribute attribute) throws com.ibm.commons.iloader.node.NodeException
instance
- the modelattribute
- the property whose value is sought
NodeException
public void setValue(java.lang.Object instance, IAttribute attribute, java.lang.String value, DataChangeNotifier notifier) throws com.ibm.commons.iloader.node.NodeException
instance
- the modelattribute
- the attribute that is to be updatedvalue
- the new value to set in the attributenotifier
- the notifier that is to notify listeners of the change
NodeException
public java.lang.Object getObject(java.lang.Object instance, IAttribute attribute) throws com.ibm.commons.iloader.node.NodeException
instance
- the modelattribute
- the attributes whose value/object is requested.
NodeException
public void setObject(java.lang.Object instance, IAttribute attribute, java.lang.Object value, DataChangeNotifier notifier) throws com.ibm.commons.iloader.node.NodeException
instance
- the modelattribute
- the property whose object value is to be setvalue
- the object value to setnotifier
- a notifier who will notify listeners of the change.
NodeException
public IValueCollection getValueCollection(java.lang.Object instance, ICollection collection) throws com.ibm.commons.iloader.node.NodeException
instance
- the modelcollection
- the property whose value is sought
NodeException
public IObjectCollection getObjectCollection(java.lang.Object instance, ICollection collection) throws com.ibm.commons.iloader.node.NodeException
instance
- the modelcollection
- the property whose object value is sought
NodeException
public DataNode.Factory getFactory()
public void setFactory(DataNode.Factory factory)
factory
- public void addComputedField(DataNode.ComputedField field)
field
- the computed field to be addedpublic java.util.ArrayList<DataNode.ComputedField> getComputedFields()
public void removeComputedField(DataNode.ComputedField field)
field
- public IObjectCollection getDataProvider()
public void setDataProvider(IObjectCollection dataProvider)
com.ibm.commons.iloader.node.DataNode.setClassDef(IClassDef)
should be called after calling this method to ensure that the DataNode is propertly initialized.
dataProvider
- an object that will provide data to the DataNodepublic boolean isValidState()
getClassDef()
must return a non-null
value, the resulting IClassDef.getLoader()
must return a non-null value and getDataProvider()
must
return a non-null value.
public int getObjectCount()
public java.lang.Object getObject(int index)
index
- the index of the item being sought
public int getCurrentRow()
public final java.lang.Object getCurrentObject()
public boolean isCurrent(int row)
record
- the record number to check
public java.lang.String getValue(int index, IAttribute attribute) throws com.ibm.commons.iloader.node.NodeException
index
- the desired indexattribute
- the attribute to lookup
NodeException
public java.lang.String getValue(IAttribute attribute) throws com.ibm.commons.iloader.node.NodeException
attribute
- the attribute to lookup
NodeException
public final boolean setValue(int index, IAttribute attribute, java.lang.String value, DataNodeListener exclude) throws com.ibm.commons.iloader.node.NodeException
index
- the index of the attribute to setattribute
- the attribute to setvalue
- the value the attribute toexclude
- the DataNodeLister to exclue from the event notification
NodeException
public final boolean setValue(IAttribute attribute, java.lang.String value, DataNodeListener exclude) throws com.ibm.commons.iloader.node.NodeException
attribute
- the attribute whose value we want to setvalue
- the new value of the attributeexclude
- a DataNodeListener that should be excluded for the event notificatio
NodeException
public final int logicalToPhysical(int index)
public final int physicalToLogical(int index)
public DataNode.Filter getFilter()
public void setFilter(DataNode.Filter filter)
filter
- public DataNode.Comparator getComparator()
public void setComparator(DataNode.Comparator comparator)
protected void initMapTable()
protected final DataNode.MapTable getMapTable()
public final DataNode getRootNode()
public final void linkTo(DataNodeBinding parent, java.lang.String propertyName)
public DataChangeNotifier getDataChangeNotifier()
public void setDataChangeNotifier(DataChangeNotifier notifier)
notifier
- public DataNode getParentNode()
public void addDataNodeListener(DataNodeListener listener)
listener
- the listener to addpublic void removeDataNodeListener(DataNodeListener listener)
listener
- the listener to removepublic void addDataNodeVetoListener(DataNodeVetoListener listener)
listener
- the listener to addpublic void removeDataNodeVetoListener(DataNodeVetoListener listener)
listener
- the listener to removepublic void addDataNodeUpdaterListener(DataNodeUpdaterListener listener)
listener
- the listener to addpublic void removeDataNodeUpdaterListener(DataNodeUpdaterListener listener)
listener
- the listener to removepublic boolean setCurrentRow(int newCurrent, DataNodeListener exclude) throws com.ibm.commons.iloader.node.NodeException
newCurrent
- the new logical current indexexclude
- a listener that will not be notified of the change
com.ibm.commons.iloader.node.NodeException
public void resetData()
public void resetRow(int row)
public void resetCurrentRow()
public int getDefaultCurrentRow()
public void setDefaultCurrentItem(int index)
index
- the current item indexpublic boolean canSetCurrentItem(int index)
public final boolean canFirst()
public final boolean canPrev()
public final boolean canNext()
public final boolean canLast()
public final boolean first() throws com.ibm.commons.iloader.node.NodeException
com.ibm.commons.iloader.node.NodeException
public final boolean prev() throws com.ibm.commons.iloader.node.NodeException
com.ibm.commons.iloader.node.NodeException
public final boolean next() throws com.ibm.commons.iloader.node.NodeException
com.ibm.commons.iloader.node.NodeException
public final boolean last() throws com.ibm.commons.iloader.node.NodeException
com.ibm.commons.iloader.node.NodeException
public final boolean flush(boolean force) throws com.ibm.commons.iloader.node.NodeException
com.ibm.commons.iloader.node.NodeException
public final boolean canEdit()
public final boolean edit(IEditor editor) throws com.ibm.commons.iloader.node.NodeException
com.ibm.commons.iloader.node.NodeException
protected boolean doEdit()
public final boolean canInsert(int index)
public final boolean canInsert()
public final boolean insert(int index, java.lang.Object object, DataNodeListener exclude) throws com.ibm.commons.iloader.node.NodeException
com.ibm.commons.iloader.node.NodeException
public final boolean insert(int index, java.lang.Object object) throws com.ibm.commons.iloader.node.NodeException
com.ibm.commons.iloader.node.NodeException
public final boolean add(java.lang.Object object, DataNodeListener exclude) throws com.ibm.commons.iloader.node.NodeException
com.ibm.commons.iloader.node.NodeException
public final boolean add(java.lang.Object object) throws com.ibm.commons.iloader.node.NodeException
com.ibm.commons.iloader.node.NodeException
public final java.lang.Object createObject() throws com.ibm.commons.iloader.node.NodeException
com.ibm.commons.iloader.node.NodeException
public final java.lang.Object createObject(java.lang.String namespaceUri, java.lang.String className) throws com.ibm.commons.iloader.node.NodeException
com.ibm.commons.iloader.node.NodeException
public final boolean canDelete(int index)
public final boolean canDelete()
public final boolean delete(int index, DataNodeListener exclude) throws com.ibm.commons.iloader.node.NodeException
com.ibm.commons.iloader.node.NodeException
public final boolean delete() throws com.ibm.commons.iloader.node.NodeException
com.ibm.commons.iloader.node.NodeException
public final boolean canDeleteAll()
public boolean doCanDeleteAll()
public boolean deleteAll(DataNodeListener exclude) throws com.ibm.commons.iloader.node.NodeException
com.ibm.commons.iloader.node.NodeException
public boolean deleteAll() throws com.ibm.commons.iloader.node.NodeException
com.ibm.commons.iloader.node.NodeException
public boolean delete(int[] indexes, DataNodeListener exclude) throws com.ibm.commons.iloader.node.NodeException
com.ibm.commons.iloader.node.NodeException
public boolean isValidMetaData()
public boolean isValidData(int index)
public boolean isValidData()
public boolean isNotifyListeners()
public void setNotifyListeners(boolean notifyListeners)
public void notifyMetaDataChanged(DataNodeListener exclude)
public void notifyModifiedChanged(DataNodeListener exclude)
public void notifyReadOnlyChanged(DataNodeListener exclude)
public void notifyInvalidate(DataNodeListener exclude)
public void notifyCurrentChanged(DataNodeListener exclude)
public void notifyValueChanged(int record, java.lang.Object object, IMember member, DataNodeListener exclude)
public void notifyItemInserted(int pos, DataNodeListener exclude)
public void notifyItemRemoved(int pos, DataNodeListener exclude)
public void notifyUserNotification(java.lang.String key, java.lang.Object param, DataNodeListener exclude)
public boolean notifyCanSetCurrentItem(int newItem)
public boolean notifyCanSetValue(java.lang.String attributeName, java.lang.String value, java.lang.String oldValue)
public boolean notifyCanEdit()
public boolean notifyCanInsert(int index)
public boolean notifyCanDelete(int index)
public boolean notifyCanDeleteAll()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |