From: amwaterhouse Date: Tue, 29 Nov 2005 17:57:41 +0000 (+0000) Subject: Save features and pdbids X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=bc3a0b87ed9289352dc0f9c81d9c041522ebebe0;p=jalview.git Save features and pdbids --- diff --git a/src/jalview/binding/Feature.java b/src/jalview/binding/Feature.java new file mode 100755 index 0000000..95d5192 --- /dev/null +++ b/src/jalview/binding/Feature.java @@ -0,0 +1,305 @@ +/* + * This class was automatically generated with + * Castor 0.9.6, using an XML + * Schema. + * $Id$ + */ + +package jalview.binding; + + //---------------------------------/ + //- Imported classes and packages -/ +//---------------------------------/ + +import java.io.IOException; +import java.io.Reader; +import java.io.Serializable; +import java.io.Writer; +import org.exolab.castor.xml.MarshalException; +import org.exolab.castor.xml.Marshaller; +import org.exolab.castor.xml.Unmarshaller; +import org.exolab.castor.xml.ValidationException; +import org.xml.sax.ContentHandler; + +/** + * Class Feature. + * + * @version $Revision$ $Date$ + */ +public class Feature implements java.io.Serializable { + + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Field _begin + */ + private int _begin; + + /** + * keeps track of state for field: _begin + */ + private boolean _has_begin; + + /** + * Field _end + */ + private int _end; + + /** + * keeps track of state for field: _end + */ + private boolean _has_end; + + /** + * Field _type + */ + private java.lang.String _type; + + /** + * Field _description + */ + private java.lang.String _description; + + /** + * Field _status + */ + private java.lang.String _status; + + + //----------------/ + //- Constructors -/ + //----------------/ + + public Feature() { + super(); + } //-- jalview.binding.Feature() + + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * Method deleteBegin + * + */ + public void deleteBegin() + { + this._has_begin= false; + } //-- void deleteBegin() + + /** + * Method deleteEnd + * + */ + public void deleteEnd() + { + this._has_end= false; + } //-- void deleteEnd() + + /** + * Returns the value of field 'begin'. + * + * @return int + * @return the value of field 'begin'. + */ + public int getBegin() + { + return this._begin; + } //-- int getBegin() + + /** + * Returns the value of field 'description'. + * + * @return String + * @return the value of field 'description'. + */ + public java.lang.String getDescription() + { + return this._description; + } //-- java.lang.String getDescription() + + /** + * Returns the value of field 'end'. + * + * @return int + * @return the value of field 'end'. + */ + public int getEnd() + { + return this._end; + } //-- int getEnd() + + /** + * Returns the value of field 'status'. + * + * @return String + * @return the value of field 'status'. + */ + public java.lang.String getStatus() + { + return this._status; + } //-- java.lang.String getStatus() + + /** + * Returns the value of field 'type'. + * + * @return String + * @return the value of field 'type'. + */ + public java.lang.String getType() + { + return this._type; + } //-- java.lang.String getType() + + /** + * Method hasBegin + * + * + * + * @return boolean + */ + public boolean hasBegin() + { + return this._has_begin; + } //-- boolean hasBegin() + + /** + * Method hasEnd + * + * + * + * @return boolean + */ + public boolean hasEnd() + { + return this._has_end; + } //-- boolean hasEnd() + + /** + * Method isValid + * + * + * + * @return boolean + */ + public boolean isValid() + { + try { + validate(); + } + catch (org.exolab.castor.xml.ValidationException vex) { + return false; + } + return true; + } //-- boolean isValid() + + /** + * Method marshal + * + * + * + * @param out + */ + public void marshal(java.io.Writer out) + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException + { + + Marshaller.marshal(this, out); + } //-- void marshal(java.io.Writer) + + /** + * Method marshal + * + * + * + * @param handler + */ + public void marshal(org.xml.sax.ContentHandler handler) + throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException + { + + Marshaller.marshal(this, handler); + } //-- void marshal(org.xml.sax.ContentHandler) + + /** + * Sets the value of field 'begin'. + * + * @param begin the value of field 'begin'. + */ + public void setBegin(int begin) + { + this._begin = begin; + this._has_begin = true; + } //-- void setBegin(int) + + /** + * Sets the value of field 'description'. + * + * @param description the value of field 'description'. + */ + public void setDescription(java.lang.String description) + { + this._description = description; + } //-- void setDescription(java.lang.String) + + /** + * Sets the value of field 'end'. + * + * @param end the value of field 'end'. + */ + public void setEnd(int end) + { + this._end = end; + this._has_end = true; + } //-- void setEnd(int) + + /** + * Sets the value of field 'status'. + * + * @param status the value of field 'status'. + */ + public void setStatus(java.lang.String status) + { + this._status = status; + } //-- void setStatus(java.lang.String) + + /** + * Sets the value of field 'type'. + * + * @param type the value of field 'type'. + */ + public void setType(java.lang.String type) + { + this._type = type; + } //-- void setType(java.lang.String) + + /** + * Method unmarshal + * + * + * + * @param reader + * @return Object + */ + public static java.lang.Object unmarshal(java.io.Reader reader) + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException + { + return (jalview.binding.Feature) Unmarshaller.unmarshal(jalview.binding.Feature.class, reader); + } //-- java.lang.Object unmarshal(java.io.Reader) + + /** + * Method validate + * + */ + public void validate() + throws org.exolab.castor.xml.ValidationException + { + org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator(); + validator.validate(this); + } //-- void validate() + +} diff --git a/src/jalview/binding/Features.java b/src/jalview/binding/Features.java new file mode 100755 index 0000000..4706beb --- /dev/null +++ b/src/jalview/binding/Features.java @@ -0,0 +1,118 @@ +/* + * This class was automatically generated with + * Castor 0.9.6, using an XML + * Schema. + * $Id$ + */ + +package jalview.binding; + + //---------------------------------/ + //- Imported classes and packages -/ +//---------------------------------/ + +import java.io.IOException; +import java.io.Reader; +import java.io.Serializable; +import java.io.Writer; +import org.exolab.castor.xml.MarshalException; +import org.exolab.castor.xml.Marshaller; +import org.exolab.castor.xml.Unmarshaller; +import org.exolab.castor.xml.ValidationException; +import org.xml.sax.ContentHandler; + +/** + * Class Features. + * + * @version $Revision$ $Date$ + */ +public class Features extends Feature +implements java.io.Serializable +{ + + + //----------------/ + //- Constructors -/ + //----------------/ + + public Features() { + super(); + } //-- jalview.binding.Features() + + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * Method isValid + * + * + * + * @return boolean + */ + public boolean isValid() + { + try { + validate(); + } + catch (org.exolab.castor.xml.ValidationException vex) { + return false; + } + return true; + } //-- boolean isValid() + + /** + * Method marshal + * + * + * + * @param out + */ + public void marshal(java.io.Writer out) + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException + { + + Marshaller.marshal(this, out); + } //-- void marshal(java.io.Writer) + + /** + * Method marshal + * + * + * + * @param handler + */ + public void marshal(org.xml.sax.ContentHandler handler) + throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException + { + + Marshaller.marshal(this, handler); + } //-- void marshal(org.xml.sax.ContentHandler) + + /** + * Method unmarshal + * + * + * + * @param reader + * @return Object + */ + public static java.lang.Object unmarshal(java.io.Reader reader) + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException + { + return (jalview.binding.Features) Unmarshaller.unmarshal(jalview.binding.Features.class, reader); + } //-- java.lang.Object unmarshal(java.io.Reader) + + /** + * Method validate + * + */ + public void validate() + throws org.exolab.castor.xml.ValidationException + { + org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator(); + validator.validate(this); + } //-- void validate() + +} diff --git a/src/jalview/binding/JSeq.java b/src/jalview/binding/JSeq.java index 751409f..ee55945 100755 --- a/src/jalview/binding/JSeq.java +++ b/src/jalview/binding/JSeq.java @@ -15,6 +15,8 @@ import java.io.IOException; import java.io.Reader; import java.io.Serializable; import java.io.Writer; +import java.util.Enumeration; +import java.util.Vector; import org.exolab.castor.xml.MarshalException; import org.exolab.castor.xml.Marshaller; import org.exolab.castor.xml.Unmarshaller; @@ -73,6 +75,16 @@ public class JSeq implements java.io.Serializable { */ private boolean _has_id; + /** + * Field _featuresList + */ + private java.util.Vector _featuresList; + + /** + * Field _pdbidsList + */ + private java.util.Vector _pdbidsList; + //----------------/ //- Constructors -/ @@ -80,6 +92,8 @@ public class JSeq implements java.io.Serializable { public JSeq() { super(); + _featuresList = new Vector(); + _pdbidsList = new Vector(); } //-- jalview.binding.JSeq() @@ -88,6 +102,60 @@ public class JSeq implements java.io.Serializable { //-----------/ /** + * Method addFeatures + * + * + * + * @param vFeatures + */ + public void addFeatures(jalview.binding.Features vFeatures) + throws java.lang.IndexOutOfBoundsException + { + _featuresList.addElement(vFeatures); + } //-- void addFeatures(jalview.binding.Features) + + /** + * Method addFeatures + * + * + * + * @param index + * @param vFeatures + */ + public void addFeatures(int index, jalview.binding.Features vFeatures) + throws java.lang.IndexOutOfBoundsException + { + _featuresList.insertElementAt(vFeatures, index); + } //-- void addFeatures(int, jalview.binding.Features) + + /** + * Method addPdbids + * + * + * + * @param vPdbids + */ + public void addPdbids(jalview.binding.Pdbids vPdbids) + throws java.lang.IndexOutOfBoundsException + { + _pdbidsList.addElement(vPdbids); + } //-- void addPdbids(jalview.binding.Pdbids) + + /** + * Method addPdbids + * + * + * + * @param index + * @param vPdbids + */ + public void addPdbids(int index, jalview.binding.Pdbids vPdbids) + throws java.lang.IndexOutOfBoundsException + { + _pdbidsList.insertElementAt(vPdbids, index); + } //-- void addPdbids(int, jalview.binding.Pdbids) + + /** * Method deleteColour * */ @@ -124,6 +192,30 @@ public class JSeq implements java.io.Serializable { } //-- void deleteStart() /** + * Method enumerateFeatures + * + * + * + * @return Enumeration + */ + public java.util.Enumeration enumerateFeatures() + { + return _featuresList.elements(); + } //-- java.util.Enumeration enumerateFeatures() + + /** + * Method enumeratePdbids + * + * + * + * @return Enumeration + */ + public java.util.Enumeration enumeratePdbids() + { + return _pdbidsList.elements(); + } //-- java.util.Enumeration enumeratePdbids() + + /** * Returns the value of field 'colour'. * * @return int @@ -146,6 +238,54 @@ public class JSeq implements java.io.Serializable { } //-- int getEnd() /** + * Method getFeatures + * + * + * + * @param index + * @return Features + */ + public jalview.binding.Features getFeatures(int index) + throws java.lang.IndexOutOfBoundsException + { + //-- check bounds for index + if ((index < 0) || (index > _featuresList.size())) { + throw new IndexOutOfBoundsException(); + } + + return (jalview.binding.Features) _featuresList.elementAt(index); + } //-- jalview.binding.Features getFeatures(int) + + /** + * Method getFeatures + * + * + * + * @return Features + */ + public jalview.binding.Features[] getFeatures() + { + int size = _featuresList.size(); + jalview.binding.Features[] mArray = new jalview.binding.Features[size]; + for (int index = 0; index < size; index++) { + mArray[index] = (jalview.binding.Features) _featuresList.elementAt(index); + } + return mArray; + } //-- jalview.binding.Features[] getFeatures() + + /** + * Method getFeaturesCount + * + * + * + * @return int + */ + public int getFeaturesCount() + { + return _featuresList.size(); + } //-- int getFeaturesCount() + + /** * Returns the value of field 'id'. * * @return int @@ -157,6 +297,54 @@ public class JSeq implements java.io.Serializable { } //-- int getId() /** + * Method getPdbids + * + * + * + * @param index + * @return Pdbids + */ + public jalview.binding.Pdbids getPdbids(int index) + throws java.lang.IndexOutOfBoundsException + { + //-- check bounds for index + if ((index < 0) || (index > _pdbidsList.size())) { + throw new IndexOutOfBoundsException(); + } + + return (jalview.binding.Pdbids) _pdbidsList.elementAt(index); + } //-- jalview.binding.Pdbids getPdbids(int) + + /** + * Method getPdbids + * + * + * + * @return Pdbids + */ + public jalview.binding.Pdbids[] getPdbids() + { + int size = _pdbidsList.size(); + jalview.binding.Pdbids[] mArray = new jalview.binding.Pdbids[size]; + for (int index = 0; index < size; index++) { + mArray[index] = (jalview.binding.Pdbids) _pdbidsList.elementAt(index); + } + return mArray; + } //-- jalview.binding.Pdbids[] getPdbids() + + /** + * Method getPdbidsCount + * + * + * + * @return int + */ + public int getPdbidsCount() + { + return _pdbidsList.size(); + } //-- int getPdbidsCount() + + /** * Returns the value of field 'start'. * * @return int @@ -262,6 +450,54 @@ public class JSeq implements java.io.Serializable { } //-- void marshal(org.xml.sax.ContentHandler) /** + * Method removeAllFeatures + * + */ + public void removeAllFeatures() + { + _featuresList.removeAllElements(); + } //-- void removeAllFeatures() + + /** + * Method removeAllPdbids + * + */ + public void removeAllPdbids() + { + _pdbidsList.removeAllElements(); + } //-- void removeAllPdbids() + + /** + * Method removeFeatures + * + * + * + * @param index + * @return Features + */ + public jalview.binding.Features removeFeatures(int index) + { + java.lang.Object obj = _featuresList.elementAt(index); + _featuresList.removeElementAt(index); + return (jalview.binding.Features) obj; + } //-- jalview.binding.Features removeFeatures(int) + + /** + * Method removePdbids + * + * + * + * @param index + * @return Pdbids + */ + public jalview.binding.Pdbids removePdbids(int index) + { + java.lang.Object obj = _pdbidsList.elementAt(index); + _pdbidsList.removeElementAt(index); + return (jalview.binding.Pdbids) obj; + } //-- jalview.binding.Pdbids removePdbids(int) + + /** * Sets the value of field 'colour'. * * @param colour the value of field 'colour'. @@ -284,6 +520,40 @@ public class JSeq implements java.io.Serializable { } //-- void setEnd(int) /** + * Method setFeatures + * + * + * + * @param index + * @param vFeatures + */ + public void setFeatures(int index, jalview.binding.Features vFeatures) + throws java.lang.IndexOutOfBoundsException + { + //-- check bounds for index + if ((index < 0) || (index > _featuresList.size())) { + throw new IndexOutOfBoundsException(); + } + _featuresList.setElementAt(vFeatures, index); + } //-- void setFeatures(int, jalview.binding.Features) + + /** + * Method setFeatures + * + * + * + * @param featuresArray + */ + public void setFeatures(jalview.binding.Features[] featuresArray) + { + //-- copy array + _featuresList.removeAllElements(); + for (int i = 0; i < featuresArray.length; i++) { + _featuresList.addElement(featuresArray[i]); + } + } //-- void setFeatures(jalview.binding.Features) + + /** * Sets the value of field 'id'. * * @param id the value of field 'id'. @@ -295,6 +565,40 @@ public class JSeq implements java.io.Serializable { } //-- void setId(int) /** + * Method setPdbids + * + * + * + * @param index + * @param vPdbids + */ + public void setPdbids(int index, jalview.binding.Pdbids vPdbids) + throws java.lang.IndexOutOfBoundsException + { + //-- check bounds for index + if ((index < 0) || (index > _pdbidsList.size())) { + throw new IndexOutOfBoundsException(); + } + _pdbidsList.setElementAt(vPdbids, index); + } //-- void setPdbids(int, jalview.binding.Pdbids) + + /** + * Method setPdbids + * + * + * + * @param pdbidsArray + */ + public void setPdbids(jalview.binding.Pdbids[] pdbidsArray) + { + //-- copy array + _pdbidsList.removeAllElements(); + for (int i = 0; i < pdbidsArray.length; i++) { + _pdbidsList.addElement(pdbidsArray[i]); + } + } //-- void setPdbids(jalview.binding.Pdbids) + + /** * Sets the value of field 'start'. * * @param start the value of field 'start'. diff --git a/src/jalview/binding/Pdbentry.java b/src/jalview/binding/Pdbentry.java new file mode 100755 index 0000000..7e0ae30 --- /dev/null +++ b/src/jalview/binding/Pdbentry.java @@ -0,0 +1,326 @@ +/* + * This class was automatically generated with + * Castor 0.9.6, using an XML + * Schema. + * $Id$ + */ + +package jalview.binding; + + //---------------------------------/ + //- Imported classes and packages -/ +//---------------------------------/ + +import java.io.IOException; +import java.io.Reader; +import java.io.Serializable; +import java.io.Writer; +import java.util.Enumeration; +import java.util.Vector; +import org.exolab.castor.xml.MarshalException; +import org.exolab.castor.xml.Marshaller; +import org.exolab.castor.xml.Unmarshaller; +import org.exolab.castor.xml.ValidationException; +import org.xml.sax.ContentHandler; + +/** + * Class Pdbentry. + * + * @version $Revision$ $Date$ + */ +public class Pdbentry implements java.io.Serializable { + + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Field _id + */ + private java.lang.String _id; + + /** + * Field _type + */ + private java.lang.String _type; + + /** + * Field _items + */ + private java.util.Vector _items; + + + //----------------/ + //- Constructors -/ + //----------------/ + + public Pdbentry() { + super(); + _items = new Vector(); + } //-- jalview.binding.Pdbentry() + + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * Method addPdbentryItem + * + * + * + * @param vPdbentryItem + */ + public void addPdbentryItem(jalview.binding.PdbentryItem vPdbentryItem) + throws java.lang.IndexOutOfBoundsException + { + _items.addElement(vPdbentryItem); + } //-- void addPdbentryItem(jalview.binding.PdbentryItem) + + /** + * Method addPdbentryItem + * + * + * + * @param index + * @param vPdbentryItem + */ + public void addPdbentryItem(int index, jalview.binding.PdbentryItem vPdbentryItem) + throws java.lang.IndexOutOfBoundsException + { + _items.insertElementAt(vPdbentryItem, index); + } //-- void addPdbentryItem(int, jalview.binding.PdbentryItem) + + /** + * Method enumeratePdbentryItem + * + * + * + * @return Enumeration + */ + public java.util.Enumeration enumeratePdbentryItem() + { + return _items.elements(); + } //-- java.util.Enumeration enumeratePdbentryItem() + + /** + * Returns the value of field 'id'. + * + * @return String + * @return the value of field 'id'. + */ + public java.lang.String getId() + { + return this._id; + } //-- java.lang.String getId() + + /** + * Method getPdbentryItem + * + * + * + * @param index + * @return PdbentryItem + */ + public jalview.binding.PdbentryItem getPdbentryItem(int index) + throws java.lang.IndexOutOfBoundsException + { + //-- check bounds for index + if ((index < 0) || (index > _items.size())) { + throw new IndexOutOfBoundsException(); + } + + return (jalview.binding.PdbentryItem) _items.elementAt(index); + } //-- jalview.binding.PdbentryItem getPdbentryItem(int) + + /** + * Method getPdbentryItem + * + * + * + * @return PdbentryItem + */ + public jalview.binding.PdbentryItem[] getPdbentryItem() + { + int size = _items.size(); + jalview.binding.PdbentryItem[] mArray = new jalview.binding.PdbentryItem[size]; + for (int index = 0; index < size; index++) { + mArray[index] = (jalview.binding.PdbentryItem) _items.elementAt(index); + } + return mArray; + } //-- jalview.binding.PdbentryItem[] getPdbentryItem() + + /** + * Method getPdbentryItemCount + * + * + * + * @return int + */ + public int getPdbentryItemCount() + { + return _items.size(); + } //-- int getPdbentryItemCount() + + /** + * Returns the value of field 'type'. + * + * @return String + * @return the value of field 'type'. + */ + public java.lang.String getType() + { + return this._type; + } //-- java.lang.String getType() + + /** + * Method isValid + * + * + * + * @return boolean + */ + public boolean isValid() + { + try { + validate(); + } + catch (org.exolab.castor.xml.ValidationException vex) { + return false; + } + return true; + } //-- boolean isValid() + + /** + * Method marshal + * + * + * + * @param out + */ + public void marshal(java.io.Writer out) + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException + { + + Marshaller.marshal(this, out); + } //-- void marshal(java.io.Writer) + + /** + * Method marshal + * + * + * + * @param handler + */ + public void marshal(org.xml.sax.ContentHandler handler) + throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException + { + + Marshaller.marshal(this, handler); + } //-- void marshal(org.xml.sax.ContentHandler) + + /** + * Method removeAllPdbentryItem + * + */ + public void removeAllPdbentryItem() + { + _items.removeAllElements(); + } //-- void removeAllPdbentryItem() + + /** + * Method removePdbentryItem + * + * + * + * @param index + * @return PdbentryItem + */ + public jalview.binding.PdbentryItem removePdbentryItem(int index) + { + java.lang.Object obj = _items.elementAt(index); + _items.removeElementAt(index); + return (jalview.binding.PdbentryItem) obj; + } //-- jalview.binding.PdbentryItem removePdbentryItem(int) + + /** + * Sets the value of field 'id'. + * + * @param id the value of field 'id'. + */ + public void setId(java.lang.String id) + { + this._id = id; + } //-- void setId(java.lang.String) + + /** + * Method setPdbentryItem + * + * + * + * @param index + * @param vPdbentryItem + */ + public void setPdbentryItem(int index, jalview.binding.PdbentryItem vPdbentryItem) + throws java.lang.IndexOutOfBoundsException + { + //-- check bounds for index + if ((index < 0) || (index > _items.size())) { + throw new IndexOutOfBoundsException(); + } + _items.setElementAt(vPdbentryItem, index); + } //-- void setPdbentryItem(int, jalview.binding.PdbentryItem) + + /** + * Method setPdbentryItem + * + * + * + * @param pdbentryItemArray + */ + public void setPdbentryItem(jalview.binding.PdbentryItem[] pdbentryItemArray) + { + //-- copy array + _items.removeAllElements(); + for (int i = 0; i < pdbentryItemArray.length; i++) { + _items.addElement(pdbentryItemArray[i]); + } + } //-- void setPdbentryItem(jalview.binding.PdbentryItem) + + /** + * Sets the value of field 'type'. + * + * @param type the value of field 'type'. + */ + public void setType(java.lang.String type) + { + this._type = type; + } //-- void setType(java.lang.String) + + /** + * Method unmarshal + * + * + * + * @param reader + * @return Object + */ + public static java.lang.Object unmarshal(java.io.Reader reader) + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException + { + return (jalview.binding.Pdbentry) Unmarshaller.unmarshal(jalview.binding.Pdbentry.class, reader); + } //-- java.lang.Object unmarshal(java.io.Reader) + + /** + * Method validate + * + */ + public void validate() + throws org.exolab.castor.xml.ValidationException + { + org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator(); + validator.validate(this); + } //-- void validate() + +} diff --git a/src/jalview/binding/PdbentryItem.java b/src/jalview/binding/PdbentryItem.java new file mode 100755 index 0000000..d797520 --- /dev/null +++ b/src/jalview/binding/PdbentryItem.java @@ -0,0 +1,197 @@ +/* + * This class was automatically generated with + * Castor 0.9.6, using an XML + * Schema. + * $Id$ + */ + +package jalview.binding; + + //---------------------------------/ + //- Imported classes and packages -/ +//---------------------------------/ + +import java.io.Serializable; +import java.util.Enumeration; +import java.util.Vector; +import org.exolab.castor.xml.Marshaller; +import org.exolab.castor.xml.Unmarshaller; + +/** + * Class PdbentryItem. + * + * @version $Revision$ $Date$ + */ +public class PdbentryItem implements java.io.Serializable { + + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Field _propertyList + */ + private java.util.Vector _propertyList; + + + //----------------/ + //- Constructors -/ + //----------------/ + + public PdbentryItem() { + super(); + _propertyList = new Vector(); + } //-- jalview.binding.PdbentryItem() + + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * Method addProperty + * + * + * + * @param vProperty + */ + public void addProperty(jalview.binding.Property vProperty) + throws java.lang.IndexOutOfBoundsException + { + _propertyList.addElement(vProperty); + } //-- void addProperty(jalview.binding.Property) + + /** + * Method addProperty + * + * + * + * @param index + * @param vProperty + */ + public void addProperty(int index, jalview.binding.Property vProperty) + throws java.lang.IndexOutOfBoundsException + { + _propertyList.insertElementAt(vProperty, index); + } //-- void addProperty(int, jalview.binding.Property) + + /** + * Method enumerateProperty + * + * + * + * @return Enumeration + */ + public java.util.Enumeration enumerateProperty() + { + return _propertyList.elements(); + } //-- java.util.Enumeration enumerateProperty() + + /** + * Method getProperty + * + * + * + * @param index + * @return Property + */ + public jalview.binding.Property getProperty(int index) + throws java.lang.IndexOutOfBoundsException + { + //-- check bounds for index + if ((index < 0) || (index > _propertyList.size())) { + throw new IndexOutOfBoundsException(); + } + + return (jalview.binding.Property) _propertyList.elementAt(index); + } //-- jalview.binding.Property getProperty(int) + + /** + * Method getProperty + * + * + * + * @return Property + */ + public jalview.binding.Property[] getProperty() + { + int size = _propertyList.size(); + jalview.binding.Property[] mArray = new jalview.binding.Property[size]; + for (int index = 0; index < size; index++) { + mArray[index] = (jalview.binding.Property) _propertyList.elementAt(index); + } + return mArray; + } //-- jalview.binding.Property[] getProperty() + + /** + * Method getPropertyCount + * + * + * + * @return int + */ + public int getPropertyCount() + { + return _propertyList.size(); + } //-- int getPropertyCount() + + /** + * Method removeAllProperty + * + */ + public void removeAllProperty() + { + _propertyList.removeAllElements(); + } //-- void removeAllProperty() + + /** + * Method removeProperty + * + * + * + * @param index + * @return Property + */ + public jalview.binding.Property removeProperty(int index) + { + java.lang.Object obj = _propertyList.elementAt(index); + _propertyList.removeElementAt(index); + return (jalview.binding.Property) obj; + } //-- jalview.binding.Property removeProperty(int) + + /** + * Method setProperty + * + * + * + * @param index + * @param vProperty + */ + public void setProperty(int index, jalview.binding.Property vProperty) + throws java.lang.IndexOutOfBoundsException + { + //-- check bounds for index + if ((index < 0) || (index > _propertyList.size())) { + throw new IndexOutOfBoundsException(); + } + _propertyList.setElementAt(vProperty, index); + } //-- void setProperty(int, jalview.binding.Property) + + /** + * Method setProperty + * + * + * + * @param propertyArray + */ + public void setProperty(jalview.binding.Property[] propertyArray) + { + //-- copy array + _propertyList.removeAllElements(); + for (int i = 0; i < propertyArray.length; i++) { + _propertyList.addElement(propertyArray[i]); + } + } //-- void setProperty(jalview.binding.Property) + +} diff --git a/src/jalview/binding/Pdbids.java b/src/jalview/binding/Pdbids.java new file mode 100755 index 0000000..4875b8b --- /dev/null +++ b/src/jalview/binding/Pdbids.java @@ -0,0 +1,118 @@ +/* + * This class was automatically generated with + * Castor 0.9.6, using an XML + * Schema. + * $Id$ + */ + +package jalview.binding; + + //---------------------------------/ + //- Imported classes and packages -/ +//---------------------------------/ + +import java.io.IOException; +import java.io.Reader; +import java.io.Serializable; +import java.io.Writer; +import org.exolab.castor.xml.MarshalException; +import org.exolab.castor.xml.Marshaller; +import org.exolab.castor.xml.Unmarshaller; +import org.exolab.castor.xml.ValidationException; +import org.xml.sax.ContentHandler; + +/** + * Class Pdbids. + * + * @version $Revision$ $Date$ + */ +public class Pdbids extends Pdbentry +implements java.io.Serializable +{ + + + //----------------/ + //- Constructors -/ + //----------------/ + + public Pdbids() { + super(); + } //-- jalview.binding.Pdbids() + + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * Method isValid + * + * + * + * @return boolean + */ + public boolean isValid() + { + try { + validate(); + } + catch (org.exolab.castor.xml.ValidationException vex) { + return false; + } + return true; + } //-- boolean isValid() + + /** + * Method marshal + * + * + * + * @param out + */ + public void marshal(java.io.Writer out) + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException + { + + Marshaller.marshal(this, out); + } //-- void marshal(java.io.Writer) + + /** + * Method marshal + * + * + * + * @param handler + */ + public void marshal(org.xml.sax.ContentHandler handler) + throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException + { + + Marshaller.marshal(this, handler); + } //-- void marshal(org.xml.sax.ContentHandler) + + /** + * Method unmarshal + * + * + * + * @param reader + * @return Object + */ + public static java.lang.Object unmarshal(java.io.Reader reader) + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException + { + return (jalview.binding.Pdbids) Unmarshaller.unmarshal(jalview.binding.Pdbids.class, reader); + } //-- java.lang.Object unmarshal(java.io.Reader) + + /** + * Method validate + * + */ + public void validate() + throws org.exolab.castor.xml.ValidationException + { + org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator(); + validator.validate(this); + } //-- void validate() + +} diff --git a/src/jalview/binding/Property.java b/src/jalview/binding/Property.java new file mode 100755 index 0000000..c0a1cdd --- /dev/null +++ b/src/jalview/binding/Property.java @@ -0,0 +1,173 @@ +/* + * This class was automatically generated with + * Castor 0.9.6, using an XML + * Schema. + * $Id$ + */ + +package jalview.binding; + + //---------------------------------/ + //- Imported classes and packages -/ +//---------------------------------/ + +import java.io.IOException; +import java.io.Reader; +import java.io.Serializable; +import java.io.Writer; +import org.exolab.castor.xml.MarshalException; +import org.exolab.castor.xml.Marshaller; +import org.exolab.castor.xml.Unmarshaller; +import org.exolab.castor.xml.ValidationException; +import org.xml.sax.ContentHandler; + +/** + * Class Property. + * + * @version $Revision$ $Date$ + */ +public class Property implements java.io.Serializable { + + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Field _name + */ + private java.lang.String _name; + + /** + * Field _value + */ + private java.lang.String _value; + + + //----------------/ + //- Constructors -/ + //----------------/ + + public Property() { + super(); + } //-- jalview.binding.Property() + + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * Returns the value of field 'name'. + * + * @return String + * @return the value of field 'name'. + */ + public java.lang.String getName() + { + return this._name; + } //-- java.lang.String getName() + + /** + * Returns the value of field 'value'. + * + * @return String + * @return the value of field 'value'. + */ + public java.lang.String getValue() + { + return this._value; + } //-- java.lang.String getValue() + + /** + * Method isValid + * + * + * + * @return boolean + */ + public boolean isValid() + { + try { + validate(); + } + catch (org.exolab.castor.xml.ValidationException vex) { + return false; + } + return true; + } //-- boolean isValid() + + /** + * Method marshal + * + * + * + * @param out + */ + public void marshal(java.io.Writer out) + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException + { + + Marshaller.marshal(this, out); + } //-- void marshal(java.io.Writer) + + /** + * Method marshal + * + * + * + * @param handler + */ + public void marshal(org.xml.sax.ContentHandler handler) + throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException + { + + Marshaller.marshal(this, handler); + } //-- void marshal(org.xml.sax.ContentHandler) + + /** + * Sets the value of field 'name'. + * + * @param name the value of field 'name'. + */ + public void setName(java.lang.String name) + { + this._name = name; + } //-- void setName(java.lang.String) + + /** + * Sets the value of field 'value'. + * + * @param value the value of field 'value'. + */ + public void setValue(java.lang.String value) + { + this._value = value; + } //-- void setValue(java.lang.String) + + /** + * Method unmarshal + * + * + * + * @param reader + * @return Object + */ + public static java.lang.Object unmarshal(java.io.Reader reader) + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException + { + return (jalview.binding.Property) Unmarshaller.unmarshal(jalview.binding.Property.class, reader); + } //-- java.lang.Object unmarshal(java.io.Reader) + + /** + * Method validate + * + */ + public void validate() + throws org.exolab.castor.xml.ValidationException + { + org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator(); + validator.validate(this); + } //-- void validate() + +} diff --git a/src/jalview/gui/Jalview2XML.java b/src/jalview/gui/Jalview2XML.java index 28840e7..bbe3389 100755 --- a/src/jalview/gui/Jalview2XML.java +++ b/src/jalview/gui/Jalview2XML.java @@ -192,6 +192,56 @@ public class Jalview2XML jseq.setId(id); + if(jal.getSequenceAt(i).getDatasetSequence().getSequenceFeatures()!=null) + { + Enumeration en = jal.getSequenceAt(i).getDatasetSequence().getSequenceFeatures().elements(); + while(en.hasMoreElements()) + { + Features features = new Features(); + jalview.datamodel.SequenceFeature sf + = (jalview.datamodel.SequenceFeature)en.nextElement(); + + features.setBegin(sf.getBegin()); + features.setEnd(sf.getEnd()); + features.setDescription(sf.getDescription()); + features.setStatus(sf.getStatus()); + features.setType(sf.getType()); + jseq.addFeatures(features); + } + } + + if(jal.getSequenceAt(i).getDatasetSequence().getPDBId()!=null) + { + Enumeration en = jal.getSequenceAt(i).getDatasetSequence().getPDBId().elements(); + while(en.hasMoreElements()) + { + Pdbids pdb = new Pdbids(); + jalview.datamodel.PDBEntry entry + = (jalview.datamodel.PDBEntry)en.nextElement(); + + pdb.setId(entry.getId()); + pdb.setType(entry.getType()); + + if(entry.getProperty()!=null) + { + PdbentryItem item = new PdbentryItem(); + Hashtable properties = entry.getProperty(); + Enumeration en2 = properties.keys(); + while(en2.hasMoreElements()) + { + Property prop = new Property(); + String key = en2.nextElement().toString(); + prop.setName(key); + prop.setValue( properties.get(key).toString() ); + item.addProperty(prop); + } + pdb.addPdbentryItem(item); + } + + jseq.addPdbids(pdb); + } + } + jms.addJSeq(jseq); vamsasSet.addSequence(vamsasSeq); id++; @@ -346,6 +396,7 @@ public class Jalview2XML jms.setJGroup(groups); } + ///////////SAVE VIEWPORT Viewport view = new Viewport(); view.setTitle(af.getTitle()); @@ -570,7 +621,6 @@ public class Jalview2XML //LOAD SEQUENCES jalview.datamodel.Sequence[] jseqs = new jalview.datamodel.Sequence[vamsasSeq.length]; JSeq[] JSEQ = object.getJalviewModelSequence().getJSeq(); - for (int i = 0; i < vamsasSeq.length; i++) { jseqs[i] = new jalview.datamodel.Sequence(vamsasSeq[i].getName(), @@ -582,9 +632,41 @@ public class Jalview2XML seqids.add(jseqs[i]); } + ///SequenceFeatures are added to the DatasetSequence, + // so we must create the dataset before loading features ///////////////////////////////// jalview.datamodel.Alignment al = new jalview.datamodel.Alignment(jseqs); + al.setDataset(null); + ///////////////////////////////// + + for (int i = 0; i < vamsasSeq.length; i++) + { + if (JSEQ[i].getFeaturesCount() > 0) + { + Features[] features = JSEQ[i].getFeatures(); + for (int f = 0; f < features.length; f++) + { + //features[f].getBegin() + jalview.datamodel.SequenceFeature sf + = new jalview.datamodel.SequenceFeature(features[f].getType(), + features[f].getDescription(), features[f].getStatus(), + features[f].getBegin(), features[f].getEnd()); + al.getSequenceAt(i).getDatasetSequence().addSequenceFeature(sf); + } + } + if (JSEQ[i].getPdbidsCount() > 0) + { + Pdbids[] ids = JSEQ[i].getPdbids(); + for (int p = 0; p < ids.length; p++) + { + jalview.datamodel.PDBEntry entry = new jalview.datamodel.PDBEntry(); + entry.setId(ids[p].getId()); + entry.setType(ids[p].getType()); + al.getSequenceAt(i).getDatasetSequence().addPDBId(entry); + } + } + } ///////////////////////////////// ////////////////////////////////// //LOAD ANNOTATIONS @@ -763,11 +845,9 @@ public class Jalview2XML if (view.getShowSequenceFeatures()) { - af.featureSettings.setEnabled(true); - af.viewport.showSequenceFeatures = true; - af.sequenceFeatures.setSelected(true); - new SequenceFeatureFetcher(al, af.alignPanel); - al.featuresAdded = true; + af.featureSettings.setEnabled(true); + af.viewport.showSequenceFeatures = true; + af.sequenceFeatures.setSelected(true); } Desktop.addInternalFrame(af, view.getTitle(),