|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.merlotxml.merlot.MerlotDOMNode
DOM node container for Merlot. Contains a DOM node, handles getting an icon for a particular node, getting the editor for a node, etc. Also implements transferable so that the node can be drag and dropped, or cut and pasted.
Field Summary | |
protected java.util.Vector |
_children
cached list of child nodes |
protected MerlotDOMNode[] |
_clonedFrom
The node we were cloned from if any... |
protected DTDPluginConfig |
_dtdPluginConfig
the plugin this node is associated with |
protected XMLFile |
_file
The file this node came from |
protected java.util.Vector |
_listeners
Listeners of for actions on this node |
protected MerlotDOMNode |
_parent
|
protected org.w3c.dom.Node |
_theNode
|
static java.awt.datatransfer.DataFlavor |
DOM_TREENODE_FLAVOR
|
Fields inherited from interface org.merlotxml.merlot.MerlotConstants |
ACTION_MENU_ACCELERATOR, ACTION_MENU_ICON, ACTION_NAME, ACTION_SHORT_DESCRIPTION, ACTION_SMALL_ICON, AFTER, BEFORE, ERR, INTO, UI, XML |
Constructor Summary | |
MerlotDOMNode(org.w3c.dom.Node data,
XMLFile file)
|
Method Summary | |
void |
addMerlotNodeListener(MerlotNodeListener l)
|
void |
appendChild(MerlotDOMNode child)
|
java.lang.String |
array2String(int[] array)
|
java.lang.String |
array2String(java.lang.Object[] array)
|
java.lang.Object |
clone()
provides a deep copy |
void |
delete()
|
boolean |
equals(java.lang.Object o)
|
void |
fireNodeChanged()
|
void |
fireNodeDeleted()
This handles the case of notifying anything editing the node that it is deleted. |
void |
fireNodeInserted(MerlotDOMNode parent,
int[] childindices,
MerlotDOMNode[] newchildren)
|
void |
fireNodeRemoved(MerlotDOMNode parent,
int[] childindices,
MerlotDOMNode[] oldchildren)
This one handles the case of keeping the tree view up to date. |
java.util.Enumeration |
getAppendableElements()
returns an enumeration of DTDElements |
org.w3c.dom.NamedNodeMap |
getAttributes()
|
java.util.Vector |
getAttributesOfType(int type)
Gets only the attributes ( org.w3c.dom.Node ) that have the specified type. |
java.util.Vector |
getChildElements()
|
int |
getChildIndex(MerlotDOMNode child)
Returns the index of the location of the child in the parent |
MerlotDOMNode[] |
getChildNodes()
gets a list of child nodes and creates an array of merlotDOMNodes. |
java.lang.String |
getChildText(boolean suppressWhiteSpace)
|
protected MerlotDOMNode[] |
getClonedFrom()
|
java.lang.String |
getDescriptiveText()
Determines the most descriptive text for a node based on priorities set in plugin.xml. |
java.lang.String |
getDescriptiveText(java.util.Map nodeProperties,
java.util.List defaultOrder)
|
java.lang.String |
getDisplayText()
|
org.w3c.dom.Document |
getDocument()
|
java.util.Enumeration |
getDTDAttributes()
Deprecated. Use getGrammarAttributes |
DTDDocument |
getDTDDocument()
Deprecated. Use getGrammarDocument. |
DTDPluginConfig |
getDTDPluginConfig()
Returns the dtd plugin config for this node if it exists |
MerlotDOMEditor |
getEditor()
This should return the editor object for this type of element if one is found, otherwise a default one should be returned. |
javax.swing.JPanel |
getEditPanel()
|
java.lang.String |
getFirstAttributeOfType(int attrType)
Gets all the attributes ( org.w3c.dom.Node ) that have the specified type. |
MerlotDOMNode |
getFirstChild()
Gets the first child that is non-empty text, or returns null if none |
GrammarSimpleType |
getGrammarAttribute(java.lang.String name)
|
GrammarSimpleType[] |
getGrammarAttributes()
Provides access to the grammar of the attributes defined for this node for both DTDs and Schemas. |
GrammarComplexType |
getGrammarComplexType()
Provides access to element grammar for both DTDs and Schemas. |
GrammarDocument |
getGrammarDocument()
Provides access to element and attribute grammar for both DTDs and Schemas. |
javax.swing.Icon |
getIcon()
Gets a large icon |
IDManager |
getIdManager()
Return THE IDManager specific to the document containing this node. |
protected int[] |
getIndices()
this gets the index of this child or if it's a fragment, then the indices of all the nodes in the top level of the fragment |
java.util.Enumeration |
getInsertableElements()
Deprecated. Use getGrammarComplexType().getInsertableElements() |
java.util.Enumeration |
getInsertableElements(int index)
Deprecated. Use getGrammarComplexType().getInsertableElements(index) |
MerlotDOMDocument |
getMerlotDOMDocument()
this goes up the tree recursively until it finds the merlot dom document |
protected java.util.Vector |
getMerlotNodeListeners()
|
java.lang.String |
getNodeName()
|
protected MerlotDOMNode[] |
getNodes()
|
MerlotDOMNode |
getParentNode()
|
MerlotDOMNode |
getPreviousSibling()
Returns the previous sibling or null if this is the first sibling |
MerlotDOMNode |
getPreviousSibling(MerlotDOMNode child)
|
java.lang.String |
getProperty(java.lang.Object property)
Property must either be a String containing the attribute name, or an Integer with a DTDConstant specifying an attribute type. |
org.w3c.dom.Node |
getRealNode()
|
javax.swing.Icon |
getSmallIcon()
Gets a small icon for this node based on its type |
java.lang.Object |
getTransferData(java.awt.datatransfer.DataFlavor flavor)
|
java.awt.datatransfer.DataFlavor[] |
getTransferDataFlavors()
|
XMLFile |
getXMLFile()
returns the XML file object |
int |
hashCode()
|
MerlotDOMNode |
importChild(MerlotDOMNode child)
imports a child node from another document |
MerlotDOMNode |
importChild(MerlotDOMNode child,
boolean asLastChild)
|
MerlotDOMNode |
importChildAfter(MerlotDOMNode child)
imports a node and places it after this one |
MerlotDOMNode |
importChildBefore(MerlotDOMNode child)
imports a node and places it before this one |
void |
insertAfter(MerlotDOMNode sibling)
inserts this after the sibling |
void |
insertBefore(MerlotDOMNode sibling)
inserts this before the sibling |
void |
insertChildAt(MerlotDOMNode child,
int loc)
|
boolean |
isAllowableChild(MerlotDOMNode child,
boolean newChild)
Returns true if the child is a valid type to be a child of this according to the DTD |
boolean |
isAllowableChild(MerlotDOMNode child,
int index,
boolean newChild)
|
boolean |
isAllowableChild(java.lang.String child,
int index)
|
boolean |
isDataFlavorSupported(java.awt.datatransfer.DataFlavor flavor)
|
boolean |
isElement()
Element nodes should overload this to return true. |
boolean |
isRootElement()
|
boolean |
isSpecialNode()
|
boolean |
isValid()
|
boolean |
locationIsValid(boolean checkParents)
|
boolean |
mayBeRemoved()
|
MerlotDOMNode |
newChild(org.w3c.dom.Node nd)
|
MerlotDOMNode |
newChild(java.lang.String nodename)
creates a new child and adds it to the end of the list |
MerlotDOMNode |
newSiblingAfter(org.w3c.dom.Node nd)
creates a new sibling and inserts it after this node |
MerlotDOMNode |
newSiblingAfter(java.lang.String nodename)
|
MerlotDOMNode |
newSiblingBefore(org.w3c.dom.Node nd)
creates a new sibling and inserts it after this node |
MerlotDOMNode |
newSiblingBefore(java.lang.String nodename)
|
void |
printNode()
|
void |
printNode(java.lang.String prepend)
|
void |
removeAllMerlotDOMNodeListeners()
Removes all listeners from this node |
void |
removeAttributes()
|
void |
removeChild(MerlotDOMNode nd)
Removes a child node |
void |
removeMerlotNodeListener(MerlotNodeListener l)
|
protected void |
resetCache()
|
void |
setAttributes(java.util.HashMap h)
Sets the attributes according the given hashtable. |
protected void |
setClonedFrom(MerlotDOMNode[] nd)
|
void |
setDescriptiveText(java.lang.String description)
Concept here is that a node can have it's description set externally by a plugin and that text be displayed - it can double as a cache for node descriptions |
void |
setParentNode(MerlotDOMNode nd)
|
protected void |
setParentNode(MerlotDOMNode nd,
boolean updateChildren)
|
java.lang.String |
toPathString()
|
java.lang.String |
toString()
|
java.lang.String |
toXMLShort()
|
Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
protected org.w3c.dom.Node _theNode
protected XMLFile _file
protected MerlotDOMNode _parent
protected MerlotDOMNode[] _clonedFrom
protected java.util.Vector _listeners
protected java.util.Vector _children
protected DTDPluginConfig _dtdPluginConfig
public static final java.awt.datatransfer.DataFlavor DOM_TREENODE_FLAVOR
Constructor Detail |
public MerlotDOMNode(org.w3c.dom.Node data, XMLFile file)
Method Detail |
public org.w3c.dom.Document getDocument()
public MerlotDOMDocument getMerlotDOMDocument()
public javax.swing.Icon getSmallIcon()
public javax.swing.Icon getIcon()
public boolean isElement()
public XMLFile getXMLFile()
public DTDPluginConfig getDTDPluginConfig()
public MerlotDOMEditor getEditor()
public java.lang.String getNodeName()
public int getChildIndex(MerlotDOMNode child) throws org.w3c.dom.DOMException
org.w3c.dom.DOMException
public MerlotDOMNode getFirstChild()
public java.util.Vector getChildElements()
public MerlotDOMNode[] getChildNodes()
protected void resetCache()
public org.w3c.dom.NamedNodeMap getAttributes()
public java.lang.String getFirstAttributeOfType(int attrType)
org.w3c.dom.Node
) that have the specified type.
for the possible types
public java.util.Vector getAttributesOfType(int type)
org.w3c.dom.Node
) that have the specified type.
for the possible types
public void setAttributes(java.util.HashMap h)
public java.util.Enumeration getAppendableElements()
public java.util.Enumeration getInsertableElements(int index)
public java.util.Enumeration getInsertableElements()
public boolean isAllowableChild(MerlotDOMNode child, boolean newChild)
public boolean isAllowableChild(MerlotDOMNode child, int index, boolean newChild)
public boolean isAllowableChild(java.lang.String child, int index)
public MerlotDOMNode getPreviousSibling()
public MerlotDOMNode getPreviousSibling(MerlotDOMNode child) throws org.w3c.dom.DOMException
org.w3c.dom.DOMException
public MerlotDOMNode getParentNode()
public void setParentNode(MerlotDOMNode nd)
protected void setParentNode(MerlotDOMNode nd, boolean updateChildren)
protected void setClonedFrom(MerlotDOMNode[] nd)
protected MerlotDOMNode[] getClonedFrom()
public MerlotDOMNode newChild(java.lang.String nodename) throws org.w3c.dom.DOMException
org.w3c.dom.DOMException
public MerlotDOMNode newChild(org.w3c.dom.Node nd)
public MerlotDOMNode newSiblingAfter(org.w3c.dom.Node nd)
public MerlotDOMNode newSiblingAfter(java.lang.String nodename)
public MerlotDOMNode newSiblingBefore(org.w3c.dom.Node nd)
public MerlotDOMNode newSiblingBefore(java.lang.String nodename)
public void insertAfter(MerlotDOMNode sibling)
public void insertBefore(MerlotDOMNode sibling)
public void insertChildAt(MerlotDOMNode child, int loc)
public void appendChild(MerlotDOMNode child)
public MerlotDOMNode importChild(MerlotDOMNode child)
public MerlotDOMNode importChild(MerlotDOMNode child, boolean asLastChild)
public MerlotDOMNode importChildBefore(MerlotDOMNode child)
public MerlotDOMNode importChildAfter(MerlotDOMNode child)
public void removeChild(MerlotDOMNode nd) throws org.w3c.dom.DOMException
org.w3c.dom.DOMException
protected int[] getIndices()
protected MerlotDOMNode[] getNodes()
public void delete()
public DTDDocument getDTDDocument()
public java.util.Enumeration getDTDAttributes()
public GrammarDocument getGrammarDocument()
public GrammarComplexType getGrammarComplexType()
public GrammarSimpleType[] getGrammarAttributes()
public GrammarSimpleType getGrammarAttribute(java.lang.String name)
public javax.swing.JPanel getEditPanel() throws java.lang.InstantiationException, java.lang.IllegalAccessException
java.lang.InstantiationException
java.lang.IllegalAccessException
public org.w3c.dom.Node getRealNode()
public java.awt.datatransfer.DataFlavor[] getTransferDataFlavors()
getTransferDataFlavors
in interface java.awt.datatransfer.Transferable
public java.lang.Object getTransferData(java.awt.datatransfer.DataFlavor flavor) throws java.awt.datatransfer.UnsupportedFlavorException, java.io.IOException
getTransferData
in interface java.awt.datatransfer.Transferable
java.awt.datatransfer.UnsupportedFlavorException
java.io.IOException
public boolean isDataFlavorSupported(java.awt.datatransfer.DataFlavor flavor)
isDataFlavorSupported
in interface java.awt.datatransfer.Transferable
public java.lang.Object clone()
public void addMerlotNodeListener(MerlotNodeListener l)
public void removeMerlotNodeListener(MerlotNodeListener l)
public void removeAllMerlotDOMNodeListeners()
protected java.util.Vector getMerlotNodeListeners()
public java.lang.String array2String(int[] array)
public java.lang.String array2String(java.lang.Object[] array)
public void fireNodeInserted(MerlotDOMNode parent, int[] childindices, MerlotDOMNode[] newchildren)
public void fireNodeDeleted()
public void fireNodeRemoved(MerlotDOMNode parent, int[] childindices, MerlotDOMNode[] oldchildren)
public void fireNodeChanged()
public java.lang.String toString()
public java.lang.String toPathString()
public boolean equals(java.lang.Object o)
public java.lang.String getDisplayText()
public java.lang.String getDescriptiveText()
public java.lang.String getDescriptiveText(java.util.Map nodeProperties, java.util.List defaultOrder)
public void setDescriptiveText(java.lang.String description)
public java.lang.String toXMLShort()
public java.lang.String getProperty(java.lang.Object property)
public int hashCode()
public void printNode()
public void printNode(java.lang.String prepend)
public java.lang.String getChildText(boolean suppressWhiteSpace)
public boolean isSpecialNode()
public IDManager getIdManager()
public boolean isRootElement()
public boolean isValid()
public void removeAttributes()
public boolean locationIsValid(boolean checkParents)
public boolean mayBeRemoved()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |