public class NewXMLChoice extends NewXMLElement
For example if XML schema defines some choice as follows:
<xsd:choice>
<xsd:element ref="RecordType"/>
<xsd:element ref="UnionType"/>
<xsd:element ref="EnumerationType"/>
<xsd:element ref="ArrayType"/>
<xsd:element ref="ListType"/>
<xsd:element ref="BasicType"/>
<xsd:element ref="PlainType"/>
<xsd:element ref="DeclaredType"/>
</xsd:choice>
such choice is represented by this class instance (actually by
the instance of it's derived class XMLComplexChoice), and choices
would be the instances of appropriate classes derived from
XMLElement class (actually from it's derived class XMLComplexElement),
which names are: 'RecordType', 'UnionType', 'EnumerationType'
, ..., 'DeclaredType'. The combo box that will be shown in the panel
of this element will offer this choices, and the names of the choices
will be shown as language specific presentation of this choices.
The another example of using choices is when choices are just some predefined strings. This is the case when some XML 'attribute' has the exact number of possible choices, for e.g.:
<xsd:attribute name="Type" use="required">
<xsd:simpleType>
<xsd:restriction base="xsd:NMTOKEN">
<xsd:enumeration value="STRING"/>
<xsd:enumeration value="FLOAT"/>
<xsd:enumeration value="INTEGER"/>
<xsd:enumeration value="REFERENCE"/>
<xsd:enumeration value="DATETIME"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute>
such choice is actually represented by the instance of derived class
XMLAttribute, and choices would be the language specific strings that
correspodents to the 'STRING', 'FLOAT',..., 'DATETIME'.
NOTE: Although this class is not declared abstract, it is
uselles without redefining it's methods. The classes
that are really used are derived classes XMLAttribute and XMLComplexChoice.
| 限定符和类型 | 字段和说明 |
|---|---|
protected Object[] |
choices
The possible choices.
|
protected Object |
choosen
The currently choosen element.
|
atts, isCollapsed, isReadOnly, isRequired, labelName, name, NEWLINE, OFFSET, value| 构造器和说明 |
|---|
NewXMLChoice(String name,
Object[] choices)
Creates a new instance of element with the specified name, and
specifies the values of choices for the element.
|
NewXMLChoice(String name,
Object[] choices,
int choosenIndex)
Creates a new instance of element with the specified name,
specified choices for the element, and with chooseIndex'th
value choosen.
|
| 限定符和类型 | 方法和说明 |
|---|---|
Object |
clone()
Overrides super-method to apply cloning of
choices
field content, if it's content are instances of XMLElement
class. |
Object[] |
getChoices()
The possible choices could be instances of XMLElement class, or
can be instances of String.
|
Object |
getChoosen()
Choosen element is one of the choices.
|
NewXMLPanel |
getPanel()
The default panel that represents this class visually
is instance of
XMLComboPanel class. |
void |
refreshLabelName() |
void |
setReadOnly(boolean ro)
Overrides super-method to set this element and all it's choice elements
(if choices are instances of XMLElement class) read only value to the
one specified.
|
void |
setValue(Object v)
Overrides the super-method to set the value field and the choosen field
to the specified value.
|
fromXML, fromXML, getNode, getPrintDescription, getPrintDescription, isCollapsed, isEmpty, isReadOnly, isRequired, isValid, isValidEnter, setCollapsed, setLabelName, setRequired, toLabel, toName, toString, toValue, toXMLprotected Object choosen
protected Object[] choices
public NewXMLChoice(String name, Object[] choices)
name - The name of the 'choice' XML element
that this class represents.choices - The possible choices for this element.public NewXMLChoice(String name, Object[] choices, int choosenIndex)
name - The name of the 'choice' XML element
that this class represents.choices - The possible choices for this element.choosenIndex - The index of element to be choosen right after creation.public void setReadOnly(boolean ro)
setReadOnly 在类中 NewXMLElementro - true if element should be read only,
false otherwise.public void setValue(Object v)
setValue 在类中 NewXMLElementv - the choice to be set.public Object[] getChoices()
public Object getChoosen()
getChoices()public NewXMLPanel getPanel()
XMLComboPanel class. The panel
has the combo box that is filled with content of
choices field.getPanel 在类中 NewXMLElementpublic Object clone()
choices
field content, if it's content are instances of XMLElement
class.clone 在类中 NewXMLElementpublic void refreshLabelName()
refreshLabelName 在类中 NewXMLElementCopyright © 2023 onecode. All rights reserved.