org.merlotxml.merlot
Class MerlotDOMElement

java.lang.Object
  extended byorg.merlotxml.merlot.MerlotDOMNode
      extended byorg.merlotxml.merlot.MerlotDOMElement
All Implemented Interfaces:
java.lang.Cloneable, MerlotConstants, java.awt.datatransfer.Transferable
Direct Known Subclasses:
MerlotLibraryItem

public class MerlotDOMElement
extends MerlotDOMNode

DOM element 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
 boolean _hasBeenValidated
           
 
Fields inherited from class org.merlotxml.merlot.MerlotDOMNode
_children, _clonedFrom, _dtdPluginConfig, _file, _listeners, _parent, _theNode, 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
MerlotDOMElement(org.w3c.dom.Element data, XMLFile doc)
           
 
Method Summary
 java.lang.String getAttribute(java.lang.String s)
           
 DTDAttribute getDTDAttribute(java.lang.String name)
          Deprecated. Use GrammarComplexType.getAttribute(name)
 DTDElement getDTDElement()
          Deprecated. Use MerlotDOMNode.getGrammarComplexType.
 java.lang.String getElementName()
          Returns the DTD name of the element (which we consider it's type) in the context of merlot
 boolean getHasBeenValidated()
           
 boolean getIsComplete()
           
 boolean getIsContentValid()
           
 boolean getIsEachChildValid()
           
 boolean getIsLocationValid()
           
 int getNumberOfPeersOfSameType()
           
 boolean isElement()
          Element nodes should overload this to return true.
 boolean isValid()
           
 boolean mayBeRemoved()
          Determines if the minimum allowed instances of this element will be violated if it is cut or deleted.
 void refreshNodeInTree()
           
 void resetValidation()
          Called from MerlotDOMNode.fireNodeInserted to update.
 void resetValidationOfChildren()
           
 void setAttribute(java.lang.String name, java.lang.String value)
          sets the attributes one at a time
 void setAttributes(java.util.HashMap h)
          Sets the attributes according the given hashtable.
 void validate()
          Adds element to queue in ValidationThread.
 void validateNow()
          Called from ValidationThread
 
Methods inherited from class org.merlotxml.merlot.MerlotDOMNode
addMerlotNodeListener, appendChild, array2String, array2String, clone, delete, equals, fireNodeChanged, fireNodeDeleted, fireNodeInserted, fireNodeRemoved, getAppendableElements, getAttributes, getAttributesOfType, getChildElements, getChildIndex, getChildNodes, getChildText, getClonedFrom, getDescriptiveText, getDescriptiveText, getDisplayText, getDocument, getDTDAttributes, getDTDDocument, getDTDPluginConfig, getEditor, getEditPanel, getFirstAttributeOfType, getFirstChild, getGrammarAttribute, getGrammarAttributes, getGrammarComplexType, getGrammarDocument, getIcon, getIdManager, getIndices, getInsertableElements, getInsertableElements, getMerlotDOMDocument, getMerlotNodeListeners, getNodeName, getNodes, getParentNode, getPreviousSibling, getPreviousSibling, getProperty, getRealNode, getSmallIcon, getTransferData, getTransferDataFlavors, getXMLFile, hashCode, importChild, importChild, importChildAfter, importChildBefore, insertAfter, insertBefore, insertChildAt, isAllowableChild, isAllowableChild, isAllowableChild, isDataFlavorSupported, isRootElement, isSpecialNode, locationIsValid, newChild, newChild, newSiblingAfter, newSiblingAfter, newSiblingBefore, newSiblingBefore, printNode, printNode, removeAllMerlotDOMNodeListeners, removeAttributes, removeChild, removeMerlotNodeListener, resetCache, setClonedFrom, setDescriptiveText, setParentNode, setParentNode, toPathString, toString, toXMLShort
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

_hasBeenValidated

public boolean _hasBeenValidated
Constructor Detail

MerlotDOMElement

public MerlotDOMElement(org.w3c.dom.Element data,
                        XMLFile doc)
Method Detail

isElement

public boolean isElement()
Description copied from class: MerlotDOMNode
Element nodes should overload this to return true.

Overrides:
isElement in class MerlotDOMNode

getElementName

public java.lang.String getElementName()
Returns the DTD name of the element (which we consider it's type) in the context of merlot


getAttribute

public java.lang.String getAttribute(java.lang.String s)

setAttributes

public void setAttributes(java.util.HashMap h)
Sets the attributes according the given hashtable. (probably should make getAttributes consistent with this at some point

Overrides:
setAttributes in class MerlotDOMNode

setAttribute

public void setAttribute(java.lang.String name,
                         java.lang.String value)
sets the attributes one at a time


isValid

public boolean isValid()
Overrides:
isValid in class MerlotDOMNode

getHasBeenValidated

public boolean getHasBeenValidated()

getIsLocationValid

public boolean getIsLocationValid()

getIsComplete

public boolean getIsComplete()

getIsContentValid

public boolean getIsContentValid()

getIsEachChildValid

public boolean getIsEachChildValid()

validate

public void validate()
Adds element to queue in ValidationThread. validateNow() will be called to do the actual validation.


validateNow

public void validateNow()
Called from ValidationThread


mayBeRemoved

public boolean mayBeRemoved()
Determines if the minimum allowed instances of this element will be violated if it is cut or deleted.

Overrides:
mayBeRemoved in class MerlotDOMNode

getNumberOfPeersOfSameType

public int getNumberOfPeersOfSameType()
Returns:
includes the current node

resetValidation

public void resetValidation()
Called from MerlotDOMNode.fireNodeInserted to update.


resetValidationOfChildren

public void resetValidationOfChildren()

refreshNodeInTree

public void refreshNodeInTree()

getDTDElement

public DTDElement getDTDElement()
Deprecated. Use MerlotDOMNode.getGrammarComplexType.


getDTDAttribute

public DTDAttribute getDTDAttribute(java.lang.String name)
Deprecated. Use GrammarComplexType.getAttribute(name)