|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.metamatrix.common.tree.basic.BasicTreeNodeEditor
public class BasicTreeNodeEditor
Field Summary |
---|
Fields inherited from interface com.metamatrix.common.object.PropertiedObjectEditor |
---|
NO_VALUE |
Fields inherited from interface com.metamatrix.common.object.PropertyAccessPolicy |
---|
DEFAULT_READ_ONLY_PRIVILEGE |
Constructor Summary | |
---|---|
BasicTreeNodeEditor(ObjectIDFactory idFactory)
Create an empty property definition object with all defaults. |
|
BasicTreeNodeEditor(ObjectIDFactory idFactory,
PropertyAccessPolicy policy)
|
|
BasicTreeNodeEditor(ObjectIDFactory idFactory,
PropertyAccessPolicy policy,
UserTransactionFactory txnFactory)
|
|
BasicTreeNodeEditor(ObjectIDFactory idFactory,
UserTransactionFactory txnFactory)
|
Method Summary | |
---|---|
protected BasicTreeNode |
assertBasicTreeNode(PropertiedObject obj)
|
protected BasicTreeNode |
cloneBasicTreeNode(BasicTreeNode original,
BasicTreeNode newParent,
boolean deep)
|
protected java.lang.Object |
copyPropertyValue(java.lang.Object value)
|
TreeNode |
create(TreeNode parent,
ObjectDefinition type)
Create a new instance of a TreeNode under the specified parent and with the specified type. |
TreeNode |
create(TreeNode parent,
java.lang.String name,
ObjectDefinition type)
Create a new instance of a TreeNode under the specified parent, with the specified type and with the specified name |
UserTransaction |
createReadTransaction()
Create a new instance of a UserTransaction that may be used to read information. |
UserTransaction |
createWriteTransaction()
Create a new instance of a UserTransaction that may be used to write and/or update information. |
UserTransaction |
createWriteTransaction(java.lang.Object source)
Create a new instance of a UserTransaction that may be used to write and/or update information. |
boolean |
delete(TreeNode node)
Removes the specified TreeNode instance (and all its children) from its parent. |
java.util.List |
getAllowedValues(PropertiedObject obj,
PropertyDefinition def)
Get the allowed values for the property on the specified object. |
PropertyDefinition |
getDescriptionPropertyDefinition(TreeNode obj)
Filter the specified PropertyDefinition instances and return the first definition that is mapped to "the description" property for the metadata object. |
PropertyDefinition |
getNamePropertyDefinition(TreeNode obj)
Filter the specified PropertyDefinition instances and return the first definition that is mapped to "the name" property for the tree node. |
PropertyAccessPolicy |
getPolicy()
|
java.util.List |
getPropertyDefinitions(PropertiedObject obj)
Obtain the list of PropertyDefinitions that apply to the specified object's type. |
java.lang.Object |
getValue(PropertiedObject obj,
PropertyDefinition def)
Obtain from the specified PropertiedObject the property value that corresponds to the specified PropertyDefinition. |
boolean |
isAncestorOf(TreeNode ancestor,
TreeNode descendent)
Determine whether the specified node is a descendent of the given ancestor node. |
boolean |
isMarked(TreeNode node)
Return the marked state of the specified node. |
boolean |
isParentOf(TreeNode parent,
TreeNode child)
Determine whether the specified node is a child of the given parent node. |
boolean |
isReadOnly(PropertiedObject obj)
Return whether this editor may be used to set property values on the specified PropertiedObject. |
boolean |
isReadOnly(PropertiedObject obj,
PropertyDefinition def)
|
boolean |
isValidValue(PropertiedObject obj,
PropertyDefinition def,
java.lang.Object value)
Return whether the specified value is considered valid. |
boolean |
move(TreeNode original,
TreeNode newParent)
Moves this TreeNode to be a child of the specified new parent. |
boolean |
move(TreeNode node,
TreeNode newParent,
int indexInNewParent)
Moves this TreeNode to be a child at a particular index in the specified new parent. |
boolean |
moveChild(TreeNode child,
int newIndex)
Moves this TreeNode to the specified location within the ordered list of children for the node's parent. |
TreeNode |
paste(TreeNode original,
TreeNode newParent)
Creates and places a copy of the specified original TreeNode under the specified new parent. |
TreeNode |
paste(TreeNode original,
TreeNode newParent,
boolean deepCopy)
Creates and places a copy of the specified original TreeNode under the specified new parent. |
TreeNode |
paste(TreeNode original,
TreeNode newParent,
boolean deepCopy,
boolean forceCopy)
Creates and places a copy of the specified original TreeNode under the specified new parent. |
boolean |
rename(TreeNode node,
java.lang.String newName)
Renames this MetaObject to the specified new name. |
void |
reset(PropertiedObject obj)
|
void |
setMarked(TreeNode node,
boolean marked)
Set the marked state of the TreeNode node. |
void |
setPolicy(PropertyAccessPolicy policy)
|
void |
setReadOnly(PropertiedObject obj,
boolean readOnly)
|
void |
setReadOnly(PropertiedObject obj,
PropertyDefinition def,
boolean readOnly)
|
void |
setValue(PropertiedObject obj,
PropertyDefinition def,
java.lang.Object value)
Set on the specified PropertiedObject the value defined by the specified PropertyDefinition. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BasicTreeNodeEditor(ObjectIDFactory idFactory, PropertyAccessPolicy policy, UserTransactionFactory txnFactory)
public BasicTreeNodeEditor(ObjectIDFactory idFactory)
public BasicTreeNodeEditor(ObjectIDFactory idFactory, PropertyAccessPolicy policy)
public BasicTreeNodeEditor(ObjectIDFactory idFactory, UserTransactionFactory txnFactory)
Method Detail |
---|
protected BasicTreeNode assertBasicTreeNode(PropertiedObject obj)
public java.util.List getPropertyDefinitions(PropertiedObject obj)
getPropertyDefinitions
in interface PropertiedObjectEditor
obj
- the propertied object for which the PropertyDefinitions are
to be obtained; may not be null
java.lang.AssertionError
- if obj
is nullpublic java.util.List getAllowedValues(PropertiedObject obj, PropertyDefinition def)
getAllowedValues
in interface PropertiedObjectEditor
obj
- the propertied object whose property value is to be obtained;
may not be nulldef
- the reference to the PropertyDefinition describing the
property whose value is to be returned; may not be null
#hasAllowedValues
public java.lang.Object getValue(PropertiedObject obj, PropertyDefinition def)
getValue
in interface PropertiedObjectEditor
obj
- the propertied object whose property value is to be obtained;
may not be nulldef
- the reference to the PropertyDefinition describing the
property whose value is to be returned; may not be null
java.lang.AssertionError
- if either of obj
or def
is nullpublic boolean isValidValue(PropertiedObject obj, PropertyDefinition def, java.lang.Object value)
isValidValue
in interface PropertiedObjectEditor
obj
- the propertied object whose property value is to be validated;
may not be nulldef
- the reference to the PropertyDefinition describing the
property whose value is to be validated; may not be nullvalue
- the proposed value for the property, which may be a collection if
the property is multi-valued, or may be null if the multiplicity
includes "0"
java.lang.AssertionError
- if either of obj
or def
is nullpublic void setValue(PropertiedObject obj, PropertyDefinition def, java.lang.Object value)
setValue
in interface PropertiedObjectEditor
obj
- the propertied object whose property value is to be set;
may not be nulldef
- the reference to the PropertyDefinition describing the
property whose value is to be changed; may not be nullvalue
- the new value for the property; the cardinality and type
must conform PropertyDefinition
java.lang.IllegalArgumentException
- if the value does not correspond
to the PropertyDefinition requirements.
java.lang.AssertionError
- if either of obj
or def
is null
java.lang.RuntimeException
- if attempting to update a read-only value.public PropertyAccessPolicy getPolicy()
getPolicy
in interface PropertiedObjectEditor
public void setPolicy(PropertyAccessPolicy policy)
setPolicy
in interface PropertiedObjectEditor
public boolean isReadOnly(PropertiedObject obj)
PropertiedObjectEditor
isReadOnly
in interface PropertiedObjectEditor
isReadOnly
in interface PropertyAccessPolicy
obj
- the propertied object; may not be null
public boolean isReadOnly(PropertiedObject obj, PropertyDefinition def)
isReadOnly
in interface PropertyAccessPolicy
public void setReadOnly(PropertiedObject obj, PropertyDefinition def, boolean readOnly)
setReadOnly
in interface PropertyAccessPolicy
public void setReadOnly(PropertiedObject obj, boolean readOnly)
setReadOnly
in interface PropertyAccessPolicy
public void reset(PropertiedObject obj)
reset
in interface PropertyAccessPolicy
public UserTransaction createReadTransaction()
createReadTransaction
in interface UserTransactionFactory
public UserTransaction createWriteTransaction()
createWriteTransaction
in interface UserTransactionFactory
public UserTransaction createWriteTransaction(java.lang.Object source)
createWriteTransaction
in interface UserTransactionFactory
source
- the object that is considered to be the source of the transaction;
may be null
public void setMarked(TreeNode node, boolean marked)
setMarked
in interface TreeNodeEditor
marked
- the marked state of the node.public boolean isMarked(TreeNode node)
isMarked
in interface TreeNodeEditor
public boolean isParentOf(TreeNode parent, TreeNode child)
isParentOf
in interface TreeNodeEditor
public boolean isAncestorOf(TreeNode ancestor, TreeNode descendent)
isAncestorOf
in interface TreeNodeEditor
public TreeNode create(TreeNode parent, ObjectDefinition type)
create
in interface TreeNodeEditor
parent
- the MetaObject that is to be the parent of the new metadata objecttype
- the ObjectDefinition instance that defines the type of metadata
object to instantiate.
java.lang.IllegalArgumentException
- if the parent and the new MetaObject
are not compatible
java.lang.AssertionError
- if parent
or type
is nullpublic TreeNode create(TreeNode parent, java.lang.String name, ObjectDefinition type)
create
in interface TreeNodeEditor
parent
- the MetaObject that is to be the parent of the new metadata objectname
- the name for the new objecttype
- the ObjectDefinition instance that defines the type of metadata
object to instantiate.
java.lang.AssertionError
- if parent
or type
is nullpublic boolean delete(TreeNode node)
delete
in interface TreeNodeEditor
obj
- the node to be deleted; may not be null
java.lang.AssertionError
- if obj
is nullpublic TreeNode paste(TreeNode original, TreeNode newParent, boolean deepCopy)
This methods may be used in conjunction with a reference to an existing TreeNode instance in this or another session to copy TreeNode instances and paste them in this session.
paste
in interface TreeNodeEditor
original
- the original node to be copied; may not be nullnewParent
- the nodethat is to be considered the
parent of the newly created instances; may not be nulldeepCopy
- true if this paste operation is to place a deep copy of
original
, or false if only the original
node and its immediate properties are to be pasted.
java.lang.AssertionError
- if either of original
or newParent
is nullpublic TreeNode paste(TreeNode original, TreeNode newParent)
This methods may be used in conjunction with a reference to an existing TreeNode instance in this or another session to copy TreeNode instances and paste them in this session.
original
- the original node to be copied; may not be nullnewParent
- the nodethat is to be considered the
parent of the newly created instances; may not be null
java.lang.AssertionError
- if either of original
or newParent
is nullpublic TreeNode paste(TreeNode original, TreeNode newParent, boolean deepCopy, boolean forceCopy)
This methods may be used in conjunction with a reference to an existing TreeNode instance in this or another session to copy TreeNode instances and paste them in this session.
original
- the original node to be copied; may not be nullnewParent
- the nodethat is to be considered the
parent of the newly created instances; may not be nulldeepCopy
- true if this paste operation is to place a deep copy of
original
, or false if only the original
node and its immediate properties are to be pasted.forceCopy
- if true, ensures that original objects are never reused but always
copied; if false, this method may choose whether to create copies or to reuse the original.
java.lang.AssertionError
- if either of original
or newParent
is nullpublic boolean move(TreeNode original, TreeNode newParent)
This method may be used in conjunction with the delete
method
of an editor from this or another another session to cut TreeNode instances
from the original's session and paste them (or move them) into this session.
move
in interface TreeNodeEditor
obj
- the node to be moved; may not be nullnewParent
- the node that is to be considered the
parent of the existing instance; may not be null
java.lang.AssertionError
- if either of obj
or newParent
is nullpublic boolean move(TreeNode node, TreeNode newParent, int indexInNewParent)
This method may be used in conjunction with the delete
method
of an editor from this or another another session to cut TreeNode instances
from the original's session and paste them (or move them) into this session.
move
in interface TreeNodeEditor
obj
- the node to be moved; may not be nullnewParent
- the node that is to be considered the
parent of the existing instance; may not be nullindexInNewParent
- the position that this node will occupy within the ordered list
of children for newParent.
java.lang.AssertionError
- if either of obj
or newParent
is null
java.lang.IndexOutOfBoundsException
- if the index is not within the range
0 <= newIndex < childCount
public boolean moveChild(TreeNode child, int newIndex)
moveChild
in interface TreeNodeEditor
child
- the node to be moved; may not be nullnewIndex
- the position that this node will occupy within the ordered list
of children for the node's parent.
java.lang.AssertionError
- if either of obj
or newParent
is null
java.lang.IndexOutOfBoundsException
- if the index is not within the range
0 <= newIndex < this.getChildCount()
public boolean rename(TreeNode node, java.lang.String newName)
rename
in interface TreeNodeEditor
obj
- the node to be renamed; may not be nullnewName
- the new name for the object; may not be null or zero-length,
and must not be used by an existing sibling
java.lang.AssertionError
- if either of obj
or newName
is null,
or if newName
is zero-lengthpublic PropertyDefinition getNamePropertyDefinition(TreeNode obj)
getNamePropertyDefinition
in interface TreeNodeEditor
obj
- the tree node; may not be null
public PropertyDefinition getDescriptionPropertyDefinition(TreeNode obj)
obj
- the tree node; may not be null
protected BasicTreeNode cloneBasicTreeNode(BasicTreeNode original, BasicTreeNode newParent, boolean deep)
protected java.lang.Object copyPropertyValue(java.lang.Object value)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |