public class XMLComplexElement extends XMLElement
<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, isVisible, labelName, name, NEWLINE, OFFSET, value| 构造器和说明 |
|---|
XMLComplexElement() |
| 限定符和类型 | 方法和说明 |
|---|---|
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.
|
int |
getIndex(String name) |
DefaultMutableTreeNode |
getNode()
DefaultMutableTreeNode with all subnodes of this element.
|
XMLPanel |
getPanel()
Returns the panel for editing the element.
|
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.
|
Collection |
toComplexValues() |
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, getPrintDescription, isCollapsed, isReadOnly, isRequired, isValidEnter, isVisible, setCollapsed, setLabelName, setRequired, setValue, setVisible, toLabel, toName, toValueprotected List complexStructure
protected List attributes
public Collection toComplexType()
public Collection toComplexTypeValues()
public Collection toComplexValues()
public void setReadOnly(boolean ro)
setReadOnly 在类中 XMLElementro - true if element will be 'read only', false
otherwise.public boolean isEmpty()
XMLElementisEmpty 在类中 XMLElementpublic boolean isValid()
XMLElementisValid 在类中 XMLElementpublic void toXML(Node parent) throws DOMException
XMLElementtoXML 在类中 XMLElementparent - indicates how much tabulators to put before element tag.DOMExceptionpublic void fromXML(Node node)
XMLElementfromXML 在类中 XMLElementnode - The content retrieved from XML file, that represents tag for
this element.protected void processAttributes(Node node)
protected void processElements(Node node)
public XMLPanel getPanel()
XMLElementgetPanel 在类中 XMLElementpublic 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()
XMLElementtoString method of it's value member, if value is
null, returns labelName member.toString 在类中 XMLElementprotected 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 int getElementsCount()
public List getChildElements()
public Object clone()
XMLElementclone 在类中 XMLElementpublic void refreshLabelName()
refreshLabelName 在类中 XMLElementpublic int getIndex(String name)
public DefaultMutableTreeNode getNode()
getNode 在类中 XMLElementCopyright © 2023 onecode. All rights reserved.