From 84c20bdc7d5c6bd3aea2c8dae5263ebd9c5e5458 Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Thu, 10 May 2007 07:12:06 +0000 Subject: [PATCH] save visible state of annotation --- src/jalview/schemabinding/version2/Annotation.java | 53 ++++++++++++++++++++ .../version2/AnnotationDescriptor.java | 41 +++++++++++++++ 2 files changed, 94 insertions(+) diff --git a/src/jalview/schemabinding/version2/Annotation.java b/src/jalview/schemabinding/version2/Annotation.java index 021fa8b..0084c75 100755 --- a/src/jalview/schemabinding/version2/Annotation.java +++ b/src/jalview/schemabinding/version2/Annotation.java @@ -106,6 +106,16 @@ public class Annotation implements java.io.Serializable { private boolean _has_score; /** + * Field _visible + */ + private boolean _visible; + + /** + * keeps track of state for field: _visible + */ + private boolean _has_visible; + + /** * Field _annotationElementList */ private java.util.Vector _annotationElementList; @@ -222,6 +232,15 @@ public class Annotation implements java.io.Serializable { } //-- void deleteScoreOnly() /** + * Method deleteVisible + * + */ + public void deleteVisible() + { + this._has_visible= false; + } //-- void deleteVisible() + + /** * Method enumerateAnnotationElement * * @@ -403,6 +422,17 @@ public class Annotation implements java.io.Serializable { } //-- jalview.schemabinding.version2.ThresholdLine getThresholdLine() /** + * Returns the value of field 'visible'. + * + * @return boolean + * @return the value of field 'visible'. + */ + public boolean getVisible() + { + return this._visible; + } //-- boolean getVisible() + + /** * Method hasGraph * * @@ -475,6 +505,18 @@ public class Annotation implements java.io.Serializable { } //-- boolean hasScoreOnly() /** + * Method hasVisible + * + * + * + * @return boolean + */ + public boolean hasVisible() + { + return this._has_visible; + } //-- boolean hasVisible() + + /** * Method isValid * * @@ -695,6 +737,17 @@ public class Annotation implements java.io.Serializable { } //-- void setThresholdLine(jalview.schemabinding.version2.ThresholdLine) /** + * Sets the value of field 'visible'. + * + * @param visible the value of field 'visible'. + */ + public void setVisible(boolean visible) + { + this._visible = visible; + this._has_visible = true; + } //-- void setVisible(boolean) + + /** * Method unmarshal * * diff --git a/src/jalview/schemabinding/version2/AnnotationDescriptor.java b/src/jalview/schemabinding/version2/AnnotationDescriptor.java index 28ceec1..e0380f3 100755 --- a/src/jalview/schemabinding/version2/AnnotationDescriptor.java +++ b/src/jalview/schemabinding/version2/AnnotationDescriptor.java @@ -383,6 +383,47 @@ public class AnnotationDescriptor extends org.exolab.castor.xml.util.XMLClassDes fieldValidator.setValidator(typeValidator); } desc.setValidator(fieldValidator); + //-- _visible + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_visible", "visible", org.exolab.castor.xml.NodeType.Attribute); + handler = (new org.exolab.castor.xml.XMLFieldHandler() { + public java.lang.Object getValue( java.lang.Object object ) + throws IllegalStateException + { + Annotation target = (Annotation) object; + if(!target.hasVisible()) + return null; + return (target.getVisible() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE); + } + public void setValue( java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try { + Annotation target = (Annotation) object; + // if null, use delete method for optional primitives + if (value == null) { + target.deleteVisible(); + return; + } + target.setVisible( ((java.lang.Boolean)value).booleanValue()); + } + 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: _visible + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + { //-- local scope + BooleanValidator typeValidator = new BooleanValidator(); + fieldValidator.setValidator(typeValidator); + } + desc.setValidator(fieldValidator); //-- initialize element descriptors //-- _annotationElementList -- 1.7.10.2