public class NewXMLComplexElement extends NewXMLElement
<xsd:element name="DataField">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="DataType"/>
<xsd:element ref="InitialValue" minOccurs="0"/>
<xsd:element ref="Length" minOccurs="0"/>
<xsd:element ref="Description" minOccurs="0"/>
<xsd:element ref="ExtendedAttributes" minOccurs="0"/>
</xsd:sequence>
<xsd:attribute name="Id" type="xsd:NMTOKEN" use="required"/>
<xsd:attribute name="Name" type="xsd:string"/>
<xsd:attribute name="IsArray" default="FALSE">
<xsd:simpleType>
<xsd:restriction base="xsd:NMTOKEN">
<xsd:enumeration value="TRUE"/>
<xsd:enumeration value="FALSE"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
</xsd:complexType>
</xsd:element>
will be presented as the object of the class derived from this class,
and the name of the class will be DataField. The DataField object will
have the other objects which are instances of XMLElement class that
will be placed within it's collection complexStructure.
These elements, in this particular case, will be the instances of
XMLAttribute class (that will be also placed into another
collection - attributes) which will represent the 'Id', 'Name'
and 'IsArray' XML attribute, the instances of classes InitialValue,
Length, Description which are all derived from XMLSimpleElement class and represents corresponding XML simple elements,
and the instances of classes DataType and ExtendedAttributes,
which are also derived from XMLComplexElement class.
The panels of elements that instance of XMLComplexElement
class contains in it's complexStructure collection, will be placed
on it's panel, which allows it's editing.
When writting or reading XML document, the complexStructure
will be used to write/read all required elements.
The methods for setting or getting the value of each element by it's name,
or by it's position within complexStructure collectioin is provided.
NOTE: Although this class is not declared abstract, it is
uselles without redefining it's method fillStructure().
The classes derived from this class corresponds to the
complex XML element.
| 限定符和类型 | 字段和说明 |
|---|---|
protected List |
attributes
The list of attributes that complex element contains.
|
protected List |
complexStructure
The list of all elements (attributes, and other elements) that
complex element is consisted of.
|
atts, isCollapsed, isReadOnly, isRequired, labelName, name, NEWLINE, OFFSET, value| 构造器和说明 |
|---|
NewXMLComplexElement() |
| 限定符和类型 | 方法和说明 |
|---|---|
Object |
clone()
Used to create exact copy of instance of this class.
|
protected void |
fillStructure()
The classes that are derived from this class has to give its
definition for this method.
|
void |
fromXML(Node node)
Supposed to be overriden by derived classes to implement
element specific reading from an XML file.
|
XMLElement |
get(int no)
Gets the element that is placed at specified no. within structure.
|
XMLElement |
get(String name)
Gets the element with specified name from stucture.
|
List |
getChildElements()
Return element child nodes, without attributes.
|
int |
getElementsCount()
Count child elements of this complex element.
|
DefaultMutableTreeNode |
getNode()
DefaultMutableTreeNode with all subnodes of this element.
|
NewXMLPanel |
getPanel()
Returns the panel for editing the element.
|
String |
getPrintDescription(String indent,
StyledDocument doc)
Make print description of this element and all subelements and attributes.
|
boolean |
isEmpty()
Indicates if element is empty.
|
boolean |
isValid()
Indicates if element is valid in XML XML sense.
|
protected void |
processAttributes(Node node) |
protected void |
processElements(Node node) |
void |
refreshLabelName() |
void |
set(int no,
Object value)
Sets the element that is placed at specified no. within structure
to the specified value.
|
void |
set(String name,
Object value)
Sets the element with specified name from stucture to
the specified value.
|
void |
setReadOnly(boolean ro)
Sets the element and all elements it is made of to be
read only or not.
|
Collection |
toComplexType()
Returns the collection of elements this element is made of.
|
Collection |
toComplexTypeValues()
Returns the collection of strings that represents elements
that this element is made of.
|
String |
toString()
Returns the text representation of element's 'value'.
|
void |
toXML(Node parent)
Supposed to be overriden by derived classes to implement
element specific writting to an XML file.
|
fromXML, getPrintDescription, isCollapsed, isReadOnly, isRequired, isValidEnter, setCollapsed, setLabelName, setRequired, setValue, toLabel, toName, toValueprotected List complexStructure
protected List attributes
public Collection toComplexType()
public Collection toComplexTypeValues()
public void setReadOnly(boolean ro)
setReadOnly 在类中 NewXMLElementro - true if element will be 'read only',
false otherwise.public boolean isEmpty()
NewXMLElementisEmpty 在类中 NewXMLElementpublic boolean isValid()
NewXMLElementisValid 在类中 NewXMLElementpublic void toXML(Node parent) throws DOMException
NewXMLElementtoXML 在类中 NewXMLElementparent - parent nodeDOMExceptionpublic void fromXML(Node node)
NewXMLElementfromXML 在类中 NewXMLElementnode - root nodeprotected void processAttributes(Node node)
protected void processElements(Node node)
public NewXMLPanel getPanel()
NewXMLElementgetPanel 在类中 NewXMLElementpublic XMLElement get(int no)
public void set(int no,
Object value)
public XMLElement get(String name)
public void set(String name, Object value)
public String toString()
NewXMLElementtoString method
of it's value member, if value is null,
returns labelName member.toString 在类中 NewXMLElementprotected void fillStructure()
toXML method uses them to properly write an element
tag to the XML file,
fromXML method uses them to properly read an element
tag from the XML file,
getPanel method uses them to properly display members
of this class,
get and set uses them to properly
retrieve/set the elements from list, ... and so on
NOTE: The order of inserted elements is relevant for XML to be valid (members of classes derived from this class must be inserted into first mentioned list in the same order that they are within a corresponding tag for those classes within WfMC XML).
public Object clone()
NewXMLElementclone 在类中 NewXMLElementpublic void refreshLabelName()
refreshLabelName 在类中 NewXMLElementpublic DefaultMutableTreeNode getNode()
getNode 在类中 NewXMLElementpublic int getElementsCount()
public List getChildElements()
public String getPrintDescription(String indent, StyledDocument doc)
getPrintDescription 在类中 NewXMLElementCopyright © 2023 onecode. All rights reserved.