summaryrefslogtreecommitdiff
path: root/source/com/c2kernel/gui/tabs
diff options
context:
space:
mode:
authorAndrew Branson <andrew.branson@cern.ch>2012-05-02 16:22:20 +0200
committerAndrew Branson <andrew.branson@cern.ch>2012-05-02 16:22:20 +0200
commita1bcd4a2304134db7d5fa1f3cbe2f70df6549566 (patch)
treef19d5565b639c23d4beba2d20c3f07911da71d85 /source/com/c2kernel/gui/tabs
parent246994285ab3e4bf754d2d684a21c4b66e619c9b (diff)
Outcome form robustness
Diffstat (limited to 'source/com/c2kernel/gui/tabs')
-rw-r--r--source/com/c2kernel/gui/tabs/outcome/form/AttributeList.java2
-rw-r--r--source/com/c2kernel/gui/tabs/outcome/form/DimensionTableModel.java5
-rw-r--r--source/com/c2kernel/gui/tabs/outcome/form/field/StringEditField.java1
3 files changed, 7 insertions, 1 deletions
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;