diff options
| author | Andrew Branson <andrew.branson@cern.ch> | 2012-05-02 16:22:20 +0200 |
|---|---|---|
| committer | Andrew Branson <andrew.branson@cern.ch> | 2012-05-02 16:22:20 +0200 |
| commit | a1bcd4a2304134db7d5fa1f3cbe2f70df6549566 (patch) | |
| tree | f19d5565b639c23d4beba2d20c3f07911da71d85 | |
| parent | 246994285ab3e4bf754d2d684a21c4b66e619c9b (diff) | |
Outcome form robustness
4 files changed, 10 insertions, 4 deletions
diff --git a/resources/boot/OD/Module.xsd b/resources/boot/OD/Module.xsd index 933d696..6cd84e0 100644 --- a/resources/boot/OD/Module.xsd +++ b/resources/boot/OD/Module.xsd @@ -9,7 +9,7 @@ <xs:sequence>
<xs:element name="Description" type="xs:string"/>
<xs:element name="Version" type="xs:string"/>
- <xs:element name="Dependency" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element name="Dependency" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
@@ -43,7 +43,7 @@ <xs:documentation>Items to import into or verify within the Cristal server upon launch.</xs:documentation>
</xs:annotation>
<xs:complexType>
- <xs:choice maxOccurs="unbounded">
+ <xs:sequence>
<xs:element name="Resource" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:simpleContent>
@@ -109,7 +109,7 @@ <xs:attribute name="password" type="xs:string" use="required"/>
</xs:complexType>
</xs:element>
- </xs:choice>
+ </xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
diff --git a/source/com/c2kernel/gui/tabs/outcome/form/AttributeList.java b/source/com/c2kernel/gui/tabs/outcome/form/AttributeList.java index 3d6cc6e..7d15452 100644 --- a/source/com/c2kernel/gui/tabs/outcome/form/AttributeList.java +++ b/source/com/c2kernel/gui/tabs/outcome/form/AttributeList.java @@ -143,6 +143,8 @@ public class AttributeList extends JPanel { thisField = e.next();
thisDecl = content.getAttributeDecl(thisField.getName());
+ // HACK: if we don't resolve the reference, the type will be null
+ if (thisDecl.isReference()) thisDecl = thisDecl.getReference();
thisAttr = newAttribute(myElement, thisDecl);
// add into parent - fill in field
try {
diff --git a/source/com/c2kernel/gui/tabs/outcome/form/DimensionTableModel.java b/source/com/c2kernel/gui/tabs/outcome/form/DimensionTableModel.java index 45bdbc8..ac6a9f2 100644 --- a/source/com/c2kernel/gui/tabs/outcome/form/DimensionTableModel.java +++ b/source/com/c2kernel/gui/tabs/outcome/form/DimensionTableModel.java @@ -39,7 +39,6 @@ public class DimensionTableModel extends AbstractTableModel { public DimensionTableModel(ElementDecl model, boolean readOnly) throws StructuralException {
XMLType modelContent = model.getType();
-
this.model = model;
this.readOnly = readOnly;
// use text node for simple types
@@ -63,6 +62,10 @@ public class DimensionTableModel extends AbstractTableModel { // process attributes
for (Enumeration<?> e = elementType.getAttributeDecls(); e.hasMoreElements();) {
AttributeDecl thisAttr = (AttributeDecl)e.nextElement();
+ // HACK: if we don't resolve the reference, the type will be null
+ if (thisAttr.isReference()) thisAttr = thisAttr.getReference();
+ if (thisAttr.getSimpleType() == null)
+ throw new StructuralException("Attribute "+thisAttr.getName()+" in "+model.getName()+" has no type");
addColumn(thisAttr.getName(), thisAttr, thisAttr.getSimpleType().getTypeCode(), new Boolean(thisAttr.isFixed()));
}
diff --git a/source/com/c2kernel/gui/tabs/outcome/form/field/StringEditField.java b/source/com/c2kernel/gui/tabs/outcome/form/field/StringEditField.java index 5f6a384..0e5fee9 100644 --- a/source/com/c2kernel/gui/tabs/outcome/form/field/StringEditField.java +++ b/source/com/c2kernel/gui/tabs/outcome/form/field/StringEditField.java @@ -103,6 +103,7 @@ public class StringEditField implements FocusListener, DomainKeyConsumer { }
public static StringEditField getEditField(AttributeDecl model) throws StructuralException {
+ if (model.isReference()) model = model.getReference();
StringEditField newField = getFieldForType(model.getSimpleType());
newField.setDecl(model);
return newField;
|
