X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fschemabinding%2Fversion2%2FAnnotationElementDescriptor.java;h=0eab95bcae0d4702ab542f7eea22a1a63da5af2b;hb=501657b3f11ab8e83271b6500375d8ae80b66c84;hp=40347553e656b7398c78bfe81fa3274423ce7383;hpb=ea49c8f1b0d681ec87547fc4055eb35a1165aee3;p=jalview.git diff --git a/src/jalview/schemabinding/version2/AnnotationElementDescriptor.java b/src/jalview/schemabinding/version2/AnnotationElementDescriptor.java index 4034755..0eab95b 100755 --- a/src/jalview/schemabinding/version2/AnnotationElementDescriptor.java +++ b/src/jalview/schemabinding/version2/AnnotationElementDescriptor.java @@ -106,6 +106,47 @@ public class AnnotationElementDescriptor extends org.exolab.castor.xml.util.XMLC fieldValidator.setValidator(typeValidator); } desc.setValidator(fieldValidator); + //-- _colour + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_colour", "colour", org.exolab.castor.xml.NodeType.Attribute); + handler = (new org.exolab.castor.xml.XMLFieldHandler() { + public java.lang.Object getValue( java.lang.Object object ) + throws IllegalStateException + { + AnnotationElement target = (AnnotationElement) object; + if(!target.hasColour()) + return null; + return new java.lang.Integer(target.getColour()); + } + public void setValue( java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try { + AnnotationElement target = (AnnotationElement) object; + // if null, use delete method for optional primitives + if (value == null) { + target.deleteColour(); + return; + } + target.setColour( ((java.lang.Integer)value).intValue()); + } + catch (java.lang.Exception ex) { + throw new IllegalStateException(ex.toString()); + } + } + public java.lang.Object newInstance( java.lang.Object parent ) { + return null; + } + } ); + desc.setHandler(handler); + addFieldDescriptor(desc); + + //-- validation code for: _colour + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + { //-- local scope + IntegerValidator typeValidator= new IntegerValidator(); + fieldValidator.setValidator(typeValidator); + } + desc.setValidator(fieldValidator); //-- initialize element descriptors //-- _displayCharacter @@ -135,13 +176,11 @@ public class AnnotationElementDescriptor extends org.exolab.castor.xml.util.XMLC } ); desc.setHandler(handler); desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2"); - desc.setRequired(true); desc.setMultivalued(false); addFieldDescriptor(desc); //-- validation code for: _displayCharacter fieldValidator = new org.exolab.castor.xml.FieldValidator(); - fieldValidator.setMinOccurs(1); { //-- local scope StringValidator typeValidator = new StringValidator(); typeValidator.setWhiteSpace("preserve"); @@ -175,13 +214,11 @@ public class AnnotationElementDescriptor extends org.exolab.castor.xml.util.XMLC } ); desc.setHandler(handler); desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2"); - desc.setRequired(true); desc.setMultivalued(false); addFieldDescriptor(desc); //-- validation code for: _description fieldValidator = new org.exolab.castor.xml.FieldValidator(); - fieldValidator.setMinOccurs(1); { //-- local scope StringValidator typeValidator = new StringValidator(); typeValidator.setWhiteSpace("preserve"); @@ -215,13 +252,11 @@ public class AnnotationElementDescriptor extends org.exolab.castor.xml.util.XMLC } ); desc.setHandler(handler); desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2"); - desc.setRequired(true); desc.setMultivalued(false); addFieldDescriptor(desc); //-- validation code for: _secondaryStructure fieldValidator = new org.exolab.castor.xml.FieldValidator(); - fieldValidator.setMinOccurs(1); { //-- local scope StringValidator typeValidator = new StringValidator(); typeValidator.setLength(1); @@ -245,9 +280,11 @@ public class AnnotationElementDescriptor extends org.exolab.castor.xml.util.XMLC { try { AnnotationElement target = (AnnotationElement) object; - // ignore null values for non optional primitives - if (value == null) return; - + // if null, use delete method for optional primitives + if (value == null) { + target.deleteValue(); + return; + } target.setValue( ((java.lang.Float)value).floatValue()); } catch (java.lang.Exception ex) { @@ -260,13 +297,11 @@ public class AnnotationElementDescriptor extends org.exolab.castor.xml.util.XMLC } ); desc.setHandler(handler); desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2"); - desc.setRequired(true); desc.setMultivalued(false); addFieldDescriptor(desc); //-- validation code for: _value fieldValidator = new org.exolab.castor.xml.FieldValidator(); - fieldValidator.setMinOccurs(1); { //-- local scope FloatValidator typeValidator = new FloatValidator(); fieldValidator.setValidator(typeValidator);