This commit was manufactured by cvs2svn to create branch 'VamJalview'.
authorjprocter <Jim Procter>
Thu, 7 Sep 2006 11:39:37 +0000 (11:39 +0000)
committerjprocter <Jim Procter>
Thu, 7 Sep 2006 11:39:37 +0000 (11:39 +0000)
Cherrypick from master 2006-09-07 11:39:36 UTC jimp 'added copy consensus sequence to consensus annotation popup menu':
    src/jalview/appletgui/Tooltip.java
    src/jalview/datamodel/.cvsignore
    src/jalview/datamodel/AlignmentView.java
    src/jalview/datamodel/CigarArray.java
    src/jalview/datamodel/CigarBase.java
    src/jalview/datamodel/CigarCigar.java
    src/jalview/datamodel/CigarSimple.java
    src/jalview/datamodel/ColumnSelection.java
    src/jalview/datamodel/DBRefSource.java
    src/jalview/datamodel/SeqCigar.java
    src/jalview/datamodel/UniprotProteinName.java
    src/jalview/gui/AnnotationExporter.java
    src/jalview/gui/DasSourceBrowser.java
    src/jalview/gui/Jalview2XML_V1.java
    src/jalview/io/AnnotationFile.java
    src/jalview/io/DBRefFetcher.java
    src/jalview/io/DasSequenceFeatureFetcher.java
    src/jalview/io/FeaturesFile.java
    src/jalview/io/JnetAnnotationMaker.java
    src/jalview/io/StockholmFile.java
    src/jalview/jbgui/GDasSourceBrowser.java
    src/jalview/schemabinding/version2/Alignment.java
    src/jalview/schemabinding/version2/AlignmentDescriptor.java
    src/jalview/schemabinding/version2/Annotation.java
    src/jalview/schemabinding/version2/AnnotationColours.java
    src/jalview/schemabinding/version2/AnnotationColoursDescriptor.java
    src/jalview/schemabinding/version2/AnnotationDescriptor.java
    src/jalview/schemabinding/version2/AnnotationElement.java
    src/jalview/schemabinding/version2/AnnotationElementDescriptor.java
    src/jalview/schemabinding/version2/Colour.java
    src/jalview/schemabinding/version2/ColourDescriptor.java
    src/jalview/schemabinding/version2/DBRef.java
    src/jalview/schemabinding/version2/DBRefDescriptor.java
    src/jalview/schemabinding/version2/Feature.java
    src/jalview/schemabinding/version2/FeatureDescriptor.java
    src/jalview/schemabinding/version2/FeatureSettings.java
    src/jalview/schemabinding/version2/FeatureSettingsDescriptor.java
    src/jalview/schemabinding/version2/Features.java
    src/jalview/schemabinding/version2/FeaturesDescriptor.java
    src/jalview/schemabinding/version2/HiddenColumns.java
    src/jalview/schemabinding/version2/HiddenColumnsDescriptor.java
    src/jalview/schemabinding/version2/JGroup.java
    src/jalview/schemabinding/version2/JGroupDescriptor.java
    src/jalview/schemabinding/version2/JSeq.java
    src/jalview/schemabinding/version2/JSeqDescriptor.java
    src/jalview/schemabinding/version2/JalviewModel.java
    src/jalview/schemabinding/version2/JalviewModelDescriptor.java
    src/jalview/schemabinding/version2/JalviewModelSequence.java
    src/jalview/schemabinding/version2/JalviewModelSequenceDescriptor.java
    src/jalview/schemabinding/version2/JalviewUserColours.java
    src/jalview/schemabinding/version2/JalviewUserColoursDescriptor.java
    src/jalview/schemabinding/version2/OtherData.java
    src/jalview/schemabinding/version2/OtherDataDescriptor.java
    src/jalview/schemabinding/version2/Pdbentry.java
    src/jalview/schemabinding/version2/PdbentryDescriptor.java
    src/jalview/schemabinding/version2/PdbentryItem.java
    src/jalview/schemabinding/version2/PdbentryItemDescriptor.java
    src/jalview/schemabinding/version2/Pdbids.java
    src/jalview/schemabinding/version2/PdbidsDescriptor.java
    src/jalview/schemabinding/version2/Property.java
    src/jalview/schemabinding/version2/PropertyDescriptor.java
    src/jalview/schemabinding/version2/Sequence.java
    src/jalview/schemabinding/version2/SequenceDescriptor.java
    src/jalview/schemabinding/version2/SequenceSet.java
    src/jalview/schemabinding/version2/SequenceSetDescriptor.java
    src/jalview/schemabinding/version2/SequenceType.java
    src/jalview/schemabinding/version2/SequenceTypeDescriptor.java
    src/jalview/schemabinding/version2/Setting.java
    src/jalview/schemabinding/version2/SettingDescriptor.java
    src/jalview/schemabinding/version2/ThresholdLine.java
    src/jalview/schemabinding/version2/ThresholdLineDescriptor.java
    src/jalview/schemabinding/version2/Tree.java
    src/jalview/schemabinding/version2/TreeDescriptor.java
    src/jalview/schemabinding/version2/UserColourScheme.java
    src/jalview/schemabinding/version2/UserColourSchemeDescriptor.java
    src/jalview/schemabinding/version2/UserColours.java
    src/jalview/schemabinding/version2/UserColoursDescriptor.java
    src/jalview/schemabinding/version2/VAMSAS.java
    src/jalview/schemabinding/version2/VAMSASDescriptor.java
    src/jalview/schemabinding/version2/VamsasModel.java
    src/jalview/schemabinding/version2/VamsasModelDescriptor.java
    src/jalview/schemabinding/version2/Viewport.java
    src/jalview/schemabinding/version2/ViewportDescriptor.java
    src/jalview/util/ShiftList.java
    src/jalview/util/TableSorter.java
    src/jalview/ws/MsaWSThread.java
    src/jalview/ws/WSThread.java
    src/org/biojava/dasobert/das/DAS_FeatureRetrieve.java
    src/org/biojava/dasobert/das/DAS_Feature_Handler.java
    src/org/biojava/dasobert/das/FeatureThread.java
    src/org/biojava/dasobert/das2/Das2Capability.java
    src/org/biojava/dasobert/das2/Das2CapabilityImpl.java
    src/org/biojava/dasobert/das2/Das2Source.java
    src/org/biojava/dasobert/das2/Das2SourceImpl.java
    src/org/biojava/dasobert/das2/DasSourceConverter.java
    src/org/biojava/dasobert/das2/io/DAS2SourceHandler.java
    src/org/biojava/dasobert/das2/io/DasSourceReader.java
    src/org/biojava/dasobert/das2/io/DasSourceReaderImpl.java
    src/org/biojava/dasobert/dasregistry/Das1Source.java
    src/org/biojava/dasobert/dasregistry/Das2Validator.java
    src/org/biojava/dasobert/dasregistry/DasCoordSysComparator.java
    src/org/biojava/dasobert/dasregistry/DasCoordinateSystem.java
    src/org/biojava/dasobert/dasregistry/DasSource.java
    src/org/biojava/dasobert/dasregistry/DasSourceComparator.java
    src/org/biojava/dasobert/eventmodel/FeatureEvent.java
    src/org/biojava/dasobert/eventmodel/FeatureListener.java
    src/org/biojava/dasobert/eventmodel/ObjectListener.java
    src/org/biojava/dasobert/eventmodel/SequenceEvent.java
    src/org/biojava/dasobert/eventmodel/SequenceListener.java

109 files changed:
src/jalview/appletgui/Tooltip.java [new file with mode: 0755]
src/jalview/datamodel/.cvsignore [new file with mode: 0644]
src/jalview/datamodel/AlignmentView.java [new file with mode: 0644]
src/jalview/datamodel/CigarArray.java [new file with mode: 0644]
src/jalview/datamodel/CigarBase.java [new file with mode: 0644]
src/jalview/datamodel/CigarCigar.java [new file with mode: 0644]
src/jalview/datamodel/CigarSimple.java [new file with mode: 0644]
src/jalview/datamodel/ColumnSelection.java [new file with mode: 0644]
src/jalview/datamodel/DBRefSource.java [new file with mode: 0755]
src/jalview/datamodel/SeqCigar.java [new file with mode: 0644]
src/jalview/datamodel/UniprotProteinName.java [new file with mode: 0755]
src/jalview/gui/AnnotationExporter.java [new file with mode: 0755]
src/jalview/gui/DasSourceBrowser.java [new file with mode: 0755]
src/jalview/gui/Jalview2XML_V1.java [new file with mode: 0755]
src/jalview/io/AnnotationFile.java [new file with mode: 0755]
src/jalview/io/DBRefFetcher.java [new file with mode: 0644]
src/jalview/io/DasSequenceFeatureFetcher.java [new file with mode: 0755]
src/jalview/io/FeaturesFile.java [new file with mode: 0755]
src/jalview/io/JnetAnnotationMaker.java [new file with mode: 0755]
src/jalview/io/StockholmFile.java [new file with mode: 0644]
src/jalview/jbgui/GDasSourceBrowser.java [new file with mode: 0755]
src/jalview/schemabinding/version2/Alignment.java [new file with mode: 0755]
src/jalview/schemabinding/version2/AlignmentDescriptor.java [new file with mode: 0755]
src/jalview/schemabinding/version2/Annotation.java [new file with mode: 0755]
src/jalview/schemabinding/version2/AnnotationColours.java [new file with mode: 0755]
src/jalview/schemabinding/version2/AnnotationColoursDescriptor.java [new file with mode: 0755]
src/jalview/schemabinding/version2/AnnotationDescriptor.java [new file with mode: 0755]
src/jalview/schemabinding/version2/AnnotationElement.java [new file with mode: 0755]
src/jalview/schemabinding/version2/AnnotationElementDescriptor.java [new file with mode: 0755]
src/jalview/schemabinding/version2/Colour.java [new file with mode: 0755]
src/jalview/schemabinding/version2/ColourDescriptor.java [new file with mode: 0755]
src/jalview/schemabinding/version2/DBRef.java [new file with mode: 0644]
src/jalview/schemabinding/version2/DBRefDescriptor.java [new file with mode: 0644]
src/jalview/schemabinding/version2/Feature.java [new file with mode: 0755]
src/jalview/schemabinding/version2/FeatureDescriptor.java [new file with mode: 0755]
src/jalview/schemabinding/version2/FeatureSettings.java [new file with mode: 0755]
src/jalview/schemabinding/version2/FeatureSettingsDescriptor.java [new file with mode: 0755]
src/jalview/schemabinding/version2/Features.java [new file with mode: 0755]
src/jalview/schemabinding/version2/FeaturesDescriptor.java [new file with mode: 0755]
src/jalview/schemabinding/version2/HiddenColumns.java [new file with mode: 0644]
src/jalview/schemabinding/version2/HiddenColumnsDescriptor.java [new file with mode: 0644]
src/jalview/schemabinding/version2/JGroup.java [new file with mode: 0755]
src/jalview/schemabinding/version2/JGroupDescriptor.java [new file with mode: 0755]
src/jalview/schemabinding/version2/JSeq.java [new file with mode: 0755]
src/jalview/schemabinding/version2/JSeqDescriptor.java [new file with mode: 0755]
src/jalview/schemabinding/version2/JalviewModel.java [new file with mode: 0755]
src/jalview/schemabinding/version2/JalviewModelDescriptor.java [new file with mode: 0755]
src/jalview/schemabinding/version2/JalviewModelSequence.java [new file with mode: 0755]
src/jalview/schemabinding/version2/JalviewModelSequenceDescriptor.java [new file with mode: 0755]
src/jalview/schemabinding/version2/JalviewUserColours.java [new file with mode: 0755]
src/jalview/schemabinding/version2/JalviewUserColoursDescriptor.java [new file with mode: 0755]
src/jalview/schemabinding/version2/OtherData.java [new file with mode: 0644]
src/jalview/schemabinding/version2/OtherDataDescriptor.java [new file with mode: 0644]
src/jalview/schemabinding/version2/Pdbentry.java [new file with mode: 0755]
src/jalview/schemabinding/version2/PdbentryDescriptor.java [new file with mode: 0755]
src/jalview/schemabinding/version2/PdbentryItem.java [new file with mode: 0755]
src/jalview/schemabinding/version2/PdbentryItemDescriptor.java [new file with mode: 0755]
src/jalview/schemabinding/version2/Pdbids.java [new file with mode: 0755]
src/jalview/schemabinding/version2/PdbidsDescriptor.java [new file with mode: 0755]
src/jalview/schemabinding/version2/Property.java [new file with mode: 0755]
src/jalview/schemabinding/version2/PropertyDescriptor.java [new file with mode: 0755]
src/jalview/schemabinding/version2/Sequence.java [new file with mode: 0755]
src/jalview/schemabinding/version2/SequenceDescriptor.java [new file with mode: 0755]
src/jalview/schemabinding/version2/SequenceSet.java [new file with mode: 0755]
src/jalview/schemabinding/version2/SequenceSetDescriptor.java [new file with mode: 0755]
src/jalview/schemabinding/version2/SequenceType.java [new file with mode: 0755]
src/jalview/schemabinding/version2/SequenceTypeDescriptor.java [new file with mode: 0755]
src/jalview/schemabinding/version2/Setting.java [new file with mode: 0755]
src/jalview/schemabinding/version2/SettingDescriptor.java [new file with mode: 0755]
src/jalview/schemabinding/version2/ThresholdLine.java [new file with mode: 0755]
src/jalview/schemabinding/version2/ThresholdLineDescriptor.java [new file with mode: 0755]
src/jalview/schemabinding/version2/Tree.java [new file with mode: 0755]
src/jalview/schemabinding/version2/TreeDescriptor.java [new file with mode: 0755]
src/jalview/schemabinding/version2/UserColourScheme.java [new file with mode: 0755]
src/jalview/schemabinding/version2/UserColourSchemeDescriptor.java [new file with mode: 0755]
src/jalview/schemabinding/version2/UserColours.java [new file with mode: 0755]
src/jalview/schemabinding/version2/UserColoursDescriptor.java [new file with mode: 0755]
src/jalview/schemabinding/version2/VAMSAS.java [new file with mode: 0755]
src/jalview/schemabinding/version2/VAMSASDescriptor.java [new file with mode: 0755]
src/jalview/schemabinding/version2/VamsasModel.java [new file with mode: 0755]
src/jalview/schemabinding/version2/VamsasModelDescriptor.java [new file with mode: 0755]
src/jalview/schemabinding/version2/Viewport.java [new file with mode: 0755]
src/jalview/schemabinding/version2/ViewportDescriptor.java [new file with mode: 0755]
src/jalview/util/ShiftList.java [new file with mode: 0644]
src/jalview/util/TableSorter.java [new file with mode: 0755]
src/jalview/ws/MsaWSThread.java [new file with mode: 0644]
src/jalview/ws/WSThread.java [new file with mode: 0644]
src/org/biojava/dasobert/das/DAS_FeatureRetrieve.java [new file with mode: 0755]
src/org/biojava/dasobert/das/DAS_Feature_Handler.java [new file with mode: 0755]
src/org/biojava/dasobert/das/FeatureThread.java [new file with mode: 0755]
src/org/biojava/dasobert/das2/Das2Capability.java [new file with mode: 0755]
src/org/biojava/dasobert/das2/Das2CapabilityImpl.java [new file with mode: 0755]
src/org/biojava/dasobert/das2/Das2Source.java [new file with mode: 0755]
src/org/biojava/dasobert/das2/Das2SourceImpl.java [new file with mode: 0755]
src/org/biojava/dasobert/das2/DasSourceConverter.java [new file with mode: 0755]
src/org/biojava/dasobert/das2/io/DAS2SourceHandler.java [new file with mode: 0755]
src/org/biojava/dasobert/das2/io/DasSourceReader.java [new file with mode: 0755]
src/org/biojava/dasobert/das2/io/DasSourceReaderImpl.java [new file with mode: 0755]
src/org/biojava/dasobert/dasregistry/Das1Source.java [new file with mode: 0755]
src/org/biojava/dasobert/dasregistry/Das2Validator.java [new file with mode: 0755]
src/org/biojava/dasobert/dasregistry/DasCoordSysComparator.java [new file with mode: 0755]
src/org/biojava/dasobert/dasregistry/DasCoordinateSystem.java [new file with mode: 0755]
src/org/biojava/dasobert/dasregistry/DasSource.java [new file with mode: 0755]
src/org/biojava/dasobert/dasregistry/DasSourceComparator.java [new file with mode: 0755]
src/org/biojava/dasobert/eventmodel/FeatureEvent.java [new file with mode: 0755]
src/org/biojava/dasobert/eventmodel/FeatureListener.java [new file with mode: 0755]
src/org/biojava/dasobert/eventmodel/ObjectListener.java [new file with mode: 0755]
src/org/biojava/dasobert/eventmodel/SequenceEvent.java [new file with mode: 0755]
src/org/biojava/dasobert/eventmodel/SequenceListener.java [new file with mode: 0755]

diff --git a/src/jalview/appletgui/Tooltip.java b/src/jalview/appletgui/Tooltip.java
new file mode 100755 (executable)
index 0000000..389b012
--- /dev/null
@@ -0,0 +1,190 @@
+/*\r
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2006 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
+ */\r
+\r
+package jalview.appletgui;\r
+\r
+import java.awt.*;\r
+import java.applet.*;\r
+import java.awt.event.*;\r
+import java.util.*;\r
+\r
+public class Tooltip extends Canvas implements MouseListener,\r
+    MouseMotionListener\r
+{\r
+\r
+        private String [] tip;\r
+        protected Component owner;\r
+\r
+        private Container mainContainer;\r
+        private LayoutManager mainLayout;\r
+\r
+        private boolean shown;\r
+\r
+        private final int VERTICAL_OFFSET = 20;\r
+        private final int HORIZONTAL_ENLARGE = 10;\r
+\r
+        int fontHeight = 0;\r
+\r
+        Image linkImage;\r
+\r
+        FontMetrics fm;\r
+\r
+\r
+\r
+        public Tooltip(String tip, Component owner)\r
+        {\r
+          this.owner = owner;\r
+          owner.addMouseListener(this);\r
+          owner.addMouseMotionListener(this);\r
+          setBackground(new Color(255, 255, 220));\r
+          setTip(tip);\r
+          java.net.URL url = getClass().getResource("/images/link.gif");\r
+          if (url != null)\r
+          {\r
+            linkImage = java.awt.Toolkit.getDefaultToolkit().getImage(url);\r
+          }\r
+        }\r
+\r
+\r
+        public void paint(Graphics g)\r
+        {\r
+                g.drawRect(0,0,getSize().width -1, getSize().height -1);\r
+                int lindex, x;\r
+                for(int i=0; i<tip.length; i++)\r
+                {\r
+                  x = 3;\r
+                  lindex = tip[i].indexOf("%LINK%");\r
+                  if(lindex!=-1)\r
+                  {\r
+                   if(lindex>0)\r
+                   {\r
+                     g.drawString(tip[i].substring(0, lindex), 3, (i+1)*fontHeight-3);\r
+                     x+=fm.stringWidth(tip[i].substring(0, lindex)+3);\r
+                   }\r
+                    g.drawImage(linkImage, x, i * fontHeight+1, this);\r
+                  }\r
+                  else\r
+                  g.drawString(tip[i], 3, (i+1)*fontHeight - 3);\r
+                }\r
+        }\r
+\r
+        private void addToolTip()\r
+        {\r
+                mainContainer.setLayout(null);\r
+                mainContainer.add(this, 0);\r
+                mainContainer.validate();\r
+                repaint();\r
+                shown = true;\r
+        }\r
+\r
+        void setTip(String tip)\r
+        {\r
+          fm = getFontMetrics(owner.getFont());\r
+          fontHeight = fm.getHeight();\r
+\r
+          int longestLine = 0;\r
+          StringTokenizer st = new StringTokenizer(tip, "\n");\r
+          this.tip = new String[st.countTokens()];\r
+          int index = 0;\r
+          while(st.hasMoreElements())\r
+          {\r
+            this.tip[index] = st.nextToken();\r
+            if(fm.stringWidth(this.tip[index])>longestLine)\r
+              longestLine = fm.stringWidth(this.tip[index]);\r
+            index ++;\r
+          }\r
+\r
+          setSize(longestLine + HORIZONTAL_ENLARGE,\r
+                  fontHeight*this.tip.length);\r
+        }\r
+\r
+        void setTipLocation(int x, int y)\r
+        {\r
+\r
+          setLocation((owner.getLocationOnScreen().x - mainContainer.getLocationOnScreen().x) +x,\r
+           (owner.getLocationOnScreen().y - mainContainer.getLocationOnScreen().y + VERTICAL_OFFSET)+y);\r
+\r
+\r
+\r
+        // correction, whole tool tip must be visible\r
+          if (mainContainer.getSize().width < (getLocation().x + getSize().width))\r
+          {\r
+            setLocation(mainContainer.getSize().width - getSize().width,\r
+                        getLocation().y);\r
+          }\r
+\r
+        }\r
+\r
+\r
+        private void removeToolTip() {\r
+                if (shown) {\r
+                        mainContainer.remove(0);\r
+                        mainContainer.setLayout(mainLayout);\r
+                        mainContainer.validate();\r
+                }\r
+                shown = false;\r
+        }\r
+\r
+        private void findMainContainer() {\r
+                Container parent = owner.getParent();\r
+                while (true) {\r
+                        if ((parent instanceof Applet) || (parent instanceof Frame)) {\r
+                                mainContainer = parent;\r
+                                break;\r
+                        } else {\r
+                                parent = parent.getParent();\r
+                        }\r
+                }\r
+                mainLayout = mainContainer.getLayout();\r
+        }\r
+\r
+        public void mouseEntered(MouseEvent me)\r
+        {     }\r
+\r
+        public void mouseExited(MouseEvent me)\r
+        {\r
+          removeToolTip();\r
+        }\r
+\r
+        public void mousePressed(MouseEvent me)\r
+        {\r
+          removeToolTip();\r
+        }\r
+\r
+        public void mouseReleased(MouseEvent me)\r
+        {}\r
+\r
+        public void mouseClicked(MouseEvent me)\r
+        {}\r
+\r
+        public void mouseMoved(MouseEvent me)\r
+        {\r
+          if (shown)\r
+            setTipLocation(me.getX(), me.getY());\r
+          else\r
+          {\r
+            findMainContainer();\r
+            addToolTip();\r
+            setTipLocation(me.getX(), me.getY());\r
+          }\r
+        }\r
+\r
+        public void mouseDragged(MouseEvent me)\r
+        {}\r
+}\r
diff --git a/src/jalview/datamodel/.cvsignore b/src/jalview/datamodel/.cvsignore
new file mode 100644 (file)
index 0000000..a4d99ef
--- /dev/null
@@ -0,0 +1,5 @@
+.#Alignment.java.1.41
+.#Alignment.java.1.42
+.#Alignment.java.1.43
+.#Alignment.java.1.44
+.#AlignmentI.java.1.21
diff --git a/src/jalview/datamodel/AlignmentView.java b/src/jalview/datamodel/AlignmentView.java
new file mode 100644 (file)
index 0000000..a76e90e
--- /dev/null
@@ -0,0 +1,434 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer
+ * Copyright (C) 2006 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
+ */
+package jalview.datamodel;
+
+
+
+/**
+ * <p>Title: </p>
+ *
+ * <p>Description: </p>
+ *
+ * <p>Copyright: Copyright (c) 2004</p>
+ *
+ * <p>Company: Dundee University</p>
+ *
+ * @author not attributable
+ * @version 1.0
+ */
+public class AlignmentView
+{
+    /**
+     * Transient object compactly representing a 'view' of an alignment - with discontinuities marked.
+     */
+    private SeqCigar[] sequences = null;
+  private int[] contigs = null;
+  private int width=0;
+  public AlignmentView(CigarArray seqcigararray)
+  {
+    if (!seqcigararray.isSeqCigarArray())
+      throw new Error("Implementation Error - can only make an alignment view from a CigarArray of sequences.");
+    //contigs = seqcigararray.applyDeletions();
+    contigs = seqcigararray.getDeletedRegions();
+    sequences = seqcigararray.getSeqCigarArray();
+    width = seqcigararray.getWidth(); // visible width
+  }
+
+  public void setSequences(SeqCigar[] sequences)
+  {
+    this.sequences = sequences;
+  }
+
+  public void setContigs(int[] contigs)
+  {
+    this.contigs = contigs;
+  }
+
+  public SeqCigar[] getSequences()
+  {
+    return sequences;
+  }
+  /**
+   * @see CigarArray.getDeletedRegions
+   * @return int[] { vis_start, sym_start, length }
+   */
+  public int[] getContigs()
+  {
+    return contigs;
+  }
+  /**
+   * get the full alignment and a columnselection object marking the hidden regions
+   * @param gapCharacter char
+   * @return Object[] { SequenceI[], ColumnSelection}
+   */
+  public Object[] getAlignmentAndColumnSelection(char gapCharacter) {
+    ColumnSelection colsel = new ColumnSelection();
+
+    return new Object[] { SeqCigar.createAlignmentSequences(sequences, gapCharacter, colsel, contigs), colsel};
+  }
+  /**
+   * getSequenceStrings
+   *
+   * @param c char
+   * @return String[]
+   */
+  public String[] getSequenceStrings(char c)
+  {
+    String[] seqs=new String[sequences.length];
+    for (int n=0; n<sequences.length; n++) {
+      String fullseq = sequences[n].getSequenceString(c);
+      if (contigs != null)
+      {
+        seqs[n] = "";
+        int p = 0;
+        for (int h = 0; h < contigs.length; h += 3)
+        {
+          seqs[n] += fullseq.substring(p, contigs[h + 1]);
+          p = contigs[h + 1] + contigs[h + 2];
+        }
+        seqs[n] += fullseq.substring(p);
+      } else
+        seqs[n] = fullseq;
+    }
+    return seqs;
+  }
+  /**
+   *
+   * @return visible number of columns in alignment view
+   */
+  public int getWidth() {
+    return width;
+  }
+
+  protected void setWidth(int width) {
+    this.width = width;
+  }
+  /**
+   * get the contiguous subalignments in an alignment view.
+   * @param gapCharacter char
+   * @return SequenceI[][]
+   */
+  public SequenceI[][] getVisibleContigs(char gapCharacter) {
+    SequenceI[][] smsa;
+    int njobs = 1;
+    if (sequences==null || width<=0)
+      return null;
+    if (contigs != null && contigs.length > 0)
+    {
+      int start = 0;
+      njobs = 0;
+      int fwidth = width;
+      for (int contig = 0; contig < contigs.length; contig += 3)
+      {
+        if ( (contigs[contig + 1] - start) > 0)
+        {
+          njobs++;
+        }
+        fwidth += contigs[contig + 2]; // end up with full region width (including hidden regions)
+        start = contigs[contig + 1] + contigs[contig + 2];
+      }
+      if (start < fwidth)
+      {
+        njobs++;
+      }
+      smsa = new SequenceI[njobs][];
+      start = 0;
+      int j = 0;
+      for (int contig = 0; contig < contigs.length; contig += 3)
+      {
+        if (contigs[contig + 1] - start > 0)
+        {
+          SequenceI mseq[] = new SequenceI[sequences.length];
+          for (int s = 0; s < mseq.length; s++)
+          {
+            mseq[s] = sequences[s].getSeq(gapCharacter).getSubSequence(start,
+                contigs[contig + 1]);
+          }
+          smsa[j] = mseq;
+          j++;
+        }
+        start = contigs[contig + 1] + contigs[contig + 2];
+      }
+      if (start < fwidth)
+      {
+        SequenceI mseq[] = new SequenceI[sequences.length];
+        for (int s = 0; s < mseq.length; s++)
+        {
+          mseq[s] = sequences[s].getSeq(gapCharacter).getSubSequence(start,
+              fwidth + 1);
+        }
+        smsa[j] = mseq;
+        j++;
+      }
+    }
+    else
+    {
+      smsa = new SequenceI[1][];
+      smsa[0] = new SequenceI[sequences.length];
+      for (int s = 0; s < sequences.length; s++)
+      {
+        smsa[0][s] = sequences[s].getSeq(gapCharacter);
+      }
+    }
+    return smsa;
+  }
+  /**
+   * return full msa and hidden regions with visible blocks replaced with new sub alignments
+   * @param nvismsa SequenceI[][]
+   * @param orders AlignmentOrder[] corresponding to each SequenceI[] block.
+   * @return Object[]
+   */
+  public Object[] getUpdatedView(SequenceI[][] nvismsa, AlignmentOrder[] orders, char gapCharacter) {
+    if (sequences == null || width <= 0)
+    {
+      throw new Error("empty view cannot be updated.");
+    }
+    if (nvismsa == null)
+      throw new Error(
+          "nvismsa==null. use getAlignmentAndColumnSelection() instead.");
+    if (contigs != null && contigs.length > 0)
+    {
+      SequenceI[] alignment = new SequenceI[sequences.length];
+      ColumnSelection columnselection = new ColumnSelection();
+      if (contigs != null && contigs.length > 0)
+      {
+        int start = 0;
+        int nwidth = 0;
+        int owidth = width;
+        int j = 0;
+        for (int contig = 0; contig < contigs.length; contig += 3)
+        {
+          owidth += contigs[contig + 2]; // recover final column width
+          if (contigs[contig + 1] - start > 0)
+          {
+            int swidth = 0; // subalignment width
+            if (nvismsa[j] != null)
+            {
+              SequenceI mseq[] = nvismsa[j];
+              AlignmentOrder order=(orders==null) ? null : orders[j];
+              j++;
+              if (mseq.length!=sequences.length)
+                throw new Error("Mismatch between number of sequences in block "+j+" ("+mseq.length+") and the original view ("+sequences.length+")");
+              swidth = mseq[0].getLength(); // JBPNote: could ensure padded here.
+              for (int s = 0; s < mseq.length; s++)
+              {
+                if (alignment[s] == null)
+                {
+                  alignment[s] = mseq[s];
+                }
+                else
+                {
+                  alignment[s].setSequence(alignment[s].getSequence() +
+                                           mseq[s].getSequence());
+                  if (mseq[s].getStart() <= mseq[s].getEnd())
+                  {
+                    alignment[s].setEnd(mseq[s].getEnd());
+                  }
+                  if (order!=null) {
+                    order.updateSequence(mseq[s], alignment[s]);
+                  }
+                }
+              }
+            }
+            else
+            {
+              // recover original alignment block or place gaps
+              if (true)
+              {
+                // recover input data
+                for (int s = 0; s < sequences.length; s++)
+                {
+                  SequenceI oseq = sequences[s].getSeq(gapCharacter).getSubSequence(start,
+                      contigs[contig + 1]);
+                  if (swidth < oseq.getLength())
+                  {
+                    swidth = oseq.getLength();
+                  }
+                  if (alignment[s] == null)
+                  {
+                    alignment[s] = oseq;
+                  }
+                  else
+                  {
+                    alignment[s].setSequence(alignment[s].getSequence() +
+                                             oseq.getSequence());
+                    if (oseq.getEnd() >= oseq.getStart())
+                    {
+                      alignment[s].setEnd(oseq.getEnd());
+                    }
+                  }
+                }
+
+              }
+              j++;
+            }
+            nwidth += swidth;
+          }
+          // advance to begining of visible region
+          start = contigs[contig + 1] + contigs[contig + 2];
+          // add hidden segment to right of next region
+          for (int s = 0; s < sequences.length; s++)
+          {
+            SequenceI hseq = sequences[s].getSeq(gapCharacter).getSubSequence(contigs[contig +
+                1], start);
+            if (alignment[s] == null)
+            {
+              alignment[s] = hseq;
+            }
+            else
+            {
+              alignment[s].setSequence(alignment[s].getSequence() +
+                                       hseq.getSequence());
+              if (hseq.getEnd() >= hseq.getStart())
+              {
+                alignment[s].setEnd(hseq.getEnd());
+              }
+            }
+          }
+          // mark hidden segment as hidden in the new alignment
+          columnselection.hideColumns(nwidth, nwidth + contigs[contig + 2] - 1);
+          nwidth += contigs[contig + 2];
+        }
+        // Do final segment - if it exists
+        if (j < nvismsa.length)
+        {
+          int swidth = 0;
+          if (nvismsa[j] != null)
+          {
+            SequenceI mseq[] = nvismsa[j];
+            AlignmentOrder order = (orders!=null) ? orders[j] : null;
+            swidth = mseq[0].getLength();
+            for (int s = 0; s < mseq.length; s++)
+            {
+              if (alignment[s] == null)
+              {
+                alignment[s] = mseq[s];
+              }
+              else
+              {
+                alignment[s].setSequence(alignment[s].getSequence() +
+                                         mseq[s].getSequence());
+                if (mseq[s].getEnd() >= mseq[s].getStart())
+                {
+                  alignment[s].setEnd(mseq[s].getEnd());
+                }
+                if (order!=null) {
+                  order.updateSequence(mseq[s], alignment[s]);
+                }
+              }
+            }
+          }
+          else
+          {
+            if (start < owidth)
+            {
+              // recover input data or place gaps
+              if (true)
+              {
+                // recover input data
+                for (int s = 0; s < sequences.length; s++)
+                {
+                  SequenceI oseq = sequences[s].getSeq(gapCharacter).getSubSequence(start,
+                      owidth + 1);
+                  if (swidth < oseq.getLength())
+                  {
+                    swidth = oseq.getLength();
+                  }
+                  if (alignment[s] == null)
+                  {
+                    alignment[s] = oseq;
+                  }
+                  else
+                  {
+                    alignment[s].setSequence(alignment[s].getSequence() +
+                                             oseq.getSequence());
+                    if (oseq.getEnd() >= oseq.getStart())
+                    {
+                      alignment[s].setEnd(oseq.getEnd());
+                    }
+                  }
+                }
+                nwidth += swidth;
+              }
+              else
+              {
+                // place gaps.
+                throw new Error("Padding not yet implemented.");
+              }
+            }
+          }
+        }
+      }
+      return new Object[] { alignment, columnselection};
+    } else {
+      if (nvismsa.length!=1)
+        throw new Error("Mismatch between visible blocks to update and number of contigs in view (contigs=0,blocks="+nvismsa.length);
+      if (nvismsa[0]!=null)
+        return new Object[] { nvismsa[0], new ColumnSelection()};
+      else
+        return getAlignmentAndColumnSelection(gapCharacter);
+    }
+  }
+  /**
+   * returns simple array of start end positions of visible range on alignment.
+   * vis_start and vis_end are inclusive - use SequenceI.getSubSequence(vis_start, vis_end+1) to recover visible sequence from underlying alignment. 
+   * @return int[] { start_i, end_i } for 1<i<n visible regions.
+   */
+  public int[] getVisibleContigs() {
+    if (contigs != null && contigs.length > 0)
+    {
+      int start = 0;
+      int nvis = 0;
+      int fwidth = width;
+      for (int contig = 0; contig < contigs.length; contig += 3)
+      {
+        if ( (contigs[contig + 1] - start) > 0)
+        {
+          nvis++;
+        }
+        fwidth += contigs[contig + 2]; // end up with full region width (including hidden regions)
+        start = contigs[contig + 1] + contigs[contig + 2];
+      }
+      if (start < fwidth)
+      {
+        nvis++;
+      }
+      int viscontigs[] = new int[nvis*2];
+      nvis=0;
+      start=0;
+      for (int contig=0; contig<contigs.length; contig+=3) {
+        if ( (contigs[contig + 1] - start) > 0)
+        {
+          viscontigs[nvis] = start;
+          viscontigs[nvis+1]=contigs[contig+1]-1; // end is inclusive
+          nvis+=2;
+        }
+        start = contigs[contig + 1] + contigs[contig + 2];              
+      }
+      if (start<fwidth) {
+        viscontigs[nvis] = start;
+        viscontigs[nvis+1]=fwidth; // end is inclusive
+        nvis+=2;
+      }
+      return viscontigs;
+    } else {
+      return new int[] { 0, width};
+    }
+  }
+}
diff --git a/src/jalview/datamodel/CigarArray.java b/src/jalview/datamodel/CigarArray.java
new file mode 100644 (file)
index 0000000..9b60e56
--- /dev/null
@@ -0,0 +1,206 @@
+/*\r
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2006 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
+ */\r
+package jalview.datamodel;\r
+\r
+public class CigarArray extends CigarBase\r
+{\r
+    /**\r
+     * Do CIGAR operations on a set of sequences from many other cigars\r
+     * BAD THINGS WILL HAPPEN IF A CIGARARRAY IS PASSED TO A CIGARARRAY\r
+     * or a CIGARCIGAR is given a CIGARARRAY to insert gaps into.\r
+     */\r
+    /**\r
+     * array of subject cigars\r
+     */\r
+    public CigarSimple refCigars[]=null;\r
+    private boolean seqcigararray=false;\r
+  private CigarArray() {\r
+    super();\r
+  }\r
+\r
+  /**\r
+   * isSeqCigarArray()\r
+   * @return boolean true if all refCigars resolve to a SeqCigar or a CigarCigar\r
+   */\r
+  public boolean isSeqCigarArray()\r
+  {\r
+    return seqcigararray;\r
+  }\r
+  /**\r
+   * Apply CIGAR operations to several cigars in parallel\r
+   * will throw an error if any of cigar are actually CigarArrays.\r
+   * @param cigar Cigar[]\r
+   */\r
+  public CigarArray(CigarSimple[] cigars) {\r
+    super();\r
+    seqcigararray = true;\r
+    if (cigars != null && cigars.length > 0)\r
+    {\r
+      refCigars = new CigarSimple[cigars.length];\r
+      for (int c = 0; c < cigars.length; c++)\r
+      {\r
+        refCigars[c] = cigars[c];\r
+        if (! ( (cigars[c] instanceof SeqCigar)\r
+               || cigars[c] instanceof CigarCigar))\r
+        {\r
+          seqcigararray = false;\r
+        }\r
+      }\r
+    }\r
+  }\r
+  /**\r
+   * @see Cigar.getSequenceAndDeletions\r
+   * @param GapChar char\r
+   * @return Object[][]\r
+   */\r
+  protected Object[][] getArrayofSequenceAndDeletions(char GapChar) {\r
+      if (refCigars == null || refCigars.length == 0 || length == 0) {\r
+        return null;\r
+      }\r
+      Object[][] sqanddels = new Object[refCigars.length][];\r
+      for (int c=0; c<refCigars.length; c++) {\r
+        String refString = refCigars[c].getSequenceString(GapChar);\r
+        if (refString != null)\r
+        {\r
+          sqanddels[c] = getSequenceAndDeletions(refString, GapChar);\r
+        } else {\r
+          sqanddels[c] = null;\r
+        }\r
+      }\r
+      return sqanddels;\r
+    }\r
+  /**\r
+   * NOTE: this is an improper sequence string function\r
+   * @return String formed by newline concatenated results of applying CIGAR operations to each reference object in turn.\r
+   * @param GapChar char\r
+   * @return '\n' separated strings (empty results included as \n\n)\r
+   */\r
+  public String getSequenceString(char GapChar)\r
+  {\r
+    if (length==0 || refCigars==null)\r
+      return "";\r
+    StringBuffer seqStrings = new StringBuffer();\r
+    Object[][] sqanddels = getArrayofSequenceAndDeletions(GapChar);\r
+    for (int c=0; c<refCigars.length; c++) {\r
+      if (sqanddels[c]!=null) {\r
+        seqStrings.append( (String) sqanddels[c][0]);\r
+        sqanddels[c][0] = null;\r
+      }\r
+      seqStrings.append('\n');\r
+    }\r
+    return seqStrings.toString();\r
+  }\r
+  /**\r
+   * return string results of applying cigar string to all reference cigars\r
+   * @param GapChar char\r
+   * @return String[]\r
+   */\r
+  public String[] getSequenceStrings(char GapChar) {\r
+\r
+    if (length==0 || refCigars==null || refCigars.length==0)\r
+      return null;\r
+    Object[][] sqanddels = getArrayofSequenceAndDeletions(GapChar);\r
+    String[] seqs = new String[sqanddels.length];\r
+    for (int c=0; c<refCigars.length; c++) {\r
+      seqs[c] = (String) sqanddels[c][0];\r
+    }\r
+    return seqs;\r
+  }\r
+  /**\r
+   * Combines the CigarArray cigar operations with the operations in each\r
+   * reference cigar - creating a new reference cigar\r
+   * @return Cigar[]\r
+\r
+  public CigarBase[] getEditedCigars() {\r
+\r
+    return new CigarBase[] {};\r
+  }\r
+*/\r
+  /**\r
+   * applyDeletions\r
+   * edits underlying refCigars to propagate deleted regions, and removes deletion\r
+   * operations from CigarArray operation list.\r
+   * @return int[] position after deletion occured and range of deletion in cigarArray or null if none occured\r
+   */\r
+  public int[] applyDeletions()\r
+  {\r
+    java.util.Vector delpos=null;\r
+    if (length==0)\r
+      return null;\r
+    int cursor=0; // range counter for deletions\r
+    int vcursor=0; // visible column index\r
+    int offset=0; // shift in visible column index as deletions are made\r
+    int i=0;\r
+    while (i<length) {\r
+      if (operation[i]!=D) {\r
+        if (operation[i]==M)\r
+          cursor+=range[i];\r
+        vcursor+=range[i++];\r
+      }\r
+      else\r
+      {\r
+        if (delpos==null)\r
+          delpos=new java.util.Vector();\r
+        int delstart=cursor, delend=cursor+range[i]-1; // inclusive\r
+        delpos.addElement(new int[] { vcursor+offset, range[i]}); // index of right hand column after hidden region boundary\r
+        offset+=range[i]-1; // shift in visible column coordinates\r
+        System.arraycopy(operation, i+1, operation, i, length-i);\r
+        System.arraycopy(range, i+1, range, i, length-i);\r
+        length--;\r
+        /*        int dmax=0;\r
+         for (int s=0; s<refCigars.length; s++) {\r
+           int d = refCigars[s].deleteRange(delstart, delend);\r
+           if (d>dmax)\r
+             dmax=d;\r
+         }\r
+         offset+=dmax; // shift in visible column coordinates\r
+         */\r
+        for (int s=0; s<refCigars.length; s++) {\r
+          int d = refCigars[s].deleteRange(delstart, delend);\r
+        }\r
+\r
+      }\r
+    }\r
+    if (delpos!=null)\r
+    {\r
+      int[] pos=new int[delpos.size()*2];\r
+      for (int k = 0, l = delpos.size(); k < l; k++) {\r
+        int[] dr = ((int[]) delpos.elementAt(k));\r
+        pos[k*2] = dr[0];\r
+        pos[k*2+1] = dr[1];\r
+        delpos.setElementAt(null,k);\r
+      }\r
+      delpos=null;\r
+      return pos;\r
+    }\r
+    return null;\r
+  }\r
+  /**\r
+   *\r
+   * @return SeqCigar[] or null if CigarArray is not a SeqCigarArray (ie it does not resolve to set of seqCigars)\r
+   */\r
+  public SeqCigar[] getSeqCigarArray() {\r
+    if (!isSeqCigarArray())\r
+      return null;\r
+    SeqCigar[] sa = new SeqCigar[refCigars.length];\r
+    for (int i=0; i<refCigars.length; i++)\r
+      sa[i] = (SeqCigar) refCigars[i];\r
+    return sa;\r
+  }\r
+}\r
diff --git a/src/jalview/datamodel/CigarBase.java b/src/jalview/datamodel/CigarBase.java
new file mode 100644 (file)
index 0000000..a36bf76
--- /dev/null
@@ -0,0 +1,652 @@
+/*\r
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2006 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
+ */\r
+package jalview.datamodel;\r
+\r
+import java.util.Vector;\r
+\r
+public abstract class CigarBase\r
+{\r
+  /**\r
+   * Base class for compact idiosyncratic representation of gaps and aligned residues\r
+   * Regards to Tom Oldfield for his DynamicArray class.\r
+   * 17th July 2006\r
+   * Not thread safe.\r
+   */\r
+  public CigarBase()\r
+  {\r
+    // nothing to be done (probably)\r
+  }\r
+\r
+  protected int length = 0;\r
+  protected int _inc_length = 10; // extension range for addition of new operations\r
+  protected char[] operation = null;\r
+  protected int[] range = null;\r
+  /**\r
+   * Range of Hidden residues in seq (translated as deleted in seq)\r
+   */\r
+  public static final char D = 'D'; /**\r
+  * Range of insertions to seq\r
+  */\r
+ public static final char I = 'I'; /**\r
+  * Range of aligned residues\r
+  */\r
+ public static final char M = 'M';\r
+  static protected final char _case_shift = 'a' - 'A';\r
+  /**\r
+   * Ugly function to get edited sequence string, start and end symbol positions and the deletion regions as an array of int pairs\r
+   * May return null for an empty cigar string.\r
+   * May return null for deletion ranges if there are none.\r
+   * @param reference - the symbol sequence to apply the cigar operations to (or null if no sequence)\r
+   * @param GapChar - the symbol to use for Insert operations\r
+   * @return Object[] { String, int[] {start, startcol, end, endcol}, int[][3] {start, end, col} or null} the gapped sequence, first and last residue index, and the deletion ranges on the reference sequence\r
+   */\r
+  public Object[] getSequenceAndDeletions(String reference, char GapChar)\r
+  {\r
+    int rlength=0;\r
+    int[][] deletions = new int[length][];\r
+    int[][] trunc_deletions = null;\r
+    StringBuffer sq = new StringBuffer();\r
+    int cursor = 0, alcursor=0,start = 0, startpos=0, end = 0, endpos=0, delcount = -1;\r
+    boolean consecutive_del = false;\r
+    if (length == 0)\r
+    {\r
+      return null;\r
+    }\r
+    if (reference!=null)\r
+      rlength=reference.length();\r
+    boolean modstart = true;\r
+    for (int i = 0; i < length; i++)\r
+    {\r
+      switch (operation[i])\r
+      {\r
+        case D:\r
+          if (!consecutive_del)\r
+          {\r
+            deletions[++delcount] = new int[]\r
+                {\r
+                cursor, 0, alcursor};\r
+          }\r
+          cursor += range[i];\r
+          deletions[delcount][1] = cursor - 1;\r
+          consecutive_del = true;\r
+          break;\r
+        case I:\r
+          consecutive_del = false;\r
+          for (int r = 0; r < range[i]; r++)\r
+          {\r
+            sq.append(GapChar);\r
+            alcursor++;\r
+          }\r
+          break;\r
+        case M:\r
+          consecutive_del = false;\r
+          if (modstart)\r
+          {\r
+            start = cursor;\r
+            startpos=alcursor;\r
+            modstart = false;\r
+          }\r
+          if (reference!=null) {\r
+            int sbend = cursor+range[i];\r
+            if (sbend>rlength) {\r
+              sq.append(reference.substring(cursor, rlength));\r
+              while (sbend-- >= rlength)\r
+              {\r
+                sq.append(GapChar);\r
+              }\r
+            } else {\r
+              sq.append(reference.substring(cursor, sbend));\r
+            }\r
+          }\r
+          alcursor+=range[i];\r
+          cursor += range[i];\r
+          end = cursor - 1;\r
+          endpos = alcursor;\r
+          break;\r
+        default:\r
+          throw new Error("Unknown SeqCigar operation '" + operation[i] + "'");\r
+      }\r
+    }\r
+    if (++delcount > 0)\r
+    {\r
+      trunc_deletions = new int[delcount][];\r
+      System.arraycopy(deletions, 0, trunc_deletions, 0, delcount);\r
+    }\r
+    deletions = null;\r
+    return new Object[]\r
+        {\r
+        ((reference!=null) ? sq.toString() : null),\r
+        new int[] {\r
+        start, startpos, end, endpos}, trunc_deletions};\r
+  }\r
+  protected void compact_operations() {\r
+    int i=1;\r
+    if (operation==null)\r
+      return;\r
+    char last = operation[0];\r
+    while (i<length) {\r
+      if (last==operation[i]) {\r
+        range[i-1]+=range[i];\r
+        int r = length-i;\r
+        if (r>0) {\r
+          System.arraycopy(range, i + 1, range, i, r);\r
+          System.arraycopy(operation, i + 1, operation, i, r);\r
+        }\r
+        length--;\r
+      } else {\r
+        last = operation[i++];\r
+      }\r
+    }\r
+  }\r
+  /**\r
+   * turn a cigar string into a series of operation range pairs\r
+   * @param cigarString String\r
+   * @return object[] {char[] operation, int[] range}\r
+   * @throws java.lang.Exception for improperly formated cigar strings or ones with unknown operations\r
+   */\r
+  public static Object[] parseCigarString(String cigarString)\r
+      throws Exception\r
+  {\r
+    int ops = 0;\r
+    for (int i = 0, l = cigarString.length(); i < l; i++)\r
+    {\r
+      char c = cigarString.charAt(i);\r
+      if (c == M || c == (M - _case_shift) || c == I || c == (I - _case_shift) ||\r
+          c == D || c == (D - _case_shift))\r
+      {\r
+        ops++;\r
+      }\r
+    }\r
+    char[] operation = new char[ops];\r
+    int[] range = new int[ops];\r
+    int op = 0;\r
+    int i = 0, l = cigarString.length();\r
+    while (i < l)\r
+    {\r
+      char c;\r
+      int j = i;\r
+      do\r
+      {\r
+        c = cigarString.charAt(j++);\r
+      }\r
+      while (c >= '0' && c <= '9' && j < l);\r
+      if (j >= l && c >= '0' && c <= '9')\r
+      {\r
+        throw new Exception("Unterminated cigar string.");\r
+      }\r
+      try\r
+      {\r
+        String rangeint = cigarString.substring(i, j - 1);\r
+        range[op] = Integer.parseInt(rangeint);\r
+        i = j;\r
+      }\r
+      catch (Exception e)\r
+      {\r
+        throw new Error("Implementation bug in parseCigarString");\r
+      }\r
+      if (c >= 'a' && c <= 'z')\r
+      {\r
+        c -= _case_shift;\r
+      }\r
+      if ( (c == M || c == I || c == D))\r
+      {\r
+        operation[op++] = c;\r
+      }\r
+      else\r
+      {\r
+        throw new Exception("Unexpected operation '" + c +\r
+                            "' in cigar string (position " + i + " in '" +\r
+                            cigarString + "'");\r
+      }\r
+    }\r
+    return new Object[]\r
+        {\r
+        operation, range};\r
+  }\r
+\r
+  /**\r
+   * add an operation to cigar string\r
+   * @param op char\r
+   * @param range int\r
+   */\r
+  public void addOperation(char op, int range)\r
+  {\r
+    if (op >= 'a' && op <= 'z')\r
+    {\r
+      op -= _case_shift;\r
+    }\r
+    if (op != M && op != D && op != I)\r
+    {\r
+      throw new Error("Implementation error. Invalid operation string.");\r
+    }\r
+    if (range<=0)\r
+      throw new Error("Invalid range string (must be non-zero positive number)");\r
+    int lngth = 0;\r
+    if (operation == null)\r
+    {\r
+      this.operation = new char[_inc_length];\r
+      this.range = new int[_inc_length];\r
+    }\r
+    if (length + 1 == operation.length)\r
+    {\r
+      char[] ops = this.operation;\r
+      this.operation = new char[length + 1 + _inc_length];\r
+      System.arraycopy(ops, 0, this.operation, 0, length);\r
+      ops = null;\r
+      int[] rng = this.range;\r
+      this.range = new int[length + 1 + _inc_length];\r
+      System.arraycopy(rng, 0, this.range, 0, length);\r
+      rng = null;\r
+    }\r
+    if ((length>0) && (operation[length-1]==op))\r
+      length--; // modify existing operation.\r
+    else\r
+      this.range[length]=0; // reset range\r
+    this.operation[length] = op;\r
+    this.range[length++] += range;\r
+  }\r
+\r
+  /**\r
+   * semi-efficient insert an operation on the current cigar string set at column pos (from 1)\r
+   * NOTE: Insertion operations simply extend width of cigar result - affecting registration of alignment\r
+   * Deletion ops will shorten length of result - and affect registration of alignment\r
+   * Match ops will also affect length of result - affecting registration of alignment\r
+   * (ie "10M".insert(4,I,3)->"4M3I3M") - (replace?)\r
+   * (ie "10M".insert(4,D,3)->"4M3D3M") - (shortens alignment)\r
+   * (ie "5I5M".insert(4,I,3)->"8I5M") - real insertion\r
+   * (ie "5I5M".insert(4,D,3)->"4I2D3M") - shortens aligment - I's are removed, Ms changed to Ds\r
+   * (ie "10M".insert(4,M,3)->"13M")  - lengthens - Is changed to M, Ds changed to M.\r
+   * (ie "5I5M".insert(4,M,3)->"4I8M") - effectively shifts sequence left by 1 residue and extends it by 3\r
+   * ( "10D5M".insert(-1,M,3)->"3M7D5M")\r
+   * ( "10D5M".insert(0,M,3)->"7D8M")\r
+   * ( "10D5M".insert(1,M,3)->"10D8M")\r
+   *\r
+   * ( "1M10D5M".insert(0,M,3)->"1M10D8M")\r
+   * ( "1M10D5M".insert(1,M,3)->"\r
+   *\r
+   * if pos is beyond width - I operations are added before the operation\r
+   * @param pos int -1, 0-length of visible region, or greater to append new ops (with insertions in between)\r
+   * @param op char\r
+   * @param range int\r
+  public void addOperationAt(int pos, char op, int range)\r
+  {\r
+    int cursor = -1; // mark the position for the current operation being edited.\r
+    int o = 0;\r
+    boolean last_d = false; // previous op was a deletion.\r
+    if (pos < -1)\r
+      throw new Error("pos<-1 is not supported.");\r
+    while (o<length) {\r
+      if (operation[o] != D)\r
+      {\r
+        if ( (cursor + this.range[o]) < pos)\r
+        {\r
+          cursor += this.range[o];\r
+          o++;\r
+          last_d=false;\r
+        }\r
+        else\r
+        {\r
+          break;\r
+        }\r
+      }\r
+      else {\r
+        last_d=true;\r
+        o++;\r
+      }\r
+    }\r
+    if (o==length) {\r
+      // must insert more operations before pos\r
+      if (pos-cursor>0)\r
+        addInsertion(pos-cursor);\r
+      // then just add the new operation. Regardless of what it is.\r
+      addOperation(op, range);\r
+    } else {\r
+      int diff = pos - cursor;\r
+\r
+      int e_length = length-o; // new edit operation array length.\r
+      // diff<0 - can only happen before first insertion or match. - affects op and all following\r
+      // dif==0 - only when at first position of existing op -\r
+      // diff>0 - must preserve some existing operations\r
+      int[] e_range = new int[e_length];\r
+      System.arraycopy(this.range, o, e_range, 0, e_length);\r
+      char[] e_op = new char[e_length];\r
+      System.arraycopy(this.operation, o, e_op, 0, e_length);\r
+      length = o; // can now use add_operation to extend list.\r
+      int e_o=0; // current operation being edited.\r
+      switch (op) {\r
+        case M:\r
+          switch (e_op[e_o])\r
+          {\r
+            case M:\r
+              if (last_d && diff <= 0)\r
+              {\r
+                // reduce D's, if possible\r
+                if (range<=this.range[o-1]) {\r
+                  this.range[o - 1] -= range;\r
+                } else {\r
+                  this.range[o-1]=0;\r
+                }\r
+                if (this.range[o-1]==0)\r
+                  o--; // lose this op.\r
+              }\r
+              e_range[e_o] += range; // just add more matched residues\r
+              break;\r
+            case I:\r
+              // change from insertion to match\r
+              if (last_d && diff<=0)\r
+              {\r
+                // reduce D's, if possible\r
+                if (range<=this.range[o-1]) {\r
+                  this.range[o - 1] -= range;\r
+                } else {\r
+                  this.range[o-1]=0;\r
+                }\r
+                if (this.range[o-1]==0)\r
+                  o--; // lose this op.\r
+              }\r
+              e_range[e_o]\r
+                    break;\r
+                default:\r
+                  throw new Inp\r
+                      }\r
+\r
+                      break;\r
+                case I:\r
+                  break;\r
+                case D:\r
+              }\r
+          break;\r
+        default:\r
+          throw new Error("Implementation Error: Unknown operation in addOperation!");\r
+      }\r
+      // finally, add remaining ops.\r
+      while (e_o<e_length) {\r
+        addOperation(e_op[e_o], e_range[e_o]);\r
+        e_o++;\r
+      }\r
+    }\r
+  }\r
+**/\r
+  /**\r
+   * Mark residues from start to end (inclusive) as deleted from the alignment, and removes any insertions.\r
+   * @param start int\r
+   * @param end int\r
+   * @return deleted int - number of symbols marked as deleted\r
+   */\r
+  public int deleteRange(int start, int end) {\r
+    int deleted=0;\r
+    if (length==0) {\r
+      // nothing to do here\r
+      return deleted;\r
+    }\r
+    if (start<0 || start>end)\r
+      throw new Error("Implementation Error: deleteRange out of bounds: start must be non-negative and less than end.");\r
+    // find beginning\r
+    int cursor = 0; // mark the position for the current operation being edited.\r
+    int rlength=1+end-start; // number of positions to delete\r
+    int oldlen=length;\r
+    int o = 0;\r
+    boolean editing=false;\r
+    char[] oldops = operation;\r
+    int[] oldrange = range;\r
+    length=0;\r
+    operation = null;\r
+    range = null;\r
+    compact_operations();\r
+    while (o<oldlen && cursor<=end && rlength>0) {\r
+      if (oldops[o] == D) {\r
+        // absorbed into new deleted region.\r
+        addDeleted(oldrange[o++]);\r
+        continue;\r
+      }\r
+\r
+      int remain = oldrange[o]; // number of op characters left to edit\r
+      if (!editing) {\r
+        if ( (cursor + remain) <= start)\r
+        {\r
+          addOperation(oldops[o],oldrange[o]);\r
+          cursor+=oldrange[o++];\r
+          continue; // next operation\r
+        }\r
+        editing=true;\r
+        // add operations before hidden region\r
+        if (start-cursor>0) {\r
+          addOperation(oldops[o], start- cursor);\r
+          remain -= start - cursor;\r
+        }\r
+      }\r
+      // start inserting new ops\r
+      if (o<oldlen && editing && rlength>0 && remain>0) {\r
+        switch (oldops[o]) {\r
+          case M:\r
+            if (rlength>remain) {\r
+              addDeleted(remain);\r
+              deleted+=remain;\r
+            } else {\r
+              deleted+=rlength;\r
+              addDeleted(rlength);\r
+              if (remain-rlength>0)\r
+                this.addOperation(M,remain-rlength); // add remaining back.\r
+              rlength=0;\r
+              remain=0;\r
+            }\r
+            break;\r
+          case I:\r
+            if (remain-rlength>0) {\r
+              // only remove some gaps\r
+              addInsertion(remain-rlength);\r
+              rlength=0;\r
+            }\r
+            break;\r
+          case D:\r
+            throw new Error("Implementation error."); // do nothing;\r
+          default:\r
+            throw new Error("Implementation Error! Unknown operation '"+oldops[o]+"'");\r
+        }\r
+        rlength-=remain;\r
+        remain = oldrange[++o]; // number of op characters left to edit\r
+      }\r
+    }\r
+    // add remaining\r
+    while (o<oldlen) {\r
+      addOperation(oldops[o],oldrange[o++]);\r
+    }\r
+    //if (cursor<(start+1)) {\r
+      // ran out of ops - nothing to do here ?\r
+     // addInsertion(start-cursor);\r
+    //}\r
+    return deleted;\r
+  }\r
+\r
+  /**\r
+   * Deleted regions mean that there will be discontinuous sequence numbering in the\r
+   * sequence returned by getSeq(char).\r
+   * @return true if there deletions\r
+   */\r
+  public boolean hasDeletedRegions()\r
+  {\r
+    for (int i = 0; i<length ; i++)\r
+    {\r
+      if (operation[i] == D)\r
+      {\r
+        return true;\r
+      }\r
+    }\r
+    return false;\r
+  }\r
+  /**\r
+   * enumerate the ranges on seq that are marked as deleted in this cigar\r
+   * @return int[] { vis_start, sym_start, length }\r
+   */\r
+  public int[] getDeletedRegions() {\r
+    if (length==0)\r
+      return null;\r
+    Vector dr = new Vector();\r
+    int cursor=0, vcursor=0;\r
+    for (int i=0;i<length;i++) {\r
+      switch (operation[i]) {\r
+        case M:\r
+          cursor+=range[i];\r
+        case I:\r
+          vcursor+=range[i];\r
+          break;\r
+        case D:\r
+          dr.addElement(new int[] { vcursor, cursor, range[i]});\r
+          cursor+=range[i];\r
+      }\r
+    }\r
+    if (dr.size()==0)\r
+      return null;\r
+    int[] delregions = new int[dr.size()*3];\r
+    for (int i=0,l=dr.size(); i<l; i++) {\r
+      int[] reg = (int[]) dr.elementAt(i);\r
+      delregions[i*3] = reg[0];\r
+      delregions[i*3+1] = reg[1];\r
+      delregions[i*3+2] = reg[2];\r
+    }\r
+    return delregions;\r
+  }\r
+  /**\r
+   * sum of ranges in cigar string\r
+   * @return int number of residues hidden, matched, or gaps inserted into sequence\r
+   */\r
+  public int getFullWidth()\r
+  {\r
+    int w = 0;\r
+    if (range != null)\r
+    {\r
+      for (int i = 0; i < length; i++)\r
+      {\r
+        w += range[i];\r
+      }\r
+    }\r
+    return w;\r
+  }\r
+\r
+  /**\r
+   * Visible length of aligned sequence\r
+   * @return int length of including gaps and less hidden regions\r
+   */\r
+  public int getWidth()\r
+  {\r
+    int w = 0;\r
+    if (range != null)\r
+    {\r
+      for (int i = 0; i < length; i++)\r
+      {\r
+        if (operation[i] == M || operation[i] == I)\r
+        {\r
+          w += range[i];\r
+        }\r
+      }\r
+    }\r
+    return w;\r
+  }\r
+  /**\r
+   * mark a range of inserted residues\r
+   * @param range int\r
+   */\r
+  public void addInsertion(int range)\r
+  {\r
+    this.addOperation(I, range);\r
+  }\r
+\r
+  /**\r
+   * mark the next range residues as hidden (not aligned) or deleted\r
+   * @param range int\r
+   */\r
+  public void addDeleted(int range)\r
+  {\r
+    this.addOperation(D, range);\r
+  }\r
+\r
+  /**\r
+   * Modifies operation list to delete columns from start to end (inclusive)\r
+   * editing will remove insertion operations, and convert matches to deletions\r
+   * @param start alignment column\r
+   * @param end alignment column\r
+   * @return boolean true if residues were marked as deleted.\r
+  public boolean deleteRange(int start, int end)\r
+  {\r
+    boolean deleted = false;\r
+    int op = 0, prevop = -1, firstm = -1,\r
+        lastm = -1, postop = -1;\r
+    int width = 0; // zero'th column\r
+    if (length > 0)\r
+    {\r
+      // find operation bracketing start of the range\r
+      do\r
+      {\r
+        if (operation[op] != D)\r
+        {\r
+          width += range[prevop = op];\r
+        }\r
+        op++;\r
+      }\r
+      while (op < length && width < start);\r
+    }\r
+    if (width < start)\r
+    {\r
+      // run off end - add more operations up to deletion.\r
+      addInsertion(start - width);\r
+    }\r
+    else\r
+    {\r
+      // edit existing operations.\r
+      op = prevop;\r
+      width -= range[prevop];\r
+      int[] oldrange = range;\r
+      char[] oldops = operation;\r
+      range = new int[oldrange.length];\r
+      operation = new char[oldops.length];\r
+      if (op < length)\r
+      {\r
+        do\r
+        {\r
+          if (operation[op] != D)\r
+          {\r
+            width += range[postop = op];\r
+          }\r
+          op++;\r
+        }\r
+        while (op < length && width <= end);\r
+      }\r
+    }\r
+    if (deleted == true)\r
+    {\r
+      addDeleted(end - start + 1);\r
+    }\r
+    return deleted;\r
+  }\r
+*/\r
+  /**\r
+   * Return an ENSEMBL style cigar string where D may indicates excluded parts of seq\r
+   * @return String of form ([0-9]+[IMD])+\r
+   */\r
+  public String getCigarstring()\r
+  {\r
+    StringBuffer cigarString = new StringBuffer();\r
+    for (int i = 0; i < length; i++)\r
+    {\r
+      cigarString.append("" + range[i]);\r
+      cigarString.append(operation[i]);\r
+    }\r
+    return cigarString.toString();\r
+  }\r
+}\r
diff --git a/src/jalview/datamodel/CigarCigar.java b/src/jalview/datamodel/CigarCigar.java
new file mode 100644 (file)
index 0000000..57848eb
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer
+ * Copyright (C) 2006 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
+ */
+package jalview.datamodel;
+
+public class CigarCigar
+    extends CigarSimple
+{
+  SeqCigar refCigar;
+    /**
+     * Apply CIGAR operations to the result of another cigar
+     * @param cigar Cigar
+     */
+    CigarCigar(SeqCigar cigar) {
+      super();
+      refCigar = cigar;
+    }
+  /**
+   *
+   * @return String formed by applying CIGAR operations to the reference object
+   * @param GapChar char
+   * @todo Implement this jalview.datamodel.Cigar method
+   */
+  public String getSequenceString(char GapChar)
+  {
+    if (length==0)
+      return "";
+    String refString = refCigar.getSequenceString(GapChar);
+    if (refString!=null) {
+      return (length==0) ? "" : (String) getSequenceAndDeletions(refString, GapChar)[0];
+    } else
+      return null;
+  }
+
+}
diff --git a/src/jalview/datamodel/CigarSimple.java b/src/jalview/datamodel/CigarSimple.java
new file mode 100644 (file)
index 0000000..c33da7a
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer
+ * Copyright (C) 2006 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
+ */
+package jalview.datamodel;
+
+/**
+ * <p>Title: </p>
+ *
+ * <p>Description: </p>
+ *
+ * <p>Copyright: Copyright (c) 2004</p>
+ *
+ * <p>Company: Dundee University</p>
+ *
+ * @author not attributable
+ * @version 1.0
+ */
+public abstract class CigarSimple
+    extends CigarBase
+{
+    /**
+     * Return a symbol sequence with edits (gaps, insertions and deletions) applied
+     * @param GapChar char
+     * @return String
+     */
+    public abstract String getSequenceString(char GapChar);
+
+}
diff --git a/src/jalview/datamodel/ColumnSelection.java b/src/jalview/datamodel/ColumnSelection.java
new file mode 100644 (file)
index 0000000..2d22231
--- /dev/null
@@ -0,0 +1,728 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer
+ * Copyright (C) 2006 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
+ */
+package jalview.datamodel;
+
+import jalview.util.ShiftList;
+
+import java.util.*;
+
+/**
+ * NOTE: Columns are zero based.
+ */
+public class ColumnSelection
+{
+    Vector selected = new Vector();
+
+    //Vector of int [] {startCol, endCol}
+    Vector hiddenColumns;
+
+    /**
+     * Add a column to the selection
+     *
+     * @param col index of column
+     */
+    public void addElement(int col)
+    {
+        Integer column = new Integer(col);
+        if (!selected.contains(column))
+        {
+            selected.addElement(column);
+        }
+    }
+
+    /**
+     * clears column selection
+     */
+    public void clear()
+    {
+        selected.removeAllElements();
+    }
+
+    /**
+     * removes col from selection
+     *
+     * @param col index of column to be removed
+     */
+    public void removeElement(int col)
+    {
+        Integer colInt = new Integer(col);
+
+        if (selected.contains(colInt))
+        {
+            selected.removeElement(colInt);
+        }
+    }
+
+    /**
+     * removes a range of columns from the selection
+     * @param start int - first column in range to be removed
+     * @param end int - last col
+     */
+    public void removeElements(int start, int end)
+    {
+      Integer colInt;
+      for(int i=start; i<end; i++)
+      {
+        colInt = new Integer(i);
+        if (selected.contains(colInt))
+        {
+            selected.removeElement(colInt);
+        }
+      }
+    }
+    /**
+     *
+     * @return Vector containing selected columns as Integers
+     */
+    public Vector getSelected()
+    {
+      return selected;
+    }
+
+    /**
+     *
+     * @param col index to search for in column selection
+     *
+     * @return true if Integer(col) is in selection.
+     */
+    public boolean contains(int col)
+    {
+        return selected.contains(new Integer(col));
+    }
+
+    /**
+     * DOCUMENT ME!
+     *
+     * @param i DOCUMENT ME!
+     *
+     * @return DOCUMENT ME!
+     */
+    public int columnAt(int i)
+    {
+        return ((Integer) selected.elementAt(i)).intValue();
+    }
+
+    /**
+     * DOCUMENT ME!
+     *
+     * @return DOCUMENT ME!
+     */
+    public int size()
+    {
+        return selected.size();
+    }
+
+    /**
+     * DOCUMENT ME!
+     *
+     * @return DOCUMENT ME!
+     */
+    public int getMax()
+    {
+        int max = -1;
+
+        for (int i = 0; i < selected.size(); i++)
+        {
+            if (columnAt(i) > max)
+            {
+                max = columnAt(i);
+            }
+        }
+
+        return max;
+    }
+
+    /**
+     * DOCUMENT ME!
+     *
+     * @return DOCUMENT ME!
+     */
+    public int getMin()
+    {
+        int min = 1000000000;
+
+        for (int i = 0; i < selected.size(); i++)
+        {
+            if (columnAt(i) < min)
+            {
+                min = columnAt(i);
+            }
+        }
+
+        return min;
+    }
+
+
+    /**
+     * propagate shift in alignment columns to column selection
+     *
+     * @param start beginning of edit
+     * @param left shift in edit (+ve for removal, or -ve for inserts)
+     */
+    public void compensateForEdit(int start, int change)
+    {
+        for (int i = 0; i < size(); i++)
+        {
+            int temp = columnAt(i);
+
+            if (temp >= start)
+            {
+                selected.setElementAt(new Integer(temp - change), i);
+            }
+        }
+
+        if(hiddenColumns!=null)
+        {
+          for(int i=0; i<hiddenColumns.size(); i++)
+          {
+            int[] region = (int[]) hiddenColumns.elementAt(i);
+            if(region[0] > start)
+            {
+              region[0] -= change;
+              region[1] -= change;
+            }
+            if(region[0]<0)
+              region[0] = 0;
+            if(region[1] <0)
+             region[1] = 0;
+          }
+        }
+    }
+    /**
+     * propagate shift in alignment columns to column selection
+     * special version of compensateForEdit - allowing for edits within hidden regions
+     * @param start beginning of edit
+     * @param left shift in edit (+ve for removal, or -ve for inserts)
+     */
+    private void compensateForDelEdits(int start, int change)
+    {
+        for (int i = 0; i < size(); i++)
+        {
+            int temp = columnAt(i);
+
+            if (temp >= start)
+            {
+                selected.setElementAt(new Integer(temp - change), i);
+            }
+        }
+
+        if(hiddenColumns!=null)
+        {
+          for(int i=0; i<hiddenColumns.size(); i++)
+          {
+            int[] region = (int[]) hiddenColumns.elementAt(i);
+            if(region[0] >= start)
+            {
+              region[0] -= change;
+            }
+            if (region[1]>= start) {
+              region[1] -=change;
+            }
+            if (region[1]<region[0]) {
+              hiddenColumns.removeElementAt(i--);
+            }
+
+            if(region[0]<0)
+              region[0] = 0;
+            if(region[1] <0)
+             region[1] = 0;
+          }
+        }
+    }
+    /**
+     * Adjust hidden column boundaries based on a series of column
+     * additions or deletions in visible regions.
+     * @param shiftrecord
+     * @return
+     */
+    public ShiftList compensateForEdits(ShiftList shiftrecord) {
+      if (shiftrecord!=null) {
+        Vector shifts = shiftrecord.shifts;
+        if (shifts!=null && shifts.size()>0) {
+          int shifted=0;
+          for (int i=0,j=shifts.size(); i<j; i++) {
+            int[] sh = (int[]) shifts.elementAt(i);
+            //compensateForEdit(shifted+sh[0], sh[1]);
+            compensateForDelEdits(shifted+sh[0], sh[1]);
+            shifted-=sh[1];
+          }
+        }
+        return shiftrecord.getInverse();
+      }
+      return null;
+    }
+    /**
+     * removes intersection of position,length ranges in deletions
+     * from the start,end regions marked in intervals.
+     * @param deletions
+     * @param intervals
+     * @return
+     */
+    private boolean pruneIntervalVector(Vector deletions, Vector intervals) {
+      boolean pruned=false;
+      int i=0,j=intervals.size()-1, s=0, t=deletions.size()-1;
+      int hr[]=(int[]) intervals.elementAt(i);
+      int sr[]=(int[]) deletions.elementAt(s);
+      while (i<=j && s<=t) {
+        boolean trailinghn=hr[1]>=sr[0];
+        if (!trailinghn) {
+          if (i<j)
+            hr=(int[]) intervals.elementAt(++i);
+          else
+            i++;
+          continue;
+        }
+        int endshift=sr[0]+sr[1]; // deletion ranges - -ve means an insert
+        if (endshift<hr[0] || endshift<sr[0]) { // leadinghc disjoint or not a deletion
+          if (s<t)
+            sr=(int[]) deletions.elementAt(++s);
+          else
+            s++;
+          continue;
+        }
+        boolean leadinghn=hr[0]>=sr[0];
+        boolean leadinghc=hr[0]<endshift;
+        boolean trailinghc=hr[1]<endshift;
+        if (leadinghn) {
+          if (trailinghc) {// deleted hidden region.
+            intervals.removeElementAt(i);
+            pruned=true;
+            j--;
+            if (i<=j)
+              hr=(int[]) intervals.elementAt(i);
+            continue;
+          }
+          if (leadinghc) {
+            hr[0]=endshift; // clip c terminal region
+            leadinghn=!leadinghn;
+            pruned=true;
+          }
+        }
+        if (!leadinghn) {
+          if (trailinghc) {
+            if (trailinghn) {
+              hr[1]=sr[0]-1;
+              pruned=true;
+            }
+          } else {
+            // sr contained in hr
+            if (s<t)
+              sr=(int[]) deletions.elementAt(++s);
+            else
+              s++;
+            continue;
+          }
+        }
+      }
+      return pruned; // true if any interval was removed or modified by operations.
+    }
+    private boolean pruneColumnList(Vector deletion, Vector list) {
+      int s=0,t=deletion.size();
+      int[] sr=(int[])list.elementAt(s++);
+      boolean pruned=false;
+      int i=0, j=list.size();
+      while (i<j && s<=t) {
+        int c=((Integer)list.elementAt(i++)).intValue();
+        if (sr[0]<=c) {
+          if (sr[1]+sr[0]>=c) { // sr[1] -ve means inseriton.
+            list.removeElementAt(--i);
+            j--;
+          } else {
+            if (s<t)
+              sr = (int[])deletion.elementAt(s);
+            s++;
+          }
+        }
+      }
+      return pruned;
+    }
+    /**
+     * remove any hiddenColumns or selected columns and shift remaining
+     * based on a series of position, range deletions.
+     * @param deletions
+     */
+    public void pruneDeletions(ShiftList deletions) {
+      if (deletions!=null) {
+        Vector shifts=deletions.shifts;
+        if (shifts!=null && shifts.size()>0) {
+          // delete any intervals intersecting.
+          if (hiddenColumns!=null) {
+            pruneIntervalVector(shifts, hiddenColumns);
+            if (hiddenColumns!=null && hiddenColumns.size()==0) {
+              hiddenColumns=null;
+            }
+          }
+          if (selected!=null && selected.size()>0) {
+            pruneColumnList(shifts, selected);
+            if (selected!=null && selected.size()==0)
+              selected=null;
+          }
+          // and shift the rest.
+          this.compensateForEdits(deletions);
+        }
+      }
+    }
+    /**
+     * This Method is used to return all the HiddenColumn regions
+     * less than the given index.
+     * @param end int
+     * @return Vector
+     */
+    public Vector getHiddenColumns()
+    {
+      return hiddenColumns;
+    }
+    /**
+     * Return absolute column index for a visible column index
+     * @param column int column index in alignment view
+     * @return alignment column index for column
+     */
+    public int adjustForHiddenColumns(int column)
+    {
+      int result = column;
+      if (hiddenColumns != null)
+      {
+        for (int i = 0; i < hiddenColumns.size(); i++)
+        {
+          int[] region = (int[]) hiddenColumns.elementAt(i);
+          if (result >= region[0])
+          {
+            result += region[1] - region[0] + 1;
+          }
+        }
+      }
+      return result;
+    }
+
+    /**
+     * Use this method to find out where a visible column is in the alignment
+     * when hidden columns exist
+     * @param hiddenColumn int
+     * @return int
+     */
+    public int findColumnPosition(int hiddenColumn)
+    {
+      int result = hiddenColumn;
+      if (hiddenColumns != null)
+      {
+        int index = 0;
+        int gaps = 0;
+        do
+        {
+          int[] region = (int[]) hiddenColumns.elementAt(index);
+          if (hiddenColumn > region[1])
+          {
+            result -= region[1]+1-region[0];
+          }
+          index++;
+        }
+        while (index < hiddenColumns.size());
+
+        result -= gaps;
+      }
+
+      return result;
+    }
+
+    /**
+     * Use this method to determine where the next hiddenRegion starts
+    */
+    public int findHiddenRegionPosition(int hiddenRegion)
+    {
+      int result = 0;
+      if (hiddenColumns != null)
+      {
+        int index = 0;
+        int gaps = 0;
+        do
+        {
+          int[] region = (int[]) hiddenColumns.elementAt(index);
+          if(hiddenRegion==0)
+          {
+            return region[0];
+          }
+
+            gaps +=  region[1] +1 - region[0];
+            result = region[1] +1;
+            index++;
+        }
+        while(index < hiddenRegion+1);
+
+        result -= gaps;
+      }
+
+      return result;
+    }
+
+    /**
+     * THis method returns the rightmost limit of a
+     * region of an alignment with hidden columns.
+     * In otherwords, the next hidden column.
+     * @param index int
+     */
+    public int getHiddenBoundaryRight(int alPos)
+    {
+      if (hiddenColumns != null)
+      {
+        int index = 0;
+        do
+        {
+          int[] region = (int[]) hiddenColumns.elementAt(index);
+          if(alPos < region[0])
+            return region[0];
+
+          index++;
+        }
+        while(index < hiddenColumns.size());
+      }
+
+      return alPos;
+
+    }
+    /**
+     * THis method returns the rightmost limit of a
+     * region of an alignment with hidden columns.
+     * In otherwords, the next hidden column.
+     * @param index int
+     */
+    public int getHiddenBoundaryLeft(int alPos)
+    {
+      if (hiddenColumns != null)
+      {
+        int index = hiddenColumns.size()-1;
+        do
+        {
+          int[] region = (int[]) hiddenColumns.elementAt(index);
+          if(alPos > region[1])
+            return region[1];
+
+          index--;
+        }
+        while(index >-1);
+      }
+
+      return alPos;
+
+    }
+
+    public void hideSelectedColumns()
+    {
+      while (size() > 0)
+      {
+        int column = ( (Integer) getSelected().firstElement()).intValue();
+        hideColumns(column);
+      }
+
+    }
+
+    public void hideColumns(int start, int end)
+    {
+      if(hiddenColumns==null)
+        hiddenColumns = new Vector();
+
+      boolean added = false;
+      boolean overlap = false;
+
+      for (int i = 0; i < hiddenColumns.size(); i++)
+      {
+        int[] region = (int[]) hiddenColumns.elementAt(i);
+        if ( start<=region[1] && end>=region[0])
+        {
+          hiddenColumns.removeElementAt(i);
+          overlap = true;
+          break;
+        }
+        else if (end < region[0] && start < region[0])
+        {
+          hiddenColumns.insertElementAt(new int[]
+                                        {start, end}, i);
+          added = true;
+          break;
+        }
+      }
+
+      if(overlap)
+      {
+         hideColumns(start, end);
+      }
+      else if (!added)
+        hiddenColumns.addElement(new int[] {start, end});
+
+    }
+
+    /**
+     * This method will find a range of selected columns
+     * around the column specified
+     * @param res int
+     */
+    public void hideColumns(int col)
+    {
+      // First find out range of columns to hide
+      int min = col, max = col+1;
+      while( contains(min) )
+      {  removeElement(min); min --;  }
+
+      while( contains(max) )
+      { removeElement(max);  max ++;  }
+
+      min++; max--;
+
+      hideColumns(min, max);
+    }
+
+    public void revealAllHiddenColumns()
+    {
+      if(hiddenColumns!=null)
+      {
+        for (int i = 0; i < hiddenColumns.size(); i++)
+        {
+          int[] region = (int[]) hiddenColumns.elementAt(i);
+          for (int j = region[0]; j < region[1]+1; j++)
+          {
+            addElement(j);
+          }
+        }
+      }
+
+      hiddenColumns = null;
+    }
+
+    public void revealHiddenColumns(int res)
+    {
+      for(int i=0; i<hiddenColumns.size(); i++)
+      {
+        int [] region = (int[])hiddenColumns.elementAt(i);
+        if( res == region[0])
+        {
+          for (int j = region[0]; j < region[1]+1; j++)
+          {
+            addElement(j);
+          }
+
+          hiddenColumns.removeElement(region);
+          break;
+        }
+      }
+      if(hiddenColumns.size()==0)
+        hiddenColumns = null;
+    }
+
+    public boolean isVisible(int column)
+    {
+      for(int i=0; i<hiddenColumns.size(); i++)
+      {
+        int [] region = (int[])hiddenColumns.elementAt(i);
+        if( column >= region[0] && column <= region[1])
+        {
+          return false;
+        }
+      }
+      return true;
+    }
+    /**
+     * Copy constructor
+     * @param copy
+     */
+    public ColumnSelection(ColumnSelection copy) {
+      if (copy!=null) {
+        if (copy.selected!=null) {
+          selected = new Vector();
+          for (int i=0,j=copy.selected.size(); i<j; i++) {
+            selected.setElementAt( ((Integer) copy.selected.elementAt(i)), i);
+          }
+        }
+        if (copy.hiddenColumns!=null) {
+          hiddenColumns=new Vector();
+          for (int i=0,j=copy.hiddenColumns.size(); i<j; i++) {
+            int[] rh,cp;
+            rh = (int[])copy.hiddenColumns.elementAt(i);
+            if (rh!=null) {
+              cp = new int[rh.length];
+              System.arraycopy(rh, 0, cp, 0, rh.length);
+              hiddenColumns.setElementAt(cp, i);
+            }
+          }
+        }
+      }
+    }
+
+  /**
+   * ColumnSelection
+   */
+  public ColumnSelection()
+  {
+  }
+
+  public String[] getVisibleSequenceStrings(int start, int end, SequenceI[] seqs) {
+    int i,iSize=seqs.length;
+    String selection[] = new String[iSize];
+    if (hiddenColumns!=null && hiddenColumns.size()>0)
+      {
+      for (i=0; i<iSize; i++) {
+        StringBuffer visibleSeq = new StringBuffer();
+        Vector regions = getHiddenColumns();
+
+        int blockStart = start, blockEnd=end;
+        int [] region;
+           int hideStart, hideEnd;
+
+           for (int j = 0; j < regions.size(); j++)
+           {
+             region = (int[]) regions.elementAt(j);
+             hideStart = region[0];
+             hideEnd = region[1];
+
+             if(hideStart < start)
+             {
+               continue;
+             }
+
+             blockStart = Math.min(blockStart, hideEnd+1);
+             blockEnd = Math.min(blockEnd, hideStart);
+
+             if(blockStart>blockEnd)
+             {
+                break;
+             }
+
+
+             visibleSeq.append(seqs[i].getSequence(blockStart, blockEnd));
+
+             blockStart = hideEnd+1;
+             blockEnd = end;
+           }
+
+           if(end>blockStart)
+             visibleSeq.append(seqs[i].getSequence(blockStart, end));
+
+           selection[i] = visibleSeq.toString();
+        }
+      }
+      else
+      {
+        for(i=0; i<iSize; i++)
+        {
+        selection[i] = seqs[i].getSequence(start, end);
+        }
+      }
+      
+    return selection;
+    }
+  
+}
diff --git a/src/jalview/datamodel/DBRefSource.java b/src/jalview/datamodel/DBRefSource.java
new file mode 100755 (executable)
index 0000000..4830bc6
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer
+ * Copyright (C) 2006 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
+ */
+package jalview.datamodel;
+
+public class DBRefSource
+{
+    /**
+     * UNIPROT Accession Number
+     */
+    public static String UNIPROT="UNIPROT";
+    /**
+     * UNIPROT Entry Name
+     */
+    public static String UP_NAME="UNIPROT_NAME";
+    /**
+     * PDB Entry Code
+     */
+    public static String PDB="PDB";
+    /**
+     * EMBL ID
+     */
+    public static String EMBL="EMBL";
+    /**
+     * EMBLCDS ID
+     */
+    public static String EMBLCDS="EMBLCDS";
+    /**
+     * PFAM ID
+     */
+    public static String PFAM="PFAM";
+    }
diff --git a/src/jalview/datamodel/SeqCigar.java b/src/jalview/datamodel/SeqCigar.java
new file mode 100644 (file)
index 0000000..84da278
--- /dev/null
@@ -0,0 +1,602 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer
+ * Copyright (C) 2006 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
+ */
+package jalview.datamodel;
+
+import jalview.analysis.*;
+import jalview.util.ShiftList;
+import java.util.Vector;
+
+public class SeqCigar
+    extends CigarSimple
+{
+    /**
+     * start(inclusive) and end(exclusive) of subsequence on refseq
+     */
+    private int start, end;
+  private SequenceI refseq = null;
+  /**
+   * Reference dataset sequence for the cigar string
+   * @return SequenceI
+   */
+  public SequenceI getRefSeq()
+  {
+    return refseq;
+  }
+  /**
+   *
+   * @return int start index of cigar ops on refSeq
+   */
+  public int getStart() {
+    return start;
+  }
+  /**
+   *
+   * @return int end index (exclusive) of cigar ops on refSeq
+   */
+  public int getEnd() {
+    return end;
+  }
+  /**
+   * Returns sequence as a string with cigar operations applied to it
+   * @return String
+   */
+  public String getSequenceString(char GapChar)
+  {
+    return (length == 0) ? "" :
+        (String) getSequenceAndDeletions(refseq.getSequence().substring(start, end), GapChar)[0];
+  }
+
+  /**
+   * recreates a gapped and edited version of RefSeq or null for an empty cigar string
+   * @return SequenceI
+   */
+  public SequenceI getSeq(char GapChar)
+  {
+    Sequence seq;
+    if (refseq == null || length == 0)
+    {
+      return null;
+    }
+    Object[] edit_result = getSequenceAndDeletions(refseq.getSequence().substring(start,end),
+        GapChar);
+    if (edit_result == null)
+    {
+      throw new Error(
+          "Implementation Error - unexpected null from getSequenceAndDeletions");
+    }
+    int bounds[] = (int[]) edit_result[1];
+    seq = new Sequence(refseq.getName(), (String) edit_result[0],
+                       refseq.getStart() + start+bounds[0],
+                       refseq.getStart() + start+((bounds[2]==0) ? -1 : bounds[2]));
+    // seq.checkValidRange(); probably not needed
+    seq.setDatasetSequence(refseq);
+    return seq;
+  }
+
+  /*
+     We don't allow this - refseq is given at construction time only
+   public void setSeq(SequenceI seq) {
+    this.seq = seq;
+     }
+   */
+  /**
+   * internal constructor - sets seq to a gapless sequence derived from seq
+   * and prepends any 'D' operations needed to get to the first residue of seq.
+   * @param seq SequenceI
+   * @param initialDeletion true to mark initial dataset sequence residues as deleted in subsequence
+   * @param _s index of first position in seq
+   * @param _e index after last position in (possibly gapped) seq
+   * @return true if gaps are present in seq
+   */
+  private boolean _setSeq(SequenceI seq, boolean initialDeletion, int _s, int _e)
+  {
+    boolean hasgaps = false;
+    if (seq == null)
+    {
+      throw new Error("Implementation Error - _setSeq(null,...)");
+    }
+    if (_s<0)
+      throw new Error("Implementation Error: _s="+_s);
+    String seq_string = seq.getSequence();
+    if (_e==0 || _e<_s || _e>seq_string.length())
+      _e=seq_string.length();
+    // resolve start and end positions relative to ungapped reference sequence
+    start = seq.findPosition(_s)-seq.getStart();
+    end = seq.findPosition(_e)-seq.getStart();
+    int l_ungapped = end-start;
+    // Find correct sequence to reference and correct start and end - if necessary
+    SequenceI ds = seq.getDatasetSequence();
+    if (ds == null)
+    {
+      // make a new dataset sequence
+      String ungapped = AlignSeq.extractGaps(jalview.util.Comparison.GapChars,
+                                               new String(seq_string));
+      l_ungapped=ungapped.length();
+      // check that we haven't just duplicated an ungapped sequence.
+      if (l_ungapped == seq.getLength())
+      {
+        ds = seq;
+      }
+      else
+      {
+        ds = new Sequence(seq.getName(), ungapped,
+                          seq.getStart(),
+                          seq.getStart()+ungapped.length()-1);
+        // JBPNote: this would be consistent but may not be useful
+        //        seq.setDatasetSequence(ds);
+      }
+    }
+    // add in offset between seq and the dataset sequence
+    if (ds.getStart() < seq.getStart())
+    {
+      int offset=seq.getStart()-ds.getStart();
+      if (initialDeletion) {
+          // absolute cigar string
+          addDeleted(_s+offset);
+          start=0;
+          end+=offset;
+      } else {
+          // normal behaviour - just mark start and end subsequence
+          start+=offset;
+          end+=offset;
+
+      }
+
+    }
+
+    // any gaps to process ?
+    if (l_ungapped!=(_e-_s))
+      hasgaps=true;
+
+    this.refseq = ds;
+
+    // Check  offsets
+    if (end>ds.getLength()) {
+      throw new Error("SeqCigar: Possible implementation error: sequence is longer than dataset sequence");
+//      end = ds.getLength();
+    }
+
+    return hasgaps;
+  }
+
+  /**
+   * directly initialise a cigar object with a sequence of range, operation pairs and a sequence to apply it to.
+   * operation and range should be relative to the seq.getStart()'th residue of the dataset seq resolved from seq.
+   * @param seq SequenceI
+   * @param operation char[]
+   * @param range int[]
+   */
+  public SeqCigar(SequenceI seq, char operation[], int range[])
+  {
+    super();
+    if (seq == null)
+    {
+      throw new Error("Implementation Bug. Null seq !");
+    }
+    if (operation.length != range.length)
+    {
+      throw new Error("Implementation Bug. Cigar Operation list!= range list");
+    }
+
+    if (operation != null)
+    {
+      this.operation = new char[operation.length + _inc_length];
+      this.range = new int[operation.length + _inc_length];
+
+      if (_setSeq(seq, false, 0, 0))
+      {
+        throw new Error("NOT YET Implemented: Constructing a Cigar object from a cigar string and a gapped sequence.");
+      }
+      for (int i = this.length, j = 0; j < operation.length; i++, j++)
+      {
+        char op = operation[j];
+        if (op != M && op != I && op != D)
+        {
+          throw new Error(
+              "Implementation Bug. Cigar Operation '" + j + "' '" + op +
+              "' not one of '" + M + "', '" + I + "', or '" + D + "'.");
+        }
+        this.operation[i] = op;
+        this.range[i] = range[j];
+      }
+      this.length += operation.length;
+    }
+    else
+    {
+      this.operation = null;
+      this.range = null;
+      this.length = 0;
+      if (_setSeq(seq, false,0, 0))
+      {
+        throw new Error("NOT YET Implemented: Constructing a Cigar object from a cigar string and a gapped sequence.");
+      }
+    }
+  }
+
+  /**
+   * add range matched residues to cigar string
+   * @param range int
+   */
+  public void addMatch(int range)
+  {
+    this.addOperation(M, range);
+  }
+  /**
+   * Adds
+   * insertion and match operations based on seq to the cigar up to
+   * the endpos column of seq.
+   *
+   * @param cigar CigarBase
+   * @param seq SequenceI
+   * @param startpos int
+   * @param endpos int
+   * @param initialDeletions if true then initial deletions will be added from start of seq to startpos
+   */
+  protected static void addSequenceOps(CigarBase cigar, SequenceI seq,
+                                       int startpos, int endpos, boolean initialDeletions)
+  {
+    char op = '\0';
+    int range = 0;
+    int p = 0, res = seq.getLength();
+
+    if (!initialDeletions)
+      p=startpos;
+
+
+    while (p <= endpos)
+    {
+      boolean isGap = (p < res) ? jalview.util.Comparison.isGap(seq.getCharAt(p)) : true;
+      if ( (startpos <= p) && (p <= endpos))
+      {
+        if (isGap)
+        {
+          if (range > 0 && op != I)
+          {
+            cigar.addOperation(op, range);
+            range = 0;
+          }
+          op = I;
+          range++;
+        }
+        else
+        {
+          if (range > 0 && op != M)
+          {
+            cigar.addOperation(op, range);
+            range = 0;
+          }
+          op = M;
+          range++;
+        }
+      }
+      else
+      {
+        if (!isGap)
+        {
+          if (range > 0 && op != D)
+          {
+            cigar.addOperation(op, range);
+            range = 0;
+          }
+          op = D;
+          range++;
+        }
+        else
+        {
+          // do nothing - insertions are not made in flanking regions
+        }
+      }
+      p++;
+    }
+    if (range > 0)
+    {
+      cigar.addOperation(op, range);
+    }
+  }
+
+  /**
+   * create a cigar string for given sequence
+   * @param seq SequenceI
+   */
+  public SeqCigar(SequenceI seq)
+  {
+    super();
+    if (seq == null)
+    {
+      throw new Error("Implementation error for new Cigar(SequenceI)");
+    }
+    _setSeq(seq, false, 0, 0);
+    // there is still work to do
+    addSequenceOps(this, seq, 0, seq.getLength()-1, false);
+  }
+
+  /**
+   * Create Cigar from a range of gaps and residues on a sequence object
+   * @param seq SequenceI
+   * @param start int - first column in range
+   * @param end int - last column in range
+   */
+  public SeqCigar(SequenceI seq, int start, int end)
+  {
+    super();
+    if (seq == null)
+    {
+      throw new Error("Implementation error for new Cigar(SequenceI)");
+    }
+    _setSeq(seq, false, start, end+1);
+    // there is still work to do
+    addSequenceOps(this, seq, start, end, false);
+  }
+
+  /**
+   * Create a cigar object from a cigar string like '[<I|D|M><range>]+'
+   * Will fail if the given seq already contains gaps (JBPNote: future implementation will fix)
+   * @param seq SequenceI object resolvable to a dataset sequence
+   * @param cigarString String
+   * @return Cigar
+   */
+  public static SeqCigar parseCigar(SequenceI seq, String cigarString)
+      throws Exception
+  {
+    Object[] opsandrange = parseCigarString(cigarString);
+    return new SeqCigar(seq, (char[]) opsandrange[0], (int[]) opsandrange[1]);
+  }
+
+  /**
+   * createAlignment
+   *
+   * @param alseqs SeqCigar[]
+   * @param gapCharacter char
+   * @return SequenceI[]
+   */
+  public static SequenceI[] createAlignmentSequences(SeqCigar[] alseqs,
+      char gapCharacter, ColumnSelection colsel, int[] segments)
+  {
+    SequenceI[] seqs = new SequenceI[alseqs.length];
+    StringBuffer[] g_seqs = new StringBuffer[alseqs.length];
+    String[] alseqs_string=new String[alseqs.length];
+    Object[] gs_regions = new Object[alseqs.length];
+    for (int i = 0; i < alseqs.length; i++)
+    {
+      alseqs_string[i]=alseqs[i].getRefSeq().
+          getSequence().substring(alseqs[i].start,alseqs[i].end);
+      gs_regions[i] = alseqs[i].getSequenceAndDeletions(alseqs_string[i], gapCharacter); // gapped sequence, {start, start col, end. endcol}, hidden regions {{start, end, col}})
+      if (gs_regions[i] == null)
+      {
+        throw new Error("Implementation error: " + i +
+                        "'th sequence Cigar has no operations.");
+      }
+      g_seqs[i] = new StringBuffer( (String) ( (Object[]) gs_regions[i])[0]); // the visible gapped sequence
+    }
+    // Now account for insertions. (well - deletions)
+    // this is complicated because we must keep track of shifted positions in each sequence
+    ShiftList shifts = new ShiftList();
+    for (int i = 0; i < alseqs.length; i++)
+    {
+      Object[] gs_region = ( (Object[]) ( (Object[]) gs_regions[i])[2]);
+      if (gs_region != null)
+
+      {
+        for (int hr = 0; hr < gs_region.length; hr++)
+        {
+          int[] region = (int[]) gs_region[hr];
+          char[] insert = new char[region[1] - region[0] + 1];
+          for (int s = 0; s < insert.length; s++)
+          {
+            insert[s] = gapCharacter;
+          }
+          int inspos = shifts.shift(region[2]); // resolve insertion position in current alignment frame of reference
+          for (int s = 0; s < alseqs.length; s++)
+          {
+            if (s != i)
+            {
+              if (g_seqs[s].length() <= inspos)
+              {
+                // prefix insertion with more gaps.
+                for (int l = inspos - g_seqs[s].length(); l > 0; l--)
+                {
+                  g_seqs[s].append(gapCharacter); // to debug - use a diffferent gap character here
+                }
+              }
+              g_seqs[s].insert(inspos, insert);
+            }
+            else
+            {
+              g_seqs[s].insert(inspos,
+                               alseqs_string[i].substring(region[0], region[1] + 1));
+            }
+          }
+          shifts.addShift(region[2], insert.length); // update shift in alignment frame of reference
+          if (segments==null)
+            // add a hidden column for this deletion
+            colsel.hideColumns(inspos, inspos+insert.length-1);
+        }
+      }
+    }
+    for (int i = 0; i < alseqs.length; i++)
+    {
+      int[] bounds = ( (int[]) ( (Object[]) gs_regions[i])[1]);
+      SequenceI ref = alseqs[i].getRefSeq();
+      seqs[i] = new Sequence(ref.getName(), g_seqs[i].toString(),
+                             ref.getStart() + alseqs[i].start+bounds[0],
+                             ref.getStart() + alseqs[i].start+(bounds[2]==0 ? -1 : bounds[2]));
+      seqs[i].setDatasetSequence(ref);
+    }
+    if (segments!=null) {
+      for (int i=0; i<segments.length; i+=3) {
+        //int start=shifts.shift(segments[i]-1)+1;
+        //int end=shifts.shift(segments[i]+segments[i+1]-1)-1;
+        colsel.hideColumns(segments[i+1], segments[i+1]+segments[i+2]-1);
+      }
+    }
+    return seqs;
+  }
+
+  /**
+   * non rigorous testing
+   */
+  /**
+   *
+   * @param seq Sequence
+   * @param ex_cs_gapped String
+   * @return String
+   */
+  public static String testCigar_string(Sequence seq, String ex_cs_gapped)
+  {
+    SeqCigar c_sgapped = new SeqCigar(seq);
+    String cs_gapped = c_sgapped.getCigarstring();
+    if (!cs_gapped.equals(ex_cs_gapped))
+    {
+      System.err.println("Failed getCigarstring: incorect string '" + cs_gapped +
+                         "' != " + ex_cs_gapped);
+    }
+    return cs_gapped;
+  }
+
+  public static boolean testSeqRecovery(SeqCigar gen_sgapped,
+                                        SequenceI s_gapped)
+  {
+      // this is non-rigorous - start and end  recovery is not tested.
+    SequenceI gen_sgapped_s = gen_sgapped.getSeq('-');
+    if (!gen_sgapped_s.getSequence().equals(s_gapped.getSequence()))
+    {
+      System.err.println("Couldn't reconstruct sequence.\n" +
+                         gen_sgapped_s.getSequence() + "\n" +
+                         s_gapped.getSequence());
+      return false;
+    }
+    return true;
+  }
+
+  public static void main(String argv[])
+      throws Exception
+  {
+    String o_seq;
+    Sequence s = new Sequence("MySeq",
+                              o_seq = "asdfktryasdtqwrtsaslldddptyipqqwaslchvhttt",
+                              39, 80);
+    String orig_gapped;
+    Sequence s_gapped = new Sequence("MySeq",
+        orig_gapped = "----asdf------ktryas---dtqwrtsasll----dddptyipqqwa----slchvhttt",
+                                     39, 80);
+    String ex_cs_gapped = "4I4M6I6M3I11M4I12M4I9M";
+    s_gapped.setDatasetSequence(s);
+    String sub_gapped_s;
+    Sequence s_subsequence_gapped = new Sequence("MySeq",
+        sub_gapped_s = "------ktryas---dtqwrtsasll----dddptyipqqwa----slchvh",
+                                                 43, 77);
+
+    s_subsequence_gapped.setDatasetSequence(s);
+    SeqCigar c_null = new SeqCigar(s);
+    String cs_null = c_null.getCigarstring();
+    if (!cs_null.equals("42M"))
+    {
+      System.err.println(
+          "Failed to recover ungapped sequence cigar operations:" +
+          ( (cs_null == "") ? "empty string" : cs_null));
+    }
+    testCigar_string(s_gapped, ex_cs_gapped);
+    SeqCigar gen_sgapped = SeqCigar.parseCigar(s, ex_cs_gapped);
+    if (!gen_sgapped.getCigarstring().equals(ex_cs_gapped))
+    {
+      System.err.println("Failed parseCigar(" + ex_cs_gapped +
+                         ")->getCigarString()->'" + gen_sgapped.getCigarstring() +
+                         "'");
+    }
+    testSeqRecovery(gen_sgapped, s_gapped);
+    // Test dataset resolution
+    SeqCigar sub_gapped = new SeqCigar(s_subsequence_gapped);
+    if (!testSeqRecovery(sub_gapped, s_subsequence_gapped))
+    {
+      System.err.println("Failed recovery for subsequence of dataset sequence");
+    }
+    // width functions
+    if (sub_gapped.getWidth() != sub_gapped_s.length())
+    {
+      System.err.println("Failed getWidth()");
+    }
+
+    sub_gapped.getFullWidth();
+    if (sub_gapped.hasDeletedRegions())
+    {
+      System.err.println("hasDeletedRegions is incorrect.");
+    }
+    // Test start-end region SeqCigar
+    SeqCigar sub_se_gp = new SeqCigar(s_subsequence_gapped, 8, 48);
+    if (sub_se_gp.getWidth() != 41)
+    {
+      System.err.println(
+          "SeqCigar(seq, start, end) not properly clipped alignsequence.");
+    }
+    System.out.println("Original sequence align:\n" + sub_gapped_s +
+                       "\nReconstructed window from 8 to 48\n"
+                       + "XXXXXXXX" + sub_se_gp.getSequenceString('-') + "..."
+                       + "\nCigar String:" + sub_se_gp.getCigarstring() + "\n"
+        );
+    SequenceI ssgp = sub_se_gp.getSeq('-');
+    System.out.println("\t " + ssgp.getSequence());
+    for (int r = 0; r < 10; r++)
+    {
+      sub_se_gp = new SeqCigar(s_subsequence_gapped, 8, 48);
+      int sl = sub_se_gp.getWidth();
+      int st = sl - 1 - r;
+      for (int rs = 0; rs < 10; rs++)
+      {
+        int e = st + rs;
+        sub_se_gp.deleteRange(st, e);
+        String ssgapedseq = sub_se_gp.getSeq('-').getSequence();
+        System.out.println(st + "," + e + "\t:" + ssgapedseq);
+        st -=3;
+      }
+    }
+    {
+      SeqCigar[] set = new SeqCigar[]
+          {
+          new SeqCigar(s), new SeqCigar(s_subsequence_gapped, 8, 48),
+          new SeqCigar(s_gapped)};
+      Alignment al = new Alignment(set);
+      for (int i = 0; i < al.getHeight(); i++)
+      {
+        System.out.println("" + al.getSequenceAt(i).getName() + "\t" +
+                           al.getSequenceAt(i).getStart() + "\t" +
+                           al.getSequenceAt(i).getEnd() + "\t" +
+                           al.getSequenceAt(i).getSequence());
+      }
+    }
+    {
+      System.out.println("Gapped.");
+      SeqCigar[] set = new SeqCigar[]
+          {
+          new SeqCigar(s), new SeqCigar(s_subsequence_gapped, 8, 48),
+          new SeqCigar(s_gapped)};
+      set[0].deleteRange(20, 25);
+      Alignment al = new Alignment(set);
+      for (int i = 0; i < al.getHeight(); i++)
+      {
+        System.out.println("" + al.getSequenceAt(i).getName() + "\t" +
+                           al.getSequenceAt(i).getStart() + "\t" +
+                           al.getSequenceAt(i).getEnd() + "\t" +
+                           al.getSequenceAt(i).getSequence());
+      }
+    }
+//    if (!ssgapedseq.equals("ryas---dtqqwa----slchvh"))
+//      System.err.println("Subseqgaped\n------ktryas---dtqwrtsasll----dddptyipqqwa----slchvhryas---dtqwrtsasll--qwa----slchvh\n"+ssgapedseq+"\n"+sub_se_gp.getCigarstring());
+  }
+
+}
diff --git a/src/jalview/datamodel/UniprotProteinName.java b/src/jalview/datamodel/UniprotProteinName.java
new file mode 100755 (executable)
index 0000000..6203a1f
--- /dev/null
@@ -0,0 +1,38 @@
+/*\r
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2006 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
+ */\r
+package jalview.datamodel;\r
+\r
+public class UniprotProteinName\r
+{\r
+    /**\r
+   * internal content storage\r
+   */\r
+  private java.util.Vector names;\r
+\r
+  public void setName(java.util.Vector names)\r
+  {\r
+    this.names = names;\r
+  }\r
+\r
+  public java.util.Vector getName()\r
+  {\r
+    return names;\r
+  }\r
+\r
+}\r
diff --git a/src/jalview/gui/AnnotationExporter.java b/src/jalview/gui/AnnotationExporter.java
new file mode 100755 (executable)
index 0000000..d4975a6
--- /dev/null
@@ -0,0 +1,227 @@
+/*\r
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2006 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
+ */\r
+\r
+package jalview.gui;\r
+\r
+import javax.swing.*;\r
+import java.awt.event.ActionListener;\r
+import java.awt.event.ActionEvent;\r
+\r
+import jalview.io.*;\r
+import jalview.datamodel.AlignmentAnnotation;\r
+\r
+import java.awt.Color;\r
+import java.awt.FlowLayout;\r
+import javax.swing.BorderFactory;\r
+\r
+\r
+public class AnnotationExporter\r
+    extends JPanel\r
+{\r
+  JInternalFrame frame;\r
+  AlignmentPanel ap;\r
+  boolean features = true;\r
+  AlignmentAnnotation [] annotations;\r
+\r
+  public AnnotationExporter()\r
+  {\r
+    try\r
+    {\r
+      jbInit();\r
+    }\r
+    catch (Exception ex)\r
+    {\r
+      ex.printStackTrace();\r
+    }\r
+\r
+    frame = new JInternalFrame();\r
+    frame.setContentPane(this);\r
+    frame.setLayer(JLayeredPane.PALETTE_LAYER);\r
+    Desktop.addInternalFrame(frame,\r
+                             "",\r
+                             260, 125);\r
+  }\r
+\r
+  public void exportFeatures(AlignmentPanel ap)\r
+  {\r
+    this.ap = ap;\r
+    features = true;\r
+    frame.setTitle("Export Features");\r
+  }\r
+\r
+  public void exportAnnotations(AlignmentPanel ap,\r
+                                AlignmentAnnotation [] annotations)\r
+  {\r
+    this.ap = ap;\r
+    features = false;\r
+    GFFFormat.setVisible(false);\r
+    this.annotations = annotations;\r
+    frame.setTitle("Export Annotations");\r
+  }\r
+\r
+  public void toFile_actionPerformed(ActionEvent e)\r
+  {\r
+      JalviewFileChooser chooser = new JalviewFileChooser(\r
+      jalview.bin.Cache.getProperty( "LAST_DIRECTORY"));\r
+\r
+      chooser.setFileView(new JalviewFileView());\r
+      chooser.setDialogTitle(\r
+          features ? "Save Features to File" : "Save Annotation to File");\r
+      chooser.setToolTipText("Save");\r
+\r
+      int value = chooser.showSaveDialog(this);\r
+\r
+      if (value == JalviewFileChooser.APPROVE_OPTION)\r
+      {\r
+        String text = "No features found on alignment";\r
+        if (features)\r
+        {\r
+          if (GFFFormat.isSelected())\r
+            text = new FeaturesFile().printGFFFormat(\r
+                ap.av.alignment.getDataset().getSequencesArray(),\r
+                ap.av.featuresDisplayed);\r
+          else\r
+            text = new FeaturesFile().printJalviewFormat(\r
+                ap.av.alignment.getDataset().getSequencesArray(),\r
+                ap.av.featuresDisplayed);\r
+        }\r
+        else\r
+        {\r
+           text = new AnnotationFile().printAnnotations( annotations );\r
+        }\r
+\r
+        try\r
+        {\r
+          java.io.PrintWriter out = new java.io.PrintWriter(\r
+              new java.io.FileWriter(chooser.getSelectedFile()));\r
+\r
+          out.print(text);\r
+          out.close();\r
+        }\r
+        catch (Exception ex)\r
+        {\r
+          ex.printStackTrace();\r
+        }\r
+      }\r
+  }\r
+\r
+  public void toTextbox_actionPerformed(ActionEvent e)\r
+  {\r
+    String text = "No features found on alignment";\r
+    if(features)\r
+    {\r
+      if (GFFFormat.isSelected())\r
+        text = new FeaturesFile().printGFFFormat(\r
+            ap.av.alignment.getDataset().getSequencesArray(),\r
+            ap.av.featuresDisplayed);\r
+      else\r
+        text = new FeaturesFile().printJalviewFormat(\r
+            ap.av.alignment.getDataset().getSequencesArray(),\r
+                ap.av.featuresDisplayed);\r
+    }\r
+    else if(!features)\r
+    {\r
+      text = new AnnotationFile().printAnnotations( annotations );\r
+    }\r
+\r
+\r
+    CutAndPasteTransfer cap = new CutAndPasteTransfer();\r
+    cap.setText(text);\r
+    Desktop.addInternalFrame(cap,\r
+                             (features ?  "Features for - " : "Annotations for - ")\r
+                             + ap.alignFrame.getTitle(),\r
+                             600,\r
+                             500);\r
+\r
+\r
+  }\r
+\r
+  public void close_actionPerformed(ActionEvent e)\r
+  {\r
+    try{\r
+      frame.setClosed(true);\r
+    }catch(java.beans.PropertyVetoException ex)\r
+    {}\r
+  }\r
+\r
+\r
+\r
+  private void jbInit()\r
+      throws Exception\r
+  {\r
+    this.setLayout(flowLayout1);\r
+    toFile.setText("to File");\r
+    toFile.addActionListener(new ActionListener()\r
+    {\r
+      public void actionPerformed(ActionEvent e)\r
+      {\r
+        toFile_actionPerformed(e);\r
+      }\r
+    });\r
+    toTextbox.setText("to Textbox");\r
+    toTextbox.addActionListener(new ActionListener()\r
+    {\r
+      public void actionPerformed(ActionEvent e)\r
+      {\r
+        toTextbox_actionPerformed(e);\r
+      }\r
+    });\r
+    close.setText("Close");\r
+    close.addActionListener(new ActionListener()\r
+    {\r
+      public void actionPerformed(ActionEvent e)\r
+      {\r
+        close_actionPerformed(e);\r
+      }\r
+    });\r
+    jalviewFormat.setOpaque(false);\r
+    jalviewFormat.setSelected(true);\r
+    jalviewFormat.setText("Jalview");\r
+    GFFFormat.setOpaque(false);\r
+    GFFFormat.setText("GFF");\r
+    jLabel1.setHorizontalAlignment(SwingConstants.TRAILING);\r
+    jLabel1.setText("Format: ");\r
+    this.setBackground(Color.white);\r
+    jPanel3.setBorder(BorderFactory.createEtchedBorder());\r
+    jPanel3.setOpaque(false);\r
+    jPanel1.setOpaque(false);\r
+    jPanel1.add(toFile);\r
+    jPanel1.add(toTextbox);\r
+    jPanel1.add(close);\r
+    jPanel3.add(jLabel1);\r
+    jPanel3.add(jalviewFormat);\r
+    jPanel3.add(GFFFormat);\r
+    buttonGroup.add(jalviewFormat);\r
+    buttonGroup.add(GFFFormat);\r
+    this.add(jPanel3, null);\r
+    this.add(jPanel1, null);\r
+  }\r
+\r
+  JPanel jPanel1 = new JPanel();\r
+  JButton toFile = new JButton();\r
+  JButton toTextbox = new JButton();\r
+  JButton close = new JButton();\r
+  ButtonGroup buttonGroup = new ButtonGroup();\r
+  JRadioButton jalviewFormat = new JRadioButton();\r
+  JRadioButton GFFFormat = new JRadioButton();\r
+  JLabel jLabel1 = new JLabel();\r
+  JPanel jPanel3 = new JPanel();\r
+  FlowLayout flowLayout1 = new FlowLayout();\r
+\r
+}\r
diff --git a/src/jalview/gui/DasSourceBrowser.java b/src/jalview/gui/DasSourceBrowser.java
new file mode 100755 (executable)
index 0000000..fc2b387
--- /dev/null
@@ -0,0 +1,810 @@
+/*\r
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2006 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
+ */\r
+package jalview.gui;\r
+\r
+import jalview.jbgui.*;\r
+import javax.swing.table.AbstractTableModel;\r
+import javax.swing.event.*;\r
+import jalview.util.TableSorter;\r
+import java.awt.event.*;\r
+import javax.swing.*;\r
+import java.util.*;\r
+\r
+\r
+import org.biojava.dasobert.dasregistry.DasCoordinateSystem;\r
+import org.biojava.dasobert.dasregistry.DasSource;\r
+import org.biojava.dasobert.dasregistry.Das1Source;\r
+import java.awt.BorderLayout;\r
+\r
+public class DasSourceBrowser extends GDasSourceBrowser\r
+    implements Runnable, ListSelectionListener\r
+{\r
+  static DasSource[] dasSources = null;\r
+\r
+  Hashtable localSources = null;\r
+\r
+  Vector selectedSources;\r
+\r
+  String DEFAULT_REGISTRY = "http://das.sanger.ac.uk/registry/das1/sources/";\r
+\r
+  boolean loadingDasSources = false;\r
+\r
+\r
+  public DasSourceBrowser()\r
+  {\r
+    registryURL.setText(jalview.bin.Cache.getDefault("DAS_REGISTRY_URL",\r
+        DEFAULT_REGISTRY) );\r
+\r
+    setSelectedFromProperties();\r
+\r
+    displayFullDetails(null);\r
+    table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);\r
+\r
+    filter1.addListSelectionListener(this);\r
+    filter2.addListSelectionListener(this);\r
+    filter3.addListSelectionListener(this);\r
+\r
+    //Ask to be notified of selection changes.\r
+    ListSelectionModel rowSM = table.getSelectionModel();\r
+    rowSM.addListSelectionListener(new ListSelectionListener()\r
+    {\r
+      public void valueChanged(ListSelectionEvent e)\r
+      {\r
+        ListSelectionModel lsm = (ListSelectionModel) e.getSource();\r
+        if (!lsm.isSelectionEmpty())\r
+        {\r
+          int selectedRow = lsm.getMinSelectionIndex();\r
+          displayFullDetails(table.getValueAt(selectedRow, 0).toString());\r
+        }\r
+      }\r
+    });\r
+\r
+    table.addMouseListener(new MouseAdapter()\r
+        {\r
+          public void mouseClicked(MouseEvent evt)\r
+          {\r
+            if(evt.getClickCount()==2\r
+               || SwingUtilities.isRightMouseButton(evt))\r
+              editRemoveLocalSource(evt);\r
+          }\r
+        });\r
+\r
+    if(dasSources!=null)\r
+    {\r
+       init();\r
+    }\r
+  }\r
+\r
+  public void paintComponent(java.awt.Graphics g)\r
+  {\r
+    if (dasSources == null && !loadingDasSources)\r
+    {\r
+      Thread worker = new Thread(this);\r
+      worker.start();\r
+    }\r
+  }\r
+\r
+  void init()\r
+  {\r
+    int dSize = dasSources.length;\r
+    Object[][] data = new Object[dSize][2];\r
+    for (int i = 0; i < dSize; i++)\r
+    {\r
+      data[i][0] = dasSources[i].getNickname();\r
+      data[i][1] = new Boolean(selectedSources.contains(dasSources[i].\r
+          getNickname()));\r
+    }\r
+\r
+    refreshTableData(data);\r
+    setCapabilities(dasSources);\r
+\r
+    javax.swing.SwingUtilities.invokeLater(new Runnable()\r
+        {\r
+          public void run()\r
+          {\r
+            TableSorter sorter = (TableSorter)table.getModel();\r
+            sorter.setSortingStatus(1, TableSorter.DESCENDING);\r
+            sorter.setSortingStatus(1, TableSorter.NOT_SORTED);\r
+          }\r
+        });\r
+\r
+    progressBar.setIndeterminate(false);\r
+    progressBar.setVisible(false);\r
+    addLocal.setVisible(true);\r
+    refresh.setVisible(true);\r
+  }\r
+\r
+\r
+  public void refreshTableData(Object[][] data)\r
+  {\r
+    TableSorter sorter = new TableSorter(new DASTableModel(data));\r
+    sorter.setTableHeader(table.getTableHeader());\r
+    table.setModel(sorter);\r
+  }\r
+\r
+  void displayFullDetails(String nickName)\r
+  {\r
+\r
+    StringBuffer text = new StringBuffer(\r
+        "<HTML><font size=\"2\" face=\"Verdana, Arial, Helvetica, sans-serif\">");\r
+\r
+    if (nickName == null)\r
+    {\r
+      fullDetails.setText(text +\r
+                          "Select a DAS service from the table"\r
+                          + " to read a full description here.</font></html>");\r
+      return;\r
+    }\r
+\r
+    int dSize = dasSources.length;\r
+    for (int i = 0; i < dSize; i++)\r
+    {\r
+      if (!dasSources[i].getNickname().equals(nickName))\r
+        continue;\r
+\r
+      DasSource ds = dasSources[i];\r
+\r
+      text.append("<font color=\"#0000FF\">Id:</font> " + dasSources[i].getId() +\r
+                  "<br>");\r
+      text.append("<font color=\"#0000FF\">Nickname:</font> " +\r
+                  dasSources[i].getNickname() + "<br>");\r
+      text.append("<font color=\"#0000FF\">URL:</font> " + dasSources[i].getUrl() +\r
+                  "<br>");\r
+\r
+      text.append("<font color=\"#0000FF\">Admin Email:</font> <a href=\"mailto:"\r
+                  +dasSources[i].getAdminemail()\r
+                  +"\">"+dasSources[i].getAdminemail()+"</a>" +\r
+                  "<br>");\r
+\r
+\r
+      text.append("<font color=\"#0000FF\">Registered at:</font> " + dasSources[i].getRegisterDate() +\r
+                        "<br>");\r
+\r
+      text.append("<font color=\"#0000FF\">Last successful test:</font> " + dasSources[i].getLeaseDate() +\r
+                        "<br>");\r
+\r
+      text.append("<font color=\"#0000FF\">Labels:</font> ");\r
+      for(int s=0; s<dasSources[i].getLabels().length; s++)\r
+      {\r
+        text.append( dasSources[i].getLabels()[s]);\r
+        if(s<dasSources[i].getLabels().length-1)\r
+          text.append(",");\r
+        text.append(" ");\r
+      }\r
+      text.append("<br>");\r
+\r
+\r
+\r
+      text.append("<font color=\"#0000FF\">Capabilities:</font> ");\r
+      String[] scap = dasSources[i].getCapabilities();\r
+      for (int j = 0; j < scap.length; j++)\r
+      {\r
+        text.append(scap[j]);\r
+        if (j < scap.length - 1)\r
+          text.append(", ");\r
+      }\r
+      text.append("<br>");\r
+\r
+      text.append("<font color=\"#0000FF\">Coordinates:</font> ");\r
+      DasCoordinateSystem[] dcs = ds.getCoordinateSystem();\r
+      for (int j = 0; j < dcs.length; j++)\r
+      {\r
+        text.append("(" + dcs[j].getUniqueId() + ") "\r
+                    + dcs[j].getCategory() + ", " + dcs[j].getName());\r
+        if (dcs[j].getNCBITaxId() != 0)\r
+          text.append(", " + dcs[j].getNCBITaxId());\r
+        if (dcs[j].getOrganismName().length() > 0)\r
+          text.append(", " + dcs[j].getOrganismName());\r
+\r
+        text.append("<br>");\r
+      }\r
+\r
+      text.append("<font color=\"#0000FF\">Description:</font> " +\r
+                  dasSources[i].getDescription() + "<br>");\r
+\r
+\r
+      if (dasSources[i].getHelperurl()!=null\r
+          && dasSources[i].getHelperurl().length() > 0)\r
+      {\r
+        text.append("<font color=\"#0000FF\"><a href=\"" +\r
+                    dasSources[i].getHelperurl()\r
+                    + "\">Go to site</a></font<br>");\r
+      }\r
+\r
+      text.append("</font></html>");\r
+\r
+      break;\r
+    }\r
+\r
+    fullDetails.setText(text.toString());\r
+    javax.swing.SwingUtilities.invokeLater(new Runnable()\r
+    {\r
+      public void run()\r
+      {\r
+        fullDetailsScrollpane.getVerticalScrollBar().setValue(0);\r
+      }\r
+    });\r
+  }\r
+\r
+\r
+  public void run()\r
+  {\r
+    loadingDasSources = true;\r
+\r
+    addLocal.setVisible(false);\r
+    refresh.setVisible(false);\r
+    progressBar.setVisible(true);\r
+    progressBar.setIndeterminate(true);\r
+\r
+    dasSources = jalview.io.DasSequenceFeatureFetcher.getDASSources();\r
+\r
+    appendLocalSources();\r
+\r
+    init();\r
+\r
+    loadingDasSources = false;\r
+\r
+  }\r
+\r
+  public Vector getSelectedSources()\r
+  {\r
+    Vector selected = new Vector();\r
+    for (int r = 0; r < selectedSources.size(); r++)\r
+    {\r
+        for (int i = 0; i < dasSources.length; i++)\r
+        {\r
+          if (dasSources[i].getNickname().equals(\r
+              selectedSources.elementAt(r)))\r
+          {\r
+            selected.addElement(dasSources[i]);\r
+            break;\r
+          }\r
+        }\r
+    }\r
+\r
+    return selected;\r
+  }\r
+\r
+  public DasSource[] getDASSource()\r
+  {\r
+    if(dasSources==null)\r
+    {\r
+     dasSources = jalview.io.DasSequenceFeatureFetcher.getDASSources();\r
+     appendLocalSources();\r
+    }\r
+\r
+    return dasSources;\r
+  }\r
+\r
+  public void refresh_actionPerformed(ActionEvent e)\r
+  {\r
+    saveProperties(jalview.bin.Cache.applicationProperties);\r
+\r
+    Thread worker = new Thread(this);\r
+    worker.start();\r
+  }\r
+\r
+  private void setCapabilities(DasSource[] sources)\r
+  {\r
+    Vector authority = new Vector();\r
+    Vector type = new Vector();\r
+    Vector label = new Vector();\r
+\r
+    authority.addElement("Any");\r
+    type.addElement("Any");\r
+    label.addElement("Any");\r
+\r
+    for (int i = 0; i < sources.length; i++)\r
+    {\r
+      DasSource ds = sources[i];\r
+\r
+      DasCoordinateSystem[] dcs = ds.getCoordinateSystem();\r
+\r
+      for (int j = 0; j < dcs.length; j++)\r
+      {\r
+        if (!type.contains(dcs[j].getCategory()))\r
+          type.addElement(dcs[j].getCategory());\r
+\r
+        if (!authority.contains(dcs[j].getName()))\r
+          authority.addElement(dcs[j].getName());\r
+      }\r
+\r
+      String[] slabels = ds.getLabels();\r
+      for (int s = 0; s < slabels.length; s++)\r
+      {\r
+        if (!label.contains(slabels[s]))\r
+        {\r
+          label.addElement(slabels[s]);\r
+        }\r
+      }\r
+\r
+    }\r
+\r
+    filter1.setListData(authority);\r
+    filter2.setListData(type);\r
+    filter3.setListData(label);\r
+\r
+    javax.swing.SwingUtilities.invokeLater(new Runnable()\r
+    {\r
+      public void run()\r
+      {\r
+        filter1.setSelectedIndex(0);\r
+        filter2.setSelectedIndex(0);\r
+        filter3.setSelectedIndex(0);\r
+      }\r
+    });\r
+  }\r
+\r
+  public void amendLocal(boolean newSource)\r
+  {\r
+    String url = "http://localhost:8080/", nickname = "";\r
+\r
+    if(!newSource)\r
+    {\r
+      int selectedRow = table.getSelectionModel().getMinSelectionIndex();\r
+      nickname = table.getValueAt(selectedRow, 0).toString();\r
+      url = ((DasSource)localSources.get(nickname)).getUrl();\r
+    }\r
+\r
+    JTextField nametf = new JTextField(nickname, 40);\r
+    JTextField urltf = new JTextField(url, 40);\r
+\r
+    JPanel panel = new JPanel(new BorderLayout());\r
+    JPanel pane12 = new JPanel(new BorderLayout());\r
+    pane12.add(new JLabel("Nickname: "), BorderLayout.CENTER);\r
+    pane12.add(nametf, BorderLayout.EAST);\r
+    panel.add(pane12, BorderLayout.NORTH);\r
+    pane12 = new JPanel(new BorderLayout());\r
+    pane12.add(new JLabel("URL: "), BorderLayout.CENTER);\r
+    pane12.add(urltf, BorderLayout.EAST);\r
+    panel.add(pane12, BorderLayout.SOUTH);\r
+\r
+\r
+    int reply = JOptionPane.showInternalConfirmDialog(Desktop.desktop,\r
+        panel, "Enter Nickname & URL of Local DAS Source",\r
+        JOptionPane.OK_CANCEL_OPTION);\r
+\r
+       if (reply != JOptionPane.OK_OPTION )\r
+       {\r
+           return;\r
+       }\r
+\r
+       if(!urltf.getText().endsWith("/"))\r
+         urltf.setText(urltf.getText()+"/");\r
+\r
+       Das1Source local = new Das1Source();\r
+\r
+       local.setUrl(urltf.getText());\r
+       local.setNickname(nametf.getText());\r
+\r
+\r
+       if(localSources==null)\r
+         localSources = new Hashtable();\r
+\r
+       localSources.put(local.getNickname(), local);\r
+\r
+       if(!newSource && !nickname.equals(nametf.getText()))\r
+       {\r
+         localSources.remove(nickname);\r
+       }\r
+\r
+       int size = dasSources.length;\r
+       int adjust = newSource ? 1 : 0;\r
+\r
+       Object[][] data = new Object[size+adjust][2];\r
+       for (int i = 0; i < size; i++)\r
+       {\r
+         if(!newSource && dasSources[i].getNickname().equals(nickname))\r
+         {\r
+           ((DasSource)dasSources[i]).setNickname(local.getNickname());\r
+           ((DasSource)dasSources[i]).setUrl(local.getUrl());\r
+           data[i][0] = local.getNickname();\r
+           data[i][1] = new Boolean(true);\r
+         }\r
+         else\r
+         {\r
+           data[i][0] = dasSources[i].getNickname();\r
+           data[i][1] = new Boolean(selectedSources.contains(dasSources[i].\r
+               getNickname()));\r
+         }\r
+       }\r
+\r
+       if(newSource)\r
+       {\r
+         data[size][0] = local.getNickname();\r
+         data[size][1] = new Boolean(true);\r
+         selectedSources.add(local.getNickname());\r
+       }\r
+\r
+       DasSource [] tmp = new DasSource[size+adjust];\r
+\r
+       System.arraycopy(dasSources, 0, tmp, 0, size);\r
+\r
+       if(newSource)\r
+         tmp[size] = local;\r
+\r
+       dasSources = tmp;\r
+\r
+       refreshTableData(data);\r
+\r
+       SwingUtilities.invokeLater(new Runnable()\r
+       {\r
+         public void run()\r
+         {\r
+           scrollPane.getVerticalScrollBar().setValue(\r
+               scrollPane.getVerticalScrollBar().getMaximum()\r
+               );\r
+         }\r
+       });\r
+\r
+       displayFullDetails(local.getNickname());\r
+     }\r
+\r
+    public void editRemoveLocalSource(MouseEvent evt)\r
+    {\r
+      int selectedRow = table.getSelectionModel().getMinSelectionIndex();\r
+      if(selectedRow==-1)\r
+        return;\r
+\r
+      String nickname = table.getValueAt(selectedRow, 0).toString();\r
+\r
+      if (!localSources.containsKey(nickname))\r
+      {\r
+        JOptionPane.showInternalMessageDialog(Desktop.desktop,\r
+        "You can only edit or remove local DAS Sources!",\r
+         "Public DAS source - not editable",\r
+         JOptionPane.WARNING_MESSAGE);\r
+        return;\r
+      }\r
+\r
+\r
+      Object[] options = {"Edit", "Remove", "Cancel"};\r
+      int choice = JOptionPane.showInternalOptionDialog(Desktop.desktop,\r
+    "Do you want to edit or remove "+nickname+"?",\r
+    "Edit / Remove Local DAS Source",\r
+    JOptionPane.YES_NO_CANCEL_OPTION,\r
+    JOptionPane.QUESTION_MESSAGE,\r
+    null,\r
+    options,\r
+    options[2]);\r
+\r
+      switch(choice)\r
+      {\r
+        case 0: amendLocal(false);   break;\r
+        case 1:\r
+          localSources.remove(nickname);\r
+          selectedSources.remove(nickname);\r
+          Object[][] data = new Object[dasSources.length-1][2];\r
+          DasSource [] tmp = new DasSource[dasSources.length-1];\r
+          int index = 0;\r
+          for (int i = 0; i < dasSources.length; i++)\r
+          {\r
+            if (dasSources[i].getNickname().equals(nickname))\r
+            {\r
+              continue;\r
+            }\r
+            else\r
+            {\r
+              tmp[index] = dasSources[i];\r
+              data[index][0] = dasSources[i].getNickname();\r
+              data[index][1] = new Boolean(selectedSources.contains(dasSources[i].\r
+                  getNickname()));\r
+              index++;\r
+            }\r
+          }\r
+           dasSources = tmp;\r
+           refreshTableData(data);\r
+           SwingUtilities.invokeLater(new Runnable()\r
+           {\r
+             public void run()\r
+             {\r
+               scrollPane.getVerticalScrollBar().setValue(\r
+                   scrollPane.getVerticalScrollBar().getMaximum()\r
+                   );\r
+             }\r
+           });\r
+\r
+          break;\r
+      }\r
+    }\r
+\r
+    void appendLocalSources()\r
+    {\r
+      if(localSources==null)\r
+        return;\r
+\r
+      int size = dasSources!=null ? dasSources.length : 0;\r
+      int lsize = localSources.size();\r
+\r
+      Object[][] data = new Object[size+lsize][2];\r
+      for (int i = 0; i < size; i++)\r
+      {\r
+        data[i][0] = dasSources[i].getNickname();\r
+        data[i][1] = new Boolean(selectedSources.contains(dasSources[i].\r
+            getNickname()));\r
+      }\r
+\r
+      DasSource [] tmp = new DasSource[size+lsize];\r
+      if(dasSources!=null)\r
+        System.arraycopy(dasSources, 0, tmp, 0, size);\r
+\r
+      Enumeration en = localSources.keys();\r
+      int index = size;\r
+      while(en.hasMoreElements())\r
+      {\r
+        String key = en.nextElement().toString();\r
+        data[index][0] = key;\r
+        data[index][1] = new Boolean(false);\r
+        tmp[index] = new Das1Source();\r
+        tmp[index].setNickname(key);\r
+        tmp[index].setUrl( ((DasSource)localSources.get(key)).getUrl() );\r
+\r
+        index++;\r
+      }\r
+\r
+      dasSources = tmp;\r
+\r
+      refreshTableData(data);\r
+  }\r
+\r
+  public void valueChanged(ListSelectionEvent evt)\r
+  {\r
+    //Called when the MainTable selection changes\r
+    if (evt.getValueIsAdjusting() )\r
+    {\r
+      return;\r
+    }\r
+\r
+\r
+    displayFullDetails(null);\r
+\r
+    // Filter the displayed data sources\r
+    int dSize = dasSources.length;\r
+\r
+\r
+    ArrayList names = new ArrayList();\r
+    ArrayList selected = new ArrayList();\r
+    DasSource ds;\r
+\r
+    //The features filter is not visible, but we must still\r
+    //filter the das source list here.\r
+    //July 2006 - only 6 sources fo not serve features\r
+    Object [] dummyFeatureList = new Object[]{"features"};\r
+\r
+    for (int i = 0; i < dSize; i++)\r
+    {\r
+      ds = dasSources[i];\r
+      DasCoordinateSystem[] dcs = ds.getCoordinateSystem();\r
+\r
+      if (dcs.length == 0 && ds.getCapabilities().length == 0\r
+          && filter1.getSelectedIndex() == 0\r
+          && filter2.getSelectedIndex() == 0\r
+          && filter3.getSelectedIndex() == 0)\r
+      {\r
+        //THIS IS A FIX FOR LOCAL SOURCES WHICH DO NOT\r
+        //HAVE COORDINATE SYSTEMS, INFO WHICH AT PRESENT\r
+        //IS ADDED FROM THE REGISTRY\r
+        names.add(ds.getNickname());\r
+        selected.add(new Boolean(\r
+              selectedSources.contains(ds.getNickname())));\r
+        continue;\r
+      }\r
+\r
+\r
+      if (!selectedInList(dummyFeatureList, ds.getCapabilities())\r
+      ||  !selectedInList(filter3.getSelectedValues(),\r
+                          ds.getLabels()))\r
+      {\r
+        continue;\r
+      }\r
+\r
+      for (int j = 0; j < dcs.length; j++)\r
+      {\r
+        if (   selectedInList(filter1.getSelectedValues(),\r
+                           new String[]\r
+                           {dcs[j].getName()})\r
+            && selectedInList(filter2.getSelectedValues(),\r
+                              new String[]\r
+                              {dcs[j].getCategory()}))\r
+        {\r
+          names.add(ds.getNickname());\r
+          selected.add(new Boolean(\r
+              selectedSources.contains(ds.getNickname())));\r
+          break;\r
+        }\r
+      }\r
+    }\r
+\r
+    dSize = names.size();\r
+    Object[][] data = new Object[dSize][2];\r
+    for (int d = 0; d < dSize; d++)\r
+    {\r
+      data[d][0] = names.get(d);\r
+      data[d][1] = selected.get(d);\r
+    }\r
+\r
+    refreshTableData(data);\r
+  }\r
+\r
+  boolean selectedInList(Object [] selection, String[] items)\r
+  {\r
+    for (int i = 0; i < selection.length; i++)\r
+    {\r
+      if (selection[i].equals("Any") )\r
+        return true;\r
+\r
+      for (int j = 0; j < items.length; j++)\r
+      {\r
+        if (selection[i].equals(items[j]))\r
+          return true;\r
+      }\r
+    }\r
+\r
+    return false;\r
+  }\r
+\r
+  void setSelectedFromProperties()\r
+  {\r
+     String active = jalview.bin.Cache.getDefault("DAS_ACTIVE_SOURCE", "uniprot");\r
+     StringTokenizer st = new StringTokenizer(active, "\t");\r
+     selectedSources = new Vector();\r
+     while(st.hasMoreTokens())\r
+     {\r
+       selectedSources.addElement(st.nextToken());\r
+     }\r
+\r
+     String local = jalview.bin.Cache.getProperty("DAS_LOCAL_SOURCE");\r
+     if(local!=null)\r
+     {\r
+       if(localSources == null)\r
+         localSources = new Hashtable();\r
+\r
+       st = new StringTokenizer(local, "\t");\r
+       while(st.hasMoreTokens())\r
+       {\r
+         String token = st.nextToken();\r
+         int bar = token.indexOf("|");\r
+         Das1Source source = new Das1Source();\r
+\r
+         source.setUrl(token.substring(bar + 1));\r
+         source.setNickname(token.substring(0, bar));\r
+\r
+         localSources.put(source.getNickname(), source);\r
+       }\r
+     }\r
+  }\r
+\r
+  public void reset_actionPerformed(ActionEvent e)\r
+  {\r
+    registryURL.setText(DEFAULT_REGISTRY);\r
+  }\r
+\r
+  public void saveProperties(Properties properties)\r
+  {\r
+    if (registryURL.getText() == null || registryURL.getText().length() < 1)\r
+      properties.remove("DAS_REGISTRY_URL");\r
+    else\r
+      properties.setProperty("DAS_REGISTRY_URL", registryURL.getText());\r
+\r
+    StringBuffer sb = new StringBuffer();\r
+    for(int r=0; r<table.getModel().getRowCount(); r++)\r
+    {\r
+      if( ((Boolean)table.getValueAt(r,1)).booleanValue())\r
+      {\r
+        sb.append(table.getValueAt(r,0)+"\t");\r
+      }\r
+    }\r
+\r
+    properties.setProperty("DAS_ACTIVE_SOURCE", sb.toString() );\r
+\r
+    if(localSources!=null)\r
+    {\r
+      sb = new StringBuffer();\r
+      Enumeration en = localSources.keys();\r
+      while(en.hasMoreElements())\r
+      {\r
+        String token = en.nextElement().toString();\r
+        sb.append(token+"|"\r
+                  + ((DasSource)localSources.get(token)).getUrl()\r
+                  +"\t");\r
+      }\r
+\r
+      properties.setProperty("DAS_LOCAL_SOURCE", sb.toString());\r
+    }\r
+\r
+  }\r
+\r
+  class DASTableModel\r
+      extends AbstractTableModel\r
+  {\r
+\r
+    public DASTableModel(Object[][] data)\r
+    {\r
+      this.data = data;\r
+    }\r
+\r
+    private String[] columnNames = new String[]  {"Nickname", "Use Source"};\r
+\r
+    private Object[][] data;\r
+\r
+    public int getColumnCount()\r
+    {\r
+      return columnNames.length;\r
+    }\r
+\r
+    public int getRowCount()\r
+    {\r
+      return data.length;\r
+    }\r
+\r
+    public String getColumnName(int col)\r
+    {\r
+      return columnNames[col];\r
+    }\r
+\r
+    public Object getValueAt(int row, int col)\r
+    {\r
+      return data[row][col];\r
+    }\r
+\r
+    /*\r
+     * JTable uses this method to determine the default renderer/\r
+     * editor for each cell.  If we didn't implement this method,\r
+     * then the last column would contain text ("true"/"false"),\r
+     * rather than a check box.\r
+     */\r
+    public Class getColumnClass(int c)\r
+    {\r
+      return getValueAt(0, c).getClass();\r
+    }\r
+\r
+    /*\r
+     * Don't need to implement this method unless your table's\r
+     * editable.\r
+     */\r
+    public boolean isCellEditable(int row, int col)\r
+    {\r
+      //Note that the data/cell address is constant,\r
+      //no matter where the cell appears onscreen.\r
+      return col == 1;\r
+\r
+    }\r
+\r
+    /*\r
+     * Don't need to implement this method unless your table's\r
+     * data can change.\r
+     */\r
+    public void setValueAt(Object value, int row, int col)\r
+    {\r
+      data[row][col] = value;\r
+      fireTableCellUpdated(row, col);\r
+\r
+      String name = getValueAt(row,0).toString();\r
+      boolean selected = ((Boolean)value).booleanValue();\r
+\r
+      if(selectedSources.contains(name) && !selected)\r
+        selectedSources.remove(name);\r
+\r
+      if(!selectedSources.contains(name) && selected)\r
+        selectedSources.add(name);\r
+    }\r
+  }\r
+}\r
+\r
+\r
diff --git a/src/jalview/gui/Jalview2XML_V1.java b/src/jalview/gui/Jalview2XML_V1.java
new file mode 100755 (executable)
index 0000000..8bce1e8
--- /dev/null
@@ -0,0 +1,485 @@
+/*\r
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2006 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
+ */\r
+package jalview.gui;\r
+\r
+import jalview.schemes.*;\r
+\r
+import jalview.gui.*;\r
+\r
+import java.io.*;\r
+\r
+import java.net.*;\r
+\r
+import java.util.*;\r
+\r
+import java.util.jar.*;\r
+\r
+import javax.swing.*;\r
+\r
+import org.exolab.castor.xml.*;\r
+\r
+import jalview.binding.*;\r
+\r
+\r
+\r
+\r
+/**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
+public class Jalview2XML_V1\r
+{\r
+   jalview.schemes.UserColourScheme GetUserColourScheme(\r
+        JalviewModelSequence jms, String id)\r
+    {\r
+        UserColours[] uc = jms.getUserColours();\r
+        UserColours colours = null;\r
+\r
+        for (int i = 0; i < uc.length; i++)\r
+        {\r
+            if (uc[i].getId().equals(id))\r
+            {\r
+                colours = uc[i];\r
+\r
+                break;\r
+            }\r
+        }\r
+\r
+        int csize = colours.getUserColourScheme().getColourCount();\r
+        java.awt.Color[] newColours = new java.awt.Color[csize];\r
+\r
+        for (int i = 0; i < csize; i++)\r
+        {\r
+            newColours[i] = new java.awt.Color(Integer.parseInt(\r
+                        colours.getUserColourScheme().getColour(i).getRGB(), 16));\r
+        }\r
+\r
+        return new jalview.schemes.UserColourScheme(newColours);\r
+    }\r
+\r
+    /**\r
+     * DOCUMENT ME!\r
+     *\r
+     * @param file DOCUMENT ME!\r
+     */\r
+    public AlignFrame LoadJalviewAlign(String file)\r
+    {\r
+\r
+        jalview.gui.AlignFrame af = null;\r
+\r
+        try\r
+        {\r
+            //UNMARSHALLER SEEMS TO CLOSE JARINPUTSTREAM, MOST ANNOYING\r
+            URL url = null;\r
+\r
+            if (file.startsWith("http://"))\r
+            {\r
+                url = new URL(file);\r
+            }\r
+\r
+            JarInputStream jin = null;\r
+            JarEntry jarentry = null;\r
+            int entryCount = 1;\r
+\r
+            do\r
+            {\r
+                if (url != null)\r
+                {\r
+                    jin = new JarInputStream(url.openStream());\r
+                }\r
+                else\r
+                {\r
+                    jin = new JarInputStream(new FileInputStream(file));\r
+                }\r
+\r
+                for (int i = 0; i < entryCount; i++)\r
+                {\r
+                    jarentry = jin.getNextJarEntry();\r
+                  }\r
+\r
+                  class NoDescIDResolver implements IDResolver\r
+                  {\r
+                    public Object resolve(String idref)\r
+                    {\r
+                      System.out.println(idref+" used");\r
+                      return null;\r
+                    }\r
+                  }\r
+\r
+\r
+                if (jarentry != null)\r
+                {\r
+                    InputStreamReader in = new InputStreamReader(jin, "UTF-8");\r
+                    JalviewModel object = new JalviewModel();\r
+\r
+                    object = (JalviewModel) object.unmarshal(in);\r
+\r
+                    af = LoadFromObject(object);\r
+                    entryCount++;\r
+                }\r
+            }\r
+            while (jarentry != null);\r
+        }\r
+        catch(java.net.UnknownHostException ex)\r
+        {\r
+          ex.printStackTrace();\r
+          System.err.println("Couldn't locate Jalview XML file : " +\r
+              ex + "\n");\r
+           JOptionPane.showInternalMessageDialog(Desktop.desktop,\r
+                                    "Couldn't locate " + file,\r
+                                    "URL not found",\r
+                                    JOptionPane.WARNING_MESSAGE);\r
+\r
+        }\r
+        catch (Exception ex)\r
+        {\r
+          ex.printStackTrace();\r
+            System.err.println("Exception whilst loading jalview XML file : " +\r
+                ex + "\n");\r
+             JOptionPane.showInternalMessageDialog(Desktop.desktop,\r
+                                      "Error loading  " + file,\r
+                                      "Error loading Jalview file",\r
+                                      JOptionPane.WARNING_MESSAGE);\r
+\r
+        }\r
+\r
+        return af;\r
+    }\r
+\r
+    AlignFrame LoadFromObject(JalviewModel object)\r
+    {\r
+        Vector seqids = new Vector();\r
+        SequenceSet vamsasSet = object.getVamsasModel().getSequenceSet(0);\r
+        Sequence[] vamsasSeq = vamsasSet.getSequence();\r
+\r
+        JalviewModelSequence jms = object.getJalviewModelSequence();\r
+\r
+        //////////////////////////////////\r
+        //LOAD SEQUENCES\r
+        jalview.datamodel.Sequence[] jseqs = new jalview.datamodel.Sequence[vamsasSeq.length];\r
+        JSeq[] JSEQ = object.getJalviewModelSequence().getJSeq();\r
+        for (int i = 0; i < vamsasSeq.length; i++)\r
+        {\r
+            jseqs[i] = new jalview.datamodel.Sequence(vamsasSeq[i].getName(),\r
+                    vamsasSeq[i].getSequence());\r
+            jseqs[i].setStart(JSEQ[i].getStart());\r
+            jseqs[i].setEnd(JSEQ[i].getEnd());\r
+            jseqs[i].setColor(new java.awt.Color(JSEQ[i].getColour()));\r
+            seqids.add(jseqs[i]);\r
+        }\r
+\r
+        ///SequenceFeatures are added to the DatasetSequence,\r
+        // so we must create the dataset before loading features\r
+        /////////////////////////////////\r
+        jalview.datamodel.Alignment al = new jalview.datamodel.Alignment(jseqs);\r
+        al.setDataset(null);\r
+        /////////////////////////////////\r
+\r
+        for (int i = 0; i < vamsasSeq.length; i++)\r
+        {\r
+          if (JSEQ[i].getFeaturesCount() > 0)\r
+          {\r
+            Features[] features = JSEQ[i].getFeatures();\r
+            for (int f = 0; f < features.length; f++)\r
+            {\r
+              jalview.datamodel.SequenceFeature sf\r
+                  = new jalview.datamodel.SequenceFeature(features[f].getType(),\r
+                  features[f].getDescription(), features[f].getStatus(),\r
+                  features[f].getBegin(), features[f].getEnd(),\r
+                  null);\r
+\r
+              al.getSequenceAt(i).getDatasetSequence().addSequenceFeature(sf);\r
+            }\r
+          }\r
+          if (JSEQ[i].getPdbidsCount() > 0)\r
+          {\r
+            Pdbids[] ids = JSEQ[i].getPdbids();\r
+            for (int p = 0; p < ids.length; p++)\r
+            {\r
+              jalview.datamodel.PDBEntry entry = new jalview.datamodel.PDBEntry();\r
+              entry.setId(ids[p].getId());\r
+              entry.setType(ids[p].getType());\r
+              al.getSequenceAt(i).getDatasetSequence().addPDBId(entry);\r
+            }\r
+\r
+          }\r
+        }\r
+\r
+         /////////////////////////////////\r
+        //////////////////////////////////\r
+        //LOAD ANNOTATIONS\r
+        if (vamsasSet.getAnnotation() != null)\r
+        {\r
+            Annotation[] an = vamsasSet.getAnnotation();\r
+\r
+            for (int i = 0; i < an.length; i++)\r
+            {\r
+                AnnotationElement[] ae = an[i].getAnnotationElement();\r
+                jalview.datamodel.Annotation[] anot = new jalview.datamodel.Annotation[al.getWidth()];\r
+\r
+                for (int aa = 0; aa < ae.length; aa++)\r
+                {\r
+                    anot[ae[aa].getPosition()] = new jalview.datamodel.Annotation(ae[aa].getDisplayCharacter(),\r
+                            ae[aa].getDescription(),\r
+                            ae[aa].getSecondaryStructure().charAt(0),\r
+                            ae[aa].getValue());\r
+                }\r
+\r
+                jalview.datamodel.AlignmentAnnotation jaa = null;\r
+\r
+                if (an[i].getGraph())\r
+                {\r
+                    jaa = new jalview.datamodel.AlignmentAnnotation(an[i].getLabel(),\r
+                            an[i].getDescription(), anot, 0, 0,\r
+                            jalview.datamodel.AlignmentAnnotation.BAR_GRAPH);\r
+                }\r
+                else\r
+                {\r
+                    jaa = new jalview.datamodel.AlignmentAnnotation(an[i].getLabel(),\r
+                            an[i].getDescription(), anot);\r
+                }\r
+\r
+                al.addAnnotation(jaa);\r
+            }\r
+        }\r
+\r
+\r
+        /////////////////////////////////\r
+        // LOAD VIEWPORT\r
+        Viewport[] views = jms.getViewport();\r
+        Viewport view = views[0]; // DEAL WITH MULTIPLE VIEWPORTS LATER\r
+\r
+        AlignFrame af = new AlignFrame(al);\r
+\r
+\r
+        //  af.changeColour() );\r
+        /////////////////////////\r
+        //LOAD GROUPS\r
+        if (jms.getJGroupCount() > 0)\r
+        {\r
+            JGroup[] groups = jms.getJGroup();\r
+\r
+            for (int i = 0; i < groups.length; i++)\r
+            {\r
+                ColourSchemeI cs = null;\r
+\r
+                if (groups[i].getColour() != null)\r
+                {\r
+                    if (groups[i].getColour().startsWith("ucs"))\r
+                    {\r
+                        cs = GetUserColourScheme(jms, groups[i].getColour());\r
+                    }\r
+                    else\r
+                    {\r
+                        cs = ColourSchemeProperty.getColour(al,\r
+                                groups[i].getColour());\r
+                    }\r
+\r
+                    if(cs!=null)\r
+                      cs.setThreshold(groups[i].getPidThreshold(), true);\r
+\r
+                }\r
+\r
+                Vector seqs = new Vector();\r
+                int[] ids = groups[i].getSeq();\r
+\r
+                for (int s = 0; s < ids.length; s++)\r
+                {\r
+                    seqs.addElement((jalview.datamodel.SequenceI) seqids.elementAt(\r
+                            ids[s]));\r
+                }\r
+\r
+                jalview.datamodel.SequenceGroup sg = new jalview.datamodel.SequenceGroup(seqs,\r
+                        groups[i].getName(), cs, groups[i].getDisplayBoxes(),\r
+                        groups[i].getDisplayText(), groups[i].getColourText(),\r
+                        groups[i].getStart(), groups[i].getEnd());\r
+\r
+                sg.setOutlineColour(new java.awt.Color(\r
+                        groups[i].getOutlineColour()));\r
+\r
+                if (groups[i].getConsThreshold() != 0)\r
+                {\r
+                    jalview.analysis.Conservation c = new jalview.analysis.Conservation("All",\r
+                            ResidueProperties.propHash, 3, sg.getSequences(false), 0,\r
+                            sg.getWidth() - 1);\r
+                    c.calculate();\r
+                    c.verdict(false, 25);\r
+                    sg.cs.setConservation(c);\r
+                }\r
+\r
+                al.addGroup(sg);\r
+            }\r
+        }\r
+\r
+\r
+\r
+        af.setBounds(view.getXpos(), view.getYpos(), view.getWidth(),\r
+            view.getHeight());\r
+        af.viewport.setStartRes(view.getStartRes());\r
+        af.viewport.setStartSeq(view.getStartSeq());\r
+        af.viewport.setShowAnnotation(view.getShowAnnotation());\r
+        af.viewport.showConservation = view.getShowConservation();\r
+        af.viewport.showQuality = view.getShowQuality();\r
+        af.viewport.showIdentity = view.getShowIdentity();\r
+        af.viewport.setAbovePIDThreshold(view.getPidSelected());\r
+        af.abovePIDThreshold.setSelected(view.getPidSelected());\r
+        af.viewport.setColourText(view.getShowColourText());\r
+        af.colourTextMenuItem.setSelected(view.getShowColourText());\r
+        af.viewport.setConservationSelected(view.getConservationSelected());\r
+        af.conservationMenuItem.setSelected(view.getConservationSelected());\r
+\r
+        af.viewport.setShowJVSuffix(view.getShowFullId());\r
+        af.seqLimits.setSelected(view.getShowFullId());\r
+\r
+        af.viewport.setFont(new java.awt.Font(view.getFontName(),\r
+                view.getFontStyle(), view.getFontSize()));\r
+        af.alignPanel.fontChanged();\r
+\r
+        af.viewport.setRenderGaps(view.getRenderGaps());\r
+        af.renderGapsMenuItem.setSelected(view.getRenderGaps());\r
+\r
+        af.viewport.setWrapAlignment(view.getWrapAlignment());\r
+        af.wrapMenuItem.setSelected(view.getWrapAlignment());\r
+\r
+\r
+        af.alignPanel.setWrapAlignment(view.getWrapAlignment());\r
+\r
+        af.annotationPanelMenuItem.setState(view.getShowAnnotation());\r
+        af.viewport.setShowAnnotation(view.getShowAnnotation());\r
+        af.alignPanel.setAnnotationVisible(view.getShowAnnotation());\r
+\r
+\r
+        af.viewport.setShowBoxes(view.getShowBoxes());\r
+        af.viewBoxesMenuItem.setSelected(view.getShowBoxes());\r
+        af.viewport.setShowText(view.getShowText());\r
+        af.viewTextMenuItem.setSelected(view.getShowText());\r
+\r
+        ColourSchemeI cs = null;\r
+\r
+        if (view.getBgColour() != null)\r
+        {\r
+            if (view.getBgColour().startsWith("ucs"))\r
+            {\r
+                cs = GetUserColourScheme(jms, view.getBgColour());\r
+            }\r
+            else\r
+            {\r
+                cs = ColourSchemeProperty.getColour(al, view.getBgColour());\r
+            }\r
+\r
+            if(cs!=null)\r
+            {\r
+              cs.setThreshold(view.getPidThreshold(), true);\r
+              cs.setConsensus(af.viewport.vconsensus);\r
+            }\r
+        }\r
+\r
+        af.setColourSelected(view.getBgColour());\r
+        af.viewport.setGlobalColourScheme(cs);\r
+        af.viewport.setColourAppliesToAllGroups(false);\r
+        af.changeColour(cs);\r
+        if (view.getConservationSelected() && cs!=null)\r
+        {\r
+          cs.setConservationInc(view.getConsThreshold());\r
+        }\r
+\r
+        af.viewport.setColourAppliesToAllGroups(true);\r
+\r
+        if (view.getShowSequenceFeatures())\r
+        {\r
+           af.viewport.showSequenceFeatures = true;\r
+           af.showSeqFeatures.setSelected(true);\r
+        }\r
+\r
+        if(jms.getFeatureSettings()!=null)\r
+        {\r
+          af.viewport.featuresDisplayed = new Hashtable();\r
+          String [] renderOrder = new String[jms.getFeatureSettings().getSettingCount()];\r
+         for(int fs=0; fs<jms.getFeatureSettings().getSettingCount(); fs++)\r
+         {\r
+           Setting setting = jms.getFeatureSettings().getSetting(fs);\r
+\r
+           af.alignPanel.seqPanel.seqCanvas.getFeatureRenderer().setColour(setting.getType(),\r
+               new java.awt.Color(setting.getColour()));\r
+\r
+           renderOrder[fs] = setting.getType();\r
+\r
+           if(setting.getDisplay())\r
+             af.viewport.featuresDisplayed.put(\r
+                 setting.getType(), new Integer(setting.getColour()));\r
+         }\r
+         af.alignPanel.seqPanel.seqCanvas.getFeatureRenderer().renderOrder = renderOrder;\r
+        }\r
+\r
+\r
+        Desktop.addInternalFrame(af, view.getTitle(),\r
+             view.getWidth(), view.getHeight());\r
+\r
+        //LOAD TREES\r
+        ///////////////////////////////////////\r
+        if (jms.getTreeCount() > 0)\r
+        {\r
+            try\r
+            {\r
+                for (int t = 0; t < jms.getTreeCount(); t++)\r
+                {\r
+\r
+                    Tree tree = jms.getTree(t);\r
+\r
+                    TreePanel tp = af.ShowNewickTree(new jalview.io.NewickFile(\r
+                                tree.getNewick()), tree.getTitle(),\r
+                                tree.getWidth(), tree.getHeight(),\r
+                                tree.getXpos(), tree.getYpos());\r
+\r
+                    tp.fitToWindow.setState(tree.getFitToWindow());\r
+                    tp.fitToWindow_actionPerformed(null);\r
+\r
+                    if(tree.getFontName()!=null)\r
+                      tp.setTreeFont(new java.awt.Font(tree.getFontName(),\r
+                                          tree.getFontStyle(),\r
+                                          tree.getFontSize()));\r
+                    else\r
+                      tp.setTreeFont(new java.awt.Font(view.getFontName(),\r
+                                            view.getFontStyle(),\r
+                                            tree.getFontSize()));\r
+\r
+                    tp.showPlaceholders(tree.getMarkUnlinked());\r
+                    tp.showBootstrap(tree.getShowBootstrap());\r
+                    tp.showDistances(tree.getShowDistances());\r
+\r
+                    tp.treeCanvas.threshold = tree.getThreshold();\r
+\r
+                    if (tree.getCurrentTree())\r
+                      af.viewport.setCurrentTree(tp.getTree());\r
+                }\r
+\r
+            }\r
+            catch (Exception ex)\r
+            {\r
+                ex.printStackTrace();\r
+            }\r
+\r
+        }\r
+\r
+        return af;\r
+    }\r
+}\r
+\r
diff --git a/src/jalview/io/AnnotationFile.java b/src/jalview/io/AnnotationFile.java
new file mode 100755 (executable)
index 0000000..08b5862
--- /dev/null
@@ -0,0 +1,423 @@
+/*\r
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2006 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
+ */\r
+\r
+package jalview.io;\r
+\r
+import java.io.*;\r
+import jalview.datamodel.*;\r
+import java.util.*;\r
+import jalview.schemes.UserColourScheme;\r
+import java.net.URL;\r
+\r
+\r
+public class AnnotationFile\r
+{\r
+\r
+  public String printAnnotations(AlignmentAnnotation [] annotations)\r
+  {\r
+    StringBuffer text = new StringBuffer(\r
+      "JALVIEW_ANNOTATION\n"\r
+      +"# Created: "\r
+      +new java.util.Date()+"\n\n");\r
+\r
+    AlignmentAnnotation row;\r
+    String comma;\r
+    String seqref = null;\r
+\r
+    StringBuffer colours = new StringBuffer();\r
+    StringBuffer graphLine = new StringBuffer();\r
+\r
+    Hashtable graphGroup = new Hashtable();\r
+\r
+    java.awt.Color color;\r
+\r
+    for(int i=0; i<annotations.length; i++)\r
+    {\r
+      row = annotations[i];\r
+      color = null;\r
+\r
+      if( row.sequenceRef == null)\r
+        seqref = null;\r
+\r
+      else if (seqref == null\r
+           || !seqref.equals(row.sequenceRef.getName()))\r
+      {\r
+        seqref = row.sequenceRef.getName();\r
+        text.append("\nSEQUENCE_REF\t" + seqref + "\n");\r
+      }\r
+\r
+\r
+      if( row.graph == AlignmentAnnotation.NO_GRAPH)\r
+      {\r
+          text.append("NO_GRAPH\t");\r
+      }\r
+      else\r
+      {\r
+        if( row.graph == AlignmentAnnotation.BAR_GRAPH)\r
+          text.append("BAR_GRAPH\t");\r
+        else if(row.graph == AlignmentAnnotation.LINE_GRAPH)\r
+          text.append("LINE_GRAPH\t");\r
+\r
+        if(row.getThreshold()!=null)\r
+            graphLine.append("GRAPHLINE\t"\r
+                             + row.label + "\t"\r
+                             + row.getThreshold().value + "\t"\r
+                             + row.getThreshold().label + "\t"\r
+                             + jalview.util.Format.getHexString(\r
+                                 row.getThreshold().colour)+"\n"\r
+                );\r
+\r
+          if(row.graphGroup>-1)\r
+          {\r
+            String key = String.valueOf(row.graphGroup);\r
+            if(graphGroup.containsKey(key))\r
+              graphGroup.put(key, graphGroup.get(key)\r
+                             +"\t"+row.label);\r
+            else\r
+              graphGroup.put(key, row.label);\r
+          }\r
+      }\r
+\r
+      text.append(row.label+"\t");\r
+\r
+      for(int j=0; j<row.annotations.length; j++)\r
+      {\r
+        if(row.annotations[j]!=null)\r
+        {\r
+          comma = "";\r
+          if (row.annotations[j].displayCharacter.length() > 0\r
+              && !row.annotations[j].displayCharacter.equals(" "))\r
+          {\r
+            text.append(row.annotations[j].displayCharacter);\r
+            comma = ",";\r
+          }\r
+          if (row.annotations[j].secondaryStructure!=' ')\r
+          {\r
+            text.append(comma + row.annotations[j].secondaryStructure);\r
+            comma = ",";\r
+          }\r
+          if (row.annotations[j].value!=0f)\r
+          {\r
+            color = row.annotations[j].colour;\r
+            text.append(comma + row.annotations[j].value);\r
+          }\r
+        }\r
+        text.append("|");\r
+      }\r
+\r
+      text.append("\n");\r
+\r
+      if(color!=null && color!=java.awt.Color.black)\r
+      {\r
+        colours.append("COLOUR\t"\r
+                       +row.label+"\t"\r
+                       +jalview.util.Format.getHexString(color)+"\n");\r
+      }\r
+\r
+    }\r
+\r
+    text.append("\n");\r
+\r
+    text.append(colours.toString());\r
+    text.append(graphLine.toString());\r
+    if(graphGroup.size()>0)\r
+    {\r
+      text.append("COMBINE\t");\r
+      Enumeration en = graphGroup.elements();\r
+      while(en.hasMoreElements())\r
+      {\r
+        text.append(en.nextElement()+"\n");\r
+      }\r
+    }\r
+\r
+    return text.toString();\r
+  }\r
+\r
+  public boolean readAnnotationFile(AlignmentI al, String file)\r
+  {\r
+    try\r
+    {\r
+      BufferedReader in = null;\r
+      java.io.InputStream is = getClass().getResourceAsStream("/" + file);\r
+      if (is != null)\r
+      {\r
+        in = new BufferedReader(new java.io.InputStreamReader(is));\r
+      }\r
+      else\r
+      {\r
+        try\r
+        {\r
+          URL url = new URL(file);\r
+          in = new BufferedReader(new InputStreamReader(url.openStream()));\r
+        }\r
+        catch (java.net.MalformedURLException ex)\r
+        {\r
+          in = new BufferedReader(new FileReader(file));\r
+        }\r
+      }\r
+\r
+      String line, label, description, token;\r
+      int graphStyle, index;\r
+      SequenceI refSeq = null;\r
+      int refSeqIndex = 1;\r
+      int existingAnnotations = 0;\r
+      if(al.getAlignmentAnnotation()!=null)\r
+       existingAnnotations = al.getAlignmentAnnotation().length;\r
+\r
+      int alWidth = al.getWidth();\r
+\r
+      StringTokenizer st;\r
+      Annotation[] annotations;\r
+      AlignmentAnnotation annotation = null;\r
+\r
+      // First confirm this is an Annotation file\r
+      boolean jvAnnotationFile = false;\r
+      while ( (line = in.readLine()) != null)\r
+      {\r
+        if (line.indexOf("#") == 0 )\r
+          continue;\r
+\r
+        if (line.indexOf("JALVIEW_ANNOTATION") > -1)\r
+        {\r
+          jvAnnotationFile = true;\r
+          break;\r
+        }\r
+      }\r
+\r
+      if(!jvAnnotationFile)\r
+      {\r
+        in.close();\r
+        return false;\r
+      }\r
+\r
+      while ( (line = in.readLine()) != null)\r
+      {\r
+        if(line.indexOf("#")==0\r
+           || line.indexOf("JALVIEW_ANNOTATION")>-1\r
+           || line.length()==0)\r
+          continue;\r
+\r
+        st = new StringTokenizer(line, "\t");\r
+        token = st.nextToken();\r
+        if(token.equalsIgnoreCase("COLOUR"))\r
+        {\r
+          colourAnnotations(al, st.nextToken(), st.nextToken());\r
+          continue;\r
+        }\r
+\r
+        if(token.equalsIgnoreCase("COMBINE") )\r
+        {\r
+          combineAnnotations(al, st);\r
+          continue;\r
+        }\r
+\r
+        if (token.equalsIgnoreCase("GRAPHLINE"))\r
+        {\r
+          addLine(al, st);\r
+          continue;\r
+        }\r
+\r
+\r
+        if(token.equalsIgnoreCase("SEQUENCE_REF") )\r
+        {\r
+          refSeq = al.findName(st.nextToken());\r
+          try{\r
+            refSeqIndex = Integer.parseInt(st.nextToken());\r
+          }\r
+          catch(Exception ex)\r
+          {\r
+            refSeqIndex = 1;\r
+          }\r
+\r
+          continue;\r
+        }\r
+\r
+\r
+        graphStyle = AlignmentAnnotation.getGraphValueFromString(token);\r
+        label = description = st.nextToken();\r
+\r
+        line = st.nextToken();\r
+\r
+        st = new StringTokenizer(line, "|", true);\r
+        annotations = new Annotation[alWidth];\r
+\r
+        index = 0;\r
+        boolean emptyColumn = true;\r
+\r
+\r
+        while (st.hasMoreElements() && index<alWidth)\r
+        {\r
+          token = st.nextToken().trim();\r
+          if(token.equals("|"))\r
+          {\r
+            if(emptyColumn)\r
+              index++;\r
+\r
+            emptyColumn = true;\r
+          }\r
+          else\r
+          {\r
+            annotations[index++] = parseAnnotation(token);\r
+            emptyColumn = false;\r
+          }\r
+        }\r
+\r
+       annotation = new AlignmentAnnotation(label,\r
+                                          description,\r
+                                          annotations,\r
+                                          0,\r
+                                          0,\r
+                                          graphStyle);\r
+\r
+       if(refSeq!=null)\r
+       {\r
+         annotation.createSequenceMapping(refSeq, refSeqIndex, false);\r
+         refSeq.addAlignmentAnnotation(annotation);\r
+       }\r
+\r
+       al.addAnnotation(annotation);\r
+\r
+       al.setAnnotationIndex(annotation,  al.getAlignmentAnnotation().length - existingAnnotations-1);\r
+      }\r
+\r
+    }catch(Exception ex)\r
+    {\r
+      ex.printStackTrace();\r
+      System.out.println("Problem reading annotation file: "+ex);\r
+      return false;\r
+    }\r
+    return true;\r
+  }\r
+\r
+  Annotation parseAnnotation(String string)\r
+  {\r
+    String desc = "", displayChar="";\r
+    char ss = ' '; // secondaryStructure\r
+    float value = 0;\r
+    boolean parsedValue = false;\r
+    StringTokenizer st = new StringTokenizer(string, ",");\r
+    String token;\r
+    while(st.hasMoreTokens())\r
+    {\r
+      token = st.nextToken().trim();\r
+      if(token.length()==0)\r
+        continue;\r
+\r
+      if(!parsedValue)\r
+      {\r
+        try{\r
+          displayChar = token;\r
+          value = new Float(token).floatValue();\r
+          parsedValue = true;\r
+        }catch(NumberFormatException ex){}\r
+      }\r
+\r
+      if(token.equals("H") || token.equals("E"))\r
+      {\r
+        // Either this character represents a helix or sheet\r
+        // or an integer which can be displayed\r
+        ss = token.charAt(0);\r
+        if(displayChar.equals(token.substring(0,1)))\r
+          displayChar = "";\r
+      }\r
+      else if(desc.length()<1)\r
+        desc = token;\r
+\r
+    }\r
+\r
+    return new Annotation(displayChar, desc, ss, value);\r
+  }\r
+\r
+  void colourAnnotations(AlignmentI al, String label, String colour)\r
+  {\r
+    UserColourScheme ucs = new UserColourScheme(colour);\r
+    Annotation[] annotations;\r
+    for(int i=0; i<al.getAlignmentAnnotation().length; i++)\r
+    {\r
+      if(al.getAlignmentAnnotation()[i].label.equalsIgnoreCase(label))\r
+      {\r
+        annotations = al.getAlignmentAnnotation()[i].annotations;\r
+        for(int j=0; j<annotations.length; j++)\r
+        {\r
+          if(annotations[j]!=null)\r
+            annotations[j].colour = ucs.findColour("A");\r
+        }\r
+      }\r
+    }\r
+  }\r
+\r
+  void combineAnnotations(AlignmentI al, StringTokenizer st)\r
+  {\r
+    int graphGroup = -1;\r
+    String group = st.nextToken();\r
+    //First make sure we are not overwriting the graphIndex\r
+    for(int i=0; i<al.getAlignmentAnnotation().length; i++)\r
+    {\r
+      if(al.getAlignmentAnnotation()[i].label.equalsIgnoreCase(group))\r
+      {\r
+        graphGroup = al.getAlignmentAnnotation()[i].graphGroup +1;\r
+        al.getAlignmentAnnotation()[i].graphGroup = graphGroup;\r
+        break;\r
+      }\r
+    }\r
+\r
+    //Now update groups\r
+    while(st.hasMoreTokens())\r
+    {\r
+      group = st.nextToken();\r
+      for(int i=0; i<al.getAlignmentAnnotation().length; i++)\r
+      {\r
+        if (al.getAlignmentAnnotation()[i].label.equalsIgnoreCase(group))\r
+        {\r
+          al.getAlignmentAnnotation()[i].graphGroup = graphGroup;\r
+          break;\r
+        }\r
+      }\r
+    }\r
+  }\r
+\r
+  void addLine(AlignmentI al, StringTokenizer st)\r
+  {\r
+    String group = st.nextToken();\r
+    AlignmentAnnotation annotation = null;\r
+\r
+    for (int i = 0; i < al.getAlignmentAnnotation().length; i++)\r
+    {\r
+      if (al.getAlignmentAnnotation()[i].label.equalsIgnoreCase(group))\r
+      {\r
+        annotation = al.getAlignmentAnnotation()[i];\r
+        break;\r
+      }\r
+    }\r
+\r
+    if(annotation==null)\r
+      return;\r
+    float value = new Float(st.nextToken()).floatValue();\r
+    String label = st.hasMoreTokens() ?  st.nextToken() : null;\r
+    java.awt.Color colour = null;\r
+    if(st.hasMoreTokens())\r
+    {\r
+      UserColourScheme ucs = new UserColourScheme(st.nextToken());\r
+      colour = ucs.findColour("A");\r
+    }\r
+\r
+    annotation.setThreshold(new GraphLine(value, label, colour));\r
+\r
+  }\r
+}\r
diff --git a/src/jalview/io/DBRefFetcher.java b/src/jalview/io/DBRefFetcher.java
new file mode 100644 (file)
index 0000000..805e78d
--- /dev/null
@@ -0,0 +1,362 @@
+/*\r
+* Jalview - A Sequence Alignment Editor and Viewer\r
+* Copyright (C) 2006 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+*\r
+* This program is free software; you can redistribute it and/or\r
+* modify it under the terms of the GNU General Public License\r
+* as published by the Free Software Foundation; either version 2\r
+* of the License, or (at your option) any later version.\r
+*\r
+* This program is distributed in the hope that it will be useful,\r
+* but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+* GNU General Public License for more details.\r
+*\r
+* You should have received a copy of the GNU General Public License\r
+* along with this program; if not, write to the Free Software\r
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
+*/\r
+package jalview.io;\r
+\r
+import jalview.datamodel.*;\r
+\r
+import jalview.gui.*;\r
+\r
+import java.io.*;\r
+\r
+import java.util.*;\r
+\r
+import org.exolab.castor.mapping.Mapping;\r
+\r
+import org.exolab.castor.xml.*;\r
+import jalview.analysis.AlignSeq;\r
+\r
+\r
+\r
+/**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
+public class DBRefFetcher implements Runnable\r
+{\r
+  AlignmentI align;\r
+  AlignmentI dataset;\r
+  AlignFrame af;\r
+  ArrayList unknownSequences;\r
+  CutAndPasteTransfer output = new CutAndPasteTransfer();\r
+  StringBuffer sbuffer = new StringBuffer();\r
+  boolean uniprotFlag = false;\r
+  boolean running = false;\r
+\r
+  public DBRefFetcher()\r
+  {}\r
+\r
+  public Vector getUniprotEntries(File file)\r
+  {\r
+    UniprotFile uni = new UniprotFile();\r
+    try\r
+    {\r
+      // 1. Load the mapping information from the file\r
+      Mapping map = new Mapping(uni.getClass().getClassLoader());\r
+      java.net.URL url = getClass().getResource("/uniprot_mapping.xml");\r
+      map.loadMapping(url);\r
+\r
+      // 2. Unmarshal the data\r
+      Unmarshaller unmar = new Unmarshaller(uni);\r
+      unmar.setIgnoreExtraElements(true);\r
+      unmar.setMapping(map);\r
+   //   unmar.setDebug(true);\r
+\r
+      uni = (UniprotFile) unmar.unmarshal(new FileReader(file));\r
+    }\r
+    catch (Exception e)\r
+    {\r
+      System.out.println("Error getUniprotEntries() "+e);\r
+    }\r
+\r
+\r
+    return uni.getUniprotEntries();\r
+  }\r
+\r
+  /**\r
+   * Creates a new SequenceFeatureFetcher object.\r
+   *\r
+   * @param align DOCUMENT ME!\r
+   * @param ap DOCUMENT ME!\r
+   */\r
+  public DBRefFetcher(AlignmentI align, AlignFrame af)\r
+  {\r
+    this.af = af;\r
+    unknownSequences = new ArrayList();\r
+    this.align = align;\r
+    this.dataset = align.getDataset();\r
+  }\r
+\r
+  public boolean fetchDBRefs(boolean waitTillFinished)\r
+  {\r
+    Thread thread = new Thread(this);\r
+    thread.start();\r
+    running = true;\r
+\r
+    if(waitTillFinished)\r
+    {\r
+      while(running)\r
+      {\r
+        try{\r
+          Thread.sleep(500);\r
+        }catch(Exception ex){}\r
+      }\r
+    }\r
+\r
+    return true;\r
+  }\r
+\r
+  /**\r
+   * DOCUMENT ME!\r
+   */\r
+  public void run()\r
+  {\r
+    long startTime = System.currentTimeMillis();\r
+    af.setProgressBar("Fetching db refs", startTime);\r
+    running = true;\r
+\r
+    try\r
+    {\r
+      int seqIndex = 0;\r
+      Vector sequences = dataset.getSequences();\r
+\r
+      while (seqIndex < sequences.size())\r
+      {\r
+        Vector ids = new Vector();\r
+\r
+        for (int i = 0; (seqIndex < sequences.size()) && (i < 50);\r
+             seqIndex++, i++)\r
+        {\r
+          Sequence sequence = (Sequence) sequences.get(seqIndex);\r
+          DBRefEntry [] uprefs = jalview.util.DBRefUtils.selectRefs(sequence.getDBRef(), new String[] {\r
+              jalview.datamodel.DBRefSource.UNIPROT});\r
+          if (uprefs!=null)\r
+          {\r
+            // we know the id for this entry, so don't note its ID in the unknownSequences list\r
+            for (int j=0,k=uprefs.length; j<k; j++)\r
+              ids.add(uprefs[j].getAccessionId());\r
+            unknownSequences.add(sequence);\r
+          } else {\r
+            if (!ids.contains(sequence.getName()))\r
+            {\r
+              ids.add(sequence.getName());\r
+              unknownSequences.add(sequence);\r
+            }\r
+          }\r
+        }\r
+\r
+        ///////////////////////////////////\r
+        ///READ FROM EBI\r
+        if (ids.size() > 0)\r
+        {\r
+          StringBuffer remainingIds = new StringBuffer("uniprot:");\r
+          for (int i = 0; i < ids.size(); i++)\r
+           {\r
+             if(ids.get(i).toString().indexOf("|")>-1)\r
+             {\r
+               remainingIds.append(ids.get(i).toString().substring(\r
+                   ids.get(i).toString().lastIndexOf("|") + 1));\r
+               uniprotFlag = true;\r
+             }\r
+             else\r
+               remainingIds.append(ids.get(i));\r
+\r
+             remainingIds.append(";");\r
+           }\r
+\r
+          EBIFetchClient ebi = new EBIFetchClient();\r
+          File file = ebi.fetchDataAsFile(remainingIds.toString(),\r
+                                          "xml", "raw");\r
+\r
+\r
+\r
+          if (file != null)\r
+          {\r
+            ReadUniprotFile(file, ids);\r
+          }\r
+        }\r
+      }\r
+    }\r
+    catch (Exception ex)\r
+    {\r
+      ex.printStackTrace();\r
+    }\r
+\r
+    if (sbuffer.length() > 0)\r
+    {\r
+      output.setText(\r
+          "Your sequences have been matched to Uniprot. Some of the ids have been\n" +\r
+          "altered, most likely the start/end residue will have been updated.\n" +\r
+          "Save your alignment to maintain the updated id.\n\n" +\r
+          sbuffer.toString());\r
+      Desktop.addInternalFrame(output, "Sequence names updated ", 600, 300);\r
+      // The above is the dataset, we must now find out the index\r
+      // of the viewed sequence\r
+\r
+    }\r
+\r
+    af.setProgressBar("DBRef search completed", startTime);\r
+   // promptBeforeBlast();\r
+\r
+   running = false;\r
+\r
+  }\r
+\r
+\r
+  void promptBeforeBlast()\r
+   {\r
+     // This must be outside the run() body as java 1.5\r
+     // will not return any value from the OptionPane to the expired thread.\r
+      if (unknownSequences.size() > 0)\r
+      {\r
+       // int reply = javax.swing.JOptionPane.showConfirmDialog(\r
+       //     Desktop.desktop, "Couldn't find a match for "+unknownSequences.size()+" sequences."\r
+        //        +"\nPerform blast for unknown sequences?",\r
+        //            "Blast for Unidentified Sequences",\r
+        //             javax.swing.JOptionPane.YES_NO_OPTION, javax.swing.JOptionPane.QUESTION_MESSAGE);\r
+     javax.swing.JOptionPane.showMessageDialog(\r
+    Desktop.desktop, "Couldn't find a match for "+unknownSequences.size()+" sequences.",\r
+            "Unidentified Sequences",\r
+             javax.swing.JOptionPane.WARNING_MESSAGE);\r
+\r
+\r
+      //  if(reply == javax.swing.JOptionPane.YES_OPTION)\r
+     //    new WSWUBlastClient(ap, align, unknownSequences);\r
+      }\r
+  }\r
+\r
+  /**\r
+   * DOCUMENT ME!\r
+   *\r
+   * @param result DOCUMENT ME!\r
+   * @param out DOCUMENT ME!\r
+   * @param align DOCUMENT ME!\r
+   */\r
+  void ReadUniprotFile(File file, Vector ids)\r
+  {\r
+    if(!file.exists())\r
+      return;\r
+\r
+    SequenceI [] sequence = null;\r
+\r
+    Vector entries = getUniprotEntries(file);\r
+\r
+    int i, iSize = entries==null?0:entries.size();\r
+    UniprotEntry entry;\r
+    for (i = 0; i < iSize; i++)\r
+    {\r
+      entry = (UniprotEntry) entries.elementAt(i);\r
+      String idmatch = entry.getAccession().elementAt(0).toString();\r
+      sequence = dataset.findSequenceMatch(idmatch);\r
+\r
+      if (sequence.length==0)\r
+      {\r
+        //Sequence maybe Name, not Accession\r
+        idmatch = entry.getName().elementAt(0).toString();\r
+        sequence = dataset.findSequenceMatch(idmatch);\r
+      }\r
+\r
+      if(sequence.length>0)\r
+        ids.remove(sequence[0].getName());\r
+\r
+      else  if (sequence.length==0 && uniprotFlag)\r
+      {\r
+          StringBuffer upid = new StringBuffer("UniProt/Swiss-Prot|");\r
+          for(int u=0; u<entry.getAccession().size(); u++)\r
+            upid.append(entry.getAccession().elementAt(u)+"|");\r
+\r
+          sequence = dataset.findSequenceMatch(upid+idmatch);\r
+          ids.remove(idmatch);\r
+      }\r
+\r
+      if(sequence.length==0)\r
+      {\r
+        System.out.println(idmatch+" not found");\r
+        continue;\r
+      }\r
+\r
+      for(int m=0; m<sequence.length; m++)\r
+      {\r
+\r
+      sequence[m].addDBRef(new DBRefEntry(DBRefSource.UNIPROT,\r
+                                       "0",\r
+                                       entry.getAccession().elementAt(0).toString()));\r
+\r
+      System.out.println("Adding dbref to "+sequence[m].getName()+" : "+\r
+                         entry.getAccession().elementAt(0).toString());\r
+\r
+      String nonGapped = AlignSeq.extractGaps("-. ", sequence[m].getSequence());\r
+\r
+      int absStart = entry.getUniprotSequence().getContent().indexOf(\r
+          nonGapped.toString());\r
+\r
+      if (absStart == -1)\r
+      {\r
+        // Is UniprotSequence contained in dataset sequence?\r
+        absStart = nonGapped.toString().indexOf(entry.getUniprotSequence().getContent());\r
+        if(absStart == -1)\r
+        {\r
+          sbuffer.append(sequence[m].getName() +\r
+                         " SEQUENCE NOT %100 MATCH \n");\r
+\r
+          continue;\r
+        }\r
+\r
+        if (entry.getFeature() != null)\r
+        {\r
+          Enumeration e = entry.getFeature().elements();\r
+          while (e.hasMoreElements())\r
+          {\r
+            SequenceFeature sf = (SequenceFeature) e.nextElement();\r
+            sf.setBegin(sf.getBegin() + absStart + 1);\r
+            sf.setEnd(sf.getEnd() + absStart + 1);\r
+          }\r
+\r
+          sbuffer.append(sequence[m].getName() +\r
+                         " HAS " + absStart +\r
+              " PREFIXED RESIDUES COMPARED TO UNIPROT - ANY SEQUENCE FEATURES"\r
+                         + " HAVE BEEN ADJUSTED ACCORDINGLY \n");\r
+          absStart = 0;\r
+        }\r
+\r
+      }\r
+\r
+      unknownSequences.remove(sequence);\r
+\r
+      int absEnd = absStart + nonGapped.toString().length();\r
+      absStart += 1;\r
+\r
+      Enumeration e = entry.getDbReference().elements();\r
+      Vector onlyPdbEntries = new Vector();\r
+      while(e.hasMoreElements())\r
+      {\r
+        PDBEntry pdb = (PDBEntry)e.nextElement();\r
+        if(!pdb.getType().equals(DBRefSource.PDB))\r
+          continue;\r
+\r
+        sequence[m].addDBRef(new DBRefEntry(DBRefSource.PDB,\r
+                                       "0",\r
+                                       pdb.getId()));\r
+\r
+        onlyPdbEntries.addElement(pdb);\r
+      }\r
+\r
+      sequence[m].setPDBId(onlyPdbEntries);\r
+\r
+      sequence[m].setStart(absStart);\r
+      sequence[m].setEnd(absEnd);\r
+\r
+\r
+      }\r
+    }\r
+  }\r
+}\r
+\r
+\r
diff --git a/src/jalview/io/DasSequenceFeatureFetcher.java b/src/jalview/io/DasSequenceFeatureFetcher.java
new file mode 100755 (executable)
index 0000000..f78f943
--- /dev/null
@@ -0,0 +1,474 @@
+/*\r
+* Jalview - A Sequence Alignment Editor and Viewer\r
+* Copyright (C) 2006 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+*\r
+* This program is free software; you can redistribute it and/or\r
+* modify it under the terms of the GNU General Public License\r
+* as published by the Free Software Foundation; either version 2\r
+* of the License, or (at your option) any later version.\r
+*\r
+* This program is distributed in the hope that it will be useful,\r
+* but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+* GNU General Public License for more details.\r
+*\r
+* You should have received a copy of the GNU General Public License\r
+* along with this program; if not, write to the Free Software\r
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
+*/\r
+package jalview.io;\r
+\r
+import jalview.datamodel.*;\r
+\r
+import jalview.gui.*;\r
+\r
+import java.util.*;\r
+\r
+import java.net.URL;\r
+\r
+import org.biojava.dasobert.das.FeatureThread;\r
+import org.biojava.dasobert.eventmodel.FeatureEvent;\r
+import org.biojava.dasobert.eventmodel.FeatureListener;\r
+import org.biojava.dasobert.dasregistry.DasSource;\r
+\r
+import org.biojava.dasobert.das2.io.DasSourceReaderImpl;\r
+import org.biojava.dasobert.dasregistry.Das1Source;\r
+import org.biojava.dasobert.dasregistry.DasSource;\r
+import org.biojava.dasobert.das2.Das2Source;\r
+import org.biojava.dasobert.das2.DasSourceConverter;\r
+\r
+\r
+import jalview.bin.Cache;\r
+import org.biojava.dasobert.dasregistry.DasCoordinateSystem;\r
+\r
+import javax.swing.*;\r
+\r
+/**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
+public class DasSequenceFeatureFetcher implements Runnable\r
+{\r
+  SequenceI [] sequences;\r
+  AlignFrame af;\r
+  StringBuffer sbuffer = new StringBuffer();\r
+  Vector selectedSources;\r
+\r
+  long startTime;\r
+  int threadsRunning = 0;\r
+\r
+\r
+  /**\r
+   * Creates a new SequenceFeatureFetcher object.\r
+   * Uses default\r
+   *\r
+   * @param align DOCUMENT ME!\r
+   * @param ap DOCUMENT ME!\r
+   */\r
+  public DasSequenceFeatureFetcher(SequenceI [] sequences,\r
+                                   final AlignFrame af,\r
+                                   Vector selectedSources)\r
+  {\r
+    this.selectedSources = selectedSources;\r
+    this.sequences = sequences;\r
+    this.af = af;\r
+\r
+    int uniprotCount = 0;\r
+    for (int i = 0; i < selectedSources.size(); i++)\r
+    {\r
+      DasSource source = (DasSource) selectedSources.elementAt(i);\r
+      DasCoordinateSystem[] coords = source.getCoordinateSystem();\r
+      for (int c = 0; c < coords.length; c++)\r
+      {\r
+        if (coords[c].getName().indexOf("UniProt")>-1)\r
+        {\r
+          uniprotCount++;\r
+          break;\r
+        }\r
+      }\r
+    }\r
+\r
+    int refCount = 0;\r
+    for(int i=0; i<sequences.length; i++)\r
+    {\r
+      DBRefEntry [] dbref = sequences[i].getDBRef();\r
+      if(dbref!=null)\r
+      {\r
+        for(int j=0; j<dbref.length; j++)\r
+        {\r
+          if(dbref[j].getSource()\r
+             .equals(jalview.datamodel.DBRefSource.UNIPROT))\r
+          {\r
+            refCount++;\r
+            break;\r
+          }\r
+        }\r
+      }\r
+    }\r
+\r
+    if(refCount<sequences.length && uniprotCount>0)\r
+    {\r
+\r
+     int reply = JOptionPane.showInternalConfirmDialog(Desktop.desktop,\r
+          "Do you want Jalview to find\n"\r
+         +"Uniprot Accession ids for given sequence names?",\r
+         "Find Uniprot Accession Ids",\r
+         JOptionPane.YES_NO_OPTION,\r
+         JOptionPane.QUESTION_MESSAGE);\r
+\r
+     if(reply == JOptionPane.YES_OPTION)\r
+     {\r
+       Thread thread = new Thread(new FetchDBRefs());\r
+       thread.start();\r
+     }\r
+     else\r
+      startFetching();\r
+    }\r
+    else\r
+      startFetching();\r
+\r
+  /* System.out.println("User selection is "   +\r
+                       ( ( (float) uniprotCount / (float) selectedSources.size()) * 100)\r
+                      + " % Uniprot,  and "+refCount+" / " +sequences.length+" have uniprot accession");\r
+*/\r
+  }\r
+\r
+  void startFetching()\r
+  {\r
+    Thread thread = new Thread(this);\r
+    thread.start();\r
+  }\r
+\r
+  class FetchDBRefs implements Runnable\r
+  {\r
+    public void run()\r
+    {\r
+      new DBRefFetcher(\r
+             af.getViewport().getAlignment(), af).fetchDBRefs(true);\r
+      startFetching();\r
+    }\r
+  }\r
+\r
+\r
+  /**\r
+   * creates a jalview sequence feature from a das feature document\r
+   * @param dasfeature\r
+   * @return sequence feature object created using dasfeature information\r
+   */\r
+  SequenceFeature newSequenceFeature(Map dasfeature, String nickname)\r
+  {\r
+         try {\r
+               /**\r
+          * Different qNames for a DAS Feature - are string keys to the HashMaps in features\r
+          * "METHOD") ||\r
+          qName.equals("TYPE") ||\r
+          qName.equals("START") ||\r
+          qName.equals("END") ||\r
+          qName.equals("NOTE") ||\r
+          qName.equals("LINK") ||\r
+          qName.equals("SCORE")\r
+          */\r
+                 String desc = new String();\r
+                 if (dasfeature.containsKey("NOTE"))\r
+                               desc+=(String) dasfeature.get("NOTE");\r
+\r
+\r
+                  int start = 0, end = 0;\r
+                  float score = 0f;\r
+\r
+                  try{ start = Integer.parseInt( dasfeature.get("START").toString()); }\r
+                  catch( Exception ex){}\r
+                  try{ end = Integer.parseInt( dasfeature.get("END").toString()); }\r
+                  catch (Exception ex){}\r
+                  try{ score = Integer.parseInt( dasfeature.get("SCORE").toString()); }\r
+                  catch (Exception ex){}\r
+\r
+\r
+                 SequenceFeature f = new SequenceFeature(\r
+                                 (String) dasfeature.get("TYPE"),\r
+                                 desc,\r
+                                 start,\r
+                                 end,\r
+                                  score,\r
+                                 nickname);\r
+\r
+                  if (dasfeature.containsKey("LINK"))\r
+                 {\r
+                      f.addLink(f.getType()+" "+f.begin+"_"+f.end\r
+                                +"|"+ dasfeature.get("LINK"));\r
+                 }\r
+                  // (String) dasfeature.get("ID"),\r
+                  ////  (String) dasfeature.get("METHOD"),\r
+                               //  (String) dasfeature.get("SCORE"),\r
+                               //  null\r
+                       // );\r
+\r
+         return f;\r
+         }\r
+         catch (Exception e) {\r
+            e.printStackTrace();\r
+                 Cache.log.debug("Failed to parse "+dasfeature.toString(), e);\r
+                 return null;\r
+         }\r
+  }\r
+  /**\r
+   * fetch and add das features to a sequence using the given source URL and Id to create a feature request\r
+   * @param seq\r
+   * @param SourceUrl\r
+   * @param id\r
+   */\r
+  protected void createFeatureFetcher(final SequenceI seq,\r
+                                      final String sourceUrl,\r
+                                      String id,\r
+                                      String nickname)\r
+  {\r
+         //////////////\r
+         /// fetch DAS features\r
+          final Das1Source source = new Das1Source();\r
+          source.setUrl(sourceUrl);\r
+          source.setNickname(nickname);\r
+\r
+\r
+          Cache.log.debug("new Das Feature Fetcher for " + id + " querying " +\r
+                          sourceUrl);\r
+\r
+          if (id != null && id.length() > 0)\r
+          {\r
+            setThreadsRunning(+1);\r
+\r
+          //  int start=seq.getStart(), end = seq.getEnd();\r
+          /*  if(af.getViewport().getSelectionGroup()!=null)\r
+            {\r
+              SequenceI tmp = af.getViewport().getAlignment().findName(seq.getName());\r
+              start = tmp.findPosition(\r
+              af.getViewport().getSelectionGroup().getStartRes()\r
+                  );\r
+\r
+              end = tmp.findPosition(\r
+                 af.getViewport().getSelectionGroup().getEndRes()\r
+                 );\r
+            }*/\r
+\r
+            FeatureThread fetcher = new FeatureThread(id\r
+                                                   //  +  ":" + start + "," + end,\r
+                                                      , source);\r
+\r
+\r
+            fetcher.addFeatureListener(new FeatureListener()\r
+            {\r
+              public void comeBackLater(FeatureEvent e)\r
+              {\r
+                setThreadsRunning(-1);\r
+                Cache.log.debug("das source " + e.getDasSource().getNickname() +\r
+                                " asked us to come back in " + e.getComeBackLater() +\r
+                                " secs.");\r
+              }\r
+\r
+              public void newFeatures(FeatureEvent e)\r
+              {\r
+                setThreadsRunning(-1);\r
+                Das1Source ds = e.getDasSource();\r
+\r
+                Map[] features = e.getFeatures();\r
+                // add features to sequence\r
+                Cache.log.debug("das source " + ds.getUrl() + " returned " +\r
+                                features.length + " features");\r
+\r
+                if (features.length > 0)\r
+                {\r
+                  for (int i = 0; i < features.length; i++)\r
+                  {\r
+                      SequenceFeature f = newSequenceFeature(features[i],\r
+                        source.getNickname());\r
+\r
+                      seq.addSequenceFeature(f);\r
+                  }\r
+                }\r
+                else\r
+                {\r
+                  System.out.println("No features found for sequence " +seq.getName()\r
+                                     +" from: "+ e.getDasSource().getNickname());\r
+                }\r
+\r
+              }\r
+            }\r
+\r
+            );\r
+\r
+            //NOTE alignPanel listener will be called after the previous\r
+            //anonymous listener!!!\r
+            fetcher.addFeatureListener(af);\r
+\r
+            fetcher.start();\r
+         }\r
+  }\r
+\r
+  synchronized void setThreadsRunning(int i)\r
+  {\r
+    threadsRunning += i;\r
+    if(threadsRunning<1)\r
+    {\r
+      af.setProgressBar("DAS Feature Fetching Complete", startTime);\r
+\r
+      if(af.featureSettings!=null)\r
+        af.featureSettings.setTableData();\r
+    }\r
+  }\r
+\r
+  /**\r
+   * Spawns a number of dasobert Fetcher threads to add features to sequences in the dataset\r
+   */\r
+  public void run()\r
+  {\r
+    startTime = System.currentTimeMillis();\r
+    af.setProgressBar("Fetching DAS Sequence Features", startTime);\r
+\r
+    DasSource [] sources = new jalview.gui.DasSourceBrowser().getDASSource();\r
+\r
+    if(selectedSources==null || selectedSources.size()==0)\r
+    {\r
+      String active = jalview.bin.Cache.getDefault("DAS_ACTIVE_SOURCE", "uniprot");\r
+      StringTokenizer st = new StringTokenizer(active, "\t");\r
+      Vector selectedSources = new Vector();\r
+      String token;\r
+      while (st.hasMoreTokens())\r
+      {\r
+        token = st.nextToken();\r
+        for (int i = 0; i < sources.length; i++)\r
+        {\r
+          if (sources[i].getNickname().equals(token))\r
+          {\r
+            selectedSources.addElement(sources[i]);\r
+            break;\r
+          }\r
+        }\r
+      }\r
+    }\r
+\r
+    if(selectedSources == null || selectedSources.size()==0)\r
+    {\r
+      System.out.println("No DAS Sources active");\r
+      af.setProgressBar("No DAS Sources Active", startTime);\r
+      return;\r
+    }\r
+\r
+    try\r
+    {\r
+      int seqIndex = 0;\r
+      while (seqIndex < sequences.length)\r
+      {\r
+          DBRefEntry [] uprefs = jalview.util.DBRefUtils.selectRefs(sequences[seqIndex].getDBRef(),\r
+              new String[]  {\r
+              jalview.datamodel.DBRefSource.PDB,\r
+              jalview.datamodel.DBRefSource.UNIPROT});\r
+\r
+          for(int sourceIndex=0; sourceIndex<selectedSources.size(); sourceIndex++)\r
+          {\r
+            DasSource dasSource = (DasSource)selectedSources.elementAt(sourceIndex);\r
+\r
+            if (uprefs != null)\r
+            {\r
+              // we know the id for this entry, so don't note its ID in the unknownSequences list\r
+              for (int j = 0;  j < uprefs.length; j++)\r
+              {\r
+\r
+                // Will have to pass any mapping information to the fetcher - the start/end for the DBRefEntry may not be the same as the sequence's start/end\r
+                DasCoordinateSystem cs[] = dasSource.getCoordinateSystem();\r
+                for (int l=0; l<cs.length; l++)\r
+                {\r
+                  if (jalview.util.DBRefUtils.isDasCoordinateSystem(cs[l].getName(), uprefs[j]))\r
+                  {\r
+                    Cache.log.debug("Launched fetcher for coordinate system " +\r
+                                    cs[l].getName());\r
+\r
+\r
+                    createFeatureFetcher(sequences[seqIndex],\r
+                                         dasSource.getUrl(),\r
+                                          uprefs[j].getAccessionId(),\r
+                                         dasSource.getNickname());\r
+                  }\r
+                }\r
+              }\r
+            }\r
+            else\r
+            {\r
+              String id = null;\r
+              // try and use the name as the sequence id\r
+              if (sequences[seqIndex].getName().indexOf("|") > -1)\r
+              {\r
+                id = sequences[seqIndex].getName().substring(\r
+                    sequences[seqIndex].getName().lastIndexOf("|") + 1);\r
+              }\r
+              else\r
+              {\r
+                id = sequences[seqIndex].getName();\r
+              }\r
+              if (id != null)\r
+              {\r
+                // Should try to call a general feature fetcher that queries many sources with name to discover applicable ID references\r
+                createFeatureFetcher(sequences[seqIndex],\r
+                                     dasSource.getUrl(),\r
+                                     id,\r
+                                     dasSource.getNickname());\r
+              }\r
+            }\r
+          }\r
+\r
+          seqIndex++;\r
+    }\r
+    }\r
+    catch (Exception ex)\r
+    {\r
+      ex.printStackTrace();\r
+    }\r
+  }\r
+\r
+\r
+  public static DasSource[] getDASSources()\r
+  {\r
+    DasSourceReaderImpl reader = new DasSourceReaderImpl();\r
+\r
+    String registryURL =jalview.bin.Cache.getDefault("DAS_REGISTRY_URL",\r
+        "http://das.sanger.ac.uk/registry/das1/sources/"\r
+      );\r
+\r
+    try\r
+    {\r
+      URL url = new URL(registryURL);\r
+\r
+      DasSource[] sources = reader.readDasSource(url);\r
+\r
+      List das1sources = new ArrayList();\r
+      for (int i = 0; i < sources.length; i++)\r
+      {\r
+        DasSource ds = sources[i];\r
+        if (ds instanceof Das2Source)\r
+        {\r
+          Das2Source d2s = (Das2Source) ds;\r
+          if (d2s.hasDas1Capabilities())\r
+          {\r
+            Das1Source d1s = DasSourceConverter.toDas1Source(d2s);\r
+            das1sources.add(d1s);\r
+          }\r
+\r
+        }\r
+        else if (ds instanceof Das1Source)\r
+        {\r
+          das1sources.add( (Das1Source) ds);\r
+        }\r
+      }\r
+\r
+      return (Das1Source[]) das1sources.toArray(new Das1Source[das1sources.size()]);\r
+    }\r
+    catch (Exception ex)\r
+    {\r
+      ex.printStackTrace();\r
+      return null;\r
+    }\r
+\r
+  }\r
+}\r
+\r
+\r
diff --git a/src/jalview/io/FeaturesFile.java b/src/jalview/io/FeaturesFile.java
new file mode 100755 (executable)
index 0000000..c32fbc9
--- /dev/null
@@ -0,0 +1,497 @@
+/*\r
+* Jalview - A Sequence Alignment Editor and Viewer\r
+* Copyright (C) 2006 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+*\r
+* This program is free software; you can redistribute it and/or\r
+* modify it under the terms of the GNU General Public License\r
+* as published by the Free Software Foundation; either version 2\r
+* of the License, or (at your option) any later version.\r
+*\r
+* This program is distributed in the hope that it will be useful,\r
+* but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+* GNU General Public License for more details.\r
+*\r
+* You should have received a copy of the GNU General Public License\r
+* along with this program; if not, write to the Free Software\r
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
+*/\r
+package jalview.io;\r
+\r
+import jalview.datamodel.*;\r
+\r
+import java.io.*;\r
+import java.util.*;\r
+import jalview.schemes.UserColourScheme;\r
+\r
+\r
+/**\r
+ * DOCUMENT ME!\r
+ *\r
+ * @author $author$\r
+ * @version $Revision$\r
+ */\r
+public class FeaturesFile extends AlignFile\r
+{\r
+    /**\r
+     * Creates a new FeaturesFile object.\r
+     */\r
+    public FeaturesFile()\r
+    {\r
+    }\r
+\r
+\r
+    /**\r
+     * Creates a new FeaturesFile object.\r
+     *\r
+     * @param inFile DOCUMENT ME!\r
+     * @param type DOCUMENT ME!\r
+     *\r
+     * @throws IOException DOCUMENT ME!\r
+     */\r
+    public FeaturesFile(String inFile, String type)\r
+       throws IOException\r
+    {\r
+        super(inFile, type);\r
+    }\r
+\r
+    /**\r
+     * The Application can render HTML, but the applet will\r
+     * remove HTML tags and replace links with %LINK%\r
+     * Both need to read links in HTML however\r
+     *\r
+     * @throws IOException DOCUMENT ME!\r
+     */\r
+    public boolean parse(AlignmentI align,\r
+                         Hashtable colours,\r
+                         boolean removeHTML)\r
+    {\r
+      return parse(align, colours, null, removeHTML);\r
+    }\r
+    /**\r
+     * The Application can render HTML, but the applet will\r
+     * remove HTML tags and replace links with %LINK%\r
+     * Both need to read links in HTML however\r
+     *\r
+     * @throws IOException DOCUMENT ME!\r
+     */\r
+    public boolean parse(AlignmentI align,\r
+                         Hashtable colours,\r
+                         Hashtable featureLink,\r
+                         boolean removeHTML)\r
+    {\r
+      String line = null;\r
+      try\r
+      {\r
+        SequenceI seq = null;\r
+        String type, desc, token=null;\r
+\r
+        int index, start, end;\r
+        float score;\r
+        StringTokenizer st;\r
+        SequenceFeature sf;\r
+        String featureGroup = null, groupLink = null;\r
+        Hashtable typeLink = new Hashtable();\r
+\r
+        boolean GFFFile = true;\r
+\r
+        while ( (line = nextLine()) != null)\r
+        {\r
+          if(line.startsWith("#"))\r
+            continue;\r
+\r
+          st = new StringTokenizer(line, "\t");\r
+          if (st.countTokens()>1 && st.countTokens() < 4 )\r
+          {\r
+            GFFFile = false;\r
+            type = st.nextToken();\r
+            if (type.equalsIgnoreCase("startgroup"))\r
+            {\r
+              featureGroup = st.nextToken();\r
+              if (st.hasMoreElements())\r
+              {\r
+                groupLink = st.nextToken();\r
+                featureLink.put(featureGroup, groupLink);\r
+              }\r
+            }\r
+            else if (type.equalsIgnoreCase("endgroup"))\r
+            {\r
+              //We should check whether this is the current group,\r
+              //but at present theres no way of showing more than 1 group\r
+              st.nextToken();\r
+              featureGroup = null;\r
+              groupLink = null;\r
+            }\r
+            else\r
+            {\r
+              UserColourScheme ucs = new UserColourScheme(st.nextToken());\r
+              colours.put(type, ucs.findColour("A"));\r
+              if (st.hasMoreElements())\r
+              {\r
+                String link = st.nextToken();\r
+                typeLink.put(type, link);\r
+                if(featureLink==null)\r
+                  featureLink = new Hashtable();\r
+                featureLink.put(type, link);\r
+              }\r
+\r
+            }\r
+            continue;\r
+          }\r
+\r
+          while (st.hasMoreElements())\r
+          {\r
+\r
+            if(GFFFile)\r
+            {\r
+              // Still possible this is an old Jalview file,\r
+              // which does not have type colours at the beginning\r
+              token = st.nextToken();\r
+              seq = align.findName(token);\r
+              if(seq != null)\r
+              {\r
+                desc = st.nextToken();\r
+                type = st.nextToken();\r
+                start = Integer.parseInt(st.nextToken());\r
+                end = Integer.parseInt(st.nextToken());\r
+                try\r
+                {\r
+                  score =  new Float(st.nextToken()).floatValue();\r
+                }\r
+                catch (NumberFormatException ex)\r
+                {\r
+                  score = 0;\r
+                }\r
+\r
+                sf = new SequenceFeature(type, desc, start, end, score, null);\r
+\r
+                try\r
+                {\r
+                  sf.setValue("STRAND", st.nextToken());\r
+                  sf.setValue("FRAME", st.nextToken());\r
+                }\r
+                catch (Exception ex)\r
+                {}\r
+\r
+                if(st.hasMoreTokens())\r
+                {\r
+                  StringBuffer attributes = new StringBuffer();\r
+                  while (st.hasMoreTokens())\r
+                  {\r
+                    attributes.append("\t"+st.nextElement());\r
+                  }\r
+                  sf.setValue("ATTRIBUTES", attributes.toString());\r
+                }\r
+\r
+                seq.addSequenceFeature(sf);\r
+\r
+                break;\r
+              }\r
+            }\r
+\r
+            if(GFFFile && seq==null)\r
+            {\r
+              desc = token;\r
+            }\r
+            else\r
+              desc = st.nextToken();\r
+\r
+\r
+            token = st.nextToken();\r
+            if (!token.equals("ID_NOT_SPECIFIED"))\r
+            {\r
+              seq = align.findName(token);\r
+              st.nextToken();\r
+            }\r
+            else\r
+            {\r
+              try{\r
+                index = Integer.parseInt(st.nextToken());\r
+                seq = align.getSequenceAt(index);\r
+              }\r
+              catch(NumberFormatException ex)\r
+              {\r
+                seq = null;\r
+              }\r
+            }\r
+\r
+            if(seq==null)\r
+            {\r
+              System.out.println("Sequence not found: "+line);\r
+              break;\r
+            }\r
+\r
+            start = Integer.parseInt(st.nextToken());\r
+            end = Integer.parseInt(st.nextToken());\r
+\r
+            type = st.nextToken();\r
+\r
+            if (!colours.containsKey(type))\r
+            {\r
+              // Probably the old style groups file\r
+              UserColourScheme ucs = new UserColourScheme(type);\r
+              colours.put(type, ucs.findColour("A"));\r
+            }\r
+\r
+            sf = new SequenceFeature(type, desc, "", start, end, featureGroup);\r
+\r
+            seq.addSequenceFeature(sf);\r
+\r
+            if(groupLink!=null && removeHTML)\r
+            {\r
+              sf.addLink(groupLink);\r
+              sf.description += "%LINK%";\r
+            }\r
+            if(typeLink.containsKey(type) && removeHTML)\r
+            {\r
+              sf.addLink(typeLink.get(type).toString());\r
+              sf.description += "%LINK%";\r
+            }\r
+\r
+            parseDescriptionHTML(sf, removeHTML);\r
+\r
+            //If we got here, its not a GFFFile\r
+            GFFFile = false;\r
+          }\r
+        }\r
+      }\r
+      catch (Exception ex)\r
+      {\r
+        System.out.println(line);\r
+        System.out.println("Error parsing feature file: " + ex +"\n"+line);\r
+        return false;\r
+      }\r
+\r
+      return true;\r
+    }\r
+\r
+    void parseDescriptionHTML(SequenceFeature sf, boolean removeHTML)\r
+    {\r
+      StringBuffer sb = new StringBuffer();\r
+      StringTokenizer st = new StringTokenizer(sf.getDescription(), "<");\r
+      String token,  link;\r
+      while(st.hasMoreElements())\r
+      {\r
+        token = st.nextToken("<>");\r
+        if(token.equalsIgnoreCase("html") || token.startsWith("/"))\r
+          continue;\r
+\r
+        if(token.startsWith("a href="))\r
+        {\r
+          link = token.substring(token.indexOf("\"")+1, token.length()-1);\r
+          String label = st.nextToken("<>");\r
+          sf.addLink(label+"|"+link);\r
+          sb.append(label+"%LINK%");\r
+        }\r
+        else if(token.equalsIgnoreCase("br"))\r
+          sb.append("\n");\r
+        else\r
+          sb.append(token);\r
+      }\r
+\r
+      if(removeHTML)\r
+        sf.description = sb.toString();\r
+  }\r
+\r
+    /**\r
+     * DOCUMENT ME!\r
+     *\r
+     * @param s DOCUMENT ME!\r
+     * @param len DOCUMENT ME!\r
+     * @param gaps DOCUMENT ME!\r
+     * @param displayId DOCUMENT ME!\r
+     *\r
+     * @return DOCUMENT ME!\r
+     */\r
+    public String printJalviewFormat(SequenceI [] seqs,\r
+                                     Hashtable visible)\r
+    {\r
+        StringBuffer out = new StringBuffer();\r
+        SequenceFeature [] next;\r
+\r
+        if(visible==null || visible.size()<1)\r
+          return "No Features Visible";\r
+\r
+        Enumeration en = visible.keys();\r
+        String type;\r
+        int color;\r
+        while( en.hasMoreElements() )\r
+        {\r
+          type = en.nextElement().toString();\r
+          color = Integer.parseInt( visible.get(type).toString() );\r
+          out.append(type + "\t"\r
+                     + jalview.util.Format.getHexString(\r
+                         new java.awt.Color(color)  )\r
+                     +"\n");\r
+        }\r
+\r
+        //Work out which groups are both present and visible\r
+        Vector groups = new Vector();\r
+        int groupIndex = 0;\r
+\r
+        for(int i=0; i<seqs.length; i++)\r
+        {\r
+          next = seqs[i].getSequenceFeatures();\r
+          if(next!=null)\r
+          {\r
+            for(int j=0; j<next.length; j++)\r
+            {\r
+              if (!visible.containsKey(next[j].type))\r
+                continue;\r
+\r
+              if (    next[j].featureGroup != null\r
+                  && !groups.contains(next[j].featureGroup))\r
+                groups.addElement(next[j].featureGroup);\r
+            }\r
+          }\r
+        }\r
+\r
+        String group = null;\r
+\r
+        do\r
+        {\r
+\r
+\r
+          if (groups.size() > 0 && groupIndex < groups.size())\r
+          {\r
+            group = groups.elementAt(groupIndex).toString();\r
+            out.append("\nSTARTGROUP\t" + group + "\n");\r
+          }\r
+          else\r
+            group = null;\r
+\r
+          for (int i = 0; i < seqs.length; i++)\r
+          {\r
+            next = seqs[i].getSequenceFeatures();\r
+            if (next != null)\r
+            {\r
+              for (int j = 0; j < next.length; j++)\r
+              {\r
+                if (!visible.containsKey(next[j].type))\r
+                  continue;\r
+\r
+                if (group != null\r
+                    && (next[j].featureGroup==null\r
+                        || !next[j].featureGroup.equals(group))\r
+                  )\r
+                  continue;\r
+\r
+                if(group==null && next[j].featureGroup!=null)\r
+                  continue;\r
+\r
+                if(next[j].description==null || next[j].description.equals(""))\r
+                  out.append(next[j].type+"\t");\r
+                else\r
+                {\r
+                  out.append(next[j].description+" ");\r
+                  if(next[j].links!=null)\r
+                    {\r
+                      for(int l=0; l<next[j].links.size(); l++)\r
+                      {\r
+                        String label = next[j].links.elementAt(l).toString();\r
+                        String href = label.substring(label.indexOf("|")+1);\r
+                        label = label.substring(0, label.indexOf("|"));\r
+\r
+                        if(next[j].description.indexOf(href)==-1)\r
+                        {\r
+                          out.append("<a href=\""\r
+                                     + href\r
+                                     + "\">"\r
+                                     + label\r
+                                     + "</a>");\r
+                        }\r
+                      }\r
+                    }\r
+                   out.append("\t");\r
+                }\r
+\r
+\r
+                out.append(  seqs[i].getName() + "\t-1\t"\r
+                           + next[j].begin + "\t"\r
+                           + next[j].end + "\t"\r
+                           + next[j].type + "\n"\r
+                    );\r
+              }\r
+            }\r
+          }\r
+\r
+          if(group!=null)\r
+          {\r
+            out.append("ENDGROUP\t"+group+"\n");\r
+            groupIndex++;\r
+          }\r
+          else\r
+            break;\r
+\r
+        }\r
+        while(groupIndex < groups.size()+1);\r
+\r
+\r
+      return out.toString();\r
+    }\r
+\r
+    public String printGFFFormat(SequenceI [] seqs, Hashtable visible)\r
+    {\r
+      StringBuffer out = new StringBuffer();\r
+      SequenceFeature [] next;\r
+      String source;\r
+\r
+      for(int i=0; i<seqs.length; i++)\r
+      {\r
+        if(seqs[i].getSequenceFeatures()!=null)\r
+        {\r
+          next = seqs[i].getSequenceFeatures();\r
+          for(int j=0; j<next.length; j++)\r
+          {\r
+            if(!visible.containsKey(next[j].type))\r
+              continue;\r
+\r
+            source = next[j].featureGroup;\r
+            if(source==null)\r
+              source = next[j].getDescription();\r
+\r
+            out.append(seqs[i].getName() + "\t"\r
+                       + source + "\t"\r
+                       + next[j].type  + "\t"\r
+                       + next[j].begin + "\t"\r
+                       + next[j].end   + "\t"\r
+                       + next[j].score + "\t"\r
+                      );\r
+\r
+            if(next[j].getValue("STRAND")!=null)\r
+              out.append(next[j].getValue("STRAND")+"\t");\r
+            else\r
+              out.append(".\t");\r
+\r
+            if(next[j].getValue("FRAME")!=null)\r
+              out.append(next[j].getValue("FRAME"));\r
+            else\r
+              out.append(".");\r
+\r
+            if(next[j].getValue("ATTRIBUTES")!=null)\r
+              out.append(next[j].getValue("ATTRIBUTES"));\r
+\r
+            out.append("\n");\r
+\r
+          }\r
+        }\r
+      }\r
+\r
+      return out.toString();\r
+    }\r
+\r
+    public void parse()\r
+    {\r
+      //IGNORED\r
+    }\r
+\r
+    /**\r
+     * DOCUMENT ME!\r
+     *\r
+     * @return DOCUMENT ME!\r
+     */\r
+    public String print()\r
+    {\r
+        return "USE printGFFFormat() or printJalviewFormat()";\r
+    }\r
+}\r
diff --git a/src/jalview/io/JnetAnnotationMaker.java b/src/jalview/io/JnetAnnotationMaker.java
new file mode 100755 (executable)
index 0000000..61f0ce1
--- /dev/null
@@ -0,0 +1,145 @@
+/*\r
+* Jalview - A Sequence Alignment Editor and Viewer\r
+* Copyright (C) 2006 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+*\r
+* This program is free software; you can redistribute it and/or\r
+* modify it under the terms of the GNU General Public License\r
+* as published by the Free Software Foundation; either version 2\r
+* of the License, or (at your option) any later version.\r
+*\r
+* This program is distributed in the hope that it will be useful,\r
+* but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+* GNU General Public License for more details.\r
+*\r
+* You should have received a copy of the GNU General Public License\r
+* along with this program; if not, write to the Free Software\r
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
+*/package jalview.io;\r
+\r
+import jalview.datamodel.*;\r
+\r
+public class JnetAnnotationMaker\r
+{\r
+  /**\r
+   * adds the annotation parsed by prediction to al.\r
+   * @param prediction JPredFile\r
+   * @param al AlignmentI\r
+   * @param FirstSeq int -\r
+   * @param noMsa boolean\r
+   */\r
+  public static void add_annotation(JPredFile prediction, AlignmentI al,\r
+                                    int FirstSeq, boolean noMsa)\r
+      throws Exception\r
+  {\r
+    int i = 0;\r
+    SequenceI[] preds = prediction.getSeqsAsArray();\r
+    // in the future we could search for the query\r
+    // sequence in the alignment before calling this function.\r
+    SequenceI seqRef = al.getSequenceAt(FirstSeq);\r
+    int width = preds[0].getSequence().length();\r
+    int[] gapmap = al.getSequenceAt(FirstSeq).gapMap();\r
+    if (gapmap.length != width)\r
+    {\r
+      throw (new Exception(\r
+          "Number of residues in supposed query sequence ('" +\r
+          al.getSequenceAt(FirstSeq).getName() + "'\n" +\r
+          al.getSequenceAt(FirstSeq).getSequence() +\r
+          ")\ndiffer from number of prediction sites in prediction (" + width +\r
+          ")"));\r
+    }\r
+\r
+    AlignmentAnnotation annot;\r
+    Annotation[] annotations = null;\r
+\r
+    int existingAnnotations = 0;\r
+    if(al.getAlignmentAnnotation()!=null)\r
+       existingAnnotations = al.getAlignmentAnnotation().length;\r
+\r
+\r
+    while (i < preds.length)\r
+    {\r
+      String id = preds[i].getName().toUpperCase();\r
+\r
+      if (id.startsWith("LUPAS") || id.startsWith("JNET") ||\r
+          id.startsWith("JPRED"))\r
+      {\r
+        annotations = new Annotation[al.getWidth()];\r
+\r
+        if (id.equals("JNETPRED") || id.equals("JNETPSSM") ||\r
+            id.equals("JNETFREQ") || id.equals("JNETHMM") ||\r
+            id.equals("JNETALIGN") || id.equals("JPRED"))\r
+        {\r
+          for (int j = 0; j < width; j++)\r
+          {\r
+            annotations[gapmap[j]] = new Annotation("", "",\r
+                preds[i].getCharAt(j), 0);\r
+          }\r
+        }\r
+        else if (id.equals("JNETCONF"))\r
+        {\r
+          for (int j = 0; j < width; j++)\r
+          {\r
+            float value = new Float(preds[i].getCharAt(\r
+                j) + "").floatValue();\r
+            annotations[gapmap[j]] = new Annotation(preds[i].getCharAt(\r
+                j) + "", "", preds[i].getCharAt(j),\r
+                value);\r
+          }\r
+        }\r
+        else\r
+        {\r
+          for (int j = 0; j < width; j++)\r
+          {\r
+            annotations[gapmap[j]] = new Annotation(preds[i].getCharAt(\r
+                j) + "", "", ' ', 0);\r
+          }\r
+        }\r
+\r
+        if (id.equals("JNETCONF"))\r
+        {\r
+          annot = new AlignmentAnnotation(preds[i].getName(),\r
+                                          "JNet Output", annotations, 0f,\r
+                                          10f,\r
+                                          AlignmentAnnotation.BAR_GRAPH);\r
+        }\r
+        else\r
+        {\r
+          annot = new AlignmentAnnotation(preds[i].getName(),\r
+                                          "JNet Output", annotations);\r
+        }\r
+\r
+        if (seqRef != null)\r
+        {\r
+          annot.createSequenceMapping(seqRef, 1, true);\r
+          seqRef.addAlignmentAnnotation(annot);\r
+        }\r
+\r
+        al.addAnnotation(annot);\r
+        al.setAnnotationIndex(annot,\r
+                              al.getAlignmentAnnotation().\r
+                              length - existingAnnotations - 1);\r
+\r
+        if (noMsa)\r
+        {\r
+          al.deleteSequence(preds[i]);\r
+        }\r
+      }\r
+\r
+      i++;\r
+    }\r
+\r
+    //Hashtable scores = prediction.getScores();\r
+\r
+    /*  addFloatAnnotations(al, gapmap,  (Vector)scores.get("JNETPROPH"),\r
+                          "JnetpropH", "Jnet Helix Propensity", 0f,1f,1);\r
+\r
+      addFloatAnnotations(al, gapmap,  (Vector)scores.get("JNETPROPB"),\r
+     "JnetpropB", "Jnet Beta Sheet Propensity", 0f,1f,1);\r
+\r
+      addFloatAnnotations(al, gapmap,  (Vector)scores.get("JNETPROPC"),\r
+                          "JnetpropC", "Jnet Coil Propensity", 0f,1f,1);\r
+     */\r
+\r
+  }\r
+}\r
diff --git a/src/jalview/io/StockholmFile.java b/src/jalview/io/StockholmFile.java
new file mode 100644 (file)
index 0000000..fd5fd44
--- /dev/null
@@ -0,0 +1,409 @@
+/*\r
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2006 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
+ */\r
+/*\r
+ * This extension was written by Benjamin Schuster-Boeckler at sanger.ac.uk\r
+ */\r
+package jalview.io;\r
+import java.io.*;\r
+import java.util.*;\r
+import jalview.datamodel.*;\r
+import com.stevesoft.pat.*;\r
+//import org.apache.log4j.*;\r
+\r
+/**\r
+ * This class is supposed to parse a Stockholm format file into Jalview\r
+ * @author bsb at sanger.ac.uk\r
+ * @version 0.3\r
+ */\r
+public class StockholmFile extends AlignFile\r
+{\r
+        //static Logger logger = Logger.getLogger("jalview.io.StockholmFile");\r
+\r
+    public StockholmFile()\r
+    {\r
+    }\r
+\r
+\r
+    public StockholmFile(String inFile, String type) throws IOException\r
+    {\r
+        super(inFile, type);\r
+    }\r
+\r
+    public void initData()\r
+    {\r
+         super.initData();\r
+    }\r
+\r
+    /**\r
+     * Parse a file in Stockholm format into Jalview's data model. The file has\r
+     * to be passed at construction time\r
+     * @throws IOException If there is an error with the input file\r
+     */\r
+    public void parse() throws IOException\r
+    {\r
+        // --------------- Variable Definitions -------------------\r
+        String line;\r
+        String version;\r
+      //  String id;\r
+        Hashtable alAnn = new Hashtable(); // Alignment wide annotations\r
+        Hashtable seqAnn = new Hashtable(); // Sequence related annotations\r
+        Hashtable seqs = new Hashtable();\r
+        Regex p, r, rend, s, x;\r
+\r
+        // ------------------ Parsing File ----------------------\r
+        // First, we have to check that this file has STOCKHOLM format, i.e. the first line must match\r
+        r = new Regex("# STOCKHOLM ([\\d\\.]+)");\r
+        if(!r.search(nextLine()))\r
+        {\r
+            throw new IOException("This file is not in valid STOCKHOLM format: First line does not contain '# STOCKHOLM'");\r
+        }\r
+        else\r
+        {\r
+            version = r.stringMatched(1);\r
+            //logger.debug("Stockholm version: " + version);\r
+        }\r
+\r
+//      We define some Regexes here that will be used regularily later\r
+        rend = new Regex("\\/\\/"); // Find the end of an alignment\r
+        p = new Regex("(\\S+)\\/(\\d+)\\-(\\d+)"); // split sequence id in id/from/to\r
+        s = new Regex("(\\S+)\\s+(\\w{2})\\s+(.*)"); // Parses annotation subtype\r
+        r = new Regex("#=(G[FSRC]?)\\s+(.*)"); // Finds any annotation line\r
+        x = new Regex("(\\S+)\\s+(\\S+)"); //split id from sequence\r
+\r
+        rend.optimize();\r
+        p.optimize();\r
+        s.optimize();\r
+        r.optimize();\r
+        x.optimize();\r
+\r
+        while ( (line = nextLine()) != null)\r
+        {\r
+            if (line.length() == 0) continue;\r
+            if(rend.search(line))\r
+            {\r
+//              End of the alignment, pass stuff back\r
+\r
+                 this.noSeqs = seqs.size();\r
+                //logger.debug("Number of sequences: " + this.noSeqs);\r
+                Enumeration accs = seqs.keys();\r
+                while (accs.hasMoreElements())\r
+                {\r
+                    String acc = (String) accs.nextElement();\r
+                    //logger.debug("Processing sequence " + acc);\r
+                    String seq = (String) seqs.get(acc);\r
+                    if (maxLength < seq.length())\r
+                    {\r
+                        maxLength = seq.length();\r
+                    }\r
+                    int start = 1;\r
+                    int end = -1;\r
+                    String sid = acc;\r
+                    // Split accession in id and from/to\r
+                    if (p.search(acc))\r
+                    {\r
+                        sid = p.stringMatched(1);\r
+                        start = Integer.parseInt(p.stringMatched(2));\r
+                        end = Integer.parseInt(p.stringMatched(3));\r
+                    }\r
+                    //logger.debug(sid + ", " + start + ", " + end);\r
+\r
+                    Sequence seqO = new Sequence(sid, seq, start, end);\r
+                    Hashtable features = null;\r
+                    // We need to adjust the positions of all features to account for gaps\r
+                    try\r
+                    {\r
+                         features = (Hashtable) ((Hashtable) seqAnn.get(acc)).get("features");\r
+                    }\r
+                    catch (java.lang.NullPointerException e)\r
+                    {\r
+                       //loggerwarn("Getting Features for " + acc + ": " + e.getMessage());\r
+                       //continue;\r
+                    }\r
+                    // if we have features\r
+                    if (features != null)\r
+                    {\r
+                        Enumeration i = features.keys();\r
+                        while(i.hasMoreElements())\r
+                        {\r
+                            String type = i.nextElement().toString();\r
+                            Hashtable content = (Hashtable) features.get(type);\r
+\r
+                            Enumeration j = content.keys();\r
+                            while(j.hasMoreElements())\r
+                            {\r
+                                        String desc = j.nextElement().toString();\r
+                                        String ns = content.get(desc).toString();\r
+                                        char[] byChar = ns.toCharArray();\r
+                                        for (int k = 0; k < byChar.length; k++)\r
+                                        {\r
+                                                char c = byChar[k];\r
+                                                if (! (c == ' ' || c == '_' ||\r
+                                                       c == '-'))\r
+                                                {\r
+                                                  int new_pos = seqO.findPosition(k);\r
+                                                  SequenceFeature feat =\r
+                                                      new SequenceFeature(type,\r
+                                                      desc, new_pos, new_pos, 0f, null);\r
+\r
+                                                  seqO.addSequenceFeature(feat);\r
+                                                }\r
+                                        }\r
+                                }\r
+\r
+                        }\r
+\r
+                    }\r
+                    //logger.debug("Adding seq " + acc + " from "  + start + " to " + end + ": " + seq);\r
+                    this.seqs.addElement(seqO);\r
+                }\r
+            }\r
+            else if (!r.search(line))\r
+            {\r
+                //System.err.println("Found sequence line: " + line);\r
+\r
+                // Split sequence in sequence and accession parts\r
+                if(!x.search(line))\r
+                {\r
+                                //logger.error("Could not parse sequence line: " + line);\r
+                                throw new IOException("Could not parse sequence line: " + line);\r
+                }\r
+                String ns  = (String) seqs.get(x.stringMatched(1));\r
+                if (ns == null) ns = "";\r
+                ns += x.stringMatched(2);\r
+\r
+                seqs.put(x.stringMatched(1), ns);\r
+            }\r
+            else\r
+            {\r
+                String annType = r.stringMatched(1);\r
+                String annContent = r.stringMatched(2);\r
+\r
+                //System.err.println("type:" + annType + " content: " + annContent);\r
+\r
+                if (annType.equals("GF"))\r
+                {\r
+                    /* Generic per-File annotation, free text\r
+                     * Magic features:\r
+                     * #=GF NH <tree in New Hampshire eXtended format>\r
+                     * #=GF TN <Unique identifier for the next tree>\r
+                     * Pfam descriptions:\r
+                        7. DESCRIPTION OF FIELDS\r
+\r
+                           Compulsory fields:\r
+                           ------------------\r
+\r
+                           AC   Accession number:           Accession number in form PFxxxxx.version or PBxxxxxx.\r
+                           ID   Identification:             One word name for family.\r
+                           DE   Definition:                 Short description of family.\r
+                           AU   Author:                     Authors of the entry.\r
+                           SE   Source of seed:             The source suggesting the seed members belong to one family.\r
+                           GA   Gathering method:           Search threshold to build the full alignment.\r
+                           TC   Trusted Cutoff:             Lowest sequence score and domain score of match in the full alignment.\r
+                           NC   Noise Cutoff:               Highest sequence score and domain score of match not in full alignment.\r
+                           TP   Type:                       Type of family -- presently Family, Domain, Motif or Repeat.\r
+                           SQ   Sequence:                   Number of sequences in alignment.\r
+                           AM   Alignment Method        The order ls and fs hits are aligned to the model to build the full align.\r
+                           //                               End of alignment.\r
+\r
+                           Optional fields:\r
+                           ----------------\r
+\r
+                           DC   Database Comment:           Comment about database reference.\r
+                           DR   Database Reference:         Reference to external database.\r
+                           RC   Reference Comment:          Comment about literature reference.\r
+                           RN   Reference Number:           Reference Number.\r
+                           RM   Reference Medline:          Eight digit medline UI number.\r
+                           RT   Reference Title:            Reference Title.\r
+                           RA   Reference Author:           Reference Author\r
+                           RL   Reference Location:         Journal location.\r
+                           PI   Previous identifier:        Record of all previous ID lines.\r
+                           KW   Keywords:                   Keywords.\r
+                           CC   Comment:                    Comments.\r
+                           NE   Pfam accession:         Indicates a nested domain.\r
+                           NL   Location:                   Location of nested domains - sequence ID, start and end of insert.\r
+\r
+                           Obsolete fields:\r
+                           -----------\r
+                           AL   Alignment method of seed:   The method used to align the seed members.\r
+                     */\r
+                    // Let's save the annotations, maybe we'll be able to do something with them later...\r
+                    Regex an = new Regex("(\\w+)\\s*(.*)");\r
+                    if (an.search(annContent)) alAnn.put(an.stringMatched(1), an.stringMatched(2));\r
+                }\r
+                else if(annType.equals("GS"))\r
+                {\r
+                    // Generic per-Sequence annotation, free text\r
+                    /* Pfam uses these features:\r
+                        Feature                    Description\r
+                        ---------------------      -----------\r
+                        AC <accession>             ACcession number\r
+                        DE <freetext>              DEscription\r
+                        DR <db>; <accession>;      Database Reference\r
+                        OS <organism>              OrganiSm (species)\r
+                        OC <clade>                 Organism Classification (clade, etc.)\r
+                        LO <look>                  Look (Color, etc.)\r
+                    */\r
+                    if (s.search(annContent))\r
+                    {\r
+                        String acc = s.stringMatched(1);\r
+                        String type = s.stringMatched(2);\r
+                        String content = s.stringMatched(3);\r
+\r
+                        Hashtable ann;\r
+                        if (seqAnn.containsKey(acc))\r
+                        {\r
+                            ann = (Hashtable) seqAnn.get(acc);\r
+                        }\r
+                        else\r
+                        {\r
+                            ann = new Hashtable();\r
+                        }\r
+                        ann.put(type, content);\r
+                        seqAnn.put(acc, ann);\r
+                    }\r
+                    else\r
+                    {\r
+                        throw new IOException("Error parsing " + line);\r
+                    }\r
+                }\r
+                else if(annType.equals("GC"))\r
+                {\r
+                  System.out.println(annContent);\r
+                    // Generic per-Column annotation, exactly 1 char per column\r
+                }\r
+                else if(annType.equals("GR"))\r
+                {\r
+                    // Generic per-Sequence AND per-Column markup, exactly 1 char per column\r
+                    /*\r
+                        Feature   Description            Markup letters\r
+                        -------   -----------            --------------\r
+                        SS        Secondary Structure    [HGIEBTSCX]\r
+                        SA        Surface Accessibility  [0-9X]\r
+                                      (0=0%-10%; ...; 9=90%-100%)\r
+                        TM        TransMembrane          [Mio]\r
+                        PP        Posterior Probability  [0-9*]\r
+                                      (0=0.00-0.05; 1=0.05-0.15; *=0.95-1.00)\r
+                        LI        LIgand binding         [*]\r
+                        AS        Active Site            [*]\r
+                        IN        INtron (in or after)   [0-2]\r
+                     */\r
+                    if (s.search(annContent))\r
+                    {\r
+                        String acc = s.stringMatched(1);\r
+                        String type = s.stringMatched(2);\r
+                        String seq = s.stringMatched(3);\r
+                        String description = new String();\r
+\r
+                        // Check for additional information about the current annotation\r
+                        if (x.search(seq))\r
+                        {\r
+                            description = x.stringMatched(1);\r
+                            seq = x.stringMatched(2);\r
+                        }\r
+                        // sequence id with from-to fields\r
+\r
+                        Hashtable ann;\r
+                        // Get an object with all the annotations for this sequence\r
+                        if (seqAnn.containsKey(acc))\r
+                        {\r
+                            //logger.debug("Found annotations for " + acc);\r
+                            ann = (Hashtable) seqAnn.get(acc);\r
+                        }\r
+                        else\r
+                        {\r
+                            //logger.debug("Creating new annotations holder for " + acc);\r
+                            ann = new Hashtable();\r
+                            seqAnn.put(acc, ann);\r
+                        }\r
+\r
+                        Hashtable features;\r
+                        // Get an object with all the content for an annotation\r
+                        if (ann.containsKey("features"))\r
+                        {\r
+                            //logger.debug("Found features for " + acc);\r
+                            features = (Hashtable) ann.get("features");\r
+                        }\r
+                        else\r
+                        {\r
+                            //logger.debug("Creating new features holder for " + acc);\r
+                            features = new Hashtable();\r
+                            ann.put("features", features);\r
+                        }\r
+\r
+                        Hashtable content;\r
+                        if (features.containsKey(this.id2type(type)))\r
+                        {\r
+                            //logger.debug("Found content for " + this.id2type(type));\r
+                            content = (Hashtable) features.get(this.id2type(type));\r
+                        }\r
+                        else\r
+                        {\r
+                            //logger.debug("Creating new content holder for " + this.id2type(type));\r
+                            content = new Hashtable();\r
+                            features.put(this.id2type(type), content);\r
+                        }\r
+                        String ns = (String) content.get(description);\r
+                        if (ns == null) ns = "";\r
+                        ns += seq;\r
+                        content.put(description, seq);\r
+                    }\r
+                    else\r
+                    {\r
+                        throw new IOException("Error parsing " + line);\r
+                    }\r
+                }\r
+                else\r
+                {\r
+                    throw new IOException("Unknown annotation detected: " + annType + " " + annContent);\r
+                }\r
+            }\r
+        }\r
+    }\r
+\r
+    public static String print(SequenceI[] s)\r
+    {\r
+        return "not yet implemented";\r
+    }\r
+\r
+    public String print()\r
+    {\r
+        return print(getSeqsAsArray());\r
+    }\r
+\r
+    private String id2type(String id)\r
+    {\r
+        // GR ids\r
+        if (id.equals("SS")) return "secondary structure";\r
+        else if (id.equals("SA")) return "surface accessibility";\r
+        else if (id.equals("TM")) return "transmembrane";\r
+        else if (id.equals("PP")) return "posterior probability";\r
+        else if (id.equals("LI")) return "ligand binding";\r
+        else if (id.equals("AS")) return "active site";\r
+        else if (id.equals("IN")) return "intron";\r
+        else if (id.equals("IR")) return "interacting residue";\r
+        // GS ids\r
+        else if (id.equals("AC")) return "accession";\r
+        else if (id.equals("OS")) return "organism";\r
+        else if (id.equals("CL")) return "class";\r
+        else if (id.equals("DE")) return "description";\r
+        else if (id.equals("DR")) return "reference";\r
+        else if (id.equals("LO")) return "look";\r
+        else return null;\r
+    }\r
+}\r
diff --git a/src/jalview/jbgui/GDasSourceBrowser.java b/src/jalview/jbgui/GDasSourceBrowser.java
new file mode 100755 (executable)
index 0000000..a3493d8
--- /dev/null
@@ -0,0 +1,210 @@
+/*\r
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2006 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
+ */\r
+package jalview.jbgui;\r
+\r
+import javax.swing.*;\r
+import javax.swing.border.TitledBorder;\r
+import java.awt.event.ActionListener;\r
+import java.awt.event.ActionEvent;\r
+import java.awt.*;\r
+import javax.swing.BorderFactory;\r
+import javax.swing.event.HyperlinkListener;\r
+import javax.swing.event.HyperlinkEvent;\r
+import java.awt.Dimension;\r
+import java.awt.Font;\r
+import java.awt.Insets;\r
+\r
+public class GDasSourceBrowser\r
+    extends JPanel\r
+{\r
+  public GDasSourceBrowser()\r
+  {\r
+    try\r
+    {\r
+      jbInit();\r
+    }\r
+    catch (Exception ex)\r
+    {\r
+      ex.printStackTrace();\r
+    }\r
+  }\r
+\r
+  private void jbInit()\r
+      throws Exception\r
+  {\r
+    this.setLayout(gridBagLayout1);\r
+    refresh.setText("Refresh Available Sources");\r
+    refresh.addActionListener(new ActionListener()\r
+    {\r
+      public void actionPerformed(ActionEvent e)\r
+      {\r
+        refresh_actionPerformed(e);\r
+      }\r
+    });\r
+    progressBar.setPreferredSize(new Dimension(450, 20));\r
+    progressBar.setString("");\r
+    scrollPane.setBorder(titledBorder1);\r
+    scrollPane.setBorder(BorderFactory.createEtchedBorder());\r
+    fullDetailsScrollpane.setBorder(BorderFactory.createEtchedBorder());\r
+    fullDetails.addHyperlinkListener(new HyperlinkListener()\r
+    {\r
+      public void hyperlinkUpdate(HyperlinkEvent e)\r
+      {\r
+        fullDetails_hyperlinkUpdate(e);\r
+      }\r
+    });\r
+    fullDetails.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));\r
+    fullDetails.setEditable(false);\r
+    registryLabel.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));\r
+    registryLabel.setHorizontalAlignment(SwingConstants.TRAILING);\r
+    registryLabel.setText("Use Registry");\r
+    addLocal.setText("Add Local Source");\r
+    addLocal.addActionListener(new ActionListener()\r
+    {\r
+      public void actionPerformed(ActionEvent e)\r
+      {\r
+        amendLocal(true);\r
+      }\r
+    });\r
+    jPanel1.setLayout(flowLayout1);\r
+    jPanel1.setMinimumSize(new Dimension(596, 30));\r
+    jPanel1.setPreferredSize(new Dimension(596, 30));\r
+    jScrollPane2.setBorder(titledBorder3);\r
+    jScrollPane3.setBorder(titledBorder4);\r
+    jScrollPane4.setBorder(titledBorder5);\r
+    titledBorder2.setTitleFont(new java.awt.Font("Verdana", Font.PLAIN, 10));\r
+    titledBorder3.setTitleFont(new java.awt.Font("Verdana", Font.PLAIN, 10));\r
+    titledBorder4.setTitleFont(new java.awt.Font("Verdana", Font.PLAIN, 10));\r
+    filter1.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));\r
+    filter2.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));\r
+    filter3.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));\r
+    table.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));\r
+    reset.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));\r
+    reset.setMargin(new Insets(2, 2, 2, 2));\r
+    reset.setText("Reset");\r
+    reset.addActionListener(new ActionListener()\r
+    {\r
+      public void actionPerformed(ActionEvent e)\r
+      {\r
+        reset_actionPerformed(e);\r
+      }\r
+    });\r
+    jPanel2.setLayout(borderLayout1);\r
+    borderLayout1.setHgap(5);\r
+    registryURL.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));\r
+    scrollPane.getViewport().add(table);\r
+    fullDetailsScrollpane.getViewport().add(fullDetails);\r
+    jScrollPane3.getViewport().add(filter2);\r
+    jScrollPane4.getViewport().add(filter3);\r
+    jPanel1.add(refresh, null);\r
+    jPanel1.add(addLocal, null);\r
+    jPanel1.add(progressBar, null);\r
+    jScrollPane2.getViewport().add(filter1);\r
+    this.add(jPanel1, new GridBagConstraints(0, 3, 3, 1, 1.0, 1.0\r
+                                             , GridBagConstraints.CENTER,\r
+                                             GridBagConstraints.HORIZONTAL,\r
+                                             new Insets(0, 0, 0, 0), 0, 0));\r
+    this.add(fullDetailsScrollpane, new GridBagConstraints(1, 0, 2, 1, 1.0, 1.0\r
+        , GridBagConstraints.CENTER, GridBagConstraints.BOTH,\r
+        new Insets(3, 0, 0, 3), 240, 130));\r
+    this.add(scrollPane, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0\r
+                                                , GridBagConstraints.CENTER,\r
+                                                GridBagConstraints.BOTH,\r
+                                                new Insets(3, 2, 0, 0), 150,\r
+                                                130));\r
+    jPanel2.add(registryLabel, java.awt.BorderLayout.WEST);\r
+    jPanel2.add(registryURL, java.awt.BorderLayout.CENTER);\r
+    jPanel2.add(reset, java.awt.BorderLayout.EAST);\r
+    this.add(jPanel2, new GridBagConstraints(0, 2, 3, 1, 0.0, 0.0\r
+                                             , GridBagConstraints.CENTER,\r
+                                             GridBagConstraints.HORIZONTAL,\r
+                                             new Insets(5, 10, 0, 10), 339, 0));\r
+    this.add(jScrollPane2, new GridBagConstraints(0, 1, 1, 1, 1.0, 1.0\r
+                                                  , GridBagConstraints.CENTER,\r
+                                                  GridBagConstraints.BOTH,\r
+                                                  new Insets(0, 0, 0, 60), 80,\r
+                                                  60));\r
+    this.add(jScrollPane4, new GridBagConstraints(2, 1, 1, 1, 1.0, 1.0\r
+                                                  , GridBagConstraints.CENTER,\r
+                                                  GridBagConstraints.BOTH,\r
+                                                  new Insets(0, -80, 0, 0), 80,\r
+                                                  60));\r
+    this.add(jScrollPane3, new GridBagConstraints(1, 1, 1, 1, 1.0, 1.0\r
+                                                  , GridBagConstraints.CENTER,\r
+                                                  GridBagConstraints.BOTH,\r
+                                                  new Insets(0, -60, 0, 80), 80,\r
+                                                  60));\r
+  }\r
+\r
+  protected JTable table = new JTable();\r
+  protected JEditorPane fullDetails = new JEditorPane("text/html", "");\r
+  TitledBorder titledBorder1 = new TitledBorder("Available DAS Sources");\r
+  protected JButton refresh = new JButton();\r
+  protected JProgressBar progressBar = new JProgressBar();\r
+  protected JScrollPane scrollPane = new JScrollPane();\r
+  TitledBorder titledBorder2 = new TitledBorder("Full Details");\r
+  protected JScrollPane fullDetailsScrollpane = new JScrollPane();\r
+  protected JList filter1 = new JList();\r
+  protected JList filter2 = new JList();\r
+  protected JList filter3 = new JList();\r
+  JScrollPane jScrollPane2 = new JScrollPane();\r
+  JScrollPane jScrollPane3 = new JScrollPane();\r
+  JScrollPane jScrollPane4 = new JScrollPane();\r
+  protected JTextField registryURL = new JTextField();\r
+  protected JLabel registryLabel = new JLabel();\r
+  protected JButton addLocal = new JButton();\r
+  JPanel jPanel1 = new JPanel();\r
+  FlowLayout flowLayout1 = new FlowLayout();\r
+  GridBagLayout gridBagLayout1 = new GridBagLayout();\r
+  TitledBorder titledBorder3 = new TitledBorder("Authority:");\r
+  TitledBorder titledBorder4 = new TitledBorder("Type:");\r
+  TitledBorder titledBorder5 = new TitledBorder("Label:");\r
+  JButton reset = new JButton();\r
+  JPanel jPanel2 = new JPanel();\r
+  BorderLayout borderLayout1 = new BorderLayout();\r
+  public void refresh_actionPerformed(ActionEvent e)\r
+  {\r
+\r
+  }\r
+\r
+  public void fullDetails_hyperlinkUpdate(HyperlinkEvent e)\r
+  {\r
+    try{\r
+\r
+      if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED)\r
+        jalview.util.BrowserLauncher.openURL(e.getURL().toString());\r
+    }\r
+    catch(Exception ex)\r
+    {\r
+      System.out.println(e.getURL());\r
+      ex.printStackTrace();\r
+    }\r
+  }\r
+\r
+  public void amendLocal(boolean newSource)\r
+  {\r
+\r
+  }\r
+\r
+  public void reset_actionPerformed(ActionEvent e)\r
+  {\r
+\r
+  }\r
+\r
+}\r
diff --git a/src/jalview/schemabinding/version2/Alignment.java b/src/jalview/schemabinding/version2/Alignment.java
new file mode 100755 (executable)
index 0000000..3b9d53b
--- /dev/null
@@ -0,0 +1,173 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package jalview.schemabinding.version2;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import java.io.IOException;\r
+import java.io.Reader;\r
+import java.io.Serializable;\r
+import java.io.Writer;\r
+import org.exolab.castor.xml.MarshalException;\r
+import org.exolab.castor.xml.Marshaller;\r
+import org.exolab.castor.xml.Unmarshaller;\r
+import org.exolab.castor.xml.ValidationException;\r
+import org.xml.sax.ContentHandler;\r
+\r
+/**\r
+ * Class Alignment.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class Alignment implements java.io.Serializable {\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * Field _annotation\r
+     */\r
+    private jalview.schemabinding.version2.Annotation _annotation;\r
+\r
+    /**\r
+     * Field _sequenceSet\r
+     */\r
+    private jalview.schemabinding.version2.SequenceSet _sequenceSet;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public Alignment() {\r
+        super();\r
+    } //-- jalview.schemabinding.version2.Alignment()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Returns the value of field 'annotation'.\r
+     * \r
+     * @return Annotation\r
+     * @return the value of field 'annotation'.\r
+     */\r
+    public jalview.schemabinding.version2.Annotation getAnnotation()\r
+    {\r
+        return this._annotation;\r
+    } //-- jalview.schemabinding.version2.Annotation getAnnotation() \r
+\r
+    /**\r
+     * Returns the value of field 'sequenceSet'.\r
+     * \r
+     * @return SequenceSet\r
+     * @return the value of field 'sequenceSet'.\r
+     */\r
+    public jalview.schemabinding.version2.SequenceSet getSequenceSet()\r
+    {\r
+        return this._sequenceSet;\r
+    } //-- jalview.schemabinding.version2.SequenceSet getSequenceSet() \r
+\r
+    /**\r
+     * Method isValid\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean isValid()\r
+    {\r
+        try {\r
+            validate();\r
+        }\r
+        catch (org.exolab.castor.xml.ValidationException vex) {\r
+            return false;\r
+        }\r
+        return true;\r
+    } //-- boolean isValid() \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param out\r
+     */\r
+    public void marshal(java.io.Writer out)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, out);\r
+    } //-- void marshal(java.io.Writer) \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param handler\r
+     */\r
+    public void marshal(org.xml.sax.ContentHandler handler)\r
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, handler);\r
+    } //-- void marshal(org.xml.sax.ContentHandler) \r
+\r
+    /**\r
+     * Sets the value of field 'annotation'.\r
+     * \r
+     * @param annotation the value of field 'annotation'.\r
+     */\r
+    public void setAnnotation(jalview.schemabinding.version2.Annotation annotation)\r
+    {\r
+        this._annotation = annotation;\r
+    } //-- void setAnnotation(jalview.schemabinding.version2.Annotation) \r
+\r
+    /**\r
+     * Sets the value of field 'sequenceSet'.\r
+     * \r
+     * @param sequenceSet the value of field 'sequenceSet'.\r
+     */\r
+    public void setSequenceSet(jalview.schemabinding.version2.SequenceSet sequenceSet)\r
+    {\r
+        this._sequenceSet = sequenceSet;\r
+    } //-- void setSequenceSet(jalview.schemabinding.version2.SequenceSet) \r
+\r
+    /**\r
+     * Method unmarshal\r
+     * \r
+     * \r
+     * \r
+     * @param reader\r
+     * @return Object\r
+     */\r
+    public static java.lang.Object unmarshal(java.io.Reader reader)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        return (jalview.schemabinding.version2.Alignment) Unmarshaller.unmarshal(jalview.schemabinding.version2.Alignment.class, reader);\r
+    } //-- java.lang.Object unmarshal(java.io.Reader) \r
+\r
+    /**\r
+     * Method validate\r
+     * \r
+     */\r
+    public void validate()\r
+        throws org.exolab.castor.xml.ValidationException\r
+    {\r
+        org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
+        validator.validate(this);\r
+    } //-- void validate() \r
+\r
+}\r
diff --git a/src/jalview/schemabinding/version2/AlignmentDescriptor.java b/src/jalview/schemabinding/version2/AlignmentDescriptor.java
new file mode 100755 (executable)
index 0000000..b285229
--- /dev/null
@@ -0,0 +1,243 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package jalview.schemabinding.version2;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import org.exolab.castor.mapping.AccessMode;\r
+import org.exolab.castor.xml.TypeValidator;\r
+import org.exolab.castor.xml.XMLFieldDescriptor;\r
+import org.exolab.castor.xml.validators.*;\r
+\r
+/**\r
+ * Class AlignmentDescriptor.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class AlignmentDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * Field nsPrefix\r
+     */\r
+    private java.lang.String nsPrefix;\r
+\r
+    /**\r
+     * Field nsURI\r
+     */\r
+    private java.lang.String nsURI;\r
+\r
+    /**\r
+     * Field xmlName\r
+     */\r
+    private java.lang.String xmlName;\r
+\r
+    /**\r
+     * Field identity\r
+     */\r
+    private org.exolab.castor.xml.XMLFieldDescriptor identity;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public AlignmentDescriptor() {\r
+        super();\r
+        nsURI = "www.vamsas.ac.uk/jalview/version2";\r
+        xmlName = "Alignment";\r
+        \r
+        //-- set grouping compositor\r
+        setCompositorAsSequence();\r
+        org.exolab.castor.xml.util.XMLFieldDescriptorImpl  desc           = null;\r
+        org.exolab.castor.xml.XMLFieldHandler              handler        = null;\r
+        org.exolab.castor.xml.FieldValidator               fieldValidator = null;\r
+        //-- initialize attribute descriptors\r
+        \r
+        //-- initialize element descriptors\r
+        \r
+        //-- _annotation\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(jalview.schemabinding.version2.Annotation.class, "_annotation", "Annotation", org.exolab.castor.xml.NodeType.Element);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Alignment target = (Alignment) object;\r
+                return target.getAnnotation();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Alignment target = (Alignment) object;\r
+                    target.setAnnotation( (jalview.schemabinding.version2.Annotation) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return new jalview.schemabinding.version2.Annotation();\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");\r
+        desc.setMultivalued(false);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _annotation\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _sequenceSet\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(jalview.schemabinding.version2.SequenceSet.class, "_sequenceSet", "SequenceSet", org.exolab.castor.xml.NodeType.Element);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Alignment target = (Alignment) object;\r
+                return target.getSequenceSet();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Alignment target = (Alignment) object;\r
+                    target.setSequenceSet( (jalview.schemabinding.version2.SequenceSet) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return new jalview.schemabinding.version2.SequenceSet();\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");\r
+        desc.setRequired(true);\r
+        desc.setMultivalued(false);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _sequenceSet\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        fieldValidator.setMinOccurs(1);\r
+        { //-- local scope\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+    } //-- jalview.schemabinding.version2.AlignmentDescriptor()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Method getAccessMode\r
+     * \r
+     * \r
+     * \r
+     * @return AccessMode\r
+     */\r
+    public org.exolab.castor.mapping.AccessMode getAccessMode()\r
+    {\r
+        return null;\r
+    } //-- org.exolab.castor.mapping.AccessMode getAccessMode() \r
+\r
+    /**\r
+     * Method getExtends\r
+     * \r
+     * \r
+     * \r
+     * @return ClassDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.ClassDescriptor getExtends()\r
+    {\r
+        return null;\r
+    } //-- org.exolab.castor.mapping.ClassDescriptor getExtends() \r
+\r
+    /**\r
+     * Method getIdentity\r
+     * \r
+     * \r
+     * \r
+     * @return FieldDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.FieldDescriptor getIdentity()\r
+    {\r
+        return identity;\r
+    } //-- org.exolab.castor.mapping.FieldDescriptor getIdentity() \r
+\r
+    /**\r
+     * Method getJavaClass\r
+     * \r
+     * \r
+     * \r
+     * @return Class\r
+     */\r
+    public java.lang.Class getJavaClass()\r
+    {\r
+        return jalview.schemabinding.version2.Alignment.class;\r
+    } //-- java.lang.Class getJavaClass() \r
+\r
+    /**\r
+     * Method getNameSpacePrefix\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpacePrefix()\r
+    {\r
+        return nsPrefix;\r
+    } //-- java.lang.String getNameSpacePrefix() \r
+\r
+    /**\r
+     * Method getNameSpaceURI\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpaceURI()\r
+    {\r
+        return nsURI;\r
+    } //-- java.lang.String getNameSpaceURI() \r
+\r
+    /**\r
+     * Method getValidator\r
+     * \r
+     * \r
+     * \r
+     * @return TypeValidator\r
+     */\r
+    public org.exolab.castor.xml.TypeValidator getValidator()\r
+    {\r
+        return this;\r
+    } //-- org.exolab.castor.xml.TypeValidator getValidator() \r
+\r
+    /**\r
+     * Method getXMLName\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getXMLName()\r
+    {\r
+        return xmlName;\r
+    } //-- java.lang.String getXMLName() \r
+\r
+}\r
diff --git a/src/jalview/schemabinding/version2/Annotation.java b/src/jalview/schemabinding/version2/Annotation.java
new file mode 100755 (executable)
index 0000000..ec9b84c
--- /dev/null
@@ -0,0 +1,590 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package jalview.schemabinding.version2;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import java.io.IOException;\r
+import java.io.Reader;\r
+import java.io.Serializable;\r
+import java.io.Writer;\r
+import java.util.Enumeration;\r
+import java.util.Vector;\r
+import org.exolab.castor.xml.MarshalException;\r
+import org.exolab.castor.xml.Marshaller;\r
+import org.exolab.castor.xml.Unmarshaller;\r
+import org.exolab.castor.xml.ValidationException;\r
+import org.xml.sax.ContentHandler;\r
+\r
+/**\r
+ * Class Annotation.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class Annotation implements java.io.Serializable {\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * Field _graph\r
+     */\r
+    private boolean _graph;\r
+\r
+    /**\r
+     * keeps track of state for field: _graph\r
+     */\r
+    private boolean _has_graph;\r
+\r
+    /**\r
+     * Field _graphType\r
+     */\r
+    private int _graphType;\r
+\r
+    /**\r
+     * keeps track of state for field: _graphType\r
+     */\r
+    private boolean _has_graphType;\r
+\r
+    /**\r
+     * Field _sequenceRef\r
+     */\r
+    private java.lang.String _sequenceRef;\r
+\r
+    /**\r
+     * Field _graphColour\r
+     */\r
+    private int _graphColour;\r
+\r
+    /**\r
+     * keeps track of state for field: _graphColour\r
+     */\r
+    private boolean _has_graphColour;\r
+\r
+    /**\r
+     * Field _graphGroup\r
+     */\r
+    private int _graphGroup;\r
+\r
+    /**\r
+     * keeps track of state for field: _graphGroup\r
+     */\r
+    private boolean _has_graphGroup;\r
+\r
+    /**\r
+     * Field _annotationElementList\r
+     */\r
+    private java.util.Vector _annotationElementList;\r
+\r
+    /**\r
+     * Field _label\r
+     */\r
+    private java.lang.String _label;\r
+\r
+    /**\r
+     * Field _description\r
+     */\r
+    private java.lang.String _description;\r
+\r
+    /**\r
+     * Field _thresholdLine\r
+     */\r
+    private jalview.schemabinding.version2.ThresholdLine _thresholdLine;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public Annotation() {\r
+        super();\r
+        _annotationElementList = new Vector();\r
+    } //-- jalview.schemabinding.version2.Annotation()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Method addAnnotationElement\r
+     * \r
+     * \r
+     * \r
+     * @param vAnnotationElement\r
+     */\r
+    public void addAnnotationElement(jalview.schemabinding.version2.AnnotationElement vAnnotationElement)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        _annotationElementList.addElement(vAnnotationElement);\r
+    } //-- void addAnnotationElement(jalview.schemabinding.version2.AnnotationElement) \r
+\r
+    /**\r
+     * Method addAnnotationElement\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @param vAnnotationElement\r
+     */\r
+    public void addAnnotationElement(int index, jalview.schemabinding.version2.AnnotationElement vAnnotationElement)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        _annotationElementList.insertElementAt(vAnnotationElement, index);\r
+    } //-- void addAnnotationElement(int, jalview.schemabinding.version2.AnnotationElement) \r
+\r
+    /**\r
+     * Method deleteGraph\r
+     * \r
+     */\r
+    public void deleteGraph()\r
+    {\r
+        this._has_graph= false;\r
+    } //-- void deleteGraph() \r
+\r
+    /**\r
+     * Method deleteGraphColour\r
+     * \r
+     */\r
+    public void deleteGraphColour()\r
+    {\r
+        this._has_graphColour= false;\r
+    } //-- void deleteGraphColour() \r
+\r
+    /**\r
+     * Method deleteGraphGroup\r
+     * \r
+     */\r
+    public void deleteGraphGroup()\r
+    {\r
+        this._has_graphGroup= false;\r
+    } //-- void deleteGraphGroup() \r
+\r
+    /**\r
+     * Method deleteGraphType\r
+     * \r
+     */\r
+    public void deleteGraphType()\r
+    {\r
+        this._has_graphType= false;\r
+    } //-- void deleteGraphType() \r
+\r
+    /**\r
+     * Method enumerateAnnotationElement\r
+     * \r
+     * \r
+     * \r
+     * @return Enumeration\r
+     */\r
+    public java.util.Enumeration enumerateAnnotationElement()\r
+    {\r
+        return _annotationElementList.elements();\r
+    } //-- java.util.Enumeration enumerateAnnotationElement() \r
+\r
+    /**\r
+     * Method getAnnotationElement\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @return AnnotationElement\r
+     */\r
+    public jalview.schemabinding.version2.AnnotationElement getAnnotationElement(int index)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        //-- check bounds for index\r
+        if ((index < 0) || (index > _annotationElementList.size())) {\r
+            throw new IndexOutOfBoundsException();\r
+        }\r
+        \r
+        return (jalview.schemabinding.version2.AnnotationElement) _annotationElementList.elementAt(index);\r
+    } //-- jalview.schemabinding.version2.AnnotationElement getAnnotationElement(int) \r
+\r
+    /**\r
+     * Method getAnnotationElement\r
+     * \r
+     * \r
+     * \r
+     * @return AnnotationElement\r
+     */\r
+    public jalview.schemabinding.version2.AnnotationElement[] getAnnotationElement()\r
+    {\r
+        int size = _annotationElementList.size();\r
+        jalview.schemabinding.version2.AnnotationElement[] mArray = new jalview.schemabinding.version2.AnnotationElement[size];\r
+        for (int index = 0; index < size; index++) {\r
+            mArray[index] = (jalview.schemabinding.version2.AnnotationElement) _annotationElementList.elementAt(index);\r
+        }\r
+        return mArray;\r
+    } //-- jalview.schemabinding.version2.AnnotationElement[] getAnnotationElement() \r
+\r
+    /**\r
+     * Method getAnnotationElementCount\r
+     * \r
+     * \r
+     * \r
+     * @return int\r
+     */\r
+    public int getAnnotationElementCount()\r
+    {\r
+        return _annotationElementList.size();\r
+    } //-- int getAnnotationElementCount() \r
+\r
+    /**\r
+     * Returns the value of field 'description'.\r
+     * \r
+     * @return String\r
+     * @return the value of field 'description'.\r
+     */\r
+    public java.lang.String getDescription()\r
+    {\r
+        return this._description;\r
+    } //-- java.lang.String getDescription() \r
+\r
+    /**\r
+     * Returns the value of field 'graph'.\r
+     * \r
+     * @return boolean\r
+     * @return the value of field 'graph'.\r
+     */\r
+    public boolean getGraph()\r
+    {\r
+        return this._graph;\r
+    } //-- boolean getGraph() \r
+\r
+    /**\r
+     * Returns the value of field 'graphColour'.\r
+     * \r
+     * @return int\r
+     * @return the value of field 'graphColour'.\r
+     */\r
+    public int getGraphColour()\r
+    {\r
+        return this._graphColour;\r
+    } //-- int getGraphColour() \r
+\r
+    /**\r
+     * Returns the value of field 'graphGroup'.\r
+     * \r
+     * @return int\r
+     * @return the value of field 'graphGroup'.\r
+     */\r
+    public int getGraphGroup()\r
+    {\r
+        return this._graphGroup;\r
+    } //-- int getGraphGroup() \r
+\r
+    /**\r
+     * Returns the value of field 'graphType'.\r
+     * \r
+     * @return int\r
+     * @return the value of field 'graphType'.\r
+     */\r
+    public int getGraphType()\r
+    {\r
+        return this._graphType;\r
+    } //-- int getGraphType() \r
+\r
+    /**\r
+     * Returns the value of field 'label'.\r
+     * \r
+     * @return String\r
+     * @return the value of field 'label'.\r
+     */\r
+    public java.lang.String getLabel()\r
+    {\r
+        return this._label;\r
+    } //-- java.lang.String getLabel() \r
+\r
+    /**\r
+     * Returns the value of field 'sequenceRef'.\r
+     * \r
+     * @return String\r
+     * @return the value of field 'sequenceRef'.\r
+     */\r
+    public java.lang.String getSequenceRef()\r
+    {\r
+        return this._sequenceRef;\r
+    } //-- java.lang.String getSequenceRef() \r
+\r
+    /**\r
+     * Returns the value of field 'thresholdLine'.\r
+     * \r
+     * @return ThresholdLine\r
+     * @return the value of field 'thresholdLine'.\r
+     */\r
+    public jalview.schemabinding.version2.ThresholdLine getThresholdLine()\r
+    {\r
+        return this._thresholdLine;\r
+    } //-- jalview.schemabinding.version2.ThresholdLine getThresholdLine() \r
+\r
+    /**\r
+     * Method hasGraph\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean hasGraph()\r
+    {\r
+        return this._has_graph;\r
+    } //-- boolean hasGraph() \r
+\r
+    /**\r
+     * Method hasGraphColour\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean hasGraphColour()\r
+    {\r
+        return this._has_graphColour;\r
+    } //-- boolean hasGraphColour() \r
+\r
+    /**\r
+     * Method hasGraphGroup\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean hasGraphGroup()\r
+    {\r
+        return this._has_graphGroup;\r
+    } //-- boolean hasGraphGroup() \r
+\r
+    /**\r
+     * Method hasGraphType\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean hasGraphType()\r
+    {\r
+        return this._has_graphType;\r
+    } //-- boolean hasGraphType() \r
+\r
+    /**\r
+     * Method isValid\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean isValid()\r
+    {\r
+        try {\r
+            validate();\r
+        }\r
+        catch (org.exolab.castor.xml.ValidationException vex) {\r
+            return false;\r
+        }\r
+        return true;\r
+    } //-- boolean isValid() \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param out\r
+     */\r
+    public void marshal(java.io.Writer out)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, out);\r
+    } //-- void marshal(java.io.Writer) \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param handler\r
+     */\r
+    public void marshal(org.xml.sax.ContentHandler handler)\r
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, handler);\r
+    } //-- void marshal(org.xml.sax.ContentHandler) \r
+\r
+    /**\r
+     * Method removeAllAnnotationElement\r
+     * \r
+     */\r
+    public void removeAllAnnotationElement()\r
+    {\r
+        _annotationElementList.removeAllElements();\r
+    } //-- void removeAllAnnotationElement() \r
+\r
+    /**\r
+     * Method removeAnnotationElement\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @return AnnotationElement\r
+     */\r
+    public jalview.schemabinding.version2.AnnotationElement removeAnnotationElement(int index)\r
+    {\r
+        java.lang.Object obj = _annotationElementList.elementAt(index);\r
+        _annotationElementList.removeElementAt(index);\r
+        return (jalview.schemabinding.version2.AnnotationElement) obj;\r
+    } //-- jalview.schemabinding.version2.AnnotationElement removeAnnotationElement(int) \r
+\r
+    /**\r
+     * Method setAnnotationElement\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @param vAnnotationElement\r
+     */\r
+    public void setAnnotationElement(int index, jalview.schemabinding.version2.AnnotationElement vAnnotationElement)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        //-- check bounds for index\r
+        if ((index < 0) || (index > _annotationElementList.size())) {\r
+            throw new IndexOutOfBoundsException();\r
+        }\r
+        _annotationElementList.setElementAt(vAnnotationElement, index);\r
+    } //-- void setAnnotationElement(int, jalview.schemabinding.version2.AnnotationElement) \r
+\r
+    /**\r
+     * Method setAnnotationElement\r
+     * \r
+     * \r
+     * \r
+     * @param annotationElementArray\r
+     */\r
+    public void setAnnotationElement(jalview.schemabinding.version2.AnnotationElement[] annotationElementArray)\r
+    {\r
+        //-- copy array\r
+        _annotationElementList.removeAllElements();\r
+        for (int i = 0; i < annotationElementArray.length; i++) {\r
+            _annotationElementList.addElement(annotationElementArray[i]);\r
+        }\r
+    } //-- void setAnnotationElement(jalview.schemabinding.version2.AnnotationElement) \r
+\r
+    /**\r
+     * Sets the value of field 'description'.\r
+     * \r
+     * @param description the value of field 'description'.\r
+     */\r
+    public void setDescription(java.lang.String description)\r
+    {\r
+        this._description = description;\r
+    } //-- void setDescription(java.lang.String) \r
+\r
+    /**\r
+     * Sets the value of field 'graph'.\r
+     * \r
+     * @param graph the value of field 'graph'.\r
+     */\r
+    public void setGraph(boolean graph)\r
+    {\r
+        this._graph = graph;\r
+        this._has_graph = true;\r
+    } //-- void setGraph(boolean) \r
+\r
+    /**\r
+     * Sets the value of field 'graphColour'.\r
+     * \r
+     * @param graphColour the value of field 'graphColour'.\r
+     */\r
+    public void setGraphColour(int graphColour)\r
+    {\r
+        this._graphColour = graphColour;\r
+        this._has_graphColour = true;\r
+    } //-- void setGraphColour(int) \r
+\r
+    /**\r
+     * Sets the value of field 'graphGroup'.\r
+     * \r
+     * @param graphGroup the value of field 'graphGroup'.\r
+     */\r
+    public void setGraphGroup(int graphGroup)\r
+    {\r
+        this._graphGroup = graphGroup;\r
+        this._has_graphGroup = true;\r
+    } //-- void setGraphGroup(int) \r
+\r
+    /**\r
+     * Sets the value of field 'graphType'.\r
+     * \r
+     * @param graphType the value of field 'graphType'.\r
+     */\r
+    public void setGraphType(int graphType)\r
+    {\r
+        this._graphType = graphType;\r
+        this._has_graphType = true;\r
+    } //-- void setGraphType(int) \r
+\r
+    /**\r
+     * Sets the value of field 'label'.\r
+     * \r
+     * @param label the value of field 'label'.\r
+     */\r
+    public void setLabel(java.lang.String label)\r
+    {\r
+        this._label = label;\r
+    } //-- void setLabel(java.lang.String) \r
+\r
+    /**\r
+     * Sets the value of field 'sequenceRef'.\r
+     * \r
+     * @param sequenceRef the value of field 'sequenceRef'.\r
+     */\r
+    public void setSequenceRef(java.lang.String sequenceRef)\r
+    {\r
+        this._sequenceRef = sequenceRef;\r
+    } //-- void setSequenceRef(java.lang.String) \r
+\r
+    /**\r
+     * Sets the value of field 'thresholdLine'.\r
+     * \r
+     * @param thresholdLine the value of field 'thresholdLine'.\r
+     */\r
+    public void setThresholdLine(jalview.schemabinding.version2.ThresholdLine thresholdLine)\r
+    {\r
+        this._thresholdLine = thresholdLine;\r
+    } //-- void setThresholdLine(jalview.schemabinding.version2.ThresholdLine) \r
+\r
+    /**\r
+     * Method unmarshal\r
+     * \r
+     * \r
+     * \r
+     * @param reader\r
+     * @return Object\r
+     */\r
+    public static java.lang.Object unmarshal(java.io.Reader reader)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        return (jalview.schemabinding.version2.Annotation) Unmarshaller.unmarshal(jalview.schemabinding.version2.Annotation.class, reader);\r
+    } //-- java.lang.Object unmarshal(java.io.Reader) \r
+\r
+    /**\r
+     * Method validate\r
+     * \r
+     */\r
+    public void validate()\r
+        throws org.exolab.castor.xml.ValidationException\r
+    {\r
+        org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
+        validator.validate(this);\r
+    } //-- void validate() \r
+\r
+}\r
diff --git a/src/jalview/schemabinding/version2/AnnotationColours.java b/src/jalview/schemabinding/version2/AnnotationColours.java
new file mode 100755 (executable)
index 0000000..b2af2c4
--- /dev/null
@@ -0,0 +1,385 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package jalview.schemabinding.version2;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import java.io.IOException;\r
+import java.io.Reader;\r
+import java.io.Serializable;\r
+import java.io.Writer;\r
+import org.exolab.castor.xml.MarshalException;\r
+import org.exolab.castor.xml.Marshaller;\r
+import org.exolab.castor.xml.Unmarshaller;\r
+import org.exolab.castor.xml.ValidationException;\r
+import org.xml.sax.ContentHandler;\r
+\r
+/**\r
+ * Class AnnotationColours.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class AnnotationColours implements java.io.Serializable {\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * Field _aboveThreshold\r
+     */\r
+    private int _aboveThreshold;\r
+\r
+    /**\r
+     * keeps track of state for field: _aboveThreshold\r
+     */\r
+    private boolean _has_aboveThreshold;\r
+\r
+    /**\r
+     * Field _annotation\r
+     */\r
+    private java.lang.String _annotation;\r
+\r
+    /**\r
+     * Field _minColour\r
+     */\r
+    private int _minColour;\r
+\r
+    /**\r
+     * keeps track of state for field: _minColour\r
+     */\r
+    private boolean _has_minColour;\r
+\r
+    /**\r
+     * Field _maxColour\r
+     */\r
+    private int _maxColour;\r
+\r
+    /**\r
+     * keeps track of state for field: _maxColour\r
+     */\r
+    private boolean _has_maxColour;\r
+\r
+    /**\r
+     * Field _colourScheme\r
+     */\r
+    private java.lang.String _colourScheme;\r
+\r
+    /**\r
+     * Field _threshold\r
+     */\r
+    private float _threshold;\r
+\r
+    /**\r
+     * keeps track of state for field: _threshold\r
+     */\r
+    private boolean _has_threshold;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public AnnotationColours() {\r
+        super();\r
+    } //-- jalview.schemabinding.version2.AnnotationColours()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Method deleteAboveThreshold\r
+     * \r
+     */\r
+    public void deleteAboveThreshold()\r
+    {\r
+        this._has_aboveThreshold= false;\r
+    } //-- void deleteAboveThreshold() \r
+\r
+    /**\r
+     * Method deleteMaxColour\r
+     * \r
+     */\r
+    public void deleteMaxColour()\r
+    {\r
+        this._has_maxColour= false;\r
+    } //-- void deleteMaxColour() \r
+\r
+    /**\r
+     * Method deleteMinColour\r
+     * \r
+     */\r
+    public void deleteMinColour()\r
+    {\r
+        this._has_minColour= false;\r
+    } //-- void deleteMinColour() \r
+\r
+    /**\r
+     * Method deleteThreshold\r
+     * \r
+     */\r
+    public void deleteThreshold()\r
+    {\r
+        this._has_threshold= false;\r
+    } //-- void deleteThreshold() \r
+\r
+    /**\r
+     * Returns the value of field 'aboveThreshold'.\r
+     * \r
+     * @return int\r
+     * @return the value of field 'aboveThreshold'.\r
+     */\r
+    public int getAboveThreshold()\r
+    {\r
+        return this._aboveThreshold;\r
+    } //-- int getAboveThreshold() \r
+\r
+    /**\r
+     * Returns the value of field 'annotation'.\r
+     * \r
+     * @return String\r
+     * @return the value of field 'annotation'.\r
+     */\r
+    public java.lang.String getAnnotation()\r
+    {\r
+        return this._annotation;\r
+    } //-- java.lang.String getAnnotation() \r
+\r
+    /**\r
+     * Returns the value of field 'colourScheme'.\r
+     * \r
+     * @return String\r
+     * @return the value of field 'colourScheme'.\r
+     */\r
+    public java.lang.String getColourScheme()\r
+    {\r
+        return this._colourScheme;\r
+    } //-- java.lang.String getColourScheme() \r
+\r
+    /**\r
+     * Returns the value of field 'maxColour'.\r
+     * \r
+     * @return int\r
+     * @return the value of field 'maxColour'.\r
+     */\r
+    public int getMaxColour()\r
+    {\r
+        return this._maxColour;\r
+    } //-- int getMaxColour() \r
+\r
+    /**\r
+     * Returns the value of field 'minColour'.\r
+     * \r
+     * @return int\r
+     * @return the value of field 'minColour'.\r
+     */\r
+    public int getMinColour()\r
+    {\r
+        return this._minColour;\r
+    } //-- int getMinColour() \r
+\r
+    /**\r
+     * Returns the value of field 'threshold'.\r
+     * \r
+     * @return float\r
+     * @return the value of field 'threshold'.\r
+     */\r
+    public float getThreshold()\r
+    {\r
+        return this._threshold;\r
+    } //-- float getThreshold() \r
+\r
+    /**\r
+     * Method hasAboveThreshold\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean hasAboveThreshold()\r
+    {\r
+        return this._has_aboveThreshold;\r
+    } //-- boolean hasAboveThreshold() \r
+\r
+    /**\r
+     * Method hasMaxColour\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean hasMaxColour()\r
+    {\r
+        return this._has_maxColour;\r
+    } //-- boolean hasMaxColour() \r
+\r
+    /**\r
+     * Method hasMinColour\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean hasMinColour()\r
+    {\r
+        return this._has_minColour;\r
+    } //-- boolean hasMinColour() \r
+\r
+    /**\r
+     * Method hasThreshold\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean hasThreshold()\r
+    {\r
+        return this._has_threshold;\r
+    } //-- boolean hasThreshold() \r
+\r
+    /**\r
+     * Method isValid\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean isValid()\r
+    {\r
+        try {\r
+            validate();\r
+        }\r
+        catch (org.exolab.castor.xml.ValidationException vex) {\r
+            return false;\r
+        }\r
+        return true;\r
+    } //-- boolean isValid() \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param out\r
+     */\r
+    public void marshal(java.io.Writer out)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, out);\r
+    } //-- void marshal(java.io.Writer) \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param handler\r
+     */\r
+    public void marshal(org.xml.sax.ContentHandler handler)\r
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, handler);\r
+    } //-- void marshal(org.xml.sax.ContentHandler) \r
+\r
+    /**\r
+     * Sets the value of field 'aboveThreshold'.\r
+     * \r
+     * @param aboveThreshold the value of field 'aboveThreshold'.\r
+     */\r
+    public void setAboveThreshold(int aboveThreshold)\r
+    {\r
+        this._aboveThreshold = aboveThreshold;\r
+        this._has_aboveThreshold = true;\r
+    } //-- void setAboveThreshold(int) \r
+\r
+    /**\r
+     * Sets the value of field 'annotation'.\r
+     * \r
+     * @param annotation the value of field 'annotation'.\r
+     */\r
+    public void setAnnotation(java.lang.String annotation)\r
+    {\r
+        this._annotation = annotation;\r
+    } //-- void setAnnotation(java.lang.String) \r
+\r
+    /**\r
+     * Sets the value of field 'colourScheme'.\r
+     * \r
+     * @param colourScheme the value of field 'colourScheme'.\r
+     */\r
+    public void setColourScheme(java.lang.String colourScheme)\r
+    {\r
+        this._colourScheme = colourScheme;\r
+    } //-- void setColourScheme(java.lang.String) \r
+\r
+    /**\r
+     * Sets the value of field 'maxColour'.\r
+     * \r
+     * @param maxColour the value of field 'maxColour'.\r
+     */\r
+    public void setMaxColour(int maxColour)\r
+    {\r
+        this._maxColour = maxColour;\r
+        this._has_maxColour = true;\r
+    } //-- void setMaxColour(int) \r
+\r
+    /**\r
+     * Sets the value of field 'minColour'.\r
+     * \r
+     * @param minColour the value of field 'minColour'.\r
+     */\r
+    public void setMinColour(int minColour)\r
+    {\r
+        this._minColour = minColour;\r
+        this._has_minColour = true;\r
+    } //-- void setMinColour(int) \r
+\r
+    /**\r
+     * Sets the value of field 'threshold'.\r
+     * \r
+     * @param threshold the value of field 'threshold'.\r
+     */\r
+    public void setThreshold(float threshold)\r
+    {\r
+        this._threshold = threshold;\r
+        this._has_threshold = true;\r
+    } //-- void setThreshold(float) \r
+\r
+    /**\r
+     * Method unmarshal\r
+     * \r
+     * \r
+     * \r
+     * @param reader\r
+     * @return Object\r
+     */\r
+    public static java.lang.Object unmarshal(java.io.Reader reader)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        return (jalview.schemabinding.version2.AnnotationColours) Unmarshaller.unmarshal(jalview.schemabinding.version2.AnnotationColours.class, reader);\r
+    } //-- java.lang.Object unmarshal(java.io.Reader) \r
+\r
+    /**\r
+     * Method validate\r
+     * \r
+     */\r
+    public void validate()\r
+        throws org.exolab.castor.xml.ValidationException\r
+    {\r
+        org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
+        validator.validate(this);\r
+    } //-- void validate() \r
+\r
+}\r
diff --git a/src/jalview/schemabinding/version2/AnnotationColoursDescriptor.java b/src/jalview/schemabinding/version2/AnnotationColoursDescriptor.java
new file mode 100755 (executable)
index 0000000..c3c06e6
--- /dev/null
@@ -0,0 +1,406 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package jalview.schemabinding.version2;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import org.exolab.castor.mapping.AccessMode;\r
+import org.exolab.castor.xml.TypeValidator;\r
+import org.exolab.castor.xml.XMLFieldDescriptor;\r
+import org.exolab.castor.xml.validators.*;\r
+\r
+/**\r
+ * Class AnnotationColoursDescriptor.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class AnnotationColoursDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * Field nsPrefix\r
+     */\r
+    private java.lang.String nsPrefix;\r
+\r
+    /**\r
+     * Field nsURI\r
+     */\r
+    private java.lang.String nsURI;\r
+\r
+    /**\r
+     * Field xmlName\r
+     */\r
+    private java.lang.String xmlName;\r
+\r
+    /**\r
+     * Field identity\r
+     */\r
+    private org.exolab.castor.xml.XMLFieldDescriptor identity;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public AnnotationColoursDescriptor() {\r
+        super();\r
+        nsURI = "www.jalview.org";\r
+        xmlName = "AnnotationColours";\r
+        org.exolab.castor.xml.util.XMLFieldDescriptorImpl  desc           = null;\r
+        org.exolab.castor.xml.XMLFieldHandler              handler        = null;\r
+        org.exolab.castor.xml.FieldValidator               fieldValidator = null;\r
+        //-- initialize attribute descriptors\r
+        \r
+        //-- _aboveThreshold\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_aboveThreshold", "aboveThreshold", org.exolab.castor.xml.NodeType.Attribute);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                AnnotationColours target = (AnnotationColours) object;\r
+                if(!target.hasAboveThreshold())\r
+                    return null;\r
+                return new java.lang.Integer(target.getAboveThreshold());\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    AnnotationColours target = (AnnotationColours) object;\r
+                    // if null, use delete method for optional primitives \r
+                    if (value == null) {\r
+                        target.deleteAboveThreshold();\r
+                        return;\r
+                    }\r
+                    target.setAboveThreshold( ((java.lang.Integer)value).intValue());\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _aboveThreshold\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            IntegerValidator typeValidator= new IntegerValidator();\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _annotation\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_annotation", "annotation", org.exolab.castor.xml.NodeType.Attribute);\r
+        desc.setImmutable(true);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                AnnotationColours target = (AnnotationColours) object;\r
+                return target.getAnnotation();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    AnnotationColours target = (AnnotationColours) object;\r
+                    target.setAnnotation( (java.lang.String) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _annotation\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            StringValidator typeValidator = new StringValidator();\r
+            typeValidator.setWhiteSpace("preserve");\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _minColour\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_minColour", "minColour", org.exolab.castor.xml.NodeType.Attribute);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                AnnotationColours target = (AnnotationColours) object;\r
+                if(!target.hasMinColour())\r
+                    return null;\r
+                return new java.lang.Integer(target.getMinColour());\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    AnnotationColours target = (AnnotationColours) object;\r
+                    // if null, use delete method for optional primitives \r
+                    if (value == null) {\r
+                        target.deleteMinColour();\r
+                        return;\r
+                    }\r
+                    target.setMinColour( ((java.lang.Integer)value).intValue());\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _minColour\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            IntegerValidator typeValidator= new IntegerValidator();\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _maxColour\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_maxColour", "maxColour", org.exolab.castor.xml.NodeType.Attribute);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                AnnotationColours target = (AnnotationColours) object;\r
+                if(!target.hasMaxColour())\r
+                    return null;\r
+                return new java.lang.Integer(target.getMaxColour());\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    AnnotationColours target = (AnnotationColours) object;\r
+                    // if null, use delete method for optional primitives \r
+                    if (value == null) {\r
+                        target.deleteMaxColour();\r
+                        return;\r
+                    }\r
+                    target.setMaxColour( ((java.lang.Integer)value).intValue());\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _maxColour\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            IntegerValidator typeValidator= new IntegerValidator();\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _colourScheme\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_colourScheme", "colourScheme", org.exolab.castor.xml.NodeType.Attribute);\r
+        desc.setImmutable(true);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                AnnotationColours target = (AnnotationColours) object;\r
+                return target.getColourScheme();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    AnnotationColours target = (AnnotationColours) object;\r
+                    target.setColourScheme( (java.lang.String) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _colourScheme\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            StringValidator typeValidator = new StringValidator();\r
+            typeValidator.setWhiteSpace("preserve");\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _threshold\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(float.class, "_threshold", "threshold", org.exolab.castor.xml.NodeType.Attribute);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                AnnotationColours target = (AnnotationColours) object;\r
+                if(!target.hasThreshold())\r
+                    return null;\r
+                return new java.lang.Float(target.getThreshold());\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    AnnotationColours target = (AnnotationColours) object;\r
+                    // if null, use delete method for optional primitives \r
+                    if (value == null) {\r
+                        target.deleteThreshold();\r
+                        return;\r
+                    }\r
+                    target.setThreshold( ((java.lang.Float)value).floatValue());\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _threshold\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            FloatValidator typeValidator = new FloatValidator();\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- initialize element descriptors\r
+        \r
+    } //-- jalview.schemabinding.version2.AnnotationColoursDescriptor()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Method getAccessMode\r
+     * \r
+     * \r
+     * \r
+     * @return AccessMode\r
+     */\r
+    public org.exolab.castor.mapping.AccessMode getAccessMode()\r
+    {\r
+        return null;\r
+    } //-- org.exolab.castor.mapping.AccessMode getAccessMode() \r
+\r
+    /**\r
+     * Method getExtends\r
+     * \r
+     * \r
+     * \r
+     * @return ClassDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.ClassDescriptor getExtends()\r
+    {\r
+        return null;\r
+    } //-- org.exolab.castor.mapping.ClassDescriptor getExtends() \r
+\r
+    /**\r
+     * Method getIdentity\r
+     * \r
+     * \r
+     * \r
+     * @return FieldDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.FieldDescriptor getIdentity()\r
+    {\r
+        return identity;\r
+    } //-- org.exolab.castor.mapping.FieldDescriptor getIdentity() \r
+\r
+    /**\r
+     * Method getJavaClass\r
+     * \r
+     * \r
+     * \r
+     * @return Class\r
+     */\r
+    public java.lang.Class getJavaClass()\r
+    {\r
+        return jalview.schemabinding.version2.AnnotationColours.class;\r
+    } //-- java.lang.Class getJavaClass() \r
+\r
+    /**\r
+     * Method getNameSpacePrefix\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpacePrefix()\r
+    {\r
+        return nsPrefix;\r
+    } //-- java.lang.String getNameSpacePrefix() \r
+\r
+    /**\r
+     * Method getNameSpaceURI\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpaceURI()\r
+    {\r
+        return nsURI;\r
+    } //-- java.lang.String getNameSpaceURI() \r
+\r
+    /**\r
+     * Method getValidator\r
+     * \r
+     * \r
+     * \r
+     * @return TypeValidator\r
+     */\r
+    public org.exolab.castor.xml.TypeValidator getValidator()\r
+    {\r
+        return this;\r
+    } //-- org.exolab.castor.xml.TypeValidator getValidator() \r
+\r
+    /**\r
+     * Method getXMLName\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getXMLName()\r
+    {\r
+        return xmlName;\r
+    } //-- java.lang.String getXMLName() \r
+\r
+}\r
diff --git a/src/jalview/schemabinding/version2/AnnotationDescriptor.java b/src/jalview/schemabinding/version2/AnnotationDescriptor.java
new file mode 100755 (executable)
index 0000000..b2290fe
--- /dev/null
@@ -0,0 +1,520 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package jalview.schemabinding.version2;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import org.exolab.castor.mapping.AccessMode;\r
+import org.exolab.castor.xml.TypeValidator;\r
+import org.exolab.castor.xml.XMLFieldDescriptor;\r
+import org.exolab.castor.xml.validators.*;\r
+\r
+/**\r
+ * Class AnnotationDescriptor.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class AnnotationDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * Field nsPrefix\r
+     */\r
+    private java.lang.String nsPrefix;\r
+\r
+    /**\r
+     * Field nsURI\r
+     */\r
+    private java.lang.String nsURI;\r
+\r
+    /**\r
+     * Field xmlName\r
+     */\r
+    private java.lang.String xmlName;\r
+\r
+    /**\r
+     * Field identity\r
+     */\r
+    private org.exolab.castor.xml.XMLFieldDescriptor identity;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public AnnotationDescriptor() {\r
+        super();\r
+        nsURI = "www.vamsas.ac.uk/jalview/version2";\r
+        xmlName = "Annotation";\r
+        \r
+        //-- set grouping compositor\r
+        setCompositorAsSequence();\r
+        org.exolab.castor.xml.util.XMLFieldDescriptorImpl  desc           = null;\r
+        org.exolab.castor.xml.XMLFieldHandler              handler        = null;\r
+        org.exolab.castor.xml.FieldValidator               fieldValidator = null;\r
+        //-- initialize attribute descriptors\r
+        \r
+        //-- _graph\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_graph", "graph", org.exolab.castor.xml.NodeType.Attribute);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Annotation target = (Annotation) object;\r
+                if(!target.hasGraph())\r
+                    return null;\r
+                return (target.getGraph() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Annotation target = (Annotation) object;\r
+                    // ignore null values for non optional primitives\r
+                    if (value == null) return;\r
+                    \r
+                    target.setGraph( ((java.lang.Boolean)value).booleanValue());\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        desc.setRequired(true);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _graph\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        fieldValidator.setMinOccurs(1);\r
+        { //-- local scope\r
+            BooleanValidator typeValidator = new BooleanValidator();\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _graphType\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_graphType", "graphType", org.exolab.castor.xml.NodeType.Attribute);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Annotation target = (Annotation) object;\r
+                if(!target.hasGraphType())\r
+                    return null;\r
+                return new java.lang.Integer(target.getGraphType());\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Annotation target = (Annotation) object;\r
+                    // if null, use delete method for optional primitives \r
+                    if (value == null) {\r
+                        target.deleteGraphType();\r
+                        return;\r
+                    }\r
+                    target.setGraphType( ((java.lang.Integer)value).intValue());\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _graphType\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            IntegerValidator typeValidator= new IntegerValidator();\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _sequenceRef\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_sequenceRef", "sequenceRef", org.exolab.castor.xml.NodeType.Attribute);\r
+        desc.setImmutable(true);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Annotation target = (Annotation) object;\r
+                return target.getSequenceRef();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Annotation target = (Annotation) object;\r
+                    target.setSequenceRef( (java.lang.String) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _sequenceRef\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            StringValidator typeValidator = new StringValidator();\r
+            typeValidator.setWhiteSpace("preserve");\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _graphColour\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_graphColour", "graphColour", org.exolab.castor.xml.NodeType.Attribute);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Annotation target = (Annotation) object;\r
+                if(!target.hasGraphColour())\r
+                    return null;\r
+                return new java.lang.Integer(target.getGraphColour());\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Annotation target = (Annotation) object;\r
+                    // if null, use delete method for optional primitives \r
+                    if (value == null) {\r
+                        target.deleteGraphColour();\r
+                        return;\r
+                    }\r
+                    target.setGraphColour( ((java.lang.Integer)value).intValue());\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _graphColour\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            IntegerValidator typeValidator= new IntegerValidator();\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _graphGroup\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_graphGroup", "graphGroup", org.exolab.castor.xml.NodeType.Attribute);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Annotation target = (Annotation) object;\r
+                if(!target.hasGraphGroup())\r
+                    return null;\r
+                return new java.lang.Integer(target.getGraphGroup());\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Annotation target = (Annotation) object;\r
+                    // if null, use delete method for optional primitives \r
+                    if (value == null) {\r
+                        target.deleteGraphGroup();\r
+                        return;\r
+                    }\r
+                    target.setGraphGroup( ((java.lang.Integer)value).intValue());\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _graphGroup\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            IntegerValidator typeValidator= new IntegerValidator();\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- initialize element descriptors\r
+        \r
+        //-- _annotationElementList\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(jalview.schemabinding.version2.AnnotationElement.class, "_annotationElementList", "annotationElement", org.exolab.castor.xml.NodeType.Element);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Annotation target = (Annotation) object;\r
+                return target.getAnnotationElement();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Annotation target = (Annotation) object;\r
+                    target.addAnnotationElement( (jalview.schemabinding.version2.AnnotationElement) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return new jalview.schemabinding.version2.AnnotationElement();\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");\r
+        desc.setMultivalued(true);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _annotationElementList\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        fieldValidator.setMinOccurs(0);\r
+        { //-- local scope\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _label\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_label", "label", org.exolab.castor.xml.NodeType.Element);\r
+        desc.setImmutable(true);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Annotation target = (Annotation) object;\r
+                return target.getLabel();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Annotation target = (Annotation) object;\r
+                    target.setLabel( (java.lang.String) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");\r
+        desc.setRequired(true);\r
+        desc.setMultivalued(false);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _label\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        fieldValidator.setMinOccurs(1);\r
+        { //-- local scope\r
+            StringValidator typeValidator = new StringValidator();\r
+            typeValidator.setWhiteSpace("preserve");\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _description\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_description", "description", org.exolab.castor.xml.NodeType.Element);\r
+        desc.setImmutable(true);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Annotation target = (Annotation) object;\r
+                return target.getDescription();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Annotation target = (Annotation) object;\r
+                    target.setDescription( (java.lang.String) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");\r
+        desc.setMultivalued(false);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _description\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            StringValidator typeValidator = new StringValidator();\r
+            typeValidator.setWhiteSpace("preserve");\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _thresholdLine\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(jalview.schemabinding.version2.ThresholdLine.class, "_thresholdLine", "thresholdLine", org.exolab.castor.xml.NodeType.Element);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Annotation target = (Annotation) object;\r
+                return target.getThresholdLine();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Annotation target = (Annotation) object;\r
+                    target.setThresholdLine( (jalview.schemabinding.version2.ThresholdLine) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return new jalview.schemabinding.version2.ThresholdLine();\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");\r
+        desc.setMultivalued(false);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _thresholdLine\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+    } //-- jalview.schemabinding.version2.AnnotationDescriptor()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Method getAccessMode\r
+     * \r
+     * \r
+     * \r
+     * @return AccessMode\r
+     */\r
+    public org.exolab.castor.mapping.AccessMode getAccessMode()\r
+    {\r
+        return null;\r
+    } //-- org.exolab.castor.mapping.AccessMode getAccessMode() \r
+\r
+    /**\r
+     * Method getExtends\r
+     * \r
+     * \r
+     * \r
+     * @return ClassDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.ClassDescriptor getExtends()\r
+    {\r
+        return null;\r
+    } //-- org.exolab.castor.mapping.ClassDescriptor getExtends() \r
+\r
+    /**\r
+     * Method getIdentity\r
+     * \r
+     * \r
+     * \r
+     * @return FieldDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.FieldDescriptor getIdentity()\r
+    {\r
+        return identity;\r
+    } //-- org.exolab.castor.mapping.FieldDescriptor getIdentity() \r
+\r
+    /**\r
+     * Method getJavaClass\r
+     * \r
+     * \r
+     * \r
+     * @return Class\r
+     */\r
+    public java.lang.Class getJavaClass()\r
+    {\r
+        return jalview.schemabinding.version2.Annotation.class;\r
+    } //-- java.lang.Class getJavaClass() \r
+\r
+    /**\r
+     * Method getNameSpacePrefix\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpacePrefix()\r
+    {\r
+        return nsPrefix;\r
+    } //-- java.lang.String getNameSpacePrefix() \r
+\r
+    /**\r
+     * Method getNameSpaceURI\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpaceURI()\r
+    {\r
+        return nsURI;\r
+    } //-- java.lang.String getNameSpaceURI() \r
+\r
+    /**\r
+     * Method getValidator\r
+     * \r
+     * \r
+     * \r
+     * @return TypeValidator\r
+     */\r
+    public org.exolab.castor.xml.TypeValidator getValidator()\r
+    {\r
+        return this;\r
+    } //-- org.exolab.castor.xml.TypeValidator getValidator() \r
+\r
+    /**\r
+     * Method getXMLName\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getXMLName()\r
+    {\r
+        return xmlName;\r
+    } //-- java.lang.String getXMLName() \r
+\r
+}\r
diff --git a/src/jalview/schemabinding/version2/AnnotationElement.java b/src/jalview/schemabinding/version2/AnnotationElement.java
new file mode 100755 (executable)
index 0000000..2507197
--- /dev/null
@@ -0,0 +1,359 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package jalview.schemabinding.version2;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import java.io.IOException;\r
+import java.io.Reader;\r
+import java.io.Serializable;\r
+import java.io.Writer;\r
+import org.exolab.castor.xml.MarshalException;\r
+import org.exolab.castor.xml.Marshaller;\r
+import org.exolab.castor.xml.Unmarshaller;\r
+import org.exolab.castor.xml.ValidationException;\r
+import org.xml.sax.ContentHandler;\r
+\r
+/**\r
+ * Class AnnotationElement.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class AnnotationElement implements java.io.Serializable {\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * Field _position\r
+     */\r
+    private int _position;\r
+\r
+    /**\r
+     * keeps track of state for field: _position\r
+     */\r
+    private boolean _has_position;\r
+\r
+    /**\r
+     * Field _colour\r
+     */\r
+    private int _colour;\r
+\r
+    /**\r
+     * keeps track of state for field: _colour\r
+     */\r
+    private boolean _has_colour;\r
+\r
+    /**\r
+     * Field _displayCharacter\r
+     */\r
+    private java.lang.String _displayCharacter;\r
+\r
+    /**\r
+     * Field _description\r
+     */\r
+    private java.lang.String _description;\r
+\r
+    /**\r
+     * Field _secondaryStructure\r
+     */\r
+    private java.lang.String _secondaryStructure;\r
+\r
+    /**\r
+     * Field _value\r
+     */\r
+    private float _value;\r
+\r
+    /**\r
+     * keeps track of state for field: _value\r
+     */\r
+    private boolean _has_value;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public AnnotationElement() {\r
+        super();\r
+    } //-- jalview.schemabinding.version2.AnnotationElement()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Method deleteColour\r
+     * \r
+     */\r
+    public void deleteColour()\r
+    {\r
+        this._has_colour= false;\r
+    } //-- void deleteColour() \r
+\r
+    /**\r
+     * Method deletePosition\r
+     * \r
+     */\r
+    public void deletePosition()\r
+    {\r
+        this._has_position= false;\r
+    } //-- void deletePosition() \r
+\r
+    /**\r
+     * Method deleteValue\r
+     * \r
+     */\r
+    public void deleteValue()\r
+    {\r
+        this._has_value= false;\r
+    } //-- void deleteValue() \r
+\r
+    /**\r
+     * Returns the value of field 'colour'.\r
+     * \r
+     * @return int\r
+     * @return the value of field 'colour'.\r
+     */\r
+    public int getColour()\r
+    {\r
+        return this._colour;\r
+    } //-- int getColour() \r
+\r
+    /**\r
+     * Returns the value of field 'description'.\r
+     * \r
+     * @return String\r
+     * @return the value of field 'description'.\r
+     */\r
+    public java.lang.String getDescription()\r
+    {\r
+        return this._description;\r
+    } //-- java.lang.String getDescription() \r
+\r
+    /**\r
+     * Returns the value of field 'displayCharacter'.\r
+     * \r
+     * @return String\r
+     * @return the value of field 'displayCharacter'.\r
+     */\r
+    public java.lang.String getDisplayCharacter()\r
+    {\r
+        return this._displayCharacter;\r
+    } //-- java.lang.String getDisplayCharacter() \r
+\r
+    /**\r
+     * Returns the value of field 'position'.\r
+     * \r
+     * @return int\r
+     * @return the value of field 'position'.\r
+     */\r
+    public int getPosition()\r
+    {\r
+        return this._position;\r
+    } //-- int getPosition() \r
+\r
+    /**\r
+     * Returns the value of field 'secondaryStructure'.\r
+     * \r
+     * @return String\r
+     * @return the value of field 'secondaryStructure'.\r
+     */\r
+    public java.lang.String getSecondaryStructure()\r
+    {\r
+        return this._secondaryStructure;\r
+    } //-- java.lang.String getSecondaryStructure() \r
+\r
+    /**\r
+     * Returns the value of field 'value'.\r
+     * \r
+     * @return float\r
+     * @return the value of field 'value'.\r
+     */\r
+    public float getValue()\r
+    {\r
+        return this._value;\r
+    } //-- float getValue() \r
+\r
+    /**\r
+     * Method hasColour\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean hasColour()\r
+    {\r
+        return this._has_colour;\r
+    } //-- boolean hasColour() \r
+\r
+    /**\r
+     * Method hasPosition\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean hasPosition()\r
+    {\r
+        return this._has_position;\r
+    } //-- boolean hasPosition() \r
+\r
+    /**\r
+     * Method hasValue\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean hasValue()\r
+    {\r
+        return this._has_value;\r
+    } //-- boolean hasValue() \r
+\r
+    /**\r
+     * Method isValid\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean isValid()\r
+    {\r
+        try {\r
+            validate();\r
+        }\r
+        catch (org.exolab.castor.xml.ValidationException vex) {\r
+            return false;\r
+        }\r
+        return true;\r
+    } //-- boolean isValid() \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param out\r
+     */\r
+    public void marshal(java.io.Writer out)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, out);\r
+    } //-- void marshal(java.io.Writer) \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param handler\r
+     */\r
+    public void marshal(org.xml.sax.ContentHandler handler)\r
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, handler);\r
+    } //-- void marshal(org.xml.sax.ContentHandler) \r
+\r
+    /**\r
+     * Sets the value of field 'colour'.\r
+     * \r
+     * @param colour the value of field 'colour'.\r
+     */\r
+    public void setColour(int colour)\r
+    {\r
+        this._colour = colour;\r
+        this._has_colour = true;\r
+    } //-- void setColour(int) \r
+\r
+    /**\r
+     * Sets the value of field 'description'.\r
+     * \r
+     * @param description the value of field 'description'.\r
+     */\r
+    public void setDescription(java.lang.String description)\r
+    {\r
+        this._description = description;\r
+    } //-- void setDescription(java.lang.String) \r
+\r
+    /**\r
+     * Sets the value of field 'displayCharacter'.\r
+     * \r
+     * @param displayCharacter the value of field 'displayCharacter'\r
+     */\r
+    public void setDisplayCharacter(java.lang.String displayCharacter)\r
+    {\r
+        this._displayCharacter = displayCharacter;\r
+    } //-- void setDisplayCharacter(java.lang.String) \r
+\r
+    /**\r
+     * Sets the value of field 'position'.\r
+     * \r
+     * @param position the value of field 'position'.\r
+     */\r
+    public void setPosition(int position)\r
+    {\r
+        this._position = position;\r
+        this._has_position = true;\r
+    } //-- void setPosition(int) \r
+\r
+    /**\r
+     * Sets the value of field 'secondaryStructure'.\r
+     * \r
+     * @param secondaryStructure the value of field\r
+     * 'secondaryStructure'.\r
+     */\r
+    public void setSecondaryStructure(java.lang.String secondaryStructure)\r
+    {\r
+        this._secondaryStructure = secondaryStructure;\r
+    } //-- void setSecondaryStructure(java.lang.String) \r
+\r
+    /**\r
+     * Sets the value of field 'value'.\r
+     * \r
+     * @param value the value of field 'value'.\r
+     */\r
+    public void setValue(float value)\r
+    {\r
+        this._value = value;\r
+        this._has_value = true;\r
+    } //-- void setValue(float) \r
+\r
+    /**\r
+     * Method unmarshal\r
+     * \r
+     * \r
+     * \r
+     * @param reader\r
+     * @return Object\r
+     */\r
+    public static java.lang.Object unmarshal(java.io.Reader reader)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        return (jalview.schemabinding.version2.AnnotationElement) Unmarshaller.unmarshal(jalview.schemabinding.version2.AnnotationElement.class, reader);\r
+    } //-- java.lang.Object unmarshal(java.io.Reader) \r
+\r
+    /**\r
+     * Method validate\r
+     * \r
+     */\r
+    public void validate()\r
+        throws org.exolab.castor.xml.ValidationException\r
+    {\r
+        org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
+        validator.validate(this);\r
+    } //-- void validate() \r
+\r
+}\r
diff --git a/src/jalview/schemabinding/version2/AnnotationElementDescriptor.java b/src/jalview/schemabinding/version2/AnnotationElementDescriptor.java
new file mode 100755 (executable)
index 0000000..0eab95b
--- /dev/null
@@ -0,0 +1,413 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package jalview.schemabinding.version2;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import org.exolab.castor.mapping.AccessMode;\r
+import org.exolab.castor.xml.TypeValidator;\r
+import org.exolab.castor.xml.XMLFieldDescriptor;\r
+import org.exolab.castor.xml.validators.*;\r
+\r
+/**\r
+ * Class AnnotationElementDescriptor.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class AnnotationElementDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * Field nsPrefix\r
+     */\r
+    private java.lang.String nsPrefix;\r
+\r
+    /**\r
+     * Field nsURI\r
+     */\r
+    private java.lang.String nsURI;\r
+\r
+    /**\r
+     * Field xmlName\r
+     */\r
+    private java.lang.String xmlName;\r
+\r
+    /**\r
+     * Field identity\r
+     */\r
+    private org.exolab.castor.xml.XMLFieldDescriptor identity;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public AnnotationElementDescriptor() {\r
+        super();\r
+        nsURI = "www.vamsas.ac.uk/jalview/version2";\r
+        xmlName = "annotationElement";\r
+        \r
+        //-- set grouping compositor\r
+        setCompositorAsSequence();\r
+        org.exolab.castor.xml.util.XMLFieldDescriptorImpl  desc           = null;\r
+        org.exolab.castor.xml.XMLFieldHandler              handler        = null;\r
+        org.exolab.castor.xml.FieldValidator               fieldValidator = null;\r
+        //-- initialize attribute descriptors\r
+        \r
+        //-- _position\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_position", "position", org.exolab.castor.xml.NodeType.Attribute);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                AnnotationElement target = (AnnotationElement) object;\r
+                if(!target.hasPosition())\r
+                    return null;\r
+                return new java.lang.Integer(target.getPosition());\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    AnnotationElement target = (AnnotationElement) object;\r
+                    // ignore null values for non optional primitives\r
+                    if (value == null) return;\r
+                    \r
+                    target.setPosition( ((java.lang.Integer)value).intValue());\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        desc.setRequired(true);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _position\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        fieldValidator.setMinOccurs(1);\r
+        { //-- local scope\r
+            IntegerValidator typeValidator= new IntegerValidator();\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _colour\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_colour", "colour", org.exolab.castor.xml.NodeType.Attribute);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                AnnotationElement target = (AnnotationElement) object;\r
+                if(!target.hasColour())\r
+                    return null;\r
+                return new java.lang.Integer(target.getColour());\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    AnnotationElement target = (AnnotationElement) object;\r
+                    // if null, use delete method for optional primitives \r
+                    if (value == null) {\r
+                        target.deleteColour();\r
+                        return;\r
+                    }\r
+                    target.setColour( ((java.lang.Integer)value).intValue());\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _colour\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            IntegerValidator typeValidator= new IntegerValidator();\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- initialize element descriptors\r
+        \r
+        //-- _displayCharacter\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_displayCharacter", "displayCharacter", org.exolab.castor.xml.NodeType.Element);\r
+        desc.setImmutable(true);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                AnnotationElement target = (AnnotationElement) object;\r
+                return target.getDisplayCharacter();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    AnnotationElement target = (AnnotationElement) object;\r
+                    target.setDisplayCharacter( (java.lang.String) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");\r
+        desc.setMultivalued(false);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _displayCharacter\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            StringValidator typeValidator = new StringValidator();\r
+            typeValidator.setWhiteSpace("preserve");\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _description\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_description", "description", org.exolab.castor.xml.NodeType.Element);\r
+        desc.setImmutable(true);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                AnnotationElement target = (AnnotationElement) object;\r
+                return target.getDescription();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    AnnotationElement target = (AnnotationElement) object;\r
+                    target.setDescription( (java.lang.String) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");\r
+        desc.setMultivalued(false);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _description\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            StringValidator typeValidator = new StringValidator();\r
+            typeValidator.setWhiteSpace("preserve");\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _secondaryStructure\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_secondaryStructure", "secondaryStructure", org.exolab.castor.xml.NodeType.Element);\r
+        desc.setImmutable(true);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                AnnotationElement target = (AnnotationElement) object;\r
+                return target.getSecondaryStructure();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    AnnotationElement target = (AnnotationElement) object;\r
+                    target.setSecondaryStructure( (java.lang.String) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");\r
+        desc.setMultivalued(false);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _secondaryStructure\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            StringValidator typeValidator = new StringValidator();\r
+            typeValidator.setLength(1);\r
+            typeValidator.setWhiteSpace("preserve");\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _value\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(float.class, "_value", "value", org.exolab.castor.xml.NodeType.Element);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                AnnotationElement target = (AnnotationElement) object;\r
+                if(!target.hasValue())\r
+                    return null;\r
+                return new java.lang.Float(target.getValue());\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    AnnotationElement target = (AnnotationElement) object;\r
+                    // if null, use delete method for optional primitives \r
+                    if (value == null) {\r
+                        target.deleteValue();\r
+                        return;\r
+                    }\r
+                    target.setValue( ((java.lang.Float)value).floatValue());\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");\r
+        desc.setMultivalued(false);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _value\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            FloatValidator typeValidator = new FloatValidator();\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+    } //-- jalview.schemabinding.version2.AnnotationElementDescriptor()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Method getAccessMode\r
+     * \r
+     * \r
+     * \r
+     * @return AccessMode\r
+     */\r
+    public org.exolab.castor.mapping.AccessMode getAccessMode()\r
+    {\r
+        return null;\r
+    } //-- org.exolab.castor.mapping.AccessMode getAccessMode() \r
+\r
+    /**\r
+     * Method getExtends\r
+     * \r
+     * \r
+     * \r
+     * @return ClassDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.ClassDescriptor getExtends()\r
+    {\r
+        return null;\r
+    } //-- org.exolab.castor.mapping.ClassDescriptor getExtends() \r
+\r
+    /**\r
+     * Method getIdentity\r
+     * \r
+     * \r
+     * \r
+     * @return FieldDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.FieldDescriptor getIdentity()\r
+    {\r
+        return identity;\r
+    } //-- org.exolab.castor.mapping.FieldDescriptor getIdentity() \r
+\r
+    /**\r
+     * Method getJavaClass\r
+     * \r
+     * \r
+     * \r
+     * @return Class\r
+     */\r
+    public java.lang.Class getJavaClass()\r
+    {\r
+        return jalview.schemabinding.version2.AnnotationElement.class;\r
+    } //-- java.lang.Class getJavaClass() \r
+\r
+    /**\r
+     * Method getNameSpacePrefix\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpacePrefix()\r
+    {\r
+        return nsPrefix;\r
+    } //-- java.lang.String getNameSpacePrefix() \r
+\r
+    /**\r
+     * Method getNameSpaceURI\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpaceURI()\r
+    {\r
+        return nsURI;\r
+    } //-- java.lang.String getNameSpaceURI() \r
+\r
+    /**\r
+     * Method getValidator\r
+     * \r
+     * \r
+     * \r
+     * @return TypeValidator\r
+     */\r
+    public org.exolab.castor.xml.TypeValidator getValidator()\r
+    {\r
+        return this;\r
+    } //-- org.exolab.castor.xml.TypeValidator getValidator() \r
+\r
+    /**\r
+     * Method getXMLName\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getXMLName()\r
+    {\r
+        return xmlName;\r
+    } //-- java.lang.String getXMLName() \r
+\r
+}\r
diff --git a/src/jalview/schemabinding/version2/Colour.java b/src/jalview/schemabinding/version2/Colour.java
new file mode 100755 (executable)
index 0000000..bcc4642
--- /dev/null
@@ -0,0 +1,173 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package jalview.schemabinding.version2;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import java.io.IOException;\r
+import java.io.Reader;\r
+import java.io.Serializable;\r
+import java.io.Writer;\r
+import org.exolab.castor.xml.MarshalException;\r
+import org.exolab.castor.xml.Marshaller;\r
+import org.exolab.castor.xml.Unmarshaller;\r
+import org.exolab.castor.xml.ValidationException;\r
+import org.xml.sax.ContentHandler;\r
+\r
+/**\r
+ * Class Colour.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class Colour implements java.io.Serializable {\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * Field _name\r
+     */\r
+    private java.lang.String _name;\r
+\r
+    /**\r
+     * Field _RGB\r
+     */\r
+    private java.lang.String _RGB;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public Colour() {\r
+        super();\r
+    } //-- jalview.schemabinding.version2.Colour()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Returns the value of field 'name'.\r
+     * \r
+     * @return String\r
+     * @return the value of field 'name'.\r
+     */\r
+    public java.lang.String getName()\r
+    {\r
+        return this._name;\r
+    } //-- java.lang.String getName() \r
+\r
+    /**\r
+     * Returns the value of field 'RGB'.\r
+     * \r
+     * @return String\r
+     * @return the value of field 'RGB'.\r
+     */\r
+    public java.lang.String getRGB()\r
+    {\r
+        return this._RGB;\r
+    } //-- java.lang.String getRGB() \r
+\r
+    /**\r
+     * Method isValid\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean isValid()\r
+    {\r
+        try {\r
+            validate();\r
+        }\r
+        catch (org.exolab.castor.xml.ValidationException vex) {\r
+            return false;\r
+        }\r
+        return true;\r
+    } //-- boolean isValid() \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param out\r
+     */\r
+    public void marshal(java.io.Writer out)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, out);\r
+    } //-- void marshal(java.io.Writer) \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param handler\r
+     */\r
+    public void marshal(org.xml.sax.ContentHandler handler)\r
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, handler);\r
+    } //-- void marshal(org.xml.sax.ContentHandler) \r
+\r
+    /**\r
+     * Sets the value of field 'name'.\r
+     * \r
+     * @param name the value of field 'name'.\r
+     */\r
+    public void setName(java.lang.String name)\r
+    {\r
+        this._name = name;\r
+    } //-- void setName(java.lang.String) \r
+\r
+    /**\r
+     * Sets the value of field 'RGB'.\r
+     * \r
+     * @param RGB the value of field 'RGB'.\r
+     */\r
+    public void setRGB(java.lang.String RGB)\r
+    {\r
+        this._RGB = RGB;\r
+    } //-- void setRGB(java.lang.String) \r
+\r
+    /**\r
+     * Method unmarshal\r
+     * \r
+     * \r
+     * \r
+     * @param reader\r
+     * @return Object\r
+     */\r
+    public static java.lang.Object unmarshal(java.io.Reader reader)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        return (jalview.schemabinding.version2.Colour) Unmarshaller.unmarshal(jalview.schemabinding.version2.Colour.class, reader);\r
+    } //-- java.lang.Object unmarshal(java.io.Reader) \r
+\r
+    /**\r
+     * Method validate\r
+     * \r
+     */\r
+    public void validate()\r
+        throws org.exolab.castor.xml.ValidationException\r
+    {\r
+        org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
+        validator.validate(this);\r
+    } //-- void validate() \r
+\r
+}\r
diff --git a/src/jalview/schemabinding/version2/ColourDescriptor.java b/src/jalview/schemabinding/version2/ColourDescriptor.java
new file mode 100755 (executable)
index 0000000..7aa3a82
--- /dev/null
@@ -0,0 +1,243 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package jalview.schemabinding.version2;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import org.exolab.castor.mapping.AccessMode;\r
+import org.exolab.castor.xml.TypeValidator;\r
+import org.exolab.castor.xml.XMLFieldDescriptor;\r
+import org.exolab.castor.xml.validators.*;\r
+\r
+/**\r
+ * Class ColourDescriptor.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class ColourDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * Field nsPrefix\r
+     */\r
+    private java.lang.String nsPrefix;\r
+\r
+    /**\r
+     * Field nsURI\r
+     */\r
+    private java.lang.String nsURI;\r
+\r
+    /**\r
+     * Field xmlName\r
+     */\r
+    private java.lang.String xmlName;\r
+\r
+    /**\r
+     * Field identity\r
+     */\r
+    private org.exolab.castor.xml.XMLFieldDescriptor identity;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public ColourDescriptor() {\r
+        super();\r
+        xmlName = "colour";\r
+        org.exolab.castor.xml.util.XMLFieldDescriptorImpl  desc           = null;\r
+        org.exolab.castor.xml.XMLFieldHandler              handler        = null;\r
+        org.exolab.castor.xml.FieldValidator               fieldValidator = null;\r
+        //-- initialize attribute descriptors\r
+        \r
+        //-- _name\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_name", "Name", org.exolab.castor.xml.NodeType.Attribute);\r
+        desc.setImmutable(true);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Colour target = (Colour) object;\r
+                return target.getName();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Colour target = (Colour) object;\r
+                    target.setName( (java.lang.String) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _name\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            StringValidator typeValidator = new StringValidator();\r
+            typeValidator.setWhiteSpace("preserve");\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _RGB\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_RGB", "RGB", org.exolab.castor.xml.NodeType.Attribute);\r
+        desc.setImmutable(true);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Colour target = (Colour) object;\r
+                return target.getRGB();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Colour target = (Colour) object;\r
+                    target.setRGB( (java.lang.String) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        desc.setRequired(true);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _RGB\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        fieldValidator.setMinOccurs(1);\r
+        { //-- local scope\r
+            StringValidator typeValidator = new StringValidator();\r
+            typeValidator.setWhiteSpace("preserve");\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- initialize element descriptors\r
+        \r
+    } //-- jalview.schemabinding.version2.ColourDescriptor()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Method getAccessMode\r
+     * \r
+     * \r
+     * \r
+     * @return AccessMode\r
+     */\r
+    public org.exolab.castor.mapping.AccessMode getAccessMode()\r
+    {\r
+        return null;\r
+    } //-- org.exolab.castor.mapping.AccessMode getAccessMode() \r
+\r
+    /**\r
+     * Method getExtends\r
+     * \r
+     * \r
+     * \r
+     * @return ClassDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.ClassDescriptor getExtends()\r
+    {\r
+        return null;\r
+    } //-- org.exolab.castor.mapping.ClassDescriptor getExtends() \r
+\r
+    /**\r
+     * Method getIdentity\r
+     * \r
+     * \r
+     * \r
+     * @return FieldDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.FieldDescriptor getIdentity()\r
+    {\r
+        return identity;\r
+    } //-- org.exolab.castor.mapping.FieldDescriptor getIdentity() \r
+\r
+    /**\r
+     * Method getJavaClass\r
+     * \r
+     * \r
+     * \r
+     * @return Class\r
+     */\r
+    public java.lang.Class getJavaClass()\r
+    {\r
+        return jalview.schemabinding.version2.Colour.class;\r
+    } //-- java.lang.Class getJavaClass() \r
+\r
+    /**\r
+     * Method getNameSpacePrefix\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpacePrefix()\r
+    {\r
+        return nsPrefix;\r
+    } //-- java.lang.String getNameSpacePrefix() \r
+\r
+    /**\r
+     * Method getNameSpaceURI\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpaceURI()\r
+    {\r
+        return nsURI;\r
+    } //-- java.lang.String getNameSpaceURI() \r
+\r
+    /**\r
+     * Method getValidator\r
+     * \r
+     * \r
+     * \r
+     * @return TypeValidator\r
+     */\r
+    public org.exolab.castor.xml.TypeValidator getValidator()\r
+    {\r
+        return this;\r
+    } //-- org.exolab.castor.xml.TypeValidator getValidator() \r
+\r
+    /**\r
+     * Method getXMLName\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getXMLName()\r
+    {\r
+        return xmlName;\r
+    } //-- java.lang.String getXMLName() \r
+\r
+}\r
diff --git a/src/jalview/schemabinding/version2/DBRef.java b/src/jalview/schemabinding/version2/DBRef.java
new file mode 100644 (file)
index 0000000..576a4ad
--- /dev/null
@@ -0,0 +1,199 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package jalview.schemabinding.version2;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import java.io.IOException;\r
+import java.io.Reader;\r
+import java.io.Serializable;\r
+import java.io.Writer;\r
+import org.exolab.castor.xml.MarshalException;\r
+import org.exolab.castor.xml.Marshaller;\r
+import org.exolab.castor.xml.Unmarshaller;\r
+import org.exolab.castor.xml.ValidationException;\r
+import org.xml.sax.ContentHandler;\r
+\r
+/**\r
+ * Class DBRef.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class DBRef implements java.io.Serializable {\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * Field _source\r
+     */\r
+    private java.lang.String _source;\r
+\r
+    /**\r
+     * Field _version\r
+     */\r
+    private java.lang.String _version;\r
+\r
+    /**\r
+     * Field _accessionId\r
+     */\r
+    private java.lang.String _accessionId;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public DBRef() {\r
+        super();\r
+    } //-- jalview.schemabinding.version2.DBRef()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Returns the value of field 'accessionId'.\r
+     * \r
+     * @return String\r
+     * @return the value of field 'accessionId'.\r
+     */\r
+    public java.lang.String getAccessionId()\r
+    {\r
+        return this._accessionId;\r
+    } //-- java.lang.String getAccessionId() \r
+\r
+    /**\r
+     * Returns the value of field 'source'.\r
+     * \r
+     * @return String\r
+     * @return the value of field 'source'.\r
+     */\r
+    public java.lang.String getSource()\r
+    {\r
+        return this._source;\r
+    } //-- java.lang.String getSource() \r
+\r
+    /**\r
+     * Returns the value of field 'version'.\r
+     * \r
+     * @return String\r
+     * @return the value of field 'version'.\r
+     */\r
+    public java.lang.String getVersion()\r
+    {\r
+        return this._version;\r
+    } //-- java.lang.String getVersion() \r
+\r
+    /**\r
+     * Method isValid\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean isValid()\r
+    {\r
+        try {\r
+            validate();\r
+        }\r
+        catch (org.exolab.castor.xml.ValidationException vex) {\r
+            return false;\r
+        }\r
+        return true;\r
+    } //-- boolean isValid() \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param out\r
+     */\r
+    public void marshal(java.io.Writer out)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, out);\r
+    } //-- void marshal(java.io.Writer) \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param handler\r
+     */\r
+    public void marshal(org.xml.sax.ContentHandler handler)\r
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, handler);\r
+    } //-- void marshal(org.xml.sax.ContentHandler) \r
+\r
+    /**\r
+     * Sets the value of field 'accessionId'.\r
+     * \r
+     * @param accessionId the value of field 'accessionId'.\r
+     */\r
+    public void setAccessionId(java.lang.String accessionId)\r
+    {\r
+        this._accessionId = accessionId;\r
+    } //-- void setAccessionId(java.lang.String) \r
+\r
+    /**\r
+     * Sets the value of field 'source'.\r
+     * \r
+     * @param source the value of field 'source'.\r
+     */\r
+    public void setSource(java.lang.String source)\r
+    {\r
+        this._source = source;\r
+    } //-- void setSource(java.lang.String) \r
+\r
+    /**\r
+     * Sets the value of field 'version'.\r
+     * \r
+     * @param version the value of field 'version'.\r
+     */\r
+    public void setVersion(java.lang.String version)\r
+    {\r
+        this._version = version;\r
+    } //-- void setVersion(java.lang.String) \r
+\r
+    /**\r
+     * Method unmarshal\r
+     * \r
+     * \r
+     * \r
+     * @param reader\r
+     * @return Object\r
+     */\r
+    public static java.lang.Object unmarshal(java.io.Reader reader)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        return (jalview.schemabinding.version2.DBRef) Unmarshaller.unmarshal(jalview.schemabinding.version2.DBRef.class, reader);\r
+    } //-- java.lang.Object unmarshal(java.io.Reader) \r
+\r
+    /**\r
+     * Method validate\r
+     * \r
+     */\r
+    public void validate()\r
+        throws org.exolab.castor.xml.ValidationException\r
+    {\r
+        org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
+        validator.validate(this);\r
+    } //-- void validate() \r
+\r
+}\r
diff --git a/src/jalview/schemabinding/version2/DBRefDescriptor.java b/src/jalview/schemabinding/version2/DBRefDescriptor.java
new file mode 100644 (file)
index 0000000..939d5b1
--- /dev/null
@@ -0,0 +1,278 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package jalview.schemabinding.version2;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import org.exolab.castor.mapping.AccessMode;\r
+import org.exolab.castor.xml.TypeValidator;\r
+import org.exolab.castor.xml.XMLFieldDescriptor;\r
+import org.exolab.castor.xml.validators.*;\r
+\r
+/**\r
+ * Class DBRefDescriptor.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class DBRefDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * Field nsPrefix\r
+     */\r
+    private java.lang.String nsPrefix;\r
+\r
+    /**\r
+     * Field nsURI\r
+     */\r
+    private java.lang.String nsURI;\r
+\r
+    /**\r
+     * Field xmlName\r
+     */\r
+    private java.lang.String xmlName;\r
+\r
+    /**\r
+     * Field identity\r
+     */\r
+    private org.exolab.castor.xml.XMLFieldDescriptor identity;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public DBRefDescriptor() {\r
+        super();\r
+        nsURI = "www.vamsas.ac.uk/jalview/version2";\r
+        xmlName = "DBRef";\r
+        org.exolab.castor.xml.util.XMLFieldDescriptorImpl  desc           = null;\r
+        org.exolab.castor.xml.XMLFieldHandler              handler        = null;\r
+        org.exolab.castor.xml.FieldValidator               fieldValidator = null;\r
+        //-- initialize attribute descriptors\r
+        \r
+        //-- _source\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_source", "source", org.exolab.castor.xml.NodeType.Attribute);\r
+        desc.setImmutable(true);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                DBRef target = (DBRef) object;\r
+                return target.getSource();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    DBRef target = (DBRef) object;\r
+                    target.setSource( (java.lang.String) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _source\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            StringValidator typeValidator = new StringValidator();\r
+            typeValidator.setWhiteSpace("preserve");\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _version\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_version", "version", org.exolab.castor.xml.NodeType.Attribute);\r
+        desc.setImmutable(true);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                DBRef target = (DBRef) object;\r
+                return target.getVersion();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    DBRef target = (DBRef) object;\r
+                    target.setVersion( (java.lang.String) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _version\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            StringValidator typeValidator = new StringValidator();\r
+            typeValidator.setWhiteSpace("preserve");\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _accessionId\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_accessionId", "accessionId", org.exolab.castor.xml.NodeType.Attribute);\r
+        desc.setImmutable(true);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                DBRef target = (DBRef) object;\r
+                return target.getAccessionId();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    DBRef target = (DBRef) object;\r
+                    target.setAccessionId( (java.lang.String) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _accessionId\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            StringValidator typeValidator = new StringValidator();\r
+            typeValidator.setWhiteSpace("preserve");\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- initialize element descriptors\r
+        \r
+    } //-- jalview.schemabinding.version2.DBRefDescriptor()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Method getAccessMode\r
+     * \r
+     * \r
+     * \r
+     * @return AccessMode\r
+     */\r
+    public org.exolab.castor.mapping.AccessMode getAccessMode()\r
+    {\r
+        return null;\r
+    } //-- org.exolab.castor.mapping.AccessMode getAccessMode() \r
+\r
+    /**\r
+     * Method getExtends\r
+     * \r
+     * \r
+     * \r
+     * @return ClassDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.ClassDescriptor getExtends()\r
+    {\r
+        return null;\r
+    } //-- org.exolab.castor.mapping.ClassDescriptor getExtends() \r
+\r
+    /**\r
+     * Method getIdentity\r
+     * \r
+     * \r
+     * \r
+     * @return FieldDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.FieldDescriptor getIdentity()\r
+    {\r
+        return identity;\r
+    } //-- org.exolab.castor.mapping.FieldDescriptor getIdentity() \r
+\r
+    /**\r
+     * Method getJavaClass\r
+     * \r
+     * \r
+     * \r
+     * @return Class\r
+     */\r
+    public java.lang.Class getJavaClass()\r
+    {\r
+        return jalview.schemabinding.version2.DBRef.class;\r
+    } //-- java.lang.Class getJavaClass() \r
+\r
+    /**\r
+     * Method getNameSpacePrefix\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpacePrefix()\r
+    {\r
+        return nsPrefix;\r
+    } //-- java.lang.String getNameSpacePrefix() \r
+\r
+    /**\r
+     * Method getNameSpaceURI\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpaceURI()\r
+    {\r
+        return nsURI;\r
+    } //-- java.lang.String getNameSpaceURI() \r
+\r
+    /**\r
+     * Method getValidator\r
+     * \r
+     * \r
+     * \r
+     * @return TypeValidator\r
+     */\r
+    public org.exolab.castor.xml.TypeValidator getValidator()\r
+    {\r
+        return this;\r
+    } //-- org.exolab.castor.xml.TypeValidator getValidator() \r
+\r
+    /**\r
+     * Method getXMLName\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getXMLName()\r
+    {\r
+        return xmlName;\r
+    } //-- java.lang.String getXMLName() \r
+\r
+}\r
diff --git a/src/jalview/schemabinding/version2/Feature.java b/src/jalview/schemabinding/version2/Feature.java
new file mode 100755 (executable)
index 0000000..305e287
--- /dev/null
@@ -0,0 +1,537 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package jalview.schemabinding.version2;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import java.io.IOException;\r
+import java.io.Reader;\r
+import java.io.Serializable;\r
+import java.io.Writer;\r
+import java.util.Enumeration;\r
+import java.util.Vector;\r
+import org.exolab.castor.xml.MarshalException;\r
+import org.exolab.castor.xml.Marshaller;\r
+import org.exolab.castor.xml.Unmarshaller;\r
+import org.exolab.castor.xml.ValidationException;\r
+import org.xml.sax.ContentHandler;\r
+\r
+/**\r
+ * Class Feature.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class Feature implements java.io.Serializable {\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * Field _begin\r
+     */\r
+    private int _begin;\r
+\r
+    /**\r
+     * keeps track of state for field: _begin\r
+     */\r
+    private boolean _has_begin;\r
+\r
+    /**\r
+     * Field _end\r
+     */\r
+    private int _end;\r
+\r
+    /**\r
+     * keeps track of state for field: _end\r
+     */\r
+    private boolean _has_end;\r
+\r
+    /**\r
+     * Field _type\r
+     */\r
+    private java.lang.String _type;\r
+\r
+    /**\r
+     * Field _description\r
+     */\r
+    private java.lang.String _description;\r
+\r
+    /**\r
+     * Field _status\r
+     */\r
+    private java.lang.String _status;\r
+\r
+    /**\r
+     * Field _featureGroup\r
+     */\r
+    private java.lang.String _featureGroup;\r
+\r
+    /**\r
+     * Field _score\r
+     */\r
+    private float _score;\r
+\r
+    /**\r
+     * keeps track of state for field: _score\r
+     */\r
+    private boolean _has_score;\r
+\r
+    /**\r
+     * Field _otherDataList\r
+     */\r
+    private java.util.Vector _otherDataList;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public Feature() {\r
+        super();\r
+        _otherDataList = new Vector();\r
+    } //-- jalview.schemabinding.version2.Feature()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Method addOtherData\r
+     * \r
+     * \r
+     * \r
+     * @param vOtherData\r
+     */\r
+    public void addOtherData(jalview.schemabinding.version2.OtherData vOtherData)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        _otherDataList.addElement(vOtherData);\r
+    } //-- void addOtherData(jalview.schemabinding.version2.OtherData) \r
+\r
+    /**\r
+     * Method addOtherData\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @param vOtherData\r
+     */\r
+    public void addOtherData(int index, jalview.schemabinding.version2.OtherData vOtherData)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        _otherDataList.insertElementAt(vOtherData, index);\r
+    } //-- void addOtherData(int, jalview.schemabinding.version2.OtherData) \r
+\r
+    /**\r
+     * Method deleteBegin\r
+     * \r
+     */\r
+    public void deleteBegin()\r
+    {\r
+        this._has_begin= false;\r
+    } //-- void deleteBegin() \r
+\r
+    /**\r
+     * Method deleteEnd\r
+     * \r
+     */\r
+    public void deleteEnd()\r
+    {\r
+        this._has_end= false;\r
+    } //-- void deleteEnd() \r
+\r
+    /**\r
+     * Method deleteScore\r
+     * \r
+     */\r
+    public void deleteScore()\r
+    {\r
+        this._has_score= false;\r
+    } //-- void deleteScore() \r
+\r
+    /**\r
+     * Method enumerateOtherData\r
+     * \r
+     * \r
+     * \r
+     * @return Enumeration\r
+     */\r
+    public java.util.Enumeration enumerateOtherData()\r
+    {\r
+        return _otherDataList.elements();\r
+    } //-- java.util.Enumeration enumerateOtherData() \r
+\r
+    /**\r
+     * Returns the value of field 'begin'.\r
+     * \r
+     * @return int\r
+     * @return the value of field 'begin'.\r
+     */\r
+    public int getBegin()\r
+    {\r
+        return this._begin;\r
+    } //-- int getBegin() \r
+\r
+    /**\r
+     * Returns the value of field 'description'.\r
+     * \r
+     * @return String\r
+     * @return the value of field 'description'.\r
+     */\r
+    public java.lang.String getDescription()\r
+    {\r
+        return this._description;\r
+    } //-- java.lang.String getDescription() \r
+\r
+    /**\r
+     * Returns the value of field 'end'.\r
+     * \r
+     * @return int\r
+     * @return the value of field 'end'.\r
+     */\r
+    public int getEnd()\r
+    {\r
+        return this._end;\r
+    } //-- int getEnd() \r
+\r
+    /**\r
+     * Returns the value of field 'featureGroup'.\r
+     * \r
+     * @return String\r
+     * @return the value of field 'featureGroup'.\r
+     */\r
+    public java.lang.String getFeatureGroup()\r
+    {\r
+        return this._featureGroup;\r
+    } //-- java.lang.String getFeatureGroup() \r
+\r
+    /**\r
+     * Method getOtherData\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @return OtherData\r
+     */\r
+    public jalview.schemabinding.version2.OtherData getOtherData(int index)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        //-- check bounds for index\r
+        if ((index < 0) || (index > _otherDataList.size())) {\r
+            throw new IndexOutOfBoundsException();\r
+        }\r
+        \r
+        return (jalview.schemabinding.version2.OtherData) _otherDataList.elementAt(index);\r
+    } //-- jalview.schemabinding.version2.OtherData getOtherData(int) \r
+\r
+    /**\r
+     * Method getOtherData\r
+     * \r
+     * \r
+     * \r
+     * @return OtherData\r
+     */\r
+    public jalview.schemabinding.version2.OtherData[] getOtherData()\r
+    {\r
+        int size = _otherDataList.size();\r
+        jalview.schemabinding.version2.OtherData[] mArray = new jalview.schemabinding.version2.OtherData[size];\r
+        for (int index = 0; index < size; index++) {\r
+            mArray[index] = (jalview.schemabinding.version2.OtherData) _otherDataList.elementAt(index);\r
+        }\r
+        return mArray;\r
+    } //-- jalview.schemabinding.version2.OtherData[] getOtherData() \r
+\r
+    /**\r
+     * Method getOtherDataCount\r
+     * \r
+     * \r
+     * \r
+     * @return int\r
+     */\r
+    public int getOtherDataCount()\r
+    {\r
+        return _otherDataList.size();\r
+    } //-- int getOtherDataCount() \r
+\r
+    /**\r
+     * Returns the value of field 'score'.\r
+     * \r
+     * @return float\r
+     * @return the value of field 'score'.\r
+     */\r
+    public float getScore()\r
+    {\r
+        return this._score;\r
+    } //-- float getScore() \r
+\r
+    /**\r
+     * Returns the value of field 'status'.\r
+     * \r
+     * @return String\r
+     * @return the value of field 'status'.\r
+     */\r
+    public java.lang.String getStatus()\r
+    {\r
+        return this._status;\r
+    } //-- java.lang.String getStatus() \r
+\r
+    /**\r
+     * Returns the value of field 'type'.\r
+     * \r
+     * @return String\r
+     * @return the value of field 'type'.\r
+     */\r
+    public java.lang.String getType()\r
+    {\r
+        return this._type;\r
+    } //-- java.lang.String getType() \r
+\r
+    /**\r
+     * Method hasBegin\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean hasBegin()\r
+    {\r
+        return this._has_begin;\r
+    } //-- boolean hasBegin() \r
+\r
+    /**\r
+     * Method hasEnd\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean hasEnd()\r
+    {\r
+        return this._has_end;\r
+    } //-- boolean hasEnd() \r
+\r
+    /**\r
+     * Method hasScore\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean hasScore()\r
+    {\r
+        return this._has_score;\r
+    } //-- boolean hasScore() \r
+\r
+    /**\r
+     * Method isValid\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean isValid()\r
+    {\r
+        try {\r
+            validate();\r
+        }\r
+        catch (org.exolab.castor.xml.ValidationException vex) {\r
+            return false;\r
+        }\r
+        return true;\r
+    } //-- boolean isValid() \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param out\r
+     */\r
+    public void marshal(java.io.Writer out)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, out);\r
+    } //-- void marshal(java.io.Writer) \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param handler\r
+     */\r
+    public void marshal(org.xml.sax.ContentHandler handler)\r
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, handler);\r
+    } //-- void marshal(org.xml.sax.ContentHandler) \r
+\r
+    /**\r
+     * Method removeAllOtherData\r
+     * \r
+     */\r
+    public void removeAllOtherData()\r
+    {\r
+        _otherDataList.removeAllElements();\r
+    } //-- void removeAllOtherData() \r
+\r
+    /**\r
+     * Method removeOtherData\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @return OtherData\r
+     */\r
+    public jalview.schemabinding.version2.OtherData removeOtherData(int index)\r
+    {\r
+        java.lang.Object obj = _otherDataList.elementAt(index);\r
+        _otherDataList.removeElementAt(index);\r
+        return (jalview.schemabinding.version2.OtherData) obj;\r
+    } //-- jalview.schemabinding.version2.OtherData removeOtherData(int) \r
+\r
+    /**\r
+     * Sets the value of field 'begin'.\r
+     * \r
+     * @param begin the value of field 'begin'.\r
+     */\r
+    public void setBegin(int begin)\r
+    {\r
+        this._begin = begin;\r
+        this._has_begin = true;\r
+    } //-- void setBegin(int) \r
+\r
+    /**\r
+     * Sets the value of field 'description'.\r
+     * \r
+     * @param description the value of field 'description'.\r
+     */\r
+    public void setDescription(java.lang.String description)\r
+    {\r
+        this._description = description;\r
+    } //-- void setDescription(java.lang.String) \r
+\r
+    /**\r
+     * Sets the value of field 'end'.\r
+     * \r
+     * @param end the value of field 'end'.\r
+     */\r
+    public void setEnd(int end)\r
+    {\r
+        this._end = end;\r
+        this._has_end = true;\r
+    } //-- void setEnd(int) \r
+\r
+    /**\r
+     * Sets the value of field 'featureGroup'.\r
+     * \r
+     * @param featureGroup the value of field 'featureGroup'.\r
+     */\r
+    public void setFeatureGroup(java.lang.String featureGroup)\r
+    {\r
+        this._featureGroup = featureGroup;\r
+    } //-- void setFeatureGroup(java.lang.String) \r
+\r
+    /**\r
+     * Method setOtherData\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @param vOtherData\r
+     */\r
+    public void setOtherData(int index, jalview.schemabinding.version2.OtherData vOtherData)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        //-- check bounds for index\r
+        if ((index < 0) || (index > _otherDataList.size())) {\r
+            throw new IndexOutOfBoundsException();\r
+        }\r
+        _otherDataList.setElementAt(vOtherData, index);\r
+    } //-- void setOtherData(int, jalview.schemabinding.version2.OtherData) \r
+\r
+    /**\r
+     * Method setOtherData\r
+     * \r
+     * \r
+     * \r
+     * @param otherDataArray\r
+     */\r
+    public void setOtherData(jalview.schemabinding.version2.OtherData[] otherDataArray)\r
+    {\r
+        //-- copy array\r
+        _otherDataList.removeAllElements();\r
+        for (int i = 0; i < otherDataArray.length; i++) {\r
+            _otherDataList.addElement(otherDataArray[i]);\r
+        }\r
+    } //-- void setOtherData(jalview.schemabinding.version2.OtherData) \r
+\r
+    /**\r
+     * Sets the value of field 'score'.\r
+     * \r
+     * @param score the value of field 'score'.\r
+     */\r
+    public void setScore(float score)\r
+    {\r
+        this._score = score;\r
+        this._has_score = true;\r
+    } //-- void setScore(float) \r
+\r
+    /**\r
+     * Sets the value of field 'status'.\r
+     * \r
+     * @param status the value of field 'status'.\r
+     */\r
+    public void setStatus(java.lang.String status)\r
+    {\r
+        this._status = status;\r
+    } //-- void setStatus(java.lang.String) \r
+\r
+    /**\r
+     * Sets the value of field 'type'.\r
+     * \r
+     * @param type the value of field 'type'.\r
+     */\r
+    public void setType(java.lang.String type)\r
+    {\r
+        this._type = type;\r
+    } //-- void setType(java.lang.String) \r
+\r
+    /**\r
+     * Method unmarshal\r
+     * \r
+     * \r
+     * \r
+     * @param reader\r
+     * @return Object\r
+     */\r
+    public static java.lang.Object unmarshal(java.io.Reader reader)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        return (jalview.schemabinding.version2.Feature) Unmarshaller.unmarshal(jalview.schemabinding.version2.Feature.class, reader);\r
+    } //-- java.lang.Object unmarshal(java.io.Reader) \r
+\r
+    /**\r
+     * Method validate\r
+     * \r
+     */\r
+    public void validate()\r
+        throws org.exolab.castor.xml.ValidationException\r
+    {\r
+        org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
+        validator.validate(this);\r
+    } //-- void validate() \r
+\r
+}\r
diff --git a/src/jalview/schemabinding/version2/FeatureDescriptor.java b/src/jalview/schemabinding/version2/FeatureDescriptor.java
new file mode 100755 (executable)
index 0000000..d0b9372
--- /dev/null
@@ -0,0 +1,477 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package jalview.schemabinding.version2;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import org.exolab.castor.mapping.AccessMode;\r
+import org.exolab.castor.xml.TypeValidator;\r
+import org.exolab.castor.xml.XMLFieldDescriptor;\r
+import org.exolab.castor.xml.validators.*;\r
+\r
+/**\r
+ * Class FeatureDescriptor.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class FeatureDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * Field nsPrefix\r
+     */\r
+    private java.lang.String nsPrefix;\r
+\r
+    /**\r
+     * Field nsURI\r
+     */\r
+    private java.lang.String nsURI;\r
+\r
+    /**\r
+     * Field xmlName\r
+     */\r
+    private java.lang.String xmlName;\r
+\r
+    /**\r
+     * Field identity\r
+     */\r
+    private org.exolab.castor.xml.XMLFieldDescriptor identity;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public FeatureDescriptor() {\r
+        super();\r
+        nsURI = "www.jalview.org";\r
+        xmlName = "feature";\r
+        \r
+        //-- set grouping compositor\r
+        setCompositorAsSequence();\r
+        org.exolab.castor.xml.util.XMLFieldDescriptorImpl  desc           = null;\r
+        org.exolab.castor.xml.XMLFieldHandler              handler        = null;\r
+        org.exolab.castor.xml.FieldValidator               fieldValidator = null;\r
+        //-- initialize attribute descriptors\r
+        \r
+        //-- _begin\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_begin", "begin", org.exolab.castor.xml.NodeType.Attribute);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Feature target = (Feature) object;\r
+                if(!target.hasBegin())\r
+                    return null;\r
+                return new java.lang.Integer(target.getBegin());\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Feature target = (Feature) object;\r
+                    // ignore null values for non optional primitives\r
+                    if (value == null) return;\r
+                    \r
+                    target.setBegin( ((java.lang.Integer)value).intValue());\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        desc.setRequired(true);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _begin\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        fieldValidator.setMinOccurs(1);\r
+        { //-- local scope\r
+            IntegerValidator typeValidator= new IntegerValidator();\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _end\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_end", "end", org.exolab.castor.xml.NodeType.Attribute);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Feature target = (Feature) object;\r
+                if(!target.hasEnd())\r
+                    return null;\r
+                return new java.lang.Integer(target.getEnd());\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Feature target = (Feature) object;\r
+                    // ignore null values for non optional primitives\r
+                    if (value == null) return;\r
+                    \r
+                    target.setEnd( ((java.lang.Integer)value).intValue());\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        desc.setRequired(true);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _end\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        fieldValidator.setMinOccurs(1);\r
+        { //-- local scope\r
+            IntegerValidator typeValidator= new IntegerValidator();\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _type\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_type", "type", org.exolab.castor.xml.NodeType.Attribute);\r
+        desc.setImmutable(true);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Feature target = (Feature) object;\r
+                return target.getType();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Feature target = (Feature) object;\r
+                    target.setType( (java.lang.String) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        desc.setRequired(true);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _type\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        fieldValidator.setMinOccurs(1);\r
+        { //-- local scope\r
+            StringValidator typeValidator = new StringValidator();\r
+            typeValidator.setWhiteSpace("preserve");\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _description\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_description", "description", org.exolab.castor.xml.NodeType.Attribute);\r
+        desc.setImmutable(true);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Feature target = (Feature) object;\r
+                return target.getDescription();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Feature target = (Feature) object;\r
+                    target.setDescription( (java.lang.String) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _description\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            StringValidator typeValidator = new StringValidator();\r
+            typeValidator.setWhiteSpace("preserve");\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _status\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_status", "status", org.exolab.castor.xml.NodeType.Attribute);\r
+        desc.setImmutable(true);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Feature target = (Feature) object;\r
+                return target.getStatus();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Feature target = (Feature) object;\r
+                    target.setStatus( (java.lang.String) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _status\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            StringValidator typeValidator = new StringValidator();\r
+            typeValidator.setWhiteSpace("preserve");\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _featureGroup\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_featureGroup", "featureGroup", org.exolab.castor.xml.NodeType.Attribute);\r
+        desc.setImmutable(true);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Feature target = (Feature) object;\r
+                return target.getFeatureGroup();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Feature target = (Feature) object;\r
+                    target.setFeatureGroup( (java.lang.String) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _featureGroup\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            StringValidator typeValidator = new StringValidator();\r
+            typeValidator.setWhiteSpace("preserve");\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _score\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(float.class, "_score", "score", org.exolab.castor.xml.NodeType.Attribute);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Feature target = (Feature) object;\r
+                if(!target.hasScore())\r
+                    return null;\r
+                return new java.lang.Float(target.getScore());\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Feature target = (Feature) object;\r
+                    // if null, use delete method for optional primitives \r
+                    if (value == null) {\r
+                        target.deleteScore();\r
+                        return;\r
+                    }\r
+                    target.setScore( ((java.lang.Float)value).floatValue());\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _score\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            FloatValidator typeValidator = new FloatValidator();\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- initialize element descriptors\r
+        \r
+        //-- _otherDataList\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(jalview.schemabinding.version2.OtherData.class, "_otherDataList", "otherData", org.exolab.castor.xml.NodeType.Element);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Feature target = (Feature) object;\r
+                return target.getOtherData();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Feature target = (Feature) object;\r
+                    target.addOtherData( (jalview.schemabinding.version2.OtherData) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return new jalview.schemabinding.version2.OtherData();\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        desc.setNameSpaceURI("www.jalview.org");\r
+        desc.setMultivalued(true);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _otherDataList\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        fieldValidator.setMinOccurs(0);\r
+        { //-- local scope\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+    } //-- jalview.schemabinding.version2.FeatureDescriptor()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Method getAccessMode\r
+     * \r
+     * \r
+     * \r
+     * @return AccessMode\r
+     */\r
+    public org.exolab.castor.mapping.AccessMode getAccessMode()\r
+    {\r
+        return null;\r
+    } //-- org.exolab.castor.mapping.AccessMode getAccessMode() \r
+\r
+    /**\r
+     * Method getExtends\r
+     * \r
+     * \r
+     * \r
+     * @return ClassDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.ClassDescriptor getExtends()\r
+    {\r
+        return null;\r
+    } //-- org.exolab.castor.mapping.ClassDescriptor getExtends() \r
+\r
+    /**\r
+     * Method getIdentity\r
+     * \r
+     * \r
+     * \r
+     * @return FieldDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.FieldDescriptor getIdentity()\r
+    {\r
+        return identity;\r
+    } //-- org.exolab.castor.mapping.FieldDescriptor getIdentity() \r
+\r
+    /**\r
+     * Method getJavaClass\r
+     * \r
+     * \r
+     * \r
+     * @return Class\r
+     */\r
+    public java.lang.Class getJavaClass()\r
+    {\r
+        return jalview.schemabinding.version2.Feature.class;\r
+    } //-- java.lang.Class getJavaClass() \r
+\r
+    /**\r
+     * Method getNameSpacePrefix\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpacePrefix()\r
+    {\r
+        return nsPrefix;\r
+    } //-- java.lang.String getNameSpacePrefix() \r
+\r
+    /**\r
+     * Method getNameSpaceURI\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpaceURI()\r
+    {\r
+        return nsURI;\r
+    } //-- java.lang.String getNameSpaceURI() \r
+\r
+    /**\r
+     * Method getValidator\r
+     * \r
+     * \r
+     * \r
+     * @return TypeValidator\r
+     */\r
+    public org.exolab.castor.xml.TypeValidator getValidator()\r
+    {\r
+        return this;\r
+    } //-- org.exolab.castor.xml.TypeValidator getValidator() \r
+\r
+    /**\r
+     * Method getXMLName\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getXMLName()\r
+    {\r
+        return xmlName;\r
+    } //-- java.lang.String getXMLName() \r
+\r
+}\r
diff --git a/src/jalview/schemabinding/version2/FeatureSettings.java b/src/jalview/schemabinding/version2/FeatureSettings.java
new file mode 100755 (executable)
index 0000000..c20a83c
--- /dev/null
@@ -0,0 +1,274 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package jalview.schemabinding.version2;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import java.io.IOException;\r
+import java.io.Reader;\r
+import java.io.Serializable;\r
+import java.io.Writer;\r
+import java.util.Enumeration;\r
+import java.util.Vector;\r
+import org.exolab.castor.xml.MarshalException;\r
+import org.exolab.castor.xml.Marshaller;\r
+import org.exolab.castor.xml.Unmarshaller;\r
+import org.exolab.castor.xml.ValidationException;\r
+import org.xml.sax.ContentHandler;\r
+\r
+/**\r
+ * Class FeatureSettings.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class FeatureSettings implements java.io.Serializable {\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * Field _settingList\r
+     */\r
+    private java.util.Vector _settingList;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public FeatureSettings() {\r
+        super();\r
+        _settingList = new Vector();\r
+    } //-- jalview.schemabinding.version2.FeatureSettings()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Method addSetting\r
+     * \r
+     * \r
+     * \r
+     * @param vSetting\r
+     */\r
+    public void addSetting(jalview.schemabinding.version2.Setting vSetting)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        _settingList.addElement(vSetting);\r
+    } //-- void addSetting(jalview.schemabinding.version2.Setting) \r
+\r
+    /**\r
+     * Method addSetting\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @param vSetting\r
+     */\r
+    public void addSetting(int index, jalview.schemabinding.version2.Setting vSetting)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        _settingList.insertElementAt(vSetting, index);\r
+    } //-- void addSetting(int, jalview.schemabinding.version2.Setting) \r
+\r
+    /**\r
+     * Method enumerateSetting\r
+     * \r
+     * \r
+     * \r
+     * @return Enumeration\r
+     */\r
+    public java.util.Enumeration enumerateSetting()\r
+    {\r
+        return _settingList.elements();\r
+    } //-- java.util.Enumeration enumerateSetting() \r
+\r
+    /**\r
+     * Method getSetting\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @return Setting\r
+     */\r
+    public jalview.schemabinding.version2.Setting getSetting(int index)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        //-- check bounds for index\r
+        if ((index < 0) || (index > _settingList.size())) {\r
+            throw new IndexOutOfBoundsException();\r
+        }\r
+        \r
+        return (jalview.schemabinding.version2.Setting) _settingList.elementAt(index);\r
+    } //-- jalview.schemabinding.version2.Setting getSetting(int) \r
+\r
+    /**\r
+     * Method getSetting\r
+     * \r
+     * \r
+     * \r
+     * @return Setting\r
+     */\r
+    public jalview.schemabinding.version2.Setting[] getSetting()\r
+    {\r
+        int size = _settingList.size();\r
+        jalview.schemabinding.version2.Setting[] mArray = new jalview.schemabinding.version2.Setting[size];\r
+        for (int index = 0; index < size; index++) {\r
+            mArray[index] = (jalview.schemabinding.version2.Setting) _settingList.elementAt(index);\r
+        }\r
+        return mArray;\r
+    } //-- jalview.schemabinding.version2.Setting[] getSetting() \r
+\r
+    /**\r
+     * Method getSettingCount\r
+     * \r
+     * \r
+     * \r
+     * @return int\r
+     */\r
+    public int getSettingCount()\r
+    {\r
+        return _settingList.size();\r
+    } //-- int getSettingCount() \r
+\r
+    /**\r
+     * Method isValid\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean isValid()\r
+    {\r
+        try {\r
+            validate();\r
+        }\r
+        catch (org.exolab.castor.xml.ValidationException vex) {\r
+            return false;\r
+        }\r
+        return true;\r
+    } //-- boolean isValid() \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param out\r
+     */\r
+    public void marshal(java.io.Writer out)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, out);\r
+    } //-- void marshal(java.io.Writer) \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param handler\r
+     */\r
+    public void marshal(org.xml.sax.ContentHandler handler)\r
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, handler);\r
+    } //-- void marshal(org.xml.sax.ContentHandler) \r
+\r
+    /**\r
+     * Method removeAllSetting\r
+     * \r
+     */\r
+    public void removeAllSetting()\r
+    {\r
+        _settingList.removeAllElements();\r
+    } //-- void removeAllSetting() \r
+\r
+    /**\r
+     * Method removeSetting\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @return Setting\r
+     */\r
+    public jalview.schemabinding.version2.Setting removeSetting(int index)\r
+    {\r
+        java.lang.Object obj = _settingList.elementAt(index);\r
+        _settingList.removeElementAt(index);\r
+        return (jalview.schemabinding.version2.Setting) obj;\r
+    } //-- jalview.schemabinding.version2.Setting removeSetting(int) \r
+\r
+    /**\r
+     * Method setSetting\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @param vSetting\r
+     */\r
+    public void setSetting(int index, jalview.schemabinding.version2.Setting vSetting)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        //-- check bounds for index\r
+        if ((index < 0) || (index > _settingList.size())) {\r
+            throw new IndexOutOfBoundsException();\r
+        }\r
+        _settingList.setElementAt(vSetting, index);\r
+    } //-- void setSetting(int, jalview.schemabinding.version2.Setting) \r
+\r
+    /**\r
+     * Method setSetting\r
+     * \r
+     * \r
+     * \r
+     * @param settingArray\r
+     */\r
+    public void setSetting(jalview.schemabinding.version2.Setting[] settingArray)\r
+    {\r
+        //-- copy array\r
+        _settingList.removeAllElements();\r
+        for (int i = 0; i < settingArray.length; i++) {\r
+            _settingList.addElement(settingArray[i]);\r
+        }\r
+    } //-- void setSetting(jalview.schemabinding.version2.Setting) \r
+\r
+    /**\r
+     * Method unmarshal\r
+     * \r
+     * \r
+     * \r
+     * @param reader\r
+     * @return Object\r
+     */\r
+    public static java.lang.Object unmarshal(java.io.Reader reader)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        return (jalview.schemabinding.version2.FeatureSettings) Unmarshaller.unmarshal(jalview.schemabinding.version2.FeatureSettings.class, reader);\r
+    } //-- java.lang.Object unmarshal(java.io.Reader) \r
+\r
+    /**\r
+     * Method validate\r
+     * \r
+     */\r
+    public void validate()\r
+        throws org.exolab.castor.xml.ValidationException\r
+    {\r
+        org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
+        validator.validate(this);\r
+    } //-- void validate() \r
+\r
+}\r
diff --git a/src/jalview/schemabinding/version2/FeatureSettingsDescriptor.java b/src/jalview/schemabinding/version2/FeatureSettingsDescriptor.java
new file mode 100755 (executable)
index 0000000..219037e
--- /dev/null
@@ -0,0 +1,208 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package jalview.schemabinding.version2;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import org.exolab.castor.mapping.AccessMode;\r
+import org.exolab.castor.xml.TypeValidator;\r
+import org.exolab.castor.xml.XMLFieldDescriptor;\r
+import org.exolab.castor.xml.validators.*;\r
+\r
+/**\r
+ * Class FeatureSettingsDescriptor.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class FeatureSettingsDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * Field nsPrefix\r
+     */\r
+    private java.lang.String nsPrefix;\r
+\r
+    /**\r
+     * Field nsURI\r
+     */\r
+    private java.lang.String nsURI;\r
+\r
+    /**\r
+     * Field xmlName\r
+     */\r
+    private java.lang.String xmlName;\r
+\r
+    /**\r
+     * Field identity\r
+     */\r
+    private org.exolab.castor.xml.XMLFieldDescriptor identity;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public FeatureSettingsDescriptor() {\r
+        super();\r
+        nsURI = "www.jalview.org";\r
+        xmlName = "FeatureSettings";\r
+        \r
+        //-- set grouping compositor\r
+        setCompositorAsSequence();\r
+        org.exolab.castor.xml.util.XMLFieldDescriptorImpl  desc           = null;\r
+        org.exolab.castor.xml.XMLFieldHandler              handler        = null;\r
+        org.exolab.castor.xml.FieldValidator               fieldValidator = null;\r
+        //-- initialize attribute descriptors\r
+        \r
+        //-- initialize element descriptors\r
+        \r
+        //-- _settingList\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(jalview.schemabinding.version2.Setting.class, "_settingList", "setting", org.exolab.castor.xml.NodeType.Element);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                FeatureSettings target = (FeatureSettings) object;\r
+                return target.getSetting();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    FeatureSettings target = (FeatureSettings) object;\r
+                    target.addSetting( (jalview.schemabinding.version2.Setting) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return new jalview.schemabinding.version2.Setting();\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        desc.setNameSpaceURI("www.jalview.org");\r
+        desc.setMultivalued(true);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _settingList\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        fieldValidator.setMinOccurs(0);\r
+        { //-- local scope\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+    } //-- jalview.schemabinding.version2.FeatureSettingsDescriptor()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Method getAccessMode\r
+     * \r
+     * \r
+     * \r
+     * @return AccessMode\r
+     */\r
+    public org.exolab.castor.mapping.AccessMode getAccessMode()\r
+    {\r
+        return null;\r
+    } //-- org.exolab.castor.mapping.AccessMode getAccessMode() \r
+\r
+    /**\r
+     * Method getExtends\r
+     * \r
+     * \r
+     * \r
+     * @return ClassDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.ClassDescriptor getExtends()\r
+    {\r
+        return null;\r
+    } //-- org.exolab.castor.mapping.ClassDescriptor getExtends() \r
+\r
+    /**\r
+     * Method getIdentity\r
+     * \r
+     * \r
+     * \r
+     * @return FieldDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.FieldDescriptor getIdentity()\r
+    {\r
+        return identity;\r
+    } //-- org.exolab.castor.mapping.FieldDescriptor getIdentity() \r
+\r
+    /**\r
+     * Method getJavaClass\r
+     * \r
+     * \r
+     * \r
+     * @return Class\r
+     */\r
+    public java.lang.Class getJavaClass()\r
+    {\r
+        return jalview.schemabinding.version2.FeatureSettings.class;\r
+    } //-- java.lang.Class getJavaClass() \r
+\r
+    /**\r
+     * Method getNameSpacePrefix\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpacePrefix()\r
+    {\r
+        return nsPrefix;\r
+    } //-- java.lang.String getNameSpacePrefix() \r
+\r
+    /**\r
+     * Method getNameSpaceURI\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpaceURI()\r
+    {\r
+        return nsURI;\r
+    } //-- java.lang.String getNameSpaceURI() \r
+\r
+    /**\r
+     * Method getValidator\r
+     * \r
+     * \r
+     * \r
+     * @return TypeValidator\r
+     */\r
+    public org.exolab.castor.xml.TypeValidator getValidator()\r
+    {\r
+        return this;\r
+    } //-- org.exolab.castor.xml.TypeValidator getValidator() \r
+\r
+    /**\r
+     * Method getXMLName\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getXMLName()\r
+    {\r
+        return xmlName;\r
+    } //-- java.lang.String getXMLName() \r
+\r
+}\r
diff --git a/src/jalview/schemabinding/version2/Features.java b/src/jalview/schemabinding/version2/Features.java
new file mode 100755 (executable)
index 0000000..72321c6
--- /dev/null
@@ -0,0 +1,118 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package jalview.schemabinding.version2;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import java.io.IOException;\r
+import java.io.Reader;\r
+import java.io.Serializable;\r
+import java.io.Writer;\r
+import org.exolab.castor.xml.MarshalException;\r
+import org.exolab.castor.xml.Marshaller;\r
+import org.exolab.castor.xml.Unmarshaller;\r
+import org.exolab.castor.xml.ValidationException;\r
+import org.xml.sax.ContentHandler;\r
+\r
+/**\r
+ * Class Features.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class Features extends Feature \r
+implements java.io.Serializable\r
+{\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public Features() {\r
+        super();\r
+    } //-- jalview.schemabinding.version2.Features()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Method isValid\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean isValid()\r
+    {\r
+        try {\r
+            validate();\r
+        }\r
+        catch (org.exolab.castor.xml.ValidationException vex) {\r
+            return false;\r
+        }\r
+        return true;\r
+    } //-- boolean isValid() \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param out\r
+     */\r
+    public void marshal(java.io.Writer out)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, out);\r
+    } //-- void marshal(java.io.Writer) \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param handler\r
+     */\r
+    public void marshal(org.xml.sax.ContentHandler handler)\r
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, handler);\r
+    } //-- void marshal(org.xml.sax.ContentHandler) \r
+\r
+    /**\r
+     * Method unmarshal\r
+     * \r
+     * \r
+     * \r
+     * @param reader\r
+     * @return Object\r
+     */\r
+    public static java.lang.Object unmarshal(java.io.Reader reader)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        return (jalview.schemabinding.version2.Features) Unmarshaller.unmarshal(jalview.schemabinding.version2.Features.class, reader);\r
+    } //-- java.lang.Object unmarshal(java.io.Reader) \r
+\r
+    /**\r
+     * Method validate\r
+     * \r
+     */\r
+    public void validate()\r
+        throws org.exolab.castor.xml.ValidationException\r
+    {\r
+        org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
+        validator.validate(this);\r
+    } //-- void validate() \r
+\r
+}\r
diff --git a/src/jalview/schemabinding/version2/FeaturesDescriptor.java b/src/jalview/schemabinding/version2/FeaturesDescriptor.java
new file mode 100755 (executable)
index 0000000..5eea818
--- /dev/null
@@ -0,0 +1,166 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package jalview.schemabinding.version2;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import org.exolab.castor.mapping.AccessMode;\r
+import org.exolab.castor.xml.TypeValidator;\r
+import org.exolab.castor.xml.XMLFieldDescriptor;\r
+import org.exolab.castor.xml.validators.*;\r
+\r
+/**\r
+ * Class FeaturesDescriptor.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class FeaturesDescriptor extends FeatureDescriptor {\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * Field nsPrefix\r
+     */\r
+    private java.lang.String nsPrefix;\r
+\r
+    /**\r
+     * Field nsURI\r
+     */\r
+    private java.lang.String nsURI;\r
+\r
+    /**\r
+     * Field xmlName\r
+     */\r
+    private java.lang.String xmlName;\r
+\r
+    /**\r
+     * Field identity\r
+     */\r
+    private org.exolab.castor.xml.XMLFieldDescriptor identity;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public FeaturesDescriptor() {\r
+        super();\r
+        setExtendsWithoutFlatten(new FeatureDescriptor());\r
+        nsURI = "www.jalview.org";\r
+        xmlName = "features";\r
+    } //-- jalview.schemabinding.version2.FeaturesDescriptor()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Method getAccessMode\r
+     * \r
+     * \r
+     * \r
+     * @return AccessMode\r
+     */\r
+    public org.exolab.castor.mapping.AccessMode getAccessMode()\r
+    {\r
+        return null;\r
+    } //-- org.exolab.castor.mapping.AccessMode getAccessMode() \r
+\r
+    /**\r
+     * Method getExtends\r
+     * \r
+     * \r
+     * \r
+     * @return ClassDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.ClassDescriptor getExtends()\r
+    {\r
+        return super.getExtends();\r
+    } //-- org.exolab.castor.mapping.ClassDescriptor getExtends() \r
+\r
+    /**\r
+     * Method getIdentity\r
+     * \r
+     * \r
+     * \r
+     * @return FieldDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.FieldDescriptor getIdentity()\r
+    {\r
+        if (identity == null)\r
+            return super.getIdentity();\r
+        return identity;\r
+    } //-- org.exolab.castor.mapping.FieldDescriptor getIdentity() \r
+\r
+    /**\r
+     * Method getJavaClass\r
+     * \r
+     * \r
+     * \r
+     * @return Class\r
+     */\r
+    public java.lang.Class getJavaClass()\r
+    {\r
+        return jalview.schemabinding.version2.Features.class;\r
+    } //-- java.lang.Class getJavaClass() \r
+\r
+    /**\r
+     * Method getNameSpacePrefix\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpacePrefix()\r
+    {\r
+        return nsPrefix;\r
+    } //-- java.lang.String getNameSpacePrefix() \r
+\r
+    /**\r
+     * Method getNameSpaceURI\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpaceURI()\r
+    {\r
+        return nsURI;\r
+    } //-- java.lang.String getNameSpaceURI() \r
+\r
+    /**\r
+     * Method getValidator\r
+     * \r
+     * \r
+     * \r
+     * @return TypeValidator\r
+     */\r
+    public org.exolab.castor.xml.TypeValidator getValidator()\r
+    {\r
+        return this;\r
+    } //-- org.exolab.castor.xml.TypeValidator getValidator() \r
+\r
+    /**\r
+     * Method getXMLName\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getXMLName()\r
+    {\r
+        return xmlName;\r
+    } //-- java.lang.String getXMLName() \r
+\r
+}\r
diff --git a/src/jalview/schemabinding/version2/HiddenColumns.java b/src/jalview/schemabinding/version2/HiddenColumns.java
new file mode 100644 (file)
index 0000000..5b83e64
--- /dev/null
@@ -0,0 +1,227 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package jalview.schemabinding.version2;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import java.io.IOException;\r
+import java.io.Reader;\r
+import java.io.Serializable;\r
+import java.io.Writer;\r
+import org.exolab.castor.xml.MarshalException;\r
+import org.exolab.castor.xml.Marshaller;\r
+import org.exolab.castor.xml.Unmarshaller;\r
+import org.exolab.castor.xml.ValidationException;\r
+import org.xml.sax.ContentHandler;\r
+\r
+/**\r
+ * Class HiddenColumns.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class HiddenColumns implements java.io.Serializable {\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * Field _start\r
+     */\r
+    private int _start;\r
+\r
+    /**\r
+     * keeps track of state for field: _start\r
+     */\r
+    private boolean _has_start;\r
+\r
+    /**\r
+     * Field _end\r
+     */\r
+    private int _end;\r
+\r
+    /**\r
+     * keeps track of state for field: _end\r
+     */\r
+    private boolean _has_end;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public HiddenColumns() {\r
+        super();\r
+    } //-- jalview.schemabinding.version2.HiddenColumns()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Method deleteEnd\r
+     * \r
+     */\r
+    public void deleteEnd()\r
+    {\r
+        this._has_end= false;\r
+    } //-- void deleteEnd() \r
+\r
+    /**\r
+     * Method deleteStart\r
+     * \r
+     */\r
+    public void deleteStart()\r
+    {\r
+        this._has_start= false;\r
+    } //-- void deleteStart() \r
+\r
+    /**\r
+     * Returns the value of field 'end'.\r
+     * \r
+     * @return int\r
+     * @return the value of field 'end'.\r
+     */\r
+    public int getEnd()\r
+    {\r
+        return this._end;\r
+    } //-- int getEnd() \r
+\r
+    /**\r
+     * Returns the value of field 'start'.\r
+     * \r
+     * @return int\r
+     * @return the value of field 'start'.\r
+     */\r
+    public int getStart()\r
+    {\r
+        return this._start;\r
+    } //-- int getStart() \r
+\r
+    /**\r
+     * Method hasEnd\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean hasEnd()\r
+    {\r
+        return this._has_end;\r
+    } //-- boolean hasEnd() \r
+\r
+    /**\r
+     * Method hasStart\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean hasStart()\r
+    {\r
+        return this._has_start;\r
+    } //-- boolean hasStart() \r
+\r
+    /**\r
+     * Method isValid\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean isValid()\r
+    {\r
+        try {\r
+            validate();\r
+        }\r
+        catch (org.exolab.castor.xml.ValidationException vex) {\r
+            return false;\r
+        }\r
+        return true;\r
+    } //-- boolean isValid() \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param out\r
+     */\r
+    public void marshal(java.io.Writer out)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, out);\r
+    } //-- void marshal(java.io.Writer) \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param handler\r
+     */\r
+    public void marshal(org.xml.sax.ContentHandler handler)\r
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, handler);\r
+    } //-- void marshal(org.xml.sax.ContentHandler) \r
+\r
+    /**\r
+     * Sets the value of field 'end'.\r
+     * \r
+     * @param end the value of field 'end'.\r
+     */\r
+    public void setEnd(int end)\r
+    {\r
+        this._end = end;\r
+        this._has_end = true;\r
+    } //-- void setEnd(int) \r
+\r
+    /**\r
+     * Sets the value of field 'start'.\r
+     * \r
+     * @param start the value of field 'start'.\r
+     */\r
+    public void setStart(int start)\r
+    {\r
+        this._start = start;\r
+        this._has_start = true;\r
+    } //-- void setStart(int) \r
+\r
+    /**\r
+     * Method unmarshal\r
+     * \r
+     * \r
+     * \r
+     * @param reader\r
+     * @return Object\r
+     */\r
+    public static java.lang.Object unmarshal(java.io.Reader reader)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        return (jalview.schemabinding.version2.HiddenColumns) Unmarshaller.unmarshal(jalview.schemabinding.version2.HiddenColumns.class, reader);\r
+    } //-- java.lang.Object unmarshal(java.io.Reader) \r
+\r
+    /**\r
+     * Method validate\r
+     * \r
+     */\r
+    public void validate()\r
+        throws org.exolab.castor.xml.ValidationException\r
+    {\r
+        org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
+        validator.validate(this);\r
+    } //-- void validate() \r
+\r
+}\r
diff --git a/src/jalview/schemabinding/version2/HiddenColumnsDescriptor.java b/src/jalview/schemabinding/version2/HiddenColumnsDescriptor.java
new file mode 100644 (file)
index 0000000..df99628
--- /dev/null
@@ -0,0 +1,252 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package jalview.schemabinding.version2;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import org.exolab.castor.mapping.AccessMode;\r
+import org.exolab.castor.xml.TypeValidator;\r
+import org.exolab.castor.xml.XMLFieldDescriptor;\r
+import org.exolab.castor.xml.validators.*;\r
+\r
+/**\r
+ * Class HiddenColumnsDescriptor.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class HiddenColumnsDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * Field nsPrefix\r
+     */\r
+    private java.lang.String nsPrefix;\r
+\r
+    /**\r
+     * Field nsURI\r
+     */\r
+    private java.lang.String nsURI;\r
+\r
+    /**\r
+     * Field xmlName\r
+     */\r
+    private java.lang.String xmlName;\r
+\r
+    /**\r
+     * Field identity\r
+     */\r
+    private org.exolab.castor.xml.XMLFieldDescriptor identity;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public HiddenColumnsDescriptor() {\r
+        super();\r
+        nsURI = "www.jalview.org";\r
+        xmlName = "hiddenColumns";\r
+        org.exolab.castor.xml.util.XMLFieldDescriptorImpl  desc           = null;\r
+        org.exolab.castor.xml.XMLFieldHandler              handler        = null;\r
+        org.exolab.castor.xml.FieldValidator               fieldValidator = null;\r
+        //-- initialize attribute descriptors\r
+        \r
+        //-- _start\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_start", "start", org.exolab.castor.xml.NodeType.Attribute);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                HiddenColumns target = (HiddenColumns) object;\r
+                if(!target.hasStart())\r
+                    return null;\r
+                return new java.lang.Integer(target.getStart());\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    HiddenColumns target = (HiddenColumns) object;\r
+                    // if null, use delete method for optional primitives \r
+                    if (value == null) {\r
+                        target.deleteStart();\r
+                        return;\r
+                    }\r
+                    target.setStart( ((java.lang.Integer)value).intValue());\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _start\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            IntegerValidator typeValidator= new IntegerValidator();\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _end\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_end", "end", org.exolab.castor.xml.NodeType.Attribute);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                HiddenColumns target = (HiddenColumns) object;\r
+                if(!target.hasEnd())\r
+                    return null;\r
+                return new java.lang.Integer(target.getEnd());\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    HiddenColumns target = (HiddenColumns) object;\r
+                    // if null, use delete method for optional primitives \r
+                    if (value == null) {\r
+                        target.deleteEnd();\r
+                        return;\r
+                    }\r
+                    target.setEnd( ((java.lang.Integer)value).intValue());\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _end\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            IntegerValidator typeValidator= new IntegerValidator();\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- initialize element descriptors\r
+        \r
+    } //-- jalview.schemabinding.version2.HiddenColumnsDescriptor()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Method getAccessMode\r
+     * \r
+     * \r
+     * \r
+     * @return AccessMode\r
+     */\r
+    public org.exolab.castor.mapping.AccessMode getAccessMode()\r
+    {\r
+        return null;\r
+    } //-- org.exolab.castor.mapping.AccessMode getAccessMode() \r
+\r
+    /**\r
+     * Method getExtends\r
+     * \r
+     * \r
+     * \r
+     * @return ClassDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.ClassDescriptor getExtends()\r
+    {\r
+        return null;\r
+    } //-- org.exolab.castor.mapping.ClassDescriptor getExtends() \r
+\r
+    /**\r
+     * Method getIdentity\r
+     * \r
+     * \r
+     * \r
+     * @return FieldDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.FieldDescriptor getIdentity()\r
+    {\r
+        return identity;\r
+    } //-- org.exolab.castor.mapping.FieldDescriptor getIdentity() \r
+\r
+    /**\r
+     * Method getJavaClass\r
+     * \r
+     * \r
+     * \r
+     * @return Class\r
+     */\r
+    public java.lang.Class getJavaClass()\r
+    {\r
+        return jalview.schemabinding.version2.HiddenColumns.class;\r
+    } //-- java.lang.Class getJavaClass() \r
+\r
+    /**\r
+     * Method getNameSpacePrefix\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpacePrefix()\r
+    {\r
+        return nsPrefix;\r
+    } //-- java.lang.String getNameSpacePrefix() \r
+\r
+    /**\r
+     * Method getNameSpaceURI\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpaceURI()\r
+    {\r
+        return nsURI;\r
+    } //-- java.lang.String getNameSpaceURI() \r
+\r
+    /**\r
+     * Method getValidator\r
+     * \r
+     * \r
+     * \r
+     * @return TypeValidator\r
+     */\r
+    public org.exolab.castor.xml.TypeValidator getValidator()\r
+    {\r
+        return this;\r
+    } //-- org.exolab.castor.xml.TypeValidator getValidator() \r
+\r
+    /**\r
+     * Method getXMLName\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getXMLName()\r
+    {\r
+        return xmlName;\r
+    } //-- java.lang.String getXMLName() \r
+\r
+}\r
diff --git a/src/jalview/schemabinding/version2/JGroup.java b/src/jalview/schemabinding/version2/JGroup.java
new file mode 100755 (executable)
index 0000000..f3fe3e9
--- /dev/null
@@ -0,0 +1,750 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package jalview.schemabinding.version2;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import java.io.IOException;\r
+import java.io.Reader;\r
+import java.io.Serializable;\r
+import java.io.Writer;\r
+import java.util.Enumeration;\r
+import java.util.Vector;\r
+import org.exolab.castor.xml.MarshalException;\r
+import org.exolab.castor.xml.Marshaller;\r
+import org.exolab.castor.xml.Unmarshaller;\r
+import org.exolab.castor.xml.ValidationException;\r
+import org.xml.sax.ContentHandler;\r
+\r
+/**\r
+ * Class JGroup.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class JGroup implements java.io.Serializable {\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * Field _start\r
+     */\r
+    private int _start;\r
+\r
+    /**\r
+     * keeps track of state for field: _start\r
+     */\r
+    private boolean _has_start;\r
+\r
+    /**\r
+     * Field _end\r
+     */\r
+    private int _end;\r
+\r
+    /**\r
+     * keeps track of state for field: _end\r
+     */\r
+    private boolean _has_end;\r
+\r
+    /**\r
+     * Field _name\r
+     */\r
+    private java.lang.String _name;\r
+\r
+    /**\r
+     * Field _colour\r
+     */\r
+    private java.lang.String _colour;\r
+\r
+    /**\r
+     * Field _consThreshold\r
+     */\r
+    private int _consThreshold;\r
+\r
+    /**\r
+     * keeps track of state for field: _consThreshold\r
+     */\r
+    private boolean _has_consThreshold;\r
+\r
+    /**\r
+     * Field _pidThreshold\r
+     */\r
+    private int _pidThreshold;\r
+\r
+    /**\r
+     * keeps track of state for field: _pidThreshold\r
+     */\r
+    private boolean _has_pidThreshold;\r
+\r
+    /**\r
+     * Field _outlineColour\r
+     */\r
+    private int _outlineColour;\r
+\r
+    /**\r
+     * keeps track of state for field: _outlineColour\r
+     */\r
+    private boolean _has_outlineColour;\r
+\r
+    /**\r
+     * Field _displayBoxes\r
+     */\r
+    private boolean _displayBoxes;\r
+\r
+    /**\r
+     * keeps track of state for field: _displayBoxes\r
+     */\r
+    private boolean _has_displayBoxes;\r
+\r
+    /**\r
+     * Field _displayText\r
+     */\r
+    private boolean _displayText;\r
+\r
+    /**\r
+     * keeps track of state for field: _displayText\r
+     */\r
+    private boolean _has_displayText;\r
+\r
+    /**\r
+     * Field _colourText\r
+     */\r
+    private boolean _colourText;\r
+\r
+    /**\r
+     * keeps track of state for field: _colourText\r
+     */\r
+    private boolean _has_colourText;\r
+\r
+    /**\r
+     * Field _seqList\r
+     */\r
+    private java.util.Vector _seqList;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public JGroup() {\r
+        super();\r
+        _seqList = new Vector();\r
+    } //-- jalview.schemabinding.version2.JGroup()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Method addSeq\r
+     * \r
+     * \r
+     * \r
+     * @param vSeq\r
+     */\r
+    public void addSeq(int vSeq)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        _seqList.addElement(new java.lang.Integer(vSeq));\r
+    } //-- void addSeq(int) \r
+\r
+    /**\r
+     * Method addSeq\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @param vSeq\r
+     */\r
+    public void addSeq(int index, int vSeq)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        _seqList.insertElementAt(new java.lang.Integer(vSeq), index);\r
+    } //-- void addSeq(int, int) \r
+\r
+    /**\r
+     * Method deleteColourText\r
+     * \r
+     */\r
+    public void deleteColourText()\r
+    {\r
+        this._has_colourText= false;\r
+    } //-- void deleteColourText() \r
+\r
+    /**\r
+     * Method deleteConsThreshold\r
+     * \r
+     */\r
+    public void deleteConsThreshold()\r
+    {\r
+        this._has_consThreshold= false;\r
+    } //-- void deleteConsThreshold() \r
+\r
+    /**\r
+     * Method deleteDisplayBoxes\r
+     * \r
+     */\r
+    public void deleteDisplayBoxes()\r
+    {\r
+        this._has_displayBoxes= false;\r
+    } //-- void deleteDisplayBoxes() \r
+\r
+    /**\r
+     * Method deleteDisplayText\r
+     * \r
+     */\r
+    public void deleteDisplayText()\r
+    {\r
+        this._has_displayText= false;\r
+    } //-- void deleteDisplayText() \r
+\r
+    /**\r
+     * Method deleteEnd\r
+     * \r
+     */\r
+    public void deleteEnd()\r
+    {\r
+        this._has_end= false;\r
+    } //-- void deleteEnd() \r
+\r
+    /**\r
+     * Method deleteOutlineColour\r
+     * \r
+     */\r
+    public void deleteOutlineColour()\r
+    {\r
+        this._has_outlineColour= false;\r
+    } //-- void deleteOutlineColour() \r
+\r
+    /**\r
+     * Method deletePidThreshold\r
+     * \r
+     */\r
+    public void deletePidThreshold()\r
+    {\r
+        this._has_pidThreshold= false;\r
+    } //-- void deletePidThreshold() \r
+\r
+    /**\r
+     * Method deleteStart\r
+     * \r
+     */\r
+    public void deleteStart()\r
+    {\r
+        this._has_start= false;\r
+    } //-- void deleteStart() \r
+\r
+    /**\r
+     * Method enumerateSeq\r
+     * \r
+     * \r
+     * \r
+     * @return Enumeration\r
+     */\r
+    public java.util.Enumeration enumerateSeq()\r
+    {\r
+        return _seqList.elements();\r
+    } //-- java.util.Enumeration enumerateSeq() \r
+\r
+    /**\r
+     * Returns the value of field 'colour'.\r
+     * \r
+     * @return String\r
+     * @return the value of field 'colour'.\r
+     */\r
+    public java.lang.String getColour()\r
+    {\r
+        return this._colour;\r
+    } //-- java.lang.String getColour() \r
+\r
+    /**\r
+     * Returns the value of field 'colourText'.\r
+     * \r
+     * @return boolean\r
+     * @return the value of field 'colourText'.\r
+     */\r
+    public boolean getColourText()\r
+    {\r
+        return this._colourText;\r
+    } //-- boolean getColourText() \r
+\r
+    /**\r
+     * Returns the value of field 'consThreshold'.\r
+     * \r
+     * @return int\r
+     * @return the value of field 'consThreshold'.\r
+     */\r
+    public int getConsThreshold()\r
+    {\r
+        return this._consThreshold;\r
+    } //-- int getConsThreshold() \r
+\r
+    /**\r
+     * Returns the value of field 'displayBoxes'.\r
+     * \r
+     * @return boolean\r
+     * @return the value of field 'displayBoxes'.\r
+     */\r
+    public boolean getDisplayBoxes()\r
+    {\r
+        return this._displayBoxes;\r
+    } //-- boolean getDisplayBoxes() \r
+\r
+    /**\r
+     * Returns the value of field 'displayText'.\r
+     * \r
+     * @return boolean\r
+     * @return the value of field 'displayText'.\r
+     */\r
+    public boolean getDisplayText()\r
+    {\r
+        return this._displayText;\r
+    } //-- boolean getDisplayText() \r
+\r
+    /**\r
+     * Returns the value of field 'end'.\r
+     * \r
+     * @return int\r
+     * @return the value of field 'end'.\r
+     */\r
+    public int getEnd()\r
+    {\r
+        return this._end;\r
+    } //-- int getEnd() \r
+\r
+    /**\r
+     * Returns the value of field 'name'.\r
+     * \r
+     * @return String\r
+     * @return the value of field 'name'.\r
+     */\r
+    public java.lang.String getName()\r
+    {\r
+        return this._name;\r
+    } //-- java.lang.String getName() \r
+\r
+    /**\r
+     * Returns the value of field 'outlineColour'.\r
+     * \r
+     * @return int\r
+     * @return the value of field 'outlineColour'.\r
+     */\r
+    public int getOutlineColour()\r
+    {\r
+        return this._outlineColour;\r
+    } //-- int getOutlineColour() \r
+\r
+    /**\r
+     * Returns the value of field 'pidThreshold'.\r
+     * \r
+     * @return int\r
+     * @return the value of field 'pidThreshold'.\r
+     */\r
+    public int getPidThreshold()\r
+    {\r
+        return this._pidThreshold;\r
+    } //-- int getPidThreshold() \r
+\r
+    /**\r
+     * Method getSeq\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @return int\r
+     */\r
+    public int getSeq(int index)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        //-- check bounds for index\r
+        if ((index < 0) || (index > _seqList.size())) {\r
+            throw new IndexOutOfBoundsException();\r
+        }\r
+        \r
+        return ((java.lang.Integer)_seqList.elementAt(index)).intValue();\r
+    } //-- int getSeq(int) \r
+\r
+    /**\r
+     * Method getSeq\r
+     * \r
+     * \r
+     * \r
+     * @return int\r
+     */\r
+    public int[] getSeq()\r
+    {\r
+        int size = _seqList.size();\r
+        int[] mArray = new int[size];\r
+        for (int index = 0; index < size; index++) {\r
+            mArray[index] = ((java.lang.Integer)_seqList.elementAt(index)).intValue();\r
+        }\r
+        return mArray;\r
+    } //-- int[] getSeq() \r
+\r
+    /**\r
+     * Method getSeqCount\r
+     * \r
+     * \r
+     * \r
+     * @return int\r
+     */\r
+    public int getSeqCount()\r
+    {\r
+        return _seqList.size();\r
+    } //-- int getSeqCount() \r
+\r
+    /**\r
+     * Returns the value of field 'start'.\r
+     * \r
+     * @return int\r
+     * @return the value of field 'start'.\r
+     */\r
+    public int getStart()\r
+    {\r
+        return this._start;\r
+    } //-- int getStart() \r
+\r
+    /**\r
+     * Method hasColourText\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean hasColourText()\r
+    {\r
+        return this._has_colourText;\r
+    } //-- boolean hasColourText() \r
+\r
+    /**\r
+     * Method hasConsThreshold\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean hasConsThreshold()\r
+    {\r
+        return this._has_consThreshold;\r
+    } //-- boolean hasConsThreshold() \r
+\r
+    /**\r
+     * Method hasDisplayBoxes\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean hasDisplayBoxes()\r
+    {\r
+        return this._has_displayBoxes;\r
+    } //-- boolean hasDisplayBoxes() \r
+\r
+    /**\r
+     * Method hasDisplayText\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean hasDisplayText()\r
+    {\r
+        return this._has_displayText;\r
+    } //-- boolean hasDisplayText() \r
+\r
+    /**\r
+     * Method hasEnd\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean hasEnd()\r
+    {\r
+        return this._has_end;\r
+    } //-- boolean hasEnd() \r
+\r
+    /**\r
+     * Method hasOutlineColour\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean hasOutlineColour()\r
+    {\r
+        return this._has_outlineColour;\r
+    } //-- boolean hasOutlineColour() \r
+\r
+    /**\r
+     * Method hasPidThreshold\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean hasPidThreshold()\r
+    {\r
+        return this._has_pidThreshold;\r
+    } //-- boolean hasPidThreshold() \r
+\r
+    /**\r
+     * Method hasStart\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean hasStart()\r
+    {\r
+        return this._has_start;\r
+    } //-- boolean hasStart() \r
+\r
+    /**\r
+     * Method isValid\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean isValid()\r
+    {\r
+        try {\r
+            validate();\r
+        }\r
+        catch (org.exolab.castor.xml.ValidationException vex) {\r
+            return false;\r
+        }\r
+        return true;\r
+    } //-- boolean isValid() \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param out\r
+     */\r
+    public void marshal(java.io.Writer out)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, out);\r
+    } //-- void marshal(java.io.Writer) \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param handler\r
+     */\r
+    public void marshal(org.xml.sax.ContentHandler handler)\r
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, handler);\r
+    } //-- void marshal(org.xml.sax.ContentHandler) \r
+\r
+    /**\r
+     * Method removeAllSeq\r
+     * \r
+     */\r
+    public void removeAllSeq()\r
+    {\r
+        _seqList.removeAllElements();\r
+    } //-- void removeAllSeq() \r
+\r
+    /**\r
+     * Method removeSeq\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @return int\r
+     */\r
+    public int removeSeq(int index)\r
+    {\r
+        java.lang.Object obj = _seqList.elementAt(index);\r
+        _seqList.removeElementAt(index);\r
+        return ((java.lang.Integer)obj).intValue();\r
+    } //-- int removeSeq(int) \r
+\r
+    /**\r
+     * Sets the value of field 'colour'.\r
+     * \r
+     * @param colour the value of field 'colour'.\r
+     */\r
+    public void setColour(java.lang.String colour)\r
+    {\r
+        this._colour = colour;\r
+    } //-- void setColour(java.lang.String) \r
+\r
+    /**\r
+     * Sets the value of field 'colourText'.\r
+     * \r
+     * @param colourText the value of field 'colourText'.\r
+     */\r
+    public void setColourText(boolean colourText)\r
+    {\r
+        this._colourText = colourText;\r
+        this._has_colourText = true;\r
+    } //-- void setColourText(boolean) \r
+\r
+    /**\r
+     * Sets the value of field 'consThreshold'.\r
+     * \r
+     * @param consThreshold the value of field 'consThreshold'.\r
+     */\r
+    public void setConsThreshold(int consThreshold)\r
+    {\r
+        this._consThreshold = consThreshold;\r
+        this._has_consThreshold = true;\r
+    } //-- void setConsThreshold(int) \r
+\r
+    /**\r
+     * Sets the value of field 'displayBoxes'.\r
+     * \r
+     * @param displayBoxes the value of field 'displayBoxes'.\r
+     */\r
+    public void setDisplayBoxes(boolean displayBoxes)\r
+    {\r
+        this._displayBoxes = displayBoxes;\r
+        this._has_displayBoxes = true;\r
+    } //-- void setDisplayBoxes(boolean) \r
+\r
+    /**\r
+     * Sets the value of field 'displayText'.\r
+     * \r
+     * @param displayText the value of field 'displayText'.\r
+     */\r
+    public void setDisplayText(boolean displayText)\r
+    {\r
+        this._displayText = displayText;\r
+        this._has_displayText = true;\r
+    } //-- void setDisplayText(boolean) \r
+\r
+    /**\r
+     * Sets the value of field 'end'.\r
+     * \r
+     * @param end the value of field 'end'.\r
+     */\r
+    public void setEnd(int end)\r
+    {\r
+        this._end = end;\r
+        this._has_end = true;\r
+    } //-- void setEnd(int) \r
+\r
+    /**\r
+     * Sets the value of field 'name'.\r
+     * \r
+     * @param name the value of field 'name'.\r
+     */\r
+    public void setName(java.lang.String name)\r
+    {\r
+        this._name = name;\r
+    } //-- void setName(java.lang.String) \r
+\r
+    /**\r
+     * Sets the value of field 'outlineColour'.\r
+     * \r
+     * @param outlineColour the value of field 'outlineColour'.\r
+     */\r
+    public void setOutlineColour(int outlineColour)\r
+    {\r
+        this._outlineColour = outlineColour;\r
+        this._has_outlineColour = true;\r
+    } //-- void setOutlineColour(int) \r
+\r
+    /**\r
+     * Sets the value of field 'pidThreshold'.\r
+     * \r
+     * @param pidThreshold the value of field 'pidThreshold'.\r
+     */\r
+    public void setPidThreshold(int pidThreshold)\r
+    {\r
+        this._pidThreshold = pidThreshold;\r
+        this._has_pidThreshold = true;\r
+    } //-- void setPidThreshold(int) \r
+\r
+    /**\r
+     * Method setSeq\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @param vSeq\r
+     */\r
+    public void setSeq(int index, int vSeq)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        //-- check bounds for index\r
+        if ((index < 0) || (index > _seqList.size())) {\r
+            throw new IndexOutOfBoundsException();\r
+        }\r
+        _seqList.setElementAt(new java.lang.Integer(vSeq), index);\r
+    } //-- void setSeq(int, int) \r
+\r
+    /**\r
+     * Method setSeq\r
+     * \r
+     * \r
+     * \r
+     * @param seqArray\r
+     */\r
+    public void setSeq(int[] seqArray)\r
+    {\r
+        //-- copy array\r
+        _seqList.removeAllElements();\r
+        for (int i = 0; i < seqArray.length; i++) {\r
+            _seqList.addElement(new java.lang.Integer(seqArray[i]));\r
+        }\r
+    } //-- void setSeq(int) \r
+\r
+    /**\r
+     * Sets the value of field 'start'.\r
+     * \r
+     * @param start the value of field 'start'.\r
+     */\r
+    public void setStart(int start)\r
+    {\r
+        this._start = start;\r
+        this._has_start = true;\r
+    } //-- void setStart(int) \r
+\r
+    /**\r
+     * Method unmarshal\r
+     * \r
+     * \r
+     * \r
+     * @param reader\r
+     * @return Object\r
+     */\r
+    public static java.lang.Object unmarshal(java.io.Reader reader)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        return (jalview.schemabinding.version2.JGroup) Unmarshaller.unmarshal(jalview.schemabinding.version2.JGroup.class, reader);\r
+    } //-- java.lang.Object unmarshal(java.io.Reader) \r
+\r
+    /**\r
+     * Method validate\r
+     * \r
+     */\r
+    public void validate()\r
+        throws org.exolab.castor.xml.ValidationException\r
+    {\r
+        org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
+        validator.validate(this);\r
+    } //-- void validate() \r
+\r
+}\r
diff --git a/src/jalview/schemabinding/version2/JGroupDescriptor.java b/src/jalview/schemabinding/version2/JGroupDescriptor.java
new file mode 100755 (executable)
index 0000000..231c631
--- /dev/null
@@ -0,0 +1,614 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package jalview.schemabinding.version2;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import org.exolab.castor.mapping.AccessMode;\r
+import org.exolab.castor.xml.TypeValidator;\r
+import org.exolab.castor.xml.XMLFieldDescriptor;\r
+import org.exolab.castor.xml.validators.*;\r
+\r
+/**\r
+ * Class JGroupDescriptor.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class JGroupDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * Field nsPrefix\r
+     */\r
+    private java.lang.String nsPrefix;\r
+\r
+    /**\r
+     * Field nsURI\r
+     */\r
+    private java.lang.String nsURI;\r
+\r
+    /**\r
+     * Field xmlName\r
+     */\r
+    private java.lang.String xmlName;\r
+\r
+    /**\r
+     * Field identity\r
+     */\r
+    private org.exolab.castor.xml.XMLFieldDescriptor identity;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public JGroupDescriptor() {\r
+        super();\r
+        nsURI = "www.jalview.org";\r
+        xmlName = "JGroup";\r
+        \r
+        //-- set grouping compositor\r
+        setCompositorAsSequence();\r
+        org.exolab.castor.xml.util.XMLFieldDescriptorImpl  desc           = null;\r
+        org.exolab.castor.xml.XMLFieldHandler              handler        = null;\r
+        org.exolab.castor.xml.FieldValidator               fieldValidator = null;\r
+        //-- initialize attribute descriptors\r
+        \r
+        //-- _start\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_start", "start", org.exolab.castor.xml.NodeType.Attribute);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                JGroup target = (JGroup) object;\r
+                if(!target.hasStart())\r
+                    return null;\r
+                return new java.lang.Integer(target.getStart());\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    JGroup target = (JGroup) object;\r
+                    // if null, use delete method for optional primitives \r
+                    if (value == null) {\r
+                        target.deleteStart();\r
+                        return;\r
+                    }\r
+                    target.setStart( ((java.lang.Integer)value).intValue());\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _start\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            IntegerValidator typeValidator= new IntegerValidator();\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _end\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_end", "end", org.exolab.castor.xml.NodeType.Attribute);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                JGroup target = (JGroup) object;\r
+                if(!target.hasEnd())\r
+                    return null;\r
+                return new java.lang.Integer(target.getEnd());\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    JGroup target = (JGroup) object;\r
+                    // if null, use delete method for optional primitives \r
+                    if (value == null) {\r
+                        target.deleteEnd();\r
+                        return;\r
+                    }\r
+                    target.setEnd( ((java.lang.Integer)value).intValue());\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _end\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            IntegerValidator typeValidator= new IntegerValidator();\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _name\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_name", "name", org.exolab.castor.xml.NodeType.Attribute);\r
+        desc.setImmutable(true);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                JGroup target = (JGroup) object;\r
+                return target.getName();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    JGroup target = (JGroup) object;\r
+                    target.setName( (java.lang.String) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _name\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            StringValidator typeValidator = new StringValidator();\r
+            typeValidator.setWhiteSpace("preserve");\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _colour\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_colour", "colour", org.exolab.castor.xml.NodeType.Attribute);\r
+        desc.setImmutable(true);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                JGroup target = (JGroup) object;\r
+                return target.getColour();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    JGroup target = (JGroup) object;\r
+                    target.setColour( (java.lang.String) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _colour\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            StringValidator typeValidator = new StringValidator();\r
+            typeValidator.setWhiteSpace("preserve");\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _consThreshold\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_consThreshold", "consThreshold", org.exolab.castor.xml.NodeType.Attribute);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                JGroup target = (JGroup) object;\r
+                if(!target.hasConsThreshold())\r
+                    return null;\r
+                return new java.lang.Integer(target.getConsThreshold());\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    JGroup target = (JGroup) object;\r
+                    // if null, use delete method for optional primitives \r
+                    if (value == null) {\r
+                        target.deleteConsThreshold();\r
+                        return;\r
+                    }\r
+                    target.setConsThreshold( ((java.lang.Integer)value).intValue());\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _consThreshold\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            IntegerValidator typeValidator= new IntegerValidator();\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _pidThreshold\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_pidThreshold", "pidThreshold", org.exolab.castor.xml.NodeType.Attribute);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                JGroup target = (JGroup) object;\r
+                if(!target.hasPidThreshold())\r
+                    return null;\r
+                return new java.lang.Integer(target.getPidThreshold());\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    JGroup target = (JGroup) object;\r
+                    // if null, use delete method for optional primitives \r
+                    if (value == null) {\r
+                        target.deletePidThreshold();\r
+                        return;\r
+                    }\r
+                    target.setPidThreshold( ((java.lang.Integer)value).intValue());\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _pidThreshold\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            IntegerValidator typeValidator= new IntegerValidator();\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _outlineColour\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_outlineColour", "outlineColour", org.exolab.castor.xml.NodeType.Attribute);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                JGroup target = (JGroup) object;\r
+                if(!target.hasOutlineColour())\r
+                    return null;\r
+                return new java.lang.Integer(target.getOutlineColour());\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    JGroup target = (JGroup) object;\r
+                    // if null, use delete method for optional primitives \r
+                    if (value == null) {\r
+                        target.deleteOutlineColour();\r
+                        return;\r
+                    }\r
+                    target.setOutlineColour( ((java.lang.Integer)value).intValue());\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _outlineColour\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            IntegerValidator typeValidator= new IntegerValidator();\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _displayBoxes\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_displayBoxes", "displayBoxes", org.exolab.castor.xml.NodeType.Attribute);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                JGroup target = (JGroup) object;\r
+                if(!target.hasDisplayBoxes())\r
+                    return null;\r
+                return (target.getDisplayBoxes() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    JGroup target = (JGroup) object;\r
+                    // if null, use delete method for optional primitives \r
+                    if (value == null) {\r
+                        target.deleteDisplayBoxes();\r
+                        return;\r
+                    }\r
+                    target.setDisplayBoxes( ((java.lang.Boolean)value).booleanValue());\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _displayBoxes\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            BooleanValidator typeValidator = new BooleanValidator();\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _displayText\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_displayText", "displayText", org.exolab.castor.xml.NodeType.Attribute);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                JGroup target = (JGroup) object;\r
+                if(!target.hasDisplayText())\r
+                    return null;\r
+                return (target.getDisplayText() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    JGroup target = (JGroup) object;\r
+                    // if null, use delete method for optional primitives \r
+                    if (value == null) {\r
+                        target.deleteDisplayText();\r
+                        return;\r
+                    }\r
+                    target.setDisplayText( ((java.lang.Boolean)value).booleanValue());\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _displayText\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            BooleanValidator typeValidator = new BooleanValidator();\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _colourText\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_colourText", "colourText", org.exolab.castor.xml.NodeType.Attribute);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                JGroup target = (JGroup) object;\r
+                if(!target.hasColourText())\r
+                    return null;\r
+                return (target.getColourText() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    JGroup target = (JGroup) object;\r
+                    // if null, use delete method for optional primitives \r
+                    if (value == null) {\r
+                        target.deleteColourText();\r
+                        return;\r
+                    }\r
+                    target.setColourText( ((java.lang.Boolean)value).booleanValue());\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _colourText\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            BooleanValidator typeValidator = new BooleanValidator();\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- initialize element descriptors\r
+        \r
+        //-- _seqList\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_seqList", "seq", org.exolab.castor.xml.NodeType.Element);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                JGroup target = (JGroup) object;\r
+                return target.getSeq();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    JGroup target = (JGroup) object;\r
+                    // ignore null values for non optional primitives\r
+                    if (value == null) return;\r
+                    \r
+                    target.addSeq( ((java.lang.Integer)value).intValue());\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        desc.setNameSpaceURI("www.jalview.org");\r
+        desc.setRequired(true);\r
+        desc.setMultivalued(true);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _seqList\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        fieldValidator.setMinOccurs(1);\r
+        { //-- local scope\r
+            IntegerValidator typeValidator= new IntegerValidator();\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+    } //-- jalview.schemabinding.version2.JGroupDescriptor()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Method getAccessMode\r
+     * \r
+     * \r
+     * \r
+     * @return AccessMode\r
+     */\r
+    public org.exolab.castor.mapping.AccessMode getAccessMode()\r
+    {\r
+        return null;\r
+    } //-- org.exolab.castor.mapping.AccessMode getAccessMode() \r
+\r
+    /**\r
+     * Method getExtends\r
+     * \r
+     * \r
+     * \r
+     * @return ClassDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.ClassDescriptor getExtends()\r
+    {\r
+        return null;\r
+    } //-- org.exolab.castor.mapping.ClassDescriptor getExtends() \r
+\r
+    /**\r
+     * Method getIdentity\r
+     * \r
+     * \r
+     * \r
+     * @return FieldDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.FieldDescriptor getIdentity()\r
+    {\r
+        return identity;\r
+    } //-- org.exolab.castor.mapping.FieldDescriptor getIdentity() \r
+\r
+    /**\r
+     * Method getJavaClass\r
+     * \r
+     * \r
+     * \r
+     * @return Class\r
+     */\r
+    public java.lang.Class getJavaClass()\r
+    {\r
+        return jalview.schemabinding.version2.JGroup.class;\r
+    } //-- java.lang.Class getJavaClass() \r
+\r
+    /**\r
+     * Method getNameSpacePrefix\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpacePrefix()\r
+    {\r
+        return nsPrefix;\r
+    } //-- java.lang.String getNameSpacePrefix() \r
+\r
+    /**\r
+     * Method getNameSpaceURI\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpaceURI()\r
+    {\r
+        return nsURI;\r
+    } //-- java.lang.String getNameSpaceURI() \r
+\r
+    /**\r
+     * Method getValidator\r
+     * \r
+     * \r
+     * \r
+     * @return TypeValidator\r
+     */\r
+    public org.exolab.castor.xml.TypeValidator getValidator()\r
+    {\r
+        return this;\r
+    } //-- org.exolab.castor.xml.TypeValidator getValidator() \r
+\r
+    /**\r
+     * Method getXMLName\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getXMLName()\r
+    {\r
+        return xmlName;\r
+    } //-- java.lang.String getXMLName() \r
+\r
+}\r
diff --git a/src/jalview/schemabinding/version2/JSeq.java b/src/jalview/schemabinding/version2/JSeq.java
new file mode 100755 (executable)
index 0000000..19e2e6d
--- /dev/null
@@ -0,0 +1,841 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package jalview.schemabinding.version2;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import java.io.IOException;\r
+import java.io.Reader;\r
+import java.io.Serializable;\r
+import java.io.Writer;\r
+import java.util.Enumeration;\r
+import java.util.Vector;\r
+import org.exolab.castor.xml.MarshalException;\r
+import org.exolab.castor.xml.Marshaller;\r
+import org.exolab.castor.xml.Unmarshaller;\r
+import org.exolab.castor.xml.ValidationException;\r
+import org.xml.sax.ContentHandler;\r
+\r
+/**\r
+ * Class JSeq.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class JSeq implements java.io.Serializable {\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * Field _colour\r
+     */\r
+    private int _colour;\r
+\r
+    /**\r
+     * keeps track of state for field: _colour\r
+     */\r
+    private boolean _has_colour;\r
+\r
+    /**\r
+     * Field _start\r
+     */\r
+    private int _start;\r
+\r
+    /**\r
+     * keeps track of state for field: _start\r
+     */\r
+    private boolean _has_start;\r
+\r
+    /**\r
+     * Field _end\r
+     */\r
+    private int _end;\r
+\r
+    /**\r
+     * keeps track of state for field: _end\r
+     */\r
+    private boolean _has_end;\r
+\r
+    /**\r
+     * Field _id\r
+     */\r
+    private int _id;\r
+\r
+    /**\r
+     * keeps track of state for field: _id\r
+     */\r
+    private boolean _has_id;\r
+\r
+    /**\r
+     * Field _hidden\r
+     */\r
+    private boolean _hidden;\r
+\r
+    /**\r
+     * keeps track of state for field: _hidden\r
+     */\r
+    private boolean _has_hidden;\r
+\r
+    /**\r
+     * Field _featuresList\r
+     */\r
+    private java.util.Vector _featuresList;\r
+\r
+    /**\r
+     * Field _pdbidsList\r
+     */\r
+    private java.util.Vector _pdbidsList;\r
+\r
+    /**\r
+     * Field _hiddenSequencesList\r
+     */\r
+    private java.util.Vector _hiddenSequencesList;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public JSeq() {\r
+        super();\r
+        _featuresList = new Vector();\r
+        _pdbidsList = new Vector();\r
+        _hiddenSequencesList = new Vector();\r
+    } //-- jalview.schemabinding.version2.JSeq()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Method addFeatures\r
+     * \r
+     * \r
+     * \r
+     * @param vFeatures\r
+     */\r
+    public void addFeatures(jalview.schemabinding.version2.Features vFeatures)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        _featuresList.addElement(vFeatures);\r
+    } //-- void addFeatures(jalview.schemabinding.version2.Features) \r
+\r
+    /**\r
+     * Method addFeatures\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @param vFeatures\r
+     */\r
+    public void addFeatures(int index, jalview.schemabinding.version2.Features vFeatures)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        _featuresList.insertElementAt(vFeatures, index);\r
+    } //-- void addFeatures(int, jalview.schemabinding.version2.Features) \r
+\r
+    /**\r
+     * Method addHiddenSequences\r
+     * \r
+     * \r
+     * \r
+     * @param vHiddenSequences\r
+     */\r
+    public void addHiddenSequences(int vHiddenSequences)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        _hiddenSequencesList.addElement(new java.lang.Integer(vHiddenSequences));\r
+    } //-- void addHiddenSequences(int) \r
+\r
+    /**\r
+     * Method addHiddenSequences\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @param vHiddenSequences\r
+     */\r
+    public void addHiddenSequences(int index, int vHiddenSequences)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        _hiddenSequencesList.insertElementAt(new java.lang.Integer(vHiddenSequences), index);\r
+    } //-- void addHiddenSequences(int, int) \r
+\r
+    /**\r
+     * Method addPdbids\r
+     * \r
+     * \r
+     * \r
+     * @param vPdbids\r
+     */\r
+    public void addPdbids(jalview.schemabinding.version2.Pdbids vPdbids)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        _pdbidsList.addElement(vPdbids);\r
+    } //-- void addPdbids(jalview.schemabinding.version2.Pdbids) \r
+\r
+    /**\r
+     * Method addPdbids\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @param vPdbids\r
+     */\r
+    public void addPdbids(int index, jalview.schemabinding.version2.Pdbids vPdbids)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        _pdbidsList.insertElementAt(vPdbids, index);\r
+    } //-- void addPdbids(int, jalview.schemabinding.version2.Pdbids) \r
+\r
+    /**\r
+     * Method deleteColour\r
+     * \r
+     */\r
+    public void deleteColour()\r
+    {\r
+        this._has_colour= false;\r
+    } //-- void deleteColour() \r
+\r
+    /**\r
+     * Method deleteEnd\r
+     * \r
+     */\r
+    public void deleteEnd()\r
+    {\r
+        this._has_end= false;\r
+    } //-- void deleteEnd() \r
+\r
+    /**\r
+     * Method deleteHidden\r
+     * \r
+     */\r
+    public void deleteHidden()\r
+    {\r
+        this._has_hidden= false;\r
+    } //-- void deleteHidden() \r
+\r
+    /**\r
+     * Method deleteId\r
+     * \r
+     */\r
+    public void deleteId()\r
+    {\r
+        this._has_id= false;\r
+    } //-- void deleteId() \r
+\r
+    /**\r
+     * Method deleteStart\r
+     * \r
+     */\r
+    public void deleteStart()\r
+    {\r
+        this._has_start= false;\r
+    } //-- void deleteStart() \r
+\r
+    /**\r
+     * Method enumerateFeatures\r
+     * \r
+     * \r
+     * \r
+     * @return Enumeration\r
+     */\r
+    public java.util.Enumeration enumerateFeatures()\r
+    {\r
+        return _featuresList.elements();\r
+    } //-- java.util.Enumeration enumerateFeatures() \r
+\r
+    /**\r
+     * Method enumerateHiddenSequences\r
+     * \r
+     * \r
+     * \r
+     * @return Enumeration\r
+     */\r
+    public java.util.Enumeration enumerateHiddenSequences()\r
+    {\r
+        return _hiddenSequencesList.elements();\r
+    } //-- java.util.Enumeration enumerateHiddenSequences() \r
+\r
+    /**\r
+     * Method enumeratePdbids\r
+     * \r
+     * \r
+     * \r
+     * @return Enumeration\r
+     */\r
+    public java.util.Enumeration enumeratePdbids()\r
+    {\r
+        return _pdbidsList.elements();\r
+    } //-- java.util.Enumeration enumeratePdbids() \r
+\r
+    /**\r
+     * Returns the value of field 'colour'.\r
+     * \r
+     * @return int\r
+     * @return the value of field 'colour'.\r
+     */\r
+    public int getColour()\r
+    {\r
+        return this._colour;\r
+    } //-- int getColour() \r
+\r
+    /**\r
+     * Returns the value of field 'end'.\r
+     * \r
+     * @return int\r
+     * @return the value of field 'end'.\r
+     */\r
+    public int getEnd()\r
+    {\r
+        return this._end;\r
+    } //-- int getEnd() \r
+\r
+    /**\r
+     * Method getFeatures\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @return Features\r
+     */\r
+    public jalview.schemabinding.version2.Features getFeatures(int index)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        //-- check bounds for index\r
+        if ((index < 0) || (index > _featuresList.size())) {\r
+            throw new IndexOutOfBoundsException();\r
+        }\r
+        \r
+        return (jalview.schemabinding.version2.Features) _featuresList.elementAt(index);\r
+    } //-- jalview.schemabinding.version2.Features getFeatures(int) \r
+\r
+    /**\r
+     * Method getFeatures\r
+     * \r
+     * \r
+     * \r
+     * @return Features\r
+     */\r
+    public jalview.schemabinding.version2.Features[] getFeatures()\r
+    {\r
+        int size = _featuresList.size();\r
+        jalview.schemabinding.version2.Features[] mArray = new jalview.schemabinding.version2.Features[size];\r
+        for (int index = 0; index < size; index++) {\r
+            mArray[index] = (jalview.schemabinding.version2.Features) _featuresList.elementAt(index);\r
+        }\r
+        return mArray;\r
+    } //-- jalview.schemabinding.version2.Features[] getFeatures() \r
+\r
+    /**\r
+     * Method getFeaturesCount\r
+     * \r
+     * \r
+     * \r
+     * @return int\r
+     */\r
+    public int getFeaturesCount()\r
+    {\r
+        return _featuresList.size();\r
+    } //-- int getFeaturesCount() \r
+\r
+    /**\r
+     * Returns the value of field 'hidden'.\r
+     * \r
+     * @return boolean\r
+     * @return the value of field 'hidden'.\r
+     */\r
+    public boolean getHidden()\r
+    {\r
+        return this._hidden;\r
+    } //-- boolean getHidden() \r
+\r
+    /**\r
+     * Method getHiddenSequences\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @return int\r
+     */\r
+    public int getHiddenSequences(int index)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        //-- check bounds for index\r
+        if ((index < 0) || (index > _hiddenSequencesList.size())) {\r
+            throw new IndexOutOfBoundsException();\r
+        }\r
+        \r
+        return ((java.lang.Integer)_hiddenSequencesList.elementAt(index)).intValue();\r
+    } //-- int getHiddenSequences(int) \r
+\r
+    /**\r
+     * Method getHiddenSequences\r
+     * \r
+     * \r
+     * \r
+     * @return int\r
+     */\r
+    public int[] getHiddenSequences()\r
+    {\r
+        int size = _hiddenSequencesList.size();\r
+        int[] mArray = new int[size];\r
+        for (int index = 0; index < size; index++) {\r
+            mArray[index] = ((java.lang.Integer)_hiddenSequencesList.elementAt(index)).intValue();\r
+        }\r
+        return mArray;\r
+    } //-- int[] getHiddenSequences() \r
+\r
+    /**\r
+     * Method getHiddenSequencesCount\r
+     * \r
+     * \r
+     * \r
+     * @return int\r
+     */\r
+    public int getHiddenSequencesCount()\r
+    {\r
+        return _hiddenSequencesList.size();\r
+    } //-- int getHiddenSequencesCount() \r
+\r
+    /**\r
+     * Returns the value of field 'id'.\r
+     * \r
+     * @return int\r
+     * @return the value of field 'id'.\r
+     */\r
+    public int getId()\r
+    {\r
+        return this._id;\r
+    } //-- int getId() \r
+\r
+    /**\r
+     * Method getPdbids\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @return Pdbids\r
+     */\r
+    public jalview.schemabinding.version2.Pdbids getPdbids(int index)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        //-- check bounds for index\r
+        if ((index < 0) || (index > _pdbidsList.size())) {\r
+            throw new IndexOutOfBoundsException();\r
+        }\r
+        \r
+        return (jalview.schemabinding.version2.Pdbids) _pdbidsList.elementAt(index);\r
+    } //-- jalview.schemabinding.version2.Pdbids getPdbids(int) \r
+\r
+    /**\r
+     * Method getPdbids\r
+     * \r
+     * \r
+     * \r
+     * @return Pdbids\r
+     */\r
+    public jalview.schemabinding.version2.Pdbids[] getPdbids()\r
+    {\r
+        int size = _pdbidsList.size();\r
+        jalview.schemabinding.version2.Pdbids[] mArray = new jalview.schemabinding.version2.Pdbids[size];\r
+        for (int index = 0; index < size; index++) {\r
+            mArray[index] = (jalview.schemabinding.version2.Pdbids) _pdbidsList.elementAt(index);\r
+        }\r
+        return mArray;\r
+    } //-- jalview.schemabinding.version2.Pdbids[] getPdbids() \r
+\r
+    /**\r
+     * Method getPdbidsCount\r
+     * \r
+     * \r
+     * \r
+     * @return int\r
+     */\r
+    public int getPdbidsCount()\r
+    {\r
+        return _pdbidsList.size();\r
+    } //-- int getPdbidsCount() \r
+\r
+    /**\r
+     * Returns the value of field 'start'.\r
+     * \r
+     * @return int\r
+     * @return the value of field 'start'.\r
+     */\r
+    public int getStart()\r
+    {\r
+        return this._start;\r
+    } //-- int getStart() \r
+\r
+    /**\r
+     * Method hasColour\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean hasColour()\r
+    {\r
+        return this._has_colour;\r
+    } //-- boolean hasColour() \r
+\r
+    /**\r
+     * Method hasEnd\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean hasEnd()\r
+    {\r
+        return this._has_end;\r
+    } //-- boolean hasEnd() \r
+\r
+    /**\r
+     * Method hasHidden\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean hasHidden()\r
+    {\r
+        return this._has_hidden;\r
+    } //-- boolean hasHidden() \r
+\r
+    /**\r
+     * Method hasId\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean hasId()\r
+    {\r
+        return this._has_id;\r
+    } //-- boolean hasId() \r
+\r
+    /**\r
+     * Method hasStart\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean hasStart()\r
+    {\r
+        return this._has_start;\r
+    } //-- boolean hasStart() \r
+\r
+    /**\r
+     * Method isValid\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean isValid()\r
+    {\r
+        try {\r
+            validate();\r
+        }\r
+        catch (org.exolab.castor.xml.ValidationException vex) {\r
+            return false;\r
+        }\r
+        return true;\r
+    } //-- boolean isValid() \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param out\r
+     */\r
+    public void marshal(java.io.Writer out)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, out);\r
+    } //-- void marshal(java.io.Writer) \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param handler\r
+     */\r
+    public void marshal(org.xml.sax.ContentHandler handler)\r
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, handler);\r
+    } //-- void marshal(org.xml.sax.ContentHandler) \r
+\r
+    /**\r
+     * Method removeAllFeatures\r
+     * \r
+     */\r
+    public void removeAllFeatures()\r
+    {\r
+        _featuresList.removeAllElements();\r
+    } //-- void removeAllFeatures() \r
+\r
+    /**\r
+     * Method removeAllHiddenSequences\r
+     * \r
+     */\r
+    public void removeAllHiddenSequences()\r
+    {\r
+        _hiddenSequencesList.removeAllElements();\r
+    } //-- void removeAllHiddenSequences() \r
+\r
+    /**\r
+     * Method removeAllPdbids\r
+     * \r
+     */\r
+    public void removeAllPdbids()\r
+    {\r
+        _pdbidsList.removeAllElements();\r
+    } //-- void removeAllPdbids() \r
+\r
+    /**\r
+     * Method removeFeatures\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @return Features\r
+     */\r
+    public jalview.schemabinding.version2.Features removeFeatures(int index)\r
+    {\r
+        java.lang.Object obj = _featuresList.elementAt(index);\r
+        _featuresList.removeElementAt(index);\r
+        return (jalview.schemabinding.version2.Features) obj;\r
+    } //-- jalview.schemabinding.version2.Features removeFeatures(int) \r
+\r
+    /**\r
+     * Method removeHiddenSequences\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @return int\r
+     */\r
+    public int removeHiddenSequences(int index)\r
+    {\r
+        java.lang.Object obj = _hiddenSequencesList.elementAt(index);\r
+        _hiddenSequencesList.removeElementAt(index);\r
+        return ((java.lang.Integer)obj).intValue();\r
+    } //-- int removeHiddenSequences(int) \r
+\r
+    /**\r
+     * Method removePdbids\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @return Pdbids\r
+     */\r
+    public jalview.schemabinding.version2.Pdbids removePdbids(int index)\r
+    {\r
+        java.lang.Object obj = _pdbidsList.elementAt(index);\r
+        _pdbidsList.removeElementAt(index);\r
+        return (jalview.schemabinding.version2.Pdbids) obj;\r
+    } //-- jalview.schemabinding.version2.Pdbids removePdbids(int) \r
+\r
+    /**\r
+     * Sets the value of field 'colour'.\r
+     * \r
+     * @param colour the value of field 'colour'.\r
+     */\r
+    public void setColour(int colour)\r
+    {\r
+        this._colour = colour;\r
+        this._has_colour = true;\r
+    } //-- void setColour(int) \r
+\r
+    /**\r
+     * Sets the value of field 'end'.\r
+     * \r
+     * @param end the value of field 'end'.\r
+     */\r
+    public void setEnd(int end)\r
+    {\r
+        this._end = end;\r
+        this._has_end = true;\r
+    } //-- void setEnd(int) \r
+\r
+    /**\r
+     * Method setFeatures\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @param vFeatures\r
+     */\r
+    public void setFeatures(int index, jalview.schemabinding.version2.Features vFeatures)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        //-- check bounds for index\r
+        if ((index < 0) || (index > _featuresList.size())) {\r
+            throw new IndexOutOfBoundsException();\r
+        }\r
+        _featuresList.setElementAt(vFeatures, index);\r
+    } //-- void setFeatures(int, jalview.schemabinding.version2.Features) \r
+\r
+    /**\r
+     * Method setFeatures\r
+     * \r
+     * \r
+     * \r
+     * @param featuresArray\r
+     */\r
+    public void setFeatures(jalview.schemabinding.version2.Features[] featuresArray)\r
+    {\r
+        //-- copy array\r
+        _featuresList.removeAllElements();\r
+        for (int i = 0; i < featuresArray.length; i++) {\r
+            _featuresList.addElement(featuresArray[i]);\r
+        }\r
+    } //-- void setFeatures(jalview.schemabinding.version2.Features) \r
+\r
+    /**\r
+     * Sets the value of field 'hidden'.\r
+     * \r
+     * @param hidden the value of field 'hidden'.\r
+     */\r
+    public void setHidden(boolean hidden)\r
+    {\r
+        this._hidden = hidden;\r
+        this._has_hidden = true;\r
+    } //-- void setHidden(boolean) \r
+\r
+    /**\r
+     * Method setHiddenSequences\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @param vHiddenSequences\r
+     */\r
+    public void setHiddenSequences(int index, int vHiddenSequences)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        //-- check bounds for index\r
+        if ((index < 0) || (index > _hiddenSequencesList.size())) {\r
+            throw new IndexOutOfBoundsException();\r
+        }\r
+        _hiddenSequencesList.setElementAt(new java.lang.Integer(vHiddenSequences), index);\r
+    } //-- void setHiddenSequences(int, int) \r
+\r
+    /**\r
+     * Method setHiddenSequences\r
+     * \r
+     * \r
+     * \r
+     * @param hiddenSequencesArray\r
+     */\r
+    public void setHiddenSequences(int[] hiddenSequencesArray)\r
+    {\r
+        //-- copy array\r
+        _hiddenSequencesList.removeAllElements();\r
+        for (int i = 0; i < hiddenSequencesArray.length; i++) {\r
+            _hiddenSequencesList.addElement(new java.lang.Integer(hiddenSequencesArray[i]));\r
+        }\r
+    } //-- void setHiddenSequences(int) \r
+\r
+    /**\r
+     * Sets the value of field 'id'.\r
+     * \r
+     * @param id the value of field 'id'.\r
+     */\r
+    public void setId(int id)\r
+    {\r
+        this._id = id;\r
+        this._has_id = true;\r
+    } //-- void setId(int) \r
+\r
+    /**\r
+     * Method setPdbids\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @param vPdbids\r
+     */\r
+    public void setPdbids(int index, jalview.schemabinding.version2.Pdbids vPdbids)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        //-- check bounds for index\r
+        if ((index < 0) || (index > _pdbidsList.size())) {\r
+            throw new IndexOutOfBoundsException();\r
+        }\r
+        _pdbidsList.setElementAt(vPdbids, index);\r
+    } //-- void setPdbids(int, jalview.schemabinding.version2.Pdbids) \r
+\r
+    /**\r
+     * Method setPdbids\r
+     * \r
+     * \r
+     * \r
+     * @param pdbidsArray\r
+     */\r
+    public void setPdbids(jalview.schemabinding.version2.Pdbids[] pdbidsArray)\r
+    {\r
+        //-- copy array\r
+        _pdbidsList.removeAllElements();\r
+        for (int i = 0; i < pdbidsArray.length; i++) {\r
+            _pdbidsList.addElement(pdbidsArray[i]);\r
+        }\r
+    } //-- void setPdbids(jalview.schemabinding.version2.Pdbids) \r
+\r
+    /**\r
+     * Sets the value of field 'start'.\r
+     * \r
+     * @param start the value of field 'start'.\r
+     */\r
+    public void setStart(int start)\r
+    {\r
+        this._start = start;\r
+        this._has_start = true;\r
+    } //-- void setStart(int) \r
+\r
+    /**\r
+     * Method unmarshal\r
+     * \r
+     * \r
+     * \r
+     * @param reader\r
+     * @return Object\r
+     */\r
+    public static java.lang.Object unmarshal(java.io.Reader reader)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        return (jalview.schemabinding.version2.JSeq) Unmarshaller.unmarshal(jalview.schemabinding.version2.JSeq.class, reader);\r
+    } //-- java.lang.Object unmarshal(java.io.Reader) \r
+\r
+    /**\r
+     * Method validate\r
+     * \r
+     */\r
+    public void validate()\r
+        throws org.exolab.castor.xml.ValidationException\r
+    {\r
+        org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
+        validator.validate(this);\r
+    } //-- void validate() \r
+\r
+}\r
diff --git a/src/jalview/schemabinding/version2/JSeqDescriptor.java b/src/jalview/schemabinding/version2/JSeqDescriptor.java
new file mode 100755 (executable)
index 0000000..eef74d2
--- /dev/null
@@ -0,0 +1,488 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package jalview.schemabinding.version2;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import org.exolab.castor.mapping.AccessMode;\r
+import org.exolab.castor.xml.TypeValidator;\r
+import org.exolab.castor.xml.XMLFieldDescriptor;\r
+import org.exolab.castor.xml.validators.*;\r
+\r
+/**\r
+ * Class JSeqDescriptor.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class JSeqDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * Field nsPrefix\r
+     */\r
+    private java.lang.String nsPrefix;\r
+\r
+    /**\r
+     * Field nsURI\r
+     */\r
+    private java.lang.String nsURI;\r
+\r
+    /**\r
+     * Field xmlName\r
+     */\r
+    private java.lang.String xmlName;\r
+\r
+    /**\r
+     * Field identity\r
+     */\r
+    private org.exolab.castor.xml.XMLFieldDescriptor identity;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public JSeqDescriptor() {\r
+        super();\r
+        nsURI = "www.jalview.org";\r
+        xmlName = "JSeq";\r
+        \r
+        //-- set grouping compositor\r
+        setCompositorAsSequence();\r
+        org.exolab.castor.xml.util.XMLFieldDescriptorImpl  desc           = null;\r
+        org.exolab.castor.xml.XMLFieldHandler              handler        = null;\r
+        org.exolab.castor.xml.FieldValidator               fieldValidator = null;\r
+        //-- initialize attribute descriptors\r
+        \r
+        //-- _colour\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_colour", "colour", org.exolab.castor.xml.NodeType.Attribute);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                JSeq target = (JSeq) object;\r
+                if(!target.hasColour())\r
+                    return null;\r
+                return new java.lang.Integer(target.getColour());\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    JSeq target = (JSeq) object;\r
+                    // if null, use delete method for optional primitives \r
+                    if (value == null) {\r
+                        target.deleteColour();\r
+                        return;\r
+                    }\r
+                    target.setColour( ((java.lang.Integer)value).intValue());\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _colour\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            IntegerValidator typeValidator= new IntegerValidator();\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _start\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_start", "start", org.exolab.castor.xml.NodeType.Attribute);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                JSeq target = (JSeq) object;\r
+                if(!target.hasStart())\r
+                    return null;\r
+                return new java.lang.Integer(target.getStart());\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    JSeq target = (JSeq) object;\r
+                    // ignore null values for non optional primitives\r
+                    if (value == null) return;\r
+                    \r
+                    target.setStart( ((java.lang.Integer)value).intValue());\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        desc.setRequired(true);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _start\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        fieldValidator.setMinOccurs(1);\r
+        { //-- local scope\r
+            IntegerValidator typeValidator= new IntegerValidator();\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _end\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_end", "end", org.exolab.castor.xml.NodeType.Attribute);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                JSeq target = (JSeq) object;\r
+                if(!target.hasEnd())\r
+                    return null;\r
+                return new java.lang.Integer(target.getEnd());\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    JSeq target = (JSeq) object;\r
+                    // ignore null values for non optional primitives\r
+                    if (value == null) return;\r
+                    \r
+                    target.setEnd( ((java.lang.Integer)value).intValue());\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        desc.setRequired(true);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _end\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        fieldValidator.setMinOccurs(1);\r
+        { //-- local scope\r
+            IntegerValidator typeValidator= new IntegerValidator();\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _id\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_id", "id", org.exolab.castor.xml.NodeType.Attribute);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                JSeq target = (JSeq) object;\r
+                if(!target.hasId())\r
+                    return null;\r
+                return new java.lang.Integer(target.getId());\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    JSeq target = (JSeq) object;\r
+                    // ignore null values for non optional primitives\r
+                    if (value == null) return;\r
+                    \r
+                    target.setId( ((java.lang.Integer)value).intValue());\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        desc.setRequired(true);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _id\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        fieldValidator.setMinOccurs(1);\r
+        { //-- local scope\r
+            IntegerValidator typeValidator= new IntegerValidator();\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _hidden\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_hidden", "hidden", org.exolab.castor.xml.NodeType.Attribute);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                JSeq target = (JSeq) object;\r
+                if(!target.hasHidden())\r
+                    return null;\r
+                return (target.getHidden() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    JSeq target = (JSeq) object;\r
+                    // if null, use delete method for optional primitives \r
+                    if (value == null) {\r
+                        target.deleteHidden();\r
+                        return;\r
+                    }\r
+                    target.setHidden( ((java.lang.Boolean)value).booleanValue());\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _hidden\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            BooleanValidator typeValidator = new BooleanValidator();\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- initialize element descriptors\r
+        \r
+        //-- _featuresList\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(jalview.schemabinding.version2.Features.class, "_featuresList", "features", org.exolab.castor.xml.NodeType.Element);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                JSeq target = (JSeq) object;\r
+                return target.getFeatures();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    JSeq target = (JSeq) object;\r
+                    target.addFeatures( (jalview.schemabinding.version2.Features) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return new jalview.schemabinding.version2.Features();\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        desc.setNameSpaceURI("www.jalview.org");\r
+        desc.setMultivalued(true);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _featuresList\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        fieldValidator.setMinOccurs(0);\r
+        { //-- local scope\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _pdbidsList\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(jalview.schemabinding.version2.Pdbids.class, "_pdbidsList", "pdbids", org.exolab.castor.xml.NodeType.Element);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                JSeq target = (JSeq) object;\r
+                return target.getPdbids();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    JSeq target = (JSeq) object;\r
+                    target.addPdbids( (jalview.schemabinding.version2.Pdbids) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return new jalview.schemabinding.version2.Pdbids();\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        desc.setNameSpaceURI("www.jalview.org");\r
+        desc.setMultivalued(true);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _pdbidsList\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        fieldValidator.setMinOccurs(0);\r
+        { //-- local scope\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _hiddenSequencesList\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_hiddenSequencesList", "hiddenSequences", org.exolab.castor.xml.NodeType.Element);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                JSeq target = (JSeq) object;\r
+                return target.getHiddenSequences();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    JSeq target = (JSeq) object;\r
+                    // ignore null values for non optional primitives\r
+                    if (value == null) return;\r
+                    \r
+                    target.addHiddenSequences( ((java.lang.Integer)value).intValue());\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        desc.setNameSpaceURI("www.jalview.org");\r
+        desc.setMultivalued(true);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _hiddenSequencesList\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        fieldValidator.setMinOccurs(0);\r
+        { //-- local scope\r
+            IntegerValidator typeValidator= new IntegerValidator();\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+    } //-- jalview.schemabinding.version2.JSeqDescriptor()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Method getAccessMode\r
+     * \r
+     * \r
+     * \r
+     * @return AccessMode\r
+     */\r
+    public org.exolab.castor.mapping.AccessMode getAccessMode()\r
+    {\r
+        return null;\r
+    } //-- org.exolab.castor.mapping.AccessMode getAccessMode() \r
+\r
+    /**\r
+     * Method getExtends\r
+     * \r
+     * \r
+     * \r
+     * @return ClassDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.ClassDescriptor getExtends()\r
+    {\r
+        return null;\r
+    } //-- org.exolab.castor.mapping.ClassDescriptor getExtends() \r
+\r
+    /**\r
+     * Method getIdentity\r
+     * \r
+     * \r
+     * \r
+     * @return FieldDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.FieldDescriptor getIdentity()\r
+    {\r
+        return identity;\r
+    } //-- org.exolab.castor.mapping.FieldDescriptor getIdentity() \r
+\r
+    /**\r
+     * Method getJavaClass\r
+     * \r
+     * \r
+     * \r
+     * @return Class\r
+     */\r
+    public java.lang.Class getJavaClass()\r
+    {\r
+        return jalview.schemabinding.version2.JSeq.class;\r
+    } //-- java.lang.Class getJavaClass() \r
+\r
+    /**\r
+     * Method getNameSpacePrefix\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpacePrefix()\r
+    {\r
+        return nsPrefix;\r
+    } //-- java.lang.String getNameSpacePrefix() \r
+\r
+    /**\r
+     * Method getNameSpaceURI\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpaceURI()\r
+    {\r
+        return nsURI;\r
+    } //-- java.lang.String getNameSpaceURI() \r
+\r
+    /**\r
+     * Method getValidator\r
+     * \r
+     * \r
+     * \r
+     * @return TypeValidator\r
+     */\r
+    public org.exolab.castor.xml.TypeValidator getValidator()\r
+    {\r
+        return this;\r
+    } //-- org.exolab.castor.xml.TypeValidator getValidator() \r
+\r
+    /**\r
+     * Method getXMLName\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getXMLName()\r
+    {\r
+        return xmlName;\r
+    } //-- java.lang.String getXMLName() \r
+\r
+}\r
diff --git a/src/jalview/schemabinding/version2/JalviewModel.java b/src/jalview/schemabinding/version2/JalviewModel.java
new file mode 100755 (executable)
index 0000000..fe8deef
--- /dev/null
@@ -0,0 +1,227 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package jalview.schemabinding.version2;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import java.io.IOException;\r
+import java.io.Reader;\r
+import java.io.Serializable;\r
+import java.io.Writer;\r
+import java.util.Date;\r
+import org.exolab.castor.xml.MarshalException;\r
+import org.exolab.castor.xml.Marshaller;\r
+import org.exolab.castor.xml.Unmarshaller;\r
+import org.exolab.castor.xml.ValidationException;\r
+import org.xml.sax.ContentHandler;\r
+\r
+/**\r
+ * Class JalviewModel.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class JalviewModel implements java.io.Serializable {\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * Field _creationDate\r
+     */\r
+    private java.util.Date _creationDate;\r
+\r
+    /**\r
+     * Field _version\r
+     */\r
+    private java.lang.String _version;\r
+\r
+    /**\r
+     * Field _vamsasModel\r
+     */\r
+    private jalview.schemabinding.version2.VamsasModel _vamsasModel;\r
+\r
+    /**\r
+     * Field _jalviewModelSequence\r
+     */\r
+    private jalview.schemabinding.version2.JalviewModelSequence _jalviewModelSequence;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public JalviewModel() {\r
+        super();\r
+    } //-- jalview.schemabinding.version2.JalviewModel()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Returns the value of field 'creationDate'.\r
+     * \r
+     * @return Date\r
+     * @return the value of field 'creationDate'.\r
+     */\r
+    public java.util.Date getCreationDate()\r
+    {\r
+        return this._creationDate;\r
+    } //-- java.util.Date getCreationDate() \r
+\r
+    /**\r
+     * Returns the value of field 'jalviewModelSequence'.\r
+     * \r
+     * @return JalviewModelSequence\r
+     * @return the value of field 'jalviewModelSequence'.\r
+     */\r
+    public jalview.schemabinding.version2.JalviewModelSequence getJalviewModelSequence()\r
+    {\r
+        return this._jalviewModelSequence;\r
+    } //-- jalview.schemabinding.version2.JalviewModelSequence getJalviewModelSequence() \r
+\r
+    /**\r
+     * Returns the value of field 'vamsasModel'.\r
+     * \r
+     * @return VamsasModel\r
+     * @return the value of field 'vamsasModel'.\r
+     */\r
+    public jalview.schemabinding.version2.VamsasModel getVamsasModel()\r
+    {\r
+        return this._vamsasModel;\r
+    } //-- jalview.schemabinding.version2.VamsasModel getVamsasModel() \r
+\r
+    /**\r
+     * Returns the value of field 'version'.\r
+     * \r
+     * @return String\r
+     * @return the value of field 'version'.\r
+     */\r
+    public java.lang.String getVersion()\r
+    {\r
+        return this._version;\r
+    } //-- java.lang.String getVersion() \r
+\r
+    /**\r
+     * Method isValid\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean isValid()\r
+    {\r
+        try {\r
+            validate();\r
+        }\r
+        catch (org.exolab.castor.xml.ValidationException vex) {\r
+            return false;\r
+        }\r
+        return true;\r
+    } //-- boolean isValid() \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param out\r
+     */\r
+    public void marshal(java.io.Writer out)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, out);\r
+    } //-- void marshal(java.io.Writer) \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param handler\r
+     */\r
+    public void marshal(org.xml.sax.ContentHandler handler)\r
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, handler);\r
+    } //-- void marshal(org.xml.sax.ContentHandler) \r
+\r
+    /**\r
+     * Sets the value of field 'creationDate'.\r
+     * \r
+     * @param creationDate the value of field 'creationDate'.\r
+     */\r
+    public void setCreationDate(java.util.Date creationDate)\r
+    {\r
+        this._creationDate = creationDate;\r
+    } //-- void setCreationDate(java.util.Date) \r
+\r
+    /**\r
+     * Sets the value of field 'jalviewModelSequence'.\r
+     * \r
+     * @param jalviewModelSequence the value of field\r
+     * 'jalviewModelSequence'.\r
+     */\r
+    public void setJalviewModelSequence(jalview.schemabinding.version2.JalviewModelSequence jalviewModelSequence)\r
+    {\r
+        this._jalviewModelSequence = jalviewModelSequence;\r
+    } //-- void setJalviewModelSequence(jalview.schemabinding.version2.JalviewModelSequence) \r
+\r
+    /**\r
+     * Sets the value of field 'vamsasModel'.\r
+     * \r
+     * @param vamsasModel the value of field 'vamsasModel'.\r
+     */\r
+    public void setVamsasModel(jalview.schemabinding.version2.VamsasModel vamsasModel)\r
+    {\r
+        this._vamsasModel = vamsasModel;\r
+    } //-- void setVamsasModel(jalview.schemabinding.version2.VamsasModel) \r
+\r
+    /**\r
+     * Sets the value of field 'version'.\r
+     * \r
+     * @param version the value of field 'version'.\r
+     */\r
+    public void setVersion(java.lang.String version)\r
+    {\r
+        this._version = version;\r
+    } //-- void setVersion(java.lang.String) \r
+\r
+    /**\r
+     * Method unmarshal\r
+     * \r
+     * \r
+     * \r
+     * @param reader\r
+     * @return Object\r
+     */\r
+    public static java.lang.Object unmarshal(java.io.Reader reader)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        return (jalview.schemabinding.version2.JalviewModel) Unmarshaller.unmarshal(jalview.schemabinding.version2.JalviewModel.class, reader);\r
+    } //-- java.lang.Object unmarshal(java.io.Reader) \r
+\r
+    /**\r
+     * Method validate\r
+     * \r
+     */\r
+    public void validate()\r
+        throws org.exolab.castor.xml.ValidationException\r
+    {\r
+        org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
+        validator.validate(this);\r
+    } //-- void validate() \r
+\r
+}\r
diff --git a/src/jalview/schemabinding/version2/JalviewModelDescriptor.java b/src/jalview/schemabinding/version2/JalviewModelDescriptor.java
new file mode 100755 (executable)
index 0000000..ad2dc13
--- /dev/null
@@ -0,0 +1,324 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package jalview.schemabinding.version2;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import org.exolab.castor.mapping.AccessMode;\r
+import org.exolab.castor.xml.TypeValidator;\r
+import org.exolab.castor.xml.XMLFieldDescriptor;\r
+import org.exolab.castor.xml.validators.*;\r
+\r
+/**\r
+ * Class JalviewModelDescriptor.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class JalviewModelDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * Field nsPrefix\r
+     */\r
+    private java.lang.String nsPrefix;\r
+\r
+    /**\r
+     * Field nsURI\r
+     */\r
+    private java.lang.String nsURI;\r
+\r
+    /**\r
+     * Field xmlName\r
+     */\r
+    private java.lang.String xmlName;\r
+\r
+    /**\r
+     * Field identity\r
+     */\r
+    private org.exolab.castor.xml.XMLFieldDescriptor identity;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public JalviewModelDescriptor() {\r
+        super();\r
+        nsURI = "www.jalview.org";\r
+        xmlName = "JalviewModel";\r
+        \r
+        //-- set grouping compositor\r
+        setCompositorAsSequence();\r
+        org.exolab.castor.xml.util.XMLFieldDescriptorImpl  desc           = null;\r
+        org.exolab.castor.xml.XMLFieldHandler              handler        = null;\r
+        org.exolab.castor.xml.FieldValidator               fieldValidator = null;\r
+        //-- initialize attribute descriptors\r
+        \r
+        //-- initialize element descriptors\r
+        \r
+        //-- _creationDate\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.util.Date.class, "_creationDate", "creationDate", org.exolab.castor.xml.NodeType.Element);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                JalviewModel target = (JalviewModel) object;\r
+                return target.getCreationDate();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    JalviewModel target = (JalviewModel) object;\r
+                    target.setCreationDate( (java.util.Date) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return new java.util.Date();\r
+            }\r
+        } );\r
+        desc.setHandler( new org.exolab.castor.xml.handlers.DateFieldHandler(handler));\r
+        desc.setImmutable(true);\r
+        desc.setNameSpaceURI("www.jalview.org");\r
+        desc.setRequired(true);\r
+        desc.setMultivalued(false);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _creationDate\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        fieldValidator.setMinOccurs(1);\r
+        { //-- local scope\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _version\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_version", "version", org.exolab.castor.xml.NodeType.Element);\r
+        desc.setImmutable(true);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                JalviewModel target = (JalviewModel) object;\r
+                return target.getVersion();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    JalviewModel target = (JalviewModel) object;\r
+                    target.setVersion( (java.lang.String) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        desc.setNameSpaceURI("www.jalview.org");\r
+        desc.setRequired(true);\r
+        desc.setMultivalued(false);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _version\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        fieldValidator.setMinOccurs(1);\r
+        { //-- local scope\r
+            StringValidator typeValidator = new StringValidator();\r
+            typeValidator.setWhiteSpace("preserve");\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _vamsasModel\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(jalview.schemabinding.version2.VamsasModel.class, "_vamsasModel", "vamsasModel", org.exolab.castor.xml.NodeType.Element);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                JalviewModel target = (JalviewModel) object;\r
+                return target.getVamsasModel();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    JalviewModel target = (JalviewModel) object;\r
+                    target.setVamsasModel( (jalview.schemabinding.version2.VamsasModel) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return new jalview.schemabinding.version2.VamsasModel();\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        desc.setNameSpaceURI("www.jalview.org");\r
+        desc.setRequired(true);\r
+        desc.setMultivalued(false);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _vamsasModel\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        fieldValidator.setMinOccurs(1);\r
+        { //-- local scope\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _jalviewModelSequence\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(jalview.schemabinding.version2.JalviewModelSequence.class, "_jalviewModelSequence", "-error-if-this-is-used-", org.exolab.castor.xml.NodeType.Element);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                JalviewModel target = (JalviewModel) object;\r
+                return target.getJalviewModelSequence();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    JalviewModel target = (JalviewModel) object;\r
+                    target.setJalviewModelSequence( (jalview.schemabinding.version2.JalviewModelSequence) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return new jalview.schemabinding.version2.JalviewModelSequence();\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        desc.setContainer(true);\r
+        desc.setClassDescriptor(new jalview.schemabinding.version2.JalviewModelSequenceDescriptor());\r
+        desc.setNameSpaceURI("www.jalview.org");\r
+        desc.setRequired(true);\r
+        desc.setMultivalued(false);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _jalviewModelSequence\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        fieldValidator.setMinOccurs(1);\r
+        { //-- local scope\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+    } //-- jalview.schemabinding.version2.JalviewModelDescriptor()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Method getAccessMode\r
+     * \r
+     * \r
+     * \r
+     * @return AccessMode\r
+     */\r
+    public org.exolab.castor.mapping.AccessMode getAccessMode()\r
+    {\r
+        return null;\r
+    } //-- org.exolab.castor.mapping.AccessMode getAccessMode() \r
+\r
+    /**\r
+     * Method getExtends\r
+     * \r
+     * \r
+     * \r
+     * @return ClassDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.ClassDescriptor getExtends()\r
+    {\r
+        return null;\r
+    } //-- org.exolab.castor.mapping.ClassDescriptor getExtends() \r
+\r
+    /**\r
+     * Method getIdentity\r
+     * \r
+     * \r
+     * \r
+     * @return FieldDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.FieldDescriptor getIdentity()\r
+    {\r
+        return identity;\r
+    } //-- org.exolab.castor.mapping.FieldDescriptor getIdentity() \r
+\r
+    /**\r
+     * Method getJavaClass\r
+     * \r
+     * \r
+     * \r
+     * @return Class\r
+     */\r
+    public java.lang.Class getJavaClass()\r
+    {\r
+        return jalview.schemabinding.version2.JalviewModel.class;\r
+    } //-- java.lang.Class getJavaClass() \r
+\r
+    /**\r
+     * Method getNameSpacePrefix\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpacePrefix()\r
+    {\r
+        return nsPrefix;\r
+    } //-- java.lang.String getNameSpacePrefix() \r
+\r
+    /**\r
+     * Method getNameSpaceURI\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpaceURI()\r
+    {\r
+        return nsURI;\r
+    } //-- java.lang.String getNameSpaceURI() \r
+\r
+    /**\r
+     * Method getValidator\r
+     * \r
+     * \r
+     * \r
+     * @return TypeValidator\r
+     */\r
+    public org.exolab.castor.xml.TypeValidator getValidator()\r
+    {\r
+        return this;\r
+    } //-- org.exolab.castor.xml.TypeValidator getValidator() \r
+\r
+    /**\r
+     * Method getXMLName\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getXMLName()\r
+    {\r
+        return xmlName;\r
+    } //-- java.lang.String getXMLName() \r
+\r
+}\r
diff --git a/src/jalview/schemabinding/version2/JalviewModelSequence.java b/src/jalview/schemabinding/version2/JalviewModelSequence.java
new file mode 100755 (executable)
index 0000000..45f486b
--- /dev/null
@@ -0,0 +1,904 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package jalview.schemabinding.version2;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import java.io.IOException;\r
+import java.io.Reader;\r
+import java.io.Serializable;\r
+import java.io.Writer;\r
+import java.util.Enumeration;\r
+import java.util.Vector;\r
+import org.exolab.castor.xml.MarshalException;\r
+import org.exolab.castor.xml.Marshaller;\r
+import org.exolab.castor.xml.Unmarshaller;\r
+import org.exolab.castor.xml.ValidationException;\r
+import org.xml.sax.ContentHandler;\r
+\r
+/**\r
+ * Class JalviewModelSequence.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class JalviewModelSequence implements java.io.Serializable {\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * Field _JSeqList\r
+     */\r
+    private java.util.Vector _JSeqList;\r
+\r
+    /**\r
+     * Field _JGroupList\r
+     */\r
+    private java.util.Vector _JGroupList;\r
+\r
+    /**\r
+     * Field _viewportList\r
+     */\r
+    private java.util.Vector _viewportList;\r
+\r
+    /**\r
+     * Field _userColoursList\r
+     */\r
+    private java.util.Vector _userColoursList;\r
+\r
+    /**\r
+     * Field _treeList\r
+     */\r
+    private java.util.Vector _treeList;\r
+\r
+    /**\r
+     * Field _featureSettings\r
+     */\r
+    private jalview.schemabinding.version2.FeatureSettings _featureSettings;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public JalviewModelSequence() {\r
+        super();\r
+        _JSeqList = new Vector();\r
+        _JGroupList = new Vector();\r
+        _viewportList = new Vector();\r
+        _userColoursList = new Vector();\r
+        _treeList = new Vector();\r
+    } //-- jalview.schemabinding.version2.JalviewModelSequence()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Method addJGroup\r
+     * \r
+     * \r
+     * \r
+     * @param vJGroup\r
+     */\r
+    public void addJGroup(jalview.schemabinding.version2.JGroup vJGroup)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        _JGroupList.addElement(vJGroup);\r
+    } //-- void addJGroup(jalview.schemabinding.version2.JGroup) \r
+\r
+    /**\r
+     * Method addJGroup\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @param vJGroup\r
+     */\r
+    public void addJGroup(int index, jalview.schemabinding.version2.JGroup vJGroup)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        _JGroupList.insertElementAt(vJGroup, index);\r
+    } //-- void addJGroup(int, jalview.schemabinding.version2.JGroup) \r
+\r
+    /**\r
+     * Method addJSeq\r
+     * \r
+     * \r
+     * \r
+     * @param vJSeq\r
+     */\r
+    public void addJSeq(jalview.schemabinding.version2.JSeq vJSeq)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        _JSeqList.addElement(vJSeq);\r
+    } //-- void addJSeq(jalview.schemabinding.version2.JSeq) \r
+\r
+    /**\r
+     * Method addJSeq\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @param vJSeq\r
+     */\r
+    public void addJSeq(int index, jalview.schemabinding.version2.JSeq vJSeq)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        _JSeqList.insertElementAt(vJSeq, index);\r
+    } //-- void addJSeq(int, jalview.schemabinding.version2.JSeq) \r
+\r
+    /**\r
+     * Method addTree\r
+     * \r
+     * \r
+     * \r
+     * @param vTree\r
+     */\r
+    public void addTree(jalview.schemabinding.version2.Tree vTree)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        _treeList.addElement(vTree);\r
+    } //-- void addTree(jalview.schemabinding.version2.Tree) \r
+\r
+    /**\r
+     * Method addTree\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @param vTree\r
+     */\r
+    public void addTree(int index, jalview.schemabinding.version2.Tree vTree)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        _treeList.insertElementAt(vTree, index);\r
+    } //-- void addTree(int, jalview.schemabinding.version2.Tree) \r
+\r
+    /**\r
+     * Method addUserColours\r
+     * \r
+     * \r
+     * \r
+     * @param vUserColours\r
+     */\r
+    public void addUserColours(jalview.schemabinding.version2.UserColours vUserColours)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        _userColoursList.addElement(vUserColours);\r
+    } //-- void addUserColours(jalview.schemabinding.version2.UserColours) \r
+\r
+    /**\r
+     * Method addUserColours\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @param vUserColours\r
+     */\r
+    public void addUserColours(int index, jalview.schemabinding.version2.UserColours vUserColours)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        _userColoursList.insertElementAt(vUserColours, index);\r
+    } //-- void addUserColours(int, jalview.schemabinding.version2.UserColours) \r
+\r
+    /**\r
+     * Method addViewport\r
+     * \r
+     * \r
+     * \r
+     * @param vViewport\r
+     */\r
+    public void addViewport(jalview.schemabinding.version2.Viewport vViewport)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        _viewportList.addElement(vViewport);\r
+    } //-- void addViewport(jalview.schemabinding.version2.Viewport) \r
+\r
+    /**\r
+     * Method addViewport\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @param vViewport\r
+     */\r
+    public void addViewport(int index, jalview.schemabinding.version2.Viewport vViewport)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        _viewportList.insertElementAt(vViewport, index);\r
+    } //-- void addViewport(int, jalview.schemabinding.version2.Viewport) \r
+\r
+    /**\r
+     * Method enumerateJGroup\r
+     * \r
+     * \r
+     * \r
+     * @return Enumeration\r
+     */\r
+    public java.util.Enumeration enumerateJGroup()\r
+    {\r
+        return _JGroupList.elements();\r
+    } //-- java.util.Enumeration enumerateJGroup() \r
+\r
+    /**\r
+     * Method enumerateJSeq\r
+     * \r
+     * \r
+     * \r
+     * @return Enumeration\r
+     */\r
+    public java.util.Enumeration enumerateJSeq()\r
+    {\r
+        return _JSeqList.elements();\r
+    } //-- java.util.Enumeration enumerateJSeq() \r
+\r
+    /**\r
+     * Method enumerateTree\r
+     * \r
+     * \r
+     * \r
+     * @return Enumeration\r
+     */\r
+    public java.util.Enumeration enumerateTree()\r
+    {\r
+        return _treeList.elements();\r
+    } //-- java.util.Enumeration enumerateTree() \r
+\r
+    /**\r
+     * Method enumerateUserColours\r
+     * \r
+     * \r
+     * \r
+     * @return Enumeration\r
+     */\r
+    public java.util.Enumeration enumerateUserColours()\r
+    {\r
+        return _userColoursList.elements();\r
+    } //-- java.util.Enumeration enumerateUserColours() \r
+\r
+    /**\r
+     * Method enumerateViewport\r
+     * \r
+     * \r
+     * \r
+     * @return Enumeration\r
+     */\r
+    public java.util.Enumeration enumerateViewport()\r
+    {\r
+        return _viewportList.elements();\r
+    } //-- java.util.Enumeration enumerateViewport() \r
+\r
+    /**\r
+     * Returns the value of field 'featureSettings'.\r
+     * \r
+     * @return FeatureSettings\r
+     * @return the value of field 'featureSettings'.\r
+     */\r
+    public jalview.schemabinding.version2.FeatureSettings getFeatureSettings()\r
+    {\r
+        return this._featureSettings;\r
+    } //-- jalview.schemabinding.version2.FeatureSettings getFeatureSettings() \r
+\r
+    /**\r
+     * Method getJGroup\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @return JGroup\r
+     */\r
+    public jalview.schemabinding.version2.JGroup getJGroup(int index)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        //-- check bounds for index\r
+        if ((index < 0) || (index > _JGroupList.size())) {\r
+            throw new IndexOutOfBoundsException();\r
+        }\r
+        \r
+        return (jalview.schemabinding.version2.JGroup) _JGroupList.elementAt(index);\r
+    } //-- jalview.schemabinding.version2.JGroup getJGroup(int) \r
+\r
+    /**\r
+     * Method getJGroup\r
+     * \r
+     * \r
+     * \r
+     * @return JGroup\r
+     */\r
+    public jalview.schemabinding.version2.JGroup[] getJGroup()\r
+    {\r
+        int size = _JGroupList.size();\r
+        jalview.schemabinding.version2.JGroup[] mArray = new jalview.schemabinding.version2.JGroup[size];\r
+        for (int index = 0; index < size; index++) {\r
+            mArray[index] = (jalview.schemabinding.version2.JGroup) _JGroupList.elementAt(index);\r
+        }\r
+        return mArray;\r
+    } //-- jalview.schemabinding.version2.JGroup[] getJGroup() \r
+\r
+    /**\r
+     * Method getJGroupCount\r
+     * \r
+     * \r
+     * \r
+     * @return int\r
+     */\r
+    public int getJGroupCount()\r
+    {\r
+        return _JGroupList.size();\r
+    } //-- int getJGroupCount() \r
+\r
+    /**\r
+     * Method getJSeq\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @return JSeq\r
+     */\r
+    public jalview.schemabinding.version2.JSeq getJSeq(int index)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        //-- check bounds for index\r
+        if ((index < 0) || (index > _JSeqList.size())) {\r
+            throw new IndexOutOfBoundsException();\r
+        }\r
+        \r
+        return (jalview.schemabinding.version2.JSeq) _JSeqList.elementAt(index);\r
+    } //-- jalview.schemabinding.version2.JSeq getJSeq(int) \r
+\r
+    /**\r
+     * Method getJSeq\r
+     * \r
+     * \r
+     * \r
+     * @return JSeq\r
+     */\r
+    public jalview.schemabinding.version2.JSeq[] getJSeq()\r
+    {\r
+        int size = _JSeqList.size();\r
+        jalview.schemabinding.version2.JSeq[] mArray = new jalview.schemabinding.version2.JSeq[size];\r
+        for (int index = 0; index < size; index++) {\r
+            mArray[index] = (jalview.schemabinding.version2.JSeq) _JSeqList.elementAt(index);\r
+        }\r
+        return mArray;\r
+    } //-- jalview.schemabinding.version2.JSeq[] getJSeq() \r
+\r
+    /**\r
+     * Method getJSeqCount\r
+     * \r
+     * \r
+     * \r
+     * @return int\r
+     */\r
+    public int getJSeqCount()\r
+    {\r
+        return _JSeqList.size();\r
+    } //-- int getJSeqCount() \r
+\r
+    /**\r
+     * Method getTree\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @return Tree\r
+     */\r
+    public jalview.schemabinding.version2.Tree getTree(int index)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        //-- check bounds for index\r
+        if ((index < 0) || (index > _treeList.size())) {\r
+            throw new IndexOutOfBoundsException();\r
+        }\r
+        \r
+        return (jalview.schemabinding.version2.Tree) _treeList.elementAt(index);\r
+    } //-- jalview.schemabinding.version2.Tree getTree(int) \r
+\r
+    /**\r
+     * Method getTree\r
+     * \r
+     * \r
+     * \r
+     * @return Tree\r
+     */\r
+    public jalview.schemabinding.version2.Tree[] getTree()\r
+    {\r
+        int size = _treeList.size();\r
+        jalview.schemabinding.version2.Tree[] mArray = new jalview.schemabinding.version2.Tree[size];\r
+        for (int index = 0; index < size; index++) {\r
+            mArray[index] = (jalview.schemabinding.version2.Tree) _treeList.elementAt(index);\r
+        }\r
+        return mArray;\r
+    } //-- jalview.schemabinding.version2.Tree[] getTree() \r
+\r
+    /**\r
+     * Method getTreeCount\r
+     * \r
+     * \r
+     * \r
+     * @return int\r
+     */\r
+    public int getTreeCount()\r
+    {\r
+        return _treeList.size();\r
+    } //-- int getTreeCount() \r
+\r
+    /**\r
+     * Method getUserColours\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @return UserColours\r
+     */\r
+    public jalview.schemabinding.version2.UserColours getUserColours(int index)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        //-- check bounds for index\r
+        if ((index < 0) || (index > _userColoursList.size())) {\r
+            throw new IndexOutOfBoundsException();\r
+        }\r
+        \r
+        return (jalview.schemabinding.version2.UserColours) _userColoursList.elementAt(index);\r
+    } //-- jalview.schemabinding.version2.UserColours getUserColours(int) \r
+\r
+    /**\r
+     * Method getUserColours\r
+     * \r
+     * \r
+     * \r
+     * @return UserColours\r
+     */\r
+    public jalview.schemabinding.version2.UserColours[] getUserColours()\r
+    {\r
+        int size = _userColoursList.size();\r
+        jalview.schemabinding.version2.UserColours[] mArray = new jalview.schemabinding.version2.UserColours[size];\r
+        for (int index = 0; index < size; index++) {\r
+            mArray[index] = (jalview.schemabinding.version2.UserColours) _userColoursList.elementAt(index);\r
+        }\r
+        return mArray;\r
+    } //-- jalview.schemabinding.version2.UserColours[] getUserColours() \r
+\r
+    /**\r
+     * Method getUserColoursCount\r
+     * \r
+     * \r
+     * \r
+     * @return int\r
+     */\r
+    public int getUserColoursCount()\r
+    {\r
+        return _userColoursList.size();\r
+    } //-- int getUserColoursCount() \r
+\r
+    /**\r
+     * Method getViewport\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @return Viewport\r
+     */\r
+    public jalview.schemabinding.version2.Viewport getViewport(int index)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        //-- check bounds for index\r
+        if ((index < 0) || (index > _viewportList.size())) {\r
+            throw new IndexOutOfBoundsException();\r
+        }\r
+        \r
+        return (jalview.schemabinding.version2.Viewport) _viewportList.elementAt(index);\r
+    } //-- jalview.schemabinding.version2.Viewport getViewport(int) \r
+\r
+    /**\r
+     * Method getViewport\r
+     * \r
+     * \r
+     * \r
+     * @return Viewport\r
+     */\r
+    public jalview.schemabinding.version2.Viewport[] getViewport()\r
+    {\r
+        int size = _viewportList.size();\r
+        jalview.schemabinding.version2.Viewport[] mArray = new jalview.schemabinding.version2.Viewport[size];\r
+        for (int index = 0; index < size; index++) {\r
+            mArray[index] = (jalview.schemabinding.version2.Viewport) _viewportList.elementAt(index);\r
+        }\r
+        return mArray;\r
+    } //-- jalview.schemabinding.version2.Viewport[] getViewport() \r
+\r
+    /**\r
+     * Method getViewportCount\r
+     * \r
+     * \r
+     * \r
+     * @return int\r
+     */\r
+    public int getViewportCount()\r
+    {\r
+        return _viewportList.size();\r
+    } //-- int getViewportCount() \r
+\r
+    /**\r
+     * Method isValid\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean isValid()\r
+    {\r
+        try {\r
+            validate();\r
+        }\r
+        catch (org.exolab.castor.xml.ValidationException vex) {\r
+            return false;\r
+        }\r
+        return true;\r
+    } //-- boolean isValid() \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param out\r
+     */\r
+    public void marshal(java.io.Writer out)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, out);\r
+    } //-- void marshal(java.io.Writer) \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param handler\r
+     */\r
+    public void marshal(org.xml.sax.ContentHandler handler)\r
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, handler);\r
+    } //-- void marshal(org.xml.sax.ContentHandler) \r
+\r
+    /**\r
+     * Method removeAllJGroup\r
+     * \r
+     */\r
+    public void removeAllJGroup()\r
+    {\r
+        _JGroupList.removeAllElements();\r
+    } //-- void removeAllJGroup() \r
+\r
+    /**\r
+     * Method removeAllJSeq\r
+     * \r
+     */\r
+    public void removeAllJSeq()\r
+    {\r
+        _JSeqList.removeAllElements();\r
+    } //-- void removeAllJSeq() \r
+\r
+    /**\r
+     * Method removeAllTree\r
+     * \r
+     */\r
+    public void removeAllTree()\r
+    {\r
+        _treeList.removeAllElements();\r
+    } //-- void removeAllTree() \r
+\r
+    /**\r
+     * Method removeAllUserColours\r
+     * \r
+     */\r
+    public void removeAllUserColours()\r
+    {\r
+        _userColoursList.removeAllElements();\r
+    } //-- void removeAllUserColours() \r
+\r
+    /**\r
+     * Method removeAllViewport\r
+     * \r
+     */\r
+    public void removeAllViewport()\r
+    {\r
+        _viewportList.removeAllElements();\r
+    } //-- void removeAllViewport() \r
+\r
+    /**\r
+     * Method removeJGroup\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @return JGroup\r
+     */\r
+    public jalview.schemabinding.version2.JGroup removeJGroup(int index)\r
+    {\r
+        java.lang.Object obj = _JGroupList.elementAt(index);\r
+        _JGroupList.removeElementAt(index);\r
+        return (jalview.schemabinding.version2.JGroup) obj;\r
+    } //-- jalview.schemabinding.version2.JGroup removeJGroup(int) \r
+\r
+    /**\r
+     * Method removeJSeq\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @return JSeq\r
+     */\r
+    public jalview.schemabinding.version2.JSeq removeJSeq(int index)\r
+    {\r
+        java.lang.Object obj = _JSeqList.elementAt(index);\r
+        _JSeqList.removeElementAt(index);\r
+        return (jalview.schemabinding.version2.JSeq) obj;\r
+    } //-- jalview.schemabinding.version2.JSeq removeJSeq(int) \r
+\r
+    /**\r
+     * Method removeTree\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @return Tree\r
+     */\r
+    public jalview.schemabinding.version2.Tree removeTree(int index)\r
+    {\r
+        java.lang.Object obj = _treeList.elementAt(index);\r
+        _treeList.removeElementAt(index);\r
+        return (jalview.schemabinding.version2.Tree) obj;\r
+    } //-- jalview.schemabinding.version2.Tree removeTree(int) \r
+\r
+    /**\r
+     * Method removeUserColours\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @return UserColours\r
+     */\r
+    public jalview.schemabinding.version2.UserColours removeUserColours(int index)\r
+    {\r
+        java.lang.Object obj = _userColoursList.elementAt(index);\r
+        _userColoursList.removeElementAt(index);\r
+        return (jalview.schemabinding.version2.UserColours) obj;\r
+    } //-- jalview.schemabinding.version2.UserColours removeUserColours(int) \r
+\r
+    /**\r
+     * Method removeViewport\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @return Viewport\r
+     */\r
+    public jalview.schemabinding.version2.Viewport removeViewport(int index)\r
+    {\r
+        java.lang.Object obj = _viewportList.elementAt(index);\r
+        _viewportList.removeElementAt(index);\r
+        return (jalview.schemabinding.version2.Viewport) obj;\r
+    } //-- jalview.schemabinding.version2.Viewport removeViewport(int) \r
+\r
+    /**\r
+     * Sets the value of field 'featureSettings'.\r
+     * \r
+     * @param featureSettings the value of field 'featureSettings'.\r
+     */\r
+    public void setFeatureSettings(jalview.schemabinding.version2.FeatureSettings featureSettings)\r
+    {\r
+        this._featureSettings = featureSettings;\r
+    } //-- void setFeatureSettings(jalview.schemabinding.version2.FeatureSettings) \r
+\r
+    /**\r
+     * Method setJGroup\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @param vJGroup\r
+     */\r
+    public void setJGroup(int index, jalview.schemabinding.version2.JGroup vJGroup)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        //-- check bounds for index\r
+        if ((index < 0) || (index > _JGroupList.size())) {\r
+            throw new IndexOutOfBoundsException();\r
+        }\r
+        _JGroupList.setElementAt(vJGroup, index);\r
+    } //-- void setJGroup(int, jalview.schemabinding.version2.JGroup) \r
+\r
+    /**\r
+     * Method setJGroup\r
+     * \r
+     * \r
+     * \r
+     * @param JGroupArray\r
+     */\r
+    public void setJGroup(jalview.schemabinding.version2.JGroup[] JGroupArray)\r
+    {\r
+        //-- copy array\r
+        _JGroupList.removeAllElements();\r
+        for (int i = 0; i < JGroupArray.length; i++) {\r
+            _JGroupList.addElement(JGroupArray[i]);\r
+        }\r
+    } //-- void setJGroup(jalview.schemabinding.version2.JGroup) \r
+\r
+    /**\r
+     * Method setJSeq\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @param vJSeq\r
+     */\r
+    public void setJSeq(int index, jalview.schemabinding.version2.JSeq vJSeq)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        //-- check bounds for index\r
+        if ((index < 0) || (index > _JSeqList.size())) {\r
+            throw new IndexOutOfBoundsException();\r
+        }\r
+        _JSeqList.setElementAt(vJSeq, index);\r
+    } //-- void setJSeq(int, jalview.schemabinding.version2.JSeq) \r
+\r
+    /**\r
+     * Method setJSeq\r
+     * \r
+     * \r
+     * \r
+     * @param JSeqArray\r
+     */\r
+    public void setJSeq(jalview.schemabinding.version2.JSeq[] JSeqArray)\r
+    {\r
+        //-- copy array\r
+        _JSeqList.removeAllElements();\r
+        for (int i = 0; i < JSeqArray.length; i++) {\r
+            _JSeqList.addElement(JSeqArray[i]);\r
+        }\r
+    } //-- void setJSeq(jalview.schemabinding.version2.JSeq) \r
+\r
+    /**\r
+     * Method setTree\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @param vTree\r
+     */\r
+    public void setTree(int index, jalview.schemabinding.version2.Tree vTree)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        //-- check bounds for index\r
+        if ((index < 0) || (index > _treeList.size())) {\r
+            throw new IndexOutOfBoundsException();\r
+        }\r
+        _treeList.setElementAt(vTree, index);\r
+    } //-- void setTree(int, jalview.schemabinding.version2.Tree) \r
+\r
+    /**\r
+     * Method setTree\r
+     * \r
+     * \r
+     * \r
+     * @param treeArray\r
+     */\r
+    public void setTree(jalview.schemabinding.version2.Tree[] treeArray)\r
+    {\r
+        //-- copy array\r
+        _treeList.removeAllElements();\r
+        for (int i = 0; i < treeArray.length; i++) {\r
+            _treeList.addElement(treeArray[i]);\r
+        }\r
+    } //-- void setTree(jalview.schemabinding.version2.Tree) \r
+\r
+    /**\r
+     * Method setUserColours\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @param vUserColours\r
+     */\r
+    public void setUserColours(int index, jalview.schemabinding.version2.UserColours vUserColours)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        //-- check bounds for index\r
+        if ((index < 0) || (index > _userColoursList.size())) {\r
+            throw new IndexOutOfBoundsException();\r
+        }\r
+        _userColoursList.setElementAt(vUserColours, index);\r
+    } //-- void setUserColours(int, jalview.schemabinding.version2.UserColours) \r
+\r
+    /**\r
+     * Method setUserColours\r
+     * \r
+     * \r
+     * \r
+     * @param userColoursArray\r
+     */\r
+    public void setUserColours(jalview.schemabinding.version2.UserColours[] userColoursArray)\r
+    {\r
+        //-- copy array\r
+        _userColoursList.removeAllElements();\r
+        for (int i = 0; i < userColoursArray.length; i++) {\r
+            _userColoursList.addElement(userColoursArray[i]);\r
+        }\r
+    } //-- void setUserColours(jalview.schemabinding.version2.UserColours) \r
+\r
+    /**\r
+     * Method setViewport\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @param vViewport\r
+     */\r
+    public void setViewport(int index, jalview.schemabinding.version2.Viewport vViewport)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        //-- check bounds for index\r
+        if ((index < 0) || (index > _viewportList.size())) {\r
+            throw new IndexOutOfBoundsException();\r
+        }\r
+        _viewportList.setElementAt(vViewport, index);\r
+    } //-- void setViewport(int, jalview.schemabinding.version2.Viewport) \r
+\r
+    /**\r
+     * Method setViewport\r
+     * \r
+     * \r
+     * \r
+     * @param viewportArray\r
+     */\r
+    public void setViewport(jalview.schemabinding.version2.Viewport[] viewportArray)\r
+    {\r
+        //-- copy array\r
+        _viewportList.removeAllElements();\r
+        for (int i = 0; i < viewportArray.length; i++) {\r
+            _viewportList.addElement(viewportArray[i]);\r
+        }\r
+    } //-- void setViewport(jalview.schemabinding.version2.Viewport) \r
+\r
+    /**\r
+     * Method unmarshal\r
+     * \r
+     * \r
+     * \r
+     * @param reader\r
+     * @return Object\r
+     */\r
+    public static java.lang.Object unmarshal(java.io.Reader reader)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        return (jalview.schemabinding.version2.JalviewModelSequence) Unmarshaller.unmarshal(jalview.schemabinding.version2.JalviewModelSequence.class, reader);\r
+    } //-- java.lang.Object unmarshal(java.io.Reader) \r
+\r
+    /**\r
+     * Method validate\r
+     * \r
+     */\r
+    public void validate()\r
+        throws org.exolab.castor.xml.ValidationException\r
+    {\r
+        org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
+        validator.validate(this);\r
+    } //-- void validate() \r
+\r
+}\r
diff --git a/src/jalview/schemabinding/version2/JalviewModelSequenceDescriptor.java b/src/jalview/schemabinding/version2/JalviewModelSequenceDescriptor.java
new file mode 100755 (executable)
index 0000000..7f5bd43
--- /dev/null
@@ -0,0 +1,383 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package jalview.schemabinding.version2;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import org.exolab.castor.mapping.AccessMode;\r
+import org.exolab.castor.xml.TypeValidator;\r
+import org.exolab.castor.xml.XMLFieldDescriptor;\r
+import org.exolab.castor.xml.validators.*;\r
+\r
+/**\r
+ * Class JalviewModelSequenceDescriptor.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class JalviewModelSequenceDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * Field nsPrefix\r
+     */\r
+    private java.lang.String nsPrefix;\r
+\r
+    /**\r
+     * Field nsURI\r
+     */\r
+    private java.lang.String nsURI;\r
+\r
+    /**\r
+     * Field xmlName\r
+     */\r
+    private java.lang.String xmlName;\r
+\r
+    /**\r
+     * Field identity\r
+     */\r
+    private org.exolab.castor.xml.XMLFieldDescriptor identity;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public JalviewModelSequenceDescriptor() {\r
+        super();\r
+        nsURI = "www.jalview.org";\r
+        \r
+        //-- set grouping compositor\r
+        setCompositorAsSequence();\r
+        org.exolab.castor.xml.util.XMLFieldDescriptorImpl  desc           = null;\r
+        org.exolab.castor.xml.XMLFieldHandler              handler        = null;\r
+        org.exolab.castor.xml.FieldValidator               fieldValidator = null;\r
+        //-- initialize attribute descriptors\r
+        \r
+        //-- initialize element descriptors\r
+        \r
+        //-- _JSeqList\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(jalview.schemabinding.version2.JSeq.class, "_JSeqList", "JSeq", org.exolab.castor.xml.NodeType.Element);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                JalviewModelSequence target = (JalviewModelSequence) object;\r
+                return target.getJSeq();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    JalviewModelSequence target = (JalviewModelSequence) object;\r
+                    target.addJSeq( (jalview.schemabinding.version2.JSeq) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return new jalview.schemabinding.version2.JSeq();\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        desc.setNameSpaceURI("www.jalview.org");\r
+        desc.setRequired(true);\r
+        desc.setMultivalued(true);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _JSeqList\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        fieldValidator.setMinOccurs(1);\r
+        { //-- local scope\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _JGroupList\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(jalview.schemabinding.version2.JGroup.class, "_JGroupList", "JGroup", org.exolab.castor.xml.NodeType.Element);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                JalviewModelSequence target = (JalviewModelSequence) object;\r
+                return target.getJGroup();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    JalviewModelSequence target = (JalviewModelSequence) object;\r
+                    target.addJGroup( (jalview.schemabinding.version2.JGroup) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return new jalview.schemabinding.version2.JGroup();\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        desc.setNameSpaceURI("www.jalview.org");\r
+        desc.setMultivalued(true);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _JGroupList\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        fieldValidator.setMinOccurs(0);\r
+        { //-- local scope\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _viewportList\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(jalview.schemabinding.version2.Viewport.class, "_viewportList", "Viewport", org.exolab.castor.xml.NodeType.Element);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                JalviewModelSequence target = (JalviewModelSequence) object;\r
+                return target.getViewport();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    JalviewModelSequence target = (JalviewModelSequence) object;\r
+                    target.addViewport( (jalview.schemabinding.version2.Viewport) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return new jalview.schemabinding.version2.Viewport();\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        desc.setNameSpaceURI("www.jalview.org");\r
+        desc.setRequired(true);\r
+        desc.setMultivalued(true);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _viewportList\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        fieldValidator.setMinOccurs(1);\r
+        { //-- local scope\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _userColoursList\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(jalview.schemabinding.version2.UserColours.class, "_userColoursList", "UserColours", org.exolab.castor.xml.NodeType.Element);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                JalviewModelSequence target = (JalviewModelSequence) object;\r
+                return target.getUserColours();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    JalviewModelSequence target = (JalviewModelSequence) object;\r
+                    target.addUserColours( (jalview.schemabinding.version2.UserColours) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return new jalview.schemabinding.version2.UserColours();\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        desc.setNameSpaceURI("www.jalview.org");\r
+        desc.setMultivalued(true);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _userColoursList\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        fieldValidator.setMinOccurs(0);\r
+        { //-- local scope\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _treeList\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(jalview.schemabinding.version2.Tree.class, "_treeList", "tree", org.exolab.castor.xml.NodeType.Element);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                JalviewModelSequence target = (JalviewModelSequence) object;\r
+                return target.getTree();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    JalviewModelSequence target = (JalviewModelSequence) object;\r
+                    target.addTree( (jalview.schemabinding.version2.Tree) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return new jalview.schemabinding.version2.Tree();\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        desc.setNameSpaceURI("www.jalview.org");\r
+        desc.setMultivalued(true);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _treeList\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        fieldValidator.setMinOccurs(0);\r
+        { //-- local scope\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _featureSettings\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(jalview.schemabinding.version2.FeatureSettings.class, "_featureSettings", "FeatureSettings", org.exolab.castor.xml.NodeType.Element);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                JalviewModelSequence target = (JalviewModelSequence) object;\r
+                return target.getFeatureSettings();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    JalviewModelSequence target = (JalviewModelSequence) object;\r
+                    target.setFeatureSettings( (jalview.schemabinding.version2.FeatureSettings) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return new jalview.schemabinding.version2.FeatureSettings();\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        desc.setNameSpaceURI("www.jalview.org");\r
+        desc.setMultivalued(false);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _featureSettings\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+    } //-- jalview.schemabinding.version2.JalviewModelSequenceDescriptor()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Method getAccessMode\r
+     * \r
+     * \r
+     * \r
+     * @return AccessMode\r
+     */\r
+    public org.exolab.castor.mapping.AccessMode getAccessMode()\r
+    {\r
+        return null;\r
+    } //-- org.exolab.castor.mapping.AccessMode getAccessMode() \r
+\r
+    /**\r
+     * Method getExtends\r
+     * \r
+     * \r
+     * \r
+     * @return ClassDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.ClassDescriptor getExtends()\r
+    {\r
+        return null;\r
+    } //-- org.exolab.castor.mapping.ClassDescriptor getExtends() \r
+\r
+    /**\r
+     * Method getIdentity\r
+     * \r
+     * \r
+     * \r
+     * @return FieldDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.FieldDescriptor getIdentity()\r
+    {\r
+        return identity;\r
+    } //-- org.exolab.castor.mapping.FieldDescriptor getIdentity() \r
+\r
+    /**\r
+     * Method getJavaClass\r
+     * \r
+     * \r
+     * \r
+     * @return Class\r
+     */\r
+    public java.lang.Class getJavaClass()\r
+    {\r
+        return jalview.schemabinding.version2.JalviewModelSequence.class;\r
+    } //-- java.lang.Class getJavaClass() \r
+\r
+    /**\r
+     * Method getNameSpacePrefix\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpacePrefix()\r
+    {\r
+        return nsPrefix;\r
+    } //-- java.lang.String getNameSpacePrefix() \r
+\r
+    /**\r
+     * Method getNameSpaceURI\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpaceURI()\r
+    {\r
+        return nsURI;\r
+    } //-- java.lang.String getNameSpaceURI() \r
+\r
+    /**\r
+     * Method getValidator\r
+     * \r
+     * \r
+     * \r
+     * @return TypeValidator\r
+     */\r
+    public org.exolab.castor.xml.TypeValidator getValidator()\r
+    {\r
+        return this;\r
+    } //-- org.exolab.castor.xml.TypeValidator getValidator() \r
+\r
+    /**\r
+     * Method getXMLName\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getXMLName()\r
+    {\r
+        return xmlName;\r
+    } //-- java.lang.String getXMLName() \r
+\r
+}\r
diff --git a/src/jalview/schemabinding/version2/JalviewUserColours.java b/src/jalview/schemabinding/version2/JalviewUserColours.java
new file mode 100755 (executable)
index 0000000..7963596
--- /dev/null
@@ -0,0 +1,300 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package jalview.schemabinding.version2;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import java.io.IOException;\r
+import java.io.Reader;\r
+import java.io.Serializable;\r
+import java.io.Writer;\r
+import java.util.Enumeration;\r
+import java.util.Vector;\r
+import org.exolab.castor.xml.MarshalException;\r
+import org.exolab.castor.xml.Marshaller;\r
+import org.exolab.castor.xml.Unmarshaller;\r
+import org.exolab.castor.xml.ValidationException;\r
+import org.xml.sax.ContentHandler;\r
+\r
+/**\r
+ * Class JalviewUserColours.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class JalviewUserColours implements java.io.Serializable {\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * Field _schemeName\r
+     */\r
+    private java.lang.String _schemeName;\r
+\r
+    /**\r
+     * Field _colourList\r
+     */\r
+    private java.util.Vector _colourList;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public JalviewUserColours() {\r
+        super();\r
+        _colourList = new Vector();\r
+    } //-- jalview.schemabinding.version2.JalviewUserColours()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Method addColour\r
+     * \r
+     * \r
+     * \r
+     * @param vColour\r
+     */\r
+    public void addColour(jalview.schemabinding.version2.Colour vColour)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        _colourList.addElement(vColour);\r
+    } //-- void addColour(jalview.schemabinding.version2.Colour) \r
+\r
+    /**\r
+     * Method addColour\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @param vColour\r
+     */\r
+    public void addColour(int index, jalview.schemabinding.version2.Colour vColour)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        _colourList.insertElementAt(vColour, index);\r
+    } //-- void addColour(int, jalview.schemabinding.version2.Colour) \r
+\r
+    /**\r
+     * Method enumerateColour\r
+     * \r
+     * \r
+     * \r
+     * @return Enumeration\r
+     */\r
+    public java.util.Enumeration enumerateColour()\r
+    {\r
+        return _colourList.elements();\r
+    } //-- java.util.Enumeration enumerateColour() \r
+\r
+    /**\r
+     * Method getColour\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @return Colour\r
+     */\r
+    public jalview.schemabinding.version2.Colour getColour(int index)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        //-- check bounds for index\r
+        if ((index < 0) || (index > _colourList.size())) {\r
+            throw new IndexOutOfBoundsException();\r
+        }\r
+        \r
+        return (jalview.schemabinding.version2.Colour) _colourList.elementAt(index);\r
+    } //-- jalview.schemabinding.version2.Colour getColour(int) \r
+\r
+    /**\r
+     * Method getColour\r
+     * \r
+     * \r
+     * \r
+     * @return Colour\r
+     */\r
+    public jalview.schemabinding.version2.Colour[] getColour()\r
+    {\r
+        int size = _colourList.size();\r
+        jalview.schemabinding.version2.Colour[] mArray = new jalview.schemabinding.version2.Colour[size];\r
+        for (int index = 0; index < size; index++) {\r
+            mArray[index] = (jalview.schemabinding.version2.Colour) _colourList.elementAt(index);\r
+        }\r
+        return mArray;\r
+    } //-- jalview.schemabinding.version2.Colour[] getColour() \r
+\r
+    /**\r
+     * Method getColourCount\r
+     * \r
+     * \r
+     * \r
+     * @return int\r
+     */\r
+    public int getColourCount()\r
+    {\r
+        return _colourList.size();\r
+    } //-- int getColourCount() \r
+\r
+    /**\r
+     * Returns the value of field 'schemeName'.\r
+     * \r
+     * @return String\r
+     * @return the value of field 'schemeName'.\r
+     */\r
+    public java.lang.String getSchemeName()\r
+    {\r
+        return this._schemeName;\r
+    } //-- java.lang.String getSchemeName() \r
+\r
+    /**\r
+     * Method isValid\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean isValid()\r
+    {\r
+        try {\r
+            validate();\r
+        }\r
+        catch (org.exolab.castor.xml.ValidationException vex) {\r
+            return false;\r
+        }\r
+        return true;\r
+    } //-- boolean isValid() \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param out\r
+     */\r
+    public void marshal(java.io.Writer out)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, out);\r
+    } //-- void marshal(java.io.Writer) \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param handler\r
+     */\r
+    public void marshal(org.xml.sax.ContentHandler handler)\r
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, handler);\r
+    } //-- void marshal(org.xml.sax.ContentHandler) \r
+\r
+    /**\r
+     * Method removeAllColour\r
+     * \r
+     */\r
+    public void removeAllColour()\r
+    {\r
+        _colourList.removeAllElements();\r
+    } //-- void removeAllColour() \r
+\r
+    /**\r
+     * Method removeColour\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @return Colour\r
+     */\r
+    public jalview.schemabinding.version2.Colour removeColour(int index)\r
+    {\r
+        java.lang.Object obj = _colourList.elementAt(index);\r
+        _colourList.removeElementAt(index);\r
+        return (jalview.schemabinding.version2.Colour) obj;\r
+    } //-- jalview.schemabinding.version2.Colour removeColour(int) \r
+\r
+    /**\r
+     * Method setColour\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @param vColour\r
+     */\r
+    public void setColour(int index, jalview.schemabinding.version2.Colour vColour)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        //-- check bounds for index\r
+        if ((index < 0) || (index > _colourList.size())) {\r
+            throw new IndexOutOfBoundsException();\r
+        }\r
+        _colourList.setElementAt(vColour, index);\r
+    } //-- void setColour(int, jalview.schemabinding.version2.Colour) \r
+\r
+    /**\r
+     * Method setColour\r
+     * \r
+     * \r
+     * \r
+     * @param colourArray\r
+     */\r
+    public void setColour(jalview.schemabinding.version2.Colour[] colourArray)\r
+    {\r
+        //-- copy array\r
+        _colourList.removeAllElements();\r
+        for (int i = 0; i < colourArray.length; i++) {\r
+            _colourList.addElement(colourArray[i]);\r
+        }\r
+    } //-- void setColour(jalview.schemabinding.version2.Colour) \r
+\r
+    /**\r
+     * Sets the value of field 'schemeName'.\r
+     * \r
+     * @param schemeName the value of field 'schemeName'.\r
+     */\r
+    public void setSchemeName(java.lang.String schemeName)\r
+    {\r
+        this._schemeName = schemeName;\r
+    } //-- void setSchemeName(java.lang.String) \r
+\r
+    /**\r
+     * Method unmarshal\r
+     * \r
+     * \r
+     * \r
+     * @param reader\r
+     * @return Object\r
+     */\r
+    public static java.lang.Object unmarshal(java.io.Reader reader)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        return (jalview.schemabinding.version2.JalviewUserColours) Unmarshaller.unmarshal(jalview.schemabinding.version2.JalviewUserColours.class, reader);\r
+    } //-- java.lang.Object unmarshal(java.io.Reader) \r
+\r
+    /**\r
+     * Method validate\r
+     * \r
+     */\r
+    public void validate()\r
+        throws org.exolab.castor.xml.ValidationException\r
+    {\r
+        org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
+        validator.validate(this);\r
+    } //-- void validate() \r
+\r
+}\r
diff --git a/src/jalview/schemabinding/version2/JalviewUserColoursDescriptor.java b/src/jalview/schemabinding/version2/JalviewUserColoursDescriptor.java
new file mode 100755 (executable)
index 0000000..661d102
--- /dev/null
@@ -0,0 +1,244 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package jalview.schemabinding.version2;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import org.exolab.castor.mapping.AccessMode;\r
+import org.exolab.castor.xml.TypeValidator;\r
+import org.exolab.castor.xml.XMLFieldDescriptor;\r
+import org.exolab.castor.xml.validators.*;\r
+\r
+/**\r
+ * Class JalviewUserColoursDescriptor.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class JalviewUserColoursDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * Field nsPrefix\r
+     */\r
+    private java.lang.String nsPrefix;\r
+\r
+    /**\r
+     * Field nsURI\r
+     */\r
+    private java.lang.String nsURI;\r
+\r
+    /**\r
+     * Field xmlName\r
+     */\r
+    private java.lang.String xmlName;\r
+\r
+    /**\r
+     * Field identity\r
+     */\r
+    private org.exolab.castor.xml.XMLFieldDescriptor identity;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public JalviewUserColoursDescriptor() {\r
+        super();\r
+        nsURI = "www.jalview.org/colours";\r
+        xmlName = "JalviewUserColours";\r
+        \r
+        //-- set grouping compositor\r
+        setCompositorAsSequence();\r
+        org.exolab.castor.xml.util.XMLFieldDescriptorImpl  desc           = null;\r
+        org.exolab.castor.xml.XMLFieldHandler              handler        = null;\r
+        org.exolab.castor.xml.FieldValidator               fieldValidator = null;\r
+        //-- initialize attribute descriptors\r
+        \r
+        //-- _schemeName\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_schemeName", "schemeName", org.exolab.castor.xml.NodeType.Attribute);\r
+        desc.setImmutable(true);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                JalviewUserColours target = (JalviewUserColours) object;\r
+                return target.getSchemeName();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    JalviewUserColours target = (JalviewUserColours) object;\r
+                    target.setSchemeName( (java.lang.String) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _schemeName\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            StringValidator typeValidator = new StringValidator();\r
+            typeValidator.setWhiteSpace("preserve");\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- initialize element descriptors\r
+        \r
+        //-- _colourList\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(jalview.schemabinding.version2.Colour.class, "_colourList", "colour", org.exolab.castor.xml.NodeType.Element);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                JalviewUserColours target = (JalviewUserColours) object;\r
+                return target.getColour();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    JalviewUserColours target = (JalviewUserColours) object;\r
+                    target.addColour( (jalview.schemabinding.version2.Colour) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return new jalview.schemabinding.version2.Colour();\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        desc.setRequired(true);\r
+        desc.setMultivalued(true);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _colourList\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        fieldValidator.setMinOccurs(1);\r
+        { //-- local scope\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+    } //-- jalview.schemabinding.version2.JalviewUserColoursDescriptor()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Method getAccessMode\r
+     * \r
+     * \r
+     * \r
+     * @return AccessMode\r
+     */\r
+    public org.exolab.castor.mapping.AccessMode getAccessMode()\r
+    {\r
+        return null;\r
+    } //-- org.exolab.castor.mapping.AccessMode getAccessMode() \r
+\r
+    /**\r
+     * Method getExtends\r
+     * \r
+     * \r
+     * \r
+     * @return ClassDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.ClassDescriptor getExtends()\r
+    {\r
+        return null;\r
+    } //-- org.exolab.castor.mapping.ClassDescriptor getExtends() \r
+\r
+    /**\r
+     * Method getIdentity\r
+     * \r
+     * \r
+     * \r
+     * @return FieldDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.FieldDescriptor getIdentity()\r
+    {\r
+        return identity;\r
+    } //-- org.exolab.castor.mapping.FieldDescriptor getIdentity() \r
+\r
+    /**\r
+     * Method getJavaClass\r
+     * \r
+     * \r
+     * \r
+     * @return Class\r
+     */\r
+    public java.lang.Class getJavaClass()\r
+    {\r
+        return jalview.schemabinding.version2.JalviewUserColours.class;\r
+    } //-- java.lang.Class getJavaClass() \r
+\r
+    /**\r
+     * Method getNameSpacePrefix\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpacePrefix()\r
+    {\r
+        return nsPrefix;\r
+    } //-- java.lang.String getNameSpacePrefix() \r
+\r
+    /**\r
+     * Method getNameSpaceURI\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpaceURI()\r
+    {\r
+        return nsURI;\r
+    } //-- java.lang.String getNameSpaceURI() \r
+\r
+    /**\r
+     * Method getValidator\r
+     * \r
+     * \r
+     * \r
+     * @return TypeValidator\r
+     */\r
+    public org.exolab.castor.xml.TypeValidator getValidator()\r
+    {\r
+        return this;\r
+    } //-- org.exolab.castor.xml.TypeValidator getValidator() \r
+\r
+    /**\r
+     * Method getXMLName\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getXMLName()\r
+    {\r
+        return xmlName;\r
+    } //-- java.lang.String getXMLName() \r
+\r
+}\r
diff --git a/src/jalview/schemabinding/version2/OtherData.java b/src/jalview/schemabinding/version2/OtherData.java
new file mode 100644 (file)
index 0000000..47423eb
--- /dev/null
@@ -0,0 +1,173 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package jalview.schemabinding.version2;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import java.io.IOException;\r
+import java.io.Reader;\r
+import java.io.Serializable;\r
+import java.io.Writer;\r
+import org.exolab.castor.xml.MarshalException;\r
+import org.exolab.castor.xml.Marshaller;\r
+import org.exolab.castor.xml.Unmarshaller;\r
+import org.exolab.castor.xml.ValidationException;\r
+import org.xml.sax.ContentHandler;\r
+\r
+/**\r
+ * Class OtherData.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class OtherData implements java.io.Serializable {\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * Field _key\r
+     */\r
+    private java.lang.String _key;\r
+\r
+    /**\r
+     * Field _value\r
+     */\r
+    private java.lang.String _value;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public OtherData() {\r
+        super();\r
+    } //-- jalview.schemabinding.version2.OtherData()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Returns the value of field 'key'.\r
+     * \r
+     * @return String\r
+     * @return the value of field 'key'.\r
+     */\r
+    public java.lang.String getKey()\r
+    {\r
+        return this._key;\r
+    } //-- java.lang.String getKey() \r
+\r
+    /**\r
+     * Returns the value of field 'value'.\r
+     * \r
+     * @return String\r
+     * @return the value of field 'value'.\r
+     */\r
+    public java.lang.String getValue()\r
+    {\r
+        return this._value;\r
+    } //-- java.lang.String getValue() \r
+\r
+    /**\r
+     * Method isValid\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean isValid()\r
+    {\r
+        try {\r
+            validate();\r
+        }\r
+        catch (org.exolab.castor.xml.ValidationException vex) {\r
+            return false;\r
+        }\r
+        return true;\r
+    } //-- boolean isValid() \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param out\r
+     */\r
+    public void marshal(java.io.Writer out)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, out);\r
+    } //-- void marshal(java.io.Writer) \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param handler\r
+     */\r
+    public void marshal(org.xml.sax.ContentHandler handler)\r
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, handler);\r
+    } //-- void marshal(org.xml.sax.ContentHandler) \r
+\r
+    /**\r
+     * Sets the value of field 'key'.\r
+     * \r
+     * @param key the value of field 'key'.\r
+     */\r
+    public void setKey(java.lang.String key)\r
+    {\r
+        this._key = key;\r
+    } //-- void setKey(java.lang.String) \r
+\r
+    /**\r
+     * Sets the value of field 'value'.\r
+     * \r
+     * @param value the value of field 'value'.\r
+     */\r
+    public void setValue(java.lang.String value)\r
+    {\r
+        this._value = value;\r
+    } //-- void setValue(java.lang.String) \r
+\r
+    /**\r
+     * Method unmarshal\r
+     * \r
+     * \r
+     * \r
+     * @param reader\r
+     * @return Object\r
+     */\r
+    public static java.lang.Object unmarshal(java.io.Reader reader)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        return (jalview.schemabinding.version2.OtherData) Unmarshaller.unmarshal(jalview.schemabinding.version2.OtherData.class, reader);\r
+    } //-- java.lang.Object unmarshal(java.io.Reader) \r
+\r
+    /**\r
+     * Method validate\r
+     * \r
+     */\r
+    public void validate()\r
+        throws org.exolab.castor.xml.ValidationException\r
+    {\r
+        org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
+        validator.validate(this);\r
+    } //-- void validate() \r
+\r
+}\r
diff --git a/src/jalview/schemabinding/version2/OtherDataDescriptor.java b/src/jalview/schemabinding/version2/OtherDataDescriptor.java
new file mode 100644 (file)
index 0000000..f6ec794
--- /dev/null
@@ -0,0 +1,246 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package jalview.schemabinding.version2;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import org.exolab.castor.mapping.AccessMode;\r
+import org.exolab.castor.xml.TypeValidator;\r
+import org.exolab.castor.xml.XMLFieldDescriptor;\r
+import org.exolab.castor.xml.validators.*;\r
+\r
+/**\r
+ * Class OtherDataDescriptor.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class OtherDataDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * Field nsPrefix\r
+     */\r
+    private java.lang.String nsPrefix;\r
+\r
+    /**\r
+     * Field nsURI\r
+     */\r
+    private java.lang.String nsURI;\r
+\r
+    /**\r
+     * Field xmlName\r
+     */\r
+    private java.lang.String xmlName;\r
+\r
+    /**\r
+     * Field identity\r
+     */\r
+    private org.exolab.castor.xml.XMLFieldDescriptor identity;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public OtherDataDescriptor() {\r
+        super();\r
+        nsURI = "www.jalview.org";\r
+        xmlName = "otherData";\r
+        org.exolab.castor.xml.util.XMLFieldDescriptorImpl  desc           = null;\r
+        org.exolab.castor.xml.XMLFieldHandler              handler        = null;\r
+        org.exolab.castor.xml.FieldValidator               fieldValidator = null;\r
+        //-- initialize attribute descriptors\r
+        \r
+        //-- _key\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_key", "key", org.exolab.castor.xml.NodeType.Attribute);\r
+        desc.setImmutable(true);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                OtherData target = (OtherData) object;\r
+                return target.getKey();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    OtherData target = (OtherData) object;\r
+                    target.setKey( (java.lang.String) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        desc.setRequired(true);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _key\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        fieldValidator.setMinOccurs(1);\r
+        { //-- local scope\r
+            StringValidator typeValidator = new StringValidator();\r
+            typeValidator.setWhiteSpace("preserve");\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _value\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_value", "value", org.exolab.castor.xml.NodeType.Attribute);\r
+        desc.setImmutable(true);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                OtherData target = (OtherData) object;\r
+                return target.getValue();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    OtherData target = (OtherData) object;\r
+                    target.setValue( (java.lang.String) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        desc.setRequired(true);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _value\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        fieldValidator.setMinOccurs(1);\r
+        { //-- local scope\r
+            StringValidator typeValidator = new StringValidator();\r
+            typeValidator.setWhiteSpace("preserve");\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- initialize element descriptors\r
+        \r
+    } //-- jalview.schemabinding.version2.OtherDataDescriptor()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Method getAccessMode\r
+     * \r
+     * \r
+     * \r
+     * @return AccessMode\r
+     */\r
+    public org.exolab.castor.mapping.AccessMode getAccessMode()\r
+    {\r
+        return null;\r
+    } //-- org.exolab.castor.mapping.AccessMode getAccessMode() \r
+\r
+    /**\r
+     * Method getExtends\r
+     * \r
+     * \r
+     * \r
+     * @return ClassDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.ClassDescriptor getExtends()\r
+    {\r
+        return null;\r
+    } //-- org.exolab.castor.mapping.ClassDescriptor getExtends() \r
+\r
+    /**\r
+     * Method getIdentity\r
+     * \r
+     * \r
+     * \r
+     * @return FieldDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.FieldDescriptor getIdentity()\r
+    {\r
+        return identity;\r
+    } //-- org.exolab.castor.mapping.FieldDescriptor getIdentity() \r
+\r
+    /**\r
+     * Method getJavaClass\r
+     * \r
+     * \r
+     * \r
+     * @return Class\r
+     */\r
+    public java.lang.Class getJavaClass()\r
+    {\r
+        return jalview.schemabinding.version2.OtherData.class;\r
+    } //-- java.lang.Class getJavaClass() \r
+\r
+    /**\r
+     * Method getNameSpacePrefix\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpacePrefix()\r
+    {\r
+        return nsPrefix;\r
+    } //-- java.lang.String getNameSpacePrefix() \r
+\r
+    /**\r
+     * Method getNameSpaceURI\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpaceURI()\r
+    {\r
+        return nsURI;\r
+    } //-- java.lang.String getNameSpaceURI() \r
+\r
+    /**\r
+     * Method getValidator\r
+     * \r
+     * \r
+     * \r
+     * @return TypeValidator\r
+     */\r
+    public org.exolab.castor.xml.TypeValidator getValidator()\r
+    {\r
+        return this;\r
+    } //-- org.exolab.castor.xml.TypeValidator getValidator() \r
+\r
+    /**\r
+     * Method getXMLName\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getXMLName()\r
+    {\r
+        return xmlName;\r
+    } //-- java.lang.String getXMLName() \r
+\r
+}\r
diff --git a/src/jalview/schemabinding/version2/Pdbentry.java b/src/jalview/schemabinding/version2/Pdbentry.java
new file mode 100755 (executable)
index 0000000..93c2748
--- /dev/null
@@ -0,0 +1,352 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package jalview.schemabinding.version2;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import java.io.IOException;\r
+import java.io.Reader;\r
+import java.io.Serializable;\r
+import java.io.Writer;\r
+import java.util.Enumeration;\r
+import java.util.Vector;\r
+import org.exolab.castor.xml.MarshalException;\r
+import org.exolab.castor.xml.Marshaller;\r
+import org.exolab.castor.xml.Unmarshaller;\r
+import org.exolab.castor.xml.ValidationException;\r
+import org.xml.sax.ContentHandler;\r
+\r
+/**\r
+ * Class Pdbentry.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class Pdbentry implements java.io.Serializable {\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * Field _id\r
+     */\r
+    private java.lang.String _id;\r
+\r
+    /**\r
+     * Field _type\r
+     */\r
+    private java.lang.String _type;\r
+\r
+    /**\r
+     * Field _file\r
+     */\r
+    private java.lang.String _file;\r
+\r
+    /**\r
+     * Field _items\r
+     */\r
+    private java.util.Vector _items;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public Pdbentry() {\r
+        super();\r
+        _items = new Vector();\r
+    } //-- jalview.schemabinding.version2.Pdbentry()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Method addPdbentryItem\r
+     * \r
+     * \r
+     * \r
+     * @param vPdbentryItem\r
+     */\r
+    public void addPdbentryItem(jalview.schemabinding.version2.PdbentryItem vPdbentryItem)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        _items.addElement(vPdbentryItem);\r
+    } //-- void addPdbentryItem(jalview.schemabinding.version2.PdbentryItem) \r
+\r
+    /**\r
+     * Method addPdbentryItem\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @param vPdbentryItem\r
+     */\r
+    public void addPdbentryItem(int index, jalview.schemabinding.version2.PdbentryItem vPdbentryItem)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        _items.insertElementAt(vPdbentryItem, index);\r
+    } //-- void addPdbentryItem(int, jalview.schemabinding.version2.PdbentryItem) \r
+\r
+    /**\r
+     * Method enumeratePdbentryItem\r
+     * \r
+     * \r
+     * \r
+     * @return Enumeration\r
+     */\r
+    public java.util.Enumeration enumeratePdbentryItem()\r
+    {\r
+        return _items.elements();\r
+    } //-- java.util.Enumeration enumeratePdbentryItem() \r
+\r
+    /**\r
+     * Returns the value of field 'file'.\r
+     * \r
+     * @return String\r
+     * @return the value of field 'file'.\r
+     */\r
+    public java.lang.String getFile()\r
+    {\r
+        return this._file;\r
+    } //-- java.lang.String getFile() \r
+\r
+    /**\r
+     * Returns the value of field 'id'.\r
+     * \r
+     * @return String\r
+     * @return the value of field 'id'.\r
+     */\r
+    public java.lang.String getId()\r
+    {\r
+        return this._id;\r
+    } //-- java.lang.String getId() \r
+\r
+    /**\r
+     * Method getPdbentryItem\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @return PdbentryItem\r
+     */\r
+    public jalview.schemabinding.version2.PdbentryItem getPdbentryItem(int index)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        //-- check bounds for index\r
+        if ((index < 0) || (index > _items.size())) {\r
+            throw new IndexOutOfBoundsException();\r
+        }\r
+        \r
+        return (jalview.schemabinding.version2.PdbentryItem) _items.elementAt(index);\r
+    } //-- jalview.schemabinding.version2.PdbentryItem getPdbentryItem(int) \r
+\r
+    /**\r
+     * Method getPdbentryItem\r
+     * \r
+     * \r
+     * \r
+     * @return PdbentryItem\r
+     */\r
+    public jalview.schemabinding.version2.PdbentryItem[] getPdbentryItem()\r
+    {\r
+        int size = _items.size();\r
+        jalview.schemabinding.version2.PdbentryItem[] mArray = new jalview.schemabinding.version2.PdbentryItem[size];\r
+        for (int index = 0; index < size; index++) {\r
+            mArray[index] = (jalview.schemabinding.version2.PdbentryItem) _items.elementAt(index);\r
+        }\r
+        return mArray;\r
+    } //-- jalview.schemabinding.version2.PdbentryItem[] getPdbentryItem() \r
+\r
+    /**\r
+     * Method getPdbentryItemCount\r
+     * \r
+     * \r
+     * \r
+     * @return int\r
+     */\r
+    public int getPdbentryItemCount()\r
+    {\r
+        return _items.size();\r
+    } //-- int getPdbentryItemCount() \r
+\r
+    /**\r
+     * Returns the value of field 'type'.\r
+     * \r
+     * @return String\r
+     * @return the value of field 'type'.\r
+     */\r
+    public java.lang.String getType()\r
+    {\r
+        return this._type;\r
+    } //-- java.lang.String getType() \r
+\r
+    /**\r
+     * Method isValid\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean isValid()\r
+    {\r
+        try {\r
+            validate();\r
+        }\r
+        catch (org.exolab.castor.xml.ValidationException vex) {\r
+            return false;\r
+        }\r
+        return true;\r
+    } //-- boolean isValid() \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param out\r
+     */\r
+    public void marshal(java.io.Writer out)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, out);\r
+    } //-- void marshal(java.io.Writer) \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param handler\r
+     */\r
+    public void marshal(org.xml.sax.ContentHandler handler)\r
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, handler);\r
+    } //-- void marshal(org.xml.sax.ContentHandler) \r
+\r
+    /**\r
+     * Method removeAllPdbentryItem\r
+     * \r
+     */\r
+    public void removeAllPdbentryItem()\r
+    {\r
+        _items.removeAllElements();\r
+    } //-- void removeAllPdbentryItem() \r
+\r
+    /**\r
+     * Method removePdbentryItem\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @return PdbentryItem\r
+     */\r
+    public jalview.schemabinding.version2.PdbentryItem removePdbentryItem(int index)\r
+    {\r
+        java.lang.Object obj = _items.elementAt(index);\r
+        _items.removeElementAt(index);\r
+        return (jalview.schemabinding.version2.PdbentryItem) obj;\r
+    } //-- jalview.schemabinding.version2.PdbentryItem removePdbentryItem(int) \r
+\r
+    /**\r
+     * Sets the value of field 'file'.\r
+     * \r
+     * @param file the value of field 'file'.\r
+     */\r
+    public void setFile(java.lang.String file)\r
+    {\r
+        this._file = file;\r
+    } //-- void setFile(java.lang.String) \r
+\r
+    /**\r
+     * Sets the value of field 'id'.\r
+     * \r
+     * @param id the value of field 'id'.\r
+     */\r
+    public void setId(java.lang.String id)\r
+    {\r
+        this._id = id;\r
+    } //-- void setId(java.lang.String) \r
+\r
+    /**\r
+     * Method setPdbentryItem\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @param vPdbentryItem\r
+     */\r
+    public void setPdbentryItem(int index, jalview.schemabinding.version2.PdbentryItem vPdbentryItem)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        //-- check bounds for index\r
+        if ((index < 0) || (index > _items.size())) {\r
+            throw new IndexOutOfBoundsException();\r
+        }\r
+        _items.setElementAt(vPdbentryItem, index);\r
+    } //-- void setPdbentryItem(int, jalview.schemabinding.version2.PdbentryItem) \r
+\r
+    /**\r
+     * Method setPdbentryItem\r
+     * \r
+     * \r
+     * \r
+     * @param pdbentryItemArray\r
+     */\r
+    public void setPdbentryItem(jalview.schemabinding.version2.PdbentryItem[] pdbentryItemArray)\r
+    {\r
+        //-- copy array\r
+        _items.removeAllElements();\r
+        for (int i = 0; i < pdbentryItemArray.length; i++) {\r
+            _items.addElement(pdbentryItemArray[i]);\r
+        }\r
+    } //-- void setPdbentryItem(jalview.schemabinding.version2.PdbentryItem) \r
+\r
+    /**\r
+     * Sets the value of field 'type'.\r
+     * \r
+     * @param type the value of field 'type'.\r
+     */\r
+    public void setType(java.lang.String type)\r
+    {\r
+        this._type = type;\r
+    } //-- void setType(java.lang.String) \r
+\r
+    /**\r
+     * Method unmarshal\r
+     * \r
+     * \r
+     * \r
+     * @param reader\r
+     * @return Object\r
+     */\r
+    public static java.lang.Object unmarshal(java.io.Reader reader)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        return (jalview.schemabinding.version2.Pdbentry) Unmarshaller.unmarshal(jalview.schemabinding.version2.Pdbentry.class, reader);\r
+    } //-- java.lang.Object unmarshal(java.io.Reader) \r
+\r
+    /**\r
+     * Method validate\r
+     * \r
+     */\r
+    public void validate()\r
+        throws org.exolab.castor.xml.ValidationException\r
+    {\r
+        org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
+        validator.validate(this);\r
+    } //-- void validate() \r
+\r
+}\r
diff --git a/src/jalview/schemabinding/version2/PdbentryDescriptor.java b/src/jalview/schemabinding/version2/PdbentryDescriptor.java
new file mode 100755 (executable)
index 0000000..61a9eda
--- /dev/null
@@ -0,0 +1,315 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package jalview.schemabinding.version2;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import org.exolab.castor.mapping.AccessMode;\r
+import org.exolab.castor.xml.TypeValidator;\r
+import org.exolab.castor.xml.XMLFieldDescriptor;\r
+import org.exolab.castor.xml.validators.*;\r
+\r
+/**\r
+ * Class PdbentryDescriptor.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class PdbentryDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * Field nsPrefix\r
+     */\r
+    private java.lang.String nsPrefix;\r
+\r
+    /**\r
+     * Field nsURI\r
+     */\r
+    private java.lang.String nsURI;\r
+\r
+    /**\r
+     * Field xmlName\r
+     */\r
+    private java.lang.String xmlName;\r
+\r
+    /**\r
+     * Field identity\r
+     */\r
+    private org.exolab.castor.xml.XMLFieldDescriptor identity;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public PdbentryDescriptor() {\r
+        super();\r
+        xmlName = "pdbentry";\r
+        org.exolab.castor.xml.util.XMLFieldDescriptorImpl  desc           = null;\r
+        org.exolab.castor.xml.XMLFieldHandler              handler        = null;\r
+        org.exolab.castor.xml.FieldValidator               fieldValidator = null;\r
+        //-- initialize attribute descriptors\r
+        \r
+        //-- _id\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_id", "id", org.exolab.castor.xml.NodeType.Attribute);\r
+        desc.setImmutable(true);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Pdbentry target = (Pdbentry) object;\r
+                return target.getId();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Pdbentry target = (Pdbentry) object;\r
+                    target.setId( (java.lang.String) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        desc.setRequired(true);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _id\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        fieldValidator.setMinOccurs(1);\r
+        { //-- local scope\r
+            StringValidator typeValidator = new StringValidator();\r
+            typeValidator.setWhiteSpace("preserve");\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _type\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_type", "type", org.exolab.castor.xml.NodeType.Attribute);\r
+        desc.setImmutable(true);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Pdbentry target = (Pdbentry) object;\r
+                return target.getType();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Pdbentry target = (Pdbentry) object;\r
+                    target.setType( (java.lang.String) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _type\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            StringValidator typeValidator = new StringValidator();\r
+            typeValidator.setWhiteSpace("preserve");\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _file\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_file", "file", org.exolab.castor.xml.NodeType.Attribute);\r
+        desc.setImmutable(true);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Pdbentry target = (Pdbentry) object;\r
+                return target.getFile();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Pdbentry target = (Pdbentry) object;\r
+                    target.setFile( (java.lang.String) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _file\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            StringValidator typeValidator = new StringValidator();\r
+            typeValidator.setWhiteSpace("preserve");\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- initialize element descriptors\r
+        \r
+        //-- _items\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(jalview.schemabinding.version2.PdbentryItem.class, "_items", (String)null, org.exolab.castor.xml.NodeType.Element);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Pdbentry target = (Pdbentry) object;\r
+                return target.getPdbentryItem();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Pdbentry target = (Pdbentry) object;\r
+                    target.addPdbentryItem( (jalview.schemabinding.version2.PdbentryItem) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return new jalview.schemabinding.version2.PdbentryItem();\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        desc.setContainer(true);\r
+        desc.setClassDescriptor(new jalview.schemabinding.version2.PdbentryItemDescriptor());\r
+        desc.setMultivalued(true);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _items\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        fieldValidator.setMinOccurs(0);\r
+        { //-- local scope\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+    } //-- jalview.schemabinding.version2.PdbentryDescriptor()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Method getAccessMode\r
+     * \r
+     * \r
+     * \r
+     * @return AccessMode\r
+     */\r
+    public org.exolab.castor.mapping.AccessMode getAccessMode()\r
+    {\r
+        return null;\r
+    } //-- org.exolab.castor.mapping.AccessMode getAccessMode() \r
+\r
+    /**\r
+     * Method getExtends\r
+     * \r
+     * \r
+     * \r
+     * @return ClassDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.ClassDescriptor getExtends()\r
+    {\r
+        return null;\r
+    } //-- org.exolab.castor.mapping.ClassDescriptor getExtends() \r
+\r
+    /**\r
+     * Method getIdentity\r
+     * \r
+     * \r
+     * \r
+     * @return FieldDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.FieldDescriptor getIdentity()\r
+    {\r
+        return identity;\r
+    } //-- org.exolab.castor.mapping.FieldDescriptor getIdentity() \r
+\r
+    /**\r
+     * Method getJavaClass\r
+     * \r
+     * \r
+     * \r
+     * @return Class\r
+     */\r
+    public java.lang.Class getJavaClass()\r
+    {\r
+        return jalview.schemabinding.version2.Pdbentry.class;\r
+    } //-- java.lang.Class getJavaClass() \r
+\r
+    /**\r
+     * Method getNameSpacePrefix\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpacePrefix()\r
+    {\r
+        return nsPrefix;\r
+    } //-- java.lang.String getNameSpacePrefix() \r
+\r
+    /**\r
+     * Method getNameSpaceURI\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpaceURI()\r
+    {\r
+        return nsURI;\r
+    } //-- java.lang.String getNameSpaceURI() \r
+\r
+    /**\r
+     * Method getValidator\r
+     * \r
+     * \r
+     * \r
+     * @return TypeValidator\r
+     */\r
+    public org.exolab.castor.xml.TypeValidator getValidator()\r
+    {\r
+        return this;\r
+    } //-- org.exolab.castor.xml.TypeValidator getValidator() \r
+\r
+    /**\r
+     * Method getXMLName\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getXMLName()\r
+    {\r
+        return xmlName;\r
+    } //-- java.lang.String getXMLName() \r
+\r
+}\r
diff --git a/src/jalview/schemabinding/version2/PdbentryItem.java b/src/jalview/schemabinding/version2/PdbentryItem.java
new file mode 100755 (executable)
index 0000000..6f64036
--- /dev/null
@@ -0,0 +1,197 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package jalview.schemabinding.version2;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import java.io.Serializable;\r
+import java.util.Enumeration;\r
+import java.util.Vector;\r
+import org.exolab.castor.xml.Marshaller;\r
+import org.exolab.castor.xml.Unmarshaller;\r
+\r
+/**\r
+ * Class PdbentryItem.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class PdbentryItem implements java.io.Serializable {\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * Field _propertyList\r
+     */\r
+    private java.util.Vector _propertyList;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public PdbentryItem() {\r
+        super();\r
+        _propertyList = new Vector();\r
+    } //-- jalview.schemabinding.version2.PdbentryItem()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Method addProperty\r
+     * \r
+     * \r
+     * \r
+     * @param vProperty\r
+     */\r
+    public void addProperty(jalview.schemabinding.version2.Property vProperty)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        _propertyList.addElement(vProperty);\r
+    } //-- void addProperty(jalview.schemabinding.version2.Property) \r
+\r
+    /**\r
+     * Method addProperty\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @param vProperty\r
+     */\r
+    public void addProperty(int index, jalview.schemabinding.version2.Property vProperty)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        _propertyList.insertElementAt(vProperty, index);\r
+    } //-- void addProperty(int, jalview.schemabinding.version2.Property) \r
+\r
+    /**\r
+     * Method enumerateProperty\r
+     * \r
+     * \r
+     * \r
+     * @return Enumeration\r
+     */\r
+    public java.util.Enumeration enumerateProperty()\r
+    {\r
+        return _propertyList.elements();\r
+    } //-- java.util.Enumeration enumerateProperty() \r
+\r
+    /**\r
+     * Method getProperty\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @return Property\r
+     */\r
+    public jalview.schemabinding.version2.Property getProperty(int index)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        //-- check bounds for index\r
+        if ((index < 0) || (index > _propertyList.size())) {\r
+            throw new IndexOutOfBoundsException();\r
+        }\r
+        \r
+        return (jalview.schemabinding.version2.Property) _propertyList.elementAt(index);\r
+    } //-- jalview.schemabinding.version2.Property getProperty(int) \r
+\r
+    /**\r
+     * Method getProperty\r
+     * \r
+     * \r
+     * \r
+     * @return Property\r
+     */\r
+    public jalview.schemabinding.version2.Property[] getProperty()\r
+    {\r
+        int size = _propertyList.size();\r
+        jalview.schemabinding.version2.Property[] mArray = new jalview.schemabinding.version2.Property[size];\r
+        for (int index = 0; index < size; index++) {\r
+            mArray[index] = (jalview.schemabinding.version2.Property) _propertyList.elementAt(index);\r
+        }\r
+        return mArray;\r
+    } //-- jalview.schemabinding.version2.Property[] getProperty() \r
+\r
+    /**\r
+     * Method getPropertyCount\r
+     * \r
+     * \r
+     * \r
+     * @return int\r
+     */\r
+    public int getPropertyCount()\r
+    {\r
+        return _propertyList.size();\r
+    } //-- int getPropertyCount() \r
+\r
+    /**\r
+     * Method removeAllProperty\r
+     * \r
+     */\r
+    public void removeAllProperty()\r
+    {\r
+        _propertyList.removeAllElements();\r
+    } //-- void removeAllProperty() \r
+\r
+    /**\r
+     * Method removeProperty\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @return Property\r
+     */\r
+    public jalview.schemabinding.version2.Property removeProperty(int index)\r
+    {\r
+        java.lang.Object obj = _propertyList.elementAt(index);\r
+        _propertyList.removeElementAt(index);\r
+        return (jalview.schemabinding.version2.Property) obj;\r
+    } //-- jalview.schemabinding.version2.Property removeProperty(int) \r
+\r
+    /**\r
+     * Method setProperty\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @param vProperty\r
+     */\r
+    public void setProperty(int index, jalview.schemabinding.version2.Property vProperty)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        //-- check bounds for index\r
+        if ((index < 0) || (index > _propertyList.size())) {\r
+            throw new IndexOutOfBoundsException();\r
+        }\r
+        _propertyList.setElementAt(vProperty, index);\r
+    } //-- void setProperty(int, jalview.schemabinding.version2.Property) \r
+\r
+    /**\r
+     * Method setProperty\r
+     * \r
+     * \r
+     * \r
+     * @param propertyArray\r
+     */\r
+    public void setProperty(jalview.schemabinding.version2.Property[] propertyArray)\r
+    {\r
+        //-- copy array\r
+        _propertyList.removeAllElements();\r
+        for (int i = 0; i < propertyArray.length; i++) {\r
+            _propertyList.addElement(propertyArray[i]);\r
+        }\r
+    } //-- void setProperty(jalview.schemabinding.version2.Property) \r
+\r
+}\r
diff --git a/src/jalview/schemabinding/version2/PdbentryItemDescriptor.java b/src/jalview/schemabinding/version2/PdbentryItemDescriptor.java
new file mode 100755 (executable)
index 0000000..d9d36c0
--- /dev/null
@@ -0,0 +1,208 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package jalview.schemabinding.version2;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import org.exolab.castor.mapping.AccessMode;\r
+import org.exolab.castor.xml.TypeValidator;\r
+import org.exolab.castor.xml.XMLFieldDescriptor;\r
+import org.exolab.castor.xml.validators.*;\r
+\r
+/**\r
+ * Class PdbentryItemDescriptor.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class PdbentryItemDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * Field nsPrefix\r
+     */\r
+    private java.lang.String nsPrefix;\r
+\r
+    /**\r
+     * Field nsURI\r
+     */\r
+    private java.lang.String nsURI;\r
+\r
+    /**\r
+     * Field xmlName\r
+     */\r
+    private java.lang.String xmlName;\r
+\r
+    /**\r
+     * Field identity\r
+     */\r
+    private org.exolab.castor.xml.XMLFieldDescriptor identity;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public PdbentryItemDescriptor() {\r
+        super();\r
+        nsURI = "www.jalview.org";\r
+        xmlName = "pdbentry";\r
+        \r
+        //-- set grouping compositor\r
+        setCompositorAsSequence();\r
+        org.exolab.castor.xml.util.XMLFieldDescriptorImpl  desc           = null;\r
+        org.exolab.castor.xml.XMLFieldHandler              handler        = null;\r
+        org.exolab.castor.xml.FieldValidator               fieldValidator = null;\r
+        //-- initialize attribute descriptors\r
+        \r
+        //-- initialize element descriptors\r
+        \r
+        //-- _propertyList\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(jalview.schemabinding.version2.Property.class, "_propertyList", "property", org.exolab.castor.xml.NodeType.Element);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                PdbentryItem target = (PdbentryItem) object;\r
+                return target.getProperty();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    PdbentryItem target = (PdbentryItem) object;\r
+                    target.addProperty( (jalview.schemabinding.version2.Property) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return new jalview.schemabinding.version2.Property();\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        desc.setNameSpaceURI("www.jalview.org");\r
+        desc.setMultivalued(true);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _propertyList\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        fieldValidator.setMinOccurs(0);\r
+        { //-- local scope\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+    } //-- jalview.schemabinding.version2.PdbentryItemDescriptor()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Method getAccessMode\r
+     * \r
+     * \r
+     * \r
+     * @return AccessMode\r
+     */\r
+    public org.exolab.castor.mapping.AccessMode getAccessMode()\r
+    {\r
+        return null;\r
+    } //-- org.exolab.castor.mapping.AccessMode getAccessMode() \r
+\r
+    /**\r
+     * Method getExtends\r
+     * \r
+     * \r
+     * \r
+     * @return ClassDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.ClassDescriptor getExtends()\r
+    {\r
+        return null;\r
+    } //-- org.exolab.castor.mapping.ClassDescriptor getExtends() \r
+\r
+    /**\r
+     * Method getIdentity\r
+     * \r
+     * \r
+     * \r
+     * @return FieldDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.FieldDescriptor getIdentity()\r
+    {\r
+        return identity;\r
+    } //-- org.exolab.castor.mapping.FieldDescriptor getIdentity() \r
+\r
+    /**\r
+     * Method getJavaClass\r
+     * \r
+     * \r
+     * \r
+     * @return Class\r
+     */\r
+    public java.lang.Class getJavaClass()\r
+    {\r
+        return jalview.schemabinding.version2.PdbentryItem.class;\r
+    } //-- java.lang.Class getJavaClass() \r
+\r
+    /**\r
+     * Method getNameSpacePrefix\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpacePrefix()\r
+    {\r
+        return nsPrefix;\r
+    } //-- java.lang.String getNameSpacePrefix() \r
+\r
+    /**\r
+     * Method getNameSpaceURI\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpaceURI()\r
+    {\r
+        return nsURI;\r
+    } //-- java.lang.String getNameSpaceURI() \r
+\r
+    /**\r
+     * Method getValidator\r
+     * \r
+     * \r
+     * \r
+     * @return TypeValidator\r
+     */\r
+    public org.exolab.castor.xml.TypeValidator getValidator()\r
+    {\r
+        return this;\r
+    } //-- org.exolab.castor.xml.TypeValidator getValidator() \r
+\r
+    /**\r
+     * Method getXMLName\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getXMLName()\r
+    {\r
+        return xmlName;\r
+    } //-- java.lang.String getXMLName() \r
+\r
+}\r
diff --git a/src/jalview/schemabinding/version2/Pdbids.java b/src/jalview/schemabinding/version2/Pdbids.java
new file mode 100755 (executable)
index 0000000..53b2e91
--- /dev/null
@@ -0,0 +1,118 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package jalview.schemabinding.version2;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import java.io.IOException;\r
+import java.io.Reader;\r
+import java.io.Serializable;\r
+import java.io.Writer;\r
+import org.exolab.castor.xml.MarshalException;\r
+import org.exolab.castor.xml.Marshaller;\r
+import org.exolab.castor.xml.Unmarshaller;\r
+import org.exolab.castor.xml.ValidationException;\r
+import org.xml.sax.ContentHandler;\r
+\r
+/**\r
+ * Class Pdbids.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class Pdbids extends Pdbentry \r
+implements java.io.Serializable\r
+{\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public Pdbids() {\r
+        super();\r
+    } //-- jalview.schemabinding.version2.Pdbids()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Method isValid\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean isValid()\r
+    {\r
+        try {\r
+            validate();\r
+        }\r
+        catch (org.exolab.castor.xml.ValidationException vex) {\r
+            return false;\r
+        }\r
+        return true;\r
+    } //-- boolean isValid() \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param out\r
+     */\r
+    public void marshal(java.io.Writer out)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, out);\r
+    } //-- void marshal(java.io.Writer) \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param handler\r
+     */\r
+    public void marshal(org.xml.sax.ContentHandler handler)\r
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, handler);\r
+    } //-- void marshal(org.xml.sax.ContentHandler) \r
+\r
+    /**\r
+     * Method unmarshal\r
+     * \r
+     * \r
+     * \r
+     * @param reader\r
+     * @return Object\r
+     */\r
+    public static java.lang.Object unmarshal(java.io.Reader reader)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        return (jalview.schemabinding.version2.Pdbids) Unmarshaller.unmarshal(jalview.schemabinding.version2.Pdbids.class, reader);\r
+    } //-- java.lang.Object unmarshal(java.io.Reader) \r
+\r
+    /**\r
+     * Method validate\r
+     * \r
+     */\r
+    public void validate()\r
+        throws org.exolab.castor.xml.ValidationException\r
+    {\r
+        org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
+        validator.validate(this);\r
+    } //-- void validate() \r
+\r
+}\r
diff --git a/src/jalview/schemabinding/version2/PdbidsDescriptor.java b/src/jalview/schemabinding/version2/PdbidsDescriptor.java
new file mode 100755 (executable)
index 0000000..607f122
--- /dev/null
@@ -0,0 +1,166 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package jalview.schemabinding.version2;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import org.exolab.castor.mapping.AccessMode;\r
+import org.exolab.castor.xml.TypeValidator;\r
+import org.exolab.castor.xml.XMLFieldDescriptor;\r
+import org.exolab.castor.xml.validators.*;\r
+\r
+/**\r
+ * Class PdbidsDescriptor.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class PdbidsDescriptor extends PdbentryDescriptor {\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * Field nsPrefix\r
+     */\r
+    private java.lang.String nsPrefix;\r
+\r
+    /**\r
+     * Field nsURI\r
+     */\r
+    private java.lang.String nsURI;\r
+\r
+    /**\r
+     * Field xmlName\r
+     */\r
+    private java.lang.String xmlName;\r
+\r
+    /**\r
+     * Field identity\r
+     */\r
+    private org.exolab.castor.xml.XMLFieldDescriptor identity;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public PdbidsDescriptor() {\r
+        super();\r
+        setExtendsWithoutFlatten(new PdbentryDescriptor());\r
+        nsURI = "www.jalview.org";\r
+        xmlName = "pdbids";\r
+    } //-- jalview.schemabinding.version2.PdbidsDescriptor()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Method getAccessMode\r
+     * \r
+     * \r
+     * \r
+     * @return AccessMode\r
+     */\r
+    public org.exolab.castor.mapping.AccessMode getAccessMode()\r
+    {\r
+        return null;\r
+    } //-- org.exolab.castor.mapping.AccessMode getAccessMode() \r
+\r
+    /**\r
+     * Method getExtends\r
+     * \r
+     * \r
+     * \r
+     * @return ClassDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.ClassDescriptor getExtends()\r
+    {\r
+        return super.getExtends();\r
+    } //-- org.exolab.castor.mapping.ClassDescriptor getExtends() \r
+\r
+    /**\r
+     * Method getIdentity\r
+     * \r
+     * \r
+     * \r
+     * @return FieldDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.FieldDescriptor getIdentity()\r
+    {\r
+        if (identity == null)\r
+            return super.getIdentity();\r
+        return identity;\r
+    } //-- org.exolab.castor.mapping.FieldDescriptor getIdentity() \r
+\r
+    /**\r
+     * Method getJavaClass\r
+     * \r
+     * \r
+     * \r
+     * @return Class\r
+     */\r
+    public java.lang.Class getJavaClass()\r
+    {\r
+        return jalview.schemabinding.version2.Pdbids.class;\r
+    } //-- java.lang.Class getJavaClass() \r
+\r
+    /**\r
+     * Method getNameSpacePrefix\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpacePrefix()\r
+    {\r
+        return nsPrefix;\r
+    } //-- java.lang.String getNameSpacePrefix() \r
+\r
+    /**\r
+     * Method getNameSpaceURI\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpaceURI()\r
+    {\r
+        return nsURI;\r
+    } //-- java.lang.String getNameSpaceURI() \r
+\r
+    /**\r
+     * Method getValidator\r
+     * \r
+     * \r
+     * \r
+     * @return TypeValidator\r
+     */\r
+    public org.exolab.castor.xml.TypeValidator getValidator()\r
+    {\r
+        return this;\r
+    } //-- org.exolab.castor.xml.TypeValidator getValidator() \r
+\r
+    /**\r
+     * Method getXMLName\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getXMLName()\r
+    {\r
+        return xmlName;\r
+    } //-- java.lang.String getXMLName() \r
+\r
+}\r
diff --git a/src/jalview/schemabinding/version2/Property.java b/src/jalview/schemabinding/version2/Property.java
new file mode 100755 (executable)
index 0000000..338dd90
--- /dev/null
@@ -0,0 +1,173 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package jalview.schemabinding.version2;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import java.io.IOException;\r
+import java.io.Reader;\r
+import java.io.Serializable;\r
+import java.io.Writer;\r
+import org.exolab.castor.xml.MarshalException;\r
+import org.exolab.castor.xml.Marshaller;\r
+import org.exolab.castor.xml.Unmarshaller;\r
+import org.exolab.castor.xml.ValidationException;\r
+import org.xml.sax.ContentHandler;\r
+\r
+/**\r
+ * Class Property.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class Property implements java.io.Serializable {\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * Field _name\r
+     */\r
+    private java.lang.String _name;\r
+\r
+    /**\r
+     * Field _value\r
+     */\r
+    private java.lang.String _value;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public Property() {\r
+        super();\r
+    } //-- jalview.schemabinding.version2.Property()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Returns the value of field 'name'.\r
+     * \r
+     * @return String\r
+     * @return the value of field 'name'.\r
+     */\r
+    public java.lang.String getName()\r
+    {\r
+        return this._name;\r
+    } //-- java.lang.String getName() \r
+\r
+    /**\r
+     * Returns the value of field 'value'.\r
+     * \r
+     * @return String\r
+     * @return the value of field 'value'.\r
+     */\r
+    public java.lang.String getValue()\r
+    {\r
+        return this._value;\r
+    } //-- java.lang.String getValue() \r
+\r
+    /**\r
+     * Method isValid\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean isValid()\r
+    {\r
+        try {\r
+            validate();\r
+        }\r
+        catch (org.exolab.castor.xml.ValidationException vex) {\r
+            return false;\r
+        }\r
+        return true;\r
+    } //-- boolean isValid() \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param out\r
+     */\r
+    public void marshal(java.io.Writer out)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, out);\r
+    } //-- void marshal(java.io.Writer) \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param handler\r
+     */\r
+    public void marshal(org.xml.sax.ContentHandler handler)\r
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, handler);\r
+    } //-- void marshal(org.xml.sax.ContentHandler) \r
+\r
+    /**\r
+     * Sets the value of field 'name'.\r
+     * \r
+     * @param name the value of field 'name'.\r
+     */\r
+    public void setName(java.lang.String name)\r
+    {\r
+        this._name = name;\r
+    } //-- void setName(java.lang.String) \r
+\r
+    /**\r
+     * Sets the value of field 'value'.\r
+     * \r
+     * @param value the value of field 'value'.\r
+     */\r
+    public void setValue(java.lang.String value)\r
+    {\r
+        this._value = value;\r
+    } //-- void setValue(java.lang.String) \r
+\r
+    /**\r
+     * Method unmarshal\r
+     * \r
+     * \r
+     * \r
+     * @param reader\r
+     * @return Object\r
+     */\r
+    public static java.lang.Object unmarshal(java.io.Reader reader)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        return (jalview.schemabinding.version2.Property) Unmarshaller.unmarshal(jalview.schemabinding.version2.Property.class, reader);\r
+    } //-- java.lang.Object unmarshal(java.io.Reader) \r
+\r
+    /**\r
+     * Method validate\r
+     * \r
+     */\r
+    public void validate()\r
+        throws org.exolab.castor.xml.ValidationException\r
+    {\r
+        org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
+        validator.validate(this);\r
+    } //-- void validate() \r
+\r
+}\r
diff --git a/src/jalview/schemabinding/version2/PropertyDescriptor.java b/src/jalview/schemabinding/version2/PropertyDescriptor.java
new file mode 100755 (executable)
index 0000000..e22704c
--- /dev/null
@@ -0,0 +1,246 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package jalview.schemabinding.version2;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import org.exolab.castor.mapping.AccessMode;\r
+import org.exolab.castor.xml.TypeValidator;\r
+import org.exolab.castor.xml.XMLFieldDescriptor;\r
+import org.exolab.castor.xml.validators.*;\r
+\r
+/**\r
+ * Class PropertyDescriptor.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class PropertyDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * Field nsPrefix\r
+     */\r
+    private java.lang.String nsPrefix;\r
+\r
+    /**\r
+     * Field nsURI\r
+     */\r
+    private java.lang.String nsURI;\r
+\r
+    /**\r
+     * Field xmlName\r
+     */\r
+    private java.lang.String xmlName;\r
+\r
+    /**\r
+     * Field identity\r
+     */\r
+    private org.exolab.castor.xml.XMLFieldDescriptor identity;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public PropertyDescriptor() {\r
+        super();\r
+        nsURI = "www.jalview.org";\r
+        xmlName = "property";\r
+        org.exolab.castor.xml.util.XMLFieldDescriptorImpl  desc           = null;\r
+        org.exolab.castor.xml.XMLFieldHandler              handler        = null;\r
+        org.exolab.castor.xml.FieldValidator               fieldValidator = null;\r
+        //-- initialize attribute descriptors\r
+        \r
+        //-- _name\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_name", "name", org.exolab.castor.xml.NodeType.Attribute);\r
+        desc.setImmutable(true);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Property target = (Property) object;\r
+                return target.getName();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Property target = (Property) object;\r
+                    target.setName( (java.lang.String) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        desc.setRequired(true);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _name\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        fieldValidator.setMinOccurs(1);\r
+        { //-- local scope\r
+            StringValidator typeValidator = new StringValidator();\r
+            typeValidator.setWhiteSpace("preserve");\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _value\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_value", "value", org.exolab.castor.xml.NodeType.Attribute);\r
+        desc.setImmutable(true);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Property target = (Property) object;\r
+                return target.getValue();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Property target = (Property) object;\r
+                    target.setValue( (java.lang.String) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        desc.setRequired(true);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _value\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        fieldValidator.setMinOccurs(1);\r
+        { //-- local scope\r
+            StringValidator typeValidator = new StringValidator();\r
+            typeValidator.setWhiteSpace("preserve");\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- initialize element descriptors\r
+        \r
+    } //-- jalview.schemabinding.version2.PropertyDescriptor()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Method getAccessMode\r
+     * \r
+     * \r
+     * \r
+     * @return AccessMode\r
+     */\r
+    public org.exolab.castor.mapping.AccessMode getAccessMode()\r
+    {\r
+        return null;\r
+    } //-- org.exolab.castor.mapping.AccessMode getAccessMode() \r
+\r
+    /**\r
+     * Method getExtends\r
+     * \r
+     * \r
+     * \r
+     * @return ClassDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.ClassDescriptor getExtends()\r
+    {\r
+        return null;\r
+    } //-- org.exolab.castor.mapping.ClassDescriptor getExtends() \r
+\r
+    /**\r
+     * Method getIdentity\r
+     * \r
+     * \r
+     * \r
+     * @return FieldDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.FieldDescriptor getIdentity()\r
+    {\r
+        return identity;\r
+    } //-- org.exolab.castor.mapping.FieldDescriptor getIdentity() \r
+\r
+    /**\r
+     * Method getJavaClass\r
+     * \r
+     * \r
+     * \r
+     * @return Class\r
+     */\r
+    public java.lang.Class getJavaClass()\r
+    {\r
+        return jalview.schemabinding.version2.Property.class;\r
+    } //-- java.lang.Class getJavaClass() \r
+\r
+    /**\r
+     * Method getNameSpacePrefix\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpacePrefix()\r
+    {\r
+        return nsPrefix;\r
+    } //-- java.lang.String getNameSpacePrefix() \r
+\r
+    /**\r
+     * Method getNameSpaceURI\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpaceURI()\r
+    {\r
+        return nsURI;\r
+    } //-- java.lang.String getNameSpaceURI() \r
+\r
+    /**\r
+     * Method getValidator\r
+     * \r
+     * \r
+     * \r
+     * @return TypeValidator\r
+     */\r
+    public org.exolab.castor.xml.TypeValidator getValidator()\r
+    {\r
+        return this;\r
+    } //-- org.exolab.castor.xml.TypeValidator getValidator() \r
+\r
+    /**\r
+     * Method getXMLName\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getXMLName()\r
+    {\r
+        return xmlName;\r
+    } //-- java.lang.String getXMLName() \r
+\r
+}\r
diff --git a/src/jalview/schemabinding/version2/Sequence.java b/src/jalview/schemabinding/version2/Sequence.java
new file mode 100755 (executable)
index 0000000..993ad23
--- /dev/null
@@ -0,0 +1,276 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package jalview.schemabinding.version2;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import java.io.IOException;\r
+import java.io.Reader;\r
+import java.io.Serializable;\r
+import java.io.Writer;\r
+import java.util.Enumeration;\r
+import java.util.Vector;\r
+import org.exolab.castor.xml.MarshalException;\r
+import org.exolab.castor.xml.Marshaller;\r
+import org.exolab.castor.xml.Unmarshaller;\r
+import org.exolab.castor.xml.ValidationException;\r
+import org.xml.sax.ContentHandler;\r
+\r
+/**\r
+ * Class Sequence.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class Sequence extends jalview.schemabinding.version2.SequenceType \r
+implements java.io.Serializable\r
+{\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * Field _DBRefList\r
+     */\r
+    private java.util.Vector _DBRefList;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public Sequence() {\r
+        super();\r
+        _DBRefList = new Vector();\r
+    } //-- jalview.schemabinding.version2.Sequence()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Method addDBRef\r
+     * \r
+     * \r
+     * \r
+     * @param vDBRef\r
+     */\r
+    public void addDBRef(jalview.schemabinding.version2.DBRef vDBRef)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        _DBRefList.addElement(vDBRef);\r
+    } //-- void addDBRef(jalview.schemabinding.version2.DBRef) \r
+\r
+    /**\r
+     * Method addDBRef\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @param vDBRef\r
+     */\r
+    public void addDBRef(int index, jalview.schemabinding.version2.DBRef vDBRef)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        _DBRefList.insertElementAt(vDBRef, index);\r
+    } //-- void addDBRef(int, jalview.schemabinding.version2.DBRef) \r
+\r
+    /**\r
+     * Method enumerateDBRef\r
+     * \r
+     * \r
+     * \r
+     * @return Enumeration\r
+     */\r
+    public java.util.Enumeration enumerateDBRef()\r
+    {\r
+        return _DBRefList.elements();\r
+    } //-- java.util.Enumeration enumerateDBRef() \r
+\r
+    /**\r
+     * Method getDBRef\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @return DBRef\r
+     */\r
+    public jalview.schemabinding.version2.DBRef getDBRef(int index)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        //-- check bounds for index\r
+        if ((index < 0) || (index > _DBRefList.size())) {\r
+            throw new IndexOutOfBoundsException();\r
+        }\r
+        \r
+        return (jalview.schemabinding.version2.DBRef) _DBRefList.elementAt(index);\r
+    } //-- jalview.schemabinding.version2.DBRef getDBRef(int) \r
+\r
+    /**\r
+     * Method getDBRef\r
+     * \r
+     * \r
+     * \r
+     * @return DBRef\r
+     */\r
+    public jalview.schemabinding.version2.DBRef[] getDBRef()\r
+    {\r
+        int size = _DBRefList.size();\r
+        jalview.schemabinding.version2.DBRef[] mArray = new jalview.schemabinding.version2.DBRef[size];\r
+        for (int index = 0; index < size; index++) {\r
+            mArray[index] = (jalview.schemabinding.version2.DBRef) _DBRefList.elementAt(index);\r
+        }\r
+        return mArray;\r
+    } //-- jalview.schemabinding.version2.DBRef[] getDBRef() \r
+\r
+    /**\r
+     * Method getDBRefCount\r
+     * \r
+     * \r
+     * \r
+     * @return int\r
+     */\r
+    public int getDBRefCount()\r
+    {\r
+        return _DBRefList.size();\r
+    } //-- int getDBRefCount() \r
+\r
+    /**\r
+     * Method isValid\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean isValid()\r
+    {\r
+        try {\r
+            validate();\r
+        }\r
+        catch (org.exolab.castor.xml.ValidationException vex) {\r
+            return false;\r
+        }\r
+        return true;\r
+    } //-- boolean isValid() \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param out\r
+     */\r
+    public void marshal(java.io.Writer out)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, out);\r
+    } //-- void marshal(java.io.Writer) \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param handler\r
+     */\r
+    public void marshal(org.xml.sax.ContentHandler handler)\r
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, handler);\r
+    } //-- void marshal(org.xml.sax.ContentHandler) \r
+\r
+    /**\r
+     * Method removeAllDBRef\r
+     * \r
+     */\r
+    public void removeAllDBRef()\r
+    {\r
+        _DBRefList.removeAllElements();\r
+    } //-- void removeAllDBRef() \r
+\r
+    /**\r
+     * Method removeDBRef\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @return DBRef\r
+     */\r
+    public jalview.schemabinding.version2.DBRef removeDBRef(int index)\r
+    {\r
+        java.lang.Object obj = _DBRefList.elementAt(index);\r
+        _DBRefList.removeElementAt(index);\r
+        return (jalview.schemabinding.version2.DBRef) obj;\r
+    } //-- jalview.schemabinding.version2.DBRef removeDBRef(int) \r
+\r
+    /**\r
+     * Method setDBRef\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @param vDBRef\r
+     */\r
+    public void setDBRef(int index, jalview.schemabinding.version2.DBRef vDBRef)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        //-- check bounds for index\r
+        if ((index < 0) || (index > _DBRefList.size())) {\r
+            throw new IndexOutOfBoundsException();\r
+        }\r
+        _DBRefList.setElementAt(vDBRef, index);\r
+    } //-- void setDBRef(int, jalview.schemabinding.version2.DBRef) \r
+\r
+    /**\r
+     * Method setDBRef\r
+     * \r
+     * \r
+     * \r
+     * @param DBRefArray\r
+     */\r
+    public void setDBRef(jalview.schemabinding.version2.DBRef[] DBRefArray)\r
+    {\r
+        //-- copy array\r
+        _DBRefList.removeAllElements();\r
+        for (int i = 0; i < DBRefArray.length; i++) {\r
+            _DBRefList.addElement(DBRefArray[i]);\r
+        }\r
+    } //-- void setDBRef(jalview.schemabinding.version2.DBRef) \r
+\r
+    /**\r
+     * Method unmarshal\r
+     * \r
+     * \r
+     * \r
+     * @param reader\r
+     * @return Object\r
+     */\r
+    public static java.lang.Object unmarshal(java.io.Reader reader)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        return (jalview.schemabinding.version2.Sequence) Unmarshaller.unmarshal(jalview.schemabinding.version2.Sequence.class, reader);\r
+    } //-- java.lang.Object unmarshal(java.io.Reader) \r
+\r
+    /**\r
+     * Method validate\r
+     * \r
+     */\r
+    public void validate()\r
+        throws org.exolab.castor.xml.ValidationException\r
+    {\r
+        org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
+        validator.validate(this);\r
+    } //-- void validate() \r
+\r
+}\r
diff --git a/src/jalview/schemabinding/version2/SequenceDescriptor.java b/src/jalview/schemabinding/version2/SequenceDescriptor.java
new file mode 100755 (executable)
index 0000000..555284a
--- /dev/null
@@ -0,0 +1,211 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package jalview.schemabinding.version2;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import org.exolab.castor.mapping.AccessMode;\r
+import org.exolab.castor.xml.TypeValidator;\r
+import org.exolab.castor.xml.XMLFieldDescriptor;\r
+import org.exolab.castor.xml.validators.*;\r
+\r
+/**\r
+ * Class SequenceDescriptor.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class SequenceDescriptor extends jalview.schemabinding.version2.SequenceTypeDescriptor {\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * Field nsPrefix\r
+     */\r
+    private java.lang.String nsPrefix;\r
+\r
+    /**\r
+     * Field nsURI\r
+     */\r
+    private java.lang.String nsURI;\r
+\r
+    /**\r
+     * Field xmlName\r
+     */\r
+    private java.lang.String xmlName;\r
+\r
+    /**\r
+     * Field identity\r
+     */\r
+    private org.exolab.castor.xml.XMLFieldDescriptor identity;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public SequenceDescriptor() {\r
+        super();\r
+        setExtendsWithoutFlatten(new jalview.schemabinding.version2.SequenceTypeDescriptor());\r
+        nsURI = "www.vamsas.ac.uk/jalview/version2";\r
+        xmlName = "Sequence";\r
+        \r
+        //-- set grouping compositor\r
+        setCompositorAsSequence();\r
+        org.exolab.castor.xml.util.XMLFieldDescriptorImpl  desc           = null;\r
+        org.exolab.castor.xml.XMLFieldHandler              handler        = null;\r
+        org.exolab.castor.xml.FieldValidator               fieldValidator = null;\r
+        //-- initialize attribute descriptors\r
+        \r
+        //-- initialize element descriptors\r
+        \r
+        //-- _DBRefList\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(jalview.schemabinding.version2.DBRef.class, "_DBRefList", "DBRef", org.exolab.castor.xml.NodeType.Element);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Sequence target = (Sequence) object;\r
+                return target.getDBRef();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Sequence target = (Sequence) object;\r
+                    target.addDBRef( (jalview.schemabinding.version2.DBRef) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return new jalview.schemabinding.version2.DBRef();\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");\r
+        desc.setMultivalued(true);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _DBRefList\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        fieldValidator.setMinOccurs(0);\r
+        { //-- local scope\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+    } //-- jalview.schemabinding.version2.SequenceDescriptor()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Method getAccessMode\r
+     * \r
+     * \r
+     * \r
+     * @return AccessMode\r
+     */\r
+    public org.exolab.castor.mapping.AccessMode getAccessMode()\r
+    {\r
+        return null;\r
+    } //-- org.exolab.castor.mapping.AccessMode getAccessMode() \r
+\r
+    /**\r
+     * Method getExtends\r
+     * \r
+     * \r
+     * \r
+     * @return ClassDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.ClassDescriptor getExtends()\r
+    {\r
+        return super.getExtends();\r
+    } //-- org.exolab.castor.mapping.ClassDescriptor getExtends() \r
+\r
+    /**\r
+     * Method getIdentity\r
+     * \r
+     * \r
+     * \r
+     * @return FieldDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.FieldDescriptor getIdentity()\r
+    {\r
+        if (identity == null)\r
+            return super.getIdentity();\r
+        return identity;\r
+    } //-- org.exolab.castor.mapping.FieldDescriptor getIdentity() \r
+\r
+    /**\r
+     * Method getJavaClass\r
+     * \r
+     * \r
+     * \r
+     * @return Class\r
+     */\r
+    public java.lang.Class getJavaClass()\r
+    {\r
+        return jalview.schemabinding.version2.Sequence.class;\r
+    } //-- java.lang.Class getJavaClass() \r
+\r
+    /**\r
+     * Method getNameSpacePrefix\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpacePrefix()\r
+    {\r
+        return nsPrefix;\r
+    } //-- java.lang.String getNameSpacePrefix() \r
+\r
+    /**\r
+     * Method getNameSpaceURI\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpaceURI()\r
+    {\r
+        return nsURI;\r
+    } //-- java.lang.String getNameSpaceURI() \r
+\r
+    /**\r
+     * Method getValidator\r
+     * \r
+     * \r
+     * \r
+     * @return TypeValidator\r
+     */\r
+    public org.exolab.castor.xml.TypeValidator getValidator()\r
+    {\r
+        return this;\r
+    } //-- org.exolab.castor.xml.TypeValidator getValidator() \r
+\r
+    /**\r
+     * Method getXMLName\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getXMLName()\r
+    {\r
+        return xmlName;\r
+    } //-- java.lang.String getXMLName() \r
+\r
+}\r
diff --git a/src/jalview/schemabinding/version2/SequenceSet.java b/src/jalview/schemabinding/version2/SequenceSet.java
new file mode 100755 (executable)
index 0000000..187139d
--- /dev/null
@@ -0,0 +1,504 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package jalview.schemabinding.version2;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import java.io.IOException;\r
+import java.io.Reader;\r
+import java.io.Serializable;\r
+import java.io.Writer;\r
+import java.util.Enumeration;\r
+import java.util.Vector;\r
+import org.exolab.castor.xml.MarshalException;\r
+import org.exolab.castor.xml.Marshaller;\r
+import org.exolab.castor.xml.Unmarshaller;\r
+import org.exolab.castor.xml.ValidationException;\r
+import org.xml.sax.ContentHandler;\r
+\r
+/**\r
+ * Class SequenceSet.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class SequenceSet implements java.io.Serializable {\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * Field _gapChar\r
+     */\r
+    private java.lang.String _gapChar;\r
+\r
+    /**\r
+     * Field _aligned\r
+     */\r
+    private boolean _aligned;\r
+\r
+    /**\r
+     * keeps track of state for field: _aligned\r
+     */\r
+    private boolean _has_aligned;\r
+\r
+    /**\r
+     * Field _sequenceList\r
+     */\r
+    private java.util.Vector _sequenceList;\r
+\r
+    /**\r
+     * Field _annotationList\r
+     */\r
+    private java.util.Vector _annotationList;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public SequenceSet() {\r
+        super();\r
+        _sequenceList = new Vector();\r
+        _annotationList = new Vector();\r
+    } //-- jalview.schemabinding.version2.SequenceSet()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Method addAnnotation\r
+     * \r
+     * \r
+     * \r
+     * @param vAnnotation\r
+     */\r
+    public void addAnnotation(jalview.schemabinding.version2.Annotation vAnnotation)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        _annotationList.addElement(vAnnotation);\r
+    } //-- void addAnnotation(jalview.schemabinding.version2.Annotation) \r
+\r
+    /**\r
+     * Method addAnnotation\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @param vAnnotation\r
+     */\r
+    public void addAnnotation(int index, jalview.schemabinding.version2.Annotation vAnnotation)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        _annotationList.insertElementAt(vAnnotation, index);\r
+    } //-- void addAnnotation(int, jalview.schemabinding.version2.Annotation) \r
+\r
+    /**\r
+     * Method addSequence\r
+     * \r
+     * \r
+     * \r
+     * @param vSequence\r
+     */\r
+    public void addSequence(jalview.schemabinding.version2.Sequence vSequence)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        _sequenceList.addElement(vSequence);\r
+    } //-- void addSequence(jalview.schemabinding.version2.Sequence) \r
+\r
+    /**\r
+     * Method addSequence\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @param vSequence\r
+     */\r
+    public void addSequence(int index, jalview.schemabinding.version2.Sequence vSequence)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        _sequenceList.insertElementAt(vSequence, index);\r
+    } //-- void addSequence(int, jalview.schemabinding.version2.Sequence) \r
+\r
+    /**\r
+     * Method deleteAligned\r
+     * \r
+     */\r
+    public void deleteAligned()\r
+    {\r
+        this._has_aligned= false;\r
+    } //-- void deleteAligned() \r
+\r
+    /**\r
+     * Method enumerateAnnotation\r
+     * \r
+     * \r
+     * \r
+     * @return Enumeration\r
+     */\r
+    public java.util.Enumeration enumerateAnnotation()\r
+    {\r
+        return _annotationList.elements();\r
+    } //-- java.util.Enumeration enumerateAnnotation() \r
+\r
+    /**\r
+     * Method enumerateSequence\r
+     * \r
+     * \r
+     * \r
+     * @return Enumeration\r
+     */\r
+    public java.util.Enumeration enumerateSequence()\r
+    {\r
+        return _sequenceList.elements();\r
+    } //-- java.util.Enumeration enumerateSequence() \r
+\r
+    /**\r
+     * Returns the value of field 'aligned'.\r
+     * \r
+     * @return boolean\r
+     * @return the value of field 'aligned'.\r
+     */\r
+    public boolean getAligned()\r
+    {\r
+        return this._aligned;\r
+    } //-- boolean getAligned() \r
+\r
+    /**\r
+     * Method getAnnotation\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @return Annotation\r
+     */\r
+    public jalview.schemabinding.version2.Annotation getAnnotation(int index)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        //-- check bounds for index\r
+        if ((index < 0) || (index > _annotationList.size())) {\r
+            throw new IndexOutOfBoundsException();\r
+        }\r
+        \r
+        return (jalview.schemabinding.version2.Annotation) _annotationList.elementAt(index);\r
+    } //-- jalview.schemabinding.version2.Annotation getAnnotation(int) \r
+\r
+    /**\r
+     * Method getAnnotation\r
+     * \r
+     * \r
+     * \r
+     * @return Annotation\r
+     */\r
+    public jalview.schemabinding.version2.Annotation[] getAnnotation()\r
+    {\r
+        int size = _annotationList.size();\r
+        jalview.schemabinding.version2.Annotation[] mArray = new jalview.schemabinding.version2.Annotation[size];\r
+        for (int index = 0; index < size; index++) {\r
+            mArray[index] = (jalview.schemabinding.version2.Annotation) _annotationList.elementAt(index);\r
+        }\r
+        return mArray;\r
+    } //-- jalview.schemabinding.version2.Annotation[] getAnnotation() \r
+\r
+    /**\r
+     * Method getAnnotationCount\r
+     * \r
+     * \r
+     * \r
+     * @return int\r
+     */\r
+    public int getAnnotationCount()\r
+    {\r
+        return _annotationList.size();\r
+    } //-- int getAnnotationCount() \r
+\r
+    /**\r
+     * Returns the value of field 'gapChar'.\r
+     * \r
+     * @return String\r
+     * @return the value of field 'gapChar'.\r
+     */\r
+    public java.lang.String getGapChar()\r
+    {\r
+        return this._gapChar;\r
+    } //-- java.lang.String getGapChar() \r
+\r
+    /**\r
+     * Method getSequence\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @return Sequence\r
+     */\r
+    public jalview.schemabinding.version2.Sequence getSequence(int index)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        //-- check bounds for index\r
+        if ((index < 0) || (index > _sequenceList.size())) {\r
+            throw new IndexOutOfBoundsException();\r
+        }\r
+        \r
+        return (jalview.schemabinding.version2.Sequence) _sequenceList.elementAt(index);\r
+    } //-- jalview.schemabinding.version2.Sequence getSequence(int) \r
+\r
+    /**\r
+     * Method getSequence\r
+     * \r
+     * \r
+     * \r
+     * @return Sequence\r
+     */\r
+    public jalview.schemabinding.version2.Sequence[] getSequence()\r
+    {\r
+        int size = _sequenceList.size();\r
+        jalview.schemabinding.version2.Sequence[] mArray = new jalview.schemabinding.version2.Sequence[size];\r
+        for (int index = 0; index < size; index++) {\r
+            mArray[index] = (jalview.schemabinding.version2.Sequence) _sequenceList.elementAt(index);\r
+        }\r
+        return mArray;\r
+    } //-- jalview.schemabinding.version2.Sequence[] getSequence() \r
+\r
+    /**\r
+     * Method getSequenceCount\r
+     * \r
+     * \r
+     * \r
+     * @return int\r
+     */\r
+    public int getSequenceCount()\r
+    {\r
+        return _sequenceList.size();\r
+    } //-- int getSequenceCount() \r
+\r
+    /**\r
+     * Method hasAligned\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean hasAligned()\r
+    {\r
+        return this._has_aligned;\r
+    } //-- boolean hasAligned() \r
+\r
+    /**\r
+     * Method isValid\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean isValid()\r
+    {\r
+        try {\r
+            validate();\r
+        }\r
+        catch (org.exolab.castor.xml.ValidationException vex) {\r
+            return false;\r
+        }\r
+        return true;\r
+    } //-- boolean isValid() \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param out\r
+     */\r
+    public void marshal(java.io.Writer out)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, out);\r
+    } //-- void marshal(java.io.Writer) \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param handler\r
+     */\r
+    public void marshal(org.xml.sax.ContentHandler handler)\r
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, handler);\r
+    } //-- void marshal(org.xml.sax.ContentHandler) \r
+\r
+    /**\r
+     * Method removeAllAnnotation\r
+     * \r
+     */\r
+    public void removeAllAnnotation()\r
+    {\r
+        _annotationList.removeAllElements();\r
+    } //-- void removeAllAnnotation() \r
+\r
+    /**\r
+     * Method removeAllSequence\r
+     * \r
+     */\r
+    public void removeAllSequence()\r
+    {\r
+        _sequenceList.removeAllElements();\r
+    } //-- void removeAllSequence() \r
+\r
+    /**\r
+     * Method removeAnnotation\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @return Annotation\r
+     */\r
+    public jalview.schemabinding.version2.Annotation removeAnnotation(int index)\r
+    {\r
+        java.lang.Object obj = _annotationList.elementAt(index);\r
+        _annotationList.removeElementAt(index);\r
+        return (jalview.schemabinding.version2.Annotation) obj;\r
+    } //-- jalview.schemabinding.version2.Annotation removeAnnotation(int) \r
+\r
+    /**\r
+     * Method removeSequence\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @return Sequence\r
+     */\r
+    public jalview.schemabinding.version2.Sequence removeSequence(int index)\r
+    {\r
+        java.lang.Object obj = _sequenceList.elementAt(index);\r
+        _sequenceList.removeElementAt(index);\r
+        return (jalview.schemabinding.version2.Sequence) obj;\r
+    } //-- jalview.schemabinding.version2.Sequence removeSequence(int) \r
+\r
+    /**\r
+     * Sets the value of field 'aligned'.\r
+     * \r
+     * @param aligned the value of field 'aligned'.\r
+     */\r
+    public void setAligned(boolean aligned)\r
+    {\r
+        this._aligned = aligned;\r
+        this._has_aligned = true;\r
+    } //-- void setAligned(boolean) \r
+\r
+    /**\r
+     * Method setAnnotation\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @param vAnnotation\r
+     */\r
+    public void setAnnotation(int index, jalview.schemabinding.version2.Annotation vAnnotation)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        //-- check bounds for index\r
+        if ((index < 0) || (index > _annotationList.size())) {\r
+            throw new IndexOutOfBoundsException();\r
+        }\r
+        _annotationList.setElementAt(vAnnotation, index);\r
+    } //-- void setAnnotation(int, jalview.schemabinding.version2.Annotation) \r
+\r
+    /**\r
+     * Method setAnnotation\r
+     * \r
+     * \r
+     * \r
+     * @param annotationArray\r
+     */\r
+    public void setAnnotation(jalview.schemabinding.version2.Annotation[] annotationArray)\r
+    {\r
+        //-- copy array\r
+        _annotationList.removeAllElements();\r
+        for (int i = 0; i < annotationArray.length; i++) {\r
+            _annotationList.addElement(annotationArray[i]);\r
+        }\r
+    } //-- void setAnnotation(jalview.schemabinding.version2.Annotation) \r
+\r
+    /**\r
+     * Sets the value of field 'gapChar'.\r
+     * \r
+     * @param gapChar the value of field 'gapChar'.\r
+     */\r
+    public void setGapChar(java.lang.String gapChar)\r
+    {\r
+        this._gapChar = gapChar;\r
+    } //-- void setGapChar(java.lang.String) \r
+\r
+    /**\r
+     * Method setSequence\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @param vSequence\r
+     */\r
+    public void setSequence(int index, jalview.schemabinding.version2.Sequence vSequence)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        //-- check bounds for index\r
+        if ((index < 0) || (index > _sequenceList.size())) {\r
+            throw new IndexOutOfBoundsException();\r
+        }\r
+        _sequenceList.setElementAt(vSequence, index);\r
+    } //-- void setSequence(int, jalview.schemabinding.version2.Sequence) \r
+\r
+    /**\r
+     * Method setSequence\r
+     * \r
+     * \r
+     * \r
+     * @param sequenceArray\r
+     */\r
+    public void setSequence(jalview.schemabinding.version2.Sequence[] sequenceArray)\r
+    {\r
+        //-- copy array\r
+        _sequenceList.removeAllElements();\r
+        for (int i = 0; i < sequenceArray.length; i++) {\r
+            _sequenceList.addElement(sequenceArray[i]);\r
+        }\r
+    } //-- void setSequence(jalview.schemabinding.version2.Sequence) \r
+\r
+    /**\r
+     * Method unmarshal\r
+     * \r
+     * \r
+     * \r
+     * @param reader\r
+     * @return Object\r
+     */\r
+    public static java.lang.Object unmarshal(java.io.Reader reader)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        return (jalview.schemabinding.version2.SequenceSet) Unmarshaller.unmarshal(jalview.schemabinding.version2.SequenceSet.class, reader);\r
+    } //-- java.lang.Object unmarshal(java.io.Reader) \r
+\r
+    /**\r
+     * Method validate\r
+     * \r
+     */\r
+    public void validate()\r
+        throws org.exolab.castor.xml.ValidationException\r
+    {\r
+        org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
+        validator.validate(this);\r
+    } //-- void validate() \r
+\r
+}\r
diff --git a/src/jalview/schemabinding/version2/SequenceSetDescriptor.java b/src/jalview/schemabinding/version2/SequenceSetDescriptor.java
new file mode 100755 (executable)
index 0000000..1e6c7b5
--- /dev/null
@@ -0,0 +1,323 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package jalview.schemabinding.version2;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import org.exolab.castor.mapping.AccessMode;\r
+import org.exolab.castor.xml.TypeValidator;\r
+import org.exolab.castor.xml.XMLFieldDescriptor;\r
+import org.exolab.castor.xml.validators.*;\r
+\r
+/**\r
+ * Class SequenceSetDescriptor.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class SequenceSetDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * Field nsPrefix\r
+     */\r
+    private java.lang.String nsPrefix;\r
+\r
+    /**\r
+     * Field nsURI\r
+     */\r
+    private java.lang.String nsURI;\r
+\r
+    /**\r
+     * Field xmlName\r
+     */\r
+    private java.lang.String xmlName;\r
+\r
+    /**\r
+     * Field identity\r
+     */\r
+    private org.exolab.castor.xml.XMLFieldDescriptor identity;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public SequenceSetDescriptor() {\r
+        super();\r
+        nsURI = "www.vamsas.ac.uk/jalview/version2";\r
+        xmlName = "SequenceSet";\r
+        \r
+        //-- set grouping compositor\r
+        setCompositorAsSequence();\r
+        org.exolab.castor.xml.util.XMLFieldDescriptorImpl  desc           = null;\r
+        org.exolab.castor.xml.XMLFieldHandler              handler        = null;\r
+        org.exolab.castor.xml.FieldValidator               fieldValidator = null;\r
+        //-- initialize attribute descriptors\r
+        \r
+        //-- _gapChar\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_gapChar", "gapChar", org.exolab.castor.xml.NodeType.Attribute);\r
+        desc.setImmutable(true);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                SequenceSet target = (SequenceSet) object;\r
+                return target.getGapChar();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    SequenceSet target = (SequenceSet) object;\r
+                    target.setGapChar( (java.lang.String) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        desc.setRequired(true);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _gapChar\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        fieldValidator.setMinOccurs(1);\r
+        { //-- local scope\r
+            StringValidator typeValidator = new StringValidator();\r
+            typeValidator.setWhiteSpace("preserve");\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _aligned\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_aligned", "aligned", org.exolab.castor.xml.NodeType.Attribute);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                SequenceSet target = (SequenceSet) object;\r
+                if(!target.hasAligned())\r
+                    return null;\r
+                return (target.getAligned() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    SequenceSet target = (SequenceSet) object;\r
+                    // if null, use delete method for optional primitives \r
+                    if (value == null) {\r
+                        target.deleteAligned();\r
+                        return;\r
+                    }\r
+                    target.setAligned( ((java.lang.Boolean)value).booleanValue());\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _aligned\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            BooleanValidator typeValidator = new BooleanValidator();\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- initialize element descriptors\r
+        \r
+        //-- _sequenceList\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(jalview.schemabinding.version2.Sequence.class, "_sequenceList", "Sequence", org.exolab.castor.xml.NodeType.Element);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                SequenceSet target = (SequenceSet) object;\r
+                return target.getSequence();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    SequenceSet target = (SequenceSet) object;\r
+                    target.addSequence( (jalview.schemabinding.version2.Sequence) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return new jalview.schemabinding.version2.Sequence();\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");\r
+        desc.setRequired(true);\r
+        desc.setMultivalued(true);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _sequenceList\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        fieldValidator.setMinOccurs(1);\r
+        { //-- local scope\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _annotationList\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(jalview.schemabinding.version2.Annotation.class, "_annotationList", "Annotation", org.exolab.castor.xml.NodeType.Element);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                SequenceSet target = (SequenceSet) object;\r
+                return target.getAnnotation();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    SequenceSet target = (SequenceSet) object;\r
+                    target.addAnnotation( (jalview.schemabinding.version2.Annotation) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return new jalview.schemabinding.version2.Annotation();\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");\r
+        desc.setMultivalued(true);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _annotationList\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        fieldValidator.setMinOccurs(0);\r
+        { //-- local scope\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+    } //-- jalview.schemabinding.version2.SequenceSetDescriptor()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Method getAccessMode\r
+     * \r
+     * \r
+     * \r
+     * @return AccessMode\r
+     */\r
+    public org.exolab.castor.mapping.AccessMode getAccessMode()\r
+    {\r
+        return null;\r
+    } //-- org.exolab.castor.mapping.AccessMode getAccessMode() \r
+\r
+    /**\r
+     * Method getExtends\r
+     * \r
+     * \r
+     * \r
+     * @return ClassDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.ClassDescriptor getExtends()\r
+    {\r
+        return null;\r
+    } //-- org.exolab.castor.mapping.ClassDescriptor getExtends() \r
+\r
+    /**\r
+     * Method getIdentity\r
+     * \r
+     * \r
+     * \r
+     * @return FieldDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.FieldDescriptor getIdentity()\r
+    {\r
+        return identity;\r
+    } //-- org.exolab.castor.mapping.FieldDescriptor getIdentity() \r
+\r
+    /**\r
+     * Method getJavaClass\r
+     * \r
+     * \r
+     * \r
+     * @return Class\r
+     */\r
+    public java.lang.Class getJavaClass()\r
+    {\r
+        return jalview.schemabinding.version2.SequenceSet.class;\r
+    } //-- java.lang.Class getJavaClass() \r
+\r
+    /**\r
+     * Method getNameSpacePrefix\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpacePrefix()\r
+    {\r
+        return nsPrefix;\r
+    } //-- java.lang.String getNameSpacePrefix() \r
+\r
+    /**\r
+     * Method getNameSpaceURI\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpaceURI()\r
+    {\r
+        return nsURI;\r
+    } //-- java.lang.String getNameSpaceURI() \r
+\r
+    /**\r
+     * Method getValidator\r
+     * \r
+     * \r
+     * \r
+     * @return TypeValidator\r
+     */\r
+    public org.exolab.castor.xml.TypeValidator getValidator()\r
+    {\r
+        return this;\r
+    } //-- org.exolab.castor.xml.TypeValidator getValidator() \r
+\r
+    /**\r
+     * Method getXMLName\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getXMLName()\r
+    {\r
+        return xmlName;\r
+    } //-- java.lang.String getXMLName() \r
+\r
+}\r
diff --git a/src/jalview/schemabinding/version2/SequenceType.java b/src/jalview/schemabinding/version2/SequenceType.java
new file mode 100755 (executable)
index 0000000..d413e2d
--- /dev/null
@@ -0,0 +1,225 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package jalview.schemabinding.version2;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import java.io.IOException;\r
+import java.io.Reader;\r
+import java.io.Serializable;\r
+import java.io.Writer;\r
+import org.exolab.castor.xml.MarshalException;\r
+import org.exolab.castor.xml.Marshaller;\r
+import org.exolab.castor.xml.Unmarshaller;\r
+import org.exolab.castor.xml.ValidationException;\r
+import org.xml.sax.ContentHandler;\r
+\r
+/**\r
+ * Class SequenceType.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class SequenceType implements java.io.Serializable {\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * Field _id\r
+     */\r
+    private java.lang.String _id;\r
+\r
+    /**\r
+     * Field _description\r
+     */\r
+    private java.lang.String _description;\r
+\r
+    /**\r
+     * Field _sequence\r
+     */\r
+    private java.lang.String _sequence;\r
+\r
+    /**\r
+     * Field _name\r
+     */\r
+    private java.lang.String _name;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public SequenceType() {\r
+        super();\r
+    } //-- jalview.schemabinding.version2.SequenceType()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Returns the value of field 'description'.\r
+     * \r
+     * @return String\r
+     * @return the value of field 'description'.\r
+     */\r
+    public java.lang.String getDescription()\r
+    {\r
+        return this._description;\r
+    } //-- java.lang.String getDescription() \r
+\r
+    /**\r
+     * Returns the value of field 'id'.\r
+     * \r
+     * @return String\r
+     * @return the value of field 'id'.\r
+     */\r
+    public java.lang.String getId()\r
+    {\r
+        return this._id;\r
+    } //-- java.lang.String getId() \r
+\r
+    /**\r
+     * Returns the value of field 'name'.\r
+     * \r
+     * @return String\r
+     * @return the value of field 'name'.\r
+     */\r
+    public java.lang.String getName()\r
+    {\r
+        return this._name;\r
+    } //-- java.lang.String getName() \r
+\r
+    /**\r
+     * Returns the value of field 'sequence'.\r
+     * \r
+     * @return String\r
+     * @return the value of field 'sequence'.\r
+     */\r
+    public java.lang.String getSequence()\r
+    {\r
+        return this._sequence;\r
+    } //-- java.lang.String getSequence() \r
+\r
+    /**\r
+     * Method isValid\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean isValid()\r
+    {\r
+        try {\r
+            validate();\r
+        }\r
+        catch (org.exolab.castor.xml.ValidationException vex) {\r
+            return false;\r
+        }\r
+        return true;\r
+    } //-- boolean isValid() \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param out\r
+     */\r
+    public void marshal(java.io.Writer out)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, out);\r
+    } //-- void marshal(java.io.Writer) \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param handler\r
+     */\r
+    public void marshal(org.xml.sax.ContentHandler handler)\r
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, handler);\r
+    } //-- void marshal(org.xml.sax.ContentHandler) \r
+\r
+    /**\r
+     * Sets the value of field 'description'.\r
+     * \r
+     * @param description the value of field 'description'.\r
+     */\r
+    public void setDescription(java.lang.String description)\r
+    {\r
+        this._description = description;\r
+    } //-- void setDescription(java.lang.String) \r
+\r
+    /**\r
+     * Sets the value of field 'id'.\r
+     * \r
+     * @param id the value of field 'id'.\r
+     */\r
+    public void setId(java.lang.String id)\r
+    {\r
+        this._id = id;\r
+    } //-- void setId(java.lang.String) \r
+\r
+    /**\r
+     * Sets the value of field 'name'.\r
+     * \r
+     * @param name the value of field 'name'.\r
+     */\r
+    public void setName(java.lang.String name)\r
+    {\r
+        this._name = name;\r
+    } //-- void setName(java.lang.String) \r
+\r
+    /**\r
+     * Sets the value of field 'sequence'.\r
+     * \r
+     * @param sequence the value of field 'sequence'.\r
+     */\r
+    public void setSequence(java.lang.String sequence)\r
+    {\r
+        this._sequence = sequence;\r
+    } //-- void setSequence(java.lang.String) \r
+\r
+    /**\r
+     * Method unmarshal\r
+     * \r
+     * \r
+     * \r
+     * @param reader\r
+     * @return Object\r
+     */\r
+    public static java.lang.Object unmarshal(java.io.Reader reader)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        return (jalview.schemabinding.version2.SequenceType) Unmarshaller.unmarshal(jalview.schemabinding.version2.SequenceType.class, reader);\r
+    } //-- java.lang.Object unmarshal(java.io.Reader) \r
+\r
+    /**\r
+     * Method validate\r
+     * \r
+     */\r
+    public void validate()\r
+        throws org.exolab.castor.xml.ValidationException\r
+    {\r
+        org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
+        validator.validate(this);\r
+    } //-- void validate() \r
+\r
+}\r
diff --git a/src/jalview/schemabinding/version2/SequenceTypeDescriptor.java b/src/jalview/schemabinding/version2/SequenceTypeDescriptor.java
new file mode 100755 (executable)
index 0000000..9977ea3
--- /dev/null
@@ -0,0 +1,325 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package jalview.schemabinding.version2;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import org.exolab.castor.mapping.AccessMode;\r
+import org.exolab.castor.xml.TypeValidator;\r
+import org.exolab.castor.xml.XMLFieldDescriptor;\r
+import org.exolab.castor.xml.validators.*;\r
+\r
+/**\r
+ * Class SequenceTypeDescriptor.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class SequenceTypeDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * Field nsPrefix\r
+     */\r
+    private java.lang.String nsPrefix;\r
+\r
+    /**\r
+     * Field nsURI\r
+     */\r
+    private java.lang.String nsURI;\r
+\r
+    /**\r
+     * Field xmlName\r
+     */\r
+    private java.lang.String xmlName;\r
+\r
+    /**\r
+     * Field identity\r
+     */\r
+    private org.exolab.castor.xml.XMLFieldDescriptor identity;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public SequenceTypeDescriptor() {\r
+        super();\r
+        nsURI = "www.vamsas.ac.uk/jalview/version2";\r
+        xmlName = "SequenceType";\r
+        \r
+        //-- set grouping compositor\r
+        setCompositorAsSequence();\r
+        org.exolab.castor.xml.util.XMLFieldDescriptorImpl  desc           = null;\r
+        org.exolab.castor.xml.XMLFieldHandler              handler        = null;\r
+        org.exolab.castor.xml.FieldValidator               fieldValidator = null;\r
+        //-- initialize attribute descriptors\r
+        \r
+        //-- _id\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_id", "id", org.exolab.castor.xml.NodeType.Attribute);\r
+        desc.setImmutable(true);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                SequenceType target = (SequenceType) object;\r
+                return target.getId();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    SequenceType target = (SequenceType) object;\r
+                    target.setId( (java.lang.String) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _id\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            StringValidator typeValidator = new StringValidator();\r
+            typeValidator.setWhiteSpace("preserve");\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _description\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_description", "description", org.exolab.castor.xml.NodeType.Attribute);\r
+        desc.setImmutable(true);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                SequenceType target = (SequenceType) object;\r
+                return target.getDescription();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    SequenceType target = (SequenceType) object;\r
+                    target.setDescription( (java.lang.String) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _description\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            StringValidator typeValidator = new StringValidator();\r
+            typeValidator.setWhiteSpace("preserve");\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- initialize element descriptors\r
+        \r
+        //-- _sequence\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_sequence", "sequence", org.exolab.castor.xml.NodeType.Element);\r
+        desc.setImmutable(true);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                SequenceType target = (SequenceType) object;\r
+                return target.getSequence();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    SequenceType target = (SequenceType) object;\r
+                    target.setSequence( (java.lang.String) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");\r
+        desc.setRequired(true);\r
+        desc.setMultivalued(false);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _sequence\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        fieldValidator.setMinOccurs(1);\r
+        { //-- local scope\r
+            StringValidator typeValidator = new StringValidator();\r
+            typeValidator.setWhiteSpace("preserve");\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _name\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_name", "name", org.exolab.castor.xml.NodeType.Element);\r
+        desc.setImmutable(true);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                SequenceType target = (SequenceType) object;\r
+                return target.getName();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    SequenceType target = (SequenceType) object;\r
+                    target.setName( (java.lang.String) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");\r
+        desc.setRequired(true);\r
+        desc.setMultivalued(false);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _name\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        fieldValidator.setMinOccurs(1);\r
+        { //-- local scope\r
+            StringValidator typeValidator = new StringValidator();\r
+            typeValidator.setWhiteSpace("preserve");\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+    } //-- jalview.schemabinding.version2.SequenceTypeDescriptor()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Method getAccessMode\r
+     * \r
+     * \r
+     * \r
+     * @return AccessMode\r
+     */\r
+    public org.exolab.castor.mapping.AccessMode getAccessMode()\r
+    {\r
+        return null;\r
+    } //-- org.exolab.castor.mapping.AccessMode getAccessMode() \r
+\r
+    /**\r
+     * Method getExtends\r
+     * \r
+     * \r
+     * \r
+     * @return ClassDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.ClassDescriptor getExtends()\r
+    {\r
+        return null;\r
+    } //-- org.exolab.castor.mapping.ClassDescriptor getExtends() \r
+\r
+    /**\r
+     * Method getIdentity\r
+     * \r
+     * \r
+     * \r
+     * @return FieldDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.FieldDescriptor getIdentity()\r
+    {\r
+        return identity;\r
+    } //-- org.exolab.castor.mapping.FieldDescriptor getIdentity() \r
+\r
+    /**\r
+     * Method getJavaClass\r
+     * \r
+     * \r
+     * \r
+     * @return Class\r
+     */\r
+    public java.lang.Class getJavaClass()\r
+    {\r
+        return jalview.schemabinding.version2.SequenceType.class;\r
+    } //-- java.lang.Class getJavaClass() \r
+\r
+    /**\r
+     * Method getNameSpacePrefix\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpacePrefix()\r
+    {\r
+        return nsPrefix;\r
+    } //-- java.lang.String getNameSpacePrefix() \r
+\r
+    /**\r
+     * Method getNameSpaceURI\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpaceURI()\r
+    {\r
+        return nsURI;\r
+    } //-- java.lang.String getNameSpaceURI() \r
+\r
+    /**\r
+     * Method getValidator\r
+     * \r
+     * \r
+     * \r
+     * @return TypeValidator\r
+     */\r
+    public org.exolab.castor.xml.TypeValidator getValidator()\r
+    {\r
+        return this;\r
+    } //-- org.exolab.castor.xml.TypeValidator getValidator() \r
+\r
+    /**\r
+     * Method getXMLName\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getXMLName()\r
+    {\r
+        return xmlName;\r
+    } //-- java.lang.String getXMLName() \r
+\r
+}\r
diff --git a/src/jalview/schemabinding/version2/Setting.java b/src/jalview/schemabinding/version2/Setting.java
new file mode 100755 (executable)
index 0000000..668ef9d
--- /dev/null
@@ -0,0 +1,253 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package jalview.schemabinding.version2;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import java.io.IOException;\r
+import java.io.Reader;\r
+import java.io.Serializable;\r
+import java.io.Writer;\r
+import org.exolab.castor.xml.MarshalException;\r
+import org.exolab.castor.xml.Marshaller;\r
+import org.exolab.castor.xml.Unmarshaller;\r
+import org.exolab.castor.xml.ValidationException;\r
+import org.xml.sax.ContentHandler;\r
+\r
+/**\r
+ * Class Setting.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class Setting implements java.io.Serializable {\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * Field _type\r
+     */\r
+    private java.lang.String _type;\r
+\r
+    /**\r
+     * Field _colour\r
+     */\r
+    private int _colour;\r
+\r
+    /**\r
+     * keeps track of state for field: _colour\r
+     */\r
+    private boolean _has_colour;\r
+\r
+    /**\r
+     * Field _display\r
+     */\r
+    private boolean _display;\r
+\r
+    /**\r
+     * keeps track of state for field: _display\r
+     */\r
+    private boolean _has_display;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public Setting() {\r
+        super();\r
+    } //-- jalview.schemabinding.version2.Setting()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Method deleteColour\r
+     * \r
+     */\r
+    public void deleteColour()\r
+    {\r
+        this._has_colour= false;\r
+    } //-- void deleteColour() \r
+\r
+    /**\r
+     * Method deleteDisplay\r
+     * \r
+     */\r
+    public void deleteDisplay()\r
+    {\r
+        this._has_display= false;\r
+    } //-- void deleteDisplay() \r
+\r
+    /**\r
+     * Returns the value of field 'colour'.\r
+     * \r
+     * @return int\r
+     * @return the value of field 'colour'.\r
+     */\r
+    public int getColour()\r
+    {\r
+        return this._colour;\r
+    } //-- int getColour() \r
+\r
+    /**\r
+     * Returns the value of field 'display'.\r
+     * \r
+     * @return boolean\r
+     * @return the value of field 'display'.\r
+     */\r
+    public boolean getDisplay()\r
+    {\r
+        return this._display;\r
+    } //-- boolean getDisplay() \r
+\r
+    /**\r
+     * Returns the value of field 'type'.\r
+     * \r
+     * @return String\r
+     * @return the value of field 'type'.\r
+     */\r
+    public java.lang.String getType()\r
+    {\r
+        return this._type;\r
+    } //-- java.lang.String getType() \r
+\r
+    /**\r
+     * Method hasColour\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean hasColour()\r
+    {\r
+        return this._has_colour;\r
+    } //-- boolean hasColour() \r
+\r
+    /**\r
+     * Method hasDisplay\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean hasDisplay()\r
+    {\r
+        return this._has_display;\r
+    } //-- boolean hasDisplay() \r
+\r
+    /**\r
+     * Method isValid\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean isValid()\r
+    {\r
+        try {\r
+            validate();\r
+        }\r
+        catch (org.exolab.castor.xml.ValidationException vex) {\r
+            return false;\r
+        }\r
+        return true;\r
+    } //-- boolean isValid() \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param out\r
+     */\r
+    public void marshal(java.io.Writer out)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, out);\r
+    } //-- void marshal(java.io.Writer) \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param handler\r
+     */\r
+    public void marshal(org.xml.sax.ContentHandler handler)\r
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, handler);\r
+    } //-- void marshal(org.xml.sax.ContentHandler) \r
+\r
+    /**\r
+     * Sets the value of field 'colour'.\r
+     * \r
+     * @param colour the value of field 'colour'.\r
+     */\r
+    public void setColour(int colour)\r
+    {\r
+        this._colour = colour;\r
+        this._has_colour = true;\r
+    } //-- void setColour(int) \r
+\r
+    /**\r
+     * Sets the value of field 'display'.\r
+     * \r
+     * @param display the value of field 'display'.\r
+     */\r
+    public void setDisplay(boolean display)\r
+    {\r
+        this._display = display;\r
+        this._has_display = true;\r
+    } //-- void setDisplay(boolean) \r
+\r
+    /**\r
+     * Sets the value of field 'type'.\r
+     * \r
+     * @param type the value of field 'type'.\r
+     */\r
+    public void setType(java.lang.String type)\r
+    {\r
+        this._type = type;\r
+    } //-- void setType(java.lang.String) \r
+\r
+    /**\r
+     * Method unmarshal\r
+     * \r
+     * \r
+     * \r
+     * @param reader\r
+     * @return Object\r
+     */\r
+    public static java.lang.Object unmarshal(java.io.Reader reader)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        return (jalview.schemabinding.version2.Setting) Unmarshaller.unmarshal(jalview.schemabinding.version2.Setting.class, reader);\r
+    } //-- java.lang.Object unmarshal(java.io.Reader) \r
+\r
+    /**\r
+     * Method validate\r
+     * \r
+     */\r
+    public void validate()\r
+        throws org.exolab.castor.xml.ValidationException\r
+    {\r
+        org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
+        validator.validate(this);\r
+    } //-- void validate() \r
+\r
+}\r
diff --git a/src/jalview/schemabinding/version2/SettingDescriptor.java b/src/jalview/schemabinding/version2/SettingDescriptor.java
new file mode 100755 (executable)
index 0000000..6cadc16
--- /dev/null
@@ -0,0 +1,290 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package jalview.schemabinding.version2;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import org.exolab.castor.mapping.AccessMode;\r
+import org.exolab.castor.xml.TypeValidator;\r
+import org.exolab.castor.xml.XMLFieldDescriptor;\r
+import org.exolab.castor.xml.validators.*;\r
+\r
+/**\r
+ * Class SettingDescriptor.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class SettingDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * Field nsPrefix\r
+     */\r
+    private java.lang.String nsPrefix;\r
+\r
+    /**\r
+     * Field nsURI\r
+     */\r
+    private java.lang.String nsURI;\r
+\r
+    /**\r
+     * Field xmlName\r
+     */\r
+    private java.lang.String xmlName;\r
+\r
+    /**\r
+     * Field identity\r
+     */\r
+    private org.exolab.castor.xml.XMLFieldDescriptor identity;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public SettingDescriptor() {\r
+        super();\r
+        nsURI = "www.jalview.org";\r
+        xmlName = "setting";\r
+        org.exolab.castor.xml.util.XMLFieldDescriptorImpl  desc           = null;\r
+        org.exolab.castor.xml.XMLFieldHandler              handler        = null;\r
+        org.exolab.castor.xml.FieldValidator               fieldValidator = null;\r
+        //-- initialize attribute descriptors\r
+        \r
+        //-- _type\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_type", "type", org.exolab.castor.xml.NodeType.Attribute);\r
+        desc.setImmutable(true);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Setting target = (Setting) object;\r
+                return target.getType();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Setting target = (Setting) object;\r
+                    target.setType( (java.lang.String) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        desc.setRequired(true);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _type\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        fieldValidator.setMinOccurs(1);\r
+        { //-- local scope\r
+            StringValidator typeValidator = new StringValidator();\r
+            typeValidator.setWhiteSpace("preserve");\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _colour\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_colour", "colour", org.exolab.castor.xml.NodeType.Attribute);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Setting target = (Setting) object;\r
+                if(!target.hasColour())\r
+                    return null;\r
+                return new java.lang.Integer(target.getColour());\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Setting target = (Setting) object;\r
+                    // ignore null values for non optional primitives\r
+                    if (value == null) return;\r
+                    \r
+                    target.setColour( ((java.lang.Integer)value).intValue());\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        desc.setRequired(true);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _colour\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        fieldValidator.setMinOccurs(1);\r
+        { //-- local scope\r
+            IntegerValidator typeValidator= new IntegerValidator();\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _display\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_display", "display", org.exolab.castor.xml.NodeType.Attribute);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Setting target = (Setting) object;\r
+                if(!target.hasDisplay())\r
+                    return null;\r
+                return (target.getDisplay() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Setting target = (Setting) object;\r
+                    // ignore null values for non optional primitives\r
+                    if (value == null) return;\r
+                    \r
+                    target.setDisplay( ((java.lang.Boolean)value).booleanValue());\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        desc.setRequired(true);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _display\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        fieldValidator.setMinOccurs(1);\r
+        { //-- local scope\r
+            BooleanValidator typeValidator = new BooleanValidator();\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- initialize element descriptors\r
+        \r
+    } //-- jalview.schemabinding.version2.SettingDescriptor()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Method getAccessMode\r
+     * \r
+     * \r
+     * \r
+     * @return AccessMode\r
+     */\r
+    public org.exolab.castor.mapping.AccessMode getAccessMode()\r
+    {\r
+        return null;\r
+    } //-- org.exolab.castor.mapping.AccessMode getAccessMode() \r
+\r
+    /**\r
+     * Method getExtends\r
+     * \r
+     * \r
+     * \r
+     * @return ClassDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.ClassDescriptor getExtends()\r
+    {\r
+        return null;\r
+    } //-- org.exolab.castor.mapping.ClassDescriptor getExtends() \r
+\r
+    /**\r
+     * Method getIdentity\r
+     * \r
+     * \r
+     * \r
+     * @return FieldDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.FieldDescriptor getIdentity()\r
+    {\r
+        return identity;\r
+    } //-- org.exolab.castor.mapping.FieldDescriptor getIdentity() \r
+\r
+    /**\r
+     * Method getJavaClass\r
+     * \r
+     * \r
+     * \r
+     * @return Class\r
+     */\r
+    public java.lang.Class getJavaClass()\r
+    {\r
+        return jalview.schemabinding.version2.Setting.class;\r
+    } //-- java.lang.Class getJavaClass() \r
+\r
+    /**\r
+     * Method getNameSpacePrefix\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpacePrefix()\r
+    {\r
+        return nsPrefix;\r
+    } //-- java.lang.String getNameSpacePrefix() \r
+\r
+    /**\r
+     * Method getNameSpaceURI\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpaceURI()\r
+    {\r
+        return nsURI;\r
+    } //-- java.lang.String getNameSpaceURI() \r
+\r
+    /**\r
+     * Method getValidator\r
+     * \r
+     * \r
+     * \r
+     * @return TypeValidator\r
+     */\r
+    public org.exolab.castor.xml.TypeValidator getValidator()\r
+    {\r
+        return this;\r
+    } //-- org.exolab.castor.xml.TypeValidator getValidator() \r
+\r
+    /**\r
+     * Method getXMLName\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getXMLName()\r
+    {\r
+        return xmlName;\r
+    } //-- java.lang.String getXMLName() \r
+\r
+}\r
diff --git a/src/jalview/schemabinding/version2/ThresholdLine.java b/src/jalview/schemabinding/version2/ThresholdLine.java
new file mode 100755 (executable)
index 0000000..85854c1
--- /dev/null
@@ -0,0 +1,253 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package jalview.schemabinding.version2;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import java.io.IOException;\r
+import java.io.Reader;\r
+import java.io.Serializable;\r
+import java.io.Writer;\r
+import org.exolab.castor.xml.MarshalException;\r
+import org.exolab.castor.xml.Marshaller;\r
+import org.exolab.castor.xml.Unmarshaller;\r
+import org.exolab.castor.xml.ValidationException;\r
+import org.xml.sax.ContentHandler;\r
+\r
+/**\r
+ * Class ThresholdLine.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class ThresholdLine implements java.io.Serializable {\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * Field _label\r
+     */\r
+    private java.lang.String _label;\r
+\r
+    /**\r
+     * Field _value\r
+     */\r
+    private float _value;\r
+\r
+    /**\r
+     * keeps track of state for field: _value\r
+     */\r
+    private boolean _has_value;\r
+\r
+    /**\r
+     * Field _colour\r
+     */\r
+    private int _colour;\r
+\r
+    /**\r
+     * keeps track of state for field: _colour\r
+     */\r
+    private boolean _has_colour;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public ThresholdLine() {\r
+        super();\r
+    } //-- jalview.schemabinding.version2.ThresholdLine()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Method deleteColour\r
+     * \r
+     */\r
+    public void deleteColour()\r
+    {\r
+        this._has_colour= false;\r
+    } //-- void deleteColour() \r
+\r
+    /**\r
+     * Method deleteValue\r
+     * \r
+     */\r
+    public void deleteValue()\r
+    {\r
+        this._has_value= false;\r
+    } //-- void deleteValue() \r
+\r
+    /**\r
+     * Returns the value of field 'colour'.\r
+     * \r
+     * @return int\r
+     * @return the value of field 'colour'.\r
+     */\r
+    public int getColour()\r
+    {\r
+        return this._colour;\r
+    } //-- int getColour() \r
+\r
+    /**\r
+     * Returns the value of field 'label'.\r
+     * \r
+     * @return String\r
+     * @return the value of field 'label'.\r
+     */\r
+    public java.lang.String getLabel()\r
+    {\r
+        return this._label;\r
+    } //-- java.lang.String getLabel() \r
+\r
+    /**\r
+     * Returns the value of field 'value'.\r
+     * \r
+     * @return float\r
+     * @return the value of field 'value'.\r
+     */\r
+    public float getValue()\r
+    {\r
+        return this._value;\r
+    } //-- float getValue() \r
+\r
+    /**\r
+     * Method hasColour\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean hasColour()\r
+    {\r
+        return this._has_colour;\r
+    } //-- boolean hasColour() \r
+\r
+    /**\r
+     * Method hasValue\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean hasValue()\r
+    {\r
+        return this._has_value;\r
+    } //-- boolean hasValue() \r
+\r
+    /**\r
+     * Method isValid\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean isValid()\r
+    {\r
+        try {\r
+            validate();\r
+        }\r
+        catch (org.exolab.castor.xml.ValidationException vex) {\r
+            return false;\r
+        }\r
+        return true;\r
+    } //-- boolean isValid() \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param out\r
+     */\r
+    public void marshal(java.io.Writer out)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, out);\r
+    } //-- void marshal(java.io.Writer) \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param handler\r
+     */\r
+    public void marshal(org.xml.sax.ContentHandler handler)\r
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, handler);\r
+    } //-- void marshal(org.xml.sax.ContentHandler) \r
+\r
+    /**\r
+     * Sets the value of field 'colour'.\r
+     * \r
+     * @param colour the value of field 'colour'.\r
+     */\r
+    public void setColour(int colour)\r
+    {\r
+        this._colour = colour;\r
+        this._has_colour = true;\r
+    } //-- void setColour(int) \r
+\r
+    /**\r
+     * Sets the value of field 'label'.\r
+     * \r
+     * @param label the value of field 'label'.\r
+     */\r
+    public void setLabel(java.lang.String label)\r
+    {\r
+        this._label = label;\r
+    } //-- void setLabel(java.lang.String) \r
+\r
+    /**\r
+     * Sets the value of field 'value'.\r
+     * \r
+     * @param value the value of field 'value'.\r
+     */\r
+    public void setValue(float value)\r
+    {\r
+        this._value = value;\r
+        this._has_value = true;\r
+    } //-- void setValue(float) \r
+\r
+    /**\r
+     * Method unmarshal\r
+     * \r
+     * \r
+     * \r
+     * @param reader\r
+     * @return Object\r
+     */\r
+    public static java.lang.Object unmarshal(java.io.Reader reader)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        return (jalview.schemabinding.version2.ThresholdLine) Unmarshaller.unmarshal(jalview.schemabinding.version2.ThresholdLine.class, reader);\r
+    } //-- java.lang.Object unmarshal(java.io.Reader) \r
+\r
+    /**\r
+     * Method validate\r
+     * \r
+     */\r
+    public void validate()\r
+        throws org.exolab.castor.xml.ValidationException\r
+    {\r
+        org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
+        validator.validate(this);\r
+    } //-- void validate() \r
+\r
+}\r
diff --git a/src/jalview/schemabinding/version2/ThresholdLineDescriptor.java b/src/jalview/schemabinding/version2/ThresholdLineDescriptor.java
new file mode 100755 (executable)
index 0000000..9241003
--- /dev/null
@@ -0,0 +1,288 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package jalview.schemabinding.version2;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import org.exolab.castor.mapping.AccessMode;\r
+import org.exolab.castor.xml.TypeValidator;\r
+import org.exolab.castor.xml.XMLFieldDescriptor;\r
+import org.exolab.castor.xml.validators.*;\r
+\r
+/**\r
+ * Class ThresholdLineDescriptor.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class ThresholdLineDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * Field nsPrefix\r
+     */\r
+    private java.lang.String nsPrefix;\r
+\r
+    /**\r
+     * Field nsURI\r
+     */\r
+    private java.lang.String nsURI;\r
+\r
+    /**\r
+     * Field xmlName\r
+     */\r
+    private java.lang.String xmlName;\r
+\r
+    /**\r
+     * Field identity\r
+     */\r
+    private org.exolab.castor.xml.XMLFieldDescriptor identity;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public ThresholdLineDescriptor() {\r
+        super();\r
+        nsURI = "www.vamsas.ac.uk/jalview/version2";\r
+        xmlName = "thresholdLine";\r
+        org.exolab.castor.xml.util.XMLFieldDescriptorImpl  desc           = null;\r
+        org.exolab.castor.xml.XMLFieldHandler              handler        = null;\r
+        org.exolab.castor.xml.FieldValidator               fieldValidator = null;\r
+        //-- initialize attribute descriptors\r
+        \r
+        //-- _label\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_label", "label", org.exolab.castor.xml.NodeType.Attribute);\r
+        desc.setImmutable(true);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                ThresholdLine target = (ThresholdLine) object;\r
+                return target.getLabel();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    ThresholdLine target = (ThresholdLine) object;\r
+                    target.setLabel( (java.lang.String) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _label\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            StringValidator typeValidator = new StringValidator();\r
+            typeValidator.setWhiteSpace("preserve");\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _value\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(float.class, "_value", "value", org.exolab.castor.xml.NodeType.Attribute);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                ThresholdLine target = (ThresholdLine) object;\r
+                if(!target.hasValue())\r
+                    return null;\r
+                return new java.lang.Float(target.getValue());\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    ThresholdLine target = (ThresholdLine) object;\r
+                    // if null, use delete method for optional primitives \r
+                    if (value == null) {\r
+                        target.deleteValue();\r
+                        return;\r
+                    }\r
+                    target.setValue( ((java.lang.Float)value).floatValue());\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _value\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            FloatValidator typeValidator = new FloatValidator();\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _colour\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_colour", "colour", org.exolab.castor.xml.NodeType.Attribute);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                ThresholdLine target = (ThresholdLine) object;\r
+                if(!target.hasColour())\r
+                    return null;\r
+                return new java.lang.Integer(target.getColour());\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    ThresholdLine target = (ThresholdLine) object;\r
+                    // if null, use delete method for optional primitives \r
+                    if (value == null) {\r
+                        target.deleteColour();\r
+                        return;\r
+                    }\r
+                    target.setColour( ((java.lang.Integer)value).intValue());\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _colour\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            IntegerValidator typeValidator= new IntegerValidator();\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- initialize element descriptors\r
+        \r
+    } //-- jalview.schemabinding.version2.ThresholdLineDescriptor()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Method getAccessMode\r
+     * \r
+     * \r
+     * \r
+     * @return AccessMode\r
+     */\r
+    public org.exolab.castor.mapping.AccessMode getAccessMode()\r
+    {\r
+        return null;\r
+    } //-- org.exolab.castor.mapping.AccessMode getAccessMode() \r
+\r
+    /**\r
+     * Method getExtends\r
+     * \r
+     * \r
+     * \r
+     * @return ClassDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.ClassDescriptor getExtends()\r
+    {\r
+        return null;\r
+    } //-- org.exolab.castor.mapping.ClassDescriptor getExtends() \r
+\r
+    /**\r
+     * Method getIdentity\r
+     * \r
+     * \r
+     * \r
+     * @return FieldDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.FieldDescriptor getIdentity()\r
+    {\r
+        return identity;\r
+    } //-- org.exolab.castor.mapping.FieldDescriptor getIdentity() \r
+\r
+    /**\r
+     * Method getJavaClass\r
+     * \r
+     * \r
+     * \r
+     * @return Class\r
+     */\r
+    public java.lang.Class getJavaClass()\r
+    {\r
+        return jalview.schemabinding.version2.ThresholdLine.class;\r
+    } //-- java.lang.Class getJavaClass() \r
+\r
+    /**\r
+     * Method getNameSpacePrefix\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpacePrefix()\r
+    {\r
+        return nsPrefix;\r
+    } //-- java.lang.String getNameSpacePrefix() \r
+\r
+    /**\r
+     * Method getNameSpaceURI\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpaceURI()\r
+    {\r
+        return nsURI;\r
+    } //-- java.lang.String getNameSpaceURI() \r
+\r
+    /**\r
+     * Method getValidator\r
+     * \r
+     * \r
+     * \r
+     * @return TypeValidator\r
+     */\r
+    public org.exolab.castor.xml.TypeValidator getValidator()\r
+    {\r
+        return this;\r
+    } //-- org.exolab.castor.xml.TypeValidator getValidator() \r
+\r
+    /**\r
+     * Method getXMLName\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getXMLName()\r
+    {\r
+        return xmlName;\r
+    } //-- java.lang.String getXMLName() \r
+\r
+}\r
diff --git a/src/jalview/schemabinding/version2/Tree.java b/src/jalview/schemabinding/version2/Tree.java
new file mode 100755 (executable)
index 0000000..96b2e18
--- /dev/null
@@ -0,0 +1,835 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package jalview.schemabinding.version2;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import java.io.IOException;\r
+import java.io.Reader;\r
+import java.io.Serializable;\r
+import java.io.Writer;\r
+import org.exolab.castor.xml.MarshalException;\r
+import org.exolab.castor.xml.Marshaller;\r
+import org.exolab.castor.xml.Unmarshaller;\r
+import org.exolab.castor.xml.ValidationException;\r
+import org.xml.sax.ContentHandler;\r
+\r
+/**\r
+ * Class Tree.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class Tree implements java.io.Serializable {\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * Field _width\r
+     */\r
+    private int _width;\r
+\r
+    /**\r
+     * keeps track of state for field: _width\r
+     */\r
+    private boolean _has_width;\r
+\r
+    /**\r
+     * Field _height\r
+     */\r
+    private int _height;\r
+\r
+    /**\r
+     * keeps track of state for field: _height\r
+     */\r
+    private boolean _has_height;\r
+\r
+    /**\r
+     * Field _xpos\r
+     */\r
+    private int _xpos;\r
+\r
+    /**\r
+     * keeps track of state for field: _xpos\r
+     */\r
+    private boolean _has_xpos;\r
+\r
+    /**\r
+     * Field _ypos\r
+     */\r
+    private int _ypos;\r
+\r
+    /**\r
+     * keeps track of state for field: _ypos\r
+     */\r
+    private boolean _has_ypos;\r
+\r
+    /**\r
+     * Field _fontName\r
+     */\r
+    private java.lang.String _fontName;\r
+\r
+    /**\r
+     * Field _fontSize\r
+     */\r
+    private int _fontSize;\r
+\r
+    /**\r
+     * keeps track of state for field: _fontSize\r
+     */\r
+    private boolean _has_fontSize;\r
+\r
+    /**\r
+     * Field _fontStyle\r
+     */\r
+    private int _fontStyle;\r
+\r
+    /**\r
+     * keeps track of state for field: _fontStyle\r
+     */\r
+    private boolean _has_fontStyle;\r
+\r
+    /**\r
+     * Field _threshold\r
+     */\r
+    private float _threshold;\r
+\r
+    /**\r
+     * keeps track of state for field: _threshold\r
+     */\r
+    private boolean _has_threshold;\r
+\r
+    /**\r
+     * Field _showBootstrap\r
+     */\r
+    private boolean _showBootstrap;\r
+\r
+    /**\r
+     * keeps track of state for field: _showBootstrap\r
+     */\r
+    private boolean _has_showBootstrap;\r
+\r
+    /**\r
+     * Field _showDistances\r
+     */\r
+    private boolean _showDistances;\r
+\r
+    /**\r
+     * keeps track of state for field: _showDistances\r
+     */\r
+    private boolean _has_showDistances;\r
+\r
+    /**\r
+     * Field _markUnlinked\r
+     */\r
+    private boolean _markUnlinked;\r
+\r
+    /**\r
+     * keeps track of state for field: _markUnlinked\r
+     */\r
+    private boolean _has_markUnlinked;\r
+\r
+    /**\r
+     * Field _fitToWindow\r
+     */\r
+    private boolean _fitToWindow;\r
+\r
+    /**\r
+     * keeps track of state for field: _fitToWindow\r
+     */\r
+    private boolean _has_fitToWindow;\r
+\r
+    /**\r
+     * Field _currentTree\r
+     */\r
+    private boolean _currentTree;\r
+\r
+    /**\r
+     * keeps track of state for field: _currentTree\r
+     */\r
+    private boolean _has_currentTree;\r
+\r
+    /**\r
+     * Field _title\r
+     */\r
+    private java.lang.String _title;\r
+\r
+    /**\r
+     * Field _newick\r
+     */\r
+    private java.lang.String _newick;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public Tree() {\r
+        super();\r
+    } //-- jalview.schemabinding.version2.Tree()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Method deleteCurrentTree\r
+     * \r
+     */\r
+    public void deleteCurrentTree()\r
+    {\r
+        this._has_currentTree= false;\r
+    } //-- void deleteCurrentTree() \r
+\r
+    /**\r
+     * Method deleteFitToWindow\r
+     * \r
+     */\r
+    public void deleteFitToWindow()\r
+    {\r
+        this._has_fitToWindow= false;\r
+    } //-- void deleteFitToWindow() \r
+\r
+    /**\r
+     * Method deleteFontSize\r
+     * \r
+     */\r
+    public void deleteFontSize()\r
+    {\r
+        this._has_fontSize= false;\r
+    } //-- void deleteFontSize() \r
+\r
+    /**\r
+     * Method deleteFontStyle\r
+     * \r
+     */\r
+    public void deleteFontStyle()\r
+    {\r
+        this._has_fontStyle= false;\r
+    } //-- void deleteFontStyle() \r
+\r
+    /**\r
+     * Method deleteHeight\r
+     * \r
+     */\r
+    public void deleteHeight()\r
+    {\r
+        this._has_height= false;\r
+    } //-- void deleteHeight() \r
+\r
+    /**\r
+     * Method deleteMarkUnlinked\r
+     * \r
+     */\r
+    public void deleteMarkUnlinked()\r
+    {\r
+        this._has_markUnlinked= false;\r
+    } //-- void deleteMarkUnlinked() \r
+\r
+    /**\r
+     * Method deleteShowBootstrap\r
+     * \r
+     */\r
+    public void deleteShowBootstrap()\r
+    {\r
+        this._has_showBootstrap= false;\r
+    } //-- void deleteShowBootstrap() \r
+\r
+    /**\r
+     * Method deleteShowDistances\r
+     * \r
+     */\r
+    public void deleteShowDistances()\r
+    {\r
+        this._has_showDistances= false;\r
+    } //-- void deleteShowDistances() \r
+\r
+    /**\r
+     * Method deleteThreshold\r
+     * \r
+     */\r
+    public void deleteThreshold()\r
+    {\r
+        this._has_threshold= false;\r
+    } //-- void deleteThreshold() \r
+\r
+    /**\r
+     * Method deleteWidth\r
+     * \r
+     */\r
+    public void deleteWidth()\r
+    {\r
+        this._has_width= false;\r
+    } //-- void deleteWidth() \r
+\r
+    /**\r
+     * Method deleteXpos\r
+     * \r
+     */\r
+    public void deleteXpos()\r
+    {\r
+        this._has_xpos= false;\r
+    } //-- void deleteXpos() \r
+\r
+    /**\r
+     * Method deleteYpos\r
+     * \r
+     */\r
+    public void deleteYpos()\r
+    {\r
+        this._has_ypos= false;\r
+    } //-- void deleteYpos() \r
+\r
+    /**\r
+     * Returns the value of field 'currentTree'.\r
+     * \r
+     * @return boolean\r
+     * @return the value of field 'currentTree'.\r
+     */\r
+    public boolean getCurrentTree()\r
+    {\r
+        return this._currentTree;\r
+    } //-- boolean getCurrentTree() \r
+\r
+    /**\r
+     * Returns the value of field 'fitToWindow'.\r
+     * \r
+     * @return boolean\r
+     * @return the value of field 'fitToWindow'.\r
+     */\r
+    public boolean getFitToWindow()\r
+    {\r
+        return this._fitToWindow;\r
+    } //-- boolean getFitToWindow() \r
+\r
+    /**\r
+     * Returns the value of field 'fontName'.\r
+     * \r
+     * @return String\r
+     * @return the value of field 'fontName'.\r
+     */\r
+    public java.lang.String getFontName()\r
+    {\r
+        return this._fontName;\r
+    } //-- java.lang.String getFontName() \r
+\r
+    /**\r
+     * Returns the value of field 'fontSize'.\r
+     * \r
+     * @return int\r
+     * @return the value of field 'fontSize'.\r
+     */\r
+    public int getFontSize()\r
+    {\r
+        return this._fontSize;\r
+    } //-- int getFontSize() \r
+\r
+    /**\r
+     * Returns the value of field 'fontStyle'.\r
+     * \r
+     * @return int\r
+     * @return the value of field 'fontStyle'.\r
+     */\r
+    public int getFontStyle()\r
+    {\r
+        return this._fontStyle;\r
+    } //-- int getFontStyle() \r
+\r
+    /**\r
+     * Returns the value of field 'height'.\r
+     * \r
+     * @return int\r
+     * @return the value of field 'height'.\r
+     */\r
+    public int getHeight()\r
+    {\r
+        return this._height;\r
+    } //-- int getHeight() \r
+\r
+    /**\r
+     * Returns the value of field 'markUnlinked'.\r
+     * \r
+     * @return boolean\r
+     * @return the value of field 'markUnlinked'.\r
+     */\r
+    public boolean getMarkUnlinked()\r
+    {\r
+        return this._markUnlinked;\r
+    } //-- boolean getMarkUnlinked() \r
+\r
+    /**\r
+     * Returns the value of field 'newick'.\r
+     * \r
+     * @return String\r
+     * @return the value of field 'newick'.\r
+     */\r
+    public java.lang.String getNewick()\r
+    {\r
+        return this._newick;\r
+    } //-- java.lang.String getNewick() \r
+\r
+    /**\r
+     * Returns the value of field 'showBootstrap'.\r
+     * \r
+     * @return boolean\r
+     * @return the value of field 'showBootstrap'.\r
+     */\r
+    public boolean getShowBootstrap()\r
+    {\r
+        return this._showBootstrap;\r
+    } //-- boolean getShowBootstrap() \r
+\r
+    /**\r
+     * Returns the value of field 'showDistances'.\r
+     * \r
+     * @return boolean\r
+     * @return the value of field 'showDistances'.\r
+     */\r
+    public boolean getShowDistances()\r
+    {\r
+        return this._showDistances;\r
+    } //-- boolean getShowDistances() \r
+\r
+    /**\r
+     * Returns the value of field 'threshold'.\r
+     * \r
+     * @return float\r
+     * @return the value of field 'threshold'.\r
+     */\r
+    public float getThreshold()\r
+    {\r
+        return this._threshold;\r
+    } //-- float getThreshold() \r
+\r
+    /**\r
+     * Returns the value of field 'title'.\r
+     * \r
+     * @return String\r
+     * @return the value of field 'title'.\r
+     */\r
+    public java.lang.String getTitle()\r
+    {\r
+        return this._title;\r
+    } //-- java.lang.String getTitle() \r
+\r
+    /**\r
+     * Returns the value of field 'width'.\r
+     * \r
+     * @return int\r
+     * @return the value of field 'width'.\r
+     */\r
+    public int getWidth()\r
+    {\r
+        return this._width;\r
+    } //-- int getWidth() \r
+\r
+    /**\r
+     * Returns the value of field 'xpos'.\r
+     * \r
+     * @return int\r
+     * @return the value of field 'xpos'.\r
+     */\r
+    public int getXpos()\r
+    {\r
+        return this._xpos;\r
+    } //-- int getXpos() \r
+\r
+    /**\r
+     * Returns the value of field 'ypos'.\r
+     * \r
+     * @return int\r
+     * @return the value of field 'ypos'.\r
+     */\r
+    public int getYpos()\r
+    {\r
+        return this._ypos;\r
+    } //-- int getYpos() \r
+\r
+    /**\r
+     * Method hasCurrentTree\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean hasCurrentTree()\r
+    {\r
+        return this._has_currentTree;\r
+    } //-- boolean hasCurrentTree() \r
+\r
+    /**\r
+     * Method hasFitToWindow\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean hasFitToWindow()\r
+    {\r
+        return this._has_fitToWindow;\r
+    } //-- boolean hasFitToWindow() \r
+\r
+    /**\r
+     * Method hasFontSize\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean hasFontSize()\r
+    {\r
+        return this._has_fontSize;\r
+    } //-- boolean hasFontSize() \r
+\r
+    /**\r
+     * Method hasFontStyle\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean hasFontStyle()\r
+    {\r
+        return this._has_fontStyle;\r
+    } //-- boolean hasFontStyle() \r
+\r
+    /**\r
+     * Method hasHeight\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean hasHeight()\r
+    {\r
+        return this._has_height;\r
+    } //-- boolean hasHeight() \r
+\r
+    /**\r
+     * Method hasMarkUnlinked\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean hasMarkUnlinked()\r
+    {\r
+        return this._has_markUnlinked;\r
+    } //-- boolean hasMarkUnlinked() \r
+\r
+    /**\r
+     * Method hasShowBootstrap\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean hasShowBootstrap()\r
+    {\r
+        return this._has_showBootstrap;\r
+    } //-- boolean hasShowBootstrap() \r
+\r
+    /**\r
+     * Method hasShowDistances\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean hasShowDistances()\r
+    {\r
+        return this._has_showDistances;\r
+    } //-- boolean hasShowDistances() \r
+\r
+    /**\r
+     * Method hasThreshold\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean hasThreshold()\r
+    {\r
+        return this._has_threshold;\r
+    } //-- boolean hasThreshold() \r
+\r
+    /**\r
+     * Method hasWidth\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean hasWidth()\r
+    {\r
+        return this._has_width;\r
+    } //-- boolean hasWidth() \r
+\r
+    /**\r
+     * Method hasXpos\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean hasXpos()\r
+    {\r
+        return this._has_xpos;\r
+    } //-- boolean hasXpos() \r
+\r
+    /**\r
+     * Method hasYpos\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean hasYpos()\r
+    {\r
+        return this._has_ypos;\r
+    } //-- boolean hasYpos() \r
+\r
+    /**\r
+     * Method isValid\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean isValid()\r
+    {\r
+        try {\r
+            validate();\r
+        }\r
+        catch (org.exolab.castor.xml.ValidationException vex) {\r
+            return false;\r
+        }\r
+        return true;\r
+    } //-- boolean isValid() \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param out\r
+     */\r
+    public void marshal(java.io.Writer out)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, out);\r
+    } //-- void marshal(java.io.Writer) \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param handler\r
+     */\r
+    public void marshal(org.xml.sax.ContentHandler handler)\r
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, handler);\r
+    } //-- void marshal(org.xml.sax.ContentHandler) \r
+\r
+    /**\r
+     * Sets the value of field 'currentTree'.\r
+     * \r
+     * @param currentTree the value of field 'currentTree'.\r
+     */\r
+    public void setCurrentTree(boolean currentTree)\r
+    {\r
+        this._currentTree = currentTree;\r
+        this._has_currentTree = true;\r
+    } //-- void setCurrentTree(boolean) \r
+\r
+    /**\r
+     * Sets the value of field 'fitToWindow'.\r
+     * \r
+     * @param fitToWindow the value of field 'fitToWindow'.\r
+     */\r
+    public void setFitToWindow(boolean fitToWindow)\r
+    {\r
+        this._fitToWindow = fitToWindow;\r
+        this._has_fitToWindow = true;\r
+    } //-- void setFitToWindow(boolean) \r
+\r
+    /**\r
+     * Sets the value of field 'fontName'.\r
+     * \r
+     * @param fontName the value of field 'fontName'.\r
+     */\r
+    public void setFontName(java.lang.String fontName)\r
+    {\r
+        this._fontName = fontName;\r
+    } //-- void setFontName(java.lang.String) \r
+\r
+    /**\r
+     * Sets the value of field 'fontSize'.\r
+     * \r
+     * @param fontSize the value of field 'fontSize'.\r
+     */\r
+    public void setFontSize(int fontSize)\r
+    {\r
+        this._fontSize = fontSize;\r
+        this._has_fontSize = true;\r
+    } //-- void setFontSize(int) \r
+\r
+    /**\r
+     * Sets the value of field 'fontStyle'.\r
+     * \r
+     * @param fontStyle the value of field 'fontStyle'.\r
+     */\r
+    public void setFontStyle(int fontStyle)\r
+    {\r
+        this._fontStyle = fontStyle;\r
+        this._has_fontStyle = true;\r
+    } //-- void setFontStyle(int) \r
+\r
+    /**\r
+     * Sets the value of field 'height'.\r
+     * \r
+     * @param height the value of field 'height'.\r
+     */\r
+    public void setHeight(int height)\r
+    {\r
+        this._height = height;\r
+        this._has_height = true;\r
+    } //-- void setHeight(int) \r
+\r
+    /**\r
+     * Sets the value of field 'markUnlinked'.\r
+     * \r
+     * @param markUnlinked the value of field 'markUnlinked'.\r
+     */\r
+    public void setMarkUnlinked(boolean markUnlinked)\r
+    {\r
+        this._markUnlinked = markUnlinked;\r
+        this._has_markUnlinked = true;\r
+    } //-- void setMarkUnlinked(boolean) \r
+\r
+    /**\r
+     * Sets the value of field 'newick'.\r
+     * \r
+     * @param newick the value of field 'newick'.\r
+     */\r
+    public void setNewick(java.lang.String newick)\r
+    {\r
+        this._newick = newick;\r
+    } //-- void setNewick(java.lang.String) \r
+\r
+    /**\r
+     * Sets the value of field 'showBootstrap'.\r
+     * \r
+     * @param showBootstrap the value of field 'showBootstrap'.\r
+     */\r
+    public void setShowBootstrap(boolean showBootstrap)\r
+    {\r
+        this._showBootstrap = showBootstrap;\r
+        this._has_showBootstrap = true;\r
+    } //-- void setShowBootstrap(boolean) \r
+\r
+    /**\r
+     * Sets the value of field 'showDistances'.\r
+     * \r
+     * @param showDistances the value of field 'showDistances'.\r
+     */\r
+    public void setShowDistances(boolean showDistances)\r
+    {\r
+        this._showDistances = showDistances;\r
+        this._has_showDistances = true;\r
+    } //-- void setShowDistances(boolean) \r
+\r
+    /**\r
+     * Sets the value of field 'threshold'.\r
+     * \r
+     * @param threshold the value of field 'threshold'.\r
+     */\r
+    public void setThreshold(float threshold)\r
+    {\r
+        this._threshold = threshold;\r
+        this._has_threshold = true;\r
+    } //-- void setThreshold(float) \r
+\r
+    /**\r
+     * Sets the value of field 'title'.\r
+     * \r
+     * @param title the value of field 'title'.\r
+     */\r
+    public void setTitle(java.lang.String title)\r
+    {\r
+        this._title = title;\r
+    } //-- void setTitle(java.lang.String) \r
+\r
+    /**\r
+     * Sets the value of field 'width'.\r
+     * \r
+     * @param width the value of field 'width'.\r
+     */\r
+    public void setWidth(int width)\r
+    {\r
+        this._width = width;\r
+        this._has_width = true;\r
+    } //-- void setWidth(int) \r
+\r
+    /**\r
+     * Sets the value of field 'xpos'.\r
+     * \r
+     * @param xpos the value of field 'xpos'.\r
+     */\r
+    public void setXpos(int xpos)\r
+    {\r
+        this._xpos = xpos;\r
+        this._has_xpos = true;\r
+    } //-- void setXpos(int) \r
+\r
+    /**\r
+     * Sets the value of field 'ypos'.\r
+     * \r
+     * @param ypos the value of field 'ypos'.\r
+     */\r
+    public void setYpos(int ypos)\r
+    {\r
+        this._ypos = ypos;\r
+        this._has_ypos = true;\r
+    } //-- void setYpos(int) \r
+\r
+    /**\r
+     * Method unmarshal\r
+     * \r
+     * \r
+     * \r
+     * @param reader\r
+     * @return Object\r
+     */\r
+    public static java.lang.Object unmarshal(java.io.Reader reader)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        return (jalview.schemabinding.version2.Tree) Unmarshaller.unmarshal(jalview.schemabinding.version2.Tree.class, reader);\r
+    } //-- java.lang.Object unmarshal(java.io.Reader) \r
+\r
+    /**\r
+     * Method validate\r
+     * \r
+     */\r
+    public void validate()\r
+        throws org.exolab.castor.xml.ValidationException\r
+    {\r
+        org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
+        validator.validate(this);\r
+    } //-- void validate() \r
+\r
+}\r
diff --git a/src/jalview/schemabinding/version2/TreeDescriptor.java b/src/jalview/schemabinding/version2/TreeDescriptor.java
new file mode 100755 (executable)
index 0000000..5232c12
--- /dev/null
@@ -0,0 +1,777 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package jalview.schemabinding.version2;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import org.exolab.castor.mapping.AccessMode;\r
+import org.exolab.castor.xml.TypeValidator;\r
+import org.exolab.castor.xml.XMLFieldDescriptor;\r
+import org.exolab.castor.xml.validators.*;\r
+\r
+/**\r
+ * Class TreeDescriptor.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class TreeDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * Field nsPrefix\r
+     */\r
+    private java.lang.String nsPrefix;\r
+\r
+    /**\r
+     * Field nsURI\r
+     */\r
+    private java.lang.String nsURI;\r
+\r
+    /**\r
+     * Field xmlName\r
+     */\r
+    private java.lang.String xmlName;\r
+\r
+    /**\r
+     * Field identity\r
+     */\r
+    private org.exolab.castor.xml.XMLFieldDescriptor identity;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public TreeDescriptor() {\r
+        super();\r
+        nsURI = "www.jalview.org";\r
+        xmlName = "tree";\r
+        \r
+        //-- set grouping compositor\r
+        setCompositorAsSequence();\r
+        org.exolab.castor.xml.util.XMLFieldDescriptorImpl  desc           = null;\r
+        org.exolab.castor.xml.XMLFieldHandler              handler        = null;\r
+        org.exolab.castor.xml.FieldValidator               fieldValidator = null;\r
+        //-- initialize attribute descriptors\r
+        \r
+        //-- _width\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_width", "width", org.exolab.castor.xml.NodeType.Attribute);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Tree target = (Tree) object;\r
+                if(!target.hasWidth())\r
+                    return null;\r
+                return new java.lang.Integer(target.getWidth());\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Tree target = (Tree) object;\r
+                    // if null, use delete method for optional primitives \r
+                    if (value == null) {\r
+                        target.deleteWidth();\r
+                        return;\r
+                    }\r
+                    target.setWidth( ((java.lang.Integer)value).intValue());\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _width\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            IntegerValidator typeValidator= new IntegerValidator();\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _height\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_height", "height", org.exolab.castor.xml.NodeType.Attribute);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Tree target = (Tree) object;\r
+                if(!target.hasHeight())\r
+                    return null;\r
+                return new java.lang.Integer(target.getHeight());\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Tree target = (Tree) object;\r
+                    // if null, use delete method for optional primitives \r
+                    if (value == null) {\r
+                        target.deleteHeight();\r
+                        return;\r
+                    }\r
+                    target.setHeight( ((java.lang.Integer)value).intValue());\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _height\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            IntegerValidator typeValidator= new IntegerValidator();\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _xpos\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_xpos", "xpos", org.exolab.castor.xml.NodeType.Attribute);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Tree target = (Tree) object;\r
+                if(!target.hasXpos())\r
+                    return null;\r
+                return new java.lang.Integer(target.getXpos());\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Tree target = (Tree) object;\r
+                    // if null, use delete method for optional primitives \r
+                    if (value == null) {\r
+                        target.deleteXpos();\r
+                        return;\r
+                    }\r
+                    target.setXpos( ((java.lang.Integer)value).intValue());\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _xpos\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            IntegerValidator typeValidator= new IntegerValidator();\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _ypos\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_ypos", "ypos", org.exolab.castor.xml.NodeType.Attribute);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Tree target = (Tree) object;\r
+                if(!target.hasYpos())\r
+                    return null;\r
+                return new java.lang.Integer(target.getYpos());\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Tree target = (Tree) object;\r
+                    // if null, use delete method for optional primitives \r
+                    if (value == null) {\r
+                        target.deleteYpos();\r
+                        return;\r
+                    }\r
+                    target.setYpos( ((java.lang.Integer)value).intValue());\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _ypos\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            IntegerValidator typeValidator= new IntegerValidator();\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _fontName\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_fontName", "fontName", org.exolab.castor.xml.NodeType.Attribute);\r
+        desc.setImmutable(true);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Tree target = (Tree) object;\r
+                return target.getFontName();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Tree target = (Tree) object;\r
+                    target.setFontName( (java.lang.String) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _fontName\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            StringValidator typeValidator = new StringValidator();\r
+            typeValidator.setWhiteSpace("preserve");\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _fontSize\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_fontSize", "fontSize", org.exolab.castor.xml.NodeType.Attribute);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Tree target = (Tree) object;\r
+                if(!target.hasFontSize())\r
+                    return null;\r
+                return new java.lang.Integer(target.getFontSize());\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Tree target = (Tree) object;\r
+                    // if null, use delete method for optional primitives \r
+                    if (value == null) {\r
+                        target.deleteFontSize();\r
+                        return;\r
+                    }\r
+                    target.setFontSize( ((java.lang.Integer)value).intValue());\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _fontSize\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            IntegerValidator typeValidator= new IntegerValidator();\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _fontStyle\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_fontStyle", "fontStyle", org.exolab.castor.xml.NodeType.Attribute);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Tree target = (Tree) object;\r
+                if(!target.hasFontStyle())\r
+                    return null;\r
+                return new java.lang.Integer(target.getFontStyle());\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Tree target = (Tree) object;\r
+                    // if null, use delete method for optional primitives \r
+                    if (value == null) {\r
+                        target.deleteFontStyle();\r
+                        return;\r
+                    }\r
+                    target.setFontStyle( ((java.lang.Integer)value).intValue());\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _fontStyle\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            IntegerValidator typeValidator= new IntegerValidator();\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _threshold\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(float.class, "_threshold", "threshold", org.exolab.castor.xml.NodeType.Attribute);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Tree target = (Tree) object;\r
+                if(!target.hasThreshold())\r
+                    return null;\r
+                return new java.lang.Float(target.getThreshold());\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Tree target = (Tree) object;\r
+                    // if null, use delete method for optional primitives \r
+                    if (value == null) {\r
+                        target.deleteThreshold();\r
+                        return;\r
+                    }\r
+                    target.setThreshold( ((java.lang.Float)value).floatValue());\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _threshold\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            FloatValidator typeValidator = new FloatValidator();\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _showBootstrap\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_showBootstrap", "showBootstrap", org.exolab.castor.xml.NodeType.Attribute);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Tree target = (Tree) object;\r
+                if(!target.hasShowBootstrap())\r
+                    return null;\r
+                return (target.getShowBootstrap() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Tree target = (Tree) object;\r
+                    // if null, use delete method for optional primitives \r
+                    if (value == null) {\r
+                        target.deleteShowBootstrap();\r
+                        return;\r
+                    }\r
+                    target.setShowBootstrap( ((java.lang.Boolean)value).booleanValue());\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _showBootstrap\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            BooleanValidator typeValidator = new BooleanValidator();\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _showDistances\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_showDistances", "showDistances", org.exolab.castor.xml.NodeType.Attribute);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Tree target = (Tree) object;\r
+                if(!target.hasShowDistances())\r
+                    return null;\r
+                return (target.getShowDistances() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Tree target = (Tree) object;\r
+                    // if null, use delete method for optional primitives \r
+                    if (value == null) {\r
+                        target.deleteShowDistances();\r
+                        return;\r
+                    }\r
+                    target.setShowDistances( ((java.lang.Boolean)value).booleanValue());\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _showDistances\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            BooleanValidator typeValidator = new BooleanValidator();\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _markUnlinked\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_markUnlinked", "markUnlinked", org.exolab.castor.xml.NodeType.Attribute);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Tree target = (Tree) object;\r
+                if(!target.hasMarkUnlinked())\r
+                    return null;\r
+                return (target.getMarkUnlinked() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Tree target = (Tree) object;\r
+                    // if null, use delete method for optional primitives \r
+                    if (value == null) {\r
+                        target.deleteMarkUnlinked();\r
+                        return;\r
+                    }\r
+                    target.setMarkUnlinked( ((java.lang.Boolean)value).booleanValue());\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _markUnlinked\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            BooleanValidator typeValidator = new BooleanValidator();\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _fitToWindow\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_fitToWindow", "fitToWindow", org.exolab.castor.xml.NodeType.Attribute);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Tree target = (Tree) object;\r
+                if(!target.hasFitToWindow())\r
+                    return null;\r
+                return (target.getFitToWindow() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Tree target = (Tree) object;\r
+                    // if null, use delete method for optional primitives \r
+                    if (value == null) {\r
+                        target.deleteFitToWindow();\r
+                        return;\r
+                    }\r
+                    target.setFitToWindow( ((java.lang.Boolean)value).booleanValue());\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _fitToWindow\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            BooleanValidator typeValidator = new BooleanValidator();\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _currentTree\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_currentTree", "currentTree", org.exolab.castor.xml.NodeType.Attribute);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Tree target = (Tree) object;\r
+                if(!target.hasCurrentTree())\r
+                    return null;\r
+                return (target.getCurrentTree() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Tree target = (Tree) object;\r
+                    // if null, use delete method for optional primitives \r
+                    if (value == null) {\r
+                        target.deleteCurrentTree();\r
+                        return;\r
+                    }\r
+                    target.setCurrentTree( ((java.lang.Boolean)value).booleanValue());\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _currentTree\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            BooleanValidator typeValidator = new BooleanValidator();\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- initialize element descriptors\r
+        \r
+        //-- _title\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_title", "title", org.exolab.castor.xml.NodeType.Element);\r
+        desc.setImmutable(true);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Tree target = (Tree) object;\r
+                return target.getTitle();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Tree target = (Tree) object;\r
+                    target.setTitle( (java.lang.String) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        desc.setNameSpaceURI("www.jalview.org");\r
+        desc.setMultivalued(false);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _title\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            StringValidator typeValidator = new StringValidator();\r
+            typeValidator.setWhiteSpace("preserve");\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _newick\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_newick", "newick", org.exolab.castor.xml.NodeType.Element);\r
+        desc.setImmutable(true);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Tree target = (Tree) object;\r
+                return target.getNewick();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Tree target = (Tree) object;\r
+                    target.setNewick( (java.lang.String) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        desc.setNameSpaceURI("www.jalview.org");\r
+        desc.setMultivalued(false);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _newick\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            StringValidator typeValidator = new StringValidator();\r
+            typeValidator.setWhiteSpace("preserve");\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+    } //-- jalview.schemabinding.version2.TreeDescriptor()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Method getAccessMode\r
+     * \r
+     * \r
+     * \r
+     * @return AccessMode\r
+     */\r
+    public org.exolab.castor.mapping.AccessMode getAccessMode()\r
+    {\r
+        return null;\r
+    } //-- org.exolab.castor.mapping.AccessMode getAccessMode() \r
+\r
+    /**\r
+     * Method getExtends\r
+     * \r
+     * \r
+     * \r
+     * @return ClassDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.ClassDescriptor getExtends()\r
+    {\r
+        return null;\r
+    } //-- org.exolab.castor.mapping.ClassDescriptor getExtends() \r
+\r
+    /**\r
+     * Method getIdentity\r
+     * \r
+     * \r
+     * \r
+     * @return FieldDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.FieldDescriptor getIdentity()\r
+    {\r
+        return identity;\r
+    } //-- org.exolab.castor.mapping.FieldDescriptor getIdentity() \r
+\r
+    /**\r
+     * Method getJavaClass\r
+     * \r
+     * \r
+     * \r
+     * @return Class\r
+     */\r
+    public java.lang.Class getJavaClass()\r
+    {\r
+        return jalview.schemabinding.version2.Tree.class;\r
+    } //-- java.lang.Class getJavaClass() \r
+\r
+    /**\r
+     * Method getNameSpacePrefix\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpacePrefix()\r
+    {\r
+        return nsPrefix;\r
+    } //-- java.lang.String getNameSpacePrefix() \r
+\r
+    /**\r
+     * Method getNameSpaceURI\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpaceURI()\r
+    {\r
+        return nsURI;\r
+    } //-- java.lang.String getNameSpaceURI() \r
+\r
+    /**\r
+     * Method getValidator\r
+     * \r
+     * \r
+     * \r
+     * @return TypeValidator\r
+     */\r
+    public org.exolab.castor.xml.TypeValidator getValidator()\r
+    {\r
+        return this;\r
+    } //-- org.exolab.castor.xml.TypeValidator getValidator() \r
+\r
+    /**\r
+     * Method getXMLName\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getXMLName()\r
+    {\r
+        return xmlName;\r
+    } //-- java.lang.String getXMLName() \r
+\r
+}\r
diff --git a/src/jalview/schemabinding/version2/UserColourScheme.java b/src/jalview/schemabinding/version2/UserColourScheme.java
new file mode 100755 (executable)
index 0000000..00bc181
--- /dev/null
@@ -0,0 +1,118 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package jalview.schemabinding.version2;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import java.io.IOException;\r
+import java.io.Reader;\r
+import java.io.Serializable;\r
+import java.io.Writer;\r
+import org.exolab.castor.xml.MarshalException;\r
+import org.exolab.castor.xml.Marshaller;\r
+import org.exolab.castor.xml.Unmarshaller;\r
+import org.exolab.castor.xml.ValidationException;\r
+import org.xml.sax.ContentHandler;\r
+\r
+/**\r
+ * Class UserColourScheme.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class UserColourScheme extends JalviewUserColours \r
+implements java.io.Serializable\r
+{\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public UserColourScheme() {\r
+        super();\r
+    } //-- jalview.schemabinding.version2.UserColourScheme()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Method isValid\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean isValid()\r
+    {\r
+        try {\r
+            validate();\r
+        }\r
+        catch (org.exolab.castor.xml.ValidationException vex) {\r
+            return false;\r
+        }\r
+        return true;\r
+    } //-- boolean isValid() \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param out\r
+     */\r
+    public void marshal(java.io.Writer out)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, out);\r
+    } //-- void marshal(java.io.Writer) \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param handler\r
+     */\r
+    public void marshal(org.xml.sax.ContentHandler handler)\r
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, handler);\r
+    } //-- void marshal(org.xml.sax.ContentHandler) \r
+\r
+    /**\r
+     * Method unmarshal\r
+     * \r
+     * \r
+     * \r
+     * @param reader\r
+     * @return Object\r
+     */\r
+    public static java.lang.Object unmarshal(java.io.Reader reader)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        return (jalview.schemabinding.version2.UserColourScheme) Unmarshaller.unmarshal(jalview.schemabinding.version2.UserColourScheme.class, reader);\r
+    } //-- java.lang.Object unmarshal(java.io.Reader) \r
+\r
+    /**\r
+     * Method validate\r
+     * \r
+     */\r
+    public void validate()\r
+        throws org.exolab.castor.xml.ValidationException\r
+    {\r
+        org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
+        validator.validate(this);\r
+    } //-- void validate() \r
+\r
+}\r
diff --git a/src/jalview/schemabinding/version2/UserColourSchemeDescriptor.java b/src/jalview/schemabinding/version2/UserColourSchemeDescriptor.java
new file mode 100755 (executable)
index 0000000..cf86a11
--- /dev/null
@@ -0,0 +1,166 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package jalview.schemabinding.version2;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import org.exolab.castor.mapping.AccessMode;\r
+import org.exolab.castor.xml.TypeValidator;\r
+import org.exolab.castor.xml.XMLFieldDescriptor;\r
+import org.exolab.castor.xml.validators.*;\r
+\r
+/**\r
+ * Class UserColourSchemeDescriptor.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class UserColourSchemeDescriptor extends JalviewUserColoursDescriptor {\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * Field nsPrefix\r
+     */\r
+    private java.lang.String nsPrefix;\r
+\r
+    /**\r
+     * Field nsURI\r
+     */\r
+    private java.lang.String nsURI;\r
+\r
+    /**\r
+     * Field xmlName\r
+     */\r
+    private java.lang.String xmlName;\r
+\r
+    /**\r
+     * Field identity\r
+     */\r
+    private org.exolab.castor.xml.XMLFieldDescriptor identity;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public UserColourSchemeDescriptor() {\r
+        super();\r
+        setExtendsWithoutFlatten(new JalviewUserColoursDescriptor());\r
+        nsURI = "www.jalview.org";\r
+        xmlName = "UserColourScheme";\r
+    } //-- jalview.schemabinding.version2.UserColourSchemeDescriptor()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Method getAccessMode\r
+     * \r
+     * \r
+     * \r
+     * @return AccessMode\r
+     */\r
+    public org.exolab.castor.mapping.AccessMode getAccessMode()\r
+    {\r
+        return null;\r
+    } //-- org.exolab.castor.mapping.AccessMode getAccessMode() \r
+\r
+    /**\r
+     * Method getExtends\r
+     * \r
+     * \r
+     * \r
+     * @return ClassDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.ClassDescriptor getExtends()\r
+    {\r
+        return super.getExtends();\r
+    } //-- org.exolab.castor.mapping.ClassDescriptor getExtends() \r
+\r
+    /**\r
+     * Method getIdentity\r
+     * \r
+     * \r
+     * \r
+     * @return FieldDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.FieldDescriptor getIdentity()\r
+    {\r
+        if (identity == null)\r
+            return super.getIdentity();\r
+        return identity;\r
+    } //-- org.exolab.castor.mapping.FieldDescriptor getIdentity() \r
+\r
+    /**\r
+     * Method getJavaClass\r
+     * \r
+     * \r
+     * \r
+     * @return Class\r
+     */\r
+    public java.lang.Class getJavaClass()\r
+    {\r
+        return jalview.schemabinding.version2.UserColourScheme.class;\r
+    } //-- java.lang.Class getJavaClass() \r
+\r
+    /**\r
+     * Method getNameSpacePrefix\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpacePrefix()\r
+    {\r
+        return nsPrefix;\r
+    } //-- java.lang.String getNameSpacePrefix() \r
+\r
+    /**\r
+     * Method getNameSpaceURI\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpaceURI()\r
+    {\r
+        return nsURI;\r
+    } //-- java.lang.String getNameSpaceURI() \r
+\r
+    /**\r
+     * Method getValidator\r
+     * \r
+     * \r
+     * \r
+     * @return TypeValidator\r
+     */\r
+    public org.exolab.castor.xml.TypeValidator getValidator()\r
+    {\r
+        return this;\r
+    } //-- org.exolab.castor.xml.TypeValidator getValidator() \r
+\r
+    /**\r
+     * Method getXMLName\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getXMLName()\r
+    {\r
+        return xmlName;\r
+    } //-- java.lang.String getXMLName() \r
+\r
+}\r
diff --git a/src/jalview/schemabinding/version2/UserColours.java b/src/jalview/schemabinding/version2/UserColours.java
new file mode 100755 (executable)
index 0000000..28f2b39
--- /dev/null
@@ -0,0 +1,173 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package jalview.schemabinding.version2;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import java.io.IOException;\r
+import java.io.Reader;\r
+import java.io.Serializable;\r
+import java.io.Writer;\r
+import org.exolab.castor.xml.MarshalException;\r
+import org.exolab.castor.xml.Marshaller;\r
+import org.exolab.castor.xml.Unmarshaller;\r
+import org.exolab.castor.xml.ValidationException;\r
+import org.xml.sax.ContentHandler;\r
+\r
+/**\r
+ * Class UserColours.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class UserColours implements java.io.Serializable {\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * Field _id\r
+     */\r
+    private java.lang.String _id;\r
+\r
+    /**\r
+     * Field _userColourScheme\r
+     */\r
+    private jalview.schemabinding.version2.UserColourScheme _userColourScheme;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public UserColours() {\r
+        super();\r
+    } //-- jalview.schemabinding.version2.UserColours()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Returns the value of field 'id'.\r
+     * \r
+     * @return String\r
+     * @return the value of field 'id'.\r
+     */\r
+    public java.lang.String getId()\r
+    {\r
+        return this._id;\r
+    } //-- java.lang.String getId() \r
+\r
+    /**\r
+     * Returns the value of field 'userColourScheme'.\r
+     * \r
+     * @return UserColourScheme\r
+     * @return the value of field 'userColourScheme'.\r
+     */\r
+    public jalview.schemabinding.version2.UserColourScheme getUserColourScheme()\r
+    {\r
+        return this._userColourScheme;\r
+    } //-- jalview.schemabinding.version2.UserColourScheme getUserColourScheme() \r
+\r
+    /**\r
+     * Method isValid\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean isValid()\r
+    {\r
+        try {\r
+            validate();\r
+        }\r
+        catch (org.exolab.castor.xml.ValidationException vex) {\r
+            return false;\r
+        }\r
+        return true;\r
+    } //-- boolean isValid() \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param out\r
+     */\r
+    public void marshal(java.io.Writer out)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, out);\r
+    } //-- void marshal(java.io.Writer) \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param handler\r
+     */\r
+    public void marshal(org.xml.sax.ContentHandler handler)\r
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, handler);\r
+    } //-- void marshal(org.xml.sax.ContentHandler) \r
+\r
+    /**\r
+     * Sets the value of field 'id'.\r
+     * \r
+     * @param id the value of field 'id'.\r
+     */\r
+    public void setId(java.lang.String id)\r
+    {\r
+        this._id = id;\r
+    } //-- void setId(java.lang.String) \r
+\r
+    /**\r
+     * Sets the value of field 'userColourScheme'.\r
+     * \r
+     * @param userColourScheme the value of field 'userColourScheme'\r
+     */\r
+    public void setUserColourScheme(jalview.schemabinding.version2.UserColourScheme userColourScheme)\r
+    {\r
+        this._userColourScheme = userColourScheme;\r
+    } //-- void setUserColourScheme(jalview.schemabinding.version2.UserColourScheme) \r
+\r
+    /**\r
+     * Method unmarshal\r
+     * \r
+     * \r
+     * \r
+     * @param reader\r
+     * @return Object\r
+     */\r
+    public static java.lang.Object unmarshal(java.io.Reader reader)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        return (jalview.schemabinding.version2.UserColours) Unmarshaller.unmarshal(jalview.schemabinding.version2.UserColours.class, reader);\r
+    } //-- java.lang.Object unmarshal(java.io.Reader) \r
+\r
+    /**\r
+     * Method validate\r
+     * \r
+     */\r
+    public void validate()\r
+        throws org.exolab.castor.xml.ValidationException\r
+    {\r
+        org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
+        validator.validate(this);\r
+    } //-- void validate() \r
+\r
+}\r
diff --git a/src/jalview/schemabinding/version2/UserColoursDescriptor.java b/src/jalview/schemabinding/version2/UserColoursDescriptor.java
new file mode 100755 (executable)
index 0000000..6c42d0b
--- /dev/null
@@ -0,0 +1,245 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package jalview.schemabinding.version2;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import org.exolab.castor.mapping.AccessMode;\r
+import org.exolab.castor.xml.TypeValidator;\r
+import org.exolab.castor.xml.XMLFieldDescriptor;\r
+import org.exolab.castor.xml.validators.*;\r
+\r
+/**\r
+ * Class UserColoursDescriptor.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class UserColoursDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * Field nsPrefix\r
+     */\r
+    private java.lang.String nsPrefix;\r
+\r
+    /**\r
+     * Field nsURI\r
+     */\r
+    private java.lang.String nsURI;\r
+\r
+    /**\r
+     * Field xmlName\r
+     */\r
+    private java.lang.String xmlName;\r
+\r
+    /**\r
+     * Field identity\r
+     */\r
+    private org.exolab.castor.xml.XMLFieldDescriptor identity;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public UserColoursDescriptor() {\r
+        super();\r
+        nsURI = "www.jalview.org";\r
+        xmlName = "UserColours";\r
+        \r
+        //-- set grouping compositor\r
+        setCompositorAsSequence();\r
+        org.exolab.castor.xml.util.XMLFieldDescriptorImpl  desc           = null;\r
+        org.exolab.castor.xml.XMLFieldHandler              handler        = null;\r
+        org.exolab.castor.xml.FieldValidator               fieldValidator = null;\r
+        //-- initialize attribute descriptors\r
+        \r
+        //-- _id\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_id", "id", org.exolab.castor.xml.NodeType.Attribute);\r
+        desc.setImmutable(true);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                UserColours target = (UserColours) object;\r
+                return target.getId();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    UserColours target = (UserColours) object;\r
+                    target.setId( (java.lang.String) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _id\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            StringValidator typeValidator = new StringValidator();\r
+            typeValidator.setWhiteSpace("preserve");\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- initialize element descriptors\r
+        \r
+        //-- _userColourScheme\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(jalview.schemabinding.version2.UserColourScheme.class, "_userColourScheme", "UserColourScheme", org.exolab.castor.xml.NodeType.Element);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                UserColours target = (UserColours) object;\r
+                return target.getUserColourScheme();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    UserColours target = (UserColours) object;\r
+                    target.setUserColourScheme( (jalview.schemabinding.version2.UserColourScheme) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return new jalview.schemabinding.version2.UserColourScheme();\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        desc.setNameSpaceURI("www.jalview.org");\r
+        desc.setRequired(true);\r
+        desc.setMultivalued(false);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _userColourScheme\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        fieldValidator.setMinOccurs(1);\r
+        { //-- local scope\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+    } //-- jalview.schemabinding.version2.UserColoursDescriptor()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Method getAccessMode\r
+     * \r
+     * \r
+     * \r
+     * @return AccessMode\r
+     */\r
+    public org.exolab.castor.mapping.AccessMode getAccessMode()\r
+    {\r
+        return null;\r
+    } //-- org.exolab.castor.mapping.AccessMode getAccessMode() \r
+\r
+    /**\r
+     * Method getExtends\r
+     * \r
+     * \r
+     * \r
+     * @return ClassDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.ClassDescriptor getExtends()\r
+    {\r
+        return null;\r
+    } //-- org.exolab.castor.mapping.ClassDescriptor getExtends() \r
+\r
+    /**\r
+     * Method getIdentity\r
+     * \r
+     * \r
+     * \r
+     * @return FieldDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.FieldDescriptor getIdentity()\r
+    {\r
+        return identity;\r
+    } //-- org.exolab.castor.mapping.FieldDescriptor getIdentity() \r
+\r
+    /**\r
+     * Method getJavaClass\r
+     * \r
+     * \r
+     * \r
+     * @return Class\r
+     */\r
+    public java.lang.Class getJavaClass()\r
+    {\r
+        return jalview.schemabinding.version2.UserColours.class;\r
+    } //-- java.lang.Class getJavaClass() \r
+\r
+    /**\r
+     * Method getNameSpacePrefix\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpacePrefix()\r
+    {\r
+        return nsPrefix;\r
+    } //-- java.lang.String getNameSpacePrefix() \r
+\r
+    /**\r
+     * Method getNameSpaceURI\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpaceURI()\r
+    {\r
+        return nsURI;\r
+    } //-- java.lang.String getNameSpaceURI() \r
+\r
+    /**\r
+     * Method getValidator\r
+     * \r
+     * \r
+     * \r
+     * @return TypeValidator\r
+     */\r
+    public org.exolab.castor.xml.TypeValidator getValidator()\r
+    {\r
+        return this;\r
+    } //-- org.exolab.castor.xml.TypeValidator getValidator() \r
+\r
+    /**\r
+     * Method getXMLName\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getXMLName()\r
+    {\r
+        return xmlName;\r
+    } //-- java.lang.String getXMLName() \r
+\r
+}\r
diff --git a/src/jalview/schemabinding/version2/VAMSAS.java b/src/jalview/schemabinding/version2/VAMSAS.java
new file mode 100755 (executable)
index 0000000..9550690
--- /dev/null
@@ -0,0 +1,576 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package jalview.schemabinding.version2;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import java.io.IOException;\r
+import java.io.Reader;\r
+import java.io.Serializable;\r
+import java.io.Writer;\r
+import java.util.Enumeration;\r
+import java.util.Vector;\r
+import org.exolab.castor.xml.MarshalException;\r
+import org.exolab.castor.xml.Marshaller;\r
+import org.exolab.castor.xml.Unmarshaller;\r
+import org.exolab.castor.xml.ValidationException;\r
+import org.xml.sax.ContentHandler;\r
+\r
+/**\r
+ * Class VAMSAS.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class VAMSAS implements java.io.Serializable {\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * Field _alignmentList\r
+     */\r
+    private java.util.Vector _alignmentList;\r
+\r
+    /**\r
+     * Field _treeList\r
+     */\r
+    private java.util.Vector _treeList;\r
+\r
+    /**\r
+     * Field _sequenceSetList\r
+     */\r
+    private java.util.Vector _sequenceSetList;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public VAMSAS() {\r
+        super();\r
+        _alignmentList = new Vector();\r
+        _treeList = new Vector();\r
+        _sequenceSetList = new Vector();\r
+    } //-- jalview.schemabinding.version2.VAMSAS()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Method addAlignment\r
+     * \r
+     * \r
+     * \r
+     * @param vAlignment\r
+     */\r
+    public void addAlignment(jalview.schemabinding.version2.Alignment vAlignment)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        _alignmentList.addElement(vAlignment);\r
+    } //-- void addAlignment(jalview.schemabinding.version2.Alignment) \r
+\r
+    /**\r
+     * Method addAlignment\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @param vAlignment\r
+     */\r
+    public void addAlignment(int index, jalview.schemabinding.version2.Alignment vAlignment)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        _alignmentList.insertElementAt(vAlignment, index);\r
+    } //-- void addAlignment(int, jalview.schemabinding.version2.Alignment) \r
+\r
+    /**\r
+     * Method addSequenceSet\r
+     * \r
+     * \r
+     * \r
+     * @param vSequenceSet\r
+     */\r
+    public void addSequenceSet(jalview.schemabinding.version2.SequenceSet vSequenceSet)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        _sequenceSetList.addElement(vSequenceSet);\r
+    } //-- void addSequenceSet(jalview.schemabinding.version2.SequenceSet) \r
+\r
+    /**\r
+     * Method addSequenceSet\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @param vSequenceSet\r
+     */\r
+    public void addSequenceSet(int index, jalview.schemabinding.version2.SequenceSet vSequenceSet)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        _sequenceSetList.insertElementAt(vSequenceSet, index);\r
+    } //-- void addSequenceSet(int, jalview.schemabinding.version2.SequenceSet) \r
+\r
+    /**\r
+     * Method addTree\r
+     * \r
+     * \r
+     * \r
+     * @param vTree\r
+     */\r
+    public void addTree(java.lang.String vTree)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        _treeList.addElement(vTree);\r
+    } //-- void addTree(java.lang.String) \r
+\r
+    /**\r
+     * Method addTree\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @param vTree\r
+     */\r
+    public void addTree(int index, java.lang.String vTree)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        _treeList.insertElementAt(vTree, index);\r
+    } //-- void addTree(int, java.lang.String) \r
+\r
+    /**\r
+     * Method enumerateAlignment\r
+     * \r
+     * \r
+     * \r
+     * @return Enumeration\r
+     */\r
+    public java.util.Enumeration enumerateAlignment()\r
+    {\r
+        return _alignmentList.elements();\r
+    } //-- java.util.Enumeration enumerateAlignment() \r
+\r
+    /**\r
+     * Method enumerateSequenceSet\r
+     * \r
+     * \r
+     * \r
+     * @return Enumeration\r
+     */\r
+    public java.util.Enumeration enumerateSequenceSet()\r
+    {\r
+        return _sequenceSetList.elements();\r
+    } //-- java.util.Enumeration enumerateSequenceSet() \r
+\r
+    /**\r
+     * Method enumerateTree\r
+     * \r
+     * \r
+     * \r
+     * @return Enumeration\r
+     */\r
+    public java.util.Enumeration enumerateTree()\r
+    {\r
+        return _treeList.elements();\r
+    } //-- java.util.Enumeration enumerateTree() \r
+\r
+    /**\r
+     * Method getAlignment\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @return Alignment\r
+     */\r
+    public jalview.schemabinding.version2.Alignment getAlignment(int index)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        //-- check bounds for index\r
+        if ((index < 0) || (index > _alignmentList.size())) {\r
+            throw new IndexOutOfBoundsException();\r
+        }\r
+        \r
+        return (jalview.schemabinding.version2.Alignment) _alignmentList.elementAt(index);\r
+    } //-- jalview.schemabinding.version2.Alignment getAlignment(int) \r
+\r
+    /**\r
+     * Method getAlignment\r
+     * \r
+     * \r
+     * \r
+     * @return Alignment\r
+     */\r
+    public jalview.schemabinding.version2.Alignment[] getAlignment()\r
+    {\r
+        int size = _alignmentList.size();\r
+        jalview.schemabinding.version2.Alignment[] mArray = new jalview.schemabinding.version2.Alignment[size];\r
+        for (int index = 0; index < size; index++) {\r
+            mArray[index] = (jalview.schemabinding.version2.Alignment) _alignmentList.elementAt(index);\r
+        }\r
+        return mArray;\r
+    } //-- jalview.schemabinding.version2.Alignment[] getAlignment() \r
+\r
+    /**\r
+     * Method getAlignmentCount\r
+     * \r
+     * \r
+     * \r
+     * @return int\r
+     */\r
+    public int getAlignmentCount()\r
+    {\r
+        return _alignmentList.size();\r
+    } //-- int getAlignmentCount() \r
+\r
+    /**\r
+     * Method getSequenceSet\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @return SequenceSet\r
+     */\r
+    public jalview.schemabinding.version2.SequenceSet getSequenceSet(int index)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        //-- check bounds for index\r
+        if ((index < 0) || (index > _sequenceSetList.size())) {\r
+            throw new IndexOutOfBoundsException();\r
+        }\r
+        \r
+        return (jalview.schemabinding.version2.SequenceSet) _sequenceSetList.elementAt(index);\r
+    } //-- jalview.schemabinding.version2.SequenceSet getSequenceSet(int) \r
+\r
+    /**\r
+     * Method getSequenceSet\r
+     * \r
+     * \r
+     * \r
+     * @return SequenceSet\r
+     */\r
+    public jalview.schemabinding.version2.SequenceSet[] getSequenceSet()\r
+    {\r
+        int size = _sequenceSetList.size();\r
+        jalview.schemabinding.version2.SequenceSet[] mArray = new jalview.schemabinding.version2.SequenceSet[size];\r
+        for (int index = 0; index < size; index++) {\r
+            mArray[index] = (jalview.schemabinding.version2.SequenceSet) _sequenceSetList.elementAt(index);\r
+        }\r
+        return mArray;\r
+    } //-- jalview.schemabinding.version2.SequenceSet[] getSequenceSet() \r
+\r
+    /**\r
+     * Method getSequenceSetCount\r
+     * \r
+     * \r
+     * \r
+     * @return int\r
+     */\r
+    public int getSequenceSetCount()\r
+    {\r
+        return _sequenceSetList.size();\r
+    } //-- int getSequenceSetCount() \r
+\r
+    /**\r
+     * Method getTree\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @return String\r
+     */\r
+    public java.lang.String getTree(int index)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        //-- check bounds for index\r
+        if ((index < 0) || (index > _treeList.size())) {\r
+            throw new IndexOutOfBoundsException();\r
+        }\r
+        \r
+        return (String)_treeList.elementAt(index);\r
+    } //-- java.lang.String getTree(int) \r
+\r
+    /**\r
+     * Method getTree\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String[] getTree()\r
+    {\r
+        int size = _treeList.size();\r
+        java.lang.String[] mArray = new java.lang.String[size];\r
+        for (int index = 0; index < size; index++) {\r
+            mArray[index] = (String)_treeList.elementAt(index);\r
+        }\r
+        return mArray;\r
+    } //-- java.lang.String[] getTree() \r
+\r
+    /**\r
+     * Method getTreeCount\r
+     * \r
+     * \r
+     * \r
+     * @return int\r
+     */\r
+    public int getTreeCount()\r
+    {\r
+        return _treeList.size();\r
+    } //-- int getTreeCount() \r
+\r
+    /**\r
+     * Method isValid\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean isValid()\r
+    {\r
+        try {\r
+            validate();\r
+        }\r
+        catch (org.exolab.castor.xml.ValidationException vex) {\r
+            return false;\r
+        }\r
+        return true;\r
+    } //-- boolean isValid() \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param out\r
+     */\r
+    public void marshal(java.io.Writer out)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, out);\r
+    } //-- void marshal(java.io.Writer) \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param handler\r
+     */\r
+    public void marshal(org.xml.sax.ContentHandler handler)\r
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, handler);\r
+    } //-- void marshal(org.xml.sax.ContentHandler) \r
+\r
+    /**\r
+     * Method removeAlignment\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @return Alignment\r
+     */\r
+    public jalview.schemabinding.version2.Alignment removeAlignment(int index)\r
+    {\r
+        java.lang.Object obj = _alignmentList.elementAt(index);\r
+        _alignmentList.removeElementAt(index);\r
+        return (jalview.schemabinding.version2.Alignment) obj;\r
+    } //-- jalview.schemabinding.version2.Alignment removeAlignment(int) \r
+\r
+    /**\r
+     * Method removeAllAlignment\r
+     * \r
+     */\r
+    public void removeAllAlignment()\r
+    {\r
+        _alignmentList.removeAllElements();\r
+    } //-- void removeAllAlignment() \r
+\r
+    /**\r
+     * Method removeAllSequenceSet\r
+     * \r
+     */\r
+    public void removeAllSequenceSet()\r
+    {\r
+        _sequenceSetList.removeAllElements();\r
+    } //-- void removeAllSequenceSet() \r
+\r
+    /**\r
+     * Method removeAllTree\r
+     * \r
+     */\r
+    public void removeAllTree()\r
+    {\r
+        _treeList.removeAllElements();\r
+    } //-- void removeAllTree() \r
+\r
+    /**\r
+     * Method removeSequenceSet\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @return SequenceSet\r
+     */\r
+    public jalview.schemabinding.version2.SequenceSet removeSequenceSet(int index)\r
+    {\r
+        java.lang.Object obj = _sequenceSetList.elementAt(index);\r
+        _sequenceSetList.removeElementAt(index);\r
+        return (jalview.schemabinding.version2.SequenceSet) obj;\r
+    } //-- jalview.schemabinding.version2.SequenceSet removeSequenceSet(int) \r
+\r
+    /**\r
+     * Method removeTree\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @return String\r
+     */\r
+    public java.lang.String removeTree(int index)\r
+    {\r
+        java.lang.Object obj = _treeList.elementAt(index);\r
+        _treeList.removeElementAt(index);\r
+        return (String)obj;\r
+    } //-- java.lang.String removeTree(int) \r
+\r
+    /**\r
+     * Method setAlignment\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @param vAlignment\r
+     */\r
+    public void setAlignment(int index, jalview.schemabinding.version2.Alignment vAlignment)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        //-- check bounds for index\r
+        if ((index < 0) || (index > _alignmentList.size())) {\r
+            throw new IndexOutOfBoundsException();\r
+        }\r
+        _alignmentList.setElementAt(vAlignment, index);\r
+    } //-- void setAlignment(int, jalview.schemabinding.version2.Alignment) \r
+\r
+    /**\r
+     * Method setAlignment\r
+     * \r
+     * \r
+     * \r
+     * @param alignmentArray\r
+     */\r
+    public void setAlignment(jalview.schemabinding.version2.Alignment[] alignmentArray)\r
+    {\r
+        //-- copy array\r
+        _alignmentList.removeAllElements();\r
+        for (int i = 0; i < alignmentArray.length; i++) {\r
+            _alignmentList.addElement(alignmentArray[i]);\r
+        }\r
+    } //-- void setAlignment(jalview.schemabinding.version2.Alignment) \r
+\r
+    /**\r
+     * Method setSequenceSet\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @param vSequenceSet\r
+     */\r
+    public void setSequenceSet(int index, jalview.schemabinding.version2.SequenceSet vSequenceSet)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        //-- check bounds for index\r
+        if ((index < 0) || (index > _sequenceSetList.size())) {\r
+            throw new IndexOutOfBoundsException();\r
+        }\r
+        _sequenceSetList.setElementAt(vSequenceSet, index);\r
+    } //-- void setSequenceSet(int, jalview.schemabinding.version2.SequenceSet) \r
+\r
+    /**\r
+     * Method setSequenceSet\r
+     * \r
+     * \r
+     * \r
+     * @param sequenceSetArray\r
+     */\r
+    public void setSequenceSet(jalview.schemabinding.version2.SequenceSet[] sequenceSetArray)\r
+    {\r
+        //-- copy array\r
+        _sequenceSetList.removeAllElements();\r
+        for (int i = 0; i < sequenceSetArray.length; i++) {\r
+            _sequenceSetList.addElement(sequenceSetArray[i]);\r
+        }\r
+    } //-- void setSequenceSet(jalview.schemabinding.version2.SequenceSet) \r
+\r
+    /**\r
+     * Method setTree\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @param vTree\r
+     */\r
+    public void setTree(int index, java.lang.String vTree)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        //-- check bounds for index\r
+        if ((index < 0) || (index > _treeList.size())) {\r
+            throw new IndexOutOfBoundsException();\r
+        }\r
+        _treeList.setElementAt(vTree, index);\r
+    } //-- void setTree(int, java.lang.String) \r
+\r
+    /**\r
+     * Method setTree\r
+     * \r
+     * \r
+     * \r
+     * @param treeArray\r
+     */\r
+    public void setTree(java.lang.String[] treeArray)\r
+    {\r
+        //-- copy array\r
+        _treeList.removeAllElements();\r
+        for (int i = 0; i < treeArray.length; i++) {\r
+            _treeList.addElement(treeArray[i]);\r
+        }\r
+    } //-- void setTree(java.lang.String) \r
+\r
+    /**\r
+     * Method unmarshal\r
+     * \r
+     * \r
+     * \r
+     * @param reader\r
+     * @return Object\r
+     */\r
+    public static java.lang.Object unmarshal(java.io.Reader reader)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        return (jalview.schemabinding.version2.VAMSAS) Unmarshaller.unmarshal(jalview.schemabinding.version2.VAMSAS.class, reader);\r
+    } //-- java.lang.Object unmarshal(java.io.Reader) \r
+\r
+    /**\r
+     * Method validate\r
+     * \r
+     */\r
+    public void validate()\r
+        throws org.exolab.castor.xml.ValidationException\r
+    {\r
+        org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
+        validator.validate(this);\r
+    } //-- void validate() \r
+\r
+}\r
diff --git a/src/jalview/schemabinding/version2/VAMSASDescriptor.java b/src/jalview/schemabinding/version2/VAMSASDescriptor.java
new file mode 100755 (executable)
index 0000000..02140e0
--- /dev/null
@@ -0,0 +1,282 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package jalview.schemabinding.version2;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import org.exolab.castor.mapping.AccessMode;\r
+import org.exolab.castor.xml.TypeValidator;\r
+import org.exolab.castor.xml.XMLFieldDescriptor;\r
+import org.exolab.castor.xml.validators.*;\r
+\r
+/**\r
+ * Class VAMSASDescriptor.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class VAMSASDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * Field nsPrefix\r
+     */\r
+    private java.lang.String nsPrefix;\r
+\r
+    /**\r
+     * Field nsURI\r
+     */\r
+    private java.lang.String nsURI;\r
+\r
+    /**\r
+     * Field xmlName\r
+     */\r
+    private java.lang.String xmlName;\r
+\r
+    /**\r
+     * Field identity\r
+     */\r
+    private org.exolab.castor.xml.XMLFieldDescriptor identity;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public VAMSASDescriptor() {\r
+        super();\r
+        nsURI = "www.vamsas.ac.uk/jalview/version2";\r
+        xmlName = "VAMSAS";\r
+        \r
+        //-- set grouping compositor\r
+        setCompositorAsSequence();\r
+        org.exolab.castor.xml.util.XMLFieldDescriptorImpl  desc           = null;\r
+        org.exolab.castor.xml.XMLFieldHandler              handler        = null;\r
+        org.exolab.castor.xml.FieldValidator               fieldValidator = null;\r
+        //-- initialize attribute descriptors\r
+        \r
+        //-- initialize element descriptors\r
+        \r
+        //-- _alignmentList\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(jalview.schemabinding.version2.Alignment.class, "_alignmentList", "Alignment", org.exolab.castor.xml.NodeType.Element);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                VAMSAS target = (VAMSAS) object;\r
+                return target.getAlignment();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    VAMSAS target = (VAMSAS) object;\r
+                    target.addAlignment( (jalview.schemabinding.version2.Alignment) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return new jalview.schemabinding.version2.Alignment();\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");\r
+        desc.setMultivalued(true);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _alignmentList\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        fieldValidator.setMinOccurs(0);\r
+        { //-- local scope\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _treeList\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_treeList", "Tree", org.exolab.castor.xml.NodeType.Element);\r
+        desc.setImmutable(true);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                VAMSAS target = (VAMSAS) object;\r
+                return target.getTree();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    VAMSAS target = (VAMSAS) object;\r
+                    target.addTree( (java.lang.String) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");\r
+        desc.setMultivalued(true);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _treeList\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        fieldValidator.setMinOccurs(0);\r
+        { //-- local scope\r
+            StringValidator typeValidator = new StringValidator();\r
+            typeValidator.setWhiteSpace("preserve");\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _sequenceSetList\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(jalview.schemabinding.version2.SequenceSet.class, "_sequenceSetList", "SequenceSet", org.exolab.castor.xml.NodeType.Element);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                VAMSAS target = (VAMSAS) object;\r
+                return target.getSequenceSet();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    VAMSAS target = (VAMSAS) object;\r
+                    target.addSequenceSet( (jalview.schemabinding.version2.SequenceSet) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return new jalview.schemabinding.version2.SequenceSet();\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        desc.setNameSpaceURI("www.vamsas.ac.uk/jalview/version2");\r
+        desc.setMultivalued(true);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _sequenceSetList\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        fieldValidator.setMinOccurs(0);\r
+        { //-- local scope\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+    } //-- jalview.schemabinding.version2.VAMSASDescriptor()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Method getAccessMode\r
+     * \r
+     * \r
+     * \r
+     * @return AccessMode\r
+     */\r
+    public org.exolab.castor.mapping.AccessMode getAccessMode()\r
+    {\r
+        return null;\r
+    } //-- org.exolab.castor.mapping.AccessMode getAccessMode() \r
+\r
+    /**\r
+     * Method getExtends\r
+     * \r
+     * \r
+     * \r
+     * @return ClassDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.ClassDescriptor getExtends()\r
+    {\r
+        return null;\r
+    } //-- org.exolab.castor.mapping.ClassDescriptor getExtends() \r
+\r
+    /**\r
+     * Method getIdentity\r
+     * \r
+     * \r
+     * \r
+     * @return FieldDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.FieldDescriptor getIdentity()\r
+    {\r
+        return identity;\r
+    } //-- org.exolab.castor.mapping.FieldDescriptor getIdentity() \r
+\r
+    /**\r
+     * Method getJavaClass\r
+     * \r
+     * \r
+     * \r
+     * @return Class\r
+     */\r
+    public java.lang.Class getJavaClass()\r
+    {\r
+        return jalview.schemabinding.version2.VAMSAS.class;\r
+    } //-- java.lang.Class getJavaClass() \r
+\r
+    /**\r
+     * Method getNameSpacePrefix\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpacePrefix()\r
+    {\r
+        return nsPrefix;\r
+    } //-- java.lang.String getNameSpacePrefix() \r
+\r
+    /**\r
+     * Method getNameSpaceURI\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpaceURI()\r
+    {\r
+        return nsURI;\r
+    } //-- java.lang.String getNameSpaceURI() \r
+\r
+    /**\r
+     * Method getValidator\r
+     * \r
+     * \r
+     * \r
+     * @return TypeValidator\r
+     */\r
+    public org.exolab.castor.xml.TypeValidator getValidator()\r
+    {\r
+        return this;\r
+    } //-- org.exolab.castor.xml.TypeValidator getValidator() \r
+\r
+    /**\r
+     * Method getXMLName\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getXMLName()\r
+    {\r
+        return xmlName;\r
+    } //-- java.lang.String getXMLName() \r
+\r
+}\r
diff --git a/src/jalview/schemabinding/version2/VamsasModel.java b/src/jalview/schemabinding/version2/VamsasModel.java
new file mode 100755 (executable)
index 0000000..4617903
--- /dev/null
@@ -0,0 +1,118 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package jalview.schemabinding.version2;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import java.io.IOException;\r
+import java.io.Reader;\r
+import java.io.Serializable;\r
+import java.io.Writer;\r
+import org.exolab.castor.xml.MarshalException;\r
+import org.exolab.castor.xml.Marshaller;\r
+import org.exolab.castor.xml.Unmarshaller;\r
+import org.exolab.castor.xml.ValidationException;\r
+import org.xml.sax.ContentHandler;\r
+\r
+/**\r
+ * Class VamsasModel.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class VamsasModel extends VAMSAS \r
+implements java.io.Serializable\r
+{\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public VamsasModel() {\r
+        super();\r
+    } //-- jalview.schemabinding.version2.VamsasModel()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Method isValid\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean isValid()\r
+    {\r
+        try {\r
+            validate();\r
+        }\r
+        catch (org.exolab.castor.xml.ValidationException vex) {\r
+            return false;\r
+        }\r
+        return true;\r
+    } //-- boolean isValid() \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param out\r
+     */\r
+    public void marshal(java.io.Writer out)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, out);\r
+    } //-- void marshal(java.io.Writer) \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param handler\r
+     */\r
+    public void marshal(org.xml.sax.ContentHandler handler)\r
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, handler);\r
+    } //-- void marshal(org.xml.sax.ContentHandler) \r
+\r
+    /**\r
+     * Method unmarshal\r
+     * \r
+     * \r
+     * \r
+     * @param reader\r
+     * @return Object\r
+     */\r
+    public static java.lang.Object unmarshal(java.io.Reader reader)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        return (jalview.schemabinding.version2.VamsasModel) Unmarshaller.unmarshal(jalview.schemabinding.version2.VamsasModel.class, reader);\r
+    } //-- java.lang.Object unmarshal(java.io.Reader) \r
+\r
+    /**\r
+     * Method validate\r
+     * \r
+     */\r
+    public void validate()\r
+        throws org.exolab.castor.xml.ValidationException\r
+    {\r
+        org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
+        validator.validate(this);\r
+    } //-- void validate() \r
+\r
+}\r
diff --git a/src/jalview/schemabinding/version2/VamsasModelDescriptor.java b/src/jalview/schemabinding/version2/VamsasModelDescriptor.java
new file mode 100755 (executable)
index 0000000..e40d9c8
--- /dev/null
@@ -0,0 +1,166 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package jalview.schemabinding.version2;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import org.exolab.castor.mapping.AccessMode;\r
+import org.exolab.castor.xml.TypeValidator;\r
+import org.exolab.castor.xml.XMLFieldDescriptor;\r
+import org.exolab.castor.xml.validators.*;\r
+\r
+/**\r
+ * Class VamsasModelDescriptor.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class VamsasModelDescriptor extends VAMSASDescriptor {\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * Field nsPrefix\r
+     */\r
+    private java.lang.String nsPrefix;\r
+\r
+    /**\r
+     * Field nsURI\r
+     */\r
+    private java.lang.String nsURI;\r
+\r
+    /**\r
+     * Field xmlName\r
+     */\r
+    private java.lang.String xmlName;\r
+\r
+    /**\r
+     * Field identity\r
+     */\r
+    private org.exolab.castor.xml.XMLFieldDescriptor identity;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public VamsasModelDescriptor() {\r
+        super();\r
+        setExtendsWithoutFlatten(new VAMSASDescriptor());\r
+        nsURI = "www.jalview.org";\r
+        xmlName = "vamsasModel";\r
+    } //-- jalview.schemabinding.version2.VamsasModelDescriptor()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Method getAccessMode\r
+     * \r
+     * \r
+     * \r
+     * @return AccessMode\r
+     */\r
+    public org.exolab.castor.mapping.AccessMode getAccessMode()\r
+    {\r
+        return null;\r
+    } //-- org.exolab.castor.mapping.AccessMode getAccessMode() \r
+\r
+    /**\r
+     * Method getExtends\r
+     * \r
+     * \r
+     * \r
+     * @return ClassDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.ClassDescriptor getExtends()\r
+    {\r
+        return super.getExtends();\r
+    } //-- org.exolab.castor.mapping.ClassDescriptor getExtends() \r
+\r
+    /**\r
+     * Method getIdentity\r
+     * \r
+     * \r
+     * \r
+     * @return FieldDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.FieldDescriptor getIdentity()\r
+    {\r
+        if (identity == null)\r
+            return super.getIdentity();\r
+        return identity;\r
+    } //-- org.exolab.castor.mapping.FieldDescriptor getIdentity() \r
+\r
+    /**\r
+     * Method getJavaClass\r
+     * \r
+     * \r
+     * \r
+     * @return Class\r
+     */\r
+    public java.lang.Class getJavaClass()\r
+    {\r
+        return jalview.schemabinding.version2.VamsasModel.class;\r
+    } //-- java.lang.Class getJavaClass() \r
+\r
+    /**\r
+     * Method getNameSpacePrefix\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpacePrefix()\r
+    {\r
+        return nsPrefix;\r
+    } //-- java.lang.String getNameSpacePrefix() \r
+\r
+    /**\r
+     * Method getNameSpaceURI\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpaceURI()\r
+    {\r
+        return nsURI;\r
+    } //-- java.lang.String getNameSpaceURI() \r
+\r
+    /**\r
+     * Method getValidator\r
+     * \r
+     * \r
+     * \r
+     * @return TypeValidator\r
+     */\r
+    public org.exolab.castor.xml.TypeValidator getValidator()\r
+    {\r
+        return this;\r
+    } //-- org.exolab.castor.xml.TypeValidator getValidator() \r
+\r
+    /**\r
+     * Method getXMLName\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getXMLName()\r
+    {\r
+        return xmlName;\r
+    } //-- java.lang.String getXMLName() \r
+\r
+}\r
diff --git a/src/jalview/schemabinding/version2/Viewport.java b/src/jalview/schemabinding/version2/Viewport.java
new file mode 100755 (executable)
index 0000000..557e454
--- /dev/null
@@ -0,0 +1,1600 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package jalview.schemabinding.version2;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import java.io.IOException;\r
+import java.io.Reader;\r
+import java.io.Serializable;\r
+import java.io.Writer;\r
+import java.util.Enumeration;\r
+import java.util.Vector;\r
+import org.exolab.castor.xml.MarshalException;\r
+import org.exolab.castor.xml.Marshaller;\r
+import org.exolab.castor.xml.Unmarshaller;\r
+import org.exolab.castor.xml.ValidationException;\r
+import org.xml.sax.ContentHandler;\r
+\r
+/**\r
+ * Class Viewport.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class Viewport implements java.io.Serializable {\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * Field _conservationSelected\r
+     */\r
+    private boolean _conservationSelected;\r
+\r
+    /**\r
+     * keeps track of state for field: _conservationSelected\r
+     */\r
+    private boolean _has_conservationSelected;\r
+\r
+    /**\r
+     * Field _pidSelected\r
+     */\r
+    private boolean _pidSelected;\r
+\r
+    /**\r
+     * keeps track of state for field: _pidSelected\r
+     */\r
+    private boolean _has_pidSelected;\r
+\r
+    /**\r
+     * Field _bgColour\r
+     */\r
+    private java.lang.String _bgColour;\r
+\r
+    /**\r
+     * Field _consThreshold\r
+     */\r
+    private int _consThreshold;\r
+\r
+    /**\r
+     * keeps track of state for field: _consThreshold\r
+     */\r
+    private boolean _has_consThreshold;\r
+\r
+    /**\r
+     * Field _pidThreshold\r
+     */\r
+    private int _pidThreshold;\r
+\r
+    /**\r
+     * keeps track of state for field: _pidThreshold\r
+     */\r
+    private boolean _has_pidThreshold;\r
+\r
+    /**\r
+     * Field _title\r
+     */\r
+    private java.lang.String _title;\r
+\r
+    /**\r
+     * Field _showFullId\r
+     */\r
+    private boolean _showFullId;\r
+\r
+    /**\r
+     * keeps track of state for field: _showFullId\r
+     */\r
+    private boolean _has_showFullId;\r
+\r
+    /**\r
+     * Field _showText\r
+     */\r
+    private boolean _showText;\r
+\r
+    /**\r
+     * keeps track of state for field: _showText\r
+     */\r
+    private boolean _has_showText;\r
+\r
+    /**\r
+     * Field _showColourText\r
+     */\r
+    private boolean _showColourText;\r
+\r
+    /**\r
+     * keeps track of state for field: _showColourText\r
+     */\r
+    private boolean _has_showColourText;\r
+\r
+    /**\r
+     * Field _showBoxes\r
+     */\r
+    private boolean _showBoxes;\r
+\r
+    /**\r
+     * keeps track of state for field: _showBoxes\r
+     */\r
+    private boolean _has_showBoxes;\r
+\r
+    /**\r
+     * Field _wrapAlignment\r
+     */\r
+    private boolean _wrapAlignment;\r
+\r
+    /**\r
+     * keeps track of state for field: _wrapAlignment\r
+     */\r
+    private boolean _has_wrapAlignment;\r
+\r
+    /**\r
+     * Field _renderGaps\r
+     */\r
+    private boolean _renderGaps;\r
+\r
+    /**\r
+     * keeps track of state for field: _renderGaps\r
+     */\r
+    private boolean _has_renderGaps;\r
+\r
+    /**\r
+     * Field _showSequenceFeatures\r
+     */\r
+    private boolean _showSequenceFeatures;\r
+\r
+    /**\r
+     * keeps track of state for field: _showSequenceFeatures\r
+     */\r
+    private boolean _has_showSequenceFeatures;\r
+\r
+    /**\r
+     * Field _showAnnotation\r
+     */\r
+    private boolean _showAnnotation;\r
+\r
+    /**\r
+     * keeps track of state for field: _showAnnotation\r
+     */\r
+    private boolean _has_showAnnotation;\r
+\r
+    /**\r
+     * Field _showConservation\r
+     */\r
+    private boolean _showConservation;\r
+\r
+    /**\r
+     * keeps track of state for field: _showConservation\r
+     */\r
+    private boolean _has_showConservation;\r
+\r
+    /**\r
+     * Field _showQuality\r
+     */\r
+    private boolean _showQuality;\r
+\r
+    /**\r
+     * keeps track of state for field: _showQuality\r
+     */\r
+    private boolean _has_showQuality;\r
+\r
+    /**\r
+     * Field _showIdentity\r
+     */\r
+    private boolean _showIdentity;\r
+\r
+    /**\r
+     * keeps track of state for field: _showIdentity\r
+     */\r
+    private boolean _has_showIdentity;\r
+\r
+    /**\r
+     * Field _xpos\r
+     */\r
+    private int _xpos;\r
+\r
+    /**\r
+     * keeps track of state for field: _xpos\r
+     */\r
+    private boolean _has_xpos;\r
+\r
+    /**\r
+     * Field _ypos\r
+     */\r
+    private int _ypos;\r
+\r
+    /**\r
+     * keeps track of state for field: _ypos\r
+     */\r
+    private boolean _has_ypos;\r
+\r
+    /**\r
+     * Field _width\r
+     */\r
+    private int _width;\r
+\r
+    /**\r
+     * keeps track of state for field: _width\r
+     */\r
+    private boolean _has_width;\r
+\r
+    /**\r
+     * Field _height\r
+     */\r
+    private int _height;\r
+\r
+    /**\r
+     * keeps track of state for field: _height\r
+     */\r
+    private boolean _has_height;\r
+\r
+    /**\r
+     * Field _startRes\r
+     */\r
+    private int _startRes;\r
+\r
+    /**\r
+     * keeps track of state for field: _startRes\r
+     */\r
+    private boolean _has_startRes;\r
+\r
+    /**\r
+     * Field _startSeq\r
+     */\r
+    private int _startSeq;\r
+\r
+    /**\r
+     * keeps track of state for field: _startSeq\r
+     */\r
+    private boolean _has_startSeq;\r
+\r
+    /**\r
+     * Field _fontName\r
+     */\r
+    private java.lang.String _fontName;\r
+\r
+    /**\r
+     * Field _fontSize\r
+     */\r
+    private int _fontSize;\r
+\r
+    /**\r
+     * keeps track of state for field: _fontSize\r
+     */\r
+    private boolean _has_fontSize;\r
+\r
+    /**\r
+     * Field _fontStyle\r
+     */\r
+    private int _fontStyle;\r
+\r
+    /**\r
+     * keeps track of state for field: _fontStyle\r
+     */\r
+    private boolean _has_fontStyle;\r
+\r
+    /**\r
+     * Field _annotationColours\r
+     */\r
+    private jalview.schemabinding.version2.AnnotationColours _annotationColours;\r
+\r
+    /**\r
+     * Field _hiddenColumnsList\r
+     */\r
+    private java.util.Vector _hiddenColumnsList;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public Viewport() {\r
+        super();\r
+        _hiddenColumnsList = new Vector();\r
+    } //-- jalview.schemabinding.version2.Viewport()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Method addHiddenColumns\r
+     * \r
+     * \r
+     * \r
+     * @param vHiddenColumns\r
+     */\r
+    public void addHiddenColumns(jalview.schemabinding.version2.HiddenColumns vHiddenColumns)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        _hiddenColumnsList.addElement(vHiddenColumns);\r
+    } //-- void addHiddenColumns(jalview.schemabinding.version2.HiddenColumns) \r
+\r
+    /**\r
+     * Method addHiddenColumns\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @param vHiddenColumns\r
+     */\r
+    public void addHiddenColumns(int index, jalview.schemabinding.version2.HiddenColumns vHiddenColumns)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        _hiddenColumnsList.insertElementAt(vHiddenColumns, index);\r
+    } //-- void addHiddenColumns(int, jalview.schemabinding.version2.HiddenColumns) \r
+\r
+    /**\r
+     * Method deleteConsThreshold\r
+     * \r
+     */\r
+    public void deleteConsThreshold()\r
+    {\r
+        this._has_consThreshold= false;\r
+    } //-- void deleteConsThreshold() \r
+\r
+    /**\r
+     * Method deleteConservationSelected\r
+     * \r
+     */\r
+    public void deleteConservationSelected()\r
+    {\r
+        this._has_conservationSelected= false;\r
+    } //-- void deleteConservationSelected() \r
+\r
+    /**\r
+     * Method deleteFontSize\r
+     * \r
+     */\r
+    public void deleteFontSize()\r
+    {\r
+        this._has_fontSize= false;\r
+    } //-- void deleteFontSize() \r
+\r
+    /**\r
+     * Method deleteFontStyle\r
+     * \r
+     */\r
+    public void deleteFontStyle()\r
+    {\r
+        this._has_fontStyle= false;\r
+    } //-- void deleteFontStyle() \r
+\r
+    /**\r
+     * Method deleteHeight\r
+     * \r
+     */\r
+    public void deleteHeight()\r
+    {\r
+        this._has_height= false;\r
+    } //-- void deleteHeight() \r
+\r
+    /**\r
+     * Method deletePidSelected\r
+     * \r
+     */\r
+    public void deletePidSelected()\r
+    {\r
+        this._has_pidSelected= false;\r
+    } //-- void deletePidSelected() \r
+\r
+    /**\r
+     * Method deletePidThreshold\r
+     * \r
+     */\r
+    public void deletePidThreshold()\r
+    {\r
+        this._has_pidThreshold= false;\r
+    } //-- void deletePidThreshold() \r
+\r
+    /**\r
+     * Method deleteRenderGaps\r
+     * \r
+     */\r
+    public void deleteRenderGaps()\r
+    {\r
+        this._has_renderGaps= false;\r
+    } //-- void deleteRenderGaps() \r
+\r
+    /**\r
+     * Method deleteShowAnnotation\r
+     * \r
+     */\r
+    public void deleteShowAnnotation()\r
+    {\r
+        this._has_showAnnotation= false;\r
+    } //-- void deleteShowAnnotation() \r
+\r
+    /**\r
+     * Method deleteShowBoxes\r
+     * \r
+     */\r
+    public void deleteShowBoxes()\r
+    {\r
+        this._has_showBoxes= false;\r
+    } //-- void deleteShowBoxes() \r
+\r
+    /**\r
+     * Method deleteShowColourText\r
+     * \r
+     */\r
+    public void deleteShowColourText()\r
+    {\r
+        this._has_showColourText= false;\r
+    } //-- void deleteShowColourText() \r
+\r
+    /**\r
+     * Method deleteShowConservation\r
+     * \r
+     */\r
+    public void deleteShowConservation()\r
+    {\r
+        this._has_showConservation= false;\r
+    } //-- void deleteShowConservation() \r
+\r
+    /**\r
+     * Method deleteShowFullId\r
+     * \r
+     */\r
+    public void deleteShowFullId()\r
+    {\r
+        this._has_showFullId= false;\r
+    } //-- void deleteShowFullId() \r
+\r
+    /**\r
+     * Method deleteShowIdentity\r
+     * \r
+     */\r
+    public void deleteShowIdentity()\r
+    {\r
+        this._has_showIdentity= false;\r
+    } //-- void deleteShowIdentity() \r
+\r
+    /**\r
+     * Method deleteShowQuality\r
+     * \r
+     */\r
+    public void deleteShowQuality()\r
+    {\r
+        this._has_showQuality= false;\r
+    } //-- void deleteShowQuality() \r
+\r
+    /**\r
+     * Method deleteShowSequenceFeatures\r
+     * \r
+     */\r
+    public void deleteShowSequenceFeatures()\r
+    {\r
+        this._has_showSequenceFeatures= false;\r
+    } //-- void deleteShowSequenceFeatures() \r
+\r
+    /**\r
+     * Method deleteShowText\r
+     * \r
+     */\r
+    public void deleteShowText()\r
+    {\r
+        this._has_showText= false;\r
+    } //-- void deleteShowText() \r
+\r
+    /**\r
+     * Method deleteStartRes\r
+     * \r
+     */\r
+    public void deleteStartRes()\r
+    {\r
+        this._has_startRes= false;\r
+    } //-- void deleteStartRes() \r
+\r
+    /**\r
+     * Method deleteStartSeq\r
+     * \r
+     */\r
+    public void deleteStartSeq()\r
+    {\r
+        this._has_startSeq= false;\r
+    } //-- void deleteStartSeq() \r
+\r
+    /**\r
+     * Method deleteWidth\r
+     * \r
+     */\r
+    public void deleteWidth()\r
+    {\r
+        this._has_width= false;\r
+    } //-- void deleteWidth() \r
+\r
+    /**\r
+     * Method deleteWrapAlignment\r
+     * \r
+     */\r
+    public void deleteWrapAlignment()\r
+    {\r
+        this._has_wrapAlignment= false;\r
+    } //-- void deleteWrapAlignment() \r
+\r
+    /**\r
+     * Method deleteXpos\r
+     * \r
+     */\r
+    public void deleteXpos()\r
+    {\r
+        this._has_xpos= false;\r
+    } //-- void deleteXpos() \r
+\r
+    /**\r
+     * Method deleteYpos\r
+     * \r
+     */\r
+    public void deleteYpos()\r
+    {\r
+        this._has_ypos= false;\r
+    } //-- void deleteYpos() \r
+\r
+    /**\r
+     * Method enumerateHiddenColumns\r
+     * \r
+     * \r
+     * \r
+     * @return Enumeration\r
+     */\r
+    public java.util.Enumeration enumerateHiddenColumns()\r
+    {\r
+        return _hiddenColumnsList.elements();\r
+    } //-- java.util.Enumeration enumerateHiddenColumns() \r
+\r
+    /**\r
+     * Returns the value of field 'annotationColours'.\r
+     * \r
+     * @return AnnotationColours\r
+     * @return the value of field 'annotationColours'.\r
+     */\r
+    public jalview.schemabinding.version2.AnnotationColours getAnnotationColours()\r
+    {\r
+        return this._annotationColours;\r
+    } //-- jalview.schemabinding.version2.AnnotationColours getAnnotationColours() \r
+\r
+    /**\r
+     * Returns the value of field 'bgColour'.\r
+     * \r
+     * @return String\r
+     * @return the value of field 'bgColour'.\r
+     */\r
+    public java.lang.String getBgColour()\r
+    {\r
+        return this._bgColour;\r
+    } //-- java.lang.String getBgColour() \r
+\r
+    /**\r
+     * Returns the value of field 'consThreshold'.\r
+     * \r
+     * @return int\r
+     * @return the value of field 'consThreshold'.\r
+     */\r
+    public int getConsThreshold()\r
+    {\r
+        return this._consThreshold;\r
+    } //-- int getConsThreshold() \r
+\r
+    /**\r
+     * Returns the value of field 'conservationSelected'.\r
+     * \r
+     * @return boolean\r
+     * @return the value of field 'conservationSelected'.\r
+     */\r
+    public boolean getConservationSelected()\r
+    {\r
+        return this._conservationSelected;\r
+    } //-- boolean getConservationSelected() \r
+\r
+    /**\r
+     * Returns the value of field 'fontName'.\r
+     * \r
+     * @return String\r
+     * @return the value of field 'fontName'.\r
+     */\r
+    public java.lang.String getFontName()\r
+    {\r
+        return this._fontName;\r
+    } //-- java.lang.String getFontName() \r
+\r
+    /**\r
+     * Returns the value of field 'fontSize'.\r
+     * \r
+     * @return int\r
+     * @return the value of field 'fontSize'.\r
+     */\r
+    public int getFontSize()\r
+    {\r
+        return this._fontSize;\r
+    } //-- int getFontSize() \r
+\r
+    /**\r
+     * Returns the value of field 'fontStyle'.\r
+     * \r
+     * @return int\r
+     * @return the value of field 'fontStyle'.\r
+     */\r
+    public int getFontStyle()\r
+    {\r
+        return this._fontStyle;\r
+    } //-- int getFontStyle() \r
+\r
+    /**\r
+     * Returns the value of field 'height'.\r
+     * \r
+     * @return int\r
+     * @return the value of field 'height'.\r
+     */\r
+    public int getHeight()\r
+    {\r
+        return this._height;\r
+    } //-- int getHeight() \r
+\r
+    /**\r
+     * Method getHiddenColumns\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @return HiddenColumns\r
+     */\r
+    public jalview.schemabinding.version2.HiddenColumns getHiddenColumns(int index)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        //-- check bounds for index\r
+        if ((index < 0) || (index > _hiddenColumnsList.size())) {\r
+            throw new IndexOutOfBoundsException();\r
+        }\r
+        \r
+        return (jalview.schemabinding.version2.HiddenColumns) _hiddenColumnsList.elementAt(index);\r
+    } //-- jalview.schemabinding.version2.HiddenColumns getHiddenColumns(int) \r
+\r
+    /**\r
+     * Method getHiddenColumns\r
+     * \r
+     * \r
+     * \r
+     * @return HiddenColumns\r
+     */\r
+    public jalview.schemabinding.version2.HiddenColumns[] getHiddenColumns()\r
+    {\r
+        int size = _hiddenColumnsList.size();\r
+        jalview.schemabinding.version2.HiddenColumns[] mArray = new jalview.schemabinding.version2.HiddenColumns[size];\r
+        for (int index = 0; index < size; index++) {\r
+            mArray[index] = (jalview.schemabinding.version2.HiddenColumns) _hiddenColumnsList.elementAt(index);\r
+        }\r
+        return mArray;\r
+    } //-- jalview.schemabinding.version2.HiddenColumns[] getHiddenColumns() \r
+\r
+    /**\r
+     * Method getHiddenColumnsCount\r
+     * \r
+     * \r
+     * \r
+     * @return int\r
+     */\r
+    public int getHiddenColumnsCount()\r
+    {\r
+        return _hiddenColumnsList.size();\r
+    } //-- int getHiddenColumnsCount() \r
+\r
+    /**\r
+     * Returns the value of field 'pidSelected'.\r
+     * \r
+     * @return boolean\r
+     * @return the value of field 'pidSelected'.\r
+     */\r
+    public boolean getPidSelected()\r
+    {\r
+        return this._pidSelected;\r
+    } //-- boolean getPidSelected() \r
+\r
+    /**\r
+     * Returns the value of field 'pidThreshold'.\r
+     * \r
+     * @return int\r
+     * @return the value of field 'pidThreshold'.\r
+     */\r
+    public int getPidThreshold()\r
+    {\r
+        return this._pidThreshold;\r
+    } //-- int getPidThreshold() \r
+\r
+    /**\r
+     * Returns the value of field 'renderGaps'.\r
+     * \r
+     * @return boolean\r
+     * @return the value of field 'renderGaps'.\r
+     */\r
+    public boolean getRenderGaps()\r
+    {\r
+        return this._renderGaps;\r
+    } //-- boolean getRenderGaps() \r
+\r
+    /**\r
+     * Returns the value of field 'showAnnotation'.\r
+     * \r
+     * @return boolean\r
+     * @return the value of field 'showAnnotation'.\r
+     */\r
+    public boolean getShowAnnotation()\r
+    {\r
+        return this._showAnnotation;\r
+    } //-- boolean getShowAnnotation() \r
+\r
+    /**\r
+     * Returns the value of field 'showBoxes'.\r
+     * \r
+     * @return boolean\r
+     * @return the value of field 'showBoxes'.\r
+     */\r
+    public boolean getShowBoxes()\r
+    {\r
+        return this._showBoxes;\r
+    } //-- boolean getShowBoxes() \r
+\r
+    /**\r
+     * Returns the value of field 'showColourText'.\r
+     * \r
+     * @return boolean\r
+     * @return the value of field 'showColourText'.\r
+     */\r
+    public boolean getShowColourText()\r
+    {\r
+        return this._showColourText;\r
+    } //-- boolean getShowColourText() \r
+\r
+    /**\r
+     * Returns the value of field 'showConservation'.\r
+     * \r
+     * @return boolean\r
+     * @return the value of field 'showConservation'.\r
+     */\r
+    public boolean getShowConservation()\r
+    {\r
+        return this._showConservation;\r
+    } //-- boolean getShowConservation() \r
+\r
+    /**\r
+     * Returns the value of field 'showFullId'.\r
+     * \r
+     * @return boolean\r
+     * @return the value of field 'showFullId'.\r
+     */\r
+    public boolean getShowFullId()\r
+    {\r
+        return this._showFullId;\r
+    } //-- boolean getShowFullId() \r
+\r
+    /**\r
+     * Returns the value of field 'showIdentity'.\r
+     * \r
+     * @return boolean\r
+     * @return the value of field 'showIdentity'.\r
+     */\r
+    public boolean getShowIdentity()\r
+    {\r
+        return this._showIdentity;\r
+    } //-- boolean getShowIdentity() \r
+\r
+    /**\r
+     * Returns the value of field 'showQuality'.\r
+     * \r
+     * @return boolean\r
+     * @return the value of field 'showQuality'.\r
+     */\r
+    public boolean getShowQuality()\r
+    {\r
+        return this._showQuality;\r
+    } //-- boolean getShowQuality() \r
+\r
+    /**\r
+     * Returns the value of field 'showSequenceFeatures'.\r
+     * \r
+     * @return boolean\r
+     * @return the value of field 'showSequenceFeatures'.\r
+     */\r
+    public boolean getShowSequenceFeatures()\r
+    {\r
+        return this._showSequenceFeatures;\r
+    } //-- boolean getShowSequenceFeatures() \r
+\r
+    /**\r
+     * Returns the value of field 'showText'.\r
+     * \r
+     * @return boolean\r
+     * @return the value of field 'showText'.\r
+     */\r
+    public boolean getShowText()\r
+    {\r
+        return this._showText;\r
+    } //-- boolean getShowText() \r
+\r
+    /**\r
+     * Returns the value of field 'startRes'.\r
+     * \r
+     * @return int\r
+     * @return the value of field 'startRes'.\r
+     */\r
+    public int getStartRes()\r
+    {\r
+        return this._startRes;\r
+    } //-- int getStartRes() \r
+\r
+    /**\r
+     * Returns the value of field 'startSeq'.\r
+     * \r
+     * @return int\r
+     * @return the value of field 'startSeq'.\r
+     */\r
+    public int getStartSeq()\r
+    {\r
+        return this._startSeq;\r
+    } //-- int getStartSeq() \r
+\r
+    /**\r
+     * Returns the value of field 'title'.\r
+     * \r
+     * @return String\r
+     * @return the value of field 'title'.\r
+     */\r
+    public java.lang.String getTitle()\r
+    {\r
+        return this._title;\r
+    } //-- java.lang.String getTitle() \r
+\r
+    /**\r
+     * Returns the value of field 'width'.\r
+     * \r
+     * @return int\r
+     * @return the value of field 'width'.\r
+     */\r
+    public int getWidth()\r
+    {\r
+        return this._width;\r
+    } //-- int getWidth() \r
+\r
+    /**\r
+     * Returns the value of field 'wrapAlignment'.\r
+     * \r
+     * @return boolean\r
+     * @return the value of field 'wrapAlignment'.\r
+     */\r
+    public boolean getWrapAlignment()\r
+    {\r
+        return this._wrapAlignment;\r
+    } //-- boolean getWrapAlignment() \r
+\r
+    /**\r
+     * Returns the value of field 'xpos'.\r
+     * \r
+     * @return int\r
+     * @return the value of field 'xpos'.\r
+     */\r
+    public int getXpos()\r
+    {\r
+        return this._xpos;\r
+    } //-- int getXpos() \r
+\r
+    /**\r
+     * Returns the value of field 'ypos'.\r
+     * \r
+     * @return int\r
+     * @return the value of field 'ypos'.\r
+     */\r
+    public int getYpos()\r
+    {\r
+        return this._ypos;\r
+    } //-- int getYpos() \r
+\r
+    /**\r
+     * Method hasConsThreshold\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean hasConsThreshold()\r
+    {\r
+        return this._has_consThreshold;\r
+    } //-- boolean hasConsThreshold() \r
+\r
+    /**\r
+     * Method hasConservationSelected\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean hasConservationSelected()\r
+    {\r
+        return this._has_conservationSelected;\r
+    } //-- boolean hasConservationSelected() \r
+\r
+    /**\r
+     * Method hasFontSize\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean hasFontSize()\r
+    {\r
+        return this._has_fontSize;\r
+    } //-- boolean hasFontSize() \r
+\r
+    /**\r
+     * Method hasFontStyle\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean hasFontStyle()\r
+    {\r
+        return this._has_fontStyle;\r
+    } //-- boolean hasFontStyle() \r
+\r
+    /**\r
+     * Method hasHeight\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean hasHeight()\r
+    {\r
+        return this._has_height;\r
+    } //-- boolean hasHeight() \r
+\r
+    /**\r
+     * Method hasPidSelected\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean hasPidSelected()\r
+    {\r
+        return this._has_pidSelected;\r
+    } //-- boolean hasPidSelected() \r
+\r
+    /**\r
+     * Method hasPidThreshold\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean hasPidThreshold()\r
+    {\r
+        return this._has_pidThreshold;\r
+    } //-- boolean hasPidThreshold() \r
+\r
+    /**\r
+     * Method hasRenderGaps\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean hasRenderGaps()\r
+    {\r
+        return this._has_renderGaps;\r
+    } //-- boolean hasRenderGaps() \r
+\r
+    /**\r
+     * Method hasShowAnnotation\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean hasShowAnnotation()\r
+    {\r
+        return this._has_showAnnotation;\r
+    } //-- boolean hasShowAnnotation() \r
+\r
+    /**\r
+     * Method hasShowBoxes\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean hasShowBoxes()\r
+    {\r
+        return this._has_showBoxes;\r
+    } //-- boolean hasShowBoxes() \r
+\r
+    /**\r
+     * Method hasShowColourText\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean hasShowColourText()\r
+    {\r
+        return this._has_showColourText;\r
+    } //-- boolean hasShowColourText() \r
+\r
+    /**\r
+     * Method hasShowConservation\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean hasShowConservation()\r
+    {\r
+        return this._has_showConservation;\r
+    } //-- boolean hasShowConservation() \r
+\r
+    /**\r
+     * Method hasShowFullId\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean hasShowFullId()\r
+    {\r
+        return this._has_showFullId;\r
+    } //-- boolean hasShowFullId() \r
+\r
+    /**\r
+     * Method hasShowIdentity\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean hasShowIdentity()\r
+    {\r
+        return this._has_showIdentity;\r
+    } //-- boolean hasShowIdentity() \r
+\r
+    /**\r
+     * Method hasShowQuality\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean hasShowQuality()\r
+    {\r
+        return this._has_showQuality;\r
+    } //-- boolean hasShowQuality() \r
+\r
+    /**\r
+     * Method hasShowSequenceFeatures\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean hasShowSequenceFeatures()\r
+    {\r
+        return this._has_showSequenceFeatures;\r
+    } //-- boolean hasShowSequenceFeatures() \r
+\r
+    /**\r
+     * Method hasShowText\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean hasShowText()\r
+    {\r
+        return this._has_showText;\r
+    } //-- boolean hasShowText() \r
+\r
+    /**\r
+     * Method hasStartRes\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean hasStartRes()\r
+    {\r
+        return this._has_startRes;\r
+    } //-- boolean hasStartRes() \r
+\r
+    /**\r
+     * Method hasStartSeq\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean hasStartSeq()\r
+    {\r
+        return this._has_startSeq;\r
+    } //-- boolean hasStartSeq() \r
+\r
+    /**\r
+     * Method hasWidth\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean hasWidth()\r
+    {\r
+        return this._has_width;\r
+    } //-- boolean hasWidth() \r
+\r
+    /**\r
+     * Method hasWrapAlignment\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean hasWrapAlignment()\r
+    {\r
+        return this._has_wrapAlignment;\r
+    } //-- boolean hasWrapAlignment() \r
+\r
+    /**\r
+     * Method hasXpos\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean hasXpos()\r
+    {\r
+        return this._has_xpos;\r
+    } //-- boolean hasXpos() \r
+\r
+    /**\r
+     * Method hasYpos\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean hasYpos()\r
+    {\r
+        return this._has_ypos;\r
+    } //-- boolean hasYpos() \r
+\r
+    /**\r
+     * Method isValid\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean isValid()\r
+    {\r
+        try {\r
+            validate();\r
+        }\r
+        catch (org.exolab.castor.xml.ValidationException vex) {\r
+            return false;\r
+        }\r
+        return true;\r
+    } //-- boolean isValid() \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param out\r
+     */\r
+    public void marshal(java.io.Writer out)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, out);\r
+    } //-- void marshal(java.io.Writer) \r
+\r
+    /**\r
+     * Method marshal\r
+     * \r
+     * \r
+     * \r
+     * @param handler\r
+     */\r
+    public void marshal(org.xml.sax.ContentHandler handler)\r
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        \r
+        Marshaller.marshal(this, handler);\r
+    } //-- void marshal(org.xml.sax.ContentHandler) \r
+\r
+    /**\r
+     * Method removeAllHiddenColumns\r
+     * \r
+     */\r
+    public void removeAllHiddenColumns()\r
+    {\r
+        _hiddenColumnsList.removeAllElements();\r
+    } //-- void removeAllHiddenColumns() \r
+\r
+    /**\r
+     * Method removeHiddenColumns\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @return HiddenColumns\r
+     */\r
+    public jalview.schemabinding.version2.HiddenColumns removeHiddenColumns(int index)\r
+    {\r
+        java.lang.Object obj = _hiddenColumnsList.elementAt(index);\r
+        _hiddenColumnsList.removeElementAt(index);\r
+        return (jalview.schemabinding.version2.HiddenColumns) obj;\r
+    } //-- jalview.schemabinding.version2.HiddenColumns removeHiddenColumns(int) \r
+\r
+    /**\r
+     * Sets the value of field 'annotationColours'.\r
+     * \r
+     * @param annotationColours the value of field\r
+     * 'annotationColours'.\r
+     */\r
+    public void setAnnotationColours(jalview.schemabinding.version2.AnnotationColours annotationColours)\r
+    {\r
+        this._annotationColours = annotationColours;\r
+    } //-- void setAnnotationColours(jalview.schemabinding.version2.AnnotationColours) \r
+\r
+    /**\r
+     * Sets the value of field 'bgColour'.\r
+     * \r
+     * @param bgColour the value of field 'bgColour'.\r
+     */\r
+    public void setBgColour(java.lang.String bgColour)\r
+    {\r
+        this._bgColour = bgColour;\r
+    } //-- void setBgColour(java.lang.String) \r
+\r
+    /**\r
+     * Sets the value of field 'consThreshold'.\r
+     * \r
+     * @param consThreshold the value of field 'consThreshold'.\r
+     */\r
+    public void setConsThreshold(int consThreshold)\r
+    {\r
+        this._consThreshold = consThreshold;\r
+        this._has_consThreshold = true;\r
+    } //-- void setConsThreshold(int) \r
+\r
+    /**\r
+     * Sets the value of field 'conservationSelected'.\r
+     * \r
+     * @param conservationSelected the value of field\r
+     * 'conservationSelected'.\r
+     */\r
+    public void setConservationSelected(boolean conservationSelected)\r
+    {\r
+        this._conservationSelected = conservationSelected;\r
+        this._has_conservationSelected = true;\r
+    } //-- void setConservationSelected(boolean) \r
+\r
+    /**\r
+     * Sets the value of field 'fontName'.\r
+     * \r
+     * @param fontName the value of field 'fontName'.\r
+     */\r
+    public void setFontName(java.lang.String fontName)\r
+    {\r
+        this._fontName = fontName;\r
+    } //-- void setFontName(java.lang.String) \r
+\r
+    /**\r
+     * Sets the value of field 'fontSize'.\r
+     * \r
+     * @param fontSize the value of field 'fontSize'.\r
+     */\r
+    public void setFontSize(int fontSize)\r
+    {\r
+        this._fontSize = fontSize;\r
+        this._has_fontSize = true;\r
+    } //-- void setFontSize(int) \r
+\r
+    /**\r
+     * Sets the value of field 'fontStyle'.\r
+     * \r
+     * @param fontStyle the value of field 'fontStyle'.\r
+     */\r
+    public void setFontStyle(int fontStyle)\r
+    {\r
+        this._fontStyle = fontStyle;\r
+        this._has_fontStyle = true;\r
+    } //-- void setFontStyle(int) \r
+\r
+    /**\r
+     * Sets the value of field 'height'.\r
+     * \r
+     * @param height the value of field 'height'.\r
+     */\r
+    public void setHeight(int height)\r
+    {\r
+        this._height = height;\r
+        this._has_height = true;\r
+    } //-- void setHeight(int) \r
+\r
+    /**\r
+     * Method setHiddenColumns\r
+     * \r
+     * \r
+     * \r
+     * @param index\r
+     * @param vHiddenColumns\r
+     */\r
+    public void setHiddenColumns(int index, jalview.schemabinding.version2.HiddenColumns vHiddenColumns)\r
+        throws java.lang.IndexOutOfBoundsException\r
+    {\r
+        //-- check bounds for index\r
+        if ((index < 0) || (index > _hiddenColumnsList.size())) {\r
+            throw new IndexOutOfBoundsException();\r
+        }\r
+        _hiddenColumnsList.setElementAt(vHiddenColumns, index);\r
+    } //-- void setHiddenColumns(int, jalview.schemabinding.version2.HiddenColumns) \r
+\r
+    /**\r
+     * Method setHiddenColumns\r
+     * \r
+     * \r
+     * \r
+     * @param hiddenColumnsArray\r
+     */\r
+    public void setHiddenColumns(jalview.schemabinding.version2.HiddenColumns[] hiddenColumnsArray)\r
+    {\r
+        //-- copy array\r
+        _hiddenColumnsList.removeAllElements();\r
+        for (int i = 0; i < hiddenColumnsArray.length; i++) {\r
+            _hiddenColumnsList.addElement(hiddenColumnsArray[i]);\r
+        }\r
+    } //-- void setHiddenColumns(jalview.schemabinding.version2.HiddenColumns) \r
+\r
+    /**\r
+     * Sets the value of field 'pidSelected'.\r
+     * \r
+     * @param pidSelected the value of field 'pidSelected'.\r
+     */\r
+    public void setPidSelected(boolean pidSelected)\r
+    {\r
+        this._pidSelected = pidSelected;\r
+        this._has_pidSelected = true;\r
+    } //-- void setPidSelected(boolean) \r
+\r
+    /**\r
+     * Sets the value of field 'pidThreshold'.\r
+     * \r
+     * @param pidThreshold the value of field 'pidThreshold'.\r
+     */\r
+    public void setPidThreshold(int pidThreshold)\r
+    {\r
+        this._pidThreshold = pidThreshold;\r
+        this._has_pidThreshold = true;\r
+    } //-- void setPidThreshold(int) \r
+\r
+    /**\r
+     * Sets the value of field 'renderGaps'.\r
+     * \r
+     * @param renderGaps the value of field 'renderGaps'.\r
+     */\r
+    public void setRenderGaps(boolean renderGaps)\r
+    {\r
+        this._renderGaps = renderGaps;\r
+        this._has_renderGaps = true;\r
+    } //-- void setRenderGaps(boolean) \r
+\r
+    /**\r
+     * Sets the value of field 'showAnnotation'.\r
+     * \r
+     * @param showAnnotation the value of field 'showAnnotation'.\r
+     */\r
+    public void setShowAnnotation(boolean showAnnotation)\r
+    {\r
+        this._showAnnotation = showAnnotation;\r
+        this._has_showAnnotation = true;\r
+    } //-- void setShowAnnotation(boolean) \r
+\r
+    /**\r
+     * Sets the value of field 'showBoxes'.\r
+     * \r
+     * @param showBoxes the value of field 'showBoxes'.\r
+     */\r
+    public void setShowBoxes(boolean showBoxes)\r
+    {\r
+        this._showBoxes = showBoxes;\r
+        this._has_showBoxes = true;\r
+    } //-- void setShowBoxes(boolean) \r
+\r
+    /**\r
+     * Sets the value of field 'showColourText'.\r
+     * \r
+     * @param showColourText the value of field 'showColourText'.\r
+     */\r
+    public void setShowColourText(boolean showColourText)\r
+    {\r
+        this._showColourText = showColourText;\r
+        this._has_showColourText = true;\r
+    } //-- void setShowColourText(boolean) \r
+\r
+    /**\r
+     * Sets the value of field 'showConservation'.\r
+     * \r
+     * @param showConservation the value of field 'showConservation'\r
+     */\r
+    public void setShowConservation(boolean showConservation)\r
+    {\r
+        this._showConservation = showConservation;\r
+        this._has_showConservation = true;\r
+    } //-- void setShowConservation(boolean) \r
+\r
+    /**\r
+     * Sets the value of field 'showFullId'.\r
+     * \r
+     * @param showFullId the value of field 'showFullId'.\r
+     */\r
+    public void setShowFullId(boolean showFullId)\r
+    {\r
+        this._showFullId = showFullId;\r
+        this._has_showFullId = true;\r
+    } //-- void setShowFullId(boolean) \r
+\r
+    /**\r
+     * Sets the value of field 'showIdentity'.\r
+     * \r
+     * @param showIdentity the value of field 'showIdentity'.\r
+     */\r
+    public void setShowIdentity(boolean showIdentity)\r
+    {\r
+        this._showIdentity = showIdentity;\r
+        this._has_showIdentity = true;\r
+    } //-- void setShowIdentity(boolean) \r
+\r
+    /**\r
+     * Sets the value of field 'showQuality'.\r
+     * \r
+     * @param showQuality the value of field 'showQuality'.\r
+     */\r
+    public void setShowQuality(boolean showQuality)\r
+    {\r
+        this._showQuality = showQuality;\r
+        this._has_showQuality = true;\r
+    } //-- void setShowQuality(boolean) \r
+\r
+    /**\r
+     * Sets the value of field 'showSequenceFeatures'.\r
+     * \r
+     * @param showSequenceFeatures the value of field\r
+     * 'showSequenceFeatures'.\r
+     */\r
+    public void setShowSequenceFeatures(boolean showSequenceFeatures)\r
+    {\r
+        this._showSequenceFeatures = showSequenceFeatures;\r
+        this._has_showSequenceFeatures = true;\r
+    } //-- void setShowSequenceFeatures(boolean) \r
+\r
+    /**\r
+     * Sets the value of field 'showText'.\r
+     * \r
+     * @param showText the value of field 'showText'.\r
+     */\r
+    public void setShowText(boolean showText)\r
+    {\r
+        this._showText = showText;\r
+        this._has_showText = true;\r
+    } //-- void setShowText(boolean) \r
+\r
+    /**\r
+     * Sets the value of field 'startRes'.\r
+     * \r
+     * @param startRes the value of field 'startRes'.\r
+     */\r
+    public void setStartRes(int startRes)\r
+    {\r
+        this._startRes = startRes;\r
+        this._has_startRes = true;\r
+    } //-- void setStartRes(int) \r
+\r
+    /**\r
+     * Sets the value of field 'startSeq'.\r
+     * \r
+     * @param startSeq the value of field 'startSeq'.\r
+     */\r
+    public void setStartSeq(int startSeq)\r
+    {\r
+        this._startSeq = startSeq;\r
+        this._has_startSeq = true;\r
+    } //-- void setStartSeq(int) \r
+\r
+    /**\r
+     * Sets the value of field 'title'.\r
+     * \r
+     * @param title the value of field 'title'.\r
+     */\r
+    public void setTitle(java.lang.String title)\r
+    {\r
+        this._title = title;\r
+    } //-- void setTitle(java.lang.String) \r
+\r
+    /**\r
+     * Sets the value of field 'width'.\r
+     * \r
+     * @param width the value of field 'width'.\r
+     */\r
+    public void setWidth(int width)\r
+    {\r
+        this._width = width;\r
+        this._has_width = true;\r
+    } //-- void setWidth(int) \r
+\r
+    /**\r
+     * Sets the value of field 'wrapAlignment'.\r
+     * \r
+     * @param wrapAlignment the value of field 'wrapAlignment'.\r
+     */\r
+    public void setWrapAlignment(boolean wrapAlignment)\r
+    {\r
+        this._wrapAlignment = wrapAlignment;\r
+        this._has_wrapAlignment = true;\r
+    } //-- void setWrapAlignment(boolean) \r
+\r
+    /**\r
+     * Sets the value of field 'xpos'.\r
+     * \r
+     * @param xpos the value of field 'xpos'.\r
+     */\r
+    public void setXpos(int xpos)\r
+    {\r
+        this._xpos = xpos;\r
+        this._has_xpos = true;\r
+    } //-- void setXpos(int) \r
+\r
+    /**\r
+     * Sets the value of field 'ypos'.\r
+     * \r
+     * @param ypos the value of field 'ypos'.\r
+     */\r
+    public void setYpos(int ypos)\r
+    {\r
+        this._ypos = ypos;\r
+        this._has_ypos = true;\r
+    } //-- void setYpos(int) \r
+\r
+    /**\r
+     * Method unmarshal\r
+     * \r
+     * \r
+     * \r
+     * @param reader\r
+     * @return Object\r
+     */\r
+    public static java.lang.Object unmarshal(java.io.Reader reader)\r
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException\r
+    {\r
+        return (jalview.schemabinding.version2.Viewport) Unmarshaller.unmarshal(jalview.schemabinding.version2.Viewport.class, reader);\r
+    } //-- java.lang.Object unmarshal(java.io.Reader) \r
+\r
+    /**\r
+     * Method validate\r
+     * \r
+     */\r
+    public void validate()\r
+        throws org.exolab.castor.xml.ValidationException\r
+    {\r
+        org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
+        validator.validate(this);\r
+    } //-- void validate() \r
+\r
+}\r
diff --git a/src/jalview/schemabinding/version2/ViewportDescriptor.java b/src/jalview/schemabinding/version2/ViewportDescriptor.java
new file mode 100755 (executable)
index 0000000..b98f97b
--- /dev/null
@@ -0,0 +1,1293 @@
+/*\r
+ * This class was automatically generated with \r
+ * <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML\r
+ * Schema.\r
+ * $Id$\r
+ */\r
+\r
+package jalview.schemabinding.version2;\r
+\r
+  //---------------------------------/\r
+ //- Imported classes and packages -/\r
+//---------------------------------/\r
+\r
+import org.exolab.castor.mapping.AccessMode;\r
+import org.exolab.castor.xml.TypeValidator;\r
+import org.exolab.castor.xml.XMLFieldDescriptor;\r
+import org.exolab.castor.xml.validators.*;\r
+\r
+/**\r
+ * Class ViewportDescriptor.\r
+ * \r
+ * @version $Revision$ $Date$\r
+ */\r
+public class ViewportDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {\r
+\r
+\r
+      //--------------------------/\r
+     //- Class/Member Variables -/\r
+    //--------------------------/\r
+\r
+    /**\r
+     * Field nsPrefix\r
+     */\r
+    private java.lang.String nsPrefix;\r
+\r
+    /**\r
+     * Field nsURI\r
+     */\r
+    private java.lang.String nsURI;\r
+\r
+    /**\r
+     * Field xmlName\r
+     */\r
+    private java.lang.String xmlName;\r
+\r
+    /**\r
+     * Field identity\r
+     */\r
+    private org.exolab.castor.xml.XMLFieldDescriptor identity;\r
+\r
+\r
+      //----------------/\r
+     //- Constructors -/\r
+    //----------------/\r
+\r
+    public ViewportDescriptor() {\r
+        super();\r
+        nsURI = "www.jalview.org";\r
+        xmlName = "Viewport";\r
+        \r
+        //-- set grouping compositor\r
+        setCompositorAsSequence();\r
+        org.exolab.castor.xml.util.XMLFieldDescriptorImpl  desc           = null;\r
+        org.exolab.castor.xml.XMLFieldHandler              handler        = null;\r
+        org.exolab.castor.xml.FieldValidator               fieldValidator = null;\r
+        //-- initialize attribute descriptors\r
+        \r
+        //-- _conservationSelected\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_conservationSelected", "conservationSelected", org.exolab.castor.xml.NodeType.Attribute);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Viewport target = (Viewport) object;\r
+                if(!target.hasConservationSelected())\r
+                    return null;\r
+                return (target.getConservationSelected() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Viewport target = (Viewport) object;\r
+                    // if null, use delete method for optional primitives \r
+                    if (value == null) {\r
+                        target.deleteConservationSelected();\r
+                        return;\r
+                    }\r
+                    target.setConservationSelected( ((java.lang.Boolean)value).booleanValue());\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _conservationSelected\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            BooleanValidator typeValidator = new BooleanValidator();\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _pidSelected\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_pidSelected", "pidSelected", org.exolab.castor.xml.NodeType.Attribute);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Viewport target = (Viewport) object;\r
+                if(!target.hasPidSelected())\r
+                    return null;\r
+                return (target.getPidSelected() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Viewport target = (Viewport) object;\r
+                    // if null, use delete method for optional primitives \r
+                    if (value == null) {\r
+                        target.deletePidSelected();\r
+                        return;\r
+                    }\r
+                    target.setPidSelected( ((java.lang.Boolean)value).booleanValue());\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _pidSelected\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            BooleanValidator typeValidator = new BooleanValidator();\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _bgColour\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_bgColour", "bgColour", org.exolab.castor.xml.NodeType.Attribute);\r
+        desc.setImmutable(true);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Viewport target = (Viewport) object;\r
+                return target.getBgColour();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Viewport target = (Viewport) object;\r
+                    target.setBgColour( (java.lang.String) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _bgColour\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            StringValidator typeValidator = new StringValidator();\r
+            typeValidator.setWhiteSpace("preserve");\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _consThreshold\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_consThreshold", "consThreshold", org.exolab.castor.xml.NodeType.Attribute);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Viewport target = (Viewport) object;\r
+                if(!target.hasConsThreshold())\r
+                    return null;\r
+                return new java.lang.Integer(target.getConsThreshold());\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Viewport target = (Viewport) object;\r
+                    // if null, use delete method for optional primitives \r
+                    if (value == null) {\r
+                        target.deleteConsThreshold();\r
+                        return;\r
+                    }\r
+                    target.setConsThreshold( ((java.lang.Integer)value).intValue());\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _consThreshold\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            IntegerValidator typeValidator= new IntegerValidator();\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _pidThreshold\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_pidThreshold", "pidThreshold", org.exolab.castor.xml.NodeType.Attribute);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Viewport target = (Viewport) object;\r
+                if(!target.hasPidThreshold())\r
+                    return null;\r
+                return new java.lang.Integer(target.getPidThreshold());\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Viewport target = (Viewport) object;\r
+                    // if null, use delete method for optional primitives \r
+                    if (value == null) {\r
+                        target.deletePidThreshold();\r
+                        return;\r
+                    }\r
+                    target.setPidThreshold( ((java.lang.Integer)value).intValue());\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _pidThreshold\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            IntegerValidator typeValidator= new IntegerValidator();\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _title\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_title", "title", org.exolab.castor.xml.NodeType.Attribute);\r
+        desc.setImmutable(true);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Viewport target = (Viewport) object;\r
+                return target.getTitle();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Viewport target = (Viewport) object;\r
+                    target.setTitle( (java.lang.String) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _title\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            StringValidator typeValidator = new StringValidator();\r
+            typeValidator.setWhiteSpace("preserve");\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _showFullId\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_showFullId", "showFullId", org.exolab.castor.xml.NodeType.Attribute);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Viewport target = (Viewport) object;\r
+                if(!target.hasShowFullId())\r
+                    return null;\r
+                return (target.getShowFullId() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Viewport target = (Viewport) object;\r
+                    // if null, use delete method for optional primitives \r
+                    if (value == null) {\r
+                        target.deleteShowFullId();\r
+                        return;\r
+                    }\r
+                    target.setShowFullId( ((java.lang.Boolean)value).booleanValue());\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _showFullId\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            BooleanValidator typeValidator = new BooleanValidator();\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _showText\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_showText", "showText", org.exolab.castor.xml.NodeType.Attribute);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Viewport target = (Viewport) object;\r
+                if(!target.hasShowText())\r
+                    return null;\r
+                return (target.getShowText() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Viewport target = (Viewport) object;\r
+                    // if null, use delete method for optional primitives \r
+                    if (value == null) {\r
+                        target.deleteShowText();\r
+                        return;\r
+                    }\r
+                    target.setShowText( ((java.lang.Boolean)value).booleanValue());\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _showText\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            BooleanValidator typeValidator = new BooleanValidator();\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _showColourText\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_showColourText", "showColourText", org.exolab.castor.xml.NodeType.Attribute);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Viewport target = (Viewport) object;\r
+                if(!target.hasShowColourText())\r
+                    return null;\r
+                return (target.getShowColourText() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Viewport target = (Viewport) object;\r
+                    // if null, use delete method for optional primitives \r
+                    if (value == null) {\r
+                        target.deleteShowColourText();\r
+                        return;\r
+                    }\r
+                    target.setShowColourText( ((java.lang.Boolean)value).booleanValue());\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _showColourText\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            BooleanValidator typeValidator = new BooleanValidator();\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _showBoxes\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_showBoxes", "showBoxes", org.exolab.castor.xml.NodeType.Attribute);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Viewport target = (Viewport) object;\r
+                if(!target.hasShowBoxes())\r
+                    return null;\r
+                return (target.getShowBoxes() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Viewport target = (Viewport) object;\r
+                    // if null, use delete method for optional primitives \r
+                    if (value == null) {\r
+                        target.deleteShowBoxes();\r
+                        return;\r
+                    }\r
+                    target.setShowBoxes( ((java.lang.Boolean)value).booleanValue());\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _showBoxes\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            BooleanValidator typeValidator = new BooleanValidator();\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _wrapAlignment\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_wrapAlignment", "wrapAlignment", org.exolab.castor.xml.NodeType.Attribute);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Viewport target = (Viewport) object;\r
+                if(!target.hasWrapAlignment())\r
+                    return null;\r
+                return (target.getWrapAlignment() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Viewport target = (Viewport) object;\r
+                    // if null, use delete method for optional primitives \r
+                    if (value == null) {\r
+                        target.deleteWrapAlignment();\r
+                        return;\r
+                    }\r
+                    target.setWrapAlignment( ((java.lang.Boolean)value).booleanValue());\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _wrapAlignment\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            BooleanValidator typeValidator = new BooleanValidator();\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _renderGaps\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_renderGaps", "renderGaps", org.exolab.castor.xml.NodeType.Attribute);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Viewport target = (Viewport) object;\r
+                if(!target.hasRenderGaps())\r
+                    return null;\r
+                return (target.getRenderGaps() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Viewport target = (Viewport) object;\r
+                    // if null, use delete method for optional primitives \r
+                    if (value == null) {\r
+                        target.deleteRenderGaps();\r
+                        return;\r
+                    }\r
+                    target.setRenderGaps( ((java.lang.Boolean)value).booleanValue());\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _renderGaps\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            BooleanValidator typeValidator = new BooleanValidator();\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _showSequenceFeatures\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_showSequenceFeatures", "showSequenceFeatures", org.exolab.castor.xml.NodeType.Attribute);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Viewport target = (Viewport) object;\r
+                if(!target.hasShowSequenceFeatures())\r
+                    return null;\r
+                return (target.getShowSequenceFeatures() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Viewport target = (Viewport) object;\r
+                    // if null, use delete method for optional primitives \r
+                    if (value == null) {\r
+                        target.deleteShowSequenceFeatures();\r
+                        return;\r
+                    }\r
+                    target.setShowSequenceFeatures( ((java.lang.Boolean)value).booleanValue());\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _showSequenceFeatures\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            BooleanValidator typeValidator = new BooleanValidator();\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _showAnnotation\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_showAnnotation", "showAnnotation", org.exolab.castor.xml.NodeType.Attribute);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Viewport target = (Viewport) object;\r
+                if(!target.hasShowAnnotation())\r
+                    return null;\r
+                return (target.getShowAnnotation() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Viewport target = (Viewport) object;\r
+                    // if null, use delete method for optional primitives \r
+                    if (value == null) {\r
+                        target.deleteShowAnnotation();\r
+                        return;\r
+                    }\r
+                    target.setShowAnnotation( ((java.lang.Boolean)value).booleanValue());\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _showAnnotation\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            BooleanValidator typeValidator = new BooleanValidator();\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _showConservation\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_showConservation", "showConservation", org.exolab.castor.xml.NodeType.Attribute);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Viewport target = (Viewport) object;\r
+                if(!target.hasShowConservation())\r
+                    return null;\r
+                return (target.getShowConservation() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Viewport target = (Viewport) object;\r
+                    // if null, use delete method for optional primitives \r
+                    if (value == null) {\r
+                        target.deleteShowConservation();\r
+                        return;\r
+                    }\r
+                    target.setShowConservation( ((java.lang.Boolean)value).booleanValue());\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _showConservation\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            BooleanValidator typeValidator = new BooleanValidator();\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _showQuality\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_showQuality", "showQuality", org.exolab.castor.xml.NodeType.Attribute);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Viewport target = (Viewport) object;\r
+                if(!target.hasShowQuality())\r
+                    return null;\r
+                return (target.getShowQuality() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Viewport target = (Viewport) object;\r
+                    // if null, use delete method for optional primitives \r
+                    if (value == null) {\r
+                        target.deleteShowQuality();\r
+                        return;\r
+                    }\r
+                    target.setShowQuality( ((java.lang.Boolean)value).booleanValue());\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _showQuality\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            BooleanValidator typeValidator = new BooleanValidator();\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _showIdentity\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_showIdentity", "showIdentity", org.exolab.castor.xml.NodeType.Attribute);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Viewport target = (Viewport) object;\r
+                if(!target.hasShowIdentity())\r
+                    return null;\r
+                return (target.getShowIdentity() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Viewport target = (Viewport) object;\r
+                    // if null, use delete method for optional primitives \r
+                    if (value == null) {\r
+                        target.deleteShowIdentity();\r
+                        return;\r
+                    }\r
+                    target.setShowIdentity( ((java.lang.Boolean)value).booleanValue());\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _showIdentity\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            BooleanValidator typeValidator = new BooleanValidator();\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _xpos\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_xpos", "xpos", org.exolab.castor.xml.NodeType.Attribute);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Viewport target = (Viewport) object;\r
+                if(!target.hasXpos())\r
+                    return null;\r
+                return new java.lang.Integer(target.getXpos());\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Viewport target = (Viewport) object;\r
+                    // if null, use delete method for optional primitives \r
+                    if (value == null) {\r
+                        target.deleteXpos();\r
+                        return;\r
+                    }\r
+                    target.setXpos( ((java.lang.Integer)value).intValue());\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _xpos\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            IntegerValidator typeValidator= new IntegerValidator();\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _ypos\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_ypos", "ypos", org.exolab.castor.xml.NodeType.Attribute);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Viewport target = (Viewport) object;\r
+                if(!target.hasYpos())\r
+                    return null;\r
+                return new java.lang.Integer(target.getYpos());\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Viewport target = (Viewport) object;\r
+                    // if null, use delete method for optional primitives \r
+                    if (value == null) {\r
+                        target.deleteYpos();\r
+                        return;\r
+                    }\r
+                    target.setYpos( ((java.lang.Integer)value).intValue());\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _ypos\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            IntegerValidator typeValidator= new IntegerValidator();\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _width\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_width", "width", org.exolab.castor.xml.NodeType.Attribute);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Viewport target = (Viewport) object;\r
+                if(!target.hasWidth())\r
+                    return null;\r
+                return new java.lang.Integer(target.getWidth());\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Viewport target = (Viewport) object;\r
+                    // if null, use delete method for optional primitives \r
+                    if (value == null) {\r
+                        target.deleteWidth();\r
+                        return;\r
+                    }\r
+                    target.setWidth( ((java.lang.Integer)value).intValue());\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _width\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            IntegerValidator typeValidator= new IntegerValidator();\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _height\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_height", "height", org.exolab.castor.xml.NodeType.Attribute);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Viewport target = (Viewport) object;\r
+                if(!target.hasHeight())\r
+                    return null;\r
+                return new java.lang.Integer(target.getHeight());\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Viewport target = (Viewport) object;\r
+                    // if null, use delete method for optional primitives \r
+                    if (value == null) {\r
+                        target.deleteHeight();\r
+                        return;\r
+                    }\r
+                    target.setHeight( ((java.lang.Integer)value).intValue());\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _height\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            IntegerValidator typeValidator= new IntegerValidator();\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _startRes\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_startRes", "startRes", org.exolab.castor.xml.NodeType.Attribute);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Viewport target = (Viewport) object;\r
+                if(!target.hasStartRes())\r
+                    return null;\r
+                return new java.lang.Integer(target.getStartRes());\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Viewport target = (Viewport) object;\r
+                    // if null, use delete method for optional primitives \r
+                    if (value == null) {\r
+                        target.deleteStartRes();\r
+                        return;\r
+                    }\r
+                    target.setStartRes( ((java.lang.Integer)value).intValue());\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _startRes\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            IntegerValidator typeValidator= new IntegerValidator();\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _startSeq\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_startSeq", "startSeq", org.exolab.castor.xml.NodeType.Attribute);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Viewport target = (Viewport) object;\r
+                if(!target.hasStartSeq())\r
+                    return null;\r
+                return new java.lang.Integer(target.getStartSeq());\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Viewport target = (Viewport) object;\r
+                    // if null, use delete method for optional primitives \r
+                    if (value == null) {\r
+                        target.deleteStartSeq();\r
+                        return;\r
+                    }\r
+                    target.setStartSeq( ((java.lang.Integer)value).intValue());\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _startSeq\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            IntegerValidator typeValidator= new IntegerValidator();\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _fontName\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_fontName", "fontName", org.exolab.castor.xml.NodeType.Attribute);\r
+        desc.setImmutable(true);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Viewport target = (Viewport) object;\r
+                return target.getFontName();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Viewport target = (Viewport) object;\r
+                    target.setFontName( (java.lang.String) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _fontName\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            StringValidator typeValidator = new StringValidator();\r
+            typeValidator.setWhiteSpace("preserve");\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _fontSize\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_fontSize", "fontSize", org.exolab.castor.xml.NodeType.Attribute);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Viewport target = (Viewport) object;\r
+                if(!target.hasFontSize())\r
+                    return null;\r
+                return new java.lang.Integer(target.getFontSize());\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Viewport target = (Viewport) object;\r
+                    // if null, use delete method for optional primitives \r
+                    if (value == null) {\r
+                        target.deleteFontSize();\r
+                        return;\r
+                    }\r
+                    target.setFontSize( ((java.lang.Integer)value).intValue());\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _fontSize\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            IntegerValidator typeValidator= new IntegerValidator();\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _fontStyle\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_fontStyle", "fontStyle", org.exolab.castor.xml.NodeType.Attribute);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Viewport target = (Viewport) object;\r
+                if(!target.hasFontStyle())\r
+                    return null;\r
+                return new java.lang.Integer(target.getFontStyle());\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Viewport target = (Viewport) object;\r
+                    // if null, use delete method for optional primitives \r
+                    if (value == null) {\r
+                        target.deleteFontStyle();\r
+                        return;\r
+                    }\r
+                    target.setFontStyle( ((java.lang.Integer)value).intValue());\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return null;\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _fontStyle\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+            IntegerValidator typeValidator= new IntegerValidator();\r
+            fieldValidator.setValidator(typeValidator);\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- initialize element descriptors\r
+        \r
+        //-- _annotationColours\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(jalview.schemabinding.version2.AnnotationColours.class, "_annotationColours", "AnnotationColours", org.exolab.castor.xml.NodeType.Element);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Viewport target = (Viewport) object;\r
+                return target.getAnnotationColours();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Viewport target = (Viewport) object;\r
+                    target.setAnnotationColours( (jalview.schemabinding.version2.AnnotationColours) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return new jalview.schemabinding.version2.AnnotationColours();\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        desc.setNameSpaceURI("www.jalview.org");\r
+        desc.setMultivalued(false);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _annotationColours\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        { //-- local scope\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+        //-- _hiddenColumnsList\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(jalview.schemabinding.version2.HiddenColumns.class, "_hiddenColumnsList", "hiddenColumns", org.exolab.castor.xml.NodeType.Element);\r
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {\r
+            public java.lang.Object getValue( java.lang.Object object ) \r
+                throws IllegalStateException\r
+            {\r
+                Viewport target = (Viewport) object;\r
+                return target.getHiddenColumns();\r
+            }\r
+            public void setValue( java.lang.Object object, java.lang.Object value) \r
+                throws IllegalStateException, IllegalArgumentException\r
+            {\r
+                try {\r
+                    Viewport target = (Viewport) object;\r
+                    target.addHiddenColumns( (jalview.schemabinding.version2.HiddenColumns) value);\r
+                }\r
+                catch (java.lang.Exception ex) {\r
+                    throw new IllegalStateException(ex.toString());\r
+                }\r
+            }\r
+            public java.lang.Object newInstance( java.lang.Object parent ) {\r
+                return new jalview.schemabinding.version2.HiddenColumns();\r
+            }\r
+        } );\r
+        desc.setHandler(handler);\r
+        desc.setNameSpaceURI("www.jalview.org");\r
+        desc.setMultivalued(true);\r
+        addFieldDescriptor(desc);\r
+        \r
+        //-- validation code for: _hiddenColumnsList\r
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();\r
+        fieldValidator.setMinOccurs(0);\r
+        { //-- local scope\r
+        }\r
+        desc.setValidator(fieldValidator);\r
+    } //-- jalview.schemabinding.version2.ViewportDescriptor()\r
+\r
+\r
+      //-----------/\r
+     //- Methods -/\r
+    //-----------/\r
+\r
+    /**\r
+     * Method getAccessMode\r
+     * \r
+     * \r
+     * \r
+     * @return AccessMode\r
+     */\r
+    public org.exolab.castor.mapping.AccessMode getAccessMode()\r
+    {\r
+        return null;\r
+    } //-- org.exolab.castor.mapping.AccessMode getAccessMode() \r
+\r
+    /**\r
+     * Method getExtends\r
+     * \r
+     * \r
+     * \r
+     * @return ClassDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.ClassDescriptor getExtends()\r
+    {\r
+        return null;\r
+    } //-- org.exolab.castor.mapping.ClassDescriptor getExtends() \r
+\r
+    /**\r
+     * Method getIdentity\r
+     * \r
+     * \r
+     * \r
+     * @return FieldDescriptor\r
+     */\r
+    public org.exolab.castor.mapping.FieldDescriptor getIdentity()\r
+    {\r
+        return identity;\r
+    } //-- org.exolab.castor.mapping.FieldDescriptor getIdentity() \r
+\r
+    /**\r
+     * Method getJavaClass\r
+     * \r
+     * \r
+     * \r
+     * @return Class\r
+     */\r
+    public java.lang.Class getJavaClass()\r
+    {\r
+        return jalview.schemabinding.version2.Viewport.class;\r
+    } //-- java.lang.Class getJavaClass() \r
+\r
+    /**\r
+     * Method getNameSpacePrefix\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpacePrefix()\r
+    {\r
+        return nsPrefix;\r
+    } //-- java.lang.String getNameSpacePrefix() \r
+\r
+    /**\r
+     * Method getNameSpaceURI\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getNameSpaceURI()\r
+    {\r
+        return nsURI;\r
+    } //-- java.lang.String getNameSpaceURI() \r
+\r
+    /**\r
+     * Method getValidator\r
+     * \r
+     * \r
+     * \r
+     * @return TypeValidator\r
+     */\r
+    public org.exolab.castor.xml.TypeValidator getValidator()\r
+    {\r
+        return this;\r
+    } //-- org.exolab.castor.xml.TypeValidator getValidator() \r
+\r
+    /**\r
+     * Method getXMLName\r
+     * \r
+     * \r
+     * \r
+     * @return String\r
+     */\r
+    public java.lang.String getXMLName()\r
+    {\r
+        return xmlName;\r
+    } //-- java.lang.String getXMLName() \r
+\r
+}\r
diff --git a/src/jalview/util/ShiftList.java b/src/jalview/util/ShiftList.java
new file mode 100644 (file)
index 0000000..bcd8e7c
--- /dev/null
@@ -0,0 +1,119 @@
+/*\r
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2006 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
+ */\r
+package jalview.util;\r
+\r
+import jalview.datamodel.SequenceI;\r
+\r
+import java.util.*;\r
+\r
+/**\r
+ * ShiftList\r
+ * Simple way of mapping a linear series to a new linear range with new points introduced.\r
+ * Use at your own risk!\r
+ * Now growing to be used for interval ranges (position, offset) storing deletions/insertions\r
+ */\r
+public class ShiftList\r
+{\r
+    public Vector shifts;\r
+  public ShiftList()\r
+  {\r
+    shifts = new Vector();\r
+  }\r
+\r
+  /**\r
+   * addShift\r
+   * @param pos start position for shift (in original reference frame)\r
+   * @param shift length of shift\r
+   */\r
+  public void addShift(int pos, int shift)\r
+  {\r
+    int sidx = 0;\r
+    int[] rshift=null;\r
+    while (sidx<shifts.size() && (rshift=(int[]) shifts.elementAt(sidx))[0]<pos)\r
+      sidx++;\r
+    if (sidx==shifts.size())\r
+      shifts.insertElementAt(new int[] { pos, shift}, sidx);\r
+    else\r
+      rshift[1]+=shift;\r
+  }\r
+\r
+  /**\r
+   * shift\r
+   *\r
+   * @param pos int\r
+   * @return int shifted position\r
+   */\r
+  public int shift(int pos)\r
+  {\r
+    if (shifts.size()==0)\r
+      return pos;\r
+    int shifted=pos;\r
+    int sidx=0;\r
+    int rshift[];\r
+    while (sidx<shifts.size()\r
+           &&\r
+           (rshift=((int[]) shifts.elementAt(sidx++)))[0]<=pos) {\r
+      shifted += rshift[1];\r
+    }\r
+    return shifted;\r
+  }\r
+\r
+  /**\r
+   * clear all shifts\r
+   */\r
+  public void clear()\r
+  {\r
+    shifts.removeAllElements();\r
+  }\r
+  /**\r
+   * invert the shifts\r
+   * @return ShiftList with inverse shift operations\r
+   */\r
+  public ShiftList getInverse() {\r
+    ShiftList inverse=new ShiftList();\r
+    if (shifts!=null) {\r
+      for (int i=0,j=shifts.size(); i<j; i++) {\r
+        int[] sh=(int[]) shifts.elementAt(i);\r
+        if (sh!=null)\r
+          inverse.shifts.addElement(new int[] {sh[0], -sh[1]});\r
+      }\r
+    }\r
+    return inverse;\r
+  }\r
+\r
+  /**\r
+   * parse a 1d map of position 1<i<n to L<pos[i]<N\r
+   * such as that returned from SequenceI.gapMap()\r
+   * @param gapMap\r
+   * @return shifts from map index to mapped position\r
+   */\r
+  public static ShiftList parseMap(int[] gapMap) {\r
+    ShiftList shiftList = null;\r
+    if (gapMap!=null && gapMap.length>0) {\r
+      shiftList=new ShiftList();\r
+      for (int i=0,p=0; i<gapMap.length; p++,i++) {\r
+        if (p!=gapMap[i]) {\r
+          shiftList.addShift(p, gapMap[i]-p);\r
+          p=gapMap[i];\r
+        }\r
+      }\r
+    }\r
+    return shiftList;\r
+  }\r
+}\r
diff --git a/src/jalview/util/TableSorter.java b/src/jalview/util/TableSorter.java
new file mode 100755 (executable)
index 0000000..c03e804
--- /dev/null
@@ -0,0 +1,501 @@
+/*\r
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2006 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
+ */\r
+package jalview.util;\r
+\r
+import java.awt.*;\r
+import java.awt.event.*;\r
+import java.util.*;\r
+import java.util.List;\r
+\r
+import javax.swing.*;\r
+import javax.swing.event.TableModelEvent;\r
+import javax.swing.event.TableModelListener;\r
+import javax.swing.table.*;\r
+\r
+/**\r
+ * TableSorter is a decorator for TableModels; adding sorting\r
+ * functionality to a supplied TableModel. TableSorter does\r
+ * not store or copy the data in its TableModel; instead it maintains\r
+ * a map from the row indexes of the view to the row indexes of the\r
+ * model. As requests are made of the sorter (like getValueAt(row, col))\r
+ * they are passed to the underlying model after the row numbers\r
+ * have been translated via the internal mapping array. This way,\r
+ * the TableSorter appears to hold another copy of the table\r
+ * with the rows in a different order.\r
+ * <p/>\r
+ * TableSorter registers itself as a listener to the underlying model,\r
+ * just as the JTable itself would. Events recieved from the model\r
+ * are examined, sometimes manipulated (typically widened), and then\r
+ * passed on to the TableSorter's listeners (typically the JTable).\r
+ * If a change to the model has invalidated the order of TableSorter's\r
+ * rows, a note of this is made and the sorter will resort the\r
+ * rows the next time a value is requested.\r
+ * <p/>\r
+ * When the tableHeader property is set, either by using the\r
+ * setTableHeader() method or the two argument constructor, the\r
+ * table header may be used as a complete UI for TableSorter.\r
+ * The default renderer of the tableHeader is decorated with a renderer\r
+ * that indicates the sorting status of each column. In addition,\r
+ * a mouse listener is installed with the following behavior:\r
+ * <ul>\r
+ * <li>\r
+ * Mouse-click: Clears the sorting status of all other columns\r
+ * and advances the sorting status of that column through three\r
+ * values: {NOT_SORTED, ASCENDING, DESCENDING} (then back to\r
+ * NOT_SORTED again).\r
+ * <li>\r
+ * SHIFT-mouse-click: Clears the sorting status of all other columns\r
+ * and cycles the sorting status of the column through the same\r
+ * three values, in the opposite order: {NOT_SORTED, DESCENDING, ASCENDING}.\r
+ * <li>\r
+ * CONTROL-mouse-click and CONTROL-SHIFT-mouse-click: as above except\r
+ * that the changes to the column do not cancel the statuses of columns\r
+ * that are already sorting - giving a way to initiate a compound\r
+ * sort.\r
+ * </ul>\r
+ * <p/>\r
+ * This is a long overdue rewrite of a class of the same name that\r
+ * first appeared in the swing table demos in 1997.\r
+ *\r
+ * @author Philip Milne\r
+ * @author Brendon McLean\r
+ * @author Dan van Enckevort\r
+ * @author Parwinder Sekhon\r
+ * @version 2.0 02/27/04\r
+ */\r
+\r
+public class TableSorter extends AbstractTableModel {\r
+    protected TableModel tableModel;\r
+\r
+    public static final int DESCENDING = -1;\r
+    public static final int NOT_SORTED = 0;\r
+    public static final int ASCENDING = 1;\r
+\r
+    private static Directive EMPTY_DIRECTIVE = new Directive(-1, NOT_SORTED);\r
+\r
+    public static final Comparator COMPARABLE_COMAPRATOR = new Comparator() {\r
+        public int compare(Object o1, Object o2) {\r
+            return ((Comparable) o1).compareTo(o2);\r
+        }\r
+    };\r
+    public static final Comparator LEXICAL_COMPARATOR = new Comparator() {\r
+        public int compare(Object o1, Object o2) {\r
+            return o1.toString().compareTo(o2.toString());\r
+        }\r
+    };\r
+\r
+    private Row[] viewToModel;\r
+    private int[] modelToView;\r
+\r
+    private JTableHeader tableHeader;\r
+    private MouseListener mouseListener;\r
+    private TableModelListener tableModelListener;\r
+    private Map columnComparators = new HashMap();\r
+    private List sortingColumns = new ArrayList();\r
+\r
+    public TableSorter() {\r
+        this.mouseListener = new MouseHandler();\r
+        this.tableModelListener = new TableModelHandler();\r
+    }\r
+\r
+    public TableSorter(TableModel tableModel) {\r
+        this();\r
+        setTableModel(tableModel);\r
+    }\r
+\r
+    public TableSorter(TableModel tableModel, JTableHeader tableHeader) {\r
+        this();\r
+        setTableHeader(tableHeader);\r
+        setTableModel(tableModel);\r
+    }\r
+\r
+    private void clearSortingState() {\r
+        viewToModel = null;\r
+        modelToView = null;\r
+    }\r
+\r
+    public TableModel getTableModel() {\r
+        return tableModel;\r
+    }\r
+\r
+    public void setTableModel(TableModel tableModel) {\r
+        if (this.tableModel != null) {\r
+            this.tableModel.removeTableModelListener(tableModelListener);\r
+        }\r
+\r
+        this.tableModel = tableModel;\r
+        if (this.tableModel != null) {\r
+            this.tableModel.addTableModelListener(tableModelListener);\r
+        }\r
+\r
+        clearSortingState();\r
+        fireTableStructureChanged();\r
+    }\r
+\r
+    public JTableHeader getTableHeader() {\r
+        return tableHeader;\r
+    }\r
+\r
+    public void setTableHeader(JTableHeader tableHeader) {\r
+        if (this.tableHeader != null) {\r
+            this.tableHeader.removeMouseListener(mouseListener);\r
+            TableCellRenderer defaultRenderer = this.tableHeader.getDefaultRenderer();\r
+            if (defaultRenderer instanceof SortableHeaderRenderer) {\r
+                this.tableHeader.setDefaultRenderer(((SortableHeaderRenderer) defaultRenderer).tableCellRenderer);\r
+            }\r
+        }\r
+        this.tableHeader = tableHeader;\r
+        if (this.tableHeader != null) {\r
+            this.tableHeader.addMouseListener(mouseListener);\r
+            this.tableHeader.setDefaultRenderer(\r
+                    new SortableHeaderRenderer(this.tableHeader.getDefaultRenderer()));\r
+        }\r
+    }\r
+\r
+    public boolean isSorting() {\r
+        return sortingColumns.size() != 0;\r
+    }\r
+\r
+    private Directive getDirective(int column) {\r
+        for (int i = 0; i < sortingColumns.size(); i++) {\r
+            Directive directive = (Directive)sortingColumns.get(i);\r
+            if (directive.column == column) {\r
+                return directive;\r
+            }\r
+        }\r
+        return EMPTY_DIRECTIVE;\r
+    }\r
+\r
+    public int getSortingStatus(int column) {\r
+        return getDirective(column).direction;\r
+    }\r
+\r
+    private void sortingStatusChanged() {\r
+        clearSortingState();\r
+        fireTableDataChanged();\r
+        if (tableHeader != null) {\r
+            tableHeader.repaint();\r
+        }\r
+    }\r
+\r
+    public void setSortingStatus(int column, int status) {\r
+        Directive directive = getDirective(column);\r
+        if (directive != EMPTY_DIRECTIVE) {\r
+            sortingColumns.remove(directive);\r
+        }\r
+        if (status != NOT_SORTED) {\r
+            sortingColumns.add(new Directive(column, status));\r
+        }\r
+        sortingStatusChanged();\r
+    }\r
+\r
+    protected Icon getHeaderRendererIcon(int column, int size) {\r
+        Directive directive = getDirective(column);\r
+        if (directive == EMPTY_DIRECTIVE) {\r
+            return null;\r
+        }\r
+        return new Arrow(directive.direction == DESCENDING, size, sortingColumns.indexOf(directive));\r
+    }\r
+\r
+    private void cancelSorting() {\r
+        sortingColumns.clear();\r
+        sortingStatusChanged();\r
+    }\r
+\r
+    public void setColumnComparator(Class type, Comparator comparator) {\r
+        if (comparator == null) {\r
+            columnComparators.remove(type);\r
+        } else {\r
+            columnComparators.put(type, comparator);\r
+        }\r
+    }\r
+\r
+    protected Comparator getComparator(int column) {\r
+        Class columnType = tableModel.getColumnClass(column);\r
+        Comparator comparator = (Comparator) columnComparators.get(columnType);\r
+        if (comparator != null) {\r
+            return comparator;\r
+        }\r
+        if (Comparable.class.isAssignableFrom(columnType)) {\r
+            return COMPARABLE_COMAPRATOR;\r
+        }\r
+        return LEXICAL_COMPARATOR;\r
+    }\r
+\r
+    private Row[] getViewToModel() {\r
+        if (viewToModel == null) {\r
+            int tableModelRowCount = tableModel.getRowCount();\r
+            viewToModel = new Row[tableModelRowCount];\r
+            for (int row = 0; row < tableModelRowCount; row++) {\r
+                viewToModel[row] = new Row(row);\r
+            }\r
+\r
+            if (isSorting()) {\r
+                Arrays.sort(viewToModel);\r
+            }\r
+        }\r
+        return viewToModel;\r
+    }\r
+\r
+    public int modelIndex(int viewIndex) {\r
+        return getViewToModel()[viewIndex].modelIndex;\r
+    }\r
+\r
+    private int[] getModelToView() {\r
+        if (modelToView == null) {\r
+            int n = getViewToModel().length;\r
+            modelToView = new int[n];\r
+            for (int i = 0; i < n; i++) {\r
+                modelToView[modelIndex(i)] = i;\r
+            }\r
+        }\r
+        return modelToView;\r
+    }\r
+\r
+    // TableModel interface methods\r
+\r
+    public int getRowCount() {\r
+        return (tableModel == null) ? 0 : tableModel.getRowCount();\r
+    }\r
+\r
+    public int getColumnCount() {\r
+        return (tableModel == null) ? 0 : tableModel.getColumnCount();\r
+    }\r
+\r
+    public String getColumnName(int column) {\r
+        return tableModel.getColumnName(column);\r
+    }\r
+\r
+    public Class getColumnClass(int column) {\r
+        return tableModel.getColumnClass(column);\r
+    }\r
+\r
+    public boolean isCellEditable(int row, int column) {\r
+        return tableModel.isCellEditable(modelIndex(row), column);\r
+    }\r
+\r
+    public Object getValueAt(int row, int column) {\r
+        return tableModel.getValueAt(modelIndex(row), column);\r
+    }\r
+\r
+    public void setValueAt(Object aValue, int row, int column) {\r
+        tableModel.setValueAt(aValue, modelIndex(row), column);\r
+    }\r
+\r
+    // Helper classes\r
+\r
+    private class Row implements Comparable {\r
+        private int modelIndex;\r
+\r
+        public Row(int index) {\r
+            this.modelIndex = index;\r
+        }\r
+\r
+        public int compareTo(Object o) {\r
+            int row1 = modelIndex;\r
+            int row2 = ((Row) o).modelIndex;\r
+\r
+            for (Iterator it = sortingColumns.iterator(); it.hasNext();) {\r
+                Directive directive = (Directive) it.next();\r
+                int column = directive.column;\r
+                Object o1 = tableModel.getValueAt(row1, column);\r
+                Object o2 = tableModel.getValueAt(row2, column);\r
+\r
+                int comparison = 0;\r
+                // Define null less than everything, except null.\r
+                if (o1 == null && o2 == null) {\r
+                    comparison = 0;\r
+                } else if (o1 == null) {\r
+                    comparison = -1;\r
+                } else if (o2 == null) {\r
+                    comparison = 1;\r
+                } else {\r
+                    comparison = getComparator(column).compare(o1, o2);\r
+                }\r
+                if (comparison != 0) {\r
+                    return directive.direction == DESCENDING ? -comparison : comparison;\r
+                }\r
+            }\r
+            return 0;\r
+        }\r
+    }\r
+\r
+    private class TableModelHandler implements TableModelListener {\r
+        public void tableChanged(TableModelEvent e) {\r
+            // If we're not sorting by anything, just pass the event along.\r
+            if (!isSorting()) {\r
+                clearSortingState();\r
+                fireTableChanged(e);\r
+                return;\r
+            }\r
+\r
+            // If the table structure has changed, cancel the sorting; the\r
+            // sorting columns may have been either moved or deleted from\r
+            // the model.\r
+            if (e.getFirstRow() == TableModelEvent.HEADER_ROW) {\r
+                cancelSorting();\r
+                fireTableChanged(e);\r
+                return;\r
+            }\r
+\r
+            // We can map a cell event through to the view without widening\r
+            // when the following conditions apply:\r
+            //\r
+            // a) all the changes are on one row (e.getFirstRow() == e.getLastRow()) and,\r
+            // b) all the changes are in one column (column != TableModelEvent.ALL_COLUMNS) and,\r
+            // c) we are not sorting on that column (getSortingStatus(column) == NOT_SORTED) and,\r
+            // d) a reverse lookup will not trigger a sort (modelToView != null)\r
+            //\r
+            // Note: INSERT and DELETE events fail this test as they have column == ALL_COLUMNS.\r
+            //\r
+            // The last check, for (modelToView != null) is to see if modelToView\r
+            // is already allocated. If we don't do this check; sorting can become\r
+            // a performance bottleneck for applications where cells\r
+            // change rapidly in different parts of the table. If cells\r
+            // change alternately in the sorting column and then outside of\r
+            // it this class can end up re-sorting on alternate cell updates -\r
+            // which can be a performance problem for large tables. The last\r
+            // clause avoids this problem.\r
+            int column = e.getColumn();\r
+            if (e.getFirstRow() == e.getLastRow()\r
+                    && column != TableModelEvent.ALL_COLUMNS\r
+                    && getSortingStatus(column) == NOT_SORTED\r
+                    && modelToView != null) {\r
+                int viewIndex = getModelToView()[e.getFirstRow()];\r
+                fireTableChanged(new TableModelEvent(TableSorter.this,\r
+                                                     viewIndex, viewIndex,\r
+                                                     column, e.getType()));\r
+                return;\r
+            }\r
+\r
+            // Something has happened to the data that may have invalidated the row order.\r
+            clearSortingState();\r
+            fireTableDataChanged();\r
+            return;\r
+        }\r
+    }\r
+\r
+    private class MouseHandler extends MouseAdapter {\r
+        public void mouseClicked(MouseEvent e) {\r
+            JTableHeader h = (JTableHeader) e.getSource();\r
+            TableColumnModel columnModel = h.getColumnModel();\r
+            int viewColumn = columnModel.getColumnIndexAtX(e.getX());\r
+            int column = columnModel.getColumn(viewColumn).getModelIndex();\r
+            if (column != -1) {\r
+                int status = getSortingStatus(column);\r
+                if (!e.isControlDown()) {\r
+                    cancelSorting();\r
+                }\r
+                // Cycle the sorting states through {NOT_SORTED, ASCENDING, DESCENDING} or\r
+                // {NOT_SORTED, DESCENDING, ASCENDING} depending on whether shift is pressed.\r
+                status = status + (e.isShiftDown() ? -1 : 1);\r
+                status = (status + 4) % 3 - 1; // signed mod, returning {-1, 0, 1}\r
+                setSortingStatus(column, status);\r
+            }\r
+        }\r
+    }\r
+\r
+    private static class Arrow implements Icon {\r
+        private boolean descending;\r
+        private int size;\r
+        private int priority;\r
+\r
+        public Arrow(boolean descending, int size, int priority) {\r
+            this.descending = descending;\r
+            this.size = size;\r
+            this.priority = priority;\r
+        }\r
+\r
+        public void paintIcon(Component c, Graphics g, int x, int y) {\r
+            Color color = c == null ? Color.GRAY : c.getBackground();\r
+            // In a compound sort, make each succesive triangle 20%\r
+            // smaller than the previous one.\r
+            int dx = (int)(size/2*Math.pow(0.8, priority));\r
+            int dy = descending ? dx : -dx;\r
+            // Align icon (roughly) with font baseline.\r
+            y = y + 5*size/6 + (descending ? -dy : 0);\r
+            int shift = descending ? 1 : -1;\r
+            g.translate(x, y);\r
+\r
+            // Right diagonal.\r
+            g.setColor(color.darker());\r
+            g.drawLine(dx / 2, dy, 0, 0);\r
+            g.drawLine(dx / 2, dy + shift, 0, shift);\r
+\r
+            // Left diagonal.\r
+            g.setColor(color.brighter());\r
+            g.drawLine(dx / 2, dy, dx, 0);\r
+            g.drawLine(dx / 2, dy + shift, dx, shift);\r
+\r
+            // Horizontal line.\r
+            if (descending) {\r
+                g.setColor(color.darker().darker());\r
+            } else {\r
+                g.setColor(color.brighter().brighter());\r
+            }\r
+            g.drawLine(dx, 0, 0, 0);\r
+\r
+            g.setColor(color);\r
+            g.translate(-x, -y);\r
+        }\r
+\r
+        public int getIconWidth() {\r
+            return size;\r
+        }\r
+\r
+        public int getIconHeight() {\r
+            return size;\r
+        }\r
+    }\r
+\r
+    private class SortableHeaderRenderer implements TableCellRenderer {\r
+        private TableCellRenderer tableCellRenderer;\r
+\r
+        public SortableHeaderRenderer(TableCellRenderer tableCellRenderer) {\r
+            this.tableCellRenderer = tableCellRenderer;\r
+        }\r
+\r
+        public Component getTableCellRendererComponent(JTable table,\r
+                                                       Object value,\r
+                                                       boolean isSelected,\r
+                                                       boolean hasFocus,\r
+                                                       int row,\r
+                                                       int column) {\r
+            Component c = tableCellRenderer.getTableCellRendererComponent(table,\r
+                    value, isSelected, hasFocus, row, column);\r
+            if (c instanceof JLabel) {\r
+                JLabel l = (JLabel) c;\r
+                l.setHorizontalTextPosition(JLabel.LEFT);\r
+                int modelColumn = table.convertColumnIndexToModel(column);\r
+                l.setIcon(getHeaderRendererIcon(modelColumn, l.getFont().getSize()));\r
+            }\r
+            return c;\r
+        }\r
+    }\r
+\r
+    private static class Directive {\r
+        private int column;\r
+        private int direction;\r
+\r
+        public Directive(int column, int direction) {\r
+            this.column = column;\r
+            this.direction = direction;\r
+        }\r
+    }\r
+}\r
diff --git a/src/jalview/ws/MsaWSThread.java b/src/jalview/ws/MsaWSThread.java
new file mode 100644 (file)
index 0000000..fb82808
--- /dev/null
@@ -0,0 +1,695 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer
+ * Copyright (C) 2006 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
+ */
+package jalview.ws;
+
+import java.util.*;
+
+import jalview.analysis.*;
+import jalview.bin.*;
+import jalview.datamodel.*;
+import jalview.datamodel.Alignment;
+import jalview.datamodel.Sequence;
+import jalview.gui.*;
+import vamsas.objects.simple.MsaResult;
+
+/**
+ * <p>
+ * Title:
+ * </p>
+ *
+ * <p>
+ * Description:
+ * </p>
+ *
+ * <p>
+ * Copyright: Copyright (c) 2004
+ * </p>
+ *
+ * <p>
+ * Company: Dundee University
+ * </p>
+ *
+ * @author not attributable
+ * @version 1.0
+ */
+class MsaWSThread
+    extends WSThread implements WSClientI
+{
+  boolean submitGaps = false; // pass sequences including gaps to alignment
+
+  // service
+
+  boolean preserveOrder = true; // and always store and recover sequence
+
+  // order
+
+  class MsaWSJob extends WSThread.WSJob
+  {
+    // hold special input for this
+    vamsas.objects.simple.SequenceSet seqs = new vamsas.objects.simple.
+        SequenceSet();
+
+    /**
+     * MsaWSJob
+     *
+     * @param jobNum
+     *            int
+     * @param jobId
+     *            String
+     */
+    public MsaWSJob(int jobNum, SequenceI[] inSeqs)
+    {
+      this.jobnum = jobNum;
+      if (!prepareInput(inSeqs, 2))
+      {
+        submitted = true;
+        subjobComplete = true;
+        result = new MsaResult();
+        result.setFinished(true);
+        result.setStatus("Job never ran - input returned to user.");
+      }
+
+    }
+
+    Hashtable SeqNames = new Hashtable();
+    Vector emptySeqs = new Vector();
+    /**
+     * prepare input sequences for MsaWS service
+     * @param seqs jalview sequences to be prepared
+     * @param minlen minimum number of residues required for this MsaWS service
+     * @return true if seqs contains sequences to be submitted to service.
+     */
+    private boolean prepareInput(SequenceI[] seqs, int minlen)
+    {
+      int nseqs = 0;
+      if (minlen < 0)
+      {
+        throw new Error("Implementation error: minlen must be zero or more.");
+      }
+      for (int i = 0; i < seqs.length; i++)
+      {
+        if (seqs[i].getEnd() - seqs[i].getStart() > minlen - 1)
+        {
+          nseqs++;
+        }
+      }
+      boolean valid = nseqs > 1; // need at least two seqs
+      vamsas.objects.simple.Sequence[] seqarray =
+          (valid)
+          ? new vamsas.objects.simple.Sequence[nseqs]
+          : null;
+      for (int i = 0, n = 0; i < seqs.length; i++)
+      {
+
+        String newname = jalview.analysis.SeqsetUtils.unique_name(i); // same
+        // for
+        // any
+        // subjob
+        SeqNames.put(newname, jalview.analysis.SeqsetUtils
+                     .SeqCharacterHash(seqs[i]));
+        if (valid && seqs[i].getEnd() - seqs[i].getStart() > minlen - 1)
+        {
+          seqarray[n] = new vamsas.objects.simple.Sequence();
+          seqarray[n].setId(newname);
+          seqarray[n++].setSeq( (submitGaps) ? seqs[i].getSequence()
+                               : AlignSeq.extractGaps(
+                                   jalview.util.Comparison.GapChars, seqs[i]
+                                   .getSequence()));
+        }
+        else
+        {
+          String empty = null;
+          if (seqs[i].getEnd() >= seqs[i].getStart())
+          {
+            empty = (submitGaps) ? seqs[i].getSequence()
+                : AlignSeq.extractGaps(
+                    jalview.util.Comparison.GapChars, seqs[i]
+                    .getSequence());
+          }
+          emptySeqs.add(new String[]
+                        {newname, empty});
+        }
+      }
+      this.seqs = new vamsas.objects.simple.SequenceSet();
+      this.seqs.setSeqs(seqarray);
+      return valid;
+    }
+
+    /**
+     *
+     * @return true if getAlignment will return a valid alignment result.
+     */
+    public boolean hasResults()
+    {
+      if (subjobComplete && result != null && result.isFinished()
+          && ((MsaResult) result).getMsa() != null && ((MsaResult) result).getMsa().getSeqs() != null)
+      {
+        return true;
+      }
+      return false;
+    }
+
+    public Object[] getAlignment()
+    {
+
+      if (result != null && result.isFinished())
+      {
+        SequenceI[] alseqs = null;
+        char alseq_gapchar = '-';
+        int alseq_l = 0;
+        if (((MsaResult) result).getMsa() != null)
+        {
+          alseqs = getVamsasAlignment(((MsaResult) result).getMsa());
+          alseq_gapchar = ((MsaResult) result).getMsa().getGapchar().charAt(0);
+          alseq_l = alseqs.length;
+        }
+        if (emptySeqs.size() > 0)
+        {
+          SequenceI[] t_alseqs = new SequenceI[alseq_l + emptySeqs.size()];
+          // get width
+          int i, w = 0;
+          if (alseq_l > 0)
+          {
+            for (i = 0, w = alseqs[0].getLength(); i < alseq_l; i++)
+            {
+              if (w < alseqs[i].getLength())
+              {
+                w = alseqs[i].getLength();
+              }
+              t_alseqs[i] = alseqs[i];
+              alseqs[i] = null;
+            }
+          }
+          // check that aligned width is at least as wide as emptySeqs width.
+          int ow = w, nw = w;
+          for (i = 0, w = emptySeqs.size(); i < w; i++)
+          {
+            String[] es = (String[]) emptySeqs.get(i);
+            if (es != null && es[1] != null)
+            {
+              int sw = es[1].length();
+              if (nw < sw)
+              {
+                nw = sw;
+              }
+            }
+          }
+          // make a gapped string.
+          StringBuffer insbuff = new StringBuffer(w);
+          for (i = 0; i < nw; i++)
+          {
+            insbuff.append(alseq_gapchar);
+          }
+          if (ow < nw)
+          {
+            for (i = 0; i < alseq_l; i++)
+            {
+              int sw = t_alseqs[i].getLength();
+              if (nw > sw)
+              {
+                // pad at end
+                alseqs[i].setSequence(t_alseqs[i].getSequence() +
+                                      insbuff.substring(0, sw - nw));
+              }
+            }
+          }
+          for (i = 0, w = emptySeqs.size(); i < w; i++)
+          {
+            String[] es = (String[]) emptySeqs.get(i);
+            if (es[1] == null)
+            {
+              t_alseqs[i +
+                  alseq_l] = new jalview.datamodel.Sequence(es[0],
+                  insbuff.toString(), 1, 0);
+            }
+            else
+            {
+              if (es[1].length() < nw)
+              {
+                t_alseqs[i +
+                    alseq_l] = new jalview.datamodel.Sequence(es[0],
+                    es[1] + insbuff.substring(0, nw - es[1].length()), 1,
+                    1 + es[1].length());
+              }
+              else
+              {
+                t_alseqs[i +
+                    alseq_l] = new jalview.datamodel.Sequence(es[0], es[1]);
+              }
+            }
+          }
+          alseqs = t_alseqs;
+        }
+        AlignmentOrder msaorder = new AlignmentOrder(alseqs);
+        // always recover the order - makes parseResult()'s life easier.
+        jalview.analysis.AlignmentSorter.recoverOrder(alseqs);
+        // account for any missing sequences
+        jalview.analysis.SeqsetUtils.deuniquify(SeqNames, alseqs);
+        return new Object[]
+            {
+            alseqs, msaorder};
+      }
+      return null;
+    }
+    /**
+     * mark subjob as cancelled and set result object appropriatly
+     */
+    void cancel() {
+      cancelled=true;
+      subjobComplete = true;
+      result = null;
+    }
+    /**
+     *
+     * @return boolean true if job can be submitted.
+     */
+    boolean hasValidInput() {
+      if (seqs.getSeqs()!=null)
+        return true;
+      return false;
+    }
+  }
+
+
+  String alTitle; // name which will be used to form new alignment window.
+  Alignment dataset; // dataset to which the new alignment will be
+
+  // associated.
+
+  ext.vamsas.MuscleWS server = null;
+  /**
+   * set basic options for this (group) of Msa jobs
+   *
+   * @param subgaps
+   *            boolean
+   * @param presorder
+   *            boolean
+   */
+  MsaWSThread(ext.vamsas.MuscleWS server, String wsUrl,
+              WebserviceInfo wsinfo, jalview.gui.AlignFrame alFrame,
+              AlignmentView alview,
+              String wsname, boolean subgaps, boolean presorder)
+  {
+    this.server = server;
+    this.WsUrl = wsUrl;
+    this.wsInfo = wsinfo;
+    this.WebServiceName = wsname;
+    this.input = alview;
+    this.submitGaps = subgaps;
+    this.preserveOrder = presorder;
+    this.alignFrame = alFrame;
+  }
+
+  /**
+   * create one or more Msa jobs to align visible seuqences in _msa
+   *
+   * @param title
+   *            String
+   * @param _msa
+   *            AlignmentView
+   * @param subgaps
+   *            boolean
+   * @param presorder
+   *            boolean
+   * @param seqset
+   *            Alignment
+   */
+  MsaWSThread(ext.vamsas.MuscleWS server, String wsUrl,
+              WebserviceInfo wsinfo, jalview.gui.AlignFrame alFrame,
+              String wsname, String title, AlignmentView _msa, boolean subgaps,
+              boolean presorder, Alignment seqset)
+  {
+    this(server, wsUrl, wsinfo, alFrame, _msa, wsname, subgaps, presorder);
+    OutputHeader = wsInfo.getProgressText();
+    alTitle = title;
+    dataset = seqset;
+    SequenceI[][] conmsa = _msa.getVisibleContigs('-');
+    if (conmsa != null)
+    {
+      int njobs = conmsa.length;
+      jobs = new MsaWSJob[njobs];
+      for (int j = 0; j < njobs; j++)
+      {
+        if (j != 0)
+        {
+          jobs[j] = new MsaWSJob(wsinfo.addJobPane(), conmsa[j]);
+        }
+        else
+        {
+          jobs[j] = new MsaWSJob(0, conmsa[j]);
+        }
+        if (njobs > 0)
+          wsinfo.setProgressName("region " + jobs[j].jobnum, jobs[j].jobnum);
+        wsinfo.setProgressText(jobs[j].jobnum, OutputHeader);
+      }
+    }
+  }
+  public boolean isCancellable()
+  {
+    return true;
+  }
+
+  public void cancelJob()
+  {
+    if (!jobComplete && jobs != null)
+    {
+      boolean cancelled = true;
+      for (int job = 0; job < jobs.length; job++)
+      {
+        if (jobs[job].submitted && !jobs[job].subjobComplete)
+        {
+          String cancelledMessage = "";
+          try
+          {
+            vamsas.objects.simple.WsJobId cancelledJob = server
+                .cancel(jobs[job].jobId);
+            if (cancelledJob.getStatus() == 2)
+            {
+              // CANCELLED_JOB
+              cancelledMessage = "Job cancelled.";
+              ((MsaWSJob) jobs[job]).cancel();
+              wsInfo.setStatus(jobs[job].jobnum,
+                               WebserviceInfo.STATE_CANCELLED_OK);
+            }
+            else if (cancelledJob.getStatus() == 3)
+            {
+              // VALID UNSTOPPABLE JOB
+              cancelledMessage +=
+                  "Server cannot cancel this job. just close the window.\n";
+              cancelled = false;
+              // wsInfo.setStatus(jobs[job].jobnum,
+              //                 WebserviceInfo.STATE_RUNNING);
+            }
+
+            if (cancelledJob.getJobId() != null)
+            {
+              cancelledMessage += ("[" + cancelledJob.getJobId() + "]");
+            }
+
+            cancelledMessage += "\n";
+          }
+          catch (Exception exc)
+          {
+            cancelledMessage +=
+                ("\nProblems cancelling the job : Exception received...\n"
+                 + exc + "\n");
+            Cache.log.warn("Exception whilst cancelling "+jobs[job].jobId,exc);
+          }
+          wsInfo.setProgressText(jobs[job].jobnum, OutputHeader
+                                 + cancelledMessage + "\n");
+        }
+      }
+      if (cancelled)
+      {
+        wsInfo.setStatus(WebserviceInfo.STATE_CANCELLED_OK);
+        jobComplete = true;
+      }
+      this.interrupt(); // kick thread to update job states.
+    }
+    else
+    {
+      if (!jobComplete)
+      {
+        wsInfo
+            .setProgressText(OutputHeader
+                             + "Server cannot cancel this job because it has not been submitted properly. just close the window.\n");
+      }
+    }
+  }
+  void pollJob(WSJob job) throws Exception {
+    ((MsaWSJob) job).result = server.getResult(((MsaWSJob) job).jobId);
+  }
+  void StartJob(WSJob job)
+  {
+    if (!(job instanceof MsaWSJob)) {
+      throw new Error("StartJob(MsaWSJob) called on a WSJobInstance "+job.getClass());
+    }
+    MsaWSJob j = (MsaWSJob) job;
+    if (j.submitted)
+    {
+      if (Cache.log.isDebugEnabled())
+      {
+        Cache.log.debug("Tried to submit an already submitted job " + j.jobId);
+      }
+      return;
+    }
+    if (j.seqs.getSeqs() == null)
+    {
+      // special case - selection consisted entirely of empty sequences...
+      j.submitted = true;
+      j.result = new MsaResult();
+      j.result.setFinished(true);
+      j.result.setStatus("Empty Alignment Job");
+      ((MsaResult) j.result).setMsa(null);
+    }
+    try
+    {
+      vamsas.objects.simple.WsJobId jobsubmit = server.align(j.seqs);
+
+      if ( (jobsubmit != null) && (jobsubmit.getStatus() == 1))
+      {
+        j.jobId = jobsubmit.getJobId();
+        j.submitted = true;
+        j.subjobComplete = false;
+        // System.out.println(WsURL + " Job Id '" + jobId + "'");
+      }
+      else
+      {
+        if (jobsubmit == null)
+        {
+          throw new Exception(
+              "Server at "
+              + WsUrl
+              +
+              " returned null object, it probably cannot be contacted. Try again later ?");
+        }
+
+        throw new Exception(jobsubmit.getJobId());
+      }
+    }
+    catch (Exception e)
+    {
+      // TODO: JBPNote catch timeout or other fault types explicitly
+      // For unexpected errors
+      System.err
+          .println(WebServiceName
+                   + "Client: Failed to submit the sequences for alignment (probably a server side problem)\n"
+                   + "When contacting Server:" + WsUrl + "\n"
+                   + e.toString() + "\n");
+      j.allowedServerExceptions = 0;
+      wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_SERVERERROR);
+      wsInfo.setStatus(j.jobnum, WebserviceInfo.STATE_STOPPED_SERVERERROR);
+      wsInfo
+          .appendProgressText(
+              j.jobnum,
+              "Failed to submit sequences for alignment.\n"
+              + "It is most likely that there is a problem with the server.\n"
+              + "Just close the window\n");
+
+      // e.printStackTrace(); // TODO: JBPNote DEBUG
+    }
+  }
+
+  private jalview.datamodel.Sequence[] getVamsasAlignment(
+      vamsas.objects.simple.Alignment valign)
+  {
+    vamsas.objects.simple.Sequence[] seqs = valign.getSeqs().getSeqs();
+    jalview.datamodel.Sequence[] msa = new jalview.datamodel.Sequence[seqs.
+        length];
+
+    for (int i = 0, j = seqs.length; i < j; i++)
+    {
+      msa[i] = new jalview.datamodel.Sequence(seqs[i].getId(), seqs[i]
+                                              .getSeq());
+    }
+
+    return msa;
+  }
+
+  void parseResult()
+  {
+    int results = 0; // number of result sets received
+    JobStateSummary finalState = new JobStateSummary();
+    try
+    {
+      for (int j = 0; j < jobs.length; j++)
+      {
+        finalState.updateJobPanelState(wsInfo, OutputHeader, jobs[j]);
+        if (jobs[j].submitted && jobs[j].subjobComplete && jobs[j].hasResults())
+        {
+          results++;
+          vamsas.objects.simple.Alignment valign = ((MsaResult) jobs[j].result).getMsa();
+          if (valign != null)
+          {
+            wsInfo.appendProgressText(jobs[j].jobnum,
+                                      "\nAlignment Object Method Notes\n");
+            String[] lines = valign.getMethod();
+            for (int line = 0; line < lines.length; line++)
+            {
+              wsInfo.appendProgressText(jobs[j].jobnum, lines[line] + "\n");
+            }
+            // JBPNote The returned files from a webservice could be
+            //  hidden behind icons in the monitor window that,
+            // when clicked, pop up their corresponding data
+          }
+        }
+      }
+    }
+    catch (Exception ex)
+    {
+
+      Cache.log.error("Unexpected exception when processing results for " +
+                      alTitle, ex);
+      wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_ERROR);
+    }
+    if (results > 0)
+    {
+      wsInfo.showResultsNewFrame
+          .addActionListener(new java.awt.event.ActionListener()
+      {
+        public void actionPerformed(
+            java.awt.event.ActionEvent evt)
+        {
+          displayResults(true);
+        }
+      });
+      wsInfo.mergeResults
+          .addActionListener(new java.awt.event.ActionListener()
+      {
+        public void actionPerformed(
+            java.awt.event.ActionEvent evt)
+        {
+          displayResults(false);
+        }
+      });
+      wsInfo.setResultsReady();
+    } else
+      wsInfo.setFinishedNoResults();
+  }
+
+  void displayResults(boolean newFrame)
+  {
+    // view input or result data for each block
+    Vector alorders = new Vector();
+    SequenceI[][] results=new SequenceI[jobs.length][];
+    AlignmentOrder[] orders = new AlignmentOrder[jobs.length];
+    SequenceI[] first=null;
+    for (int j=0; j<jobs.length; j++) {
+      if (jobs[j].hasResults()) {
+        Object[] res = ( (MsaWSJob) jobs[j]).getAlignment();
+        alorders.add(res[1]);
+        results[j] = (SequenceI[]) res[0];
+        orders[j] = (AlignmentOrder) res[1];
+//    SequenceI[] alignment = input.getUpdated
+      } else {
+        results[j]=null;
+      }
+    }
+    Object[] newview = input.getUpdatedView(results, orders, '-');
+    // trash references to original result data
+    for (int j=0; j<jobs.length; j++) {
+      results[j] = null;
+      orders[j] = null;
+    }
+    SequenceI[] alignment = (SequenceI[]) newview[0];
+    ColumnSelection columnselection = (ColumnSelection) newview[1];
+    Alignment al = new Alignment(alignment);
+    if (dataset != null)
+    {
+      al.setDataset(dataset);
+    }
+
+    // JBNote- TODO: warn user if a block is input rather than aligned data ?
+
+    if (newFrame)
+    {
+      AlignFrame af = new AlignFrame(al, columnselection);
+
+      // >>>This is a fix for the moment, until a better solution is
+      // found!!<<<
+      af.getFeatureRenderer().transferSettings(
+          alignFrame.getFeatureRenderer());
+      // update orders
+      if (alorders.size() > 0)
+      {
+        if (alorders.size() == 1)
+        {
+          af.addSortByOrderMenuItem(WebServiceName + " Ordering",
+                                    (AlignmentOrder) alorders.get(0));
+        }
+        else
+        {
+          // construct a non-redundant ordering set
+          Vector names = new Vector();
+          for (int i = 0, l = alorders.size(); i < l; i++)
+          {
+            String orderName = new String(" Region " + i);
+            int j = i + 1;
+            int r = l;
+            while (j < l)
+            {
+              if ( ( (AlignmentOrder) alorders.get(i)).equals( ( (
+                  AlignmentOrder) alorders.get(j))))
+              {
+                alorders.remove(j);
+                l--;
+                orderName += "," + j;
+              }
+              else
+              {
+                j++;
+              }
+            }
+
+            if (i == 0 && j == 1)
+            {
+              names.add(new String(""));
+            }
+            else
+            {
+              names.add(orderName);
+            }
+          }
+          for (int i = 0, l = alorders.size(); i < l; i++)
+          {
+            af.addSortByOrderMenuItem(WebServiceName
+                                      +( (String) names.get(i)) +
+                                      " Ordering",
+                                      (AlignmentOrder) alorders.get(i));
+          }
+        }
+      }
+
+      Desktop.addInternalFrame(af, alTitle,
+                               AlignFrame.NEW_WINDOW_WIDTH,
+                               AlignFrame.NEW_WINDOW_HEIGHT);
+
+    }
+    else
+    {
+      System.out.println("MERGE WITH OLD FRAME");
+
+    }
+  }
+
+  public boolean canMergeResults()
+  {
+    return false;
+  }
+}
diff --git a/src/jalview/ws/WSThread.java b/src/jalview/ws/WSThread.java
new file mode 100644 (file)
index 0000000..86ee49a
--- /dev/null
@@ -0,0 +1,269 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer
+ * Copyright (C) 2006 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
+ */
+ package jalview.ws;
+
+import jalview.gui.AlignFrame;
+import jalview.gui.WebserviceInfo;
+import jalview.datamodel.AlignmentView;
+import jalview.gui.Desktop;
+import javax.swing.JOptionPane;
+import jalview.bin.Cache;
+
+public abstract class WSThread extends Thread
+{
+    /**
+     * Generic properties for Web Service Client threads.
+     */
+    AlignFrame alignFrame=null;
+  WebserviceInfo wsInfo = null;
+  AlignmentView input=null;
+  boolean jobComplete = false;
+  abstract class WSJob {
+      /**
+       * Generic properties for an individual job within a Web Service Client thread
+       */
+    int jobnum = 0; // WebServiceInfo pane for this job
+    String jobId; // ws job ticket
+    boolean cancelled = false;
+    int allowedServerExceptions = 3; // job dies if too many exceptions.
+    boolean submitted = false;
+    boolean subjobComplete = false;
+    /**
+     *
+     * @return true if job has completed and valid results are available
+     */
+    abstract boolean hasResults();
+    /**
+     *
+     * @return boolean true if job can be submitted.
+     */
+    abstract boolean hasValidInput();
+    vamsas.objects.simple.Result result;
+  }
+  class JobStateSummary {
+    int running = 0;
+    int queuing = 0;
+    int finished = 0;
+    int error = 0;
+    int serror = 0;
+    int cancelled = 0;
+    int results = 0;
+    void updateJobPanelState(WebserviceInfo wsInfo, String OutputHeader,
+                             WSJob j)
+    {
+      if (j.result != null)
+      {
+        String progheader = "";
+        // Parse state of job[j]
+        if (j.result.isRunning())
+        {
+          running++;
+          wsInfo.setStatus(j.jobnum, WebserviceInfo.STATE_RUNNING);
+        }
+        else if (j.result.isQueued())
+        {
+          queuing++;
+          wsInfo.setStatus(j.jobnum, WebserviceInfo.STATE_QUEUING);
+        }
+        else if (j.result.isFinished())
+        {
+          finished++;
+          j.subjobComplete = true;
+          if (j.hasResults())
+            results++;
+          wsInfo.setStatus(j.jobnum, WebserviceInfo.STATE_STOPPED_OK);
+        }
+        else if (j.result.isFailed())
+        {
+          progheader += "Job failed.\n";
+          j.subjobComplete = true;
+          wsInfo.setStatus(j.jobnum, WebserviceInfo.STATE_STOPPED_ERROR);
+          error++;
+        }
+        else if (j.result.isServerError())
+        {
+          serror++;
+          j.subjobComplete = true;
+          wsInfo.setStatus(j.jobnum,
+                           WebserviceInfo.STATE_STOPPED_SERVERERROR);
+        }
+        else if (j.result.isBroken() || j.result.isFailed())
+        {
+          error++;
+          j.subjobComplete = true;
+          wsInfo.setStatus(j.jobnum, WebserviceInfo.STATE_STOPPED_ERROR);
+        }
+        // and pass on any sub-job messages to the user
+        wsInfo.setProgressText(j.jobnum, OutputHeader);
+        wsInfo.appendProgressText(j.jobnum, progheader);
+        if (j.result.getStatus() != null)
+        {
+          wsInfo.appendProgressText(j.jobnum, j.result.getStatus());
+        }
+      }
+      else
+      {
+        if (j.submitted && j.subjobComplete)
+        {
+          if (j.allowedServerExceptions == 0)
+          {
+            serror++;
+          }
+          else if (j.result == null)
+          {
+            error++;
+          }
+        }
+      }
+    }
+  }
+
+  WSJob jobs[] = null;
+  String WebServiceName = null;
+  String OutputHeader;
+  String WsUrl = null;
+  abstract void pollJob(WSJob job) throws Exception;
+  public void run()
+  {
+  JobStateSummary jstate=null;
+  if (jobs==null)
+    jobComplete=true;
+  while (!jobComplete)
+  {
+    jstate = new JobStateSummary();
+    for (int j = 0; j < jobs.length; j++)
+    {
+
+      if (!jobs[j].submitted && jobs[j].hasValidInput())
+      {
+        StartJob(jobs[j]);
+      }
+
+      if (jobs[j].submitted && !jobs[j].subjobComplete)
+      {
+        try
+        {
+          pollJob(jobs[j]);
+          if (jobs[j].result == null)
+          {
+            throw (new Exception(
+                "Timed out when communicating with server\nTry again later.\n"));
+          }
+          jalview.bin.Cache.log.debug("Job " + j + " Result state " +
+                                      jobs[j].result.getState()
+                                      + "(ServerError=" +
+                                      jobs[j].result.isServerError() + ")");
+        }
+        catch (Exception ex)
+        {
+          // Deal with Transaction exceptions
+          wsInfo.appendProgressText(jobs[j].jobnum, "\n" + WebServiceName
+                                    + " Server exception!\n" + ex.getMessage());
+          Cache.log.warn(WebServiceName + " job(" + jobs[j].jobnum
+                         + ") Server exception: " + ex.getMessage());
+
+          if (jobs[j].allowedServerExceptions > 0)
+          {
+            jobs[j].allowedServerExceptions--;
+            Cache.log.debug("Sleeping after a server exception.");
+            try
+            {
+              Thread.sleep(5000);
+            }
+            catch (InterruptedException ex1)
+            {
+            }
+          }
+          else
+          {
+            Cache.log.warn("Dropping job " + j + " " + jobs[j].jobId);
+            jobs[j].subjobComplete = true;
+            wsInfo.setStatus(jobs[j].jobnum,
+                             WebserviceInfo.STATE_STOPPED_SERVERERROR);
+          }
+        }
+        catch (OutOfMemoryError er)
+        {
+          jobComplete = true;
+          jobs[j].subjobComplete = true;
+          jobs[j].result = null; // may contain out of date result object
+          wsInfo.setStatus(jobs[j].jobnum,
+                           WebserviceInfo.STATE_STOPPED_ERROR);
+          JOptionPane
+              .showInternalMessageDialog(
+                  Desktop.desktop,
+                  "Out of memory handling result for job !!"
+                  +
+              "\nSee help files for increasing Java Virtual Machine memory.",
+                  "Out of memory", JOptionPane.WARNING_MESSAGE);
+          Cache.log.error("Out of memory when retrieving Job " + j + " id:" +
+                          WsUrl + "/" + jobs[j].jobId, er);
+          System.gc();
+        }
+      }
+      jstate.updateJobPanelState(wsInfo, OutputHeader, jobs[j]);
+    }
+    // Decide on overall state based on collected jobs[] states
+    if (jstate.running > 0)
+    {
+      wsInfo.setStatus(WebserviceInfo.STATE_RUNNING);
+    }
+    else if (jstate.queuing > 0)
+    {
+      wsInfo.setStatus(WebserviceInfo.STATE_QUEUING);
+    }
+    else
+    {
+      jobComplete = true;
+      if (jstate.finished > 0)
+      {
+        wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_OK);
+      }
+      else if (jstate.error > 0)
+      {
+        wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_ERROR);
+      }
+      else if (jstate.serror > 0)
+      {
+        wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_SERVERERROR);
+      }
+    }
+    if (!jobComplete)
+    {
+      try
+      {
+        Thread.sleep(5000);
+      }
+      catch (InterruptedException e)
+      {
+        Cache.log.debug("Interrupted sleep waiting for next job poll.", e);
+      }
+      // System.out.println("I'm alive "+alTitle);
+    }
+  }
+  if (jobComplete && jobs!=null)
+  {
+    parseResult(); // tidy up and make results available to user
+  } else {
+    Cache.log.debug("WebServiceJob poll loop finished with no jobs created.");
+  }
+}
+abstract void StartJob(WSJob job);
+abstract void parseResult();
+}
diff --git a/src/org/biojava/dasobert/das/DAS_FeatureRetrieve.java b/src/org/biojava/dasobert/das/DAS_FeatureRetrieve.java
new file mode 100755 (executable)
index 0000000..b65a847
--- /dev/null
@@ -0,0 +1,235 @@
+/**
+ *                    BioJava development code
+ *
+ * This code may be freely distributed and modified under the
+ * terms of the GNU Lesser General Public Licence.  This should
+ * be distributed with the code.  If you do not have a copy,
+ * see:
+ *
+ *      http://www.gnu.org/copyleft/lesser.html
+ *
+ * Copyright for this code is held jointly by the individual
+ * authors.  These should be listed in @author doc comments.
+ *
+ * For more information on the BioJava project and its aims,
+ * or to join the biojava-l mailing list, visit the home page
+ * at:
+ *
+ *      http://www.biojava.org/
+ *
+ * Created on 19.03.2004
+ * @author Andreas Prlic
+ *
+ */
+package org.biojava.dasobert.das;
+
+
+import java.net.URL                         ;
+import java.io.InputStream                  ;
+import org.xml.sax.InputSource              ;
+import org.xml.sax.XMLReader                ;
+import javax.xml.parsers.*                  ;
+import org.xml.sax.*                        ;
+import java.util.ArrayList                  ;
+import java.util.List;
+import java.util.logging.*                  ;
+import java.net.HttpURLConnection           ;
+import java.io.IOException;
+import java.net.ConnectException;
+import java.lang.reflect.Method;
+
+
+
+
+/**
+ * A class to perform a DAS features request
+ *
+ * @author Andreas Prlic
+ *
+ */
+public class DAS_FeatureRetrieve {
+
+    List features ;
+    Logger logger     ;
+    int comeBackLater;
+    URL url;
+    /**
+     * @param url the URL the features should be downloaded from
+     *
+     */
+    public DAS_FeatureRetrieve(URL url) {
+        super();
+
+        logger = Logger.getLogger("org.biojava.spice");
+        features = new ArrayList() ;
+        comeBackLater = -1;
+        this.url=url;
+        reload();
+    }
+
+
+    /** contact the DAS-feature server again. Usually
+     * it is not necessary to call this again, because the constructor already does, but
+     * if comeBackLater > -1 this should be called again.
+     *
+     */
+    public void reload(){
+
+        try {
+
+            InputStream dasInStream = null;
+            try {
+                dasInStream    = open(url);
+            } catch (Exception e ){
+                comeBackLater = -1;
+                logger.log(Level.FINE,"could not open connection to " + url,e);
+                return ;
+            }
+
+
+            SAXParserFactory spfactory =
+                SAXParserFactory.newInstance();
+
+            spfactory.setValidating(false);
+
+            SAXParser saxParser = null ;
+
+            try{
+                saxParser =
+                    spfactory.newSAXParser();
+            } catch (ParserConfigurationException e) {
+                e.printStackTrace();
+            }
+
+
+
+            String vali = System.getProperty("XMLVALIDATION");
+
+            boolean validation = false ;
+            if ( vali != null )
+                if ( vali.equals("true") )
+                    validation = true ;
+
+
+            XMLReader xmlreader = saxParser.getXMLReader();
+
+            //XMLReader xmlreader = XMLReaderFactory.createXMLReader();
+            try {
+                xmlreader.setFeature("http://xml.org/sax/features/validation", validation);
+            } catch (SAXException e) {
+                logger.log(Level.FINE,"Cannot set validation " + validation);
+            }
+
+            try {
+                xmlreader.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd",validation);
+            } catch (SAXNotRecognizedException e){
+                e.printStackTrace();
+                logger.log(Level.FINE,"Cannot set load-external-dtd "+validation);
+
+            }
+
+            DAS_Feature_Handler cont_handle = new DAS_Feature_Handler() ;
+            cont_handle.setDASCommand(url.toString());
+            xmlreader.setContentHandler(cont_handle);
+            xmlreader.setErrorHandler(new org.xml.sax.helpers.DefaultHandler());
+            InputSource insource = new InputSource() ;
+            insource.setByteStream(dasInStream);
+
+            try {
+                xmlreader.parse(insource);
+                features = cont_handle.get_features();
+                comeBackLater = cont_handle.getComBackLater();
+            }
+            catch ( Exception e){
+                e.printStackTrace();
+                logger.log(Level.FINE,"error while parsing response from "+ url);
+                comeBackLater = -1;
+                features = new ArrayList();
+            }
+        }
+        catch (Exception ex) {
+            ex.printStackTrace();
+            comeBackLater = -1;
+        }
+    }
+
+
+    /** open HttpURLConnection. Recommended way to open
+     * HttpURLConnections, since this take care of setting timeouts
+     * properly for java 1.4 and 1.5*/
+    public static HttpURLConnection openHttpURLConnection(URL url)
+    throws IOException, ConnectException {
+    HttpURLConnection huc = null;
+    huc = (HttpURLConnection) url.openConnection();
+
+    String os_name    = java.lang.System.getProperty("os.name");
+    String os_version = java.lang.System.getProperty("os.version");
+    String os_arch    = java.lang.System.getProperty("os.arch");
+    String VERSION = "1.0";
+
+    String userAgent = "Jalview " + VERSION + "("+os_name+"; "+os_arch + " ; "+ os_version+")";
+    //e.g. "Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.7.2) Gecko/20040803"
+     huc.addRequestProperty("User-Agent", userAgent);
+    //logger.finest("opening "+url);
+
+
+    // use reflection to determine if get and set timeout methods for urlconnection are available
+        // seems java 1.5 does not watch the System properties any longer...
+        // and java 1.4 did not provide these...
+    // for 1.4 see setSystemProperties
+    int timeout = 15000;
+    try {
+        // try to use reflection to set timeout property
+        Class urlconnectionClass = Class.forName("java.net.HttpURLConnection");
+
+            Method setconnecttimeout = urlconnectionClass.getMethod (
+                                     "setConnectTimeout", new Class [] {int.class}
+                                     );
+        setconnecttimeout.invoke(huc,new Object[] {new Integer(timeout)});
+
+        Method setreadtimeout = urlconnectionClass.getMethod (
+                                  "setReadTimeout", new Class[] {int.class}
+                                  );
+        setreadtimeout.invoke(huc,new Object[] {new Integer(timeout)});
+        //System.out.println("successfully set java 1.5 timeout");
+    } catch (Exception e) {
+        //e.printStackTrace();
+        // most likely it was a NoSuchMEthodException and we are running java 1.4.
+    }
+    return huc;
+    }
+
+
+    private InputStream open(URL url)
+    throws java.io.IOException, java.net.ConnectException
+    {
+        InputStream inStream = null;
+
+
+        HttpURLConnection huc = openHttpURLConnection(url);
+
+        inStream = huc.getInputStream();
+
+        return inStream;
+
+    }
+
+    /** returns a List of Features
+     * @return a List of Maps containing the features*/
+    public List get_features() {
+
+        return features;
+    }
+
+    /** returns the comeBackLater value - if a server returned suchh -
+     *
+     * @return comeBackLater in seconds, or -1 if not provided by server
+     */
+    public int getComeBackLater(){
+
+        return comeBackLater;
+
+    }
+
+
+}
diff --git a/src/org/biojava/dasobert/das/DAS_Feature_Handler.java b/src/org/biojava/dasobert/das/DAS_Feature_Handler.java
new file mode 100755 (executable)
index 0000000..105388e
--- /dev/null
@@ -0,0 +1,190 @@
+/*
+ *                    BioJava development code
+ *
+ * This code may be freely distributed and modified under the
+ * terms of the GNU Lesser General Public Licence.  This should
+ * be distributed with the code.  If you do not have a copy,
+ * see:
+ *
+ *      http://www.gnu.org/copyleft/lesser.html
+ *
+ * Copyright for this code is held jointly by the individual
+ * authors.  These should be listed in @author doc comments.
+ *
+ * For more information on the BioJava project and its aims,
+ * or to join the biojava-l mailing list, visit the home page
+ * at:
+ *
+ *      http://www.biojava.org/
+ *
+ * Created on 19.03.2004
+ * @author Andreas Prlic
+ *
+ */
+package org.biojava.dasobert.das;
+
+import org.xml.sax.helpers.DefaultHandler;
+import org.xml.sax.Attributes;
+
+import java.util.ArrayList ;
+import java.util.HashMap ;
+import java.util.List;
+
+/**
+ * a class to parse the response of a DAS - Feature request
+ * @author Andreas Prlic
+ *
+ */
+public class DAS_Feature_Handler  extends DefaultHandler{
+    
+    /**
+     * 
+     */
+    List features ;
+    boolean first_flag ;
+    HashMap feature ;
+    String featurefield ;
+    String characterdata ;
+    String dasCommand ;
+    
+    int comeBackLater ;
+
+    int maxFeatures ;
+
+    public DAS_Feature_Handler() {
+        super();
+        
+        features= new ArrayList() ;
+        first_flag = true ;
+        featurefield = "" ;
+        characterdata = "";
+        dasCommand = "" ;
+        comeBackLater = -1; 
+       maxFeatures = -1;
+    }
+
+    /** specifies a maximum number of features to be downloaded. if a
+       server returns more, they will be ignored.  default is to load
+       all features 
+    @param max the maximium number of features to be downloaded
+    */
+
+    public void setMaxFeatures(int max) {
+       maxFeatures = max;
+    }
+
+    public int getMaxFeatures() {
+       return maxFeatures;
+    }
+    
+    public void setDASCommand(String cmd) { dasCommand = cmd ;}
+    public String getDASCommand() { return dasCommand; }
+    
+    public List get_features() {
+        return features ;
+    }
+    
+    public int getComBackLater(){
+        return comeBackLater;
+    }
+    
+    void start_feature(String uri, String name, String qName, Attributes atts) {
+
+       if (( maxFeatures > 0 ) && ( features.size() > maxFeatures ) ) {
+           characterdata = "";
+           return;
+       }
+        feature = new HashMap() ;
+        String id      = atts.getValue("id");
+        feature.put("id",id);
+        feature.put("dassource",dasCommand);
+        characterdata = "";
+    }
+    
+    void add_featuredata(String uri, String name, String qName) {
+        //System.out.println("featurefield "+featurefield+ " data "+characterdata);
+        // NOTE can have multiple lines ..
+        
+       if (( maxFeatures > 0 ) && ( features.size() > maxFeatures ) ) {
+           return;
+       }
+
+
+        String data = (String)feature.get(featurefield);
+        if (data != null){
+            characterdata = data + " " + characterdata;
+        }
+        
+        feature.put(featurefield,characterdata);
+        featurefield = "";
+        characterdata = "";
+    }
+    
+    private void addLink(String uri, String name, String qName, Attributes atts) {
+        String href = atts.getValue("href");
+        feature.put("LINK",href);
+        characterdata="";
+        featurefield = "LINK-TEXT";
+                
+    }
+    
+    public void startElement (String uri, String name, String qName, Attributes atts){
+        //System.out.println("new element "+qName);
+        
+        if (qName.equals("FEATURE")) 
+            start_feature(uri,  name,  qName,  atts);
+        else if ( qName.equals("LINK"))
+            addLink(uri,name,qName, atts);
+        else if ( qName.equals("METHOD") || 
+                qName.equals("TYPE") ||
+                qName.equals("START") ||
+                qName.equals("END") ||
+                qName.equals("NOTE") ||                
+                qName.equals("SCORE")
+        ){
+            characterdata ="";
+            featurefield = qName ;
+        }
+        
+    }
+    
+    public void startDocument() {
+    }
+    
+    public void endDocument () {        
+    }
+    public void endElement(String uri, String name, String qName) {
+
+        if ( qName.equals("METHOD") || 
+                qName.equals("TYPE") ||
+                qName.equals("START") ||
+                qName.equals("END") ||
+                qName.equals("NOTE") || 
+                qName.equals("LINK") || 
+                qName.equals("SCORE")
+        ) {
+            add_featuredata(uri,name,qName);
+        }
+        else if ( qName.equals("FEATURE")) {
+
+           if ( maxFeatures > 0 ) {
+               if ( features.size() < maxFeatures ) {
+                    features.add(feature);
+               } 
+           } else {
+               // no restriction
+               features.add(feature);
+           }
+        }
+    }
+    
+    public void characters (char ch[], int start, int length){
+
+        for (int i = start; i < start + length; i++) {
+            
+            characterdata += ch[i];
+        }
+        
+    }
+    
+}
diff --git a/src/org/biojava/dasobert/das/FeatureThread.java b/src/org/biojava/dasobert/das/FeatureThread.java
new file mode 100755 (executable)
index 0000000..8c8923e
--- /dev/null
@@ -0,0 +1,180 @@
+/*
+ *                    BioJava development code
+ *
+ * This code may be freely distributed and modified under the
+ * terms of the GNU Lesser General Public Licence.  This should
+ * be distributed with the code.  If you do not have a copy,
+ * see:
+ *
+ *      http://www.gnu.org/copyleft/lesser.html
+ *
+ * Copyright for this code is held jointly by the individual
+ * authors.  These should be listed in @author doc comments.
+ *
+ * For more information on the BioJava project and its aims,
+ * or to join the biojava-l mailing list, visit the home page
+ * at:
+ *
+ *      http://www.biojava.org/
+ *
+ * Created on 21.09.2004
+ * @author Andreas Prlic
+ *
+ */
+
+package org.biojava.dasobert.das ;
+
+import java.util.*;
+import java.net.*;
+import java.util.logging.* ;
+import org.biojava.dasobert.eventmodel.FeatureListener;
+import org.biojava.dasobert.eventmodel.FeatureEvent;
+import org.biojava.dasobert.dasregistry.Das1Source;
+
+/** a thread that connects to a DAS - Feature service and gets the features
+ * 
+ * @author Andreas Prlic
+ */
+
+
+
+public class FeatureThread
+    implements Runnable 
+{
+    
+    /** number of times the client tries to reconnect to the server if a "come back later" is returned.
+     * the server should provide a reasonable estimation how long it will take him to create results.
+     * if this number of requests is still not successfull, give up.
+     */
+    public static int MAX_COME_BACK_ITERATIONS = 5;
+
+    public static int MAX_NR_FEATURES = 300;
+
+    static Logger logger = Logger.getLogger("org.biojava.spice");
+
+    Das1Source dasSource;
+    String ac ;
+    List featureListeners;
+    Thread thread;
+    
+    public FeatureThread (String accessionCode, Das1Source dasSource) {
+       this.dasSource = dasSource;
+       this.ac = accessionCode;
+       featureListeners = new ArrayList();
+    }
+
+    public void addFeatureListener(FeatureListener li) {
+       featureListeners.add(li);
+    }
+    
+    public void clearFeatureListeners() {
+       featureListeners.clear();
+    }
+
+    public synchronized void stop(){
+       thread = null;
+       notify();
+    }
+
+    
+
+
+    public void run() {
+       Thread me = Thread.currentThread();
+       while ( thread == me) {
+           String url = dasSource.getUrl();
+           String queryString = url + "features?segment="+ ac ;
+           URL cmd = null ;
+           try {
+               cmd = new URL(queryString);
+           } catch (MalformedURLException e ) {
+               logger.warning("got MalformedURL from das source " +dasSource);
+               e.printStackTrace();
+               
+           }
+
+           logger.info("requesting features from " + cmd);
+           DAS_FeatureRetrieve ftmp = new DAS_FeatureRetrieve(cmd);
+        
+           
+           int comeBackLater = ftmp.getComeBackLater();
+           int securityCounter = 0;
+           while ( (thread == me) && ( comeBackLater > 0 )) {
+               securityCounter++;
+               if ( securityCounter >= MAX_COME_BACK_ITERATIONS){
+                   comeBackLater = -1; 
+                   break;
+                
+               }
+               notifyComeBackLater(comeBackLater);
+               // server is still calculating - asks us to come back later
+               try {
+                   wait (comeBackLater);
+               } catch (InterruptedException e){
+                   comeBackLater = -1;
+                   break;
+               }
+                
+               ftmp.reload();
+               comeBackLater = ftmp.getComeBackLater(); 
+           }
+
+           if ( ! (thread == me ) ) {
+               break;
+           }
+
+           List features = ftmp.get_features();
+        
+           // a fallback mechanism to prevent DAS sources from bringing down spice
+           if ( features.size() > MAX_NR_FEATURES){
+               logger.warning("DAS source returned more than " + MAX_NR_FEATURES + "features. " +
+                              " throwing away excess features at " +cmd);
+               features = features.subList(0,MAX_NR_FEATURES);
+           }
+      
+              
+           // notify FeatureListeners
+           Map[] feats = (Map[])features.toArray(new Map[features.size()]);
+           notifyFeatureListeners(feats);
+
+           break;
+
+
+       }
+       thread = null;
+
+    }
+
+    public void start() {
+       thread = new Thread(this);
+       thread.start();
+    }
+
+    private void notifyFeatureListeners(Map[] feats){
+        logger.finest("FeatureThread found " + feats.length + " features");
+        FeatureEvent fevent = new FeatureEvent(feats,dasSource);
+        Iterator fiter = featureListeners.iterator();
+        while (fiter.hasNext()){
+            FeatureListener fi = (FeatureListener)fiter.next();
+            fi.newFeatures(fevent);
+        }
+    }
+    
+ /** the Annotation server requested to be queried again in a while
+     * 
+     * @param comeBackLater
+     */
+    private void notifyComeBackLater(int comeBackLater){
+        FeatureEvent event = new FeatureEvent(new HashMap[0],dasSource);
+        event.setComeBackLater(comeBackLater);
+        Iterator fiter = featureListeners.iterator();
+        while (fiter.hasNext()){
+            FeatureListener fi = (FeatureListener)fiter.next();
+            fi.comeBackLater(event);
+        }
+        
+    }
+
+
+}
+
diff --git a/src/org/biojava/dasobert/das2/Das2Capability.java b/src/org/biojava/dasobert/das2/Das2Capability.java
new file mode 100755 (executable)
index 0000000..5b5c17c
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ *                  BioJava development code
+ *
+ * This code may be freely distributed and modified under the
+ * terms of the GNU Lesser General Public Licence.  This should
+ * be distributed with the code.  If you do not have a copy,
+ * see:
+ *
+ *      http://www.gnu.org/copyleft/lesser.html
+ *
+ * Copyright for this code is held jointly by the individual
+ * authors.  These should be listed in @author doc comments.
+ *
+ * For more information on the BioJava project and its aims,
+ * or to join the biojava-l mailing list, visit the home page
+ * at:
+ *
+ *      http://www.biojava.org/
+ * 
+ * Created on Feb 9, 2006
+ *
+ */
+package org.biojava.dasobert.das2;
+
+public interface Das2Capability {
+
+    public boolean equals(Das2Capability other);
+    public int hashCode();
+    
+    public void setCapability(String type);
+    public String getCapability();
+    
+    public void setQueryUri(String id);
+    public String getQueryUri();
+    
+    public void setFormats(String[] formats);
+    public String[] getFormats();
+    
+    /** checks if this capability is actually of das1 style
+     * 
+     * @return boolean true if the capability is in DAS1 style
+     */
+    public boolean isDas1Style();
+    
+}
diff --git a/src/org/biojava/dasobert/das2/Das2CapabilityImpl.java b/src/org/biojava/dasobert/das2/Das2CapabilityImpl.java
new file mode 100755 (executable)
index 0000000..273defa
--- /dev/null
@@ -0,0 +1,109 @@
+/*
+ *                  BioJava development code
+ *
+ * This code may be freely distributed and modified under the
+ * terms of the GNU Lesser General Public Licence.  This should
+ * be distributed with the code.  If you do not have a copy,
+ * see:
+ *
+ *      http://www.gnu.org/copyleft/lesser.html
+ *
+ * Copyright for this code is held jointly by the individual
+ * authors.  These should be listed in @author doc comments.
+ *
+ * For more information on the BioJava project and its aims,
+ * or to join the biojava-l mailing list, visit the home page
+ * at:
+ *
+ *      http://www.biojava.org/
+ * 
+ * Created on Feb 9, 2006
+ *
+ */
+package org.biojava.dasobert.das2;
+
+public class Das2CapabilityImpl 
+implements Das2Capability{
+
+    String capability;
+    String[] formats;
+    String queryId;
+    
+    public static String DAS1_CAPABILITY_PREFIX = "das1:";
+    
+    public Das2CapabilityImpl() {
+        super();
+        capability = "undef";
+        queryId = "";
+        formats = new String[0];
+
+    }
+    
+    public boolean isDas1Style(){
+        
+        if ( capability == null)
+            return false;
+        if ( capability.length() < DAS1_CAPABILITY_PREFIX.length())
+            return false;
+        if ( capability.substring(0,DAS1_CAPABILITY_PREFIX.length()).equals(DAS1_CAPABILITY_PREFIX))
+            return true;
+        return false;
+    
+    }
+    
+    public boolean equals(Das2Capability other){
+        
+        boolean status = true;
+        
+        if (!  capability.equals(other.getCapability()))
+            status = false;
+        if ( ! queryId.equals(other.getQueryUri()))
+            status = false;
+        
+        return status;
+    }
+    
+    public int hashCode(){
+        int h = 7;
+        h = 31 * h + ( null == capability ? 0 : capability.hashCode()) ;
+        h = 31 * h + ( null == queryId    ? 0 : queryId.hashCode()) ;
+        
+        return h;
+    }
+    
+    public String toString(){
+        String txt ="capability " + capability + " queryId " + queryId;
+        return txt;
+    }
+
+    public String getCapability() {
+        
+        return capability;
+    }
+
+    public String[] getFormats() {      
+        return formats;
+    }
+
+    public String getQueryUri() {      
+        return queryId;
+    }
+
+    public void setCapability(String type) {
+       capability = type;
+        
+    }
+
+    public void setFormats(String[] formats) {
+       
+        this.formats = formats; 
+    }
+
+    public void setQueryUri(String id) {
+       queryId = id;
+        
+    }
+    
+    
+
+}
diff --git a/src/org/biojava/dasobert/das2/Das2Source.java b/src/org/biojava/dasobert/das2/Das2Source.java
new file mode 100755 (executable)
index 0000000..21a008a
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ *                  BioJava development code
+ *
+ * This code may be freely distributed and modified under the
+ * terms of the GNU Lesser General Public Licence.  This should
+ * be distributed with the code.  If you do not have a copy,
+ * see:
+ *
+ *      http://www.gnu.org/copyleft/lesser.html
+ *
+ * Copyright for this code is held jointly by the individual
+ * authors.  These should be listed in @author doc comments.
+ *
+ * For more information on the BioJava project and its aims,
+ * or to join the biojava-l mailing list, visit the home page
+ * at:
+ *
+ *      http://www.biojava.org/
+ * 
+ * Created on Feb 9, 2006
+ *
+ */
+package org.biojava.dasobert.das2;
+
+import org.biojava.dasobert.dasregistry.DasSource;
+
+public interface Das2Source
+extends DasSource {
+
+   public Das2Capability[] getDas2Capabilities();
+   public void setDas2Capabilities(Das2Capability[] capabilities);
+   
+   /** test if this is a DAS1 source represented as a DAS2 source
+    *  if true - this source can be converted into a DAS1 source by using
+    *  DasSourceConverter.toDas1(Das2Source);
+    *
+    * @return true if the DasSource has DAS1 capabilties
+    */
+   public boolean hasDas1Capabilities();
+}
diff --git a/src/org/biojava/dasobert/das2/Das2SourceImpl.java b/src/org/biojava/dasobert/das2/Das2SourceImpl.java
new file mode 100755 (executable)
index 0000000..aca49b2
--- /dev/null
@@ -0,0 +1,144 @@
+/*
+ *                  BioJava development code
+ *
+ * This code may be freely distributed and modified under the
+ * terms of the GNU Lesser General Public Licence.  This should
+ * be distributed with the code.  If you do not have a copy,
+ * see:
+ *
+ *      http://www.gnu.org/copyleft/lesser.html
+ *
+ * Copyright for this code is held jointly by the individual
+ * authors.  These should be listed in @author doc comments.
+ *
+ * For more information on the BioJava project and its aims,
+ * or to join the biojava-l mailing list, visit the home page
+ * at:
+ *
+ *      http://www.biojava.org/
+ * 
+ * Created on Feb 9, 2006
+ *
+ */
+package org.biojava.dasobert.das2;
+
+import org.biojava.dasobert.dasregistry.Das1Source;
+import org.biojava.dasobert.dasregistry.DasSource;
+
+public class Das2SourceImpl 
+extends Das1Source
+implements Das2Source 
+
+{
+
+    Das2Capability[] capabilities;
+    
+    public Das2SourceImpl() {
+        super();
+
+        capabilities = new Das2Capability[0];
+    }
+    
+    
+    /**  compare if two DasSources are identical
+     * 
+     */
+    public boolean equals(DasSource other){
+        
+        if ( this == other)
+            return true;
+        
+        if ( ( other == null) || (other.getClass() != this.getClass()))    
+            return false;
+       
+        // to compare if two Das2Sources are identical we do the following:
+        //  we check the capabilities
+        
+        Das2SourceImpl d2o = (Das2SourceImpl)other;
+        
+        if ( nickname.equals(d2o.getNickname()))
+            return true;
+        
+        Das2Capability[] othercaps = d2o.getDas2Capabilities();
+        
+        if ( ! (capabilities.length == othercaps.length))
+            return false;
+        
+        for ( int x=0;x<capabilities.length;x++){
+            Das2Capability tmpcap = capabilities[x];
+            boolean foundCap = false;
+            for (int y=0; y< othercaps.length;y++){
+                Das2Capability tmpcapo = othercaps[y];
+                if ( tmpcap.equals(tmpcapo))
+                    foundCap = true;
+            }
+            if ( ! foundCap)
+                return false;
+        }
+        
+        
+        //TODO?
+        // should we add a check for coordinate systems?
+        // but we already check for the endpoints, that should be enough...
+        
+        return true;
+        
+    }
+    
+    public int hashCode(){
+        int h = 7 ;
+        
+        h = 31 * h + (null == nickname ? 0 :  nickname.hashCode());
+        
+        for ( int x=0;x<capabilities.length;x++){
+            Das2Capability cap = capabilities[x];
+            h = 31 * h + cap.hashCode();
+        }
+        
+        return h;
+    }
+    
+    
+    public boolean hasDas1Capabilities(){
+        
+        // test if any of the capabilities is a das1 capabilitiy
+        
+        for (int i = 0 ; i < capabilities.length; i++) {
+            Das2Capability cap = capabilities[i];
+            if ( cap.isDas1Style())
+                return true;            
+        }
+        return false;
+        
+        
+    }
+    
+    public String[] getCapabilities() {
+        //todo mark as not needed / not appropriate ...
+        return super.getCapabilities();
+    }
+
+
+
+    public void setCapabilities(String[] u) {
+        // TODO Auto-generated method stub
+        super.setCapabilities(u);
+    }
+
+
+
+    public Das2Capability[] getDas2Capabilities() {
+        // TODO Auto-generated method stub
+        return capabilities;
+    }
+
+    public void setDas2Capabilities(Das2Capability[] capabilities) {
+        // TODO Auto-generated method stub
+        this.capabilities = capabilities;
+        
+    }
+    
+    
+    
+
+}
diff --git a/src/org/biojava/dasobert/das2/DasSourceConverter.java b/src/org/biojava/dasobert/das2/DasSourceConverter.java
new file mode 100755 (executable)
index 0000000..513ba3f
--- /dev/null
@@ -0,0 +1,82 @@
+/*
+ *                  BioJava development code
+ *
+ * This code may be freely distributed and modified under the
+ * terms of the GNU Lesser General Public Licence.  This should
+ * be distributed with the code.  If you do not have a copy,
+ * see:
+ *
+ *      http://www.gnu.org/copyleft/lesser.html
+ *
+ * Copyright for this code is held jointly by the individual
+ * authors.  These should be listed in @author doc comments.
+ *
+ * For more information on the BioJava project and its aims,
+ * or to join the biojava-l mailing list, visit the home page
+ * at:
+ *
+ *      http://www.biojava.org/
+ *
+ * Created on Mar 23, 2006
+ *
+ */
+package org.biojava.dasobert.das2;
+
+//import org.biojava.bio.program.das.dasalignment.DASException;
+import org.biojava.dasobert.dasregistry.Das1Source;
+
+public class DasSourceConverter {
+
+    public DasSourceConverter() {
+        super();
+
+    }
+
+
+    /** convert a das2 source to a das 1 source.
+     * This only will work if is passes the Das2Source.isDas1Source() test
+     * i.e. this is really a das1 server there
+     *
+     * @param das2source a DAS2Source to be converted
+     * @return a Das1Source
+     * @throws DASException
+     */
+    public static Das1Source toDas1Source (Das2Source das2source) throws Exception{
+        if ( ! das2source.hasDas1Capabilities())
+            throw new Exception("this das source does not have das1 capabilitites");
+
+        Das1Source ds = new Das1Source();
+        ds.setAdminemail(das2source.getAdminemail());
+        ds.setDescription(das2source.getDescription());
+        ds.setHelperurl(das2source.getHelperurl());
+        ds.setRegisterDate(das2source.getRegisterDate());
+        ds.setLeaseDate(das2source.getLeaseDate());
+        ds.setLabels(das2source.getLabels());
+        ds.setCoordinateSystem(das2source.getCoordinateSystem());
+        ds.setNickname(das2source.getNickname());
+        ds.setId(das2source.getId());
+        ds.setLabels(das2source.getLabels());
+
+        // convert the capabilitites to das1 capabiltities and get the url
+        Das2Capability[] caps = das2source.getDas2Capabilities();
+        String[] das1capabilitites = new String[caps.length];
+        int DASPREFIXLENGTH = Das2CapabilityImpl.DAS1_CAPABILITY_PREFIX.length();
+
+        for ( int i = 0 ; i< caps.length;i++){
+            Das2Capability cap = caps[i];
+
+            String c = cap.getCapability();
+
+            das1capabilitites[i] = c.substring(DASPREFIXLENGTH,c.length());
+
+            String query_uri = cap.getQueryUri();
+
+            String url = query_uri.substring(0,(query_uri.length() - c.length() + DASPREFIXLENGTH));
+            ds.setUrl(url);
+        }
+        ds.setCapabilities(das1capabilitites);
+
+        return ds ;
+    }
+
+}
diff --git a/src/org/biojava/dasobert/das2/io/DAS2SourceHandler.java b/src/org/biojava/dasobert/das2/io/DAS2SourceHandler.java
new file mode 100755 (executable)
index 0000000..caf6798
--- /dev/null
@@ -0,0 +1,181 @@
+/*
+ *                  BioJava development code
+ *
+ * This code may be freely distributed and modified under the
+ * terms of the GNU Lesser General Public Licence.  This should
+ * be distributed with the code.  If you do not have a copy,
+ * see:
+ *
+ *      http://www.gnu.org/copyleft/lesser.html
+ *
+ * Copyright for this code is held jointly by the individual
+ * authors.  These should be listed in @author doc comments.
+ *
+ * For more information on the BioJava project and its aims,
+ * or to join the biojava-l mailing list, visit the home page
+ * at:
+ *
+ *      http://www.biojava.org/
+ * 
+ * Created on Mar 15, 2006
+ *
+ */
+package org.biojava.dasobert.das2.io;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.biojava.dasobert.das2.Das2Capability;
+import org.biojava.dasobert.das2.Das2CapabilityImpl;
+import org.biojava.dasobert.das2.Das2Source;
+import org.biojava.dasobert.das2.Das2SourceImpl;
+import org.biojava.dasobert.dasregistry.DasCoordinateSystem;
+import org.biojava.dasobert.dasregistry.DasSource;
+import org.xml.sax.Attributes;
+import org.xml.sax.helpers.DefaultHandler;
+
+/** a parser for the DAS2 sources response
+ * 
+ * @author Andreas Prlic
+ * @since 6:53:45 PM
+ * @version %I% %G%
+ */
+public class DAS2SourceHandler extends DefaultHandler{
+
+    List sources;
+    Das2Source currentSource;
+    List coordinates;
+    List capabilities;
+    List labels;
+
+    public static final String LABELPROPERTY = "label";
+
+    public DAS2SourceHandler() {
+        super();
+        
+        sources       = new ArrayList();
+        currentSource = new Das2SourceImpl();
+        coordinates   = new ArrayList();
+        capabilities  = new ArrayList();
+       labels        = new ArrayList();
+    }
+    
+    private void startSource (String uri, String name, String qName, Attributes atts){
+        
+        String id = atts.getValue("uri");
+        String title = atts.getValue("title");
+        String doc_ref = atts.getValue("doc_href");
+        String description = atts.getValue("description");
+
+           
+        currentSource.setId(id);
+        currentSource.setNickname(title);
+        currentSource.setHelperurl(doc_ref);
+        currentSource.setDescription(description);
+        
+    }
+    
+    private DasCoordinateSystem getCoordinateSystem(String uri, String name, String qname, Attributes atts){
+        // e.g. uri="http://das.sanger.ac.uk/dasregistry/coordsys/CS_LOCAL6" 
+        // source="Protein Sequence" authority="UniProt" test_range="P06213" />
+        DasCoordinateSystem dcs = new DasCoordinateSystem();
+        String id = atts.getValue("uri");
+        dcs.setUniqueId(id);
+        
+        String source = atts.getValue("source");
+        dcs.setCategory(source);
+        
+        String authority = atts.getValue("authority");
+        dcs.setName(authority);
+        
+        String test_range = atts.getValue("test_range");
+        dcs.setTestCode(test_range);
+        
+        try {
+            String taxidstr = atts.getValue("taxid");
+            int taxid = Integer.parseInt(taxidstr);
+            dcs.setNCBITaxId(taxid);
+        } catch (Exception e){}
+        
+        String version = atts.getValue("version");
+        if ( version != null)
+            dcs.setVersion(version);
+        
+        return dcs;
+    }
+    
+    public void startElement (String uri, String name, String qName, Attributes atts){
+        //System.out.println("new element "+qName);
+        
+        if (qName.equals("SOURCE")) {
+            //System.out.println("new Source " + atts.getValue(uri));
+            currentSource = new Das2SourceImpl();
+            coordinates = new ArrayList();
+            capabilities = new ArrayList();
+            
+            startSource(uri,name, qName, atts);
+            
+        } else if ( qName.equals("MAINTAINER")){
+            String email = atts.getValue("email");
+            currentSource.setAdminemail(email);
+        } else if ( qName.equals("COORDINATES")){
+            DasCoordinateSystem dcs = getCoordinateSystem(uri,name,qName,atts);
+            coordinates.add(dcs);
+            
+        } else if ( qName.equals("CAPABILITY")){
+            Das2Capability cap = getCapability(uri,name,qName,atts);
+            capabilities.add(cap);
+        } else if (qName.equals("PROPERTY")) {
+           addProperty(uri,name,qName,atts);
+       }                
+    }
+    
+    private Das2Capability getCapability(String uri, String name, String qName, Attributes atts){
+        // e.g <CAPABILITY type="features" query_id="http://das.biopackages.net/das/genome/yeast/S228C/feature" />
+        Das2Capability cap = new Das2CapabilityImpl();
+        
+        String type = atts.getValue("type");
+        cap.setCapability(type);
+        String query_uri = atts.getValue("query_uri");
+        cap.setQueryUri(query_uri);
+        return cap;
+        
+    }
+    
+    private void addProperty(String uri, String name, String qName, Attributes atts){
+       String pname = atts.getValue("name");
+       String label = atts.getValue("value");
+       if ( pname.equals(LABELPROPERTY) )
+           labels.add(label);
+    }
+    
+    public void startDocument(){
+        sources = new ArrayList();
+        coordinates = new ArrayList();
+        capabilities = new ArrayList();
+    }
+    
+    public void endElement(String uri, String name, String qName) {
+        if ( qName.equals("SOURCE")) {
+            currentSource.setDas2Capabilities((Das2Capability[])capabilities.toArray(new Das2Capability[capabilities.size()]));
+            //System.out.println("got coordinates " + coordinates.size());
+            currentSource.setCoordinateSystem((DasCoordinateSystem[])coordinates.toArray(new DasCoordinateSystem[coordinates.size()]));
+
+           currentSource.setLabels((String[])labels.toArray(new String[labels.size()]));
+           labels.clear();
+
+            //System.out.println("Das2SourceHandler endElement name " + name + " uri " + uri + " qName " + qName);
+            //System.out.println("Das2SourceHandler adding to source: " + currentSource.getId());    
+            sources.add(currentSource);   
+            currentSource = new Das2SourceImpl();
+        }              
+    }
+    
+    public DasSource[] getSources(){    
+        //System.out.println("Das2SourceHandler: source size: " + sources.size());
+        return (DasSource[])sources.toArray(new DasSource[sources.size()]);
+    }
+    
+    
+
+}
diff --git a/src/org/biojava/dasobert/das2/io/DasSourceReader.java b/src/org/biojava/dasobert/das2/io/DasSourceReader.java
new file mode 100755 (executable)
index 0000000..0b05df8
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ *                  BioJava development code
+ *
+ * This code may be freely distributed and modified under the
+ * terms of the GNU Lesser General Public Licence.  This should
+ * be distributed with the code.  If you do not have a copy,
+ * see:
+ *
+ *      http://www.gnu.org/copyleft/lesser.html
+ *
+ * Copyright for this code is held jointly by the individual
+ * authors.  These should be listed in @author doc comments.
+ *
+ * For more information on the BioJava project and its aims,
+ * or to join the biojava-l mailing list, visit the home page
+ * at:
+ *
+ *      http://www.biojava.org/
+ * 
+ * Created on Feb 24, 2006
+ *
+ */
+package org.biojava.dasobert.das2.io;
+
+import java.io.InputStream;
+
+import org.biojava.dasobert.dasregistry.DasSource;
+
+public interface DasSourceReader {
+
+    public DasSource[] readDasSource(InputStream stream);
+}
diff --git a/src/org/biojava/dasobert/das2/io/DasSourceReaderImpl.java b/src/org/biojava/dasobert/das2/io/DasSourceReaderImpl.java
new file mode 100755 (executable)
index 0000000..3f0a07a
--- /dev/null
@@ -0,0 +1,173 @@
+/*
+ *                  BioJava development code
+ *
+ * This code may be freely distributed and modified under the
+ * terms of the GNU Lesser General Public Licence.  This should
+ * be distributed with the code.  If you do not have a copy,
+ * see:
+ *
+ *      http://www.gnu.org/copyleft/lesser.html
+ *
+ * Copyright for this code is held jointly by the individual
+ * authors.  These should be listed in @author doc comments.
+ *
+ * For more information on the BioJava project and its aims,
+ * or to join the biojava-l mailing list, visit the home page
+ * at:
+ *
+ *      http://www.biojava.org/
+ *
+ * Created on Feb 24, 2006
+ *
+ */
+package org.biojava.dasobert.das2.io;
+
+import java.io.InputStream;
+import java.net.HttpURLConnection;
+import java.net.URL;
+
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
+//import org.biojava.dasobert.das.AlignmentThread;
+import org.biojava.dasobert.das.DAS_FeatureRetrieve;
+import org.biojava.dasobert.dasregistry.DasSource;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXNotRecognizedException;
+import org.xml.sax.XMLReader;
+
+public class DasSourceReaderImpl implements DasSourceReader {
+
+    Exception loggedException;
+
+    public DasSourceReaderImpl() {
+        super();
+        loggedException = null;
+
+        // open the stream to a server and then parse the result ...
+    }
+
+    private InputStream open(URL url)
+    throws java.io.IOException, java.net.ConnectException
+    {
+        InputStream inStream = null;
+
+
+        HttpURLConnection huc = DAS_FeatureRetrieve.openHttpURLConnection(url);
+
+        inStream = huc.getInputStream();
+
+        return inStream;
+
+    }
+
+
+    public DasSource[] readDasSource(URL url){
+        DasSource[] sources = new DasSource[0];
+
+        try {
+            InputStream stream = open(url);
+
+            sources = readDasSource(stream);
+        } catch (Exception e){
+            e.printStackTrace();
+            loggedException = e;
+        }
+        return sources;
+    }
+
+    /** read a DAS2 sources response and return a list of DAS sources.
+     *
+     */
+    public DasSource[] readDasSource(InputStream stream)  {
+
+        DasSource[] sources = new DasSource[0];
+
+        try {
+        SAXParserFactory spfactory =
+            SAXParserFactory.newInstance();
+
+        spfactory.setValidating(false);
+
+        SAXParser saxParser = null ;
+
+        try{
+            saxParser =
+                spfactory.newSAXParser();
+        } catch (ParserConfigurationException e) {
+            e.printStackTrace();
+            loggedException = e;
+        }
+
+        String vali = System.getProperty("XMLVALIDATION");
+
+        boolean validation = false ;
+        if ( vali != null )
+            if ( vali.equals("true") )
+                validation = true ;
+
+
+        XMLReader xmlreader = saxParser.getXMLReader();
+
+        //XMLReader xmlreader = XMLReaderFactory.createXMLReader();
+        try {
+            xmlreader.setFeature("http://xml.org/sax/features/validation", validation);
+        } catch (SAXException e) {
+            //logger.log(Level.FINE,"Cannot set validation " + validation);
+        }
+
+        try {
+            xmlreader.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd",validation);
+        } catch (SAXNotRecognizedException e){
+            e.printStackTrace();
+            //logger.log(Level.FINE,"Cannot set load-external-dtd "+validation);
+
+        }
+
+        DAS2SourceHandler cont_handle = new DAS2SourceHandler() ;
+
+        xmlreader.setContentHandler(cont_handle);
+        xmlreader.setErrorHandler(new org.xml.sax.helpers.DefaultHandler());
+        InputSource insource = new InputSource() ;
+        insource.setByteStream(stream);
+
+
+        xmlreader.parse(insource);
+        sources = cont_handle.getSources();
+
+
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            loggedException = e;
+        }
+        return sources;
+    }
+
+    public Exception getLoggedException(){
+        return loggedException;
+    }
+
+    public static void main (String[] args){
+        String url = "http://www.spice-3d.org/dasregistry/das2/sources/";
+        DasSourceReaderImpl reader = new DasSourceReaderImpl();
+        try {
+            URL u = new URL(url);
+            DasSource[] sources = reader.readDasSource(u);
+            for (int i=0; i< sources.length;i++){
+                DasSource ds = sources[i];
+                System.out.println(ds.toString());
+            }
+
+        } catch (Exception e){
+            e.printStackTrace();
+        }
+
+    }
+
+
+
+}
diff --git a/src/org/biojava/dasobert/dasregistry/Das1Source.java b/src/org/biojava/dasobert/dasregistry/Das1Source.java
new file mode 100755 (executable)
index 0000000..de007d6
--- /dev/null
@@ -0,0 +1,206 @@
+/*
+ *                    BioJava development code
+ *
+ * This code may be freely distributed and modified under the
+ * terms of the GNU Lesser General Public Licence.  This should
+ * be distributed with the code.  If you do not have a copy,
+ * see:
+ *
+ *      http://www.gnu.org/copyleft/lesser.html
+ *
+ * Copyright for this code is held jointly by the individual
+ * authors.  These should be listed in @author doc comments.
+ *
+ * For more information on the BioJava project and its aims,
+ * or to join the biojava-l mailing list, visit the home page
+ * at:
+ *
+ *      http://www.biojava.org/
+ *
+ * Created on 15.04.2004
+ * @author Andreas Prlic
+ *
+ */
+package org.biojava.dasobert.dasregistry;
+
+import java.util.Date ;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+
+
+//import org.biojava.dasobert.das2.io.DasSourceWriter;
+//import org.biojava.dasobert.das2.io.DasSourceWriterImpl;
+//import org.biojava.utils.xml.PrettyXMLWriter;
+
+
+/** a simple Bean class to be returned via SOAP
+ * @author Andreas Prlic
+ */
+
+public class Das1Source implements DasSource {
+    String url                ;
+    protected String nickname           ;
+    String adminemail         ;
+    String description        ;
+    DasCoordinateSystem[] coordinateSystem ;
+    String[] capabilities     ;
+    String[] labels           ;
+    String helperurl          ;
+    Date   registerDate       ;
+    Date   leaseDate          ;
+    String id                 ;
+    boolean local;
+
+    boolean alertAdmin;
+
+    public static String EMPTY_ID = "UNK:-1" ;
+
+    public Das1Source () {
+        id               = EMPTY_ID;
+        url              = "";
+        adminemail       = "" ;
+        description      = "" ;
+        //String empty     = "" ;
+        nickname         = "" ;
+        coordinateSystem = new DasCoordinateSystem[0];
+        //coordinateSystem[0] = new DasCoordinateSystem();
+        capabilities     =  new String[0];
+        labels                  = new String[0];
+        //capabilities[0]  = empty ;
+        registerDate     = new Date() ;
+        leaseDate        = new Date() ;
+        helperurl        = "";
+        local=true;
+    }
+
+
+    public boolean equals(DasSource other){
+        System.out.println("Das1Source equals, comparing with other DasSource");
+        if (! (other instanceof Das1Source))
+            return false;
+
+        Das1Source ods = (Das1Source) other;
+
+        if ( ods.getUrl().equals(url))
+            return true;
+        if ( ods.getNickname().equals(nickname))
+            return true;
+        return false;
+    }
+
+    public int hashCode() {
+        int h = 7;
+
+        h = 31 * h + ( null == nickname ? 0 : nickname.hashCode());
+        h = 31 * h + ( null == url ? 0 : url.hashCode());
+
+        return h;
+    }
+
+    /** the DAS2 string representation of this DAS source
+     *
+    public String toString() {
+
+        StringWriter writer = new StringWriter();
+
+        PrintWriter pw = new PrintWriter(writer);
+        PrettyXMLWriter xw = new PrettyXMLWriter(pw);
+
+        DasSourceWriter dswriter = new DasSourceWriterImpl();
+        try {
+            dswriter.writeDasSource(xw,this);
+        } catch (IOException e){
+            e.printStackTrace();
+        }
+
+        return writer.toString();
+
+    }
+    */
+    public void setLocal(boolean flag){ local = flag;}
+    public boolean isLocal(){return local;}
+
+    public void setId(String i) { id = i; }
+
+    /** get a the Id of the DasSource. The Id is a unique db
+     * identifier. The public DAS-Registry has Auto_Ids that look like
+     * DASSOURCE:12345; public look like XYZ:12345, where the XYZ
+     * prefix can be configured in the config file.
+     */
+    public String getId() { return id;}
+
+    public void setNickname(String name) {
+        nickname = name ;
+    }
+    public String getNickname(){
+        return nickname;
+    }
+    public void setUrl(String u) {
+        char lastChar = u.charAt(u.length()-1);
+        if ( lastChar  != '/')
+            u += "/";
+
+        url = u ;
+    }
+
+    public void setAdminemail (String u) {
+        adminemail = u ;
+    }
+
+    public void setDescription (String u) {
+        description = u;
+    }
+
+    public void setCoordinateSystem (DasCoordinateSystem[] u){
+        coordinateSystem=u ;
+    }
+
+    public void setCapabilities (String[] u){
+        capabilities = u ;
+    }
+
+    public String getUrl(){return url;}
+    public String getAdminemail(){return adminemail;}
+    public String getDescription(){return description;}
+    public String[] getCapabilities(){return capabilities;}
+    public DasCoordinateSystem[] getCoordinateSystem(){return coordinateSystem;}
+
+    public void setRegisterDate(Date d) {
+        registerDate = d;
+    }
+    public Date getRegisterDate() {
+        return registerDate ;
+    }
+    public void setLeaseDate(Date d) {
+        leaseDate =d ;
+    }
+    public Date getLeaseDate() {
+        return leaseDate ;
+    }
+
+    public void setLabels(String[] ls) {
+        labels = ls ;
+    }
+
+    public String[] getLabels() {
+        return labels;
+    }
+
+    public void setHelperurl(String url) {
+        helperurl = url;
+    }
+
+    public String getHelperurl() {
+        return helperurl;
+    }
+
+    public void setAlertAdmin(boolean flag) {
+        alertAdmin = flag;
+    }
+
+    public boolean getAlertAdmin() {
+        return alertAdmin;
+    }
+
+}
diff --git a/src/org/biojava/dasobert/dasregistry/Das2Validator.java b/src/org/biojava/dasobert/dasregistry/Das2Validator.java
new file mode 100755 (executable)
index 0000000..a7fd293
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ *                  BioJava development code
+ *
+ * This code may be freely distributed and modified under the
+ * terms of the GNU Lesser General Public Licence.  This should
+ * be distributed with the code.  If you do not have a copy,
+ * see:
+ *
+ *      http://www.gnu.org/copyleft/lesser.html
+ *
+ * Copyright for this code is held jointly by the individual
+ * authors.  These should be listed in @author doc comments.
+ *
+ * For more information on the BioJava project and its aims,
+ * or to join the biojava-l mailing list, visit the home page
+ * at:
+ *
+ *      http://www.biojava.org/
+ * 
+ * Created on Mar 20, 2006
+ *
+ */
+package org.biojava.dasobert.dasregistry;
+
+import org.biojava.dasobert.das2.Das2Source;
+
+public class Das2Validator {
+
+    public Das2Validator() {
+        super();
+
+    }
+    
+    public boolean validate(Das2Source ds){
+        
+        // TODO this bit still needs to be implemented!
+        
+        return true;
+    }
+
+    
+    
+}
diff --git a/src/org/biojava/dasobert/dasregistry/DasCoordSysComparator.java b/src/org/biojava/dasobert/dasregistry/DasCoordSysComparator.java
new file mode 100755 (executable)
index 0000000..8715446
--- /dev/null
@@ -0,0 +1,116 @@
+/*
+ *                    BioJava development code
+ *
+ * This code may be freely distributed and modified under the
+ * terms of the GNU Lesser General Public Licence.  This should
+ * be distributed with the code.  If you do not have a copy,
+ * see:
+ *
+ *      http://www.gnu.org/copyleft/lesser.html
+ *
+ * Copyright for this code is held jointly by the individual
+ * authors.  These should be listed in @author doc comments.
+ *
+ * For more information on the BioJava project and its aims,
+ * or to join the biojava-l mailing list, visit the home page
+ * at:
+ *
+ *      http://www.biojava.org/
+ *
+ * Created on 15.04.2004
+ * @author Andreas Prlic
+ *
+ */
+
+
+package org.biojava.dasobert.dasregistry ;
+
+import java.util.Comparator ;
+import java.util.Map ;
+import java.util.HashMap ;
+
+import org.biojava.dasobert.dasregistry.DasCoordinateSystem;
+
+/** a comparator to sort DasSources 
+ * @author Andreas Prlic 
+ */
+
+
+public abstract class DasCoordSysComparator
+    implements Comparator
+{ 
+
+    private final String name ;
+    private static final Map COMPS_BY_NAME;
+
+
+    public DasCoordSysComparator(String str) {
+       //System.out.println("new dasSourceComparator " + str);
+       name = str ;
+    }
+   
+    public static final Comparator BY_NAME = new DasCoordSysComparator("name") {
+        protected Comparable getField(DasCoordinateSystem ds) {
+            return ds.getName();
+        }
+    };    
+
+    public static final Comparator BY_ID = new DasCoordSysComparator("id") {
+        protected Comparable getField(DasCoordinateSystem ds) {
+            return ds.getUniqueId();
+        }
+    };    
+    public static final Comparator BY_CATEGORY = new DasCoordSysComparator("category") {
+        protected Comparable getField(DasCoordinateSystem ds) {
+            return ds.getCategory();
+        }
+    };
+    public static final Comparator BY_ORGANISM = new DasCoordSysComparator("organism") {
+        protected Comparable getField(DasCoordinateSystem ds) {
+            return ds.getOrganismName();
+        }
+    };
+    public static final Comparator BY_TAXID = new DasCoordSysComparator("taxid") {
+        protected Comparable getField(DasCoordinateSystem ds) {
+            return ds.getNCBITaxId()+"";
+        }
+    };
+   
+    
+
+    static {
+        COMPS_BY_NAME = new HashMap();
+        COMPS_BY_NAME.put(BY_ID.toString(),           BY_ID);
+       COMPS_BY_NAME.put(BY_NAME.toString(),         BY_NAME);
+        COMPS_BY_NAME.put(BY_CATEGORY.toString(),     BY_CATEGORY);
+        COMPS_BY_NAME.put(BY_ORGANISM.toString(),     BY_ORGANISM);
+        COMPS_BY_NAME.put(BY_TAXID.toString(),        BY_TAXID);
+    }
+
+   
+
+    public static Comparator fromString(String name) {
+        if (COMPS_BY_NAME.containsKey(name)) {
+            return (Comparator) COMPS_BY_NAME.get(name);
+        } else {
+            throw new IllegalArgumentException("Can't compare by key " + name);
+        }
+    }
+
+    protected abstract Comparable getField(DasCoordinateSystem ds);
+
+    /** compare two DasCoordSys objects */
+    public int compare( Object a, Object b) {
+        DasCoordinateSystem x = (DasCoordinateSystem) a ;
+        DasCoordinateSystem y = (DasCoordinateSystem) b ;
+        return getField(x).compareTo(getField(y));
+    }
+
+    public String toString() {
+        return name;
+    }
+
+
+}
+
+
diff --git a/src/org/biojava/dasobert/dasregistry/DasCoordinateSystem.java b/src/org/biojava/dasobert/dasregistry/DasCoordinateSystem.java
new file mode 100755 (executable)
index 0000000..31caaf5
--- /dev/null
@@ -0,0 +1,159 @@
+/*
+ *                    BioJava development code
+ *
+ * This code may be freely distributed and modified under the
+ * terms of the GNU Lesser General Public Licence.  This should
+ * be distributed with the code.  If you do not have a copy,
+ * see:
+ *
+ *      http://www.gnu.org/copyleft/lesser.html
+ *
+ * Copyright for this code is held jointly by the individual
+ * authors.  These should be listed in @author doc comments.
+ *
+ * For more information on the BioJava project and its aims,
+ * or to join the biojava-l mailing list, visit the home page
+ * at:
+ *
+ *      http://www.biojava.org/
+ *
+ * Created on 15.04.2004
+ * @author Andreas Prlic
+ *
+ */
+package org.biojava.dasobert.dasregistry;
+
+
+/** a Bean to be returned via SOAP. It takes care of the DAS -  coordinate Systems 
+ * @author Andreas Prlic
+ */
+public class DasCoordinateSystem {
+
+    String name;
+    String category;
+    String organism_name;
+    int ncbi_tax_id ;
+    String uniqueId ;
+    String version;
+    String testCode;
+    
+    public DasCoordinateSystem () {
+        uniqueId = "";
+        name = "";
+        category ="";
+        organism_name = "";
+        ncbi_tax_id = 0;
+        version = "";
+        testCode = "";
+    }
+
+    public boolean equals(DasCoordinateSystem other){
+        boolean match = true;
+        System.out.println("comparing " + this.toString() + " to " + other.toString());
+        // URI has piority 
+        if ( (! uniqueId.equals("")) && ( uniqueId.equals( other.getUniqueId())))
+            return true;
+        
+        if ( ncbi_tax_id != other.getNCBITaxId()) {
+            System.out.println("mismatch in ncbi tax id " + ncbi_tax_id + " != " + other.getNCBITaxId());
+            match = false;
+        }
+        if ( ! version.equals(other.getVersion() )){
+            System.out.println("mismatch in version");
+            match = false;
+        }
+        if ( ! category.equals(other.getCategory())  ) {
+            System.out.println("mismatch in category");
+            match = false;
+        }
+        if ( ! name.equals(other.getName())) {
+            System.out.println("mismatch in name");   
+            match = false;
+        }
+        System.out.println(" match: " + match);
+        
+        return match;
+    }
+    
+    public Object clone() {
+        DasCoordinateSystem d = new DasCoordinateSystem();
+        d.setTestCode(testCode);
+        d.setCategory(category);
+        d.setName(name);
+        d.setNCBITaxId(ncbi_tax_id);
+        d.setUniqueId(getUniqueId());
+        d.setOrganismName(getOrganismName());
+        d.setVersion(getVersion());
+        return d;
+    }
+    
+    public String getTestCode() {
+        return testCode;
+    }
+
+
+
+    public void setTestCode(String testCode) {
+        if ( testCode == null)
+            testCode = "";
+        this.testCode = testCode;
+    }
+
+
+
+    public void setUniqueId(String id) { uniqueId = id ;   }
+    public String getUniqueId() { return uniqueId;         }
+
+    public void setName(String n) { name = n; }
+    public String getName() { return name; }
+    
+    public void setCategory(String c) { category = c;}
+    public String getCategory() { return category;}
+
+    public void setOrganismName(String t) { organism_name  =t;} 
+    public String getOrganismName() { return organism_name;}
+
+    public void setNCBITaxId(int id) { ncbi_tax_id = id;}
+    public int getNCBITaxId(){ return ncbi_tax_id ;}
+    
+    
+    
+
+    public String getVersion() {
+        return version;
+    }
+
+    public void setVersion(String version) {
+        if ( version == null)
+            version = "";
+        this.version = version;
+    }
+
+    public String toString() {
+        String nam = name;
+        if ( ! version.equals(""))
+            nam += "_" + version;
+        
+       if ( organism_name.equals("") ) 
+           return nam+","+category ;
+       else 
+           return nam+","+category+"," + organism_name ;
+    }
+
+    public static DasCoordinateSystem fromString(String rawString) {
+       String[] spl = rawString.split(",");
+       DasCoordinateSystem dcs = new DasCoordinateSystem();
+       if ( spl.length == 2 ) {
+           dcs.setName(spl[0]);           
+           dcs.setCategory(spl[1]);
+       } 
+       if ( spl.length == 3 ) {
+           dcs.setName(spl[0]);
+           dcs.setCategory(spl[1]);
+           dcs.setOrganismName(spl[2]);
+       }
+       return dcs;
+    }
+
+
+}
diff --git a/src/org/biojava/dasobert/dasregistry/DasSource.java b/src/org/biojava/dasobert/dasregistry/DasSource.java
new file mode 100755 (executable)
index 0000000..a2112b6
--- /dev/null
@@ -0,0 +1,105 @@
+/*
+ *                  BioJava development code
+ *
+ * This code may be freely distributed and modified under the
+ * terms of the GNU Lesser General Public Licence.  This should
+ * be distributed with the code.  If you do not have a copy,
+ * see:
+ *
+ *      http://www.gnu.org/copyleft/lesser.html
+ *
+ * Copyright for this code is held jointly by the individual
+ * authors.  These should be listed in @author doc comments.
+ *
+ * For more information on the BioJava project and its aims,
+ * or to join the biojava-l mailing list, visit the home page
+ * at:
+ *
+ *      http://www.biojava.org/
+ * 
+ * Created on Feb 8, 2006
+ *
+ */
+package org.biojava.dasobert.dasregistry;
+
+import java.util.Date;
+
+public interface DasSource {
+
+    public  void setLocal(boolean flag);
+
+    public  boolean isLocal();
+
+    /** compare if two das sources are equal
+     * 
+     * @param ds
+     * @return returns true if two DAS sources are equivalent
+     */
+    public boolean equals(DasSource ds);
+    
+    /** classes that implement equals, should also implement hashKey
+     * 
+     * @return the hash code of a das source
+     */
+    public int hashCode();
+    
+    
+    public  void setId(String i);
+
+    /** get a the Id of the DasSource. The Id is a unique db
+     * identifier. The public DAS-Registry has Auto_Ids that look like
+     * DASSOURCE:12345; public look like XYZ:12345, where the XYZ
+     * prefix can be configured in the config file.
+     * @return String the ID of a Das Source
+     */
+    public  String getId();
+
+    public  void setNickname(String name);
+
+    public  String getNickname();
+
+    public  void setUrl(String u);
+
+    public  void setAdminemail(String u);
+
+    public  void setDescription(String u);
+
+    public  void setCoordinateSystem(DasCoordinateSystem[] u);
+
+    public  void setCapabilities(String[] u);
+
+    public  String getUrl();
+
+    public  String getAdminemail();
+
+    public  String getDescription();
+
+    public  String[] getCapabilities();
+
+    public  DasCoordinateSystem[] getCoordinateSystem();
+
+    public  void setRegisterDate(Date d);
+
+    public  Date getRegisterDate();
+
+    public  void setLeaseDate(Date d);
+
+    public  Date getLeaseDate();
+
+    public  void setLabels(String[] ls);
+
+    public  String[] getLabels();
+
+    public  void setHelperurl(String url);
+
+    public  String getHelperurl();
+
+    // TestCode is now part of the coordinate system!
+    //public  void setTestCode(String code);
+    //public  String getTestCode();
+
+    public  void setAlertAdmin(boolean flag);
+
+    public  boolean getAlertAdmin();
+
+}
\ No newline at end of file
diff --git a/src/org/biojava/dasobert/dasregistry/DasSourceComparator.java b/src/org/biojava/dasobert/dasregistry/DasSourceComparator.java
new file mode 100755 (executable)
index 0000000..c07b32d
--- /dev/null
@@ -0,0 +1,140 @@
+/*
+ *                    BioJava development code
+ *
+ * This code may be freely distributed and modified under the
+ * terms of the GNU Lesser General Public Licence.  This should
+ * be distributed with the code.  If you do not have a copy,
+ * see:
+ *
+ *      http://www.gnu.org/copyleft/lesser.html
+ *
+ * Copyright for this code is held jointly by the individual
+ * authors.  These should be listed in @author doc comments.
+ *
+ * For more information on the BioJava project and its aims,
+ * or to join the biojava-l mailing list, visit the home page
+ * at:
+ *
+ *      http://www.biojava.org/
+ *
+ * Created on 15.04.2004
+ * @author Andreas Prlic
+ *
+ */
+
+
+package org.biojava.dasobert.dasregistry ;
+
+import java.util.Comparator ;
+import java.util.Map ;
+import java.util.HashMap ;
+
+
+/** a comparator to sort DasSources 
+ * @author Andreas Prlic, Thomas Down
+ */
+
+
+public abstract class DasSourceComparator
+    implements Comparator
+{ 
+
+    private final String name ;
+    private static final Map COMPS_BY_NAME;
+
+
+    public DasSourceComparator(String str) {
+       //System.out.println("new dasSourceComparator " + str);
+       name = str ;
+    }
+   
+    public static final Comparator BY_ID = new DasSourceComparator("id") {
+        protected Comparable getField(DasSource ds) {
+            return ds.getId();
+        }
+    };    
+
+    public static final Comparator BY_NICKNAME = new DasSourceComparator("nickname") {
+        protected Comparable getField(DasSource ds) {
+            return ds.getNickname();
+        }
+    };    
+    public static final Comparator BY_REGISTER_DATE = new DasSourceComparator("registerdate") {
+        protected Comparable getField(DasSource ds) {
+            return ds.getRegisterDate();
+        }
+    };
+    public static final Comparator BY_LEASE_DATE = new DasSourceComparator("leasedate") {
+        protected Comparable getField(DasSource ds) {
+            return ds.getLeaseDate();
+        }
+    };
+    public static final Comparator BY_URL = new DasSourceComparator("url") {
+        protected Comparable getField(DasSource ds) {
+            return ds.getUrl();
+        }
+    };
+    public static final Comparator BY_ADMIN_EMAIL = new DasSourceComparator("adminemail") {
+        protected Comparable getField(DasSource ds) {
+            return ds.getAdminemail();
+        }
+    };
+    public static final Comparator BY_DESCRIPTION = new DasSourceComparator("description") {
+        protected Comparable getField(DasSource ds) {
+            return ds.getDescription();
+        }
+    };
+    public static final Comparator BY_CAPABILITIES = new DasSourceComparator("capabilities") {
+        protected Comparable getField(DasSource ds) {
+            String[] caps = ds.getCapabilities();
+            return caps.length == 0 ? "" : caps[0];
+        }
+    };
+    public static final Comparator BY_COORDINATE_SYSTEM = new DasSourceComparator("coordinateSystem") {
+        protected Comparable getField(DasSource ds) {
+            DasCoordinateSystem[] dcss = ds.getCoordinateSystem();
+            return dcss.length == 0 ? "" : dcss[0].toString();
+        }
+    };
+
+    static {
+        COMPS_BY_NAME = new HashMap();
+        COMPS_BY_NAME.put(BY_ID.toString(),                BY_ID);
+        COMPS_BY_NAME.put(BY_NICKNAME.toString(),          BY_NICKNAME);
+        COMPS_BY_NAME.put(BY_REGISTER_DATE.toString(),     BY_REGISTER_DATE);
+        COMPS_BY_NAME.put(BY_LEASE_DATE.toString(),        BY_LEASE_DATE);
+        COMPS_BY_NAME.put(BY_URL.toString(),               BY_URL);
+        COMPS_BY_NAME.put(BY_ADMIN_EMAIL.toString(),       BY_ADMIN_EMAIL);
+        COMPS_BY_NAME.put(BY_DESCRIPTION.toString(),       BY_DESCRIPTION);
+        COMPS_BY_NAME.put(BY_CAPABILITIES.toString(),      BY_CAPABILITIES);
+        COMPS_BY_NAME.put(BY_COORDINATE_SYSTEM.toString(), BY_COORDINATE_SYSTEM);
+    }
+
+   
+
+    public static Comparator fromString(String name) {
+        if (COMPS_BY_NAME.containsKey(name)) {
+            return (Comparator) COMPS_BY_NAME.get(name);
+        } else {
+            throw new IllegalArgumentException("Can't compare by key " + name);
+        }
+    }
+
+    protected abstract Comparable getField(DasSource ds);
+
+    /** compare two DasSource objects */
+    public int compare( Object a, Object b) {
+        
+        DasSource x = (DasSource) a ;
+        DasSource y = (DasSource) b ;
+        return getField(x).compareTo(getField(y));
+    }
+
+    public String toString() {
+        return name;
+    }
+
+
+}
+
+
diff --git a/src/org/biojava/dasobert/eventmodel/FeatureEvent.java b/src/org/biojava/dasobert/eventmodel/FeatureEvent.java
new file mode 100755 (executable)
index 0000000..4c9ac37
--- /dev/null
@@ -0,0 +1,72 @@
+/*
+ *                  BioJava development code
+ *
+ * This code may be freely distributed and modified under the
+ * terms of the GNU Lesser General Public Licence.  This should
+ * be distributed with the code.  If you do not have a copy,
+ * see:
+ *
+ *      http://www.gnu.org/copyleft/lesser.html
+ *
+ * Copyright for this code is held jointly by the individual
+ * authors.  These should be listed in @author doc comments.
+ *
+ * For more information on the BioJava project and its aims,
+ * or to join the biojava-l mailing list, visit the home page
+ * at:
+ *
+ *      http://www.biojava.org/
+ * 
+ * Created on Oct 28, 2005
+ *
+ */
+package org.biojava.dasobert.eventmodel;
+
+import java.util.Map;
+
+import org.biojava.dasobert.dasregistry.Das1Source;
+public class FeatureEvent {
+    
+    Map[] features;
+    Das1Source dasSource;
+    int comeBackLater;
+    
+    public FeatureEvent(Map[] features,Das1Source dasSource) {
+        super();
+        this.features =features;
+        this.dasSource = dasSource;
+        comeBackLater = -1;
+    }
+    
+    public int getComeBackLater(){
+        return comeBackLater;
+    }
+    
+    public void setComeBackLater(int comeBackLater){
+        this.comeBackLater = comeBackLater;
+    }
+    
+    
+    /** get the features that have been found.
+     * 
+     * do something like
+     * Map[] features = event.getFeatures();
+     * <pre>
+     * for (int i = 0 ; i< features;i++) {            
+     *      Map f = features[i];
+     *      String type = (String) f.get("TYPE") ;
+     *      System.out.println(type);
+     * }      
+     * </pre>
+     * @return a Map containng the features
+     */
+    public Map[] getFeatures(){
+        return features;
+    }
+    
+    public Das1Source getDasSource(){
+        return dasSource;
+    }
+    
+}
+
diff --git a/src/org/biojava/dasobert/eventmodel/FeatureListener.java b/src/org/biojava/dasobert/eventmodel/FeatureListener.java
new file mode 100755 (executable)
index 0000000..0091ef1
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ *                  BioJava development code
+ *
+ * This code may be freely distributed and modified under the
+ * terms of the GNU Lesser General Public Licence.  This should
+ * be distributed with the code.  If you do not have a copy,
+ * see:
+ *
+ *      http://www.gnu.org/copyleft/lesser.html
+ *
+ * Copyright for this code is held jointly by the individual
+ * authors.  These should be listed in @author doc comments.
+ *
+ * For more information on the BioJava project and its aims,
+ * or to join the biojava-l mailing list, visit the home page
+ * at:
+ *
+ *      http://www.biojava.org/
+ * 
+ * Created on Oct 28, 2005
+ *
+ */
+package org.biojava.dasobert.eventmodel;
+
+//import org.biojava.spice.multipanel.eventmodel.FeatureEvent;
+
+/**  a feature listener that returns the raw features as returned by a DAS source.
+ * 
+ */  
+public interface FeatureListener {
+    
+    /** new features have been returned from the Annotation server 
+     * 
+     * @param e
+     */
+    public void newFeatures(FeatureEvent e);
+    
+    /** the server says that he is busy and we should try again in x seconds
+     * 
+     * @param e
+     */
+    public void comeBackLater(FeatureEvent e);
+    
+}
+
+    
+    
+    
+
diff --git a/src/org/biojava/dasobert/eventmodel/ObjectListener.java b/src/org/biojava/dasobert/eventmodel/ObjectListener.java
new file mode 100755 (executable)
index 0000000..7b136a4
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ *                  BioJava development code
+ *
+ * This code may be freely distributed and modified under the
+ * terms of the GNU Lesser General Public Licence.  This should
+ * be distributed with the code.  If you do not have a copy,
+ * see:
+ *
+ *      http://www.gnu.org/copyleft/lesser.html
+ *
+ * Copyright for this code is held jointly by the individual
+ * authors.  These should be listed in @author doc comments.
+ *
+ * For more information on the BioJava project and its aims,
+ * or to join the biojava-l mailing list, visit the home page
+ * at:
+ *
+ *      http://www.biojava.org/
+ * 
+ * Created on Nov 1, 2005
+ *
+ */
+package org.biojava.dasobert.eventmodel;
+
+/** an interface for the listeners of new PDB code requested / new Uniprot code requested
+ * 
+ * @author Andreas Prlic
+ *
+ */
+public interface ObjectListener {
+    
+    /** a new object has been requested 
+     * 
+     * @param accessionCode
+     */
+    public void newObjectRequested(String accessionCode);
+    
+    /** no object with that accessionCode has been found
+     * 
+     * @param accessionCode
+     */
+    public void noObjectFound(String accessionCode);
+    
+    
+   // public void exceptionOccured(Exception e);
+   
+}
diff --git a/src/org/biojava/dasobert/eventmodel/SequenceEvent.java b/src/org/biojava/dasobert/eventmodel/SequenceEvent.java
new file mode 100755 (executable)
index 0000000..c3123ff
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ *                  BioJava development code
+ *
+ * This code may be freely distributed and modified under the
+ * terms of the GNU Lesser General Public Licence.  This should
+ * be distributed with the code.  If you do not have a copy,
+ * see:
+ *
+ *      http://www.gnu.org/copyleft/lesser.html
+ *
+ * Copyright for this code is held jointly by the individual
+ * authors.  These should be listed in @author doc comments.
+ *
+ * For more information on the BioJava project and its aims,
+ * or to join the biojava-l mailing list, visit the home page
+ * at:
+ *
+ *      http://www.biojava.org/
+ * 
+ * Created on Nov 20, 2005
+ *
+ */
+package org.biojava.dasobert.eventmodel;
+
+
+public class SequenceEvent {
+
+    String sequence;
+    String accessionCode;
+    public SequenceEvent(String accessionCode, String seq) {
+        super();
+        sequence = seq;
+        this.accessionCode = accessionCode;
+    }
+    
+    public String getAccessionCode(){
+        return accessionCode;
+    }
+    
+    public String getSequence(){
+        return sequence;
+    }
+
+}
diff --git a/src/org/biojava/dasobert/eventmodel/SequenceListener.java b/src/org/biojava/dasobert/eventmodel/SequenceListener.java
new file mode 100755 (executable)
index 0000000..58cbdb3
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ *                  BioJava development code
+ *
+ * This code may be freely distributed and modified under the
+ * terms of the GNU Lesser General Public Licence.  This should
+ * be distributed with the code.  If you do not have a copy,
+ * see:
+ *
+ *      http://www.gnu.org/copyleft/lesser.html
+ *
+ * Copyright for this code is held jointly by the individual
+ * authors.  These should be listed in @author doc comments.
+ *
+ * For more information on the BioJava project and its aims,
+ * or to join the biojava-l mailing list, visit the home page
+ * at:
+ *
+ *      http://www.biojava.org/
+ * 
+ * Created on Jun 10, 2005
+ *
+ */
+package org.biojava.dasobert.eventmodel;
+
+/** An interface fore events related to selections of sequence
+ * position, sequence range and locking of the selection.
+ *
+ * @author Andreas Prlic
+ *
+ */
+public interface SequenceListener 
+extends ObjectListener{
+    
+    /* select a certain sequence position */
+    public void selectedSeqPosition(int position);
+    
+    /** select a certain range of a sequence 
+     * @param start the start
+     * @param end the end of the range
+     * */
+    public void selectedSeqRange(int start, int end);
+    
+    /** the current selecetion is locked and can not be changed 
+     * @param flag true if selection should be locked
+     * */
+    public void selectionLocked(boolean flag);
+    
+    public void newSequence(SequenceEvent e);
+    
+    /** clear what has been selected
+     * 
+     *
+     */
+    public void clearSelection();
+}