AlignmentAnnotation: added annotation score attribute and allowed for annotation...
authorjprocter <Jim Procter>
Wed, 25 Apr 2007 11:47:48 +0000 (11:47 +0000)
committerjprocter <Jim Procter>
Wed, 25 Apr 2007 11:47:48 +0000 (11:47 +0000)
12 files changed:
schemas/vamsas.xsd
src/jalview/analysis/Dna.java
src/jalview/appletgui/AnnotationLabels.java
src/jalview/commands/EditCommand.java
src/jalview/datamodel/AlignmentAnnotation.java
src/jalview/gui/AnnotationLabels.java
src/jalview/gui/Jalview2XML.java
src/jalview/io/AnnotationFile.java
src/jalview/schemabinding/version2/Annotation.java
src/jalview/schemabinding/version2/AnnotationDescriptor.java
src/jalview/schemabinding/version2/StructureState.java
src/jalview/schemabinding/version2/StructureStateDescriptor.java

index 4cc56b3..1a24509 100755 (executable)
@@ -1,82 +1,84 @@
-<?xml version="1.0" encoding="UTF-8"?>\r
-<!-- edited with XMLSpy v2006 sp1 U (http://www.altova.com) by ioh[ (o[ih[oh) -->\r
-<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:vamsas="www.vamsas.ac.uk/jalview/version2" targetNamespace="www.vamsas.ac.uk/jalview/version2" elementFormDefault="qualified" attributeFormDefault="unqualified">\r
-       <xs:complexType name="VAMSAS">\r
-               <xs:sequence>\r
-                       <xs:element name="Tree" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>\r
-                       <xs:element ref="vamsas:SequenceSet" minOccurs="0" maxOccurs="unbounded"/>\r
-               </xs:sequence>\r
-       </xs:complexType>\r
-       <xs:element name="SequenceSet">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="Sequence" minOccurs="0" maxOccurs="unbounded">\r
-                                       <xs:complexType>\r
-                                               <xs:complexContent>\r
-                                                       <xs:extension base="vamsas:SequenceType">\r
-                                                               <xs:sequence>\r
-                                                                       <xs:element name="DBRef" minOccurs="0" maxOccurs="unbounded">\r
-                                                                               <xs:complexType>\r
-                                                                                       <xs:attribute name="source" type="xs:string"/>\r
-                                                                                       <xs:attribute name="version" type="xs:string"/>\r
-                                                                                       <xs:attribute name="accessionId" type="xs:string"/>\r
-                                                                               </xs:complexType>\r
-                                                                       </xs:element>\r
-                                                               </xs:sequence>\r
-                                                       </xs:extension>\r
-                                               </xs:complexContent>\r
-                                       </xs:complexType>\r
-                               </xs:element>\r
-                               <xs:element name="Annotation" minOccurs="0" maxOccurs="unbounded">\r
-                                       <xs:complexType>\r
-                                               <xs:sequence>\r
-                                                       <xs:element ref="vamsas:annotationElement" minOccurs="0" maxOccurs="unbounded"/>\r
-                                                       <xs:element name="label" type="xs:string"/>\r
-                                                       <xs:element name="description" type="xs:string" minOccurs="0"/>\r
-                                                       <xs:element name="thresholdLine" minOccurs="0">\r
-                                                               <xs:complexType>\r
-                                                                       <xs:attribute name="label" type="xs:string"/>\r
-                                                                       <xs:attribute name="value" type="xs:float"/>\r
-                                                                       <xs:attribute name="colour" type="xs:int"/>\r
-                                                               </xs:complexType>\r
-                                                       </xs:element>\r
-                                               </xs:sequence>\r
-                                               <xs:attribute name="graph" type="xs:boolean" use="required"/>\r
-                                               <xs:attribute name="graphType" type="xs:int" use="optional"/>\r
-                                               <xs:attribute name="sequenceRef" type="xs:string" use="optional"/>\r
-                                               <xs:attribute name="graphColour" type="xs:int" use="optional"/>\r
-                                               <xs:attribute name="graphGroup" type="xs:int" use="optional"/>\r
-                                               <xs:attribute name="id" type="xs:string" use="optional"/>\r
-                                       </xs:complexType>\r
-                               </xs:element>\r
-                       </xs:sequence>\r
-                       <xs:attribute name="gapChar" type="xs:string" use="required"/>\r
-               </xs:complexType>\r
-       </xs:element>\r
-       <xs:element name="annotationElement">\r
-               <xs:complexType>\r
-                       <xs:sequence>\r
-                               <xs:element name="displayCharacter" type="xs:string" minOccurs="0"/>\r
-                               <xs:element name="description" type="xs:string" minOccurs="0"/>\r
-                               <xs:element name="secondaryStructure" minOccurs="0">\r
-                                       <xs:simpleType>\r
-                                               <xs:restriction base="xs:string">\r
-                                                       <xs:length value="1"/>\r
-                                               </xs:restriction>\r
-                                       </xs:simpleType>\r
-                               </xs:element>\r
-                               <xs:element name="value" type="xs:float" minOccurs="0"/>\r
-                       </xs:sequence>\r
-                       <xs:attribute name="position" type="xs:int" use="required"/>\r
-                       <xs:attribute name="colour" type="xs:int" use="optional"/>\r
-               </xs:complexType>\r
-       </xs:element>\r
-       <xs:complexType name="SequenceType">\r
-               <xs:sequence>\r
-                       <xs:element name="sequence" type="xs:string" minOccurs="0"/>\r
-                       <xs:element name="name" type="xs:string" minOccurs="0"/>\r
-               </xs:sequence>\r
-               <xs:attribute name="id" type="xs:string"/>\r
-               <xs:attribute name="description" type="xs:string"/>\r
-       </xs:complexType>\r
-</xs:schema>\r
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- edited with XMLSpy v2006 sp1 U (http://www.altova.com) by ioh[ (o[ih[oh) -->
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:vamsas="www.vamsas.ac.uk/jalview/version2" targetNamespace="www.vamsas.ac.uk/jalview/version2" elementFormDefault="qualified" attributeFormDefault="unqualified">
+       <xs:complexType name="VAMSAS">
+               <xs:sequence>
+                       <xs:element name="Tree" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
+                       <xs:element ref="vamsas:SequenceSet" minOccurs="0" maxOccurs="unbounded"/>
+               </xs:sequence>
+       </xs:complexType>
+       <xs:element name="SequenceSet">
+               <xs:complexType>
+                       <xs:sequence>
+                               <xs:element name="Sequence" minOccurs="0" maxOccurs="unbounded">
+                                       <xs:complexType>
+                                               <xs:complexContent>
+                                                       <xs:extension base="vamsas:SequenceType">
+                                                               <xs:sequence>
+                                                                       <xs:element name="DBRef" minOccurs="0" maxOccurs="unbounded">
+                                                                               <xs:complexType>
+                                                                                       <xs:attribute name="source" type="xs:string"/>
+                                                                                       <xs:attribute name="version" type="xs:string"/>
+                                                                                       <xs:attribute name="accessionId" type="xs:string"/>
+                                                                               </xs:complexType>
+                                                                       </xs:element>
+                                                               </xs:sequence>
+                                                       </xs:extension>
+                                               </xs:complexContent>
+                                       </xs:complexType>
+                               </xs:element>
+                               <xs:element name="Annotation" minOccurs="0" maxOccurs="unbounded">
+                                       <xs:complexType>
+                                               <xs:sequence>
+                                                       <xs:element ref="vamsas:annotationElement" minOccurs="0" maxOccurs="unbounded"/>
+                                                       <xs:element name="label" type="xs:string"/>
+                                                       <xs:element name="description" type="xs:string" minOccurs="0"/>
+                                                       <xs:element name="thresholdLine" minOccurs="0">
+                                                               <xs:complexType>
+                                                                       <xs:attribute name="label" type="xs:string"/>
+                                                                       <xs:attribute name="value" type="xs:float"/>
+                                                                       <xs:attribute name="colour" type="xs:int"/>
+                                                               </xs:complexType>
+                                                       </xs:element>
+                                               </xs:sequence>
+                                               <xs:attribute name="graph" type="xs:boolean" use="required"/>
+                                               <xs:attribute name="graphType" type="xs:int" use="optional"/>
+                                               <xs:attribute name="sequenceRef" type="xs:string" use="optional"/>
+                                               <xs:attribute name="graphColour" type="xs:int" use="optional"/>
+                                               <xs:attribute name="graphGroup" type="xs:int" use="optional"/>
+                                               <xs:attribute name="id" type="xs:string" use="optional"/>
+                                               <xs:attribute name="scoreOnly" type="xs:boolean" use="optional" default="false"/>
+                                               <xs:attribute name="score" type="xs:float" use="optional"/>
+                                       </xs:complexType>
+                               </xs:element>
+                       </xs:sequence>
+                       <xs:attribute name="gapChar" type="xs:string" use="required"/>
+               </xs:complexType>
+       </xs:element>
+       <xs:element name="annotationElement">
+               <xs:complexType>
+                       <xs:sequence>
+                               <xs:element name="displayCharacter" type="xs:string" minOccurs="0"/>
+                               <xs:element name="description" type="xs:string" minOccurs="0"/>
+                               <xs:element name="secondaryStructure" minOccurs="0">
+                                       <xs:simpleType>
+                                               <xs:restriction base="xs:string">
+                                                       <xs:length value="1"/>
+                                               </xs:restriction>
+                                       </xs:simpleType>
+                               </xs:element>
+                               <xs:element name="value" type="xs:float" minOccurs="0"/>
+                       </xs:sequence>
+                       <xs:attribute name="position" type="xs:int" use="required"/>
+                       <xs:attribute name="colour" type="xs:int" use="optional"/>
+               </xs:complexType>
+       </xs:element>
+       <xs:complexType name="SequenceType">
+               <xs:sequence>
+                       <xs:element name="sequence" type="xs:string" minOccurs="0"/>
+                       <xs:element name="name" type="xs:string" minOccurs="0"/>
+               </xs:sequence>
+               <xs:attribute name="id" type="xs:string"/>
+               <xs:attribute name="description" type="xs:string"/>
+       </xs:complexType>
+</xs:schema>
index 836c39e..5096ae8 100644 (file)
@@ -197,28 +197,36 @@ public class Dna {
         if (annotations[i].autoCalculated) {\r
           continue;\r
         }\r
-\r
-        aSize = aslen; // aa alignment width.\r
-        jalview.datamodel.Annotation[] anots =\r
-          new jalview.datamodel.Annotation[aSize];\r
         \r
-        for (a = 0; a < aSize; a++)\r
+        aSize = aslen; // aa alignment width.\r
+        jalview.datamodel.Annotation[] anots = \r
+          (annotations[i].annotations==null) \r
+          ? null :\r
+            new jalview.datamodel.Annotation[aSize];\r
+        if (anots!=null)\r
         {\r
-          // process through codon map.\r
-          if (codons[a]!=null && codons[a][0]==(codons[a][2]-2))\r
+          for (a = 0; a < aSize; a++)\r
           {\r
-            pos = codons[a][0];\r
-            if (annotations[i].annotations[pos] == null\r
-                || annotations[i].annotations[pos] == null)\r
-              continue;\r
+            // process through codon map.\r
+            if (codons[a]!=null && codons[a][0]==(codons[a][2]-2))\r
+            {\r
+              pos = codons[a][0];\r
+              if (annotations[i].annotations[pos] == null\r
+                      || annotations[i].annotations[pos] == null)\r
+                continue;\r
             \r
-            anots[a] = new Annotation(annotations[i].annotations[pos]);\r
+              anots[a] = new Annotation(annotations[i].annotations[pos]);\r
+            }\r
           }\r
         }\r
 \r
         jalview.datamodel.AlignmentAnnotation aa\r
         = new jalview.datamodel.AlignmentAnnotation(annotations[i].label,\r
             annotations[i].description, anots);\r
+        if (annotations[i].hasScore)\r
+        {\r
+          aa.setScore(annotations[i].getScore());\r
+        }\r
         al.addAnnotation(aa);\r
       }\r
     }\r
index a952f9d..1884a08 100755 (executable)
-/*\r
- * Jalview - A Sequence Alignment Editor and Viewer\r
- * Copyright (C) 2007 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.util.*;\r
-\r
-import java.awt.*;\r
-import java.awt.event.*;\r
-\r
-import jalview.datamodel.*;\r
-\r
-public class AnnotationLabels\r
-    extends Panel implements ActionListener, MouseListener, MouseMotionListener\r
-{\r
-  Image image;\r
-  boolean active = false;\r
-  AlignmentPanel ap;\r
-  AlignViewport av;\r
-  boolean resizing = false;\r
-  int oldY, mouseX;\r
-\r
-  static String ADDNEW = "Add New Row";\r
-  static String EDITNAME = "Edit Label/Description";\r
-  static String HIDE = "Hide This Row";\r
-  static String SHOWALL = "Show All Hidden Rows";\r
-  static String OUTPUT_TEXT = "Show Values In Textbox";\r
-  static String COPYCONS_SEQ = "Copy Consensus Sequence";\r
-\r
-  int scrollOffset = 0;\r
-  int selectedRow = -1;\r
-\r
-  Tooltip tooltip;\r
-\r
-  public AnnotationLabels(AlignmentPanel ap)\r
-  {\r
-    this.ap = ap;\r
-    this.av = ap.av;\r
-    setLayout(null);\r
-    addMouseListener(this);\r
-    addMouseMotionListener(this);\r
-  }\r
-\r
-  public AnnotationLabels(AlignViewport av)\r
-  {\r
-    this.av = av;\r
-  }\r
-\r
-  public void setScrollOffset(int y)\r
-  {\r
-    scrollOffset = y;\r
-    repaint();\r
-  }\r
-\r
-  int getSelectedRow(int y)\r
-  {\r
-    int row = -1;\r
-    AlignmentAnnotation[] aa = ap.av.alignment.getAlignmentAnnotation();\r
-\r
-    if (aa == null)\r
-    {\r
-      return row;\r
-    }\r
-\r
-    int height = 0;\r
-    for (int i = 0; i < aa.length; i++)\r
-    {\r
-      if (!aa[i].visible)\r
-      {\r
-        continue;\r
-      }\r
-\r
-      height += aa[i].height;\r
-      if (y < height)\r
-      {\r
-        row = i;\r
-        break;\r
-      }\r
-    }\r
-\r
-    return row;\r
-  }\r
-\r
-  public void actionPerformed(ActionEvent evt)\r
-  {\r
-    AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();\r
-\r
-    if (evt.getActionCommand().equals(ADDNEW))\r
-    {\r
-      AlignmentAnnotation newAnnotation = new AlignmentAnnotation("",\r
-          null,\r
-          new Annotation[ap.av.alignment.getWidth()]);\r
-\r
-      if (!editLabelDescription(newAnnotation))\r
-      {\r
-        return;\r
-      }\r
-\r
-      ap.av.alignment.addAnnotation(newAnnotation);\r
-      ap.av.alignment.setAnnotationIndex(newAnnotation, 0);\r
-    }\r
-    else if (evt.getActionCommand().equals(EDITNAME))\r
-    {\r
-      editLabelDescription(aa[selectedRow]);\r
-    }\r
-    else if (evt.getActionCommand().equals(HIDE))\r
-    {\r
-      aa[selectedRow].visible = false;\r
-    }\r
-    else if (evt.getActionCommand().equals(SHOWALL))\r
-    {\r
-      for (int i = 0; i < aa.length; i++)\r
-      {\r
-        aa[i].visible = true;\r
-      }\r
-    }\r
-    else if (evt.getActionCommand().equals(OUTPUT_TEXT))\r
-    {\r
-      CutAndPasteTransfer cap = new CutAndPasteTransfer(false, ap.alignFrame);\r
-      Frame frame = new Frame();\r
-      frame.add(cap);\r
-      jalview.bin.JalviewLite.addFrame(frame,\r
-                                       ap.alignFrame.getTitle() + " - " +\r
-                                       aa[selectedRow].label, 500, 100);\r
-      cap.setText(aa[selectedRow].toString());\r
-    }\r
-    else if (evt.getActionCommand().equals(COPYCONS_SEQ))\r
-    {\r
-      SequenceI cons = av.getConsensusSeq();\r
-      if (cons != null)\r
-      {\r
-        copy_annotseqtoclipboard(cons);\r
-      }\r
-\r
-    }\r
-    ap.annotationPanel.adjustPanelHeight();\r
-    setSize(getSize().width, ap.annotationPanel.getSize().height);\r
-    ap.validate();\r
-    ap.paintAlignment(true);\r
-  }\r
-\r
-  boolean editLabelDescription(AlignmentAnnotation annotation)\r
-  {\r
-    EditNameDialog dialog = new EditNameDialog(\r
-        annotation.label,\r
-        annotation.description,\r
-        "       Annotation Label",\r
-        "Annotation Description",\r
-        ap.alignFrame,\r
-        "Edit Annotation Name / Description",\r
-        500, 100);\r
-\r
-    if (dialog.accept)\r
-    {\r
-      annotation.label = dialog.getName();\r
-      annotation.description = dialog.getDescription();\r
-      repaint();\r
-      return true;\r
-    }\r
-    else\r
-      return false;\r
-\r
-  }\r
-\r
-  public void mouseMoved(MouseEvent evt)\r
-  {\r
-    int row = getSelectedRow(evt.getY() - scrollOffset);\r
-\r
-    if (row > -1)\r
-    {\r
-      if (tooltip == null)\r
-      {\r
-        tooltip = new Tooltip(ap.av.alignment.\r
-                              getAlignmentAnnotation()[row].\r
-                              description,\r
-                              this);\r
-      }\r
-      else\r
-      {\r
-        tooltip.setTip(ap.av.alignment.\r
-                       getAlignmentAnnotation()[row].description);\r
-      }\r
-    }\r
-    else if (tooltip != null)\r
-    {\r
-      tooltip.setTip("");\r
-    }\r
-\r
-  }\r
-\r
-  public void mouseDragged(MouseEvent evt)\r
-  {}\r
-\r
-  public void mouseClicked(MouseEvent evt)\r
-  {}\r
-\r
-  public void mouseReleased(MouseEvent evt)\r
-  {}\r
-\r
-  public void mouseEntered(MouseEvent evt)\r
-  {}\r
-\r
-  public void mouseExited(MouseEvent evt)\r
-  {}\r
-\r
-  public void mousePressed(MouseEvent evt)\r
-  {\r
-    selectedRow = getSelectedRow(evt.getY() - scrollOffset);\r
-\r
-    AlignmentAnnotation[] aa = ap.av.alignment.getAlignmentAnnotation();\r
-\r
-    PopupMenu popup = new PopupMenu("Annotations");\r
-\r
-    MenuItem item = new MenuItem(ADDNEW);\r
-    item.addActionListener(this);\r
-    popup.add(item);\r
-    item = new MenuItem(EDITNAME);\r
-    item.addActionListener(this);\r
-    popup.add(item);\r
-    item = new MenuItem(HIDE);\r
-    item.addActionListener(this);\r
-    popup.add(item);\r
-    item = new MenuItem(SHOWALL);\r
-    item.addActionListener(this);\r
-    popup.add(item);\r
-    this.add(popup);\r
-    item = new MenuItem(OUTPUT_TEXT);\r
-    item.addActionListener(this);\r
-    popup.add(item);\r
-\r
-    if (aa[selectedRow] == ap.av.consensus)\r
-    {\r
-      popup.addSeparator();\r
-      final CheckboxMenuItem cbmi = new CheckboxMenuItem(\r
-          "Ignore Gaps In Consensus",\r
-          ap.av.getIgnoreGapsConsensus());\r
-\r
-      cbmi.addItemListener(new ItemListener()\r
-      {\r
-        public void itemStateChanged(ItemEvent e)\r
-        {\r
-          ap.av.setIgnoreGapsConsensus(cbmi.getState());\r
-          ap.paintAlignment(true);\r
-        }\r
-      });\r
-      popup.add(cbmi);\r
-      item = new MenuItem(COPYCONS_SEQ);\r
-      item.addActionListener(this);\r
-      popup.add(item);\r
-    }\r
-\r
-    popup.show(this, evt.getX(), evt.getY());\r
-\r
-  }\r
-\r
-  /**\r
-   * DOCUMENT ME!\r
-   *\r
-   * @param e DOCUMENT ME!\r
-   */\r
-  protected void copy_annotseqtoclipboard(SequenceI sq)\r
-  {\r
-    if (sq == null || sq.getLength() < 1)\r
-    {\r
-      return;\r
-    }\r
-    jalview.appletgui.AlignFrame.copiedSequences = new StringBuffer();\r
-    jalview.appletgui.AlignFrame.copiedSequences.append(sq.getName() + "\t" +\r
-        sq.getStart() + "\t" +\r
-        sq.getEnd() + "\t" +\r
-        sq.getSequenceAsString() + "\n");\r
-    if (av.hasHiddenColumns)\r
-    {\r
-      jalview.appletgui.AlignFrame.copiedHiddenColumns = new Vector();\r
-      for (int i = 0; i < av.getColumnSelection().getHiddenColumns().size(); i++)\r
-      {\r
-        int[] region = (int[])\r
-            av.getColumnSelection().getHiddenColumns().elementAt(i);\r
-\r
-        jalview.appletgui.AlignFrame.copiedHiddenColumns.addElement(new int[]\r
-            {region[0],\r
-            region[1]});\r
-      }\r
-    }\r
-  }\r
-\r
-  public void update(Graphics g)\r
-  {\r
-    paint(g);\r
-  }\r
-\r
-  public void paint(Graphics g)\r
-  {\r
-    int w = getSize().width;\r
-    if (image == null || w != image.getWidth(this))\r
-    {\r
-      image = createImage(w, ap.annotationPanel.getSize().height);\r
-    }\r
-\r
-    drawComponent(image.getGraphics(), w);\r
-    g.drawImage(image, 0, 0, this);\r
-  }\r
-\r
-  public void drawComponent(Graphics g, int width)\r
-  {\r
-    g.setFont(av.getFont());\r
-    FontMetrics fm = g.getFontMetrics(av.getFont());\r
-    g.setColor(Color.white);\r
-    g.fillRect(0, 0, getSize().width, getSize().height);\r
-\r
-    g.translate(0, scrollOffset);\r
-    g.setColor(Color.black);\r
-\r
-    AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();\r
-    int y = g.getFont().getSize();\r
-    int x = 0;\r
-\r
-    if (aa != null)\r
-    {\r
-      for (int i = 0; i < aa.length; i++)\r
-      {\r
-        if (!aa[i].visible)\r
-        {\r
-          continue;\r
-        }\r
-\r
-        x = width - fm.stringWidth(aa[i].label) - 3;\r
-\r
-        if (aa[i].graph > 0)\r
-        {\r
-          y += (aa[i].height / 3);\r
-        }\r
-\r
-        g.drawString(aa[i].label, x, y);\r
-\r
-        if (aa[i].graph > 0)\r
-        {\r
-          y += (2 * aa[i].height / 3);\r
-        }\r
-        else\r
-        {\r
-          y += aa[i].height;\r
-        }\r
-      }\r
-    }\r
-  }\r
-\r
-}\r
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer
+ * Copyright (C) 2007 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.appletgui;
+
+import java.util.*;
+
+import java.awt.*;
+import java.awt.event.*;
+
+import jalview.datamodel.*;
+
+public class AnnotationLabels
+    extends Panel implements ActionListener, MouseListener, MouseMotionListener
+{
+  Image image;
+  boolean active = false;
+  AlignmentPanel ap;
+  AlignViewport av;
+  boolean resizing = false;
+  int oldY, mouseX;
+
+  static String ADDNEW = "Add New Row";
+  static String EDITNAME = "Edit Label/Description";
+  static String HIDE = "Hide This Row";
+  static String SHOWALL = "Show All Hidden Rows";
+  static String OUTPUT_TEXT = "Show Values In Textbox";
+  static String COPYCONS_SEQ = "Copy Consensus Sequence";
+
+  int scrollOffset = 0;
+  int selectedRow = -1;
+
+  Tooltip tooltip;
+
+  public AnnotationLabels(AlignmentPanel ap)
+  {
+    this.ap = ap;
+    this.av = ap.av;
+    setLayout(null);
+    addMouseListener(this);
+    addMouseMotionListener(this);
+  }
+
+  public AnnotationLabels(AlignViewport av)
+  {
+    this.av = av;
+  }
+
+  public void setScrollOffset(int y)
+  {
+    scrollOffset = y;
+    repaint();
+  }
+
+  int getSelectedRow(int y)
+  {
+    int row = -1;
+    AlignmentAnnotation[] aa = ap.av.alignment.getAlignmentAnnotation();
+
+    if (aa == null)
+    {
+      return row;
+    }
+
+    int height = 0;
+    for (int i = 0; i < aa.length; i++)
+    {
+      if (!aa[i].visible)
+      {
+        continue;
+      }
+
+      height += aa[i].height;
+      if (y < height)
+      {
+        row = i;
+        break;
+      }
+    }
+
+    return row;
+  }
+
+  public void actionPerformed(ActionEvent evt)
+  {
+    AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();
+
+    if (evt.getActionCommand().equals(ADDNEW))
+    {
+      AlignmentAnnotation newAnnotation = new AlignmentAnnotation("",
+          null,
+          new Annotation[ap.av.alignment.getWidth()]);
+
+      if (!editLabelDescription(newAnnotation))
+      {
+        return;
+      }
+
+      ap.av.alignment.addAnnotation(newAnnotation);
+      ap.av.alignment.setAnnotationIndex(newAnnotation, 0);
+    }
+    else if (evt.getActionCommand().equals(EDITNAME))
+    {
+      editLabelDescription(aa[selectedRow]);
+    }
+    else if (evt.getActionCommand().equals(HIDE))
+    {
+      aa[selectedRow].visible = false;
+    }
+    else if (evt.getActionCommand().equals(SHOWALL))
+    {
+      for (int i = 0; i < aa.length; i++)
+      {
+        aa[i].visible = (aa[i].annotations==null) ? false : true;
+      }
+    }
+    else if (evt.getActionCommand().equals(OUTPUT_TEXT))
+    {
+      CutAndPasteTransfer cap = new CutAndPasteTransfer(false, ap.alignFrame);
+      Frame frame = new Frame();
+      frame.add(cap);
+      jalview.bin.JalviewLite.addFrame(frame,
+                                       ap.alignFrame.getTitle() + " - " +
+                                       aa[selectedRow].label, 500, 100);
+      cap.setText(aa[selectedRow].toString());
+    }
+    else if (evt.getActionCommand().equals(COPYCONS_SEQ))
+    {
+      SequenceI cons = av.getConsensusSeq();
+      if (cons != null)
+      {
+        copy_annotseqtoclipboard(cons);
+      }
+
+    }
+    ap.annotationPanel.adjustPanelHeight();
+    setSize(getSize().width, ap.annotationPanel.getSize().height);
+    ap.validate();
+    ap.paintAlignment(true);
+  }
+
+  boolean editLabelDescription(AlignmentAnnotation annotation)
+  {
+    EditNameDialog dialog = new EditNameDialog(
+        annotation.label,
+        annotation.description,
+        "       Annotation Label",
+        "Annotation Description",
+        ap.alignFrame,
+        "Edit Annotation Name / Description",
+        500, 100);
+
+    if (dialog.accept)
+    {
+      annotation.label = dialog.getName();
+      annotation.description = dialog.getDescription();
+      repaint();
+      return true;
+    }
+    else
+      return false;
+
+  }
+
+  public void mouseMoved(MouseEvent evt)
+  {
+    int row = getSelectedRow(evt.getY() - scrollOffset);
+
+    if (row > -1)
+    {
+      if (tooltip == null)
+      {
+        tooltip = new Tooltip(ap.av.alignment.
+                              getAlignmentAnnotation()[row].
+                              description,
+                              this);
+      }
+      else
+      {
+        tooltip.setTip(ap.av.alignment.
+                       getAlignmentAnnotation()[row].description);
+      }
+    }
+    else if (tooltip != null)
+    {
+      tooltip.setTip("");
+    }
+
+  }
+
+  public void mouseDragged(MouseEvent evt)
+  {}
+
+  public void mouseClicked(MouseEvent evt)
+  {}
+
+  public void mouseReleased(MouseEvent evt)
+  {}
+
+  public void mouseEntered(MouseEvent evt)
+  {}
+
+  public void mouseExited(MouseEvent evt)
+  {}
+
+  public void mousePressed(MouseEvent evt)
+  {
+    selectedRow = getSelectedRow(evt.getY() - scrollOffset);
+
+    AlignmentAnnotation[] aa = ap.av.alignment.getAlignmentAnnotation();
+
+    PopupMenu popup = new PopupMenu("Annotations");
+
+    MenuItem item = new MenuItem(ADDNEW);
+    item.addActionListener(this);
+    popup.add(item);
+    item = new MenuItem(EDITNAME);
+    item.addActionListener(this);
+    popup.add(item);
+    item = new MenuItem(HIDE);
+    item.addActionListener(this);
+    popup.add(item);
+    item = new MenuItem(SHOWALL);
+    item.addActionListener(this);
+    popup.add(item);
+    this.add(popup);
+    item = new MenuItem(OUTPUT_TEXT);
+    item.addActionListener(this);
+    popup.add(item);
+
+    if (aa[selectedRow] == ap.av.consensus)
+    {
+      popup.addSeparator();
+      final CheckboxMenuItem cbmi = new CheckboxMenuItem(
+          "Ignore Gaps In Consensus",
+          ap.av.getIgnoreGapsConsensus());
+
+      cbmi.addItemListener(new ItemListener()
+      {
+        public void itemStateChanged(ItemEvent e)
+        {
+          ap.av.setIgnoreGapsConsensus(cbmi.getState());
+          ap.paintAlignment(true);
+        }
+      });
+      popup.add(cbmi);
+      item = new MenuItem(COPYCONS_SEQ);
+      item.addActionListener(this);
+      popup.add(item);
+    }
+
+    popup.show(this, evt.getX(), evt.getY());
+
+  }
+
+  /**
+   * DOCUMENT ME!
+   *
+   * @param e DOCUMENT ME!
+   */
+  protected void copy_annotseqtoclipboard(SequenceI sq)
+  {
+    if (sq == null || sq.getLength() < 1)
+    {
+      return;
+    }
+    jalview.appletgui.AlignFrame.copiedSequences = new StringBuffer();
+    jalview.appletgui.AlignFrame.copiedSequences.append(sq.getName() + "\t" +
+        sq.getStart() + "\t" +
+        sq.getEnd() + "\t" +
+        sq.getSequenceAsString() + "\n");
+    if (av.hasHiddenColumns)
+    {
+      jalview.appletgui.AlignFrame.copiedHiddenColumns = new Vector();
+      for (int i = 0; i < av.getColumnSelection().getHiddenColumns().size(); i++)
+      {
+        int[] region = (int[])
+            av.getColumnSelection().getHiddenColumns().elementAt(i);
+
+        jalview.appletgui.AlignFrame.copiedHiddenColumns.addElement(new int[]
+            {region[0],
+            region[1]});
+      }
+    }
+  }
+
+  public void update(Graphics g)
+  {
+    paint(g);
+  }
+
+  public void paint(Graphics g)
+  {
+    int w = getSize().width;
+    if (image == null || w != image.getWidth(this))
+    {
+      image = createImage(w, ap.annotationPanel.getSize().height);
+    }
+
+    drawComponent(image.getGraphics(), w);
+    g.drawImage(image, 0, 0, this);
+  }
+
+  public void drawComponent(Graphics g, int width)
+  {
+    g.setFont(av.getFont());
+    FontMetrics fm = g.getFontMetrics(av.getFont());
+    g.setColor(Color.white);
+    g.fillRect(0, 0, getSize().width, getSize().height);
+
+    g.translate(0, scrollOffset);
+    g.setColor(Color.black);
+
+    AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();
+    int y = g.getFont().getSize();
+    int x = 0;
+
+    if (aa != null)
+    {
+      for (int i = 0; i < aa.length; i++)
+      {
+        if (!aa[i].visible)
+        {
+          continue;
+        }
+
+        x = width - fm.stringWidth(aa[i].label) - 3;
+
+        if (aa[i].graph > 0)
+        {
+          y += (aa[i].height / 3);
+        }
+
+        g.drawString(aa[i].label, x, y);
+
+        if (aa[i].graph > 0)
+        {
+          y += (2 * aa[i].height / 3);
+        }
+        else
+        {
+          y += aa[i].height;
+        }
+      }
+    }
+  }
+
+}
index 4cd5992..ce88127 100644 (file)
@@ -472,7 +472,11 @@ public class EditCommand
       }
 
       int tSize = 0;
-
+      if (annotations[a].annotations == null)
+      {
+        // nothing to edit here ?
+        continue;
+      }
       aSize = annotations[a].annotations.length;
       if (insert)
       {
index 16f8fb8..3ad05ea 100755 (executable)
@@ -54,8 +54,15 @@ public class AlignmentAnnotation
   /** DOCUMENT ME!! */
   public float graphMax;
 
+  /**
+   * Score associated with label and description.
+   */
   public float score;
-
+  /**
+   * flag indicating if annotation has a score.
+   */
+  public boolean hasScore=false;
+  
   public GraphLine threshold;
 
   // Graphical hints and tips
@@ -216,6 +223,11 @@ public class AlignmentAnnotation
    * if appropriate.
    */
   private void validateRangeAndDisplay() {
+    if (annotations==null)
+    {
+      visible=false; // try to prevent renderer from displaying.
+      return; // this is a non-annotation row annotation - ie a sequence score.
+    }
     int graphType = graph;
     float min = graphMin;
     float max = graphMax;
@@ -459,7 +471,10 @@ public class AlignmentAnnotation
     {
       return;
     }
-
+    if (annotations==null)
+    {
+      return;
+    }
     sequenceMapping = new java.util.Hashtable();
 
     sequenceRef = seqRef;
@@ -489,6 +504,11 @@ public class AlignmentAnnotation
     if (sequenceRef==null)
       return;
 
+    if (annotations==null)
+    {
+      return;
+    }
+
     int a = 0, aSize = sequenceRef.getLength();
 
     if (aSize == 0)
@@ -580,4 +600,28 @@ public class AlignmentAnnotation
       sequenceRef = null;
     }
   }
+
+  /**
+   * @return the score
+   */
+  public float getScore()
+  {
+    return score;
+  }
+
+  /**
+   * @param score the score to set
+   */
+  public void setScore(float score)
+  {
+    this.score = score;
+  }
+  /**
+   * 
+   * @return true if annotation has an associated score
+   */
+  public boolean hasScore()
+  {
+    return hasScore;
+  }
 }
index e7e3970..ccbebd5 100755 (executable)
@@ -193,7 +193,7 @@ public class AnnotationLabels
     {
       for (int i = 0; i < aa.length; i++)
       {
-        if (!aa[i].visible)
+        if (!aa[i].visible && aa[i].annotations!=null)
         {
           dif += aa[i].height;
           aa[i].visible = true;
index eda5eac..f0551e8 100755 (executable)
@@ -530,32 +530,40 @@ public class Jalview2XML
         }
 
         an.setLabel(aa[i].label);
-
+        if (aa[i].hasScore())
+        {
+          an.setScore(aa[i].getScore());
+        }
         AnnotationElement ae;
-
-        for (int a = 0; a < aa[i].annotations.length; a++)
+        if (aa[i].annotations!=null)
         {
-          if ( (aa[i] == null) || (aa[i].annotations[a] == null))
+          an.setScoreOnly(false);
+          for (int a = 0; a < aa[i].annotations.length; a++)
           {
-            continue;
-          }
+            if ((aa[i] == null) || (aa[i].annotations[a] == null))
+            {
+              continue;
+            }
 
-          ae = new AnnotationElement();
-          ae.setDescription(aa[i].annotations[a].description);
-          ae.setDisplayCharacter(aa[i].annotations[a].displayCharacter);
-          ae.setValue(aa[i].annotations[a].value);
-          ae.setPosition(a);
-          ae.setSecondaryStructure(aa[i].annotations[a].secondaryStructure +
-                                   "");
+            ae = new AnnotationElement();
+            ae.setDescription(aa[i].annotations[a].description);
+            ae.setDisplayCharacter(aa[i].annotations[a].displayCharacter);
+            ae.setValue(aa[i].annotations[a].value);
+            ae.setPosition(a);
+            ae
+                    .setSecondaryStructure(aa[i].annotations[a].secondaryStructure
+                            + "");
 
-          if (aa[i].annotations[a].colour != java.awt.Color.black)
-          {
-            ae.setColour(aa[i].annotations[a].colour.getRGB());
-          }
+            if (aa[i].annotations[a].colour != java.awt.Color.black)
+            {
+              ae.setColour(aa[i].annotations[a].colour.getRGB());
+            }
 
-          an.addAnnotationElement(ae);
+            an.addAnnotationElement(ae);
+          }
+        } else {
+          an.setScoreOnly(true);
         }
-
         vamsasSet.addAnnotation(an);
       }
     }
@@ -1310,21 +1318,24 @@ public class Jalview2XML
         }
 
         AnnotationElement[] ae = an[i].getAnnotationElement();
-        jalview.datamodel.Annotation[] anot = new jalview.datamodel.Annotation[
-            al.getWidth()];
+        jalview.datamodel.Annotation[] anot = null;
+        if (!an[i].getScoreOnly())
+        { 
+          anot = new jalview.datamodel.Annotation[
+                    al.getWidth()];
 
-        for (int aa = 0; aa < ae.length && aa < anot.length; aa++)
-        {
-          anot[ae[aa].getPosition()] = new jalview.datamodel.Annotation(ae[aa].
-              getDisplayCharacter(),
-              ae[aa].getDescription(),
-              ae[aa].getSecondaryStructure().length() == 0 ? ' ' :
-              ae[aa].getSecondaryStructure().charAt(0),
-                   ae[aa].getValue());
-          anot[ae[aa].getPosition()].colour = new java.awt.Color(ae[aa].
-              getColour());
+          for (int aa = 0; aa < ae.length && aa < anot.length; aa++)
+          {
+            anot[ae[aa].getPosition()] = new jalview.datamodel.Annotation(ae[aa].
+                    getDisplayCharacter(),
+                    ae[aa].getDescription(),
+                    ae[aa].getSecondaryStructure().length() == 0 ? ' ' :
+                      ae[aa].getSecondaryStructure().charAt(0),
+                      ae[aa].getValue());
+            anot[ae[aa].getPosition()].colour = new java.awt.Color(ae[aa].
+                    getColour());
+          }
         }
-
         jalview.datamodel.AlignmentAnnotation jaa = null;
 
         if (an[i].getGraph())
@@ -1365,7 +1376,10 @@ public class Jalview2XML
               );
           al.findName(an[i].getSequenceRef()).addAlignmentAnnotation(jaa);
         }
-
+        if (an[i].hasScore())
+        {
+          jaa.setScore(an[i].getScore());
+        }
         al.addAnnotation(jaa);
       }
     }
index 12c128a..ef95458 100755 (executable)
@@ -54,7 +54,7 @@ public class AnnotationFile
       {\r
         row = annotations[i];\r
 \r
-        if (!row.visible)\r
+        if (!row.visible && row.annotations!=null)\r
         {\r
           continue;\r
         }\r
index 61f9413..9eb6907 100755 (executable)
@@ -86,6 +86,26 @@ public class Annotation implements java.io.Serializable {
     private java.lang.String _id;\r
 \r
     /**\r
+     * Field _scoreOnly\r
+     */\r
+    private boolean _scoreOnly = false;\r
+\r
+    /**\r
+     * keeps track of state for field: _scoreOnly\r
+     */\r
+    private boolean _has_scoreOnly;\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 _annotationElementList\r
      */\r
     private java.util.Vector _annotationElementList;\r
@@ -184,6 +204,24 @@ public class Annotation implements java.io.Serializable {
     } //-- void deleteGraphType() \r
 \r
     /**\r
+     * Method deleteScore\r
+     * \r
+     */\r
+    public void deleteScore()\r
+    {\r
+        this._has_score= false;\r
+    } //-- void deleteScore() \r
+\r
+    /**\r
+     * Method deleteScoreOnly\r
+     * \r
+     */\r
+    public void deleteScoreOnly()\r
+    {\r
+        this._has_scoreOnly= false;\r
+    } //-- void deleteScoreOnly() \r
+\r
+    /**\r
      * Method enumerateAnnotationElement\r
      * \r
      * \r
@@ -321,6 +359,28 @@ public class Annotation implements java.io.Serializable {
     } //-- java.lang.String getLabel() \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 'scoreOnly'.\r
+     * \r
+     * @return boolean\r
+     * @return the value of field 'scoreOnly'.\r
+     */\r
+    public boolean getScoreOnly()\r
+    {\r
+        return this._scoreOnly;\r
+    } //-- boolean getScoreOnly() \r
+\r
+    /**\r
      * Returns the value of field 'sequenceRef'.\r
      * \r
      * @return String\r
@@ -391,6 +451,30 @@ public class Annotation implements java.io.Serializable {
     } //-- boolean hasGraphType() \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 hasScoreOnly\r
+     * \r
+     * \r
+     * \r
+     * @return boolean\r
+     */\r
+    public boolean hasScoreOnly()\r
+    {\r
+        return this._has_scoreOnly;\r
+    } //-- boolean hasScoreOnly() \r
+\r
+    /**\r
      * Method isValid\r
      * \r
      * \r
@@ -569,6 +653,28 @@ public class Annotation implements java.io.Serializable {
     } //-- void setLabel(java.lang.String) \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 'scoreOnly'.\r
+     * \r
+     * @param scoreOnly the value of field 'scoreOnly'.\r
+     */\r
+    public void setScoreOnly(boolean scoreOnly)\r
+    {\r
+        this._scoreOnly = scoreOnly;\r
+        this._has_scoreOnly = true;\r
+    } //-- void setScoreOnly(boolean) \r
+\r
+    /**\r
      * Sets the value of field 'sequenceRef'.\r
      * \r
      * @param sequenceRef the value of field 'sequenceRef'.\r
index 34047b3..e0061ae 100755 (executable)
@@ -301,6 +301,88 @@ public class AnnotationDescriptor extends org.exolab.castor.xml.util.XMLClassDes
             fieldValidator.setValidator(typeValidator);\r
         }\r
         desc.setValidator(fieldValidator);\r
+        //-- _scoreOnly\r
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_scoreOnly", "scoreOnly", 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.hasScoreOnly())\r
+                    return null;\r
+                return (target.getScoreOnly() ? 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
+                    // if null, use delete method for optional primitives \r
+                    if (value == null) {\r
+                        target.deleteScoreOnly();\r
+                        return;\r
+                    }\r
+                    target.setScoreOnly( ((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: _scoreOnly\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
+        //-- _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
+                Annotation target = (Annotation) 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
+                    Annotation target = (Annotation) 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
         //-- _annotationElementList\r
index be826fc..3e913cb 100644 (file)
-/*\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 StructureState.\r
- * \r
- * @version $Revision$ $Date$\r
- */\r
-public class StructureState implements java.io.Serializable {\r
-\r
-\r
-      //--------------------------/\r
-     //- Class/Member Variables -/\r
-    //--------------------------/\r
-\r
-    /**\r
-     * internal content storage\r
-     */\r
-    private java.lang.String _content = "";\r
-\r
-    /**\r
-     * Field _visible\r
-     */\r
-    private boolean _visible;\r
-\r
-    /**\r
-     * keeps track of state for field: _visible\r
-     */\r
-    private boolean _has_visible;\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
-      //----------------/\r
-     //- Constructors -/\r
-    //----------------/\r
-\r
-    public StructureState() {\r
-        super();\r
-        setContent("");\r
-    } //-- jalview.schemabinding.version2.StructureState()\r
-\r
-\r
-      //-----------/\r
-     //- Methods -/\r
-    //-----------/\r
-\r
-    /**\r
-     * Method deleteHeight\r
-     * \r
-     */\r
-    public void deleteHeight()\r
-    {\r
-        this._has_height= false;\r
-    } //-- void deleteHeight() \r
-\r
-    /**\r
-     * Method deleteVisible\r
-     * \r
-     */\r
-    public void deleteVisible()\r
-    {\r
-        this._has_visible= false;\r
-    } //-- void deleteVisible() \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 'content'. The field 'content'\r
-     * has the following description: internal content storage\r
-     * \r
-     * @return String\r
-     * @return the value of field 'content'.\r
-     */\r
-    public java.lang.String getContent()\r
-    {\r
-        return this._content;\r
-    } //-- java.lang.String getContent() \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 'visible'.\r
-     * \r
-     * @return boolean\r
-     * @return the value of field 'visible'.\r
-     */\r
-    public boolean getVisible()\r
-    {\r
-        return this._visible;\r
-    } //-- boolean getVisible() \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 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 hasVisible\r
-     * \r
-     * \r
-     * \r
-     * @return boolean\r
-     */\r
-    public boolean hasVisible()\r
-    {\r
-        return this._has_visible;\r
-    } //-- boolean hasVisible() \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 'content'. The field 'content' has\r
-     * the following description: internal content storage\r
-     * \r
-     * @param content the value of field 'content'.\r
-     */\r
-    public void setContent(java.lang.String content)\r
-    {\r
-        this._content = content;\r
-    } //-- void setContent(java.lang.String) \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 'visible'.\r
-     * \r
-     * @param visible the value of field 'visible'.\r
-     */\r
-    public void setVisible(boolean visible)\r
-    {\r
-        this._visible = visible;\r
-        this._has_visible = true;\r
-    } //-- void setVisible(boolean) \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.StructureState) Unmarshaller.unmarshal(jalview.schemabinding.version2.StructureState.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
+/*
+ * This class was automatically generated with 
+ * <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML
+ * Schema.
+ * $Id$
+ */
+
+package jalview.schemabinding.version2;
+
+  //---------------------------------/
+ //- Imported classes and packages -/
+//---------------------------------/
+
+import java.io.IOException;
+import java.io.Reader;
+import java.io.Serializable;
+import java.io.Writer;
+import org.exolab.castor.xml.MarshalException;
+import org.exolab.castor.xml.Marshaller;
+import org.exolab.castor.xml.Unmarshaller;
+import org.exolab.castor.xml.ValidationException;
+import org.xml.sax.ContentHandler;
+
+/**
+ * Class StructureState.
+ * 
+ * @version $Revision$ $Date$
+ */
+public class StructureState implements java.io.Serializable {
+
+
+      //--------------------------/
+     //- Class/Member Variables -/
+    //--------------------------/
+
+    /**
+     * internal content storage
+     */
+    private java.lang.String _content = "";
+
+    /**
+     * Field _visible
+     */
+    private boolean _visible;
+
+    /**
+     * keeps track of state for field: _visible
+     */
+    private boolean _has_visible;
+
+    /**
+     * Field _xpos
+     */
+    private int _xpos;
+
+    /**
+     * keeps track of state for field: _xpos
+     */
+    private boolean _has_xpos;
+
+    /**
+     * Field _ypos
+     */
+    private int _ypos;
+
+    /**
+     * keeps track of state for field: _ypos
+     */
+    private boolean _has_ypos;
+
+    /**
+     * Field _width
+     */
+    private int _width;
+
+    /**
+     * keeps track of state for field: _width
+     */
+    private boolean _has_width;
+
+    /**
+     * Field _height
+     */
+    private int _height;
+
+    /**
+     * keeps track of state for field: _height
+     */
+    private boolean _has_height;
+
+
+      //----------------/
+     //- Constructors -/
+    //----------------/
+
+    public StructureState() {
+        super();
+        setContent("");
+    } //-- jalview.schemabinding.version2.StructureState()
+
+
+      //-----------/
+     //- Methods -/
+    //-----------/
+
+    /**
+     * Method deleteHeight
+     * 
+     */
+    public void deleteHeight()
+    {
+        this._has_height= false;
+    } //-- void deleteHeight() 
+
+    /**
+     * Method deleteVisible
+     * 
+     */
+    public void deleteVisible()
+    {
+        this._has_visible= false;
+    } //-- void deleteVisible() 
+
+    /**
+     * Method deleteWidth
+     * 
+     */
+    public void deleteWidth()
+    {
+        this._has_width= false;
+    } //-- void deleteWidth() 
+
+    /**
+     * Method deleteXpos
+     * 
+     */
+    public void deleteXpos()
+    {
+        this._has_xpos= false;
+    } //-- void deleteXpos() 
+
+    /**
+     * Method deleteYpos
+     * 
+     */
+    public void deleteYpos()
+    {
+        this._has_ypos= false;
+    } //-- void deleteYpos() 
+
+    /**
+     * Returns the value of field 'content'. The field 'content'
+     * has the following description: internal content storage
+     * 
+     * @return String
+     * @return the value of field 'content'.
+     */
+    public java.lang.String getContent()
+    {
+        return this._content;
+    } //-- java.lang.String getContent() 
+
+    /**
+     * Returns the value of field 'height'.
+     * 
+     * @return int
+     * @return the value of field 'height'.
+     */
+    public int getHeight()
+    {
+        return this._height;
+    } //-- int getHeight() 
+
+    /**
+     * Returns the value of field 'visible'.
+     * 
+     * @return boolean
+     * @return the value of field 'visible'.
+     */
+    public boolean getVisible()
+    {
+        return this._visible;
+    } //-- boolean getVisible() 
+
+    /**
+     * Returns the value of field 'width'.
+     * 
+     * @return int
+     * @return the value of field 'width'.
+     */
+    public int getWidth()
+    {
+        return this._width;
+    } //-- int getWidth() 
+
+    /**
+     * Returns the value of field 'xpos'.
+     * 
+     * @return int
+     * @return the value of field 'xpos'.
+     */
+    public int getXpos()
+    {
+        return this._xpos;
+    } //-- int getXpos() 
+
+    /**
+     * Returns the value of field 'ypos'.
+     * 
+     * @return int
+     * @return the value of field 'ypos'.
+     */
+    public int getYpos()
+    {
+        return this._ypos;
+    } //-- int getYpos() 
+
+    /**
+     * Method hasHeight
+     * 
+     * 
+     * 
+     * @return boolean
+     */
+    public boolean hasHeight()
+    {
+        return this._has_height;
+    } //-- boolean hasHeight() 
+
+    /**
+     * Method hasVisible
+     * 
+     * 
+     * 
+     * @return boolean
+     */
+    public boolean hasVisible()
+    {
+        return this._has_visible;
+    } //-- boolean hasVisible() 
+
+    /**
+     * Method hasWidth
+     * 
+     * 
+     * 
+     * @return boolean
+     */
+    public boolean hasWidth()
+    {
+        return this._has_width;
+    } //-- boolean hasWidth() 
+
+    /**
+     * Method hasXpos
+     * 
+     * 
+     * 
+     * @return boolean
+     */
+    public boolean hasXpos()
+    {
+        return this._has_xpos;
+    } //-- boolean hasXpos() 
+
+    /**
+     * Method hasYpos
+     * 
+     * 
+     * 
+     * @return boolean
+     */
+    public boolean hasYpos()
+    {
+        return this._has_ypos;
+    } //-- boolean hasYpos() 
+
+    /**
+     * Method isValid
+     * 
+     * 
+     * 
+     * @return boolean
+     */
+    public boolean isValid()
+    {
+        try {
+            validate();
+        }
+        catch (org.exolab.castor.xml.ValidationException vex) {
+            return false;
+        }
+        return true;
+    } //-- boolean isValid() 
+
+    /**
+     * Method marshal
+     * 
+     * 
+     * 
+     * @param out
+     */
+    public void marshal(java.io.Writer out)
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
+    {
+        
+        Marshaller.marshal(this, out);
+    } //-- void marshal(java.io.Writer) 
+
+    /**
+     * Method marshal
+     * 
+     * 
+     * 
+     * @param handler
+     */
+    public void marshal(org.xml.sax.ContentHandler handler)
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
+    {
+        
+        Marshaller.marshal(this, handler);
+    } //-- void marshal(org.xml.sax.ContentHandler) 
+
+    /**
+     * Sets the value of field 'content'. The field 'content' has
+     * the following description: internal content storage
+     * 
+     * @param content the value of field 'content'.
+     */
+    public void setContent(java.lang.String content)
+    {
+        this._content = content;
+    } //-- void setContent(java.lang.String) 
+
+    /**
+     * Sets the value of field 'height'.
+     * 
+     * @param height the value of field 'height'.
+     */
+    public void setHeight(int height)
+    {
+        this._height = height;
+        this._has_height = true;
+    } //-- void setHeight(int) 
+
+    /**
+     * Sets the value of field 'visible'.
+     * 
+     * @param visible the value of field 'visible'.
+     */
+    public void setVisible(boolean visible)
+    {
+        this._visible = visible;
+        this._has_visible = true;
+    } //-- void setVisible(boolean) 
+
+    /**
+     * Sets the value of field 'width'.
+     * 
+     * @param width the value of field 'width'.
+     */
+    public void setWidth(int width)
+    {
+        this._width = width;
+        this._has_width = true;
+    } //-- void setWidth(int) 
+
+    /**
+     * Sets the value of field 'xpos'.
+     * 
+     * @param xpos the value of field 'xpos'.
+     */
+    public void setXpos(int xpos)
+    {
+        this._xpos = xpos;
+        this._has_xpos = true;
+    } //-- void setXpos(int) 
+
+    /**
+     * Sets the value of field 'ypos'.
+     * 
+     * @param ypos the value of field 'ypos'.
+     */
+    public void setYpos(int ypos)
+    {
+        this._ypos = ypos;
+        this._has_ypos = true;
+    } //-- void setYpos(int) 
+
+    /**
+     * Method unmarshal
+     * 
+     * 
+     * 
+     * @param reader
+     * @return Object
+     */
+    public static java.lang.Object unmarshal(java.io.Reader reader)
+        throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException
+    {
+        return (jalview.schemabinding.version2.StructureState) Unmarshaller.unmarshal(jalview.schemabinding.version2.StructureState.class, reader);
+    } //-- java.lang.Object unmarshal(java.io.Reader) 
+
+    /**
+     * Method validate
+     * 
+     */
+    public void validate()
+        throws org.exolab.castor.xml.ValidationException
+    {
+        org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();
+        validator.validate(this);
+    } //-- void validate() 
+
+}
index 998d373..e7a5a4d 100644 (file)
-/*\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 StructureStateDescriptor.\r
- * \r
- * @version $Revision$ $Date$\r
- */\r
-public class StructureStateDescriptor 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 StructureStateDescriptor() {\r
-        super();\r
-        nsURI = "www.jalview.org";\r
-        xmlName = "structureState";\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
-        //-- _content\r
-        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_content", "PCDATA", org.exolab.castor.xml.NodeType.Text);\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
-                StructureState target = (StructureState) object;\r
-                return target.getContent();\r
-            }\r
-            public void setValue( java.lang.Object object, java.lang.Object value) \r
-                throws IllegalStateException, IllegalArgumentException\r
-            {\r
-                try {\r
-                    StructureState target = (StructureState) object;\r
-                    target.setContent( (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: _content\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 attribute descriptors\r
-        \r
-        //-- _visible\r
-        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_visible", "visible", 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
-                StructureState target = (StructureState) object;\r
-                if(!target.hasVisible())\r
-                    return null;\r
-                return (target.getVisible() ? 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
-                    StructureState target = (StructureState) object;\r
-                    // if null, use delete method for optional primitives \r
-                    if (value == null) {\r
-                        target.deleteVisible();\r
-                        return;\r
-                    }\r
-                    target.setVisible( ((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: _visible\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
-                StructureState target = (StructureState) 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
-                    StructureState target = (StructureState) 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
-                StructureState target = (StructureState) 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
-                    StructureState target = (StructureState) 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
-                StructureState target = (StructureState) 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
-                    StructureState target = (StructureState) 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
-                StructureState target = (StructureState) 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
-                    StructureState target = (StructureState) 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
-        //-- initialize element descriptors\r
-        \r
-    } //-- jalview.schemabinding.version2.StructureStateDescriptor()\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.StructureState.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
+/*
+ * This class was automatically generated with 
+ * <a href="http://www.castor.org">Castor 0.9.6</a>, using an XML
+ * Schema.
+ * $Id$
+ */
+
+package jalview.schemabinding.version2;
+
+  //---------------------------------/
+ //- Imported classes and packages -/
+//---------------------------------/
+
+import org.exolab.castor.mapping.AccessMode;
+import org.exolab.castor.xml.TypeValidator;
+import org.exolab.castor.xml.XMLFieldDescriptor;
+import org.exolab.castor.xml.validators.*;
+
+/**
+ * Class StructureStateDescriptor.
+ * 
+ * @version $Revision$ $Date$
+ */
+public class StructureStateDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl {
+
+
+      //--------------------------/
+     //- Class/Member Variables -/
+    //--------------------------/
+
+    /**
+     * Field nsPrefix
+     */
+    private java.lang.String nsPrefix;
+
+    /**
+     * Field nsURI
+     */
+    private java.lang.String nsURI;
+
+    /**
+     * Field xmlName
+     */
+    private java.lang.String xmlName;
+
+    /**
+     * Field identity
+     */
+    private org.exolab.castor.xml.XMLFieldDescriptor identity;
+
+
+      //----------------/
+     //- Constructors -/
+    //----------------/
+
+    public StructureStateDescriptor() {
+        super();
+        nsURI = "www.jalview.org";
+        xmlName = "structureState";
+        org.exolab.castor.xml.util.XMLFieldDescriptorImpl  desc           = null;
+        org.exolab.castor.xml.XMLFieldHandler              handler        = null;
+        org.exolab.castor.xml.FieldValidator               fieldValidator = null;
+        //-- _content
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_content", "PCDATA", org.exolab.castor.xml.NodeType.Text);
+        desc.setImmutable(true);
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {
+            public java.lang.Object getValue( java.lang.Object object ) 
+                throws IllegalStateException
+            {
+                StructureState target = (StructureState) object;
+                return target.getContent();
+            }
+            public void setValue( java.lang.Object object, java.lang.Object value) 
+                throws IllegalStateException, IllegalArgumentException
+            {
+                try {
+                    StructureState target = (StructureState) object;
+                    target.setContent( (java.lang.String) value);
+                }
+                catch (java.lang.Exception ex) {
+                    throw new IllegalStateException(ex.toString());
+                }
+            }
+            public java.lang.Object newInstance( java.lang.Object parent ) {
+                return null;
+            }
+        } );
+        desc.setHandler(handler);
+        addFieldDescriptor(desc);
+        
+        //-- validation code for: _content
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();
+        { //-- local scope
+            StringValidator typeValidator = new StringValidator();
+            typeValidator.setWhiteSpace("preserve");
+            fieldValidator.setValidator(typeValidator);
+        }
+        desc.setValidator(fieldValidator);
+        //-- initialize attribute descriptors
+        
+        //-- _visible
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_visible", "visible", org.exolab.castor.xml.NodeType.Attribute);
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {
+            public java.lang.Object getValue( java.lang.Object object ) 
+                throws IllegalStateException
+            {
+                StructureState target = (StructureState) object;
+                if(!target.hasVisible())
+                    return null;
+                return (target.getVisible() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE);
+            }
+            public void setValue( java.lang.Object object, java.lang.Object value) 
+                throws IllegalStateException, IllegalArgumentException
+            {
+                try {
+                    StructureState target = (StructureState) object;
+                    // if null, use delete method for optional primitives 
+                    if (value == null) {
+                        target.deleteVisible();
+                        return;
+                    }
+                    target.setVisible( ((java.lang.Boolean)value).booleanValue());
+                }
+                catch (java.lang.Exception ex) {
+                    throw new IllegalStateException(ex.toString());
+                }
+            }
+            public java.lang.Object newInstance( java.lang.Object parent ) {
+                return null;
+            }
+        } );
+        desc.setHandler(handler);
+        addFieldDescriptor(desc);
+        
+        //-- validation code for: _visible
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();
+        { //-- local scope
+            BooleanValidator typeValidator = new BooleanValidator();
+            fieldValidator.setValidator(typeValidator);
+        }
+        desc.setValidator(fieldValidator);
+        //-- _xpos
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_xpos", "xpos", org.exolab.castor.xml.NodeType.Attribute);
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {
+            public java.lang.Object getValue( java.lang.Object object ) 
+                throws IllegalStateException
+            {
+                StructureState target = (StructureState) object;
+                if(!target.hasXpos())
+                    return null;
+                return new java.lang.Integer(target.getXpos());
+            }
+            public void setValue( java.lang.Object object, java.lang.Object value) 
+                throws IllegalStateException, IllegalArgumentException
+            {
+                try {
+                    StructureState target = (StructureState) object;
+                    // if null, use delete method for optional primitives 
+                    if (value == null) {
+                        target.deleteXpos();
+                        return;
+                    }
+                    target.setXpos( ((java.lang.Integer)value).intValue());
+                }
+                catch (java.lang.Exception ex) {
+                    throw new IllegalStateException(ex.toString());
+                }
+            }
+            public java.lang.Object newInstance( java.lang.Object parent ) {
+                return null;
+            }
+        } );
+        desc.setHandler(handler);
+        addFieldDescriptor(desc);
+        
+        //-- validation code for: _xpos
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();
+        { //-- local scope
+            IntegerValidator typeValidator= new IntegerValidator();
+            fieldValidator.setValidator(typeValidator);
+        }
+        desc.setValidator(fieldValidator);
+        //-- _ypos
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_ypos", "ypos", org.exolab.castor.xml.NodeType.Attribute);
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {
+            public java.lang.Object getValue( java.lang.Object object ) 
+                throws IllegalStateException
+            {
+                StructureState target = (StructureState) object;
+                if(!target.hasYpos())
+                    return null;
+                return new java.lang.Integer(target.getYpos());
+            }
+            public void setValue( java.lang.Object object, java.lang.Object value) 
+                throws IllegalStateException, IllegalArgumentException
+            {
+                try {
+                    StructureState target = (StructureState) object;
+                    // if null, use delete method for optional primitives 
+                    if (value == null) {
+                        target.deleteYpos();
+                        return;
+                    }
+                    target.setYpos( ((java.lang.Integer)value).intValue());
+                }
+                catch (java.lang.Exception ex) {
+                    throw new IllegalStateException(ex.toString());
+                }
+            }
+            public java.lang.Object newInstance( java.lang.Object parent ) {
+                return null;
+            }
+        } );
+        desc.setHandler(handler);
+        addFieldDescriptor(desc);
+        
+        //-- validation code for: _ypos
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();
+        { //-- local scope
+            IntegerValidator typeValidator= new IntegerValidator();
+            fieldValidator.setValidator(typeValidator);
+        }
+        desc.setValidator(fieldValidator);
+        //-- _width
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_width", "width", org.exolab.castor.xml.NodeType.Attribute);
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {
+            public java.lang.Object getValue( java.lang.Object object ) 
+                throws IllegalStateException
+            {
+                StructureState target = (StructureState) object;
+                if(!target.hasWidth())
+                    return null;
+                return new java.lang.Integer(target.getWidth());
+            }
+            public void setValue( java.lang.Object object, java.lang.Object value) 
+                throws IllegalStateException, IllegalArgumentException
+            {
+                try {
+                    StructureState target = (StructureState) object;
+                    // if null, use delete method for optional primitives 
+                    if (value == null) {
+                        target.deleteWidth();
+                        return;
+                    }
+                    target.setWidth( ((java.lang.Integer)value).intValue());
+                }
+                catch (java.lang.Exception ex) {
+                    throw new IllegalStateException(ex.toString());
+                }
+            }
+            public java.lang.Object newInstance( java.lang.Object parent ) {
+                return null;
+            }
+        } );
+        desc.setHandler(handler);
+        addFieldDescriptor(desc);
+        
+        //-- validation code for: _width
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();
+        { //-- local scope
+            IntegerValidator typeValidator= new IntegerValidator();
+            fieldValidator.setValidator(typeValidator);
+        }
+        desc.setValidator(fieldValidator);
+        //-- _height
+        desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Integer.TYPE, "_height", "height", org.exolab.castor.xml.NodeType.Attribute);
+        handler = (new org.exolab.castor.xml.XMLFieldHandler() {
+            public java.lang.Object getValue( java.lang.Object object ) 
+                throws IllegalStateException
+            {
+                StructureState target = (StructureState) object;
+                if(!target.hasHeight())
+                    return null;
+                return new java.lang.Integer(target.getHeight());
+            }
+            public void setValue( java.lang.Object object, java.lang.Object value) 
+                throws IllegalStateException, IllegalArgumentException
+            {
+                try {
+                    StructureState target = (StructureState) object;
+                    // if null, use delete method for optional primitives 
+                    if (value == null) {
+                        target.deleteHeight();
+                        return;
+                    }
+                    target.setHeight( ((java.lang.Integer)value).intValue());
+                }
+                catch (java.lang.Exception ex) {
+                    throw new IllegalStateException(ex.toString());
+                }
+            }
+            public java.lang.Object newInstance( java.lang.Object parent ) {
+                return null;
+            }
+        } );
+        desc.setHandler(handler);
+        addFieldDescriptor(desc);
+        
+        //-- validation code for: _height
+        fieldValidator = new org.exolab.castor.xml.FieldValidator();
+        { //-- local scope
+            IntegerValidator typeValidator= new IntegerValidator();
+            fieldValidator.setValidator(typeValidator);
+        }
+        desc.setValidator(fieldValidator);
+        //-- initialize element descriptors
+        
+    } //-- jalview.schemabinding.version2.StructureStateDescriptor()
+
+
+      //-----------/
+     //- Methods -/
+    //-----------/
+
+    /**
+     * Method getAccessMode
+     * 
+     * 
+     * 
+     * @return AccessMode
+     */
+    public org.exolab.castor.mapping.AccessMode getAccessMode()
+    {
+        return null;
+    } //-- org.exolab.castor.mapping.AccessMode getAccessMode() 
+
+    /**
+     * Method getExtends
+     * 
+     * 
+     * 
+     * @return ClassDescriptor
+     */
+    public org.exolab.castor.mapping.ClassDescriptor getExtends()
+    {
+        return null;
+    } //-- org.exolab.castor.mapping.ClassDescriptor getExtends() 
+
+    /**
+     * Method getIdentity
+     * 
+     * 
+     * 
+     * @return FieldDescriptor
+     */
+    public org.exolab.castor.mapping.FieldDescriptor getIdentity()
+    {
+        return identity;
+    } //-- org.exolab.castor.mapping.FieldDescriptor getIdentity() 
+
+    /**
+     * Method getJavaClass
+     * 
+     * 
+     * 
+     * @return Class
+     */
+    public java.lang.Class getJavaClass()
+    {
+        return jalview.schemabinding.version2.StructureState.class;
+    } //-- java.lang.Class getJavaClass() 
+
+    /**
+     * Method getNameSpacePrefix
+     * 
+     * 
+     * 
+     * @return String
+     */
+    public java.lang.String getNameSpacePrefix()
+    {
+        return nsPrefix;
+    } //-- java.lang.String getNameSpacePrefix() 
+
+    /**
+     * Method getNameSpaceURI
+     * 
+     * 
+     * 
+     * @return String
+     */
+    public java.lang.String getNameSpaceURI()
+    {
+        return nsURI;
+    } //-- java.lang.String getNameSpaceURI() 
+
+    /**
+     * Method getValidator
+     * 
+     * 
+     * 
+     * @return TypeValidator
+     */
+    public org.exolab.castor.xml.TypeValidator getValidator()
+    {
+        return this;
+    } //-- org.exolab.castor.xml.TypeValidator getValidator() 
+
+    /**
+     * Method getXMLName
+     * 
+     * 
+     * 
+     * @return String
+     */
+    public java.lang.String getXMLName()
+    {
+        return xmlName;
+    } //-- java.lang.String getXMLName() 
+
+}