java.lang.Object
PMRElementImpl
org.xmlcml.cmlimpl.CMLBaseImpl
- All Implemented Interfaces:
- org.xmlcml.cml.AbstractBase, org.xmlcml.cml.AttributeConvention, org.xmlcml.cml.AttributeDictRef, org.xmlcml.cml.AttributeId, org.xmlcml.cml.AttributeTitle, org.w3c.dom.Element, org.w3c.dom.Node
- Direct Known Subclasses:
- AbstractAtomRefImpl, AbstractBuiltinContainerImpl, AbstractStringValImpl, CMLImpl, ElectronImpl, FeatureImpl, LinkImpl, ListImpl, MoleculeImpl, ReactionImpl, SequenceImpl
- public abstract class CMLBaseImpl
- extends PMRElementImpl
- implements org.xmlcml.cml.AbstractBase
The base class for all elementObjects mentioned in the CML
DTD.
Any CML element may have attributes:
- title
- id
- dictRef
- convention
and convenience get/set methods are provided for all, through
the interfaces AttributeTitle, AttributeId and AttributeConvention.
An element (FOO) subclassed from a AbstractBase may be constructed in the
following ways:
- FOO(). Creates a new empty element with null values of the
attributes. Required for newInstance(), but use carefully since
it has no tagName and no document associated with it.
- FOO(String tagName, Document document). Creates an empty
element with null attribute names.
- FOO(org.w3c.dom.Element element). Creates a subclassed Element with
the same attribute values as the input Element. Used when a DOM has
been created with non-CML-aware software. The routine
makeAndProcessSubclass(Element element) will replace the current Element
with the appropriate CML subclass.
- FOO(String title, String id, String dictRef, String conventionName).
Makes subclassed Element and sets attribute values.
| Fields inherited from interface org.xmlcml.cml.AbstractBase |
ANGLE, ATOM, ATOMARRAY, ATOMPARITY, BOND, BONDARRAY, BONDSTEREO, BUILTIN, CML, CML_PREFIX, CRYSTAL, ELECTRON, ELEMENT_COUNT, ELEMENT_NAMES, EXECUTE, FEATURE, FLOAT, FLOAT_TYPE, FLOATARRAY, FLOATMATRIX, FORMULA, INTEGER, INTEGER_TYPE, INTEGERARRAY, LINK, LIST, MOLECULE, NAMESPACE_URI, PACKAGE_NAME, REACTION, SEQUENCE, STRING, STRING_TYPE, STRINGARRAY, TORSION, UNK, UNK_ELEM, UNKNOWN |
| Fields inherited from interface org.w3c.dom.Node |
ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_POSITION_CONTAINED_BY, DOCUMENT_POSITION_CONTAINS, DOCUMENT_POSITION_DISCONNECTED, DOCUMENT_POSITION_FOLLOWING, DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, DOCUMENT_POSITION_PRECEDING, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE |
|
Method Summary |
void |
addToThisLog(int messageId,
java.lang.String message)
|
void |
addTracer(java.lang.Class theClass)
set a trace for objects of a class. |
static void |
buildXMLTest()
|
protected static void |
convertChildrenToSubclass(org.w3c.dom.Element element)
|
static PMRElement |
convertToSubclass(org.w3c.dom.Element element)
recursively process all nodes. |
void |
copyAndExtractCommonAttributes(org.w3c.dom.Element element)
|
static org.xmlcml.cml.style.TreeStyle |
createDefaultTreeStyle(org.xmlcml.cml.AbstractBase ab)
non-core |
void |
debug()
output debug info to System.out |
(package private) static void |
debug(org.w3c.dom.Node node,
java.io.Writer w)
|
void |
debug(java.io.Writer w)
output debug info to Writer and return String equivalent (e.g. |
protected abstract java.lang.String |
getClassTagName()
|
static CMLBaseImpl |
getCMLBaseImpl(javax.swing.table.TableModel model,
int row,
int column)
NON-CORE supports rendering of JTables |
java.lang.String |
getConventionName()
|
static java.lang.String |
getDefaultPrefix()
|
org.xmlcml.cml.metadata.CMLDictionaryEntry |
getDictionaryEntry()
gets the dictionary entry based on the dictRef attribute |
java.lang.String |
getDictRef()
|
java.awt.Component |
getDisplay()
non-CORE. |
java.lang.String |
getId()
|
protected java.lang.String[] |
getMessageBodies()
|
protected java.lang.String[] |
getMessageCodes()
|
java.lang.String |
getStringValue()
|
static PMRElement |
getSubClassedElement(java.lang.String name,
org.xmlcml.cml.CMLDocument cmlDocument)
create a PMRElement (usually a AbstractBase) and processDOM() it. |
javax.swing.table.TableCellEditor |
getTableCellEditor()
NON-CORE - returns a table cell editor; this is based on the dictionary
when possible |
static javax.swing.table.TableCellEditor |
getTableCellEditor(javax.swing.table.TableModel model,
int row,
int column)
|
javax.swing.table.TableCellRenderer |
getTableCellRenderer()
|
static javax.swing.table.TableCellRenderer |
getTableCellRenderer(javax.swing.table.TableModel model,
int row,
int column)
|
java.lang.String |
getTitle()
|
org.xmlcml.cml.style.TreeStyle |
getTreeStyle()
non-CORE. |
static void |
help()
|
abstract boolean |
isTrace()
|
static void |
main(java.lang.String[] args)
|
(package private) static void |
outputChildContent(org.w3c.dom.Element element,
java.io.Writer w,
int type,
int level)
|
boolean |
processDOM()
subclassed if necessary |
void |
processDOM(boolean processMe)
|
boolean |
processDOMHasConvention()
|
static boolean |
processDOMHasConvention(org.xmlcml.cml.AttributeConvention element)
|
static boolean |
processDOMHasCount(org.xmlcml.cml.AttributeCount element)
|
boolean |
processDOMHasDictRef()
|
static boolean |
processDOMHasDictRef(org.xmlcml.cml.AttributeDictRef element)
|
boolean |
processDOMHasId()
maintenance methods |
static boolean |
processDOMHasId(org.xmlcml.cml.AttributeId element)
|
static boolean |
processDOMHasSize(org.xmlcml.cml.AttributeSize element)
gets the SIZE attribute |
boolean |
processDOMHasTitle()
|
static boolean |
processDOMHasTitle(org.xmlcml.cml.AttributeTitle element)
|
static boolean |
processDOMHasUnits(org.xmlcml.cml.AttributeUnits element)
|
void |
readXMLTest()
tests an element that has been read from an XML document. |
(package private) static void |
readXMLTest(java.lang.String[] args,
java.lang.String className,
java.lang.String tagName)
|
void |
removeTracer(java.lang.Class theClass)
remove a trace.for objects of a class |
void |
setConventionName(java.lang.String conventionName)
|
void |
setDictionaryEntryPanel(javax.swing.JPanel p)
|
void |
setDictRef(java.lang.String dictRef)
|
void |
setId(java.lang.String id)
|
void |
setTitle(java.lang.String title)
|
abstract void |
setTrace(boolean t)
|
void |
setTreeStyle(org.xmlcml.cml.style.TreeStyle treeStyle)
non-CORE. |
void |
showDictionaryEntry(javax.swing.JPanel p)
|
static void |
showElementNames()
|
static void |
test1(java.lang.String[] args)
|
void |
trace(java.lang.String message)
|
boolean |
updateDOM()
|
boolean |
updateDOM(boolean updateMe)
|
protected boolean |
updateDOMFromVector(java.util.Vector elementVector,
java.lang.String elementName)
replaces all elements of this type with contents of vector |
boolean |
updateDOMHasConvention()
maintenance method |
static boolean |
updateDOMHasConvention(org.xmlcml.cml.AttributeConvention element)
|
static boolean |
updateDOMHasCount(org.xmlcml.cml.AttributeCount element)
|
boolean |
updateDOMHasDictRef()
maintenance methods |
static boolean |
updateDOMHasDictRef(org.xmlcml.cml.AttributeDictRef element)
|
boolean |
updateDOMHasId()
|
static boolean |
updateDOMHasId(org.xmlcml.cml.AttributeId element)
|
static boolean |
updateDOMHasSize(org.xmlcml.cml.AttributeSize element)
calculates the SIZE attribute from the array. |
boolean |
updateDOMHasTitle()
maintenance methods |
static boolean |
updateDOMHasTitle(org.xmlcml.cml.AttributeTitle element)
|
static boolean |
updateDOMHasUnits(org.xmlcml.cml.AttributeUnits element)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.w3c.dom.Element |
getAttribute, getAttributeNode, getAttributeNodeNS, getAttributeNS, getElementsByTagName, getElementsByTagNameNS, getSchemaTypeInfo, getTagName, hasAttribute, hasAttributeNS, removeAttribute, removeAttributeNode, removeAttributeNS, setAttribute, setAttributeNode, setAttributeNodeNS, setAttributeNS, setIdAttribute, setIdAttributeNode, setIdAttributeNS |
| Methods inherited from interface org.w3c.dom.Node |
appendChild, cloneNode, compareDocumentPosition, getAttributes, getBaseURI, getChildNodes, getFeature, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, getTextContent, getUserData, hasAttributes, hasChildNodes, insertBefore, isDefaultNamespace, isEqualNode, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, normalize, removeChild, replaceChild, setNodeValue, setPrefix, setTextContent, setUserData |
moleculeFactory
static org.xmlcml.cml.CMLMoleculeFactory moleculeFactory
conventionTable
protected static java.util.Hashtable conventionTable
title
protected java.lang.String title
id
protected java.lang.String id
dictRef
protected java.lang.String dictRef
conventionName
protected java.lang.String conventionName
thisLog
protected ListImpl thisLog
treeStyle
protected org.xmlcml.cml.style.TreeStyle treeStyle
dictionaryEntryPanel
protected javax.swing.JPanel dictionaryEntryPanel
BASE_GENERAL
static int BASE_GENERAL
- messages
messageCodes
static java.lang.String[] messageCodes
messageBodies
static java.lang.String[] messageBodies
CMLBaseImpl
public CMLBaseImpl()
- create a Node WITHOUT tagName OR document. Use with care
CMLBaseImpl
public CMLBaseImpl(java.lang.String tagName,
org.w3c.dom.Document document)
- used when creating new nodes in a DOM
CMLBaseImpl
public CMLBaseImpl(org.w3c.dom.Element element)
- used when analysing a DOM
CMLBaseImpl
public CMLBaseImpl(java.lang.String tagName,
org.w3c.dom.Document document,
java.lang.String title,
java.lang.String id,
java.lang.String dictRef,
java.lang.String conventionName)
showElementNames
public static final void showElementNames()
getMessageCodes
protected java.lang.String[] getMessageCodes()
getMessageBodies
protected java.lang.String[] getMessageBodies()
copyAndExtractCommonAttributes
public void copyAndExtractCommonAttributes(org.w3c.dom.Element element)
getClassTagName
protected abstract java.lang.String getClassTagName()
getDefaultPrefix
public static java.lang.String getDefaultPrefix()
setTitle
public void setTitle(java.lang.String title)
- Specified by:
setTitle in interface org.xmlcml.cml.AttributeTitle
getTitle
public java.lang.String getTitle()
- Specified by:
getTitle in interface org.xmlcml.cml.AttributeTitle
setId
public void setId(java.lang.String id)
- Specified by:
setId in interface org.xmlcml.cml.AttributeId
getId
public java.lang.String getId()
- Specified by:
getId in interface org.xmlcml.cml.AttributeId
setDictRef
public void setDictRef(java.lang.String dictRef)
- Specified by:
setDictRef in interface org.xmlcml.cml.AttributeDictRef
getDictRef
public java.lang.String getDictRef()
- Specified by:
getDictRef in interface org.xmlcml.cml.AttributeDictRef
setConventionName
public void setConventionName(java.lang.String conventionName)
- Specified by:
setConventionName in interface org.xmlcml.cml.AttributeConvention
getConventionName
public java.lang.String getConventionName()
- Specified by:
getConventionName in interface org.xmlcml.cml.AttributeConvention
convertToSubclass
public static PMRElement convertToSubclass(org.w3c.dom.Element element)
throws java.lang.Exception
- recursively process all nodes. Assumes we have built a DOM
and all Nodes are of type Element. They need to be converted
to PMRElement or a subclass of it
convertChildrenToSubclass
protected static void convertChildrenToSubclass(org.w3c.dom.Element element)
throws java.lang.Exception
getSubClassedElement
public static PMRElement getSubClassedElement(java.lang.String name,
org.xmlcml.cml.CMLDocument cmlDocument)
throws java.lang.Exception
- create a PMRElement (usually a AbstractBase) and processDOM() it.
processDOM
public boolean processDOM()
throws org.xmlcml.cml.CMLException
- subclassed if necessary
- Specified by:
processDOM in interface org.xmlcml.cml.AbstractBase
processDOM
public void processDOM(boolean processMe)
throws org.xmlcml.cml.CMLException
processDOMHasConvention
public static boolean processDOMHasConvention(org.xmlcml.cml.AttributeConvention element)
processDOMHasDictRef
public static boolean processDOMHasDictRef(org.xmlcml.cml.AttributeDictRef element)
processDOMHasCount
public static boolean processDOMHasCount(org.xmlcml.cml.AttributeCount element)
processDOMHasId
public static boolean processDOMHasId(org.xmlcml.cml.AttributeId element)
processDOMHasTitle
public static boolean processDOMHasTitle(org.xmlcml.cml.AttributeTitle element)
processDOMHasSize
public static boolean processDOMHasSize(org.xmlcml.cml.AttributeSize element)
- gets the SIZE attribute
processDOMHasUnits
public static boolean processDOMHasUnits(org.xmlcml.cml.AttributeUnits element)
processDOMHasConvention
public boolean processDOMHasConvention()
- Specified by:
processDOMHasConvention in interface org.xmlcml.cml.AttributeConvention
processDOMHasDictRef
public boolean processDOMHasDictRef()
- Specified by:
processDOMHasDictRef in interface org.xmlcml.cml.AttributeDictRef
processDOMHasId
public boolean processDOMHasId()
- Description copied from interface:
org.xmlcml.cml.AttributeId
- maintenance methods
- Specified by:
processDOMHasId in interface org.xmlcml.cml.AttributeId
processDOMHasTitle
public boolean processDOMHasTitle()
- Specified by:
processDOMHasTitle in interface org.xmlcml.cml.AttributeTitle
debug
public void debug(java.io.Writer w)
throws java.io.IOException
- output debug info to Writer and return String equivalent (e.g. with
new StringWriter()
- Specified by:
debug in interface org.xmlcml.cml.AbstractBase
debug
public void debug()
- output debug info to System.out
- Specified by:
debug in interface org.xmlcml.cml.AbstractBase
outputChildContent
static void outputChildContent(org.w3c.dom.Element element,
java.io.Writer w,
int type,
int level)
throws java.io.IOException
debug
static void debug(org.w3c.dom.Node node,
java.io.Writer w)
throws java.io.IOException
help
public static void help()
updateDOMHasConvention
public static boolean updateDOMHasConvention(org.xmlcml.cml.AttributeConvention element)
updateDOMHasDictRef
public static boolean updateDOMHasDictRef(org.xmlcml.cml.AttributeDictRef element)
updateDOMHasCount
public static boolean updateDOMHasCount(org.xmlcml.cml.AttributeCount element)
updateDOMHasId
public static boolean updateDOMHasId(org.xmlcml.cml.AttributeId element)
updateDOMHasTitle
public static boolean updateDOMHasTitle(org.xmlcml.cml.AttributeTitle element)
updateDOMHasSize
public static boolean updateDOMHasSize(org.xmlcml.cml.AttributeSize element)
- calculates the SIZE attribute from the array. should not be
set by user. If size <= 0 do not update
updateDOMHasUnits
public static boolean updateDOMHasUnits(org.xmlcml.cml.AttributeUnits element)
updateDOMHasConvention
public boolean updateDOMHasConvention()
- Description copied from interface:
org.xmlcml.cml.AttributeConvention
- maintenance method
- Specified by:
updateDOMHasConvention in interface org.xmlcml.cml.AttributeConvention
updateDOMHasDictRef
public boolean updateDOMHasDictRef()
- Description copied from interface:
org.xmlcml.cml.AttributeDictRef
- maintenance methods
- Specified by:
updateDOMHasDictRef in interface org.xmlcml.cml.AttributeDictRef
updateDOMHasId
public boolean updateDOMHasId()
- Specified by:
updateDOMHasId in interface org.xmlcml.cml.AttributeId
updateDOMHasTitle
public boolean updateDOMHasTitle()
- Description copied from interface:
org.xmlcml.cml.AttributeTitle
- maintenance methods
- Specified by:
updateDOMHasTitle in interface org.xmlcml.cml.AttributeTitle
updateDOM
public boolean updateDOM(boolean updateMe)
throws org.xmlcml.cml.CMLException
updateDOM
public boolean updateDOM()
throws org.xmlcml.cml.CMLException
- Specified by:
updateDOM in interface org.xmlcml.cml.AbstractBase
updateDOMFromVector
protected boolean updateDOMFromVector(java.util.Vector elementVector,
java.lang.String elementName)
throws org.xmlcml.cml.CMLException
- replaces all elements of this type with contents of vector
test1
public static void test1(java.lang.String[] args)
throws java.lang.Exception
readXMLTest
static void readXMLTest(java.lang.String[] args,
java.lang.String className,
java.lang.String tagName)
throws java.lang.Exception
readXMLTest
public void readXMLTest()
throws org.xmlcml.cml.CMLException
- Description copied from interface:
org.xmlcml.cml.AbstractBase
- tests an element that has been read from an XML document. This
may be overridden in some or all subclasses
- Specified by:
readXMLTest in interface org.xmlcml.cml.AbstractBase
buildXMLTest
public static void buildXMLTest()
throws java.lang.Exception
addTracer
public void addTracer(java.lang.Class theClass)
- set a trace for objects of a class.
- Specified by:
addTracer in interface org.xmlcml.cml.AbstractBase
removeTracer
public void removeTracer(java.lang.Class theClass)
- remove a trace.for objects of a class
- Specified by:
removeTracer in interface org.xmlcml.cml.AbstractBase
setTrace
public abstract void setTrace(boolean t)
isTrace
public abstract boolean isTrace()
trace
public void trace(java.lang.String message)
addToThisLog
public void addToThisLog(int messageId,
java.lang.String message)
getDisplay
public java.awt.Component getDisplay()
- non-CORE. how to display object
- Specified by:
getDisplay in interface org.xmlcml.cml.AbstractBase
getTreeStyle
public org.xmlcml.cml.style.TreeStyle getTreeStyle()
- non-CORE. how to display object in a tree; subclassed as appropriate
setTreeStyle
public void setTreeStyle(org.xmlcml.cml.style.TreeStyle treeStyle)
- non-CORE. how to display object in a tree; subclassed id appropriate
createDefaultTreeStyle
public static org.xmlcml.cml.style.TreeStyle createDefaultTreeStyle(org.xmlcml.cml.AbstractBase ab)
- non-core
getCMLBaseImpl
public static CMLBaseImpl getCMLBaseImpl(javax.swing.table.TableModel model,
int row,
int column)
- NON-CORE supports rendering of JTables
getDictionaryEntry
public org.xmlcml.cml.metadata.CMLDictionaryEntry getDictionaryEntry()
- gets the dictionary entry based on the dictRef attribute
getTableCellRenderer
public static javax.swing.table.TableCellRenderer getTableCellRenderer(javax.swing.table.TableModel model,
int row,
int column)
getTableCellRenderer
public javax.swing.table.TableCellRenderer getTableCellRenderer()
getTableCellEditor
public static javax.swing.table.TableCellEditor getTableCellEditor(javax.swing.table.TableModel model,
int row,
int column)
getTableCellEditor
public javax.swing.table.TableCellEditor getTableCellEditor()
- NON-CORE - returns a table cell editor; this is based on the dictionary
when possible
showDictionaryEntry
public void showDictionaryEntry(javax.swing.JPanel p)
setDictionaryEntryPanel
public void setDictionaryEntryPanel(javax.swing.JPanel p)
getStringValue
public java.lang.String getStringValue()
main
public static void main(java.lang.String[] args)