Formatted source
authoramwaterhouse <Andrew Waterhouse>
Wed, 8 Jun 2005 13:41:35 +0000 (13:41 +0000)
committeramwaterhouse <Andrew Waterhouse>
Wed, 8 Jun 2005 13:41:35 +0000 (13:41 +0000)
220 files changed:
src/MCview/Atom.java
src/MCview/Bond.java
src/MCview/MCMatrix.java
src/MCview/PDBChain.java
src/MCview/PDBfile.java
src/MCview/Residue.java
src/MCview/Zsort.java
src/MCview/myAtom.java
src/MCview/rotCanvas.java
src/ext/vamsas/JPredWS.java
src/ext/vamsas/JPredWSService.java
src/ext/vamsas/JPredWSServiceLocator.java
src/ext/vamsas/JpredResult.java
src/ext/vamsas/JpredSoapBindingStub.java
src/ext/vamsas/Msfalignment.java
src/ext/vamsas/MuscleWS.java
src/ext/vamsas/MuscleWSService.java
src/ext/vamsas/MuscleWSServiceLocator.java
src/ext/vamsas/MuscleWSSoapBindingStub.java
src/ext/vamsas/Result.java
src/ext/vamsas/Secstructpred.java
src/ext/vamsas/Sequence.java
src/jalview/analysis/AAFrequency.java
src/jalview/analysis/AlignSeq.java
src/jalview/analysis/AlignmentSorter.java
src/jalview/analysis/AlignmentUtil.java
src/jalview/analysis/CompareAlignments.java
src/jalview/analysis/Conservation.java
src/jalview/analysis/NJTree.java
src/jalview/analysis/PCA.java
src/jalview/analysis/SeqsetUtils.java
src/jalview/analysis/SequenceIdMatcher.java
src/jalview/appletgui/APopupMenu.java
src/jalview/appletgui/AlignFrame.java
src/jalview/appletgui/AlignViewport.java
src/jalview/appletgui/AlignmentPanel.java
src/jalview/appletgui/AnnotationLabels.java
src/jalview/appletgui/AnnotationPanel.java
src/jalview/appletgui/ColumnSelection.java
src/jalview/appletgui/CutAndPasteTransfer.java
src/jalview/appletgui/FeatureRenderer.java
src/jalview/appletgui/Finder.java
src/jalview/appletgui/FontChooser.java
src/jalview/appletgui/IdCanvas.java
src/jalview/appletgui/IdPanel.java
src/jalview/appletgui/IdwidthAdjuster.java
src/jalview/appletgui/OverviewPanel.java
src/jalview/appletgui/PCAPanel.java
src/jalview/appletgui/PaintRefresher.java
src/jalview/appletgui/PairwiseAlignPanel.java
src/jalview/appletgui/RedundancyPanel.java
src/jalview/appletgui/RotatableCanvas.java
src/jalview/appletgui/ScalePanel.java
src/jalview/appletgui/SeqCanvas.java
src/jalview/appletgui/SeqPanel.java
src/jalview/appletgui/SequenceRenderer.java
src/jalview/appletgui/SliderPanel.java
src/jalview/appletgui/TreeCanvas.java
src/jalview/appletgui/TreePanel.java
src/jalview/appletgui/UserDefinedColours.java
src/jalview/bin/Cache.java
src/jalview/bin/Jalview.java
src/jalview/bin/JalviewLite.java
src/jalview/binding/Alignment.java
src/jalview/binding/Annotation.java
src/jalview/binding/AnnotationElement.java
src/jalview/binding/Colour.java
src/jalview/binding/JGroup.java
src/jalview/binding/JSeq.java
src/jalview/binding/JalviewModel.java
src/jalview/binding/JalviewModelSequence.java
src/jalview/binding/JalviewModelSequence2.java
src/jalview/binding/JalviewModelSequence2Item.java
src/jalview/binding/JalviewUserColours.java
src/jalview/binding/JalviewUserColoursItem.java
src/jalview/binding/Residue.java
src/jalview/binding/Sequence.java
src/jalview/binding/SequenceSet.java
src/jalview/binding/SequenceType.java
src/jalview/binding/UserColour.java
src/jalview/binding/UserColourScheme.java
src/jalview/binding/UserColours.java
src/jalview/binding/VAMSAS.java
src/jalview/binding/VamsasModel.java
src/jalview/binding/Viewport.java
src/jalview/datamodel/Alignment.java
src/jalview/datamodel/AlignmentAnnotation.java
src/jalview/datamodel/AlignmentI.java
src/jalview/datamodel/AlignmentOrder.java
src/jalview/datamodel/Annotation.java
src/jalview/datamodel/BinaryNode.java
src/jalview/datamodel/BinarySequence.java
src/jalview/datamodel/HistoryItem.java
src/jalview/datamodel/Sequence.java
src/jalview/datamodel/SequenceFeature.java
src/jalview/datamodel/SequenceGroup.java
src/jalview/datamodel/SequenceI.java
src/jalview/datamodel/SequenceNode.java
src/jalview/datamodel/SequencePoint.java
src/jalview/datamodel/SuperGroup.java
src/jalview/gui/AlignFrame.java
src/jalview/gui/AlignViewport.java
src/jalview/gui/AlignmentPanel.java
src/jalview/gui/AnnotationLabels.java
src/jalview/gui/AnnotationPanel.java
src/jalview/gui/ColumnSelection.java
src/jalview/gui/CutAndPasteTransfer.java
src/jalview/gui/Desktop.java
src/jalview/gui/FeatureRenderer.java
src/jalview/gui/Finder.java
src/jalview/gui/FontChooser.java
src/jalview/gui/IdCanvas.java
src/jalview/gui/IdPanel.java
src/jalview/gui/IdwidthAdjuster.java
src/jalview/gui/Jalview2XML.java
src/jalview/gui/OverviewPanel.java
src/jalview/gui/PCAPanel.java
src/jalview/gui/PaintRefresher.java
src/jalview/gui/PairwiseAlignPanel.java
src/jalview/gui/PopupMenu.java
src/jalview/gui/Preferences.java
src/jalview/gui/RedundancyPanel.java
src/jalview/gui/RotatableCanvas.java
src/jalview/gui/ScalePanel.java
src/jalview/gui/SeqCanvas.java
src/jalview/gui/SeqPanel.java
src/jalview/gui/SequenceRenderer.java
src/jalview/gui/SliderPanel.java
src/jalview/gui/SplashScreen.java
src/jalview/gui/TreeCanvas.java
src/jalview/gui/TreePanel.java
src/jalview/gui/UserDefinedColours.java
src/jalview/gui/WebserviceInfo.java
src/jalview/io/AlignFile.java
src/jalview/io/BLCFile.java
src/jalview/io/ClustalFile.java
src/jalview/io/EBIFetchClient.java
src/jalview/io/FastaFile.java
src/jalview/io/FileParse.java
src/jalview/io/FormatAdapter.java
src/jalview/io/HTMLOutput.java
src/jalview/io/IdentifyFile.java
src/jalview/io/JPredFile.java
src/jalview/io/JalviewFileChooser.java
src/jalview/io/JalviewFileFilter.java
src/jalview/io/JalviewFileView.java
src/jalview/io/MSFfile.java
src/jalview/io/NewickFile.java
src/jalview/io/PIRFile.java
src/jalview/io/PfamFile.java
src/jalview/io/PileUpfile.java
src/jalview/io/SequenceFeatureFetcher.java
src/jalview/io/WSWUBlastClient.java
src/jalview/jbappletgui/GAlignFrame.java
src/jalview/jbappletgui/GAlignmentPanel.java
src/jalview/jbappletgui/GCutAndPasteTransfer.java
src/jalview/jbappletgui/GFinder.java
src/jalview/jbappletgui/GFontChooser.java
src/jalview/jbappletgui/GPCAPanel.java
src/jalview/jbappletgui/GPairwiseAlignPanel.java
src/jalview/jbappletgui/GSliderPanel.java
src/jalview/jbappletgui/GTreePanel.java
src/jalview/jbappletgui/GUserDefinedColours.java
src/jalview/jbgui/GAlignFrame.java
src/jalview/jbgui/GAlignmentPanel.java
src/jalview/jbgui/GCutAndPasteTransfer.java
src/jalview/jbgui/GDesktop.java
src/jalview/jbgui/GFinder.java
src/jalview/jbgui/GFontChooser.java
src/jalview/jbgui/GPCAPanel.java
src/jalview/jbgui/GPairwiseAlignPanel.java
src/jalview/jbgui/GPreferences.java
src/jalview/jbgui/GSliderPanel.java
src/jalview/jbgui/GTreePanel.java
src/jalview/jbgui/GUserDefinedColours.java
src/jalview/jbgui/GWebserviceInfo.java
src/jalview/math/Matrix.java
src/jalview/math/RotatableMatrix.java
src/jalview/schemes/Blosum62ColourScheme.java
src/jalview/schemes/BuriedColourScheme.java
src/jalview/schemes/ClustalxColourScheme.java
src/jalview/schemes/ColourSchemeI.java
src/jalview/schemes/ColourSchemeProperty.java
src/jalview/schemes/Consensus.java
src/jalview/schemes/ConservationColourScheme.java
src/jalview/schemes/HelixColourScheme.java
src/jalview/schemes/HydrophobicColourScheme.java
src/jalview/schemes/NucleotideColourScheme.java
src/jalview/schemes/PIDColourScheme.java
src/jalview/schemes/ResidueColourScheme.java
src/jalview/schemes/ResidueProperties.java
src/jalview/schemes/ScoreColourScheme.java
src/jalview/schemes/StrandColourScheme.java
src/jalview/schemes/TaylorColourScheme.java
src/jalview/schemes/TurnColourScheme.java
src/jalview/schemes/UserColourScheme.java
src/jalview/schemes/ZappoColourScheme.java
src/jalview/util/BrowserLauncher.java
src/jalview/util/Comparison.java
src/jalview/util/Format.java
src/jalview/util/QuickSort.java
src/jalview/ws/JPredClient.java
src/jalview/ws/MsaWSClient.java
src/jalview/ws/MsaWServices.java
src/jalview/ws/WSClient.java
src/jalview/ws/WSClientI.java
src/vamsas/objects/simple/Alignment.java
src/vamsas/objects/simple/Alignment_Helper.java
src/vamsas/objects/simple/MsaResult.java
src/vamsas/objects/simple/MsaResult_Helper.java
src/vamsas/objects/simple/Object.java
src/vamsas/objects/simple/Object_Helper.java
src/vamsas/objects/simple/Result.java
src/vamsas/objects/simple/Result_Helper.java
src/vamsas/objects/simple/Sequence.java
src/vamsas/objects/simple/SequenceSet.java
src/vamsas/objects/simple/SequenceSet_Helper.java
src/vamsas/objects/simple/Sequence_Helper.java
src/vamsas/objects/simple/WsJobId.java
src/vamsas/objects/simple/WsJobId_Helper.java

index b3a8fdb..0aaf040 100755 (executable)
 * 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 MCview;\r
-import java.util.*;\r
+\r
 import java.awt.*;\r
 \r
-public class Atom {\r
-  double x;\r
-  double y;\r
-  double z;\r
-  int number;\r
-  String name;\r
-  String resName;\r
-  int resNumber;\r
-  int type;\r
-  Color color;\r
-  String chain;\r
+import java.util.*;\r
 \r
-  public Atom(StringTokenizer str) {\r
-    this.number  = (new Integer(str.nextToken())).intValue();\r
-    this.name    = str.nextToken();\r
-    this.resName = str.nextToken();\r
 \r
-    String tmpstr = new String();\r
+public class Atom {\r
+    double x;\r
+    double y;\r
+    double z;\r
+    int number;\r
+    String name;\r
+    String resName;\r
+    int resNumber;\r
+    int type;\r
+    Color color;\r
+    String chain;\r
 \r
-    try {\r
-      tmpstr = str.nextToken();\r
+    public Atom(StringTokenizer str) {\r
+        this.number = (new Integer(str.nextToken())).intValue();\r
+        this.name = str.nextToken();\r
+        this.resName = str.nextToken();\r
 \r
-      this.resNumber = (new Integer(tmpstr).intValue());\r
-      this.chain     = "A";\r
-      this.color     = Color.green;\r
+        String tmpstr = new String();\r
 \r
-    } catch(NumberFormatException e) {\r
-      this.chain = tmpstr;\r
+        try {\r
+            tmpstr = str.nextToken();\r
 \r
-      if (tmpstr.equals("A")) {\r
-        this.color = new Color((float)Math.random(),(float)Math.random(),(float)Math.random());\r
-      } else {\r
-        this.color = Color.red;\r
-      }\r
-      this.resNumber = (new Integer(str.nextToken()).intValue());\r
-    }\r
+            this.resNumber = (new Integer(tmpstr).intValue());\r
+            this.chain = "A";\r
+            this.color = Color.green;\r
+        } catch (NumberFormatException e) {\r
+            this.chain = tmpstr;\r
 \r
-    this.x = (double)(new Double(str.nextToken()).floatValue());\r
-    this.y = (double)(new Double(str.nextToken()).floatValue());\r
-    this.z = (double)(new Double(str.nextToken()).floatValue());\r
+            if (tmpstr.equals("A")) {\r
+                this.color = new Color((float) Math.random(),\r
+                        (float) Math.random(), (float) Math.random());\r
+            } else {\r
+                this.color = Color.red;\r
+            }\r
 \r
-  }\r
+            this.resNumber = (new Integer(str.nextToken()).intValue());\r
+        }\r
 \r
-  public void setColor(Color col) {\r
-    this.color = col;\r
-  }\r
+        this.x = (double) (new Double(str.nextToken()).floatValue());\r
+        this.y = (double) (new Double(str.nextToken()).floatValue());\r
+        this.z = (double) (new Double(str.nextToken()).floatValue());\r
+    }\r
 \r
+    public void setColor(Color col) {\r
+        this.color = col;\r
+    }\r
 }\r
index c84152a..17f66bb 100755 (executable)
 * 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 MCview;\r
 \r
 import java.awt.*;\r
 \r
-public class Bond {\r
-\r
-  float start[];\r
-  float end[];\r
-\r
-  Color startCol;\r
-  Color endCol;\r
-\r
-  public myAtom at1;\r
-  public myAtom at2;\r
-\r
-  public Bond(float[] start, float[] end, myAtom at1, myAtom at2) {\r
-    this.start    = start;\r
-    this.end      = end;\r
-    this.startCol = at1.color;\r
-    this.endCol   = at2.color;\r
-    this.at1      = at1;\r
-    this.at2      = at2;\r
-  }\r
-  public Bond(Bond bond) {\r
-    this.start    = new float[3];\r
-\r
-    this.start[0] = bond.start[0];\r
-    this.start[1] = bond.start[1];\r
-    this.start[2] = bond.start[2];\r
-\r
-    this.end    = new float[3];\r
 \r
-    this.end[0] = bond.end[0];\r
-    this.end[1] = bond.end[1];\r
-    this.end[2] = bond.end[2];\r
-\r
-    this.startCol = bond.startCol;\r
-    this.endCol   = bond.endCol;\r
-  }\r
-\r
-  public void print() {\r
-    System.out.println("Start " + start[0] + " "+ start[1] + " " + start[2]);\r
-    System.out.println("End   " + end[0] + " "+ end[1] + " " + end[2]);\r
-  }\r
-\r
-  public float length() {\r
-    float len = (end[0] - start[0])*(end[0] - start[0]) +\r
-                (end[1] - start[1])*(end[1] - start[1]) +\r
-                (end[2] - start[2])*(end[2] - start[2]);\r
-\r
-    len = (float)(Math.sqrt(len));\r
-\r
-    return len;\r
-  }\r
-  public void translate(float x, float y, float z) {\r
-    start[0] = (start[0] + x);\r
-    end[0]   = (end[0] + x);\r
-\r
-    start[1] = (start[1] + y);\r
-    end[1]   = (end[1] + y);\r
-\r
-    start[2] = (start[2] + z);\r
-    end[2]   = (end[2] + z);\r
-  }\r
+public class Bond {\r
+    float[] start;\r
+    float[] end;\r
+    Color startCol;\r
+    Color endCol;\r
+    public myAtom at1;\r
+    public myAtom at2;\r
+\r
+    public Bond(float[] start, float[] end, myAtom at1, myAtom at2) {\r
+        this.start = start;\r
+        this.end = end;\r
+        this.startCol = at1.color;\r
+        this.endCol = at2.color;\r
+        this.at1 = at1;\r
+        this.at2 = at2;\r
+    }\r
+\r
+    public Bond(Bond bond) {\r
+        this.start = new float[3];\r
+\r
+        this.start[0] = bond.start[0];\r
+        this.start[1] = bond.start[1];\r
+        this.start[2] = bond.start[2];\r
+\r
+        this.end = new float[3];\r
+\r
+        this.end[0] = bond.end[0];\r
+        this.end[1] = bond.end[1];\r
+        this.end[2] = bond.end[2];\r
+\r
+        this.startCol = bond.startCol;\r
+        this.endCol = bond.endCol;\r
+    }\r
+\r
+    public void print() {\r
+        System.out.println("Start " + start[0] + " " + start[1] + " " +\r
+            start[2]);\r
+        System.out.println("End   " + end[0] + " " + end[1] + " " + end[2]);\r
+    }\r
+\r
+    public float length() {\r
+        float len = ((end[0] - start[0]) * (end[0] - start[0])) +\r
+            ((end[1] - start[1]) * (end[1] - start[1])) +\r
+            ((end[2] - start[2]) * (end[2] - start[2]));\r
+\r
+        len = (float) (Math.sqrt(len));\r
+\r
+        return len;\r
+    }\r
+\r
+    public void translate(float x, float y, float z) {\r
+        start[0] = (start[0] + x);\r
+        end[0] = (end[0] + x);\r
+\r
+        start[1] = (start[1] + y);\r
+        end[1] = (end[1] + y);\r
+\r
+        start[2] = (start[2] + z);\r
+        end[2] = (end[2] + z);\r
+    }\r
 }\r
index 31af9d4..2effba6 100755 (executable)
 * 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 MCview;\r
 \r
 public class MCMatrix {\r
-  float matrix[][];\r
-  float tmp[][];\r
-\r
-  float mycos;\r
-  float mysin;\r
-  float myconst = (float)(Math.PI/180);\r
-\r
-  public MCMatrix(int rows, int cols) {\r
-    matrix = new float[rows][cols];\r
-    tmp    = new float[rows][cols];\r
-  }\r
-\r
-  public void addElement(int i, int j, float value) {\r
-    matrix[i][j] = value;\r
-  }\r
-\r
-  public void print() {\r
-    System.out.println(matrix[0][0] + " " + matrix[0][1] + " " + matrix[0][2]);\r
-    System.out.println(matrix[1][0] + " " + matrix[1][1] + " " + matrix[1][2]);\r
-    System.out.println(matrix[2][0] + " " + matrix[2][1] + " " + matrix[2][2]);\r
-  }\r
-\r
-  public void rotatex(float degrees) {\r
-    mycos = (float)(Math.cos(degrees*myconst));\r
-    mysin = (float)(Math.sin(degrees*myconst));\r
-\r
-    tmp[0][0] = 1;\r
-    tmp[0][1] = 0;\r
-    tmp[0][2] = 0;\r
-    tmp[1][0] = 0;\r
-    tmp[1][1] = mycos;\r
-    tmp[1][2] = mysin;\r
-    tmp[2][0] = 0;\r
-    tmp[2][1] = -mysin;\r
-    tmp[2][2] = mycos;\r
-    preMultiply(tmp);\r
-  }\r
-\r
-  public void rotatez(float degrees) {\r
-    mycos = (float)(Math.cos(degrees*myconst));\r
-    mysin = (float)(Math.sin(degrees*myconst));\r
-\r
-    tmp[0][0] = mycos;\r
-    tmp[0][1] = -mysin;\r
-    tmp[0][2] = 0;\r
-    tmp[1][0] = mysin;\r
-    tmp[1][1] = mycos;\r
-    tmp[1][2] = 0;\r
-    tmp[2][0] = 0;\r
-    tmp[2][1] = 0;\r
-    tmp[2][2] = 1;\r
-\r
-    preMultiply(tmp);\r
-  }\r
-\r
-  public void rotatey(float degrees) {\r
-    mycos = (float)(Math.cos(degrees*myconst));\r
-    mysin = (float)(Math.sin(degrees*myconst));\r
-\r
-    tmp[0][0] = mycos;\r
-    tmp[0][1] = 0;\r
-    tmp[0][2] = -mysin;\r
-    tmp[1][0] = 0;\r
-    tmp[1][1] = 1;\r
-    tmp[1][2] = 0;\r
-    tmp[2][0] = mysin;\r
-    tmp[2][1] = 0;\r
-    tmp[2][2] = mycos;\r
-\r
-    preMultiply(tmp);\r
-  }\r
-\r
-  public float[] vectorMultiply(float[] vect) {\r
-    float temp[] = new float[3];\r
-\r
-    temp[0] = vect[0];\r
-    temp[1] = vect[1];\r
-    temp[2] = vect[2];\r
-\r
-    for (int i = 0; i < 3; i++) {\r
-      temp[i] = (float)matrix[i][0]*vect[0] + (float)matrix[i][1]*vect[1] +(float)matrix[i][2]*vect[2];\r
+    float[][] matrix;\r
+    float[][] tmp;\r
+    float mycos;\r
+    float mysin;\r
+    float myconst = (float) (Math.PI / 180);\r
+\r
+    public MCMatrix(int rows, int cols) {\r
+        matrix = new float[rows][cols];\r
+        tmp = new float[rows][cols];\r
     }\r
 \r
-    vect[0] = temp[0];\r
-    vect[1] = temp[1];\r
-    vect[2] = temp[2];\r
+    public void addElement(int i, int j, float value) {\r
+        matrix[i][j] = value;\r
+    }\r
 \r
-    return vect;\r
-  }\r
+    public void print() {\r
+        System.out.println(matrix[0][0] + " " + matrix[0][1] + " " +\r
+            matrix[0][2]);\r
+        System.out.println(matrix[1][0] + " " + matrix[1][1] + " " +\r
+            matrix[1][2]);\r
+        System.out.println(matrix[2][0] + " " + matrix[2][1] + " " +\r
+            matrix[2][2]);\r
+    }\r
 \r
-  public void preMultiply(float mat[][]) {\r
-    float tmp[][]  = new float[3][3];\r
+    public void rotatex(float degrees) {\r
+        mycos = (float) (Math.cos(degrees * myconst));\r
+        mysin = (float) (Math.sin(degrees * myconst));\r
+\r
+        tmp[0][0] = 1;\r
+        tmp[0][1] = 0;\r
+        tmp[0][2] = 0;\r
+        tmp[1][0] = 0;\r
+        tmp[1][1] = mycos;\r
+        tmp[1][2] = mysin;\r
+        tmp[2][0] = 0;\r
+        tmp[2][1] = -mysin;\r
+        tmp[2][2] = mycos;\r
+        preMultiply(tmp);\r
+    }\r
 \r
-    for (int i = 0; i < 3 ; i++) {\r
-      for (int j = 0; j < 3; j++ ) {\r
-        tmp[i][j] = mat[i][0]*matrix[0][j] +\r
-                    mat[i][1]*matrix[1][j] +\r
-                    mat[i][2]*matrix[2][j];\r
-      }\r
+    public void rotatez(float degrees) {\r
+        mycos = (float) (Math.cos(degrees * myconst));\r
+        mysin = (float) (Math.sin(degrees * myconst));\r
+\r
+        tmp[0][0] = mycos;\r
+        tmp[0][1] = -mysin;\r
+        tmp[0][2] = 0;\r
+        tmp[1][0] = mysin;\r
+        tmp[1][1] = mycos;\r
+        tmp[1][2] = 0;\r
+        tmp[2][0] = 0;\r
+        tmp[2][1] = 0;\r
+        tmp[2][2] = 1;\r
+\r
+        preMultiply(tmp);\r
     }\r
 \r
-    for (int i = 0; i < 3 ; i++) {\r
-      for (int j = 0; j < 3; j++ ) {\r
-        matrix[i][j] = tmp[i][j];\r
-      }\r
+    public void rotatey(float degrees) {\r
+        mycos = (float) (Math.cos(degrees * myconst));\r
+        mysin = (float) (Math.sin(degrees * myconst));\r
+\r
+        tmp[0][0] = mycos;\r
+        tmp[0][1] = 0;\r
+        tmp[0][2] = -mysin;\r
+        tmp[1][0] = 0;\r
+        tmp[1][1] = 1;\r
+        tmp[1][2] = 0;\r
+        tmp[2][0] = mysin;\r
+        tmp[2][1] = 0;\r
+        tmp[2][2] = mycos;\r
+\r
+        preMultiply(tmp);\r
     }\r
-  }\r
 \r
-  public void postMultiply(float mat[][]) {\r
-    float tmp[][]  = new float[3][3];\r
+    public float[] vectorMultiply(float[] vect) {\r
+        float[] temp = new float[3];\r
+\r
+        temp[0] = vect[0];\r
+        temp[1] = vect[1];\r
+        temp[2] = vect[2];\r
+\r
+        for (int i = 0; i < 3; i++) {\r
+            temp[i] = ((float) matrix[i][0] * vect[0]) +\r
+                ((float) matrix[i][1] * vect[1]) +\r
+                ((float) matrix[i][2] * vect[2]);\r
+        }\r
 \r
-    for (int i = 0; i < 3 ; i++) {\r
-      for (int j = 0; j < 3; j++ ) {\r
-        tmp[i][j] = matrix[i][0]*mat[0][j] +\r
-                    matrix[i][1]*mat[1][j] +\r
-                    matrix[i][2]*mat[2][j];\r
-      }\r
+        vect[0] = temp[0];\r
+        vect[1] = temp[1];\r
+        vect[2] = temp[2];\r
+\r
+        return vect;\r
     }\r
 \r
-    for (int i = 0; i < 3 ; i++) {\r
-      for (int j = 0; j < 3; j++ ) {\r
-        matrix[i][j] = tmp[i][j];\r
-      }\r
+    public void preMultiply(float[][] mat) {\r
+        float[][] tmp = new float[3][3];\r
+\r
+        for (int i = 0; i < 3; i++) {\r
+            for (int j = 0; j < 3; j++) {\r
+                tmp[i][j] = (mat[i][0] * matrix[0][j]) +\r
+                    (mat[i][1] * matrix[1][j]) + (mat[i][2] * matrix[2][j]);\r
+            }\r
+        }\r
+\r
+        for (int i = 0; i < 3; i++) {\r
+            for (int j = 0; j < 3; j++) {\r
+                matrix[i][j] = tmp[i][j];\r
+            }\r
+        }\r
     }\r
-  }\r
-\r
-  public void setIdentity() {\r
-    matrix[0][0] = 1;\r
-    matrix[1][1] = 1;\r
-    matrix[2][2] = 1;\r
-    matrix[0][1] = 0;\r
-    matrix[0][2] = 0;\r
-    matrix[1][0] = 0;\r
-    matrix[1][2] = 0;\r
-    matrix[2][0] = 0;\r
-    matrix[2][1] = 0;\r
-  }\r
-}\r
 \r
+    public void postMultiply(float[][] mat) {\r
+        float[][] tmp = new float[3][3];\r
+\r
+        for (int i = 0; i < 3; i++) {\r
+            for (int j = 0; j < 3; j++) {\r
+                tmp[i][j] = (matrix[i][0] * mat[0][j]) +\r
+                    (matrix[i][1] * mat[1][j]) + (matrix[i][2] * mat[2][j]);\r
+            }\r
+        }\r
+\r
+        for (int i = 0; i < 3; i++) {\r
+            for (int j = 0; j < 3; j++) {\r
+                matrix[i][j] = tmp[i][j];\r
+            }\r
+        }\r
+    }\r
 \r
+    public void setIdentity() {\r
+        matrix[0][0] = 1;\r
+        matrix[1][1] = 1;\r
+        matrix[2][2] = 1;\r
+        matrix[0][1] = 0;\r
+        matrix[0][2] = 0;\r
+        matrix[1][0] = 0;\r
+        matrix[1][2] = 0;\r
+        matrix[2][0] = 0;\r
+        matrix[2][1] = 0;\r
+    }\r
+}\r
index fdb74bd..4bfe255 100755 (executable)
 * 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 MCview;\r
 \r
 import jalview.datamodel.*;\r
+\r
 import jalview.schemes.ResidueProperties;\r
 \r
 import java.awt.*;\r
+\r
 import java.util.*;\r
 \r
 \r
 public class PDBChain {\r
+    public String id;\r
+    public Vector bonds = new Vector();\r
+    public Vector atoms = new Vector();\r
+    public Vector residues = new Vector();\r
+    public int offset;\r
+    public Sequence sequence;\r
+    public boolean isVisible = false;\r
+    public int pdbstart = 0;\r
+    public int pdbend = 0;\r
+    public int seqstart = 0;\r
+    public int seqend = 0;\r
+\r
+    //public DrawableSequence ds;\r
+    public PDBChain(String id) {\r
+        this.id = id;\r
+    }\r
 \r
-  public String id;\r
-  public Vector bonds = new Vector();\r
-  public Vector atoms = new Vector();\r
-  public Vector residues = new Vector();\r
-  public int offset;\r
-\r
-  public Sequence sequence;\r
-  public boolean isVisible = false;\r
-\r
-  public int pdbstart=0, pdbend=0, seqstart=0, seqend=0;\r
-\r
-  //public DrawableSequence ds;\r
-\r
-  public PDBChain(String id) {\r
-    this.id = id;\r
-  }\r
-\r
+    public String print() {\r
+        String tmp = "";\r
 \r
-  public String print() {\r
-    String tmp = "";\r
-    for (int i=0; i < bonds.size() ;i++) {\r
-      tmp = tmp + ((Bond)bonds.elementAt(i)).at1.resName + " " + ((Bond)bonds.elementAt(i)).at1.resNumber +" " + offset+ "\n";\r
-    }\r
-    return tmp;\r
-  }\r
-  public void makeCaBondList() {\r
-    for (int i = 0; i < (residues.size() - 1) ; i++) {\r
-      Residue tmpres = (Residue)residues.elementAt(i);\r
-      Residue tmpres2 = (Residue)residues.elementAt(i+1);\r
-      myAtom at1 = tmpres.findAtom("CA");\r
-      myAtom at2 = tmpres2.findAtom("CA");\r
-      if ((at1 != null) && (at2 != null)) {\r
-        if (at1.chain.equals(at2.chain)) {\r
-          makeBond(at1,at2);\r
-        }\r
-      }\r
-    }\r
-  }\r
-\r
-  public void makeBond(myAtom at1, myAtom at2) {\r
-    float[] start = new float[3];\r
-    float[] end = new float[3];\r
-\r
-    start[0] = at1.x;\r
-    start[1] = at1.y;\r
-    start[2] = at1.z;\r
-\r
-    end[0] = at2.x;\r
-    end[1] = at2.y;\r
-    end[2] = at2.z;\r
-\r
-    bonds.addElement(new Bond(start, end, at1,at2));\r
-  }\r
-\r
-  public void makeResidueList() {\r
-    int count = 0;\r
-    String seq = "";\r
-    for (int i = 0; i < atoms.size(); i++) {\r
-\r
-      myAtom tmp = (myAtom)atoms.elementAt(i);\r
-      String resName = tmp.resName;\r
-      int resNumber = tmp.resNumber;\r
-      int res = resNumber;\r
-\r
-      if (i ==0) {\r
-        offset = resNumber;\r
-      }\r
-      Vector resAtoms = new Vector();\r
-\r
-      resAtoms.addElement((myAtom)atoms.elementAt(i));\r
-      i++;\r
-      resNumber = ((myAtom)atoms.elementAt(i)).resNumber;\r
-\r
-      //Add atoms to a vector while the residue number\r
-      //remains the same\r
-      while ((resNumber == res) && (i < atoms.size())) {\r
-\r
-        resAtoms.addElement((myAtom)atoms.elementAt(i));\r
-        i++;\r
-        if (i < atoms.size()) {\r
-          resNumber = ((myAtom)atoms.elementAt(i)).resNumber;\r
-        } else {\r
-          resNumber++;\r
+        for (int i = 0; i < bonds.size(); i++) {\r
+            tmp = tmp + ((Bond) bonds.elementAt(i)).at1.resName + " " +\r
+                ((Bond) bonds.elementAt(i)).at1.resNumber + " " + offset +\r
+                "\n";\r
         }\r
-      }\r
-\r
-      //We need this to keep in step with the outer for i = loop\r
-      i--;\r
-\r
-      //Make a new Residue object with the new atoms vector\r
-      residues.addElement(new Residue(resAtoms, resNumber - 1,count));\r
-      count++;\r
-      Residue tmpres = (Residue)residues.lastElement();\r
-      myAtom tmpat = (myAtom)tmpres.atoms.elementAt(0);\r
-\r
-      // Keep totting up the sequence\r
-      if (ResidueProperties.getAA3Hash().get(tmpat.resName) == null) {\r
-        System.err.println("PDBReader:Null aa3Hash for " + tmpat.resName);\r
-      } else {\r
-        String tmpres2 =\r
-          ResidueProperties.aa[((Integer)ResidueProperties.getAA3Hash().get(tmpat.resName)).intValue()];\r
-        seq = seq + tmpres2;\r
-      }\r
-      //      System.out.println(tmpat.resName + " " + tmpres2);\r
+\r
+        return tmp;\r
     }\r
-    sequence = new Sequence("PDB_seq",seq,1,seq.length());\r
-    System.out.println("PDB Sequence is :\nSequence = " + seq);\r
-    System.out.println("No of residues = " +residues.size());\r
-  }\r
-\r
-  public void setChargeColours() {\r
-    for (int i = 0; i < bonds.size(); i++) {\r
-      try {\r
-        Bond b = (Bond)bonds.elementAt(i);\r
-\r
-        if (b.at1.resName.toUpperCase().equals("ASP") || b.at1.resName.toUpperCase().equals("GLU")) {\r
-          b.startCol = Color.red;\r
-        } else if (b.at1.resName.toUpperCase().equals("LYS") || b.at1.resName.toUpperCase().equals("ARG")) {\r
-          b.startCol = Color.blue;\r
-        } else if (b.at1.resName.toUpperCase().equals("CYS")) {\r
-          b.startCol = Color.yellow;\r
-        } else {\r
-          int atno = ((Integer)ResidueProperties.getAA3Hash().get(b.at1.resName.toUpperCase())).intValue();\r
-          b.startCol = Color.lightGray;\r
-        }\r
-        if (b.at2.resName.toUpperCase().equals("ASP") || b.at2.resName.toUpperCase().equals("GLU")) {\r
-          b.endCol = Color.red;\r
-        } else if (b.at2.resName.toUpperCase().equals("LYS") || b.at2.resName.toUpperCase().equals("ARG")) {\r
-          b.endCol = Color.blue;\r
-        } else if (b.at2.resName.toUpperCase().equals("CYS")) {\r
-          b.endCol = Color.yellow;\r
-        } else {\r
-          int atno = ((Integer)ResidueProperties.getAA3Hash().get(b.at2.resName.toUpperCase())).intValue();\r
-          b.endCol = Color.lightGray;\r
+\r
+    public void makeCaBondList() {\r
+        for (int i = 0; i < (residues.size() - 1); i++) {\r
+            Residue tmpres = (Residue) residues.elementAt(i);\r
+            Residue tmpres2 = (Residue) residues.elementAt(i + 1);\r
+            myAtom at1 = tmpres.findAtom("CA");\r
+            myAtom at2 = tmpres2.findAtom("CA");\r
+\r
+            if ((at1 != null) && (at2 != null)) {\r
+                if (at1.chain.equals(at2.chain)) {\r
+                    makeBond(at1, at2);\r
+                }\r
+            }\r
         }\r
-      } catch (Exception e) {\r
-        Bond b = (Bond)bonds.elementAt(i);\r
-        b.startCol = Color.gray;\r
-        b.endCol = Color.gray;\r
-      }\r
     }\r
-  }\r
 \r
-  public void setHydrophobicityColours() {\r
-    float hydmin = (float)ResidueProperties.getHydmin();\r
-    float hydmax = (float)ResidueProperties.getHydmax();\r
-    double[] hyd  = ResidueProperties.getHyd();\r
+    public void makeBond(myAtom at1, myAtom at2) {\r
+        float[] start = new float[3];\r
+        float[] end = new float[3];\r
 \r
-    Hashtable AA3Hash = ResidueProperties.getAA3Hash();\r
+        start[0] = at1.x;\r
+        start[1] = at1.y;\r
+        start[2] = at1.z;\r
 \r
-    for (int i = 0; i < bonds.size(); i++) {\r
-      try {\r
-        Bond b = (Bond)bonds.elementAt(i);\r
+        end[0] = at2.x;\r
+        end[1] = at2.y;\r
+        end[2] = at2.z;\r
 \r
-        int   atno = ((Integer)AA3Hash.get(b.at1.resName.toUpperCase())).intValue();\r
-        float red  = ((float)hyd[atno] - hydmin)/(hydmax - hydmin);\r
+        bonds.addElement(new Bond(start, end, at1, at2));\r
+    }\r
 \r
-        if (red > (float)1.0) {\r
-          red = (float)1.0;\r
-        }\r
-        if (red < (float)0.0) {\r
-          red = (float)0.0;\r
+    public void makeResidueList() {\r
+        int count = 0;\r
+        String seq = "";\r
+\r
+        for (int i = 0; i < atoms.size(); i++) {\r
+            myAtom tmp = (myAtom) atoms.elementAt(i);\r
+            String resName = tmp.resName;\r
+            int resNumber = tmp.resNumber;\r
+            int res = resNumber;\r
+\r
+            if (i == 0) {\r
+                offset = resNumber;\r
+            }\r
+\r
+            Vector resAtoms = new Vector();\r
+\r
+            resAtoms.addElement((myAtom) atoms.elementAt(i));\r
+            i++;\r
+            resNumber = ((myAtom) atoms.elementAt(i)).resNumber;\r
+\r
+            //Add atoms to a vector while the residue number\r
+            //remains the same\r
+            while ((resNumber == res) && (i < atoms.size())) {\r
+                resAtoms.addElement((myAtom) atoms.elementAt(i));\r
+                i++;\r
+\r
+                if (i < atoms.size()) {\r
+                    resNumber = ((myAtom) atoms.elementAt(i)).resNumber;\r
+                } else {\r
+                    resNumber++;\r
+                }\r
+            }\r
+\r
+            //We need this to keep in step with the outer for i = loop\r
+            i--;\r
+\r
+            //Make a new Residue object with the new atoms vector\r
+            residues.addElement(new Residue(resAtoms, resNumber - 1, count));\r
+            count++;\r
+\r
+            Residue tmpres = (Residue) residues.lastElement();\r
+            myAtom tmpat = (myAtom) tmpres.atoms.elementAt(0);\r
+\r
+            // Keep totting up the sequence\r
+            if (ResidueProperties.getAA3Hash().get(tmpat.resName) == null) {\r
+                System.err.println("PDBReader:Null aa3Hash for " +\r
+                    tmpat.resName);\r
+            } else {\r
+                String tmpres2 = ResidueProperties.aa[((Integer) ResidueProperties.getAA3Hash()\r
+                                                                                  .get(tmpat.resName)).intValue()];\r
+                seq = seq + tmpres2;\r
+            }\r
+\r
+            //      System.out.println(tmpat.resName + " " + tmpres2);\r
         }\r
 \r
-        b.startCol = new Color(red,(float)0.0,(float)1.0-red);\r
-        atno = ((Integer)AA3Hash.get(b.at2.resName.toUpperCase())).intValue();\r
-\r
-        red = ((float)hyd[atno] - hydmin)/(hydmax - hydmin);\r
+        sequence = new Sequence("PDB_seq", seq, 1, seq.length());\r
+        System.out.println("PDB Sequence is :\nSequence = " + seq);\r
+        System.out.println("No of residues = " + residues.size());\r
+    }\r
 \r
-        if (red > (float)1.0) {\r
-          red = (float)1.0;\r
+    public void setChargeColours() {\r
+        for (int i = 0; i < bonds.size(); i++) {\r
+            try {\r
+                Bond b = (Bond) bonds.elementAt(i);\r
+\r
+                if (b.at1.resName.toUpperCase().equals("ASP") ||\r
+                        b.at1.resName.toUpperCase().equals("GLU")) {\r
+                    b.startCol = Color.red;\r
+                } else if (b.at1.resName.toUpperCase().equals("LYS") ||\r
+                        b.at1.resName.toUpperCase().equals("ARG")) {\r
+                    b.startCol = Color.blue;\r
+                } else if (b.at1.resName.toUpperCase().equals("CYS")) {\r
+                    b.startCol = Color.yellow;\r
+                } else {\r
+                    int atno = ((Integer) ResidueProperties.getAA3Hash().get(b.at1.resName.toUpperCase())).intValue();\r
+                    b.startCol = Color.lightGray;\r
+                }\r
+\r
+                if (b.at2.resName.toUpperCase().equals("ASP") ||\r
+                        b.at2.resName.toUpperCase().equals("GLU")) {\r
+                    b.endCol = Color.red;\r
+                } else if (b.at2.resName.toUpperCase().equals("LYS") ||\r
+                        b.at2.resName.toUpperCase().equals("ARG")) {\r
+                    b.endCol = Color.blue;\r
+                } else if (b.at2.resName.toUpperCase().equals("CYS")) {\r
+                    b.endCol = Color.yellow;\r
+                } else {\r
+                    int atno = ((Integer) ResidueProperties.getAA3Hash().get(b.at2.resName.toUpperCase())).intValue();\r
+                    b.endCol = Color.lightGray;\r
+                }\r
+            } catch (Exception e) {\r
+                Bond b = (Bond) bonds.elementAt(i);\r
+                b.startCol = Color.gray;\r
+                b.endCol = Color.gray;\r
+            }\r
         }\r
-        if (red < (float)0.0) {\r
-          red = (float)0.0;\r
-        }\r
-\r
-        b.endCol = new Color(red,(float)0.2,(float)1.0-red);\r
-      } catch (Exception e) {\r
-        Bond b = (Bond)bonds.elementAt(i);\r
-        b.startCol = Color.gray;\r
-        b.endCol = Color.gray;\r
-      }\r
     }\r
-  }\r
-\r
 \r
-  public void colourBySequence(jalview.gui.AlignViewport av, Sequence seq) {\r
-jalview.gui.SequenceRenderer sr = new jalview.gui.SequenceRenderer(av);\r
+    public void setHydrophobicityColours() {\r
+        float hydmin = (float) ResidueProperties.getHydmin();\r
+        float hydmax = (float) ResidueProperties.getHydmax();\r
+        double[] hyd = ResidueProperties.getHyd();\r
 \r
+        Hashtable AA3Hash = ResidueProperties.getAA3Hash();\r
 \r
-    for (int i = 0; i < bonds.size(); i++) {\r
-      Bond tmp = (Bond)bonds.elementAt(i);\r
-      try {\r
+        for (int i = 0; i < bonds.size(); i++) {\r
+            try {\r
+                Bond b = (Bond) bonds.elementAt(i);\r
 \r
-        if (tmp.at1.resNumber >= (offset + pdbstart - 1) && tmp.at1.resNumber <= (offset + pdbend - 1)) {\r
+                int atno = ((Integer) AA3Hash.get(b.at1.resName.toUpperCase())).intValue();\r
+                float red = ((float) hyd[atno] - hydmin) / (hydmax - hydmin);\r
 \r
-          int pos   = seqstart + (tmp.at1.resNumber - pdbstart - offset) ;\r
-          int index = seq.findIndex(pos);\r
+                if (red > (float) 1.0) {\r
+                    red = (float) 1.0;\r
+                }\r
 \r
+                if (red < (float) 0.0) {\r
+                    red = (float) 0.0;\r
+                }\r
 \r
-          tmp.startCol = sr.getResidueBoxColour(av.getGlobalColourScheme(), seq, index);\r
+                b.startCol = new Color(red, (float) 0.0, (float) 1.0 - red);\r
+                atno = ((Integer) AA3Hash.get(b.at2.resName.toUpperCase())).intValue();\r
 \r
-        } else {\r
-          tmp.startCol = Color.gray;\r
-        }\r
+                red = ((float) hyd[atno] - hydmin) / (hydmax - hydmin);\r
 \r
-        if (tmp.at2.resNumber >= (offset + pdbstart -1) && tmp.at2.resNumber <= (pdbend+offset-1)) {\r
+                if (red > (float) 1.0) {\r
+                    red = (float) 1.0;\r
+                }\r
 \r
-          int pos    = seqstart + (tmp.at2.resNumber - pdbstart-offset);\r
-          int index  = seq.findIndex(pos);\r
+                if (red < (float) 0.0) {\r
+                    red = (float) 0.0;\r
+                }\r
 \r
-          tmp.endCol = sr.getResidueBoxColour(av.getGlobalColourScheme(), seq, index);\r
+                b.endCol = new Color(red, (float) 0.2, (float) 1.0 - red);\r
+            } catch (Exception e) {\r
+                Bond b = (Bond) bonds.elementAt(i);\r
+                b.startCol = Color.gray;\r
+                b.endCol = Color.gray;\r
+            }\r
+        }\r
+    }\r
 \r
-        } else {\r
-          tmp.endCol = Color.gray;\r
+    public void colourBySequence(jalview.gui.AlignViewport av, Sequence seq) {\r
+        jalview.gui.SequenceRenderer sr = new jalview.gui.SequenceRenderer(av);\r
+\r
+        for (int i = 0; i < bonds.size(); i++) {\r
+            Bond tmp = (Bond) bonds.elementAt(i);\r
+\r
+            try {\r
+                if ((tmp.at1.resNumber >= ((offset + pdbstart) - 1)) &&\r
+                        (tmp.at1.resNumber <= ((offset + pdbend) - 1))) {\r
+                    int pos = seqstart +\r
+                        (tmp.at1.resNumber - pdbstart - offset);\r
+                    int index = seq.findIndex(pos);\r
+\r
+                    tmp.startCol = sr.getResidueBoxColour(av.getGlobalColourScheme(),\r
+                            seq, index);\r
+                } else {\r
+                    tmp.startCol = Color.gray;\r
+                }\r
+\r
+                if ((tmp.at2.resNumber >= ((offset + pdbstart) - 1)) &&\r
+                        (tmp.at2.resNumber <= ((pdbend + offset) - 1))) {\r
+                    int pos = seqstart +\r
+                        (tmp.at2.resNumber - pdbstart - offset);\r
+                    int index = seq.findIndex(pos);\r
+\r
+                    tmp.endCol = sr.getResidueBoxColour(av.getGlobalColourScheme(),\r
+                            seq, index);\r
+                } else {\r
+                    tmp.endCol = Color.gray;\r
+                }\r
+            } catch (Exception e) {\r
+                tmp.startCol = Color.lightGray;\r
+                tmp.endCol = Color.lightGray;\r
+            }\r
         }\r
-      } catch (Exception e) {\r
-        tmp.startCol = Color.lightGray;\r
-        tmp.endCol = Color.lightGray;\r
-      }\r
     }\r
-  }\r
-\r
-  public void setChainColours() {\r
-    for (int i = 0; i < bonds.size(); i++) {\r
-      Bond tmp = (Bond)bonds.elementAt(i);\r
-      try {\r
-        tmp.startCol = (Color) ResidueProperties.getChainColours().get(id);\r
-        tmp.endCol   = (Color) ResidueProperties.getChainColours().get(id);\r
-      } catch (Exception e) {\r
-        tmp.startCol = Color.lightGray;\r
-        tmp.endCol   = Color.lightGray;\r
-      }\r
+\r
+    public void setChainColours() {\r
+        for (int i = 0; i < bonds.size(); i++) {\r
+            Bond tmp = (Bond) bonds.elementAt(i);\r
+\r
+            try {\r
+                tmp.startCol = (Color) ResidueProperties.getChainColours().get(id);\r
+                tmp.endCol = (Color) ResidueProperties.getChainColours().get(id);\r
+            } catch (Exception e) {\r
+                tmp.startCol = Color.lightGray;\r
+                tmp.endCol = Color.lightGray;\r
+            }\r
+        }\r
     }\r
-  }\r
 }\r
-\r
-\r
index 1937a8f..71d8c11 100755 (executable)
 * 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 MCview;\r
 \r
 import jalview.datamodel.*;\r
+\r
 import java.io.*;\r
+\r
 import java.net.*;\r
+\r
 import java.util.*;\r
 \r
 \r
 public class PDBfile extends jalview.io.FileParse {\r
+    public Vector chains = new Vector();\r
+    Vector lineArray = new Vector();\r
 \r
-  public Vector chains = new Vector();\r
+    public PDBfile(String[] lines) {\r
+        for (int i = 0; i < lines.length; i++)\r
+            lineArray.addElement(lines[i]);\r
 \r
-  Vector lineArray = new Vector();\r
-\r
-  public PDBfile(String [] lines)\r
-  {\r
-    for(int i=0; i<lines.length; i++)\r
-      lineArray.addElement(lines[i]);\r
+        noLines = lineArray.size();\r
+        parse();\r
+    }\r
 \r
-    noLines = lineArray.size();\r
-    parse();\r
-  }\r
+    public PDBfile(String inFile, String inType) throws IOException {\r
+        super(inFile, inType);\r
 \r
-  public PDBfile(String inFile, String inType) throws IOException {\r
+        String line;\r
+        this.lineArray = new Vector();\r
 \r
-    super(inFile,inType);\r
+        BufferedReader dataIn;\r
 \r
-    String line;\r
-    this.lineArray = new Vector();\r
-    BufferedReader dataIn;\r
+        if (inType.equals("File")) {\r
+            dataIn = new BufferedReader(new FileReader(inFile));\r
+        }\r
+        else {\r
+            URL url = new URL(inFile);\r
+            this.fileSize = 0;\r
+            dataIn = new BufferedReader(new InputStreamReader(url.openStream()));\r
+        }\r
 \r
-    if (inType.equals("File"))\r
-      dataIn =  new BufferedReader(new FileReader( inFile ));\r
+        while ((line = dataIn.readLine()) != null) {\r
+            lineArray.addElement(line);\r
+        }\r
 \r
-    else\r
-    {\r
-      URL url = new URL(inFile);\r
-      this.fileSize = 0;\r
-      dataIn = new BufferedReader(new InputStreamReader(url.openStream()));\r
-    }\r
+        noLines = lineArray.size();\r
 \r
-    while ((line = dataIn.readLine()) != null) {\r
-      lineArray.addElement(line);\r
+        parse();\r
     }\r
-    noLines = lineArray.size();\r
 \r
-    parse();\r
+    public void parse() {\r
+        for (int i = 0; i < lineArray.size(); i++) {\r
+            StringTokenizer str = new StringTokenizer(lineArray.elementAt(i)\r
+                                                               .toString());\r
+\r
+            if (str.hasMoreTokens()) {\r
+                String inStr = str.nextToken();\r
+\r
+                if (inStr.indexOf("ATOM") != -1) {\r
+                    try {\r
+                        myAtom tmpatom = new myAtom(str);\r
+\r
+                        if (findChain(tmpatom.chain) != null) {\r
+                            //   System.out.println("Adding to chain " + tmpatom.chain);\r
+                            findChain(tmpatom.chain).atoms.addElement(tmpatom);\r
+                        } else {\r
+                            //  System.out.println("Making chain " + tmpatom.chain);\r
+                            PDBChain tmpchain = new PDBChain(tmpatom.chain);\r
+                            chains.addElement(tmpchain);\r
+                            tmpchain.atoms.addElement(tmpatom);\r
+                        }\r
+                    } catch (NumberFormatException e) {\r
+                        System.err.println("Caught" + e);\r
+                        System.err.println("Record not added to PDB model:" +\r
+                            lineArray.elementAt(i).toString());\r
+                    }\r
+                }\r
+            }\r
+        }\r
 \r
-}\r
+        makeResidueList();\r
+        makeCaBondList();\r
 \r
+        //    for (int i=0; i < chains.size() ; i++) {\r
+        //  String pog = ((PDBChain)chains.elementAt(i)).print();\r
+        //  System.out.println(pog);\r
+        // }\r
+    }\r
 \r
-  public void parse() {\r
-\r
-    for (int i = 0; i < lineArray.size(); i++) {\r
-      StringTokenizer str = new StringTokenizer(lineArray.elementAt(i).toString());\r
-      if (str.hasMoreTokens()) {\r
-        String inStr = str.nextToken();\r
-\r
-        if (inStr.indexOf("ATOM") != -1) {\r
-          try {\r
-            myAtom tmpatom = new myAtom(str);\r
-            if (findChain(tmpatom.chain) != null) {\r
-           //   System.out.println("Adding to chain " + tmpatom.chain);\r
-              findChain(tmpatom.chain).atoms.addElement(tmpatom);\r
-            } else {\r
-            //  System.out.println("Making chain " + tmpatom.chain);\r
-              PDBChain tmpchain = new PDBChain(tmpatom.chain);\r
-              chains.addElement(tmpchain);\r
-              tmpchain.atoms.addElement(tmpatom);\r
-            }\r
-          } catch(NumberFormatException e) {\r
-            System.err.println("Caught" +  e);\r
-            System.err.println("Record not added to PDB model:"+lineArray.elementAt(i).toString());\r
-          }\r
+    public void makeResidueList() {\r
+        for (int i = 0; i < chains.size(); i++) {\r
+            ((PDBChain) chains.elementAt(i)).makeResidueList();\r
         }\r
-      }\r
-    }\r
-    makeResidueList();\r
-    makeCaBondList();\r
-    //    for (int i=0; i < chains.size() ; i++) {\r
-    //  String pog = ((PDBChain)chains.elementAt(i)).print();\r
-    //  System.out.println(pog);\r
-    // }\r
-  }\r
-\r
-  public void makeResidueList() {\r
-    for (int i=0; i < chains.size() ; i++) {\r
-      ((PDBChain)chains.elementAt(i)).makeResidueList();\r
     }\r
-  }\r
-  public void makeCaBondList() {\r
-    for (int i=0; i < chains.size() ; i++) {\r
-      ((PDBChain)chains.elementAt(i)).makeCaBondList();\r
-    }\r
-  }\r
-\r
-  public PDBChain findChain(String id) {\r
-    for (int i=0; i < chains.size(); i++) {\r
-      // System.out.println("ID = " + id + " " +((PDBChain)chains.elementAt(i)).id);\r
-      if (((PDBChain)chains.elementAt(i)).id.equals(id)) {\r
-        return (PDBChain)chains.elementAt(i);\r
-      }\r
+\r
+    public void makeCaBondList() {\r
+        for (int i = 0; i < chains.size(); i++) {\r
+            ((PDBChain) chains.elementAt(i)).makeCaBondList();\r
+        }\r
     }\r
-    return null;\r
-  }\r
 \r
+    public PDBChain findChain(String id) {\r
+        for (int i = 0; i < chains.size(); i++) {\r
+            // System.out.println("ID = " + id + " " +((PDBChain)chains.elementAt(i)).id);\r
+            if (((PDBChain) chains.elementAt(i)).id.equals(id)) {\r
+                return (PDBChain) chains.elementAt(i);\r
+            }\r
+        }\r
 \r
-  public void setChargeColours() {\r
-    for (int i=0; i < chains.size(); i++) {\r
-      ((PDBChain)chains.elementAt(i)).setChargeColours();\r
+        return null;\r
     }\r
-  }\r
 \r
-  public void setHydrophobicityColours() {\r
-    for (int i=0; i < chains.size(); i++) {\r
-      ((PDBChain)chains.elementAt(i)).setHydrophobicityColours();\r
-    }\r
-  }\r
-\r
-  public void colourBySequence(Sequence seq) {\r
-//SMJS TODO\r
-//    int max = seq.maxchain;\r
-//    if (seq.maxchain != -1) {\r
-//      ((PDBChain)chains.elementAt(max)).colourBySequence(seq);\r
-//    }\r
-  }\r
-\r
-  public void setChainColours() {\r
-    for (int i=0; i < chains.size(); i++) {\r
-      ((PDBChain)chains.elementAt(i)).setChainColours();\r
+    public void setChargeColours() {\r
+        for (int i = 0; i < chains.size(); i++) {\r
+            ((PDBChain) chains.elementAt(i)).setChargeColours();\r
+        }\r
     }\r
-  }\r
-  public static void main(String[] args) {\r
-    try {\r
-      PDBfile pdb = new PDBfile("enkp1.pdb","File");\r
-    } catch(IOException e) {\r
-      System.out.println(e);\r
-      e.printStackTrace();\r
-      System.exit(0);\r
+\r
+    public void setHydrophobicityColours() {\r
+        for (int i = 0; i < chains.size(); i++) {\r
+            ((PDBChain) chains.elementAt(i)).setHydrophobicityColours();\r
+        }\r
     }\r
-  }\r
-}\r
 \r
+    public void colourBySequence(Sequence seq) {\r
+        //SMJS TODO\r
+        //    int max = seq.maxchain;\r
+        //    if (seq.maxchain != -1) {\r
+        //      ((PDBChain)chains.elementAt(max)).colourBySequence(seq);\r
+        //    }\r
+    }\r
 \r
+    public void setChainColours() {\r
+        for (int i = 0; i < chains.size(); i++) {\r
+            ((PDBChain) chains.elementAt(i)).setChainColours();\r
+        }\r
+    }\r
 \r
+    public static void main(String[] args) {\r
+        try {\r
+            PDBfile pdb = new PDBfile("enkp1.pdb", "File");\r
+        } catch (IOException e) {\r
+            System.out.println(e);\r
+            e.printStackTrace();\r
+            System.exit(0);\r
+        }\r
+    }\r
+}\r
index 998e388..b01d982 100755 (executable)
 * 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 MCview;\r
 \r
 import java.util.*;\r
 \r
 \r
 public class Residue {\r
-  Vector atoms = new Vector();\r
-\r
-  int number;\r
-  int count;\r
-  int seqnumber;\r
-\r
-  public Residue(Vector atoms, int number, int count) {\r
-    this.atoms  = atoms;\r
-    this.number = number;\r
-    this.count  = count;\r
-  }\r
+    Vector atoms = new Vector();\r
+    int number;\r
+    int count;\r
+    int seqnumber;\r
+\r
+    public Residue(Vector atoms, int number, int count) {\r
+        this.atoms = atoms;\r
+        this.number = number;\r
+        this.count = count;\r
+    }\r
 \r
-  public myAtom findAtom(String name) {\r
+    public myAtom findAtom(String name) {\r
+        for (int i = 0; i < atoms.size(); i++) {\r
+            if (((myAtom) atoms.elementAt(i)).name.equals(name)) {\r
+                return (myAtom) atoms.elementAt(i);\r
+            }\r
+        }\r
 \r
-    for (int i = 0; i < atoms.size(); i++) {\r
-      if (((myAtom)atoms.elementAt(i)).name.equals(name)) {\r
-        return (myAtom)atoms.elementAt(i);\r
-      }\r
+        return null;\r
     }\r
-    return null;\r
-  }\r
 }\r
index 215f753..322fd2a 100755 (executable)
 * 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 MCview;\r
 \r
 import java.util.*;\r
 \r
-public class Zsort {\r
-\r
-  public static void Zsort(Vector bonds) {\r
-\r
-    sort(bonds,0,bonds.size()-1);\r
-  }\r
-\r
-\r
-\r
-  public static void sort(Vector bonds,int p, int r) {\r
-    int q;\r
 \r
-    if (p < r) {\r
-      q = partition(bonds,p,r);\r
-      sort(bonds,p,q);\r
-      sort(bonds,q+1,r);\r
+public class Zsort {\r
+    public static void Zsort(Vector bonds) {\r
+        sort(bonds, 0, bonds.size() - 1);\r
     }\r
-  }\r
-\r
-  private static int partition(Vector bonds, int p, int r) {\r
-    float x = ((Bond)bonds.elementAt(p)).start[2];\r
-    int i = p-1;\r
-    int j = r+1;\r
 \r
-    while(true) {\r
-      do {\r
-        j = j-1;\r
-      }        while (j >= 0  && ((Bond)bonds.elementAt(j)).start[2] > x);\r
+    public static void sort(Vector bonds, int p, int r) {\r
+        int q;\r
 \r
-      do {\r
-        i = i+1;\r
-      } while (i < bonds.size() && ((Bond)bonds.elementAt(i)).start[2] < x);\r
+        if (p < r) {\r
+            q = partition(bonds, p, r);\r
+            sort(bonds, p, q);\r
+            sort(bonds, q + 1, r);\r
+        }\r
+    }\r
 \r
-      if ( i < j) {\r
-        Bond tmp = (Bond)bonds.elementAt(i);\r
-        bonds.setElementAt(bonds.elementAt(j),i);\r
-        bonds.setElementAt(tmp,j);\r
-      } else {\r
-        return j;\r
-      }\r
+    private static int partition(Vector bonds, int p, int r) {\r
+        float x = ((Bond) bonds.elementAt(p)).start[2];\r
+        int i = p - 1;\r
+        int j = r + 1;\r
+\r
+        while (true) {\r
+            do {\r
+                j = j - 1;\r
+            } while ((j >= 0) && (((Bond) bonds.elementAt(j)).start[2] > x));\r
+\r
+            do {\r
+                i = i + 1;\r
+            } while ((i < bonds.size()) &&\r
+                    (((Bond) bonds.elementAt(i)).start[2] < x));\r
+\r
+            if (i < j) {\r
+                Bond tmp = (Bond) bonds.elementAt(i);\r
+                bonds.setElementAt(bonds.elementAt(j), i);\r
+                bonds.setElementAt(tmp, j);\r
+            } else {\r
+                return j;\r
+            }\r
+        }\r
     }\r
-  }\r
 }\r
-\r
-\r
-\r
index 27a4b08..75dec37 100755 (executable)
 * 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 MCview;\r
 \r
-import java.util.*;\r
 import java.awt.*;\r
 \r
-public class myAtom {\r
-  float x;\r
-  float y;\r
-  float z;\r
-\r
-  public int     number;\r
-  public String  name;\r
-  public String  resName;\r
-  public int     resNumber;\r
-  public int     type;\r
-  public Color   color;\r
-  public String  chain;\r
-  public boolean isSelected = false;\r
+import java.util.*;\r
 \r
-  public myAtom(StringTokenizer str) {\r
 \r
-    this.number  = (new Integer(str.nextToken())).intValue();\r
-    this.name    = str.nextToken();\r
-    this.resName = str.nextToken();\r
+public class myAtom {\r
+    float x;\r
+    float y;\r
+    float z;\r
+    public int number;\r
+    public String name;\r
+    public String resName;\r
+    public int resNumber;\r
+    public int type;\r
+    public Color color;\r
+    public String chain;\r
+    public boolean isSelected = false;\r
 \r
-    String tmpstr = new String();\r
+    public myAtom(StringTokenizer str) {\r
+        this.number = (new Integer(str.nextToken())).intValue();\r
+        this.name = str.nextToken();\r
+        this.resName = str.nextToken();\r
 \r
-    try {\r
-      tmpstr         = str.nextToken();\r
-      this.resNumber = (new Integer(tmpstr).intValue());\r
-      this.chain     = "A";\r
-      this.color     = Color.lightGray;\r
+        String tmpstr = new String();\r
 \r
-    } catch(NumberFormatException e) {\r
-      this.chain = tmpstr;\r
+        try {\r
+            tmpstr = str.nextToken();\r
+            this.resNumber = (new Integer(tmpstr).intValue());\r
+            this.chain = "A";\r
+            this.color = Color.lightGray;\r
+        } catch (NumberFormatException e) {\r
+            this.chain = tmpstr;\r
 \r
-      if (tmpstr.equals("A")) {\r
-        this.color = Color.lightGray;\r
+            if (tmpstr.equals("A")) {\r
+                this.color = Color.lightGray;\r
+            } else {\r
+                this.color = Color.red;\r
+            }\r
 \r
-      } else {\r
-        this.color = Color.red;\r
-      }\r
+            this.resNumber = (new Integer(str.nextToken()).intValue());\r
+        }\r
 \r
-      this.resNumber = (new Integer(str.nextToken()).intValue());\r
+        this.x = (float) (new Float(str.nextToken()).floatValue());\r
+        this.y = (float) (new Float(str.nextToken()).floatValue());\r
+        this.z = (float) (new Float(str.nextToken()).floatValue());\r
     }\r
 \r
-    this.x = (float)(new Float(str.nextToken()).floatValue());\r
-    this.y = (float)(new Float(str.nextToken()).floatValue());\r
-    this.z = (float)(new Float(str.nextToken()).floatValue());\r
-  }\r
-\r
-  public void setColor(Color col) {\r
-    this.color = col;\r
-  }\r
+    public void setColor(Color col) {\r
+        this.color = col;\r
+    }\r
 }\r
index a165129..154e7e6 100755 (executable)
 * 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 MCview;\r
-// JBPNote TODO: This class is quite noisy - needs proper log.info/log.debug\r
-import java.awt.*;\r
-import java.awt.event.*;\r
-import java.util.*;\r
-import java.io.*;\r
-import javax.swing.*;\r
-import jalview.analysis.AlignSeq;\r
-import jalview.datamodel.*;\r
-\r
-public class rotCanvas extends JPanel implements KeyListener,\r
-                                                 MouseListener,\r
-                                                 MouseMotionListener {\r
-  MCMatrix  idmat  = new MCMatrix(3,3);\r
-  MCMatrix  objmat = new MCMatrix(3,3);\r
-\r
-  boolean redrawneeded =true;\r
-\r
-  int omx = 0;\r
-  int mx = 0;\r
-  int omy = 0;\r
-  int my = 0;\r
-\r
-  public PDBfile pdb;\r
-\r
-  int bsize;\r
-\r
-  Image img;\r
-  Graphics ig;\r
 \r
-  Dimension prefsize;\r
-\r
-  float centre[] = new float[3];\r
-  float width[]  = new float[3];\r
+import jalview.analysis.AlignSeq;\r
 \r
-  float maxwidth;\r
-  float scale;\r
+import jalview.datamodel.*;\r
 \r
-  String inStr;\r
-  String inType;\r
+// JBPNote TODO: This class is quite noisy - needs proper log.info/log.debug\r
+import java.awt.*;\r
+import java.awt.event.*;\r
 \r
-  boolean depthcue   = true;\r
-  boolean wire       = false;\r
-  boolean bymolecule = false;\r
-  boolean zbuffer    = true;\r
+import java.io.*;\r
 \r
-  boolean dragging;\r
+import java.util.*;\r
 \r
-  int xstart;\r
-  int xend;\r
-  int ystart;\r
-  int yend;\r
-  int xmid;\r
-  int ymid;\r
+import javax.swing.*;\r
 \r
-  Font font = new Font("Helvetica",Font.PLAIN,10);\r
 \r
-  public rotCanvas(PDBfile pdb, Sequence sequence, jalview.gui.AlignViewport av) throws IOException {\r
+public class rotCanvas extends JPanel implements KeyListener, MouseListener,\r
+    MouseMotionListener {\r
+    MCMatrix idmat = new MCMatrix(3, 3);\r
+    MCMatrix objmat = new MCMatrix(3, 3);\r
+    boolean redrawneeded = true;\r
+    int omx = 0;\r
+    int mx = 0;\r
+    int omy = 0;\r
+    int my = 0;\r
+    public PDBfile pdb;\r
+    int bsize;\r
+    Image img;\r
+    Graphics ig;\r
+    Dimension prefsize;\r
+    float[] centre = new float[3];\r
+    float[] width = new float[3];\r
+    float maxwidth;\r
+    float scale;\r
+    String inStr;\r
+    String inType;\r
+    boolean depthcue = true;\r
+    boolean wire = false;\r
+    boolean bymolecule = false;\r
+    boolean zbuffer = true;\r
+    boolean dragging;\r
+    int xstart;\r
+    int xend;\r
+    int ystart;\r
+    int yend;\r
+    int xmid;\r
+    int ymid;\r
+    Font font = new Font("Helvetica", Font.PLAIN, 10);\r
+\r
+    public rotCanvas(PDBfile pdb, Sequence sequence,\r
+        jalview.gui.AlignViewport av) throws IOException {\r
+        int max = -10;\r
+        int maxchain = -1;\r
+        int pdbstart = 0;\r
+        int pdbend = 0;\r
+        int seqstart = 0;\r
+        int seqend = 0;\r
+\r
+        for (int i = 0; i < pdb.chains.size(); i++) {\r
+            // Now lets compare the sequences to get\r
+            // the start and end points.\r
+            java.util.StringTokenizer str = new java.util.StringTokenizer(sequence.getSequence(),\r
+                    ".");\r
+            String newString = "";\r
+\r
+            while (str.hasMoreTokens()) {\r
+                newString += str.nextToken();\r
+            }\r
 \r
-    int max = -10;\r
-    int maxchain = -1;\r
-    int pdbstart=0, pdbend=0,  seqstart =0,  seqend=0;\r
+            // Align the sequence to the pdb\r
+            AlignSeq as = new AlignSeq(sequence,\r
+                    ((PDBChain) pdb.chains.elementAt(i)).sequence, "pep");\r
+            as.calcScoreMatrix();\r
+            as.traceAlignment();\r
+            as.printAlignment();\r
+\r
+            if (as.maxscore > max) {\r
+                max = as.maxscore;\r
+                maxchain = i;\r
+\r
+                pdbstart = as.seq2start;\r
+                pdbend = as.seq2end;\r
+                seqstart = as.seq1start - 1;\r
+                seqend = as.seq1end - 1;\r
+            }\r
 \r
+            System.out.println("PDB start/end " + pdbstart + " " + pdbend);\r
+            System.out.println("SEQ start/end " + seqstart + " " + seqend);\r
+        }\r
 \r
-    for (int i=0; i < pdb.chains.size(); i++) {\r
-      // Now lets compare the sequences to get\r
-      // the start and end points.\r
+        ((PDBChain) pdb.chains.elementAt(maxchain)).pdbstart = pdbstart;\r
+        ((PDBChain) pdb.chains.elementAt(maxchain)).pdbend = pdbend;\r
+        ((PDBChain) pdb.chains.elementAt(maxchain)).seqstart = seqstart;\r
+        ((PDBChain) pdb.chains.elementAt(maxchain)).seqend = seqend;\r
+        ((PDBChain) pdb.chains.elementAt(maxchain)).isVisible = true;\r
+        ((PDBChain) pdb.chains.elementAt(maxchain)).sequence = sequence;\r
+        ((PDBChain) pdb.chains.elementAt(maxchain)).colourBySequence(av,\r
+            sequence);\r
+\r
+        this.pdb = pdb;\r
+        this.prefsize = new Dimension(getWidth(), getHeight());\r
+\r
+        //Initialize the matrices to identity\r
+        for (int i = 0; i < 3; i++) {\r
+            for (int j = 0; j < 3; j++) {\r
+                if (i != j) {\r
+                    idmat.addElement(i, j, 0);\r
+                    objmat.addElement(i, j, 0);\r
+                } else {\r
+                    idmat.addElement(i, j, 1);\r
+                    objmat.addElement(i, j, 1);\r
+                }\r
+            }\r
+        }\r
 \r
-    java.util.StringTokenizer str = new java.util.StringTokenizer(sequence.getSequence(), ".");\r
-    String newString = "";\r
+        addMouseMotionListener(this);\r
+        addMouseListener(this);\r
+        addKeyListener(this);\r
 \r
-    while (str.hasMoreTokens()) {\r
-        newString += str.nextToken();\r
-    }\r
-      // Align the sequence to the pdb\r
-      AlignSeq as = new AlignSeq(sequence,((PDBChain)pdb.chains.elementAt(i)).sequence,"pep");\r
-      as.calcScoreMatrix();\r
-      as.traceAlignment();\r
-      as.printAlignment();\r
-\r
-      if (as.maxscore > max) {\r
-        max = as.maxscore;\r
-        maxchain = i;\r
-\r
-        pdbstart = as.seq2start;\r
-        pdbend = as.seq2end;\r
-        seqstart = as.seq1start  - 1 ;\r
-        seqend = as.seq1end  -1;\r
-      }\r
-\r
-      System.out.println("PDB start/end " + pdbstart + " " + pdbend);\r
-      System.out.println("SEQ start/end " + seqstart + " " + seqend);\r
+        addPDBfile();\r
+        ToolTipManager.sharedInstance().registerComponent(this);\r
     }\r
 \r
+    public void addPDBfile() {\r
+        findCentre();\r
+        findWidth();\r
 \r
-    ( (PDBChain)pdb.chains.elementAt(maxchain)).pdbstart = pdbstart;\r
-    ( (PDBChain)pdb.chains.elementAt(maxchain)).pdbend = pdbend;\r
-    ( (PDBChain)pdb.chains.elementAt(maxchain)).seqstart = seqstart;\r
-     ( (PDBChain)pdb.chains.elementAt(maxchain)).seqend = seqend;\r
-     ( (PDBChain) pdb.chains.elementAt(maxchain)).isVisible = true;\r
-     ( (PDBChain) pdb.chains.elementAt(maxchain)).sequence = sequence;\r
-     ( (PDBChain)pdb.chains.elementAt(maxchain)).colourBySequence(av, sequence);\r
+        scale = findScale();\r
 \r
+        System.out.println("Scale factor = " + scale);\r
+    }\r
 \r
+    public void deleteBonds() {\r
+        scale = 0;\r
+        maxwidth = 0;\r
 \r
-    this.pdb      = pdb;\r
-    this.prefsize = new Dimension( getWidth(), getHeight());\r
+        width[0] = 0;\r
+        width[1] = 0;\r
+        width[2] = 0;\r
 \r
-    //Initialize the matrices to identity\r
+        centre[0] = 0;\r
+        centre[1] = 0;\r
+        centre[2] = 0;\r
 \r
-    for (int i = 0; i < 3; i++) {\r
-      for (int j = 0; j < 3 ; j++) {\r
-        if (i != j) {\r
-          idmat.addElement(i,j,0);\r
-          objmat.addElement(i,j,0);\r
-        } else {\r
-          idmat.addElement(i,j,1);\r
-          objmat.addElement(i,j,1);\r
+        for (int i = 0; i < pdb.chains.size(); i++) {\r
+            ((PDBChain) pdb.chains.elementAt(i)).bonds = null;\r
         }\r
-      }\r
     }\r
 \r
-    addMouseMotionListener(this);\r
-    addMouseListener(this);\r
-    addKeyListener(this);\r
-\r
-    addPDBfile();\r
-    ToolTipManager.sharedInstance().registerComponent(this);\r
-\r
-  }\r
+    public void findWidth() {\r
+        float[] max = new float[3];\r
+        float[] min = new float[3];\r
 \r
-  public void addPDBfile() {\r
-    findCentre();\r
-    findWidth();\r
+        max[0] = (float) -1e30;\r
+        max[1] = (float) -1e30;\r
+        max[2] = (float) -1e30;\r
 \r
-    scale = findScale();\r
+        min[0] = (float) 1e30;\r
+        min[1] = (float) 1e30;\r
+        min[2] = (float) 1e30;\r
 \r
-    System.out.println("Scale factor = " + scale);\r
-  }\r
+        for (int ii = 0; ii < pdb.chains.size(); ii++) {\r
+            if (((PDBChain) pdb.chains.elementAt(ii)).isVisible) {\r
+                Vector bonds = ((PDBChain) pdb.chains.elementAt(ii)).bonds;\r
 \r
-  public void deleteBonds() {\r
-    scale     = 0;\r
-    maxwidth  = 0;\r
+                for (int i = 0; i < bonds.size(); i++) {\r
+                    Bond tmp = (Bond) bonds.elementAt(i);\r
 \r
-    width[0] = 0;\r
-    width[1] = 0;\r
-    width[2] = 0;\r
+                    if (tmp.start[0] >= max[0]) {\r
+                        max[0] = tmp.start[0];\r
+                    }\r
 \r
-    centre[0] = 0;\r
-    centre[1] = 0;\r
-    centre[2] = 0;\r
+                    if (tmp.start[1] >= max[1]) {\r
+                        max[1] = tmp.start[1];\r
+                    }\r
 \r
-    for (int i=0; i < pdb.chains.size(); i++) {\r
-      ((PDBChain)pdb.chains.elementAt(i)).bonds = null;\r
-    }\r
-  }\r
+                    if (tmp.start[2] >= max[2]) {\r
+                        max[2] = tmp.start[2];\r
+                    }\r
 \r
-  public void findWidth() {\r
-    float max[] = new float[3];\r
-    float min[] = new float[3];\r
+                    if (tmp.start[0] <= min[0]) {\r
+                        min[0] = tmp.start[0];\r
+                    }\r
 \r
-    max[0] = (float)-1e30;\r
-    max[1] = (float)-1e30;\r
-    max[2] = (float)-1e30;\r
+                    if (tmp.start[1] <= min[1]) {\r
+                        min[1] = tmp.start[1];\r
+                    }\r
 \r
-    min[0] = (float)1e30;\r
-    min[1] = (float)1e30;\r
-    min[2] = (float)1e30;\r
+                    if (tmp.start[2] <= min[2]) {\r
+                        min[2] = tmp.start[2];\r
+                    }\r
 \r
-    for (int ii=0; ii < pdb.chains.size(); ii++) {\r
-      if (((PDBChain)pdb.chains.elementAt(ii)).isVisible) {\r
+                    if (tmp.end[0] >= max[0]) {\r
+                        max[0] = tmp.end[0];\r
+                    }\r
 \r
-        Vector bonds = ((PDBChain)pdb.chains.elementAt(ii)).bonds;\r
+                    if (tmp.end[1] >= max[1]) {\r
+                        max[1] = tmp.end[1];\r
+                    }\r
 \r
-        for (int i = 0; i < bonds.size(); i++) {\r
-          Bond tmp = (Bond)bonds.elementAt(i);\r
-\r
-          if (tmp.start[0] >= max[0])\r
-            max[0] = tmp.start[0];\r
-          if (tmp.start[1] >= max[1])\r
-            max[1] = tmp.start[1];\r
-          if (tmp.start[2] >= max[2])\r
-            max[2] = tmp.start[2];\r
-          if (tmp.start[0] <= min[0])\r
-            min[0] = tmp.start[0];\r
-          if (tmp.start[1] <= min[1])\r
-            min[1] = tmp.start[1];\r
-          if (tmp.start[2] <= min[2])\r
-            min[2] = tmp.start[2];\r
-\r
-          if (tmp.end[0] >= max[0])\r
-            max[0] = tmp.end[0];\r
-          if (tmp.end[1] >= max[1])\r
-            max[1] = tmp.end[1];\r
-          if (tmp.end[2] >= max[2])\r
-            max[2] = tmp.end[2];\r
-          if (tmp.end[0] <= min[0])\r
-            min[0] = tmp.end[0];\r
-          if (tmp.end[1] <= min[1])\r
-            min[1] = tmp.end[1];\r
-          if (tmp.end[2] <= min[2])\r
-            min[2] = tmp.end[2];\r
-        }\r
-      }\r
-    }\r
+                    if (tmp.end[2] >= max[2]) {\r
+                        max[2] = tmp.end[2];\r
+                    }\r
 \r
-    System.out.println("xmax " + max[0] + " min " + min[0]);\r
-    System.out.println("ymax " + max[1] + " min " + min[1]);\r
-    System.out.println("zmax " + max[2] + " min " + min[2]);\r
+                    if (tmp.end[0] <= min[0]) {\r
+                        min[0] = tmp.end[0];\r
+                    }\r
 \r
-    width[0] = (float)Math.abs(max[0] - min[0]);\r
-    width[1] = (float)Math.abs(max[1] - min[1]);\r
-    width[2] = (float)Math.abs(max[2] - min[2]);\r
+                    if (tmp.end[1] <= min[1]) {\r
+                        min[1] = tmp.end[1];\r
+                    }\r
 \r
-    maxwidth = width[0];\r
+                    if (tmp.end[2] <= min[2]) {\r
+                        min[2] = tmp.end[2];\r
+                    }\r
+                }\r
+            }\r
+        }\r
 \r
-    if (width[1] > width[0])\r
-      maxwidth = width[1];\r
-    if (width[2] > width[1])\r
-      maxwidth = width[2];\r
+        System.out.println("xmax " + max[0] + " min " + min[0]);\r
+        System.out.println("ymax " + max[1] + " min " + min[1]);\r
+        System.out.println("zmax " + max[2] + " min " + min[2]);\r
 \r
-    System.out.println("Maxwidth = " + maxwidth);\r
-  }\r
+        width[0] = (float) Math.abs(max[0] - min[0]);\r
+        width[1] = (float) Math.abs(max[1] - min[1]);\r
+        width[2] = (float) Math.abs(max[2] - min[2]);\r
 \r
-  public float findScale() {\r
-    int dim, width, height;\r
+        maxwidth = width[0];\r
 \r
-    if ( getWidth() != 0) {\r
-      width  = getWidth();\r
-      height = getHeight();\r
+        if (width[1] > width[0]) {\r
+            maxwidth = width[1];\r
+        }\r
 \r
-    } else {\r
-      width  = prefsize.width;\r
-      height = prefsize.height;\r
-    }\r
+        if (width[2] > width[1]) {\r
+            maxwidth = width[2];\r
+        }\r
 \r
-    if (width < height) {\r
-      dim = width;\r
-    } else {\r
-      dim = height;\r
+        System.out.println("Maxwidth = " + maxwidth);\r
     }\r
 \r
-    return (float)(dim/(1.5d*maxwidth));\r
-  }\r
-\r
+    public float findScale() {\r
+        int dim;\r
+        int width;\r
+        int height;\r
 \r
+        if (getWidth() != 0) {\r
+            width = getWidth();\r
+            height = getHeight();\r
+        } else {\r
+            width = prefsize.width;\r
+            height = prefsize.height;\r
+        }\r
 \r
-  public void findCentre() {\r
-    float xtot = 0;\r
-    float ytot = 0;\r
-    float ztot = 0;\r
+        if (width < height) {\r
+            dim = width;\r
+        } else {\r
+            dim = height;\r
+        }\r
 \r
-    int bsize  = 0;\r
-    //Find centre coordinate\r
+        return (float) (dim / (1.5d * maxwidth));\r
+    }\r
 \r
-    for (int ii = 0; ii < pdb.chains.size() ; ii++) {\r
-      if (((PDBChain)pdb.chains.elementAt(ii)).isVisible) {\r
+    public void findCentre() {\r
+        float xtot = 0;\r
+        float ytot = 0;\r
+        float ztot = 0;\r
 \r
-        Vector bonds = ((PDBChain)pdb.chains.elementAt(ii)).bonds;\r
+        int bsize = 0;\r
 \r
-        bsize += bonds.size();\r
+        //Find centre coordinate\r
+        for (int ii = 0; ii < pdb.chains.size(); ii++) {\r
+            if (((PDBChain) pdb.chains.elementAt(ii)).isVisible) {\r
+                Vector bonds = ((PDBChain) pdb.chains.elementAt(ii)).bonds;\r
 \r
-        for (int i = 0; i < bonds.size(); i++) {\r
+                bsize += bonds.size();\r
 \r
-          xtot = xtot + ((Bond)bonds.elementAt(i)).start[0] +\r
-                 ((Bond)bonds.elementAt(i)).end[0];\r
+                for (int i = 0; i < bonds.size(); i++) {\r
+                    xtot = xtot + ((Bond) bonds.elementAt(i)).start[0] +\r
+                        ((Bond) bonds.elementAt(i)).end[0];\r
 \r
-          ytot = ytot + ((Bond)bonds.elementAt(i)).start[1] +\r
-                 ((Bond)bonds.elementAt(i)).end[1];\r
+                    ytot = ytot + ((Bond) bonds.elementAt(i)).start[1] +\r
+                        ((Bond) bonds.elementAt(i)).end[1];\r
 \r
-          ztot = ztot + ((Bond)bonds.elementAt(i)).start[2] +\r
-                 ((Bond)bonds.elementAt(i)).end[2];\r
+                    ztot = ztot + ((Bond) bonds.elementAt(i)).start[2] +\r
+                        ((Bond) bonds.elementAt(i)).end[2];\r
+                }\r
+            }\r
         }\r
-      }\r
+\r
+        centre[0] = xtot / (2 * (float) bsize);\r
+        centre[1] = ytot / (2 * (float) bsize);\r
+        centre[2] = ztot / (2 * (float) bsize);\r
     }\r
 \r
-    centre[0] = xtot / (2 * (float)bsize);\r
-    centre[1] = ytot / (2 * (float)bsize);\r
-    centre[2] = ztot / (2 * (float)bsize);\r
-  }\r
+    public void paint(Graphics g) {\r
+        //Only create the image at the beginning -\r
+        //this saves much memory usage\r
+        if ((img == null) || (prefsize.width != getWidth()) ||\r
+                (prefsize.height != getHeight())) {\r
+            prefsize.width = getWidth();\r
+            prefsize.height = getHeight();\r
 \r
-  public void paint(Graphics g) {\r
-    //Only create the image at the beginning -\r
-    //this saves much memory usage\r
-    if ((img == null) || (prefsize.width != getWidth()) || (prefsize.height != getHeight())) {\r
-      prefsize.width  = getWidth();\r
-      prefsize.height = getHeight();\r
+            scale = findScale();\r
+            img = createImage(prefsize.width, prefsize.height);\r
+            ig = img.getGraphics();\r
 \r
-      scale = findScale();\r
-      img   = createImage(prefsize.width,prefsize.height);\r
-      ig    = img.getGraphics();\r
+            redrawneeded = true;\r
+        }\r
 \r
-      redrawneeded = true;\r
-    }\r
+        if (redrawneeded == true) {\r
+            drawBackground(ig, Color.black);\r
+            drawScene(ig);\r
+            redrawneeded = false;\r
+        } else {\r
+            ig = img.getGraphics();\r
+        }\r
 \r
-    if (redrawneeded == true) {\r
-      drawBackground(ig,Color.black);\r
-      drawScene(ig);\r
-      redrawneeded = false;\r
-    } else {\r
-      ig = img.getGraphics();\r
+        g.drawImage(img, 0, 0, this);\r
     }\r
 \r
-    g.drawImage(img,0,0,this);\r
-  }\r
+    public void drawBackground(Graphics g, Color col) {\r
+        g.setColor(col);\r
+        g.fillRect(0, 0, prefsize.width, prefsize.height);\r
+    }\r
 \r
-  public void drawBackground(Graphics g, Color col) {\r
-    g.setColor(col);\r
-    g.fillRect(0,0,prefsize.width,prefsize.height);\r
-  }\r
+    public void drawScene(Graphics g) {\r
+        // Sort the bonds by z coord\r
+        Vector bonds = new Vector();\r
 \r
+        for (int ii = 0; ii < pdb.chains.size(); ii++) {\r
+            if (((PDBChain) pdb.chains.elementAt(ii)).isVisible) {\r
+                Vector tmp = ((PDBChain) pdb.chains.elementAt(ii)).bonds;\r
 \r
-  public void drawScene(Graphics g) {\r
-    // Sort the bonds by z coord\r
+                for (int i = 0; i < tmp.size(); i++) {\r
+                    bonds.addElement(tmp.elementAt(i));\r
+                }\r
+            }\r
+        }\r
 \r
-    Vector bonds = new Vector();\r
+        if (zbuffer) {\r
+            Zsort.Zsort(bonds);\r
+        }\r
 \r
+        for (int i = 0; i < bonds.size(); i++) {\r
+            Bond tmpBond = (Bond) bonds.elementAt(i);\r
+\r
+            xstart = (int) (((tmpBond.start[0] - centre[0]) * scale) +\r
+                (getWidth() / 2));\r
+            ystart = (int) (((tmpBond.start[1] - centre[1]) * scale) +\r
+                (getHeight() / 2));\r
+\r
+            xend = (int) (((tmpBond.end[0] - centre[0]) * scale) +\r
+                (getWidth() / 2));\r
+            yend = (int) (((tmpBond.end[1] - centre[1]) * scale) +\r
+                (getHeight() / 2));\r
+\r
+            xmid = (xend + xstart) / 2;\r
+            ymid = (yend + ystart) / 2;\r
+\r
+            if (depthcue && !bymolecule) {\r
+                if (tmpBond.start[2] < (centre[2] - (maxwidth / 6))) {\r
+                    g.setColor(tmpBond.startCol.darker().darker());\r
+                    drawLine(g, xstart, ystart, xmid, ymid);\r
+\r
+                    g.setColor(tmpBond.endCol.darker().darker());\r
+                    drawLine(g, xmid, ymid, xend, yend);\r
+                } else if (tmpBond.start[2] < (centre[2] + (maxwidth / 6))) {\r
+                    g.setColor(tmpBond.startCol.darker());\r
+                    drawLine(g, xstart, ystart, xmid, ymid);\r
+\r
+                    g.setColor(tmpBond.endCol.darker());\r
+                    drawLine(g, xmid, ymid, xend, yend);\r
+                } else {\r
+                    g.setColor(tmpBond.startCol);\r
+                    drawLine(g, xstart, ystart, xmid, ymid);\r
+\r
+                    g.setColor(tmpBond.endCol);\r
+                    drawLine(g, xmid, ymid, xend, yend);\r
+                }\r
+            } else if (depthcue && bymolecule) {\r
+                if (tmpBond.start[2] < (centre[2] - (maxwidth / 6))) {\r
+                    g.setColor(Color.green.darker().darker());\r
+                    drawLine(g, xstart, ystart, xend, yend);\r
+                } else if (tmpBond.start[2] < (centre[2] + (maxwidth / 6))) {\r
+                    g.setColor(Color.green.darker());\r
+                    drawLine(g, xstart, ystart, xend, yend);\r
+                } else {\r
+                    g.setColor(Color.green);\r
+                    drawLine(g, xstart, ystart, xend, yend);\r
+                }\r
+            } else if (!depthcue && !bymolecule) {\r
+                g.setColor(tmpBond.startCol);\r
+                drawLine(g, xstart, ystart, xmid, ymid);\r
+                g.setColor(tmpBond.endCol);\r
+                drawLine(g, xmid, ymid, xend, yend);\r
+            } else {\r
+                drawLine(g, xstart, ystart, xend, yend);\r
+            }\r
+        }\r
+    }\r
 \r
-    for (int ii = 0; ii < pdb.chains.size() ; ii++) {\r
-      if (((PDBChain)pdb.chains.elementAt(ii)).isVisible) {\r
+    public void drawLine(Graphics g, int x1, int y1, int x2, int y2) {\r
+        if (!wire) {\r
+            if (((float) Math.abs(y2 - y1) / (float) Math.abs(x2 - x1)) < 0.5) {\r
+                g.drawLine(x1, y1, x2, y2);\r
+                g.drawLine(x1 + 1, y1 + 1, x2 + 1, y2 + 1);\r
+                g.drawLine(x1, y1 - 1, x2, y2 - 1);\r
+            } else {\r
+                g.setColor(g.getColor().brighter());\r
+                g.drawLine(x1, y1, x2, y2);\r
+                g.drawLine(x1 + 1, y1, x2 + 1, y2);\r
+                g.drawLine(x1 - 1, y1, x2 - 1, y2);\r
+            }\r
+        } else {\r
+            g.drawLine(x1, y1, x2, y2);\r
+        }\r
+    }\r
 \r
-        Vector tmp = ((PDBChain)pdb.chains.elementAt(ii)).bonds;\r
+    public Dimension minimumsize() {\r
+        return prefsize;\r
+    }\r
 \r
-        for (int i=0; i < tmp.size(); i++) {\r
-          bonds.addElement(tmp.elementAt(i));\r
-        }\r
-      }\r
+    public Dimension preferredsize() {\r
+        return prefsize;\r
     }\r
 \r
-    if (zbuffer) {\r
-      Zsort.Zsort(bonds);\r
+    public void keyTyped(KeyEvent evt) {\r
     }\r
 \r
-    for (int i = 0; i < bonds.size(); i++) {\r
-      Bond tmpBond = (Bond)bonds.elementAt(i);\r
+    public void keyReleased(KeyEvent evt) {\r
+    }\r
 \r
-      xstart = (int)((tmpBond.start[0] - centre[0])*scale + getWidth()/2);\r
-      ystart = (int)((tmpBond.start[1] - centre[1])*scale + getHeight()/2);\r
+    public void keyPressed(KeyEvent evt) {\r
+        int key = evt.getKeyChar();\r
+\r
+        if (evt.getKeyCode() == KeyEvent.VK_UP) {\r
+            scale = (float) (scale * 1.1);\r
+            redrawneeded = true;\r
+            repaint();\r
+        } else if (evt.getKeyCode() == KeyEvent.VK_DOWN) {\r
+            scale = (float) (scale * 0.9);\r
+            redrawneeded = true;\r
+            repaint();\r
+        } else if (key == 'w') {\r
+            wire = !wire;\r
+            System.out.println("wireframe " + wire);\r
+            redrawneeded = true;\r
+            repaint();\r
+        } else if (key == 'd') {\r
+            depthcue = !depthcue;\r
+            System.out.println("Depth cueing is " + depthcue);\r
+            redrawneeded = true;\r
+            repaint();\r
+        } else if (key == 'm') {\r
+            bymolecule = !bymolecule;\r
+            System.out.println("Bymolecule is " + bymolecule);\r
+            redrawneeded = true;\r
+            repaint();\r
+        } else if (key == 'z') {\r
+            zbuffer = !zbuffer;\r
+            System.out.println("Z buffering is " + zbuffer);\r
+            redrawneeded = true;\r
+            repaint();\r
+        } else if (key == 'c') {\r
+            bymolecule = false;\r
+            pdb.setChainColours();\r
+            System.out.println("Colouring by chain");\r
+            redrawneeded = true;\r
+            repaint();\r
+        } else if (key == 'h') {\r
+            bymolecule = false;\r
+            pdb.setHydrophobicityColours();\r
+            System.out.println("Colouring by hydrophobicity");\r
+            redrawneeded = true;\r
+            repaint();\r
+        } else if (key == 'q') {\r
+            bymolecule = false;\r
+            pdb.setChargeColours();\r
+            System.out.println("Colouring charges and cysteines");\r
+            redrawneeded = true;\r
+            repaint();\r
+        }\r
 \r
-      xend = (int)((tmpBond.end[0] - centre[0])*scale + getWidth()/2);\r
-      yend = (int)((tmpBond.end[1] - centre[1])*scale + getHeight()/2);\r
+        return;\r
+    }\r
 \r
-      xmid = (xend+xstart)/2;\r
-      ymid = (yend+ystart)/2;\r
+    public void mousePressed(MouseEvent e) {\r
+        mx = e.getX();\r
+        my = e.getY();\r
+        omx = mx;\r
+        omy = my;\r
+        dragging = false;\r
+    }\r
 \r
+    public void mouseMoved(MouseEvent e) {\r
+        myAtom fatom = null;\r
 \r
-      if (depthcue && !bymolecule) {\r
+        for (int ii = 0; ii < pdb.chains.size(); ii++) {\r
+            PDBChain chain = (PDBChain) pdb.chains.elementAt(ii);\r
 \r
-        if (tmpBond.start[2] < (centre[2] - maxwidth/6))  {\r
-          g.setColor(tmpBond.startCol.darker().darker());\r
-          drawLine(g,xstart,ystart,xmid,ymid);\r
+            if (chain.isVisible) {\r
+                Vector bonds = ((PDBChain) pdb.chains.elementAt(ii)).bonds;\r
 \r
-          g.setColor(tmpBond.endCol.darker().darker());\r
-          drawLine(g,xmid,ymid,xend,yend);\r
-        } else if (tmpBond.start[2] < (centre[2]+maxwidth/6)) {\r
-          g.setColor(tmpBond.startCol.darker());\r
-          drawLine(g,xstart,ystart,xmid,ymid);\r
+                for (int i = 0; i < bonds.size(); i++) {\r
+                    Bond tmpBond = (Bond) bonds.elementAt(i);\r
+                    int truex = (int) (((tmpBond.start[0] - centre[0]) * scale) +\r
+                        (getWidth() / 2));\r
 \r
-          g.setColor(tmpBond.endCol.darker());\r
-          drawLine(g,xmid,ymid,xend,yend);\r
-        } else {\r
-          g.setColor(tmpBond.startCol);\r
-          drawLine(g,xstart,ystart,xmid,ymid);\r
+                    if (Math.abs(truex - e.getX()) <= 2) {\r
+                        int truey = (int) (((tmpBond.start[1] - centre[1]) * scale) +\r
+                            (getHeight() / 2));\r
 \r
-          g.setColor(tmpBond.endCol);\r
-          drawLine(g,xmid,ymid,xend,yend);\r
+                        if (Math.abs(truey - e.getY()) <= 2) {\r
+                            fatom = tmpBond.at1;\r
+                        }\r
+                    }\r
+                }\r
+            }\r
         }\r
-      } else if (depthcue && bymolecule) {\r
-        if (tmpBond.start[2] < (centre[2] - maxwidth/6))  {\r
-          g.setColor(Color.green.darker().darker());\r
-          drawLine(g,xstart,ystart,xend,yend);\r
-\r
-        } else if (tmpBond.start[2] < (centre[2]+maxwidth/6)) {\r
-          g.setColor(Color.green.darker());\r
-          drawLine(g,xstart,ystart,xend,yend);\r
 \r
+        if (fatom != null) {\r
+            this.setToolTipText(fatom.resName);\r
         } else {\r
-          g.setColor(Color.green);\r
-          drawLine(g,xstart,ystart,xend,yend);\r
-\r
+            this.setToolTipText(null);\r
         }\r
-      } else if (!depthcue && !bymolecule) {\r
-        g.setColor(tmpBond.startCol);\r
-        drawLine(g,xstart,ystart,xmid,ymid);\r
-        g.setColor(tmpBond.endCol);\r
-        drawLine(g,xmid,ymid,xend,yend);\r
-\r
-      } else {\r
-        drawLine(g,xstart,ystart,xend,yend);\r
-      }\r
     }\r
-  }\r
 \r
-  public void drawLine(Graphics g, int x1, int y1, int x2, int y2) {\r
-    if (!wire) {\r
-\r
-      if (((float)Math.abs(y2-y1)/(float)Math.abs(x2-x1)) < 0.5) {\r
-\r
-        g.drawLine(x1,y1,x2,y2);\r
-        g.drawLine(x1+1,y1+1,x2+1,y2+1);\r
-        g.drawLine(x1,y1-1,x2,y2-1);\r
-      } else {\r
-        g.setColor(g.getColor().brighter());\r
-        g.drawLine(x1,y1,x2,y2);\r
-        g.drawLine(x1+1,y1,x2+1,y2);\r
-        g.drawLine(x1-1,y1,x2-1,y2);\r
+    public void mouseClicked(MouseEvent e) {\r
+    }\r
 \r
-      }\r
-    } else {\r
-      g.drawLine(x1,y1,x2,y2);\r
+    public void mouseEntered(MouseEvent e) {\r
     }\r
-  }\r
-\r
-  public Dimension minimumsize() {\r
-    return prefsize;\r
-  }\r
-  public Dimension preferredsize() {\r
-    return prefsize;\r
-  }\r
-\r
-  public void keyTyped(KeyEvent evt) { }\r
-  public void keyReleased(KeyEvent evt) { }\r
-  public void keyPressed(KeyEvent evt) {\r
-    int key = evt.getKeyChar();\r
-\r
-    if (evt.getKeyCode() == KeyEvent.VK_UP) {\r
-      scale        = (float)(scale * 1.1);\r
-      redrawneeded = true;\r
-      repaint();\r
-\r
-    } else if (evt.getKeyCode() == KeyEvent.VK_DOWN) {\r
-      scale        = (float)(scale * 0.9);\r
-      redrawneeded = true;\r
-      repaint();\r
-\r
-    } else if (key == 'w') {\r
-\r
-      wire = !wire;\r
-      System.out.println("wireframe " + wire);\r
-      redrawneeded = true;\r
-      repaint();\r
-\r
-    } else if (key == 'd') {\r
-      depthcue = !depthcue;\r
-      System.out.println("Depth cueing is " + depthcue);\r
-      redrawneeded = true;\r
-      repaint();\r
-\r
-    } else if (key == 'm') {\r
-      bymolecule = !bymolecule;\r
-      System.out.println("Bymolecule is " + bymolecule);\r
-      redrawneeded = true;\r
-      repaint();\r
-\r
-    } else if (key == 'z') {\r
-      zbuffer = !zbuffer;\r
-      System.out.println("Z buffering is " + zbuffer);\r
-      redrawneeded = true;\r
-      repaint();\r
-\r
-    } else if (key == 'c') {\r
-      bymolecule = false;\r
-      pdb.setChainColours();\r
-      System.out.println("Colouring by chain");\r
-      redrawneeded = true;\r
-      repaint();\r
-\r
-    } else if (key == 'h') {\r
-      bymolecule = false;\r
-      pdb.setHydrophobicityColours();\r
-      System.out.println("Colouring by hydrophobicity");\r
-      redrawneeded = true;\r
-      repaint();\r
-\r
-    } else if (key == 'q') {\r
-      bymolecule = false;\r
-      pdb.setChargeColours();\r
-      System.out.println("Colouring charges and cysteines");\r
-      redrawneeded = true;\r
-      repaint();\r
 \r
+    public void mouseExited(MouseEvent e) {\r
     }\r
-    return;\r
-  }\r
 \r
-  public void mousePressed(MouseEvent e)\r
-  {\r
+    public void mouseDragged(MouseEvent evt) {\r
+        int x = evt.getX();\r
+        int y = evt.getY();\r
+        mx = x;\r
+        my = y;\r
 \r
-      mx = e.getX();\r
-      my = e.getY();\r
-      omx = mx;\r
-      omy = my;\r
-      dragging = false;\r
-}\r
+        MCMatrix objmat = new MCMatrix(3, 3);\r
+        objmat.setIdentity();\r
 \r
-  public void mouseMoved(MouseEvent e)\r
-  {\r
-    myAtom fatom = null;\r
-    for (int ii = 0; ii < pdb.chains.size(); ii++)\r
-    {\r
-\r
-      PDBChain chain = (PDBChain) pdb.chains.elementAt(ii);\r
-      if (chain.isVisible)\r
-      {\r
-        Vector bonds = ( (PDBChain) pdb.chains.elementAt(ii)).bonds;\r
-        for (int i = 0; i < bonds.size(); i++)\r
-        {\r
-          Bond tmpBond = (Bond) bonds.elementAt(i);\r
-          int truex = (int) ( (tmpBond.start[0] - centre[0]) * scale +\r
-                             getWidth() / 2);\r
-          if (Math.abs(truex - e.getX()) <= 2)\r
-          {\r
-            int truey = (int) ( (tmpBond.start[1] - centre[1]) * scale +\r
-                               getHeight() / 2);\r
-            if (Math.abs(truey - e.getY()) <= 2)\r
-              fatom = tmpBond.at1;\r
-          }\r
+        if ((evt.getModifiers() & Event.META_MASK) != 0) {\r
+            objmat.rotatez((float) ((mx - omx)));\r
+        } else {\r
+            objmat.rotatex((float) ((my - omy)));\r
+            objmat.rotatey((float) ((omx - mx)));\r
         }\r
-      }\r
-    }\r
-    if(fatom!=null)\r
-     {\r
-       this.setToolTipText(fatom.resName);\r
-     }\r
-     else\r
-        this.setToolTipText(null);\r
-  }\r
-\r
-  public void mouseClicked(MouseEvent e) { }\r
-  public void mouseEntered(MouseEvent e) { }\r
-  public void mouseExited(MouseEvent e) { }\r
-\r
-  public void mouseDragged(MouseEvent evt) {\r
-    int x = evt.getX();\r
-    int y = evt.getY();\r
-    mx = x;\r
-    my = y;\r
-\r
-    MCMatrix objmat = new MCMatrix(3,3);\r
-    objmat.setIdentity();\r
-\r
-    if ((evt.getModifiers()  & Event.META_MASK) != 0) {\r
-      objmat.rotatez((float)((mx-omx)));\r
-    } else {\r
-      objmat.rotatex((float)((my-omy)));\r
-      objmat.rotatey((float)((omx-mx)));\r
-    }\r
 \r
-    //Alter the bonds\r
-    for (int ii = 0; ii < pdb.chains.size() ; ii++) {\r
-      Vector bonds = ((PDBChain)pdb.chains.elementAt(ii)).bonds;\r
+        //Alter the bonds\r
+        for (int ii = 0; ii < pdb.chains.size(); ii++) {\r
+            Vector bonds = ((PDBChain) pdb.chains.elementAt(ii)).bonds;\r
 \r
-      for (int i = 0; i < bonds.size(); i++) {\r
+            for (int i = 0; i < bonds.size(); i++) {\r
+                Bond tmpBond = (Bond) bonds.elementAt(i);\r
 \r
-        Bond tmpBond = (Bond)bonds.elementAt(i);\r
+                //Translate the bond so the centre is 0,0,0\r
+                tmpBond.translate(-centre[0], -centre[1], -centre[2]);\r
 \r
-        //Translate the bond so the centre is 0,0,0\r
-        tmpBond.translate(-centre[0],-centre[1],-centre[2]);\r
-\r
-        //Now apply the rotation matrix\r
-        tmpBond.start = objmat.vectorMultiply(tmpBond.start);\r
-        tmpBond.end   = objmat.vectorMultiply(tmpBond.end);\r
-\r
-        //Now translate back again\r
-        tmpBond.translate(centre[0],centre[1],centre[2]);\r
-      }\r
-    }\r
+                //Now apply the rotation matrix\r
+                tmpBond.start = objmat.vectorMultiply(tmpBond.start);\r
+                tmpBond.end = objmat.vectorMultiply(tmpBond.end);\r
 \r
-    objmat = null;\r
+                //Now translate back again\r
+                tmpBond.translate(centre[0], centre[1], centre[2]);\r
+            }\r
+        }\r
 \r
-    omx    = mx;\r
-    omy    = my;\r
+        objmat = null;\r
 \r
-    redrawneeded = true;\r
+        omx = mx;\r
+        omy = my;\r
 \r
-    paint(this.getGraphics());\r
+        redrawneeded = true;\r
 \r
-    dragging = true;\r
-    return;\r
-  }\r
+        paint(this.getGraphics());\r
 \r
-  public void mouseReleased(MouseEvent evt) {\r
-    int x = evt.getX();\r
-    int y = evt.getY();\r
+        dragging = true;\r
 \r
-    if (!dragging) {\r
-      myAtom tmp = findAtom(x,y);\r
+        return;\r
     }\r
-    drawLabels();\r
-    return;\r
-  }\r
-\r
-  public void drawLabels() {\r
-    redrawneeded = true;\r
-    paint(this.getGraphics());\r
-\r
-    for (int ii = 0; ii < pdb.chains.size() ; ii++) {\r
 \r
-      PDBChain chain = (PDBChain)pdb.chains.elementAt(ii);\r
-\r
-      if (chain.isVisible) {\r
-\r
-        Vector bonds = ((PDBChain)pdb.chains.elementAt(ii)).bonds;\r
-\r
-        for (int i = 0; i < bonds.size(); i++) {\r
-          Bond tmpBond = (Bond)bonds.elementAt(i);\r
-\r
-          if (tmpBond.at1.isSelected) {\r
-            labelAtom(img.getGraphics(),tmpBond,1);\r
-          }\r
-\r
-          if (tmpBond.at2.isSelected) {\r
-            labelAtom(img.getGraphics(),tmpBond,2);\r
-          }\r
+    public void mouseReleased(MouseEvent evt) {\r
+        int x = evt.getX();\r
+        int y = evt.getY();\r
 \r
+        if (!dragging) {\r
+            myAtom tmp = findAtom(x, y);\r
         }\r
-      }\r
-    }\r
-\r
-    this.getGraphics().drawImage(img,0,0,this);\r
-\r
-    dragging = false;\r
-\r
-  }\r
-\r
-  public void labelAtom(Graphics g,Bond b, int n) {\r
 \r
-    g.setFont(font);\r
+        drawLabels();\r
 \r
-    if (n ==1) {\r
-\r
-      int xstart = (int)((b.start[0] - centre[0])*scale + getWidth()/2);\r
-      int ystart = (int)((b.start[1] - centre[1])*scale + getHeight()/2);\r
-\r
-      g.setColor(Color.red);\r
-      g.drawString(b.at1.resName + "-" + b.at1.resNumber,xstart,ystart);\r
+        return;\r
     }\r
 \r
-    if (n ==2) {\r
+    public void drawLabels() {\r
+        redrawneeded = true;\r
+        paint(this.getGraphics());\r
 \r
-      int xstart = (int)((b.end[0] - centre[0])*scale + getWidth()/2);\r
-      int ystart = (int)((b.end[1] - centre[1])*scale + getHeight()/2);\r
+        for (int ii = 0; ii < pdb.chains.size(); ii++) {\r
+            PDBChain chain = (PDBChain) pdb.chains.elementAt(ii);\r
 \r
-      g.setColor(Color.red);\r
-      g.drawString(b.at2.resName + "-" + b.at2.resNumber,xstart,ystart);\r
-    }\r
-  }\r
+            if (chain.isVisible) {\r
+                Vector bonds = ((PDBChain) pdb.chains.elementAt(ii)).bonds;\r
 \r
+                for (int i = 0; i < bonds.size(); i++) {\r
+                    Bond tmpBond = (Bond) bonds.elementAt(i);\r
 \r
-  public myAtom findAtom(int x, int y) {\r
-    myAtom fatom = null;\r
+                    if (tmpBond.at1.isSelected) {\r
+                        labelAtom(img.getGraphics(), tmpBond, 1);\r
+                    }\r
 \r
-    int foundchain = -1;\r
+                    if (tmpBond.at2.isSelected) {\r
+                        labelAtom(img.getGraphics(), tmpBond, 2);\r
+                    }\r
+                }\r
+            }\r
+        }\r
 \r
-    for (int ii = 0; ii < pdb.chains.size() ; ii++) {\r
+        this.getGraphics().drawImage(img, 0, 0, this);\r
 \r
-      PDBChain chain = (PDBChain)pdb.chains.elementAt(ii);\r
+        dragging = false;\r
+    }\r
 \r
-      if (chain.isVisible) {\r
+    public void labelAtom(Graphics g, Bond b, int n) {\r
+        g.setFont(font);\r
 \r
-        Vector bonds = ((PDBChain)pdb.chains.elementAt(ii)).bonds;\r
+        if (n == 1) {\r
+            int xstart = (int) (((b.start[0] - centre[0]) * scale) +\r
+                (getWidth() / 2));\r
+            int ystart = (int) (((b.start[1] - centre[1]) * scale) +\r
+                (getHeight() / 2));\r
 \r
-        for (int i = 0; i < bonds.size(); i++) {\r
-          Bond tmpBond = (Bond)bonds.elementAt(i);\r
+            g.setColor(Color.red);\r
+            g.drawString(b.at1.resName + "-" + b.at1.resNumber, xstart, ystart);\r
+        }\r
 \r
-          int truex = (int)((tmpBond.start[0] - centre[0])*scale + getWidth()/2);\r
+        if (n == 2) {\r
+            int xstart = (int) (((b.end[0] - centre[0]) * scale) +\r
+                (getWidth() / 2));\r
+            int ystart = (int) (((b.end[1] - centre[1]) * scale) +\r
+                (getHeight() / 2));\r
 \r
-          if (Math.abs(truex - x) <= 2) {\r
+            g.setColor(Color.red);\r
+            g.drawString(b.at2.resName + "-" + b.at2.resNumber, xstart, ystart);\r
+        }\r
+    }\r
 \r
-            int truey = (int)((tmpBond.start[1] - centre[1])*scale + getHeight()/2);\r
+    public myAtom findAtom(int x, int y) {\r
+        myAtom fatom = null;\r
+\r
+        int foundchain = -1;\r
+\r
+        for (int ii = 0; ii < pdb.chains.size(); ii++) {\r
+            PDBChain chain = (PDBChain) pdb.chains.elementAt(ii);\r
+\r
+            if (chain.isVisible) {\r
+                Vector bonds = ((PDBChain) pdb.chains.elementAt(ii)).bonds;\r
+\r
+                for (int i = 0; i < bonds.size(); i++) {\r
+                    Bond tmpBond = (Bond) bonds.elementAt(i);\r
+\r
+                    int truex = (int) (((tmpBond.start[0] - centre[0]) * scale) +\r
+                        (getWidth() / 2));\r
+\r
+                    if (Math.abs(truex - x) <= 2) {\r
+                        int truey = (int) (((tmpBond.start[1] - centre[1]) * scale) +\r
+                            (getHeight() / 2));\r
+\r
+                        if (Math.abs(truey - y) <= 2) {\r
+                            System.out.println("Found match");\r
+                            System.out.println(x + " " + y);\r
+                            System.out.println(truex + " " + truey);\r
+                            System.out.println(tmpBond.start[0] + " " +\r
+                                tmpBond.start[1]);\r
+                            System.out.println("Atom 1 = " +\r
+                                tmpBond.at1.resName + " " +\r
+                                tmpBond.at1.resNumber + " " +\r
+                                tmpBond.at1.chain);\r
+                            fatom = tmpBond.at1;\r
+                            fatom.isSelected = !fatom.isSelected;\r
+                            foundchain = ii;\r
+                        }\r
+                    }\r
+                }\r
+            }\r
 \r
-            if (Math.abs(truey - y) <= 2) {\r
+            if (fatom != null) //)&& chain.ds != null)\r
+             {\r
+                chain = (PDBChain) pdb.chains.elementAt(foundchain);\r
 \r
-              System.out.println("Found match");\r
-              System.out.println(x + " " + y);\r
-              System.out.println(truex + " " + truey);\r
-              System.out.println(tmpBond.start[0] + " " + tmpBond.start[1]);\r
-              System.out.println("Atom 1 = " + tmpBond.at1.resName + " " +\r
-                                 tmpBond.at1.resNumber + " " + tmpBond.at1.chain);\r
-              fatom = tmpBond.at1;\r
-              fatom.isSelected = !fatom.isSelected;\r
-              foundchain = ii;\r
+                // SMJS TODO\r
+                // int tmp = chain.ds.seqstart + fatom.resNumber - chain.offset;\r
+                // int pos = chain.ds.findIndex(tmp);\r
+                // System.out.println("Found seq " + chain.ds.name + " "  + tmp + " " + pos);\r
             }\r
-          }\r
         }\r
-      }\r
-\r
-      if (fatom != null) //)&& chain.ds != null)\r
-      {\r
-        chain = (PDBChain)pdb.chains.elementAt(foundchain);\r
-        // SMJS TODO\r
-        // int tmp = chain.ds.seqstart + fatom.resNumber - chain.offset;\r
-        // int pos = chain.ds.findIndex(tmp);\r
-        // System.out.println("Found seq " + chain.ds.name + " "  + tmp + " " + pos);\r
-      }\r
 \r
+        return fatom;\r
     }\r
-    return fatom;\r
-  }\r
-\r
-  public void update(Graphics g) {\r
-    paint(g);\r
-  }\r
 \r
+    public void update(Graphics g) {\r
+        paint(g);\r
+    }\r
 }\r
index 82e58c2..194272e 100755 (executable)
@@ -3,8 +3,8 @@
  *
  * This file was auto-generated from WSDL
  * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter.
- */
-
+ */\r
+\r
 /*
 * Jalview - A Sequence Alignment Editor and Viewer
 * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
 * 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 ext.vamsas;
-
-public interface JPredWS extends java.rmi.Remote {
-    public java.lang.String predict(ext.vamsas.Sequence in0) throws java.rmi.RemoteException;
-    public java.lang.String predictOnMsa(ext.vamsas.Msfalignment in0) throws java.rmi.RemoteException;
-    public ext.vamsas.Secstructpred getpredict(java.lang.String in0) throws java.rmi.RemoteException;
-    public ext.vamsas.JpredResult getresult(java.lang.String in0) throws java.rmi.RemoteException;
-}
+*/\r
+package ext.vamsas;\r
+\r
+public interface JPredWS extends java.rmi.Remote {\r
+    public java.lang.String predict(ext.vamsas.Sequence in0)\r
+        throws java.rmi.RemoteException;\r
+\r
+    public java.lang.String predictOnMsa(ext.vamsas.Msfalignment in0)\r
+        throws java.rmi.RemoteException;\r
+\r
+    public ext.vamsas.Secstructpred getpredict(java.lang.String in0)\r
+        throws java.rmi.RemoteException;\r
+\r
+    public ext.vamsas.JpredResult getresult(java.lang.String in0)\r
+        throws java.rmi.RemoteException;\r
+}\r
index e14c51d..3cb5e5d 100755 (executable)
@@ -3,8 +3,8 @@
  *
  * This file was auto-generated from WSDL
  * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter.
- */
-
+ */\r
+\r
 /*
 * Jalview - A Sequence Alignment Editor and Viewer
 * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
 * 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 ext.vamsas;
-
-public interface JPredWSService extends javax.xml.rpc.Service {
-    public java.lang.String getjpredAddress();
-
-    public ext.vamsas.JPredWS getjpred() throws javax.xml.rpc.ServiceException;
-
-    public ext.vamsas.JPredWS getjpred(java.net.URL portAddress) throws javax.xml.rpc.ServiceException;
-}
+*/\r
+package ext.vamsas;\r
+\r
+public interface JPredWSService extends javax.xml.rpc.Service {\r
+    public java.lang.String getjpredAddress();\r
+\r
+    public ext.vamsas.JPredWS getjpred() throws javax.xml.rpc.ServiceException;\r
+\r
+    public ext.vamsas.JPredWS getjpred(java.net.URL portAddress)\r
+        throws javax.xml.rpc.ServiceException;\r
+}\r
index af51043..cb4006d 100755 (executable)
@@ -3,8 +3,8 @@
  *
  * This file was auto-generated from WSDL
  * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter.
- */
-
+ */\r
+\r
 /*
 * Jalview - A Sequence Alignment Editor and Viewer
 * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
 * 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 ext.vamsas;
-
-public class JPredWSServiceLocator extends org.apache.axis.client.Service implements ext.vamsas.JPredWSService {
-
-    public JPredWSServiceLocator() {
-    }
-
-
-    public JPredWSServiceLocator(org.apache.axis.EngineConfiguration config) {
-        super(config);
-    }
-
-    // Use to get a proxy class for jpred
-    private java.lang.String jpred_address = "http://anaplog.compbio.dundee.ac.uk:8080/axis/services/jpred";
-
-    public java.lang.String getjpredAddress() {
-        return jpred_address;
-    }
-
-    // The WSDD service name defaults to the port name.
-    private java.lang.String jpredWSDDServiceName = "jpred";
-
-    public java.lang.String getjpredWSDDServiceName() {
-        return jpredWSDDServiceName;
-    }
-
-    public void setjpredWSDDServiceName(java.lang.String name) {
-        jpredWSDDServiceName = name;
-    }
-
-    public ext.vamsas.JPredWS getjpred() throws javax.xml.rpc.ServiceException {
-       java.net.URL endpoint;
-        try {
-            endpoint = new java.net.URL(jpred_address);
-        }
-        catch (java.net.MalformedURLException e) {
-            throw new javax.xml.rpc.ServiceException(e);
-        }
-        return getjpred(endpoint);
-    }
-
-    public ext.vamsas.JPredWS getjpred(java.net.URL portAddress) throws javax.xml.rpc.ServiceException {
-        try {
-            ext.vamsas.JpredSoapBindingStub _stub = new ext.vamsas.JpredSoapBindingStub(portAddress, this);
-            _stub.setPortName(getjpredWSDDServiceName());
-            return _stub;
-        }
-        catch (org.apache.axis.AxisFault e) {
-            return null;
-        }
-    }
-
-    public void setjpredEndpointAddress(java.lang.String address) {
-        jpred_address = address;
-    }
-
+*/\r
+package ext.vamsas;\r
+\r
+public class JPredWSServiceLocator extends org.apache.axis.client.Service\r
+    implements ext.vamsas.JPredWSService {\r
+    // Use to get a proxy class for jpred\r
+    private java.lang.String jpred_address = "http://anaplog.compbio.dundee.ac.uk:8080/axis/services/jpred";\r
+\r
+    // The WSDD service name defaults to the port name.\r
+    private java.lang.String jpredWSDDServiceName = "jpred";\r
+    private java.util.HashSet ports = null;\r
+\r
+    public JPredWSServiceLocator() {\r
+    }\r
+\r
+    public JPredWSServiceLocator(org.apache.axis.EngineConfiguration config) {\r
+        super(config);\r
+    }\r
+\r
+    public java.lang.String getjpredAddress() {\r
+        return jpred_address;\r
+    }\r
+\r
+    public java.lang.String getjpredWSDDServiceName() {\r
+        return jpredWSDDServiceName;\r
+    }\r
+\r
+    public void setjpredWSDDServiceName(java.lang.String name) {\r
+        jpredWSDDServiceName = name;\r
+    }\r
+\r
+    public ext.vamsas.JPredWS getjpred() throws javax.xml.rpc.ServiceException {\r
+        java.net.URL endpoint;\r
+\r
+        try {\r
+            endpoint = new java.net.URL(jpred_address);\r
+        } catch (java.net.MalformedURLException e) {\r
+            throw new javax.xml.rpc.ServiceException(e);\r
+        }\r
+\r
+        return getjpred(endpoint);\r
+    }\r
+\r
+    public ext.vamsas.JPredWS getjpred(java.net.URL portAddress)\r
+        throws javax.xml.rpc.ServiceException {\r
+        try {\r
+            ext.vamsas.JpredSoapBindingStub _stub = new ext.vamsas.JpredSoapBindingStub(portAddress,\r
+                    this);\r
+            _stub.setPortName(getjpredWSDDServiceName());\r
+\r
+            return _stub;\r
+        } catch (org.apache.axis.AxisFault e) {\r
+            return null;\r
+        }\r
+    }\r
+\r
+    public void setjpredEndpointAddress(java.lang.String address) {\r
+        jpred_address = address;\r
+    }\r
+\r
     /**
-     * For the given interface, get the stub implementation.
-     * If this service has no port for the given interface,
-     * then ServiceException is thrown.
-     */
-    public java.rmi.Remote getPort(Class serviceEndpointInterface) throws javax.xml.rpc.ServiceException {
-        try {
-            if (ext.vamsas.JPredWS.class.isAssignableFrom(serviceEndpointInterface)) {
-                ext.vamsas.JpredSoapBindingStub _stub = new ext.vamsas.JpredSoapBindingStub(new java.net.URL(jpred_address), this);
-                _stub.setPortName(getjpredWSDDServiceName());
-                return _stub;
-            }
-        }
-        catch (java.lang.Throwable t) {
-            throw new javax.xml.rpc.ServiceException(t);
-        }
-        throw new javax.xml.rpc.ServiceException("There is no stub implementation for the interface:  " + (serviceEndpointInterface == null ? "null" : serviceEndpointInterface.getName()));
-    }
-
+ * For the given interface, get the stub implementation.
+ * If this service has no port for the given interface,
+ * then ServiceException is thrown.
+ */\r
+    public java.rmi.Remote getPort(Class serviceEndpointInterface)\r
+        throws javax.xml.rpc.ServiceException {\r
+        try {\r
+            if (ext.vamsas.JPredWS.class.isAssignableFrom(\r
+                        serviceEndpointInterface)) {\r
+                ext.vamsas.JpredSoapBindingStub _stub = new ext.vamsas.JpredSoapBindingStub(new java.net.URL(\r
+                            jpred_address), this);\r
+                _stub.setPortName(getjpredWSDDServiceName());\r
+\r
+                return _stub;\r
+            }\r
+        } catch (java.lang.Throwable t) {\r
+            throw new javax.xml.rpc.ServiceException(t);\r
+        }\r
+\r
+        throw new javax.xml.rpc.ServiceException(\r
+            "There is no stub implementation for the interface:  " +\r
+            ((serviceEndpointInterface == null) ? "null"\r
+                                                : serviceEndpointInterface.getName()));\r
+    }\r
+\r
     /**
-     * For the given interface, get the stub implementation.
-     * If this service has no port for the given interface,
-     * then ServiceException is thrown.
-     */
-    public java.rmi.Remote getPort(javax.xml.namespace.QName portName, Class serviceEndpointInterface) throws javax.xml.rpc.ServiceException {
-        if (portName == null) {
-            return getPort(serviceEndpointInterface);
-        }
-        java.lang.String inputPortName = portName.getLocalPart();
-        if ("jpred".equals(inputPortName)) {
-            return getjpred();
-        }
-        else  {
-            java.rmi.Remote _stub = getPort(serviceEndpointInterface);
-            ((org.apache.axis.client.Stub) _stub).setPortName(portName);
-            return _stub;
-        }
-    }
-
-    public javax.xml.namespace.QName getServiceName() {
-        return new javax.xml.namespace.QName("vamsas", "JPredWSService");
-    }
-
-    private java.util.HashSet ports = null;
-
-    public java.util.Iterator getPorts() {
-        if (ports == null) {
-            ports = new java.util.HashSet();
-            ports.add(new javax.xml.namespace.QName("vamsas", "jpred"));
-        }
-        return ports.iterator();
-    }
-
+ * For the given interface, get the stub implementation.
+ * If this service has no port for the given interface,
+ * then ServiceException is thrown.
+ */\r
+    public java.rmi.Remote getPort(javax.xml.namespace.QName portName,\r
+        Class serviceEndpointInterface) throws javax.xml.rpc.ServiceException {\r
+        if (portName == null) {\r
+            return getPort(serviceEndpointInterface);\r
+        }\r
+\r
+        java.lang.String inputPortName = portName.getLocalPart();\r
+\r
+        if ("jpred".equals(inputPortName)) {\r
+            return getjpred();\r
+        } else {\r
+            java.rmi.Remote _stub = getPort(serviceEndpointInterface);\r
+            ((org.apache.axis.client.Stub) _stub).setPortName(portName);\r
+\r
+            return _stub;\r
+        }\r
+    }\r
+\r
+    public javax.xml.namespace.QName getServiceName() {\r
+        return new javax.xml.namespace.QName("vamsas", "JPredWSService");\r
+    }\r
+\r
+    public java.util.Iterator getPorts() {\r
+        if (ports == null) {\r
+            ports = new java.util.HashSet();\r
+            ports.add(new javax.xml.namespace.QName("vamsas", "jpred"));\r
+        }\r
+\r
+        return ports.iterator();\r
+    }\r
+\r
     /**
-    * Set the endpoint address for the specified port name.
-    */
-    public void setEndpointAddress(java.lang.String portName, java.lang.String address) throws javax.xml.rpc.ServiceException {
-        if ("jpred".equals(portName)) {
-            setjpredEndpointAddress(address);
-        }
-        else { // Unknown Port Name
-            throw new javax.xml.rpc.ServiceException(" Cannot set Endpoint Address for Unknown Port" + portName);
-        }
-    }
-
+* Set the endpoint address for the specified port name.
+*/\r
+    public void setEndpointAddress(java.lang.String portName,\r
+        java.lang.String address) throws javax.xml.rpc.ServiceException {\r
+        if ("jpred".equals(portName)) {\r
+            setjpredEndpointAddress(address);\r
+        } else { // Unknown Port Name\r
+            throw new javax.xml.rpc.ServiceException(\r
+                " Cannot set Endpoint Address for Unknown Port" + portName);\r
+        }\r
+    }\r
+\r
     /**
-    * Set the endpoint address for the specified port name.
-    */
-    public void setEndpointAddress(javax.xml.namespace.QName portName, java.lang.String address) throws javax.xml.rpc.ServiceException {
-        setEndpointAddress(portName.getLocalPart(), address);
-    }
-
-}
+* Set the endpoint address for the specified port name.
+*/\r
+    public void setEndpointAddress(javax.xml.namespace.QName portName,\r
+        java.lang.String address) throws javax.xml.rpc.ServiceException {\r
+        setEndpointAddress(portName.getLocalPart(), address);\r
+    }\r
+}\r
index 741d3df..e7d089b 100755 (executable)
@@ -3,8 +3,8 @@
  *
  * This file was auto-generated from WSDL
  * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter.
- */
-
+ */\r
+\r
 /*
 * Jalview - A Sequence Alignment Editor and Viewer
 * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
 * 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 ext.vamsas;
-
-public class JpredResult  extends ext.vamsas.Result  implements java.io.Serializable {
-    private java.lang.String aligfile;
-    private java.lang.String predfile;
-
-    public JpredResult() {
-    }
-
-    public JpredResult(
-           java.lang.String aligfile,
-           java.lang.String predfile) {
-           this.aligfile = aligfile;
-           this.predfile = predfile;
-    }
-
-
+*/\r
+package ext.vamsas;\r
+\r
+public class JpredResult extends ext.vamsas.Result\r
+    implements java.io.Serializable {\r
+    // Type metadata\r
+    private static org.apache.axis.description.TypeDesc typeDesc = new org.apache.axis.description.TypeDesc(JpredResult.class,\r
+            true);\r
+\r
+    static {\r
+        typeDesc.setXmlType(new javax.xml.namespace.QName(\r
+                "http://dataTypes.vamsas", "JpredResult"));\r
+\r
+        org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();\r
+        elemField.setFieldName("aligfile");\r
+        elemField.setXmlName(new javax.xml.namespace.QName(\r
+                "http://dataTypes.vamsas", "aligfile"));\r
+        elemField.setXmlType(new javax.xml.namespace.QName(\r
+                "http://www.w3.org/2001/XMLSchema", "string"));\r
+        typeDesc.addFieldDesc(elemField);\r
+        elemField = new org.apache.axis.description.ElementDesc();\r
+        elemField.setFieldName("predfile");\r
+        elemField.setXmlName(new javax.xml.namespace.QName(\r
+                "http://dataTypes.vamsas", "predfile"));\r
+        elemField.setXmlType(new javax.xml.namespace.QName(\r
+                "http://www.w3.org/2001/XMLSchema", "string"));\r
+        typeDesc.addFieldDesc(elemField);\r
+    }\r
+\r
+    private java.lang.String aligfile;\r
+    private java.lang.String predfile;\r
+    private java.lang.Object __equalsCalc = null;\r
+    private boolean __hashCodeCalc = false;\r
+\r
+    public JpredResult() {\r
+    }\r
+\r
+    public JpredResult(java.lang.String aligfile, java.lang.String predfile) {\r
+        this.aligfile = aligfile;\r
+        this.predfile = predfile;\r
+    }\r
+\r
     /**
-     * Gets the aligfile value for this JpredResult.
-     *
-     * @return aligfile
-     */
-    public java.lang.String getAligfile() {
-        return aligfile;
-    }
-
-
+ * Gets the aligfile value for this JpredResult.
+ *
+ * @return aligfile
+ */\r
+    public java.lang.String getAligfile() {\r
+        return aligfile;\r
+    }\r
+\r
     /**
-     * Sets the aligfile value for this JpredResult.
-     *
-     * @param aligfile
-     */
-    public void setAligfile(java.lang.String aligfile) {
-        this.aligfile = aligfile;
-    }
-
-
+ * Sets the aligfile value for this JpredResult.
+ *
+ * @param aligfile
+ */\r
+    public void setAligfile(java.lang.String aligfile) {\r
+        this.aligfile = aligfile;\r
+    }\r
+\r
     /**
-     * Gets the predfile value for this JpredResult.
-     *
-     * @return predfile
-     */
-    public java.lang.String getPredfile() {
-        return predfile;
-    }
-
-
+ * Gets the predfile value for this JpredResult.
+ *
+ * @return predfile
+ */\r
+    public java.lang.String getPredfile() {\r
+        return predfile;\r
+    }\r
+\r
     /**
-     * Sets the predfile value for this JpredResult.
-     *
-     * @param predfile
-     */
-    public void setPredfile(java.lang.String predfile) {
-        this.predfile = predfile;
-    }
-
-    private java.lang.Object __equalsCalc = null;
-    public synchronized boolean equals(java.lang.Object obj) {
-        if (!(obj instanceof JpredResult)) return false;
-        JpredResult other = (JpredResult) obj;
-        if (obj == null) return false;
-        if (this == obj) return true;
-        if (__equalsCalc != null) {
-            return (__equalsCalc == obj);
-        }
-        __equalsCalc = obj;
-        boolean _equals;
-        _equals = super.equals(obj) &&
-            ((this.aligfile==null && other.getAligfile()==null) ||
-             (this.aligfile!=null &&
-              this.aligfile.equals(other.getAligfile()))) &&
-            ((this.predfile==null && other.getPredfile()==null) ||
-             (this.predfile!=null &&
-              this.predfile.equals(other.getPredfile())));
-        __equalsCalc = null;
-        return _equals;
-    }
-
-    private boolean __hashCodeCalc = false;
-    public synchronized int hashCode() {
-        if (__hashCodeCalc) {
-            return 0;
-        }
-        __hashCodeCalc = true;
-        int _hashCode = super.hashCode();
-        if (getAligfile() != null) {
-            _hashCode += getAligfile().hashCode();
-        }
-        if (getPredfile() != null) {
-            _hashCode += getPredfile().hashCode();
-        }
-        __hashCodeCalc = false;
-        return _hashCode;
-    }
-
-    // Type metadata
-    private static org.apache.axis.description.TypeDesc typeDesc =
-        new org.apache.axis.description.TypeDesc(JpredResult.class, true);
-
-    static {
-        typeDesc.setXmlType(new javax.xml.namespace.QName("http://dataTypes.vamsas", "JpredResult"));
-        org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("aligfile");
-        elemField.setXmlName(new javax.xml.namespace.QName("http://dataTypes.vamsas", "aligfile"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("predfile");
-        elemField.setXmlName(new javax.xml.namespace.QName("http://dataTypes.vamsas", "predfile"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
-        typeDesc.addFieldDesc(elemField);
-    }
-
+ * Sets the predfile value for this JpredResult.
+ *
+ * @param predfile
+ */\r
+    public void setPredfile(java.lang.String predfile) {\r
+        this.predfile = predfile;\r
+    }\r
+\r
+    public synchronized boolean equals(java.lang.Object obj) {\r
+        if (!(obj instanceof JpredResult)) {\r
+            return false;\r
+        }\r
+\r
+        JpredResult other = (JpredResult) obj;\r
+\r
+        if (obj == null) {\r
+            return false;\r
+        }\r
+\r
+        if (this == obj) {\r
+            return true;\r
+        }\r
+\r
+        if (__equalsCalc != null) {\r
+            return (__equalsCalc == obj);\r
+        }\r
+\r
+        __equalsCalc = obj;\r
+\r
+        boolean _equals;\r
+        _equals = super.equals(obj) &&\r
+            (((this.aligfile == null) && (other.getAligfile() == null)) ||\r
+            ((this.aligfile != null) &&\r
+            this.aligfile.equals(other.getAligfile()))) &&\r
+            (((this.predfile == null) && (other.getPredfile() == null)) ||\r
+            ((this.predfile != null) &&\r
+            this.predfile.equals(other.getPredfile())));\r
+        __equalsCalc = null;\r
+\r
+        return _equals;\r
+    }\r
+\r
+    public synchronized int hashCode() {\r
+        if (__hashCodeCalc) {\r
+            return 0;\r
+        }\r
+\r
+        __hashCodeCalc = true;\r
+\r
+        int _hashCode = super.hashCode();\r
+\r
+        if (getAligfile() != null) {\r
+            _hashCode += getAligfile().hashCode();\r
+        }\r
+\r
+        if (getPredfile() != null) {\r
+            _hashCode += getPredfile().hashCode();\r
+        }\r
+\r
+        __hashCodeCalc = false;\r
+\r
+        return _hashCode;\r
+    }\r
+\r
     /**
-     * Return type metadata object
-     */
-    public static org.apache.axis.description.TypeDesc getTypeDesc() {
-        return typeDesc;
-    }
-
+ * Return type metadata object
+ */\r
+    public static org.apache.axis.description.TypeDesc getTypeDesc() {\r
+        return typeDesc;\r
+    }\r
+\r
     /**
-     * Get Custom Serializer
-     */
-    public static org.apache.axis.encoding.Serializer getSerializer(
-           java.lang.String mechType,
-           java.lang.Class _javaType,
-           javax.xml.namespace.QName _xmlType) {
-        return
-          new  org.apache.axis.encoding.ser.BeanSerializer(
-            _javaType, _xmlType, typeDesc);
-    }
-
+ * Get Custom Serializer
+ */\r
+    public static org.apache.axis.encoding.Serializer getSerializer(\r
+        java.lang.String mechType, java.lang.Class _javaType,\r
+        javax.xml.namespace.QName _xmlType) {\r
+        return new org.apache.axis.encoding.ser.BeanSerializer(_javaType,\r
+            _xmlType, typeDesc);\r
+    }\r
+\r
     /**
-     * Get Custom Deserializer
-     */
-    public static org.apache.axis.encoding.Deserializer getDeserializer(
-           java.lang.String mechType,
-           java.lang.Class _javaType,
-           javax.xml.namespace.QName _xmlType) {
-        return
-          new  org.apache.axis.encoding.ser.BeanDeserializer(
-            _javaType, _xmlType, typeDesc);
-    }
-
-}
+ * Get Custom Deserializer
+ */\r
+    public static org.apache.axis.encoding.Deserializer getDeserializer(\r
+        java.lang.String mechType, java.lang.Class _javaType,\r
+        javax.xml.namespace.QName _xmlType) {\r
+        return new org.apache.axis.encoding.ser.BeanDeserializer(_javaType,\r
+            _xmlType, typeDesc);\r
+    }\r
+}\r
index d27a582..bed6fa3 100755 (executable)
@@ -3,8 +3,8 @@
  *
  * This file was auto-generated from WSDL
  * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter.
- */
-
+ */\r
+\r
 /*
 * Jalview - A Sequence Alignment Editor and Viewer
 * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
 * 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 ext.vamsas;
-
-public class JpredSoapBindingStub extends org.apache.axis.client.Stub implements ext.vamsas.JPredWS {
-    private java.util.Vector cachedSerClasses = new java.util.Vector();
-    private java.util.Vector cachedSerQNames = new java.util.Vector();
-    private java.util.Vector cachedSerFactories = new java.util.Vector();
-    private java.util.Vector cachedDeserFactories = new java.util.Vector();
-
-    static org.apache.axis.description.OperationDesc [] _operations;
-
-    static {
-        _operations = new org.apache.axis.description.OperationDesc[4];
-        _initOperationDesc1();
-    }
-
-    private static void _initOperationDesc1(){
-        org.apache.axis.description.OperationDesc oper;
-        oper = new org.apache.axis.description.OperationDesc();
-        oper.setName("predict");
-        oper.addParameter(new javax.xml.namespace.QName("vamsas", "in0"), new javax.xml.namespace.QName("http://dataTypes.vamsas", "Sequence"), ext.vamsas.Sequence.class, org.apache.axis.description.ParameterDesc.IN, false, false);
-        oper.setReturnType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
-        oper.setReturnClass(java.lang.String.class);
-        oper.setReturnQName(new javax.xml.namespace.QName("vamsas", "predictReturn"));
-        oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
-        oper.setUse(org.apache.axis.constants.Use.LITERAL);
-        _operations[0] = oper;
-
-        oper = new org.apache.axis.description.OperationDesc();
-        oper.setName("predictOnMsa");
-        oper.addParameter(new javax.xml.namespace.QName("vamsas", "in0"), new javax.xml.namespace.QName("http://dataTypes.vamsas", "Msfalignment"), ext.vamsas.Msfalignment.class, org.apache.axis.description.ParameterDesc.IN, false, false);
-        oper.setReturnType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
-        oper.setReturnClass(java.lang.String.class);
-        oper.setReturnQName(new javax.xml.namespace.QName("vamsas", "predictOnMsaReturn"));
-        oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
-        oper.setUse(org.apache.axis.constants.Use.LITERAL);
-        _operations[1] = oper;
-
-        oper = new org.apache.axis.description.OperationDesc();
-        oper.setName("getpredict");
-        oper.addParameter(new javax.xml.namespace.QName("vamsas", "in0"), new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), java.lang.String.class, org.apache.axis.description.ParameterDesc.IN, false, false);
-        oper.setReturnType(new javax.xml.namespace.QName("http://dataTypes.vamsas", "Secstructpred"));
-        oper.setReturnClass(ext.vamsas.Secstructpred.class);
-        oper.setReturnQName(new javax.xml.namespace.QName("vamsas", "getpredictReturn"));
-        oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
-        oper.setUse(org.apache.axis.constants.Use.LITERAL);
-        _operations[2] = oper;
-
-        oper = new org.apache.axis.description.OperationDesc();
-        oper.setName("getresult");
-        oper.addParameter(new javax.xml.namespace.QName("vamsas", "in0"), new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), java.lang.String.class, org.apache.axis.description.ParameterDesc.IN, false, false);
-        oper.setReturnType(new javax.xml.namespace.QName("http://dataTypes.vamsas", "JpredResult"));
-        oper.setReturnClass(ext.vamsas.JpredResult.class);
-        oper.setReturnQName(new javax.xml.namespace.QName("vamsas", "getresultReturn"));
-        oper.setStyle(org.apache.axis.constants.Style.WRAPPED);
-        oper.setUse(org.apache.axis.constants.Use.LITERAL);
-        _operations[3] = oper;
-
-    }
-
-    public JpredSoapBindingStub() throws org.apache.axis.AxisFault {
-         this(null);
-    }
-
-    public JpredSoapBindingStub(java.net.URL endpointURL, javax.xml.rpc.Service service) throws org.apache.axis.AxisFault {
-         this(service);
-         super.cachedEndpoint = endpointURL;
-    }
-
-    public JpredSoapBindingStub(javax.xml.rpc.Service service) throws org.apache.axis.AxisFault {
-        if (service == null) {
-            super.service = new org.apache.axis.client.Service();
-        } else {
-            super.service = service;
-        }
-            java.lang.Class cls;
-            javax.xml.namespace.QName qName;
-            java.lang.Class beansf = org.apache.axis.encoding.ser.BeanSerializerFactory.class;
-            java.lang.Class beandf = org.apache.axis.encoding.ser.BeanDeserializerFactory.class;
-            java.lang.Class enumsf = org.apache.axis.encoding.ser.EnumSerializerFactory.class;
-            java.lang.Class enumdf = org.apache.axis.encoding.ser.EnumDeserializerFactory.class;
-            java.lang.Class arraysf = org.apache.axis.encoding.ser.ArraySerializerFactory.class;
-            java.lang.Class arraydf = org.apache.axis.encoding.ser.ArrayDeserializerFactory.class;
-            java.lang.Class simplesf = org.apache.axis.encoding.ser.SimpleSerializerFactory.class;
-            java.lang.Class simpledf = org.apache.axis.encoding.ser.SimpleDeserializerFactory.class;
-            java.lang.Class simplelistsf = org.apache.axis.encoding.ser.SimpleListSerializerFactory.class;
-            java.lang.Class simplelistdf = org.apache.axis.encoding.ser.SimpleListDeserializerFactory.class;
-            qName = new javax.xml.namespace.QName("http://dataTypes.vamsas", "Sequence");
-            cachedSerQNames.add(qName);
-            cls = ext.vamsas.Sequence.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("http://dataTypes.vamsas", "Secstructpred");
-            cachedSerQNames.add(qName);
-            cls = ext.vamsas.Secstructpred.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("http://dataTypes.vamsas", "Msfalignment");
-            cachedSerQNames.add(qName);
-            cls = ext.vamsas.Msfalignment.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("http://dataTypes.vamsas", "JpredResult");
-            cachedSerQNames.add(qName);
-            cls = ext.vamsas.JpredResult.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("http://dataTypes.vamsas", "Result");
-            cachedSerQNames.add(qName);
-            cls = ext.vamsas.Result.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-    }
-
-    protected org.apache.axis.client.Call createCall() throws java.rmi.RemoteException {
-        try {
-            org.apache.axis.client.Call _call =
-                    (org.apache.axis.client.Call) super.service.createCall();
-            if (super.maintainSessionSet) {
-                _call.setMaintainSession(super.maintainSession);
-            }
-            if (super.cachedUsername != null) {
-                _call.setUsername(super.cachedUsername);
-            }
-            if (super.cachedPassword != null) {
-                _call.setPassword(super.cachedPassword);
-            }
-            if (super.cachedEndpoint != null) {
-                _call.setTargetEndpointAddress(super.cachedEndpoint);
-            }
-            if (super.cachedTimeout != null) {
-                _call.setTimeout(super.cachedTimeout);
-            }
-            if (super.cachedPortName != null) {
-                _call.setPortName(super.cachedPortName);
-            }
-            java.util.Enumeration keys = super.cachedProperties.keys();
-            while (keys.hasMoreElements()) {
-                java.lang.String key = (java.lang.String) keys.nextElement();
-                _call.setProperty(key, super.cachedProperties.get(key));
-            }
-            // All the type mapping information is registered
-            // when the first call is made.
-            // The type mapping information is actually registered in
-            // the TypeMappingRegistry of the service, which
-            // is the reason why registration is only needed for the first call.
-            synchronized (this) {
-                if (firstCall()) {
-                    // must set encoding style before registering serializers
-                    _call.setEncodingStyle(null);
-                    for (int i = 0; i < cachedSerFactories.size(); ++i) {
-                        java.lang.Class cls = (java.lang.Class) cachedSerClasses.get(i);
-                        javax.xml.namespace.QName qName =
-                                (javax.xml.namespace.QName) cachedSerQNames.get(i);
-                        java.lang.Class sf = (java.lang.Class)
-                                 cachedSerFactories.get(i);
-                        java.lang.Class df = (java.lang.Class)
-                                 cachedDeserFactories.get(i);
-                        _call.registerTypeMapping(cls, qName, sf, df, false);
-                    }
-                }
-            }
-            return _call;
-        }
-        catch (java.lang.Throwable _t) {
-            throw new org.apache.axis.AxisFault("Failure trying to get the Call object", _t);
-        }
-    }
-
-    public java.lang.String predict(ext.vamsas.Sequence in0) throws java.rmi.RemoteException {
-        if (super.cachedEndpoint == null) {
-            throw new org.apache.axis.NoEndPointException();
-        }
-        org.apache.axis.client.Call _call = createCall();
-        _call.setOperation(_operations[0]);
-        _call.setUseSOAPAction(true);
-        _call.setSOAPActionURI("");
-        _call.setEncodingStyle(null);
-        _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
-        _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
-        _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
-        _call.setOperationName(new javax.xml.namespace.QName("vamsas", "predict"));
-
-        setRequestHeaders(_call);
-        setAttachments(_call);
-        java.lang.Object _resp = _call.invoke(new java.lang.Object[] {in0});
-
-        if (_resp instanceof java.rmi.RemoteException) {
-            throw (java.rmi.RemoteException)_resp;
-        }
-        else {
-            extractAttachments(_call);
-            try {
-                return (java.lang.String) _resp;
-            } catch (java.lang.Exception _exception) {
-                return (java.lang.String) org.apache.axis.utils.JavaUtils.convert(_resp, java.lang.String.class);
-            }
-        }
-    }
-
-    public java.lang.String predictOnMsa(ext.vamsas.Msfalignment in0) throws java.rmi.RemoteException {
-        if (super.cachedEndpoint == null) {
-            throw new org.apache.axis.NoEndPointException();
-        }
-        org.apache.axis.client.Call _call = createCall();
-        _call.setOperation(_operations[1]);
-        _call.setUseSOAPAction(true);
-        _call.setSOAPActionURI("");
-        _call.setEncodingStyle(null);
-        _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
-        _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
-        _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
-        _call.setOperationName(new javax.xml.namespace.QName("vamsas", "predictOnMsa"));
-
-        setRequestHeaders(_call);
-        setAttachments(_call);
-        java.lang.Object _resp = _call.invoke(new java.lang.Object[] {in0});
-
-        if (_resp instanceof java.rmi.RemoteException) {
-            throw (java.rmi.RemoteException)_resp;
-        }
-        else {
-            extractAttachments(_call);
-            try {
-                return (java.lang.String) _resp;
-            } catch (java.lang.Exception _exception) {
-                return (java.lang.String) org.apache.axis.utils.JavaUtils.convert(_resp, java.lang.String.class);
-            }
-        }
-    }
-
-    public ext.vamsas.Secstructpred getpredict(java.lang.String in0) throws java.rmi.RemoteException {
-        if (super.cachedEndpoint == null) {
-            throw new org.apache.axis.NoEndPointException();
-        }
-        org.apache.axis.client.Call _call = createCall();
-        _call.setOperation(_operations[2]);
-        _call.setUseSOAPAction(true);
-        _call.setSOAPActionURI("");
-        _call.setEncodingStyle(null);
-        _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
-        _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
-        _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
-        _call.setOperationName(new javax.xml.namespace.QName("vamsas", "getpredict"));
-
-        setRequestHeaders(_call);
-        setAttachments(_call);
-        java.lang.Object _resp = _call.invoke(new java.lang.Object[] {in0});
-
-        if (_resp instanceof java.rmi.RemoteException) {
-            throw (java.rmi.RemoteException)_resp;
-        }
-        else {
-            extractAttachments(_call);
-            try {
-                return (ext.vamsas.Secstructpred) _resp;
-            } catch (java.lang.Exception _exception) {
-                return (ext.vamsas.Secstructpred) org.apache.axis.utils.JavaUtils.convert(_resp, ext.vamsas.Secstructpred.class);
-            }
-        }
-    }
-
-    public ext.vamsas.JpredResult getresult(java.lang.String in0) throws java.rmi.RemoteException {
-        if (super.cachedEndpoint == null) {
-            throw new org.apache.axis.NoEndPointException();
-        }
-        org.apache.axis.client.Call _call = createCall();
-        _call.setOperation(_operations[3]);
-        _call.setUseSOAPAction(true);
-        _call.setSOAPActionURI("");
-        _call.setEncodingStyle(null);
-        _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR, Boolean.FALSE);
-        _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS, Boolean.FALSE);
-        _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
-        _call.setOperationName(new javax.xml.namespace.QName("vamsas", "getresult"));
-
-        setRequestHeaders(_call);
-        setAttachments(_call);
-        java.lang.Object _resp = _call.invoke(new java.lang.Object[] {in0});
-
-        if (_resp instanceof java.rmi.RemoteException) {
-            throw (java.rmi.RemoteException)_resp;
-        }
-        else {
-            extractAttachments(_call);
-            try {
-                return (ext.vamsas.JpredResult) _resp;
-            } catch (java.lang.Exception _exception) {
-                return (ext.vamsas.JpredResult) org.apache.axis.utils.JavaUtils.convert(_resp, ext.vamsas.JpredResult.class);
-            }
-        }
-    }
-
-}
+*/\r
+package ext.vamsas;\r
+\r
+public class JpredSoapBindingStub extends org.apache.axis.client.Stub\r
+    implements ext.vamsas.JPredWS {\r
+    static org.apache.axis.description.OperationDesc[] _operations;\r
+\r
+    static {\r
+        _operations = new org.apache.axis.description.OperationDesc[4];\r
+        _initOperationDesc1();\r
+    }\r
+\r
+    private java.util.Vector cachedSerClasses = new java.util.Vector();\r
+    private java.util.Vector cachedSerQNames = new java.util.Vector();\r
+    private java.util.Vector cachedSerFactories = new java.util.Vector();\r
+    private java.util.Vector cachedDeserFactories = new java.util.Vector();\r
+\r
+    public JpredSoapBindingStub() throws org.apache.axis.AxisFault {\r
+        this(null);\r
+    }\r
+\r
+    public JpredSoapBindingStub(java.net.URL endpointURL,\r
+        javax.xml.rpc.Service service) throws org.apache.axis.AxisFault {\r
+        this(service);\r
+        super.cachedEndpoint = endpointURL;\r
+    }\r
+\r
+    public JpredSoapBindingStub(javax.xml.rpc.Service service)\r
+        throws org.apache.axis.AxisFault {\r
+        if (service == null) {\r
+            super.service = new org.apache.axis.client.Service();\r
+        } else {\r
+            super.service = service;\r
+        }\r
+\r
+        java.lang.Class cls;\r
+        javax.xml.namespace.QName qName;\r
+        java.lang.Class beansf = org.apache.axis.encoding.ser.BeanSerializerFactory.class;\r
+        java.lang.Class beandf = org.apache.axis.encoding.ser.BeanDeserializerFactory.class;\r
+        java.lang.Class enumsf = org.apache.axis.encoding.ser.EnumSerializerFactory.class;\r
+        java.lang.Class enumdf = org.apache.axis.encoding.ser.EnumDeserializerFactory.class;\r
+        java.lang.Class arraysf = org.apache.axis.encoding.ser.ArraySerializerFactory.class;\r
+        java.lang.Class arraydf = org.apache.axis.encoding.ser.ArrayDeserializerFactory.class;\r
+        java.lang.Class simplesf = org.apache.axis.encoding.ser.SimpleSerializerFactory.class;\r
+        java.lang.Class simpledf = org.apache.axis.encoding.ser.SimpleDeserializerFactory.class;\r
+        java.lang.Class simplelistsf = org.apache.axis.encoding.ser.SimpleListSerializerFactory.class;\r
+        java.lang.Class simplelistdf = org.apache.axis.encoding.ser.SimpleListDeserializerFactory.class;\r
+        qName = new javax.xml.namespace.QName("http://dataTypes.vamsas",\r
+                "Sequence");\r
+        cachedSerQNames.add(qName);\r
+        cls = ext.vamsas.Sequence.class;\r
+        cachedSerClasses.add(cls);\r
+        cachedSerFactories.add(beansf);\r
+        cachedDeserFactories.add(beandf);\r
+\r
+        qName = new javax.xml.namespace.QName("http://dataTypes.vamsas",\r
+                "Secstructpred");\r
+        cachedSerQNames.add(qName);\r
+        cls = ext.vamsas.Secstructpred.class;\r
+        cachedSerClasses.add(cls);\r
+        cachedSerFactories.add(beansf);\r
+        cachedDeserFactories.add(beandf);\r
+\r
+        qName = new javax.xml.namespace.QName("http://dataTypes.vamsas",\r
+                "Msfalignment");\r
+        cachedSerQNames.add(qName);\r
+        cls = ext.vamsas.Msfalignment.class;\r
+        cachedSerClasses.add(cls);\r
+        cachedSerFactories.add(beansf);\r
+        cachedDeserFactories.add(beandf);\r
+\r
+        qName = new javax.xml.namespace.QName("http://dataTypes.vamsas",\r
+                "JpredResult");\r
+        cachedSerQNames.add(qName);\r
+        cls = ext.vamsas.JpredResult.class;\r
+        cachedSerClasses.add(cls);\r
+        cachedSerFactories.add(beansf);\r
+        cachedDeserFactories.add(beandf);\r
+\r
+        qName = new javax.xml.namespace.QName("http://dataTypes.vamsas",\r
+                "Result");\r
+        cachedSerQNames.add(qName);\r
+        cls = ext.vamsas.Result.class;\r
+        cachedSerClasses.add(cls);\r
+        cachedSerFactories.add(beansf);\r
+        cachedDeserFactories.add(beandf);\r
+    }\r
+\r
+    private static void _initOperationDesc1() {\r
+        org.apache.axis.description.OperationDesc oper;\r
+        oper = new org.apache.axis.description.OperationDesc();\r
+        oper.setName("predict");\r
+        oper.addParameter(new javax.xml.namespace.QName("vamsas", "in0"),\r
+            new javax.xml.namespace.QName("http://dataTypes.vamsas", "Sequence"),\r
+            ext.vamsas.Sequence.class,\r
+            org.apache.axis.description.ParameterDesc.IN, false, false);\r
+        oper.setReturnType(new javax.xml.namespace.QName(\r
+                "http://www.w3.org/2001/XMLSchema", "string"));\r
+        oper.setReturnClass(java.lang.String.class);\r
+        oper.setReturnQName(new javax.xml.namespace.QName("vamsas",\r
+                "predictReturn"));\r
+        oper.setStyle(org.apache.axis.constants.Style.WRAPPED);\r
+        oper.setUse(org.apache.axis.constants.Use.LITERAL);\r
+        _operations[0] = oper;\r
+\r
+        oper = new org.apache.axis.description.OperationDesc();\r
+        oper.setName("predictOnMsa");\r
+        oper.addParameter(new javax.xml.namespace.QName("vamsas", "in0"),\r
+            new javax.xml.namespace.QName("http://dataTypes.vamsas",\r
+                "Msfalignment"), ext.vamsas.Msfalignment.class,\r
+            org.apache.axis.description.ParameterDesc.IN, false, false);\r
+        oper.setReturnType(new javax.xml.namespace.QName(\r
+                "http://www.w3.org/2001/XMLSchema", "string"));\r
+        oper.setReturnClass(java.lang.String.class);\r
+        oper.setReturnQName(new javax.xml.namespace.QName("vamsas",\r
+                "predictOnMsaReturn"));\r
+        oper.setStyle(org.apache.axis.constants.Style.WRAPPED);\r
+        oper.setUse(org.apache.axis.constants.Use.LITERAL);\r
+        _operations[1] = oper;\r
+\r
+        oper = new org.apache.axis.description.OperationDesc();\r
+        oper.setName("getpredict");\r
+        oper.addParameter(new javax.xml.namespace.QName("vamsas", "in0"),\r
+            new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema",\r
+                "string"), java.lang.String.class,\r
+            org.apache.axis.description.ParameterDesc.IN, false, false);\r
+        oper.setReturnType(new javax.xml.namespace.QName(\r
+                "http://dataTypes.vamsas", "Secstructpred"));\r
+        oper.setReturnClass(ext.vamsas.Secstructpred.class);\r
+        oper.setReturnQName(new javax.xml.namespace.QName("vamsas",\r
+                "getpredictReturn"));\r
+        oper.setStyle(org.apache.axis.constants.Style.WRAPPED);\r
+        oper.setUse(org.apache.axis.constants.Use.LITERAL);\r
+        _operations[2] = oper;\r
+\r
+        oper = new org.apache.axis.description.OperationDesc();\r
+        oper.setName("getresult");\r
+        oper.addParameter(new javax.xml.namespace.QName("vamsas", "in0"),\r
+            new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema",\r
+                "string"), java.lang.String.class,\r
+            org.apache.axis.description.ParameterDesc.IN, false, false);\r
+        oper.setReturnType(new javax.xml.namespace.QName(\r
+                "http://dataTypes.vamsas", "JpredResult"));\r
+        oper.setReturnClass(ext.vamsas.JpredResult.class);\r
+        oper.setReturnQName(new javax.xml.namespace.QName("vamsas",\r
+                "getresultReturn"));\r
+        oper.setStyle(org.apache.axis.constants.Style.WRAPPED);\r
+        oper.setUse(org.apache.axis.constants.Use.LITERAL);\r
+        _operations[3] = oper;\r
+    }\r
+\r
+    protected org.apache.axis.client.Call createCall()\r
+        throws java.rmi.RemoteException {\r
+        try {\r
+            org.apache.axis.client.Call _call = (org.apache.axis.client.Call) super.service.createCall();\r
+\r
+            if (super.maintainSessionSet) {\r
+                _call.setMaintainSession(super.maintainSession);\r
+            }\r
+\r
+            if (super.cachedUsername != null) {\r
+                _call.setUsername(super.cachedUsername);\r
+            }\r
+\r
+            if (super.cachedPassword != null) {\r
+                _call.setPassword(super.cachedPassword);\r
+            }\r
+\r
+            if (super.cachedEndpoint != null) {\r
+                _call.setTargetEndpointAddress(super.cachedEndpoint);\r
+            }\r
+\r
+            if (super.cachedTimeout != null) {\r
+                _call.setTimeout(super.cachedTimeout);\r
+            }\r
+\r
+            if (super.cachedPortName != null) {\r
+                _call.setPortName(super.cachedPortName);\r
+            }\r
+\r
+            java.util.Enumeration keys = super.cachedProperties.keys();\r
+\r
+            while (keys.hasMoreElements()) {\r
+                java.lang.String key = (java.lang.String) keys.nextElement();\r
+                _call.setProperty(key, super.cachedProperties.get(key));\r
+            }\r
+\r
+            // All the type mapping information is registered\r
+            // when the first call is made.\r
+            // The type mapping information is actually registered in\r
+            // the TypeMappingRegistry of the service, which\r
+            // is the reason why registration is only needed for the first call.\r
+            synchronized (this) {\r
+                if (firstCall()) {\r
+                    // must set encoding style before registering serializers\r
+                    _call.setEncodingStyle(null);\r
+\r
+                    for (int i = 0; i < cachedSerFactories.size(); ++i) {\r
+                        java.lang.Class cls = (java.lang.Class) cachedSerClasses.get(i);\r
+                        javax.xml.namespace.QName qName = (javax.xml.namespace.QName) cachedSerQNames.get(i);\r
+                        java.lang.Class sf = (java.lang.Class) cachedSerFactories.get(i);\r
+                        java.lang.Class df = (java.lang.Class) cachedDeserFactories.get(i);\r
+                        _call.registerTypeMapping(cls, qName, sf, df, false);\r
+                    }\r
+                }\r
+            }\r
+\r
+            return _call;\r
+        } catch (java.lang.Throwable _t) {\r
+            throw new org.apache.axis.AxisFault("Failure trying to get the Call object",\r
+                _t);\r
+        }\r
+    }\r
+\r
+    public java.lang.String predict(ext.vamsas.Sequence in0)\r
+        throws java.rmi.RemoteException {\r
+        if (super.cachedEndpoint == null) {\r
+            throw new org.apache.axis.NoEndPointException();\r
+        }\r
+\r
+        org.apache.axis.client.Call _call = createCall();\r
+        _call.setOperation(_operations[0]);\r
+        _call.setUseSOAPAction(true);\r
+        _call.setSOAPActionURI("");\r
+        _call.setEncodingStyle(null);\r
+        _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR,\r
+            Boolean.FALSE);\r
+        _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS,\r
+            Boolean.FALSE);\r
+        _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);\r
+        _call.setOperationName(new javax.xml.namespace.QName("vamsas", "predict"));\r
+\r
+        setRequestHeaders(_call);\r
+        setAttachments(_call);\r
+\r
+        java.lang.Object _resp = _call.invoke(new java.lang.Object[] { in0 });\r
+\r
+        if (_resp instanceof java.rmi.RemoteException) {\r
+            throw (java.rmi.RemoteException) _resp;\r
+        } else {\r
+            extractAttachments(_call);\r
+\r
+            try {\r
+                return (java.lang.String) _resp;\r
+            } catch (java.lang.Exception _exception) {\r
+                return (java.lang.String) org.apache.axis.utils.JavaUtils.convert(_resp,\r
+                    java.lang.String.class);\r
+            }\r
+        }\r
+    }\r
+\r
+    public java.lang.String predictOnMsa(ext.vamsas.Msfalignment in0)\r
+        throws java.rmi.RemoteException {\r
+        if (super.cachedEndpoint == null) {\r
+            throw new org.apache.axis.NoEndPointException();\r
+        }\r
+\r
+        org.apache.axis.client.Call _call = createCall();\r
+        _call.setOperation(_operations[1]);\r
+        _call.setUseSOAPAction(true);\r
+        _call.setSOAPActionURI("");\r
+        _call.setEncodingStyle(null);\r
+        _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR,\r
+            Boolean.FALSE);\r
+        _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS,\r
+            Boolean.FALSE);\r
+        _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);\r
+        _call.setOperationName(new javax.xml.namespace.QName("vamsas",\r
+                "predictOnMsa"));\r
+\r
+        setRequestHeaders(_call);\r
+        setAttachments(_call);\r
+\r
+        java.lang.Object _resp = _call.invoke(new java.lang.Object[] { in0 });\r
+\r
+        if (_resp instanceof java.rmi.RemoteException) {\r
+            throw (java.rmi.RemoteException) _resp;\r
+        } else {\r
+            extractAttachments(_call);\r
+\r
+            try {\r
+                return (java.lang.String) _resp;\r
+            } catch (java.lang.Exception _exception) {\r
+                return (java.lang.String) org.apache.axis.utils.JavaUtils.convert(_resp,\r
+                    java.lang.String.class);\r
+            }\r
+        }\r
+    }\r
+\r
+    public ext.vamsas.Secstructpred getpredict(java.lang.String in0)\r
+        throws java.rmi.RemoteException {\r
+        if (super.cachedEndpoint == null) {\r
+            throw new org.apache.axis.NoEndPointException();\r
+        }\r
+\r
+        org.apache.axis.client.Call _call = createCall();\r
+        _call.setOperation(_operations[2]);\r
+        _call.setUseSOAPAction(true);\r
+        _call.setSOAPActionURI("");\r
+        _call.setEncodingStyle(null);\r
+        _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR,\r
+            Boolean.FALSE);\r
+        _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS,\r
+            Boolean.FALSE);\r
+        _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);\r
+        _call.setOperationName(new javax.xml.namespace.QName("vamsas",\r
+                "getpredict"));\r
+\r
+        setRequestHeaders(_call);\r
+        setAttachments(_call);\r
+\r
+        java.lang.Object _resp = _call.invoke(new java.lang.Object[] { in0 });\r
+\r
+        if (_resp instanceof java.rmi.RemoteException) {\r
+            throw (java.rmi.RemoteException) _resp;\r
+        } else {\r
+            extractAttachments(_call);\r
+\r
+            try {\r
+                return (ext.vamsas.Secstructpred) _resp;\r
+            } catch (java.lang.Exception _exception) {\r
+                return (ext.vamsas.Secstructpred) org.apache.axis.utils.JavaUtils.convert(_resp,\r
+                    ext.vamsas.Secstructpred.class);\r
+            }\r
+        }\r
+    }\r
+\r
+    public ext.vamsas.JpredResult getresult(java.lang.String in0)\r
+        throws java.rmi.RemoteException {\r
+        if (super.cachedEndpoint == null) {\r
+            throw new org.apache.axis.NoEndPointException();\r
+        }\r
+\r
+        org.apache.axis.client.Call _call = createCall();\r
+        _call.setOperation(_operations[3]);\r
+        _call.setUseSOAPAction(true);\r
+        _call.setSOAPActionURI("");\r
+        _call.setEncodingStyle(null);\r
+        _call.setProperty(org.apache.axis.client.Call.SEND_TYPE_ATTR,\r
+            Boolean.FALSE);\r
+        _call.setProperty(org.apache.axis.AxisEngine.PROP_DOMULTIREFS,\r
+            Boolean.FALSE);\r
+        _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);\r
+        _call.setOperationName(new javax.xml.namespace.QName("vamsas",\r
+                "getresult"));\r
+\r
+        setRequestHeaders(_call);\r
+        setAttachments(_call);\r
+\r
+        java.lang.Object _resp = _call.invoke(new java.lang.Object[] { in0 });\r
+\r
+        if (_resp instanceof java.rmi.RemoteException) {\r
+            throw (java.rmi.RemoteException) _resp;\r
+        } else {\r
+            extractAttachments(_call);\r
+\r
+            try {\r
+                return (ext.vamsas.JpredResult) _resp;\r
+            } catch (java.lang.Exception _exception) {\r
+                return (ext.vamsas.JpredResult) org.apache.axis.utils.JavaUtils.convert(_resp,\r
+                    ext.vamsas.JpredResult.class);\r
+            }\r
+        }\r
+    }\r
+}\r
index d94e2b9..c9fbf85 100755 (executable)
@@ -3,8 +3,8 @@
  *
  * This file was auto-generated from WSDL
  * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter.
- */
-
+ */\r
+\r
 /*
 * Jalview - A Sequence Alignment Editor and Viewer
 * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
 * 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 ext.vamsas;
-
-public class Msfalignment  implements java.io.Serializable {
-    private java.lang.String msf;
-    private java.lang.String notes;
-
-    public Msfalignment() {
-    }
-
-    public Msfalignment(
-           java.lang.String msf,
-           java.lang.String notes) {
-           this.msf = msf;
-           this.notes = notes;
-    }
-
-
+*/\r
+package ext.vamsas;\r
+\r
+public class Msfalignment implements java.io.Serializable {\r
+    // Type metadata\r
+    private static org.apache.axis.description.TypeDesc typeDesc = new org.apache.axis.description.TypeDesc(Msfalignment.class,\r
+            true);\r
+\r
+    static {\r
+        typeDesc.setXmlType(new javax.xml.namespace.QName(\r
+                "http://dataTypes.vamsas", "Msfalignment"));\r
+\r
+        org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();\r
+        elemField.setFieldName("msf");\r
+        elemField.setXmlName(new javax.xml.namespace.QName(\r
+                "http://dataTypes.vamsas", "msf"));\r
+        elemField.setXmlType(new javax.xml.namespace.QName(\r
+                "http://www.w3.org/2001/XMLSchema", "string"));\r
+        typeDesc.addFieldDesc(elemField);\r
+        elemField = new org.apache.axis.description.ElementDesc();\r
+        elemField.setFieldName("notes");\r
+        elemField.setXmlName(new javax.xml.namespace.QName(\r
+                "http://dataTypes.vamsas", "notes"));\r
+        elemField.setXmlType(new javax.xml.namespace.QName(\r
+                "http://www.w3.org/2001/XMLSchema", "string"));\r
+        typeDesc.addFieldDesc(elemField);\r
+    }\r
+\r
+    private java.lang.String msf;\r
+    private java.lang.String notes;\r
+    private java.lang.Object __equalsCalc = null;\r
+    private boolean __hashCodeCalc = false;\r
+\r
+    public Msfalignment() {\r
+    }\r
+\r
+    public Msfalignment(java.lang.String msf, java.lang.String notes) {\r
+        this.msf = msf;\r
+        this.notes = notes;\r
+    }\r
+\r
     /**
-     * Gets the msf value for this Msfalignment.
-     *
-     * @return msf
-     */
-    public java.lang.String getMsf() {
-        return msf;
-    }
-
-
+ * Gets the msf value for this Msfalignment.
+ *
+ * @return msf
+ */\r
+    public java.lang.String getMsf() {\r
+        return msf;\r
+    }\r
+\r
     /**
-     * Sets the msf value for this Msfalignment.
-     *
-     * @param msf
-     */
-    public void setMsf(java.lang.String msf) {
-        this.msf = msf;
-    }
-
-
+ * Sets the msf value for this Msfalignment.
+ *
+ * @param msf
+ */\r
+    public void setMsf(java.lang.String msf) {\r
+        this.msf = msf;\r
+    }\r
+\r
     /**
-     * Gets the notes value for this Msfalignment.
-     *
-     * @return notes
-     */
-    public java.lang.String getNotes() {
-        return notes;
-    }
-
-
+ * Gets the notes value for this Msfalignment.
+ *
+ * @return notes
+ */\r
+    public java.lang.String getNotes() {\r
+        return notes;\r
+    }\r
+\r
     /**
-     * Sets the notes value for this Msfalignment.
-     *
-     * @param notes
-     */
-    public void setNotes(java.lang.String notes) {
-        this.notes = notes;
-    }
-
-    private java.lang.Object __equalsCalc = null;
-    public synchronized boolean equals(java.lang.Object obj) {
-        if (!(obj instanceof Msfalignment)) return false;
-        Msfalignment other = (Msfalignment) obj;
-        if (obj == null) return false;
-        if (this == obj) return true;
-        if (__equalsCalc != null) {
-            return (__equalsCalc == obj);
-        }
-        __equalsCalc = obj;
-        boolean _equals;
-        _equals = true &&
-            ((this.msf==null && other.getMsf()==null) ||
-             (this.msf!=null &&
-              this.msf.equals(other.getMsf()))) &&
-            ((this.notes==null && other.getNotes()==null) ||
-             (this.notes!=null &&
-              this.notes.equals(other.getNotes())));
-        __equalsCalc = null;
-        return _equals;
-    }
-
-    private boolean __hashCodeCalc = false;
-    public synchronized int hashCode() {
-        if (__hashCodeCalc) {
-            return 0;
-        }
-        __hashCodeCalc = true;
-        int _hashCode = 1;
-        if (getMsf() != null) {
-            _hashCode += getMsf().hashCode();
-        }
-        if (getNotes() != null) {
-            _hashCode += getNotes().hashCode();
-        }
-        __hashCodeCalc = false;
-        return _hashCode;
-    }
-
-    // Type metadata
-    private static org.apache.axis.description.TypeDesc typeDesc =
-        new org.apache.axis.description.TypeDesc(Msfalignment.class, true);
-
-    static {
-        typeDesc.setXmlType(new javax.xml.namespace.QName("http://dataTypes.vamsas", "Msfalignment"));
-        org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("msf");
-        elemField.setXmlName(new javax.xml.namespace.QName("http://dataTypes.vamsas", "msf"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("notes");
-        elemField.setXmlName(new javax.xml.namespace.QName("http://dataTypes.vamsas", "notes"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
-        typeDesc.addFieldDesc(elemField);
-    }
-
+ * Sets the notes value for this Msfalignment.
+ *
+ * @param notes
+ */\r
+    public void setNotes(java.lang.String notes) {\r
+        this.notes = notes;\r
+    }\r
+\r
+    public synchronized boolean equals(java.lang.Object obj) {\r
+        if (!(obj instanceof Msfalignment)) {\r
+            return false;\r
+        }\r
+\r
+        Msfalignment other = (Msfalignment) obj;\r
+\r
+        if (obj == null) {\r
+            return false;\r
+        }\r
+\r
+        if (this == obj) {\r
+            return true;\r
+        }\r
+\r
+        if (__equalsCalc != null) {\r
+            return (__equalsCalc == obj);\r
+        }\r
+\r
+        __equalsCalc = obj;\r
+\r
+        boolean _equals;\r
+        _equals = true &&\r
+            (((this.msf == null) && (other.getMsf() == null)) ||\r
+            ((this.msf != null) && this.msf.equals(other.getMsf()))) &&\r
+            (((this.notes == null) && (other.getNotes() == null)) ||\r
+            ((this.notes != null) && this.notes.equals(other.getNotes())));\r
+        __equalsCalc = null;\r
+\r
+        return _equals;\r
+    }\r
+\r
+    public synchronized int hashCode() {\r
+        if (__hashCodeCalc) {\r
+            return 0;\r
+        }\r
+\r
+        __hashCodeCalc = true;\r
+\r
+        int _hashCode = 1;\r
+\r
+        if (getMsf() != null) {\r
+            _hashCode += getMsf().hashCode();\r
+        }\r
+\r
+        if (getNotes() != null) {\r
+            _hashCode += getNotes().hashCode();\r
+        }\r
+\r
+        __hashCodeCalc = false;\r
+\r
+        return _hashCode;\r
+    }\r
+\r
     /**
-     * Return type metadata object
-     */
-    public static org.apache.axis.description.TypeDesc getTypeDesc() {
-        return typeDesc;
-    }
-
+ * Return type metadata object
+ */\r
+    public static org.apache.axis.description.TypeDesc getTypeDesc() {\r
+        return typeDesc;\r
+    }\r
+\r
     /**
-     * Get Custom Serializer
-     */
-    public static org.apache.axis.encoding.Serializer getSerializer(
-           java.lang.String mechType,
-           java.lang.Class _javaType,
-           javax.xml.namespace.QName _xmlType) {
-        return
-          new  org.apache.axis.encoding.ser.BeanSerializer(
-            _javaType, _xmlType, typeDesc);
-    }
-
+ * Get Custom Serializer
+ */\r
+    public static org.apache.axis.encoding.Serializer getSerializer(\r
+        java.lang.String mechType, java.lang.Class _javaType,\r
+        javax.xml.namespace.QName _xmlType) {\r
+        return new org.apache.axis.encoding.ser.BeanSerializer(_javaType,\r
+            _xmlType, typeDesc);\r
+    }\r
+\r
     /**
-     * Get Custom Deserializer
-     */
-    public static org.apache.axis.encoding.Deserializer getDeserializer(
-           java.lang.String mechType,
-           java.lang.Class _javaType,
-           javax.xml.namespace.QName _xmlType) {
-        return
-          new  org.apache.axis.encoding.ser.BeanDeserializer(
-            _javaType, _xmlType, typeDesc);
-    }
-
-}
+ * Get Custom Deserializer
+ */\r
+    public static org.apache.axis.encoding.Deserializer getDeserializer(\r
+        java.lang.String mechType, java.lang.Class _javaType,\r
+        javax.xml.namespace.QName _xmlType) {\r
+        return new org.apache.axis.encoding.ser.BeanDeserializer(_javaType,\r
+            _xmlType, typeDesc);\r
+    }\r
+}\r
index 37f851d..ffbe5cb 100755 (executable)
@@ -3,8 +3,8 @@
  *
  * This file was auto-generated from WSDL
  * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter.
- */
-
+ */\r
+\r
 /*
 * Jalview - A Sequence Alignment Editor and Viewer
 * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
 * 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 ext.vamsas;
-
-public interface MuscleWS extends java.rmi.Remote {
-    public vamsas.objects.simple.WsJobId align(vamsas.objects.simple.SequenceSet seqSet) throws java.rmi.RemoteException;
-    public vamsas.objects.simple.Alignment getalign(java.lang.String job_id) throws java.rmi.RemoteException;
-    public vamsas.objects.simple.MsaResult getResult(java.lang.String job_id) throws java.rmi.RemoteException;
-    public vamsas.objects.simple.WsJobId cancel(java.lang.String jobId) throws java.rmi.RemoteException;
-}
+*/\r
+package ext.vamsas;\r
+\r
+public interface MuscleWS extends java.rmi.Remote {\r
+    public vamsas.objects.simple.WsJobId align(\r
+        vamsas.objects.simple.SequenceSet seqSet)\r
+        throws java.rmi.RemoteException;\r
+\r
+    public vamsas.objects.simple.Alignment getalign(java.lang.String job_id)\r
+        throws java.rmi.RemoteException;\r
+\r
+    public vamsas.objects.simple.MsaResult getResult(java.lang.String job_id)\r
+        throws java.rmi.RemoteException;\r
+\r
+    public vamsas.objects.simple.WsJobId cancel(java.lang.String jobId)\r
+        throws java.rmi.RemoteException;\r
+}\r
index b1a41cc..ffc4abc 100755 (executable)
@@ -3,8 +3,8 @@
  *
  * This file was auto-generated from WSDL
  * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter.
- */
-
+ */\r
+\r
 /*
 * Jalview - A Sequence Alignment Editor and Viewer
 * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
 * 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 ext.vamsas;
-
-public interface MuscleWSService extends javax.xml.rpc.Service {
-    public java.lang.String getMuscleWSAddress();
-
-    public ext.vamsas.MuscleWS getMuscleWS() throws javax.xml.rpc.ServiceException;
-
-    public ext.vamsas.MuscleWS getMuscleWS(java.net.URL portAddress) throws javax.xml.rpc.ServiceException;
-}
+*/\r
+package ext.vamsas;\r
+\r
+public interface MuscleWSService extends javax.xml.rpc.Service {\r
+    public java.lang.String getMuscleWSAddress();\r
+\r
+    public ext.vamsas.MuscleWS getMuscleWS()\r
+        throws javax.xml.rpc.ServiceException;\r
+\r
+    public ext.vamsas.MuscleWS getMuscleWS(java.net.URL portAddress)\r
+        throws javax.xml.rpc.ServiceException;\r
+}\r
index fd906cd..96ef074 100755 (executable)
@@ -3,8 +3,8 @@
  *
  * This file was auto-generated from WSDL
  * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter.
- */
-
+ */\r
+\r
 /*
 * Jalview - A Sequence Alignment Editor and Viewer
 * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
 * 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 ext.vamsas;
-
-public class MuscleWSServiceLocator extends org.apache.axis.client.Service implements ext.vamsas.MuscleWSService {
-
-    public MuscleWSServiceLocator() {
-    }
-
-
-    public MuscleWSServiceLocator(org.apache.axis.EngineConfiguration config) {
-        super(config);
-    }
-
-    // Use to get a proxy class for MuscleWS
-    private java.lang.String MuscleWS_address = "http://anaplog.compbio.dundee.ac.uk:8080/axis/services/MuscleWS";
-
-    public java.lang.String getMuscleWSAddress() {
-        return MuscleWS_address;
-    }
-
-    // The WSDD service name defaults to the port name.
-    private java.lang.String MuscleWSWSDDServiceName = "MuscleWS";
-
-    public java.lang.String getMuscleWSWSDDServiceName() {
-        return MuscleWSWSDDServiceName;
-    }
-
-    public void setMuscleWSWSDDServiceName(java.lang.String name) {
-        MuscleWSWSDDServiceName = name;
-    }
-
-    public ext.vamsas.MuscleWS getMuscleWS() throws javax.xml.rpc.ServiceException {
-       java.net.URL endpoint;
-        try {
-            endpoint = new java.net.URL(MuscleWS_address);
-        }
-        catch (java.net.MalformedURLException e) {
-            throw new javax.xml.rpc.ServiceException(e);
-        }
-        return getMuscleWS(endpoint);
-    }
-
-    public ext.vamsas.MuscleWS getMuscleWS(java.net.URL portAddress) throws javax.xml.rpc.ServiceException {
-        try {
-            ext.vamsas.MuscleWSSoapBindingStub _stub = new ext.vamsas.MuscleWSSoapBindingStub(portAddress, this);
-            _stub.setPortName(getMuscleWSWSDDServiceName());
-            return _stub;
-        }
-        catch (org.apache.axis.AxisFault e) {
-            return null;
-        }
-    }
-
-    public void setMuscleWSEndpointAddress(java.lang.String address) {
-        MuscleWS_address = address;
-    }
-
+*/\r
+package ext.vamsas;\r
+\r
+public class MuscleWSServiceLocator extends org.apache.axis.client.Service\r
+    implements ext.vamsas.MuscleWSService {\r
+    // Use to get a proxy class for MuscleWS\r
+    private java.lang.String MuscleWS_address = "http://anaplog.compbio.dundee.ac.uk:8080/axis/services/MuscleWS";\r
+\r
+    // The WSDD service name defaults to the port name.\r
+    private java.lang.String MuscleWSWSDDServiceName = "MuscleWS";\r
+    private java.util.HashSet ports = null;\r
+\r
+    public MuscleWSServiceLocator() {\r
+    }\r
+\r
+    public MuscleWSServiceLocator(org.apache.axis.EngineConfiguration config) {\r
+        super(config);\r
+    }\r
+\r
+    public java.lang.String getMuscleWSAddress() {\r
+        return MuscleWS_address;\r
+    }\r
+\r
+    public java.lang.String getMuscleWSWSDDServiceName() {\r
+        return MuscleWSWSDDServiceName;\r
+    }\r
+\r
+    public void setMuscleWSWSDDServiceName(java.lang.String name) {\r
+        MuscleWSWSDDServiceName = name;\r
+    }\r
+\r
+    public ext.vamsas.MuscleWS getMuscleWS()\r
+        throws javax.xml.rpc.ServiceException {\r
+        java.net.URL endpoint;\r
+\r
+        try {\r
+            endpoint = new java.net.URL(MuscleWS_address);\r
+        } catch (java.net.MalformedURLException e) {\r
+            throw new javax.xml.rpc.ServiceException(e);\r
+        }\r
+\r
+        return getMuscleWS(endpoint);\r
+    }\r
+\r
+    public ext.vamsas.MuscleWS getMuscleWS(java.net.URL portAddress)\r
+        throws javax.xml.rpc.ServiceException {\r
+        try {\r
+            ext.vamsas.MuscleWSSoapBindingStub _stub = new ext.vamsas.MuscleWSSoapBindingStub(portAddress,\r
+                    this);\r
+            _stub.setPortName(getMuscleWSWSDDServiceName());\r
+\r
+            return _stub;\r
+        } catch (org.apache.axis.AxisFault e) {\r
+            return null;\r
+        }\r
+    }\r
+\r
+    public void setMuscleWSEndpointAddress(java.lang.String address) {\r
+        MuscleWS_address = address;\r
+    }\r
+\r
     /**
-     * For the given interface, get the stub implementation.
-     * If this service has no port for the given interface,
-     * then ServiceException is thrown.
-     */
-    public java.rmi.Remote getPort(Class serviceEndpointInterface) throws javax.xml.rpc.ServiceException {
-        try {
-            if (ext.vamsas.MuscleWS.class.isAssignableFrom(serviceEndpointInterface)) {
-                ext.vamsas.MuscleWSSoapBindingStub _stub = new ext.vamsas.MuscleWSSoapBindingStub(new java.net.URL(MuscleWS_address), this);
-                _stub.setPortName(getMuscleWSWSDDServiceName());
-                return _stub;
-            }
-        }
-        catch (java.lang.Throwable t) {
-            throw new javax.xml.rpc.ServiceException(t);
-        }
-        throw new javax.xml.rpc.ServiceException("There is no stub implementation for the interface:  " + (serviceEndpointInterface == null ? "null" : serviceEndpointInterface.getName()));
-    }
-
+ * For the given interface, get the stub implementation.
+ * If this service has no port for the given interface,
+ * then ServiceException is thrown.
+ */\r
+    public java.rmi.Remote getPort(Class serviceEndpointInterface)\r
+        throws javax.xml.rpc.ServiceException {\r
+        try {\r
+            if (ext.vamsas.MuscleWS.class.isAssignableFrom(\r
+                        serviceEndpointInterface)) {\r
+                ext.vamsas.MuscleWSSoapBindingStub _stub = new ext.vamsas.MuscleWSSoapBindingStub(new java.net.URL(\r
+                            MuscleWS_address), this);\r
+                _stub.setPortName(getMuscleWSWSDDServiceName());\r
+\r
+                return _stub;\r
+            }\r
+        } catch (java.lang.Throwable t) {\r
+            throw new javax.xml.rpc.ServiceException(t);\r
+        }\r
+\r
+        throw new javax.xml.rpc.ServiceException(\r
+            "There is no stub implementation for the interface:  " +\r
+            ((serviceEndpointInterface == null) ? "null"\r
+                                                : serviceEndpointInterface.getName()));\r
+    }\r
+\r
     /**
-     * For the given interface, get the stub implementation.
-     * If this service has no port for the given interface,
-     * then ServiceException is thrown.
-     */
-    public java.rmi.Remote getPort(javax.xml.namespace.QName portName, Class serviceEndpointInterface) throws javax.xml.rpc.ServiceException {
-        if (portName == null) {
-            return getPort(serviceEndpointInterface);
-        }
-        java.lang.String inputPortName = portName.getLocalPart();
-        if ("MuscleWS".equals(inputPortName)) {
-            return getMuscleWS();
-        }
-        else  {
-            java.rmi.Remote _stub = getPort(serviceEndpointInterface);
-            ((org.apache.axis.client.Stub) _stub).setPortName(portName);
-            return _stub;
-        }
-    }
-
-    public javax.xml.namespace.QName getServiceName() {
-        return new javax.xml.namespace.QName("vamsas", "MuscleWSService");
-    }
-
-    private java.util.HashSet ports = null;
-
-    public java.util.Iterator getPorts() {
-        if (ports == null) {
-            ports = new java.util.HashSet();
-            ports.add(new javax.xml.namespace.QName("vamsas", "MuscleWS"));
-        }
-        return ports.iterator();
-    }
-
+ * For the given interface, get the stub implementation.
+ * If this service has no port for the given interface,
+ * then ServiceException is thrown.
+ */\r
+    public java.rmi.Remote getPort(javax.xml.namespace.QName portName,\r
+        Class serviceEndpointInterface) throws javax.xml.rpc.ServiceException {\r
+        if (portName == null) {\r
+            return getPort(serviceEndpointInterface);\r
+        }\r
+\r
+        java.lang.String inputPortName = portName.getLocalPart();\r
+\r
+        if ("MuscleWS".equals(inputPortName)) {\r
+            return getMuscleWS();\r
+        } else {\r
+            java.rmi.Remote _stub = getPort(serviceEndpointInterface);\r
+            ((org.apache.axis.client.Stub) _stub).setPortName(portName);\r
+\r
+            return _stub;\r
+        }\r
+    }\r
+\r
+    public javax.xml.namespace.QName getServiceName() {\r
+        return new javax.xml.namespace.QName("vamsas", "MuscleWSService");\r
+    }\r
+\r
+    public java.util.Iterator getPorts() {\r
+        if (ports == null) {\r
+            ports = new java.util.HashSet();\r
+            ports.add(new javax.xml.namespace.QName("vamsas", "MuscleWS"));\r
+        }\r
+\r
+        return ports.iterator();\r
+    }\r
+\r
     /**
-    * Set the endpoint address for the specified port name.
-    */
-    public void setEndpointAddress(java.lang.String portName, java.lang.String address) throws javax.xml.rpc.ServiceException {
-        if ("MuscleWS".equals(portName)) {
-            setMuscleWSEndpointAddress(address);
-        }
-        else { // Unknown Port Name
-            throw new javax.xml.rpc.ServiceException(" Cannot set Endpoint Address for Unknown Port" + portName);
-        }
-    }
-
+* Set the endpoint address for the specified port name.
+*/\r
+    public void setEndpointAddress(java.lang.String portName,\r
+        java.lang.String address) throws javax.xml.rpc.ServiceException {\r
+        if ("MuscleWS".equals(portName)) {\r
+            setMuscleWSEndpointAddress(address);\r
+        } else { // Unknown Port Name\r
+            throw new javax.xml.rpc.ServiceException(\r
+                " Cannot set Endpoint Address for Unknown Port" + portName);\r
+        }\r
+    }\r
+\r
     /**
-    * Set the endpoint address for the specified port name.
-    */
-    public void setEndpointAddress(javax.xml.namespace.QName portName, java.lang.String address) throws javax.xml.rpc.ServiceException {
-        setEndpointAddress(portName.getLocalPart(), address);
-    }
-
-}
+* Set the endpoint address for the specified port name.
+*/\r
+    public void setEndpointAddress(javax.xml.namespace.QName portName,\r
+        java.lang.String address) throws javax.xml.rpc.ServiceException {\r
+        setEndpointAddress(portName.getLocalPart(), address);\r
+    }\r
+}\r
index b2739bd..35e2470 100755 (executable)
@@ -3,8 +3,8 @@
  *
  * This file was auto-generated from WSDL
  * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter.
- */
-
+ */\r
+\r
 /*
 * Jalview - A Sequence Alignment Editor and Viewer
 * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
 * 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 ext.vamsas;
-
-public class MuscleWSSoapBindingStub extends org.apache.axis.client.Stub implements ext.vamsas.MuscleWS {
-    private java.util.Vector cachedSerClasses = new java.util.Vector();
-    private java.util.Vector cachedSerQNames = new java.util.Vector();
-    private java.util.Vector cachedSerFactories = new java.util.Vector();
-    private java.util.Vector cachedDeserFactories = new java.util.Vector();
-
-    static org.apache.axis.description.OperationDesc [] _operations;
-
-    static {
-        _operations = new org.apache.axis.description.OperationDesc[4];
-        _initOperationDesc1();
-    }
-
-    private static void _initOperationDesc1(){
-        org.apache.axis.description.OperationDesc oper;
-        oper = new org.apache.axis.description.OperationDesc();
-        oper.setName("align");
-        oper.addParameter(new javax.xml.namespace.QName("", "seqSet"), new javax.xml.namespace.QName("simple.objects.vamsas", "SequenceSet"), vamsas.objects.simple.SequenceSet.class, org.apache.axis.description.ParameterDesc.IN, false, false);
-        oper.setReturnType(new javax.xml.namespace.QName("simple.objects.vamsas", "WsJobId"));
-        oper.setReturnClass(vamsas.objects.simple.WsJobId.class);
-        oper.setReturnQName(new javax.xml.namespace.QName("", "alignReturn"));
-        oper.setStyle(org.apache.axis.constants.Style.RPC);
-        oper.setUse(org.apache.axis.constants.Use.ENCODED);
-        _operations[0] = oper;
-
-        oper = new org.apache.axis.description.OperationDesc();
-        oper.setName("getalign");
-        oper.addParameter(new javax.xml.namespace.QName("", "job_id"), new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), java.lang.String.class, org.apache.axis.description.ParameterDesc.IN, false, false);
-        oper.setReturnType(new javax.xml.namespace.QName("simple.objects.vamsas", "Alignment"));
-        oper.setReturnClass(vamsas.objects.simple.Alignment.class);
-        oper.setReturnQName(new javax.xml.namespace.QName("", "getalignReturn"));
-        oper.setStyle(org.apache.axis.constants.Style.RPC);
-        oper.setUse(org.apache.axis.constants.Use.ENCODED);
-        _operations[1] = oper;
-
-        oper = new org.apache.axis.description.OperationDesc();
-        oper.setName("getResult");
-        oper.addParameter(new javax.xml.namespace.QName("", "job_id"), new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), java.lang.String.class, org.apache.axis.description.ParameterDesc.IN, false, false);
-        oper.setReturnType(new javax.xml.namespace.QName("simple.objects.vamsas", "MsaResult"));
-        oper.setReturnClass(vamsas.objects.simple.MsaResult.class);
-        oper.setReturnQName(new javax.xml.namespace.QName("", "getResultReturn"));
-        oper.setStyle(org.apache.axis.constants.Style.RPC);
-        oper.setUse(org.apache.axis.constants.Use.ENCODED);
-        _operations[2] = oper;
-
-        oper = new org.apache.axis.description.OperationDesc();
-        oper.setName("cancel");
-        oper.addParameter(new javax.xml.namespace.QName("", "jobId"), new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), java.lang.String.class, org.apache.axis.description.ParameterDesc.IN, false, false);
-        oper.setReturnType(new javax.xml.namespace.QName("simple.objects.vamsas", "WsJobId"));
-        oper.setReturnClass(vamsas.objects.simple.WsJobId.class);
-        oper.setReturnQName(new javax.xml.namespace.QName("", "cancelReturn"));
-        oper.setStyle(org.apache.axis.constants.Style.RPC);
-        oper.setUse(org.apache.axis.constants.Use.ENCODED);
-        _operations[3] = oper;
-
-    }
-
-    public MuscleWSSoapBindingStub() throws org.apache.axis.AxisFault {
-         this(null);
-    }
-
-    public MuscleWSSoapBindingStub(java.net.URL endpointURL, javax.xml.rpc.Service service) throws org.apache.axis.AxisFault {
-         this(service);
-         super.cachedEndpoint = endpointURL;
-    }
-
-    public MuscleWSSoapBindingStub(javax.xml.rpc.Service service) throws org.apache.axis.AxisFault {
-        if (service == null) {
-            super.service = new org.apache.axis.client.Service();
-        } else {
-            super.service = service;
-        }
-            java.lang.Class cls;
-            javax.xml.namespace.QName qName;
-            java.lang.Class beansf = org.apache.axis.encoding.ser.BeanSerializerFactory.class;
-            java.lang.Class beandf = org.apache.axis.encoding.ser.BeanDeserializerFactory.class;
-            java.lang.Class enumsf = org.apache.axis.encoding.ser.EnumSerializerFactory.class;
-            java.lang.Class enumdf = org.apache.axis.encoding.ser.EnumDeserializerFactory.class;
-            java.lang.Class arraysf = org.apache.axis.encoding.ser.ArraySerializerFactory.class;
-            java.lang.Class arraydf = org.apache.axis.encoding.ser.ArrayDeserializerFactory.class;
-            java.lang.Class simplesf = org.apache.axis.encoding.ser.SimpleSerializerFactory.class;
-            java.lang.Class simpledf = org.apache.axis.encoding.ser.SimpleDeserializerFactory.class;
-            java.lang.Class simplelistsf = org.apache.axis.encoding.ser.SimpleListSerializerFactory.class;
-            java.lang.Class simplelistdf = org.apache.axis.encoding.ser.SimpleListDeserializerFactory.class;
-            qName = new javax.xml.namespace.QName("simple.objects.vamsas", "Sequence");
-            cachedSerQNames.add(qName);
-            cls = vamsas.objects.simple.Sequence.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("vamsas", "ArrayOf_tns1_Sequence");
-            cachedSerQNames.add(qName);
-            cls = vamsas.objects.simple.Sequence[].class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(arraysf);
-            cachedDeserFactories.add(arraydf);
-
-            qName = new javax.xml.namespace.QName("simple.objects.vamsas", "MsaResult");
-            cachedSerQNames.add(qName);
-            cls = vamsas.objects.simple.MsaResult.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("simple.objects.vamsas", "SequenceSet");
-            cachedSerQNames.add(qName);
-            cls = vamsas.objects.simple.SequenceSet.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("http://simple.objects.vamsas", "Object");
-            cachedSerQNames.add(qName);
-            cls = vamsas.objects.simple.Object.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("simple.objects.vamsas", "Alignment");
-            cachedSerQNames.add(qName);
-            cls = vamsas.objects.simple.Alignment.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("simple.objects.vamsas", "WsJobId");
-            cachedSerQNames.add(qName);
-            cls = vamsas.objects.simple.WsJobId.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-            qName = new javax.xml.namespace.QName("vamsas", "ArrayOf_xsd_string");
-            cachedSerQNames.add(qName);
-            cls = java.lang.String[].class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(arraysf);
-            cachedDeserFactories.add(arraydf);
-
-            qName = new javax.xml.namespace.QName("simple.objects.vamsas", "Result");
-            cachedSerQNames.add(qName);
-            cls = vamsas.objects.simple.Result.class;
-            cachedSerClasses.add(cls);
-            cachedSerFactories.add(beansf);
-            cachedDeserFactories.add(beandf);
-
-    }
-
-    protected org.apache.axis.client.Call createCall() throws java.rmi.RemoteException {
-        try {
-            org.apache.axis.client.Call _call =
-                    (org.apache.axis.client.Call) super.service.createCall();
-            if (super.maintainSessionSet) {
-                _call.setMaintainSession(super.maintainSession);
-            }
-            if (super.cachedUsername != null) {
-                _call.setUsername(super.cachedUsername);
-            }
-            if (super.cachedPassword != null) {
-                _call.setPassword(super.cachedPassword);
-            }
-            if (super.cachedEndpoint != null) {
-                _call.setTargetEndpointAddress(super.cachedEndpoint);
-            }
-            if (super.cachedTimeout != null) {
-                _call.setTimeout(super.cachedTimeout);
-            }
-            if (super.cachedPortName != null) {
-                _call.setPortName(super.cachedPortName);
-            }
-            java.util.Enumeration keys = super.cachedProperties.keys();
-            while (keys.hasMoreElements()) {
-                java.lang.String key = (java.lang.String) keys.nextElement();
-                _call.setProperty(key, super.cachedProperties.get(key));
-            }
-            // All the type mapping information is registered
-            // when the first call is made.
-            // The type mapping information is actually registered in
-            // the TypeMappingRegistry of the service, which
-            // is the reason why registration is only needed for the first call.
-            synchronized (this) {
-                if (firstCall()) {
-                    // must set encoding style before registering serializers
-                    _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
-                    _call.setEncodingStyle(org.apache.axis.Constants.URI_SOAP11_ENC);
-                    for (int i = 0; i < cachedSerFactories.size(); ++i) {
-                        java.lang.Class cls = (java.lang.Class) cachedSerClasses.get(i);
-                        javax.xml.namespace.QName qName =
-                                (javax.xml.namespace.QName) cachedSerQNames.get(i);
-                        java.lang.Class sf = (java.lang.Class)
-                                 cachedSerFactories.get(i);
-                        java.lang.Class df = (java.lang.Class)
-                                 cachedDeserFactories.get(i);
-                        _call.registerTypeMapping(cls, qName, sf, df, false);
-                    }
-                }
-            }
-            return _call;
-        }
-        catch (java.lang.Throwable _t) {
-            throw new org.apache.axis.AxisFault("Failure trying to get the Call object", _t);
-        }
-    }
-
-    public vamsas.objects.simple.WsJobId align(vamsas.objects.simple.SequenceSet seqSet) throws java.rmi.RemoteException {
-        if (super.cachedEndpoint == null) {
-            throw new org.apache.axis.NoEndPointException();
-        }
-        org.apache.axis.client.Call _call = createCall();
-        _call.setOperation(_operations[0]);
-        _call.setUseSOAPAction(true);
-        _call.setSOAPActionURI("");
-        _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
-        _call.setOperationName(new javax.xml.namespace.QName("vamsas", "align"));
-
-        setRequestHeaders(_call);
-        setAttachments(_call);
-        java.lang.Object _resp = _call.invoke(new java.lang.Object[] {seqSet});
-
-        if (_resp instanceof java.rmi.RemoteException) {
-            throw (java.rmi.RemoteException)_resp;
-        }
-        else {
-            extractAttachments(_call);
-            try {
-                return (vamsas.objects.simple.WsJobId) _resp;
-            } catch (java.lang.Exception _exception) {
-                return (vamsas.objects.simple.WsJobId) org.apache.axis.utils.JavaUtils.convert(_resp, vamsas.objects.simple.WsJobId.class);
-            }
-        }
-    }
-
-    public vamsas.objects.simple.Alignment getalign(java.lang.String job_id) throws java.rmi.RemoteException {
-        if (super.cachedEndpoint == null) {
-            throw new org.apache.axis.NoEndPointException();
-        }
-        org.apache.axis.client.Call _call = createCall();
-        _call.setOperation(_operations[1]);
-        _call.setUseSOAPAction(true);
-        _call.setSOAPActionURI("");
-        _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
-        _call.setOperationName(new javax.xml.namespace.QName("vamsas", "getalign"));
-
-        setRequestHeaders(_call);
-        setAttachments(_call);
-        java.lang.Object _resp = _call.invoke(new java.lang.Object[] {job_id});
-
-        if (_resp instanceof java.rmi.RemoteException) {
-            throw (java.rmi.RemoteException)_resp;
-        }
-        else {
-            extractAttachments(_call);
-            try {
-                return (vamsas.objects.simple.Alignment) _resp;
-            } catch (java.lang.Exception _exception) {
-                return (vamsas.objects.simple.Alignment) org.apache.axis.utils.JavaUtils.convert(_resp, vamsas.objects.simple.Alignment.class);
-            }
-        }
-    }
-
-    public vamsas.objects.simple.MsaResult getResult(java.lang.String job_id) throws java.rmi.RemoteException {
-        if (super.cachedEndpoint == null) {
-            throw new org.apache.axis.NoEndPointException();
-        }
-        org.apache.axis.client.Call _call = createCall();
-        _call.setOperation(_operations[2]);
-        _call.setUseSOAPAction(true);
-        _call.setSOAPActionURI("");
-        _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
-        _call.setOperationName(new javax.xml.namespace.QName("vamsas", "getResult"));
-
-        setRequestHeaders(_call);
-        setAttachments(_call);
-        java.lang.Object _resp = _call.invoke(new java.lang.Object[] {job_id});
-
-        if (_resp instanceof java.rmi.RemoteException) {
-            throw (java.rmi.RemoteException)_resp;
-        }
-        else {
-            extractAttachments(_call);
-            try {
-                return (vamsas.objects.simple.MsaResult) _resp;
-            } catch (java.lang.Exception _exception) {
-                return (vamsas.objects.simple.MsaResult) org.apache.axis.utils.JavaUtils.convert(_resp, vamsas.objects.simple.MsaResult.class);
-            }
-        }
-    }
-
-    public vamsas.objects.simple.WsJobId cancel(java.lang.String jobId) throws java.rmi.RemoteException {
-        if (super.cachedEndpoint == null) {
-            throw new org.apache.axis.NoEndPointException();
-        }
-        org.apache.axis.client.Call _call = createCall();
-        _call.setOperation(_operations[3]);
-        _call.setUseSOAPAction(true);
-        _call.setSOAPActionURI("");
-        _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);
-        _call.setOperationName(new javax.xml.namespace.QName("vamsas", "cancel"));
-
-        setRequestHeaders(_call);
-        setAttachments(_call);
-        java.lang.Object _resp = _call.invoke(new java.lang.Object[] {jobId});
-
-        if (_resp instanceof java.rmi.RemoteException) {
-            throw (java.rmi.RemoteException)_resp;
-        }
-        else {
-            extractAttachments(_call);
-            try {
-                return (vamsas.objects.simple.WsJobId) _resp;
-            } catch (java.lang.Exception _exception) {
-                return (vamsas.objects.simple.WsJobId) org.apache.axis.utils.JavaUtils.convert(_resp, vamsas.objects.simple.WsJobId.class);
-            }
-        }
-    }
-
-}
+*/\r
+package ext.vamsas;\r
+\r
+public class MuscleWSSoapBindingStub extends org.apache.axis.client.Stub\r
+    implements ext.vamsas.MuscleWS {\r
+    static org.apache.axis.description.OperationDesc[] _operations;\r
+\r
+    static {\r
+        _operations = new org.apache.axis.description.OperationDesc[4];\r
+        _initOperationDesc1();\r
+    }\r
+\r
+    private java.util.Vector cachedSerClasses = new java.util.Vector();\r
+    private java.util.Vector cachedSerQNames = new java.util.Vector();\r
+    private java.util.Vector cachedSerFactories = new java.util.Vector();\r
+    private java.util.Vector cachedDeserFactories = new java.util.Vector();\r
+\r
+    public MuscleWSSoapBindingStub() throws org.apache.axis.AxisFault {\r
+        this(null);\r
+    }\r
+\r
+    public MuscleWSSoapBindingStub(java.net.URL endpointURL,\r
+        javax.xml.rpc.Service service) throws org.apache.axis.AxisFault {\r
+        this(service);\r
+        super.cachedEndpoint = endpointURL;\r
+    }\r
+\r
+    public MuscleWSSoapBindingStub(javax.xml.rpc.Service service)\r
+        throws org.apache.axis.AxisFault {\r
+        if (service == null) {\r
+            super.service = new org.apache.axis.client.Service();\r
+        } else {\r
+            super.service = service;\r
+        }\r
+\r
+        java.lang.Class cls;\r
+        javax.xml.namespace.QName qName;\r
+        java.lang.Class beansf = org.apache.axis.encoding.ser.BeanSerializerFactory.class;\r
+        java.lang.Class beandf = org.apache.axis.encoding.ser.BeanDeserializerFactory.class;\r
+        java.lang.Class enumsf = org.apache.axis.encoding.ser.EnumSerializerFactory.class;\r
+        java.lang.Class enumdf = org.apache.axis.encoding.ser.EnumDeserializerFactory.class;\r
+        java.lang.Class arraysf = org.apache.axis.encoding.ser.ArraySerializerFactory.class;\r
+        java.lang.Class arraydf = org.apache.axis.encoding.ser.ArrayDeserializerFactory.class;\r
+        java.lang.Class simplesf = org.apache.axis.encoding.ser.SimpleSerializerFactory.class;\r
+        java.lang.Class simpledf = org.apache.axis.encoding.ser.SimpleDeserializerFactory.class;\r
+        java.lang.Class simplelistsf = org.apache.axis.encoding.ser.SimpleListSerializerFactory.class;\r
+        java.lang.Class simplelistdf = org.apache.axis.encoding.ser.SimpleListDeserializerFactory.class;\r
+        qName = new javax.xml.namespace.QName("simple.objects.vamsas",\r
+                "Sequence");\r
+        cachedSerQNames.add(qName);\r
+        cls = vamsas.objects.simple.Sequence.class;\r
+        cachedSerClasses.add(cls);\r
+        cachedSerFactories.add(beansf);\r
+        cachedDeserFactories.add(beandf);\r
+\r
+        qName = new javax.xml.namespace.QName("vamsas", "ArrayOf_tns1_Sequence");\r
+        cachedSerQNames.add(qName);\r
+        cls = vamsas.objects.simple.Sequence[].class;\r
+        cachedSerClasses.add(cls);\r
+        cachedSerFactories.add(arraysf);\r
+        cachedDeserFactories.add(arraydf);\r
+\r
+        qName = new javax.xml.namespace.QName("simple.objects.vamsas",\r
+                "MsaResult");\r
+        cachedSerQNames.add(qName);\r
+        cls = vamsas.objects.simple.MsaResult.class;\r
+        cachedSerClasses.add(cls);\r
+        cachedSerFactories.add(beansf);\r
+        cachedDeserFactories.add(beandf);\r
+\r
+        qName = new javax.xml.namespace.QName("simple.objects.vamsas",\r
+                "SequenceSet");\r
+        cachedSerQNames.add(qName);\r
+        cls = vamsas.objects.simple.SequenceSet.class;\r
+        cachedSerClasses.add(cls);\r
+        cachedSerFactories.add(beansf);\r
+        cachedDeserFactories.add(beandf);\r
+\r
+        qName = new javax.xml.namespace.QName("http://simple.objects.vamsas",\r
+                "Object");\r
+        cachedSerQNames.add(qName);\r
+        cls = vamsas.objects.simple.Object.class;\r
+        cachedSerClasses.add(cls);\r
+        cachedSerFactories.add(beansf);\r
+        cachedDeserFactories.add(beandf);\r
+\r
+        qName = new javax.xml.namespace.QName("simple.objects.vamsas",\r
+                "Alignment");\r
+        cachedSerQNames.add(qName);\r
+        cls = vamsas.objects.simple.Alignment.class;\r
+        cachedSerClasses.add(cls);\r
+        cachedSerFactories.add(beansf);\r
+        cachedDeserFactories.add(beandf);\r
+\r
+        qName = new javax.xml.namespace.QName("simple.objects.vamsas", "WsJobId");\r
+        cachedSerQNames.add(qName);\r
+        cls = vamsas.objects.simple.WsJobId.class;\r
+        cachedSerClasses.add(cls);\r
+        cachedSerFactories.add(beansf);\r
+        cachedDeserFactories.add(beandf);\r
+\r
+        qName = new javax.xml.namespace.QName("vamsas", "ArrayOf_xsd_string");\r
+        cachedSerQNames.add(qName);\r
+        cls = java.lang.String[].class;\r
+        cachedSerClasses.add(cls);\r
+        cachedSerFactories.add(arraysf);\r
+        cachedDeserFactories.add(arraydf);\r
+\r
+        qName = new javax.xml.namespace.QName("simple.objects.vamsas", "Result");\r
+        cachedSerQNames.add(qName);\r
+        cls = vamsas.objects.simple.Result.class;\r
+        cachedSerClasses.add(cls);\r
+        cachedSerFactories.add(beansf);\r
+        cachedDeserFactories.add(beandf);\r
+    }\r
+\r
+    private static void _initOperationDesc1() {\r
+        org.apache.axis.description.OperationDesc oper;\r
+        oper = new org.apache.axis.description.OperationDesc();\r
+        oper.setName("align");\r
+        oper.addParameter(new javax.xml.namespace.QName("", "seqSet"),\r
+            new javax.xml.namespace.QName("simple.objects.vamsas", "SequenceSet"),\r
+            vamsas.objects.simple.SequenceSet.class,\r
+            org.apache.axis.description.ParameterDesc.IN, false, false);\r
+        oper.setReturnType(new javax.xml.namespace.QName(\r
+                "simple.objects.vamsas", "WsJobId"));\r
+        oper.setReturnClass(vamsas.objects.simple.WsJobId.class);\r
+        oper.setReturnQName(new javax.xml.namespace.QName("", "alignReturn"));\r
+        oper.setStyle(org.apache.axis.constants.Style.RPC);\r
+        oper.setUse(org.apache.axis.constants.Use.ENCODED);\r
+        _operations[0] = oper;\r
+\r
+        oper = new org.apache.axis.description.OperationDesc();\r
+        oper.setName("getalign");\r
+        oper.addParameter(new javax.xml.namespace.QName("", "job_id"),\r
+            new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema",\r
+                "string"), java.lang.String.class,\r
+            org.apache.axis.description.ParameterDesc.IN, false, false);\r
+        oper.setReturnType(new javax.xml.namespace.QName(\r
+                "simple.objects.vamsas", "Alignment"));\r
+        oper.setReturnClass(vamsas.objects.simple.Alignment.class);\r
+        oper.setReturnQName(new javax.xml.namespace.QName("", "getalignReturn"));\r
+        oper.setStyle(org.apache.axis.constants.Style.RPC);\r
+        oper.setUse(org.apache.axis.constants.Use.ENCODED);\r
+        _operations[1] = oper;\r
+\r
+        oper = new org.apache.axis.description.OperationDesc();\r
+        oper.setName("getResult");\r
+        oper.addParameter(new javax.xml.namespace.QName("", "job_id"),\r
+            new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema",\r
+                "string"), java.lang.String.class,\r
+            org.apache.axis.description.ParameterDesc.IN, false, false);\r
+        oper.setReturnType(new javax.xml.namespace.QName(\r
+                "simple.objects.vamsas", "MsaResult"));\r
+        oper.setReturnClass(vamsas.objects.simple.MsaResult.class);\r
+        oper.setReturnQName(new javax.xml.namespace.QName("", "getResultReturn"));\r
+        oper.setStyle(org.apache.axis.constants.Style.RPC);\r
+        oper.setUse(org.apache.axis.constants.Use.ENCODED);\r
+        _operations[2] = oper;\r
+\r
+        oper = new org.apache.axis.description.OperationDesc();\r
+        oper.setName("cancel");\r
+        oper.addParameter(new javax.xml.namespace.QName("", "jobId"),\r
+            new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema",\r
+                "string"), java.lang.String.class,\r
+            org.apache.axis.description.ParameterDesc.IN, false, false);\r
+        oper.setReturnType(new javax.xml.namespace.QName(\r
+                "simple.objects.vamsas", "WsJobId"));\r
+        oper.setReturnClass(vamsas.objects.simple.WsJobId.class);\r
+        oper.setReturnQName(new javax.xml.namespace.QName("", "cancelReturn"));\r
+        oper.setStyle(org.apache.axis.constants.Style.RPC);\r
+        oper.setUse(org.apache.axis.constants.Use.ENCODED);\r
+        _operations[3] = oper;\r
+    }\r
+\r
+    protected org.apache.axis.client.Call createCall()\r
+        throws java.rmi.RemoteException {\r
+        try {\r
+            org.apache.axis.client.Call _call = (org.apache.axis.client.Call) super.service.createCall();\r
+\r
+            if (super.maintainSessionSet) {\r
+                _call.setMaintainSession(super.maintainSession);\r
+            }\r
+\r
+            if (super.cachedUsername != null) {\r
+                _call.setUsername(super.cachedUsername);\r
+            }\r
+\r
+            if (super.cachedPassword != null) {\r
+                _call.setPassword(super.cachedPassword);\r
+            }\r
+\r
+            if (super.cachedEndpoint != null) {\r
+                _call.setTargetEndpointAddress(super.cachedEndpoint);\r
+            }\r
+\r
+            if (super.cachedTimeout != null) {\r
+                _call.setTimeout(super.cachedTimeout);\r
+            }\r
+\r
+            if (super.cachedPortName != null) {\r
+                _call.setPortName(super.cachedPortName);\r
+            }\r
+\r
+            java.util.Enumeration keys = super.cachedProperties.keys();\r
+\r
+            while (keys.hasMoreElements()) {\r
+                java.lang.String key = (java.lang.String) keys.nextElement();\r
+                _call.setProperty(key, super.cachedProperties.get(key));\r
+            }\r
+\r
+            // All the type mapping information is registered\r
+            // when the first call is made.\r
+            // The type mapping information is actually registered in\r
+            // the TypeMappingRegistry of the service, which\r
+            // is the reason why registration is only needed for the first call.\r
+            synchronized (this) {\r
+                if (firstCall()) {\r
+                    // must set encoding style before registering serializers\r
+                    _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);\r
+                    _call.setEncodingStyle(org.apache.axis.Constants.URI_SOAP11_ENC);\r
+\r
+                    for (int i = 0; i < cachedSerFactories.size(); ++i) {\r
+                        java.lang.Class cls = (java.lang.Class) cachedSerClasses.get(i);\r
+                        javax.xml.namespace.QName qName = (javax.xml.namespace.QName) cachedSerQNames.get(i);\r
+                        java.lang.Class sf = (java.lang.Class) cachedSerFactories.get(i);\r
+                        java.lang.Class df = (java.lang.Class) cachedDeserFactories.get(i);\r
+                        _call.registerTypeMapping(cls, qName, sf, df, false);\r
+                    }\r
+                }\r
+            }\r
+\r
+            return _call;\r
+        } catch (java.lang.Throwable _t) {\r
+            throw new org.apache.axis.AxisFault("Failure trying to get the Call object",\r
+                _t);\r
+        }\r
+    }\r
+\r
+    public vamsas.objects.simple.WsJobId align(\r
+        vamsas.objects.simple.SequenceSet seqSet)\r
+        throws java.rmi.RemoteException {\r
+        if (super.cachedEndpoint == null) {\r
+            throw new org.apache.axis.NoEndPointException();\r
+        }\r
+\r
+        org.apache.axis.client.Call _call = createCall();\r
+        _call.setOperation(_operations[0]);\r
+        _call.setUseSOAPAction(true);\r
+        _call.setSOAPActionURI("");\r
+        _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);\r
+        _call.setOperationName(new javax.xml.namespace.QName("vamsas", "align"));\r
+\r
+        setRequestHeaders(_call);\r
+        setAttachments(_call);\r
+\r
+        java.lang.Object _resp = _call.invoke(new java.lang.Object[] { seqSet });\r
+\r
+        if (_resp instanceof java.rmi.RemoteException) {\r
+            throw (java.rmi.RemoteException) _resp;\r
+        } else {\r
+            extractAttachments(_call);\r
+\r
+            try {\r
+                return (vamsas.objects.simple.WsJobId) _resp;\r
+            } catch (java.lang.Exception _exception) {\r
+                return (vamsas.objects.simple.WsJobId) org.apache.axis.utils.JavaUtils.convert(_resp,\r
+                    vamsas.objects.simple.WsJobId.class);\r
+            }\r
+        }\r
+    }\r
+\r
+    public vamsas.objects.simple.Alignment getalign(java.lang.String job_id)\r
+        throws java.rmi.RemoteException {\r
+        if (super.cachedEndpoint == null) {\r
+            throw new org.apache.axis.NoEndPointException();\r
+        }\r
+\r
+        org.apache.axis.client.Call _call = createCall();\r
+        _call.setOperation(_operations[1]);\r
+        _call.setUseSOAPAction(true);\r
+        _call.setSOAPActionURI("");\r
+        _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);\r
+        _call.setOperationName(new javax.xml.namespace.QName("vamsas",\r
+                "getalign"));\r
+\r
+        setRequestHeaders(_call);\r
+        setAttachments(_call);\r
+\r
+        java.lang.Object _resp = _call.invoke(new java.lang.Object[] { job_id });\r
+\r
+        if (_resp instanceof java.rmi.RemoteException) {\r
+            throw (java.rmi.RemoteException) _resp;\r
+        } else {\r
+            extractAttachments(_call);\r
+\r
+            try {\r
+                return (vamsas.objects.simple.Alignment) _resp;\r
+            } catch (java.lang.Exception _exception) {\r
+                return (vamsas.objects.simple.Alignment) org.apache.axis.utils.JavaUtils.convert(_resp,\r
+                    vamsas.objects.simple.Alignment.class);\r
+            }\r
+        }\r
+    }\r
+\r
+    public vamsas.objects.simple.MsaResult getResult(java.lang.String job_id)\r
+        throws java.rmi.RemoteException {\r
+        if (super.cachedEndpoint == null) {\r
+            throw new org.apache.axis.NoEndPointException();\r
+        }\r
+\r
+        org.apache.axis.client.Call _call = createCall();\r
+        _call.setOperation(_operations[2]);\r
+        _call.setUseSOAPAction(true);\r
+        _call.setSOAPActionURI("");\r
+        _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);\r
+        _call.setOperationName(new javax.xml.namespace.QName("vamsas",\r
+                "getResult"));\r
+\r
+        setRequestHeaders(_call);\r
+        setAttachments(_call);\r
+\r
+        java.lang.Object _resp = _call.invoke(new java.lang.Object[] { job_id });\r
+\r
+        if (_resp instanceof java.rmi.RemoteException) {\r
+            throw (java.rmi.RemoteException) _resp;\r
+        } else {\r
+            extractAttachments(_call);\r
+\r
+            try {\r
+                return (vamsas.objects.simple.MsaResult) _resp;\r
+            } catch (java.lang.Exception _exception) {\r
+                return (vamsas.objects.simple.MsaResult) org.apache.axis.utils.JavaUtils.convert(_resp,\r
+                    vamsas.objects.simple.MsaResult.class);\r
+            }\r
+        }\r
+    }\r
+\r
+    public vamsas.objects.simple.WsJobId cancel(java.lang.String jobId)\r
+        throws java.rmi.RemoteException {\r
+        if (super.cachedEndpoint == null) {\r
+            throw new org.apache.axis.NoEndPointException();\r
+        }\r
+\r
+        org.apache.axis.client.Call _call = createCall();\r
+        _call.setOperation(_operations[3]);\r
+        _call.setUseSOAPAction(true);\r
+        _call.setSOAPActionURI("");\r
+        _call.setSOAPVersion(org.apache.axis.soap.SOAPConstants.SOAP11_CONSTANTS);\r
+        _call.setOperationName(new javax.xml.namespace.QName("vamsas", "cancel"));\r
+\r
+        setRequestHeaders(_call);\r
+        setAttachments(_call);\r
+\r
+        java.lang.Object _resp = _call.invoke(new java.lang.Object[] { jobId });\r
+\r
+        if (_resp instanceof java.rmi.RemoteException) {\r
+            throw (java.rmi.RemoteException) _resp;\r
+        } else {\r
+            extractAttachments(_call);\r
+\r
+            try {\r
+                return (vamsas.objects.simple.WsJobId) _resp;\r
+            } catch (java.lang.Exception _exception) {\r
+                return (vamsas.objects.simple.WsJobId) org.apache.axis.utils.JavaUtils.convert(_resp,\r
+                    vamsas.objects.simple.WsJobId.class);\r
+            }\r
+        }\r
+    }\r
+}\r
index 97d766b..3115fd1 100755 (executable)
@@ -3,8 +3,8 @@
  *
  * This file was auto-generated from WSDL
  * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter.
- */
-
+ */\r
+\r
 /*
 * Jalview - A Sequence Alignment Editor and Viewer
 * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
 * 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 ext.vamsas;
-
-public class Result  implements java.io.Serializable {
-    private boolean broken;
-    private boolean failed;
-    private boolean finished;
-    private boolean invalid;
-    private boolean jobFailed;
-    private boolean queued;
-    private boolean running;
-    private boolean serverError;
-    private int state;
-    private java.lang.String status;
-    private boolean suspended;
-
-    public Result() {
-    }
-
-    public Result(
-           boolean broken,
-           boolean failed,
-           boolean finished,
-           boolean invalid,
-           boolean jobFailed,
-           boolean queued,
-           boolean running,
-           boolean serverError,
-           int state,
-           java.lang.String status,
-           boolean suspended) {
-           this.broken = broken;
-           this.failed = failed;
-           this.finished = finished;
-           this.invalid = invalid;
-           this.jobFailed = jobFailed;
-           this.queued = queued;
-           this.running = running;
-           this.serverError = serverError;
-           this.state = state;
-           this.status = status;
-           this.suspended = suspended;
-    }
-
-
+*/\r
+package ext.vamsas;\r
+\r
+public class Result implements java.io.Serializable {\r
+    // Type metadata\r
+    private static org.apache.axis.description.TypeDesc typeDesc = new org.apache.axis.description.TypeDesc(Result.class,\r
+            true);\r
+\r
+    static {\r
+        typeDesc.setXmlType(new javax.xml.namespace.QName(\r
+                "http://dataTypes.vamsas", "Result"));\r
+\r
+        org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();\r
+        elemField.setFieldName("broken");\r
+        elemField.setXmlName(new javax.xml.namespace.QName(\r
+                "http://dataTypes.vamsas", "broken"));\r
+        elemField.setXmlType(new javax.xml.namespace.QName(\r
+                "http://www.w3.org/2001/XMLSchema", "boolean"));\r
+        typeDesc.addFieldDesc(elemField);\r
+        elemField = new org.apache.axis.description.ElementDesc();\r
+        elemField.setFieldName("failed");\r
+        elemField.setXmlName(new javax.xml.namespace.QName(\r
+                "http://dataTypes.vamsas", "failed"));\r
+        elemField.setXmlType(new javax.xml.namespace.QName(\r
+                "http://www.w3.org/2001/XMLSchema", "boolean"));\r
+        typeDesc.addFieldDesc(elemField);\r
+        elemField = new org.apache.axis.description.ElementDesc();\r
+        elemField.setFieldName("finished");\r
+        elemField.setXmlName(new javax.xml.namespace.QName(\r
+                "http://dataTypes.vamsas", "finished"));\r
+        elemField.setXmlType(new javax.xml.namespace.QName(\r
+                "http://www.w3.org/2001/XMLSchema", "boolean"));\r
+        typeDesc.addFieldDesc(elemField);\r
+        elemField = new org.apache.axis.description.ElementDesc();\r
+        elemField.setFieldName("invalid");\r
+        elemField.setXmlName(new javax.xml.namespace.QName(\r
+                "http://dataTypes.vamsas", "invalid"));\r
+        elemField.setXmlType(new javax.xml.namespace.QName(\r
+                "http://www.w3.org/2001/XMLSchema", "boolean"));\r
+        typeDesc.addFieldDesc(elemField);\r
+        elemField = new org.apache.axis.description.ElementDesc();\r
+        elemField.setFieldName("jobFailed");\r
+        elemField.setXmlName(new javax.xml.namespace.QName(\r
+                "http://dataTypes.vamsas", "jobFailed"));\r
+        elemField.setXmlType(new javax.xml.namespace.QName(\r
+                "http://www.w3.org/2001/XMLSchema", "boolean"));\r
+        typeDesc.addFieldDesc(elemField);\r
+        elemField = new org.apache.axis.description.ElementDesc();\r
+        elemField.setFieldName("queued");\r
+        elemField.setXmlName(new javax.xml.namespace.QName(\r
+                "http://dataTypes.vamsas", "queued"));\r
+        elemField.setXmlType(new javax.xml.namespace.QName(\r
+                "http://www.w3.org/2001/XMLSchema", "boolean"));\r
+        typeDesc.addFieldDesc(elemField);\r
+        elemField = new org.apache.axis.description.ElementDesc();\r
+        elemField.setFieldName("running");\r
+        elemField.setXmlName(new javax.xml.namespace.QName(\r
+                "http://dataTypes.vamsas", "running"));\r
+        elemField.setXmlType(new javax.xml.namespace.QName(\r
+                "http://www.w3.org/2001/XMLSchema", "boolean"));\r
+        typeDesc.addFieldDesc(elemField);\r
+        elemField = new org.apache.axis.description.ElementDesc();\r
+        elemField.setFieldName("serverError");\r
+        elemField.setXmlName(new javax.xml.namespace.QName(\r
+                "http://dataTypes.vamsas", "serverError"));\r
+        elemField.setXmlType(new javax.xml.namespace.QName(\r
+                "http://www.w3.org/2001/XMLSchema", "boolean"));\r
+        typeDesc.addFieldDesc(elemField);\r
+        elemField = new org.apache.axis.description.ElementDesc();\r
+        elemField.setFieldName("state");\r
+        elemField.setXmlName(new javax.xml.namespace.QName(\r
+                "http://dataTypes.vamsas", "state"));\r
+        elemField.setXmlType(new javax.xml.namespace.QName(\r
+                "http://www.w3.org/2001/XMLSchema", "int"));\r
+        typeDesc.addFieldDesc(elemField);\r
+        elemField = new org.apache.axis.description.ElementDesc();\r
+        elemField.setFieldName("status");\r
+        elemField.setXmlName(new javax.xml.namespace.QName(\r
+                "http://dataTypes.vamsas", "status"));\r
+        elemField.setXmlType(new javax.xml.namespace.QName(\r
+                "http://www.w3.org/2001/XMLSchema", "string"));\r
+        typeDesc.addFieldDesc(elemField);\r
+        elemField = new org.apache.axis.description.ElementDesc();\r
+        elemField.setFieldName("suspended");\r
+        elemField.setXmlName(new javax.xml.namespace.QName(\r
+                "http://dataTypes.vamsas", "suspended"));\r
+        elemField.setXmlType(new javax.xml.namespace.QName(\r
+                "http://www.w3.org/2001/XMLSchema", "boolean"));\r
+        typeDesc.addFieldDesc(elemField);\r
+    }\r
+\r
+    private boolean broken;\r
+    private boolean failed;\r
+    private boolean finished;\r
+    private boolean invalid;\r
+    private boolean jobFailed;\r
+    private boolean queued;\r
+    private boolean running;\r
+    private boolean serverError;\r
+    private int state;\r
+    private java.lang.String status;\r
+    private boolean suspended;\r
+    private java.lang.Object __equalsCalc = null;\r
+    private boolean __hashCodeCalc = false;\r
+\r
+    public Result() {\r
+    }\r
+\r
+    public Result(boolean broken, boolean failed, boolean finished,\r
+        boolean invalid, boolean jobFailed, boolean queued, boolean running,\r
+        boolean serverError, int state, java.lang.String status,\r
+        boolean suspended) {\r
+        this.broken = broken;\r
+        this.failed = failed;\r
+        this.finished = finished;\r
+        this.invalid = invalid;\r
+        this.jobFailed = jobFailed;\r
+        this.queued = queued;\r
+        this.running = running;\r
+        this.serverError = serverError;\r
+        this.state = state;\r
+        this.status = status;\r
+        this.suspended = suspended;\r
+    }\r
+\r
     /**
-     * Gets the broken value for this Result.
-     *
-     * @return broken
-     */
-    public boolean isBroken() {
-        return broken;
-    }
-
-
+ * Gets the broken value for this Result.
+ *
+ * @return broken
+ */\r
+    public boolean isBroken() {\r
+        return broken;\r
+    }\r
+\r
     /**
-     * Sets the broken value for this Result.
-     *
-     * @param broken
-     */
-    public void setBroken(boolean broken) {
-        this.broken = broken;
-    }
-
-
+ * Sets the broken value for this Result.
+ *
+ * @param broken
+ */\r
+    public void setBroken(boolean broken) {\r
+        this.broken = broken;\r
+    }\r
+\r
     /**
-     * Gets the failed value for this Result.
-     *
-     * @return failed
-     */
-    public boolean isFailed() {
-        return failed;
-    }
-
-
+ * Gets the failed value for this Result.
+ *
+ * @return failed
+ */\r
+    public boolean isFailed() {\r
+        return failed;\r
+    }\r
+\r
     /**
-     * Sets the failed value for this Result.
-     *
-     * @param failed
-     */
-    public void setFailed(boolean failed) {
-        this.failed = failed;
-    }
-
-
+ * Sets the failed value for this Result.
+ *
+ * @param failed
+ */\r
+    public void setFailed(boolean failed) {\r
+        this.failed = failed;\r
+    }\r
+\r
     /**
-     * Gets the finished value for this Result.
-     *
-     * @return finished
-     */
-    public boolean isFinished() {
-        return finished;
-    }
-
-
+ * Gets the finished value for this Result.
+ *
+ * @return finished
+ */\r
+    public boolean isFinished() {\r
+        return finished;\r
+    }\r
+\r
     /**
-     * Sets the finished value for this Result.
-     *
-     * @param finished
-     */
-    public void setFinished(boolean finished) {
-        this.finished = finished;
-    }
-
-
+ * Sets the finished value for this Result.
+ *
+ * @param finished
+ */\r
+    public void setFinished(boolean finished) {\r
+        this.finished = finished;\r
+    }\r
+\r
     /**
-     * Gets the invalid value for this Result.
-     *
-     * @return invalid
-     */
-    public boolean isInvalid() {
-        return invalid;
-    }
-
-
+ * Gets the invalid value for this Result.
+ *
+ * @return invalid
+ */\r
+    public boolean isInvalid() {\r
+        return invalid;\r
+    }\r
+\r
     /**
-     * Sets the invalid value for this Result.
-     *
-     * @param invalid
-     */
-    public void setInvalid(boolean invalid) {
-        this.invalid = invalid;
-    }
-
-
+ * Sets the invalid value for this Result.
+ *
+ * @param invalid
+ */\r
+    public void setInvalid(boolean invalid) {\r
+        this.invalid = invalid;\r
+    }\r
+\r
     /**
-     * Gets the jobFailed value for this Result.
-     *
-     * @return jobFailed
-     */
-    public boolean isJobFailed() {
-        return jobFailed;
-    }
-
-
+ * Gets the jobFailed value for this Result.
+ *
+ * @return jobFailed
+ */\r
+    public boolean isJobFailed() {\r
+        return jobFailed;\r
+    }\r
+\r
     /**
-     * Sets the jobFailed value for this Result.
-     *
-     * @param jobFailed
-     */
-    public void setJobFailed(boolean jobFailed) {
-        this.jobFailed = jobFailed;
-    }
-
-
+ * Sets the jobFailed value for this Result.
+ *
+ * @param jobFailed
+ */\r
+    public void setJobFailed(boolean jobFailed) {\r
+        this.jobFailed = jobFailed;\r
+    }\r
+\r
     /**
-     * Gets the queued value for this Result.
-     *
-     * @return queued
-     */
-    public boolean isQueued() {
-        return queued;
-    }
-
-
+ * Gets the queued value for this Result.
+ *
+ * @return queued
+ */\r
+    public boolean isQueued() {\r
+        return queued;\r
+    }\r
+\r
     /**
-     * Sets the queued value for this Result.
-     *
-     * @param queued
-     */
-    public void setQueued(boolean queued) {
-        this.queued = queued;
-    }
-
-
+ * Sets the queued value for this Result.
+ *
+ * @param queued
+ */\r
+    public void setQueued(boolean queued) {\r
+        this.queued = queued;\r
+    }\r
+\r
     /**
-     * Gets the running value for this Result.
-     *
-     * @return running
-     */
-    public boolean isRunning() {
-        return running;
-    }
-
-
+ * Gets the running value for this Result.
+ *
+ * @return running
+ */\r
+    public boolean isRunning() {\r
+        return running;\r
+    }\r
+\r
     /**
-     * Sets the running value for this Result.
-     *
-     * @param running
-     */
-    public void setRunning(boolean running) {
-        this.running = running;
-    }
-
-
+ * Sets the running value for this Result.
+ *
+ * @param running
+ */\r
+    public void setRunning(boolean running) {\r
+        this.running = running;\r
+    }\r
+\r
     /**
-     * Gets the serverError value for this Result.
-     *
-     * @return serverError
-     */
-    public boolean isServerError() {
-        return serverError;
-    }
-
-
+ * Gets the serverError value for this Result.
+ *
+ * @return serverError
+ */\r
+    public boolean isServerError() {\r
+        return serverError;\r
+    }\r
+\r
     /**
-     * Sets the serverError value for this Result.
-     *
-     * @param serverError
-     */
-    public void setServerError(boolean serverError) {
-        this.serverError = serverError;
-    }
-
-
+ * Sets the serverError value for this Result.
+ *
+ * @param serverError
+ */\r
+    public void setServerError(boolean serverError) {\r
+        this.serverError = serverError;\r
+    }\r
+\r
     /**
-     * Gets the state value for this Result.
-     *
-     * @return state
-     */
-    public int getState() {
-        return state;
-    }
-
-
+ * Gets the state value for this Result.
+ *
+ * @return state
+ */\r
+    public int getState() {\r
+        return state;\r
+    }\r
+\r
     /**
-     * Sets the state value for this Result.
-     *
-     * @param state
-     */
-    public void setState(int state) {
-        this.state = state;
-    }
-
-
+ * Sets the state value for this Result.
+ *
+ * @param state
+ */\r
+    public void setState(int state) {\r
+        this.state = state;\r
+    }\r
+\r
     /**
-     * Gets the status value for this Result.
-     *
-     * @return status
-     */
-    public java.lang.String getStatus() {
-        return status;
-    }
-
-
+ * Gets the status value for this Result.
+ *
+ * @return status
+ */\r
+    public java.lang.String getStatus() {\r
+        return status;\r
+    }\r
+\r
     /**
-     * Sets the status value for this Result.
-     *
-     * @param status
-     */
-    public void setStatus(java.lang.String status) {
-        this.status = status;
-    }
-
-
+ * Sets the status value for this Result.
+ *
+ * @param status
+ */\r
+    public void setStatus(java.lang.String status) {\r
+        this.status = status;\r
+    }\r
+\r
     /**
-     * Gets the suspended value for this Result.
-     *
-     * @return suspended
-     */
-    public boolean isSuspended() {
-        return suspended;
-    }
-
-
+ * Gets the suspended value for this Result.
+ *
+ * @return suspended
+ */\r
+    public boolean isSuspended() {\r
+        return suspended;\r
+    }\r
+\r
     /**
-     * Sets the suspended value for this Result.
-     *
-     * @param suspended
-     */
-    public void setSuspended(boolean suspended) {
-        this.suspended = suspended;
-    }
-
-    private java.lang.Object __equalsCalc = null;
-    public synchronized boolean equals(java.lang.Object obj) {
-        if (!(obj instanceof Result)) return false;
-        Result other = (Result) obj;
-        if (obj == null) return false;
-        if (this == obj) return true;
-        if (__equalsCalc != null) {
-            return (__equalsCalc == obj);
-        }
-        __equalsCalc = obj;
-        boolean _equals;
-        _equals = true &&
-            this.broken == other.isBroken() &&
-            this.failed == other.isFailed() &&
-            this.finished == other.isFinished() &&
-            this.invalid == other.isInvalid() &&
-            this.jobFailed == other.isJobFailed() &&
-            this.queued == other.isQueued() &&
-            this.running == other.isRunning() &&
-            this.serverError == other.isServerError() &&
-            this.state == other.getState() &&
-            ((this.status==null && other.getStatus()==null) ||
-             (this.status!=null &&
-              this.status.equals(other.getStatus()))) &&
-            this.suspended == other.isSuspended();
-        __equalsCalc = null;
-        return _equals;
-    }
-
-    private boolean __hashCodeCalc = false;
-    public synchronized int hashCode() {
-        if (__hashCodeCalc) {
-            return 0;
-        }
-        __hashCodeCalc = true;
-        int _hashCode = 1;
-        _hashCode += (isBroken() ? Boolean.TRUE : Boolean.FALSE).hashCode();
-        _hashCode += (isFailed() ? Boolean.TRUE : Boolean.FALSE).hashCode();
-        _hashCode += (isFinished() ? Boolean.TRUE : Boolean.FALSE).hashCode();
-        _hashCode += (isInvalid() ? Boolean.TRUE : Boolean.FALSE).hashCode();
-        _hashCode += (isJobFailed() ? Boolean.TRUE : Boolean.FALSE).hashCode();
-        _hashCode += (isQueued() ? Boolean.TRUE : Boolean.FALSE).hashCode();
-        _hashCode += (isRunning() ? Boolean.TRUE : Boolean.FALSE).hashCode();
-        _hashCode += (isServerError() ? Boolean.TRUE : Boolean.FALSE).hashCode();
-        _hashCode += getState();
-        if (getStatus() != null) {
-            _hashCode += getStatus().hashCode();
-        }
-        _hashCode += (isSuspended() ? Boolean.TRUE : Boolean.FALSE).hashCode();
-        __hashCodeCalc = false;
-        return _hashCode;
-    }
-
-    // Type metadata
-    private static org.apache.axis.description.TypeDesc typeDesc =
-        new org.apache.axis.description.TypeDesc(Result.class, true);
-
-    static {
-        typeDesc.setXmlType(new javax.xml.namespace.QName("http://dataTypes.vamsas", "Result"));
-        org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("broken");
-        elemField.setXmlName(new javax.xml.namespace.QName("http://dataTypes.vamsas", "broken"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("failed");
-        elemField.setXmlName(new javax.xml.namespace.QName("http://dataTypes.vamsas", "failed"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("finished");
-        elemField.setXmlName(new javax.xml.namespace.QName("http://dataTypes.vamsas", "finished"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("invalid");
-        elemField.setXmlName(new javax.xml.namespace.QName("http://dataTypes.vamsas", "invalid"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("jobFailed");
-        elemField.setXmlName(new javax.xml.namespace.QName("http://dataTypes.vamsas", "jobFailed"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("queued");
-        elemField.setXmlName(new javax.xml.namespace.QName("http://dataTypes.vamsas", "queued"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("running");
-        elemField.setXmlName(new javax.xml.namespace.QName("http://dataTypes.vamsas", "running"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("serverError");
-        elemField.setXmlName(new javax.xml.namespace.QName("http://dataTypes.vamsas", "serverError"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("state");
-        elemField.setXmlName(new javax.xml.namespace.QName("http://dataTypes.vamsas", "state"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "int"));
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("status");
-        elemField.setXmlName(new javax.xml.namespace.QName("http://dataTypes.vamsas", "status"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("suspended");
-        elemField.setXmlName(new javax.xml.namespace.QName("http://dataTypes.vamsas", "suspended"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
-        typeDesc.addFieldDesc(elemField);
-    }
-
+ * Sets the suspended value for this Result.
+ *
+ * @param suspended
+ */\r
+    public void setSuspended(boolean suspended) {\r
+        this.suspended = suspended;\r
+    }\r
+\r
+    public synchronized boolean equals(java.lang.Object obj) {\r
+        if (!(obj instanceof Result)) {\r
+            return false;\r
+        }\r
+\r
+        Result other = (Result) obj;\r
+\r
+        if (obj == null) {\r
+            return false;\r
+        }\r
+\r
+        if (this == obj) {\r
+            return true;\r
+        }\r
+\r
+        if (__equalsCalc != null) {\r
+            return (__equalsCalc == obj);\r
+        }\r
+\r
+        __equalsCalc = obj;\r
+\r
+        boolean _equals;\r
+        _equals = true && (this.broken == other.isBroken()) &&\r
+            (this.failed == other.isFailed()) &&\r
+            (this.finished == other.isFinished()) &&\r
+            (this.invalid == other.isInvalid()) &&\r
+            (this.jobFailed == other.isJobFailed()) &&\r
+            (this.queued == other.isQueued()) &&\r
+            (this.running == other.isRunning()) &&\r
+            (this.serverError == other.isServerError()) &&\r
+            (this.state == other.getState()) &&\r
+            (((this.status == null) && (other.getStatus() == null)) ||\r
+            ((this.status != null) && this.status.equals(other.getStatus()))) &&\r
+            (this.suspended == other.isSuspended());\r
+        __equalsCalc = null;\r
+\r
+        return _equals;\r
+    }\r
+\r
+    public synchronized int hashCode() {\r
+        if (__hashCodeCalc) {\r
+            return 0;\r
+        }\r
+\r
+        __hashCodeCalc = true;\r
+\r
+        int _hashCode = 1;\r
+        _hashCode += (isBroken() ? Boolean.TRUE : Boolean.FALSE).hashCode();\r
+        _hashCode += (isFailed() ? Boolean.TRUE : Boolean.FALSE).hashCode();\r
+        _hashCode += (isFinished() ? Boolean.TRUE : Boolean.FALSE).hashCode();\r
+        _hashCode += (isInvalid() ? Boolean.TRUE : Boolean.FALSE).hashCode();\r
+        _hashCode += (isJobFailed() ? Boolean.TRUE : Boolean.FALSE).hashCode();\r
+        _hashCode += (isQueued() ? Boolean.TRUE : Boolean.FALSE).hashCode();\r
+        _hashCode += (isRunning() ? Boolean.TRUE : Boolean.FALSE).hashCode();\r
+        _hashCode += (isServerError() ? Boolean.TRUE : Boolean.FALSE).hashCode();\r
+        _hashCode += getState();\r
+\r
+        if (getStatus() != null) {\r
+            _hashCode += getStatus().hashCode();\r
+        }\r
+\r
+        _hashCode += (isSuspended() ? Boolean.TRUE : Boolean.FALSE).hashCode();\r
+        __hashCodeCalc = false;\r
+\r
+        return _hashCode;\r
+    }\r
+\r
     /**
-     * Return type metadata object
-     */
-    public static org.apache.axis.description.TypeDesc getTypeDesc() {
-        return typeDesc;
-    }
-
+ * Return type metadata object
+ */\r
+    public static org.apache.axis.description.TypeDesc getTypeDesc() {\r
+        return typeDesc;\r
+    }\r
+\r
     /**
-     * Get Custom Serializer
-     */
-    public static org.apache.axis.encoding.Serializer getSerializer(
-           java.lang.String mechType,
-           java.lang.Class _javaType,
-           javax.xml.namespace.QName _xmlType) {
-        return
-          new  org.apache.axis.encoding.ser.BeanSerializer(
-            _javaType, _xmlType, typeDesc);
-    }
-
+ * Get Custom Serializer
+ */\r
+    public static org.apache.axis.encoding.Serializer getSerializer(\r
+        java.lang.String mechType, java.lang.Class _javaType,\r
+        javax.xml.namespace.QName _xmlType) {\r
+        return new org.apache.axis.encoding.ser.BeanSerializer(_javaType,\r
+            _xmlType, typeDesc);\r
+    }\r
+\r
     /**
-     * Get Custom Deserializer
-     */
-    public static org.apache.axis.encoding.Deserializer getDeserializer(
-           java.lang.String mechType,
-           java.lang.Class _javaType,
-           javax.xml.namespace.QName _xmlType) {
-        return
-          new  org.apache.axis.encoding.ser.BeanDeserializer(
-            _javaType, _xmlType, typeDesc);
-    }
-
-}
+ * Get Custom Deserializer
+ */\r
+    public static org.apache.axis.encoding.Deserializer getDeserializer(\r
+        java.lang.String mechType, java.lang.Class _javaType,\r
+        javax.xml.namespace.QName _xmlType) {\r
+        return new org.apache.axis.encoding.ser.BeanDeserializer(_javaType,\r
+            _xmlType, typeDesc);\r
+    }\r
+}\r
index 290ac3c..d1da9be 100755 (executable)
@@ -3,8 +3,8 @@
  *
  * This file was auto-generated from WSDL
  * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter.
- */
-
+ */\r
+\r
 /*
 * Jalview - A Sequence Alignment Editor and Viewer
 * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
 * 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 ext.vamsas;
-
-public class Secstructpred  implements java.io.Serializable {
-    private java.lang.String output;
-
-    public Secstructpred() {
-    }
-
-    public Secstructpred(
-           java.lang.String output) {
-           this.output = output;
-    }
-
-
+*/\r
+package ext.vamsas;\r
+\r
+public class Secstructpred implements java.io.Serializable {\r
+    // Type metadata\r
+    private static org.apache.axis.description.TypeDesc typeDesc = new org.apache.axis.description.TypeDesc(Secstructpred.class,\r
+            true);\r
+\r
+    static {\r
+        typeDesc.setXmlType(new javax.xml.namespace.QName(\r
+                "http://dataTypes.vamsas", "Secstructpred"));\r
+\r
+        org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();\r
+        elemField.setFieldName("output");\r
+        elemField.setXmlName(new javax.xml.namespace.QName(\r
+                "http://dataTypes.vamsas", "output"));\r
+        elemField.setXmlType(new javax.xml.namespace.QName(\r
+                "http://www.w3.org/2001/XMLSchema", "string"));\r
+        typeDesc.addFieldDesc(elemField);\r
+    }\r
+\r
+    private java.lang.String output;\r
+    private java.lang.Object __equalsCalc = null;\r
+    private boolean __hashCodeCalc = false;\r
+\r
+    public Secstructpred() {\r
+    }\r
+\r
+    public Secstructpred(java.lang.String output) {\r
+        this.output = output;\r
+    }\r
+\r
     /**
-     * Gets the output value for this Secstructpred.
-     *
-     * @return output
-     */
-    public java.lang.String getOutput() {
-        return output;
-    }
-
-
+ * Gets the output value for this Secstructpred.
+ *
+ * @return output
+ */\r
+    public java.lang.String getOutput() {\r
+        return output;\r
+    }\r
+\r
     /**
-     * Sets the output value for this Secstructpred.
-     *
-     * @param output
-     */
-    public void setOutput(java.lang.String output) {
-        this.output = output;
-    }
-
-    private java.lang.Object __equalsCalc = null;
-    public synchronized boolean equals(java.lang.Object obj) {
-        if (!(obj instanceof Secstructpred)) return false;
-        Secstructpred other = (Secstructpred) obj;
-        if (obj == null) return false;
-        if (this == obj) return true;
-        if (__equalsCalc != null) {
-            return (__equalsCalc == obj);
-        }
-        __equalsCalc = obj;
-        boolean _equals;
-        _equals = true &&
-            ((this.output==null && other.getOutput()==null) ||
-             (this.output!=null &&
-              this.output.equals(other.getOutput())));
-        __equalsCalc = null;
-        return _equals;
-    }
-
-    private boolean __hashCodeCalc = false;
-    public synchronized int hashCode() {
-        if (__hashCodeCalc) {
-            return 0;
-        }
-        __hashCodeCalc = true;
-        int _hashCode = 1;
-        if (getOutput() != null) {
-            _hashCode += getOutput().hashCode();
-        }
-        __hashCodeCalc = false;
-        return _hashCode;
-    }
-
-    // Type metadata
-    private static org.apache.axis.description.TypeDesc typeDesc =
-        new org.apache.axis.description.TypeDesc(Secstructpred.class, true);
-
-    static {
-        typeDesc.setXmlType(new javax.xml.namespace.QName("http://dataTypes.vamsas", "Secstructpred"));
-        org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("output");
-        elemField.setXmlName(new javax.xml.namespace.QName("http://dataTypes.vamsas", "output"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
-        typeDesc.addFieldDesc(elemField);
-    }
-
+ * Sets the output value for this Secstructpred.
+ *
+ * @param output
+ */\r
+    public void setOutput(java.lang.String output) {\r
+        this.output = output;\r
+    }\r
+\r
+    public synchronized boolean equals(java.lang.Object obj) {\r
+        if (!(obj instanceof Secstructpred)) {\r
+            return false;\r
+        }\r
+\r
+        Secstructpred other = (Secstructpred) obj;\r
+\r
+        if (obj == null) {\r
+            return false;\r
+        }\r
+\r
+        if (this == obj) {\r
+            return true;\r
+        }\r
+\r
+        if (__equalsCalc != null) {\r
+            return (__equalsCalc == obj);\r
+        }\r
+\r
+        __equalsCalc = obj;\r
+\r
+        boolean _equals;\r
+        _equals = true &&\r
+            (((this.output == null) && (other.getOutput() == null)) ||\r
+            ((this.output != null) && this.output.equals(other.getOutput())));\r
+        __equalsCalc = null;\r
+\r
+        return _equals;\r
+    }\r
+\r
+    public synchronized int hashCode() {\r
+        if (__hashCodeCalc) {\r
+            return 0;\r
+        }\r
+\r
+        __hashCodeCalc = true;\r
+\r
+        int _hashCode = 1;\r
+\r
+        if (getOutput() != null) {\r
+            _hashCode += getOutput().hashCode();\r
+        }\r
+\r
+        __hashCodeCalc = false;\r
+\r
+        return _hashCode;\r
+    }\r
+\r
     /**
-     * Return type metadata object
-     */
-    public static org.apache.axis.description.TypeDesc getTypeDesc() {
-        return typeDesc;
-    }
-
+ * Return type metadata object
+ */\r
+    public static org.apache.axis.description.TypeDesc getTypeDesc() {\r
+        return typeDesc;\r
+    }\r
+\r
     /**
-     * Get Custom Serializer
-     */
-    public static org.apache.axis.encoding.Serializer getSerializer(
-           java.lang.String mechType,
-           java.lang.Class _javaType,
-           javax.xml.namespace.QName _xmlType) {
-        return
-          new  org.apache.axis.encoding.ser.BeanSerializer(
-            _javaType, _xmlType, typeDesc);
-    }
-
+ * Get Custom Serializer
+ */\r
+    public static org.apache.axis.encoding.Serializer getSerializer(\r
+        java.lang.String mechType, java.lang.Class _javaType,\r
+        javax.xml.namespace.QName _xmlType) {\r
+        return new org.apache.axis.encoding.ser.BeanSerializer(_javaType,\r
+            _xmlType, typeDesc);\r
+    }\r
+\r
     /**
-     * Get Custom Deserializer
-     */
-    public static org.apache.axis.encoding.Deserializer getDeserializer(
-           java.lang.String mechType,
-           java.lang.Class _javaType,
-           javax.xml.namespace.QName _xmlType) {
-        return
-          new  org.apache.axis.encoding.ser.BeanDeserializer(
-            _javaType, _xmlType, typeDesc);
-    }
-
-}
+ * Get Custom Deserializer
+ */\r
+    public static org.apache.axis.encoding.Deserializer getDeserializer(\r
+        java.lang.String mechType, java.lang.Class _javaType,\r
+        javax.xml.namespace.QName _xmlType) {\r
+        return new org.apache.axis.encoding.ser.BeanDeserializer(_javaType,\r
+            _xmlType, typeDesc);\r
+    }\r
+}\r
index c2b9da8..4d73bcf 100755 (executable)
@@ -3,8 +3,8 @@
  *
  * This file was auto-generated from WSDL
  * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter.
- */
-
+ */\r
+\r
 /*
 * Jalview - A Sequence Alignment Editor and Viewer
 * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
 * 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 ext.vamsas;
-
-public class Sequence  implements java.io.Serializable {
-    private java.lang.String id;
-    private java.lang.String seq;
-
-    public Sequence() {
-    }
-
-    public Sequence(
-           java.lang.String id,
-           java.lang.String seq) {
-           this.id = id;
-           this.seq = seq;
-    }
-
-
+*/\r
+package ext.vamsas;\r
+\r
+public class Sequence implements java.io.Serializable {\r
+    // Type metadata\r
+    private static org.apache.axis.description.TypeDesc typeDesc = new org.apache.axis.description.TypeDesc(Sequence.class,\r
+            true);\r
+\r
+    static {\r
+        typeDesc.setXmlType(new javax.xml.namespace.QName(\r
+                "http://dataTypes.vamsas", "Sequence"));\r
+\r
+        org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();\r
+        elemField.setFieldName("id");\r
+        elemField.setXmlName(new javax.xml.namespace.QName(\r
+                "http://dataTypes.vamsas", "id"));\r
+        elemField.setXmlType(new javax.xml.namespace.QName(\r
+                "http://www.w3.org/2001/XMLSchema", "string"));\r
+        typeDesc.addFieldDesc(elemField);\r
+        elemField = new org.apache.axis.description.ElementDesc();\r
+        elemField.setFieldName("seq");\r
+        elemField.setXmlName(new javax.xml.namespace.QName(\r
+                "http://dataTypes.vamsas", "seq"));\r
+        elemField.setXmlType(new javax.xml.namespace.QName(\r
+                "http://www.w3.org/2001/XMLSchema", "string"));\r
+        typeDesc.addFieldDesc(elemField);\r
+    }\r
+\r
+    private java.lang.String id;\r
+    private java.lang.String seq;\r
+    private java.lang.Object __equalsCalc = null;\r
+    private boolean __hashCodeCalc = false;\r
+\r
+    public Sequence() {\r
+    }\r
+\r
+    public Sequence(java.lang.String id, java.lang.String seq) {\r
+        this.id = id;\r
+        this.seq = seq;\r
+    }\r
+\r
     /**
-     * Gets the id value for this Sequence.
-     *
-     * @return id
-     */
-    public java.lang.String getId() {
-        return id;
-    }
-
-
+ * Gets the id value for this Sequence.
+ *
+ * @return id
+ */\r
+    public java.lang.String getId() {\r
+        return id;\r
+    }\r
+\r
     /**
-     * Sets the id value for this Sequence.
-     *
-     * @param id
-     */
-    public void setId(java.lang.String id) {
-        this.id = id;
-    }
-
-
+ * Sets the id value for this Sequence.
+ *
+ * @param id
+ */\r
+    public void setId(java.lang.String id) {\r
+        this.id = id;\r
+    }\r
+\r
     /**
-     * Gets the seq value for this Sequence.
-     *
-     * @return seq
-     */
-    public java.lang.String getSeq() {
-        return seq;
-    }
-
-
+ * Gets the seq value for this Sequence.
+ *
+ * @return seq
+ */\r
+    public java.lang.String getSeq() {\r
+        return seq;\r
+    }\r
+\r
     /**
-     * Sets the seq value for this Sequence.
-     *
-     * @param seq
-     */
-    public void setSeq(java.lang.String seq) {
-        this.seq = seq;
-    }
-
-    private java.lang.Object __equalsCalc = null;
-    public synchronized boolean equals(java.lang.Object obj) {
-        if (!(obj instanceof Sequence)) return false;
-        Sequence other = (Sequence) obj;
-        if (obj == null) return false;
-        if (this == obj) return true;
-        if (__equalsCalc != null) {
-            return (__equalsCalc == obj);
-        }
-        __equalsCalc = obj;
-        boolean _equals;
-        _equals = true &&
-            ((this.id==null && other.getId()==null) ||
-             (this.id!=null &&
-              this.id.equals(other.getId()))) &&
-            ((this.seq==null && other.getSeq()==null) ||
-             (this.seq!=null &&
-              this.seq.equals(other.getSeq())));
-        __equalsCalc = null;
-        return _equals;
-    }
-
-    private boolean __hashCodeCalc = false;
-    public synchronized int hashCode() {
-        if (__hashCodeCalc) {
-            return 0;
-        }
-        __hashCodeCalc = true;
-        int _hashCode = 1;
-        if (getId() != null) {
-            _hashCode += getId().hashCode();
-        }
-        if (getSeq() != null) {
-            _hashCode += getSeq().hashCode();
-        }
-        __hashCodeCalc = false;
-        return _hashCode;
-    }
-
-    // Type metadata
-    private static org.apache.axis.description.TypeDesc typeDesc =
-        new org.apache.axis.description.TypeDesc(Sequence.class, true);
-
-    static {
-        typeDesc.setXmlType(new javax.xml.namespace.QName("http://dataTypes.vamsas", "Sequence"));
-        org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("id");
-        elemField.setXmlName(new javax.xml.namespace.QName("http://dataTypes.vamsas", "id"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("seq");
-        elemField.setXmlName(new javax.xml.namespace.QName("http://dataTypes.vamsas", "seq"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));
-        typeDesc.addFieldDesc(elemField);
-    }
-
+ * Sets the seq value for this Sequence.
+ *
+ * @param seq
+ */\r
+    public void setSeq(java.lang.String seq) {\r
+        this.seq = seq;\r
+    }\r
+\r
+    public synchronized boolean equals(java.lang.Object obj) {\r
+        if (!(obj instanceof Sequence)) {\r
+            return false;\r
+        }\r
+\r
+        Sequence other = (Sequence) obj;\r
+\r
+        if (obj == null) {\r
+            return false;\r
+        }\r
+\r
+        if (this == obj) {\r
+            return true;\r
+        }\r
+\r
+        if (__equalsCalc != null) {\r
+            return (__equalsCalc == obj);\r
+        }\r
+\r
+        __equalsCalc = obj;\r
+\r
+        boolean _equals;\r
+        _equals = true &&\r
+            (((this.id == null) && (other.getId() == null)) ||\r
+            ((this.id != null) && this.id.equals(other.getId()))) &&\r
+            (((this.seq == null) && (other.getSeq() == null)) ||\r
+            ((this.seq != null) && this.seq.equals(other.getSeq())));\r
+        __equalsCalc = null;\r
+\r
+        return _equals;\r
+    }\r
+\r
+    public synchronized int hashCode() {\r
+        if (__hashCodeCalc) {\r
+            return 0;\r
+        }\r
+\r
+        __hashCodeCalc = true;\r
+\r
+        int _hashCode = 1;\r
+\r
+        if (getId() != null) {\r
+            _hashCode += getId().hashCode();\r
+        }\r
+\r
+        if (getSeq() != null) {\r
+            _hashCode += getSeq().hashCode();\r
+        }\r
+\r
+        __hashCodeCalc = false;\r
+\r
+        return _hashCode;\r
+    }\r
+\r
     /**
-     * Return type metadata object
-     */
-    public static org.apache.axis.description.TypeDesc getTypeDesc() {
-        return typeDesc;
-    }
-
+ * Return type metadata object
+ */\r
+    public static org.apache.axis.description.TypeDesc getTypeDesc() {\r
+        return typeDesc;\r
+    }\r
+\r
     /**
-     * Get Custom Serializer
-     */
-    public static org.apache.axis.encoding.Serializer getSerializer(
-           java.lang.String mechType,
-           java.lang.Class _javaType,
-           javax.xml.namespace.QName _xmlType) {
-        return
-          new  org.apache.axis.encoding.ser.BeanSerializer(
-            _javaType, _xmlType, typeDesc);
-    }
-
+ * Get Custom Serializer
+ */\r
+    public static org.apache.axis.encoding.Serializer getSerializer(\r
+        java.lang.String mechType, java.lang.Class _javaType,\r
+        javax.xml.namespace.QName _xmlType) {\r
+        return new org.apache.axis.encoding.ser.BeanSerializer(_javaType,\r
+            _xmlType, typeDesc);\r
+    }\r
+\r
     /**
-     * Get Custom Deserializer
-     */
-    public static org.apache.axis.encoding.Deserializer getDeserializer(
-           java.lang.String mechType,
-           java.lang.Class _javaType,
-           javax.xml.namespace.QName _xmlType) {
-        return
-          new  org.apache.axis.encoding.ser.BeanDeserializer(
-            _javaType, _xmlType, typeDesc);
-    }
-
-}
+ * Get Custom Deserializer
+ */\r
+    public static org.apache.axis.encoding.Deserializer getDeserializer(\r
+        java.lang.String mechType, java.lang.Class _javaType,\r
+        javax.xml.namespace.QName _xmlType) {\r
+        return new org.apache.axis.encoding.ser.BeanDeserializer(_javaType,\r
+            _xmlType, typeDesc);\r
+    }\r
+}\r
index 02569ef..41c6599 100755 (executable)
 * 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.analysis;\r
 \r
-import jalview.jbgui.*;\r
+import jalview.analysis.*;\r
+\r
 import jalview.datamodel.*;\r
+\r
 import jalview.io.*;\r
-import jalview.analysis.*;\r
 \r
-import java.awt.*;\r
+import jalview.jbgui.*;\r
+\r
 import java.applet.Applet;\r
-import java.util.*;\r
-import java.net.*;\r
+\r
+import java.awt.*;\r
+\r
 import java.io.*;\r
 \r
-public class AAFrequency {\r
+import java.net.*;\r
 \r
+import java.util.*;\r
+\r
+\r
+public class AAFrequency {\r
     // Takes in a vector of sequences and column start and column end\r
     // and returns a vector of size (end-start+1). Each element of the\r
     // vector contains a hashtable with the keys being residues and\r
     // the values being the count of each residue in that column.\r
     // This class is used extensively in calculating alignment colourschemes\r
     // that depend on the amount of conservation in each alignment column.\r
+    public static Vector calculate(Vector sequences, int start, int end) {\r
+        Vector result = new Vector();\r
+\r
+        for (int i = start; i <= end; i++) {\r
+            Hashtable residueHash = new Hashtable();\r
+            int maxCount = 0;\r
+            String maxResidue = "-";\r
+            int nongap = 0;\r
+\r
+            for (int j = 0; j < sequences.size(); j++) {\r
+                if (sequences.elementAt(j) instanceof Sequence) {\r
+                    Sequence s = (Sequence) sequences.elementAt(j);\r
+\r
+                    if (s.getSequence().length() > i) {\r
+                        String res = s.getSequence().charAt(i) + "";\r
+\r
+                        if (!jalview.util.Comparison.isGap(res.charAt(0))) {\r
+                            nongap++;\r
+                        } else {\r
+                            res = "-"; // we always use this for gaps in the property vectors\r
+                        }\r
+\r
+                        if (residueHash.containsKey(res)) {\r
+                            int count = ((Integer) residueHash.get(res)).intValue();\r
+                            count++;\r
+\r
+                            if (!jalview.util.Comparison.isGap(res.charAt(0)) &&\r
+                                    (count >= maxCount)) {\r
+                                if (count > maxCount) {\r
+                                    maxResidue = res;\r
+                                } else if (maxResidue.indexOf(res) == -1) {\r
+                                    maxResidue += res;\r
+                                }\r
+\r
+                                maxCount = count;\r
+                            }\r
+\r
+                            residueHash.put(res, new Integer(count));\r
+                        } else {\r
+                            residueHash.put(res, new Integer(1));\r
+                        }\r
+                    } else {\r
+                        if (residueHash.containsKey("-")) {\r
+                            int count = ((Integer) residueHash.get("-")).intValue();\r
+                            count++;\r
+                            residueHash.put("-", new Integer(count));\r
+                        } else {\r
+                            residueHash.put("-", new Integer(1));\r
+                        }\r
+                    }\r
+                }\r
+            }\r
 \r
+            residueHash.put("maxCount", new Integer(maxCount));\r
 \r
-    public static Vector calculate(Vector sequences,int start,int end) {\r
-\r
-    Vector result = new Vector();\r
-\r
-    for (int i = start;i <= end; i++)\r
-    {\r
-\r
-      Hashtable residueHash = new Hashtable();\r
-      int       maxCount    = 0;\r
-      String    maxResidue  = "-";\r
-      int       nongap      = 0;\r
-      for (int j=0; j < sequences.size(); j++)\r
-      {\r
-\r
-        if (sequences.elementAt(j) instanceof Sequence)\r
-        {\r
-          Sequence s = (Sequence)sequences.elementAt(j);\r
-\r
-          if (s.getSequence().length() > i)\r
-          {\r
-\r
-            String res = s.getSequence().charAt(i)+"";\r
-\r
-            if (!jalview.util.Comparison.isGap(res.charAt(0)))\r
-              nongap++;\r
-            else\r
-              res = "-"; // we always use this for gaps in the property vectors\r
-\r
-            if (residueHash.containsKey(res))\r
-            {\r
-\r
-              int count = ((Integer)residueHash.get(res)).intValue() ;\r
-              count++;\r
-\r
-             if (!jalview.util.Comparison.isGap(res.charAt(0)) && count >= maxCount)\r
-              {\r
-\r
-                  if(count>maxCount)\r
-                      maxResidue = res;\r
-                  else if(maxResidue.indexOf(res)==-1)\r
-                      maxResidue += res;\r
-\r
-                  maxCount = count;\r
-             }\r
-\r
-              residueHash.put(res,new Integer(count));\r
+            if (maxCount < 0) {\r
+                System.out.println("asasa " + maxCount);\r
             }\r
-            else\r
-              residueHash.put(res,new Integer(1));\r
-\r
-\r
-          }\r
-          else\r
-          {\r
-            if (residueHash.containsKey("-"))\r
-            {\r
-              int count = ((Integer)residueHash.get("-")).intValue() ;\r
-              count++;\r
-              residueHash.put("-",new Integer(count));\r
-            }\r
-            else\r
-              residueHash.put("-",new Integer(1));\r
 \r
-          }\r
+            residueHash.put("maxResidue", maxResidue);\r
+            residueHash.put("size", new Integer(sequences.size()));\r
+            residueHash.put("nongap", new Integer(nongap));\r
+            result.addElement(residueHash);\r
         }\r
-      }\r
-\r
-      residueHash.put("maxCount",new Integer(maxCount));\r
-      if(maxCount<0)\r
-        System.out.println("asasa "+maxCount);\r
-      residueHash.put("maxResidue", maxResidue);\r
-      residueHash.put("size", new Integer(sequences.size()));\r
-      residueHash.put("nongap", new Integer(nongap));\r
-      result.addElement(residueHash);\r
-    }\r
-\r
-    return result;\r
-  }\r
 \r
-    public static Vector calculatePID(SequenceI refseq,Vector sequences,int window,int start,int end) {\r
-\r
-    Vector result = new Vector();\r
-\r
-    boolean init = true;\r
-\r
-\r
-    Vector prev = null;\r
-\r
-    for (int i = start;i <= end; i++) {\r
-       Vector values = new Vector();\r
+        return result;\r
+    }\r
 \r
-       result.addElement(values);\r
+    public static Vector calculatePID(SequenceI refseq, Vector sequences,\r
+        int window, int start, int end) {\r
+        Vector result = new Vector();\r
 \r
-       // If start < window/2 then set value to zero.\r
+        boolean init = true;\r
 \r
-       if (i< window/2 || i >= refseq.getSequence().length()-window/2) {\r
-           for (int j = 0; j < sequences.size(); j++) {\r
-               values.addElement(new Integer(0));\r
-           }\r
-       } else  if (init == true) {\r
-           init = false;\r
+        Vector prev = null;\r
 \r
-           int winstart = i-window/2;\r
-           int winend   = i+window/2;\r
+        for (int i = start; i <= end; i++) {\r
+            Vector values = new Vector();\r
 \r
-            if (window%2 != 0) {\r
-              winend++;\r
-            }\r
+            result.addElement(values);\r
 \r
-           for (int j = 0; j < sequences.size(); j++) {\r
-               values.addElement(new Integer(0));\r
-           }\r
-\r
-           for (int k = winstart; k <= winend; k++) {\r
-               String refchar = refseq.getSequence().substring(k,k+1);\r
-                if (jalview.util.Comparison.isGap(refchar.charAt(0)))\r
-                  refchar="-";\r
-                else {\r
-                  for (int j = 0; j < sequences.size(); j++) {\r
+            // If start < window/2 then set value to zero.\r
+            if ((i < (window / 2)) ||\r
+                    (i >= (refseq.getSequence().length() - (window / 2)))) {\r
+                for (int j = 0; j < sequences.size(); j++) {\r
+                    values.addElement(new Integer(0));\r
+                }\r
+            } else if (init == true) {\r
+                init = false;\r
 \r
-                    Sequence s = (Sequence)sequences.elementAt(j);\r
+                int winstart = i - (window / 2);\r
+                int winend = i + (window / 2);\r
 \r
-                    if (s.getSequence().length() > k) {\r
+                if ((window % 2) != 0) {\r
+                    winend++;\r
+                }\r
 \r
-                      String res = s.getSequence().substring(k,k+1); // no gapchar test needed\r
+                for (int j = 0; j < sequences.size(); j++) {\r
+                    values.addElement(new Integer(0));\r
+                }\r
 \r
-                      if (res.equals(refchar)) {\r
-                        int val = ((Integer)values.elementAt(j)).intValue();\r
-                        val++;\r
-                        values.setElementAt(new Integer(val),j);\r
-                      }\r
+                for (int k = winstart; k <= winend; k++) {\r
+                    String refchar = refseq.getSequence().substring(k, k + 1);\r
+\r
+                    if (jalview.util.Comparison.isGap(refchar.charAt(0))) {\r
+                        refchar = "-";\r
+                    } else {\r
+                        for (int j = 0; j < sequences.size(); j++) {\r
+                            Sequence s = (Sequence) sequences.elementAt(j);\r
+\r
+                            if (s.getSequence().length() > k) {\r
+                                String res = s.getSequence().substring(k, k +\r
+                                        1); // no gapchar test needed\r
+\r
+                                if (res.equals(refchar)) {\r
+                                    int val = ((Integer) values.elementAt(j)).intValue();\r
+                                    val++;\r
+                                    values.setElementAt(new Integer(val), j);\r
+                                }\r
+                            }\r
+                        }\r
                     }\r
-                  }\r
                 }\r
 \r
-              }\r
-\r
-           prev = values;\r
-       } else {\r
-           int winstart = i-window/2;\r
-           int winend   = i+window/2;\r
+                prev = values;\r
+            } else {\r
+                int winstart = i - (window / 2);\r
+                int winend = i + (window / 2);\r
 \r
-            if (window%2 != 0) {\r
-              winend++;\r
-            }\r
-           // We need to take the previous set of values\r
-           // subtract the pid at winstart-1\r
-           // and add the pid at winend;\r
-\r
-           String pre_refchar  = refseq.getSequence().substring(winstart-1,winstart);\r
-            String pos_refchar = "-";\r
-\r
-            if (refseq.getSequence().length() > winend) {\r
-             pos_refchar  = refseq.getSequence().substring(winend,winend+1);\r
-            }\r
-\r
-           for (int j = 0; j < sequences.size(); j++) {\r
-               // First copy the pid value from i-1\r
-\r
-               int val = ((Integer)prev.elementAt(j)).intValue();\r
-\r
-               Sequence s = (Sequence)sequences.elementAt(j);\r
-\r
-               String pre_char = s.getSequence().substring(winstart-1,winstart);\r
-\r
-                String pos_char = "-";\r
-\r
-                if (s.getSequence().length() > winend) {\r
-                 pos_char = s.getSequence().substring(winend,winend+1);\r
+                if ((window % 2) != 0) {\r
+                    winend++;\r
                 }\r
 \r
-               // Now substract 1 if the chars at winstart-1 match\r
-\r
-                if (jalview.util.Comparison.isGap(pre_refchar.charAt(0)) == false\r
-                    && pre_char.equals(pre_refchar)) {\r
-                   val--;\r
-               }\r
-\r
-                if (jalview.util.Comparison.isGap(pos_refchar.charAt(0)) == false\r
-                    && pos_char.equals(pos_refchar)) {\r
-                   val++;\r
-               }\r
-\r
-               values.addElement(new Integer(val));\r
+                // We need to take the previous set of values\r
+                // subtract the pid at winstart-1\r
+                // and add the pid at winend;\r
+                String pre_refchar = refseq.getSequence().substring(winstart -\r
+                        1, winstart);\r
+                String pos_refchar = "-";\r
 \r
+                if (refseq.getSequence().length() > winend) {\r
+                    pos_refchar = refseq.getSequence().substring(winend,\r
+                            winend + 1);\r
+                }\r
 \r
-           }\r
-           prev = values;\r
-       }\r
-    }\r
+                for (int j = 0; j < sequences.size(); j++) {\r
+                    // First copy the pid value from i-1\r
+                    int val = ((Integer) prev.elementAt(j)).intValue();\r
 \r
-    return result;\r
-    }\r
+                    Sequence s = (Sequence) sequences.elementAt(j);\r
 \r
-    public static Hashtable findBlocks(Vector seqs, int start, int end,Vector exc) {\r
+                    String pre_char = s.getSequence().substring(winstart - 1,\r
+                            winstart);\r
 \r
-       // start and end are in real (not relative coords);\r
+                    String pos_char = "-";\r
 \r
-       // The coords in the hashtable that is returned are in relative coords\r
-       // i.e. start from 0\r
+                    if (s.getSequence().length() > winend) {\r
+                        pos_char = s.getSequence().substring(winend, winend +\r
+                                1);\r
+                    }\r
 \r
-       Hashtable blocks = new Hashtable();\r
+                    // Now substract 1 if the chars at winstart-1 match\r
+                    if ((jalview.util.Comparison.isGap(pre_refchar.charAt(0)) == false) &&\r
+                            pre_char.equals(pre_refchar)) {\r
+                        val--;\r
+                    }\r
 \r
-       boolean prev = false;\r
-       int     bstart = -1;\r
+                    if ((jalview.util.Comparison.isGap(pos_refchar.charAt(0)) == false) &&\r
+                            pos_char.equals(pos_refchar)) {\r
+                        val++;\r
+                    }\r
 \r
-       for (int i = start; i <= end ; i++) {\r
-           SequenceI seq = (SequenceI)seqs.elementAt(0);\r
+                    values.addElement(new Integer(val));\r
+                }\r
 \r
-           char      c   = seq.getCharAt(i);\r
+                prev = values;\r
+            }\r
+        }\r
 \r
-           boolean found = true;\r
+        return result;\r
+    }\r
 \r
-           int j = 1;\r
+    public static Hashtable findBlocks(Vector seqs, int start, int end,\r
+        Vector exc) {\r
+        // start and end are in real (not relative coords);\r
+        // The coords in the hashtable that is returned are in relative coords\r
+        // i.e. start from 0\r
+        Hashtable blocks = new Hashtable();\r
 \r
-           while (j < seqs.size() && found == true) {\r
+        boolean prev = false;\r
+        int bstart = -1;\r
 \r
-               SequenceI jseq  = (SequenceI)seqs.elementAt(j);\r
+        for (int i = start; i <= end; i++) {\r
+            SequenceI seq = (SequenceI) seqs.elementAt(0);\r
 \r
-               if (!exc.contains(jseq)) {\r
+            char c = seq.getCharAt(i);\r
 \r
-                   char cc = jseq.getCharAt(i);\r
+            boolean found = true;\r
 \r
-                   if ( cc != c) {\r
-                       found = false;\r
-                   }\r
-               }\r
-               j++;\r
-           }\r
+            int j = 1;\r
 \r
+            while ((j < seqs.size()) && (found == true)) {\r
+                SequenceI jseq = (SequenceI) seqs.elementAt(j);\r
 \r
-           if (prev == false && found == true) {\r
-               bstart = i;\r
-           } else if (prev == true && found == false && bstart != -1) {\r
+                if (!exc.contains(jseq)) {\r
+                    char cc = jseq.getCharAt(i);\r
 \r
-               int blockstart = bstart-start;\r
-               int blocklen   = i-bstart;\r
+                    if (cc != c) {\r
+                        found = false;\r
+                    }\r
+                }\r
 \r
-               //System.out.println("Start len " + blockstart + " " + blocklen);\r
+                j++;\r
+            }\r
 \r
-               for (int jj = blockstart; jj < blockstart + blocklen;jj++) {\r
-                   blocks.put(new Integer(jj),new Integer(blocklen));\r
-               }\r
+            if ((prev == false) && (found == true)) {\r
+                bstart = i;\r
+            } else if ((prev == true) && (found == false) && (bstart != -1)) {\r
+                int blockstart = bstart - start;\r
+                int blocklen = i - bstart;\r
 \r
-               bstart = -1;\r
-           }\r
-           prev = found;\r
-       }\r
+                //System.out.println("Start len " + blockstart + " " + blocklen);\r
+                for (int jj = blockstart; jj < (blockstart + blocklen); jj++) {\r
+                    blocks.put(new Integer(jj), new Integer(blocklen));\r
+                }\r
 \r
-       if (bstart != -1) {\r
+                bstart = -1;\r
+            }\r
 \r
-           int blockstart = bstart-start;\r
-           int blocklen   = end-bstart;\r
+            prev = found;\r
+        }\r
 \r
-         //  System.out.println("Start len " + blockstart + " " + blocklen);\r
+        if (bstart != -1) {\r
+            int blockstart = bstart - start;\r
+            int blocklen = end - bstart;\r
 \r
-           for (int jj = blockstart; jj < blockstart + blocklen;jj++) {\r
-               blocks.put(new Integer(blockstart),new Integer(blocklen));\r
-           }\r
+            //  System.out.println("Start len " + blockstart + " " + blocklen);\r
+            for (int jj = blockstart; jj < (blockstart + blocklen); jj++) {\r
+                blocks.put(new Integer(blockstart), new Integer(blocklen));\r
+            }\r
+        }\r
 \r
-       }\r
-       return blocks;\r
+        return blocks;\r
     }\r
 \r
+    public static Hashtable findKmerCount(SequenceI seq, int start, int end,\r
+        int window, int step, Vector kmers) {\r
+        int tmpstart = start;\r
+        Hashtable vals = new Hashtable();\r
 \r
+        while (tmpstart <= end) {\r
+            String tmpstr = seq.getSequence().substring(tmpstart -\r
+                    (window / 2), tmpstart + (window / 2));\r
 \r
-    public static Hashtable findKmerCount(SequenceI seq, int start, int end,int window, int step,Vector kmers) {\r
-\r
-       int tmpstart = start;\r
-       Hashtable vals = new Hashtable();\r
+            int count = 0;\r
 \r
-       while (tmpstart <= end) {\r
+            //System.out.println("Str " + tmpstr);\r
+            for (int ii = 0; ii < kmers.size(); ii++) {\r
+                String kmer = ((SequenceI) kmers.elementAt(ii)).getSequence();\r
 \r
-           String tmpstr = seq.getSequence().substring(tmpstart-window/2,tmpstart+window/2);\r
+                int i = -1;\r
 \r
-           int count = 0;\r
+                while (tmpstr.indexOf(kmer, i) != -1) {\r
+                    i = tmpstr.indexOf(kmer, i);\r
 \r
-           //System.out.println("Str " + tmpstr);\r
-\r
-          for (int ii = 0; ii < kmers.size(); ii++) {\r
-              String kmer = ((SequenceI)kmers.elementAt(ii)).getSequence();\r
+                    i++;\r
+                    count++;\r
+                }\r
 \r
-              int i = -1;\r
+                ii++;\r
+            }\r
 \r
-              while (tmpstr.indexOf(kmer,i) != -1) {\r
-               i = tmpstr.indexOf(kmer,i);\r
+            vals.put(new Integer(tmpstart), new Integer(count));\r
+            tmpstart += step;\r
+        }\r
 \r
-               i++;\r
-               count++;\r
-              }\r
-              ii++;\r
-          }\r
-           vals.put(new Integer(tmpstart),new Integer(count));\r
-           tmpstart += step;\r
-       }\r
-       return vals;\r
+        return vals;\r
     }\r
 \r
-    public static Hashtable findBlockStarts(Vector seqs, int start, int end,Vector exc) {\r
-\r
-       // start and end are in real (not relative coords);\r
-\r
-       // The coords in the hashtable that is returned are in relative coords\r
-       // i.e. start from 0\r
+    public static Hashtable findBlockStarts(Vector seqs, int start, int end,\r
+        Vector exc) {\r
+        // start and end are in real (not relative coords);\r
+        // The coords in the hashtable that is returned are in relative coords\r
+        // i.e. start from 0\r
+        Hashtable blocks = new Hashtable();\r
 \r
-       Hashtable blocks = new Hashtable();\r
+        boolean prev = false;\r
+        int bstart = -1;\r
 \r
-       boolean prev = false;\r
-       int     bstart = -1;\r
+        for (int i = start; i <= end; i++) {\r
+            SequenceI seq = (SequenceI) seqs.elementAt(0);\r
 \r
-       for (int i = start; i <= end ; i++) {\r
-           SequenceI seq = (SequenceI)seqs.elementAt(0);\r
+            char c = seq.getCharAt(i);\r
 \r
-           char      c   = seq.getCharAt(i);\r
+            boolean found = true;\r
 \r
-           boolean found = true;\r
+            int j = 1;\r
 \r
-           int j = 1;\r
+            while ((j < seqs.size()) && (found == true)) {\r
+                SequenceI jseq = (SequenceI) seqs.elementAt(j);\r
 \r
-           while (j < seqs.size() && found == true) {\r
+                if (!exc.contains(jseq)) {\r
+                    char cc = jseq.getCharAt(i);\r
 \r
-               SequenceI jseq  = (SequenceI)seqs.elementAt(j);\r
-\r
-               if (!exc.contains(jseq)) {\r
-\r
-                   char cc = jseq.getCharAt(i);\r
-\r
-                   if ( cc != c) {\r
-                       found = false;\r
-                   }\r
-               }\r
-               j++;\r
-           }\r
-\r
-\r
-           if (prev == false && found == true) {\r
-               bstart = i;\r
-           } else if (prev == true && found == false && bstart != -1) {\r
+                    if (cc != c) {\r
+                        found = false;\r
+                    }\r
+                }\r
 \r
-               int blockstart = bstart-start;\r
-               int blocklen   = i-bstart;\r
+                j++;\r
+            }\r
 \r
-               //              System.out.println("Start len " + blockstart + " " + blocklen);\r
+            if ((prev == false) && (found == true)) {\r
+                bstart = i;\r
+            } else if ((prev == true) && (found == false) && (bstart != -1)) {\r
+                int blockstart = bstart - start;\r
+                int blocklen = i - bstart;\r
 \r
-               //for (int jj = blockstart; jj < blockstart + blocklen;jj++) {\r
-                   blocks.put(new Integer(blockstart),new Integer(blocklen));\r
-       //      }\r
+                //             System.out.println("Start len " + blockstart + " " + blocklen);\r
+                //for (int jj = blockstart; jj < blockstart + blocklen;jj++) {\r
+                blocks.put(new Integer(blockstart), new Integer(blocklen));\r
 \r
-               bstart = -1;\r
-           }\r
-           prev = found;\r
-       }\r
+                //     }\r
+                bstart = -1;\r
+            }\r
 \r
-       if (bstart != -1) {\r
+            prev = found;\r
+        }\r
 \r
-           int blockstart = bstart-start;\r
-           int blocklen   = end-bstart;\r
+        if (bstart != -1) {\r
+            int blockstart = bstart - start;\r
+            int blocklen = end - bstart;\r
 \r
-         //  System.out.println("Start len " + blockstart + " " + blocklen);\r
+            //  System.out.println("Start len " + blockstart + " " + blocklen);\r
+            //for (int jj = blockstart; jj < blockstart + blocklen;jj++) {\r
+            blocks.put(new Integer(blockstart), new Integer(blocklen));\r
 \r
-           //for (int jj = blockstart; jj < blockstart + blocklen;jj++) {\r
-               blocks.put(new Integer(blockstart),new Integer(blocklen));\r
-          // }\r
+            // }\r
+        }\r
 \r
-       }\r
-       return blocks;\r
+        return blocks;\r
     }\r
-\r
 }\r
-\r
index e77a0d3..47c17a3 100755 (executable)
 * 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.analysis;\r
 \r
-import jalview.schemes.*;\r
 import jalview.datamodel.SequenceI;\r
-import jalview.util.*;\r
+\r
 import jalview.io.*;\r
 \r
-import java.util.*;\r
-import java.io.*;\r
+import jalview.schemes.*;\r
+\r
+import jalview.util.*;\r
+\r
 import java.awt.*;\r
 \r
+import java.io.*;\r
+\r
+import java.util.*;\r
+\r
+\r
 public class AlignSeq {\r
+    public static java.util.Hashtable dnaHash = new java.util.Hashtable();\r
+\r
+    static {\r
+        dnaHash.put("C", new Integer(0));\r
+        dnaHash.put("T", new Integer(1));\r
+        dnaHash.put("A", new Integer(2));\r
+        dnaHash.put("G", new Integer(3));\r
+        dnaHash.put("-", new Integer(4));\r
+    }\r
+\r
+    static String[] dna = { "C", "T", "A", "G", "-" };\r
+    static String[] pep = {\r
+        "A", "R", "N", "D", "C", "Q", "E", "G", "H", "I", "L", "K", "M", "F",\r
+        "P", "S", "T", "W", "Y", "V", "B", "Z", "X", "-"\r
+    };\r
+    int[][] score;\r
+    int[][] E;\r
+    int[][] F;\r
+    int[][] traceback;\r
+    int[] seq1;\r
+    int[] seq2;\r
+    SequenceI s1;\r
+    SequenceI s2;\r
+    String s1str;\r
+    String s2str;\r
+    int maxi;\r
+    int maxj;\r
+    int[] aseq1;\r
+    int[] aseq2;\r
+    String astr1 = "";\r
+    String astr2 = "";\r
+    public int seq1start;\r
+    public int seq1end;\r
+    public int seq2start;\r
+    public int seq2end;\r
+    int count;\r
+    public int maxscore;\r
+    float pid;\r
+    int prev = 0;\r
+    int gapOpen = 120;\r
+    int gapExtend = 20;\r
+    int[][] lookup = ResidueProperties.getBLOSUM62();\r
+    String[] intToStr = pep;\r
+    int defInt = 23;\r
+    String output = "";\r
+    String type;\r
+    Runtime rt;\r
+\r
+    public AlignSeq() {\r
+    }\r
+\r
+    public AlignSeq(SequenceI s1, SequenceI s2, String type) {\r
+        rt = Runtime.getRuntime();\r
+        SeqInit(s1, s2, type);\r
+    }\r
+\r
+    public int getMaxScore() {\r
+        return maxscore;\r
+    }\r
 \r
-  int[][] score;\r
-  int[][] E;\r
-  int[][] F;\r
-  int[][] traceback;\r
-\r
-  int[] seq1;\r
-  int[] seq2;\r
-\r
-  SequenceI s1;\r
-  SequenceI s2;\r
-\r
-  String s1str;\r
-  String s2str;\r
-\r
-  int maxi;\r
-  int maxj;\r
-\r
-  int[] aseq1;\r
-  int[] aseq2;\r
-\r
-  String astr1 = "";\r
-  String astr2 = "";\r
-\r
-  public int seq1start;\r
-  public int seq1end;\r
-  public int seq2start;\r
-  public int seq2end;\r
-\r
-  int count;\r
-\r
-  public int maxscore;\r
-  float pid;\r
-  int prev = 0;\r
-\r
-  public static java.util.Hashtable dnaHash = new java.util.Hashtable();\r
-\r
-  static  {\r
-    dnaHash.put("C", new Integer(0));\r
-    dnaHash.put("T", new Integer(1));\r
-    dnaHash.put("A", new Integer(2));\r
-    dnaHash.put("G", new Integer(3));\r
-    dnaHash.put("-", new Integer(4));\r
-  }\r
-\r
-  static String dna[] = {"C","T","A","G","-"};\r
-  static String pep[] = {"A","R","N","D","C","Q","E","G","H","I","L","K","M","F","P","S","T","W","Y","V","B","Z","X","-"};\r
-\r
-  int gapOpen = 120;\r
-  int gapExtend = 20;\r
-\r
-  int lookup[][] = ResidueProperties.getBLOSUM62();\r
-  String intToStr[] = pep;\r
-  int defInt = 23;\r
-\r
-  String output = "";\r
-\r
-  String type;\r
-  Runtime rt;\r
-  public AlignSeq() {}\r
-\r
-  public AlignSeq(SequenceI s1, SequenceI s2,String type) {\r
-    rt  = Runtime.getRuntime();\r
-    SeqInit(s1,s2,type);\r
-  }\r
-\r
-  public int getMaxScore() {\r
-    return maxscore;\r
-  }\r
-\r
-  public int getSeq2Start() {\r
-    return seq2start;\r
-  }\r
-\r
-  public int getSeq2End() {\r
-    return seq2end;\r
-  }\r
-\r
-  public int getSeq1Start() {\r
-    return seq1start;\r
-  }\r
-\r
-  public int getSeq1End() {\r
-    return seq1end;\r
-  }\r
-\r
-  public String getOutput() {\r
-    return output;\r
-  }\r
-\r
-  public String getAStr1() {\r
-    return astr1;\r
-  }\r
-  public String getAStr2() {\r
-    return astr2;\r
-  }\r
-  public int [] getASeq1() {\r
-    return aseq1;\r
-  }\r
-  public int [] getASeq2() {\r
-    return aseq2;\r
-  }\r
-  public SequenceI getS1() {\r
-    return s1;\r
-  }\r
-  public SequenceI getS2() {\r
-    return s2;\r
-  }\r
-\r
-  public void SeqInit(SequenceI s1, SequenceI s2,String type) {\r
-    s1str = extractGaps(".",s1.getSequence());\r
-    s2str = extractGaps(".",s2.getSequence());\r
-    s1str = extractGaps("-",s1str);\r
-    s2str = extractGaps("-",s2str);\r
-    s1str = extractGaps(" ",s1str);\r
-    s2str = extractGaps(" ",s2str);\r
-\r
-    this.s1 = s1;\r
-    this.s2 = s2;\r
-\r
-    this.type = type;\r
-\r
-    if (type.equals("pep")) {\r
-      lookup = ResidueProperties.getBLOSUM62();\r
-      intToStr = pep;\r
-      defInt = 23;\r
-    } else if (type.equals("dna")) {\r
-      lookup = ResidueProperties.getDNA();\r
-      intToStr = dna;\r
-      defInt = 4;\r
-    } else {\r
-      output = output + ("Wrong type = dna or pep only");\r
-      System.exit(0);\r
+    public int getSeq2Start() {\r
+        return seq2start;\r
     }\r
 \r
+    public int getSeq2End() {\r
+        return seq2end;\r
+    }\r
 \r
-    //System.out.println("lookuip " + rt.freeMemory() + " "+  rt.totalMemory());\r
-    seq1 = new int[s1str.length()];\r
-    //System.out.println("seq1 " + rt.freeMemory() +" "  + rt.totalMemory());\r
-    seq2 = new int[s2str.length()];\r
-    //System.out.println("seq2 " + rt.freeMemory() + " " + rt.totalMemory());\r
-    score = new int[s1str.length()][s2str.length()];\r
-    //System.out.println("score " + rt.freeMemory() + " " + rt.totalMemory());\r
-    E = new int[s1str.length()][s2str.length()];\r
-    //System.out.println("E " + rt.freeMemory() + " " + rt.totalMemory());\r
-    F = new int[s1str.length()][s2str.length()];\r
-    traceback = new int[s1str.length()][s2str.length()];\r
-    //System.out.println("F " + rt.freeMemory() + " " + rt.totalMemory());\r
-    seq1 = stringToInt(s1str,type);\r
-    //System.out.println("seq1 " + rt.freeMemory() + " " + rt.totalMemory());\r
-    seq2 = stringToInt(s2str,type);\r
-    //System.out.println("Seq2 " + rt.freeMemory() + " " + rt.totalMemory());\r
-\r
-    //   long tstart = System.currentTimeMillis();\r
-    //    calcScoreMatrix();\r
-    //long tend = System.currentTimeMillis();\r
-\r
-    //System.out.println("Time take to calculate score matrix = " + (tend-tstart) + " ms");\r
-\r
-\r
-    //   printScoreMatrix(score);\r
-    //System.out.println();\r
-\r
-    //printScoreMatrix(traceback);\r
-    //System.out.println();\r
-\r
-    //  printScoreMatrix(E);\r
-    //System.out.println();\r
-\r
-    ///printScoreMatrix(F);\r
-    //System.out.println();\r
-    // tstart = System.currentTimeMillis();\r
-    //traceAlignment();\r
-    //tend = System.currentTimeMillis();\r
-    //System.out.println("Time take to traceback alignment = " + (tend-tstart) + " ms");\r
-  }\r
-\r
-  public void traceAlignment() {\r
-\r
-    // Find the maximum score along the rhs or bottom row\r
-    int max = -9999;\r
-    for (int i = 0; i < seq1.length; i++) {\r
-      if (score[i][seq2.length - 1] > max ) {\r
-        max = score[i][seq2.length - 1];\r
-        maxi = i;\r
-        maxj = seq2.length-1;\r
-      }\r
+    public int getSeq1Start() {\r
+        return seq1start;\r
     }\r
-    for (int j = 0; j < seq2.length; j++) {\r
-      if (score[seq1.length - 1][j] > max ) {\r
-        max = score[seq1.length - 1][j];\r
-        maxi = seq1.length-1;\r
-        maxj = j;\r
-      }\r
+\r
+    public int getSeq1End() {\r
+        return seq1end;\r
     }\r
 \r
-    //  System.out.println(maxi + " " + maxj + " " + score[maxi][maxj]);\r
-\r
-    int i = maxi;\r
-    int j = maxj;\r
-    int trace;\r
-    maxscore = score[i][j] / 10;\r
-\r
-    seq1end = maxi+1;\r
-    seq2end = maxj+1;\r
-\r
-    aseq1 = new int[seq1.length + seq2.length];\r
-    aseq2 = new int[seq1.length + seq2.length];\r
-\r
-    count = seq1.length + seq2.length - 1;\r
-\r
-    while (i>0 && j >0) {\r
-\r
-      if (aseq1[count] != defInt && i >=0) {\r
-        aseq1[count] = seq1[i];\r
-        astr1 = intToStr[seq1[i]] + astr1;\r
-      }\r
-\r
-      if (aseq2[count] != defInt && j > 0) {\r
-        aseq2[count] = seq2[j];\r
-        astr2 = intToStr[seq2[j]] + astr2;\r
-      }\r
-      trace = findTrace(i,j);\r
-      if (trace == 0) {\r
-        i--;\r
-        j--;\r
-\r
-      } else  if (trace == 1) {\r
-        j--;\r
-        aseq1[count] = defInt;\r
-        astr1 = "-" + astr1.substring(1);\r
-      } else  if (trace == -1) {\r
-        i--;\r
-        aseq2[count] = defInt;\r
-        astr2 = "-" + astr2.substring(1);\r
-      }\r
-      count--;\r
+    public String getOutput() {\r
+        return output;\r
     }\r
 \r
-    seq1start = i+1;\r
-    seq2start = j+1;\r
+    public String getAStr1() {\r
+        return astr1;\r
+    }\r
 \r
-    if (aseq1[count] != defInt) {\r
-      aseq1[count] = seq1[i];\r
-      astr1 = intToStr[seq1[i]] + astr1;\r
+    public String getAStr2() {\r
+        return astr2;\r
     }\r
 \r
-    if (aseq2[count] != defInt) {\r
-      aseq2[count] = seq2[j];\r
-      astr2 = intToStr[seq2[j]] + astr2;\r
+    public int[] getASeq1() {\r
+        return aseq1;\r
     }\r
-  }\r
 \r
-  public void printAlignment() {\r
-    // Find the biggest id length for formatting purposes\r
-    int maxid = s1.getName().length();\r
+    public int[] getASeq2() {\r
+        return aseq2;\r
+    }\r
 \r
-    if (s2.getName().length() > maxid) {\r
-      maxid = s2.getName().length();\r
+    public SequenceI getS1() {\r
+        return s1;\r
     }\r
 \r
-    int len = 72 - maxid - 1;\r
-    int nochunks = ((aseq1.length - count) / len) + 1;\r
-    pid = 0;\r
-    int overlap = 0;\r
-\r
-    output = output + ("Score = " + score[maxi][maxj] + "\n");\r
-    output = output + ("Length of alignment = " + (aseq1.length-count) + "\n");\r
-    output = output + ("Sequence ");\r
-    output = output + (new Format("%" + maxid + "s").form(s1.getName()));\r
-    output = output + (" :  " + seq1start + " - " + seq1end + " (Sequence length = " + s1str.length() + ")\n");\r
-    output = output + ("Sequence ");\r
-    output = output + (new Format("%" + maxid + "s").form(s2.getName()));\r
-    output = output + (" :  " + seq2start + " - " + seq2end + " (Sequence length = " + s2str.length() + ")\n\n");\r
-\r
-    for (int j = 0; j < nochunks; j++) {\r
-      // Print the first aligned sequence\r
-      output = output + (new Format("%" + (maxid) + "s").form(s1.getName()) + " ");\r
-      for (int i = 0; i < len ; i++) {\r
-\r
-        if ((count + i + j*len) < aseq1.length) {\r
-          output = output + (new Format("%s").form(intToStr[aseq1[count + i + j*len]]));\r
+    public SequenceI getS2() {\r
+        return s2;\r
+    }\r
+\r
+    public void SeqInit(SequenceI s1, SequenceI s2, String type) {\r
+        s1str = extractGaps(".", s1.getSequence());\r
+        s2str = extractGaps(".", s2.getSequence());\r
+        s1str = extractGaps("-", s1str);\r
+        s2str = extractGaps("-", s2str);\r
+        s1str = extractGaps(" ", s1str);\r
+        s2str = extractGaps(" ", s2str);\r
+\r
+        this.s1 = s1;\r
+        this.s2 = s2;\r
+\r
+        this.type = type;\r
+\r
+        if (type.equals("pep")) {\r
+            lookup = ResidueProperties.getBLOSUM62();\r
+            intToStr = pep;\r
+            defInt = 23;\r
+        } else if (type.equals("dna")) {\r
+            lookup = ResidueProperties.getDNA();\r
+            intToStr = dna;\r
+            defInt = 4;\r
+        } else {\r
+            output = output + ("Wrong type = dna or pep only");\r
+            System.exit(0);\r
         }\r
-      }\r
-\r
-      output = output + ("\n");\r
-      output = output + (new Format("%" + (maxid) + "s").form(" ") + " ");\r
-      // Print out the matching chars\r
-      for (int i = 0; i < len ; i++) {\r
-\r
-        if ((count + i + j*len) < aseq1.length) {\r
-          if ( intToStr[aseq1[count+i+j*len]].equals(intToStr[aseq2[count+i+j*len]]) && !intToStr[aseq1[count+i+j*len]].equals("-")) {\r
-            pid++;\r
-            output = output + ("|");\r
-          } else if (type.equals("pep")) {\r
-            if (ResidueProperties.getPAM250(intToStr[aseq1[count+i+j*len]],intToStr[aseq2[count+i+j*len]]) > 0) {\r
-              output  = output + (".");\r
-            } else {\r
-              output = output + (" ");\r
+\r
+        //System.out.println("lookuip " + rt.freeMemory() + " "+  rt.totalMemory());\r
+        seq1 = new int[s1str.length()];\r
+\r
+        //System.out.println("seq1 " + rt.freeMemory() +" "  + rt.totalMemory());\r
+        seq2 = new int[s2str.length()];\r
+\r
+        //System.out.println("seq2 " + rt.freeMemory() + " " + rt.totalMemory());\r
+        score = new int[s1str.length()][s2str.length()];\r
+\r
+        //System.out.println("score " + rt.freeMemory() + " " + rt.totalMemory());\r
+        E = new int[s1str.length()][s2str.length()];\r
+\r
+        //System.out.println("E " + rt.freeMemory() + " " + rt.totalMemory());\r
+        F = new int[s1str.length()][s2str.length()];\r
+        traceback = new int[s1str.length()][s2str.length()];\r
+\r
+        //System.out.println("F " + rt.freeMemory() + " " + rt.totalMemory());\r
+        seq1 = stringToInt(s1str, type);\r
+\r
+        //System.out.println("seq1 " + rt.freeMemory() + " " + rt.totalMemory());\r
+        seq2 = stringToInt(s2str, type);\r
+\r
+        //System.out.println("Seq2 " + rt.freeMemory() + " " + rt.totalMemory());\r
+        //   long tstart = System.currentTimeMillis();\r
+        //    calcScoreMatrix();\r
+        //long tend = System.currentTimeMillis();\r
+        //System.out.println("Time take to calculate score matrix = " + (tend-tstart) + " ms");\r
+        //   printScoreMatrix(score);\r
+        //System.out.println();\r
+        //printScoreMatrix(traceback);\r
+        //System.out.println();\r
+        //  printScoreMatrix(E);\r
+        //System.out.println();\r
+        ///printScoreMatrix(F);\r
+        //System.out.println();\r
+        // tstart = System.currentTimeMillis();\r
+        //traceAlignment();\r
+        //tend = System.currentTimeMillis();\r
+        //System.out.println("Time take to traceback alignment = " + (tend-tstart) + " ms");\r
+    }\r
+\r
+    public void traceAlignment() {\r
+        // Find the maximum score along the rhs or bottom row\r
+        int max = -9999;\r
+\r
+        for (int i = 0; i < seq1.length; i++) {\r
+            if (score[i][seq2.length - 1] > max) {\r
+                max = score[i][seq2.length - 1];\r
+                maxi = i;\r
+                maxj = seq2.length - 1;\r
             }\r
-          } else {\r
-            output = output + (" ");\r
-          }\r
+        }\r
 \r
+        for (int j = 0; j < seq2.length; j++) {\r
+            if (score[seq1.length - 1][j] > max) {\r
+                max = score[seq1.length - 1][j];\r
+                maxi = seq1.length - 1;\r
+                maxj = j;\r
+            }\r
         }\r
-      }\r
-      // Now print the second aligned sequence\r
-      output = output + ("\n");\r
-      output = output + (new Format("%" + (maxid) + "s").form(s2.getName()) + " " );\r
-      for (int i = 0; i < len ; i++) {\r
-        if ((count + i + j*len) < aseq1.length) {\r
-          output = output + (new Format("%s").form(intToStr[aseq2[count + i + j*len]]));\r
+\r
+        //  System.out.println(maxi + " " + maxj + " " + score[maxi][maxj]);\r
+        int i = maxi;\r
+        int j = maxj;\r
+        int trace;\r
+        maxscore = score[i][j] / 10;\r
+\r
+        seq1end = maxi + 1;\r
+        seq2end = maxj + 1;\r
+\r
+        aseq1 = new int[seq1.length + seq2.length];\r
+        aseq2 = new int[seq1.length + seq2.length];\r
+\r
+        count = (seq1.length + seq2.length) - 1;\r
+\r
+        while ((i > 0) && (j > 0)) {\r
+            if ((aseq1[count] != defInt) && (i >= 0)) {\r
+                aseq1[count] = seq1[i];\r
+                astr1 = intToStr[seq1[i]] + astr1;\r
+            }\r
+\r
+            if ((aseq2[count] != defInt) && (j > 0)) {\r
+                aseq2[count] = seq2[j];\r
+                astr2 = intToStr[seq2[j]] + astr2;\r
+            }\r
+\r
+            trace = findTrace(i, j);\r
+\r
+            if (trace == 0) {\r
+                i--;\r
+                j--;\r
+            } else if (trace == 1) {\r
+                j--;\r
+                aseq1[count] = defInt;\r
+                astr1 = "-" + astr1.substring(1);\r
+            } else if (trace == -1) {\r
+                i--;\r
+                aseq2[count] = defInt;\r
+                astr2 = "-" + astr2.substring(1);\r
+            }\r
+\r
+            count--;\r
         }\r
-      }\r
-      output = output + ("\n\n");\r
-    }\r
-    pid = pid/(float)(aseq1.length-count)*100;\r
-    output = output + (new Format("Percentage ID = %2.2f\n\n").form(pid));\r
 \r
-  }\r
+        seq1start = i + 1;\r
+        seq2start = j + 1;\r
 \r
-  public void printScoreMatrix(int[][] mat) {\r
-    int n = seq1.length;\r
-    int m = seq2.length;\r
+        if (aseq1[count] != defInt) {\r
+            aseq1[count] = seq1[i];\r
+            astr1 = intToStr[seq1[i]] + astr1;\r
+        }\r
 \r
-    for (int i = 0; i < n;i++) {\r
-      // Print the top sequence\r
-      if (i == 0) {\r
-        Format.print(System.out,"%8s",s2str.substring(0,1));\r
-        for (int jj = 1;jj < m; jj++) {\r
-          Format.print(System.out,"%5s",s2str.substring(jj,jj+1));\r
+        if (aseq2[count] != defInt) {\r
+            aseq2[count] = seq2[j];\r
+            astr2 = intToStr[seq2[j]] + astr2;\r
         }\r
-        System.out.println();\r
-      }\r
+    }\r
 \r
-      for (int j = 0;j < m; j++) {\r
-        if (j == 0) {\r
-          Format.print(System.out,"%3s",s1str.substring(i,i+1));\r
+    public void printAlignment() {\r
+        // Find the biggest id length for formatting purposes\r
+        int maxid = s1.getName().length();\r
+\r
+        if (s2.getName().length() > maxid) {\r
+            maxid = s2.getName().length();\r
         }\r
-        Format.print(System.out,"%3d ",mat[i][j]/10);\r
-      }\r
-      System.out.println();\r
+\r
+        int len = 72 - maxid - 1;\r
+        int nochunks = ((aseq1.length - count) / len) + 1;\r
+        pid = 0;\r
+\r
+        int overlap = 0;\r
+\r
+        output = output + ("Score = " + score[maxi][maxj] + "\n");\r
+        output = output +\r
+            ("Length of alignment = " + (aseq1.length - count) + "\n");\r
+        output = output + ("Sequence ");\r
+        output = output + (new Format("%" + maxid + "s").form(s1.getName()));\r
+        output = output +\r
+            (" :  " + seq1start + " - " + seq1end + " (Sequence length = " +\r
+            s1str.length() + ")\n");\r
+        output = output + ("Sequence ");\r
+        output = output + (new Format("%" + maxid + "s").form(s2.getName()));\r
+        output = output +\r
+            (" :  " + seq2start + " - " + seq2end + " (Sequence length = " +\r
+            s2str.length() + ")\n\n");\r
+\r
+        for (int j = 0; j < nochunks; j++) {\r
+            // Print the first aligned sequence\r
+            output = output +\r
+                (new Format("%" + (maxid) + "s").form(s1.getName()) + " ");\r
+\r
+            for (int i = 0; i < len; i++) {\r
+                if ((count + i + (j * len)) < aseq1.length) {\r
+                    output = output +\r
+                        (new Format("%s").form(intToStr[aseq1[count + i +\r
+                            (j * len)]]));\r
+                }\r
+            }\r
+\r
+            output = output + ("\n");\r
+            output = output +\r
+                (new Format("%" + (maxid) + "s").form(" ") + " ");\r
+\r
+            // Print out the matching chars\r
+            for (int i = 0; i < len; i++) {\r
+                if ((count + i + (j * len)) < aseq1.length) {\r
+                    if (intToStr[aseq1[count + i + (j * len)]].equals(\r
+                                intToStr[aseq2[count + i + (j * len)]]) &&\r
+                            !intToStr[aseq1[count + i + (j * len)]].equals("-")) {\r
+                        pid++;\r
+                        output = output + ("|");\r
+                    } else if (type.equals("pep")) {\r
+                        if (ResidueProperties.getPAM250(\r
+                                    intToStr[aseq1[count + i + (j * len)]],\r
+                                    intToStr[aseq2[count + i + (j * len)]]) > 0) {\r
+                            output = output + (".");\r
+                        } else {\r
+                            output = output + (" ");\r
+                        }\r
+                    } else {\r
+                        output = output + (" ");\r
+                    }\r
+                }\r
+            }\r
+\r
+            // Now print the second aligned sequence\r
+            output = output + ("\n");\r
+            output = output +\r
+                (new Format("%" + (maxid) + "s").form(s2.getName()) + " ");\r
+\r
+            for (int i = 0; i < len; i++) {\r
+                if ((count + i + (j * len)) < aseq1.length) {\r
+                    output = output +\r
+                        (new Format("%s").form(intToStr[aseq2[count + i +\r
+                            (j * len)]]));\r
+                }\r
+            }\r
+\r
+            output = output + ("\n\n");\r
+        }\r
+\r
+        pid = pid / (float) (aseq1.length - count) * 100;\r
+        output = output + (new Format("Percentage ID = %2.2f\n\n").form(pid));\r
     }\r
-  }\r
-\r
-  public int findTrace(int i,int j) {\r
-    int t = 0;\r
-    int max = score[i-1][j-1] + lookup[seq1[i]][seq2[j]] * 10;\r
-\r
-    if (F[i][j] > max) {\r
-      max = F[i][j];\r
-      t = -1;\r
-    } else if (F[i][j] == max) {\r
-      if (prev == -1) {\r
-        max = F[i][j];\r
-        t = -1;\r
-      }\r
+\r
+    public void printScoreMatrix(int[][] mat) {\r
+        int n = seq1.length;\r
+        int m = seq2.length;\r
+\r
+        for (int i = 0; i < n; i++) {\r
+            // Print the top sequence\r
+            if (i == 0) {\r
+                Format.print(System.out, "%8s", s2str.substring(0, 1));\r
+\r
+                for (int jj = 1; jj < m; jj++) {\r
+                    Format.print(System.out, "%5s", s2str.substring(jj, jj + 1));\r
+                }\r
+\r
+                System.out.println();\r
+            }\r
+\r
+            for (int j = 0; j < m; j++) {\r
+                if (j == 0) {\r
+                    Format.print(System.out, "%3s", s1str.substring(i, i + 1));\r
+                }\r
+\r
+                Format.print(System.out, "%3d ", mat[i][j] / 10);\r
+            }\r
+\r
+            System.out.println();\r
+        }\r
     }\r
-    if (E[i][j] >= max) {\r
-      max = E[i][j];\r
-      t = 1;\r
-    } else if (E[i][j] == max) {\r
-      if (prev == 1) {\r
-        max = E[i][j];\r
-        t = 1;\r
-      }\r
+\r
+    public int findTrace(int i, int j) {\r
+        int t = 0;\r
+        int max = score[i - 1][j - 1] + (lookup[seq1[i]][seq2[j]] * 10);\r
+\r
+        if (F[i][j] > max) {\r
+            max = F[i][j];\r
+            t = -1;\r
+        } else if (F[i][j] == max) {\r
+            if (prev == -1) {\r
+                max = F[i][j];\r
+                t = -1;\r
+            }\r
+        }\r
+\r
+        if (E[i][j] >= max) {\r
+            max = E[i][j];\r
+            t = 1;\r
+        } else if (E[i][j] == max) {\r
+            if (prev == 1) {\r
+                max = E[i][j];\r
+                t = 1;\r
+            }\r
+        }\r
+\r
+        prev = t;\r
+\r
+        return t;\r
     }\r
-    prev = t;\r
-    return t;\r
-  }\r
 \r
-  public void calcScoreMatrix() {\r
+    public void calcScoreMatrix() {\r
+        int n = seq1.length;\r
+        int m = seq2.length;\r
 \r
+        // top left hand element\r
+        score[0][0] = lookup[seq1[0]][seq2[0]] * 10;\r
+        E[0][0] = -gapExtend;\r
+        F[0][0] = 0;\r
 \r
-    int n = seq1.length;\r
-    int m = seq2.length;\r
+        // Calculate the top row first\r
+        for (int j = 1; j < m; j++) {\r
+            // What should these values be? 0 maybe\r
+            E[0][j] = max(score[0][j - 1] - gapOpen, E[0][j - 1] - gapExtend);\r
+            F[0][j] = -gapExtend;\r
 \r
+            score[0][j] = max(lookup[seq1[0]][seq2[j]] * 10, -gapOpen,\r
+                    -gapExtend);\r
 \r
-    // top left hand element\r
-    score[0][0] =  lookup[seq1[0]][seq2[0]] * 10;\r
-    E[0][0] = -gapExtend;\r
-    F[0][0] = 0;\r
+            traceback[0][j] = 1;\r
+        }\r
 \r
-    // Calculate the top row first\r
-    for (int j=1; j < m; j++) {\r
-      // What should these values be? 0 maybe\r
-      E[0][j] = max(score[0][j-1] - gapOpen,E[0][j-1] - gapExtend);\r
-      F[0][j] = -gapExtend;\r
+        // Now do the left hand column\r
+        for (int i = 1; i < n; i++) {\r
+            E[i][0] = -gapOpen;\r
+            F[i][0] = max(score[i - 1][0] - gapOpen, F[i - 1][0] - gapExtend);\r
 \r
-      score[0][j] = max( lookup[seq1[0]][seq2[j]] * 10 ,-gapOpen,-gapExtend);\r
+            score[i][0] = max(lookup[seq1[i]][seq2[0]] * 10, E[i][0], F[i][0]);\r
+            traceback[i][0] = -1;\r
+        }\r
 \r
-      traceback[0][j] = 1;\r
+        // Now do all the other rows\r
+        for (int i = 1; i < n; i++) {\r
+            for (int j = 1; j < m; j++) {\r
+                E[i][j] = max(score[i][j - 1] - gapOpen, E[i][j - 1] -\r
+                        gapExtend);\r
+                F[i][j] = max(score[i - 1][j] - gapOpen, F[i - 1][j] -\r
+                        gapExtend);\r
+\r
+                score[i][j] = max(score[i - 1][j - 1] +\r
+                        (lookup[seq1[i]][seq2[j]] * 10), E[i][j], F[i][j]);\r
+                traceback[i][j] = findTrace(i, j);\r
+            }\r
+        }\r
     }\r
 \r
-    // Now do the left hand column\r
-    for (int i=1; i < n; i++) {\r
-      E[i][0] =  -gapOpen;\r
-      F[i][0] =  max(score[i-1][0]-gapOpen,F[i-1][0]-gapExtend);\r
+    public static String extractChars(String chars, String seq) {\r
+        String out = seq;\r
+\r
+        for (int i = 0; i < chars.length(); i++) {\r
+            String gap = chars.substring(i, i + 1);\r
+            out = extractGaps(gap, out);\r
+        }\r
 \r
-      score[i][0] = max( lookup[seq1[i]][seq2[0]] * 10 ,E[i][0],F[i][0]);\r
-      traceback[i][0] = -1;\r
+        return out;\r
     }\r
 \r
-    // Now do all the other rows\r
-    for (int i = 1; i < n; i++) {\r
-      for (int j = 1; j < m; j++) {\r
+    public static String extractGaps(String gapChar, String seq) {\r
+        StringTokenizer str = new StringTokenizer(seq, gapChar);\r
+        String newString = "";\r
 \r
-        E[i][j] = max(score[i][j-1] - gapOpen,  E[i][j-1] - gapExtend);\r
-        F[i][j] = max(score[i-1][j] - gapOpen,  F[i-1][j] - gapExtend);\r
+        while (str.hasMoreTokens()) {\r
+            newString = newString + str.nextToken();\r
+        }\r
 \r
-        score[i][j] = max(score[i-1][j-1] + lookup[seq1[i]][seq2[j]]*10,\r
-                          E[i][j],\r
-                          F[i][j]);\r
-        traceback[i][j] = findTrace(i,j);\r
-      }\r
+        return newString;\r
     }\r
 \r
-  }\r
-  public static String extractChars(String chars, String seq) {\r
-    String out = seq;\r
-    for (int i=0; i < chars.length(); i++) {\r
-      String gap = chars.substring(i,i+1);\r
-      out = extractGaps(gap,out);\r
-    }\r
-    return out;\r
-  }\r
-  public static String extractGaps(String gapChar, String seq) {\r
-    StringTokenizer str = new StringTokenizer(seq,gapChar);\r
-    String newString = "";\r
-\r
-    while (str.hasMoreTokens()) {\r
-      newString  = newString + str.nextToken();\r
-    }\r
-    return newString;\r
-  }\r
+    public int max(int i1, int i2, int i3) {\r
+        int max = i1;\r
 \r
+        if (i2 > i1) {\r
+            max = i2;\r
+        }\r
 \r
-  public int max(int i1, int i2, int i3) {\r
-    int max = i1;\r
-    if (i2 > i1)  {\r
-      max = i2;\r
-    }\r
-    if (i3 > max) {\r
-      max = i3;\r
-    }\r
-    return max;\r
-  }\r
+        if (i3 > max) {\r
+            max = i3;\r
+        }\r
 \r
-  public int max(int i1, int i2) {\r
-    int max = i1;\r
-    if (i2 > i1)  {\r
-      max = i2;\r
+        return max;\r
     }\r
-    return max;\r
-  }\r
 \r
-  public int[] stringToInt(String s,String type) {\r
-    int[] seq1 = new int[s.length()];\r
+    public int max(int i1, int i2) {\r
+        int max = i1;\r
 \r
-    for (int i = 0;i < s.length(); i++) {\r
-      String ss = s.substring(i,i+1).toUpperCase();\r
-      try {\r
-        if (type.equals("pep")) {\r
-          seq1[i] = ((Integer)ResidueProperties.aaHash.get(ss)).intValue();\r
-        } else if (type.equals("dna")) {\r
-          seq1[i] = ((Integer)dnaHash.get(ss)).intValue();\r
-        }\r
-        if (seq1[i] > 23) {\r
-          seq1[i] = 23;\r
+        if (i2 > i1) {\r
+            max = i2;\r
         }\r
-      } catch (Exception e) {\r
-        if (type.equals("dna")) {\r
-          seq1[i] = 4;\r
-        } else {\r
-          seq1[i] = 23;\r
+\r
+        return max;\r
+    }\r
+\r
+    public int[] stringToInt(String s, String type) {\r
+        int[] seq1 = new int[s.length()];\r
+\r
+        for (int i = 0; i < s.length(); i++) {\r
+            String ss = s.substring(i, i + 1).toUpperCase();\r
+\r
+            try {\r
+                if (type.equals("pep")) {\r
+                    seq1[i] = ((Integer) ResidueProperties.aaHash.get(ss)).intValue();\r
+                } else if (type.equals("dna")) {\r
+                    seq1[i] = ((Integer) dnaHash.get(ss)).intValue();\r
+                }\r
+\r
+                if (seq1[i] > 23) {\r
+                    seq1[i] = 23;\r
+                }\r
+            } catch (Exception e) {\r
+                if (type.equals("dna")) {\r
+                    seq1[i] = 4;\r
+                } else {\r
+                    seq1[i] = 23;\r
+                }\r
+            }\r
         }\r
-      }\r
+\r
+        return seq1;\r
     }\r
-    return seq1;\r
-  }\r
 \r
-  public static void displayMatrix(Graphics g, int[][] mat, int n, int m,int psize) {\r
+    public static void displayMatrix(Graphics g, int[][] mat, int n, int m,\r
+        int psize) {\r
+        int max = -1000;\r
+        int min = 1000;\r
 \r
-    int max = -1000;\r
-    int min = 1000;\r
+        for (int i = 0; i < n; i++) {\r
+            for (int j = 0; j < m; j++) {\r
+                if (mat[i][j] >= max) {\r
+                    max = mat[i][j];\r
+                }\r
 \r
-    for (int i=0; i < n; i++) {\r
-      for (int j=0; j < m; j++) {\r
-        if (mat[i][j] >= max) {\r
-          max = mat[i][j];\r
-        }\r
-        if (mat[i][j] <= min) {\r
-          min = mat[i][j];\r
+                if (mat[i][j] <= min) {\r
+                    min = mat[i][j];\r
+                }\r
+            }\r
         }\r
-      }\r
-    }\r
-    System.out.println(max + " " + min);\r
-    for (int i=0; i < n; i++) {\r
-      for (int j=0; j < m; j++) {\r
-        int x = psize*i;\r
-        int y = psize*j;\r
-        //     System.out.println(mat[i][j]);\r
-        float score = (float)(mat[i][j] - min)/(float)(max-min);\r
-        g.setColor(new Color(score,0,0));\r
-        g.fillRect(x,y,psize,psize);\r
-        //     System.out.println(x + " " + y + " " + score);\r
-      }\r
 \r
-    }\r
-  }\r
+        System.out.println(max + " " + min);\r
+\r
+        for (int i = 0; i < n; i++) {\r
+            for (int j = 0; j < m; j++) {\r
+                int x = psize * i;\r
+                int y = psize * j;\r
+\r
+                //     System.out.println(mat[i][j]);\r
+                float score = (float) (mat[i][j] - min) / (float) (max - min);\r
+                g.setColor(new Color(score, 0, 0));\r
+                g.fillRect(x, y, psize, psize);\r
 \r
+                //     System.out.println(x + " " + y + " " + score);\r
+            }\r
+        }\r
+    }\r
 }\r
index 53eb1dd..7c2a554 100755 (executable)
 * 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.analysis;\r
 \r
 import jalview.datamodel.*;\r
-import jalview.util.*;\r
+\r
 import jalview.io.*;\r
 \r
+import jalview.util.*;\r
+\r
 import java.util.*;\r
 \r
+\r
 /** Data structure to hold and manipulate a multiple sequence alignment\r
  */\r
 public class AlignmentSorter {\r
-\r
-  private AlignmentSorter() {\r
-    try\r
-    {\r
-      jbInit();\r
+    /**    */\r
+    static boolean sortIdAscending = true;\r
+    static int lastGroupHash = 0;\r
+    static boolean sortGroupAscending = true;\r
+    static AlignmentOrder lastOrder = null;\r
+    static boolean sortOrderAscending = true;\r
+    static NJTree lastTree = null;\r
+    static boolean sortTreeAscending = true;\r
+\r
+    private AlignmentSorter() {\r
+        try {\r
+            jbInit();\r
+        } catch (Exception ex) {\r
+            ex.printStackTrace();\r
+        }\r
     }\r
-    catch (Exception ex)\r
-    {\r
-      ex.printStackTrace();\r
-    }\r
-  }\r
 \r
-  public static void sortGroups(AlignmentI align) {\r
-    Vector groups = align.getGroups();\r
-    int    nGroup = groups.size();\r
+    public static void sortGroups(AlignmentI align) {\r
+        Vector groups = align.getGroups();\r
+        int nGroup = groups.size();\r
+\r
+        float[] arr = new float[nGroup];\r
+        Object[] s = new Object[nGroup];\r
 \r
-    float[]  arr = new float [nGroup];\r
-    Object[] s   = new Object[nGroup];\r
+        for (int i = 0; i < nGroup; i++) {\r
+            arr[i] = ((SequenceGroup) groups.elementAt(i)).getSize();\r
+            s[i] = groups.elementAt(i);\r
+        }\r
 \r
-    for (int i=0; i < nGroup; i++) {\r
-      arr[i] = ((SequenceGroup)groups.elementAt(i)).getSize();\r
-      s[i]   = groups.elementAt(i);\r
+        QuickSort.sort(arr, s);\r
+\r
+        //  align..setGroups(newg);\r
     }\r
 \r
-    QuickSort.sort(arr,s);\r
+    /**\r
+     * Sort by Percentage Identity\r
+     *\r
+     * @param align AlignmentI\r
+     * @param s SequenceI\r
+     */\r
+    public static void sortByPID(AlignmentI align, SequenceI s) {\r
+        int nSeq = align.getHeight();\r
 \r
-    //  align..setGroups(newg);\r
-  }\r
+        float[] scores = new float[nSeq];\r
+        SequenceI[] seqs = new SequenceI[nSeq];\r
 \r
-  /**\r
-   * Sort by Percentage Identity\r
-   *\r
-   * @param align AlignmentI\r
-   * @param s SequenceI\r
-   */\r
-  public static void sortByPID(AlignmentI align, SequenceI s) {\r
-    int nSeq = align.getHeight();\r
+        for (int i = 0; i < nSeq; i++) {\r
+            scores[i] = Comparison.PID(align.getSequenceAt(i), s);\r
+            seqs[i] = align.getSequenceAt(i);\r
+        }\r
 \r
-    float     scores[] = new float[nSeq];\r
-    SequenceI seqs[]   = new SequenceI[nSeq];\r
+        QuickSort.sort(scores, 0, scores.length - 1, seqs);\r
 \r
-    for (int i = 0; i < nSeq; i++) {\r
-      scores[i] = Comparison.PID(align.getSequenceAt(i),s);\r
-      seqs[i]   = align.getSequenceAt(i);\r
+        setReverseOrder(align, seqs);\r
     }\r
 \r
-    QuickSort.sort(scores,0,scores.length-1,seqs);\r
+    private static void setReverseOrder(AlignmentI align, SequenceI[] seqs) {\r
+        int nSeq = seqs.length;\r
+\r
+        int len = 0;\r
 \r
-   setReverseOrder(align,seqs);\r
-  }\r
+        if ((nSeq % 2) == 0) {\r
+            len = nSeq / 2;\r
+        } else {\r
+            len = (nSeq + 1) / 2;\r
+        }\r
 \r
-  private static void setReverseOrder(AlignmentI align, SequenceI [] seqs) {\r
-    int nSeq = seqs.length;\r
+        // NOTE: DO NOT USE align.setSequenceAt() here - it will NOT work\r
+        for (int i = 0; i < len; i++) {\r
+            //SequenceI tmp = seqs[i];\r
+            align.getSequences().setElementAt(seqs[nSeq - i - 1], i);\r
+            align.getSequences().setElementAt(seqs[i], nSeq - i - 1);\r
+        }\r
+    }\r
 \r
-    int len = 0;\r
-    if (nSeq%2 == 0) {\r
-      len = nSeq/2;\r
-    } else {\r
-      len = (nSeq+1)/2;\r
+    private static void setOrder(AlignmentI align, Vector tmp) {\r
+        setOrder(align, vectorSubsetToArray(tmp, align.getSequences()));\r
     }\r
 \r
-// NOTE: DO NOT USE align.setSequenceAt() here - it will NOT work\r
-    for (int i = 0; i < len; i++) {\r
-      //SequenceI tmp = seqs[i];\r
-      align.getSequences().setElementAt(seqs[nSeq-i-1],i);\r
-      align.getSequences().setElementAt(seqs[i],nSeq-i-1);\r
+    private static void setOrder(AlignmentI align, SequenceI[] seqs) {\r
+        // NOTE: DO NOT USE align.setSequenceAt() here - it will NOT work\r
+        Vector algn = align.getSequences();\r
+\r
+        for (int i = 0, p = 0; i < seqs.length; i++)\r
+            algn.setElementAt(seqs[i], p++);\r
     }\r
-  }\r
 \r
-  private static void setOrder(AlignmentI align, Vector tmp) {\r
-    setOrder(align,vectorSubsetToArray(tmp, align.getSequences()));\r
-  }\r
+    public static void sortByID(AlignmentI align) {\r
+        int nSeq = align.getHeight();\r
 \r
-  private static void setOrder(AlignmentI align, SequenceI [] seqs) {\r
-      // NOTE: DO NOT USE align.setSequenceAt() here - it will NOT work\r
+        String[] ids = new String[nSeq];\r
+        SequenceI[] seqs = new SequenceI[nSeq];\r
 \r
-      Vector algn = align.getSequences();\r
+        for (int i = 0; i < nSeq; i++) {\r
+            ids[i] = align.getSequenceAt(i).getName();\r
+            seqs[i] = align.getSequenceAt(i);\r
+        }\r
 \r
-      for (int i = 0, p = 0; i < seqs.length; i++)\r
-        algn.setElementAt(seqs[i], p++);\r
-  }\r
-  /**    */\r
-  static boolean sortIdAscending = true;\r
-  public static void sortByID(AlignmentI align) {\r
-    int nSeq = align.getHeight();\r
+        QuickSort.sort(ids, seqs);\r
 \r
-    String    ids[]   = new String[nSeq];\r
-    SequenceI seqs[]  = new SequenceI[nSeq];\r
+        if (sortIdAscending) {\r
+            setReverseOrder(align, seqs);\r
+        } else {\r
+            setOrder(align, seqs);\r
+        }\r
 \r
-    for (int i = 0; i < nSeq; i++) {\r
-      ids[i]  = align.getSequenceAt(i).getName();\r
-      seqs[i] = align.getSequenceAt(i);\r
+        sortIdAscending = !sortIdAscending;\r
     }\r
 \r
-    QuickSort.sort(ids,seqs);\r
+    public static void sortByGroup(AlignmentI align) {\r
+        Vector groups = align.getGroups();\r
+\r
+        if (groups.hashCode() != lastGroupHash) {\r
+            sortGroupAscending = true;\r
+            lastGroupHash = groups.hashCode();\r
+        } else {\r
+            sortGroupAscending = !sortGroupAscending;\r
+        }\r
+\r
+        Vector seqs = new Vector();\r
+\r
+        for (int i = 0; i < groups.size(); i++) {\r
+            SequenceGroup sg = (SequenceGroup) groups.elementAt(i);\r
+\r
+            for (int j = 0; j < sg.getSize(); j++) {\r
+                seqs.addElement(sg.getSequenceAt(j));\r
+            }\r
+        }\r
+\r
+        // Deletions can happen so this check may fail\r
+\r
+        /*\r
+         if (seqs.size() != nSeq) {\r
+          System.err.println("ERROR: tmp.size() != nseq in sortByGroups");\r
+          if (seqs.size() < nSeq) {\r
+            addStrays(align,seqs);\r
+          }\r
+        }\r
+        */\r
+        if (sortGroupAscending) {\r
+            setOrder(align, seqs);\r
+        } else {\r
+            setReverseOrder(align,\r
+                vectorSubsetToArray(seqs, align.getSequences()));\r
+        }\r
+    }\r
+\r
+    private static SequenceI[] vectorToArray(Vector tmp) {\r
+        SequenceI[] seqs = new SequenceI[tmp.size()];\r
 \r
-    if(sortIdAscending)\r
-      setReverseOrder(align,seqs);\r
-    else\r
-      setOrder(align, seqs);\r
+        for (int i = 0; i < tmp.size(); i++) {\r
+            seqs[i] = (SequenceI) tmp.elementAt(i);\r
+        }\r
+\r
+        return seqs;\r
+    }\r
 \r
-    sortIdAscending = !sortIdAscending;\r
-  }\r
-  static int lastGroupHash = 0;\r
-  static boolean sortGroupAscending = true;\r
+    private static SequenceI[] vectorSubsetToArray(Vector tmp, Vector mask) {\r
+        Vector seqs = new Vector();\r
+        int i;\r
+        int m;\r
+        int p;\r
+        boolean[] tmask = new boolean[m = mask.size()];\r
 \r
-  public static void sortByGroup(AlignmentI align) {\r
-    Vector groups = align.getGroups();\r
-    if (groups.hashCode()!=lastGroupHash) {\r
-      sortGroupAscending=true;\r
-      lastGroupHash = groups.hashCode();\r
-    } else\r
-      sortGroupAscending = ! sortGroupAscending;\r
+        for (i = 0; i < m; i++)\r
+            tmask[i] = true;\r
 \r
-    Vector seqs = new Vector();\r
+        for (i = 0; i < tmp.size(); i++) {\r
+            Object sq;\r
 \r
-    for (int i=0; i < groups.size(); i++) {\r
-      SequenceGroup sg = (SequenceGroup)groups.elementAt(i);\r
+            if (mask.contains(sq = tmp.elementAt(i))) {\r
+                tmask[mask.indexOf(sq)] = false;\r
+                seqs.addElement(sq);\r
+                m--;\r
+            }\r
+        }\r
 \r
-      for (int j = 0; j < sg.getSize(); j++) {\r
-        seqs.addElement(sg.getSequenceAt(j));\r
-      }\r
+        for (i = 0; i < tmask.length; i++)\r
+            if (tmask[i]) {\r
+                seqs.addElement(mask.elementAt(i));\r
+            }\r
+\r
+        return vectorToArray(seqs);\r
     }\r
 \r
-    // Deletions can happen so this check may fail\r
-    /*\r
-     if (seqs.size() != nSeq) {\r
-      System.err.println("ERROR: tmp.size() != nseq in sortByGroups");\r
-      if (seqs.size() < nSeq) {\r
-        addStrays(align,seqs);\r
-      }\r
+    public static void sortBy(AlignmentI align, AlignmentOrder order) {\r
+        // Get an ordered vector of sequences which may also be present in align\r
+        Vector tmp = order.getOrder();\r
+\r
+        //    if (tmp.size()<align.getHeight())\r
+        //      addStrays(align, tmp);\r
+        if (lastOrder == order) {\r
+            sortOrderAscending = !sortOrderAscending;\r
+        } else {\r
+            sortOrderAscending = true;\r
+        }\r
+\r
+        if (sortOrderAscending) {\r
+            setOrder(align, tmp);\r
+        } else {\r
+            setReverseOrder(align,\r
+                vectorSubsetToArray(tmp, align.getSequences()));\r
+        }\r
     }\r
-*/\r
-    if(sortGroupAscending)\r
-      setOrder(align,seqs);\r
-    else\r
-      setReverseOrder( align, vectorSubsetToArray(seqs, align.getSequences()));\r
 \r
-  }\r
+    public static Vector getOrderByTree(AlignmentI align, NJTree tree) {\r
+        int nSeq = align.getHeight();\r
 \r
-  private static SequenceI [] vectorToArray(Vector tmp) {\r
-    SequenceI[] seqs = new SequenceI[tmp.size()];\r
+        Vector tmp = new Vector();\r
 \r
-    for (int i=0; i < tmp.size(); i++) {\r
-      seqs[i] = (SequenceI)tmp.elementAt(i);\r
-    }\r
-    return seqs;\r
-  }\r
-\r
-  private static SequenceI [] vectorSubsetToArray(Vector tmp, Vector mask) {\r
-    Vector seqs = new Vector();\r
-    int i,m, p;\r
-    boolean[] tmask = new boolean[m=mask.size()];\r
-    for (i=0; i<m; i++)\r
-      tmask[i] = true;\r
-    for (i=0; i < tmp.size(); i++) {\r
-      Object sq;\r
-      if (mask.contains(sq=tmp.elementAt(i))) {\r
-        tmask[mask.indexOf(sq)] = false;\r
-        seqs.addElement(sq);\r
-        m--;\r
-      }\r
-    }\r
-    for (i=0; i<tmask.length; i++)\r
-      if (tmask[i])\r
-        seqs.addElement(mask.elementAt(i));\r
-    return vectorToArray(seqs);\r
-  }\r
-\r
-  static AlignmentOrder lastOrder = null;\r
-  static boolean sortOrderAscending = true;\r
-\r
-  public static void sortBy(AlignmentI align, AlignmentOrder order) {\r
-    // Get an ordered vector of sequences which may also be present in align\r
-    Vector tmp = order.getOrder();\r
-//    if (tmp.size()<align.getHeight())\r
-//      addStrays(align, tmp);\r
-    if (lastOrder==order)\r
-      sortOrderAscending=!sortOrderAscending;\r
-    else\r
-      sortOrderAscending=true;\r
-\r
-    if (sortOrderAscending)\r
-      setOrder(align, tmp);\r
-    else\r
-      setReverseOrder(align, vectorSubsetToArray(tmp, align.getSequences()));\r
-  }\r
-  static NJTree lastTree = null;\r
-  static boolean sortTreeAscending = true;\r
-\r
-  public static Vector getOrderByTree(AlignmentI align, NJTree tree) {\r
-    int nSeq = align.getHeight();\r
-\r
-    Vector tmp = new Vector();\r
-\r
-    tmp = _sortByTree(tree.getTopNode(), tmp, align.getSequences());\r
-\r
-    if (tmp.size() != nSeq)\r
-    {\r
-      // TODO: JBPNote - decide if this is always an error\r
-      // (eg. not when a tree is associated to another alignment which has more\r
-      //  sequences)\r
-\r
-      if (tmp.size() < nSeq)\r
-      {\r
-        addStrays(align, tmp);\r
-      }\r
-      if (tmp.size() != nSeq)\r
-        System.err.println("ERROR: tmp.size()="+tmp.size()+" != nseq="+nSeq+" in getOrderByTree");\r
+        tmp = _sortByTree(tree.getTopNode(), tmp, align.getSequences());\r
 \r
+        if (tmp.size() != nSeq) {\r
+            // TODO: JBPNote - decide if this is always an error\r
+            // (eg. not when a tree is associated to another alignment which has more\r
+            //  sequences)\r
+            if (tmp.size() < nSeq) {\r
+                addStrays(align, tmp);\r
+            }\r
+\r
+            if (tmp.size() != nSeq) {\r
+                System.err.println("ERROR: tmp.size()=" + tmp.size() +\r
+                    " != nseq=" + nSeq + " in getOrderByTree");\r
+            }\r
+        }\r
+\r
+        return tmp;\r
     }\r
-    return tmp;\r
-  }\r
-\r
-  public static void sortByTree(AlignmentI align, NJTree tree) {\r
-    Vector tmp = getOrderByTree(align, tree);\r
-    // tmp should properly permute align with tree.\r
-    if(lastTree!=tree) {\r
-      sortTreeAscending = true;\r
-      lastTree = tree;\r
-    } else {\r
-      sortTreeAscending = !sortTreeAscending;\r
+\r
+    public static void sortByTree(AlignmentI align, NJTree tree) {\r
+        Vector tmp = getOrderByTree(align, tree);\r
+\r
+        // tmp should properly permute align with tree.\r
+        if (lastTree != tree) {\r
+            sortTreeAscending = true;\r
+            lastTree = tree;\r
+        } else {\r
+            sortTreeAscending = !sortTreeAscending;\r
+        }\r
+\r
+        if (sortTreeAscending) {\r
+            setOrder(align, tmp);\r
+        } else {\r
+            setReverseOrder(align,\r
+                vectorSubsetToArray(tmp, align.getSequences()));\r
+        }\r
     }\r
-    if(sortTreeAscending)\r
-      setOrder(align,tmp);\r
-    else\r
-      setReverseOrder(align, vectorSubsetToArray(tmp, align.getSequences()));\r
-  }\r
-\r
-  private static void addStrays(AlignmentI align, Vector seqs) {\r
-    int    nSeq = align.getHeight();\r
-    for (int i=0;i<nSeq;i++) {\r
-      if (!seqs.contains(align.getSequenceAt(i))) {\r
-        seqs.addElement(align.getSequenceAt(i));\r
-      }\r
+\r
+    private static void addStrays(AlignmentI align, Vector seqs) {\r
+        int nSeq = align.getHeight();\r
+\r
+        for (int i = 0; i < nSeq; i++) {\r
+            if (!seqs.contains(align.getSequenceAt(i))) {\r
+                seqs.addElement(align.getSequenceAt(i));\r
+            }\r
+        }\r
+\r
+        if (nSeq != seqs.size()) {\r
+            System.err.println(\r
+                "ERROR: Size still not right even after addStrays");\r
+        }\r
     }\r
-    if (nSeq != seqs.size()) {\r
-      System.err.println("ERROR: Size still not right even after addStrays");\r
+\r
+    public static Vector _sortByTree(SequenceNode node, Vector tmp,\r
+        Vector seqset) {\r
+        if (node == null) {\r
+            return tmp;\r
+        }\r
+\r
+        SequenceNode left = (SequenceNode) node.left();\r
+        SequenceNode right = (SequenceNode) node.right();\r
+\r
+        if ((left == null) && (right == null)) {\r
+            if (!node.isPlaceholder() && (node.element() != null)) {\r
+                if (node.element() instanceof SequenceI) {\r
+                    if (!tmp.contains(node.element())) {\r
+                        tmp.addElement((SequenceI) node.element());\r
+                    }\r
+                }\r
+            }\r
+\r
+            return tmp;\r
+        } else {\r
+            _sortByTree(left, tmp, seqset);\r
+            _sortByTree(right, tmp, seqset);\r
+        }\r
+\r
+        return tmp;\r
     }\r
-  }\r
 \r
-  public static Vector _sortByTree(SequenceNode node, Vector tmp, Vector seqset) {\r
-    if (node == null) {return tmp;}\r
+    // Ordering Objects\r
+    // Alignment.sortBy(OrderObj) - sequence of sequence pointer refs in appropriate order\r
+    //\r
 \r
-    SequenceNode left = (SequenceNode)node.left();\r
-    SequenceNode right = (SequenceNode)node.right();\r
+    /**\r
+     * recover the order of sequences given by the safe numbering scheme introducd\r
+     * SeqsetUtils.uniquify.\r
+     */\r
+    public static void recoverOrder(SequenceI[] alignment) {\r
+        float[] ids = new float[alignment.length];\r
 \r
-    if (left == null && right == null) {\r
-      if (!node.isPlaceholder() && node.element()!=null)\r
-        if (node.element() instanceof SequenceI)\r
-          if (!tmp.contains(node.element()))\r
-              tmp.addElement((SequenceI)node.element());\r
-        return tmp;\r
+        for (int i = 0; i < alignment.length; i++)\r
+            ids[i] = (new Float(alignment[i].getName().substring(8))).floatValue();\r
 \r
-    } else {\r
-      _sortByTree(left,tmp, seqset);\r
-      _sortByTree(right,tmp, seqset);\r
+        jalview.util.QuickSort.sort(ids, alignment);\r
     }\r
-    return tmp;\r
-  }\r
-  // Ordering Objects\r
-  // Alignment.sortBy(OrderObj) - sequence of sequence pointer refs in appropriate order\r
-  //\r
-\r
-  /**\r
-   * recover the order of sequences given by the safe numbering scheme introducd\r
-   * SeqsetUtils.uniquify.\r
-   */\r
-  public static void recoverOrder(SequenceI[] alignment) {\r
-    float[] ids = new float[alignment.length];\r
-    for (int i=0; i<alignment.length; i++)\r
-      ids[i] = (new Float(alignment[i].getName().substring(8))).floatValue();\r
-    jalview.util.QuickSort.sort(ids, alignment);\r
-  }\r
-\r
-  private void jbInit()\r
-      throws Exception\r
-  {\r
-  }\r
 \r
+    private void jbInit() throws Exception {\r
+    }\r
 }\r
index b992f4a..a2e1c71 100755 (executable)
 * 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.analysis;\r
 \r
 import jalview.datamodel.*;\r
-import jalview.util.*;\r
-import java.util.*;\r
 \r
-public class AlignmentUtil {\r
+import jalview.util.*;\r
 \r
-  private AlignmentUtil() {\r
-  }\r
+import java.util.*;\r
 \r
-  public static int[][] percentIdentity2(AlignmentI align) {\r
-    return percentIdentity2(align,0,align.getWidth()-1);\r
-  }\r
 \r
-  public static int[][] percentIdentity2(AlignmentI align, int start, int end) {\r
-    int [][] cons2 = new int[align.getWidth()][24];\r
-    // Initialize the array\r
-    for (int j=0;j<24;j++) {\r
-      for (int i=0; i < align.getWidth();i++) {\r
-        cons2[i][j] = 0;\r
-      }\r
+public class AlignmentUtil {\r
+    private AlignmentUtil() {\r
     }\r
 \r
-    return cons2;\r
-  }\r
-  public static int getPixelHeight(int i, int j,int charHeight) {\r
-    int h=0;\r
-    while (i < j) {\r
-      h += charHeight;\r
-      i++;\r
+    public static int[][] percentIdentity2(AlignmentI align) {\r
+        return percentIdentity2(align, 0, align.getWidth() - 1);\r
     }\r
-    return h;\r
-  }\r
-\r
-\r
-    public static Vector substitution_rates (AlignmentI align, int start, int end) {\r
-\r
-       Vector rates = new Vector();\r
-\r
-       int len = (end-start+1);\r
-\r
-       // Turn seqs into char arrays\r
-\r
-       int[][] seqint = new int[align.getHeight()][len];\r
-\r
-\r
-       for (int j = 0; j < align.getHeight(); j++) {\r
-\r
-           SequenceI seq = align.getSequenceAt(j);\r
-\r
-           for (int i = 0 ; i < len; i++) {\r
-               char c = seq.getCharAt(start + i - 1);\r
-\r
-               if (c == 'A') {\r
-                   seqint[j][i] = 0;\r
-               } else if (c == 'C') {\r
-                   seqint[j][i] = 1;\r
-               } else if (c == 'T') {\r
-                   seqint[j][i] = 2;\r
-               } else if (c == 'G') {\r
-                   seqint[j][i] = 3;\r
-               } else {\r
-                   seqint[j][i] = -1;\r
-               }\r
-\r
-           }\r
-\r
-       }\r
-\r
-\r
-       //      print_matrix(seqint,2,len);     for (int j = 0; j < align.getHeight(); j++) {\r
-\r
-           for (int j = 0; j < align.getHeight(); j++) {\r
-\r
-               for (int k = 0; k < align.getHeight(); k++) {\r
-\r
-               int counts[][] = new int[4][4];\r
-               int tot  = 0;\r
-               int tots[] = new int[4];\r
-               int fulltot = 0;\r
-               int fulltots[] = new int[4];\r
-\r
-               for (int i = 0 ; i < len; i++) {\r
-\r
-                   if (k != j) {\r
 \r
-                       //                      System.out.println("Seq " + j + " " + k + " " + i + " " + seqint[j][i] + " " + seqint[k][i]);\r
-                       if (seqint[j][i] >= 0 &&\r
-                           seqint[k][i] >= 0) {\r
-                           counts[seqint[k][i]][seqint[j][i]]++;\r
+    public static int[][] percentIdentity2(AlignmentI align, int start, int end) {\r
+        int[][] cons2 = new int[align.getWidth()][24];\r
 \r
-                           //  print_matrix(counts,4,4);\r
-                           tots[seqint[j][i]]++;\r
-                           tot++;\r
-                       }\r
-                       if (seqint[j][i] != -1) {\r
-                           fulltots[seqint[j][i]]++;\r
-                           fulltot++;\r
-                       }\r
-                   }\r
-               }\r
+        // Initialize the array\r
+        for (int j = 0; j < 24; j++) {\r
+            for (int i = 0; i < align.getWidth(); i++) {\r
+                cons2[i][j] = 0;\r
+            }\r
+        }\r
 \r
-               if (k != j) {\r
-\r
-                   System.out.println();\r
-\r
-                   System.out.println("Sequence " + align.getSequenceAt(j).getName() + " "  + align.getSequenceAt(k).getName());\r
-\r
-                   System.out.println();\r
-                   print_matrix(counts,4,4);\r
-                   System.out.println();\r
-\r
-\r
-\r
-                   double[][] out = new double[4][4];// = constant_multiply_matrix(counts,1.0/tot,4,4);\r
-\r
-                   for (int i = 0; i < 4; i++) {\r
-                       for (int jj = 0; jj < 4; jj++) {\r
-                           out[i][jj] = (double)counts[i][jj]/tots[jj];\r
-                       }\r
-                   }\r
-\r
-                   print_matrix(out,4,4);\r
-                   System.out.println();\r
-\r
-\r
-                   System.out.print("RATES\t");\r
-                   System.out.print(align.getSequenceAt(j).getName() + "\t"  + align.getSequenceAt(k).getName() + "\t");\r
-\r
-                   for (int i = 0; i < 4; i++) {\r
-                       for (int jj = 0; jj < 4; jj++) {\r
-                           Format.print(System.out,"%4.3f\t",out[i][jj]);\r
-                       }\r
-                   }\r
-                   System.out.println();\r
-\r
-                   for (int i = 0; i < 4; i++) {\r
-                       Format.print(System.out,"%4.3f\t",(double)fulltots[i]*1.0/fulltot);\r
-                   }\r
-\r
-                   System.out.println();\r
-                   System.out.print("\nGC ");\r
-\r
-                   Format.print(System.out,"%4.3f\t",(double)(100*fulltots[1]+fulltots[3])/fulltot);\r
-\r
-                   System.out.print((fulltots[1]+fulltots[3]) + "\t" + fulltot);\r
+        return cons2;\r
+    }\r
 \r
+    public static int getPixelHeight(int i, int j, int charHeight) {\r
+        int h = 0;\r
 \r
-                   System.out.println();\r
+        while (i < j) {\r
+            h += charHeight;\r
+            i++;\r
+        }\r
 \r
-                   rates.addElement(out);\r
-               }\r
+        return h;\r
+    }\r
 \r
-           }\r
-       }\r
-       return rates;\r
+    public static Vector substitution_rates(AlignmentI align, int start, int end) {\r
+        Vector rates = new Vector();\r
+\r
+        int len = (end - start + 1);\r
+\r
+        // Turn seqs into char arrays\r
+        int[][] seqint = new int[align.getHeight()][len];\r
+\r
+        for (int j = 0; j < align.getHeight(); j++) {\r
+            SequenceI seq = align.getSequenceAt(j);\r
+\r
+            for (int i = 0; i < len; i++) {\r
+                char c = seq.getCharAt((start + i) - 1);\r
+\r
+                if (c == 'A') {\r
+                    seqint[j][i] = 0;\r
+                } else if (c == 'C') {\r
+                    seqint[j][i] = 1;\r
+                } else if (c == 'T') {\r
+                    seqint[j][i] = 2;\r
+                } else if (c == 'G') {\r
+                    seqint[j][i] = 3;\r
+                } else {\r
+                    seqint[j][i] = -1;\r
+                }\r
+            }\r
+        }\r
+\r
+        //     print_matrix(seqint,2,len);     for (int j = 0; j < align.getHeight(); j++) {\r
+        for (int j = 0; j < align.getHeight(); j++) {\r
+            for (int k = 0; k < align.getHeight(); k++) {\r
+                int[][] counts = new int[4][4];\r
+                int tot = 0;\r
+                int[] tots = new int[4];\r
+                int fulltot = 0;\r
+                int[] fulltots = new int[4];\r
+\r
+                for (int i = 0; i < len; i++) {\r
+                    if (k != j) {\r
+                        //                     System.out.println("Seq " + j + " " + k + " " + i + " " + seqint[j][i] + " " + seqint[k][i]);\r
+                        if ((seqint[j][i] >= 0) && (seqint[k][i] >= 0)) {\r
+                            counts[seqint[k][i]][seqint[j][i]]++;\r
+\r
+                            //  print_matrix(counts,4,4);\r
+                            tots[seqint[j][i]]++;\r
+                            tot++;\r
+                        }\r
+\r
+                        if (seqint[j][i] != -1) {\r
+                            fulltots[seqint[j][i]]++;\r
+                            fulltot++;\r
+                        }\r
+                    }\r
+                }\r
+\r
+                if (k != j) {\r
+                    System.out.println();\r
+\r
+                    System.out.println("Sequence " +\r
+                        align.getSequenceAt(j).getName() + " " +\r
+                        align.getSequenceAt(k).getName());\r
+\r
+                    System.out.println();\r
+                    print_matrix(counts, 4, 4);\r
+                    System.out.println();\r
+\r
+                    double[][] out = new double[4][4]; // = constant_multiply_matrix(counts,1.0/tot,4,4);\r
+\r
+                    for (int i = 0; i < 4; i++) {\r
+                        for (int jj = 0; jj < 4; jj++) {\r
+                            out[i][jj] = (double) counts[i][jj] / tots[jj];\r
+                        }\r
+                    }\r
+\r
+                    print_matrix(out, 4, 4);\r
+                    System.out.println();\r
+\r
+                    System.out.print("RATES\t");\r
+                    System.out.print(align.getSequenceAt(j).getName() + "\t" +\r
+                        align.getSequenceAt(k).getName() + "\t");\r
+\r
+                    for (int i = 0; i < 4; i++) {\r
+                        for (int jj = 0; jj < 4; jj++) {\r
+                            Format.print(System.out, "%4.3f\t", out[i][jj]);\r
+                        }\r
+                    }\r
+\r
+                    System.out.println();\r
+\r
+                    for (int i = 0; i < 4; i++) {\r
+                        Format.print(System.out, "%4.3f\t",\r
+                            ((double) fulltots[i] * 1.0) / fulltot);\r
+                    }\r
+\r
+                    System.out.println();\r
+                    System.out.print("\nGC ");\r
+\r
+                    Format.print(System.out, "%4.3f\t",\r
+                        (double) ((100 * fulltots[1]) + fulltots[3]) / fulltot);\r
+\r
+                    System.out.print((fulltots[1] + fulltots[3]) + "\t" +\r
+                        fulltot);\r
+\r
+                    System.out.println();\r
+\r
+                    rates.addElement(out);\r
+                }\r
+            }\r
+        }\r
+\r
+        return rates;\r
     }\r
 \r
-    public static double[][]  constant_multiply_matrix(int[][] matrix, double c,int n, int m) {\r
-       double[][] out = new double[n][m];\r
+    public static double[][] constant_multiply_matrix(int[][] matrix, double c,\r
+        int n, int m) {\r
+        double[][] out = new double[n][m];\r
 \r
-       for (int i = 0; i < n; i++) {\r
-           for (int j = 0; j < m; j++) {\r
+        for (int i = 0; i < n; i++) {\r
+            for (int j = 0; j < m; j++) {\r
+                out[i][j] = matrix[i][j] * c;\r
+            }\r
+        }\r
 \r
-               out[i][j] = matrix[i][j]*c;\r
-           }\r
-       }\r
-       return out;\r
+        return out;\r
     }\r
 \r
-\r
     public static void print_matrix(int[][] matrix, int n, int m) {\r
+        for (int i = 0; i < n; i++) {\r
+            for (int j = 0; j < m; j++) {\r
+                System.out.print(matrix[i][j] + "\t");\r
+            }\r
 \r
-\r
-       for (int i = 0; i < n; i++) {\r
-           for (int j = 0; j < m; j++) {\r
-\r
-               System.out.print(matrix[i][j] + "\t");\r
-           }\r
-           System.out.println();\r
-       }\r
+            System.out.println();\r
+        }\r
     }\r
-    public static void print_matrix(double[][] matrix, int n, int m) {\r
-\r
-\r
-       for (int i = 0; i < n; i++) {\r
-           for (int j = 0; j < m; j++) {\r
 \r
-               Format.print(System.out,"%4.3f\t",matrix[i][j]);\r
+    public static void print_matrix(double[][] matrix, int n, int m) {\r
+        for (int i = 0; i < n; i++) {\r
+            for (int j = 0; j < m; j++) {\r
+                Format.print(System.out, "%4.3f\t", matrix[i][j]);\r
+            }\r
 \r
-           }\r
-           System.out.println();\r
-       }\r
+            System.out.println();\r
+        }\r
     }\r
-\r
-\r
 }\r
index e2dd742..2752e6f 100755 (executable)
 * 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.analysis;\r
 \r
 import jalview.datamodel.*;\r
+\r
 import jalview.io.*;\r
 \r
 import java.util.*;\r
 \r
-public class CompareAlignments {\r
 \r
+public class CompareAlignments {\r
     Vector align;\r
     String refId;\r
     Vector ids;\r
 \r
     public CompareAlignments(Vector align) {\r
+        this.align = align;\r
 \r
-       this.align = align;\r
-\r
-       ids = new Vector();\r
+        ids = new Vector();\r
 \r
-       Alignment al0 = (Alignment)align.elementAt(0);\r
+        Alignment al0 = (Alignment) align.elementAt(0);\r
 \r
-       for (int i = 0; i < al0.getHeight(); i++) {\r
-           SequenceI seq = al0.getSequenceAt(i);\r
+        for (int i = 0; i < al0.getHeight(); i++) {\r
+            SequenceI seq = al0.getSequenceAt(i);\r
 \r
-           ids.addElement(seq.getName());\r
-\r
-           if (i == 0) {\r
-               setReferenceId(seq.getName());\r
-           }\r
-       }\r
+            ids.addElement(seq.getName());\r
 \r
+            if (i == 0) {\r
+                setReferenceId(seq.getName());\r
+            }\r
+        }\r
     }\r
 \r
     public void compare() {\r
+        Hashtable positions = new Hashtable();\r
 \r
-       Hashtable positions = new Hashtable();\r
-\r
-       for (int k = 0; k < ids.size(); k++) {\r
-\r
-           String id = (String)ids.elementAt(k);\r
-\r
-           System.out.println("Ids " + id + " " + refId);\r
+        for (int k = 0; k < ids.size(); k++) {\r
+            String id = (String) ids.elementAt(k);\r
 \r
-           if (!id.equals(refId)) {\r
+            System.out.println("Ids " + id + " " + refId);\r
 \r
-               Hashtable fullhash = new Hashtable();\r
+            if (!id.equals(refId)) {\r
+                Hashtable fullhash = new Hashtable();\r
 \r
-               for (int i = 0; i < align.size(); i++) {\r
-                   System.out.println("Alignment " + i);\r
+                for (int i = 0; i < align.size(); i++) {\r
+                    System.out.println("Alignment " + i);\r
 \r
-                   Alignment al = (Alignment)align.elementAt(i);\r
+                    Alignment al = (Alignment) align.elementAt(i);\r
 \r
-                   SequenceI refseq = null;\r
+                    SequenceI refseq = null;\r
 \r
-                   for (int j = 0; j < al.getHeight(); j++) {\r
-                       if (((SequenceI)al.getSequenceAt(j)).getName().equals(refId)) {\r
-                           refseq = (SequenceI)al.getSequenceAt(j);\r
-                       }\r
-                   }\r
+                    for (int j = 0; j < al.getHeight(); j++) {\r
+                        if (((SequenceI) al.getSequenceAt(j)).getName().equals(refId)) {\r
+                            refseq = (SequenceI) al.getSequenceAt(j);\r
+                        }\r
+                    }\r
 \r
-                   if (refseq != null) {\r
+                    if (refseq != null) {\r
+                        System.out.println("Refseq " + refseq.getName());\r
 \r
-                       System.out.println("Refseq " + refseq.getName());\r
+                        for (int jj = 0; jj < al.getHeight(); jj++) {\r
+                            SequenceI seq = (SequenceI) al.getSequenceAt(jj);\r
 \r
-                       for (int jj = 0; jj < al.getHeight(); jj++) {\r
-                           SequenceI seq = (SequenceI)al.getSequenceAt(jj);\r
+                            if (seq.getName().equals(id)) {\r
+                                Hashtable hash = getAlignPositions(seq, refseq);\r
 \r
-                           if (seq.getName().equals(id)) {\r
-                               Hashtable hash = getAlignPositions(seq,refseq);\r
+                                Enumeration keys = hash.keys();\r
 \r
-                               Enumeration keys = hash.keys();\r
+                                while (keys.hasMoreElements()) {\r
+                                    Integer key = (Integer) keys.nextElement();\r
 \r
-                               while (keys.hasMoreElements()) {\r
-                                   Integer key = (Integer)keys.nextElement();\r
-                                   //                          System.out.println(key + " " + hash.get(key));\r
-                                   if (fullhash.get(key) == null) {\r
-                                       fullhash.put(key,new Vector());\r
-                                   }\r
+                                    //                         System.out.println(key + " " + hash.get(key));\r
+                                    if (fullhash.get(key) == null) {\r
+                                        fullhash.put(key, new Vector());\r
+                                    }\r
 \r
-                                   Vector tmp = (Vector)fullhash.get(key);\r
+                                    Vector tmp = (Vector) fullhash.get(key);\r
 \r
-                                   tmp.addElement(hash.get(key));\r
-                               }\r
-                           }\r
+                                    tmp.addElement(hash.get(key));\r
+                                }\r
+                            }\r
+                        }\r
+                    }\r
+                }\r
 \r
-                       }\r
-                   }\r
-               }\r
+                System.out.println("\nId " + id);\r
 \r
-               System.out.println ("\nId " + id);\r
+                Enumeration keys = fullhash.keys();\r
 \r
-               Enumeration keys = fullhash.keys();\r
+                int totdiff = 0;\r
 \r
+                while (keys.hasMoreElements()) {\r
+                    Integer key = (Integer) keys.nextElement();\r
 \r
-               int totdiff = 0;\r
-               while (keys.hasMoreElements()) {\r
-                   Integer key = (Integer)keys.nextElement();\r
+                    Vector tmp = (Vector) fullhash.get(key);\r
 \r
-                   Vector tmp = (Vector)fullhash.get(key);\r
+                    int diff0 = ((Integer) tmp.elementAt(0)).intValue();\r
+                    ;\r
 \r
+                    int diff = 0;\r
 \r
+                    for (int l = 1; l < tmp.size(); l++) {\r
+                        diff += Math.abs(diff0 -\r
+                            ((Integer) tmp.elementAt(l)).intValue());\r
+                    }\r
 \r
-                   int diff0 = ((Integer)tmp.elementAt(0)).intValue();;\r
-                   int diff = 0;\r
+                    if (diff > 0) {\r
+                        totdiff++;\r
+                        System.out.print(id + " Ref pos " + key + " : " +\r
+                            diff0 + " " + diff + " : ");\r
 \r
-                   for (int l = 1; l < tmp.size(); l++) {\r
-                       diff += Math.abs(diff0 - ((Integer)tmp.elementAt(l)).intValue());\r
+                        for (int l = 1; l < tmp.size(); l++) {\r
+                            System.out.print(diff0 -\r
+                                ((Integer) tmp.elementAt(l)).intValue() + " ");\r
+                        }\r
 \r
-                   }\r
+                        System.out.println();\r
+                    }\r
+                }\r
 \r
-                   if (diff > 0) {\r
-                       totdiff++;\r
-                       System.out.print(id + " Ref pos " + key + " : " + diff0 + " " + diff + " : ");\r
-\r
-                       for (int l = 1; l < tmp.size(); l++) {\r
-                           System.out.print(diff0 - ((Integer)tmp.elementAt(l)).intValue() + " ");\r
-                       }\r
-                       System.out.println();\r
-                   }\r
-               }\r
-\r
-               System.out.println("Total " + id + " " + totdiff);\r
-\r
-           }\r
-       }\r
+                System.out.println("Total " + id + " " + totdiff);\r
+            }\r
+        }\r
     }\r
 \r
-\r
     public void setReferenceId(String id) {\r
-       this.refId = id;\r
+        this.refId = id;\r
     }\r
 \r
     public Hashtable getAlignPositions(SequenceI seq1, SequenceI seq2) {\r
+        Hashtable hash = new Hashtable();\r
 \r
-       Hashtable hash = new Hashtable();\r
+        int i = 0;\r
 \r
-       int i = 0;\r
+        int pos1 = 0;\r
+        int pos2 = 0;\r
 \r
-       int pos1 = 0;\r
-       int pos2 = 0;\r
+        while (i < seq1.getLength()) {\r
+            char c1 = seq1.getCharAt(i);\r
+            char c2 = seq2.getCharAt(i);\r
 \r
-       while (i < seq1.getLength()) {\r
+            if (c1 != '-') {\r
+                pos1++;\r
+            }\r
 \r
-           char c1 = seq1.getCharAt(i);\r
-           char c2 = seq2.getCharAt(i);\r
+            if (c2 != '-') {\r
+                pos2++;\r
+            }\r
 \r
-           if (c1 != '-') {\r
-               pos1++;\r
-           }\r
+            if (c1 != '-') {\r
+                hash.put(new Integer(pos1), new Integer(pos2));\r
+            }\r
 \r
-           if (c2 != '-') {\r
-               pos2++;\r
-           }\r
+            i++;\r
+        }\r
 \r
-           if (c1 != '-') {\r
-               hash.put(new Integer(pos1),new Integer(pos2));\r
-           }\r
-\r
-           i++;\r
-       }\r
-       return hash;\r
+        return hash;\r
     }\r
-\r
-\r
-\r
 }\r
index d3f1e01..bfb2e00 100755 (executable)
 * 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.analysis;\r
 \r
+import jalview.datamodel.*;\r
 \r
-import java.util.*;\r
 import jalview.gui.*;\r
-import jalview.datamodel.*;\r
+\r
+import java.util.*;\r
 \r
 \r
 public class Conservation {\r
-  Vector sequences;\r
-  int    start;\r
-  int    end;\r
-  Vector seqNums; // vector of int vectors where first is sequence checksum\r
-  int maxLength=0; //  used by quality calcs\r
-  boolean seqNumsChanged = false; // updated after any change via calcSeqNum;\r
-  private void calcSeqNums() {\r
-    for (int i=0; i<sequences.size(); i++) {\r
-      calcSeqNum(i);\r
+    Vector sequences;\r
+    int start;\r
+    int end;\r
+    Vector seqNums; // vector of int vectors where first is sequence checksum\r
+    int maxLength = 0; //  used by quality calcs\r
+    boolean seqNumsChanged = false; // updated after any change via calcSeqNum;\r
+    Vector total = new Vector();\r
+    public Vector quality;\r
+    public Double[] qualityRange = new Double[2];\r
+    String consString = "";\r
+    Sequence consSequence;\r
+    Hashtable propHash;\r
+    int threshold;\r
+    String name = "";\r
+    int[][] cons2;\r
+\r
+    public Conservation(String name, Hashtable propHash, int threshold,\r
+        Vector sequences, int start, int end) {\r
+        this.name = name;\r
+        this.propHash = propHash;\r
+        this.threshold = threshold;\r
+        this.sequences = sequences;\r
+        this.start = start;\r
+        this.end = end;\r
+        seqNums = new Vector(sequences.size());\r
+        calcSeqNums();\r
     }\r
-  }\r
-  private void calcSeqNum(int i) {\r
-    String sq=null; // for dumb jbuilder not-inited exception warning\r
-    int[] sqnum = null;\r
-    if (i>-1 && i<sequences.size()) {\r
-      sq = ((SequenceI)sequences.elementAt(i)).getSequence();\r
-      if (seqNums.size()<=i) {\r
-        seqNums.addElement(new int[sq.length()+1]);\r
-      }\r
-      if (sq.hashCode()!=((int[])seqNums.elementAt(i))[0])\r
-       {\r
-         int j, len;\r
-         seqNumsChanged = true;\r
-         sq = ((SequenceI) sequences.elementAt(i)).getSequence();\r
-         len = sq.length();\r
-         if (maxLength < len)\r
-           maxLength = len;\r
-         sqnum = new int[len + 1]; // better to always make a new array - sequence can change its length\r
-         sqnum[0] = sq.hashCode();\r
-         for (j = 1; j <= len; j++)\r
-         {\r
-           sqnum[j] = ( (Integer) jalview.schemes.ResidueProperties.aaHash.get(new\r
-               String(sq.substring(j - 1, j)))).intValue(); // yuk\r
-         }\r
-         seqNums.setElementAt(sqnum, i);\r
-       }\r
-     } else {\r
-       // JBPNote INFO level debug\r
-       System.err.println("ERROR: calcSeqNum called with out of range sequence index for Alignment\n");\r
-     }\r
-   }\r
-   Vector total = new Vector();\r
-   public Vector quality;\r
-   public Double[] qualityRange = new Double[2];\r
-   String consString = "";\r
-\r
-   Sequence consSequence;\r
-   Hashtable        propHash;\r
-   int              threshold;\r
-\r
-  String name = "";\r
-\r
-  public Conservation(String name,Hashtable propHash, int threshold, Vector sequences, int start, int end) {\r
-    this.name      = name;\r
-    this.propHash  = propHash;\r
-    this.threshold = threshold;\r
-    this.sequences = sequences;\r
-    this.start     = start;\r
-    this.end       = end;\r
-    seqNums = new Vector(sequences.size());\r
-    calcSeqNums();\r
-  }\r
-\r
-\r
-  public void  calculate() {\r
-\r
-    for (int i = start;i <= end; i++) {\r
-      Hashtable resultHash  = null;\r
-      Hashtable residueHash = null;\r
-\r
-      resultHash  = new Hashtable();\r
-      residueHash = new Hashtable();\r
-\r
-      for (int j=0; j < sequences.size(); j++) {\r
-        // JBPNote - have to make sure elements of the sequences vector\r
-        //  are tested like this everywhere...\r
-        if (sequences.elementAt(j) instanceof Sequence) {\r
-          Sequence s = (Sequence)sequences.elementAt(j);\r
-\r
-          if (s.getLength() > i) {\r
-            String res = s.getSequence().substring(i,i+1);\r
-\r
-            if (residueHash.containsKey(res)) {\r
-              int count = ((Integer)residueHash.get(res)).intValue() ;\r
-              count++;\r
-              residueHash.put(res,new Integer(count));\r
-            } else {\r
-              residueHash.put(res,new Integer(1));\r
+\r
+    private void calcSeqNums() {\r
+        for (int i = 0; i < sequences.size(); i++) {\r
+            calcSeqNum(i);\r
+        }\r
+    }\r
+\r
+    private void calcSeqNum(int i) {\r
+        String sq = null; // for dumb jbuilder not-inited exception warning\r
+        int[] sqnum = null;\r
+\r
+        if ((i > -1) && (i < sequences.size())) {\r
+            sq = ((SequenceI) sequences.elementAt(i)).getSequence();\r
+\r
+            if (seqNums.size() <= i) {\r
+                seqNums.addElement(new int[sq.length() + 1]);\r
             }\r
-          } else {\r
-            if (residueHash.containsKey("-")) {\r
-              int count = ((Integer)residueHash.get("-")).intValue() ;\r
-              count++;\r
-              residueHash.put("-",new Integer(count));\r
-            } else {\r
-              residueHash.put("-",new Integer(1));\r
+\r
+            if (sq.hashCode() != ((int[]) seqNums.elementAt(i))[0]) {\r
+                int j;\r
+                int len;\r
+                seqNumsChanged = true;\r
+                sq = ((SequenceI) sequences.elementAt(i)).getSequence();\r
+                len = sq.length();\r
+\r
+                if (maxLength < len) {\r
+                    maxLength = len;\r
+                }\r
+\r
+                sqnum = new int[len + 1]; // better to always make a new array - sequence can change its length\r
+                sqnum[0] = sq.hashCode();\r
+\r
+                for (j = 1; j <= len; j++) {\r
+                    sqnum[j] = ((Integer) jalview.schemes.ResidueProperties.aaHash.get(new String(\r
+                                sq.substring(j - 1, j)))).intValue(); // yuk\r
+                }\r
+\r
+                seqNums.setElementAt(sqnum, i);\r
             }\r
-          }\r
+        } else {\r
+            // JBPNote INFO level debug\r
+            System.err.println(\r
+                "ERROR: calcSeqNum called with out of range sequence index for Alignment\n");\r
         }\r
-      }\r
+    }\r
 \r
-      //What is the count threshold to count the residues in residueHash()\r
-      int thresh = threshold*(sequences.size())/100;\r
+    public void calculate() {\r
+        for (int i = start; i <= end; i++) {\r
+            Hashtable resultHash = null;\r
+            Hashtable residueHash = null;\r
+\r
+            resultHash = new Hashtable();\r
+            residueHash = new Hashtable();\r
+\r
+            for (int j = 0; j < sequences.size(); j++) {\r
+                // JBPNote - have to make sure elements of the sequences vector\r
+                //  are tested like this everywhere...\r
+                if (sequences.elementAt(j) instanceof Sequence) {\r
+                    Sequence s = (Sequence) sequences.elementAt(j);\r
+\r
+                    if (s.getLength() > i) {\r
+                        String res = s.getSequence().substring(i, i + 1);\r
+\r
+                        if (residueHash.containsKey(res)) {\r
+                            int count = ((Integer) residueHash.get(res)).intValue();\r
+                            count++;\r
+                            residueHash.put(res, new Integer(count));\r
+                        } else {\r
+                            residueHash.put(res, new Integer(1));\r
+                        }\r
+                    } else {\r
+                        if (residueHash.containsKey("-")) {\r
+                            int count = ((Integer) residueHash.get("-")).intValue();\r
+                            count++;\r
+                            residueHash.put("-", new Integer(count));\r
+                        } else {\r
+                            residueHash.put("-", new Integer(1));\r
+                        }\r
+                    }\r
+                }\r
+            }\r
 \r
-      //loop over all the found residues\r
-      Enumeration e = residueHash.keys();\r
+            //What is the count threshold to count the residues in residueHash()\r
+            int thresh = (threshold * (sequences.size())) / 100;\r
+\r
+            //loop over all the found residues\r
+            Enumeration e = residueHash.keys();\r
+\r
+            while (e.hasMoreElements()) {\r
+                String res = (String) e.nextElement();\r
+\r
+                if (((Integer) residueHash.get(res)).intValue() > thresh) {\r
+                    //Now loop over the properties\r
+                    Enumeration e2 = propHash.keys();\r
+\r
+                    while (e2.hasMoreElements()) {\r
+                        String type = (String) e2.nextElement();\r
+                        Hashtable ht = (Hashtable) propHash.get(type);\r
+\r
+                        //Have we ticked this before?\r
+                        if (!resultHash.containsKey(type)) {\r
+                            if (ht.containsKey(res)) {\r
+                                resultHash.put(type, ht.get(res));\r
+                            } else {\r
+                                resultHash.put(type, ht.get("-"));\r
+                            }\r
+                        } else if (((Integer) resultHash.get(type)).equals(\r
+                                    (Integer) ht.get(res)) == false) {\r
+                            resultHash.put(type, new Integer(-1));\r
+                        }\r
+                    }\r
+                }\r
+            }\r
+\r
+            total.addElement(resultHash);\r
+        }\r
+    }\r
 \r
-      while (e.hasMoreElements()) {\r
+    public int countGaps(int j) {\r
+        int count = 0;\r
 \r
-        String res = (String)e.nextElement();\r
-        if (((Integer)residueHash.get(res)).intValue() > thresh) {\r
+        for (int i = 0; i < sequences.size(); i++) {\r
+            if ((j + 1) > ((Sequence) sequences.elementAt(i)).getSequence()\r
+                               .length()) {\r
+                count++;\r
 \r
-          //Now loop over the properties\r
-          Enumeration e2 = propHash.keys();\r
+                continue;\r
+            }\r
 \r
-          while (e2.hasMoreElements()) {\r
-            String    type = (String)e2.nextElement();\r
-            Hashtable ht   = (Hashtable)propHash.get(type);\r
+            char c = ((Sequence) sequences.elementAt(i)).getSequence().charAt(j);\r
 \r
-            //Have we ticked this before?\r
-            if (! resultHash.containsKey(type)) {\r
-              if (ht.containsKey(res)) {\r
-                resultHash.put(type,ht.get(res));\r
-              } else {\r
-                resultHash.put(type,ht.get("-"));\r
-              }\r
-            } else if ( ((Integer)resultHash.get(type)).equals((Integer)ht.get(res)) == false) {\r
-              resultHash.put(type,new Integer(-1));\r
+            if (jalview.util.Comparison.isGap((c))) {\r
+                count++;\r
             }\r
-          }\r
         }\r
-      }\r
 \r
-      total.addElement(resultHash);\r
+        return count;\r
     }\r
-  }\r
 \r
-  public int countGaps(int j)\r
-  {\r
-    int count = 0;\r
+    /***\r
+     * countConsNGaps\r
+     * returns gap count in int[0], and conserved residue count in int[1]\r
+     */\r
+    public int[] countConsNGaps(int j) {\r
+        int count = 0;\r
+        int cons = 0;\r
+        int nres = 0;\r
+        int[] r = new int[2];\r
+        char f = '$';\r
+\r
+        for (int i = 0; i < sequences.size(); i++) {\r
+            if (j >= ((Sequence) sequences.elementAt(i)).getSequence().length()) {\r
+                count++;\r
+\r
+                continue;\r
+            }\r
 \r
-    for (int i = 0; i < sequences.size();i++)\r
-    {\r
-      if( j+1 > ((Sequence)sequences.elementAt(i)).getSequence().length())\r
-      {  count++; continue;}\r
+            char c = ((Sequence) sequences.elementAt(i)).getSequence().charAt(j);\r
+\r
+            if (jalview.util.Comparison.isGap((c))) {\r
+                count++;\r
+            } else {\r
+                nres++;\r
+\r
+                if (nres == 1) {\r
+                    f = c;\r
+                    cons++;\r
+                } else if (f == c) {\r
+                    cons++;\r
+                }\r
+            }\r
+        }\r
 \r
-      char c = ((Sequence)sequences.elementAt(i)).getSequence().charAt(j);\r
-      if (jalview.util.Comparison.isGap((c)))\r
-        count++;\r
+        r[0] = (nres == cons) ? 1 : 0;\r
+        r[1] = count;\r
 \r
+        return r;\r
     }\r
-    return count;\r
-  }\r
-  /***\r
-   * countConsNGaps\r
-   * returns gap count in int[0], and conserved residue count in int[1]\r
-   */\r
-  public int[] countConsNGaps(int j)\r
-  {\r
-    int count = 0;\r
-    int cons=0;\r
-    int nres = 0;\r
-    int[] r = new int[2];\r
-    char f='$';\r
-    for (int i = 0; i < sequences.size();i++)\r
-    {\r
-      if( j >= ((Sequence)sequences.elementAt(i)).getSequence().length())\r
-      {  count++;\r
-      continue;}\r
-\r
-      char c = ((Sequence)sequences.elementAt(i)).getSequence().charAt(j);\r
-      if (jalview.util.Comparison.isGap((c)))\r
-        count++;\r
-      else {\r
-        nres++;\r
-        if (nres==1) {\r
-          f = c;\r
-          cons++;\r
-        } else\r
-          if (f == c) {\r
-            cons++;\r
-          }\r
-      }\r
+\r
+    public void verdict(boolean consflag, float percentageGaps) {\r
+        String consString = "";\r
+\r
+        for (int i = start; i <= end; i++) {\r
+            int[] gapcons = countConsNGaps(i);\r
+            boolean cons = (gapcons[0] == 1) ? true : false;\r
+            int totGaps = gapcons[1];\r
+            float pgaps = ((float) totGaps * 100) / (float) sequences.size();\r
+\r
+            //      System.out.println("percentage gaps = "+pgaps+"\n");\r
+            if (percentageGaps > pgaps) {\r
+                Hashtable resultHash = (Hashtable) total.elementAt(i - start);\r
+\r
+                //Now find the verdict\r
+                int count = 0;\r
+                Enumeration e3 = resultHash.keys();\r
+\r
+                while (e3.hasMoreElements()) {\r
+                    String type = (String) e3.nextElement();\r
+                    Integer result = (Integer) resultHash.get(type);\r
+\r
+                    //Do we want to count +ve conservation or +ve and -ve cons.?\r
+                    if (consflag) {\r
+                        if (result.intValue() == 1) {\r
+                            count++;\r
+                        }\r
+                    } else {\r
+                        if (result.intValue() != -1) {\r
+                            count++;\r
+                        }\r
+                    }\r
+                }\r
+\r
+                if (count < 10) {\r
+                    consString = consString + String.valueOf(count); // Conserved props!=Identity\r
+                } else {\r
+                    consString = consString + ((gapcons[0] == 1) ? "*" : "+");\r
+                }\r
+            } else {\r
+                consString = consString + "-";\r
+            }\r
+        }\r
+\r
+        consSequence = new Sequence(name, consString, start, end);\r
     }\r
-    r[0] = (nres==cons) ? 1 : 0;\r
-    r[1] = count;\r
 \r
+    public Sequence getConsSequence() {\r
+        return consSequence;\r
+    }\r
 \r
-    return r;\r
-  }\r
+    // From Alignment.java in jalview118\r
+    public void findQuality() {\r
+        findQuality(0, maxLength - 1);\r
+    }\r
 \r
-  public  void  verdict(boolean consflag, float percentageGaps) {\r
-    String consString = "";\r
+    private void percentIdentity2() {\r
+        calcSeqNums(); // updates maxLength, too.\r
 \r
-    for (int i=start; i <= end; i++) {\r
-      int[] gapcons = countConsNGaps(i);\r
-      boolean cons = (gapcons[0]==1) ? true : false;\r
-      int totGaps = gapcons[1];\r
-      float pgaps = (float)totGaps*100/(float)sequences.size();\r
-      //      System.out.println("percentage gaps = "+pgaps+"\n");\r
-      if (percentageGaps > pgaps)\r
-      {\r
-        Hashtable resultHash = (Hashtable)total.elementAt(i-start);\r
-\r
-        //Now find the verdict\r
-        int         count = 0;\r
-        Enumeration e3    = resultHash.keys();\r
-\r
-        while (e3.hasMoreElements())\r
-        {\r
-          String type    = (String)e3.nextElement();\r
-          Integer result = (Integer)resultHash.get(type);\r
-\r
-          //Do we want to count +ve conservation or +ve and -ve cons.?\r
-\r
-          if (consflag)\r
-          {\r
-            if (result.intValue() == 1)\r
-              count++;\r
-          }\r
-          else\r
-          {\r
-            if (result.intValue() != -1)\r
-              count++;\r
-          }\r
-        }\r
+        if ((cons2 == null) || seqNumsChanged) {\r
+            cons2 = new int[maxLength][24];\r
 \r
-        if (count < 10)\r
-          consString = consString + String.valueOf(count);// Conserved props!=Identity\r
-        else\r
-          consString = consString + ((gapcons[0]==1) ? "*" : "+");\r
+            // Initialize the array\r
+            for (int j = 0; j < 24; j++) {\r
+                for (int i = 0; i < maxLength; i++) {\r
+                    cons2[i][j] = 0;\r
+                }\r
+            }\r
 \r
-      }\r
-      else\r
-      {\r
-        consString = consString + "-";\r
-      }\r
-    }\r
+            int[] sqnum;\r
+            int j = 0;\r
 \r
-    consSequence = new Sequence(name,consString,start,end);\r
-  }\r
+            while (j < sequences.size()) {\r
+                sqnum = (int[]) seqNums.elementAt(j);\r
 \r
-  public Sequence getConsSequence() {\r
-    return consSequence;\r
-  }\r
+                for (int i = 1; i < sqnum.length; i++) {\r
+                    cons2[i - 1][sqnum[i]]++;\r
+                }\r
 \r
-  // From Alignment.java in jalview118\r
+                for (int i = sqnum.length - 1; i < maxLength; i++) {\r
+                    cons2[i][23]++; // gap count\r
+                }\r
 \r
-  public void findQuality() {\r
-    findQuality(0,maxLength-1);\r
-  }\r
+                j++;\r
+            }\r
 \r
-  int[][] cons2;\r
+            // unnecessary ?\r
 \r
-  private void percentIdentity2() {\r
-    calcSeqNums(); // updates maxLength, too.\r
-    if (cons2==null || seqNumsChanged) {\r
-      cons2 = new int[maxLength][24];\r
-      // Initialize the array\r
-      for (int j=0;j<24;j++) {\r
-        for (int i=0; i < maxLength;i++) {\r
-          cons2[i][j] = 0;\r
-        }\r
-      }\r
-\r
-      int sqnum[];\r
-      int j = 0;\r
-      while(j < sequences.size()) {\r
-        sqnum=(int[])seqNums.elementAt(j);\r
-        for (int i = 1; i < sqnum.length; i++) {\r
-          cons2[i-1][sqnum[i]]++;\r
-        }\r
-        for (int i=sqnum.length-1; i<maxLength; i++) {\r
-          cons2[i][23]++; // gap count\r
-        }\r
-        j++;\r
-      }\r
-\r
-      // unnecessary ?\r
-      /* for (int i=start; i <= end; i++) {\r
-           int max = -1000;\r
-    int maxi = -1;\r
-    int maxj = -1;\r
-\r
-    for (int j=0;j<24;j++) {\r
-        if (cons2[i][j] > max) {\r
-        max = cons2[i][j];\r
-        maxi = i;\r
-        maxj = j;\r
-      }\r
+            /* for (int i=start; i <= end; i++) {\r
+                 int max = -1000;\r
+            int maxi = -1;\r
+            int maxj = -1;\r
 \r
-    }\r
-  } */\r
+            for (int j=0;j<24;j++) {\r
+              if (cons2[i][j] > max) {\r
+              max = cons2[i][j];\r
+              maxi = i;\r
+              maxj = j;\r
+            }\r
+\r
+            }\r
+            } */\r
+        }\r
     }\r
 \r
-}\r
+    public void findQuality(int start, int end) {\r
+        quality = new Vector();\r
+\r
+        double max = -10000;\r
+        String s = "";\r
+        int[][] BLOSUM62 = jalview.schemes.ResidueProperties.getBLOSUM62();\r
+\r
+        //Loop over columns // JBPNote Profiling info\r
+        //    long ts = System.currentTimeMillis();\r
+        //long te = System.currentTimeMillis();\r
+        percentIdentity2();\r
+\r
+        int size = seqNums.size();\r
+        int[] lengths = new int[size];\r
+\r
+        for (int l = 0; l < size; l++)\r
+            lengths[l] = ((int[]) seqNums.elementAt(l)).length - 1;\r
+\r
+        for (int j = start; j <= end; j++) {\r
+            double bigtot = 0;\r
+\r
+            // First Xr = depends on column only\r
+            double[] x = new double[24];\r
+\r
+            for (int ii = 0; ii < 24; ii++) {\r
+                x[ii] = 0;\r
 \r
+                try {\r
+                    for (int i2 = 0; i2 < 24; i2++) {\r
+                        x[ii] += (((double) cons2[j][i2] * BLOSUM62[ii][i2]) +\r
+                        4);\r
+                    }\r
+                } catch (Exception e) {\r
+                    System.err.println("Exception during quality calculation.");\r
+                    e.printStackTrace();\r
+                }\r
 \r
-public void findQuality(int start, int end) {\r
-    quality = new Vector();\r
-    double max = -10000;\r
-    String s = "";\r
-    int[][] BLOSUM62 = jalview.schemes.ResidueProperties.getBLOSUM62();\r
-    //Loop over columns // JBPNote Profiling info\r
-    //    long ts = System.currentTimeMillis();\r
-    //long te = System.currentTimeMillis();\r
-    percentIdentity2();\r
-\r
-    int size = seqNums.size();\r
-    int[] lengths = new int[size];\r
-\r
-    for (int l = 0; l < size; l++)\r
-      lengths[l] = ((int[]) seqNums.elementAt(l)).length-1;\r
-\r
-    for (int j=start; j <= end; j++) {\r
-      double bigtot = 0;\r
-\r
-      // First Xr = depends on column only\r
-      double x[] = new double[24];\r
-\r
-      for (int ii=0; ii < 24; ii++) {\r
-       x[ii] = 0;\r
-       try {\r
-         for (int i2=0; i2 < 24; i2++) {\r
-           x[ii]  += (double)cons2[j][i2] * BLOSUM62[ii][i2]+4;\r
-         }\r
-       } catch (Exception e) {\r
-         System.err.println("Exception during quality calculation.");\r
-          e.printStackTrace();\r
-       }\r
-       //System.out.println("X " + ii + " " + x[ii]);\r
-       x[ii] /= (size);\r
-       //System.out.println("X " + ii + " " + x[ii]);\r
-      }\r
-      // Now calculate D for each position and sum\r
-      for (int k=0; k < size; k++) {\r
-       double tot = 0;\r
-       double[] xx = new double[24];\r
-        int seqNum =\r
-            (j<lengths[k])\r
-            ? ((int[]) seqNums.elementAt(k))[j+1]\r
-            : 23; // Sequence, or gap at the end\r
-\r
-        // This is a loop over r\r
-        for (int i=0; i < 23; i++) {\r
-          double sr = 0;\r
-          try {\r
-            sr = (double)BLOSUM62[i][seqNum]+4;\r
-          } catch (Exception e) {\r
-            System.out.println("Exception in sr: " + e);\r
-            e.printStackTrace();\r
-          }\r
-          //Calculate X with another loop over residues\r
-\r
-          //  System.out.println("Xi " + i + " " + x[i] + " " + sr);\r
-          xx[i] = x[i] - sr;\r
-\r
-          tot += xx[i]*xx[i];\r
+                //System.out.println("X " + ii + " " + x[ii]);\r
+                x[ii] /= (size);\r
+\r
+                //System.out.println("X " + ii + " " + x[ii]);\r
+            }\r
+\r
+            // Now calculate D for each position and sum\r
+            for (int k = 0; k < size; k++) {\r
+                double tot = 0;\r
+                double[] xx = new double[24];\r
+                int seqNum = (j < lengths[k])\r
+                    ? ((int[]) seqNums.elementAt(k))[j + 1] : 23; // Sequence, or gap at the end\r
+\r
+                // This is a loop over r\r
+                for (int i = 0; i < 23; i++) {\r
+                    double sr = 0;\r
+\r
+                    try {\r
+                        sr = (double) BLOSUM62[i][seqNum] + 4;\r
+                    } catch (Exception e) {\r
+                        System.out.println("Exception in sr: " + e);\r
+                        e.printStackTrace();\r
+                    }\r
+\r
+                    //Calculate X with another loop over residues\r
+                    //  System.out.println("Xi " + i + " " + x[i] + " " + sr);\r
+                    xx[i] = x[i] - sr;\r
+\r
+                    tot += (xx[i] * xx[i]);\r
+                }\r
+\r
+                bigtot += Math.sqrt(tot);\r
+            }\r
+\r
+            // This is the quality for one column\r
+            if (max < bigtot) {\r
+                max = bigtot;\r
+            }\r
+\r
+            //      bigtot  = bigtot * (size-cons2[j][23])/size;\r
+            quality.addElement(new Double(bigtot));\r
+\r
+            s += "-";\r
+\r
+            // Need to normalize by gaps\r
         }\r
-        bigtot += Math.sqrt(tot);\r
-      }\r
-      // This is the quality for one column\r
-      if (max < bigtot) {max = bigtot;}\r
-      //      bigtot  = bigtot * (size-cons2[j][23])/size;\r
 \r
-      quality.addElement(new Double(bigtot));\r
+        double newmax = -10000;\r
 \r
-      s += "-";\r
+        for (int j = start; j <= end; j++) {\r
+            double tmp = ((Double) quality.elementAt(j)).doubleValue();\r
+            tmp = ((max - tmp) * (size - cons2[j][23])) / size;\r
 \r
-      // Need to normalize by gaps\r
-    }\r
-    double newmax=-10000;\r
-    for (int j=start; j <= end; j++) {\r
-     double tmp =  ((Double)quality.elementAt(j)).doubleValue();\r
-     tmp = (max - tmp)*(size-cons2[j][23])/size;\r
-     //     System.out.println(tmp+ " " + j);\r
-     quality.setElementAt(new Double(tmp),j);\r
-     if (tmp>newmax)\r
-       newmax = tmp;\r
-    }\r
-    //    System.out.println("Quality " + s);\r
-    qualityRange[0] = new Double(0);\r
-    qualityRange[1] = new Double(newmax);\r
-  }\r
+            //     System.out.println(tmp+ " " + j);\r
+            quality.setElementAt(new Double(tmp), j);\r
 \r
+            if (tmp > newmax) {\r
+                newmax = tmp;\r
+            }\r
+        }\r
 \r
+        //    System.out.println("Quality " + s);\r
+        qualityRange[0] = new Double(0);\r
+        qualityRange[1] = new Double(newmax);\r
+    }\r
 }\r
index 75d36c1..6daee9b 100755 (executable)
 * 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.analysis;\r
 \r
 import jalview.datamodel.*;\r
-import jalview.util.*;\r
-import jalview.schemes.ResidueProperties;\r
-import java.util.*;\r
 \r
 import jalview.io.NewickFile;\r
 \r
-public class NJTree {\r
-\r
-  Vector cluster;\r
-  SequenceI[] sequence;\r
-\r
-  int done[];\r
-  int noseqs;\r
-  int noClus;\r
-\r
-  float distance[][];\r
-\r
-  int mini;\r
-  int minj;\r
-  float ri;\r
-  float rj;\r
-\r
-  Vector groups = new Vector();\r
-  SequenceNode maxdist;\r
-  SequenceNode top;\r
-\r
-  float maxDistValue;\r
-  float maxheight;\r
-\r
-  int ycount;\r
-\r
-  Vector node;\r
-\r
-  String type;\r
-  String pwtype;\r
-\r
-  Object found = null;\r
-  Object leaves = null;\r
-\r
-  int start;\r
-  int end;\r
-\r
-  public NJTree(SequenceNode node) {\r
-    top = node;\r
-    maxheight = findHeight(top);\r
-  }\r
-\r
-  public String toString()\r
-  {\r
-    jalview.io.NewickFile fout = new jalview.io.NewickFile(getTopNode());\r
-    return fout.print(false,true); // distances only\r
-  }\r
-\r
-  public NJTree(SequenceI[] seqs, NewickFile treefile) {\r
-    top = treefile.getTree();\r
-    maxheight = findHeight(top);\r
-    SequenceIdMatcher algnIds = new SequenceIdMatcher(seqs);\r
-\r
-    Vector leaves = new Vector();\r
-    findLeaves(top, leaves);\r
-\r
-    int i = 0;\r
-    int namesleft = seqs.length;\r
-\r
-    SequenceNode j;\r
-    SequenceI nam;\r
-    String realnam;\r
-    while (i < leaves.size())\r
-    {\r
-      j = (SequenceNode) leaves.elementAt(i++);\r
-      realnam = j.getName();\r
-      nam = null;\r
-      if (namesleft>-1)\r
-        nam = algnIds.findIdMatch(realnam);\r
-      if (nam != null) {\r
-        j.setElement(nam);\r
-        namesleft--;\r
-      } else {\r
-        j.setElement(new Sequence(realnam, "THISISAPLACEHLDER"));\r
-        j.setPlaceholder(true);\r
-\r
-      }\r
-    }\r
-  }\r
-\r
-  /**\r
-   *\r
-   * used when the alignment associated to a tree has changed.\r
-   *\r
-   * @param alignment Vector\r
-   */\r
-  public void UpdatePlaceHolders(Vector alignment) {\r
-    Vector leaves = new Vector();\r
-    findLeaves(top, leaves);\r
-    int sz = leaves.size();\r
-    SequenceIdMatcher seqmatcher=null;\r
-    int i=0;\r
-    while (i<sz) {\r
-      SequenceNode leaf = (SequenceNode) leaves.elementAt(i++);\r
-      if (alignment.contains(leaf.element()))\r
-        leaf.setPlaceholder(false);\r
-      else {\r
-        if (seqmatcher==null) {\r
-          // Only create this the first time we need it\r
-          SequenceI[] seqs = new SequenceI[alignment.size()];\r
-          for (int j=0; j<seqs.length; j++)\r
-            seqs[j] = (SequenceI) alignment.elementAt(j);\r
-          seqmatcher = new SequenceIdMatcher(seqs);\r
-        }\r
-        SequenceI nam = seqmatcher.findIdMatch(leaf.getName());\r
-        if (nam!=null) {\r
-          leaf.setPlaceholder(false);\r
-          leaf.setElement(nam);\r
-        } else {\r
-          leaf.setPlaceholder(true);\r
-        }\r
-      }\r
-    }\r
-  }\r
+import jalview.schemes.ResidueProperties;\r
 \r
-  public NJTree(SequenceI[] sequence,int start, int end) {\r
-    this(sequence,"NJ","BL",start,end);\r
-  }\r
+import jalview.util.*;\r
 \r
-  public NJTree(SequenceI[] sequence,String type,String pwtype,int start, int end ) {\r
+import java.util.*;\r
 \r
-    this.sequence = sequence;\r
-    this.node     = new Vector();\r
-    this.type     = type;\r
-    this.pwtype   = pwtype;\r
-    this.start    = start;\r
-    this.end      = end;\r
 \r
-    if (!(type.equals("NJ"))) {\r
-      type = "AV";\r
+public class NJTree {\r
+    Vector cluster;\r
+    SequenceI[] sequence;\r
+    int[] done;\r
+    int noseqs;\r
+    int noClus;\r
+    float[][] distance;\r
+    int mini;\r
+    int minj;\r
+    float ri;\r
+    float rj;\r
+    Vector groups = new Vector();\r
+    SequenceNode maxdist;\r
+    SequenceNode top;\r
+    float maxDistValue;\r
+    float maxheight;\r
+    int ycount;\r
+    Vector node;\r
+    String type;\r
+    String pwtype;\r
+    Object found = null;\r
+    Object leaves = null;\r
+    int start;\r
+    int end;\r
+\r
+    public NJTree(SequenceNode node) {\r
+        top = node;\r
+        maxheight = findHeight(top);\r
+    }\r
+\r
+    public NJTree(SequenceI[] seqs, NewickFile treefile) {\r
+        top = treefile.getTree();\r
+        maxheight = findHeight(top);\r
+\r
+        SequenceIdMatcher algnIds = new SequenceIdMatcher(seqs);\r
+\r
+        Vector leaves = new Vector();\r
+        findLeaves(top, leaves);\r
+\r
+        int i = 0;\r
+        int namesleft = seqs.length;\r
+\r
+        SequenceNode j;\r
+        SequenceI nam;\r
+        String realnam;\r
+\r
+        while (i < leaves.size()) {\r
+            j = (SequenceNode) leaves.elementAt(i++);\r
+            realnam = j.getName();\r
+            nam = null;\r
+\r
+            if (namesleft > -1) {\r
+                nam = algnIds.findIdMatch(realnam);\r
+            }\r
+\r
+            if (nam != null) {\r
+                j.setElement(nam);\r
+                namesleft--;\r
+            } else {\r
+                j.setElement(new Sequence(realnam, "THISISAPLACEHLDER"));\r
+                j.setPlaceholder(true);\r
+            }\r
+        }\r
     }\r
 \r
-    if (!(pwtype.equals("PID"))) {\r
-      type = "BL";\r
+    public NJTree(SequenceI[] sequence, int start, int end) {\r
+        this(sequence, "NJ", "BL", start, end);\r
     }\r
 \r
-    int i=0;\r
+    public NJTree(SequenceI[] sequence, String type, String pwtype, int start,\r
+        int end) {\r
+        this.sequence = sequence;\r
+        this.node = new Vector();\r
+        this.type = type;\r
+        this.pwtype = pwtype;\r
+        this.start = start;\r
+        this.end = end;\r
 \r
-    done = new int[sequence.length];\r
+        if (!(type.equals("NJ"))) {\r
+            type = "AV";\r
+        }\r
 \r
+        if (!(pwtype.equals("PID"))) {\r
+            type = "BL";\r
+        }\r
 \r
-    while (i < sequence.length  && sequence[i] != null) {\r
-      done[i] = 0;\r
-      i++;\r
-    }\r
+        int i = 0;\r
 \r
-    noseqs = i++;\r
+        done = new int[sequence.length];\r
 \r
-    distance = findDistances();\r
+        while ((i < sequence.length) && (sequence[i] != null)) {\r
+            done[i] = 0;\r
+            i++;\r
+        }\r
 \r
-    makeLeaves();\r
+        noseqs = i++;\r
 \r
-    noClus = cluster.size();\r
+        distance = findDistances();\r
 \r
-    cluster();\r
+        makeLeaves();\r
 \r
-  }\r
+        noClus = cluster.size();\r
 \r
+        cluster();\r
+    }\r
 \r
-  public void cluster() {\r
+    public String toString() {\r
+        jalview.io.NewickFile fout = new jalview.io.NewickFile(getTopNode());\r
 \r
-    while (noClus > 2) {\r
-      if (type.equals("NJ")) {\r
-        float mind = findMinNJDistance();\r
-      } else {\r
-        float mind = findMinDistance();\r
-      }\r
+        return fout.print(false, true); // distances only\r
+    }\r
 \r
-      Cluster c = joinClusters(mini,minj);\r
+    /**\r
+     *\r
+     * used when the alignment associated to a tree has changed.\r
+     *\r
+     * @param alignment Vector\r
+     */\r
+    public void UpdatePlaceHolders(Vector alignment) {\r
+        Vector leaves = new Vector();\r
+        findLeaves(top, leaves);\r
 \r
+        int sz = leaves.size();\r
+        SequenceIdMatcher seqmatcher = null;\r
+        int i = 0;\r
 \r
-      done[minj] = 1;\r
+        while (i < sz) {\r
+            SequenceNode leaf = (SequenceNode) leaves.elementAt(i++);\r
 \r
-      cluster.setElementAt(null,minj);\r
-      cluster.setElementAt(c,mini);\r
+            if (alignment.contains(leaf.element())) {\r
+                leaf.setPlaceholder(false);\r
+            } else {\r
+                if (seqmatcher == null) {\r
+                    // Only create this the first time we need it\r
+                    SequenceI[] seqs = new SequenceI[alignment.size()];\r
 \r
-      noClus--;\r
-    }\r
+                    for (int j = 0; j < seqs.length; j++)\r
+                        seqs[j] = (SequenceI) alignment.elementAt(j);\r
 \r
-    boolean onefound = false;\r
+                    seqmatcher = new SequenceIdMatcher(seqs);\r
+                }\r
 \r
-    int one = -1;\r
-    int two = -1;\r
+                SequenceI nam = seqmatcher.findIdMatch(leaf.getName());\r
 \r
-    for (int i=0; i < noseqs; i++) {\r
-      if (done[i] != 1) {\r
-        if (onefound == false) {\r
-          two = i;\r
-          onefound = true;\r
-        } else {\r
-          one = i;\r
+                if (nam != null) {\r
+                    leaf.setPlaceholder(false);\r
+                    leaf.setElement(nam);\r
+                } else {\r
+                    leaf.setPlaceholder(true);\r
+                }\r
+            }\r
         }\r
-      }\r
     }\r
 \r
-    Cluster c = joinClusters(one,two);\r
-    top = (SequenceNode)(node.elementAt(one));\r
+    public void cluster() {\r
+        while (noClus > 2) {\r
+            if (type.equals("NJ")) {\r
+                float mind = findMinNJDistance();\r
+            } else {\r
+                float mind = findMinDistance();\r
+            }\r
 \r
-    reCount(top);\r
-    findHeight(top);\r
-    findMaxDist(top);\r
+            Cluster c = joinClusters(mini, minj);\r
 \r
-  }\r
+            done[minj] = 1;\r
 \r
-  public Cluster joinClusters(int i, int j) {\r
+            cluster.setElementAt(null, minj);\r
+            cluster.setElementAt(c, mini);\r
 \r
-    float dist = distance[i][j];\r
+            noClus--;\r
+        }\r
 \r
-    int noi = ((Cluster)cluster.elementAt(i)).value.length;\r
-    int noj = ((Cluster)cluster.elementAt(j)).value.length;\r
+        boolean onefound = false;\r
 \r
-    int[] value = new int[noi + noj];\r
+        int one = -1;\r
+        int two = -1;\r
 \r
-    for (int ii = 0; ii < noi;ii++) {\r
-      value[ii] =  ((Cluster)cluster.elementAt(i)).value[ii];\r
-    }\r
+        for (int i = 0; i < noseqs; i++) {\r
+            if (done[i] != 1) {\r
+                if (onefound == false) {\r
+                    two = i;\r
+                    onefound = true;\r
+                } else {\r
+                    one = i;\r
+                }\r
+            }\r
+        }\r
+\r
+        Cluster c = joinClusters(one, two);\r
+        top = (SequenceNode) (node.elementAt(one));\r
 \r
-    for (int ii = noi; ii < noi+ noj;ii++) {\r
-      value[ii] =  ((Cluster)cluster.elementAt(j)).value[ii-noi];\r
+        reCount(top);\r
+        findHeight(top);\r
+        findMaxDist(top);\r
     }\r
 \r
-    Cluster c = new Cluster(value);\r
+    public Cluster joinClusters(int i, int j) {\r
+        float dist = distance[i][j];\r
 \r
-    ri = findr(i,j);\r
-    rj = findr(j,i);\r
+        int noi = ((Cluster) cluster.elementAt(i)).value.length;\r
+        int noj = ((Cluster) cluster.elementAt(j)).value.length;\r
 \r
-    if (type.equals("NJ")) {\r
-      findClusterNJDistance(i,j);\r
-    } else {\r
-      findClusterDistance(i,j);\r
-    }\r
+        int[] value = new int[noi + noj];\r
+\r
+        for (int ii = 0; ii < noi; ii++) {\r
+            value[ii] = ((Cluster) cluster.elementAt(i)).value[ii];\r
+        }\r
 \r
-    SequenceNode sn = new SequenceNode();\r
+        for (int ii = noi; ii < (noi + noj); ii++) {\r
+            value[ii] = ((Cluster) cluster.elementAt(j)).value[ii - noi];\r
+        }\r
 \r
-    sn.setLeft((SequenceNode)(node.elementAt(i)));\r
-    sn.setRight((SequenceNode)(node.elementAt(j)));\r
+        Cluster c = new Cluster(value);\r
 \r
-    SequenceNode tmpi = (SequenceNode)(node.elementAt(i));\r
-    SequenceNode tmpj = (SequenceNode)(node.elementAt(j));\r
+        ri = findr(i, j);\r
+        rj = findr(j, i);\r
 \r
-    if (type.equals("NJ")) {\r
-      findNewNJDistances(tmpi,tmpj,dist);\r
-    } else {\r
-      findNewDistances(tmpi,tmpj,dist);\r
-    }\r
+        if (type.equals("NJ")) {\r
+            findClusterNJDistance(i, j);\r
+        } else {\r
+            findClusterDistance(i, j);\r
+        }\r
 \r
-    tmpi.setParent(sn);\r
-    tmpj.setParent(sn);\r
+        SequenceNode sn = new SequenceNode();\r
 \r
-    node.setElementAt(sn,i);\r
-    return c;\r
-  }\r
+        sn.setLeft((SequenceNode) (node.elementAt(i)));\r
+        sn.setRight((SequenceNode) (node.elementAt(j)));\r
 \r
-  public void findNewNJDistances(SequenceNode tmpi, SequenceNode tmpj, float dist) {\r
+        SequenceNode tmpi = (SequenceNode) (node.elementAt(i));\r
+        SequenceNode tmpj = (SequenceNode) (node.elementAt(j));\r
 \r
-    float ih = 0;\r
-    float jh = 0;\r
+        if (type.equals("NJ")) {\r
+            findNewNJDistances(tmpi, tmpj, dist);\r
+        } else {\r
+            findNewDistances(tmpi, tmpj, dist);\r
+        }\r
 \r
-    SequenceNode sni = tmpi;\r
-    SequenceNode snj = tmpj;\r
+        tmpi.setParent(sn);\r
+        tmpj.setParent(sn);\r
 \r
-    tmpi.dist = (dist + ri - rj)/2;\r
-    tmpj.dist = (dist - tmpi.dist);\r
+        node.setElementAt(sn, i);\r
 \r
-    if (tmpi.dist < 0) {\r
-      tmpi.dist = 0;\r
+        return c;\r
     }\r
-    if (tmpj.dist < 0) {\r
-      tmpj.dist = 0;\r
-    }\r
-  }\r
 \r
-  public void findNewDistances(SequenceNode tmpi,SequenceNode tmpj,float dist) {\r
+    public void findNewNJDistances(SequenceNode tmpi, SequenceNode tmpj,\r
+        float dist) {\r
+        float ih = 0;\r
+        float jh = 0;\r
 \r
-    float ih = 0;\r
-    float jh = 0;\r
+        SequenceNode sni = tmpi;\r
+        SequenceNode snj = tmpj;\r
 \r
-    SequenceNode sni = tmpi;\r
-    SequenceNode snj = tmpj;\r
+        tmpi.dist = ((dist + ri) - rj) / 2;\r
+        tmpj.dist = (dist - tmpi.dist);\r
 \r
-    while (sni != null) {\r
-      ih = ih + sni.dist;\r
-      sni = (SequenceNode)sni.left();\r
-    }\r
+        if (tmpi.dist < 0) {\r
+            tmpi.dist = 0;\r
+        }\r
 \r
-    while (snj != null) {\r
-      jh = jh + snj.dist;\r
-      snj = (SequenceNode)snj.left();\r
+        if (tmpj.dist < 0) {\r
+            tmpj.dist = 0;\r
+        }\r
     }\r
 \r
-    tmpi.dist = (dist/2 - ih);\r
-    tmpj.dist = (dist/2 - jh);\r
-  }\r
+    public void findNewDistances(SequenceNode tmpi, SequenceNode tmpj,\r
+        float dist) {\r
+        float ih = 0;\r
+        float jh = 0;\r
 \r
+        SequenceNode sni = tmpi;\r
+        SequenceNode snj = tmpj;\r
 \r
+        while (sni != null) {\r
+            ih = ih + sni.dist;\r
+            sni = (SequenceNode) sni.left();\r
+        }\r
 \r
-  public void findClusterDistance(int i, int j) {\r
+        while (snj != null) {\r
+            jh = jh + snj.dist;\r
+            snj = (SequenceNode) snj.left();\r
+        }\r
 \r
-    int noi = ((Cluster)cluster.elementAt(i)).value.length;\r
-    int noj = ((Cluster)cluster.elementAt(j)).value.length;\r
+        tmpi.dist = ((dist / 2) - ih);\r
+        tmpj.dist = ((dist / 2) - jh);\r
+    }\r
 \r
-    // New distances from cluster to others\r
-    float[] newdist = new float[noseqs];\r
+    public void findClusterDistance(int i, int j) {\r
+        int noi = ((Cluster) cluster.elementAt(i)).value.length;\r
+        int noj = ((Cluster) cluster.elementAt(j)).value.length;\r
 \r
-    for (int l = 0; l < noseqs; l++) {\r
-      if ( l != i && l != j) {\r
-        newdist[l] = (distance[i][l] * noi + distance[j][l] * noj)/(noi + noj);\r
-      } else {\r
-        newdist[l] = 0;\r
-      }\r
-    }\r
+        // New distances from cluster to others\r
+        float[] newdist = new float[noseqs];\r
+\r
+        for (int l = 0; l < noseqs; l++) {\r
+            if ((l != i) && (l != j)) {\r
+                newdist[l] = ((distance[i][l] * noi) + (distance[j][l] * noj)) / (noi +\r
+                    noj);\r
+            } else {\r
+                newdist[l] = 0;\r
+            }\r
+        }\r
 \r
-    for (int ii=0; ii < noseqs;ii++) {\r
-      distance[i][ii] = newdist[ii];\r
-      distance[ii][i] = newdist[ii];\r
+        for (int ii = 0; ii < noseqs; ii++) {\r
+            distance[i][ii] = newdist[ii];\r
+            distance[ii][i] = newdist[ii];\r
+        }\r
     }\r
-  }\r
 \r
-  public void findClusterNJDistance(int i, int j) {\r
+    public void findClusterNJDistance(int i, int j) {\r
+        int noi = ((Cluster) cluster.elementAt(i)).value.length;\r
+        int noj = ((Cluster) cluster.elementAt(j)).value.length;\r
 \r
-    int noi = ((Cluster)cluster.elementAt(i)).value.length;\r
-    int noj = ((Cluster)cluster.elementAt(j)).value.length;\r
+        // New distances from cluster to others\r
+        float[] newdist = new float[noseqs];\r
 \r
-    // New distances from cluster to others\r
-    float[] newdist = new float[noseqs];\r
+        for (int l = 0; l < noseqs; l++) {\r
+            if ((l != i) && (l != j)) {\r
+                newdist[l] = ((distance[i][l] + distance[j][l]) -\r
+                    distance[i][j]) / 2;\r
+            } else {\r
+                newdist[l] = 0;\r
+            }\r
+        }\r
 \r
-    for (int l = 0; l < noseqs; l++) {\r
-      if ( l != i && l != j) {\r
-        newdist[l] = (distance[i][l] + distance[j][l] - distance[i][j])/2;\r
-      } else {\r
-        newdist[l] = 0;\r
-      }\r
+        for (int ii = 0; ii < noseqs; ii++) {\r
+            distance[i][ii] = newdist[ii];\r
+            distance[ii][i] = newdist[ii];\r
+        }\r
     }\r
 \r
-    for (int ii=0; ii < noseqs;ii++) {\r
-      distance[i][ii] = newdist[ii];\r
-      distance[ii][i] = newdist[ii];\r
+    public float findr(int i, int j) {\r
+        float tmp = 1;\r
+\r
+        for (int k = 0; k < noseqs; k++) {\r
+            if ((k != i) && (k != j) && (done[k] != 1)) {\r
+                tmp = tmp + distance[i][k];\r
+            }\r
+        }\r
+\r
+        if (noClus > 2) {\r
+            tmp = tmp / (noClus - 2);\r
+        }\r
+\r
+        return tmp;\r
     }\r
-  }\r
 \r
-  public float findr(int i, int j) {\r
+    public float findMinNJDistance() {\r
+        float min = 100000;\r
+\r
+        for (int i = 0; i < (noseqs - 1); i++) {\r
+            for (int j = i + 1; j < noseqs; j++) {\r
+                if ((done[i] != 1) && (done[j] != 1)) {\r
+                    float tmp = distance[i][j] - (findr(i, j) + findr(j, i));\r
+\r
+                    if (tmp < min) {\r
+                        mini = i;\r
+                        minj = j;\r
 \r
-    float tmp = 1;\r
-    for (int k=0; k < noseqs;k++) {\r
-      if (k!= i && k!= j && done[k] != 1) {\r
-        tmp = tmp + distance[i][k];\r
-      }\r
+                        min = tmp;\r
+                    }\r
+                }\r
+            }\r
+        }\r
+\r
+        return min;\r
     }\r
 \r
-    if (noClus > 2) {\r
-      tmp = tmp/(noClus - 2);\r
+    public float findMinDistance() {\r
+        float min = 100000;\r
+\r
+        for (int i = 0; i < (noseqs - 1); i++) {\r
+            for (int j = i + 1; j < noseqs; j++) {\r
+                if ((done[i] != 1) && (done[j] != 1)) {\r
+                    if (distance[i][j] < min) {\r
+                        mini = i;\r
+                        minj = j;\r
+\r
+                        min = distance[i][j];\r
+                    }\r
+                }\r
+            }\r
+        }\r
+\r
+        return min;\r
+    }\r
+\r
+    public float[][] findDistances() {\r
+        float[][] distance = new float[noseqs][noseqs];\r
+\r
+        if (pwtype.equals("PID")) {\r
+            for (int i = 0; i < (noseqs - 1); i++) {\r
+                for (int j = i; j < noseqs; j++) {\r
+                    if (j == i) {\r
+                        distance[i][i] = 0;\r
+                    } else {\r
+                        distance[i][j] = 100 -\r
+                            Comparison.PID(sequence[i], sequence[j], start, end);\r
+                        distance[j][i] = distance[i][j];\r
+                    }\r
+                }\r
+            }\r
+        } else if (pwtype.equals("BL")) {\r
+            int maxscore = 0;\r
+\r
+            for (int i = 0; i < (noseqs - 1); i++) {\r
+                for (int j = i; j < noseqs; j++) {\r
+                    int score = 0;\r
+\r
+                    for (int k = start; k < end; k++) {\r
+                        try {\r
+                            score += ResidueProperties.getBLOSUM62(sequence[i].getSequence(\r
+                                    k, k + 1), sequence[j].getSequence(k, k +\r
+                                    1));\r
+                        } catch (Exception ex) {\r
+                            System.err.println("err creating BLOSUM62 tree");\r
+                            ex.printStackTrace();\r
+                        }\r
+                    }\r
+\r
+                    distance[i][j] = (float) score;\r
+\r
+                    if (score > maxscore) {\r
+                        maxscore = score;\r
+                    }\r
+                }\r
+            }\r
+\r
+            for (int i = 0; i < (noseqs - 1); i++) {\r
+                for (int j = i; j < noseqs; j++) {\r
+                    distance[i][j] = (float) maxscore - distance[i][j];\r
+                    distance[j][i] = distance[i][j];\r
+                }\r
+            }\r
+        } else if (pwtype.equals("SW")) {\r
+            float max = -1;\r
+\r
+            for (int i = 0; i < (noseqs - 1); i++) {\r
+                for (int j = i; j < noseqs; j++) {\r
+                    AlignSeq as = new AlignSeq(sequence[i], sequence[j], "pep");\r
+                    as.calcScoreMatrix();\r
+                    as.traceAlignment();\r
+                    as.printAlignment();\r
+                    distance[i][j] = (float) as.maxscore;\r
+\r
+                    if (max < distance[i][j]) {\r
+                        max = distance[i][j];\r
+                    }\r
+                }\r
+            }\r
+\r
+            for (int i = 0; i < (noseqs - 1); i++) {\r
+                for (int j = i; j < noseqs; j++) {\r
+                    distance[i][j] = max - distance[i][j];\r
+                    distance[j][i] = distance[i][j];\r
+                }\r
+            }\r
+        }\r
+\r
+        return distance;\r
     }\r
 \r
-    return tmp;\r
-  }\r
+    public void makeLeaves() {\r
+        cluster = new Vector();\r
+\r
+        for (int i = 0; i < noseqs; i++) {\r
+            SequenceNode sn = new SequenceNode();\r
 \r
-  public float findMinNJDistance() {\r
+            sn.setElement(sequence[i]);\r
+            sn.setName(sequence[i].getName());\r
+            node.addElement(sn);\r
 \r
-    float min = 100000;\r
+            int[] value = new int[1];\r
+            value[0] = i;\r
 \r
-    for (int i=0; i < noseqs-1; i++) {\r
-      for (int j=i+1;j < noseqs;j++) {\r
-        if (done[i] != 1 && done[j] != 1) {\r
-          float tmp = distance[i][j] - (findr(i,j) + findr(j,i));\r
-          if (tmp < min) {\r
+            Cluster c = new Cluster(value);\r
+            cluster.addElement(c);\r
+        }\r
+    }\r
 \r
-            mini = i;\r
-            minj = j;\r
+    public Vector findLeaves(SequenceNode node, Vector leaves) {\r
+        if (node == null) {\r
+            return leaves;\r
+        }\r
 \r
-            min = tmp;\r
+        if ((node.left() == null) && (node.right() == null)) {\r
+            leaves.addElement(node);\r
 \r
-          }\r
+            return leaves;\r
+        } else {\r
+            findLeaves((SequenceNode) node.left(), leaves);\r
+            findLeaves((SequenceNode) node.right(), leaves);\r
         }\r
-      }\r
+\r
+        return leaves;\r
     }\r
-    return min;\r
-  }\r
 \r
-  public float findMinDistance() {\r
+    public Object findLeaf(SequenceNode node, int count) {\r
+        found = _findLeaf(node, count);\r
 \r
-    float min = 100000;\r
+        return found;\r
+    }\r
 \r
-    for (int i=0; i < noseqs-1;i++) {\r
-      for (int j = i+1; j < noseqs;j++) {\r
-        if (done[i] != 1 && done[j] != 1) {\r
-          if (distance[i][j] < min) {\r
-            mini = i;\r
-            minj = j;\r
+    public Object _findLeaf(SequenceNode node, int count) {\r
+        if (node == null) {\r
+            return null;\r
+        }\r
 \r
-            min = distance[i][j];\r
-          }\r
+        if (node.ycount == count) {\r
+            found = node.element();\r
+\r
+            return found;\r
+        } else {\r
+            _findLeaf((SequenceNode) node.left(), count);\r
+            _findLeaf((SequenceNode) node.right(), count);\r
         }\r
-      }\r
+\r
+        return found;\r
     }\r
-    return min;\r
-  }\r
 \r
-  public float[][] findDistances() {\r
+    /**\r
+     * printNode is mainly for debugging purposes.\r
+     *\r
+     * @param node SequenceNode\r
+     */\r
+    public void printNode(SequenceNode node) {\r
+        if (node == null) {\r
+            return;\r
+        }\r
+\r
+        if ((node.left() == null) && (node.right() == null)) {\r
+            System.out.println("Leaf = " +\r
+                ((SequenceI) node.element()).getName());\r
+            System.out.println("Dist " + ((SequenceNode) node).dist);\r
+            System.out.println("Boot " + node.getBootstrap());\r
+        } else {\r
+            System.out.println("Dist " + ((SequenceNode) node).dist);\r
+            printNode((SequenceNode) node.left());\r
+            printNode((SequenceNode) node.right());\r
+        }\r
+    }\r
 \r
-    float[][] distance = new float[noseqs][noseqs];\r
-    if (pwtype.equals("PID")) {\r
-      for (int i = 0; i < noseqs-1; i++) {\r
-        for (int j = i; j < noseqs; j++) {\r
-          if (j==i) {\r
-            distance[i][i] = 0;\r
-          } else {\r
-            distance[i][j] = 100-Comparison.PID(sequence[i], sequence[j], start, end);\r
-            distance[j][i] = distance[i][j];\r
-          }\r
+    public void findMaxDist(SequenceNode node) {\r
+        if (node == null) {\r
+            return;\r
         }\r
-      }\r
-    } else if (pwtype.equals("BL")) {\r
-      int   maxscore = 0;\r
 \r
-      for (int i = 0; i < noseqs-1; i++) {\r
-        for (int j = i; j < noseqs; j++) {\r
-          int score = 0;\r
-          for (int k=start; k < end; k++) {\r
-            try{\r
-              score +=\r
-                  ResidueProperties.getBLOSUM62(sequence[i].getSequence(k,\r
-                  k + 1),\r
-                                                sequence[j].getSequence(k,\r
-                  k + 1));\r
-            }catch(Exception ex){System.err.println("err creating BLOSUM62 tree");ex.printStackTrace();}\r
-          }\r
-          distance[i][j] = (float)score;\r
-          if (score > maxscore) {\r
-            maxscore = score;\r
-          }\r
+        if ((node.left() == null) && (node.right() == null)) {\r
+            float dist = ((SequenceNode) node).dist;\r
+\r
+            if (dist > maxDistValue) {\r
+                maxdist = (SequenceNode) node;\r
+                maxDistValue = dist;\r
+            }\r
+        } else {\r
+            findMaxDist((SequenceNode) node.left());\r
+            findMaxDist((SequenceNode) node.right());\r
         }\r
-      }\r
-      for (int i = 0; i < noseqs-1; i++) {\r
-        for (int j = i; j < noseqs; j++) {\r
-          distance[i][j] =  (float)maxscore - distance[i][j];\r
-          distance[j][i] = distance[i][j];\r
-        }\r
-      }\r
-    } else if (pwtype.equals("SW")) {\r
-      float max = -1;\r
-      for (int i = 0; i < noseqs-1; i++) {\r
-        for (int j = i; j < noseqs; j++) {\r
-          AlignSeq as = new AlignSeq(sequence[i],sequence[j],"pep");\r
-          as.calcScoreMatrix();\r
-          as.traceAlignment();\r
-          as.printAlignment();\r
-          distance[i][j] = (float)as.maxscore;\r
-          if (max < distance[i][j]) {\r
-            max = distance[i][j];\r
-          }\r
-        }\r
-      }\r
-      for (int i = 0; i < noseqs-1; i++) {\r
-        for (int j = i; j < noseqs; j++) {\r
-          distance[i][j] =  max - distance[i][j];\r
-          distance[j][i] = distance[i][j];\r
-        }\r
-      }\r
-    }\r
-\r
-    return distance;\r
-  }\r
-\r
-  public void makeLeaves() {\r
-    cluster = new Vector();\r
-\r
-    for (int i=0; i < noseqs; i++) {\r
-      SequenceNode sn = new SequenceNode();\r
-\r
-      sn.setElement(sequence[i]);\r
-      sn.setName(sequence[i].getName());\r
-      node.addElement(sn);\r
-\r
-      int[] value = new int[1];\r
-      value[0] = i;\r
-\r
-      Cluster c = new Cluster(value);\r
-      cluster.addElement(c);\r
-    }\r
-  }\r
-\r
-  public Vector findLeaves(SequenceNode node, Vector leaves) {\r
-    if (node == null) {\r
-      return leaves;\r
-    }\r
-\r
-    if (node.left() == null && node.right() == null) {\r
-      leaves.addElement(node);\r
-      return leaves;\r
-    } else {\r
-      findLeaves((SequenceNode)node.left(),leaves);\r
-      findLeaves((SequenceNode)node.right(),leaves);\r
-    }\r
-    return leaves;\r
-  }\r
-\r
-  public Object findLeaf(SequenceNode node, int count) {\r
-    found = _findLeaf(node,count);\r
-\r
-    return found;\r
-  }\r
-  public Object _findLeaf(SequenceNode node,int count) {\r
-    if (node == null) {\r
-      return null;\r
-    }\r
-    if (node.ycount == count) {\r
-      found = node.element();\r
-      return found;\r
-    } else {\r
-      _findLeaf((SequenceNode)node.left(),count);\r
-      _findLeaf((SequenceNode)node.right(),count);\r
-    }\r
-\r
-    return found;\r
-  }\r
-\r
-  /**\r
-   * printNode is mainly for debugging purposes.\r
-   *\r
-   * @param node SequenceNode\r
-   */\r
-  public void printNode(SequenceNode node) {\r
-    if (node == null) {\r
-      return;\r
-    }\r
-    if (node.left() == null && node.right() == null) {\r
-      System.out.println("Leaf = " + ((SequenceI)node.element()).getName());\r
-      System.out.println("Dist " + ((SequenceNode)node).dist);\r
-      System.out.println("Boot " + node.getBootstrap());\r
-    } else {\r
-      System.out.println("Dist " + ((SequenceNode)node).dist);\r
-      printNode((SequenceNode)node.left());\r
-      printNode((SequenceNode)node.right());\r
-    }\r
-  }\r
-  public void findMaxDist(SequenceNode node) {\r
-    if (node == null) {\r
-      return;\r
-    }\r
-    if (node.left() == null && node.right() == null) {\r
-\r
-      float dist = ((SequenceNode)node).dist;\r
-      if (dist > maxDistValue) {\r
-          maxdist      = (SequenceNode)node;\r
-          maxDistValue = dist;\r
-      }\r
-    } else {\r
-      findMaxDist((SequenceNode)node.left());\r
-      findMaxDist((SequenceNode)node.right());\r
     }\r
-  }\r
+\r
     public Vector getGroups() {\r
         return groups;\r
     }\r
+\r
     public float getMaxHeight() {\r
         return maxheight;\r
     }\r
-  public void  groupNodes(SequenceNode node, float threshold) {\r
-    if (node == null) {\r
-      return;\r
+\r
+    public void groupNodes(SequenceNode node, float threshold) {\r
+        if (node == null) {\r
+            return;\r
+        }\r
+\r
+        if ((node.height / maxheight) > threshold) {\r
+            groups.addElement(node);\r
+        } else {\r
+            groupNodes((SequenceNode) node.left(), threshold);\r
+            groupNodes((SequenceNode) node.right(), threshold);\r
+        }\r
     }\r
 \r
-    if (node.height/maxheight > threshold) {\r
-      groups.addElement(node);\r
-    } else {\r
-      groupNodes((SequenceNode)node.left(),threshold);\r
-      groupNodes((SequenceNode)node.right(),threshold);\r
+    public float findHeight(SequenceNode node) {\r
+        if (node == null) {\r
+            return maxheight;\r
+        }\r
+\r
+        if ((node.left() == null) && (node.right() == null)) {\r
+            node.height = ((SequenceNode) node.parent()).height + node.dist;\r
+\r
+            if (node.height > maxheight) {\r
+                return node.height;\r
+            } else {\r
+                return maxheight;\r
+            }\r
+        } else {\r
+            if (node.parent() != null) {\r
+                node.height = ((SequenceNode) node.parent()).height +\r
+                    node.dist;\r
+            } else {\r
+                maxheight = 0;\r
+                node.height = (float) 0.0;\r
+            }\r
+\r
+            maxheight = findHeight((SequenceNode) (node.left()));\r
+            maxheight = findHeight((SequenceNode) (node.right()));\r
+        }\r
+\r
+        return maxheight;\r
     }\r
-  }\r
 \r
-  public float findHeight(SequenceNode node) {\r
+    public SequenceNode reRoot() {\r
+        if (maxdist != null) {\r
+            ycount = 0;\r
+\r
+            float tmpdist = maxdist.dist;\r
+\r
+            // New top\r
+            SequenceNode sn = new SequenceNode();\r
+            sn.setParent(null);\r
+\r
+            // New right hand of top\r
+            SequenceNode snr = (SequenceNode) maxdist.parent();\r
+            changeDirection(snr, maxdist);\r
+            System.out.println("Printing reversed tree");\r
+            printN(snr);\r
+            snr.dist = tmpdist / 2;\r
+            maxdist.dist = tmpdist / 2;\r
+\r
+            snr.setParent(sn);\r
+            maxdist.setParent(sn);\r
+\r
+            sn.setRight(snr);\r
+            sn.setLeft(maxdist);\r
 \r
-    if (node == null) {\r
-      return maxheight;\r
+            top = sn;\r
+\r
+            ycount = 0;\r
+            reCount(top);\r
+            findHeight(top);\r
+        }\r
+\r
+        return top;\r
     }\r
 \r
-    if (node.left() == null && node.right() == null) {\r
-      node.height = ((SequenceNode)node.parent()).height + node.dist;\r
+    public static void printN(SequenceNode node) {\r
+        if (node == null) {\r
+            return;\r
+        }\r
 \r
-      if (node.height > maxheight) {\r
-        return node.height;\r
-      } else {\r
-        return maxheight;\r
-      }\r
-    } else {\r
-      if (node.parent() != null) {\r
-        node.height = ((SequenceNode)node.parent()).height + node.dist;\r
-      } else {\r
-        maxheight = 0;\r
-        node.height = (float)0.0;\r
-      }\r
-\r
-      maxheight = findHeight((SequenceNode)(node.left()));\r
-      maxheight = findHeight((SequenceNode)(node.right()));\r
-    }\r
-    return maxheight;\r
-  }\r
-  public SequenceNode reRoot() {\r
-    if (maxdist != null) {\r
-      ycount = 0;\r
-      float tmpdist = maxdist.dist;\r
-\r
-      // New top\r
-      SequenceNode sn = new SequenceNode();\r
-      sn.setParent(null);\r
-\r
-      // New right hand of top\r
-      SequenceNode snr = (SequenceNode)maxdist.parent();\r
-      changeDirection(snr,maxdist);\r
-      System.out.println("Printing reversed tree");\r
-      printN(snr);\r
-      snr.dist = tmpdist/2;\r
-      maxdist.dist = tmpdist/2;\r
-\r
-      snr.setParent(sn);\r
-      maxdist.setParent(sn);\r
-\r
-      sn.setRight(snr);\r
-      sn.setLeft(maxdist);\r
-\r
-      top = sn;\r
-\r
-      ycount = 0;\r
-      reCount(top);\r
-      findHeight(top);\r
-\r
-    }\r
-    return top;\r
-  }\r
-  public static void printN(SequenceNode node) {\r
-    if (node == null) {\r
-      return;\r
-    }\r
-\r
-    if (node.left() != null && node.right() != null) {\r
-      printN((SequenceNode)node.left());\r
-      printN((SequenceNode)node.right());\r
-    } else {\r
-      System.out.println(" name = " + ((SequenceI)node.element()).getName());\r
-    }\r
-    System.out.println(" dist = " + ((SequenceNode)node).dist + " " + ((SequenceNode)node).count + " " + ((SequenceNode)node).height);\r
-  }\r
+        if ((node.left() != null) && (node.right() != null)) {\r
+            printN((SequenceNode) node.left());\r
+            printN((SequenceNode) node.right());\r
+        } else {\r
+            System.out.println(" name = " +\r
+                ((SequenceI) node.element()).getName());\r
+        }\r
+\r
+        System.out.println(" dist = " + ((SequenceNode) node).dist + " " +\r
+            ((SequenceNode) node).count + " " + ((SequenceNode) node).height);\r
+    }\r
 \r
     public void reCount(SequenceNode node) {\r
         ycount = 0;\r
         _reCount(node);\r
     }\r
-  public void _reCount(SequenceNode node) {\r
-    if (node == null) {\r
-      return;\r
-    }\r
 \r
-    if (node.left() != null && node.right() != null) {\r
-      _reCount((SequenceNode)node.left());\r
-      _reCount((SequenceNode)node.right());\r
+    public void _reCount(SequenceNode node) {\r
+        if (node == null) {\r
+            return;\r
+        }\r
 \r
-      SequenceNode l = (SequenceNode)node.left();\r
-      SequenceNode r = (SequenceNode)node.right();\r
+        if ((node.left() != null) && (node.right() != null)) {\r
+            _reCount((SequenceNode) node.left());\r
+            _reCount((SequenceNode) node.right());\r
 \r
-      ((SequenceNode)node).count  = l.count + r.count;\r
-      ((SequenceNode)node).ycount = (l.ycount + r.ycount)/2;\r
+            SequenceNode l = (SequenceNode) node.left();\r
+            SequenceNode r = (SequenceNode) node.right();\r
 \r
-    } else {\r
-      ((SequenceNode)node).count = 1;\r
-      ((SequenceNode)node).ycount = ycount++;\r
+            ((SequenceNode) node).count = l.count + r.count;\r
+            ((SequenceNode) node).ycount = (l.ycount + r.ycount) / 2;\r
+        } else {\r
+            ((SequenceNode) node).count = 1;\r
+            ((SequenceNode) node).ycount = ycount++;\r
+        }\r
     }\r
 \r
-  }\r
     public void swapNodes(SequenceNode node) {\r
         if (node == null) {\r
             return;\r
         }\r
-        SequenceNode tmp = (SequenceNode)node.left();\r
+\r
+        SequenceNode tmp = (SequenceNode) node.left();\r
 \r
         node.setLeft(node.right());\r
         node.setRight(tmp);\r
     }\r
-  public void changeDirection(SequenceNode node, SequenceNode dir) {\r
-    if (node == null) {\r
-      return;\r
-    }\r
-    if (node.parent() != top) {\r
-      changeDirection((SequenceNode)node.parent(), node);\r
-\r
-      SequenceNode tmp = (SequenceNode)node.parent();\r
 \r
-      if (dir == node.left()) {\r
-        node.setParent(dir);\r
-        node.setLeft(tmp);\r
-      } else if (dir == node.right()) {\r
-        node.setParent(dir);\r
-        node.setRight(tmp);\r
-      }\r
+    public void changeDirection(SequenceNode node, SequenceNode dir) {\r
+        if (node == null) {\r
+            return;\r
+        }\r
 \r
-    } else {\r
-      if (dir == node.left()) {\r
-        node.setParent(node.left());\r
+        if (node.parent() != top) {\r
+            changeDirection((SequenceNode) node.parent(), node);\r
 \r
-        if (top.left() == node) {\r
-          node.setRight(top.right());\r
-        } else {\r
-          node.setRight(top.left());\r
-        }\r
-      } else {\r
-        node.setParent(node.right());\r
+            SequenceNode tmp = (SequenceNode) node.parent();\r
 \r
-        if (top.left() == node) {\r
-          node.setLeft(top.right());\r
+            if (dir == node.left()) {\r
+                node.setParent(dir);\r
+                node.setLeft(tmp);\r
+            } else if (dir == node.right()) {\r
+                node.setParent(dir);\r
+                node.setRight(tmp);\r
+            }\r
         } else {\r
-          node.setLeft(top.left());\r
+            if (dir == node.left()) {\r
+                node.setParent(node.left());\r
+\r
+                if (top.left() == node) {\r
+                    node.setRight(top.right());\r
+                } else {\r
+                    node.setRight(top.left());\r
+                }\r
+            } else {\r
+                node.setParent(node.right());\r
+\r
+                if (top.left() == node) {\r
+                    node.setLeft(top.right());\r
+                } else {\r
+                    node.setLeft(top.left());\r
+                }\r
+            }\r
         }\r
-      }\r
     }\r
-  }\r
+\r
     public void setMaxDist(SequenceNode node) {\r
         this.maxdist = maxdist;\r
     }\r
+\r
     public SequenceNode getMaxDist() {\r
         return maxdist;\r
     }\r
+\r
     public SequenceNode getTopNode() {\r
         return top;\r
     }\r
-\r
 }\r
 \r
 \r
-\r
 class Cluster {\r
+    int[] value;\r
 \r
-  int[] value;\r
-\r
-  public Cluster(int[] value) {\r
-    this.value = value;\r
-  }\r
-\r
+    public Cluster(int[] value) {\r
+        this.value = value;\r
+    }\r
 }\r
-\r
index 3948695..ecbe4ab 100755 (executable)
 * 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.analysis;\r
 \r
-import jalview.math.*;\r
 import jalview.datamodel.*;\r
+\r
+import jalview.math.*;\r
+\r
 import jalview.util.*;\r
 \r
 import java.awt.*;\r
+\r
 import java.io.*;\r
 \r
-public class PCA implements Runnable {\r
-  Matrix m;\r
-  Matrix symm;\r
-  Matrix m2;\r
 \r
-  double[] eigenvalue;\r
-  Matrix eigenvector;\r
+public class PCA implements Runnable {\r
+    Matrix m;\r
+    Matrix symm;\r
+    Matrix m2;\r
+    double[] eigenvalue;\r
+    Matrix eigenvector;\r
+\r
+    public PCA(Matrix m) {\r
+        this.m = m;\r
+    }\r
 \r
-  public PCA(Matrix m) {\r
-    this.m = m;\r
-  }\r
+    public PCA(SequenceI[] s) {\r
+        Runtime rt = Runtime.getRuntime();\r
+\r
+        BinarySequence[] bs = new BinarySequence[s.length];\r
+        int ii = 0;\r
+\r
+        while ((ii < s.length) && (s[ii] != null)) {\r
+            bs[ii] = new BinarySequence(s[ii]);\r
+            bs[ii].encode();\r
+            ii++;\r
+        }\r
+\r
+        BinarySequence[] bs2 = new BinarySequence[s.length];\r
+        ii = 0;\r
+\r
+        while ((ii < s.length) && (s[ii] != null)) {\r
+            bs2[ii] = new BinarySequence(s[ii]);\r
+            bs2[ii].blosumEncode();\r
+            ii++;\r
+        }\r
+\r
+        //System.out.println("Created binary encoding");\r
+        //printMemory(rt);\r
+        int count = 0;\r
+\r
+        while ((count < bs.length) && (bs[count] != null)) {\r
+            count++;\r
+        }\r
+\r
+        double[][] seqmat = new double[count][bs[0].getDBinary().length];\r
+        double[][] seqmat2 = new double[count][bs2[0].getDBinary().length];\r
+        int i = 0;\r
+\r
+        while (i < count) {\r
+            seqmat[i] = bs[i].getDBinary();\r
+            seqmat2[i] = bs2[i].getDBinary();\r
+            i++;\r
+        }\r
+\r
+        //System.out.println("Created array");\r
+        //printMemory(rt);\r
+        //    System.out.println(" --- Original matrix ---- ");\r
+        m = new Matrix(seqmat, count, bs[0].getDBinary().length);\r
+        m2 = new Matrix(seqmat2, count, bs2[0].getDBinary().length);\r
+\r
+        //System.out.println("Created matrix");\r
+        printMemory(rt);\r
+    }\r
 \r
-  public PCA(SequenceI[] s) {\r
-    Runtime rt = Runtime.getRuntime();\r
+    public static void printMemory(Runtime rt) {\r
+        System.out.println("PCA:Free memory = " + rt.freeMemory());\r
+    }\r
 \r
-    BinarySequence[] bs = new BinarySequence[s.length];\r
-    int ii = 0;\r
-    while (ii < s.length && s[ii] != null) {\r
+    public Matrix getM() {\r
+        return m;\r
+    }\r
 \r
-      bs[ii] = new BinarySequence(s[ii]);\r
-      bs[ii].encode();\r
-      ii++;\r
+    public double[] getEigenvector(int i) {\r
+        return eigenvector.getColumn(i);\r
     }\r
 \r
-    BinarySequence[] bs2 = new BinarySequence[s.length];\r
-    ii = 0;\r
-    while (ii < s.length && s[ii] != null) {\r
+    public double getEigenvalue(int i) {\r
+        return eigenvector.d[i];\r
+    }\r
 \r
-      bs2[ii] = new BinarySequence(s[ii]);\r
-      bs2[ii].blosumEncode();\r
-      ii++;\r
+    public float[][] getComponents(int l, int n, int mm) {\r
+        return getComponents(l, n, mm, 1);\r
     }\r
 \r
+    public float[][] getComponents(int l, int n, int mm, float factor) {\r
+        float[][] out = new float[m.rows][3];\r
 \r
-    //System.out.println("Created binary encoding");\r
-    //printMemory(rt);\r
+        for (int i = 0; i < m.rows; i++) {\r
+            out[i][0] = (float) component(i, l) * factor;\r
+            out[i][1] = (float) component(i, n) * factor;\r
+            out[i][2] = (float) component(i, mm) * factor;\r
+        }\r
 \r
-    int count=0;\r
-    while (count < bs.length && bs[count] != null) {\r
-      count++;\r
-    }\r
-    double[][] seqmat = new double[count][bs[0].getDBinary().length];\r
-    double[][] seqmat2 = new double[count][bs2[0].getDBinary().length];\r
-    int i=0;\r
-    while (i < count) {\r
-      seqmat[i] = bs[i].getDBinary();\r
-      seqmat2[i] = bs2[i].getDBinary();\r
-      i++;\r
+        return out;\r
     }\r
-    //System.out.println("Created array");\r
-    //printMemory(rt);\r
-    //    System.out.println(" --- Original matrix ---- ");\r
-    m = new Matrix(seqmat,count,bs[0].getDBinary().length);\r
-    m2 = new Matrix(seqmat2,count,bs2[0].getDBinary().length);\r
-\r
-    //System.out.println("Created matrix");\r
-    printMemory(rt);\r
-  }\r
-\r
-  public static void printMemory(Runtime rt) {\r
-    System.out.println("PCA:Free memory = " + rt.freeMemory());\r
-  }\r
-\r
-  public Matrix getM() {\r
-    return m;\r
-  }\r
-\r
-  public double[] getEigenvector(int i) {\r
-    return eigenvector.getColumn(i);\r
-  }\r
-\r
-  public double getEigenvalue(int i) {\r
-    return eigenvector.d[i];\r
-  }\r
-  public float[][] getComponents(int l, int n, int mm) {\r
-    return getComponents(l,n,mm,1);\r
-  }\r
-  public float[][] getComponents(int l, int n, int mm, float factor) {\r
-    float[][] out = new float[m.rows][3];\r
-\r
-    for (int i = 0; i < m.rows;i++) {\r
-      out[i][0] = (float)component(i,l)*factor;\r
-      out[i][1] = (float)component(i,n)*factor;\r
-      out[i][2] = (float)component(i,mm)*factor;\r
-    }\r
-    return out;\r
-  }\r
 \r
-  public double[] component(int n) {\r
-    // n = index of eigenvector\r
-    double[] out = new double[m.rows];\r
+    public double[] component(int n) {\r
+        // n = index of eigenvector\r
+        double[] out = new double[m.rows];\r
 \r
-    for (int i=0; i < m.rows; i++) {\r
-      out[i] = component(i,n);\r
-    }\r
-    return out;\r
-  }\r
-  public double component(int row, int n) {\r
-    double out = 0.0;\r
+        for (int i = 0; i < m.rows; i++) {\r
+            out[i] = component(i, n);\r
+        }\r
 \r
-    for (int i = 0; i < symm.cols; i++) {\r
-      out += symm.value[row][i] * eigenvector.value[i][n];\r
+        return out;\r
     }\r
-    return out/eigenvector.d[n];\r
-  }\r
 \r
-  public void checkEigenvector(int n,PrintStream ps) {\r
-    ps.println(" --- Eigenvector " + n  + " --- ");\r
+    public double component(int row, int n) {\r
+        double out = 0.0;\r
 \r
-    double[] eigenv = eigenvector.getColumn(n);\r
+        for (int i = 0; i < symm.cols; i++) {\r
+            out += (symm.value[row][i] * eigenvector.value[i][n]);\r
+        }\r
 \r
-    for (int i=0; i < eigenv.length;i++) {\r
-      Format.print(ps,"%15.4f",eigenv[i]);\r
+        return out / eigenvector.d[n];\r
     }\r
 \r
-    System.out.println();\r
+    public void checkEigenvector(int n, PrintStream ps) {\r
+        ps.println(" --- Eigenvector " + n + " --- ");\r
+\r
+        double[] eigenv = eigenvector.getColumn(n);\r
 \r
-    double[] neigenv = symm.vectorPostMultiply(eigenv);\r
-    System.out.println(" --- symmat * eigenv / lambda --- ");\r
-    if (eigenvector.d[n] > 1e-4) {\r
-      for (int i=0; i < neigenv.length;i++) {\r
-        Format.print(System.out,"%15.4f",neigenv[i]/eigenvector.d[n]);\r
-      }\r
+        for (int i = 0; i < eigenv.length; i++) {\r
+            Format.print(ps, "%15.4f", eigenv[i]);\r
+        }\r
+\r
+        System.out.println();\r
+\r
+        double[] neigenv = symm.vectorPostMultiply(eigenv);\r
+        System.out.println(" --- symmat * eigenv / lambda --- ");\r
+\r
+        if (eigenvector.d[n] > 1e-4) {\r
+            for (int i = 0; i < neigenv.length; i++) {\r
+                Format.print(System.out, "%15.4f", neigenv[i] / eigenvector.d[n]);\r
+            }\r
+        }\r
+\r
+        System.out.println();\r
     }\r
-    System.out.println();\r
-  }\r
-\r
-  public void run() {\r
-    Matrix mt = m.transpose();\r
-    //    System.out.println(" --- OrigT * Orig ---- ");\r
-    eigenvector = mt.preMultiply(m2);\r
-    //  eigenvector.print(System.out);\r
-    symm = eigenvector.copy();\r
-\r
-    //TextArea ta = new TextArea(25,72);\r
-    //TextAreaPrintStream taps = new TextAreaPrintStream(System.out,ta);\r
-    //Frame f = new Frame("PCA output");\r
-    //f.resize(500,500);\r
-    //f.setLayout(new BorderLayout());\r
-    //f.add("Center",ta);\r
-    //f.show();\r
-    //symm.print(taps);\r
-    long tstart = System.currentTimeMillis();\r
-    eigenvector.tred();\r
-    long tend = System.currentTimeMillis();\r
-    //taps.println("Time take for tred = " + (tend-tstart) + "ms");\r
-    //taps.println(" ---Tridiag transform matrix ---");\r
-\r
-    //taps.println(" --- D vector ---");\r
-    //eigenvector.printD(taps);\r
-    //taps.println();\r
-    //taps.println(" --- E vector ---");\r
-    //    eigenvector.printE(taps);\r
-    //taps.println();\r
-\r
-    // Now produce the diagonalization matrix\r
-    tstart = System.currentTimeMillis();\r
-    eigenvector.tqli();\r
-    tend = System.currentTimeMillis();\r
-    //System.out.println("Time take for tqli = " + (tend-tstart) + " ms");\r
-\r
-    //System.out.println(" --- New diagonalization matrix ---");\r
-\r
-    //System.out.println(" --- Eigenvalues ---");\r
-    //eigenvector.printD(taps);\r
-\r
-    //System.out.println();\r
-\r
-    // for (int i=0; i < eigenvector.cols; i++) {\r
-    // checkEigenvector(i,taps);\r
-    // taps.println();\r
-    // }\r
-\r
-    //  taps.println();\r
-    //  taps.println("Transformed sequences = ");\r
-    // Matrix trans =  m.preMultiply(eigenvector);\r
-    //  trans.print(System.out);\r
-  }\r
 \r
+    public void run() {\r
+        Matrix mt = m.transpose();\r
+\r
+        //    System.out.println(" --- OrigT * Orig ---- ");\r
+        eigenvector = mt.preMultiply(m2);\r
+\r
+        //  eigenvector.print(System.out);\r
+        symm = eigenvector.copy();\r
+\r
+        //TextArea ta = new TextArea(25,72);\r
+        //TextAreaPrintStream taps = new TextAreaPrintStream(System.out,ta);\r
+        //Frame f = new Frame("PCA output");\r
+        //f.resize(500,500);\r
+        //f.setLayout(new BorderLayout());\r
+        //f.add("Center",ta);\r
+        //f.show();\r
+        //symm.print(taps);\r
+        long tstart = System.currentTimeMillis();\r
+        eigenvector.tred();\r
+\r
+        long tend = System.currentTimeMillis();\r
+\r
+        //taps.println("Time take for tred = " + (tend-tstart) + "ms");\r
+        //taps.println(" ---Tridiag transform matrix ---");\r
+        //taps.println(" --- D vector ---");\r
+        //eigenvector.printD(taps);\r
+        //taps.println();\r
+        //taps.println(" --- E vector ---");\r
+        //    eigenvector.printE(taps);\r
+        //taps.println();\r
+        // Now produce the diagonalization matrix\r
+        tstart = System.currentTimeMillis();\r
+        eigenvector.tqli();\r
+        tend = System.currentTimeMillis();\r
+\r
+        //System.out.println("Time take for tqli = " + (tend-tstart) + " ms");\r
+        //System.out.println(" --- New diagonalization matrix ---");\r
+        //System.out.println(" --- Eigenvalues ---");\r
+        //eigenvector.printD(taps);\r
+        //System.out.println();\r
+        // for (int i=0; i < eigenvector.cols; i++) {\r
+        // checkEigenvector(i,taps);\r
+        // taps.println();\r
+        // }\r
+        //  taps.println();\r
+        //  taps.println("Transformed sequences = ");\r
+        // Matrix trans =  m.preMultiply(eigenvector);\r
+        //  trans.print(System.out);\r
+    }\r
 }\r
index faa08e1..8a8ae28 100755 (executable)
 * 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.analysis;
-
-import jalview.datamodel.SequenceI;
-import java.util.Hashtable;
-
+*/\r
+package jalview.analysis;\r
+\r
+import jalview.datamodel.SequenceI;\r
+\r
+import java.util.Hashtable;\r
+\r
+\r
 /**
  * <p>Title: </p>
  *
@@ -33,97 +34,105 @@ import java.util.Hashtable;
  *
  * @author not attributable
  * @version 1.0
- */
-public class SeqsetUtils
-{
+ */\r
+public class SeqsetUtils {\r
     /**
-     * Store essential properties of a sequence in a hashtable for later recovery
-     *  Keys are Name, Start, End, SeqFeatures, PdbId
-     * @param seq SequenceI
-     * @return Hashtable
-     */
-    public static Hashtable SeqCharacterHash(SequenceI seq) {
-    Hashtable sqinfo = new Hashtable();
-    sqinfo.put("Name", seq.getName());
-    sqinfo.put("Start", new Integer(seq.getStart()));
-    sqinfo.put("End", new Integer(seq.getEnd()));
-    sqinfo.put("SeqFeatures", seq.getSequenceFeatures());
-    sqinfo.put("PdbId", (seq.getPDBId()!=null) ? seq.getPDBId() : new String("") );
-    return sqinfo;
-  }
-  /**
-   * Recover essential properties of a sequence from a hashtable
-   * TODO: replace these methods with something more elegant.
-   * @param sq SequenceI
-   * @param sqinfo Hashtable
-   * @return boolean
-   */
-  public static boolean SeqCharacterUnhash(SequenceI sq, Hashtable sqinfo) {
-    boolean namePresent = true;
-    String oldname = (String) sqinfo.get("Name");
-    Integer start = (Integer) sqinfo.get("Start");
-    Integer end = (Integer) sqinfo.get("End");
-    java.util.Vector sfeatures = (java.util.Vector) sqinfo.get("SeqFeatures");
-    String pdbid = (String) sqinfo.get("PdbId");
-    if (oldname==null)
-      namePresent = false;
-    else
-      sq.setName(oldname);
-    if (!pdbid.equals(""))
-      sq.setPDBId(pdbid);
-
-    if ((start!=null) && (end!=null)) {
-      sq.setStart(start.intValue());
-      sq.setEnd(end.intValue());
-    }
-    if (sfeatures!=null)
-      sq.setSequenceFeatures(sfeatures);
-    return namePresent;
-  }
-
-  /**
-   * Form of the unique name used in uniquify for the i'th sequence in an ordered vector of sequences.
-   * @param i int
-   * @return String
-   */
-  public static String unique_name(int i) {
-      return new String("Sequence"+i);
-  }
-
-  public static Hashtable uniquify(SequenceI[] sequences, boolean write_names)
-  {
-    // Generate a safely named sequence set and a hash to recover the sequence names
-    Hashtable map = new Hashtable();
-    String[] un_names = new String[sequences.length];
-    if (!write_names)
-
-    for (int i = 0; i < sequences.length; i++)
-    {
-      String safename = new String("Sequence" + i);
-      map.put(safename, SeqCharacterHash(sequences[i]));
-      if (write_names)
-        sequences[i].setName(safename);
-    }
-    return map;
-  }
-
-  public static boolean deuniquify(Hashtable map, SequenceI[] sequences)
-  {
-    // recover unsafe sequence names for a sequence set
-    boolean allfound = true;
-    for (int i = 0; i < sequences.length; i++)
-    {
-      if (map.containsKey(sequences[i].getName()))
-      {
-        Hashtable sqinfo = (Hashtable) map.get(sequences[i].getName());
-        SeqCharacterUnhash(sequences[i], sqinfo);
-      }
-      else
-      {
-        allfound = false;
-      }
-    }
-    return allfound;
-  }
-
-}
+ * Store essential properties of a sequence in a hashtable for later recovery
+ *  Keys are Name, Start, End, SeqFeatures, PdbId
+ * @param seq SequenceI
+ * @return Hashtable
+ */\r
+    public static Hashtable SeqCharacterHash(SequenceI seq) {\r
+        Hashtable sqinfo = new Hashtable();\r
+        sqinfo.put("Name", seq.getName());\r
+        sqinfo.put("Start", new Integer(seq.getStart()));\r
+        sqinfo.put("End", new Integer(seq.getEnd()));\r
+        sqinfo.put("SeqFeatures", seq.getSequenceFeatures());\r
+        sqinfo.put("PdbId",\r
+            (seq.getPDBId() != null) ? seq.getPDBId() : new String(""));\r
+\r
+        return sqinfo;\r
+    }\r
+\r
+    /**
+ * Recover essential properties of a sequence from a hashtable
+ * TODO: replace these methods with something more elegant.
+ * @param sq SequenceI
+ * @param sqinfo Hashtable
+ * @return boolean
+ */\r
+    public static boolean SeqCharacterUnhash(SequenceI sq, Hashtable sqinfo) {\r
+        boolean namePresent = true;\r
+        String oldname = (String) sqinfo.get("Name");\r
+        Integer start = (Integer) sqinfo.get("Start");\r
+        Integer end = (Integer) sqinfo.get("End");\r
+        java.util.Vector sfeatures = (java.util.Vector) sqinfo.get(\r
+                "SeqFeatures");\r
+        String pdbid = (String) sqinfo.get("PdbId");\r
+\r
+        if (oldname == null) {\r
+            namePresent = false;\r
+        } else {\r
+            sq.setName(oldname);\r
+        }\r
+\r
+        if (!pdbid.equals("")) {\r
+            sq.setPDBId(pdbid);\r
+        }\r
+\r
+        if ((start != null) && (end != null)) {\r
+            sq.setStart(start.intValue());\r
+            sq.setEnd(end.intValue());\r
+        }\r
+\r
+        if (sfeatures != null) {\r
+            sq.setSequenceFeatures(sfeatures);\r
+        }\r
+\r
+        return namePresent;\r
+    }\r
+\r
+    /**
+ * Form of the unique name used in uniquify for the i'th sequence in an ordered vector of sequences.
+ * @param i int
+ * @return String
+ */\r
+    public static String unique_name(int i) {\r
+        return new String("Sequence" + i);\r
+    }\r
+\r
+    public static Hashtable uniquify(SequenceI[] sequences, boolean write_names) {\r
+        // Generate a safely named sequence set and a hash to recover the sequence names\r
+        Hashtable map = new Hashtable();\r
+        String[] un_names = new String[sequences.length];\r
+\r
+        if (!write_names) {\r
+            for (int i = 0; i < sequences.length; i++) {\r
+                String safename = new String("Sequence" + i);\r
+                map.put(safename, SeqCharacterHash(sequences[i]));\r
+\r
+                if (write_names) {\r
+                    sequences[i].setName(safename);\r
+                }\r
+            }\r
+        }\r
+\r
+        return map;\r
+    }\r
+\r
+    public static boolean deuniquify(Hashtable map, SequenceI[] sequences) {\r
+        // recover unsafe sequence names for a sequence set\r
+        boolean allfound = true;\r
+\r
+        for (int i = 0; i < sequences.length; i++) {\r
+            if (map.containsKey(sequences[i].getName())) {\r
+                Hashtable sqinfo = (Hashtable) map.get(sequences[i].getName());\r
+                SeqCharacterUnhash(sequences[i], sqinfo);\r
+            } else {\r
+                allfound = false;\r
+            }\r
+        }\r
+\r
+        return allfound;\r
+    }\r
+}\r
index 1c156cd..f786243 100755 (executable)
 * 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.analysis;
-
-import java.util.Vector;
-import java.util.Hashtable;
-import jalview.datamodel.SequenceI;
-
+*/\r
+package jalview.analysis;\r
+\r
+import jalview.datamodel.SequenceI;\r
+\r
+import java.util.Hashtable;\r
+import java.util.Vector;\r
+\r
+\r
 /**
  * <p>Title: </p>
  * SequenceIdMatcher
@@ -34,123 +35,105 @@ import jalview.datamodel.SequenceI;
  *
  * @author not attributable
  * @version 1.0
- */
-public class SequenceIdMatcher
-{
-
-  private class SeqIdName
-  {
-    String id;
-
-    SeqIdName(String s)
-    {
-      id = new String(s);
-    }
-
-    public int hashCode()
-    {
-      return (id.substring(0, 4).hashCode());
-    }
-
-    public boolean equals(Object s)
-    {
-      if (s instanceof SeqIdName)
-      {
-        return this.equals( (SeqIdName) s);
-      }
-      else
-      {
-        if (s instanceof String)
-        {
-          return this.equals( (String) s);
-        }
-      }
-      return false;
-    }
-
-    public boolean equals(SeqIdName s)
-    {
-      if (id.startsWith(s.id) || s.id.startsWith(id))
-      {
-        return true;
-      }
-      return false;
-    }
-
-    public boolean equals(String s)
-    {
-      if (id.startsWith(s) || s.startsWith(id))
-      {
-        return true;
-      }
-      return false;
-    }
-  }
-
-  private Hashtable names;
-
-  public SequenceIdMatcher(SequenceI[] seqs)
-  {
-    names = new Hashtable();
-    for (int i = 0; i < seqs.length; i++)
-    {
-      names.put(new SeqIdName(seqs[i].getName()), seqs[i]);
-    }
-  }
-
-  SequenceI findIdMatch(SequenceI seq)
-  {
-    SeqIdName nam = new SeqIdName(seq.getName());
-    if (names.containsKey(nam))
-    {
-      return (SequenceI) names.get(nam);
-    }
-    return null;
-  }
-
-  SequenceI findIdMatch(String seqnam)
-  {
-    SeqIdName nam = new SeqIdName(seqnam);
-    if (names.containsKey(nam))
-    {
-      return (SequenceI) names.get(nam);
-    }
-    return null;
-  }
-
-  /**
-   * findIdMatch
-   *
-   * Return pointers to sequences (or sequence object containers)
-   * which have same Id as a given set of different sequence objects
-   *
-   * @param seqs SequenceI[]
-   * @return SequenceI[]
-   */
-
-  SequenceI[] findIdMatch(SequenceI[] seqs)
-  {
-    SequenceI[] namedseqs = new SequenceI[seqs.length];
-
-    int i = 0;
-    SeqIdName nam;
-    if (seqs.length > 0)
-    {
-      do
-      {
-        nam = new SeqIdName(seqs[i].getName());
-        if (names.containsKey(nam))
-        {
-          namedseqs[i] = (SequenceI) names.get(nam);
-        }
-        else
-        {
-          namedseqs[i] = null;
-        }
-      }
-      while (i++ < seqs.length);
-    }
-    return namedseqs;
-  }
-
-}
+ */\r
+public class SequenceIdMatcher {\r
+    private Hashtable names;\r
+\r
+    public SequenceIdMatcher(SequenceI[] seqs) {\r
+        names = new Hashtable();\r
+\r
+        for (int i = 0; i < seqs.length; i++) {\r
+            names.put(new SeqIdName(seqs[i].getName()), seqs[i]);\r
+        }\r
+    }\r
+\r
+    SequenceI findIdMatch(SequenceI seq) {\r
+        SeqIdName nam = new SeqIdName(seq.getName());\r
+\r
+        if (names.containsKey(nam)) {\r
+            return (SequenceI) names.get(nam);\r
+        }\r
+\r
+        return null;\r
+    }\r
+\r
+    SequenceI findIdMatch(String seqnam) {\r
+        SeqIdName nam = new SeqIdName(seqnam);\r
+\r
+        if (names.containsKey(nam)) {\r
+            return (SequenceI) names.get(nam);\r
+        }\r
+\r
+        return null;\r
+    }\r
+\r
+    /**
+ * findIdMatch
+ *
+ * Return pointers to sequences (or sequence object containers)
+ * which have same Id as a given set of different sequence objects
+ *
+ * @param seqs SequenceI[]
+ * @return SequenceI[]
+ */\r
+    SequenceI[] findIdMatch(SequenceI[] seqs) {\r
+        SequenceI[] namedseqs = new SequenceI[seqs.length];\r
+\r
+        int i = 0;\r
+        SeqIdName nam;\r
+\r
+        if (seqs.length > 0) {\r
+            do {\r
+                nam = new SeqIdName(seqs[i].getName());\r
+\r
+                if (names.containsKey(nam)) {\r
+                    namedseqs[i] = (SequenceI) names.get(nam);\r
+                } else {\r
+                    namedseqs[i] = null;\r
+                }\r
+            } while (i++ < seqs.length);\r
+        }\r
+\r
+        return namedseqs;\r
+    }\r
+\r
+    private class SeqIdName {\r
+        String id;\r
+\r
+        SeqIdName(String s) {\r
+            id = new String(s);\r
+        }\r
+\r
+        public int hashCode() {\r
+            return (id.substring(0, 4).hashCode());\r
+        }\r
+\r
+        public boolean equals(Object s) {\r
+            if (s instanceof SeqIdName) {\r
+                return this.equals((SeqIdName) s);\r
+            } else {\r
+                if (s instanceof String) {\r
+                    return this.equals((String) s);\r
+                }\r
+            }\r
+\r
+            return false;\r
+        }\r
+\r
+        public boolean equals(SeqIdName s) {\r
+            if (id.startsWith(s.id) || s.id.startsWith(id)) {\r
+                return true;\r
+            }\r
+\r
+            return false;\r
+        }\r
+\r
+        public boolean equals(String s) {\r
+            if (id.startsWith(s) || s.startsWith(id)) {\r
+                return true;\r
+            }\r
+\r
+            return false;\r
+        }\r
+    }\r
+}\r
index 42643d0..42546f9 100755 (executable)
@@ -1,31 +1,33 @@
 /*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 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
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 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 jalview.datamodel.*;\r
-import jalview.analysis.*;\r
-import jalview.schemes.*;\r
 import java.awt.*;\r
 import java.awt.event.*;\r
 \r
-public class APopupMenu extends java.awt.PopupMenu\r
+import jalview.analysis.*;\r
+import jalview.datamodel.*;\r
+import jalview.schemes.*;\r
+\r
+public class APopupMenu\r
+    extends java.awt.PopupMenu\r
 {\r
   Menu groupMenu = new Menu();\r
   protected MenuItem clustalColour = new MenuItem();\r
@@ -43,7 +45,6 @@ public class APopupMenu extends java.awt.PopupMenu
   MenuItem noColourmenuItem = new MenuItem();\r
   protected CheckboxMenuItem conservationMenuItem = new CheckboxMenuItem();\r
 \r
-\r
   AlignmentPanel ap;\r
   Menu sequenceMenu = new Menu();\r
   MenuItem sequenceName = new MenuItem();\r
@@ -68,28 +69,36 @@ public class APopupMenu extends java.awt.PopupMenu
     sequence = seq;\r
 \r
     try\r
-    {     jbInit();   }\r
-    catch(Exception e)\r
-    {    e.printStackTrace();    }\r
-\r
+    {\r
+      jbInit();\r
+    }\r
+    catch (Exception e)\r
+    {\r
+      e.printStackTrace();\r
+    }\r
 \r
     SequenceGroup sg = ap.av.getSelectionGroup();\r
-    if(sg!=null)\r
+    if (sg != null)\r
     {\r
       showText.setState(sg.getDisplayText());\r
       showColourText.setState(sg.getColourText());\r
       showBoxes.setState(sg.getDisplayBoxes());\r
     }\r
 \r
-    if( !ap.av.alignment.getGroups().contains(sg))\r
-        groupMenu.remove(unGroupMenuItem);\r
-\r
-    if(seq==null)\r
-       remove(sequenceMenu);\r
+    if (!ap.av.alignment.getGroups().contains(sg))\r
+    {\r
+      groupMenu.remove(unGroupMenuItem);\r
+    }\r
 \r
+    if (seq == null)\r
+    {\r
+      remove(sequenceMenu);\r
+    }\r
 \r
   }\r
-  private void jbInit() throws Exception\r
+\r
+  private void jbInit()\r
+      throws Exception\r
   {\r
     groupMenu.setLabel("Group");\r
     groupMenu.setLabel("Define");\r
@@ -105,7 +114,6 @@ public class APopupMenu extends java.awt.PopupMenu
       }\r
     });\r
 \r
-\r
     nucleotideMenuItem.setLabel("Nucleotide");\r
     nucleotideMenuItem.addActionListener(new ActionListener()\r
     {\r
@@ -283,15 +291,16 @@ public class APopupMenu extends java.awt.PopupMenu
     });\r
     conservationMenuItem.setLabel("Conservation");\r
 \r
-\r
   }\r
 \r
   void refresh()\r
   {\r
     SequenceGroup sg = getGroup();\r
-    SuperGroup superG = ap.av.alignment.getSuperGroup( sg );\r
-    if( superG !=null)\r
-      superG.setSuperGroupProperties( sg );\r
+    SuperGroup superG = ap.av.alignment.getSuperGroup(sg);\r
+    if (superG != null)\r
+    {\r
+      superG.setSuperGroupProperties(sg);\r
+    }\r
 \r
     ap.seqPanel.seqCanvas.repaint();\r
   }\r
@@ -315,7 +324,6 @@ public class APopupMenu extends java.awt.PopupMenu
     refresh();\r
   }\r
 \r
-\r
   protected void hydrophobicityColour_actionPerformed(ActionEvent e)\r
   {\r
     getGroup().cs = new HydrophobicColourScheme();\r
@@ -352,8 +360,6 @@ public class APopupMenu extends java.awt.PopupMenu
     refresh();\r
   }\r
 \r
-\r
-\r
   protected void abovePIDColour_itemStateChanged(ItemEvent ie)\r
   {\r
     SequenceGroup sg = getGroup();\r
@@ -361,15 +367,19 @@ public class APopupMenu extends java.awt.PopupMenu
     {\r
       sg.cs.setConsensus(AAFrequency.calculate(sg.sequences, 0,\r
                                                ap.av.alignment.getWidth()));\r
-      int threshold = SliderPanel.setPIDSliderSource(ap, sg.cs, getGroup().getName());\r
+      int threshold = SliderPanel.setPIDSliderSource(ap, sg.cs,\r
+          getGroup().getName());\r
       if (sg.cs instanceof ResidueColourScheme)\r
-        ( (ResidueColourScheme)sg. cs).setThreshold(threshold);\r
+      {\r
+        ( (ResidueColourScheme) sg.cs).setThreshold(threshold);\r
+      }\r
       else if (sg.cs instanceof ScoreColourScheme)\r
+      {\r
         ( (ScoreColourScheme) sg.cs).setThreshold(threshold);\r
+      }\r
 \r
       SliderPanel.showPIDSlider();\r
 \r
-\r
     }\r
     else // remove PIDColouring\r
     {\r
@@ -382,10 +392,9 @@ public class APopupMenu extends java.awt.PopupMenu
 \r
   }\r
 \r
-\r
   protected void userDefinedColour_actionPerformed(ActionEvent e)\r
   {\r
-    new UserDefinedColours( ap, getGroup());\r
+    new UserDefinedColours(ap, getGroup());\r
   }\r
 \r
   protected void PIDColour_actionPerformed(ActionEvent e)\r
@@ -393,7 +402,7 @@ public class APopupMenu extends java.awt.PopupMenu
     SequenceGroup sg = getGroup();\r
     sg.cs = new PIDColourScheme();\r
     sg.cs.setConsensus(AAFrequency.calculate(sg.sequences, 0,\r
-                                               ap.av.alignment.getWidth()));\r
+                                             ap.av.alignment.getWidth()));\r
     refresh();\r
   }\r
 \r
@@ -404,34 +413,32 @@ public class APopupMenu extends java.awt.PopupMenu
     sg.cs = new Blosum62ColourScheme();\r
 \r
     sg.cs.setConsensus(AAFrequency.calculate(sg.sequences, 0,\r
-                                               ap.av.alignment.getWidth()));\r
+                                             ap.av.alignment.getWidth()));\r
 \r
     refresh();\r
   }\r
 \r
-\r
   protected void noColourmenuItem_actionPerformed(ActionEvent e)\r
   {\r
     getGroup().cs = null;\r
     refresh();\r
   }\r
 \r
-  protected  void conservationMenuItem_itemStateChanged(ItemEvent ie)\r
+  protected void conservationMenuItem_itemStateChanged(ItemEvent ie)\r
   {\r
     SequenceGroup sg = getGroup();\r
 \r
-    if(conservationMenuItem.getState())\r
+    if (conservationMenuItem.getState())\r
     {\r
 \r
-        Conservation c = new Conservation("Group",\r
-                                          ResidueProperties.propHash, 3,\r
-                                          sg.sequences, 0,\r
-                                          ap.av.alignment.getWidth());\r
-\r
-        c.calculate();\r
-        c.verdict(false, ap.av.ConsPercGaps);\r
-        ConservationColourScheme ccs = new ConservationColourScheme(c, sg.cs);\r
+      Conservation c = new Conservation("Group",\r
+                                        ResidueProperties.propHash, 3,\r
+                                        sg.sequences, 0,\r
+                                        ap.av.alignment.getWidth());\r
 \r
+      c.calculate();\r
+      c.verdict(false, ap.av.ConsPercGaps);\r
+      ConservationColourScheme ccs = new ConservationColourScheme(c, sg.cs);\r
 \r
       sg.cs = ccs;\r
 \r
@@ -440,32 +447,31 @@ public class APopupMenu extends java.awt.PopupMenu
     }\r
     else // remove ConservationColouring\r
     {\r
-        ConservationColourScheme ccs = (ConservationColourScheme)sg.cs;\r
-        sg.cs = ccs.cs;\r
+      ConservationColourScheme ccs = (ConservationColourScheme) sg.cs;\r
+      sg.cs = ccs.cs;\r
     }\r
 \r
-     refresh();\r
+    refresh();\r
   }\r
 \r
-\r
   protected void analyze_actionPerformed(ActionEvent e)\r
   {\r
-     CutAndPasteTransfer cap = new CutAndPasteTransfer(false);\r
-     Frame frame = new Frame();\r
-     frame.add(cap);\r
-     jalview.bin.JalviewLite.addFrame(frame, "Analyze this - ", 400, 300);\r
-     SequenceGroup sg = getGroup();\r
-     StringBuffer sb = new StringBuffer();\r
-\r
-     for(int i=0; i<sg.sequences.size(); i++)\r
-     {\r
-       Sequence tmp = (Sequence)sg.sequences.elementAt(i);\r
-       sb.append(  tmp.getSequence(sg.getStartRes(), sg.getEndRes()+1));\r
-       sb.append("\n");\r
-     }\r
-\r
-     sb.append("Something amazing will happen soon");\r
-     cap.setText( sb.toString() );\r
+    CutAndPasteTransfer cap = new CutAndPasteTransfer(false);\r
+    Frame frame = new Frame();\r
+    frame.add(cap);\r
+    jalview.bin.JalviewLite.addFrame(frame, "Analyze this - ", 400, 300);\r
+    SequenceGroup sg = getGroup();\r
+    StringBuffer sb = new StringBuffer();\r
+\r
+    for (int i = 0; i < sg.sequences.size(); i++)\r
+    {\r
+      Sequence tmp = (Sequence) sg.sequences.elementAt(i);\r
+      sb.append(tmp.getSequence(sg.getStartRes(), sg.getEndRes() + 1));\r
+      sb.append("\n");\r
+    }\r
+\r
+    sb.append("Something amazing will happen soon");\r
+    cap.setText(sb.toString());\r
 \r
   }\r
 \r
@@ -481,13 +487,12 @@ public class APopupMenu extends java.awt.PopupMenu
 \r
   void unGroupMenuItem_actionPerformed(ActionEvent e)\r
   {\r
-     SequenceGroup sg = ap.av.getSelectionGroup();\r
-     ap.av.alignment.deleteGroup(sg);\r
-     ap.av.setSelectionGroup(null);\r
-     ap.repaint();\r
+    SequenceGroup sg = ap.av.getSelectionGroup();\r
+    ap.av.alignment.deleteGroup(sg);\r
+    ap.av.setSelectionGroup(null);\r
+    ap.repaint();\r
   }\r
 \r
-\r
   public void showColourText_itemStateChanged(ItemEvent itemEvent)\r
   {\r
     getGroup().setColourText(showColourText.getState());\r
index 7d0c985..2783f26 100755 (executable)
@@ -1,21 +1,21 @@
 /*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 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
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 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
@@ -28,11 +28,11 @@ import java.awt.*;
 import java.awt.event.*;\r
 import java.util.*;\r
 \r
-\r
-public class AlignFrame extends GAlignFrame\r
+public class AlignFrame\r
+    extends GAlignFrame\r
 {\r
   final AlignmentPanel alignPanel;\r
-  final AlignViewport  viewport;\r
+  final AlignViewport viewport;\r
   public static final int NEW_WINDOW_WIDTH = 700;\r
   public static final int NEW_WINDOW_HEIGHT = 500;\r
   jalview.bin.JalviewLite applet;\r
@@ -61,14 +61,15 @@ public class AlignFrame extends GAlignFrame
       try\r
       {\r
         treeFile = treeFile;\r
-        jalview.io.NewickFile fin = new jalview.io.NewickFile( applet.getCodeBase()+treeFile, "URL");\r
+        jalview.io.NewickFile fin = new jalview.io.NewickFile(applet.\r
+            getCodeBase() + treeFile, "URL");\r
         fin.parse();\r
 \r
         if (fin.getTree() != null)\r
         {\r
           TreePanel tp = null;\r
           tp = new TreePanel(viewport, viewport.getAlignment().getSequences(),\r
-                             fin, "FromFile", applet.getCodeBase()+treeFile);\r
+                             fin, "FromFile", applet.getCodeBase() + treeFile);\r
           jalview.bin.JalviewLite.addFrame(tp, treeFile, 600, 500);\r
           addTreeMenuItem(tp, treeFile);\r
         }\r
@@ -79,25 +80,27 @@ public class AlignFrame extends GAlignFrame
       }\r
     }\r
 \r
-\r
   }\r
 \r
   public void inputText_actionPerformed(ActionEvent e)\r
   {\r
-     CutAndPasteTransfer cap = new CutAndPasteTransfer(true);\r
-     Frame frame = new Frame();\r
-     frame.add(cap);\r
-     jalview.bin.JalviewLite.addFrame(frame, "Cut & Paste Input", 500,500);\r
+    CutAndPasteTransfer cap = new CutAndPasteTransfer(true);\r
+    Frame frame = new Frame();\r
+    frame.add(cap);\r
+    jalview.bin.JalviewLite.addFrame(frame, "Cut & Paste Input", 500, 500);\r
   }\r
 \r
-\r
   protected void outputText_actionPerformed(ActionEvent e)\r
   {\r
-     CutAndPasteTransfer cap = new CutAndPasteTransfer(false);\r
-     Frame frame = new Frame();\r
-     frame.add(cap);\r
-     jalview.bin.JalviewLite.addFrame(frame,"Alignment output - "+e.getActionCommand(),600, 500);\r
-     cap.setText( FormatAdapter.formatSequences(e.getActionCommand(), viewport.getAlignment().getSequences()));\r
+    CutAndPasteTransfer cap = new CutAndPasteTransfer(false);\r
+    Frame frame = new Frame();\r
+    frame.add(cap);\r
+    jalview.bin.JalviewLite.addFrame(frame,\r
+                                     "Alignment output - " + e.getActionCommand(),\r
+                                     600, 500);\r
+    cap.setText(FormatAdapter.formatSequences(e.getActionCommand(),\r
+                                              viewport.getAlignment().\r
+                                              getSequences()));\r
   }\r
 \r
   public void closeMenuItem_actionPerformed(ActionEvent e)\r
@@ -109,100 +112,109 @@ public class AlignFrame extends GAlignFrame
   Stack redoList = new Stack();\r
 \r
   void updateEditMenuBar()\r
-   {\r
-     if(historyList.size()>0)\r
-      {\r
-        undoMenuItem.setEnabled(true);\r
-        HistoryItem hi = (HistoryItem)historyList.peek();\r
-        undoMenuItem.setLabel("Undo "+hi.getDescription());\r
-      }\r
-     else\r
-     {\r
-       undoMenuItem.setEnabled(false);\r
-       undoMenuItem.setLabel("Undo");\r
-     }\r
+  {\r
+    if (historyList.size() > 0)\r
+    {\r
+      undoMenuItem.setEnabled(true);\r
+      HistoryItem hi = (HistoryItem) historyList.peek();\r
+      undoMenuItem.setLabel("Undo " + hi.getDescription());\r
+    }\r
+    else\r
+    {\r
+      undoMenuItem.setEnabled(false);\r
+      undoMenuItem.setLabel("Undo");\r
+    }\r
 \r
-     if(redoList.size()>0)\r
-      {\r
-        redoMenuItem.setEnabled(true);\r
-        HistoryItem hi = (HistoryItem)redoList.peek();\r
-        redoMenuItem.setLabel("Redo "+hi.getDescription());\r
-      }\r
-     else\r
-     {\r
-       redoMenuItem.setEnabled(false);\r
-       redoMenuItem.setLabel("Redo");\r
-     }\r
-   }\r
-\r
-   public void addHistoryItem(HistoryItem hi)\r
-   {\r
-     historyList.push(hi);\r
-     updateEditMenuBar();\r
-   }\r
-\r
-   protected void undoMenuItem_actionPerformed(ActionEvent e)\r
-   {\r
-       HistoryItem hi = (HistoryItem)historyList.pop();\r
-       redoList.push(new HistoryItem(hi.getDescription(), viewport.alignment, HistoryItem.HIDE));\r
-       restoreHistoryItem(hi);\r
-   }\r
-\r
-   protected void redoMenuItem_actionPerformed(ActionEvent e)\r
-   {\r
-      HistoryItem hi = (HistoryItem)redoList.pop();\r
-      restoreHistoryItem(hi);\r
-      updateEditMenuBar();\r
-      viewport.updateConsensus();\r
-      alignPanel.repaint();\r
-      alignPanel.repaint();\r
-   }\r
+    if (redoList.size() > 0)\r
+    {\r
+      redoMenuItem.setEnabled(true);\r
+      HistoryItem hi = (HistoryItem) redoList.peek();\r
+      redoMenuItem.setLabel("Redo " + hi.getDescription());\r
+    }\r
+    else\r
+    {\r
+      redoMenuItem.setEnabled(false);\r
+      redoMenuItem.setLabel("Redo");\r
+    }\r
+  }\r
+\r
+  public void addHistoryItem(HistoryItem hi)\r
+  {\r
+    historyList.push(hi);\r
+    updateEditMenuBar();\r
+  }\r
+\r
+  protected void undoMenuItem_actionPerformed(ActionEvent e)\r
+  {\r
+    HistoryItem hi = (HistoryItem) historyList.pop();\r
+    redoList.push(new HistoryItem(hi.getDescription(), viewport.alignment,\r
+                                  HistoryItem.HIDE));\r
+    restoreHistoryItem(hi);\r
+  }\r
 \r
+  protected void redoMenuItem_actionPerformed(ActionEvent e)\r
+  {\r
+    HistoryItem hi = (HistoryItem) redoList.pop();\r
+    restoreHistoryItem(hi);\r
+    updateEditMenuBar();\r
+    viewport.updateConsensus();\r
+    alignPanel.repaint();\r
+    alignPanel.repaint();\r
+  }\r
 \r
-   // used by undo and redo\r
-   void restoreHistoryItem(HistoryItem hi)\r
-   {\r
-      if(hi.getType()== HistoryItem.SORT)\r
+  // used by undo and redo\r
+  void restoreHistoryItem(HistoryItem hi)\r
+  {\r
+    if (hi.getType() == HistoryItem.SORT)\r
+    {\r
+      for (int i = 0; i < hi.getSequences().size(); i++)\r
       {\r
-           for(int i=0; i<hi.getSequences().size(); i++)\r
-             viewport.alignment.getSequences().setElementAt(hi.getSequences().elementAt(i), i);\r
+        viewport.alignment.getSequences().setElementAt(hi.getSequences().\r
+            elementAt(i), i);\r
       }\r
-      else\r
+    }\r
+    else\r
+    {\r
+      for (int i = 0; i < hi.getSequences().size(); i++)\r
       {\r
-        for (int i = 0; i < hi.getSequences().size(); i++)\r
+        SequenceI restore = (SequenceI) hi.getSequences().elementAt(i);\r
+        if (restore.getLength() == 0)\r
         {\r
-          SequenceI restore = (SequenceI) hi.getSequences().elementAt(i);\r
-          if(restore.getLength()==0)\r
-          {\r
-            // log.System.out.println(hi.getHidden().elementAt(i));\r
-            restore.setSequence(hi.getHidden().elementAt(i).toString());\r
-            viewport.alignment.getSequences().insertElementAt(\r
-               restore,\r
-               hi.getAlignIndex(i));\r
-          }\r
-          else\r
-            restore.setSequence(hi.getHidden().elementAt(i).toString());\r
+          // log.System.out.println(hi.getHidden().elementAt(i));\r
+          restore.setSequence(hi.getHidden().elementAt(i).toString());\r
+          viewport.alignment.getSequences().insertElementAt(\r
+              restore,\r
+              hi.getAlignIndex(i));\r
         }\r
-        if(hi.getType()==HistoryItem.PASTE)\r
+        else\r
         {\r
-          for(int i=viewport.alignment.getHeight()-1;i>hi.getSequences().size()-1; i--)\r
-            viewport.alignment.deleteSequence(i);\r
+          restore.setSequence(hi.getHidden().elementAt(i).toString());\r
         }\r
       }\r
+      if (hi.getType() == HistoryItem.PASTE)\r
+      {\r
+        for (int i = viewport.alignment.getHeight() - 1;\r
+             i > hi.getSequences().size() - 1; i--)\r
+        {\r
+          viewport.alignment.deleteSequence(i);\r
+        }\r
+      }\r
+    }\r
 \r
-       updateEditMenuBar();\r
-\r
-       viewport.updateConsensus();\r
-       viewport.updateConservation();\r
-       alignPanel.repaint();\r
-   }\r
+    updateEditMenuBar();\r
 \r
+    viewport.updateConsensus();\r
+    viewport.updateConservation();\r
+    alignPanel.repaint();\r
+  }\r
 \r
   public void moveSelectedSequences(boolean up)\r
   {\r
     SequenceGroup sg = viewport.getSelectionGroup();\r
     if (sg == null)\r
+    {\r
       return;\r
+    }\r
 \r
     if (up)\r
     {\r
@@ -210,11 +222,15 @@ public class AlignFrame extends GAlignFrame
       {\r
         SequenceI seq = viewport.alignment.getSequenceAt(i);\r
         if (!sg.sequences.contains(seq))\r
+        {\r
           continue;\r
+        }\r
 \r
         SequenceI temp = viewport.alignment.getSequenceAt(i - 1);\r
         if (sg.sequences.contains(temp))\r
+        {\r
           continue;\r
+        }\r
 \r
         viewport.alignment.getSequences().setElementAt(temp, i);\r
         viewport.alignment.getSequences().setElementAt(seq, i - 1);\r
@@ -226,11 +242,15 @@ public class AlignFrame extends GAlignFrame
       {\r
         SequenceI seq = viewport.alignment.getSequenceAt(i);\r
         if (!sg.sequences.contains(seq))\r
+        {\r
           continue;\r
+        }\r
 \r
         SequenceI temp = viewport.alignment.getSequenceAt(i + 1);\r
         if (sg.sequences.contains(temp))\r
+        {\r
           continue;\r
+        }\r
 \r
         viewport.alignment.getSequences().setElementAt(temp, i);\r
         viewport.alignment.getSequences().setElementAt(seq, i + 1);\r
@@ -240,47 +260,52 @@ public class AlignFrame extends GAlignFrame
     alignPanel.repaint();\r
   }\r
 \r
-\r
   StringBuffer copiedSequences;\r
   protected void copy_actionPerformed(ActionEvent e)\r
   {\r
-   if(viewport.getSelectionGroup()==null)\r
-     return;\r
+    if (viewport.getSelectionGroup() == null)\r
+    {\r
+      return;\r
+    }\r
 \r
-   SequenceGroup sg = viewport.getSelectionGroup();\r
-   copiedSequences = new StringBuffer();\r
-   Hashtable orderedSeqs = new Hashtable();\r
-   for(int i=0; i<sg.getSize(); i++)\r
-   {\r
+    SequenceGroup sg = viewport.getSelectionGroup();\r
+    copiedSequences = new StringBuffer();\r
+    Hashtable orderedSeqs = new Hashtable();\r
+    for (int i = 0; i < sg.getSize(); i++)\r
+    {\r
       SequenceI seq = sg.getSequenceAt(i);\r
       int index = viewport.alignment.findIndex(seq);\r
-      orderedSeqs.put(index+"", seq);\r
-   }\r
+      orderedSeqs.put(index + "", seq);\r
+    }\r
 \r
-   int index=0;\r
-   for(int i=0; i<sg.getSize(); i++)\r
-   {\r
-     SequenceI seq = null;\r
-     while( seq == null )\r
-     {\r
-       if(orderedSeqs.containsKey(index+""))\r
-       {\r
-         seq = (SequenceI) orderedSeqs.get(index + "");\r
-         index++;\r
-         break;\r
-       }\r
-       else\r
-         index++;\r
-     }\r
+    int index = 0;\r
+    for (int i = 0; i < sg.getSize(); i++)\r
+    {\r
+      SequenceI seq = null;\r
+      while (seq == null)\r
+      {\r
+        if (orderedSeqs.containsKey(index + ""))\r
+        {\r
+          seq = (SequenceI) orderedSeqs.get(index + "");\r
+          index++;\r
+          break;\r
+        }\r
+        else\r
+        {\r
+          index++;\r
+        }\r
+      }\r
 \r
-         copiedSequences.append( seq.getName()+"\t"+seq.findPosition( sg.getStartRes() ) +"\t"\r
-                        +seq.findPosition( sg.getEndRes() )+ "\t"\r
-                        +sg.getSequenceAt(i).getSequence(sg.getStartRes(), sg.getEndRes()+1)+"\n");\r
-       }\r
+      copiedSequences.append(seq.getName() + "\t" +\r
+                             seq.findPosition(sg.getStartRes()) + "\t"\r
+                             + seq.findPosition(sg.getEndRes()) + "\t"\r
+                             +\r
+                             sg.getSequenceAt(i).getSequence(sg.getStartRes(),\r
+          sg.getEndRes() + 1) + "\n");\r
+    }\r
 \r
   }\r
 \r
-\r
   protected void pasteNew_actionPerformed(ActionEvent e)\r
   {\r
     paste(true);\r
@@ -288,15 +313,19 @@ public class AlignFrame extends GAlignFrame
 \r
   protected void pasteThis_actionPerformed(ActionEvent e)\r
   {\r
-    addHistoryItem(new HistoryItem("Paste Sequences", viewport.alignment, HistoryItem.PASTE));\r
+    addHistoryItem(new HistoryItem("Paste Sequences", viewport.alignment,\r
+                                   HistoryItem.PASTE));\r
     paste(false);\r
   }\r
 \r
   void paste(boolean newAlignment)\r
   {\r
-    try{\r
+    try\r
+    {\r
       if (copiedSequences == null)\r
+      {\r
         return;\r
+      }\r
 \r
       StringTokenizer st = new StringTokenizer(copiedSequences.toString());\r
       Vector seqs = new Vector();\r
@@ -305,27 +334,38 @@ public class AlignFrame extends GAlignFrame
         String name = st.nextToken();\r
         int start = Integer.parseInt(st.nextToken());\r
         int end = Integer.parseInt(st.nextToken());\r
-        Sequence sequence = new Sequence(name,st.nextToken(), start, end);\r
+        Sequence sequence = new Sequence(name, st.nextToken(), start, end);\r
 \r
-        if(!newAlignment)\r
+        if (!newAlignment)\r
+        {\r
           viewport.alignment.addSequence(sequence);\r
+        }\r
         else\r
+        {\r
           seqs.addElement(sequence);\r
+        }\r
       }\r
 \r
-      if(newAlignment)\r
+      if (newAlignment)\r
       {\r
         SequenceI[] newSeqs = new SequenceI[seqs.size()];\r
-        for(int i=0; i<seqs.size(); i++)\r
-         newSeqs[i] = (SequenceI)seqs.elementAt(i);\r
+        for (int i = 0; i < seqs.size(); i++)\r
+        {\r
+          newSeqs[i] = (SequenceI) seqs.elementAt(i);\r
+        }\r
 \r
         AlignFrame af = new AlignFrame(new Alignment(newSeqs), applet);\r
         String newtitle = new String("Copied sequences");\r
-        if( getTitle().startsWith("Copied sequences"))\r
-         newtitle = getTitle();\r
-       else\r
-         newtitle = newtitle.concat("- from "+getTitle());\r
-        jalview.bin.JalviewLite.addFrame(af, newtitle, NEW_WINDOW_WIDTH, NEW_WINDOW_HEIGHT);\r
+        if (getTitle().startsWith("Copied sequences"))\r
+        {\r
+          newtitle = getTitle();\r
+        }\r
+        else\r
+        {\r
+          newtitle = newtitle.concat("- from " + getTitle());\r
+        }\r
+        jalview.bin.JalviewLite.addFrame(af, newtitle, NEW_WINDOW_WIDTH,\r
+                                         NEW_WINDOW_HEIGHT);\r
       }\r
       else\r
       {\r
@@ -336,11 +376,12 @@ public class AlignFrame extends GAlignFrame
         alignPanel.repaint();\r
       }\r
 \r
-    }catch(Exception ex){}// could be anything being pasted in here\r
+    }\r
+    catch (Exception ex)\r
+    {} // could be anything being pasted in here\r
 \r
   }\r
 \r
-\r
   protected void cut_actionPerformed(ActionEvent e)\r
   {\r
     copy_actionPerformed(null);\r
@@ -349,39 +390,48 @@ public class AlignFrame extends GAlignFrame
 \r
   protected void delete_actionPerformed(ActionEvent e)\r
   {\r
-    addHistoryItem(new HistoryItem("Delete Sequences", viewport.alignment, HistoryItem.HIDE));\r
+    addHistoryItem(new HistoryItem("Delete Sequences", viewport.alignment,\r
+                                   HistoryItem.HIDE));\r
     if (viewport.getSelectionGroup() == null)\r
+    {\r
       return;\r
+    }\r
 \r
-     SequenceGroup sg = viewport.getSelectionGroup();\r
-     for (int i=0;i < sg.sequences.size(); i++)\r
-     {\r
-       SequenceI seq = sg.getSequenceAt(i);\r
-       int index = viewport.getAlignment().findIndex(seq);\r
-       seq.deleteChars(sg.getStartRes(), sg.getEndRes()+1);\r
+    SequenceGroup sg = viewport.getSelectionGroup();\r
+    for (int i = 0; i < sg.sequences.size(); i++)\r
+    {\r
+      SequenceI seq = sg.getSequenceAt(i);\r
+      int index = viewport.getAlignment().findIndex(seq);\r
+      seq.deleteChars(sg.getStartRes(), sg.getEndRes() + 1);\r
 \r
-       if(seq.getSequence().length()<1)\r
-          viewport.getAlignment().deleteSequence(seq);\r
+      if (seq.getSequence().length() < 1)\r
+      {\r
+        viewport.getAlignment().deleteSequence(seq);\r
+      }\r
       else\r
-          viewport.getAlignment().getSequences().setElementAt(seq, index);\r
-     }\r
+      {\r
+        viewport.getAlignment().getSequences().setElementAt(seq, index);\r
+      }\r
+    }\r
 \r
-     viewport.setSelectionGroup(null);\r
-     viewport.alignment.deleteGroup(sg);\r
-     viewport.resetSeqLimits( alignPanel.seqPanel.seqCanvas.getSize().height);\r
-     if(viewport.getAlignment().getHeight()<1)\r
-     try\r
-     {\r
-       this.setVisible(false);\r
-     }catch(Exception ex){}\r
-   viewport.updateConservation();\r
-   viewport.updateConsensus();\r
-     alignPanel.repaint();\r
+    viewport.setSelectionGroup(null);\r
+    viewport.alignment.deleteGroup(sg);\r
+    viewport.resetSeqLimits(alignPanel.seqPanel.seqCanvas.getSize().height);\r
+    if (viewport.getAlignment().getHeight() < 1)\r
+    {\r
+      try\r
+      {\r
+        this.setVisible(false);\r
+      }\r
+      catch (Exception ex)\r
+      {}\r
+    }\r
+    viewport.updateConservation();\r
+    viewport.updateConsensus();\r
+    alignPanel.repaint();\r
 \r
   }\r
 \r
-\r
-\r
   protected void deleteGroups_actionPerformed(ActionEvent e)\r
   {\r
     viewport.alignment.deleteAllGroups();\r
@@ -390,13 +440,13 @@ public class AlignFrame extends GAlignFrame
     alignPanel.repaint();\r
   }\r
 \r
-\r
-\r
   public void selectAllSequenceMenuItem_actionPerformed(ActionEvent e)\r
   {\r
     SequenceGroup sg = new SequenceGroup();\r
-    for (int i=0; i<viewport.getAlignment().getSequences().size(); i++)\r
-      sg.addSequence( viewport.getAlignment().getSequenceAt(i));\r
+    for (int i = 0; i < viewport.getAlignment().getSequences().size(); i++)\r
+    {\r
+      sg.addSequence(viewport.getAlignment().getSequenceAt(i));\r
+    }\r
     sg.setEndRes(viewport.alignment.getWidth());\r
     viewport.setSelectionGroup(sg);\r
     alignPanel.repaint();\r
@@ -414,8 +464,10 @@ public class AlignFrame extends GAlignFrame
   public void invertSequenceMenuItem_actionPerformed(ActionEvent e)\r
   {\r
     SequenceGroup sg = viewport.getSelectionGroup();\r
-    for (int i=0; i<viewport.getAlignment().getSequences().size(); i++)\r
-      sg.addOrRemove (viewport.getAlignment().getSequenceAt(i));\r
+    for (int i = 0; i < viewport.getAlignment().getSequences().size(); i++)\r
+    {\r
+      sg.addOrRemove(viewport.getAlignment().getSequenceAt(i));\r
+    }\r
 \r
     PaintRefresher.Refresh(null);\r
   }\r
@@ -425,21 +477,25 @@ public class AlignFrame extends GAlignFrame
     ColumnSelection colSel = viewport.getColumnSelection();\r
     if (colSel.size() > 0)\r
     {\r
-      addHistoryItem(new HistoryItem("Remove Left",viewport.alignment,\r
+      addHistoryItem(new HistoryItem("Remove Left", viewport.alignment,\r
                                      HistoryItem.HIDE));\r
       int min = colSel.getMin();\r
       viewport.getAlignment().trimLeft(min);\r
-      colSel.compensateForEdit(0,min);\r
+      colSel.compensateForEdit(0, min);\r
 \r
-      if(viewport.getSelectionGroup()!=null)\r
+      if (viewport.getSelectionGroup() != null)\r
+      {\r
         viewport.getSelectionGroup().adjustForRemoveLeft(min);\r
+      }\r
 \r
       Vector groups = viewport.alignment.getGroups();\r
-      for(int i=0; i<groups.size(); i++)\r
+      for (int i = 0; i < groups.size(); i++)\r
       {\r
         SequenceGroup sg = (SequenceGroup) groups.elementAt(i);\r
-        if(!sg.adjustForRemoveLeft(min))\r
+        if (!sg.adjustForRemoveLeft(min))\r
+        {\r
           viewport.alignment.deleteGroup(sg);\r
+        }\r
       }\r
 \r
       alignPanel.repaint();\r
@@ -451,23 +507,25 @@ public class AlignFrame extends GAlignFrame
     ColumnSelection colSel = viewport.getColumnSelection();\r
     if (colSel.size() > 0)\r
     {\r
-      addHistoryItem(new HistoryItem("Remove Right",viewport.alignment,\r
+      addHistoryItem(new HistoryItem("Remove Right", viewport.alignment,\r
                                      HistoryItem.HIDE));\r
       int max = colSel.getMax();\r
       viewport.getAlignment().trimRight(max);\r
-      if(viewport.getSelectionGroup()!=null)\r
+      if (viewport.getSelectionGroup() != null)\r
+      {\r
         viewport.getSelectionGroup().adjustForRemoveRight(max);\r
+      }\r
 \r
       Vector groups = viewport.alignment.getGroups();\r
-      for(int i=0; i<groups.size(); i++)\r
+      for (int i = 0; i < groups.size(); i++)\r
       {\r
         SequenceGroup sg = (SequenceGroup) groups.elementAt(i);\r
-        if(!sg.adjustForRemoveRight(max))\r
+        if (!sg.adjustForRemoveRight(max))\r
+        {\r
           viewport.alignment.deleteGroup(sg);\r
+        }\r
       }\r
 \r
-\r
-\r
       alignPanel.repaint();\r
     }\r
 \r
@@ -491,59 +549,59 @@ public class AlignFrame extends GAlignFrame
                                    HistoryItem.HIDE));\r
     SequenceI current;\r
     int jSize;\r
-    for (int i=0; i < viewport.getAlignment().getSequences().size();i++)\r
+    for (int i = 0; i < viewport.getAlignment().getSequences().size(); i++)\r
     {\r
       current = viewport.getAlignment().getSequenceAt(i);\r
       jSize = current.getLength();\r
-      for (int j=0; j < jSize; j++)\r
-        if(jalview.util.Comparison.isGap(current.getCharAt(j)))\r
+      for (int j = 0; j < jSize; j++)\r
+      {\r
+        if (jalview.util.Comparison.isGap(current.getCharAt(j)))\r
         {\r
           current.deleteCharAt(j);\r
           j--;\r
           jSize--;\r
         }\r
+      }\r
     }\r
     viewport.updateConservation();\r
     viewport.updateConsensus();\r
     alignPanel.repaint();\r
   }\r
 \r
-\r
   public void findMenuItem_actionPerformed(ActionEvent e)\r
   {\r
     Finder finder = new Finder(alignPanel);\r
   }\r
 \r
-\r
   public void font_actionPerformed(ActionEvent e)\r
   {\r
     Frame frame = new Frame();\r
-    FontChooser fc = new FontChooser( alignPanel, frame);\r
+    FontChooser fc = new FontChooser(alignPanel, frame);\r
     frame.add(fc);\r
-    jalview.bin.JalviewLite.addFrame(frame, "Change Font", 440,100);\r
+    jalview.bin.JalviewLite.addFrame(frame, "Change Font", 440, 100);\r
 \r
   }\r
 \r
   protected void fullSeqId_actionPerformed(ActionEvent e)\r
   {\r
-    viewport.setShowFullId( fullSeqId.getState() );\r
+    viewport.setShowFullId(fullSeqId.getState());\r
     alignPanel.fontChanged();\r
     alignPanel.repaint();\r
   }\r
 \r
   protected void colourTextMenuItem_actionPerformed(ActionEvent e)\r
   {\r
-      viewport.setColourText( colourTextMenuItem.getState() );\r
-      alignPanel.repaint();\r
+    viewport.setColourText(colourTextMenuItem.getState());\r
+    alignPanel.repaint();\r
   }\r
 \r
   protected void wrapMenuItem_actionPerformed(ActionEvent e)\r
   {\r
-    viewport.setWrapAlignment( wrapMenuItem.getState() );\r
-    alignPanel.setWrapAlignment( wrapMenuItem.getState() );\r
-    scaleAbove.setEnabled( wrapMenuItem.getState() );\r
-    scaleLeft.setEnabled( wrapMenuItem.getState());\r
-    scaleRight.setEnabled( wrapMenuItem.getState());\r
+    viewport.setWrapAlignment(wrapMenuItem.getState());\r
+    alignPanel.setWrapAlignment(wrapMenuItem.getState());\r
+    scaleAbove.setEnabled(wrapMenuItem.getState());\r
+    scaleLeft.setEnabled(wrapMenuItem.getState());\r
+    scaleRight.setEnabled(wrapMenuItem.getState());\r
     alignPanel.repaint();\r
   }\r
 \r
@@ -565,74 +623,73 @@ public class AlignFrame extends GAlignFrame
     alignPanel.repaint();\r
   }\r
 \r
-\r
-\r
   public void viewBoxesMenuItem_actionPerformed(ActionEvent e)\r
   {\r
-    viewport.setShowBoxes( viewBoxesMenuItem.getState() );\r
+    viewport.setShowBoxes(viewBoxesMenuItem.getState());\r
     alignPanel.repaint();\r
   }\r
 \r
   public void viewTextMenuItem_actionPerformed(ActionEvent e)\r
   {\r
-    viewport.setShowText( viewTextMenuItem.getState() );\r
+    viewport.setShowText(viewTextMenuItem.getState());\r
     alignPanel.repaint();\r
   }\r
 \r
-\r
   protected void renderGapsMenuItem_actionPerformed(ActionEvent e)\r
   {\r
     viewport.setRenderGaps(renderGapsMenuItem.getState());\r
     alignPanel.repaint();\r
   }\r
 \r
-\r
   public void annotationPanelMenuItem_actionPerformed(ActionEvent e)\r
   {\r
-    if(annotationPanelMenuItem.getState() && viewport.getWrapAlignment())\r
+    if (annotationPanelMenuItem.getState() && viewport.getWrapAlignment())\r
     {\r
       annotationPanelMenuItem.setState(false);\r
       return;\r
     }\r
-    viewport.setShowAnnotation( annotationPanelMenuItem.getState() );\r
-    alignPanel.setAnnotationVisible( annotationPanelMenuItem.getState() );\r
+    viewport.setShowAnnotation(annotationPanelMenuItem.getState());\r
+    alignPanel.setAnnotationVisible(annotationPanelMenuItem.getState());\r
   }\r
 \r
   public void overviewMenuItem_actionPerformed(ActionEvent e)\r
   {\r
-   if (alignPanel.overviewPanel != null)\r
+    if (alignPanel.overviewPanel != null)\r
+    {\r
       return;\r
+    }\r
 \r
     Frame frame = new Frame();\r
     OverviewPanel overview = new OverviewPanel(alignPanel);\r
     frame.add(overview);\r
     // +50 must allow for applet frame window\r
     jalview.bin.JalviewLite.addFrame(frame, "Overview " + this.getTitle(),\r
-                             overview.preferredSize().width, overview.preferredSize().height+50);\r
+                                     overview.preferredSize().width,\r
+                                     overview.preferredSize().height + 50);\r
 \r
     frame.pack();\r
     frame.addWindowListener(new WindowAdapter()\r
-    { public void windowClosing(WindowEvent e)\r
+    {\r
+      public void windowClosing(WindowEvent e)\r
       {\r
-            alignPanel.setOverviewPanel(null);\r
+        alignPanel.setOverviewPanel(null);\r
       };\r
     });\r
 \r
-    alignPanel.setOverviewPanel( overview );\r
-\r
+    alignPanel.setOverviewPanel(overview);\r
 \r
   }\r
 \r
   protected void noColourmenuItem_actionPerformed(ActionEvent e)\r
   {\r
-    changeColour( null );\r
+    changeColour(null);\r
   }\r
 \r
-\r
   public void clustalColour_actionPerformed(ActionEvent e)\r
   {\r
     abovePIDThreshold.setState(false);\r
-    changeColour(new ClustalxColourScheme(viewport.alignment.getSequences(), viewport.alignment.getWidth()));\r
+    changeColour(new ClustalxColourScheme(viewport.alignment.getSequences(),\r
+                                          viewport.alignment.getWidth()));\r
   }\r
 \r
   public void zappoColour_actionPerformed(ActionEvent e)\r
@@ -645,33 +702,29 @@ public class AlignFrame extends GAlignFrame
     changeColour(new TaylorColourScheme());\r
   }\r
 \r
-\r
   public void hydrophobicityColour_actionPerformed(ActionEvent e)\r
   {\r
-    changeColour( new HydrophobicColourScheme() );\r
+    changeColour(new HydrophobicColourScheme());\r
   }\r
 \r
   public void helixColour_actionPerformed(ActionEvent e)\r
   {\r
-    changeColour(new HelixColourScheme() );\r
+    changeColour(new HelixColourScheme());\r
   }\r
 \r
-\r
   public void strandColour_actionPerformed(ActionEvent e)\r
   {\r
     changeColour(new StrandColourScheme());\r
   }\r
 \r
-\r
   public void turnColour_actionPerformed(ActionEvent e)\r
   {\r
     changeColour(new TurnColourScheme());\r
   }\r
 \r
-\r
   public void buriedColour_actionPerformed(ActionEvent e)\r
   {\r
-    changeColour(new BuriedColourScheme() );\r
+    changeColour(new BuriedColourScheme());\r
   }\r
 \r
   public void nucleotideColour_actionPerformed(ActionEvent e)\r
@@ -679,35 +732,38 @@ public class AlignFrame extends GAlignFrame
     changeColour(new NucleotideColourScheme());\r
   }\r
 \r
-\r
   protected void applyToAllGroups_actionPerformed(ActionEvent e)\r
   {\r
     viewport.setColourAppliesToAllGroups(applyToAllGroups.getState());\r
   }\r
 \r
-\r
-\r
   void changeColour(ColourSchemeI cs)\r
   {\r
     int threshold = 0;\r
 \r
-    if ( viewport.getAbovePIDThreshold() )\r
+    if (viewport.getAbovePIDThreshold())\r
     {\r
       threshold = SliderPanel.setPIDSliderSource(alignPanel, cs, "Background");\r
 \r
       if (cs instanceof ResidueColourScheme)\r
+      {\r
         ( (ResidueColourScheme) cs).setThreshold(threshold);\r
+      }\r
       else if (cs instanceof ScoreColourScheme)\r
+      {\r
         ( (ScoreColourScheme) cs).setThreshold(threshold);\r
+      }\r
 \r
       viewport.setGlobalColourScheme(cs);\r
     }\r
     else if (cs instanceof ResidueColourScheme)\r
+    {\r
       ( (ResidueColourScheme) cs).setThreshold(0);\r
+    }\r
     else if (cs instanceof ScoreColourScheme)\r
+    {\r
       ( (ScoreColourScheme) cs).setThreshold(0);\r
-\r
-\r
+    }\r
 \r
     if (viewport.getConservationSelected())\r
     {\r
@@ -725,7 +781,7 @@ public class AlignFrame extends GAlignFrame
       ccs = new ConservationColourScheme(c, cs);\r
 \r
       // MUST NOTIFY THE COLOURSCHEME OF CONSENSUS!\r
-      ccs.setConsensus( viewport.vconsensus );\r
+      ccs.setConsensus(viewport.vconsensus);\r
       viewport.setGlobalColourScheme(ccs);\r
 \r
       SliderPanel.setConservationSlider(alignPanel, ccs, "Background");\r
@@ -733,25 +789,27 @@ public class AlignFrame extends GAlignFrame
     }\r
     else\r
     {\r
-        // MUST NOTIFY THE COLOURSCHEME OF CONSENSUS!\r
-        if (cs != null)\r
-          cs.setConsensus(viewport.vconsensus);\r
-        viewport.setGlobalColourScheme(cs);\r
+      // MUST NOTIFY THE COLOURSCHEME OF CONSENSUS!\r
+      if (cs != null)\r
+      {\r
+        cs.setConsensus(viewport.vconsensus);\r
+      }\r
+      viewport.setGlobalColourScheme(cs);\r
     }\r
 \r
-\r
-    if(viewport.getColourAppliesToAllGroups())\r
+    if (viewport.getColourAppliesToAllGroups())\r
     {\r
       Vector groups = viewport.alignment.getGroups();\r
-      for(int i=0; i<groups.size(); i++)\r
+      for (int i = 0; i < groups.size(); i++)\r
       {\r
-        SequenceGroup sg = (SequenceGroup)groups.elementAt(i);\r
+        SequenceGroup sg = (SequenceGroup) groups.elementAt(i);\r
 \r
         if (cs instanceof ClustalxColourScheme)\r
         {\r
           sg.cs = new ClustalxColourScheme(sg.sequences, sg.getWidth());\r
         }\r
         else\r
+        {\r
           try\r
           {\r
             sg.cs = (ColourSchemeI) cs.getClass().newInstance();\r
@@ -761,28 +819,34 @@ public class AlignFrame extends GAlignFrame
             ex.printStackTrace();\r
             sg.cs = cs;\r
           }\r
+        }\r
 \r
-        if(viewport.getAbovePIDThreshold())\r
+        if (viewport.getAbovePIDThreshold())\r
         {\r
           if (sg.cs instanceof ResidueColourScheme)\r
+          {\r
             ( (ResidueColourScheme) sg.cs).setThreshold(threshold);\r
+          }\r
           else if (sg.cs instanceof ScoreColourScheme)\r
+          {\r
             ( (ScoreColourScheme) sg.cs).setThreshold(threshold);\r
+          }\r
 \r
-           sg.cs.setConsensus( AAFrequency.calculate(sg.sequences, 0, sg.getWidth()) );\r
+          sg.cs.setConsensus(AAFrequency.calculate(sg.sequences, 0, sg.getWidth()));\r
         }\r
 \r
-        if( viewport.getConservationSelected() )\r
+        if (viewport.getConservationSelected())\r
         {\r
           Conservation c = new Conservation("Group",\r
                                             ResidueProperties.propHash, 3,\r
-                                            sg.sequences, 0, viewport.alignment.getWidth()-1);\r
+                                            sg.sequences, 0,\r
+                                            viewport.alignment.getWidth() - 1);\r
           c.calculate();\r
           c.verdict(false, viewport.ConsPercGaps);\r
           ConservationColourScheme ccs = new ConservationColourScheme(c, sg.cs);\r
 \r
           // MUST NOTIFY THE COLOURSCHEME OF CONSENSUS!\r
-          ccs.setConsensus( AAFrequency.calculate(sg.sequences, 0, sg.getWidth()));\r
+          ccs.setConsensus(AAFrequency.calculate(sg.sequences, 0, sg.getWidth()));\r
           sg.cs = ccs;\r
         }\r
         else\r
@@ -794,25 +858,27 @@ public class AlignFrame extends GAlignFrame
       }\r
     }\r
 \r
-    if(alignPanel.getOverviewPanel()!=null)\r
+    if (alignPanel.getOverviewPanel() != null)\r
+    {\r
       alignPanel.getOverviewPanel().updateOverviewImage();\r
+    }\r
 \r
     alignPanel.repaint();\r
   }\r
 \r
   protected void modifyPID_actionPerformed(ActionEvent e)\r
   {\r
-      if(viewport.getAbovePIDThreshold())\r
-      {\r
-        SliderPanel.setPIDSliderSource(alignPanel, viewport.getGlobalColourScheme(),\r
-                                   "Background");\r
-        SliderPanel.showPIDSlider();\r
-      }\r
+    if (viewport.getAbovePIDThreshold())\r
+    {\r
+      SliderPanel.setPIDSliderSource(alignPanel, viewport.getGlobalColourScheme(),\r
+                                     "Background");\r
+      SliderPanel.showPIDSlider();\r
+    }\r
   }\r
 \r
   protected void modifyConservation_actionPerformed(ActionEvent e)\r
   {\r
-    if(viewport.getConservationSelected())\r
+    if (viewport.getConservationSelected())\r
     {\r
       SliderPanel.setConservationSlider(alignPanel, viewport.globalColourScheme,\r
                                         "Background");\r
@@ -820,19 +886,22 @@ public class AlignFrame extends GAlignFrame
     }\r
   }\r
 \r
-\r
-  protected  void conservationMenuItem_actionPerformed(ActionEvent e)\r
+  protected void conservationMenuItem_actionPerformed(ActionEvent e)\r
   {\r
     viewport.setConservationSelected(conservationMenuItem.getState());\r
 \r
     viewport.setAbovePIDThreshold(false);\r
     abovePIDThreshold.setState(false);\r
 \r
-   ColourSchemeI cs = viewport.getGlobalColourScheme();\r
-   if(cs instanceof ConservationColourScheme )\r
-     changeColour( ((ConservationColourScheme)cs).cs );\r
+    ColourSchemeI cs = viewport.getGlobalColourScheme();\r
+    if (cs instanceof ConservationColourScheme)\r
+    {\r
+      changeColour( ( (ConservationColourScheme) cs).cs);\r
+    }\r
     else\r
-      changeColour( cs );\r
+    {\r
+      changeColour(cs);\r
+    }\r
 \r
     modifyConservation_actionPerformed(null);\r
   }\r
@@ -846,51 +915,54 @@ public class AlignFrame extends GAlignFrame
 \r
     ColourSchemeI cs = viewport.getGlobalColourScheme();\r
 \r
-    if(cs instanceof ConservationColourScheme )\r
-        changeColour( ((ConservationColourScheme)cs).cs );\r
+    if (cs instanceof ConservationColourScheme)\r
+    {\r
+      changeColour( ( (ConservationColourScheme) cs).cs);\r
+    }\r
     else\r
-        changeColour( cs );\r
+    {\r
+      changeColour(cs);\r
+    }\r
 \r
     modifyPID_actionPerformed(null);\r
   }\r
 \r
-\r
-\r
   public void userDefinedColour_actionPerformed(ActionEvent e)\r
   {\r
-    UserDefinedColours chooser = new UserDefinedColours( alignPanel, null);\r
+    UserDefinedColours chooser = new UserDefinedColours(alignPanel, null);\r
   }\r
 \r
   public void PIDColour_actionPerformed(ActionEvent e)\r
   {\r
-    changeColour( new PIDColourScheme() );\r
+    changeColour(new PIDColourScheme());\r
   }\r
 \r
-\r
   public void BLOSUM62Colour_actionPerformed(ActionEvent e)\r
   {\r
-    changeColour(new Blosum62ColourScheme() );\r
+    changeColour(new Blosum62ColourScheme());\r
   }\r
 \r
-\r
-\r
   public void sortPairwiseMenuItem_actionPerformed(ActionEvent e)\r
   {\r
-    addHistoryItem(new HistoryItem("Pairwise Sort", viewport.alignment, HistoryItem.SORT));\r
-    AlignmentSorter.sortByPID(viewport.getAlignment(), viewport.getAlignment().getSequenceAt(0));\r
+    addHistoryItem(new HistoryItem("Pairwise Sort", viewport.alignment,\r
+                                   HistoryItem.SORT));\r
+    AlignmentSorter.sortByPID(viewport.getAlignment(),\r
+                              viewport.getAlignment().getSequenceAt(0));\r
     alignPanel.repaint();\r
   }\r
 \r
   public void sortIDMenuItem_actionPerformed(ActionEvent e)\r
   {\r
-    addHistoryItem(new HistoryItem("ID Sort", viewport.alignment, HistoryItem.SORT));\r
-    AlignmentSorter.sortByID( viewport.getAlignment() );\r
+    addHistoryItem(new HistoryItem("ID Sort", viewport.alignment,\r
+                                   HistoryItem.SORT));\r
+    AlignmentSorter.sortByID(viewport.getAlignment());\r
     alignPanel.repaint();\r
   }\r
 \r
   public void sortGroupMenuItem_actionPerformed(ActionEvent e)\r
   {\r
-    addHistoryItem(new HistoryItem("Group Sort", viewport.alignment, HistoryItem.SORT));\r
+    addHistoryItem(new HistoryItem("Group Sort", viewport.alignment,\r
+                                   HistoryItem.SORT));\r
     AlignmentSorter.sortByGroup(viewport.getAlignment());\r
     AlignmentSorter.sortGroups(viewport.getAlignment());\r
     alignPanel.repaint();\r
@@ -901,13 +973,14 @@ public class AlignFrame extends GAlignFrame
     RedundancyPanel sp = new RedundancyPanel(alignPanel);\r
     Frame frame = new Frame();\r
     frame.add(sp);\r
-    jalview.bin.JalviewLite.addFrame(frame, "Redundancy threshold selection", 400, 120);\r
+    jalview.bin.JalviewLite.addFrame(frame, "Redundancy threshold selection",\r
+                                     400, 120);\r
 \r
   }\r
 \r
   public void pairwiseAlignmentMenuItem_actionPerformed(ActionEvent e)\r
   {\r
-    if(viewport.getSelectionGroup().getSize()>1)\r
+    if (viewport.getSelectionGroup().getSize() > 1)\r
     {\r
       Frame frame = new Frame();\r
       frame.add(new PairwiseAlignPanel(viewport));\r
@@ -918,21 +991,25 @@ public class AlignFrame extends GAlignFrame
   public void PCAMenuItem_actionPerformed(ActionEvent e)\r
   {\r
 \r
-    if( (viewport.getSelectionGroup()!=null && viewport.getSelectionGroup().getSize()<4 && viewport.getSelectionGroup().getSize()>0)\r
-       || viewport.getAlignment().getHeight()<4)\r
+    if ( (viewport.getSelectionGroup() != null &&\r
+          viewport.getSelectionGroup().getSize() < 4 &&\r
+          viewport.getSelectionGroup().getSize() > 0)\r
+        || viewport.getAlignment().getHeight() < 4)\r
     {\r
       return;\r
     }\r
 \r
-    try{\r
+    try\r
+    {\r
       PCAPanel pcaPanel = new PCAPanel(viewport, null);\r
       Frame frame = new Frame();\r
       frame.add(pcaPanel);\r
-      jalview.bin.JalviewLite.addFrame(frame, "Principal component analysis", 400, 400);\r
-   }catch(java.lang.OutOfMemoryError ex)\r
-   {\r
-   }\r
-\r
+      jalview.bin.JalviewLite.addFrame(frame, "Principal component analysis",\r
+                                       400, 400);\r
+    }\r
+    catch (java.lang.OutOfMemoryError ex)\r
+    {\r
+    }\r
 \r
   }\r
 \r
@@ -946,7 +1023,6 @@ public class AlignFrame extends GAlignFrame
     NewTreePanel("NJ", "PID", "Neighbour joining tree using PID");\r
   }\r
 \r
-\r
   protected void njTreeBlosumMenuItem_actionPerformed(ActionEvent e)\r
   {\r
     NewTreePanel("NJ", "BL", "Neighbour joining tree using BLOSUM62");\r
@@ -960,7 +1036,7 @@ public class AlignFrame extends GAlignFrame
   void NewTreePanel(String type, String pwType, String title)\r
   {\r
     //are the sequences aligned?\r
-    if(!viewport.alignment.isAligned())\r
+    if (!viewport.alignment.isAligned())\r
     {\r
       return;\r
     }\r
@@ -979,9 +1055,9 @@ public class AlignFrame extends GAlignFrame
                          type, pwType, 0, viewport.alignment.getWidth());\r
     }\r
 \r
-   addTreeMenuItem(tp, title);\r
+    addTreeMenuItem(tp, title);\r
 \r
-   jalview.bin.JalviewLite.addFrame(tp, title, 600, 500);\r
+    jalview.bin.JalviewLite.addFrame(tp, title, 600, 500);\r
   }\r
 \r
   void addTreeMenuItem(final TreePanel treePanel, String title)\r
@@ -1008,7 +1084,8 @@ public class AlignFrame extends GAlignFrame
     });\r
   }\r
 \r
-  protected void documentation_actionPerformed(ActionEvent e) {\r
+  protected void documentation_actionPerformed(ActionEvent e)\r
+  {\r
 \r
     jalview.bin.JalviewLite.showURL("http://www.jalview.org");\r
 \r
@@ -1016,33 +1093,38 @@ public class AlignFrame extends GAlignFrame
 \r
   protected void about_actionPerformed(ActionEvent e)\r
   {\r
-    class AboutPanel extends Canvas\r
+    class AboutPanel\r
+        extends Canvas\r
     {\r
       public void paint(Graphics g)\r
       {\r
         g.setColor(Color.white);\r
-        g.fillRect(0,0,getSize().width, getSize().height);\r
+        g.fillRect(0, 0, getSize().width, getSize().height);\r
         g.setFont(new Font("Helvetica", Font.PLAIN, 12));\r
         FontMetrics fm = g.getFontMetrics();\r
         int fh = fm.getHeight();\r
-        int y=5, x=7;\r
+        int y = 5, x = 7;\r
         g.setColor(Color.black);\r
         g.setFont(new Font("Helvetica", Font.BOLD, 14));\r
-        g.drawString("JalView - Release 2.0", 200,y+=fh);\r
+        g.drawString("JalView - Release 2.0", 200, y += fh);\r
         g.setFont(new Font("Helvetica", Font.PLAIN, 12));\r
-        g.drawString("Authors:  Michele Clamp, James Cuff, Steve Searle, Andrew Waterhouse, Jim Procter & Geoff Barton.",x,y+=fh*2);\r
-        g.drawString("Current development managed by Andrew Waterhouse; Barton Group, University of Dundee.",x,y+=fh);\r
-        g.drawString("For any issues relating to Jalview, email help@jalview.org", x,y+=fh);\r
-        g.drawString("If  you use JalView, please cite:",x,y+=fh+8);\r
-        g.drawString("\"Clamp, M., Cuff, J., Searle, S. M. and Barton, G. J. (2004), The Jalview Java Alignment Editor\"",x,y+=fh);\r
-        g.drawString("Bioinformatics,  2004 12;426-7.",x,y+=fh);\r
+        g.drawString("Authors:  Michele Clamp, James Cuff, Steve Searle, Andrew Waterhouse, Jim Procter & Geoff Barton.",\r
+                     x, y += fh * 2);\r
+        g.drawString("Current development managed by Andrew Waterhouse; Barton Group, University of Dundee.",\r
+                     x, y += fh);\r
+        g.drawString(\r
+            "For any issues relating to Jalview, email help@jalview.org", x,\r
+            y += fh);\r
+        g.drawString("If  you use JalView, please cite:", x, y += fh + 8);\r
+        g.drawString("\"Clamp, M., Cuff, J., Searle, S. M. and Barton, G. J. (2004), The Jalview Java Alignment Editor\"",\r
+                     x, y += fh);\r
+        g.drawString("Bioinformatics,  2004 12;426-7.", x, y += fh);\r
       }\r
     }\r
+\r
     Frame frame = new Frame();\r
     frame.add(new AboutPanel());\r
-    jalview.bin.JalviewLite.addFrame(frame, "Jalview", 580,200);\r
-\r
-\r
+    jalview.bin.JalviewLite.addFrame(frame, "Jalview", 580, 200);\r
 \r
   }\r
 }\r
index bdc2359..51478f2 100755 (executable)
@@ -1,30 +1,32 @@
 /*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 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
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 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 jalview.bin.*;\r
+\r
 import jalview.analysis.*;\r
+import jalview.bin.*;\r
 import jalview.datamodel.*;\r
 import jalview.schemes.*;\r
-import java.util.*;\r
 \r
 public class AlignViewport\r
 {\r
@@ -35,10 +37,10 @@ public class AlignViewport
   int endSeq;\r
 \r
   boolean showFullId = true;\r
-  boolean showText=true;\r
-  boolean showColourText=false;\r
-  boolean showBoxes=true;\r
-  boolean wrapAlignment=false;\r
+  boolean showText = true;\r
+  boolean showColourText = false;\r
+  boolean showBoxes = true;\r
+  boolean wrapAlignment = false;\r
   boolean renderGaps = true;\r
   boolean showSequenceFeatures = false;\r
   boolean showAnnotation = true;\r
@@ -53,13 +55,13 @@ public class AlignViewport
 \r
   SequenceGroup selectionGroup = new SequenceGroup();\r
 \r
-  int             charHeight;\r
-  int             charWidth;\r
-  int             chunkWidth;\r
-  int             chunkHeight;\r
+  int charHeight;\r
+  int charWidth;\r
+  int chunkWidth;\r
+  int chunkHeight;\r
 \r
-  Font            font = new Font("SansSerif",Font.PLAIN,10);\r
-  AlignmentI      alignment;\r
+  Font font = new Font("SansSerif", Font.PLAIN, 10);\r
+  AlignmentI alignment;\r
 \r
   ColumnSelection colSel = new ColumnSelection();\r
 \r
@@ -69,60 +71,70 @@ public class AlignViewport
   NJTree currentTree = null;\r
 \r
   boolean scaleAboveWrapped = true;\r
-  boolean scaleLeftWrapped  = true;\r
+  boolean scaleLeftWrapped = true;\r
   boolean scaleRightWrapped = true;\r
 \r
   public AlignViewport(AlignmentI al, JalviewLite applet)\r
   {\r
     setAlignment(al);\r
     this.startRes = 0;\r
-    this.endRes = al.getWidth()-1;\r
+    this.endRes = al.getWidth() - 1;\r
     this.startSeq = 0;\r
-    this.endSeq = al.getHeight()-1;\r
+    this.endSeq = al.getHeight() - 1;\r
     setFont(font);\r
 \r
-\r
-    if(applet!=null)\r
+    if (applet != null)\r
     {\r
       String param = applet.getParameter("showFullId");\r
       if (param != null)\r
+      {\r
         showFullId = Boolean.valueOf(param).booleanValue();\r
+      }\r
 \r
       param = applet.getParameter("showAnnotation");\r
       if (param != null)\r
+      {\r
         showAnnotation = Boolean.valueOf(param).booleanValue();\r
+      }\r
 \r
       param = applet.getParameter("showConservation");\r
       if (param != null)\r
+      {\r
         showConservation = Boolean.valueOf(param).booleanValue();\r
+      }\r
 \r
       param = applet.getParameter("showQuality");\r
       if (param != null)\r
+      {\r
         showQuality = Boolean.valueOf(param).booleanValue();\r
+      }\r
 \r
       param = applet.getParameter("showConsensus");\r
       if (param != null)\r
+      {\r
         showConsensus = Boolean.valueOf(param).booleanValue();\r
+      }\r
     }\r
     // We must set conservation and consensus before setting colour,\r
     // as Blosum and Clustal require this to be done\r
     updateConservation();\r
     updateConsensus();\r
 \r
-    if(applet!=null && applet.getParameter("defaultColour")!=null)\r
+    if (applet != null && applet.getParameter("defaultColour") != null)\r
     {\r
       globalColourScheme = ColourSchemeProperty.getColour(alignment,\r
           applet.getParameter("defaultColour"));\r
-      if(globalColourScheme!=null)\r
-        globalColourScheme.setConsensus( vconsensus );\r
-   }\r
- }\r
-\r
+      if (globalColourScheme != null)\r
+      {\r
+        globalColourScheme.setConsensus(vconsensus);\r
+      }\r
+    }\r
+  }\r
 \r
- public void showSequenceFeatures(boolean b)\r
- {\r
-   showSequenceFeatures = b;\r
- }\r
+  public void showSequenceFeatures(boolean b)\r
+  {\r
+    showSequenceFeatures = b;\r
+  }\r
 \r
   public Vector vconsensus;\r
   AlignmentAnnotation consensus;\r
@@ -136,19 +148,21 @@ public class AlignViewport
     Conservation cons = new jalview.analysis.Conservation("All",\r
         jalview.schemes.ResidueProperties.propHash, 3,\r
         alignment.getSequences(), 0,\r
-        alignment.getWidth()-1);\r
+        alignment.getWidth() - 1);\r
     cons.calculate();\r
     cons.verdict(false, ConsPercGaps);\r
     cons.findQuality();\r
     int alWidth = alignment.getWidth();\r
-    Annotation [] annotations = new Annotation[alWidth];\r
-    Annotation [] qannotations = new Annotation[alWidth];\r
+    Annotation[] annotations = new Annotation[alWidth];\r
+    Annotation[] qannotations = new Annotation[alWidth];\r
     String sequence = cons.getConsSequence().getSequence();\r
-    float minR,minG,minB, maxR,maxG,maxB;\r
+    float minR, minG, minB, maxR, maxG, maxB;\r
     minR = 0.3f;\r
     minG = 0.0f;\r
     minB = 0f;\r
-    maxR = 1.0f-minR; maxG=0.9f-minG; maxB=0f-minB; // scalable range for colouring both Conservation and Quality\r
+    maxR = 1.0f - minR;\r
+    maxG = 0.9f - minG;\r
+    maxB = 0f - minB; // scalable range for colouring both Conservation and Quality\r
     float min = 0f;\r
     float max = 11f;\r
     float qmin = cons.qualityRange[0].floatValue();\r
@@ -158,108 +172,131 @@ public class AlignViewport
     {\r
       float value = 0;\r
       try\r
+      {\r
+        value = Integer.parseInt(sequence.charAt(i) + "");\r
+      }\r
+      catch (Exception ex)\r
+      {\r
+        if (sequence.charAt(i) == '*')\r
         {\r
-          value = Integer.parseInt(sequence.charAt(i) + "");\r
+          value = 11;\r
         }\r
-      catch (Exception ex)\r
+        if (sequence.charAt(i) == '+')\r
         {\r
-          if (sequence.charAt(i) == '*') value = 11;\r
-          if (sequence.charAt(i) == '+') value = 10;\r
+          value = 10;\r
         }\r
-      float vprop = value-min;\r
-      vprop/=max;\r
+      }\r
+      float vprop = value - min;\r
+      vprop /= max;\r
 \r
       annotations[i] = new Annotation(sequence.charAt(i) + "",\r
-                                      "", ' ', value, new Color(minR+maxR*vprop, minG+maxG*vprop, minB+maxB*vprop));\r
+                                      "", ' ', value,\r
+                                      new Color(minR + maxR * vprop,\r
+                                                minG + maxG * vprop,\r
+                                                minB + maxB * vprop));\r
       // Quality calc\r
-      value = ((Double) cons.quality.elementAt(i)).floatValue();\r
+      value = ( (Double) cons.quality.elementAt(i)).floatValue();\r
       vprop = value - qmin;\r
-      vprop/=qmax;\r
+      vprop /= qmax;\r
       qannotations[i] = new Annotation(" ",\r
-                                      String.valueOf(value), ' ', value, new Color(minR+maxR*vprop, minG+maxG*vprop, minB+maxB*vprop));\r
+                                       String.valueOf(value), ' ', value,\r
+                                       new\r
+                                       Color(minR + maxR * vprop,\r
+                                             minG + maxG * vprop,\r
+                                             minB + maxB * vprop));\r
     }\r
 \r
-    if(conservation==null)\r
+    if (conservation == null)\r
     {\r
       conservation = new AlignmentAnnotation("Conservation",\r
-                                             "Conservation of total alignment less than "+ConsPercGaps+"% gaps",\r
+                                             "Conservation of total alignment less than " +\r
+                                             ConsPercGaps + "% gaps",\r
                                              annotations,\r
                                              0f, // cons.qualityRange[0].floatValue(),\r
                                              11f, // cons.qualityRange[1].floatValue()\r
                                              1);\r
-      if(showConservation)\r
-      alignment.addAnnotation(conservation);\r
+      if (showConservation)\r
+      {\r
+        alignment.addAnnotation(conservation);\r
+      }\r
       quality = new AlignmentAnnotation("Quality",\r
                                         "Alignment Quality based on Blosum62 scores",\r
                                         qannotations,\r
                                         cons.qualityRange[0].floatValue(),\r
                                         cons.qualityRange[1].floatValue(),\r
                                         1);\r
-      if(showQuality)\r
+      if (showQuality)\r
+      {\r
         alignment.addAnnotation(quality);\r
+      }\r
     }\r
-    else {\r
+    else\r
+    {\r
       conservation.annotations = annotations;\r
       quality.annotations = qannotations;\r
       quality.graphMax = cons.qualityRange[1].floatValue();\r
     }\r
 \r
-\r
   }\r
 \r
   public void updateConsensus()\r
   {\r
-    Annotation [] annotations = new Annotation[alignment.getWidth()];\r
+    Annotation[] annotations = new Annotation[alignment.getWidth()];\r
 \r
     // this routine prevents vconsensus becoming a new object each time\r
     // consenus is calculated. Important for speed of Blosum62\r
     // and PID colouring of alignment\r
-    if(vconsensus == null)\r
-        vconsensus = alignment.getAAFrequency();\r
+    if (vconsensus == null)\r
+    {\r
+      vconsensus = alignment.getAAFrequency();\r
+    }\r
     else\r
     {\r
-        Vector temp = alignment.getAAFrequency();\r
-        vconsensus.removeAllElements();\r
-        Enumeration e = temp.elements();\r
-        while(e.hasMoreElements())\r
-        {\r
-          vconsensus.addElement(e.nextElement());\r
-        }\r
+      Vector temp = alignment.getAAFrequency();\r
+      vconsensus.removeAllElements();\r
+      Enumeration e = temp.elements();\r
+      while (e.hasMoreElements())\r
+      {\r
+        vconsensus.addElement(e.nextElement());\r
+      }\r
     }\r
     Hashtable hash = null;\r
-    for (int i = 0; i<alignment.getWidth(); i++)\r
+    for (int i = 0; i < alignment.getWidth(); i++)\r
     {\r
-        hash = (Hashtable) vconsensus.elementAt(i);\r
-        float value = new Float(hash.get("maxCount").toString()).floatValue();\r
-        value /= new Float(hash.get("size").toString()).floatValue();\r
-\r
-        value *= 100;\r
-        String maxRes = hash.get("maxResidue")+" ";\r
-        String mouseOver = hash.get("maxResidue")+" ";\r
-        if(maxRes.length()>2)\r
-        {\r
-          mouseOver = "["+maxRes+"] ";\r
-          maxRes = "+ ";\r
-        }\r
+      hash = (Hashtable) vconsensus.elementAt(i);\r
+      float value = new Float(hash.get("maxCount").toString()).floatValue();\r
+      value /= new Float(hash.get("size").toString()).floatValue();\r
+\r
+      value *= 100;\r
+      String maxRes = hash.get("maxResidue") + " ";\r
+      String mouseOver = hash.get("maxResidue") + " ";\r
+      if (maxRes.length() > 2)\r
+      {\r
+        mouseOver = "[" + maxRes + "] ";\r
+        maxRes = "+ ";\r
+      }\r
 \r
-        mouseOver += (int)value+"%";\r
-        annotations[i] = new Annotation(maxRes, mouseOver, ' ', value);\r
+      mouseOver += (int) value + "%";\r
+      annotations[i] = new Annotation(maxRes, mouseOver, ' ', value);\r
 \r
     }\r
 \r
-     if(consensus==null)\r
-     {\r
-       consensus = new AlignmentAnnotation("Consensus",\r
-                                           "PID", annotations, 0f, 100f, 1);\r
-       if(showConsensus)\r
-         alignment.addAnnotation(consensus);\r
-     }\r
-     else\r
-       consensus.annotations = annotations;\r
+    if (consensus == null)\r
+    {\r
+      consensus = new AlignmentAnnotation("Consensus",\r
+                                          "PID", annotations, 0f, 100f, 1);\r
+      if (showConsensus)\r
+      {\r
+        alignment.addAnnotation(consensus);\r
+      }\r
+    }\r
+    else\r
+    {\r
+      consensus.annotations = annotations;\r
+    }\r
 \r
   }\r
 \r
-\r
   public SequenceGroup getSelectionGroup()\r
   {\r
     return selectionGroup;\r
@@ -270,42 +307,44 @@ public class AlignViewport
     selectionGroup = sg;\r
   }\r
 \r
+  public boolean getConservationSelected()\r
+  {\r
+    return conservationColourSelected;\r
+  }\r
 \r
- public boolean getConservationSelected()\r
- {\r
-   return conservationColourSelected;\r
- }\r
-\r
- public void setConservationSelected(boolean b)\r
- {\r
-   conservationColourSelected = b;\r
- }\r
+  public void setConservationSelected(boolean b)\r
+  {\r
+    conservationColourSelected = b;\r
+  }\r
 \r
- public boolean getAbovePIDThreshold()\r
- {\r
-   return abovePIDThreshold;\r
- }\r
+  public boolean getAbovePIDThreshold()\r
+  {\r
+    return abovePIDThreshold;\r
+  }\r
 \r
- public void setAbovePIDThreshold(boolean b)\r
- {\r
-   abovePIDThreshold = b;\r
- }\r
+  public void setAbovePIDThreshold(boolean b)\r
+  {\r
+    abovePIDThreshold = b;\r
+  }\r
 \r
-  public int getStartRes() {\r
+  public int getStartRes()\r
+  {\r
     return startRes;\r
   }\r
 \r
-  public int getEndRes() {\r
+  public int getEndRes()\r
+  {\r
     return endRes;\r
   }\r
 \r
-  public int getStartSeq() {\r
+  public int getStartSeq()\r
+  {\r
     return startSeq;\r
   }\r
 \r
   public void setGlobalColourScheme(ColourSchemeI cs)\r
   {\r
-     globalColourScheme = cs;\r
+    globalColourScheme = cs;\r
   }\r
 \r
   public ColourSchemeI getGlobalColourScheme()\r
@@ -313,37 +352,50 @@ public class AlignViewport
     return globalColourScheme;\r
   }\r
 \r
-\r
-  public void setStartRes(int res) {\r
+  public void setStartRes(int res)\r
+  {\r
     this.startRes = res;\r
   }\r
-  public void setStartSeq(int seq) {\r
+\r
+  public void setStartSeq(int seq)\r
+  {\r
     this.startSeq = seq;\r
   }\r
-  public void setEndRes(int res) {\r
-    if (res > alignment.getWidth()-1) {\r
+\r
+  public void setEndRes(int res)\r
+  {\r
+    if (res > alignment.getWidth() - 1)\r
+    {\r
       // log.System.out.println(" Corrected res from " + res + " to maximum " + (alignment.getWidth()-1));\r
-       res = alignment.getWidth()-1;\r
+      res = alignment.getWidth() - 1;\r
     }\r
-    if (res < 0) {\r
+    if (res < 0)\r
+    {\r
       res = 0;\r
     }\r
     this.endRes = res;\r
   }\r
-  public void setEndSeq(int seq) {\r
-    if (seq > alignment.getHeight()) {\r
+\r
+  public void setEndSeq(int seq)\r
+  {\r
+    if (seq > alignment.getHeight())\r
+    {\r
       seq = alignment.getHeight();\r
     }\r
-    if (seq < 0) {\r
+    if (seq < 0)\r
+    {\r
       seq = 0;\r
     }\r
     this.endSeq = seq;\r
   }\r
-  public int getEndSeq() {\r
+\r
+  public int getEndSeq()\r
+  {\r
     return endSeq;\r
   }\r
 \r
-  public void setFont(Font f) {\r
+  public void setFont(Font f)\r
+  {\r
     font = f;\r
     java.awt.Frame temp = new java.awt.Frame();\r
     temp.addNotify();\r
@@ -352,52 +404,76 @@ public class AlignViewport
     setCharWidth(fm.charWidth('M'));\r
   }\r
 \r
-  public Font getFont() {\r
+  public Font getFont()\r
+  {\r
     return font;\r
   }\r
-  public void setCharWidth(int w) {\r
+\r
+  public void setCharWidth(int w)\r
+  {\r
     this.charWidth = w;\r
   }\r
-  public int getCharWidth() {\r
+\r
+  public int getCharWidth()\r
+  {\r
     return charWidth;\r
   }\r
-  public void setCharHeight(int h) {\r
+\r
+  public void setCharHeight(int h)\r
+  {\r
     this.charHeight = h;\r
   }\r
-  public int getCharHeight() {\r
+\r
+  public int getCharHeight()\r
+  {\r
     return charHeight;\r
   }\r
-  public void setChunkWidth(int w) {\r
+\r
+  public void setChunkWidth(int w)\r
+  {\r
     this.chunkWidth = w;\r
   }\r
-  public int getChunkWidth() {\r
+\r
+  public int getChunkWidth()\r
+  {\r
     return chunkWidth;\r
   }\r
-  public void setChunkHeight(int h) {\r
+\r
+  public void setChunkHeight(int h)\r
+  {\r
     this.chunkHeight = h;\r
   }\r
-  public int getChunkHeight() {\r
+\r
+  public int getChunkHeight()\r
+  {\r
     return chunkHeight;\r
   }\r
-  public AlignmentI getAlignment() {\r
+\r
+  public AlignmentI getAlignment()\r
+  {\r
     return alignment;\r
   }\r
-  public void setAlignment(AlignmentI align) {\r
+\r
+  public void setAlignment(AlignmentI align)\r
+  {\r
     this.alignment = align;\r
   }\r
 \r
-  public void setWrapAlignment(boolean state) {\r
+  public void setWrapAlignment(boolean state)\r
+  {\r
     wrapAlignment = state;\r
   }\r
-  public void setShowText(boolean state) {\r
+\r
+  public void setShowText(boolean state)\r
+  {\r
     showText = state;\r
   }\r
 \r
-  public void setRenderGaps(boolean state){\r
+  public void setRenderGaps(boolean state)\r
+  {\r
     renderGaps = state;\r
   }\r
 \r
-\r
   public boolean getColourText()\r
   {\r
     return showColourText;\r
@@ -408,80 +484,114 @@ public class AlignViewport
     showColourText = state;\r
   }\r
 \r
-  public void setShowBoxes(boolean state) {\r
+  public void setShowBoxes(boolean state)\r
+  {\r
     showBoxes = state;\r
   }\r
 \r
-  public boolean getWrapAlignment() {\r
-      return wrapAlignment;\r
+  public boolean getWrapAlignment()\r
+  {\r
+    return wrapAlignment;\r
   }\r
-  public boolean getShowText() {\r
+\r
+  public boolean getShowText()\r
+  {\r
     return showText;\r
   }\r
-  public boolean getShowBoxes() {\r
+\r
+  public boolean getShowBoxes()\r
+  {\r
     return showBoxes;\r
   }\r
 \r
-  public char getGapCharacter() {\r
+  public char getGapCharacter()\r
+  {\r
     return getAlignment().getGapCharacter();\r
   }\r
-  public void setGapCharacter(char gap) {\r
-    if (getAlignment() != null) {\r
+\r
+  public void setGapCharacter(char gap)\r
+  {\r
+    if (getAlignment() != null)\r
+    {\r
       getAlignment().setGapCharacter(gap);\r
     }\r
   }\r
-  public void setThreshold(int thresh) {\r
+\r
+  public void setThreshold(int thresh)\r
+  {\r
     threshold = thresh;\r
   }\r
-  public int getThreshold() {\r
+\r
+  public int getThreshold()\r
+  {\r
     return threshold;\r
   }\r
-  public void setIncrement(int inc) {\r
+\r
+  public void setIncrement(int inc)\r
+  {\r
     increment = inc;\r
   }\r
-  public int getIncrement() {\r
+\r
+  public int getIncrement()\r
+  {\r
     return increment;\r
   }\r
-  public int getIndex(int y) {\r
-    int y1     = 0;\r
+\r
+  public int getIndex(int y)\r
+  {\r
+    int y1 = 0;\r
     int starty = getStartSeq();\r
-    int endy   = getEndSeq();\r
+    int endy = getEndSeq();\r
 \r
-    for (int i = starty; i <= endy; i++) {\r
-      if (i < alignment.getHeight() && alignment.getSequenceAt(i) != null) {\r
+    for (int i = starty; i <= endy; i++)\r
+    {\r
+      if (i < alignment.getHeight() && alignment.getSequenceAt(i) != null)\r
+      {\r
         int y2 = y1 + getCharHeight();\r
 \r
-        if (y>=y1 && y <=y2) {\r
+        if (y >= y1 && y <= y2)\r
+        {\r
           return i;\r
         }\r
-        y1  = y2;\r
-      } else {\r
+        y1 = y2;\r
+      }\r
+      else\r
+      {\r
         return -1;\r
       }\r
     }\r
     return -1;\r
   }\r
 \r
-  public ColumnSelection getColumnSelection() {\r
+  public ColumnSelection getColumnSelection()\r
+  {\r
     return colSel;\r
   }\r
 \r
-  public void resetSeqLimits(int height) {\r
-    setEndSeq(height/getCharHeight());\r
+  public void resetSeqLimits(int height)\r
+  {\r
+    setEndSeq(height / getCharHeight());\r
   }\r
-  public void setCurrentTree(NJTree tree) {\r
-      currentTree = tree;\r
+\r
+  public void setCurrentTree(NJTree tree)\r
+  {\r
+    currentTree = tree;\r
   }\r
-  public NJTree getCurrentTree() {\r
+\r
+  public NJTree getCurrentTree()\r
+  {\r
     return currentTree;\r
   }\r
 \r
-\r
   public void setColourAppliesToAllGroups(boolean b)\r
-  {   colourAppliesToAllGroups = b; }\r
+  {\r
+    colourAppliesToAllGroups = b;\r
+  }\r
 \r
   public boolean getColourAppliesToAllGroups()\r
-  {return colourAppliesToAllGroups; }\r
+  {\r
+    return colourAppliesToAllGroups;\r
+  }\r
 \r
   public boolean getShowFullId()\r
   {\r
@@ -504,22 +614,33 @@ public class AlignViewport
   }\r
 \r
   public boolean getScaleAboveWrapped()\r
-  { return scaleAboveWrapped;}\r
+  {\r
+    return scaleAboveWrapped;\r
+  }\r
 \r
   public boolean getScaleLeftWrapped()\r
-  { return scaleLeftWrapped; }\r
+  {\r
+    return scaleLeftWrapped;\r
+  }\r
 \r
   public boolean getScaleRightWrapped()\r
-  { return scaleRightWrapped; }\r
+  {\r
+    return scaleRightWrapped;\r
+  }\r
 \r
   public void setScaleAboveWrapped(boolean b)\r
-  { scaleAboveWrapped = b; }\r
+  {\r
+    scaleAboveWrapped = b;\r
+  }\r
 \r
   public void setScaleLeftWrapped(boolean b)\r
-  { scaleLeftWrapped = b; }\r
+  {\r
+    scaleLeftWrapped = b;\r
+  }\r
 \r
   public void setScaleRightWrapped(boolean b)\r
-  { scaleRightWrapped = b; }\r
-\r
+  {\r
+    scaleRightWrapped = b;\r
+  }\r
 \r
 }\r
index 9c77e13..754d698 100755 (executable)
@@ -1,38 +1,40 @@
 /*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 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
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 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 jalview.jbappletgui.GAlignmentPanel;\r
-import jalview.schemes.*;\r
-import jalview.analysis.*;\r
-import jalview.datamodel.*;\r
 import java.awt.*;\r
 import java.awt.event.*;\r
 \r
-public class AlignmentPanel extends GAlignmentPanel implements AdjustmentListener\r
+import jalview.analysis.*;\r
+import jalview.datamodel.*;\r
+import jalview.jbappletgui.*;\r
+import jalview.schemes.*;\r
+\r
+public class AlignmentPanel\r
+    extends GAlignmentPanel implements AdjustmentListener\r
 {\r
 \r
-  AlignViewport     av;\r
+  AlignViewport av;\r
   OverviewPanel overviewPanel;\r
-  SeqPanel   seqPanel;\r
-  IdPanel    idPanel;\r
+  SeqPanel seqPanel;\r
+  IdPanel idPanel;\r
   IdwidthAdjuster idwidthAdjuster;\r
   public AlignFrame alignFrame;\r
   ScalePanel scalePanel;\r
@@ -45,14 +47,13 @@ public class AlignmentPanel extends GAlignmentPanel implements AdjustmentListene
   public AlignmentPanel(AlignFrame af, final AlignViewport av)\r
   {\r
     alignFrame = af;\r
-    this.av         = av;\r
-    seqPanel        = new SeqPanel  (av, this);\r
-    idPanel         = new IdPanel   (av, this);\r
-    scalePanel      = new ScalePanel(av, this);\r
+    this.av = av;\r
+    seqPanel = new SeqPanel(av, this);\r
+    idPanel = new IdPanel(av, this);\r
+    scalePanel = new ScalePanel(av, this);\r
     idwidthAdjuster = new IdwidthAdjuster(this);\r
     annotationPanel = new AnnotationPanel(this);\r
-    alabels         = new AnnotationLabels(this);\r
-\r
+    alabels = new AnnotationLabels(this);\r
 \r
     idPanelHolder.add(idPanel, BorderLayout.CENTER);\r
     idSpaceFillerPanel1.add(idwidthAdjuster, BorderLayout.CENTER);\r
@@ -67,57 +68,67 @@ public class AlignmentPanel extends GAlignmentPanel implements AdjustmentListene
     hscroll.addAdjustmentListener(this);\r
     vscroll.addAdjustmentListener(this);\r
 \r
-   seqPanel.seqCanvas.addKeyListener( new MyKeyAdapter() );\r
-   idPanel.idCanvas.addKeyListener( new MyKeyAdapter() );\r
+    seqPanel.seqCanvas.addKeyListener(new MyKeyAdapter());\r
+    idPanel.idCanvas.addKeyListener(new MyKeyAdapter());\r
 \r
-   addComponentListener(new ComponentAdapter()\r
-     {\r
-       public void componentResized(ComponentEvent evt)\r
-       {\r
-         setScrollValues(av.getStartRes(), av.getStartSeq());\r
-         repaint();\r
-       }\r
-     });\r
+    addComponentListener(new ComponentAdapter()\r
+    {\r
+      public void componentResized(ComponentEvent evt)\r
+      {\r
+        setScrollValues(av.getStartRes(), av.getStartSeq());\r
+        repaint();\r
+      }\r
+    });\r
 \r
-     Dimension d = calculateIdWidth();\r
-     idPanel.idCanvas.setSize(d);\r
+    Dimension d = calculateIdWidth();\r
+    idPanel.idCanvas.setSize(d);\r
 \r
-     hscrollFillerPanel.setSize(d.width, annotationPanel.getSize().height);\r
-     annotationScroller.setSize(annotationPanel.getSize());\r
+    hscrollFillerPanel.setSize(d.width, annotationPanel.getSize().height);\r
+    annotationScroller.setSize(annotationPanel.getSize());\r
 \r
-     idPanel.idCanvas.setSize(d.width, seqPanel.seqCanvas.getSize().height);\r
-     annotationSpaceFillerHolder.setSize(d.width,annotationPanel.getSize().height);\r
-     alabels.setSize(d.width,annotationPanel.getSize().height);\r
+    idPanel.idCanvas.setSize(d.width, seqPanel.seqCanvas.getSize().height);\r
+    annotationSpaceFillerHolder.setSize(d.width,\r
+                                        annotationPanel.getSize().height);\r
+    alabels.setSize(d.width, annotationPanel.getSize().height);\r
 \r
   }\r
 \r
-  class MyKeyAdapter extends KeyAdapter\r
+  class MyKeyAdapter\r
+      extends KeyAdapter\r
   {\r
-     public void keyPressed(KeyEvent evt)\r
-     {\r
-       // System.out.println(evt.getKeyCode()); log.\r
-       switch(evt.getKeyCode())\r
-       {\r
-         case  27: // escape key\r
-           av.setSelectionGroup(null);\r
-           alignFrame.alignPanel.repaint();\r
-           break;\r
-         case KeyEvent.VK_X:\r
-           if(evt.isControlDown())\r
-           alignFrame.cut_actionPerformed(null);\r
-           break;\r
-         case KeyEvent.VK_C:\r
-         if(evt.isControlDown())\r
-           alignFrame.copy_actionPerformed(null);\r
-           break;\r
-         case KeyEvent.VK_V:\r
-          if(evt.isControlDown())\r
-           alignFrame.paste(true);\r
-           break;\r
-         case KeyEvent.VK_A:\r
-         if(evt.isControlDown())\r
-           alignFrame.selectAllSequenceMenuItem_actionPerformed(null);\r
-           break;\r
+    public void keyPressed(KeyEvent evt)\r
+    {\r
+      // System.out.println(evt.getKeyCode()); log.\r
+      switch (evt.getKeyCode())\r
+      {\r
+        case 27: // escape key\r
+          av.setSelectionGroup(null);\r
+          alignFrame.alignPanel.repaint();\r
+          break;\r
+        case KeyEvent.VK_X:\r
+          if (evt.isControlDown())\r
+          {\r
+            alignFrame.cut_actionPerformed(null);\r
+          }\r
+          break;\r
+        case KeyEvent.VK_C:\r
+          if (evt.isControlDown())\r
+          {\r
+            alignFrame.copy_actionPerformed(null);\r
+          }\r
+          break;\r
+        case KeyEvent.VK_V:\r
+          if (evt.isControlDown())\r
+          {\r
+            alignFrame.paste(true);\r
+          }\r
+          break;\r
+        case KeyEvent.VK_A:\r
+          if (evt.isControlDown())\r
+          {\r
+            alignFrame.selectAllSequenceMenuItem_actionPerformed(null);\r
+          }\r
+          break;\r
         case KeyEvent.VK_DOWN:\r
           alignFrame.moveSelectedSequences(false);\r
           break;\r
@@ -125,11 +136,13 @@ public class AlignmentPanel extends GAlignmentPanel implements AdjustmentListene
           alignFrame.moveSelectedSequences(true);\r
           break;\r
         case KeyEvent.VK_F:\r
-         if(evt.isControlDown())\r
-          alignFrame.findMenuItem_actionPerformed(null);\r
+          if (evt.isControlDown())\r
+          {\r
+            alignFrame.findMenuItem_actionPerformed(null);\r
+          }\r
           break;\r
-       }\r
-     }\r
+      }\r
+    }\r
   }\r
 \r
   public void fontChanged()\r
@@ -138,8 +151,8 @@ public class AlignmentPanel extends GAlignmentPanel implements AdjustmentListene
     // to prevent drawing old image\r
     FontMetrics fm = getFontMetrics(av.getFont());\r
 \r
-    scalePanel.setSize(new Dimension(10, av.charHeight+fm.getDescent()));\r
-    idwidthAdjuster.setSize(new Dimension(10, av.charHeight+fm.getDescent()));\r
+    scalePanel.setSize(new Dimension(10, av.charHeight + fm.getDescent()));\r
+    idwidthAdjuster.setSize(new Dimension(10, av.charHeight + fm.getDescent()));\r
 \r
     annotationPanel.adjustPanelHeight();\r
     annotationPanel.repaint();\r
@@ -153,17 +166,18 @@ public class AlignmentPanel extends GAlignmentPanel implements AdjustmentListene
 \r
   public void setIdWidth(int w, int h)\r
   {\r
-    idPanel.idCanvas.setSize(w,h);\r
-    idPanelHolder.setSize(w,idPanelHolder.getSize().height);\r
-    alabels.setSize(w,alabels.getSize().height);\r
+    idPanel.idCanvas.setSize(w, h);\r
+    idPanelHolder.setSize(w, idPanelHolder.getSize().height);\r
+    alabels.setSize(w, alabels.getSize().height);\r
     validate();\r
   }\r
+\r
   Dimension calculateIdWidth()\r
   {\r
     Frame frame = new Frame();\r
     frame.addNotify();\r
     Graphics g = frame.getGraphics();\r
-    if(g==null)\r
+    if (g == null)\r
     {\r
       Frame f = new Frame();\r
       f.addNotify();\r
@@ -173,70 +187,77 @@ public class AlignmentPanel extends GAlignmentPanel implements AdjustmentListene
     FontMetrics fm = g.getFontMetrics(av.font);\r
     AlignmentI al = av.getAlignment();\r
 \r
-       int i   = 0;\r
-       int idWidth = 0;\r
-       String id;\r
-       while (i < al.getHeight() && al.getSequenceAt(i) != null)\r
-       {\r
-         SequenceI s   = al.getSequenceAt(i);\r
-         if(av.getShowFullId())\r
-           id   = s.getDisplayId();\r
-         else\r
-           id = s.getName();\r
-\r
-         if (fm.stringWidth(id) > idWidth)\r
-           idWidth = fm.stringWidth(id);\r
-         i++;\r
-       }\r
-\r
-       // Also check annotation label widths\r
-       i=0;\r
-       if(al.getAlignmentAnnotation()!=null)\r
-       {\r
-         fm = g.getFontMetrics(frame.getFont());\r
-         while (i < al.getAlignmentAnnotation().length)\r
-         {\r
-           String label = al.getAlignmentAnnotation()[i].label;\r
-           if (fm.stringWidth(label) > idWidth)\r
-             idWidth = fm.stringWidth(label);\r
-           i++;\r
-         }\r
-       }\r
-\r
-       return new Dimension(idWidth, idPanel.idCanvas.getSize().height);\r
-  }\r
+    int i = 0;\r
+    int idWidth = 0;\r
+    String id;\r
+    while (i < al.getHeight() && al.getSequenceAt(i) != null)\r
+    {\r
+      SequenceI s = al.getSequenceAt(i);\r
+      if (av.getShowFullId())\r
+      {\r
+        id = s.getDisplayId();\r
+      }\r
+      else\r
+      {\r
+        id = s.getName();\r
+      }\r
 \r
+      if (fm.stringWidth(id) > idWidth)\r
+      {\r
+        idWidth = fm.stringWidth(id);\r
+      }\r
+      i++;\r
+    }\r
 \r
- public void highlightSearchResults(int [] results)\r
- {\r
-   seqPanel.seqCanvas.highlightSearchResults( results );\r
+    // Also check annotation label widths\r
+    i = 0;\r
+    if (al.getAlignmentAnnotation() != null)\r
+    {\r
+      fm = g.getFontMetrics(frame.getFont());\r
+      while (i < al.getAlignmentAnnotation().length)\r
+      {\r
+        String label = al.getAlignmentAnnotation()[i].label;\r
+        if (fm.stringWidth(label) > idWidth)\r
+        {\r
+          idWidth = fm.stringWidth(label);\r
+        }\r
+        i++;\r
+      }\r
+    }\r
+\r
+    return new Dimension(idWidth, idPanel.idCanvas.getSize().height);\r
+  }\r
+\r
+  public void highlightSearchResults(int[] results)\r
+  {\r
+    seqPanel.seqCanvas.highlightSearchResults(results);\r
 \r
-   // do we need to scroll the panel?\r
-   if(results!=null)\r
+    // do we need to scroll the panel?\r
+    if (results != null)\r
     {\r
       SequenceI seq = av.alignment.getSequenceAt(results[0]);\r
-      int start = seq.findIndex( results[1] )-1;\r
-      int end = seq.findIndex( results[2] )-1;\r
-      if( av.getStartRes() > start\r
+      int start = seq.findIndex(results[1]) - 1;\r
+      int end = seq.findIndex(results[2]) - 1;\r
+      if (av.getStartRes() > start\r
           || av.getEndRes() < end\r
           || (av.getStartSeq() > results[0]\r
-          || av.getEndSeq() < results[0]))\r
+              || av.getEndSeq() < results[0]))\r
+      {\r
         setScrollValues(start, results[0]);\r
+      }\r
     }\r
 \r
- }\r
-\r
-\r
- public OverviewPanel getOverviewPanel()\r
- {\r
-   return overviewPanel;\r
- }\r
+  }\r
 \r
- public void setOverviewPanel(OverviewPanel op)\r
- {\r
-   overviewPanel = op;\r
- }\r
+  public OverviewPanel getOverviewPanel()\r
+  {\r
+    return overviewPanel;\r
+  }\r
 \r
+  public void setOverviewPanel(OverviewPanel op)\r
+  {\r
+    overviewPanel = op;\r
+  }\r
 \r
   public void setAnnotationVisible(boolean b)\r
   {\r
@@ -246,7 +267,6 @@ public class AlignmentPanel extends GAlignmentPanel implements AdjustmentListene
     repaint();\r
   }\r
 \r
-\r
   public void setWrapAlignment(boolean wrap)\r
   {\r
     scalePanelHolder.setVisible(!wrap);\r
@@ -263,49 +283,52 @@ public class AlignmentPanel extends GAlignmentPanel implements AdjustmentListene
 \r
   }\r
 \r
-\r
   public void setColourScheme()\r
   {\r
     ColourSchemeI cs = av.getGlobalColourScheme();\r
 \r
-    if(av.getConservationSelected())\r
+    if (av.getConservationSelected())\r
     {\r
 \r
-       Alignment al = (Alignment)av.getAlignment();\r
-       Conservation c = new Conservation("All",\r
-                            ResidueProperties.propHash, 3, al.getSequences(), 0,\r
-                            al.getWidth() );\r
+      Alignment al = (Alignment) av.getAlignment();\r
+      Conservation c = new Conservation("All",\r
+                                        ResidueProperties.propHash, 3,\r
+                                        al.getSequences(), 0,\r
+                                        al.getWidth());\r
 \r
-       c.calculate();\r
-       c.verdict(false, av.ConsPercGaps);\r
-       ConservationColourScheme ccs = new ConservationColourScheme(c, cs);\r
+      c.calculate();\r
+      c.verdict(false, av.ConsPercGaps);\r
+      ConservationColourScheme ccs = new ConservationColourScheme(c, cs);\r
 \r
-       av.setGlobalColourScheme( ccs );\r
+      av.setGlobalColourScheme(ccs);\r
 \r
     }\r
 \r
     repaint();\r
   }\r
 \r
-\r
   int hextent = 0;\r
   int vextent = 0;\r
 \r
   // return value is true if the scroll is valid\r
   public boolean scrollUp(boolean up)\r
   {\r
-    if(up)\r
+    if (up)\r
     {\r
-      if(vscroll.getValue()<1)\r
+      if (vscroll.getValue() < 1)\r
+      {\r
         return false;\r
-      fastPaint  = false;\r
+      }\r
+      fastPaint = false;\r
       vscroll.setValue(vscroll.getValue() - 1);\r
     }\r
     else\r
     {\r
-     if(vextent+vscroll.getValue() >= av.getAlignment().getHeight())\r
-       return false;\r
-      fastPaint  = false;\r
+      if (vextent + vscroll.getValue() >= av.getAlignment().getHeight())\r
+      {\r
+        return false;\r
+      }\r
+      fastPaint = false;\r
       vscroll.setValue(vscroll.getValue() + 1);\r
     }\r
     fastPaint = true;\r
@@ -318,14 +341,18 @@ public class AlignmentPanel extends GAlignmentPanel implements AdjustmentListene
     if (right)\r
     {\r
       if (hscroll.getValue() < 1)\r
+      {\r
         return false;\r
+      }\r
       fastPaint = false;\r
       hscroll.setValue(hscroll.getValue() - 1);\r
     }\r
     else\r
     {\r
       if (hextent + hscroll.getValue() >= av.getAlignment().getWidth())\r
+      {\r
         return false;\r
+      }\r
       fastPaint = false;\r
       hscroll.setValue(hscroll.getValue() + 1);\r
     }\r
@@ -333,47 +360,57 @@ public class AlignmentPanel extends GAlignmentPanel implements AdjustmentListene
     return true;\r
   }\r
 \r
-\r
   public void setScrollValues(int x, int y)\r
   {\r
 \r
     av.setStartRes(x);\r
     av.setStartSeq(y);\r
-    av.setEndRes(x + seqPanel.seqCanvas.getSize().width/av.getCharWidth()-1);\r
+    av.setEndRes(x + seqPanel.seqCanvas.getSize().width / av.getCharWidth() - 1);\r
 \r
-    hextent = seqPanel.seqCanvas.getSize().width/av.charWidth;\r
-    vextent = seqPanel.seqCanvas.getSize().height/av.charHeight;\r
+    hextent = seqPanel.seqCanvas.getSize().width / av.charWidth;\r
+    vextent = seqPanel.seqCanvas.getSize().height / av.charHeight;\r
 \r
-    if(hextent > av.alignment.getWidth())\r
+    if (hextent > av.alignment.getWidth())\r
+    {\r
       hextent = av.alignment.getWidth();\r
-    if(vextent > av.alignment.getHeight())\r
+    }\r
+    if (vextent > av.alignment.getHeight())\r
+    {\r
       vextent = av.alignment.getHeight();\r
+    }\r
 \r
-    if(hextent+x  >  av.getAlignment().getWidth())\r
-      x =  av.getAlignment().getWidth()- hextent;\r
+    if (hextent + x > av.getAlignment().getWidth())\r
+    {\r
+      x = av.getAlignment().getWidth() - hextent;\r
+    }\r
 \r
-    if(vextent+y > av.getAlignment().getHeight())\r
+    if (vextent + y > av.getAlignment().getHeight())\r
+    {\r
       y = av.getAlignment().getHeight() - vextent;\r
+    }\r
 \r
-    if(y<0)\r
+    if (y < 0)\r
+    {\r
       y = 0;\r
+    }\r
 \r
-    if(x<0)\r
-      x=0;\r
-\r
+    if (x < 0)\r
+    {\r
+      x = 0;\r
+    }\r
 \r
     int endSeq = y + vextent;\r
-    if(endSeq>av.alignment.getHeight())\r
+    if (endSeq > av.alignment.getHeight())\r
+    {\r
       endSeq = av.alignment.getHeight();\r
+    }\r
 \r
-\r
-    av.setEndSeq( endSeq );\r
-    hscroll.setValues(x,hextent,0,av.getAlignment().getWidth());\r
-    vscroll.setValues(y,vextent,0,av.getAlignment().getHeight() );\r
+    av.setEndSeq(endSeq);\r
+    hscroll.setValues(x, hextent, 0, av.getAlignment().getWidth());\r
+    vscroll.setValues(y, vextent, 0, av.getAlignment().getHeight());\r
 \r
   }\r
 \r
-\r
   public void adjustmentValueChanged(AdjustmentEvent evt)\r
   {\r
     int oldX = av.getStartRes();\r
@@ -383,7 +420,8 @@ public class AlignmentPanel extends GAlignmentPanel implements AdjustmentListene
     {\r
       int x = hscroll.getValue();\r
       av.setStartRes(x);\r
-      av.setEndRes(x + seqPanel.seqCanvas.getSize().width/av.getCharWidth()-1);\r
+      av.setEndRes(x + seqPanel.seqCanvas.getSize().width / av.getCharWidth() -\r
+                   1);\r
     }\r
 \r
     if (evt.getSource() == vscroll)\r
@@ -391,22 +429,28 @@ public class AlignmentPanel extends GAlignmentPanel implements AdjustmentListene
       int offy = vscroll.getValue();\r
       if (av.getWrapAlignment())\r
       {\r
-        int rowSize = seqPanel.seqCanvas.getWrappedCanvasWidth(seqPanel.seqCanvas.getSize().width);\r
-        av.setStartRes( vscroll.getValue() * rowSize );\r
-        av.setEndRes( (vscroll.getValue()+1) * rowSize );\r
+        int rowSize = seqPanel.seqCanvas.getWrappedCanvasWidth(seqPanel.\r
+            seqCanvas.getSize().width);\r
+        av.setStartRes(vscroll.getValue() * rowSize);\r
+        av.setEndRes( (vscroll.getValue() + 1) * rowSize);\r
       }\r
       else\r
       {\r
         av.setStartSeq(offy);\r
-        av.setEndSeq(offy + seqPanel.seqCanvas.getSize().height / av.getCharHeight());\r
+        av.setEndSeq(offy +\r
+                     seqPanel.seqCanvas.getSize().height / av.getCharHeight());\r
       }\r
     }\r
 \r
-    if(overviewPanel!=null)\r
+    if (overviewPanel != null)\r
+    {\r
       overviewPanel.setBoxPosition();\r
+    }\r
 \r
-    if(av.getWrapAlignment() || !fastPaint)\r
+    if (av.getWrapAlignment() || !fastPaint)\r
+    {\r
       repaint();\r
+    }\r
     else\r
     {\r
       idPanel.idCanvas.fastPaint(av.getStartSeq() - oldY);\r
@@ -415,23 +459,25 @@ public class AlignmentPanel extends GAlignmentPanel implements AdjustmentListene
 \r
       scalePanel.repaint();\r
       if (av.getShowAnnotation())\r
+      {\r
         annotationPanel.fastPaint(av.getStartRes() - oldX);\r
+      }\r
     }\r
 \r
   }\r
 \r
   public void update(Graphics g)\r
   {\r
-    paint (g);\r
+    paint(g);\r
   }\r
 \r
-\r
   public void paint(Graphics g)\r
   {\r
     Dimension d = idPanel.idCanvas.getSize();\r
     idPanel.idCanvas.setSize(d.width, seqPanel.seqCanvas.getSize().height);\r
-    annotationSpaceFillerHolder.setSize(d.width,annotationPanel.getSize().height);\r
-    alabels.setSize(d.width,annotationPanel.getSize().height);\r
+    annotationSpaceFillerHolder.setSize(d.width,\r
+                                        annotationPanel.getSize().height);\r
+    alabels.setSize(d.width, annotationPanel.getSize().height);\r
 \r
     alabels.repaint();\r
     idPanel.idCanvas.repaint();\r
@@ -439,10 +485,11 @@ public class AlignmentPanel extends GAlignmentPanel implements AdjustmentListene
     scalePanel.repaint();\r
     annotationPanel.repaint();\r
 \r
-\r
     if (av.getWrapAlignment())\r
     {\r
-      int max = av.alignment.getWidth() / seqPanel.seqCanvas.getWrappedCanvasWidth(seqPanel.seqCanvas.getSize().width);\r
+      int max = av.alignment.getWidth() /\r
+          seqPanel.seqCanvas.\r
+          getWrappedCanvasWidth(seqPanel.seqCanvas.getSize().width);\r
       vscroll.setMaximum(max);\r
       vscroll.setUnitIncrement(1);\r
       vscroll.setVisibleAmount(1);\r
@@ -452,7 +499,5 @@ public class AlignmentPanel extends GAlignmentPanel implements AdjustmentListene
       setScrollValues(av.getStartRes(), av.getStartSeq());\r
     }\r
 \r
-\r
-\r
   }\r
 }\r
index 095377d..38013d1 100755 (executable)
@@ -1,40 +1,41 @@
-\r
 /*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 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
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
+ */\r
 \r
 package jalview.appletgui;\r
 \r
-import java.awt.event.*;\r
 import java.awt.*;\r
+import java.awt.event.*;\r
+\r
 import jalview.datamodel.*;\r
 \r
-public class AnnotationLabels extends Panel implements ActionListener\r
+public class AnnotationLabels\r
+    extends Panel implements ActionListener\r
 {\r
   boolean active = false;\r
-  AlignmentPanel ap ;\r
+  AlignmentPanel ap;\r
   boolean resizing = false;\r
   int oldY, mouseX;\r
   static String ADDNEW = "Add new row";\r
   static String HIDE = "Hide this row";\r
   static String DELETE = "Delete this row";\r
-  static String SHOWALL="Show all hidden rows";\r
-  static String OUTPUT_TEXT="Show Values In Textbox";\r
+  static String SHOWALL = "Show all hidden rows";\r
+  static String OUTPUT_TEXT = "Show Values In Textbox";\r
   int selectedRow = 0;\r
   int scrollOffset = 0;\r
 \r
@@ -43,7 +44,8 @@ public class AnnotationLabels extends Panel implements ActionListener
     this.ap = ap;\r
     setLayout(null);\r
     addMouseListener(new MouseAdapter()\r
-    {public void mousePressed(MouseEvent evt)\r
+    {\r
+      public void mousePressed(MouseEvent evt)\r
       {\r
         doMousePressed(evt);\r
       }\r
@@ -60,30 +62,32 @@ public class AnnotationLabels extends Panel implements ActionListener
   {\r
     AlignmentAnnotation[] aa = ap.av.alignment.getAlignmentAnnotation();\r
 \r
-   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
-         aa[i].visible = true;\r
-   }\r
-   else if (evt.getActionCommand().equals(OUTPUT_TEXT))\r
-   {\r
-     CutAndPasteTransfer cap = new CutAndPasteTransfer(false);\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
-\r
-   ap.annotationPanel.adjustPanelHeight();\r
-   setSize(getSize().width,ap.annotationPanel.getSize().height);\r
-   ap.validate();\r
-   ap.repaint();\r
+    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);\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
+\r
+    ap.annotationPanel.adjustPanelHeight();\r
+    setSize(getSize().width, ap.annotationPanel.getSize().height);\r
+    ap.validate();\r
+    ap.repaint();\r
   }\r
 \r
   public void doMousePressed(MouseEvent evt)\r
@@ -94,7 +98,9 @@ public class AnnotationLabels extends Panel implements ActionListener
     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
@@ -128,33 +134,43 @@ public class AnnotationLabels extends Panel implements ActionListener
   {\r
     FontMetrics fm = g.getFontMetrics(g.getFont());\r
     g.setColor(Color.white);\r
-    g.fillRect(0,0, getSize().width, getSize().height);\r
+    g.fillRect(0, 0, getSize().width, getSize().height);\r
 \r
     g.translate(0, scrollOffset);\r
     g.setColor(Color.black);\r
 \r
-   AlignmentAnnotation[] aa = ap.av.alignment.getAlignmentAnnotation();\r
-   int y = g.getFont().getSize();\r
-   int x = 0;\r
-\r
-   if(aa!=null)\r
-   for(int i=0; i<aa.length; i++)\r
-   {\r
-     if(!aa[i].visible)\r
-       continue;\r
-\r
-     x = getSize().width - fm.stringWidth(aa[i].label)-3;\r
-\r
-     if(aa[i].isGraph)\r
-       y+=(aa[i].height/3);\r
-\r
-     g.drawString(aa[i].label, x, y);\r
+    AlignmentAnnotation[] aa = ap.av.alignment.getAlignmentAnnotation();\r
+    int y = g.getFont().getSize();\r
+    int x = 0;\r
 \r
-     if(aa[i].isGraph)\r
-       y+=(2*aa[i].height/3);\r
-    else\r
-       y+=aa[i].height;\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 = getSize().width - fm.stringWidth(aa[i].label) - 3;\r
+\r
+        if (aa[i].isGraph)\r
+        {\r
+          y += (aa[i].height / 3);\r
+        }\r
+\r
+        g.drawString(aa[i].label, x, y);\r
+\r
+        if (aa[i].isGraph)\r
+        {\r
+          y += (2 * aa[i].height / 3);\r
+        }\r
+        else\r
+        {\r
+          y += aa[i].height;\r
+        }\r
+      }\r
+    }\r
   }\r
 \r
 }\r
index afdc6db..cd6396f 100755 (executable)
@@ -1,57 +1,56 @@
 /*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 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
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 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 jalview.datamodel.*;\r
+import java.util.*;\r
 \r
 import java.awt.*;\r
 import java.awt.event.*;\r
-import java.util.*;\r
 \r
-public class AnnotationPanel extends Panel implements AdjustmentListener\r
+import jalview.datamodel.*;\r
+\r
+public class AnnotationPanel\r
+    extends Panel implements AdjustmentListener\r
 {\r
   AlignViewport av;\r
   AlignmentPanel ap;\r
-  int activeRow =-1;\r
+  int activeRow = -1;\r
 \r
   Vector activeRes;\r
-  static String HELIX ="Helix";\r
-  static String SHEET ="Sheet";\r
-  static String LABEL ="Label";\r
-  static String REMOVE="Remove Annotation";\r
-  static String COLOUR="Colour";\r
+  static String HELIX = "Helix";\r
+  static String SHEET = "Sheet";\r
+  static String LABEL = "Label";\r
+  static String REMOVE = "Remove Annotation";\r
+  static String COLOUR = "Colour";\r
   static Color HELIX_COLOUR = Color.red.darker();\r
   static Color SHEET_COLOUR = Color.green.darker().darker();\r
 \r
-\r
   Image image;\r
   Graphics gg;\r
   FontMetrics fm;\r
-  int imgWidth=0;\r
+  int imgWidth = 0;\r
 \r
   boolean fastPaint = false;\r
 \r
   public static int GRAPH_HEIGHT = 40;\r
 \r
-\r
-\r
   public AnnotationPanel(AlignmentPanel ap)\r
   {\r
     this.ap = ap;\r
@@ -60,16 +59,19 @@ public class AnnotationPanel extends Panel implements AdjustmentListener
     adjustPanelHeight();\r
 \r
     addMouseMotionListener(new MouseMotionAdapter()\r
-    {public void mouseMoved(MouseEvent evt)\r
-          { doMouseMoved(evt); }\r
+    {\r
+      public void mouseMoved(MouseEvent evt)\r
+      {\r
+        doMouseMoved(evt);\r
+      }\r
     });\r
 \r
-   // ap.annotationScroller.getVAdjustable().addAdjustmentListener( this );\r
+    // ap.annotationScroller.getVAdjustable().addAdjustmentListener( this );\r
   }\r
 \r
   public void adjustmentValueChanged(AdjustmentEvent evt)\r
   {\r
-    ap.alabels.setScrollOffset( -evt.getValue() );\r
+    ap.alabels.setScrollOffset( -evt.getValue());\r
   }\r
 \r
   public void adjustPanelHeight()\r
@@ -77,51 +79,68 @@ public class AnnotationPanel extends Panel implements AdjustmentListener
     // setHeight of panels\r
     AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();\r
     int height = 0;\r
-    if(aa!=null)\r
-    for (int i = 0; i < aa.length; i++)\r
+    if (aa != null)\r
     {\r
-      if(!aa[i].visible)\r
-        continue;\r
+      for (int i = 0; i < aa.length; i++)\r
+      {\r
+        if (!aa[i].visible)\r
+        {\r
+          continue;\r
+        }\r
 \r
-      aa[i].height = 0;\r
+        aa[i].height = 0;\r
 \r
-      if(aa[i].hasText)\r
-        aa[i].height += av.charHeight;\r
-      if (aa[i].hasIcons)\r
-        aa[i].height += 16;\r
+        if (aa[i].hasText)\r
+        {\r
+          aa[i].height += av.charHeight;\r
+        }\r
+        if (aa[i].hasIcons)\r
+        {\r
+          aa[i].height += 16;\r
+        }\r
 \r
-      if (aa[i].isGraph)\r
-        aa[i].height += GRAPH_HEIGHT;\r
+        if (aa[i].isGraph)\r
+        {\r
+          aa[i].height += GRAPH_HEIGHT;\r
+        }\r
 \r
-      if(aa[i].height==0)\r
-        aa[i].height = 20;\r
-      height += aa[i].height;\r
+        if (aa[i].height == 0)\r
+        {\r
+          aa[i].height = 20;\r
+        }\r
+        height += aa[i].height;\r
+      }\r
+    }\r
+    else\r
+    {\r
+      height = 20;\r
     }\r
-  else height=20;\r
 \r
-   this.setSize(getSize().width, height);\r
-   ap.annotationScroller.setSize(getSize().width, height);\r
+    this.setSize(getSize().width, height);\r
+    ap.annotationScroller.setSize(getSize().width, height);\r
 \r
 //  ap.annotationSpaceFillerHolder.setSize(d.width,annotationPanel.getSize().height);\r
 \r
-   repaint();\r
+    repaint();\r
 \r
   }\r
 \r
   public void addEditableColumn(int i)\r
   {\r
-    if(activeRow==-1)\r
+    if (activeRow == -1)\r
     {\r
-      AlignmentAnnotation [] aa = av.alignment.getAlignmentAnnotation();\r
-      for(int j=0; j<aa.length; j++)\r
-        if(aa[j].editable)\r
+      AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();\r
+      for (int j = 0; j < aa.length; j++)\r
+      {\r
+        if (aa[j].editable)\r
         {\r
           activeRow = j;\r
           break;\r
         }\r
+      }\r
     }\r
 \r
-    if(activeRes==null)\r
+    if (activeRes == null)\r
     {\r
       activeRes = new Vector();\r
       activeRes.addElement(String.valueOf(i));\r
@@ -131,38 +150,40 @@ public class AnnotationPanel extends Panel implements AdjustmentListener
     activeRes.addElement(String.valueOf(i));\r
   }\r
 \r
- public void doMouseMoved(MouseEvent evt)\r
- {\r
-   AlignmentAnnotation [] aa = av.alignment.getAlignmentAnnotation();\r
-   if(aa==null)\r
-     return;\r
-\r
-   int row = -1;\r
-   int height=0;\r
-   for(int i=0; i<aa.length; i++)\r
-   {\r
-\r
-     if( aa[i].visible )\r
-       height += aa[i].height;\r
+  public void doMouseMoved(MouseEvent evt)\r
+  {\r
+    AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();\r
+    if (aa == null)\r
+    {\r
+      return;\r
+    }\r
 \r
-     if(evt.getY()<height)\r
-     {\r
-       row = i;\r
-       break;\r
-     }\r
-   }\r
+    int row = -1;\r
+    int height = 0;\r
+    for (int i = 0; i < aa.length; i++)\r
+    {\r
 \r
-   int res = evt.getX() / av.getCharWidth() + av.getStartRes();\r
-   if(row>-1 && res<aa[row].annotations.length && aa[row].annotations[res]!=null)\r
-   {\r
-     StringBuffer text = new StringBuffer("Sequence position " + (res + 1) +\r
-                                          "  " +\r
-                                          aa[row].annotations[res].description);\r
-     ap.alignFrame.statusBar.setText(text.toString());\r
-   }\r
- }\r
+      if (aa[i].visible)\r
+      {\r
+        height += aa[i].height;\r
+      }\r
 \r
+      if (evt.getY() < height)\r
+      {\r
+        row = i;\r
+        break;\r
+      }\r
+    }\r
 \r
+    int res = evt.getX() / av.getCharWidth() + av.getStartRes();\r
+    if (row > -1 && res < aa[row].annotations.length && aa[row].annotations[res] != null)\r
+    {\r
+      StringBuffer text = new StringBuffer("Sequence position " + (res + 1) +\r
+                                           "  " +\r
+                                           aa[row].annotations[res].description);\r
+      ap.alignFrame.statusBar.setText(text.toString());\r
+    }\r
+  }\r
 \r
   public void update(Graphics g)\r
   {\r
@@ -171,258 +192,304 @@ public class AnnotationPanel extends Panel implements AdjustmentListener
 \r
   public void paint(Graphics g)\r
   {\r
-    imgWidth = (av.endRes-av.startRes+1) *av.charWidth;\r
+    imgWidth = (av.endRes - av.startRes + 1) * av.charWidth;\r
 \r
-    if(image==null || imgWidth != image.getWidth(this))\r
-      {\r
-        image = createImage(imgWidth, ap.annotationPanel.getSize().height);\r
-        gg = image.getGraphics();\r
-        gg.setFont(av.getFont());\r
-        fm = gg.getFontMetrics();\r
-        fastPaint = false;\r
+    if (image == null || imgWidth != image.getWidth(this))\r
+    {\r
+      image = createImage(imgWidth, ap.annotationPanel.getSize().height);\r
+      gg = image.getGraphics();\r
+      gg.setFont(av.getFont());\r
+      fm = gg.getFontMetrics();\r
+      fastPaint = false;\r
     }\r
 \r
-    if(fastPaint)\r
+    if (fastPaint)\r
     {\r
       g.drawImage(image, 0, 0, this);\r
       fastPaint = false;\r
       return;\r
     }\r
 \r
-    drawComponent( gg, av.startRes, av.endRes+1);\r
-    g.drawImage( image, 0, 0, this);\r
+    drawComponent(gg, av.startRes, av.endRes + 1);\r
+    g.drawImage(image, 0, 0, this);\r
 \r
   }\r
 \r
   public void fastPaint(int horizontal)\r
-{\r
-  if( horizontal == 0\r
-     || av.alignment.getAlignmentAnnotation()==null\r
-     || av.alignment.getAlignmentAnnotation().length<1\r
-    )\r
   {\r
-    repaint();\r
-    return;\r
-  }\r
-\r
-  gg.copyArea( 0,0, imgWidth, getSize().height, -horizontal*av.charWidth, 0 );\r
-  int sr=av.startRes, er=av.endRes+1, transX=0;\r
-\r
-  if(horizontal>0) // scrollbar pulled right, image to the left\r
-  {\r
-    transX =  (er-sr-horizontal)*av.charWidth;\r
-    sr = er - horizontal ;\r
-  }\r
-  else if(horizontal<0)\r
-  {\r
-    er = sr-horizontal;\r
-  }\r
+    if (horizontal == 0\r
+        || av.alignment.getAlignmentAnnotation() == null\r
+        || av.alignment.getAlignmentAnnotation().length < 1\r
+        )\r
+    {\r
+      repaint();\r
+      return;\r
+    }\r
 \r
+    gg.copyArea(0, 0, imgWidth, getSize().height, -horizontal * av.charWidth, 0);\r
+    int sr = av.startRes, er = av.endRes + 1, transX = 0;\r
 \r
-  gg.translate(transX, 0);\r
+    if (horizontal > 0) // scrollbar pulled right, image to the left\r
+    {\r
+      transX = (er - sr - horizontal) * av.charWidth;\r
+      sr = er - horizontal;\r
+    }\r
+    else if (horizontal < 0)\r
+    {\r
+      er = sr - horizontal;\r
+    }\r
 \r
-  drawComponent(gg, sr, er);\r
+    gg.translate(transX, 0);\r
 \r
-  gg.translate( -transX, 0 );\r
+    drawComponent(gg, sr, er);\r
 \r
-  fastPaint = true;\r
-  repaint();\r
-}\r
+    gg.translate( -transX, 0);\r
 \r
+    fastPaint = true;\r
+    repaint();\r
+  }\r
 \r
   public void drawComponent(Graphics g, int startRes, int endRes)\r
   {\r
     g.setColor(Color.white);\r
-    g.fillRect(0,0,(endRes-startRes) *av.charWidth, getSize().height);\r
-    if(av.alignment.getAlignmentAnnotation()==null || av.alignment.getAlignmentAnnotation().length<1)\r
+    g.fillRect(0, 0, (endRes - startRes) * av.charWidth, getSize().height);\r
+    if (av.alignment.getAlignmentAnnotation() == null ||\r
+        av.alignment.getAlignmentAnnotation().length < 1)\r
     {\r
       g.setColor(Color.white);\r
-      g.fillRect(0,0,getSize().width, getSize().height);\r
+      g.fillRect(0, 0, getSize().width, getSize().height);\r
       g.setColor(Color.black);\r
-      g.drawString("Alignment has no annotations",20,15);\r
+      g.drawString("Alignment has no annotations", 20, 15);\r
       return;\r
     }\r
 \r
-    AlignmentAnnotation [] aa = av.alignment.getAlignmentAnnotation();\r
+    AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();\r
 \r
-    int j, x=0, y=0;\r
-    char [] lastSS = new char[aa.length];\r
-    int  [] lastSSX= new int[aa.length] ;\r
-    int iconOffset = av.charHeight/2;\r
+    int j, x = 0, y = 0;\r
+    char[] lastSS = new char[aa.length];\r
+    int[] lastSSX = new int[aa.length];\r
+    int iconOffset = av.charHeight / 2;\r
     boolean validRes = false;\r
     //\u03B2 \u03B1\r
 \r
-    for(int i=0; i<aa.length; i++)\r
+    for (int i = 0; i < aa.length; i++)\r
     {\r
       AlignmentAnnotation row = aa[i];\r
-      if(!row.visible)\r
+      if (!row.visible)\r
+      {\r
         continue;\r
+      }\r
 \r
-      if(row.isGraph)\r
+      if (row.isGraph)\r
       {\r
         // this is so that we draw the characters below the graph\r
         y += row.height;\r
-        if(row.hasText)\r
+        if (row.hasText)\r
+        {\r
           y -= av.charHeight;\r
+        }\r
+      }\r
+      if (row.hasText)\r
+      {\r
+        iconOffset = av.charHeight / 2;\r
       }\r
-      if(row.hasText)\r
-        iconOffset = av.charHeight/2;\r
       else\r
+      {\r
         iconOffset = 0;\r
+      }\r
 \r
-      for(j=startRes; j<endRes; j++)\r
+      for (j = startRes; j < endRes; j++)\r
       {\r
-        if(row.annotations.length<=j || row.annotations[j]==null)\r
-        validRes = false;\r
-       else\r
-         validRes = true;\r
-\r
-       x = (j-startRes)*av.charWidth;\r
-\r
-\r
-       if(activeRow==i)\r
-       {\r
+        if (row.annotations.length <= j || row.annotations[j] == null)\r
+        {\r
+          validRes = false;\r
+        }\r
+        else\r
+        {\r
+          validRes = true;\r
+        }\r
 \r
-         g.setColor(Color.red);\r
+        x = (j - startRes) * av.charWidth;\r
 \r
-         if(activeRes!=null)\r
-           for (int n = 0; n < activeRes.size(); n++)\r
-           {\r
-             int v = Integer.parseInt(activeRes.elementAt(n).toString()) ;\r
-             if (v == j)\r
-               g.fillRect( (j-startRes) * av.charWidth, y, av.charWidth, row.height);\r
-           }\r
-       }\r
+        if (activeRow == i)\r
+        {\r
 \r
+          g.setColor(Color.red);\r
 \r
+          if (activeRes != null)\r
+          {\r
+            for (int n = 0; n < activeRes.size(); n++)\r
+            {\r
+              int v = Integer.parseInt(activeRes.elementAt(n).toString());\r
+              if (v == j)\r
+              {\r
+                g.fillRect( (j - startRes) * av.charWidth, y, av.charWidth,\r
+                           row.height);\r
+              }\r
+            }\r
+          }\r
+        }\r
 \r
-       if(validRes && row.annotations[j].displayCharacter.length()>0)\r
-       {\r
-         int charOffset = (av.charWidth - fm.charWidth(row.annotations[j].displayCharacter.charAt(0)))/2;\r
-         g.setColor( row.annotations[j].colour);\r
-          if(j==0)\r
+        if (validRes && row.annotations[j].displayCharacter.length() > 0)\r
+        {\r
+          int charOffset = (av.charWidth -\r
+                            fm.charWidth(row.annotations[j].displayCharacter.\r
+                                         charAt(0))) / 2;\r
+          g.setColor(row.annotations[j].colour);\r
+          if (j == 0)\r
           {\r
             if (row.annotations[0].secondaryStructure == 'H'\r
                 || row.annotations[0].secondaryStructure == 'E')\r
+            {\r
               g.drawString(row.annotations[j].displayCharacter, x,\r
                            y + iconOffset + 2);\r
+            }\r
           }\r
-         else if( (row.annotations[j].secondaryStructure=='H'\r
-               || row.annotations[j].secondaryStructure=='E') &&\r
-               (row.annotations[j-1]==null ||\r
-                row.annotations[j].secondaryStructure!=row.annotations[j-1].secondaryStructure))\r
+          else if ( (row.annotations[j].secondaryStructure == 'H'\r
+                     || row.annotations[j].secondaryStructure == 'E') &&\r
+                   (row.annotations[j - 1] == null ||\r
+                    row.annotations[j].secondaryStructure !=\r
+                    row.annotations[j - 1].secondaryStructure))\r
+          {\r
 \r
-        g.drawString(row.annotations[j].displayCharacter, x, y + iconOffset + 2);\r
+            g.drawString(row.annotations[j].displayCharacter, x,\r
+                         y + iconOffset + 2);\r
+          }\r
 \r
-        if(!row.hasIcons)\r
+          if (!row.hasIcons)\r
+          {\r
             g.drawString(row.annotations[j].displayCharacter, x + charOffset,\r
                          y + iconOffset + 2);\r
-       }\r
-\r
-       if(row.hasIcons)\r
-       if(!validRes || row.annotations[j].secondaryStructure!=lastSS[i])\r
-       {\r
-         switch (lastSS[i])\r
-         {\r
-           case 'H':\r
-             g.setColor(HELIX_COLOUR);\r
-             g.fillRoundRect(lastSSX[i], y+4 + iconOffset, x-lastSSX[i], 7, 8, 8);\r
-             break;\r
-           case 'E':\r
-             g.setColor(SHEET_COLOUR);\r
-             g.fillRect(lastSSX[i], y + 4 + iconOffset, x-lastSSX[i]-4, 7);\r
-             g.fillPolygon(new int[] {x - 4, x- 4, x }\r
-                           , new int[]{y+ iconOffset, y + 14+ iconOffset, y + 8+ iconOffset}, 3);\r
-             break;\r
-           case 'C':\r
-             break;\r
-           default :\r
-             g.setColor(Color.gray);\r
-             g.fillRect(lastSSX[i], y+6+ iconOffset, x-lastSSX[i], 2);\r
-             break;\r
-         }\r
-\r
-         if(validRes)\r
-           lastSS[i] = row.annotations[j].secondaryStructure;\r
-          else\r
-            lastSS[i] = ' ';\r
-         lastSSX[i] = x;\r
-       }\r
-\r
-       if (validRes && row.isGraph)\r
-       {\r
-         g.setColor(new Color(0,0,180));\r
-         int height = (int)((row.annotations[j].value / row.graphMax)*GRAPH_HEIGHT);\r
-\r
-         if(row.windowLength>1)\r
-         {\r
-           int total =0;\r
-           for(int i2=j- (row.windowLength/2); i2<j+(row.windowLength/2); i2++)\r
-           {\r
-             if(i2<0 || i2>=av.alignment.getWidth())\r
-               continue;\r
-\r
-             total += row.annotations[i2].value;\r
-           }\r
-\r
-           total/=row.windowLength;\r
-           height = (int)( (total / row.graphMax) *GRAPH_HEIGHT);\r
-\r
-         }\r
-         g.setColor(row.annotations[j].colour);\r
-         g.fillRect(x, y-height, av.charWidth, height );\r
-       }\r
+          }\r
+        }\r
+\r
+        if (row.hasIcons)\r
+        {\r
+          if (!validRes || row.annotations[j].secondaryStructure != lastSS[i])\r
+          {\r
+            switch (lastSS[i])\r
+            {\r
+              case 'H':\r
+                g.setColor(HELIX_COLOUR);\r
+                g.fillRoundRect(lastSSX[i], y + 4 + iconOffset, x - lastSSX[i],\r
+                                7, 8, 8);\r
+                break;\r
+              case 'E':\r
+                g.setColor(SHEET_COLOUR);\r
+                g.fillRect(lastSSX[i], y + 4 + iconOffset, x - lastSSX[i] - 4,\r
+                           7);\r
+                g.fillPolygon(new int[]\r
+                              {x - 4, x - 4, x}\r
+                              , new int[]\r
+                              {y + iconOffset, y + 14 + iconOffset,\r
+                              y + 8 + iconOffset}, 3);\r
+                break;\r
+              case 'C':\r
+                break;\r
+              default:\r
+                g.setColor(Color.gray);\r
+                g.fillRect(lastSSX[i], y + 6 + iconOffset, x - lastSSX[i], 2);\r
+                break;\r
+            }\r
+\r
+            if (validRes)\r
+            {\r
+              lastSS[i] = row.annotations[j].secondaryStructure;\r
+            }\r
+            else\r
+            {\r
+              lastSS[i] = ' ';\r
+            }\r
+            lastSSX[i] = x;\r
+          }\r
+        }\r
+\r
+        if (validRes && row.isGraph)\r
+        {\r
+          g.setColor(new Color(0, 0, 180));\r
+          int height = (int) ( (row.annotations[j].value / row.graphMax) *\r
+                              GRAPH_HEIGHT);\r
+\r
+          if (row.windowLength > 1)\r
+          {\r
+            int total = 0;\r
+            for (int i2 = j - (row.windowLength / 2);\r
+                 i2 < j + (row.windowLength / 2); i2++)\r
+            {\r
+              if (i2 < 0 || i2 >= av.alignment.getWidth())\r
+              {\r
+                continue;\r
+              }\r
+\r
+              total += row.annotations[i2].value;\r
+            }\r
 \r
+            total /= row.windowLength;\r
+            height = (int) ( (total / row.graphMax) * GRAPH_HEIGHT);\r
+\r
+          }\r
+          g.setColor(row.annotations[j].colour);\r
+          g.fillRect(x, y - height, av.charWidth, height);\r
+        }\r
 \r
       }\r
 \r
-      x+=av.charWidth;\r
+      x += av.charWidth;\r
 \r
-      if(row.hasIcons)\r
-      switch (lastSS[i])\r
+      if (row.hasIcons)\r
       {\r
-        case 'H':\r
-          g.setColor(HELIX_COLOUR);\r
-          g.fillRoundRect(lastSSX[i], y+4+ iconOffset, x - lastSSX[i], 7, 8, 8);\r
-          break;\r
-        case 'E':\r
-          g.setColor(SHEET_COLOUR);\r
-          g.fillRect(lastSSX[i], y + 4+ iconOffset, x - lastSSX[i] - 4, 7);\r
-          g.fillPolygon(new int[]\r
-                        {x - 4, x - 4, x}\r
-                        , new int[]\r
-                        {y + iconOffset, y + 14+ iconOffset, y + 7+ iconOffset}\r
-                        , 3);\r
-          break;\r
-        case 'C':\r
-          break;\r
-        default:\r
-          g.setColor(Color.gray);\r
-          g.fillRect(lastSSX[i], y+6+ iconOffset, x-lastSSX[i], 2);\r
-          break;\r
+        switch (lastSS[i])\r
+        {\r
+          case 'H':\r
+            g.setColor(HELIX_COLOUR);\r
+            g.fillRoundRect(lastSSX[i], y + 4 + iconOffset, x - lastSSX[i], 7,\r
+                            8, 8);\r
+            break;\r
+          case 'E':\r
+            g.setColor(SHEET_COLOUR);\r
+            g.fillRect(lastSSX[i], y + 4 + iconOffset, x - lastSSX[i] - 4, 7);\r
+            g.fillPolygon(new int[]\r
+                          {x - 4, x - 4, x}\r
+                          , new int[]\r
+                          {y + iconOffset, y + 14 + iconOffset,\r
+                          y + 7 + iconOffset}\r
+                          , 3);\r
+            break;\r
+          case 'C':\r
+            break;\r
+          default:\r
+            g.setColor(Color.gray);\r
+            g.fillRect(lastSSX[i], y + 6 + iconOffset, x - lastSSX[i], 2);\r
+            break;\r
 \r
+        }\r
       }\r
 \r
-       if(row.isGraph && row.hasText)\r
-         y+=av.charHeight;\r
-       if(!row.isGraph)\r
-          y+=aa[i].height;\r
+      if (row.isGraph && row.hasText)\r
+      {\r
+        y += av.charHeight;\r
+      }\r
+      if (!row.isGraph)\r
+      {\r
+        y += aa[i].height;\r
+      }\r
     }\r
   }\r
 \r
   // used by overview window\r
-  public void drawGraph(Graphics g, AlignmentAnnotation aa,int width, int y)\r
+  public void drawGraph(Graphics g, AlignmentAnnotation aa, int width, int y)\r
   {\r
     g.setColor(Color.white);\r
-    g.fillRect(0,0,width, y);\r
-    g.setColor(new Color(0,0,180));\r
+    g.fillRect(0, 0, width, y);\r
+    g.setColor(new Color(0, 0, 180));\r
     int x = 0;\r
-    for(int j=0; j<aa.annotations.length; j++)\r
+    for (int j = 0; j < aa.annotations.length; j++)\r
     {\r
       g.setColor(new Color(0, 0, 180));\r
-      int height = (int) ( (aa.annotations[j].value / aa.graphMax) * GRAPH_HEIGHT );\r
+      int height = (int) ( (aa.annotations[j].value / aa.graphMax) *\r
+                          GRAPH_HEIGHT);\r
       g.fillRect(x, y - height, av.charWidth, height);\r
-      x+=av.charWidth;\r
+      x += av.charWidth;\r
     }\r
   }\r
 }\r
index cb83c4a..72bec07 100755 (executable)
@@ -1,21 +1,21 @@
 /*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 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
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 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
@@ -24,70 +24,92 @@ import java.util.*;
 /**\r
  * NOTE: Columns are zero based.\r
  */\r
-public class ColumnSelection{\r
+public class ColumnSelection\r
+{\r
   Vector selected = new Vector();\r
 \r
-  public void addElement(int col) {\r
+  public void addElement(int col)\r
+  {\r
     selected.addElement(new Integer(col));\r
   }\r
 \r
-  public void clear() {\r
+  public void clear()\r
+  {\r
     selected.removeAllElements();\r
   }\r
 \r
-  public void removeElement(int col) {\r
+  public void removeElement(int col)\r
+  {\r
     Integer colInt = new Integer(col);\r
-    if (selected.contains(colInt)) {\r
+    if (selected.contains(colInt))\r
+    {\r
       selected.removeElement(colInt);\r
-    } else {\r
-      System.err.println("WARNING: Tried to remove Integer NOT in ColumnSelection");\r
+    }\r
+    else\r
+    {\r
+      System.err.println(\r
+          "WARNING: Tried to remove Integer NOT in ColumnSelection");\r
     }\r
   }\r
 \r
-  public boolean contains(int col) {\r
+  public boolean contains(int col)\r
+  {\r
     return selected.contains(new Integer(col));\r
   }\r
 \r
-  public int columnAt(int i) {\r
-    return ((Integer)selected.elementAt(i)).intValue();\r
+  public int columnAt(int i)\r
+  {\r
+    return ( (Integer) selected.elementAt(i)).intValue();\r
   }\r
 \r
-  public int size() {\r
+  public int size()\r
+  {\r
     return selected.size();\r
   }\r
 \r
-  public int getMax() {\r
+  public int getMax()\r
+  {\r
     int max = -1;\r
 \r
-    for (int i=0;i<selected.size();i++) {\r
-      if (columnAt(i) > max) {\r
+    for (int i = 0; i < selected.size(); i++)\r
+    {\r
+      if (columnAt(i) > max)\r
+      {\r
         max = columnAt(i);\r
       }\r
     }\r
     return max;\r
   }\r
 \r
-  public int getMin() {\r
+  public int getMin()\r
+  {\r
     int min = 1000000000;\r
 \r
-    for (int i=0;i<selected.size();i++) {\r
-      if (columnAt(i) < min) {\r
+    for (int i = 0; i < selected.size(); i++)\r
+    {\r
+      if (columnAt(i) < min)\r
+      {\r
         min = columnAt(i);\r
       }\r
     }\r
     return min;\r
   }\r
 \r
-  public Vector asVector() {\r
+  public Vector asVector()\r
+  {\r
     return selected;\r
   }\r
 \r
-  public void compensateForEdit(int start, int change) {\r
-    for (int i=0; i < size();i++) {\r
+  public void compensateForEdit(int start, int change)\r
+  {\r
+    for (int i = 0; i < size(); i++)\r
+    {\r
       int temp = columnAt(i);\r
 \r
       if (temp >= start)\r
-        selected.setElementAt(new Integer(temp-change),i);\r
+      {\r
+        selected.setElementAt(new Integer(temp - change), i);\r
+      }\r
     }\r
   }\r
 }\r
index 22cfd67..ed89001 100755 (executable)
@@ -1,43 +1,44 @@
 /*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 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
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 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 jalview.jbappletgui.GCutAndPasteTransfer;\r
-import jalview.datamodel.*;\r
-import jalview.io.*;\r
 import java.awt.*;\r
 import java.awt.event.*;\r
 \r
-public class CutAndPasteTransfer extends GCutAndPasteTransfer\r
+import jalview.datamodel.*;\r
+import jalview.io.*;\r
+import jalview.jbappletgui.*;\r
+\r
+public class CutAndPasteTransfer\r
+    extends GCutAndPasteTransfer\r
 {\r
   public CutAndPasteTransfer(boolean forImport)\r
   {\r
     super();\r
 \r
-    if(!forImport)\r
+    if (!forImport)\r
     {\r
       buttonPanel.setVisible(false);\r
     }\r
   }\r
 \r
-\r
   public String getText()\r
   {\r
     return textarea.getText();\r
@@ -48,7 +49,6 @@ public class CutAndPasteTransfer extends GCutAndPasteTransfer
     textarea.setText(text);\r
   }\r
 \r
-\r
   protected void ok_actionPerformed(ActionEvent e)\r
   {\r
     String text = getText();\r
@@ -68,14 +68,12 @@ public class CutAndPasteTransfer extends GCutAndPasteTransfer
 \r
     Frame frame = (Frame)this.getParent();\r
     frame.setVisible(false);\r
-   }\r
-\r
-   protected void cancel_actionPerformed(ActionEvent e) {\r
-     Frame frame = (Frame)this.getParent();\r
-     frame.setVisible(false);\r
-   }\r
-\r
-\r
+  }\r
 \r
+  protected void cancel_actionPerformed(ActionEvent e)\r
+  {\r
+    Frame frame = (Frame)this.getParent();\r
+    frame.setVisible(false);\r
+  }\r
 \r
 }\r
index f6fe0be..291ce5f 100755 (executable)
@@ -1,34 +1,36 @@
 /*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 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
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 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 jalview.datamodel.*;\r
-import java.awt.*;\r
 import java.util.*;\r
 \r
+import java.awt.*;\r
+\r
+import jalview.datamodel.*;\r
+\r
 public class FeatureRenderer\r
 {\r
   AlignViewport av;\r
 \r
   SequenceGroup currentSequenceGroup = null;\r
-  SequenceGroup [] allGroups = null;\r
+  SequenceGroup[] allGroups = null;\r
   Color resBoxColour;\r
   Graphics graphics;\r
 \r
@@ -37,36 +39,43 @@ public class FeatureRenderer
     this.av = av;\r
   }\r
 \r
-\r
-  public void drawSequence(Graphics g,SequenceI seq,SequenceGroup [] sg, int start, int end, int x1, int y1, int width, int height)\r
+  public void drawSequence(Graphics g, SequenceI seq, SequenceGroup[] sg,\r
+                           int start, int end, int x1, int y1, int width,\r
+                           int height)\r
   {\r
     Vector features = seq.getSequenceFeatures();\r
     Enumeration e = features.elements();\r
-    while( e.hasMoreElements() )\r
+    while (e.hasMoreElements())\r
     {\r
-      SequenceFeature sf = (SequenceFeature)e.nextElement();\r
-      if(sf.getStart()>seq.getEnd())\r
+      SequenceFeature sf = (SequenceFeature) e.nextElement();\r
+      if (sf.getStart() > seq.getEnd())\r
+      {\r
         continue;\r
+      }\r
 \r
-      int fstart = seq.findIndex(sf.getStart())-1;\r
-      int fend = seq.findIndex(sf.getEnd())-1;\r
+      int fstart = seq.findIndex(sf.getStart()) - 1;\r
+      int fend = seq.findIndex(sf.getEnd()) - 1;\r
 \r
-      if(   (fstart<=end && fend>=start)  )\r
+      if ( (fstart <= end && fend >= start))\r
       {\r
-        if(fstart<0) // fix for if the feature we have starts before the sequence start,\r
-          fstart = 0;// but the feature end is still valid!!\r
+        if (fstart < 0) // fix for if the feature we have starts before the sequence start,\r
+        {\r
+          fstart = 0; // but the feature end is still valid!!\r
+        }\r
 \r
-        if(fstart==fend)\r
+        if (fstart == fend)\r
         {\r
           g.setColor(Color.red);\r
-          g.fillRoundRect( (fstart - start) * width, y1, width, height, 4,4);\r
+          g.fillRoundRect( (fstart - start) * width, y1, width, height, 4, 4);\r
           g.setColor(Color.white);\r
 \r
           char s = seq.getSequence().charAt(fstart);\r
           FontMetrics fm = g.getFontMetrics();\r
-          int charOffset =  (width - fm.charWidth(s))/2;\r
-          int pady = height/5;\r
-          g.drawString(String.valueOf(s), charOffset + x1 + width * (fstart - start), y1 + height - pady);\r
+          int charOffset = (width - fm.charWidth(s)) / 2;\r
+          int pady = height / 5;\r
+          g.drawString(String.valueOf(s),\r
+                       charOffset + x1 + width * (fstart - start),\r
+                       y1 + height - pady);\r
 \r
         }\r
         else\r
@@ -74,11 +83,13 @@ public class FeatureRenderer
           for (int i = fstart; i <= fend; i++)\r
           {\r
             char s = seq.getSequence().charAt(i);\r
-            if( jalview.util.Comparison.isGap(s) )\r
+            if (jalview.util.Comparison.isGap(s))\r
+            {\r
               continue;\r
+            }\r
 \r
             g.setColor(Color.blue);\r
-            g.fillRect( (i-start) * width, y1, width, height);\r
+            g.fillRect( (i - start) * width, y1, width, height);\r
 \r
             g.setColor(Color.white);\r
 \r
@@ -86,13 +97,13 @@ public class FeatureRenderer
             int charOffset = (width - fm.charWidth(s)) / 2;\r
             int pady = height / 5;\r
             g.drawString(String.valueOf(s),\r
-                         charOffset + x1 + width * (i-start),\r
+                         charOffset + x1 + width * (i - start),\r
                          y1 + height - pady);\r
           }\r
         }\r
       }\r
 \r
     }\r
-   }\r
+  }\r
 \r
 }\r
index e6fb5e6..a3a6124 100755 (executable)
@@ -1,31 +1,34 @@
 /*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 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
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 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 jalview.jbappletgui.GFinder;\r
-import jalview.datamodel.*;\r
-import java.awt.event.*;\r
 import java.util.*;\r
+\r
 import java.awt.*;\r
+import java.awt.event.*;\r
+\r
+import jalview.datamodel.*;\r
+import jalview.jbappletgui.*;\r
 \r
-public class Finder extends GFinder\r
+public class Finder\r
+    extends GFinder\r
 {\r
   AlignViewport av;\r
   AlignmentPanel ap;\r
@@ -41,12 +44,15 @@ public class Finder extends GFinder
     this.ap = ap;\r
     frame = new Frame();\r
     frame.add(this);\r
-    jalview.bin.JalviewLite.addFrame(frame, "Find", 340,120);\r
+    jalview.bin.JalviewLite.addFrame(frame, "Find", 340, 120);\r
     frame.repaint();\r
     frame.addWindowListener(new WindowAdapter()\r
-        {public void windowClosing(WindowEvent evt)\r
-              { ap.highlightSearchResults( null ); }\r
-        });\r
+    {\r
+      public void windowClosing(WindowEvent evt)\r
+      {\r
+        ap.highlightSearchResults(null);\r
+      }\r
+    });\r
   }\r
 \r
   public void textfield_actionPerformed(ActionEvent e)\r
@@ -61,197 +67,229 @@ public class Finder extends GFinder
 \r
   public void findAll_actionPerformed(ActionEvent e)\r
   {\r
-    resIndex=0;\r
-    seqIndex=0;\r
+    resIndex = 0;\r
+    seqIndex = 0;\r
     doSearch(true);\r
   }\r
 \r
   public void cancel_actionPerformed(ActionEvent e)\r
   {\r
-    try{\r
+    try\r
+    {\r
       // if allResults is null, this effectively switches displaySearch flag in seqCanvas\r
-      ap.highlightSearchResults( null );\r
-      ap.idPanel.highlightSearchResults( null );\r
-     // frame.setClosed(true);\r
-    }catch(Exception ex){ }\r
+      ap.highlightSearchResults(null);\r
+      ap.idPanel.highlightSearchResults(null);\r
+      // frame.setClosed(true);\r
+    }\r
+    catch (Exception ex)\r
+    {}\r
   }\r
 \r
-\r
   public void createNewGroup_actionPerformed(ActionEvent e)\r
   {\r
-   Color [] newColors = new Color[24];\r
-   for(int i=0; i<24; i++)\r
-     newColors[i] = new Color(60,160,115);\r
-\r
-   jalview.schemes.UserColourScheme ucs = new jalview.schemes.UserColourScheme(newColors);\r
-   String searchString = textfield.getText();\r
+    Color[] newColors = new Color[24];\r
+    for (int i = 0; i < 24; i++)\r
+    {\r
+      newColors[i] = new Color(60, 160, 115);\r
+    }\r
 \r
-   searchGroup = new SuperGroup(searchString, ucs , true, true, false);\r
+    jalview.schemes.UserColourScheme ucs = new jalview.schemes.UserColourScheme(\r
+        newColors);\r
+    String searchString = textfield.getText();\r
 \r
+    searchGroup = new SuperGroup(searchString, ucs, true, true, false);\r
 \r
-    for(int i=0; i<searchResults.size(); i+=3)\r
+    for (int i = 0; i < searchResults.size(); i += 3)\r
     {\r
       // its possible edits may have occurred since search was performed\r
       // account for this here\r
 \r
-      SequenceI seq = av.alignment.getSequenceAt( Integer.parseInt(searchResults.elementAt(i).toString()) );\r
-      int startRes = seq.findIndex( Integer.parseInt(searchResults.elementAt(i+1).toString()) )-1;\r
-      int endRes = seq.findIndex(   Integer.parseInt(searchResults.elementAt(i+2).toString()) )-1;\r
+      SequenceI seq = av.alignment.getSequenceAt(Integer.parseInt(searchResults.\r
+          elementAt(i).toString()));\r
+      int startRes = seq.findIndex(Integer.parseInt(searchResults.elementAt(i +\r
+          1).toString())) - 1;\r
+      int endRes = seq.findIndex(Integer.parseInt(searchResults.elementAt(i + 2).\r
+                                                  toString())) - 1;\r
 \r
-      SequenceGroup sg = new SequenceGroup(searchString, ucs, true, true, false, startRes , endRes  );\r
+      SequenceGroup sg = new SequenceGroup(searchString, ucs, true, true, false,\r
+                                           startRes, endRes);\r
       sg.addSequence(seq);\r
       av.alignment.addGroup(sg);\r
-      searchGroup.addGroup( sg );\r
+      searchGroup.addGroup(sg);\r
 \r
     }\r
 \r
     ap.av.alignment.addSuperGroup(searchGroup);\r
-    ap.highlightSearchResults( null );\r
+    ap.highlightSearchResults(null);\r
   }\r
 \r
-\r
   void doSearch(boolean findAll)\r
   {\r
     createNewGroup.setEnabled(false);\r
 \r
     String searchString = textfield.getText().toUpperCase();\r
 \r
-    com.stevesoft.pat.Regex regex = new  com.stevesoft.pat.Regex(searchString);\r
+    com.stevesoft.pat.Regex regex = new com.stevesoft.pat.Regex(searchString);\r
 \r
     searchResults = new Vector();\r
-    int [] allResults = null;\r
+    int[] allResults = null;\r
 \r
     Sequence seq;\r
-    String item=null;\r
+    String item = null;\r
     boolean found = false;\r
 \r
     ////// is the searchString a residue number?\r
-    try{\r
+    try\r
+    {\r
       int res = Integer.parseInt(searchString);\r
       found = true;\r
 \r
-      if(av.getSelectionGroup().getSize()>0)\r
-        seq = (Sequence)(av.getSelectionGroup().getSequenceAt(0));\r
+      if (av.getSelectionGroup().getSize() > 0)\r
+      {\r
+        seq = (Sequence) (av.getSelectionGroup().getSequenceAt(0));\r
+      }\r
       else\r
-        seq = (Sequence)av.getAlignment().getSequenceAt(0);\r
+      {\r
+        seq = (Sequence) av.getAlignment().getSequenceAt(0);\r
+      }\r
 \r
-      searchResults.addElement( Integer.toString( av.getAlignment().findIndex(seq) ) );\r
-      searchResults.addElement( Integer.toString( seq.findIndex(res)-1 ) );\r
-      searchResults.addElement( Integer.toString( seq.findIndex(res)-1 ) );\r
+      searchResults.addElement(Integer.toString(av.getAlignment().findIndex(seq)));\r
+      searchResults.addElement(Integer.toString(seq.findIndex(res) - 1));\r
+      searchResults.addElement(Integer.toString(seq.findIndex(res) - 1));\r
 \r
-    }catch(NumberFormatException ex){}\r
+    }\r
+    catch (NumberFormatException ex)\r
+    {}\r
     ///////////////////////////////////////////////\r
 \r
 \r
     int end = av.alignment.getHeight();\r
 \r
     SequenceGroup selection = av.getSelectionGroup();\r
-    if(selection!=null)\r
-     if(selection.getSize()<1 || (selection.getEndRes()-selection.getStartRes()<2))\r
-      selection = null;\r
-\r
-    while( !found && seqIndex<end)\r
+    if (selection != null)\r
     {\r
-      seq = (Sequence)av.alignment.getSequenceAt(seqIndex);\r
+      if (selection.getSize() < 1 ||\r
+          (selection.getEndRes() - selection.getStartRes() < 2))\r
+      {\r
+        selection = null;\r
+      }\r
+    }\r
 \r
+    while (!found && seqIndex < end)\r
+    {\r
+      seq = (Sequence) av.alignment.getSequenceAt(seqIndex);\r
 \r
-      if(selection!=null && !selection.sequences.contains(seq))\r
+      if (selection != null && !selection.sequences.contains(seq))\r
       {\r
         seqIndex++;\r
-        resIndex=0;\r
+        resIndex = 0;\r
         continue;\r
       }\r
 \r
       item = seq.getSequence().toUpperCase();\r
 \r
-      if(selection!=null && selection.getEndRes()<av.alignment.getWidth())\r
-          item = item.substring(0, selection.getEndRes()+1);\r
+      if (selection != null && selection.getEndRes() < av.alignment.getWidth())\r
+      {\r
+        item = item.substring(0, selection.getEndRes() + 1);\r
+      }\r
 \r
       ///Shall we ignore gaps????\r
       StringBuffer noGaps = new StringBuffer();\r
-      int insertCount=0;\r
+      int insertCount = 0;\r
       Vector spaces = new Vector();\r
 \r
-      for (int j=0; j < item.length(); j++)\r
+      for (int j = 0; j < item.length(); j++)\r
       {\r
 \r
-        if(!jalview.util.Comparison.isGap(item.charAt(j)))\r
-         {\r
-           noGaps.append(item.charAt(j));\r
-           spaces.addElement(new Integer(insertCount));\r
-         }\r
+        if (!jalview.util.Comparison.isGap(item.charAt(j)))\r
+        {\r
+          noGaps.append(item.charAt(j));\r
+          spaces.addElement(new Integer(insertCount));\r
+        }\r
         else\r
-           insertCount++;\r
+        {\r
+          insertCount++;\r
+        }\r
       }\r
 \r
-\r
-\r
-      for(int r = resIndex; r<noGaps.length(); r++)\r
+      for (int r = resIndex; r < noGaps.length(); r++)\r
       {\r
 \r
-       if( regex.searchFrom( noGaps.toString(), r ) )\r
-       {\r
-         resIndex = regex.matchedFrom();\r
-         if(selection!=null && ( resIndex+ Integer.parseInt(spaces.elementAt(resIndex).toString()) )<selection.getStartRes())\r
-           continue;\r
-\r
-         searchResults.addElement( Integer.toString( seqIndex) );\r
-         int sres = seq.findPosition( resIndex+ Integer.parseInt(spaces.elementAt(resIndex).toString()) );\r
-         int eres = seq.findPosition( regex.matchedTo()-1 + Integer.parseInt(spaces.elementAt(regex.matchedTo()-1).toString()) );\r
-          searchResults.addElement( sres+"" );\r
-          searchResults.addElement( eres+"" );\r
-\r
-\r
-         if(!findAll)\r
-         {\r
-           // thats enough, break and display the result\r
-           found = true;\r
-           resIndex++;\r
-           break;\r
-         }\r
-\r
-         r=resIndex;\r
-       }\r
+        if (regex.searchFrom(noGaps.toString(), r))\r
+        {\r
+          resIndex = regex.matchedFrom();\r
+          if (selection != null &&\r
+              (resIndex + Integer.parseInt(spaces.elementAt(resIndex).toString())) <\r
+              selection.getStartRes())\r
+          {\r
+            continue;\r
+          }\r
+\r
+          searchResults.addElement(Integer.toString(seqIndex));\r
+          int sres = seq.findPosition(resIndex +\r
+                                      Integer.parseInt(spaces.\r
+              elementAt(resIndex).toString()));\r
+          int eres = seq.findPosition(regex.matchedTo() - 1 +\r
+                                      Integer.parseInt(\r
+                                      spaces.elementAt(regex.matchedTo() - 1).\r
+                                      toString()));\r
+          searchResults.addElement(sres + "");\r
+          searchResults.addElement(eres + "");\r
+\r
+          if (!findAll)\r
+          {\r
+            // thats enough, break and display the result\r
+            found = true;\r
+            resIndex++;\r
+            break;\r
+          }\r
+\r
+          r = resIndex;\r
+        }\r
       }\r
-      if(!found)\r
+      if (!found)\r
       {\r
         seqIndex++;\r
         resIndex = 0;\r
       }\r
     }\r
 \r
-\r
     Vector idMatch = new Vector();\r
-    for(int id = 0; id<av.alignment.getHeight(); id++)\r
+    for (int id = 0; id < av.alignment.getHeight(); id++)\r
     {\r
-      if(   regex.search( av.alignment.getSequenceAt(id).getName() ) )\r
-        idMatch.addElement( av.alignment.getSequenceAt(id) );\r
+      if (regex.search(av.alignment.getSequenceAt(id).getName()))\r
+      {\r
+        idMatch.addElement(av.alignment.getSequenceAt(id));\r
+      }\r
     }\r
 \r
-    if(searchResults.size()==0 && idMatch.size()>0)\r
-      ap.idPanel.highlightSearchResults( idMatch );\r
-\r
+    if (searchResults.size() == 0 && idMatch.size() > 0)\r
+    {\r
+      ap.idPanel.highlightSearchResults(idMatch);\r
+    }\r
 \r
-    if(searchResults.size()>0)\r
+    if (searchResults.size() > 0)\r
     {\r
       allResults = new int[searchResults.size()];\r
-      for(int i=0; i<searchResults.size(); i++)\r
+      for (int i = 0; i < searchResults.size(); i++)\r
+      {\r
         allResults[i] = Integer.parseInt(searchResults.elementAt(i).toString());\r
+      }\r
 \r
       createNewGroup.setEnabled(true);\r
     }\r
     else\r
     {\r
-      resIndex=0;\r
-      seqIndex=0;\r
+      resIndex = 0;\r
+      seqIndex = 0;\r
     }\r
 \r
     // if allResults is null, this effectively switches displaySearch flag in seqCanvas\r
-    ap.highlightSearchResults( allResults );\r
+    ap.highlightSearchResults(allResults);\r
 \r
     if (findAll)\r
     {\r
-      String message =  (searchResults.size()/3) + " matches found.";\r
+      String message = (searchResults.size() / 3) + " matches found.";\r
       System.out.println(message);\r
     }\r
 \r
index eb29211..02a7471 100755 (executable)
@@ -1,31 +1,30 @@
 /*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 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
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 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 jalview.jbappletgui.GFontChooser;\r
-import jalview.appletgui.*;\r
 import java.awt.*;\r
-import java.awt.event.*;\r
 \r
+import jalview.jbappletgui.*;\r
 \r
-public class FontChooser extends GFontChooser\r
+public class FontChooser\r
+    extends GFontChooser\r
 {\r
   AlignmentPanel ap;\r
   Font oldFont;\r
@@ -40,29 +39,35 @@ public class FontChooser extends GFontChooser
 \r
     this.ap = ap;\r
     String fonts[] = Toolkit.getDefaultToolkit().getFontList();\r
-    for(int i=0; i<fonts.length; i++)\r
+    for (int i = 0; i < fonts.length; i++)\r
+    {\r
       fontName.addItem(fonts[i]);\r
+    }\r
 \r
-    for(int i=1; i<31; i++)\r
-      fontSize.addItem(i+"");\r
+    for (int i = 1; i < 31; i++)\r
+    {\r
+      fontSize.addItem(i + "");\r
+    }\r
 \r
-   fontStyle.addItem("plain");\r
-   fontStyle.addItem("bold");\r
-   fontStyle.addItem("italic");\r
+    fontStyle.addItem("plain");\r
+    fontStyle.addItem("bold");\r
+    fontStyle.addItem("italic");\r
 \r
-   oldFont = ap.av.getFont();\r
-   fontName.select(oldFont.getName());\r
-   fontSize.select(oldFont.getSize()+"");\r
-   fontStyle.select(oldFont.getStyle());\r
+    oldFont = ap.av.getFont();\r
+    fontName.select(oldFont.getName());\r
+    fontSize.select(oldFont.getSize() + "");\r
+    fontStyle.select(oldFont.getStyle());\r
 \r
-   init = false;\r
+    init = false;\r
   }\r
 \r
   protected void ok_actionPerformed()\r
   {\r
-      frame.setVisible(false);\r
-   if(ap.getOverviewPanel()!=null)\r
-     ap.getOverviewPanel().updateOverviewImage();\r
+    frame.setVisible(false);\r
+    if (ap.getOverviewPanel() != null)\r
+    {\r
+      ap.getOverviewPanel().updateOverviewImage();\r
+    }\r
   }\r
 \r
   protected void cancel_actionPerformed()\r
@@ -70,7 +75,7 @@ public class FontChooser extends GFontChooser
     ap.av.setFont(oldFont);\r
     ap.repaint();\r
     fontName.select(oldFont.getName());\r
-    fontSize.select(oldFont.getSize()+"");\r
+    fontSize.select(oldFont.getSize() + "");\r
     fontStyle.select(oldFont.getStyle());\r
 \r
     frame.setVisible(false);\r
@@ -80,28 +85,37 @@ public class FontChooser extends GFontChooser
   {\r
     Font newFont = new Font(fontName.getSelectedItem().toString(),\r
                             fontStyle.getSelectedIndex(),\r
-                            Integer.parseInt(fontSize.getSelectedItem().toString())\r
-                            );\r
+                            Integer.parseInt(fontSize.getSelectedItem().\r
+                                             toString())\r
+        );\r
     ap.av.setFont(newFont);\r
     ap.fontChanged();\r
   }\r
 \r
-\r
   protected void fontName_actionPerformed()\r
   {\r
-    if(init) return;\r
+    if (init)\r
+    {\r
+      return;\r
+    }\r
     changeFont();\r
   }\r
 \r
   protected void fontSize_actionPerformed()\r
   {\r
-    if(init) return;\r
+    if (init)\r
+    {\r
+      return;\r
+    }\r
     changeFont();\r
   }\r
 \r
   protected void fontStyle_actionPerformed()\r
   {\r
-    if(init) return;\r
+    if (init)\r
+    {\r
+      return;\r
+    }\r
     changeFont();\r
   }\r
 \r
index 5b7aa1e..3c3c52c 100755 (executable)
@@ -1,38 +1,41 @@
 /*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 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
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
+ */\r
 \r
 package jalview.appletgui;\r
 \r
 import java.awt.*;\r
-import jalview.datamodel.*;\r
+\r
 import jalview.analysis.*;\r
-public class IdCanvas extends Panel\r
+import jalview.datamodel.*;\r
+\r
+public class IdCanvas\r
+    extends Panel\r
 {\r
   protected AlignViewport av;\r
 \r
-  protected boolean showScores  = true;\r
+  protected boolean showScores = true;\r
 \r
-  protected int     maxIdLength = -1;\r
-  protected String  maxIdStr    = null;\r
+  protected int maxIdLength = -1;\r
+  protected String maxIdStr = null;\r
   Image image;\r
   Graphics gg;\r
-  int imgHeight=0;\r
+  int imgHeight = 0;\r
   boolean fastPaint = false;\r
 \r
   java.util.Vector searchResults;\r
@@ -40,81 +43,103 @@ public class IdCanvas extends Panel
   public IdCanvas(AlignViewport av)\r
   {\r
     setLayout(null);\r
-    this.av         = av;\r
+    this.av = av;\r
     PaintRefresher.Register(this);\r
   }\r
 \r
-  public void drawIdString(Graphics gg,SequenceI s,int i, int starty, int ypos) {\r
-      int charHeight = av.getCharHeight();\r
+  public void drawIdString(Graphics gg, SequenceI s, int i, int starty,\r
+                           int ypos)\r
+  {\r
+    int charHeight = av.getCharHeight();\r
 \r
-      if(searchResults!=null && searchResults.contains(s))\r
-      {\r
-        gg.setColor(Color.black);\r
-        gg.fillRect(0,AlignmentUtil.getPixelHeight(starty,i,charHeight)+ ypos,getSize().width,charHeight);\r
-        gg.setColor(Color.white);\r
-      }\r
-      else if (av.getSelectionGroup()!=null && av.getSelectionGroup().sequences.contains(s)) {\r
-         gg.setColor(Color.lightGray);\r
-         gg.fillRect(0,AlignmentUtil.getPixelHeight(starty,i,charHeight)+ ypos,getSize().width,charHeight);\r
-         gg.setColor(Color.white);\r
-      } else {\r
-         gg.setColor(s.getColor());\r
-         gg.fillRect(0,AlignmentUtil.getPixelHeight(starty,i,charHeight)+ ypos,getSize().width,charHeight);\r
-         gg.setColor(Color.black);\r
-      }\r
+    if (searchResults != null && searchResults.contains(s))\r
+    {\r
+      gg.setColor(Color.black);\r
+      gg.fillRect(0, AlignmentUtil.getPixelHeight(starty, i, charHeight) + ypos,\r
+                  getSize().width, charHeight);\r
+      gg.setColor(Color.white);\r
+    }\r
+    else if (av.getSelectionGroup() != null &&\r
+             av.getSelectionGroup().sequences.contains(s))\r
+    {\r
+      gg.setColor(Color.lightGray);\r
+      gg.fillRect(0, AlignmentUtil.getPixelHeight(starty, i, charHeight) + ypos,\r
+                  getSize().width, charHeight);\r
+      gg.setColor(Color.white);\r
+    }\r
+    else\r
+    {\r
+      gg.setColor(s.getColor());\r
+      gg.fillRect(0, AlignmentUtil.getPixelHeight(starty, i, charHeight) + ypos,\r
+                  getSize().width, charHeight);\r
+      gg.setColor(Color.black);\r
+    }\r
 \r
-      String string = s.getName();\r
-      if(av.getShowFullId())\r
-        string = s.getDisplayId();\r
+    String string = s.getName();\r
+    if (av.getShowFullId())\r
+    {\r
+      string = s.getDisplayId();\r
+    }\r
 \r
-      gg.drawString(string,0,AlignmentUtil.getPixelHeight(starty,i,charHeight) + ypos + charHeight-   (charHeight/5));\r
+    gg.drawString(string, 0,\r
+                  AlignmentUtil.getPixelHeight(starty, i, charHeight) + ypos +\r
+                  charHeight - (charHeight / 5));\r
 \r
   }\r
 \r
   public void fastPaint(int vertical)\r
   {\r
-    if(gg==null)\r
-    {  repaint(); return;}\r
+    if (gg == null)\r
+    {\r
+      repaint();\r
+      return;\r
+    }\r
 \r
-    gg.copyArea( 0,0, getSize().width, imgHeight, 0, -vertical*av.charHeight );\r
+    gg.copyArea(0, 0, getSize().width, imgHeight, 0, -vertical * av.charHeight);\r
 \r
-    int ss=av.startSeq, es=av.endSeq, transY = 0;\r
+    int ss = av.startSeq, es = av.endSeq, transY = 0;\r
     if (vertical > 0) // scroll down\r
-     {\r
-       ss = es - vertical;\r
-       if(ss<av.startSeq) // ie scrolling too fast, more than a page at a time\r
-         ss = av.startSeq;\r
-       else\r
-         transY = imgHeight - vertical * av.charHeight;\r
-     }\r
-     else if (vertical < 0)\r
-     {\r
-       es = ss - vertical;\r
-       if(es > av.endSeq)\r
-         es = av.endSeq;\r
-     }\r
-\r
-\r
-\r
-        gg.translate(0, transY);\r
+    {\r
+      ss = es - vertical;\r
+      if (ss < av.startSeq) // ie scrolling too fast, more than a page at a time\r
+      {\r
+        ss = av.startSeq;\r
+      }\r
+      else\r
+      {\r
+        transY = imgHeight - vertical * av.charHeight;\r
+      }\r
+    }\r
+    else if (vertical < 0)\r
+    {\r
+      es = ss - vertical;\r
+      if (es > av.endSeq)\r
+      {\r
+        es = av.endSeq;\r
+      }\r
+    }\r
 \r
-        drawIds(ss, es);\r
+    gg.translate(0, transY);\r
 \r
-        gg.translate( 0, -transY );\r
+    drawIds(ss, es);\r
 \r
+    gg.translate(0, -transY);\r
 \r
-      fastPaint = true;\r
-      repaint();\r
+    fastPaint = true;\r
+    repaint();\r
   }\r
 \r
   public void update(Graphics g)\r
   {\r
     paint(g);\r
   }\r
+\r
   public void paint(Graphics g)\r
   {\r
-    if(getSize().height<0 || getSize().width<0)\r
+    if (getSize().height < 0 || getSize().width < 0)\r
+    {\r
       return;\r
+    }\r
     if (fastPaint)\r
     {\r
       fastPaint = false;\r
@@ -125,51 +150,53 @@ public class IdCanvas extends Panel
     imgHeight = getSize().height;\r
     imgHeight -= imgHeight % av.charHeight;\r
 \r
-    if (imgHeight<1)\r
+    if (imgHeight < 1)\r
+    {\r
       return;\r
+    }\r
 \r
-    if(image==null || imgHeight!=image.getHeight(this))\r
+    if (image == null || imgHeight != image.getHeight(this))\r
     {\r
       image = createImage(getSize().width, imgHeight);\r
       gg = image.getGraphics();\r
       gg.setFont(av.getFont());\r
     }\r
 \r
-      //Fill in the background\r
-      gg.setColor(Color.white);\r
-      Font italic = new Font(av.getFont().getName(), Font.ITALIC,\r
+    //Fill in the background\r
+    gg.setColor(Color.white);\r
+    Font italic = new Font(av.getFont().getName(), Font.ITALIC,\r
                            av.getFont().getSize());\r
-      gg.setFont(italic);\r
+    gg.setFont(italic);\r
 \r
     gg.fillRect(0, 0, getSize().width, getSize().height);\r
-    drawIds( av.getStartSeq(), av.endSeq);\r
+    drawIds(av.getStartSeq(), av.endSeq);\r
     g.drawImage(image, 0, 0, this);\r
   }\r
 \r
   void drawIds(int starty, int endy)\r
   {\r
-    Color currentColor     = Color.white;\r
+    Color currentColor = Color.white;\r
     Color currentTextColor = Color.black;\r
 \r
     if (av.getWrapAlignment())\r
     {\r
 \r
-          int rowSize =  av.getEndRes() - av.getStartRes();\r
-          // Draw the rest of the panels\r
-\r
-          for(int ypos=2*av.charHeight, row=av.startRes;\r
-              ypos <= getSize().height && row<av.alignment.getWidth();\r
-              ypos += av.chunkHeight, row+=rowSize )\r
-          {\r
-            for (int i = starty; i < av.alignment.getHeight(); i++)\r
-            {\r
-              SequenceI s = av.alignment.getSequenceAt(i);\r
-              drawIdString(gg, s, i, 0, ypos);\r
-            }\r
-          }\r
+      int rowSize = av.getEndRes() - av.getStartRes();\r
+      // Draw the rest of the panels\r
 \r
+      for (int ypos = 2 * av.charHeight, row = av.startRes;\r
+           ypos <= getSize().height && row < av.alignment.getWidth();\r
+           ypos += av.chunkHeight, row += rowSize)\r
+      {\r
+        for (int i = starty; i < av.alignment.getHeight(); i++)\r
+        {\r
+          SequenceI s = av.alignment.getSequenceAt(i);\r
+          drawIdString(gg, s, i, 0, ypos);\r
+        }\r
+      }\r
 \r
-    } else\r
+    }\r
+    else\r
     {\r
 \r
       //Now draw the id strings\r
@@ -177,14 +204,17 @@ public class IdCanvas extends Panel
       {\r
         // Selected sequence colours\r
 \r
-        if(searchResults!=null && searchResults.contains(av.alignment.getSequenceAt(i)))\r
+        if (searchResults != null &&\r
+            searchResults.contains(av.alignment.getSequenceAt(i)))\r
         {\r
           gg.setColor(Color.black);\r
           currentColor = Color.black;\r
           currentTextColor = Color.white;\r
-      }\r
-      else if (av.getSelectionGroup()!= null\r
-            && av.getSelectionGroup().sequences.contains(av.alignment.getSequenceAt(i)))\r
+        }\r
+        else if (av.getSelectionGroup() != null\r
+                 &&\r
+                 av.getSelectionGroup().sequences.contains(av.alignment.\r
+            getSequenceAt(i)))\r
         {\r
           currentColor = Color.lightGray;\r
           currentTextColor = Color.black;\r
@@ -204,8 +234,10 @@ public class IdCanvas extends Panel
 \r
         gg.setColor(currentTextColor);\r
         String string = av.alignment.getSequenceAt(i).getName();\r
-        if(av.getShowFullId())\r
+        if (av.getShowFullId())\r
+        {\r
           string = av.alignment.getSequenceAt(i).getDisplayId();\r
+        }\r
         gg.drawString(string, 0,\r
                       AlignmentUtil.getPixelHeight(starty, i, av.charHeight) +\r
                       av.charHeight - (av.charHeight / 5));\r
@@ -213,7 +245,7 @@ public class IdCanvas extends Panel
 \r
       // add a border\r
       gg.setColor(Color.white);\r
-      gg.fillRect(getSize().width-4,0,4,getSize().height);\r
+      gg.fillRect(getSize().width - 4, 0, 4, getSize().height);\r
     }\r
 \r
   }\r
index 4998360..39fab0a 100755 (executable)
@@ -1,21 +1,21 @@
 /*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 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
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 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
@@ -24,21 +24,23 @@ import java.awt.event.*;
 \r
 import jalview.datamodel.*;\r
 \r
-public class IdPanel extends Panel implements MouseListener, MouseMotionListener {\r
+public class IdPanel\r
+    extends Panel implements MouseListener, MouseMotionListener\r
+{\r
 \r
-  protected IdCanvas       idCanvas;\r
-  protected AlignViewport  av;\r
+  protected IdCanvas idCanvas;\r
+  protected AlignViewport av;\r
   protected AlignmentPanel alignPanel;\r
   ScrollThread scrollThread = null;\r
 \r
-  int            offy;\r
-  int            width;\r
+  int offy;\r
+  int width;\r
   int lastid = -1;\r
   boolean mouseDragging = false;\r
 \r
   public IdPanel(AlignViewport av, AlignmentPanel parent)\r
   {\r
-    this.av         = av;\r
+    this.av = av;\r
     alignPanel = parent;\r
     idCanvas = new IdCanvas(av);\r
     setLayout(new BorderLayout());\r
@@ -47,24 +49,33 @@ public class IdPanel extends Panel implements MouseListener, MouseMotionListener
     idCanvas.addMouseMotionListener(this);\r
   }\r
 \r
-  public void mouseMoved(MouseEvent e) {}\r
+  public void mouseMoved(MouseEvent e)\r
+  {}\r
 \r
-\r
-  public void mouseDragged(MouseEvent e) {\r
+  public void mouseDragged(MouseEvent e)\r
+  {\r
     mouseDragging = true;\r
 \r
     int y = e.getY();\r
-    if(av.getWrapAlignment())\r
-      y-=2*av.charHeight;\r
+    if (av.getWrapAlignment())\r
+    {\r
+      y -= 2 * av.charHeight;\r
+    }\r
     int seq = av.getIndex(y);\r
 \r
-    if(seq<0)\r
+    if (seq < 0)\r
+    {\r
       return;\r
+    }\r
 \r
     if (seq < lastid)\r
+    {\r
       selectSeqs(lastid - 1, seq);\r
+    }\r
     else if (seq > lastid)\r
+    {\r
       selectSeqs(lastid + 1, seq);\r
+    }\r
 \r
     lastid = seq;\r
     alignPanel.repaint();\r
@@ -74,57 +85,77 @@ public class IdPanel extends Panel implements MouseListener, MouseMotionListener
   {\r
     if (e.getClickCount() == 2)\r
     {\r
-       int y = e.getY();\r
-       if(av.getWrapAlignment())\r
-         y-=2*av.charHeight;\r
-\r
-       int seq = av.getIndex(y);\r
-       String id = av.getAlignment().getSequenceAt(seq).getName();\r
-\r
-       try{\r
-         jalview.bin.JalviewLite.showURL(\r
-             "http://srs.ebi.ac.uk/srs7bin/cgi-bin/wgetz?-e+[swall-id:" + id +\r
-             "]+-vn+2");\r
-       }catch(Exception ex){ex.printStackTrace();}\r
+      int y = e.getY();\r
+      if (av.getWrapAlignment())\r
+      {\r
+        y -= 2 * av.charHeight;\r
+      }\r
+\r
+      int seq = av.getIndex(y);\r
+      String id = av.getAlignment().getSequenceAt(seq).getName();\r
+\r
+      try\r
+      {\r
+        jalview.bin.JalviewLite.showURL(\r
+            "http://srs.ebi.ac.uk/srs7bin/cgi-bin/wgetz?-e+[swall-id:" + id +\r
+            "]+-vn+2");\r
+      }\r
+      catch (Exception ex)\r
+      {\r
+        ex.printStackTrace();\r
+      }\r
     }\r
 \r
   }\r
+\r
   public void mouseEntered(MouseEvent e)\r
   {\r
-    if(scrollThread!=null)\r
+    if (scrollThread != null)\r
+    {\r
       scrollThread.running = false;\r
+    }\r
   }\r
 \r
-  public void mouseExited (MouseEvent e)\r
+  public void mouseExited(MouseEvent e)\r
   {\r
-    if(av.getWrapAlignment())\r
+    if (av.getWrapAlignment())\r
+    {\r
       return;\r
+    }\r
 \r
-    if(mouseDragging && e.getY()<0 && av.getStartSeq()>0)\r
+    if (mouseDragging && e.getY() < 0 && av.getStartSeq() > 0)\r
     {\r
       scrollThread = new ScrollThread(true);\r
     }\r
 \r
-    if(mouseDragging && e.getY()>=getSize().height && av.alignment.getHeight()>av.getEndSeq())\r
+    if (mouseDragging && e.getY() >= getSize().height &&\r
+        av.alignment.getHeight() > av.getEndSeq())\r
     {\r
       scrollThread = new ScrollThread(false);\r
     }\r
   }\r
 \r
-\r
-  public void mousePressed(MouseEvent e) {\r
+  public void mousePressed(MouseEvent e)\r
+  {\r
     if (e.getClickCount() == 2)\r
+    {\r
       return;\r
+    }\r
 \r
     int y = e.getY();\r
-    if(av.getWrapAlignment())\r
-      y-=2*av.charHeight;\r
+    if (av.getWrapAlignment())\r
+    {\r
+      y -= 2 * av.charHeight;\r
+    }\r
 \r
     int seq = av.getIndex(y);\r
     if (seq == -1)\r
+    {\r
       return;\r
+    }\r
 \r
-    if ( (e.getModifiers() & InputEvent.BUTTON3_MASK) == InputEvent.BUTTON3_MASK)\r
+    if ( (e.getModifiers() & InputEvent.BUTTON3_MASK) ==\r
+        InputEvent.BUTTON3_MASK)\r
     {\r
       APopupMenu popup = new APopupMenu(alignPanel, null);\r
       this.add(popup);\r
@@ -132,31 +163,40 @@ public class IdPanel extends Panel implements MouseListener, MouseMotionListener
       return;\r
     }\r
 \r
-\r
-    if(!e.isControlDown() && !e.isShiftDown() && av.alignment.findGroup( av.alignment.getSequenceAt(seq))!=null)\r
+    if (!e.isControlDown() && !e.isShiftDown() &&\r
+        av.alignment.findGroup(av.alignment.getSequenceAt(seq)) != null)\r
     {\r
 \r
       SequenceGroup selection = new SequenceGroup();\r
       SequenceGroup sg = av.alignment.findGroup(av.alignment.getSequenceAt(seq));\r
       selection.setStartRes(0);\r
-      selection.setEndRes(av.alignment.getWidth()-1);\r
-      for (int i =0; i< sg.getSize(); i++)\r
+      selection.setEndRes(av.alignment.getWidth() - 1);\r
+      for (int i = 0; i < sg.getSize(); i++)\r
+      {\r
         selection.addSequence(sg.getSequenceAt(i));\r
+      }\r
 \r
       av.setSelectionGroup(selection);\r
       return;\r
     }\r
 \r
-    if(av.getSelectionGroup()==null || ( !e.isControlDown() && av.getSelectionGroup()!=null))\r
+    if (av.getSelectionGroup() == null ||\r
+        (!e.isControlDown() && av.getSelectionGroup() != null))\r
+    {\r
       av.setSelectionGroup(new SequenceGroup());\r
+    }\r
 \r
     av.getSelectionGroup().setStartRes(0);\r
-    av.getSelectionGroup().setEndRes(av.alignment.getWidth()-1);\r
+    av.getSelectionGroup().setEndRes(av.alignment.getWidth() - 1);\r
 \r
-    if(e.isShiftDown() && lastid!=-1)\r
+    if (e.isShiftDown() && lastid != -1)\r
+    {\r
       selectSeqs(lastid, seq);\r
+    }\r
     else\r
+    {\r
       selectSeq(seq);\r
+    }\r
 \r
     alignPanel.repaint();\r
   }\r
@@ -168,44 +208,52 @@ public class IdPanel extends Panel implements MouseListener, MouseMotionListener
     av.getSelectionGroup().addOrRemove(pickedSeq);\r
   }\r
 \r
-  void selectSeqs(int start, int end) {\r
+  void selectSeqs(int start, int end)\r
+  {\r
 \r
     lastid = start;\r
     if (end < start)\r
-     {\r
-       int tmp = start;\r
-       start = end;\r
-       end   = tmp;\r
-       lastid = end;\r
-     }\r
-\r
-     for (int i = start; i <= end; i++)\r
-        av.getSelectionGroup().addSequence(av.getAlignment().getSequenceAt(i));\r
+    {\r
+      int tmp = start;\r
+      start = end;\r
+      end = tmp;\r
+      lastid = end;\r
+    }\r
 \r
-   }\r
+    for (int i = start; i <= end; i++)\r
+    {\r
+      av.getSelectionGroup().addSequence(av.getAlignment().getSequenceAt(i));\r
+    }\r
 \r
+  }\r
 \r
   public void mouseReleased(MouseEvent e)\r
   {\r
-    if(scrollThread!=null)\r
+    if (scrollThread != null)\r
+    {\r
       scrollThread.running = false;\r
+    }\r
 \r
     mouseDragging = false;\r
     PaintRefresher.Refresh(this);\r
   }\r
 \r
-  public void highlightSearchResults( java.util.Vector found )\r
+  public void highlightSearchResults(java.util.Vector found)\r
   {\r
-    idCanvas.setHighlighted( found );\r
+    idCanvas.setHighlighted(found);\r
 \r
-    if(found == null)\r
+    if (found == null)\r
+    {\r
       return;\r
+    }\r
 \r
-    int index = av.alignment.findIndex( (SequenceI)found.elementAt(0));\r
+    int index = av.alignment.findIndex( (SequenceI) found.elementAt(0));\r
 \r
     // do we need to scroll the panel?\r
-    if(av.getStartSeq()>index || av.getEndSeq()<index)\r
-        alignPanel.setScrollValues( av.getStartRes(), index);\r
+    if (av.getStartSeq() > index || av.getEndSeq() < index)\r
+    {\r
+      alignPanel.setScrollValues(av.getStartRes(), index);\r
+    }\r
   }\r
 \r
   // this class allows scrolling off the bottom of the visible alignment\r
@@ -230,22 +278,30 @@ public class IdPanel extends Panel implements MouseListener, MouseMotionListener
       running = true;\r
       while (running)\r
       {\r
-        if(alignPanel.scrollUp(up))\r
+        if (alignPanel.scrollUp(up))\r
         {\r
           // scroll was ok, so add new sequence to selection\r
           int seq = av.getStartSeq();\r
-          if(!up)\r
+          if (!up)\r
+          {\r
             seq = av.getEndSeq();\r
+          }\r
 \r
           if (seq < lastid)\r
+          {\r
             selectSeqs(lastid - 1, seq);\r
+          }\r
           else if (seq > lastid)\r
+          {\r
             selectSeqs(lastid + 1, seq);\r
+          }\r
 \r
           lastid = seq;\r
         }\r
         else\r
+        {\r
           running = false;\r
+        }\r
 \r
         alignPanel.repaint();\r
         try\r
@@ -256,6 +312,6 @@ public class IdPanel extends Panel implements MouseListener, MouseMotionListener
         {}\r
       }\r
     }\r
-}\r
+  }\r
 \r
 }\r
index 5e5df30..5b4de85 100755 (executable)
 /*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 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
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
+ */\r
 \r
 package jalview.appletgui;\r
 \r
-import java.awt.event.*;\r
 import java.awt.*;\r
+import java.awt.event.*;\r
 \r
-\r
-public class IdwidthAdjuster extends Panel implements MouseListener, MouseMotionListener\r
+public class IdwidthAdjuster\r
+    extends Panel implements MouseListener, MouseMotionListener\r
 {\r
   boolean active = false;\r
-  int oldX=0;\r
+  int oldX = 0;\r
   Image image;\r
-  AlignmentPanel ap ;\r
+  AlignmentPanel ap;\r
 \r
   public IdwidthAdjuster(AlignmentPanel ap)\r
   {\r
     setLayout(null);\r
     this.ap = ap;\r
     java.net.URL url = getClass().getResource("/images/idwidth.gif");\r
-       if (url != null)\r
-         image = java.awt.Toolkit.getDefaultToolkit().getImage(url);\r
+    if (url != null)\r
+    {\r
+      image = java.awt.Toolkit.getDefaultToolkit().getImage(url);\r
+    }\r
 \r
     addMouseListener(this);\r
     addMouseMotionListener(this);\r
   }\r
 \r
   public void mousePressed(MouseEvent evt)\r
-  { oldX = evt.getX(); }\r
+  {\r
+    oldX = evt.getX();\r
+  }\r
+\r
+  public void mouseReleased(MouseEvent evt)\r
+  {\r
+    active = false;\r
+    repaint();\r
+  }\r
+\r
+  public void mouseEntered(MouseEvent evt)\r
+  {\r
+    active = true;\r
+    repaint();\r
+  }\r
+\r
+  public void mouseExited(MouseEvent evt)\r
+  {\r
+    active = false;\r
+    repaint();\r
+  }\r
 \r
-  public void mouseReleased(MouseEvent evt){ active = false; repaint(); }\r
-  public void mouseEntered(MouseEvent evt) { active = true;  repaint();}\r
-  public void mouseExited(MouseEvent evt)  { active = false; repaint();}\r
   public void mouseDragged(MouseEvent evt)\r
   {\r
     active = true;\r
     Dimension d = ap.idPanel.idCanvas.getSize();\r
     int dif = evt.getX() - oldX;\r
 \r
-    if(d.width+dif>20 || dif>0)\r
+    if (d.width + dif > 20 || dif > 0)\r
     {\r
-      ap.setIdWidth(d.width + dif,d.height);\r
+      ap.setIdWidth(d.width + dif, d.height);\r
       this.setSize(d.width + dif, getSize().height);\r
     }\r
 \r
     oldX = evt.getX();\r
   }\r
 \r
-  public void mouseMoved(MouseEvent evt)   {}\r
-  public void mouseClicked(MouseEvent evt) {}\r
+  public void mouseMoved(MouseEvent evt)\r
+  {}\r
+\r
+  public void mouseClicked(MouseEvent evt)\r
+  {}\r
 \r
   public void paint(Graphics g)\r
   {\r
     g.setColor(Color.white);\r
-    g.fillRect(0,0, getSize().width, getSize().height);\r
-    if(active)\r
+    g.fillRect(0, 0, getSize().width, getSize().height);\r
+    if (active)\r
     {\r
-      if(image!=null)\r
-        g.drawImage(image, getSize().width-20, 2, this);\r
+      if (image != null)\r
+      {\r
+        g.drawImage(image, getSize().width - 20, 2, this);\r
+      }\r
     }\r
   }\r
 \r
index 97f8147..d02892b 100755 (executable)
@@ -1,28 +1,29 @@
 /*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 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
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
+ */\r
 \r
 package jalview.appletgui;\r
 \r
-import java.awt.event.*;\r
 import java.awt.*;\r
+import java.awt.event.*;\r
 \r
-public class OverviewPanel extends Panel implements Runnable\r
+public class OverviewPanel\r
+    extends Panel implements Runnable\r
 {\r
   Image miniMe;\r
   AlignViewport av;\r
@@ -31,8 +32,8 @@ public class OverviewPanel extends Panel implements Runnable
   float scaleh = 1f;\r
 \r
   public int width, sequencesHeight;\r
-  int graphHeight=30;\r
-  int boxX=-1, boxY=-1, boxWidth=-1, boxHeight=-1;\r
+  int graphHeight = 30;\r
+  int boxX = -1, boxY = -1, boxWidth = -1, boxHeight = -1;\r
 \r
   boolean resizing = false;\r
 \r
@@ -47,47 +48,58 @@ public class OverviewPanel extends Panel implements Runnable
     nullFrame.addNotify();\r
 \r
     // scale the initial size of overviewpanel to shape of alignment\r
-    float initialScale = (float)av.alignment.getWidth()/(float)av.alignment.getHeight();\r
-    if(av.alignment.getWidth() > av.alignment.getHeight())\r
+    float initialScale = (float) av.alignment.getWidth() /\r
+        (float) av.alignment.getHeight();\r
+    if (av.alignment.getWidth() > av.alignment.getHeight())\r
     {\r
       // wider\r
       width = 400;\r
-      sequencesHeight = (int)(400f/initialScale);\r
+      sequencesHeight = (int) (400f / initialScale);\r
     }\r
     else\r
     {\r
       // taller\r
-      width = (int)(400f*initialScale);\r
+      width = (int) (400f * initialScale);\r
       sequencesHeight = 300;\r
-      if(width<120)\r
+      if (width < 120)\r
+      {\r
         width = 120;\r
+      }\r
     }\r
 \r
-    setSize (new Dimension(width, sequencesHeight+graphHeight));\r
+    setSize(new Dimension(width, sequencesHeight + graphHeight));\r
     addComponentListener(new ComponentAdapter()\r
-   {\r
+    {\r
 \r
-       public void componentResized(ComponentEvent evt)\r
-       {\r
-         if( getSize().width!=width || getSize().height!=sequencesHeight+graphHeight)\r
-         {\r
-           updateOverviewImage();\r
-         }\r
-       }\r
-   });\r
+      public void componentResized(ComponentEvent evt)\r
+      {\r
+        if (getSize().width != width ||\r
+            getSize().height != sequencesHeight + graphHeight)\r
+        {\r
+          updateOverviewImage();\r
+        }\r
+      }\r
+    });\r
 \r
     addMouseMotionListener(new MouseMotionAdapter()\r
-           {\r
-             public void mouseDragged(MouseEvent evt)\r
-             { doMouseDragged(evt);}\r
-           });\r
+    {\r
+      public void mouseDragged(MouseEvent evt)\r
+      {\r
+        doMouseDragged(evt);\r
+      }\r
+    });\r
 \r
     addMouseListener(new MouseAdapter()\r
     {\r
       public void mousePressed(MouseEvent evt)\r
-      { doMousePressed(evt);}\r
+      {\r
+        doMousePressed(evt);\r
+      }\r
+\r
       public void mouseReleased(MouseEvent evt)\r
-      { doMouseReleased(evt);}\r
+      {\r
+        doMouseReleased(evt);\r
+      }\r
     });\r
 \r
     updateOverviewImage();\r
@@ -108,9 +120,11 @@ public class OverviewPanel extends Panel implements Runnable
     boxX = evt.getX();\r
     boxY = evt.getY();\r
     checkValid();\r
-    if(!resizing)\r
-    ap.setScrollValues( (int)(boxX/scalew/av.getCharWidth()),\r
-                        (int)(boxY/scaleh/av.getCharHeight()) );\r
+    if (!resizing)\r
+    {\r
+      ap.setScrollValues( (int) (boxX / scalew / av.getCharWidth()),\r
+                         (int) (boxY / scaleh / av.getCharHeight()));\r
+    }\r
   }\r
 \r
   public void doMouseDragged(MouseEvent evt)\r
@@ -118,9 +132,11 @@ public class OverviewPanel extends Panel implements Runnable
     boxX = evt.getX();\r
     boxY = evt.getY();\r
     checkValid();\r
-    if(!resizing)\r
-    ap.setScrollValues( (int)(boxX/scalew/av.getCharWidth()),\r
-                        (int)(boxY/scaleh/av.getCharHeight()) );\r
+    if (!resizing)\r
+    {\r
+      ap.setScrollValues( (int) (boxX / scalew / av.getCharWidth()),\r
+                         (int) (boxY / scaleh / av.getCharHeight()));\r
+    }\r
     repaint();\r
     ap.repaint();\r
   }\r
@@ -128,21 +144,29 @@ public class OverviewPanel extends Panel implements Runnable
   void checkValid()\r
   {\r
     if (boxY < 0)\r
+    {\r
       boxY = 0;\r
+    }\r
 \r
     if (boxY > sequencesHeight - boxHeight)\r
-      boxY = sequencesHeight - boxHeight+1;\r
+    {\r
+      boxY = sequencesHeight - boxHeight + 1;\r
+    }\r
 \r
     if (boxX < 0)\r
+    {\r
       boxX = 0;\r
+    }\r
 \r
     if (boxX > width - boxWidth)\r
+    {\r
       boxX = width - boxWidth;\r
+    }\r
   }\r
 \r
   public void updateOverviewImage()\r
   {\r
-    if(resizing)\r
+    if (resizing)\r
     {\r
       return;\r
     }\r
@@ -159,15 +183,15 @@ public class OverviewPanel extends Panel implements Runnable
     int alwidth = av.alignment.getWidth();\r
     int alheight = av.alignment.getHeight();\r
 \r
-    if(getSize().width>0 && getSize().height>0)\r
+    if (getSize().width > 0 && getSize().height > 0)\r
     {\r
       width = getSize().width;\r
       sequencesHeight = getSize().height - graphHeight;\r
     }\r
 \r
-    setSize (new Dimension(width, sequencesHeight+graphHeight));\r
+    setSize(new Dimension(width, sequencesHeight + graphHeight));\r
 \r
-    int fullsizeWidth  = alwidth * av.getCharWidth();\r
+    int fullsizeWidth = alwidth * av.getCharWidth();\r
     int fullsizeHeight = alheight * av.getCharHeight();\r
 \r
     scalew = (float) width / (float) fullsizeWidth;\r
@@ -180,62 +204,72 @@ public class OverviewPanel extends Panel implements Runnable
     Graphics g = consensus.getGraphics();\r
     ap.annotationPanel.drawGraph(g, av.conservation, fullsizeWidth, 60);\r
     mg.drawImage(consensus, 0, sequencesHeight, width,\r
-             sequencesHeight + graphHeight, 0, 0, fullsizeWidth, 60, this);\r
-\r
+                 sequencesHeight + graphHeight, 0, 0, fullsizeWidth, 60, this);\r
 \r
     boolean oldRenderGaps = av.renderGaps;\r
-    try{\r
-    // We'll have to draw the full size alignment in chunks, as an image of the\r
-    // whole alignment requires too much memory\r
+    try\r
+    {\r
+      // We'll have to draw the full size alignment in chunks, as an image of the\r
+      // whole alignment requires too much memory\r
 \r
       // Max size depends on the font size, the following is a\r
       // guess at a size which works\r
-      int maxSize = 2000 /  av.getFont().getSize();\r
+      int maxSize = 2000 / av.getFont().getSize();\r
       Image block;\r
-      int blockx=0, blocky=0, blockw=0, blockh=0, eRes=0, eSeq=0;\r
+      int blockx = 0, blocky = 0, blockw = 0, blockh = 0, eRes = 0, eSeq = 0;\r
 \r
       av.setRenderGaps(false);\r
-      for(int sRes=0, chunkx=0; sRes<alwidth; sRes+=maxSize, chunkx++)\r
+      for (int sRes = 0, chunkx = 0; sRes < alwidth; sRes += maxSize, chunkx++)\r
       {\r
-          eSeq = 0;\r
-          eRes+=maxSize;\r
-          if(eRes>alwidth)\r
-            eRes = alwidth;\r
-\r
-          for(int sSeq=0, chunky=0; sSeq<alheight; sSeq+=maxSize, chunky++)\r
+        eSeq = 0;\r
+        eRes += maxSize;\r
+        if (eRes > alwidth)\r
+        {\r
+          eRes = alwidth;\r
+        }\r
+\r
+        for (int sSeq = 0, chunky = 0; sSeq < alheight; sSeq += maxSize, chunky++)\r
+        {\r
+          eSeq += maxSize;\r
+          if (eSeq > alheight)\r
           {\r
-            eSeq+=maxSize;\r
-            if(eSeq>alheight)\r
-              eSeq = alheight;\r
+            eSeq = alheight;\r
+          }\r
 \r
-            blocky = 0;\r
-            blockx = (int)((float)sRes/(float)alwidth * width);\r
+          blocky = 0;\r
+          blockx = (int) ( (float) sRes / (float) alwidth * width);\r
 \r
-            block = nullFrame.createImage((eRes-sRes)*av.charWidth, (eSeq-sSeq)*av.charHeight);\r
-            g = block.getGraphics();\r
+          block = nullFrame.createImage( (eRes - sRes) * av.charWidth,\r
+                                        (eSeq - sSeq) * av.charHeight);\r
+          g = block.getGraphics();\r
 \r
-           ap.seqPanel.seqCanvas.drawPanel(g, sRes, eRes, sSeq, eSeq, sRes, sSeq, 0);\r
+          ap.seqPanel.seqCanvas.drawPanel(g, sRes, eRes, sSeq, eSeq, sRes, sSeq,\r
+                                          0);\r
 \r
-           blockh = (int)( (float)(eSeq-sSeq)/(float)alheight *  sequencesHeight  )+1 ;\r
-           blockw = (int)( (float)(eRes-sRes)/(float)alwidth  *   width )+1;\r
+          blockh = (int) ( (float) (eSeq - sSeq) / (float) alheight *\r
+                          sequencesHeight) + 1;\r
+          blockw = (int) ( (float) (eRes - sRes) / (float) alwidth * width) + 1;\r
 \r
-           blocky += (int) ((float)sSeq/(float)alheight* sequencesHeight);\r
+          blocky += (int) ( (float) sSeq / (float) alheight * sequencesHeight);\r
 \r
-           mg.drawImage(block,  blockx,\r
-                              blocky ,\r
-                            blockx + blockw,\r
-                            blocky + blockh,\r
+          mg.drawImage(block, blockx,\r
+                       blocky,\r
+                       blockx + blockw,\r
+                       blocky + blockh,\r
 \r
-                         0, 0, block.getWidth(null),block.getHeight(null), this);\r
+                       0, 0, block.getWidth(null), block.getHeight(null), this);\r
 \r
           block = null;\r
-          }\r
+        }\r
 \r
       }\r
 \r
-    }catch(OutOfMemoryError error)\r
-    {     System.err.println("Out of memory when trying to calculate the overview window image!");   }\r
-\r
+    }\r
+    catch (OutOfMemoryError error)\r
+    {\r
+      System.err.println(\r
+          "Out of memory when trying to calculate the overview window image!");\r
+    }\r
 \r
     av.setRenderGaps(oldRenderGaps);\r
     resizing = false;\r
@@ -245,38 +279,41 @@ public class OverviewPanel extends Panel implements Runnable
 \r
   public void setBoxPosition()\r
   {\r
-      boxX = (int) (av.getStartRes() * av.getCharWidth() * scalew);\r
-      boxY = (int) (av.getStartSeq() * av.getCharHeight() * scaleh);\r
-      boxWidth = (int) ((av.getEndRes()-av.getStartRes()+1)* av.getCharWidth() * scalew) ;\r
-      boxHeight = (int) (av.getEndSeq() * av.getCharHeight() * scaleh) - boxY;\r
-      repaint();\r
+    boxX = (int) (av.getStartRes() * av.getCharWidth() * scalew);\r
+    boxY = (int) (av.getStartSeq() * av.getCharHeight() * scaleh);\r
+    boxWidth = (int) ( (av.getEndRes() - av.getStartRes() + 1) *\r
+                      av.getCharWidth() * scalew);\r
+    boxHeight = (int) (av.getEndSeq() * av.getCharHeight() * scaleh) - boxY;\r
+    repaint();\r
   }\r
 \r
- public void update(Graphics g)\r
- {\r
-   paint(g);\r
- }\r
+  public void update(Graphics g)\r
+  {\r
+    paint(g);\r
+  }\r
 \r
   public void paint(Graphics g)\r
   {\r
-    if(resizing)\r
+    if (resizing)\r
     {\r
       g.setColor(Color.white);\r
       g.fillRect(0, 0, getSize().width, getSize().height);\r
       g.setColor(Color.black);\r
 \r
       g.setFont(new Font("Verdana", Font.BOLD, 15));\r
-      g.drawString("Recalculating", 5, sequencesHeight/2);\r
-      g.drawString("Overview.....", 5, sequencesHeight/2 +20);\r
+      g.drawString("Recalculating", 5, sequencesHeight / 2);\r
+      g.drawString("Overview.....", 5, sequencesHeight / 2 + 20);\r
     }\r
     else\r
     {\r
-      if(miniMe!=null)\r
-        g.drawImage(miniMe, 0,0,this);\r
+      if (miniMe != null)\r
+      {\r
+        g.drawImage(miniMe, 0, 0, this);\r
+      }\r
 \r
       g.setColor(Color.red);\r
       g.drawRect(boxX, boxY, boxWidth, boxHeight);\r
-      g.drawRect(boxX+1, boxY+1, boxWidth-2, boxHeight-2);\r
+      g.drawRect(boxX + 1, boxY + 1, boxWidth - 2, boxHeight - 2);\r
     }\r
   }\r
 \r
index f652aae..1dd05e0 100755 (executable)
@@ -1,33 +1,35 @@
 /*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 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
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 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 jalview.datamodel.*;\r
-import jalview.analysis.PCA;\r
-import jalview.jbappletgui.*;\r
+import java.util.*;\r
+\r
 import java.awt.*;\r
 import java.awt.event.*;\r
-import java.util.*;\r
 \r
+import jalview.analysis.*;\r
+import jalview.datamodel.*;\r
+import jalview.jbappletgui.*;\r
 \r
-public class PCAPanel extends GPCAPanel implements Runnable\r
+public class PCAPanel\r
+    extends GPCAPanel implements Runnable\r
 {\r
   PCA pca;\r
   int top;\r
@@ -39,30 +41,34 @@ public class PCAPanel extends GPCAPanel implements Runnable
     // do stuff\r
   }\r
 \r
-  public PCAPanel(AlignViewport av, SequenceI[] s) {\r
+  public PCAPanel(AlignViewport av, SequenceI[] s)\r
+  {\r
 \r
     this.av = av;\r
-    if(av.getSelectionGroup().getSize()>3)\r
+    if (av.getSelectionGroup().getSize() > 3)\r
     {\r
       s = new Sequence[av.getSelectionGroup().getSize()];\r
-      for(int i=0; i<s.length; i++)\r
+      for (int i = 0; i < s.length; i++)\r
+      {\r
         s[i] = av.getSelectionGroup().getSequenceAt(i);\r
+      }\r
     }\r
 \r
-\r
-    if(s==null)\r
+    if (s == null)\r
     {\r
       s = new Sequence[av.getAlignment().getHeight()];\r
       for (int i = 0; i < av.getAlignment().getHeight(); i++)\r
+      {\r
         s[i] = av.getAlignment().getSequenceAt(i);\r
-     }\r
+      }\r
+    }\r
 \r
 //////////////////////This part was done in PCATHread originally. Is it too slow???\r
     pca = new PCA(s);\r
     pca.run();\r
 \r
     // Now find the component coordinates\r
-    int ii=0;\r
+    int ii = 0;\r
     while (ii < s.length && s[ii] != null)\r
     {\r
       ii++;\r
@@ -70,11 +76,11 @@ public class PCAPanel extends GPCAPanel implements Runnable
 \r
     double[][] comps = new double[ii][ii];\r
 \r
-    for (int i=0; i < ii; i++ )\r
+    for (int i = 0; i < ii; i++)\r
     {\r
       if (pca.getEigenvalue(i) > 1e-4)\r
       {\r
-        comps[i]  = pca.component(i);\r
+        comps[i] = pca.component(i);\r
       }\r
     }\r
 \r
@@ -84,37 +90,39 @@ public class PCAPanel extends GPCAPanel implements Runnable
     yCombobox.select(1);\r
     zCombobox.select(2);\r
 \r
-    top = pca.getM().rows-1;\r
+    top = pca.getM().rows - 1;\r
 \r
     Vector points = new Vector();\r
-    float[][] scores = pca.getComponents(top-1,top-2,top-3,100);\r
+    float[][] scores = pca.getComponents(top - 1, top - 2, top - 3, 100);\r
 \r
-    for (int i =0; i < pca.getM().rows; i++ )\r
+    for (int i = 0; i < pca.getM().rows; i++)\r
     {\r
-      SequencePoint sp = new SequencePoint(s[i],scores[i]);\r
+      SequencePoint sp = new SequencePoint(s[i], scores[i]);\r
       points.addElement(sp);\r
     }\r
 \r
-    rc = new RotatableCanvas(av,points,pca.getM().rows);\r
+    rc = new RotatableCanvas(av, points, pca.getM().rows);\r
 \r
     //rc.printPoints();\r
 \r
     add(rc, BorderLayout.CENTER);\r
   }\r
 \r
-\r
   void doDimensionChange()\r
   {\r
-    if(top==0)\r
+    if (top == 0)\r
+    {\r
       return;\r
+    }\r
 \r
     int dim1 = top - xCombobox.getSelectedIndex();\r
     int dim2 = top - yCombobox.getSelectedIndex();\r
     int dim3 = top - zCombobox.getSelectedIndex();\r
 \r
-    float[][] scores  = pca.getComponents(dim1,dim2,dim3,100);\r
-    for (int i=0; i < pca.getM().rows; i++) {\r
-      ((SequencePoint)rc.points.elementAt(i)).coord = scores[i];\r
+    float[][] scores = pca.getComponents(dim1, dim2, dim3, 100);\r
+    for (int i = 0; i < pca.getM().rows; i++)\r
+    {\r
+      ( (SequencePoint) rc.points.elementAt(i)).coord = scores[i];\r
     }\r
 \r
     rc.img = null;\r
index 0f2c1f6..670af70 100755 (executable)
@@ -1,50 +1,60 @@
 /*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 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
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 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
-import java.awt.*;\r
+\r
 import java.util.*;\r
 \r
+import java.awt.*;\r
+\r
 public class PaintRefresher\r
 {\r
   static Vector components = new Vector();\r
 \r
   public static void Register(Component c)\r
   {\r
-    if(!components.contains(c))\r
+    if (!components.contains(c))\r
+    {\r
       components.addElement(c);\r
+    }\r
     else\r
+    {\r
       components.removeElement(c);\r
+    }\r
   }\r
 \r
   public static void Refresh(Component c)\r
   {\r
     Component temp;\r
     Enumeration e = components.elements();\r
-    while( e.hasMoreElements() )\r
+    while (e.hasMoreElements())\r
     {\r
-      temp = (Component)e.nextElement();\r
+      temp = (Component) e.nextElement();\r
 \r
-      if(!temp.isValid())\r
-        components.removeElement( temp );\r
-      else if( temp == c )\r
-           continue;\r
+      if (!temp.isValid())\r
+      {\r
+        components.removeElement(temp);\r
+      }\r
+      else if (temp == c)\r
+      {\r
+        continue;\r
+      }\r
 \r
       temp.repaint();\r
     }\r
index 65f40c3..55cf2cc 100755 (executable)
@@ -1,89 +1,97 @@
 /*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 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
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 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 jalview.datamodel.*;\r
-import jalview.jbappletgui.GPairwiseAlignPanel;\r
-import jalview.analysis.*;\r
-import java.awt.event.*;\r
 import java.util.*;\r
 \r
+import java.awt.event.*;\r
+\r
+import jalview.analysis.*;\r
+import jalview.datamodel.*;\r
+import jalview.jbappletgui.*;\r
 \r
-public class PairwiseAlignPanel extends GPairwiseAlignPanel\r
+public class PairwiseAlignPanel\r
+    extends GPairwiseAlignPanel\r
 {\r
-    Vector sequences = new Vector();\r
-    AlignViewport av;\r
+  Vector sequences = new Vector();\r
+  AlignViewport av;\r
 \r
-    public PairwiseAlignPanel(AlignViewport av)\r
+  public PairwiseAlignPanel(AlignViewport av)\r
+  {\r
+    super();\r
+    this.av = av;\r
+    float scores[][] = new float[av.getAlignment().getHeight()][av.getAlignment().\r
+        getHeight()];\r
+    double totscore = 0;\r
+    int count = av.getSelectionGroup().getSize();\r
+\r
+    int acount = 0;\r
+    for (int i = 1; i < count; i++)\r
     {\r
-      super();\r
-      this.av = av;\r
-      float scores[][] = new float[av.getAlignment().getHeight()][av.getAlignment().getHeight()];\r
-      double totscore = 0;\r
-      int count = av.getSelectionGroup().getSize();\r
-\r
-      int acount = 0;\r
-        for (int i = 1; i < count; i++)\r
-        {\r
-          for (int j = 0; j < i; j++)\r
-          {\r
-            acount++;\r
-            AlignSeq as = new AlignSeq(av.getSelectionGroup().getSequenceAt(i),\r
-                                       av.getSelectionGroup().getSequenceAt(j),"pep");\r
-\r
-            as.calcScoreMatrix();\r
-            as.traceAlignment();\r
-            as.printAlignment();\r
-            scores[i][j] = (float)as.getMaxScore()/(float)as.getASeq1().length;\r
-            totscore = totscore + scores[i][j];\r
+      for (int j = 0; j < i; j++)\r
+      {\r
+        acount++;\r
+        AlignSeq as = new AlignSeq(av.getSelectionGroup().getSequenceAt(i),\r
+                                   av.getSelectionGroup().getSequenceAt(j),\r
+                                   "pep");\r
+\r
+        as.calcScoreMatrix();\r
+        as.traceAlignment();\r
+        as.printAlignment();\r
+        scores[i][j] = (float) as.getMaxScore() / (float) as.getASeq1().length;\r
+        totscore = totscore + scores[i][j];\r
+\r
+        textarea.append(as.getOutput());\r
+        sequences.addElement(new Sequence(as.getS1().getName(), as.getAStr1()));\r
+        sequences.addElement(new Sequence(as.getS2().getName(), as.getAStr2()));\r
 \r
-            textarea.append(as.getOutput());\r
-            sequences.addElement( new Sequence( as.getS1().getName(), as.getAStr1()) );\r
-            sequences.addElement( new Sequence( as.getS2().getName(), as.getAStr2()) );\r
-\r
-\r
-          }\r
-        }\r
+      }\r
+    }\r
 \r
-        if (count > 2)\r
+    if (count > 2)\r
+    {\r
+      for (int i = 0; i < count; i++)\r
+      {\r
+        for (int j = 0; j < i; j++)\r
         {\r
-          for (int i = 0; i < count;i++)\r
-            for (int j = 0; j < i; j++)\r
-              jalview.util.Format.print(System.out,"%7.3f",scores[i][j]/totscore);\r
+          jalview.util.Format.print(System.out, "%7.3f",\r
+                                    scores[i][j] / totscore);\r
         }\r
       }\r
-\r
+    }\r
+  }\r
 \r
   protected void viewInEditorButton_actionPerformed(ActionEvent e)\r
   {\r
 \r
-      Sequence [] seq = new Sequence[sequences.size()];\r
-\r
-      for (int i=0;i<sequences.size();i++)\r
-       seq[i] = (Sequence) sequences.elementAt(i);\r
+    Sequence[] seq = new Sequence[sequences.size()];\r
 \r
+    for (int i = 0; i < sequences.size(); i++)\r
+    {\r
+      seq[i] = (Sequence) sequences.elementAt(i);\r
+    }\r
 \r
-      AlignFrame af = new AlignFrame(new Alignment(seq));\r
-      jalview.bin.JalviewLite.addFrame(af, "Pairwise Aligned Sequences",\r
-                               AlignFrame.NEW_WINDOW_WIDTH,\r
-                               AlignFrame.NEW_WINDOW_HEIGHT);\r
+    AlignFrame af = new AlignFrame(new Alignment(seq));\r
+    jalview.bin.JalviewLite.addFrame(af, "Pairwise Aligned Sequences",\r
+                                     AlignFrame.NEW_WINDOW_WIDTH,\r
+                                     AlignFrame.NEW_WINDOW_HEIGHT);\r
 \r
   }\r
 \r
index 735a579..42ac7f4 100755 (executable)
@@ -1,36 +1,38 @@
 /*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 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
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 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 jalview.jbappletgui.*;\r
-import jalview.datamodel.*;\r
-import java.awt.event.*;\r
 import java.util.*;\r
 \r
-public class RedundancyPanel extends GSliderPanel\r
+import java.awt.event.*;\r
+\r
+import jalview.datamodel.*;\r
+import jalview.jbappletgui.*;\r
+\r
+public class RedundancyPanel\r
+    extends GSliderPanel\r
 {\r
   AlignmentPanel ap;\r
 \r
   SequenceI[] oldAlignment;\r
 \r
-\r
   public RedundancyPanel(AlignmentPanel ap)\r
   {\r
     this.ap = ap;\r
@@ -41,81 +43,87 @@ public class RedundancyPanel extends GSliderPanel
     {\r
       public void adjustmentValueChanged(AdjustmentEvent evt)\r
       {\r
-        valueField.setText( slider.getValue()+"" );\r
+        valueField.setText(slider.getValue() + "");\r
       }\r
     });\r
 \r
     slider.setMinimum(0);\r
     slider.setMaximum(100);\r
-    slider.setValue(100 );\r
+    slider.setValue(100);\r
 \r
   }\r
 \r
   public void applyButton_actionPerformed(ActionEvent e)\r
   {\r
-       float threshold = slider.getValue();\r
-       Vector del;\r
+    float threshold = slider.getValue();\r
+    Vector del;\r
+\r
+    oldAlignment = new SequenceI[ap.av.alignment.getHeight()];\r
+    for (int i = 0; i < ap.av.alignment.getHeight(); i++)\r
+    {\r
+      oldAlignment[i] = new Sequence(ap.av.alignment.getSequenceAt(i).getName(),\r
+                                     ap.av.alignment.getSequenceAt(i).\r
+                                     getSequence());\r
+    }\r
+\r
+    undoButton.setEnabled(true);\r
+\r
+    SequenceGroup sg = ap.av.getSelectionGroup();\r
+    if (sg != null && sg.getSize() > 1)\r
+    {\r
 \r
-       oldAlignment = new SequenceI[ap.av.alignment.getHeight()];\r
-        for (int i = 0; i < ap.av.alignment.getHeight(); i++)\r
+      del = ap.av.alignment.removeRedundancy(threshold, sg.sequences);\r
+      for (int i = 0; i < del.size(); i++)\r
+      {\r
+        if (sg.sequences.contains( (SequenceI) del.elementAt(i)))\r
         {\r
-           oldAlignment[i] = new Sequence(ap.av.alignment.getSequenceAt(i).getName(),\r
-                                ap.av.alignment.getSequenceAt(i).\r
-                                getSequence());\r
+          sg.deleteSequence( (SequenceI) del.elementAt(i));\r
         }\r
+      }\r
 \r
-        undoButton.setEnabled(true);\r
-\r
-        SequenceGroup sg = ap.av.getSelectionGroup();\r
-       if (sg != null && sg.getSize() > 1)\r
-       {\r
-\r
-         del = ap.av.alignment.removeRedundancy(threshold, sg.sequences);\r
-         for (int i = 0; i < del.size(); i++)\r
-           if (sg.sequences.contains( (SequenceI) del.elementAt(i)))\r
-             sg.deleteSequence( (SequenceI) del.elementAt(i));\r
-\r
-         }\r
-         else\r
-         {\r
-           Vector s = new Vector();\r
-           int i=0;\r
-           while(i < ap.av.alignment.getHeight())\r
-           {\r
-             s.addElement( ap.av.alignment.getSequenceAt(i) );\r
-             i++;\r
-           }\r
-            del = ap.av.alignment.removeRedundancy(threshold,s);\r
-           for (int j=0; j < del.size(); j++)\r
-           {\r
-               if (sg.sequences.contains((SequenceI)del.elementAt(j)))\r
-               sg.deleteSequence((SequenceI)del.elementAt(j));\r
-\r
-           }\r
-         }\r
-\r
-         ap.repaint();\r
+    }\r
+    else\r
+    {\r
+      Vector s = new Vector();\r
+      int i = 0;\r
+      while (i < ap.av.alignment.getHeight())\r
+      {\r
+        s.addElement(ap.av.alignment.getSequenceAt(i));\r
+        i++;\r
+      }\r
+      del = ap.av.alignment.removeRedundancy(threshold, s);\r
+      for (int j = 0; j < del.size(); j++)\r
+      {\r
+        if (sg.sequences.contains( (SequenceI) del.elementAt(j)))\r
+        {\r
+          sg.deleteSequence( (SequenceI) del.elementAt(j));\r
+        }\r
+\r
+      }\r
+    }\r
+\r
+    ap.repaint();\r
 \r
   }\r
 \r
   public void undoButton_actionPerformed(ActionEvent e)\r
   {\r
-      undoButton.setEnabled(false);\r
-      ap.av.setAlignment( new Alignment(oldAlignment) );\r
-      oldAlignment = null;\r
-      ap.repaint();\r
+    undoButton.setEnabled(false);\r
+    ap.av.setAlignment(new Alignment(oldAlignment));\r
+    oldAlignment = null;\r
+    ap.repaint();\r
   }\r
 \r
-\r
   public void valueField_actionPerformed(ActionEvent e)\r
   {\r
-    try{\r
+    try\r
+    {\r
       int i = Integer.parseInt(valueField.getText());\r
       slider.setValue(i);\r
     }\r
-    catch(Exception ex)\r
+    catch (Exception ex)\r
     {\r
-      valueField.setText( slider.getValue()+"" );\r
+      valueField.setText(slider.getValue() + "");\r
     }\r
   }\r
 }\r
index a13b1a2..7d32b86 100755 (executable)
@@ -1,42 +1,43 @@
 /*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 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
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 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 jalview.math.*;\r
-import jalview.datamodel.*;\r
-import jalview.util.*;\r
+import java.util.*;\r
 \r
 import java.awt.*;\r
 import java.awt.event.*;\r
-import java.util.*;\r
 \r
+import jalview.datamodel.*;\r
+import jalview.math.*;\r
+import jalview.util.*;\r
 \r
-public class RotatableCanvas extends Panel implements MouseListener,\r
-                                                       MouseMotionListener,\r
-                                                       KeyListener\r
-                                                       //RubberbandListener,\r
-                                                       //SequenceSelectionListener\r
+public class RotatableCanvas\r
+    extends Panel implements MouseListener,\r
+    MouseMotionListener,\r
+    KeyListener\r
+//RubberbandListener,\r
+//SequenceSelectionListener\r
 {\r
-  RotatableMatrix idmat  = new RotatableMatrix(3,3);\r
-  RotatableMatrix objmat = new RotatableMatrix(3,3);\r
-  RotatableMatrix rotmat = new RotatableMatrix(3,3);\r
+  RotatableMatrix idmat = new RotatableMatrix(3, 3);\r
+  RotatableMatrix objmat = new RotatableMatrix(3, 3);\r
+  RotatableMatrix rotmat = new RotatableMatrix(3, 3);\r
 \r
   //RubberbandRectangle rubberband;\r
 \r
@@ -85,7 +86,8 @@ public class RotatableCanvas extends Panel implements MouseListener,
 \r
 \r
   public RotatableCanvas(AlignViewport av,\r
-                          Vector points, int npoint) {\r
+                         Vector points, int npoint)\r
+  {\r
     this.points = points;\r
     this.npoint = npoint;\r
     this.av = av;\r
@@ -94,24 +96,31 @@ public class RotatableCanvas extends Panel implements MouseListener,
     prefsize = getPreferredSize();\r
     orig = new float[npoint][3];\r
 \r
-    for (int i=0; i < npoint; i++) {\r
-      SequencePoint sp = (SequencePoint)points.elementAt(i);\r
-      for (int j=0; j < 3; j++) {\r
+    for (int i = 0; i < npoint; i++)\r
+    {\r
+      SequencePoint sp = (SequencePoint) points.elementAt(i);\r
+      for (int j = 0; j < 3; j++)\r
+      {\r
         orig[i][j] = sp.coord[j];\r
       }\r
     }\r
     //Initialize the matrices to identity\r
 \r
-    for (int i = 0; i < 3; i++) {\r
-      for (int j = 0; j < 3 ; j++) {\r
-        if (i != j) {\r
-          idmat.addElement(i,j,0);\r
-          objmat.addElement(i,j,0);\r
-          rotmat.addElement(i,j,0);\r
-        } else {\r
-          idmat.addElement(i,j,0);\r
-          objmat.addElement(i,j,0);\r
-          rotmat.addElement(i,j,0);\r
+    for (int i = 0; i < 3; i++)\r
+    {\r
+      for (int j = 0; j < 3; j++)\r
+      {\r
+        if (i != j)\r
+        {\r
+          idmat.addElement(i, j, 0);\r
+          objmat.addElement(i, j, 0);\r
+          rotmat.addElement(i, j, 0);\r
+        }\r
+        else\r
+        {\r
+          idmat.addElement(i, j, 0);\r
+          objmat.addElement(i, j, 0);\r
+          rotmat.addElement(i, j, 0);\r
         }\r
       }\r
     }\r
@@ -128,59 +137,70 @@ public class RotatableCanvas extends Panel implements MouseListener,
 \r
     addMouseListener(this);\r
     addKeyListener(this);\r
-   // if (getParent() != null) {\r
-   //   getParent().addKeyListener(this);\r
+    // if (getParent() != null) {\r
+    //   getParent().addKeyListener(this);\r
     //}\r
     addMouseMotionListener(this);\r
 \r
     // Add rubberband\r
- //   rubberband  = new RubberbandRectangle(this);\r
-  //  rubberband.setActive(true);\r
- //   rubberband.addListener(this);\r
+    //   rubberband  = new RubberbandRectangle(this);\r
+    //  rubberband.setActive(true);\r
+    //   rubberband.addListener(this);\r
   }\r
 \r
- /* public boolean handleSequenceSelectionEvent(SequenceSelectionEvent evt) {\r
-    redrawneeded = true;\r
-    repaint();\r
-    return true;\r
-  }\r
+  /* public boolean handleSequenceSelectionEvent(SequenceSelectionEvent evt) {\r
+     redrawneeded = true;\r
+     repaint();\r
+     return true;\r
+   }\r
 \r
-  public void removeNotify() {\r
-    controller.removeListener(this);\r
-    super.removeNotify();\r
-  }*/\r
+   public void removeNotify() {\r
+     controller.removeListener(this);\r
+     super.removeNotify();\r
+   }*/\r
 \r
-  public void initAxes() {\r
-    for (int i = 0; i < 3; i++) {\r
-      for (int j=0; j < 3; j++) {\r
-        if (i != j) {\r
+  public void initAxes()\r
+  {\r
+    for (int i = 0; i < 3; i++)\r
+    {\r
+      for (int j = 0; j < 3; j++)\r
+      {\r
+        if (i != j)\r
+        {\r
           axes[i][j] = 0;\r
-        } else {\r
+        }\r
+        else\r
+        {\r
           axes[i][j] = 1;\r
         }\r
       }\r
     }\r
   }\r
 \r
-  public void findWidth() {\r
+  public void findWidth()\r
+  {\r
     max = new float[3];\r
     min = new float[3];\r
 \r
-    max[0] = (float)-1e30;\r
-    max[1] = (float)-1e30;\r
-    max[2] = (float)-1e30;\r
+    max[0] = (float) - 1e30;\r
+    max[1] = (float) - 1e30;\r
+    max[2] = (float) - 1e30;\r
 \r
-    min[0] = (float)1e30;\r
-    min[1] = (float)1e30;\r
-    min[2] = (float)1e30;\r
+    min[0] = (float) 1e30;\r
+    min[1] = (float) 1e30;\r
+    min[2] = (float) 1e30;\r
 \r
-    for (int i = 0; i < 3; i++) {\r
-      for (int j = 0; j < npoint; j++) {\r
-        SequencePoint sp = (SequencePoint)points.elementAt(j);\r
-        if (sp.coord[i] >= max[i]) {\r
+    for (int i = 0; i < 3; i++)\r
+    {\r
+      for (int j = 0; j < npoint; j++)\r
+      {\r
+        SequencePoint sp = (SequencePoint) points.elementAt(j);\r
+        if (sp.coord[i] >= max[i])\r
+        {\r
           max[i] = sp.coord[i];\r
         }\r
-        if (sp.coord[i] <= min[i]) {\r
+        if (sp.coord[i] <= min[i])\r
+        {\r
           min[i] = sp.coord[i];\r
         }\r
       }\r
@@ -197,130 +217,156 @@ public class RotatableCanvas extends Panel implements MouseListener,
     maxwidth = width[0];\r
 \r
     if (width[1] > width[0])\r
+    {\r
       maxwidth = width[1];\r
+    }\r
     if (width[2] > width[1])\r
+    {\r
       maxwidth = width[2];\r
+    }\r
 \r
     //System.out.println("Maxwidth = " + maxwidth);\r
   }\r
 \r
-  public float findScale() {\r
+  public float findScale()\r
+  {\r
     int dim, width, height;\r
-    if (getSize().width != 0) {\r
+    if (getSize().width != 0)\r
+    {\r
       width = getSize().width;\r
       height = getSize().height;\r
-    } else {\r
+    }\r
+    else\r
+    {\r
       width = prefsize.width;\r
       height = prefsize.height;\r
     }\r
 \r
-    if (width < height) {\r
+    if (width < height)\r
+    {\r
       dim = width;\r
-    } else {\r
+    }\r
+    else\r
+    {\r
       dim = height;\r
     }\r
 \r
-    return (float)(dim*scalefactor/(2*maxwidth));\r
+    return (float) (dim * scalefactor / (2 * maxwidth));\r
   }\r
 \r
-  public void findCentre() {\r
+  public void findCentre()\r
+  {\r
     //Find centre coordinate\r
     findWidth();\r
 \r
-    centre[0] = (max[0] + min[0])/2;\r
-    centre[1] = (max[1] + min[1])/2;\r
-    centre[2] = (max[2] + min[2])/2;\r
+    centre[0] = (max[0] + min[0]) / 2;\r
+    centre[1] = (max[1] + min[1]) / 2;\r
+    centre[2] = (max[2] + min[2]) / 2;\r
 \r
     //    System.out.println("Centre x " + centre[0]);\r
     //System.out.println("Centre y " + centre[1]);\r
     //System.out.println("Centre z " + centre[2]);\r
   }\r
 \r
-  public Dimension getPreferredSize() {\r
-    if (prefsize != null) {\r
+  public Dimension getPreferredSize()\r
+  {\r
+    if (prefsize != null)\r
+    {\r
       return prefsize;\r
-    } else {\r
-      return new Dimension(400,400);\r
+    }\r
+    else\r
+    {\r
+      return new Dimension(400, 400);\r
     }\r
   }\r
 \r
-  public Dimension getMinimumSize() {\r
+  public Dimension getMinimumSize()\r
+  {\r
     return getPreferredSize();\r
   }\r
 \r
-  public void paint(Graphics g) {\r
+  public void paint(Graphics g)\r
+  {\r
     //Only create the image at the beginning -\r
-    if ((img == null) || (prefsize.width != getSize().width) || (prefsize.height != getSize().height)) {\r
+    if ( (img == null) || (prefsize.width != getSize().width) ||\r
+        (prefsize.height != getSize().height))\r
+    {\r
       prefsize.width = getSize().width;\r
       prefsize.height = getSize().height;\r
 \r
       scale = findScale();\r
 \r
       //      System.out.println("New scale = " + scale);\r
-      img = createImage(getSize().width,getSize().height);\r
+      img = createImage(getSize().width, getSize().height);\r
       ig = img.getGraphics();\r
 \r
     }\r
 \r
+    drawBackground(ig, Color.black);\r
+    drawScene(ig);\r
+    if (drawAxes == true)\r
+    {\r
+      drawAxes(ig);\r
+    }\r
 \r
-      drawBackground(ig,Color.black);\r
-      drawScene(ig);\r
-      if (drawAxes == true)\r
-      {\r
-        drawAxes(ig);\r
-      }\r
-\r
-\r
-    g.drawImage(img,0,0,this);\r
+    g.drawImage(img, 0, 0, this);\r
   }\r
 \r
-  public void drawAxes(Graphics g) {\r
+  public void drawAxes(Graphics g)\r
+  {\r
 \r
     g.setColor(Color.yellow);\r
-    for (int i=0; i < 3 ; i++) {\r
-      g.drawLine(getSize().width/2,getSize().height/2,\r
-                 (int)(axes[i][0]*scale*max[0] + getSize().width/2),\r
-                 (int)(axes[i][1]*scale*max[1] + getSize().height/2));\r
+    for (int i = 0; i < 3; i++)\r
+    {\r
+      g.drawLine(getSize().width / 2, getSize().height / 2,\r
+                 (int) (axes[i][0] * scale * max[0] + getSize().width / 2),\r
+                 (int) (axes[i][1] * scale * max[1] + getSize().height / 2));\r
     }\r
   }\r
 \r
-  public void drawBackground(Graphics g, Color col) {\r
+  public void drawBackground(Graphics g, Color col)\r
+  {\r
     g.setColor(col);\r
-    g.fillRect(0,0,prefsize.width,prefsize.height);\r
+    g.fillRect(0, 0, prefsize.width, prefsize.height);\r
   }\r
 \r
-\r
-  public void drawScene(Graphics g) {\r
+  public void drawScene(Graphics g)\r
+  {\r
     boolean darker = false;\r
 \r
-    int halfwidth = getSize().width/2;\r
-    int halfheight = getSize().height/2;\r
+    int halfwidth = getSize().width / 2;\r
+    int halfheight = getSize().height / 2;\r
 \r
-    for (int i = 0; i < npoint; i++) {\r
-      SequencePoint sp = (SequencePoint)points.elementAt(i);\r
-      int x = (int)((float)(sp.coord[0] - centre[0])*scale) + halfwidth;\r
-      int y = (int)((float)(sp.coord[1] - centre[1])*scale) + halfheight;\r
+    for (int i = 0; i < npoint; i++)\r
+    {\r
+      SequencePoint sp = (SequencePoint) points.elementAt(i);\r
+      int x = (int) ( (float) (sp.coord[0] - centre[0]) * scale) + halfwidth;\r
+      int y = (int) ( (float) (sp.coord[1] - centre[1]) * scale) + halfheight;\r
       float z = sp.coord[1] - centre[2];\r
 \r
-\r
-\r
-\r
       if (sp.sequence.getColor() == Color.black)\r
-          g.setColor(Color.white);\r
+      {\r
+        g.setColor(Color.white);\r
+      }\r
       else\r
-          g.setColor(sp.sequence.getColor());\r
-\r
+      {\r
+        g.setColor(sp.sequence.getColor());\r
+      }\r
 \r
       if (av.getSelectionGroup() != null)\r
       {\r
-        if (av.getSelectionGroup().sequences.contains(((SequencePoint)points.elementAt(i)).sequence))\r
+        if (av.getSelectionGroup().sequences.contains( ( (SequencePoint) points.\r
+            elementAt(i)).sequence))\r
+        {\r
           g.setColor(Color.gray);\r
+        }\r
       }\r
       if (z < 0)\r
+      {\r
         g.setColor(g.getColor().darker());\r
+      }\r
 \r
-\r
-      g.fillRect(x-3,y-3,6,6);\r
+      g.fillRect(x - 3, y - 3, 6, 6);\r
       g.setColor(Color.red);\r
     }\r
 //    //Now the rectangle\r
@@ -331,52 +377,75 @@ public class RotatableCanvas extends Panel implements MouseListener,
 //    }\r
   }\r
 \r
-  public Dimension minimumsize() {\r
+  public Dimension minimumsize()\r
+  {\r
     return prefsize;\r
   }\r
 \r
-  public Dimension preferredsize() {\r
+  public Dimension preferredsize()\r
+  {\r
     return prefsize;\r
   }\r
 \r
-  public void keyTyped(KeyEvent evt) { }\r
-  public void keyReleased(KeyEvent evt) { }\r
+  public void keyTyped(KeyEvent evt)\r
+  {}\r
 \r
-  public void keyPressed(KeyEvent evt) {\r
+  public void keyReleased(KeyEvent evt)\r
+  {}\r
+\r
+  public void keyPressed(KeyEvent evt)\r
+  {\r
     requestFocus();\r
-    if (evt.getKeyCode() == KeyEvent.VK_UP) {\r
-      scalefactor = (float)(scalefactor * 1.1);\r
+    if (evt.getKeyCode() == KeyEvent.VK_UP)\r
+    {\r
+      scalefactor = (float) (scalefactor * 1.1);\r
       scale = findScale();\r
-    } else if (evt.getKeyCode() == KeyEvent.VK_DOWN) {\r
-      scalefactor = (float)(scalefactor * 0.9);\r
+    }\r
+    else if (evt.getKeyCode() == KeyEvent.VK_DOWN)\r
+    {\r
+      scalefactor = (float) (scalefactor * 0.9);\r
       scale = findScale();\r
-    } else if (evt.getKeyChar() == 's') {\r
+    }\r
+    else if (evt.getKeyChar() == 's')\r
+    {\r
       System.err.println("DEBUG: Rectangle selection"); // log.debug\r
-      if (rectx2 != -1 && recty2 != -1) {\r
-        rectSelect(rectx1,recty1,rectx2,recty2);\r
+      if (rectx2 != -1 && recty2 != -1)\r
+      {\r
+        rectSelect(rectx1, recty1, rectx2, recty2);\r
 \r
       }\r
     }\r
     repaint();\r
   }\r
 \r
-  public void printPoints() {\r
-    for (int i=0; i < npoint; i++) {\r
-      SequencePoint sp = (SequencePoint)points.elementAt(i);\r
-      Format.print(System.out,"%5d ", i);\r
-      for (int j=0; j < 3;j++) {\r
-        Format.print(System.out,"%13.3f  ",sp.coord[j]);\r
+  public void printPoints()\r
+  {\r
+    for (int i = 0; i < npoint; i++)\r
+    {\r
+      SequencePoint sp = (SequencePoint) points.elementAt(i);\r
+      Format.print(System.out, "%5d ", i);\r
+      for (int j = 0; j < 3; j++)\r
+      {\r
+        Format.print(System.out, "%13.3f  ", sp.coord[j]);\r
       }\r
       System.out.println();\r
     }\r
   }\r
 \r
-  public void mouseClicked(MouseEvent evt) { }\r
-  public void mouseEntered(MouseEvent evt) { }\r
-  public void mouseExited(MouseEvent evt) { }\r
-  public void mouseReleased(MouseEvent evt) { }\r
+  public void mouseClicked(MouseEvent evt)\r
+  {}\r
 \r
-  public void mousePressed(MouseEvent evt) {\r
+  public void mouseEntered(MouseEvent evt)\r
+  {}\r
+\r
+  public void mouseExited(MouseEvent evt)\r
+  {}\r
+\r
+  public void mouseReleased(MouseEvent evt)\r
+  {}\r
+\r
+  public void mousePressed(MouseEvent evt)\r
+  {\r
     int x = evt.getX();\r
     int y = evt.getY();\r
 \r
@@ -395,7 +464,7 @@ public class RotatableCanvas extends Panel implements MouseListener,
     rectx2 = -1;\r
     recty2 = -1;\r
 \r
-    SequenceI found = findPoint(x,y);\r
+    SequenceI found = findPoint(x, y);\r
 \r
     if (found != null)\r
     {\r
@@ -406,45 +475,50 @@ public class RotatableCanvas extends Panel implements MouseListener,
       }\r
       else\r
       {\r
-          av.setSelectionGroup(new SequenceGroup());\r
-          av.getSelectionGroup().addOrRemove(found);\r
-          av.getSelectionGroup().setEndRes(av.alignment.getWidth());\r
+        av.setSelectionGroup(new SequenceGroup());\r
+        av.getSelectionGroup().addOrRemove(found);\r
+        av.getSelectionGroup().setEndRes(av.alignment.getWidth());\r
 \r
       }\r
     }\r
     repaint();\r
   }\r
 \r
- // private void fireSequenceSelectionEvent(Selection sel) {\r
- //   controller.handleSequenceSelectionEvent(new SequenceSelectionEvent(this,sel));\r
+  // private void fireSequenceSelectionEvent(Selection sel) {\r
+  //   controller.handleSequenceSelectionEvent(new SequenceSelectionEvent(this,sel));\r
   //}\r
 \r
   public void mouseMoved(MouseEvent evt)\r
   {\r
-  // SequenceI found = findPoint(evt.getX(), evt.getY());\r
+    // SequenceI found = findPoint(evt.getX(), evt.getY());\r
   }\r
 \r
-  public void mouseDragged(MouseEvent evt) {\r
+  public void mouseDragged(MouseEvent evt)\r
+  {\r
     mx = evt.getX();\r
     my = evt.getY();\r
     //Check if this is a rectangle drawing drag\r
-    if ((evt.getModifiers() & InputEvent.BUTTON2_MASK) != 0) {\r
+    if ( (evt.getModifiers() & InputEvent.BUTTON2_MASK) != 0)\r
+    {\r
 //      rectx2 = evt.getX();\r
 //      recty2 = evt.getY();\r
-    } else {\r
+    }\r
+    else\r
+    {\r
       rotmat.setIdentity();\r
 \r
-      rotmat.rotate((float)(my-omy),'x');\r
-      rotmat.rotate((float)(mx-omx),'y');\r
+      rotmat.rotate( (float) (my - omy), 'x');\r
+      rotmat.rotate( (float) (mx - omx), 'y');\r
 \r
-      for (int i = 0; i < npoint; i++) {\r
-        SequencePoint sp = (SequencePoint)points.elementAt(i);\r
+      for (int i = 0; i < npoint; i++)\r
+      {\r
+        SequencePoint sp = (SequencePoint) points.elementAt(i);\r
         sp.coord[0] -= centre[0];\r
         sp.coord[1] -= centre[1];\r
         sp.coord[2] -= centre[2];\r
 \r
         //Now apply the rotation matrix\r
-        sp.coord= rotmat.vectorMultiply(sp.coord);\r
+        sp.coord = rotmat.vectorMultiply(sp.coord);\r
 \r
         //Now translate back again\r
         sp.coord[0] += centre[0];\r
@@ -452,7 +526,8 @@ public class RotatableCanvas extends Panel implements MouseListener,
         sp.coord[2] += centre[2];\r
       }\r
 \r
-      for (int i=0; i < 3; i++) {\r
+      for (int i = 0; i < 3; i++)\r
+      {\r
         axes[i] = rotmat.vectorMultiply(axes[i]);\r
       }\r
       omx = mx;\r
@@ -463,15 +538,21 @@ public class RotatableCanvas extends Panel implements MouseListener,
 \r
   }\r
 \r
-  public void rectSelect(int x1, int y1, int x2, int y2) {\r
+  public void rectSelect(int x1, int y1, int x2, int y2)\r
+  {\r
     boolean changedSel = false;\r
-    for (int i=0; i < npoint; i++) {\r
-      SequencePoint sp = (SequencePoint)points.elementAt(i);\r
-      int tmp1 = (int)((sp.coord[0] - centre[0])*scale + (float)getSize().width/2.0);\r
-      int tmp2 = (int)((sp.coord[1] - centre[1])*scale + (float)getSize().height/2.0);\r
+    for (int i = 0; i < npoint; i++)\r
+    {\r
+      SequencePoint sp = (SequencePoint) points.elementAt(i);\r
+      int tmp1 = (int) ( (sp.coord[0] - centre[0]) * scale +\r
+                        (float) getSize().width / 2.0);\r
+      int tmp2 = (int) ( (sp.coord[1] - centre[1]) * scale +\r
+                        (float) getSize().height / 2.0);\r
 \r
-      if (tmp1 > x1 && tmp1 < x2 && tmp2 > y1 && tmp2 < y2) {\r
-        if (av != null) {\r
+      if (tmp1 > x1 && tmp1 < x2 && tmp2 > y1 && tmp2 < y2)\r
+      {\r
+        if (av != null)\r
+        {\r
           if (!av.getSelectionGroup().sequences.contains(sp.sequence))\r
           {\r
             changedSel = true;\r
@@ -480,54 +561,60 @@ public class RotatableCanvas extends Panel implements MouseListener,
         }\r
       }\r
     }\r
-   // if (changedSel) {\r
-   //    fireSequenceSelectionEvent(av.getSelection());\r
-   // }\r
+    // if (changedSel) {\r
+    //    fireSequenceSelectionEvent(av.getSelection());\r
+    // }\r
   }\r
-  public SequenceI findPoint(int x, int y) {\r
 \r
-    int halfwidth = getSize().width/2;\r
-    int halfheight = getSize().height/2;\r
+  public SequenceI findPoint(int x, int y)\r
+  {\r
+\r
+    int halfwidth = getSize().width / 2;\r
+    int halfheight = getSize().height / 2;\r
 \r
     int found = -1;\r
 \r
-    for (int i=0; i < npoint; i++) {\r
-\r
-      SequencePoint sp = (SequencePoint)points.elementAt(i);\r
-      int px = (int)((float)(sp.coord[0] - centre[0])*scale) + halfwidth;\r
-      int py = (int)((float)(sp.coord[1] - centre[1])*scale) + halfheight;\r
+    for (int i = 0; i < npoint; i++)\r
+    {\r
 \r
+      SequencePoint sp = (SequencePoint) points.elementAt(i);\r
+      int px = (int) ( (float) (sp.coord[0] - centre[0]) * scale) + halfwidth;\r
+      int py = (int) ( (float) (sp.coord[1] - centre[1]) * scale) + halfheight;\r
 \r
-      if (Math.abs(px-x)<3 && Math.abs(py - y) < 3 ) {\r
+      if (Math.abs(px - x) < 3 && Math.abs(py - y) < 3)\r
+      {\r
         found = i;\r
       }\r
     }\r
-    if (found != -1) {\r
-      return ((SequencePoint)points.elementAt(found)).sequence;\r
-    } else {\r
+    if (found != -1)\r
+    {\r
+      return ( (SequencePoint) points.elementAt(found)).sequence;\r
+    }\r
+    else\r
+    {\r
       return null;\r
     }\r
   }\r
-/*  public boolean handleRubberbandEvent(RubberbandEvent evt) {\r
-    System.out.println("Rubberband handler called in RotatableCanvas with " +\r
-                       evt.getBounds());\r
+  /*  public boolean handleRubberbandEvent(RubberbandEvent evt) {\r
+      System.out.println("Rubberband handler called in RotatableCanvas with " +\r
+                         evt.getBounds());\r
 \r
-    Rubberband rb = (Rubberband)evt.getSource();\r
+      Rubberband rb = (Rubberband)evt.getSource();\r
 \r
-    // Clear the current selection (instance variable)\r
-    //if ((rb.getModifiers() & Event.SHIFT_MASK) == 0) {\r
-    //   clearSelection();\r
-    //}\r
+      // Clear the current selection (instance variable)\r
+      //if ((rb.getModifiers() & Event.SHIFT_MASK) == 0) {\r
+      //   clearSelection();\r
+      //}\r
 \r
-    if (rb.getComponent() == this) {\r
-      Rectangle bounds = evt.getBounds();\r
-      rectSelect(bounds.x,bounds.y,bounds.x+bounds.width,bounds.y+bounds.height);\r
-    }\r
+      if (rb.getComponent() == this) {\r
+        Rectangle bounds = evt.getBounds();\r
+   rectSelect(bounds.x,bounds.y,bounds.x+bounds.width,bounds.y+bounds.height);\r
+      }\r
 \r
-    redrawneeded = true;\r
-    paint(this.getGraphics());\r
+      redrawneeded = true;\r
+      paint(this.getGraphics());\r
 \r
-    return true;\r
-  }*/\r
+      return true;\r
+    }*/\r
 \r
 }\r
index 24460ba..71d360d 100755 (executable)
@@ -1,33 +1,35 @@
 /*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 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
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 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 jalview.datamodel.*;\r
 import java.awt.*;\r
 import java.awt.event.*;\r
 \r
-public class ScalePanel extends Panel\r
+import jalview.datamodel.*;\r
+\r
+public class ScalePanel\r
+    extends Panel\r
 {\r
 \r
   protected int offy = 4;\r
-  public    int width;\r
+  public int width;\r
 \r
   protected AlignViewport av;\r
   AlignmentPanel ap;\r
@@ -37,7 +39,7 @@ public class ScalePanel extends Panel
   public ScalePanel(AlignViewport av, AlignmentPanel ap)\r
   {\r
     setLayout(null);\r
-    this.av         = av;\r
+    this.av = av;\r
     this.ap = ap;\r
 \r
     addMouseListener(new MouseAdapter()\r
@@ -46,6 +48,7 @@ public class ScalePanel extends Panel
       {\r
         doMousePressed(evt);\r
       }\r
+\r
       public void mouseReleased(MouseEvent evt)\r
       {\r
         doMouseReleased(evt);\r
@@ -62,21 +65,25 @@ public class ScalePanel extends Panel
 \r
   }\r
 \r
-\r
-  public void doMousePressed(MouseEvent evt) {\r
+  public void doMousePressed(MouseEvent evt)\r
+  {\r
     int x = evt.getX();\r
-    int res = x/av.getCharWidth() + av.getStartRes();\r
+    int res = x / av.getCharWidth() + av.getStartRes();\r
     SequenceGroup sg = null;\r
 \r
     if (av.getColumnSelection().contains(res))\r
+    {\r
       av.getColumnSelection().removeElement(res);\r
+    }\r
     else\r
     {\r
       av.getColumnSelection().addElement(res);\r
 \r
       sg = new SequenceGroup();\r
       for (int i = 0; i < av.alignment.getSequences().size(); i++)\r
+      {\r
         sg.addSequence(av.alignment.getSequenceAt(i));\r
+      }\r
 \r
       sg.setStartRes(res);\r
       sg.setEndRes(res);\r
@@ -89,41 +96,53 @@ public class ScalePanel extends Panel
 \r
   public void doMouseReleased(MouseEvent evt)\r
   {\r
-    if(!stretchingGroup)\r
+    if (!stretchingGroup)\r
+    {\r
       return;\r
+    }\r
 \r
     int x = evt.getX();\r
-    int res = x/av.getCharWidth() + av.getStartRes();\r
+    int res = x / av.getCharWidth() + av.getStartRes();\r
 \r
-   if (! av.getColumnSelection().contains(res))\r
-     av.getColumnSelection().addElement(res);\r
+    if (!av.getColumnSelection().contains(res))\r
+    {\r
+      av.getColumnSelection().addElement(res);\r
+    }\r
 \r
-   SequenceGroup sg = av.getSelectionGroup();\r
+    SequenceGroup sg = av.getSelectionGroup();\r
 \r
-   if(res>sg.getStartRes())\r
-     sg.setEndRes(res);\r
-   else if(res<sg.getStartRes())\r
-     sg.setStartRes(res);\r
+    if (res > sg.getStartRes())\r
+    {\r
+      sg.setEndRes(res);\r
+    }\r
+    else if (res < sg.getStartRes())\r
+    {\r
+      sg.setStartRes(res);\r
+    }\r
 \r
-   stretchingGroup = false;\r
-   ap.repaint();\r
+    stretchingGroup = false;\r
+    ap.repaint();\r
   }\r
 \r
   public void doMouseDragged(MouseEvent evt)\r
   {\r
     int x = evt.getX();\r
-    int res = x/av.getCharWidth() + av.getStartRes();\r
+    int res = x / av.getCharWidth() + av.getStartRes();\r
 \r
     SequenceGroup sg = av.getSelectionGroup();\r
-    if(sg!=null)\r
+    if (sg != null)\r
     {\r
       stretchingGroup = true;\r
       if (res > sg.getStartRes())\r
+      {\r
         sg.setEndRes(res);\r
+      }\r
       else if (res < sg.getStartRes())\r
+      {\r
         sg.setStartRes(res);\r
+      }\r
 \r
-       ap.annotationPanel.addEditableColumn(res);\r
+      ap.annotationPanel.addEditableColumn(res);\r
       ap.repaint();\r
     }\r
   }\r
@@ -135,60 +154,65 @@ public class ScalePanel extends Panel
 \r
   public void paint(Graphics g)\r
   {\r
-    drawScale(g, av.getStartRes(), av.getEndRes(), getSize().width, getSize().height);\r
+    drawScale(g, av.getStartRes(), av.getEndRes(), getSize().width,\r
+              getSize().height);\r
   }\r
 \r
 // scalewidth will normally be screenwidth,\r
-  public void drawScale(Graphics gg, int startx, int endx, int width, int height)\r
+  public void drawScale(Graphics gg, int startx, int endx, int width,\r
+                        int height)\r
   {\r
     gg.setFont(av.getFont());\r
 \r
     //Fill in the background\r
     gg.setColor(Color.white);\r
-    gg.fillRect(0,0,width, height);\r
+    gg.fillRect(0, 0, width, height);\r
     gg.setColor(Color.black);\r
 \r
-\r
     //Fill the selected columns\r
     ColumnSelection cs = av.getColumnSelection();\r
-    gg.setColor(new Color(220,0,0));\r
-    for (int i=0; i<cs.size(); i++)\r
+    gg.setColor(new Color(220, 0, 0));\r
+    for (int i = 0; i < cs.size(); i++)\r
     {\r
-      int sel  = cs.columnAt(i);\r
-      if ( sel >= startx  && sel <= endx)\r
-        gg.fillRect((sel-startx)*av.charWidth,0,av.charWidth, getSize().height);\r
+      int sel = cs.columnAt(i);\r
+      if (sel >= startx && sel <= endx)\r
+      {\r
+        gg.fillRect( (sel - startx) * av.charWidth, 0, av.charWidth,\r
+                    getSize().height);\r
+      }\r
     }\r
 \r
-\r
     // Draw the scale numbers\r
     gg.setColor(Color.black);\r
-    int scalestartx = (startx/10) * 10;\r
+    int scalestartx = (startx / 10) * 10;\r
 \r
     FontMetrics fm = gg.getFontMetrics(av.getFont());\r
-    int y = av.charHeight -fm.getDescent();\r
+    int y = av.charHeight - fm.getDescent();\r
 \r
-    if(scalestartx%10==0)\r
-      scalestartx+=5;\r
+    if (scalestartx % 10 == 0)\r
+    {\r
+      scalestartx += 5;\r
+    }\r
 \r
-    for (int i=scalestartx;i < endx; i+= 5)\r
+    for (int i = scalestartx; i < endx; i += 5)\r
     {\r
-      if(i%10==0)\r
+      if (i % 10 == 0)\r
       {\r
         gg.drawString(String.valueOf(i), (i - startx - 1) * av.charWidth, y);\r
         gg.drawLine( (int) ( (i - startx - 1) * av.charWidth + av.charWidth / 2),\r
-                    y+2,\r
+                    y + 2,\r
                     (int) ( (i - startx - 1) * av.charWidth + av.charWidth / 2),\r
-                    y+fm.getDescent()*2);\r
+                    y + fm.getDescent() * 2);\r
       }\r
       else\r
+      {\r
         gg.drawLine( (int) ( (i - startx - 1) * av.charWidth + av.charWidth / 2),\r
-                    y+fm.getDescent(),\r
+                    y + fm.getDescent(),\r
                     (int) ( (i - startx - 1) * av.charWidth + av.charWidth / 2),\r
-                   y+fm.getDescent()*2);\r
-\r
+                    y + fm.getDescent() * 2);\r
+      }\r
 \r
     }\r
   }\r
 \r
-\r
 }\r
index 6855468..438d7ad 100755 (executable)
@@ -1,60 +1,61 @@
 /*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 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
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
+ */\r
 \r
 package jalview.appletgui;\r
 \r
 import java.awt.*;\r
-import jalview.datamodel.*;\r
-import jalview.analysis.*;\r
 \r
+import jalview.analysis.*;\r
+import jalview.datamodel.*;\r
 \r
-public class SeqCanvas extends Panel\r
+public class SeqCanvas\r
+    extends Panel\r
 {\r
-    FeatureRenderer fr;\r
-    SequenceRenderer sr;\r
-    Image             img;\r
-    Graphics          gg;\r
-    int               imgWidth;\r
-    int               imgHeight;\r
-\r
-    AlignViewport     av;\r
+  FeatureRenderer fr;\r
+  SequenceRenderer sr;\r
+  Image img;\r
+  Graphics gg;\r
+  int imgWidth;\r
+  int imgHeight;\r
 \r
-    boolean showScores = false;\r
-    boolean displaySearch = false;\r
-    int [] searchResults = null;\r
+  AlignViewport av;\r
 \r
-    int chunkHeight;\r
-    int chunkWidth;\r
+  boolean showScores = false;\r
+  boolean displaySearch = false;\r
+  int[] searchResults = null;\r
 \r
-    boolean fastPaint = false;\r
+  int chunkHeight;\r
+  int chunkWidth;\r
 \r
+  boolean fastPaint = false;\r
 \r
-    public SeqCanvas(AlignViewport av)\r
-    {\r
-       this.av         = av;\r
-       fr = new FeatureRenderer(av);\r
-       sr = new SequenceRenderer(av);\r
-       PaintRefresher.Register(this);\r
+  public SeqCanvas(AlignViewport av)\r
+  {\r
+    this.av = av;\r
+    fr = new FeatureRenderer(av);\r
+    sr = new SequenceRenderer(av);\r
+    PaintRefresher.Register(this);\r
 \r
-    }\r
+  }\r
 \r
-  void drawNorthScale(Graphics g, int startx, int endx,int ypos) {\r
+  void drawNorthScale(Graphics g, int startx, int endx, int ypos)\r
+  {\r
     int scalestartx = startx - startx % 10 + 10;\r
 \r
     g.setColor(Color.black);\r
@@ -76,8 +77,8 @@ public class SeqCanvas extends Panel
   void drawWestScale(Graphics g, int startx, int endx, int ypos)\r
   {\r
     FontMetrics fm = getFontMetrics(av.getFont());\r
-    ypos+= av.charHeight;\r
-      // EAST SCALE\r
+    ypos += av.charHeight;\r
+    // EAST SCALE\r
     for (int i = 0; i < av.alignment.getHeight(); i++)\r
     {\r
       SequenceI seq = av.alignment.getSequenceAt(i);\r
@@ -94,46 +95,50 @@ public class SeqCanvas extends Panel
         value = av.alignment.getSequenceAt(i).findPosition(index);\r
         break;\r
       }\r
-      if(value!=-1)\r
+      if (value != -1)\r
       {\r
-        int x = LABEL_WEST - fm.stringWidth(value+"");\r
-        g.drawString(value + "", x,  ypos +  i*av.charHeight - av.charHeight/5);\r
+        int x = LABEL_WEST - fm.stringWidth(value + "");\r
+        g.drawString(value + "", x,\r
+                     ypos + i * av.charHeight - av.charHeight / 5);\r
       }\r
     }\r
   }\r
 \r
   void drawEastScale(Graphics g, int startx, int endx, int ypos)\r
-{\r
-    ypos+= av.charHeight;\r
-    // EAST SCALE\r
-  for (int i = 0; i < av.alignment.getHeight(); i++)\r
   {\r
-    SequenceI seq = av.alignment.getSequenceAt(i);\r
-    int index = endx;\r
-    int value = -1;\r
-    while (index > startx)\r
+    ypos += av.charHeight;\r
+    // EAST SCALE\r
+    for (int i = 0; i < av.alignment.getHeight(); i++)\r
     {\r
-      if (jalview.util.Comparison.isGap(seq.getCharAt(index)))\r
+      SequenceI seq = av.alignment.getSequenceAt(i);\r
+      int index = endx;\r
+      int value = -1;\r
+      while (index > startx)\r
       {\r
-        index--;\r
-        continue;\r
-      }\r
+        if (jalview.util.Comparison.isGap(seq.getCharAt(index)))\r
+        {\r
+          index--;\r
+          continue;\r
+        }\r
 \r
-      value = av.alignment.getSequenceAt(i).findPosition(index);\r
-      break;\r
+        value = av.alignment.getSequenceAt(i).findPosition(index);\r
+        break;\r
+      }\r
+      if (value != -1)\r
+      {\r
+        g.drawString(value + "", 0,\r
+                     ypos + i * av.charHeight - av.charHeight / 5);\r
+      }\r
     }\r
-    if(value!=-1)\r
-       g.drawString(value + "", 0,  ypos +  i*av.charHeight - av.charHeight/5);\r
-  }\r
-\r
-}\r
-\r
 \r
+  }\r
 \r
-public void fastPaint(int horizontal, int vertical)\r
-{\r
-    if (horizontal == 0 && vertical == 0 || gg==null)\r
+  public void fastPaint(int horizontal, int vertical)\r
+  {\r
+    if (horizontal == 0 && vertical == 0 || gg == null)\r
+    {\r
       return;\r
+    }\r
 \r
     gg.copyArea(0, 0, imgWidth, imgHeight, -horizontal * av.charWidth,\r
                 -vertical * av.charHeight);\r
@@ -146,46 +151,53 @@ public void fastPaint(int horizontal, int vertical)
       sr = er - horizontal;\r
     }\r
     else if (horizontal < 0)\r
+    {\r
       er = sr - horizontal;\r
+    }\r
 \r
     else if (vertical > 0) // scroll down\r
     {\r
       ss = es - vertical;\r
-      if(ss<av.startSeq) // ie scrolling too fast, more than a page at a time\r
+      if (ss < av.startSeq) // ie scrolling too fast, more than a page at a time\r
+      {\r
         ss = av.startSeq;\r
+      }\r
       else\r
+      {\r
         transY = imgHeight - vertical * av.charHeight;\r
+      }\r
     }\r
     else if (vertical < 0)\r
     {\r
       es = ss - vertical;\r
-      if(es > av.endSeq)\r
+      if (es > av.endSeq)\r
+      {\r
         es = av.endSeq;\r
+      }\r
     }\r
 \r
-\r
     gg.translate(transX, transY);\r
 \r
     gg.setColor(Color.white);\r
-    gg.fillRect(0,0, (er-sr+1)*av.charWidth, (es-ss)*av.charHeight);\r
+    gg.fillRect(0, 0, (er - sr + 1) * av.charWidth, (es - ss) * av.charHeight);\r
     drawPanel(gg, sr, er, ss, es, sr, ss, 0);\r
     gg.translate( -transX, -transY);\r
 \r
     fastPaint = true;\r
     repaint();\r
 \r
-}\r
+  }\r
 \r
-/**\r
- * Definitions of startx and endx (hopefully):\r
- * SMJS This is what I'm working towards!\r
- *   startx is the first residue (starting at 0) to display.\r
- *   endx   is the last residue to display (starting at 0).\r
- *   starty is the first sequence to display (starting at 0).\r
- *   endy   is the last sequence to display (starting at 0).\r
- * NOTE 1: The av limits are set in setFont in this class and\r
- * in the adjustment listener in SeqPanel when the scrollbars move.\r
- */\r
+  /**\r
+   * Definitions of startx and endx (hopefully):\r
+   * SMJS This is what I'm working towards!\r
+   *   startx is the first residue (starting at 0) to display.\r
+   *   endx   is the last residue to display (starting at 0).\r
+   *   starty is the first sequence to display (starting at 0).\r
+   *   endy   is the last sequence to display (starting at 0).\r
+   * NOTE 1: The av limits are set in setFont in this class and\r
+   * in the adjustment listener in SeqPanel when the scrollbars move.\r
+   */\r
   public void update(Graphics g)\r
   {\r
     paint(g);\r
@@ -201,36 +213,43 @@ public void fastPaint(int horizontal, int vertical)
     }\r
 \r
     // this draws the whole of the alignment\r
-      imgWidth  = this.getSize().width;\r
-      imgHeight = this.getSize().height;\r
+    imgWidth = this.getSize().width;\r
+    imgHeight = this.getSize().height;\r
 \r
-      imgWidth -= imgWidth%av.charWidth;\r
-      imgHeight-= imgHeight%av.charHeight;\r
+    imgWidth -= imgWidth % av.charWidth;\r
+    imgHeight -= imgHeight % av.charHeight;\r
 \r
-      if(imgWidth<1 || imgHeight<1)\r
-              return;\r
+    if (imgWidth < 1 || imgHeight < 1)\r
+    {\r
+      return;\r
+    }\r
 \r
-      if(img==null || imgWidth!=img.getWidth(this) || imgHeight!=img.getHeight(this))\r
-      {\r
-        img = createImage(imgWidth, imgHeight);\r
-        gg = img.getGraphics();\r
-        gg.setFont(av.getFont());\r
-      }\r
+    if (img == null || imgWidth != img.getWidth(this) ||\r
+        imgHeight != img.getHeight(this))\r
+    {\r
+      img = createImage(imgWidth, imgHeight);\r
+      gg = img.getGraphics();\r
+      gg.setFont(av.getFont());\r
+    }\r
 \r
-      gg.setColor(Color.white);\r
-      gg.fillRect(0,0,imgWidth,imgHeight);\r
+    gg.setColor(Color.white);\r
+    gg.fillRect(0, 0, imgWidth, imgHeight);\r
 \r
-    chunkWidth  =   getWrappedCanvasWidth( getSize().width );\r
-    chunkHeight =  (av.getAlignment().getHeight() + 2)*av.charHeight;\r
+    chunkWidth = getWrappedCanvasWidth(getSize().width);\r
+    chunkHeight = (av.getAlignment().getHeight() + 2) * av.charHeight;\r
 \r
     av.setChunkHeight(chunkHeight);\r
     av.setChunkWidth(chunkWidth);\r
 \r
-\r
     if (av.getWrapAlignment())\r
+    {\r
       drawWrappedPanel(gg, getSize().width, getSize().height, av.startRes);\r
+    }\r
     else\r
-      drawPanel(gg, av.startRes, av.endRes, av.startSeq, av.endSeq, av.startRes, av.startSeq, 0);\r
+    {\r
+      drawPanel(gg, av.startRes, av.endRes, av.startSeq, av.endSeq, av.startRes,\r
+                av.startSeq, 0);\r
+    }\r
 \r
     g.drawImage(img, 0, 0, this);\r
 \r
@@ -244,84 +263,102 @@ public void fastPaint(int horizontal, int vertical)
     LABEL_EAST = 0;\r
     LABEL_WEST = 0;\r
 \r
-    if(av.scaleRightWrapped)\r
-      LABEL_EAST = fm.stringWidth( av.alignment.getWidth()+"000" );\r
+    if (av.scaleRightWrapped)\r
+    {\r
+      LABEL_EAST = fm.stringWidth(av.alignment.getWidth() + "000");\r
+    }\r
 \r
-    if(av.scaleLeftWrapped)\r
-      LABEL_WEST = fm.stringWidth( av.alignment.getWidth()+"" );\r
+    if (av.scaleLeftWrapped)\r
+    {\r
+      LABEL_WEST = fm.stringWidth(av.alignment.getWidth() + "");\r
+    }\r
 \r
-    return  (cwidth - LABEL_EAST -LABEL_WEST)/av.charWidth;\r
+    return (cwidth - LABEL_EAST - LABEL_WEST) / av.charWidth;\r
   }\r
 \r
-  public void drawWrappedPanel(Graphics g, int canvasWidth, int canvasHeight, int startRes)\r
+  public void drawWrappedPanel(Graphics g, int canvasWidth, int canvasHeight,\r
+                               int startRes)\r
   {\r
-      AlignmentI al = av.getAlignment();\r
+    AlignmentI al = av.getAlignment();\r
 \r
-      FontMetrics fm = getFontMetrics(av.getFont());\r
+    FontMetrics fm = getFontMetrics(av.getFont());\r
 \r
-      int LABEL_EAST = 0;\r
-      if(av.scaleRightWrapped)\r
-        LABEL_EAST = fm.stringWidth( al.getWidth()+"000" );\r
-      int LABEL_WEST = 0;\r
-      if(av.scaleLeftWrapped)\r
-        LABEL_WEST = fm.stringWidth(al.getWidth()+"0");\r
+    int LABEL_EAST = 0;\r
+    if (av.scaleRightWrapped)\r
+    {\r
+      LABEL_EAST = fm.stringWidth(al.getWidth() + "000");\r
+    }\r
+    int LABEL_WEST = 0;\r
+    if (av.scaleLeftWrapped)\r
+    {\r
+      LABEL_WEST = fm.stringWidth(al.getWidth() + "0");\r
+    }\r
 \r
+    int cWidth = (canvasWidth - LABEL_EAST - LABEL_WEST) / av.charWidth;\r
+    int cHeight = (av.getAlignment().getHeight() + 2) * av.charHeight;\r
 \r
-      int cWidth  =   (canvasWidth - LABEL_EAST -LABEL_WEST)/av.charWidth;\r
-      int cHeight =  (av.getAlignment().getHeight() + 2)*av.charHeight;\r
+    av.endRes = av.startRes + cWidth;\r
 \r
-      av.endRes = av.startRes + cWidth;\r
+    int endx = startRes + cWidth - 1;\r
+    int ypos = 2 * av.charHeight;\r
 \r
-      int  endx   = startRes+cWidth-1;\r
-      int  ypos  = 2*av.charHeight;\r
+    while (ypos <= canvasHeight && startRes < av.alignment.getWidth())\r
+    {\r
+      g.setColor(Color.black);\r
 \r
-      while (ypos <= canvasHeight && startRes<av.alignment.getWidth() )\r
+      if (av.scaleLeftWrapped)\r
       {\r
-        g.setColor(Color.black);\r
+        drawWestScale(g, startRes, endx, ypos);\r
+      }\r
 \r
-        if(av.scaleLeftWrapped)\r
-          drawWestScale(g, startRes, endx, ypos);\r
+      if (av.scaleRightWrapped)\r
+      {\r
+        g.translate(canvasWidth - LABEL_EAST + av.charWidth, 0);\r
+        drawEastScale(g, startRes, endx, ypos);\r
+        g.translate( - (canvasWidth - LABEL_EAST + av.charWidth), 0);\r
+      }\r
 \r
-        if(av.scaleRightWrapped)\r
-        {\r
-          g.translate(canvasWidth - LABEL_EAST +av.charWidth, 0);\r
-          drawEastScale(g, startRes, endx, ypos);\r
-          g.translate( - (canvasWidth - LABEL_EAST+av.charWidth), 0);\r
-        }\r
+      g.translate(LABEL_WEST, 0);\r
+      if (av.scaleAboveWrapped)\r
+      {\r
+        drawNorthScale(g, startRes, endx, ypos);\r
+      }\r
 \r
-        g.translate(LABEL_WEST,0);\r
-        if(av.scaleAboveWrapped)\r
-          drawNorthScale(g, startRes, endx, ypos);\r
-\r
-\r
-        // When printing we have an extra clipped region,\r
-        // the Printable page which we need to account for here\r
-        Shape clip = g.getClip();\r
-        if(clip==null)\r
-          g.setClip(0, 0, cWidth*av.charWidth, canvasHeight);\r
-        else\r
-          g.setClip(0,\r
-                    (int)clip.getBounds().y,\r
-                    cWidth*av.charWidth,\r
-                    (int)clip.getBounds().height\r
-                    );\r
-\r
-        drawPanel(g, startRes, endx, 0, al.getHeight(), startRes, 0, ypos);\r
-        g.setClip(clip);\r
-        g.translate(-LABEL_WEST,0);\r
-\r
-        ypos += cHeight;\r
-        startRes += cWidth;\r
-        endx = startRes + cWidth - 1;\r
-\r
-        if (endx > al.getWidth())\r
-          endx = al.getWidth();\r
+      // When printing we have an extra clipped region,\r
+      // the Printable page which we need to account for here\r
+      Shape clip = g.getClip();\r
+      if (clip == null)\r
+      {\r
+        g.setClip(0, 0, cWidth * av.charWidth, canvasHeight);\r
+      }\r
+      else\r
+      {\r
+        g.setClip(0,\r
+                  (int) clip.getBounds().y,\r
+                  cWidth * av.charWidth,\r
+                  (int) clip.getBounds().height\r
+            );\r
       }\r
 \r
-  }\r
+      drawPanel(g, startRes, endx, 0, al.getHeight(), startRes, 0, ypos);\r
+      g.setClip(clip);\r
+      g.translate( -LABEL_WEST, 0);\r
 \r
+      ypos += cHeight;\r
+      startRes += cWidth;\r
+      endx = startRes + cWidth - 1;\r
 \r
-  synchronized public void drawPanel(Graphics g,int x1,int x2, int y1, int y2,int startx, int starty,int offset) {\r
+      if (endx > al.getWidth())\r
+      {\r
+        endx = al.getWidth();\r
+      }\r
+    }\r
+\r
+  }\r
+\r
+  synchronized public void drawPanel(Graphics g, int x1, int x2, int y1, int y2,\r
+                                     int startx, int starty, int offset)\r
+  {\r
 \r
     g.setFont(av.getFont());\r
     sr.renderGaps(av.renderGaps);\r
@@ -330,23 +367,24 @@ public void fastPaint(int horizontal, int vertical)
 \r
     /// First draw the sequences\r
     /////////////////////////////\r
-    for (int i = y1 ; i < y2 ;i++)\r
+    for (int i = y1; i < y2; i++)\r
     {\r
-     nextSeq = av.alignment.getSequenceAt(i);\r
-\r
-     sr.drawSequence(g, nextSeq, av.alignment.findAllGroups( nextSeq ),x1,x2,\r
-                 (x1 - startx) * av.charWidth,\r
-                 offset + AlignmentUtil.getPixelHeight(starty, i, av.charHeight),\r
-                 av.charWidth,av.charHeight);\r
-\r
-     if(av.showSequenceFeatures)\r
-     {\r
-       fr.drawSequence(g, nextSeq, av.alignment.findAllGroups( nextSeq ), x1, x2,\r
-                       (x1 - startx) * av.charWidth,\r
-                       offset +\r
-                       AlignmentUtil.getPixelHeight(starty, i, av.charHeight),\r
-                       av.charWidth, av.charHeight);\r
-     }\r
+      nextSeq = av.alignment.getSequenceAt(i);\r
+\r
+      sr.drawSequence(g, nextSeq, av.alignment.findAllGroups(nextSeq), x1, x2,\r
+                      (x1 - startx) * av.charWidth,\r
+                      offset +\r
+                      AlignmentUtil.getPixelHeight(starty, i, av.charHeight),\r
+                      av.charWidth, av.charHeight);\r
+\r
+      if (av.showSequenceFeatures)\r
+      {\r
+        fr.drawSequence(g, nextSeq, av.alignment.findAllGroups(nextSeq), x1, x2,\r
+                        (x1 - startx) * av.charWidth,\r
+                        offset +\r
+                        AlignmentUtil.getPixelHeight(starty, i, av.charHeight),\r
+                        av.charWidth, av.charHeight);\r
+      }\r
     }\r
     //\r
     /////////////////////////////////////\r
@@ -365,42 +403,47 @@ public void fastPaint(int horizontal, int vertical)
     }\r
 \r
     if (group != null)\r
+    {\r
       do\r
       {\r
         int oldY = -1;\r
         int i = 0;\r
         boolean inGroup = false;\r
-        int top=-1, bottom =-1;\r
+        int top = -1, bottom = -1;\r
         for (i = y1; i < y2; i++)\r
         {\r
           sx = (group.getStartRes() - startx) * av.charWidth;\r
           sy = offset + AlignmentUtil.getPixelHeight(starty, i, av.charHeight);\r
-          ex = (group.getEndRes() + 1 - group.getStartRes()) * av.charWidth -1;\r
+          ex = (group.getEndRes() + 1 - group.getStartRes()) * av.charWidth - 1;\r
 \r
           if (sx < getSize().width\r
               && ex > 0\r
               && group.sequences.contains(av.alignment.getSequenceAt(i)))\r
           {\r
-            if (bottom == -1 && (i==av.alignment.getHeight()-1 ||\r
-                !group.sequences.contains(av.alignment.getSequenceAt(i + 1))))\r
-              bottom = sy + av.charHeight ;\r
+            if (bottom == -1 && (i == av.alignment.getHeight() - 1 ||\r
+                                 !group.sequences.contains(av.alignment.\r
+                getSequenceAt(i + 1))))\r
+            {\r
+              bottom = sy + av.charHeight;\r
+            }\r
 \r
             if (!inGroup)\r
             {\r
-              if (top == -1 && i==0 ||\r
+              if (top == -1 && i == 0 ||\r
                   !group.sequences.contains(av.alignment.getSequenceAt(i - 1)))\r
+              {\r
                 top = sy;\r
-\r
+              }\r
 \r
               oldY = sy;\r
               inGroup = true;\r
               if (group == av.getSelectionGroup())\r
               {\r
-                    g.setColor(new Color(255,0,0));\r
+                g.setColor(new Color(255, 0, 0));\r
               }\r
               else\r
               {\r
-                    g.setColor(group.getOutlineColour());\r
+                g.setColor(group.getOutlineColour());\r
               }\r
             }\r
           }\r
@@ -408,13 +451,13 @@ public void fastPaint(int horizontal, int vertical)
           {\r
             if (inGroup)\r
             {\r
-              g.drawLine(sx, oldY, sx, sy );\r
-              g.drawLine(sx+ex, oldY, sx+ex, sy );\r
+              g.drawLine(sx, oldY, sx, sy);\r
+              g.drawLine(sx + ex, oldY, sx + ex, sy);\r
 \r
               if (top != -1)\r
               {\r
                 g.drawLine(sx, top, sx + ex, top);\r
-                top =-1;\r
+                top = -1;\r
               }\r
               if (bottom != -1)\r
               {\r
@@ -422,7 +465,6 @@ public void fastPaint(int horizontal, int vertical)
                 bottom = -1;\r
               }\r
 \r
-\r
               inGroup = false;\r
             }\r
           }\r
@@ -431,37 +473,39 @@ public void fastPaint(int horizontal, int vertical)
         if (inGroup)\r
         {\r
 \r
-          if(top!=-1)\r
+          if (top != -1)\r
           {\r
             g.drawLine(sx, top, sx + ex, top);\r
-            top =-1;\r
+            top = -1;\r
           }\r
-          if(bottom!=-1)\r
-           {\r
-             g.drawLine(sx, bottom-1, sx + ex, bottom-1);\r
-             bottom = -1;\r
+          if (bottom != -1)\r
+          {\r
+            g.drawLine(sx, bottom - 1, sx + ex, bottom - 1);\r
+            bottom = -1;\r
 \r
-           }\r
+          }\r
           sy = offset + AlignmentUtil.getPixelHeight(starty, i, av.charHeight);\r
-          g.drawLine(sx, oldY, sx, sy );\r
-          g.drawLine(sx+ex, oldY, sx+ex, sy );\r
+          g.drawLine(sx, oldY, sx, sy);\r
+          g.drawLine(sx + ex, oldY, sx + ex, sy);\r
           inGroup = false;\r
         }\r
         groupIndex++;\r
         if (groupIndex >= groups.size())\r
+        {\r
           break;\r
+        }\r
 \r
         group = (SequenceGroup) groups.elementAt(groupIndex);\r
 \r
       }\r
       while (groupIndex < groups.size());\r
-\r
+    }\r
 \r
     /// Highlight search Results once all sequences have been drawn\r
     //////////////////////////////////////////////////////////\r
-    if(displaySearch)\r
+    if (displaySearch)\r
     {\r
-      for(int r=0; r<searchResults.length; r+=3)\r
+      for (int r = 0; r < searchResults.length; r += 3)\r
       {\r
         int searchSeq = searchResults[r];\r
 \r
@@ -469,21 +513,26 @@ public void fastPaint(int horizontal, int vertical)
         {\r
           SequenceI seq = av.getAlignment().getSequenceAt(searchSeq);\r
 \r
-          int searchStart = seq.findIndex( searchResults[r+1] )-1;\r
-          int searchEnd =  seq.findIndex(  searchResults[r+2] )-1;\r
+          int searchStart = seq.findIndex(searchResults[r + 1]) - 1;\r
+          int searchEnd = seq.findIndex(searchResults[r + 2]) - 1;\r
 \r
           SequenceRenderer ssr = (SequenceRenderer) sr;\r
-          if(searchStart<x1)\r
+          if (searchStart < x1)\r
+          {\r
             searchStart = x1;\r
-          if(searchEnd > x2)\r
+          }\r
+          if (searchEnd > x2)\r
+          {\r
             searchEnd = x2;\r
+          }\r
 \r
           ssr.drawHighlightedText(seq,\r
                                   searchStart,\r
                                   searchEnd,\r
                                   (searchStart - startx) * av.charWidth,\r
                                   offset +\r
-                                  AlignmentUtil.getPixelHeight(starty, searchSeq,\r
+                                  AlignmentUtil.getPixelHeight(starty,\r
+              searchSeq,\r
               av.charHeight),\r
                                   av.charWidth,\r
                                   av.charHeight);\r
@@ -493,20 +542,21 @@ public void fastPaint(int horizontal, int vertical)
 \r
   }\r
 \r
-\r
-\r
-  public void highlightSearchResults(int [] results)\r
+  public void highlightSearchResults(int[] results)\r
   {\r
     // results are in the order sequence, startRes, endRes\r
-    if(results==null)\r
+    if (results == null)\r
+    {\r
       displaySearch = false;\r
+    }\r
     else\r
+    {\r
       displaySearch = true;\r
+    }\r
 \r
     searchResults = results;\r
 \r
     repaint();\r
   }\r
 \r
-\r
 }\r
index 163b967..1720edc 100755 (executable)
@@ -1,41 +1,43 @@
 /*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 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
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 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
-import java.util.*;\r
 import jalview.schemes.*;\r
 \r
-\r
-public class SeqPanel extends Panel\r
+public class SeqPanel\r
+    extends Panel\r
 {\r
 \r
-  public    SeqCanvas         seqCanvas;\r
-  public    AlignmentPanel    ap;\r
+  public SeqCanvas seqCanvas;\r
+  public AlignmentPanel ap;\r
 \r
   protected int lastres;\r
   protected int startseq;\r
-  int startEdit=-1;\r
-  int endEdit=-1;\r
+  int startEdit = -1;\r
+  int endEdit = -1;\r
 \r
   protected AlignViewport av;\r
 \r
@@ -48,74 +50,101 @@ public class SeqPanel extends Panel
   boolean editingSeqs = false;\r
   boolean groupEditing = false;\r
 \r
+  public SeqPanel(AlignViewport avp, AlignmentPanel p)\r
+  {\r
+    this.av = avp;\r
 \r
-\r
-  public SeqPanel(AlignViewport avp, AlignmentPanel p) {\r
-    this.av         = avp;\r
-\r
-    seqCanvas  = new SeqCanvas(avp);\r
+    seqCanvas = new SeqCanvas(avp);\r
     setLayout(new BorderLayout());\r
     add(seqCanvas);\r
 \r
     ap = p;\r
 \r
-    seqCanvas.addMouseMotionListener( new MouseMotionAdapter()\r
+    seqCanvas.addMouseMotionListener(new MouseMotionAdapter()\r
     {\r
       public void mouseMoved(MouseEvent evt)\r
       {\r
-       if(av.getWrapAlignment())\r
-         return;\r
-        doMouseMoved(evt);    }\r
+        if (av.getWrapAlignment())\r
+        {\r
+          return;\r
+        }\r
+        doMouseMoved(evt);\r
+      }\r
 \r
       public void mouseDragged(MouseEvent evt)\r
       {\r
-        if(av.getWrapAlignment())\r
-         return;\r
-        if( editingSeqs )\r
+        if (av.getWrapAlignment())\r
+        {\r
+          return;\r
+        }\r
+        if (editingSeqs)\r
+        {\r
           doMouseDragged(evt);\r
+        }\r
         else\r
+        {\r
           doMouseDraggedDefineMode(evt);\r
+        }\r
       }\r
     });\r
 \r
-    seqCanvas.addMouseListener( new MouseAdapter()\r
+    seqCanvas.addMouseListener(new MouseAdapter()\r
     {\r
       public void mouseReleased(MouseEvent evt)\r
       {\r
-        if(av.getWrapAlignment())\r
-         return;\r
-        if(editingSeqs)\r
+        if (av.getWrapAlignment())\r
+        {\r
+          return;\r
+        }\r
+        if (editingSeqs)\r
+        {\r
           doMouseReleased(evt);\r
+        }\r
         else\r
+        {\r
           doMouseReleasedDefineMode(evt);\r
+        }\r
 \r
       }\r
+\r
       public void mousePressed(MouseEvent evt)\r
       {\r
-        if(av.getWrapAlignment())\r
-         return;\r
-        if(evt.isShiftDown() || evt.isAltDown() || evt.isControlDown())\r
+        if (av.getWrapAlignment())\r
         {\r
-          if(evt.isAltDown() || evt.isControlDown())\r
+          return;\r
+        }\r
+        if (evt.isShiftDown() || evt.isAltDown() || evt.isControlDown())\r
+        {\r
+          if (evt.isAltDown() || evt.isControlDown())\r
+          {\r
             groupEditing = true;\r
+          }\r
 \r
           editingSeqs = true;\r
           doMousePressed(evt);\r
         }\r
         else\r
+        {\r
           doMousePressedDefineMode(evt);\r
+        }\r
       }\r
+\r
       public void mouseExited(MouseEvent evt)\r
       {\r
         if (av.getWrapAlignment() || editingSeqs)\r
-                return;\r
-              doMouseExitedDefineMode(evt);\r
+        {\r
+          return;\r
+        }\r
+        doMouseExitedDefineMode(evt);\r
 \r
       }\r
+\r
       public void mouseEntered(MouseEvent evt)\r
       {\r
         if (av.getWrapAlignment() || editingSeqs)\r
+        {\r
           return;\r
+        }\r
         doMouseEnteredDefineMode(evt);\r
       }\r
 \r
@@ -123,31 +152,34 @@ public class SeqPanel extends Panel
     seqCanvas.repaint();\r
   }\r
 \r
+  public void doMouseReleased(MouseEvent evt)\r
+  {\r
 \r
-  public void doMouseReleased(MouseEvent evt) {\r
-\r
-    if(seqEditOccurred>-1)\r
+    if (seqEditOccurred > -1)\r
+    {\r
       editOccurred(seqEditOccurred);\r
+    }\r
 \r
     startseq = -1;\r
-    lastres  = -1;\r
+    lastres = -1;\r
     seqEditOccurred = -1;\r
-    editingSeqs  = false;\r
+    editingSeqs = false;\r
     groupEditing = false;\r
     ap.repaint();\r
   }\r
 \r
-  public void doMousePressed(MouseEvent evt) {\r
-    ap.alignFrame.addHistoryItem( new HistoryItem(\r
-        "Edit Sequence",av.alignment, HistoryItem.EDIT));\r
+  public void doMousePressed(MouseEvent evt)\r
+  {\r
+    ap.alignFrame.addHistoryItem(new HistoryItem(\r
+        "Edit Sequence", av.alignment, HistoryItem.EDIT));\r
     int seq;\r
     int res;\r
 \r
     int x = evt.getX();\r
     int y = evt.getY();\r
 \r
-    res = x/av.getCharWidth() + av.getStartRes();\r
-    seq = y/av.getCharHeight() + av.getStartSeq();\r
+    res = x / av.getCharWidth() + av.getStartRes();\r
+    seq = y / av.getCharHeight() + av.getStartSeq();\r
 \r
     if (seq < av.getAlignment().getHeight() &&\r
         res < av.getAlignment().getSequenceAt(seq).getLength())\r
@@ -170,217 +202,248 @@ public class SeqPanel extends Panel
 \r
   public void doMouseMoved(MouseEvent evt)\r
   {\r
-    int res=0, seq=0;\r
+    int res = 0, seq = 0;\r
     int x = evt.getX();\r
     int y = evt.getY();\r
-    if(av.wrapAlignment)\r
+    if (av.wrapAlignment)\r
     {\r
-      y -= 2*av.charHeight;\r
-      int chunkHeight = (av.getAlignment().getHeight()+2)*av.charHeight;\r
+      y -= 2 * av.charHeight;\r
+      int chunkHeight = (av.getAlignment().getHeight() + 2) * av.charHeight;\r
 \r
-\r
-      res =   (int)((y/chunkHeight)*(getSize().width/av.charWidth)) +  x/av.getCharWidth() + av.getStartRes();\r
+      res = (int) ( (y / chunkHeight) * (getSize().width / av.charWidth)) +\r
+          x / av.getCharWidth() + av.getStartRes();\r
 \r
       y %= chunkHeight;\r
-      seq =     y / av.getCharHeight() + av.getStartSeq();\r
+      seq = y / av.getCharHeight() + av.getStartSeq();\r
 \r
     }\r
     else\r
     {\r
-      res = x / av.getCharWidth()  + av.getStartRes();\r
+      res = x / av.getCharWidth() + av.getStartRes();\r
       seq = y / av.getCharHeight() + av.getStartSeq();\r
     }\r
 \r
-\r
-    if(seq>=av.getAlignment().getHeight())\r
+    if (seq >= av.getAlignment().getHeight())\r
+    {\r
       return;\r
+    }\r
 \r
     SequenceI sequence = av.getAlignment().getSequenceAt(seq);\r
-    if(res>sequence.getLength())\r
+    if (res > sequence.getLength())\r
+    {\r
       return;\r
+    }\r
 \r
-    Object obj = ResidueProperties.aa2Triplet.get( sequence.getCharAt(res)+"" ) ;\r
+    Object obj = ResidueProperties.aa2Triplet.get(sequence.getCharAt(res) + "");\r
     String aa = "";\r
-    if(obj!=null)\r
-         aa = obj.toString();\r
+    if (obj != null)\r
+    {\r
+      aa = obj.toString();\r
+    }\r
 \r
-    StringBuffer text = new StringBuffer("Sequence " +(seq+1)+" ID: "+sequence.getName());\r
-    if(aa!="")\r
-      text.append("  Residue: "+aa+" ("+  av.getAlignment().getSequenceAt(seq).findPosition(res)+")");\r
+    StringBuffer text = new StringBuffer("Sequence " + (seq + 1) + " ID: " +\r
+                                         sequence.getName());\r
+    if (aa != "")\r
+    {\r
+      text.append("  Residue: " + aa + " (" +\r
+                  av.getAlignment().getSequenceAt(seq).findPosition(res) + ")");\r
+    }\r
 \r
     ap.alignFrame.statusBar.setText(text.toString());\r
 \r
     // use aa to see if the mouse pointer is on a\r
-    if(  av.showSequenceFeatures)\r
+    if (av.showSequenceFeatures)\r
     {\r
       Vector features = sequence.getSequenceFeatures();\r
       Enumeration e = features.elements();\r
       StringBuffer sbuffer = new StringBuffer();\r
 \r
-\r
       while (e.hasMoreElements())\r
       {\r
         SequenceFeature sf = (SequenceFeature) e.nextElement();\r
         if (sf.getStart() <= sequence.findPosition(res) &&\r
             sf.getEnd() >= sequence.findPosition(res))\r
         {\r
-          if(sbuffer.length()>0)\r
+          if (sbuffer.length() > 0)\r
+          {\r
             sbuffer.append("; ");\r
+          }\r
           sbuffer.append(sf.getType() + " " + sf.getDescription());\r
-          if(sf.getStatus().length()>0)\r
-            sbuffer.append(" ("+sf.getStatus()+")");\r
+          if (sf.getStatus().length() > 0)\r
+          {\r
+            sbuffer.append(" (" + sf.getStatus() + ")");\r
+          }\r
         }\r
 \r
       }\r
     }\r
 \r
-\r
   }\r
 \r
-  public void doMouseDragged(MouseEvent evt) {\r
-\r
-      // If we're dragging we're editing\r
-      int res = evt.getX() / av.getCharWidth() + av.getStartRes();\r
-      if (res < 0)\r
-        res = 0;\r
-\r
-      if (lastres == -1 || lastres == res)\r
-        return;\r
-\r
-      boolean dragRight = true;\r
-      if (res < av.getAlignment().getWidth() && res < lastres)\r
-        dragRight = false;\r
-\r
-\r
-      if (res != lastres)\r
-     {\r
-         // Group editing\r
-         if (groupEditing)\r
-         {\r
-           SequenceGroup sg = av.getSelectionGroup();\r
-           if(sg==null)\r
-           {\r
-             lastres=-1;\r
-             return;\r
-           }\r
-\r
-             // drag to right\r
-             if(dragRight)\r
-                 sg.setEndRes(sg.getEndRes() + (res-lastres));\r
-\r
-             // drag to left\r
-             else\r
-             {\r
-                /// Are we able to delete?\r
-                // ie are all columns blank?\r
-                boolean deleteAllowed = false;\r
-               for (int s = 0; s < sg.getSize(); s++)\r
-               {\r
-                 SequenceI seq = sg.getSequenceAt(s);\r
-                 for (int j=res; j<lastres; j++)\r
-                 {\r
-                   if(seq.getSequence().length()<=j)\r
-                     continue;\r
-\r
-                   if(!jalview.util.Comparison.isGap(seq.getSequence().charAt(j)))\r
-                   {\r
-                     // Not a gap, block edit not valid\r
-                     res=j+1;\r
-                     deleteAllowed = false;\r
-                     continue;\r
-                   }\r
-                   deleteAllowed = true;\r
-                 }\r
-               }\r
-\r
-               if(!deleteAllowed)\r
-               {\r
-                 lastres = -1;\r
-                 return;\r
-               }\r
-\r
-               sg.setEndRes(sg.getEndRes() - (lastres-res));\r
-             }\r
-\r
-\r
-             for (int i = 0; i < sg.getSize(); i++)\r
-             {\r
-               SequenceI s = sg.getSequenceAt(i);\r
-               int k = av.alignment.findIndex(s);\r
-\r
-               // drag to right\r
-               if (dragRight)\r
-                 for (int j = lastres; j < res; j++)\r
-                   insertChar(j, k);\r
-\r
-               // drag to left\r
-               else\r
-               {\r
-                 for (int j = res; j < lastres; j++)\r
-                 {\r
-                   if(s.getLength()>j)\r
-                     deleteChar(res, k);\r
-                 }\r
-               }\r
-             }\r
-         }\r
-         else /////Editing a single sequence///////////\r
-         {\r
-           if (res < av.getAlignment().getWidth() && res > lastres)\r
-           {\r
-             // dragging to the right\r
-             for (int j = lastres; j < res; j++)\r
-               insertChar(j, startseq);\r
-           }\r
-           else if (res < av.getAlignment().getWidth() && res < lastres)\r
-           {\r
-             // dragging to the left\r
-             for (int j = lastres; j > res; j--)\r
-             {\r
-               if( jalview.util.Comparison.isGap(\r
-                 av.alignment.getSequenceAt(startseq).getSequence().charAt(res)))\r
-\r
-               deleteChar(res, startseq);\r
-               else\r
-               {\r
-\r
-                 break;\r
-               }\r
-             }\r
-           }\r
-\r
-         }\r
-     }\r
-\r
-     endEdit = res;\r
-     lastres = res;\r
-      seqCanvas.repaint();\r
+  public void doMouseDragged(MouseEvent evt)\r
+  {\r
+\r
+    // If we're dragging we're editing\r
+    int res = evt.getX() / av.getCharWidth() + av.getStartRes();\r
+    if (res < 0)\r
+    {\r
+      res = 0;\r
+    }\r
+\r
+    if (lastres == -1 || lastres == res)\r
+    {\r
+      return;\r
+    }\r
+\r
+    boolean dragRight = true;\r
+    if (res < av.getAlignment().getWidth() && res < lastres)\r
+    {\r
+      dragRight = false;\r
+    }\r
+\r
+    if (res != lastres)\r
+    {\r
+      // Group editing\r
+      if (groupEditing)\r
+      {\r
+        SequenceGroup sg = av.getSelectionGroup();\r
+        if (sg == null)\r
+        {\r
+          lastres = -1;\r
+          return;\r
+        }\r
+\r
+        // drag to right\r
+        if (dragRight)\r
+        {\r
+          sg.setEndRes(sg.getEndRes() + (res - lastres));\r
+        }\r
+\r
+        // drag to left\r
+        else\r
+        {\r
+          /// Are we able to delete?\r
+          // ie are all columns blank?\r
+          boolean deleteAllowed = false;\r
+          for (int s = 0; s < sg.getSize(); s++)\r
+          {\r
+            SequenceI seq = sg.getSequenceAt(s);\r
+            for (int j = res; j < lastres; j++)\r
+            {\r
+              if (seq.getSequence().length() <= j)\r
+              {\r
+                continue;\r
+              }\r
+\r
+              if (!jalview.util.Comparison.isGap(seq.getSequence().charAt(j)))\r
+              {\r
+                // Not a gap, block edit not valid\r
+                res = j + 1;\r
+                deleteAllowed = false;\r
+                continue;\r
+              }\r
+              deleteAllowed = true;\r
+            }\r
+          }\r
+\r
+          if (!deleteAllowed)\r
+          {\r
+            lastres = -1;\r
+            return;\r
+          }\r
+\r
+          sg.setEndRes(sg.getEndRes() - (lastres - res));\r
+        }\r
+\r
+        for (int i = 0; i < sg.getSize(); i++)\r
+        {\r
+          SequenceI s = sg.getSequenceAt(i);\r
+          int k = av.alignment.findIndex(s);\r
+\r
+          // drag to right\r
+          if (dragRight)\r
+          {\r
+            for (int j = lastres; j < res; j++)\r
+            {\r
+              insertChar(j, k);\r
+            }\r
+          }\r
+\r
+          // drag to left\r
+          else\r
+          {\r
+            for (int j = res; j < lastres; j++)\r
+            {\r
+              if (s.getLength() > j)\r
+              {\r
+                deleteChar(res, k);\r
+              }\r
+            }\r
+          }\r
+        }\r
+      }\r
+      else /////Editing a single sequence///////////\r
+      {\r
+        if (res < av.getAlignment().getWidth() && res > lastres)\r
+        {\r
+          // dragging to the right\r
+          for (int j = lastres; j < res; j++)\r
+          {\r
+            insertChar(j, startseq);\r
+          }\r
+        }\r
+        else if (res < av.getAlignment().getWidth() && res < lastres)\r
+        {\r
+          // dragging to the left\r
+          for (int j = lastres; j > res; j--)\r
+          {\r
+            if (jalview.util.Comparison.isGap(\r
+                av.alignment.getSequenceAt(startseq).getSequence().charAt(res)))\r
+            {\r
+\r
+              deleteChar(res, startseq);\r
+            }\r
+            else\r
+            {\r
+\r
+              break;\r
+            }\r
+          }\r
+        }\r
+\r
+      }\r
+    }\r
+\r
+    endEdit = res;\r
+    lastres = res;\r
+    seqCanvas.repaint();\r
   }\r
 \r
-  public void drawChars(int seqstart, int seqend, int start) {\r
-    seqCanvas.drawPanel(seqCanvas.gg, start,av.getEndRes(),seqstart,seqend,av.getStartRes(),av.getStartSeq(),0);\r
+  public void drawChars(int seqstart, int seqend, int start)\r
+  {\r
+    seqCanvas.drawPanel(seqCanvas.gg, start, av.getEndRes(), seqstart, seqend,\r
+                        av.getStartRes(), av.getStartSeq(), 0);\r
     seqCanvas.repaint();\r
   }\r
 \r
   public void insertChar(int j, int seq)\r
   {\r
     av.alignment.getSequenceAt(seq).insertCharAt(j, av.getGapCharacter());\r
-    seqEditOccurred=seq;\r
+    seqEditOccurred = seq;\r
   }\r
 \r
   public void deleteChar(int j, int seq)\r
   {\r
 \r
     av.alignment.getSequenceAt(seq).deleteCharAt(j);\r
-    seqEditOccurred=seq;\r
+    seqEditOccurred = seq;\r
     av.alignment.getWidth();\r
     repaint();\r
   }\r
 \r
-\r
   void editOccurred(int i)\r
   {\r
-    if(endEdit==startEdit)\r
+    if (endEdit == startEdit)\r
     {\r
       ap.alignFrame.historyList.pop();\r
       ap.alignFrame.updateEditMenuBar();\r
@@ -391,34 +454,33 @@ public class SeqPanel extends Panel
 \r
     // Y O Y CLUSTALX\r
     ColourSchemeI cs = av.getGlobalColourScheme();\r
-    if(cs instanceof ConservationColourScheme)\r
+    if (cs instanceof ConservationColourScheme)\r
     {\r
-      ConservationColourScheme ccs =  (ConservationColourScheme) cs;\r
-      if(ccs.cs instanceof ClustalxColourScheme)\r
-     {\r
+      ConservationColourScheme ccs = (ConservationColourScheme) cs;\r
+      if (ccs.cs instanceof ClustalxColourScheme)\r
+      {\r
         jalview.analysis.Conservation c = new jalview.analysis.Conservation\r
             ("All",\r
-            ResidueProperties.propHash, 3,\r
-            av.alignment.getSequences(), 0,\r
-            av.alignment.getWidth() - 1);\r
+             ResidueProperties.propHash, 3,\r
+             av.alignment.getSequences(), 0,\r
+             av.alignment.getWidth() - 1);\r
         c.calculate();\r
         c.verdict(false, av.ConsPercGaps);\r
 \r
-        ClustalxColourScheme cxs = (ClustalxColourScheme)ccs.cs;\r
-        cxs.resetClustalX(av.alignment.getSequences(),  av.alignment.getWidth());\r
+        ClustalxColourScheme cxs = (ClustalxColourScheme) ccs.cs;\r
+        cxs.resetClustalX(av.alignment.getSequences(), av.alignment.getWidth());\r
         ccs = new ConservationColourScheme(c, cxs);\r
         av.setGlobalColourScheme(ccs);\r
-     }\r
+      }\r
     }\r
 \r
-    if(cs instanceof ClustalxColourScheme)\r
+    if (cs instanceof ClustalxColourScheme)\r
     {\r
-      ((ClustalxColourScheme)cs).resetClustalX(av.alignment.getSequences(),\r
-                                    av.alignment.getWidth());\r
+      ( (ClustalxColourScheme) cs).resetClustalX(av.alignment.getSequences(),\r
+                                                 av.alignment.getWidth());\r
       av.setGlobalColourScheme(cs);\r
     }\r
 \r
-\r
   }\r
 \r
 //////////////////////////////////////////\r
@@ -427,78 +489,99 @@ public class SeqPanel extends Panel
   int oldSeq = -1;\r
   public void doMousePressedDefineMode(MouseEvent evt)\r
   {\r
-    int res = evt.getX()/av.getCharWidth() + av.getStartRes();\r
-    int seq = evt.getY()/av.getCharHeight() + av.getStartSeq();\r
+    int res = evt.getX() / av.getCharWidth() + av.getStartRes();\r
+    int seq = evt.getY() / av.getCharHeight() + av.getStartSeq();\r
     oldSeq = seq;\r
 \r
     SequenceI sequence = (Sequence) av.getAlignment().getSequenceAt(seq);\r
 \r
-    if(sequence==null || res>sequence.getLength())\r
+    if (sequence == null || res > sequence.getLength())\r
+    {\r
       return;\r
+    }\r
 \r
     stretchGroup = av.getSelectionGroup();\r
 \r
-    if(stretchGroup == null)\r
-     {\r
-       stretchGroup = av.alignment.findGroup( sequence );\r
-       if(stretchGroup!=null && res>stretchGroup.getStartRes() && res<stretchGroup.getEndRes())\r
-         av.setSelectionGroup(stretchGroup);\r
-       else\r
-         stretchGroup = null;\r
-     }\r
-\r
-    else if(!stretchGroup.sequences.contains(sequence)\r
-            || stretchGroup.getStartRes()>res\r
-            || stretchGroup.getEndRes()<res)\r
-     {\r
-       stretchGroup = null;\r
-\r
-       SequenceGroup[] allGroups = av.alignment.findAllGroups( sequence );\r
-\r
-       if (allGroups != null)\r
-         for (int i = 0; i < allGroups.length; i++)\r
-           if (allGroups[i].getStartRes() <= res &&\r
-               allGroups[i].getEndRes() >= res)\r
-           {\r
-             stretchGroup = allGroups[i];\r
-             av.setSelectionGroup(stretchGroup);\r
-             break;\r
-           }\r
-     }\r
-\r
-    if(stretchGroup==null)\r
+    if (stretchGroup == null)\r
+    {\r
+      stretchGroup = av.alignment.findGroup(sequence);\r
+      if (stretchGroup != null && res > stretchGroup.getStartRes() &&\r
+          res < stretchGroup.getEndRes())\r
+      {\r
+        av.setSelectionGroup(stretchGroup);\r
+      }\r
+      else\r
+      {\r
+        stretchGroup = null;\r
+      }\r
+    }\r
+\r
+    else if (!stretchGroup.sequences.contains(sequence)\r
+             || stretchGroup.getStartRes() > res\r
+             || stretchGroup.getEndRes() < res)\r
+    {\r
+      stretchGroup = null;\r
+\r
+      SequenceGroup[] allGroups = av.alignment.findAllGroups(sequence);\r
+\r
+      if (allGroups != null)\r
+      {\r
+        for (int i = 0; i < allGroups.length; i++)\r
+        {\r
+          if (allGroups[i].getStartRes() <= res &&\r
+              allGroups[i].getEndRes() >= res)\r
+          {\r
+            stretchGroup = allGroups[i];\r
+            av.setSelectionGroup(stretchGroup);\r
+            break;\r
+          }\r
+        }\r
+      }\r
+    }\r
+\r
+    if (stretchGroup == null)\r
     {\r
       // define a new group here\r
       SequenceGroup sg = new SequenceGroup();\r
       sg.setStartRes(res);\r
       sg.setEndRes(res);\r
-      sg.addSequence( sequence );\r
-      av.setSelectionGroup( sg );\r
+      sg.addSequence(sequence);\r
+      av.setSelectionGroup(sg);\r
       stretchGroup = sg;\r
 \r
-      if(av.getConservationSelected())\r
-        SliderPanel.setConservationSlider(ap, av.getGlobalColourScheme(), "Background");\r
-      if(av.getAbovePIDThreshold())\r
-        SliderPanel.setPIDSliderSource(ap, av.getGlobalColourScheme(), "Background");\r
+      if (av.getConservationSelected())\r
+      {\r
+        SliderPanel.setConservationSlider(ap, av.getGlobalColourScheme(),\r
+                                          "Background");\r
+      }\r
+      if (av.getAbovePIDThreshold())\r
+      {\r
+        SliderPanel.setPIDSliderSource(ap, av.getGlobalColourScheme(),\r
+                                       "Background");\r
+      }\r
 \r
     }\r
 \r
     // DETECT RIGHT MOUSE BUTTON IN AWT\r
-    else if( ( evt.getModifiers() & InputEvent .BUTTON3_MASK ) == InputEvent.BUTTON3_MASK )\r
+    else if ( (evt.getModifiers() & InputEvent.BUTTON3_MASK) ==\r
+             InputEvent.BUTTON3_MASK)\r
     {\r
       APopupMenu popup = new APopupMenu(ap, null);\r
       this.add(popup);\r
       popup.show(this, evt.getX(), evt.getY());\r
     }\r
 \r
-\r
-    if(stretchGroup!=null && stretchGroup.getEndRes()==res)\r
+    if (stretchGroup != null && stretchGroup.getEndRes() == res)\r
+    {\r
       // Edit end res position of selected group\r
       changeEndRes = true;\r
+    }\r
 \r
-   else if(stretchGroup!=null && stretchGroup.getStartRes()==res)\r
+    else if (stretchGroup != null && stretchGroup.getStartRes() == res)\r
+    {\r
       // Edit end res position of selected group\r
       changeStartRes = true;\r
+    }\r
 \r
   }\r
 \r
@@ -512,85 +595,106 @@ public class SeqPanel extends Panel
   {\r
     mouseDragging = false;\r
 \r
-    if(stretchGroup==null)\r
+    if (stretchGroup == null)\r
+    {\r
       return;\r
+    }\r
 \r
-    if(stretchGroup.cs instanceof ClustalxColourScheme)\r
+    if (stretchGroup.cs instanceof ClustalxColourScheme)\r
     {\r
-      stretchGroup.cs = new ClustalxColourScheme(stretchGroup.sequences, av.alignment.getWidth());\r
+      stretchGroup.cs = new ClustalxColourScheme(stretchGroup.sequences,\r
+                                                 av.alignment.getWidth());\r
       seqCanvas.repaint();\r
     }\r
 \r
-    else if(stretchGroup.cs instanceof ConservationColourScheme)\r
+    else if (stretchGroup.cs instanceof ConservationColourScheme)\r
     {\r
-       ConservationColourScheme ccs = (ConservationColourScheme)stretchGroup.cs;\r
-       stretchGroup.cs = ccs;\r
-       SliderPanel.setConservationSlider(ap, stretchGroup.cs, stretchGroup.getName()) ;\r
+      ConservationColourScheme ccs = (ConservationColourScheme) stretchGroup.cs;\r
+      stretchGroup.cs = ccs;\r
+      SliderPanel.setConservationSlider(ap, stretchGroup.cs,\r
+                                        stretchGroup.getName());\r
 \r
-       seqCanvas.repaint();\r
+      seqCanvas.repaint();\r
     }\r
     else\r
     {\r
-      if(stretchGroup.cs !=null)\r
+      if (stretchGroup.cs != null)\r
       {\r
-        SliderPanel.setPIDSliderSource(ap, stretchGroup.cs, stretchGroup.getName());\r
+        SliderPanel.setPIDSliderSource(ap, stretchGroup.cs,\r
+                                       stretchGroup.getName());\r
       }\r
 \r
     }\r
 \r
-\r
     changeEndRes = false;\r
     changeStartRes = false;\r
     stretchGroup = null;\r
     ap.repaint();\r
   }\r
 \r
-\r
   boolean remove = false;\r
   public void doMouseDraggedDefineMode(MouseEvent evt)\r
   {\r
-    int res = evt.getX()/av.getCharWidth() + av.getStartRes();\r
-    int y = evt.getY()/av.getCharHeight() + av.getStartSeq();\r
+    int res = evt.getX() / av.getCharWidth() + av.getStartRes();\r
+    int y = evt.getY() / av.getCharHeight() + av.getStartSeq();\r
 \r
-    if(stretchGroup==null)\r
+    if (stretchGroup == null)\r
+    {\r
       return;\r
+    }\r
 \r
-    if(res>av.alignment.getWidth())\r
-      res = av.alignment.getWidth()-1;\r
-\r
+    if (res > av.alignment.getWidth())\r
+    {\r
+      res = av.alignment.getWidth() - 1;\r
+    }\r
 \r
-    if(stretchGroup.getEndRes()==res)\r
+    if (stretchGroup.getEndRes() == res)\r
+    {\r
       // Edit end res position of selected group\r
       changeEndRes = true;\r
+    }\r
 \r
-    else if(stretchGroup.getStartRes()==res)\r
+    else if (stretchGroup.getStartRes() == res)\r
+    {\r
       // Edit start res position of selected group\r
       changeStartRes = true;\r
+    }\r
 \r
-\r
-    if(res<av.getStartRes())\r
+    if (res < av.getStartRes())\r
+    {\r
       res = av.getStartRes();\r
-    else if(res>av.getEndRes())\r
+    }\r
+    else if (res > av.getEndRes())\r
+    {\r
       res = av.getEndRes();\r
+    }\r
 \r
-    if(changeEndRes)\r
+    if (changeEndRes)\r
     {\r
-      if(res>stretchGroup.getStartRes()-1)\r
-        stretchGroup.setEndRes( res );\r
+      if (res > stretchGroup.getStartRes() - 1)\r
+      {\r
+        stretchGroup.setEndRes(res);\r
+      }\r
     }\r
-    else if(changeStartRes)\r
+    else if (changeStartRes)\r
     {\r
-      if(res<stretchGroup.getEndRes()+1)\r
-        stretchGroup.setStartRes( res );\r
+      if (res < stretchGroup.getEndRes() + 1)\r
+      {\r
+        stretchGroup.setStartRes(res);\r
+      }\r
     }\r
 \r
     int dragDirection = 0;\r
     if (y > oldSeq)\r
+    {\r
       dragDirection = 1;\r
+    }\r
     else if (y < oldSeq)\r
+    {\r
       dragDirection = -1;\r
+    }\r
 \r
-    while (y != oldSeq && oldSeq>0 && y<av.alignment.getHeight())\r
+    while (y != oldSeq && oldSeq > 0 && y < av.alignment.getHeight())\r
     {\r
       // This routine ensures we don't skip any sequences, as the\r
       // selection is quite slow.\r
@@ -606,15 +710,19 @@ public class SeqPanel extends Panel
       }\r
       else\r
       {\r
-       if(seq!=null)\r
-        stretchGroup.addSequence(seq);\r
+        if (seq != null)\r
+        {\r
+          stretchGroup.addSequence(seq);\r
+        }\r
         stretchGroup.addSequence(nextSeq);\r
       }\r
     }\r
     oldSeq = y;\r
     mouseDragging = true;\r
-    if(scrollThread!=null)\r
+    if (scrollThread != null)\r
+    {\r
       scrollThread.setEvent(evt);\r
+    }\r
 \r
     seqCanvas.repaint();\r
   }\r
@@ -622,20 +730,28 @@ public class SeqPanel extends Panel
   public void doMouseEnteredDefineMode(MouseEvent e)\r
   {\r
     if (scrollThread != null)\r
+    {\r
       scrollThread.running = false;\r
+    }\r
   }\r
 \r
   public void doMouseExitedDefineMode(MouseEvent e)\r
   {\r
     if (av.getWrapAlignment())\r
+    {\r
       return;\r
+    }\r
 \r
-    if(mouseDragging)\r
+    if (mouseDragging)\r
+    {\r
       scrollThread = new ScrollThread();\r
+    }\r
 \r
   }\r
+\r
   // this class allows scrolling off the bottom of the visible alignment\r
-  class ScrollThread extends Thread\r
+  class ScrollThread\r
+      extends Thread\r
   {\r
     MouseEvent evt;\r
     boolean running = false;\r
@@ -659,21 +775,29 @@ public class SeqPanel extends Panel
       running = true;\r
       while (running)\r
       {\r
-        if(evt!=null)\r
+        if (evt != null)\r
         {\r
 \r
           if (mouseDragging && evt.getY() < 0 && av.getStartSeq() > 0)\r
+          {\r
             running = ap.scrollUp(true);\r
+          }\r
 \r
           if (mouseDragging && evt.getY() >= getSize().height &&\r
               av.alignment.getHeight() > av.getEndSeq())\r
+          {\r
             running = ap.scrollUp(false);\r
+          }\r
 \r
           if (mouseDragging && evt.getX() < 0)\r
+          {\r
             running = ap.scrollRight(true);\r
+          }\r
 \r
           else if (mouseDragging && evt.getX() >= getSize().width)\r
+          {\r
             running = ap.scrollRight(false);\r
+          }\r
         }\r
 \r
         try\r
@@ -684,12 +808,6 @@ public class SeqPanel extends Panel
         {}\r
       }\r
     }\r
-}\r
-\r
-\r
+  }\r
 \r
 }\r
-\r
-\r
-\r
-\r
index 321edef..9a722f2 100755 (executable)
@@ -1,27 +1,28 @@
 /*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 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
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
+ */\r
 \r
 package jalview.appletgui;\r
 \r
+import java.awt.*;\r
+\r
 import jalview.datamodel.*;\r
 import jalview.schemes.*;\r
-import java.awt.*;\r
 \r
 public class SequenceRenderer\r
 {\r
@@ -29,7 +30,7 @@ public class SequenceRenderer
   FontMetrics fm;\r
   boolean renderGaps = true;\r
   SequenceGroup currentSequenceGroup = null;\r
-  SequenceGroup [] allGroups = null;\r
+  SequenceGroup[] allGroups = null;\r
   Color resBoxColour;\r
   Graphics graphics;\r
 \r
@@ -38,7 +39,6 @@ public class SequenceRenderer
     this.av = av;\r
   }\r
 \r
-\r
   public void renderGaps(boolean b)\r
   {\r
     renderGaps = b;\r
@@ -52,13 +52,19 @@ public class SequenceRenderer
 \r
   void getBoxColour(ColourSchemeI cs, SequenceI seq, int i)\r
   {\r
-   if (cs != null)\r
-       resBoxColour = cs.findColour(seq.getSequence(i, i + 1), i);\r
-   else\r
-       resBoxColour = Color.white;\r
+    if (cs != null)\r
+    {\r
+      resBoxColour = cs.findColour(seq.getSequence(i, i + 1), i);\r
+    }\r
+    else\r
+    {\r
+      resBoxColour = Color.white;\r
+    }\r
   }\r
 \r
-  public void drawSequence(Graphics g,SequenceI seq,SequenceGroup [] sg, int start, int end, int x1, int y1, int width, int height)\r
+  public void drawSequence(Graphics g, SequenceI seq, SequenceGroup[] sg,\r
+                           int start, int end, int x1, int y1, int width,\r
+                           int height)\r
   {\r
     allGroups = sg;\r
 \r
@@ -67,12 +73,14 @@ public class SequenceRenderer
     drawBoxes(seq, start, end, x1, y1, (int) width, height);\r
 \r
     fm = g.getFontMetrics();\r
-    drawText(seq,start,end,x1,y1,(int)width,height);\r
+    drawText(seq, start, end, x1, y1, (int) width, height);\r
 \r
   }\r
 \r
-  public void drawBoxes(SequenceI seq,int start, int end, int x1, int y1, int width, int height) {\r
-    int i      = start;\r
+  public void drawBoxes(SequenceI seq, int start, int end, int x1, int y1,\r
+                        int width, int height)\r
+  {\r
+    int i = start;\r
     int length = seq.getLength();\r
 \r
     int curStart = -1;\r
@@ -81,23 +89,33 @@ public class SequenceRenderer
     Color tempColour = null;\r
     while (i <= end && i < length)\r
     {\r
-      if(inCurrentSequenceGroup(i))\r
+      if (inCurrentSequenceGroup(i))\r
       {\r
-        if( currentSequenceGroup.getDisplayBoxes())\r
-             getBoxColour(currentSequenceGroup.cs, seq, i);\r
+        if (currentSequenceGroup.getDisplayBoxes())\r
+        {\r
+          getBoxColour(currentSequenceGroup.cs, seq, i);\r
+        }\r
         else\r
-             resBoxColour = Color.white;\r
+        {\r
+          resBoxColour = Color.white;\r
+        }\r
+      }\r
+      else if (av.getShowBoxes())\r
+      {\r
+        getBoxColour(av.getGlobalColourScheme(), seq, i);\r
       }\r
-      else if(av.getShowBoxes())\r
-            getBoxColour(av.getGlobalColourScheme(), seq, i);\r
       else\r
+      {\r
         resBoxColour = Color.white;\r
-\r
+      }\r
 \r
       if (resBoxColour != tempColour)\r
       {\r
-        if(tempColour!=null)\r
-          graphics.fillRect(x1+width*(curStart-start),y1,curWidth,height);\r
+        if (tempColour != null)\r
+        {\r
+          graphics.fillRect(x1 + width * (curStart - start), y1, curWidth,\r
+                            height);\r
+        }\r
         graphics.setColor(resBoxColour);\r
 \r
         curStart = i;\r
@@ -106,104 +124,126 @@ public class SequenceRenderer
 \r
       }\r
       else\r
+      {\r
         curWidth += width;\r
+      }\r
 \r
       i++;\r
     }\r
 \r
-\r
-     graphics.fillRect(x1+width*(curStart-start),y1,curWidth,height);\r
+    graphics.fillRect(x1 + width * (curStart - start), y1, curWidth, height);\r
   }\r
 \r
-  public void drawText(SequenceI seq,int start, int end, int x1, int y1, int width, int height)\r
+  public void drawText(SequenceI seq, int start, int end, int x1, int y1,\r
+                       int width, int height)\r
   {\r
-    int pady = height/5;\r
-    int charOffset=0;\r
+    int pady = height / 5;\r
+    int charOffset = 0;\r
     char s;\r
     // Need to find the sequence position here.\r
 \r
-    String sequence  = seq.getSequence();\r
+    String sequence = seq.getSequence();\r
     for (int i = start; i <= end; i++)\r
     {\r
-        graphics.setColor(Color.black);\r
-        if(i<sequence.length())\r
-          s = sequence.charAt(i);\r
-        else\r
-          s = ' ';\r
+      graphics.setColor(Color.black);\r
+      if (i < sequence.length())\r
+      {\r
+        s = sequence.charAt(i);\r
+      }\r
+      else\r
+      {\r
+        s = ' ';\r
+      }\r
 \r
-        if(!renderGaps && jalview.util.Comparison.isGap(s))\r
-          continue;\r
+      if (!renderGaps && jalview.util.Comparison.isGap(s))\r
+      {\r
+        continue;\r
+      }\r
 \r
+      if (inCurrentSequenceGroup(i))\r
+      {\r
+        if (!currentSequenceGroup.getDisplayText())\r
+        {\r
+          continue;\r
+        }\r
 \r
-        if (inCurrentSequenceGroup(i))\r
+        if (currentSequenceGroup.getColourText())\r
         {\r
-          if(!currentSequenceGroup.getDisplayText())\r
-            continue;\r
-\r
-            if (currentSequenceGroup.getColourText())\r
-            {\r
-              getBoxColour(currentSequenceGroup.cs, seq, i);\r
-              graphics.setColor(resBoxColour.darker());\r
-            }\r
+          getBoxColour(currentSequenceGroup.cs, seq, i);\r
+          graphics.setColor(resBoxColour.darker());\r
         }\r
-        else\r
+      }\r
+      else\r
+      {\r
+        if (!av.getShowText())\r
         {\r
-          if(!av.getShowText())\r
-            continue;\r
-\r
-          if(av.getColourText())\r
-           {\r
-             getBoxColour(av.getGlobalColourScheme(), seq, i);\r
-             if(av.getShowBoxes())\r
-              graphics.setColor(resBoxColour.darker());\r
-            else\r
-              graphics.setColor(resBoxColour);\r
-           }\r
+          continue;\r
         }\r
 \r
-          charOffset =  (width - fm.charWidth(s))/2;\r
-          graphics.drawString(String.valueOf(s),\r
-                              charOffset + x1 + width * (i - start),\r
-                              y1 + height - pady);\r
+        if (av.getColourText())\r
+        {\r
+          getBoxColour(av.getGlobalColourScheme(), seq, i);\r
+          if (av.getShowBoxes())\r
+          {\r
+            graphics.setColor(resBoxColour.darker());\r
+          }\r
+          else\r
+          {\r
+            graphics.setColor(resBoxColour);\r
+          }\r
         }\r
+      }\r
 \r
+      charOffset = (width - fm.charWidth(s)) / 2;\r
+      graphics.drawString(String.valueOf(s),\r
+                          charOffset + x1 + width * (i - start),\r
+                          y1 + height - pady);\r
+    }\r
 \r
   }\r
 \r
   boolean inCurrentSequenceGroup(int res)\r
   {\r
-    if(allGroups ==null)\r
+    if (allGroups == null)\r
+    {\r
       return false;\r
+    }\r
 \r
-    for(int i=0; i<allGroups.length; i++)\r
-      if(allGroups[i].getStartRes()<=res && allGroups[i].getEndRes()>=res)\r
+    for (int i = 0; i < allGroups.length; i++)\r
+    {\r
+      if (allGroups[i].getStartRes() <= res && allGroups[i].getEndRes() >= res)\r
       {\r
-         currentSequenceGroup = allGroups[i];\r
-         return true;\r
+        currentSequenceGroup = allGroups[i];\r
+        return true;\r
       }\r
+    }\r
 \r
     return false;\r
   }\r
 \r
-  public void drawHighlightedText(SequenceI seq,int start, int end, int x1, int y1, int width, int height)\r
+  public void drawHighlightedText(SequenceI seq, int start, int end, int x1,\r
+                                  int y1, int width, int height)\r
   {\r
-    int pady = height/5;\r
-    int charOffset=0;\r
+    int pady = height / 5;\r
+    int charOffset = 0;\r
     graphics.setColor(Color.black);\r
-    graphics.fillRect(x1,y1,width*(end-start+1),height);\r
+    graphics.fillRect(x1, y1, width * (end - start + 1), height);\r
     graphics.setColor(Color.white);\r
 \r
-    char s='~';\r
+    char s = '~';\r
     // Need to find the sequence position here.\r
     for (int i = start; i <= end; i++)\r
     {\r
-       if(i<seq.getLength())\r
-          s = seq.getSequence().charAt(i);\r
+      if (i < seq.getLength())\r
+      {\r
+        s = seq.getSequence().charAt(i);\r
+      }\r
 \r
-     charOffset =  (width - fm.charWidth(s))/2;\r
-      graphics.drawString(String.valueOf(s), charOffset + x1 + width * (i - start), y1 + height - pady);\r
+      charOffset = (width - fm.charWidth(s)) / 2;\r
+      graphics.drawString(String.valueOf(s),\r
+                          charOffset + x1 + width * (i - start),\r
+                          y1 + height - pady);\r
     }\r
   }\r
 \r
-\r
 }\r
index 6c89fb7..caabbf9 100755 (executable)
@@ -1,32 +1,35 @@
 /*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 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
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 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 jalview.jbappletgui.*;\r
-import jalview.schemes.*;\r
-import jalview.datamodel.*;\r
+import java.util.*;\r
+\r
 import java.awt.*;\r
 import java.awt.event.*;\r
-import java.util.*;\r
 \r
-public class SliderPanel extends GSliderPanel\r
+import jalview.datamodel.*;\r
+import jalview.jbappletgui.*;\r
+import jalview.schemes.*;\r
+\r
+public class SliderPanel\r
+    extends GSliderPanel\r
 {\r
   AlignmentPanel ap;\r
   boolean forConservation = true;\r
@@ -35,12 +38,13 @@ public class SliderPanel extends GSliderPanel
   static Frame conservationSlider;\r
   static Frame PIDSlider;\r
 \r
-  public static int setConservationSlider(AlignmentPanel ap, ColourSchemeI cs, String source)\r
+  public static int setConservationSlider(AlignmentPanel ap, ColourSchemeI cs,\r
+                                          String source)\r
   {\r
     SliderPanel sp = null;\r
-    ConservationColourScheme ccs = (ConservationColourScheme)cs;\r
+    ConservationColourScheme ccs = (ConservationColourScheme) cs;\r
 \r
-    if(conservationSlider == null)\r
+    if (conservationSlider == null)\r
     {\r
       sp = new SliderPanel(ap, ccs.inc, true, cs);\r
       conservationSlider = new Frame();\r
@@ -48,30 +52,38 @@ public class SliderPanel extends GSliderPanel
     }\r
     else\r
     {\r
-        sp = (SliderPanel)conservationSlider.getComponent(0);\r
-        sp.cs = cs;\r
+      sp = (SliderPanel) conservationSlider.getComponent(0);\r
+      sp.cs = cs;\r
     }\r
 \r
-    conservationSlider.setTitle("Conservation Colour Increment  ("+source+")");\r
-    if(ap.av.alignment.getGroups()!=null)\r
-      sp.setAllGroupsCheckEnabled( true );\r
+    conservationSlider.setTitle("Conservation Colour Increment  (" + source +\r
+                                ")");\r
+    if (ap.av.alignment.getGroups() != null)\r
+    {\r
+      sp.setAllGroupsCheckEnabled(true);\r
+    }\r
     else\r
-      sp.setAllGroupsCheckEnabled( false);\r
+    {\r
+      sp.setAllGroupsCheckEnabled(false);\r
+    }\r
 \r
     return sp.getValue();\r
   }\r
 \r
   public static void showConservationSlider()\r
   {\r
-    try{\r
+    try\r
+    {\r
       PIDSlider.setVisible(false);\r
       PIDSlider = null;\r
-    }catch(Exception ex){}\r
-\r
+    }\r
+    catch (Exception ex)\r
+    {}\r
 \r
-    if(!conservationSlider.isVisible())\r
+    if (!conservationSlider.isVisible())\r
     {\r
-      jalview.bin.JalviewLite.addFrame(conservationSlider, conservationSlider.getTitle(), 420, 100);\r
+      jalview.bin.JalviewLite.addFrame(conservationSlider,\r
+                                       conservationSlider.getTitle(), 420, 100);\r
       conservationSlider.addWindowListener(new WindowAdapter()\r
       {\r
         public void windowClosing(WindowEvent e)\r
@@ -84,41 +96,50 @@ public class SliderPanel extends GSliderPanel
 \r
   }\r
 \r
-  public static int setPIDSliderSource(AlignmentPanel ap, ColourSchemeI cs, String source)\r
-   {\r
-     SliderPanel pid = null;\r
-     if(PIDSlider == null)\r
-     {\r
-       pid = new SliderPanel(ap, 50, false, cs);\r
-       PIDSlider = new Frame();\r
-       PIDSlider.add(pid);\r
-     }\r
-     else\r
-     {\r
-         pid = (SliderPanel)PIDSlider.getComponent(0);\r
-         pid.cs = cs;\r
-     }\r
-     PIDSlider.setTitle("Percentage Identity Threshold ("+source+")");\r
-\r
-     if (ap.av.alignment.getGroups() != null)\r
-       pid.setAllGroupsCheckEnabled(true);\r
-     else\r
-       pid.setAllGroupsCheckEnabled(false);\r
-\r
-     return pid.getValue();\r
-\r
-   }\r
-\r
-   public static void showPIDSlider()\r
-   {\r
-     try{\r
-       conservationSlider.setVisible(false);\r
-       conservationSlider = null;\r
-     }catch(Exception ex){}\r
-\r
-     if(!PIDSlider.isVisible())\r
-    {\r
-      jalview.bin.JalviewLite.addFrame(PIDSlider, PIDSlider.getTitle(), 420, 100);\r
+  public static int setPIDSliderSource(AlignmentPanel ap, ColourSchemeI cs,\r
+                                       String source)\r
+  {\r
+    SliderPanel pid = null;\r
+    if (PIDSlider == null)\r
+    {\r
+      pid = new SliderPanel(ap, 50, false, cs);\r
+      PIDSlider = new Frame();\r
+      PIDSlider.add(pid);\r
+    }\r
+    else\r
+    {\r
+      pid = (SliderPanel) PIDSlider.getComponent(0);\r
+      pid.cs = cs;\r
+    }\r
+    PIDSlider.setTitle("Percentage Identity Threshold (" + source + ")");\r
+\r
+    if (ap.av.alignment.getGroups() != null)\r
+    {\r
+      pid.setAllGroupsCheckEnabled(true);\r
+    }\r
+    else\r
+    {\r
+      pid.setAllGroupsCheckEnabled(false);\r
+    }\r
+\r
+    return pid.getValue();\r
+\r
+  }\r
+\r
+  public static void showPIDSlider()\r
+  {\r
+    try\r
+    {\r
+      conservationSlider.setVisible(false);\r
+      conservationSlider = null;\r
+    }\r
+    catch (Exception ex)\r
+    {}\r
+\r
+    if (!PIDSlider.isVisible())\r
+    {\r
+      jalview.bin.JalviewLite.addFrame(PIDSlider, PIDSlider.getTitle(), 420,\r
+                                       100);\r
       PIDSlider.addWindowListener(new WindowAdapter()\r
       {\r
         public void windowClosing(WindowEvent e)\r
@@ -128,76 +149,82 @@ public class SliderPanel extends GSliderPanel
       });\r
     }\r
 \r
-   }\r
-\r
+  }\r
 \r
-  public SliderPanel(AlignmentPanel ap, int value, boolean forConserve, ColourSchemeI cs)\r
+  public SliderPanel(AlignmentPanel ap, int value, boolean forConserve,\r
+                     ColourSchemeI cs)\r
   {\r
     this.ap = ap;\r
     this.cs = cs;\r
     forConservation = forConserve;\r
     undoButton.setVisible(false);\r
     applyButton.setVisible(false);\r
-    if(forConservation)\r
+    if (forConservation)\r
     {\r
       label.setText("Modify conservation visibility");\r
       slider.setMinimum(0);\r
-      slider.setMaximum(50+slider.getVisibleAmount());\r
+      slider.setMaximum(50 + slider.getVisibleAmount());\r
       slider.setUnitIncrement(1);\r
     }\r
     else\r
     {\r
       label.setText("Colour residues above % occurence");\r
       slider.setMinimum(0);\r
-      slider.setMaximum(100+slider.getVisibleAmount());\r
+      slider.setMaximum(100 + slider.getVisibleAmount());\r
       slider.setBlockIncrement(1);\r
     }\r
 \r
-\r
-    slider.addAdjustmentListener( new AdjustmentListener()\r
+    slider.addAdjustmentListener(new AdjustmentListener()\r
     {\r
       public void adjustmentValueChanged(AdjustmentEvent evt)\r
       {\r
-        valueField.setText( slider.getValue()+"" );\r
-        valueChanged( slider.getValue() );\r
+        valueField.setText(slider.getValue() + "");\r
+        valueChanged(slider.getValue());\r
       }\r
     });\r
 \r
     slider.setValue(value);\r
-    valueField.setText(value+"");\r
+    valueField.setText(value + "");\r
   }\r
 \r
   public void valueChanged(int i)\r
   {\r
-    if(cs == null)\r
+    if (cs == null)\r
+    {\r
       return;\r
+    }\r
 \r
     ColourSchemeI toChange = null;\r
     Vector allGroups = null;\r
     int groupIndex = 0;\r
 \r
-    if(allGroupsCheck.getState())\r
+    if (allGroupsCheck.getState())\r
     {\r
       allGroups = ap.av.alignment.getGroups();\r
-      groupIndex = allGroups.size()-1;\r
+      groupIndex = allGroups.size() - 1;\r
     }\r
     else\r
+    {\r
       toChange = cs;\r
+    }\r
 \r
-\r
-    while( groupIndex > -1 )\r
+    while (groupIndex > -1)\r
     {\r
-      if(allGroups!=null)\r
-        toChange = ((SequenceGroup)allGroups.elementAt(groupIndex)).cs;\r
+      if (allGroups != null)\r
+      {\r
+        toChange = ( (SequenceGroup) allGroups.elementAt(groupIndex)).cs;\r
+      }\r
 \r
       if (forConservation)\r
       {\r
         if (toChange instanceof ConservationColourScheme)\r
+        {\r
           ( (ConservationColourScheme) toChange).inc = i;\r
+        }\r
       }\r
       else\r
       {\r
-          ( (ResidueColourScheme) toChange).setThreshold(i);\r
+        ( (ResidueColourScheme) toChange).setThreshold(i);\r
       }\r
 \r
       groupIndex--;\r
@@ -212,16 +239,16 @@ public class SliderPanel extends GSliderPanel
     allGroupsCheck.setEnabled(b);\r
   }\r
 \r
-\r
   public void valueField_actionPerformed(ActionEvent e)\r
   {\r
-    try{\r
+    try\r
+    {\r
       int i = Integer.parseInt(valueField.getText());\r
       slider.setValue(i);\r
     }\r
-    catch(Exception ex)\r
+    catch (Exception ex)\r
     {\r
-      valueField.setText( slider.getValue()+"" );\r
+      valueField.setText(slider.getValue() + "");\r
     }\r
   }\r
 \r
@@ -229,10 +256,10 @@ public class SliderPanel extends GSliderPanel
   {\r
     slider.setValue(value);\r
   }\r
+\r
   public int getValue()\r
   {\r
     return Integer.parseInt(valueField.getText());\r
   }\r
 \r
-\r
 }\r
index be37813..434ad60 100755 (executable)
@@ -1,42 +1,43 @@
 /*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 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
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 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 jalview.analysis.*;\r
-import jalview.datamodel.*;\r
-import jalview.util.*;\r
-import jalview.schemes.*;\r
 import java.awt.*;\r
 import java.awt.event.*;\r
-import java.util.*;\r
 \r
+import jalview.analysis.*;\r
+import jalview.datamodel.*;\r
+import jalview.schemes.*;\r
+import jalview.util.*;\r
 \r
-public class TreeCanvas extends Panel implements MouseListener\r
+public class TreeCanvas\r
+    extends Panel implements MouseListener\r
 {\r
   NJTree tree;\r
   ScrollPane scrollPane;\r
   AlignViewport av;\r
-  public static final String PLACEHOLDER=" * ";\r
+  public static final String PLACEHOLDER = " * ";\r
   Font font;\r
-  int  fontSize = 12;\r
+  int fontSize = 12;\r
 \r
   boolean fitToWindow = true;\r
   boolean showDistances = false;\r
@@ -49,19 +50,20 @@ public class TreeCanvas extends Panel implements MouseListener
   float threshold;\r
 \r
   String longestName;\r
-  int labelLength=-1;\r
+  int labelLength = -1;\r
 \r
   //RubberbandRectangle rubberband;\r
 \r
-  Vector    listeners;\r
+  Vector listeners;\r
 \r
   Hashtable nameHash = new Hashtable();\r
   Hashtable nodeHash = new Hashtable();\r
 \r
-  public TreeCanvas(AlignViewport av, NJTree tree, ScrollPane scroller, String label)\r
+  public TreeCanvas(AlignViewport av, NJTree tree, ScrollPane scroller,\r
+                    String label)\r
   {\r
     this.av = av;\r
-    this.tree     = tree;\r
+    this.tree = tree;\r
     scrollPane = scroller;\r
     addMouseListener(this);\r
     tree.findHeight(tree.getTopNode());\r
@@ -70,10 +72,11 @@ public class TreeCanvas extends Panel implements MouseListener
 \r
     PaintRefresher.Register(this);\r
   }\r
+\r
   public void TreeSelectionChanged(Sequence sequence)\r
- {\r
+  {\r
     SequenceGroup selected = av.getSelectionGroup();\r
-    if(selected == null)\r
+    if (selected == null)\r
     {\r
       selected = new SequenceGroup();\r
       av.setSelectionGroup(selected);\r
@@ -82,373 +85,450 @@ public class TreeCanvas extends Panel implements MouseListener
     selected.setEndRes(av.alignment.getWidth());\r
     selected.addOrRemove(sequence);\r
 \r
-\r
     PaintRefresher.Refresh(this);\r
     repaint();\r
- }\r
-\r
-\r
+  }\r
 \r
-  public void setTree(NJTree tree) {\r
+  public void setTree(NJTree tree)\r
+  {\r
     this.tree = tree;\r
     tree.findHeight(tree.getTopNode());\r
   }\r
 \r
-    public void drawNode(Graphics g,SequenceNode node, float chunk, float scale, int width,int offx, int offy) {\r
-    if (node == null) {\r
+  public void drawNode(Graphics g, SequenceNode node, float chunk, float scale,\r
+                       int width, int offx, int offy)\r
+  {\r
+    if (node == null)\r
+    {\r
       return;\r
     }\r
 \r
-    if (node.left() == null && node.right() == null) {\r
+    if (node.left() == null && node.right() == null)\r
+    {\r
       // Drawing leaf node\r
 \r
       float height = node.height;\r
-      float dist   = node.dist;\r
+      float dist = node.dist;\r
 \r
-      int xstart = (int)((height-dist)*scale) + offx;\r
-      int xend =   (int)(height*scale)        + offx;\r
+      int xstart = (int) ( (height - dist) * scale) + offx;\r
+      int xend = (int) (height * scale) + offx;\r
 \r
-      int ypos = (int)(node.ycount * chunk) + offy;\r
+      int ypos = (int) (node.ycount * chunk) + offy;\r
 \r
       if (node.element() instanceof SequenceI)\r
       {\r
-       if ( ( (SequenceI) ( (SequenceNode) node).element()).getColor() == Color.white)\r
-       {\r
-         g.setColor(Color.black);\r
-       }\r
-       else\r
-        g.setColor( ( (SequenceI) ( (SequenceNode) node).element()).getColor().\r
-                   darker());\r
+        if ( ( (SequenceI) ( (SequenceNode) node).element()).getColor() ==\r
+            Color.white)\r
+        {\r
+          g.setColor(Color.black);\r
+        }\r
+        else\r
+        {\r
+          g.setColor( ( (SequenceI) ( (SequenceNode) node).element()).getColor().\r
+                     darker());\r
+        }\r
 \r
       }\r
       else\r
-          g.setColor(Color.black);\r
-\r
+      {\r
+        g.setColor(Color.black);\r
+      }\r
 \r
       // Draw horizontal line\r
-      g.drawLine(xstart,ypos,xend,ypos);\r
+      g.drawLine(xstart, ypos, xend, ypos);\r
 \r
       String nodeLabel = "";\r
-      if (showDistances && node.dist > 0) {\r
+      if (showDistances && node.dist > 0)\r
+      {\r
         nodeLabel = new Format("%5.2f").form(node.dist);\r
       }\r
-      if (showBootstrap) {\r
-        if (showDistances) {\r
+      if (showBootstrap)\r
+      {\r
+        if (showDistances)\r
+        {\r
           nodeLabel = nodeLabel + " : ";\r
         }\r
         nodeLabel = nodeLabel + String.valueOf(node.getBootstrap());\r
       }\r
-      if (! nodeLabel.equals("")) {\r
-      g.drawString(nodeLabel,xstart,ypos - 10);\r
+      if (!nodeLabel.equals(""))\r
+      {\r
+        g.drawString(nodeLabel, xstart, ypos - 10);\r
       }\r
 \r
-      String name    = (markPlaceholders && node.isPlaceholder()) ? (PLACEHOLDER+node.getName()) : node.getName();\r
+      String name = (markPlaceholders && node.isPlaceholder()) ?\r
+          (PLACEHOLDER + node.getName()) : node.getName();\r
       FontMetrics fm = g.getFontMetrics(font);\r
-      int charWidth  = fm.stringWidth(name) + 3;\r
+      int charWidth = fm.stringWidth(name) + 3;\r
       int charHeight = fm.getHeight();\r
 \r
-      Rectangle rect = new Rectangle(xend+20,ypos-charHeight,\r
-                                     charWidth,charHeight);\r
+      Rectangle rect = new Rectangle(xend + 20, ypos - charHeight,\r
+                                     charWidth, charHeight);\r
 \r
-      nameHash.put((SequenceI)node.element(),rect);\r
+      nameHash.put( (SequenceI) node.element(), rect);\r
 \r
       // Colour selected leaves differently\r
       SequenceGroup selected = av.getSelectionGroup();\r
-      if (selected!=null && selected.sequences.contains((SequenceI)node.element())) {\r
+      if (selected != null &&\r
+          selected.sequences.contains( (SequenceI) node.element()))\r
+      {\r
         g.setColor(Color.gray);\r
 \r
-        g.fillRect(xend + 10, ypos - charHeight + 3,charWidth,charHeight);\r
+        g.fillRect(xend + 10, ypos - charHeight + 3, charWidth, charHeight);\r
         g.setColor(Color.white);\r
       }\r
-      g.drawString(name,xend+10,ypos);\r
+      g.drawString(name, xend + 10, ypos);\r
       g.setColor(Color.black);\r
-    } else {\r
-      drawNode(g,(SequenceNode)node.left(), chunk,scale,width,offx,offy);\r
-      drawNode(g,(SequenceNode)node.right(),chunk,scale,width,offx,offy);\r
+    }\r
+    else\r
+    {\r
+      drawNode(g, (SequenceNode) node.left(), chunk, scale, width, offx, offy);\r
+      drawNode(g, (SequenceNode) node.right(), chunk, scale, width, offx, offy);\r
 \r
       float height = node.height;\r
-      float dist   = node.dist;\r
+      float dist = node.dist;\r
 \r
-      int xstart = (int)((height-dist)*scale) + offx;\r
-      int xend   = (int)(height       *scale) + offx;\r
-      int ypos   = (int)(node.ycount  *chunk) + offy;\r
+      int xstart = (int) ( (height - dist) * scale) + offx;\r
+      int xend = (int) (height * scale) + offx;\r
+      int ypos = (int) (node.ycount * chunk) + offy;\r
 \r
-      g.setColor(((SequenceNode)node).color.darker());\r
+      g.setColor( ( (SequenceNode) node).color.darker());\r
 \r
       // Draw horizontal line\r
-      g.drawLine(xstart,ypos,xend,ypos);\r
-      g.fillRect(xend-2, ypos-2, 4,4);\r
+      g.drawLine(xstart, ypos, xend, ypos);\r
+      g.fillRect(xend - 2, ypos - 2, 4, 4);\r
 \r
-      int ystart = (int)(((SequenceNode)node.left()) .ycount * chunk) + offy;\r
-      int yend   = (int)(((SequenceNode)node.right()).ycount * chunk) + offy;\r
+      int ystart = (int) ( ( (SequenceNode) node.left()).ycount * chunk) + offy;\r
+      int yend = (int) ( ( (SequenceNode) node.right()).ycount * chunk) + offy;\r
 \r
-      Rectangle pos = new Rectangle(xend-2,ypos-2,5,5);\r
-      nodeHash.put(node,pos);\r
+      Rectangle pos = new Rectangle(xend - 2, ypos - 2, 5, 5);\r
+      nodeHash.put(node, pos);\r
 \r
-      g.drawLine((int)(height*scale) + offx, ystart,\r
-                 (int)(height*scale) + offx, yend);\r
+      g.drawLine( (int) (height * scale) + offx, ystart,\r
+                 (int) (height * scale) + offx, yend);\r
 \r
-      if (showDistances && node.dist > 0) {\r
-        g.drawString(new Format("%5.2f").form(node.dist),xstart,ypos - 5);\r
+      if (showDistances && node.dist > 0)\r
+      {\r
+        g.drawString(new Format("%5.2f").form(node.dist), xstart, ypos - 5);\r
       }\r
 \r
     }\r
   }\r
-  public Object findElement(int x, int y) {\r
-       Enumeration keys = nameHash.keys();\r
 \r
-    while (keys.hasMoreElements()) {\r
-            Object ob = keys.nextElement();\r
-            Rectangle rect = (Rectangle)nameHash.get(ob);\r
+  public Object findElement(int x, int y)\r
+  {\r
+    Enumeration keys = nameHash.keys();\r
 \r
-            if (x >= rect.x && x <= (rect.x + rect.width) &&\r
-              y >= rect.y && y <= (rect.y + rect.height)) {\r
-              return ob;\r
-            }\r
-  }\r
-  keys = nodeHash.keys();\r
+    while (keys.hasMoreElements())\r
+    {\r
+      Object ob = keys.nextElement();\r
+      Rectangle rect = (Rectangle) nameHash.get(ob);\r
+\r
+      if (x >= rect.x && x <= (rect.x + rect.width) &&\r
+          y >= rect.y && y <= (rect.y + rect.height))\r
+      {\r
+        return ob;\r
+      }\r
+    }\r
+    keys = nodeHash.keys();\r
 \r
-    while (keys.hasMoreElements()) {\r
-            Object ob = keys.nextElement();\r
-            Rectangle rect = (Rectangle)nodeHash.get(ob);\r
+    while (keys.hasMoreElements())\r
+    {\r
+      Object ob = keys.nextElement();\r
+      Rectangle rect = (Rectangle) nodeHash.get(ob);\r
 \r
-            if (x >= rect.x && x <= (rect.x + rect.width) &&\r
-              y >= rect.y && y <= (rect.y + rect.height)) {\r
-              return ob;\r
-            }\r
+      if (x >= rect.x && x <= (rect.x + rect.width) &&\r
+          y >= rect.y && y <= (rect.y + rect.height))\r
+      {\r
+        return ob;\r
+      }\r
     }\r
-      return null;\r
+    return null;\r
 \r
   }\r
 \r
-  public void pickNodes(Rectangle pickBox) {\r
-    int width  = getSize().width;\r
+  public void pickNodes(Rectangle pickBox)\r
+  {\r
+    int width = getSize().width;\r
     int height = getSize().height;\r
 \r
     SequenceNode top = tree.getTopNode();\r
 \r
-    float wscale = (float)(width*.8-offx*2)/tree.getMaxHeight()\r
-;\r
-    if (top.count == 0) {\r
-      top.count = ((SequenceNode)top.left()).count + ((SequenceNode)top.right()).count ;\r
+    float wscale = (float) (width * .8 - offx * 2) / tree.getMaxHeight()\r
+        ;\r
+    if (top.count == 0)\r
+    {\r
+      top.count = ( (SequenceNode) top.left()).count +\r
+          ( (SequenceNode) top.right()).count;\r
     }\r
-    float chunk = (float)(height-offy*2)/top.count;\r
+    float chunk = (float) (height - offy * 2) / top.count;\r
 \r
-    pickNode(pickBox,top,chunk,wscale,width,offx,offy);\r
+    pickNode(pickBox, top, chunk, wscale, width, offx, offy);\r
   }\r
 \r
-  public void pickNode(Rectangle pickBox, SequenceNode node, float chunk, float scale, int width,int offx, int offy) {\r
-    if (node == null) {\r
+  public void pickNode(Rectangle pickBox, SequenceNode node, float chunk,\r
+                       float scale, int width, int offx, int offy)\r
+  {\r
+    if (node == null)\r
+    {\r
       return;\r
     }\r
 \r
-    if (node.left() == null && node.right() == null) {\r
+    if (node.left() == null && node.right() == null)\r
+    {\r
       float height = node.height;\r
-      float dist   = node.dist;\r
+      float dist = node.dist;\r
 \r
-      int xstart = (int)((height-dist)*scale) + offx;\r
-      int xend   = (int)(height*scale) + offx;\r
+      int xstart = (int) ( (height - dist) * scale) + offx;\r
+      int xend = (int) (height * scale) + offx;\r
 \r
-      int ypos = (int)(node.ycount * chunk) + offy;\r
+      int ypos = (int) (node.ycount * chunk) + offy;\r
 \r
-      if (pickBox.contains(new Point(xend,ypos))) {\r
-        if (node.element() instanceof SequenceI) {\r
-          SequenceI seq = (SequenceI)node.element();\r
+      if (pickBox.contains(new Point(xend, ypos)))\r
+      {\r
+        if (node.element() instanceof SequenceI)\r
+        {\r
+          SequenceI seq = (SequenceI) node.element();\r
           SequenceGroup sg = av.getSelectionGroup();\r
-          if(sg!=null)\r
+          if (sg != null)\r
+          {\r
             sg.addOrRemove(seq);\r
+          }\r
         }\r
       }\r
-    } else {\r
-      pickNode(pickBox,(SequenceNode)node.left(), chunk,scale,width,offx,offy);\r
-      pickNode(pickBox,(SequenceNode)node.right(),chunk,scale,width,offx,offy);\r
+    }\r
+    else\r
+    {\r
+      pickNode(pickBox, (SequenceNode) node.left(), chunk, scale, width, offx,\r
+               offy);\r
+      pickNode(pickBox, (SequenceNode) node.right(), chunk, scale, width, offx,\r
+               offy);\r
     }\r
   }\r
 \r
   public void setColor(SequenceNode node, Color c)\r
   {\r
     if (node == null)\r
+    {\r
       return;\r
+    }\r
 \r
     if (node.left() == null && node.right() == null)\r
     {\r
       node.color = c;\r
 \r
       if (node.element() instanceof SequenceI)\r
-          ((SequenceI)node.element()).setColor(c);\r
-    } else\r
+      {\r
+        ( (SequenceI) node.element()).setColor(c);\r
+      }\r
+    }\r
+    else\r
     {\r
       node.color = c;\r
-      setColor((SequenceNode)node.left(),c);\r
-      setColor((SequenceNode)node.right(),c);\r
+      setColor( (SequenceNode) node.left(), c);\r
+      setColor( (SequenceNode) node.right(), c);\r
     }\r
   }\r
 \r
-\r
   public void paint(Graphics g)\r
   {\r
 \r
-    font = new Font("Verdana",Font.PLAIN,fontSize);\r
+    font = new Font("Verdana", Font.PLAIN, fontSize);\r
     g.setFont(font);\r
 \r
     FontMetrics fm = g.getFontMetrics(font);\r
 \r
-    if(nameHash.size()==0)\r
+    if (nameHash.size() == 0)\r
+    {\r
       repaint();\r
+    }\r
 \r
-\r
-    if( fitToWindow || (!fitToWindow && scrollPane.getSize().height > fm.getHeight() * nameHash.size()+offy ) )\r
-     {\r
-         draw(g,scrollPane.getSize().width,scrollPane.getSize().height);\r
-     }\r
+    if (fitToWindow ||\r
+        (!fitToWindow &&\r
+         scrollPane.getSize().height > fm.getHeight() * nameHash.size() + offy))\r
+    {\r
+      draw(g, scrollPane.getSize().width, scrollPane.getSize().height);\r
+    }\r
     else\r
-     {\r
-         setSize(new Dimension(scrollPane.getSize().width, fm.getHeight() * nameHash.size()));\r
-         draw( g,scrollPane.getSize().width, fm.getHeight() * nameHash.size());\r
-     }\r
+    {\r
+      setSize(new Dimension(scrollPane.getSize().width,\r
+                            fm.getHeight() * nameHash.size()));\r
+      draw(g, scrollPane.getSize().width, fm.getHeight() * nameHash.size());\r
+    }\r
 \r
     scrollPane.validate();\r
   }\r
-    public int getFontSize() {\r
-        return fontSize;\r
-    }\r
-    public void setFontSize(int fontSize) {\r
-        this.fontSize = fontSize;\r
-        repaint();\r
-    }\r
-  public void draw(Graphics g, int width, int height) {\r
 \r
-      g.setColor(Color.white);\r
-      g.fillRect(0,0,width,height);\r
+  public int getFontSize()\r
+  {\r
+    return fontSize;\r
+  }\r
 \r
+  public void setFontSize(int fontSize)\r
+  {\r
+    this.fontSize = fontSize;\r
+    repaint();\r
+  }\r
 \r
-      labelLength = g.getFontMetrics(font).stringWidth(longestName)+ 20;//20 allows for scrollbar\r
+  public void draw(Graphics g, int width, int height)\r
+  {\r
 \r
-      float wscale =(float)(width - labelLength -offx*2)/tree.getMaxHeight();\r
+    g.setColor(Color.white);\r
+    g.fillRect(0, 0, width, height);\r
 \r
-      SequenceNode top = tree.getTopNode();\r
+    labelLength = g.getFontMetrics(font).stringWidth(longestName) + 20; //20 allows for scrollbar\r
 \r
-      if (top.count == 0) {\r
-          top.count = ((SequenceNode)top.left()).count + ((SequenceNode)top.right()).count ;\r
-      }\r
-      float chunk = (float)(height-offy*2)/top.count ;\r
+    float wscale = (float) (width - labelLength - offx * 2) / tree.getMaxHeight();\r
 \r
-      drawNode(g,tree.getTopNode(),chunk,wscale,width,offx,offy);\r
+    SequenceNode top = tree.getTopNode();\r
 \r
-      if (threshold != 0)\r
-      {\r
-        if(av.getCurrentTree() == tree)\r
-          g.setColor(Color.red);\r
-        else\r
-          g.setColor(Color.gray);\r
+    if (top.count == 0)\r
+    {\r
+      top.count = ( (SequenceNode) top.left()).count +\r
+          ( (SequenceNode) top.right()).count;\r
+    }\r
+    float chunk = (float) (height - offy * 2) / top.count;\r
 \r
-          int x = (int)(    threshold * (float)(getSize().width-labelLength - 2*offx) +offx   ) ;\r
+    drawNode(g, tree.getTopNode(), chunk, wscale, width, offx, offy);\r
 \r
-          g.drawLine(x,0,x,getSize().height);\r
+    if (threshold != 0)\r
+    {\r
+      if (av.getCurrentTree() == tree)\r
+      {\r
+        g.setColor(Color.red);\r
+      }\r
+      else\r
+      {\r
+        g.setColor(Color.gray);\r
       }\r
 \r
-  }\r
-\r
-  public void mouseReleased(MouseEvent e) { }\r
-  public void mouseEntered(MouseEvent e) { }\r
-  public void mouseExited(MouseEvent e) { }\r
-  public void mouseClicked(MouseEvent e) {\r
-  }\r
-\r
-  public void mousePressed(MouseEvent e) {\r
+      int x = (int) (threshold *\r
+                     (float) (getSize().width - labelLength - 2 * offx) + offx);\r
 \r
-      av.setCurrentTree(tree);\r
+      g.drawLine(x, 0, x, getSize().height);\r
+    }\r
 \r
-      int x = e.getX();\r
-      int y = e.getY();\r
+  }\r
 \r
-      Object ob = findElement(x,y);\r
+  public void mouseReleased(MouseEvent e)\r
+  {}\r
 \r
-      if (ob instanceof SequenceI)\r
-      {\r
-          TreeSelectionChanged((Sequence)ob);\r
-          repaint();\r
-          return;\r
+  public void mouseEntered(MouseEvent e)\r
+  {}\r
 \r
-      } else if (ob instanceof SequenceNode) {\r
-          SequenceNode tmpnode = (SequenceNode)ob;\r
-          tree.swapNodes(tmpnode);\r
-          tree.reCount(tree.getTopNode());\r
-          tree.findHeight(tree.getTopNode());\r
-      } else {\r
-          // Find threshold\r
+  public void mouseExited(MouseEvent e)\r
+  {}\r
 \r
-          if (tree.getMaxHeight() != 0) {\r
-              threshold = (float)(x - offx)/(float)(getSize().width-labelLength - 2*offx);\r
+  public void mouseClicked(MouseEvent e)\r
+  {\r
+  }\r
 \r
-              tree.getGroups().removeAllElements();\r
-              tree.groupNodes(tree.getTopNode(),threshold);\r
-              setColor(tree.getTopNode(),Color.black);\r
+  public void mousePressed(MouseEvent e)\r
+  {\r
 \r
-              av.setSelectionGroup(null);\r
-              av.alignment.deleteAllGroups();\r
+    av.setCurrentTree(tree);\r
 \r
-              for (int i=0; i < tree.getGroups().size(); i++)\r
-              {\r
+    int x = e.getX();\r
+    int y = e.getY();\r
 \r
-                  Color col = new Color((int)(Math.random()*255),\r
-                                        (int)(Math.random()*255),\r
-                                        (int)(Math.random()*255));\r
-                  setColor((SequenceNode)tree.getGroups().elementAt(i),col.brighter());\r
+    Object ob = findElement(x, y);\r
 \r
-                  Vector l = tree.findLeaves((SequenceNode)tree.getGroups().elementAt(i),new Vector());\r
-                  SequenceGroup sg = null;\r
-                  for (int j = 0; j < l.size(); j++)\r
-                  {\r
-                    SequenceNode sn = (SequenceNode) l.elementAt(j);\r
-                    if(sg==null)\r
-                       sg = new SequenceGroup("TreeGroup", av.getGlobalColourScheme(), true, true,false,0,av.alignment.getWidth());\r
+    if (ob instanceof SequenceI)\r
+    {\r
+      TreeSelectionChanged( (Sequence) ob);\r
+      repaint();\r
+      return;\r
 \r
-                    sg.addSequence( (Sequence) sn.element());\r
-                  }\r
+    }\r
+    else if (ob instanceof SequenceNode)\r
+    {\r
+      SequenceNode tmpnode = (SequenceNode) ob;\r
+      tree.swapNodes(tmpnode);\r
+      tree.reCount(tree.getTopNode());\r
+      tree.findHeight(tree.getTopNode());\r
+    }\r
+    else\r
+    {\r
+      // Find threshold\r
 \r
-                  if (av.getGlobalColourScheme() instanceof ConservationColourScheme)\r
-                  {\r
-                    ConservationColourScheme ccs = (ConservationColourScheme) av.getGlobalColourScheme();\r
-                    Conservation c = new Conservation("Group",\r
-                                                      ResidueProperties.propHash, 3,\r
-                                                      sg.sequences, sg.getStartRes(),\r
-                                                      sg.getEndRes());\r
+      if (tree.getMaxHeight() != 0)\r
+      {\r
+        threshold = (float) (x - offx) /\r
+            (float) (getSize().width - labelLength - 2 * offx);\r
+\r
+        tree.getGroups().removeAllElements();\r
+        tree.groupNodes(tree.getTopNode(), threshold);\r
+        setColor(tree.getTopNode(), Color.black);\r
+\r
+        av.setSelectionGroup(null);\r
+        av.alignment.deleteAllGroups();\r
+\r
+        for (int i = 0; i < tree.getGroups().size(); i++)\r
+        {\r
+\r
+          Color col = new Color( (int) (Math.random() * 255),\r
+                                (int) (Math.random() * 255),\r
+                                (int) (Math.random() * 255));\r
+          setColor( (SequenceNode) tree.getGroups().elementAt(i), col.brighter());\r
+\r
+          Vector l = tree.findLeaves( (SequenceNode) tree.getGroups().elementAt(\r
+              i), new Vector());\r
+          SequenceGroup sg = null;\r
+          for (int j = 0; j < l.size(); j++)\r
+          {\r
+            SequenceNode sn = (SequenceNode) l.elementAt(j);\r
+            if (sg == null)\r
+            {\r
+              sg = new SequenceGroup("TreeGroup", av.getGlobalColourScheme(), true, true, false,\r
+                                     0, av.alignment.getWidth());\r
+            }\r
 \r
-                    c.calculate();\r
-                    c.verdict(false, av.ConsPercGaps);\r
-                    ccs = new ConservationColourScheme(c, ccs.cs);\r
+            sg.addSequence( (Sequence) sn.element());\r
+          }\r
 \r
-                    sg.cs = ccs;\r
+          if (av.getGlobalColourScheme() instanceof ConservationColourScheme)\r
+          {\r
+            ConservationColourScheme ccs = (ConservationColourScheme) av.\r
+                getGlobalColourScheme();\r
+            Conservation c = new Conservation("Group",\r
+                                              ResidueProperties.propHash, 3,\r
+                                              sg.sequences, sg.getStartRes(),\r
+                                              sg.getEndRes());\r
 \r
-                  }\r
+            c.calculate();\r
+            c.verdict(false, av.ConsPercGaps);\r
+            ccs = new ConservationColourScheme(c, ccs.cs);\r
 \r
+            sg.cs = ccs;\r
 \r
+          }\r
 \r
-                  av.alignment.addGroup(sg);\r
+          av.alignment.addGroup(sg);\r
 \r
-              }\r
-          }\r
+        }\r
       }\r
+    }\r
 \r
-      PaintRefresher.Refresh(this);\r
-      repaint();\r
+    PaintRefresher.Refresh(this);\r
+    repaint();\r
 \r
   }\r
 \r
-    public void setShowDistances(boolean state) {\r
-        this.showDistances = state;\r
-        repaint();\r
-    }\r
+  public void setShowDistances(boolean state)\r
+  {\r
+    this.showDistances = state;\r
+    repaint();\r
+  }\r
 \r
-    public void setShowBootstrap(boolean state) {\r
-      this.showBootstrap = state;\r
-      repaint();\r
-    }\r
-    public void setMarkPlaceholders(boolean state) {\r
-            this.markPlaceholders = state;\r
-            repaint();\r
-    }\r
+  public void setShowBootstrap(boolean state)\r
+  {\r
+    this.showBootstrap = state;\r
+    repaint();\r
+  }\r
 \r
-}\r
+  public void setMarkPlaceholders(boolean state)\r
+  {\r
+    this.markPlaceholders = state;\r
+    repaint();\r
+  }\r
 \r
+}\r
index c33975b..58da074 100755 (executable)
@@ -1,34 +1,35 @@
 /*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 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
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 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 jalview.datamodel.*;\r
-import jalview.io.NewickFile;\r
-import jalview.analysis.*;\r
-import jalview.jbappletgui.GTreePanel;\r
-import java.awt.event.*;\r
 import java.util.*;\r
-import jalview.io.NewickFile;\r
 \r
+import java.awt.event.*;\r
+\r
+import jalview.analysis.*;\r
+import jalview.datamodel.*;\r
+import jalview.io.*;\r
+import jalview.jbappletgui.*;\r
 \r
-public class TreePanel extends GTreePanel\r
+public class TreePanel\r
+    extends GTreePanel\r
 {\r
   SequenceI[] seq;\r
   String type;\r
@@ -44,7 +45,8 @@ public class TreePanel extends GTreePanel
     return tree;\r
   }\r
 \r
-  public TreePanel(AlignViewport av, Vector seqVector, String type, String pwtype, int s, int e)\r
+  public TreePanel(AlignViewport av, Vector seqVector, String type,\r
+                   String pwtype, int s, int e)\r
   {\r
     super();\r
 \r
@@ -55,12 +57,14 @@ public class TreePanel extends GTreePanel
     end = e;\r
 \r
     String longestName = "";\r
-    seq = new Sequence [seqVector.size()];\r
-    for (int i=0;i < seqVector.size();i++)\r
+    seq = new Sequence[seqVector.size()];\r
+    for (int i = 0; i < seqVector.size(); i++)\r
     {\r
       seq[i] = (Sequence) seqVector.elementAt(i);\r
-      if(seq[i].getName().length()>longestName.length())\r
+      if (seq[i].getName().length() > longestName.length())\r
+      {\r
         longestName = seq[i].getName();\r
+      }\r
     }\r
 \r
     tree = new NJTree(seq, type, pwtype, start, end);\r
@@ -72,49 +76,61 @@ public class TreePanel extends GTreePanel
     scrollPane.add(treeCanvas);\r
 \r
   }\r
+\r
   public TreePanel(AlignViewport av, Vector seqVector, NewickFile newtree,\r
                    String type, String pwtype)\r
-    {\r
-      super();\r
-      // These are probably only  arbitrary strings reflecting source of tree\r
-      this.type = type;\r
-      this.pwtype = pwtype;\r
+  {\r
+    super();\r
+    // These are probably only  arbitrary strings reflecting source of tree\r
+    this.type = type;\r
+    this.pwtype = pwtype;\r
 \r
-      start = 0;\r
-      end = seqVector.size();\r
+    start = 0;\r
+    end = seqVector.size();\r
+\r
+    String longestName = "";\r
+    seq = new Sequence[seqVector.size()];\r
+    for (int i = 0; i < seqVector.size(); i++)\r
+    {\r
+      seq[i] = (Sequence) seqVector.elementAt(i);\r
+    }\r
+    // This constructor matches sequence names to treenodes and sets up the tree layouts.\r
+    tree = new NJTree(seq, newtree);\r
+    // Now have to calculate longest name based on the leaves\r
+    Vector leaves = tree.findLeaves(tree.getTopNode(), new Vector());\r
 \r
-      String longestName = "";\r
-      seq = new Sequence [seqVector.size()];\r
-      for (int i=0;i < seqVector.size();i++)\r
+    for (int i = 0; i < leaves.size(); i++)\r
+    {\r
+      if (longestName.length() <\r
+          ( (Sequence) ( (SequenceNode) leaves.elementAt(i)).element()).getName().\r
+          length())\r
       {\r
-        seq[i] = (Sequence) seqVector.elementAt(i);\r
+        longestName = TreeCanvas.PLACEHOLDER +\r
+            ( (Sequence) ( (SequenceNode) leaves.elementAt(i)).element()).\r
+            getName();\r
       }\r
-      // This constructor matches sequence names to treenodes and sets up the tree layouts.\r
-      tree = new NJTree(seq, newtree);\r
-      // Now have to calculate longest name based on the leaves\r
-      Vector leaves = tree.findLeaves(tree.getTopNode(),new Vector());\r
-\r
-      for (int i=0;i < leaves.size();i++)\r
-        if (longestName.length()<((Sequence) ((SequenceNode) leaves.elementAt(i)).element()).getName().length())\r
-          longestName = TreeCanvas.PLACEHOLDER+((Sequence) ((SequenceNode) leaves.elementAt(i)).element()).getName();\r
-\r
-      tree.reCount(tree.getTopNode());\r
-      tree.findHeight(tree.getTopNode());\r
-\r
-      treeCanvas = new TreeCanvas(av, tree, scrollPane, longestName);\r
-      treeCanvas.setShowBootstrap(newtree.HasBootstrap());\r
-      treeCanvas.setShowDistances(newtree.HasDistances());\r
-      distanceMenu.setState(newtree.HasDistances());\r
-      bootstrapMenu.setState(newtree.HasBootstrap());\r
-      if (true) // JBPNote TODO: preference for always marking placeholders in new associated tree\r
-        placeholdersMenu.setState(treeCanvas.markPlaceholders);\r
-      scrollPane.add(treeCanvas);\r
+    }\r
+\r
+    tree.reCount(tree.getTopNode());\r
+    tree.findHeight(tree.getTopNode());\r
 \r
+    treeCanvas = new TreeCanvas(av, tree, scrollPane, longestName);\r
+    treeCanvas.setShowBootstrap(newtree.HasBootstrap());\r
+    treeCanvas.setShowDistances(newtree.HasDistances());\r
+    distanceMenu.setState(newtree.HasDistances());\r
+    bootstrapMenu.setState(newtree.HasBootstrap());\r
+    if (true) // JBPNote TODO: preference for always marking placeholders in new associated tree\r
+    {\r
+      placeholdersMenu.setState(treeCanvas.markPlaceholders);\r
     }\r
+    scrollPane.add(treeCanvas);\r
 \r
-public String getText(String format) {\r
-  return null;\r
-}\r
+  }\r
+\r
+  public String getText(String format)\r
+  {\r
+    return null;\r
+  }\r
 \r
   protected void fitToWindow_actionPerformed(ActionEvent e)\r
   {\r
@@ -130,33 +146,31 @@ public String getText(String format) {
     cap.setText(output);\r
     java.awt.Frame frame = new java.awt.Frame();\r
     frame.add(cap);\r
-    jalview.bin.JalviewLite.addFrame(frame, type+" "+pwtype, 500,100);\r
+    jalview.bin.JalviewLite.addFrame(frame, type + " " + pwtype, 500, 100);\r
   }\r
 \r
-\r
-\r
   protected void fontSize_actionPerformed(ActionEvent e)\r
   {\r
- /*   if( treeCanvas==null )\r
-     return;\r
-\r
-   String size = fontSize.getLabel().substring( fontSize.getLabel().indexOf("-")+1);\r
-\r
-   Object selection = JOptionPane.showInternalInputDialog(Desktop.desktop,\r
-                               "Select font size",\r
-                               "Font size",\r
-                               JOptionPane.QUESTION_MESSAGE,\r
-                               null, new String[]{"1","2","4","6","8","10","12","14","16","18","20"}\r
-                               ,"Font Size - "+size);\r
-   if(selection!=null)\r
-   {\r
-     fontSize.setText("Font Size - " + selection);\r
-\r
-     int i = Integer.parseInt(selection.toString());\r
-     treeCanvas.setFontSize(i);\r
-   }\r
-    scrollPane.setViewportView(treeCanvas);\r
-*/\r
+    /*   if( treeCanvas==null )\r
+        return;\r
+\r
+      String size = fontSize.getLabel().substring( fontSize.getLabel().indexOf("-")+1);\r
+\r
+      Object selection = JOptionPane.showInternalInputDialog(Desktop.desktop,\r
+                                  "Select font size",\r
+                                  "Font size",\r
+                                  JOptionPane.QUESTION_MESSAGE,\r
+     null, new String[]{"1","2","4","6","8","10","12","14","16","18","20"}\r
+                                  ,"Font Size - "+size);\r
+      if(selection!=null)\r
+      {\r
+        fontSize.setText("Font Size - " + selection);\r
+\r
+        int i = Integer.parseInt(selection.toString());\r
+        treeCanvas.setFontSize(i);\r
+      }\r
+       scrollPane.setViewportView(treeCanvas);\r
+     */\r
   }\r
 \r
   protected void distanceMenu_actionPerformed(ActionEvent e)\r
@@ -171,7 +185,7 @@ public String getText(String format) {
 \r
   protected void placeholdersMenu_actionPerformed(ActionEvent e)\r
   {\r
-      treeCanvas.setMarkPlaceholders(placeholdersMenu.getState());\r
+    treeCanvas.setMarkPlaceholders(placeholdersMenu.getState());\r
   }\r
 \r
 }\r
index 0c7e685..80d91ef 100755 (executable)
@@ -1,35 +1,36 @@
 /*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 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
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 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 jalview.jbappletgui.GUserDefinedColours;\r
-import jalview.datamodel.*;\r
-import jalview.schemes.*;\r
-import jalview.io.*;\r
 import java.io.*;\r
+import java.util.*;\r
+\r
 import java.awt.*;\r
 import java.awt.event.*;\r
-import java.util.*;\r
 \r
+import jalview.datamodel.*;\r
+import jalview.jbappletgui.*;\r
+import jalview.schemes.*;\r
 \r
-public class UserDefinedColours extends GUserDefinedColours\r
+public class UserDefinedColours\r
+    extends GUserDefinedColours\r
 {\r
 \r
   AlignmentPanel ap;\r
@@ -52,98 +53,120 @@ public class UserDefinedColours extends GUserDefinedColours
     super();\r
     frame = new Frame();\r
     frame.add(this);\r
-    jalview.bin.JalviewLite.addFrame(frame, "User defined colours", 420,345 );\r
-\r
-    if(sg!=null)\r
-        frame.setTitle( frame.getTitle()+ " ("+sg.getName()+")");\r
+    jalview.bin.JalviewLite.addFrame(frame, "User defined colours", 420, 345);\r
 \r
+    if (sg != null)\r
+    {\r
+      frame.setTitle(frame.getTitle() + " (" + sg.getName() + ")");\r
+    }\r
 \r
     this.ap = ap;\r
     seqGroup = sg;\r
 \r
+    if (seqGroup != null)\r
+    {\r
+      oldColourScheme = seqGroup.cs;\r
+    }\r
+    else\r
+    {\r
+      oldColourScheme = ap.av.getGlobalColourScheme();\r
+    }\r
 \r
-      if (seqGroup != null)\r
-        oldColourScheme = seqGroup.cs;\r
-      else\r
-        oldColourScheme = ap.av.getGlobalColourScheme();\r
-\r
-      for (int i = 0; i < 20; i++)\r
-        makeButton(ResidueProperties.aa2Triplet.get(ResidueProperties.aa[i]) +\r
-                   "", ResidueProperties.aa[i]);\r
+    for (int i = 0; i < 20; i++)\r
+    {\r
+      makeButton(ResidueProperties.aa2Triplet.get(ResidueProperties.aa[i]) +\r
+                 "", ResidueProperties.aa[i]);\r
+    }\r
 \r
-      makeButton("B", "B");\r
-      makeButton("Z", "Z");\r
-      makeButton("X", "X");\r
-      makeButton("Gap", "'.','-',' '");\r
+    makeButton("B", "B");\r
+    makeButton("Z", "Z");\r
+    makeButton("X", "X");\r
+    makeButton("Gap", "'.','-',' '");\r
 \r
   }\r
 \r
-  protected void rText_actionPerformed(ActionEvent e) {\r
-    try{\r
+  protected void rText_actionPerformed(ActionEvent e)\r
+  {\r
+    try\r
+    {\r
       int i = Integer.parseInt(rText.getText());\r
       rScroller.setValue(i);\r
-    }catch(NumberFormatException ex){}\r
+    }\r
+    catch (NumberFormatException ex)\r
+    {}\r
   }\r
 \r
-  protected void gText_actionPerformed(ActionEvent e) {\r
-    try{\r
+  protected void gText_actionPerformed(ActionEvent e)\r
+  {\r
+    try\r
+    {\r
       int i = Integer.parseInt(gText.getText());\r
       gScroller.setValue(i);\r
-    }catch(NumberFormatException ex){}\r
+    }\r
+    catch (NumberFormatException ex)\r
+    {}\r
 \r
   }\r
 \r
-  protected void bText_actionPerformed(ActionEvent e) {\r
-    try{\r
+  protected void bText_actionPerformed(ActionEvent e)\r
+  {\r
+    try\r
+    {\r
       int i = Integer.parseInt(bText.getText());\r
       bScroller.setValue(i);\r
-    }catch(NumberFormatException ex){}\r
+    }\r
+    catch (NumberFormatException ex)\r
+    {}\r
 \r
   }\r
 \r
-\r
-  protected void rScroller_adjustmentValueChanged(AdjustmentEvent e) {\r
+  protected void rScroller_adjustmentValueChanged(AdjustmentEvent e)\r
+  {\r
     R = rScroller.getValue();\r
-    rText.setText(R+"");\r
+    rText.setText(R + "");\r
     colourChanged();\r
   }\r
 \r
-  protected void gScroller_adjustmentValueChanged(AdjustmentEvent e) {\r
+  protected void gScroller_adjustmentValueChanged(AdjustmentEvent e)\r
+  {\r
     G = gScroller.getValue();\r
-    gText.setText(G+"");\r
+    gText.setText(G + "");\r
     colourChanged();\r
   }\r
 \r
-  protected void bScroller_adjustmentValueChanged(AdjustmentEvent e) {\r
+  protected void bScroller_adjustmentValueChanged(AdjustmentEvent e)\r
+  {\r
     B = bScroller.getValue();\r
-    bText.setText(B+"");\r
+    bText.setText(B + "");\r
     colourChanged();\r
   }\r
 \r
- public void colourChanged()\r
- {\r
-   Color col = new Color(R,G,B);\r
-   target.setBackground( col );\r
+  public void colourChanged()\r
+  {\r
+    Color col = new Color(R, G, B);\r
+    target.setBackground(col);\r
 \r
-   if(selectedButton!=null)\r
-     selectedButton.setBackground( col );\r
- }\r
+    if (selectedButton != null)\r
+    {\r
+      selectedButton.setBackground(col);\r
+    }\r
+  }\r
 \r
   public void colourButtonPressed(MouseEvent e)\r
   {\r
-     selectedButton = (Button)e.getSource();\r
-     Color col = selectedButton.getBackground();\r
-     R = col.getRed();\r
-     G = col.getGreen();\r
-     B = col.getBlue();\r
-     rScroller.setValue(R);\r
-     gScroller.setValue(G);\r
-     bScroller.setValue(B);\r
-     rText.setText(R+"");\r
-     gText.setText(G+"");\r
-     bText.setText(B+"");\r
-\r
-     colourChanged();\r
+    selectedButton = (Button) e.getSource();\r
+    Color col = selectedButton.getBackground();\r
+    R = col.getRed();\r
+    G = col.getGreen();\r
+    B = col.getBlue();\r
+    rScroller.setValue(R);\r
+    gScroller.setValue(G);\r
+    bScroller.setValue(B);\r
+    rText.setText(R + "");\r
+    gText.setText(G + "");\r
+    bText.setText(B + "");\r
+\r
+    colourChanged();\r
   }\r
 \r
   void makeButton(String label, String aa)\r
@@ -151,15 +174,17 @@ public class UserDefinedColours extends GUserDefinedColours
     final Button button = new Button();\r
     Color col = Color.white;\r
 \r
-\r
-    try{\r
+    try\r
+    {\r
       col = oldColourScheme.findColour(aa, -1);\r
-    }catch(Exception ex){}\r
+    }\r
+    catch (Exception ex)\r
+    {}\r
 \r
-    button.setBackground(  col );\r
-    oldColours.addElement( col );\r
-    button.setLabel( label );\r
-    button.setForeground( col.darker().darker().darker() );\r
+    button.setBackground(col);\r
+    oldColours.addElement(col);\r
+    button.setLabel(label);\r
+    button.setForeground(col.darker().darker().darker());\r
     button.setFont(new java.awt.Font("Verdana", 1, 10));\r
     button.addMouseListener(new java.awt.event.MouseAdapter()\r
     {\r
@@ -172,42 +197,44 @@ public class UserDefinedColours extends GUserDefinedColours
     buttonPanel.add(button, null);\r
   }\r
 \r
-\r
   protected void okButton_actionPerformed(ActionEvent e)\r
   {\r
     applyButton_actionPerformed(null);\r
-   frame.setVisible(false);\r
+    frame.setVisible(false);\r
   }\r
 \r
   protected void applyButton_actionPerformed(ActionEvent e)\r
   {\r
 \r
-    Color [] newColours = new Color[24];\r
-    for(int i=0; i<24; i++)\r
+    Color[] newColours = new Color[24];\r
+    for (int i = 0; i < 24; i++)\r
     {\r
-          Button button = (Button)buttonPanel.getComponent(i);\r
-          newColours[i] = button.getBackground();\r
+      Button button = (Button) buttonPanel.getComponent(i);\r
+      newColours[i] = button.getBackground();\r
     }\r
 \r
-    UserColourScheme ucs = new UserColourScheme( newColours );\r
+    UserColourScheme ucs = new UserColourScheme(newColours);\r
     ucs.setThreshold(0);\r
 \r
-    if(seqGroup!=null)\r
+    if (seqGroup != null)\r
+    {\r
       seqGroup.cs = ucs;\r
+    }\r
     else\r
+    {\r
       ap.av.setGlobalColourScheme(ucs);\r
+    }\r
 \r
     ap.repaint();\r
   }\r
 \r
-\r
   public static UserColourScheme loadDefaultColours(String file)\r
   {\r
     UserColourScheme ucs = null;\r
     try\r
     {\r
       BufferedReader in = new BufferedReader(new FileReader(file));\r
-      Color [] newColours = new Color[24];\r
+      Color[] newColours = new Color[24];\r
       for (int i = 0; i < 24; i++)\r
       {\r
         newColours[i] = new Color(Integer.parseInt(in.readLine()));\r
@@ -223,28 +250,30 @@ public class UserDefinedColours extends GUserDefinedColours
     return ucs;\r
   }\r
 \r
-\r
   protected void cancelButton_actionPerformed(ActionEvent e)\r
   {\r
 \r
-    Color [] newColours = new Color[24];\r
-    for(int i=0; i<24; i++)\r
+    Color[] newColours = new Color[24];\r
+    for (int i = 0; i < 24; i++)\r
     {\r
-          newColours[i] = (Color)oldColours.elementAt(i);\r
-          buttonPanel.getComponent(i).setBackground(newColours[i]);\r
+      newColours[i] = (Color) oldColours.elementAt(i);\r
+      buttonPanel.getComponent(i).setBackground(newColours[i]);\r
     }\r
 \r
-    UserColourScheme ucs = new UserColourScheme( newColours );\r
+    UserColourScheme ucs = new UserColourScheme(newColours);\r
 \r
     if (seqGroup != null)\r
+    {\r
       seqGroup.cs = ucs;\r
+    }\r
     else\r
+    {\r
       ap.av.setGlobalColourScheme(ucs);\r
+    }\r
 \r
     ap.repaint();\r
 \r
     frame.setVisible(false);\r
   }\r
 \r
-\r
 }\r
index d939a7e..9857f44 100755 (executable)
 * 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.bin;\r
-import java.util.*;\r
+\r
 import java.io.*;\r
 \r
+import java.util.*;\r
 import java.util.jar.*;\r
-public class Cache\r
-{\r
-  public static String  VERSION = "Release 2.0";\r
-  public static String  BUILD_DATE = "";\r
-\r
-  public static Properties applicationProperties;\r
-  // Current properties include:\r
-  //\r
-  // LAST_DIRECTORY   , use this to cache record of where the user looked to find a file\r
-  // UNIPROT_CACHE\r
-  // USER_DEFINED_COLOUR - file describing last user set colours\r
-  // FONT_NAME\r
-  // FONT_STYLE\r
-  // FONT_SIZE\r
-  // logs.Axis.Level - one of the stringified Levels for log4j controlling the logging level for axis (used for web services)\r
-  // jalview.browser - used in the jalview.utils.browserLauncher class if it doesn't know what else to do.\r
-  public static void loadProperties()\r
-  {\r
-    // get last build time.\r
-    long date = 0;\r
-    try{\r
-          String localFile = Cache.class.getProtectionDomain().getCodeSource().getLocation().toString();\r
-          localFile = localFile.concat("!/");\r
-          String tmpString = "jar:";\r
-          String localJarFileString = tmpString.concat(localFile);\r
-          java.net.URL localJarFileURL = new java.net.URL(localJarFileString);\r
-          java.net.JarURLConnection localJarFile = (java.net.JarURLConnection)localJarFileURL.openConnection();\r
-          date = localJarFile.getLastModified();\r
-    }catch(Exception ex){ex.printStackTrace();}\r
-    if(date==0)\r
-    {\r
-      // this is called for unpackaged class files, ie not in a Jar file\r
-      // InstallAnywhere version will find build date this way\r
-      // not entirely accurate as it only tells you when Cache.class was last compiled\r
-\r
-\r
-     java.io.File f = new java.io.File(System.getProperty("user.dir") + "/jalview/bin/Cache.class" );\r
-     date = f.lastModified();\r
-    }\r
-\r
-    if(date!=0)\r
-      BUILD_DATE = new Date( date ).toString();\r
 \r
-    applicationProperties = new Properties();\r
 \r
-    try\r
-    {\r
-      FileInputStream in = new FileInputStream(System.getProperty("user.home") +\r
-                                               "/.jalview_properties");\r
-      applicationProperties = new Properties();\r
-      applicationProperties.load(in);\r
-      in.close();\r
+public class Cache {\r
+    public static String VERSION = "Release 2.0";\r
+    public static String BUILD_DATE = "";\r
+    public static Properties applicationProperties;\r
+\r
+    // Current properties include:\r
+    //\r
+    // LAST_DIRECTORY   , use this to cache record of where the user looked to find a file\r
+    // UNIPROT_CACHE\r
+    // USER_DEFINED_COLOUR - file describing last user set colours\r
+    // FONT_NAME\r
+    // FONT_STYLE\r
+    // FONT_SIZE\r
+    // logs.Axis.Level - one of the stringified Levels for log4j controlling the logging level for axis (used for web services)\r
+    // jalview.browser - used in the jalview.utils.browserLauncher class if it doesn't know what else to do.\r
+    public static void loadProperties() {\r
+        // get last build time.\r
+        long date = 0;\r
+\r
+        try {\r
+            String localFile = Cache.class.getProtectionDomain().getCodeSource()\r
+                                          .getLocation().toString();\r
+            localFile = localFile.concat("!/");\r
+\r
+            String tmpString = "jar:";\r
+            String localJarFileString = tmpString.concat(localFile);\r
+            java.net.URL localJarFileURL = new java.net.URL(localJarFileString);\r
+            java.net.JarURLConnection localJarFile = (java.net.JarURLConnection) localJarFileURL.openConnection();\r
+            date = localJarFile.getLastModified();\r
+        } catch (Exception ex) {\r
+            ex.printStackTrace();\r
+        }\r
+\r
+        if (date == 0) {\r
+            // this is called for unpackaged class files, ie not in a Jar file\r
+            // InstallAnywhere version will find build date this way\r
+            // not entirely accurate as it only tells you when Cache.class was last compiled\r
+            java.io.File f = new java.io.File(System.getProperty("user.dir") +\r
+                    "/jalview/bin/Cache.class");\r
+            date = f.lastModified();\r
+        }\r
+\r
+        if (date != 0) {\r
+            BUILD_DATE = new Date(date).toString();\r
+        }\r
+\r
+        applicationProperties = new Properties();\r
+\r
+        try {\r
+            FileInputStream in = new FileInputStream(System.getProperty(\r
+                        "user.home") + "/.jalview_properties");\r
+            applicationProperties = new Properties();\r
+            applicationProperties.load(in);\r
+            in.close();\r
+        } catch (Exception ex) {\r
+        }\r
     }\r
-    catch (Exception ex)\r
-    { }\r
-  }\r
-\r
-  public static String getProperty(String key)\r
-  {\r
-    return  applicationProperties.getProperty(key);\r
-  }\r
-\r
-  public static String setProperty(String key, String obj)\r
-  {\r
-    try\r
-    {\r
-      FileOutputStream out = new FileOutputStream(System.getProperty(\r
-          "user.home") + "/.jalview_properties");\r
-\r
-      applicationProperties.setProperty(key, obj);\r
-\r
-      applicationProperties.store(out, "---JalviewX Properties File---");\r
-      out.close();\r
-    }\r
-    catch (Exception ex)\r
-    {}\r
-\r
-    return obj;\r
-\r
-  }\r
 \r
+    public static String getProperty(String key) {\r
+        return applicationProperties.getProperty(key);\r
+    }\r
 \r
+    public static String setProperty(String key, String obj) {\r
+        try {\r
+            FileOutputStream out = new FileOutputStream(System.getProperty(\r
+                        "user.home") + "/.jalview_properties");\r
 \r
+            applicationProperties.setProperty(key, obj);\r
 \r
+            applicationProperties.store(out, "---JalviewX Properties File---");\r
+            out.close();\r
+        } catch (Exception ex) {\r
+        }\r
 \r
+        return obj;\r
+    }\r
 }\r
index 2524abd..07958b4 100755 (executable)
 * 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.bin;\r
 \r
 import jalview.gui.*;\r
-import javax.swing.*;\r
-import java.awt.event.*;\r
+\r
 import jalview.io.*;\r
 \r
 import org.apache.log4j.*;\r
 \r
-public class Jalview extends JApplet\r
-{\r
-  public static JApplet applet;\r
-  Desktop frame;\r
-  public void init()\r
-  {\r
-    applet = this;\r
-    Cache.loadProperties();\r
-    jalview.gui.Preferences.initPreferences();\r
-\r
-    frame = new Desktop();\r
-    frame.setResizable(true);\r
-    frame.setVisible(true);\r
-    frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);\r
-    frame.addWindowListener(new WindowAdapter()\r
-    {\r
-      public void windowClosing(WindowEvent e)\r
-      {\r
-          applet.stop();\r
-          applet.destroy();\r
-      }\r
-    });\r
-\r
-    String file = getParameter("alignment");\r
-\r
-    if(file!=null)\r
-    {\r
-      jalview.bin.Cache.setProperty("LAST_DIRECTORY", file);\r
-      String protocol = "File";\r
-      if (file.indexOf("http:") > -1)\r
-        protocol = "URL";\r
-\r
-      String format = jalview.io.IdentifyFile.Identify(file, protocol);\r
-\r
-      frame.LoadFile(file, protocol, format);\r
+import java.awt.event.*;\r
+\r
+import javax.swing.*;\r
+\r
+\r
+public class Jalview extends JApplet {\r
+    public static JApplet applet;\r
+    Desktop frame;\r
+\r
+    public void init() {\r
+        applet = this;\r
+        Cache.loadProperties();\r
+        jalview.gui.Preferences.initPreferences();\r
+\r
+        frame = new Desktop();\r
+        frame.setResizable(true);\r
+        frame.setVisible(true);\r
+        frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);\r
+        frame.addWindowListener(new WindowAdapter() {\r
+                public void windowClosing(WindowEvent e) {\r
+                    applet.stop();\r
+                    applet.destroy();\r
+                }\r
+            });\r
+\r
+        String file = getParameter("alignment");\r
+\r
+        if (file != null) {\r
+            jalview.bin.Cache.setProperty("LAST_DIRECTORY", file);\r
+\r
+            String protocol = "File";\r
+\r
+            if (file.indexOf("http:") > -1) {\r
+                protocol = "URL";\r
+            }\r
+\r
+            String format = jalview.io.IdentifyFile.Identify(file, protocol);\r
+\r
+            frame.LoadFile(file, protocol, format);\r
+        }\r
     }\r
-  }\r
-\r
-  public void destroy()\r
-  {\r
-    if(applet!=null)\r
-      applet.stop();\r
-    else\r
-      System.exit(0);\r
-    frame.setVisible(false);\r
-  }\r
-\r
-  private static void initLogger() {\r
-    Logger l = Logger.getLogger("org.apache.axis");\r
-    if (Cache.getProperty("logs.Axis.Level")==null) {\r
-      Cache.setProperty("logs.Axis.Level", Level.INFO.toString());\r
+\r
+    public void destroy() {\r
+        if (applet != null) {\r
+            applet.stop();\r
+        } else {\r
+            System.exit(0);\r
+        }\r
+\r
+        frame.setVisible(false);\r
     }\r
 \r
-    l.setLevel(Level.toLevel(Cache.getProperty("logs.Axis.Level")));\r
-    ConsoleAppender ap = new ConsoleAppender(new SimpleLayout(),"System.err");\r
-    ap.setName("Axis");\r
-    l.addAppender(ap);\r
-  }\r
-   public static void main(String[] args) {\r
-\r
-    Cache.loadProperties();\r
-    jalview.gui.Preferences.initPreferences();\r
-    try {\r
-      initLogger();\r
-    } catch (Exception e) {\r
-      System.err.println("Problems initializing the log4j system\n");\r
-      e.printStackTrace();\r
+    private static void initLogger() {\r
+        Logger l = Logger.getLogger("org.apache.axis");\r
+\r
+        if (Cache.getProperty("logs.Axis.Level") == null) {\r
+            Cache.setProperty("logs.Axis.Level", Level.INFO.toString());\r
+        }\r
+\r
+        l.setLevel(Level.toLevel(Cache.getProperty("logs.Axis.Level")));\r
+\r
+        ConsoleAppender ap = new ConsoleAppender(new SimpleLayout(),\r
+                "System.err");\r
+        ap.setName("Axis");\r
+        l.addAppender(ap);\r
     }\r
-    try{\r
-       UIManager.setLookAndFeel(\r
-   //   "javax.swing.plaf.metal.MetalLookAndFeel"\r
-    //  "javax.swing.plaf.multi.MultiLookAndFeel"\r
-         UIManager.getSystemLookAndFeelClassName()\r
-     //    UIManager.getCrossPlatformLookAndFeelClassName()\r
-       // "com.sun.java.swing.plaf.gtk.GTKLookAndFeel"\r
-       //   "com.sun.java.swing.plaf.windows.WindowsLookAndFeel"\r
-       //  "com.sun.java.swing.plaf.motif.MotifLookAndFeel"\r
-     );\r
-     }\r
-     catch (Exception ex)\r
-     {}\r
-\r
-     Desktop frame = new Desktop();\r
-     frame.setResizable(true);\r
-     frame.setVisible(true);\r
-\r
-\r
-\r
-     if(args!=null && args.length>0)\r
-     {\r
-         String file=null;\r
-         if(args[0].equals("-open"))\r
-           file = args[1];\r
-         else\r
-           file = args[0];\r
-\r
-         String protocol = "File";\r
-         if(file.indexOf("http:")>-1)\r
-           protocol = "URL";\r
-\r
-         String format = jalview.io.IdentifyFile.Identify(file, protocol);\r
-\r
-         frame.LoadFile(file, protocol, format);\r
-     }\r
-\r
-     if(jalview.gui.Preferences.showStartupFile &&\r
-         jalview.gui.Preferences.startupFile!=null)\r
-     {\r
-       String file = jalview.gui.Preferences.startupFile;\r
-       String protocol = "File";\r
-       if (file.indexOf("http:") > -1)\r
-         protocol = "URL";\r
-\r
-       if(file.endsWith(".jar"))\r
-         Jalview2XML.LoadJalviewAlign(file);\r
-       else\r
-       {\r
-         String format = jalview.io.IdentifyFile.Identify(file, protocol);\r
-         frame.LoadFile(file, protocol, format);\r
-       }\r
-     }\r
-\r
-\r
-\r
-   }\r
 \r
+    public static void main(String[] args) {\r
+        Cache.loadProperties();\r
+        jalview.gui.Preferences.initPreferences();\r
+\r
+        try {\r
+            initLogger();\r
+        } catch (Exception e) {\r
+            System.err.println("Problems initializing the log4j system\n");\r
+            e.printStackTrace();\r
+        }\r
+\r
+        try {\r
+            UIManager.setLookAndFeel(\r
+            //   "javax.swing.plaf.metal.MetalLookAndFeel"\r
+            //  "javax.swing.plaf.multi.MultiLookAndFeel"\r
+            UIManager.getSystemLookAndFeelClassName());\r
+        } catch (Exception ex) {\r
+        }\r
+\r
+        Desktop frame = new Desktop();\r
+        frame.setResizable(true);\r
+        frame.setVisible(true);\r
+\r
+        if ((args != null) && (args.length > 0)) {\r
+            String file = null;\r
+\r
+            if (args[0].equals("-open")) {\r
+                file = args[1];\r
+            } else {\r
+                file = args[0];\r
+            }\r
+\r
+            String protocol = "File";\r
+\r
+            if (file.indexOf("http:") > -1) {\r
+                protocol = "URL";\r
+            }\r
+\r
+            String format = jalview.io.IdentifyFile.Identify(file, protocol);\r
+\r
+            frame.LoadFile(file, protocol, format);\r
+        }\r
+\r
+        if (jalview.gui.Preferences.showStartupFile &&\r
+                (jalview.gui.Preferences.startupFile != null)) {\r
+            String file = jalview.gui.Preferences.startupFile;\r
+            String protocol = "File";\r
+\r
+            if (file.indexOf("http:") > -1) {\r
+                protocol = "URL";\r
+            }\r
+\r
+            if (file.endsWith(".jar")) {\r
+                Jalview2XML.LoadJalviewAlign(file);\r
+            } else {\r
+                String format = jalview.io.IdentifyFile.Identify(file, protocol);\r
+                frame.LoadFile(file, protocol, format);\r
+            }\r
+        }\r
+    }\r
 }\r
-\r
index bd5abb0..35ebecc 100755 (executable)
 * 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.bin;\r
 \r
+import jalview.appletgui.AlignFrame;\r
+\r
+import jalview.datamodel.*;\r
+\r
+import jalview.io.*;\r
+\r
 import java.applet.*;\r
+\r
 import java.awt.*;\r
 import java.awt.event.*;\r
-import jalview.datamodel.*;\r
-import jalview.io.*;\r
-import jalview.appletgui.AlignFrame;\r
 \r
-public class JalviewLite extends Applet\r
-{\r
-  static int lastFrameX = 200;\r
-  static int lastFrameY = 200;\r
-  static Applet applet;\r
-  boolean fileFound = true;\r
-  String file = "No file";\r
-  Button launcher = new Button("Start Jalview");\r
-\r
-  public void init()\r
-  {\r
-    applet = this;\r
-    this.setBackground(Color.white);\r
-\r
-    file = getParameter("file");\r
-    if (file != null)\r
-    {\r
-      add(launcher);\r
-      file = applet.getCodeBase() + file;\r
-      launcher.addActionListener(new java.awt.event.ActionListener()\r
-     {\r
-       public void actionPerformed(ActionEvent e)\r
-       {\r
-         String format = jalview.io.IdentifyFile.Identify( file, "URL");\r
-         LoadFile(file, "URL", format);\r
-       }\r
-     });\r
+\r
+public class JalviewLite extends Applet {\r
+    static int lastFrameX = 200;\r
+    static int lastFrameY = 200;\r
+    static Applet applet;\r
+    boolean fileFound = true;\r
+    String file = "No file";\r
+    Button launcher = new Button("Start Jalview");\r
+\r
+    public void init() {\r
+        applet = this;\r
+        this.setBackground(Color.white);\r
+\r
+        file = getParameter("file");\r
+\r
+        if (file != null) {\r
+            add(launcher);\r
+            file = applet.getCodeBase() + file;\r
+            launcher.addActionListener(new java.awt.event.ActionListener() {\r
+                    public void actionPerformed(ActionEvent e) {\r
+                        String format = jalview.io.IdentifyFile.Identify(file,\r
+                                "URL");\r
+                        LoadFile(file, "URL", format);\r
+                    }\r
+                });\r
+        } else {\r
+            file = "NO FILE";\r
+            fileFound = false;\r
+        }\r
+    }\r
+\r
+    public static void showURL(String url) {\r
+        try {\r
+            applet.getAppletContext().showDocument(new java.net.URL(url),\r
+                "HELP_WINDOW");\r
+        } catch (Exception ex) {\r
+        }\r
     }\r
-     else\r
-     {\r
-       file = "NO FILE";\r
-       fileFound = false;\r
-     }\r
-   }\r
-\r
-\r
-   public static void showURL(String url)\r
-   {\r
-     try{\r
-       applet.getAppletContext().showDocument(new java.net.URL(url), "HELP_WINDOW");\r
-     }catch(Exception ex){}\r
-   }\r
-\r
-   public void LoadFile(String file, String protocol,  String format)\r
-   {\r
-     LoadingThread loader = new LoadingThread(file, protocol, format, this);\r
-     loader.start();\r
-   }\r
-\r
-   public static void addFrame(final Frame frame, String title, int width, int height)\r
-   {\r
-     frame.setLocation(lastFrameX,lastFrameY);\r
-     lastFrameX+=40; lastFrameY+=40;\r
-     frame.setSize(width,height);\r
-     frame.setTitle(title);\r
-     frame.addWindowListener(new WindowAdapter()\r
-    {\r
-      public void windowClosing(WindowEvent e)\r
-      {\r
-        frame.dispose();\r
-      }\r
-    });\r
-    frame.setVisible(true);\r
-   }\r
-\r
-\r
-   public void paint(Graphics g)\r
-   {\r
-     if(!fileFound)\r
-     {\r
-       g.setColor(new Color(200,200,200));\r
-       g.setColor(Color.cyan);\r
-       g.fillRect(0,0,getSize().width, getSize().height);\r
-       g.setColor(Color.red);\r
-       g.drawString("Jalview can't open file", 5, 15);\r
-       g.drawString("\""+ file+"\"", 5, 30);\r
-     }\r
-   }\r
-\r
-   class LoadingThread extends Thread\r
-   {\r
-     String file, protocol, format;\r
-     JalviewLite jlapplet;\r
-\r
-     public LoadingThread(String file, String protocol,  String format, JalviewLite applet)\r
-     {\r
-       this.file = file;\r
-       this.protocol = protocol;\r
-       this.format = format;\r
-       this.jlapplet = applet;\r
-     }\r
-     public void run()\r
-     {\r
-       SequenceI [] sequences = null;\r
-       sequences = FormatAdapter.readFile(file, protocol, format);\r
-\r
-       if (sequences != null && sequences.length>0)\r
-       {\r
-         AlignFrame af = new AlignFrame(new Alignment(sequences), jlapplet );\r
-         addFrame(af, file, AlignFrame.NEW_WINDOW_WIDTH, AlignFrame.NEW_WINDOW_HEIGHT);\r
-         af.statusBar.setText("Successfully loaded file " + file);\r
-       }\r
-       else\r
-       {\r
-         fileFound = false;\r
-         remove(launcher);\r
-         repaint();\r
-       }\r
-     }\r
-   }\r
-}\r
 \r
+    public void LoadFile(String file, String protocol, String format) {\r
+        LoadingThread loader = new LoadingThread(file, protocol, format, this);\r
+        loader.start();\r
+    }\r
 \r
+    public static void addFrame(final Frame frame, String title, int width,\r
+        int height) {\r
+        frame.setLocation(lastFrameX, lastFrameY);\r
+        lastFrameX += 40;\r
+        lastFrameY += 40;\r
+        frame.setSize(width, height);\r
+        frame.setTitle(title);\r
+        frame.addWindowListener(new WindowAdapter() {\r
+                public void windowClosing(WindowEvent e) {\r
+                    frame.dispose();\r
+                }\r
+            });\r
+        frame.setVisible(true);\r
+    }\r
+\r
+    public void paint(Graphics g) {\r
+        if (!fileFound) {\r
+            g.setColor(new Color(200, 200, 200));\r
+            g.setColor(Color.cyan);\r
+            g.fillRect(0, 0, getSize().width, getSize().height);\r
+            g.setColor(Color.red);\r
+            g.drawString("Jalview can't open file", 5, 15);\r
+            g.drawString("\"" + file + "\"", 5, 30);\r
+        }\r
+    }\r
+\r
+    class LoadingThread extends Thread {\r
+        String file;\r
+        String protocol;\r
+        String format;\r
+        JalviewLite jlapplet;\r
+\r
+        public LoadingThread(String file, String protocol, String format,\r
+            JalviewLite applet) {\r
+            this.file = file;\r
+            this.protocol = protocol;\r
+            this.format = format;\r
+            this.jlapplet = applet;\r
+        }\r
+\r
+        public void run() {\r
+            SequenceI[] sequences = null;\r
+            sequences = FormatAdapter.readFile(file, protocol, format);\r
+\r
+            if ((sequences != null) && (sequences.length > 0)) {\r
+                AlignFrame af = new AlignFrame(new Alignment(sequences),\r
+                        jlapplet);\r
+                addFrame(af, file, AlignFrame.NEW_WINDOW_WIDTH,\r
+                    AlignFrame.NEW_WINDOW_HEIGHT);\r
+                af.statusBar.setText("Successfully loaded file " + file);\r
+            } else {\r
+                fileFound = false;\r
+                remove(launcher);\r
+                repaint();\r
+            }\r
+        }\r
+    }\r
+}\r
index 644cd03..093ae6f 100755 (executable)
@@ -4,7 +4,6 @@
  * Schema.\r
  * $Id$\r
  */\r
-\r
 /*\r
 * Jalview - A Sequence Alignment Editor and Viewer\r
 * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\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.binding;\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
+\r
 import org.xml.sax.ContentHandler;\r
 \r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
+//---------------------------------/\r
+import java.io.IOException;\r
+import java.io.Reader;\r
+import java.io.Serializable;\r
+import java.io.Writer;\r
+\r
+\r
 /**\r
  * Class Alignment.\r
  *\r
  * @version $Revision$ $Date$\r
  */\r
 public class Alignment implements java.io.Serializable {\r
-\r
-\r
-      //--------------------------/\r
-     //- Class/Member Variables -/\r
+    //--------------------------/\r
+    //- Class/Member Variables -/\r
     //--------------------------/\r
 \r
     /**\r
@@ -62,30 +60,19 @@ public class Alignment implements java.io.Serializable {
      */\r
     private jalview.binding.SequenceSet _sequenceSet;\r
 \r
-\r
-      //----------------/\r
-     //- Constructors -/\r
     //----------------/\r
-\r
+    //- Constructors -/\r
+    //----------------/\r
     public Alignment() {\r
         super();\r
-    } //-- jalview.binding.Alignment()\r
-\r
-\r
-      //-----------/\r
-     //- Methods -/\r
-    //-----------/\r
+    }\r
+     //-- jalview.binding.Alignment()\r
+ //-----------/\r
 \r
-    /**\r
-     * Returns the value of field 'annotation'.\r
-     *\r
-     * @return Annotation\r
-     * @return the value of field 'annotation'.\r
-     */\r
-    public jalview.binding.Annotation getAnnotation()\r
-    {\r
+    public jalview.binding.Annotation getAnnotation() {\r
         return this._annotation;\r
-    } //-- jalview.binding.Annotation getAnnotation()\r
+    }\r
+     //-- jalview.binding.Annotation getAnnotation()\r
 \r
     /**\r
      * Returns the value of field 'sequenceSet'.\r
@@ -93,10 +80,10 @@ public class Alignment implements java.io.Serializable {
      * @return SequenceSet\r
      * @return the value of field 'sequenceSet'.\r
      */\r
-    public jalview.binding.SequenceSet getSequenceSet()\r
-    {\r
+    public jalview.binding.SequenceSet getSequenceSet() {\r
         return this._sequenceSet;\r
-    } //-- jalview.binding.SequenceSet getSequenceSet()\r
+    }\r
+     //-- jalview.binding.SequenceSet getSequenceSet()\r
 \r
     /**\r
      * Method isValid\r
@@ -105,16 +92,16 @@ public class Alignment implements java.io.Serializable {
      *\r
      * @return boolean\r
      */\r
-    public boolean isValid()\r
-    {\r
+    public boolean isValid() {\r
         try {\r
             validate();\r
-        }\r
-        catch (org.exolab.castor.xml.ValidationException vex) {\r
+        } catch (org.exolab.castor.xml.ValidationException vex) {\r
             return false;\r
         }\r
+\r
         return true;\r
-    } //-- boolean isValid()\r
+    }\r
+     //-- boolean isValid()\r
 \r
     /**\r
      * Method marshal\r
@@ -124,11 +111,11 @@ public class Alignment implements java.io.Serializable {
      * @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
+        throws org.exolab.castor.xml.MarshalException, \r
+            org.exolab.castor.xml.ValidationException {\r
         Marshaller.marshal(this, out);\r
-    } //-- void marshal(java.io.Writer)\r
+    }\r
+     //-- void marshal(java.io.Writer)\r
 \r
     /**\r
      * Method marshal\r
@@ -138,31 +125,31 @@ public class Alignment implements java.io.Serializable {
      * @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
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, \r
+            org.exolab.castor.xml.ValidationException {\r
         Marshaller.marshal(this, handler);\r
-    } //-- void marshal(org.xml.sax.ContentHandler)\r
+    }\r
+     //-- void marshal(org.xml.sax.ContentHandler)\r
 \r
     /**\r
      * Sets the value of field 'annotation'.\r
      *\r
      * @param annotation the value of field 'annotation'.\r
      */\r
-    public void setAnnotation(jalview.binding.Annotation annotation)\r
-    {\r
+    public void setAnnotation(jalview.binding.Annotation annotation) {\r
         this._annotation = annotation;\r
-    } //-- void setAnnotation(jalview.binding.Annotation)\r
+    }\r
+     //-- void setAnnotation(jalview.binding.Annotation)\r
 \r
     /**\r
      * Sets the value of field 'sequenceSet'.\r
      *\r
      * @param sequenceSet the value of field 'sequenceSet'.\r
      */\r
-    public void setSequenceSet(jalview.binding.SequenceSet sequenceSet)\r
-    {\r
+    public void setSequenceSet(jalview.binding.SequenceSet sequenceSet) {\r
         this._sequenceSet = sequenceSet;\r
-    } //-- void setSequenceSet(jalview.binding.SequenceSet)\r
+    }\r
+     //-- void setSequenceSet(jalview.binding.SequenceSet)\r
 \r
     /**\r
      * Method unmarshal\r
@@ -173,20 +160,20 @@ public class Alignment implements java.io.Serializable {
      * @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.binding.Alignment) Unmarshaller.unmarshal(jalview.binding.Alignment.class, reader);\r
-    } //-- java.lang.Object unmarshal(java.io.Reader)\r
+        throws org.exolab.castor.xml.MarshalException, \r
+            org.exolab.castor.xml.ValidationException {\r
+        return (jalview.binding.Alignment) Unmarshaller.unmarshal(jalview.binding.Alignment.class,\r
+            reader);\r
+    }\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
+    public void validate() throws org.exolab.castor.xml.ValidationException {\r
         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
         validator.validate(this);\r
-    } //-- void validate()\r
-\r
+    }\r
+     //-- void validate()\r
 }\r
index 4af694f..6879c96 100755 (executable)
@@ -4,7 +4,6 @@
  * Schema.\r
  * $Id$\r
  */\r
-\r
 /*\r
 * Jalview - A Sequence Alignment Editor and Viewer\r
 * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\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.binding;\r
 \r
-  //---------------------------------/\r
- //- Imported classes and packages -/\r
-//---------------------------------/\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
+\r
+import org.xml.sax.ContentHandler;\r
 \r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
+//---------------------------------/\r
 import java.io.IOException;\r
 import java.io.Reader;\r
 import java.io.Serializable;\r
 import java.io.Writer;\r
+\r
 import java.util.Enumeration;\r
 import java.util.Vector;\r
-import org.exolab.castor.xml.MarshalException;\r
-import org.exolab.castor.xml.Marshaller;\r
-import org.exolab.castor.xml.Unmarshaller;\r
-import org.exolab.castor.xml.ValidationException;\r
-import org.xml.sax.ContentHandler;\r
+\r
 \r
 /**\r
  * Class Annotation.\r
@@ -48,10 +49,8 @@ import org.xml.sax.ContentHandler;
  * @version $Revision$ $Date$\r
  */\r
 public class Annotation implements java.io.Serializable {\r
-\r
-\r
-      //--------------------------/\r
-     //- Class/Member Variables -/\r
+    //--------------------------/\r
+    //- Class/Member Variables -/\r
     //--------------------------/\r
 \r
     /**\r
@@ -79,33 +78,22 @@ public class Annotation implements java.io.Serializable {
      */\r
     private java.lang.String _description;\r
 \r
-\r
-      //----------------/\r
-     //- Constructors -/\r
     //----------------/\r
-\r
+    //- Constructors -/\r
+    //----------------/\r
     public Annotation() {\r
         super();\r
         _annotationElementList = new Vector();\r
-    } //-- jalview.binding.Annotation()\r
-\r
+    }\r
+     //-- jalview.binding.Annotation()\r
+ //-----------/\r
 \r
-      //-----------/\r
-     //- Methods -/\r
-    //-----------/\r
-\r
-    /**\r
-     * Method addAnnotationElement\r
-     *\r
-     *\r
-     *\r
-     * @param vAnnotationElement\r
-     */\r
-    public void addAnnotationElement(jalview.binding.AnnotationElement vAnnotationElement)\r
-        throws java.lang.IndexOutOfBoundsException\r
-    {\r
+    public void addAnnotationElement(\r
+        jalview.binding.AnnotationElement vAnnotationElement)\r
+        throws java.lang.IndexOutOfBoundsException {\r
         _annotationElementList.addElement(vAnnotationElement);\r
-    } //-- void addAnnotationElement(jalview.binding.AnnotationElement)\r
+    }\r
+     //-- void addAnnotationElement(jalview.binding.AnnotationElement)\r
 \r
     /**\r
      * Method addAnnotationElement\r
@@ -115,20 +103,21 @@ public class Annotation implements java.io.Serializable {
      * @param index\r
      * @param vAnnotationElement\r
      */\r
-    public void addAnnotationElement(int index, jalview.binding.AnnotationElement vAnnotationElement)\r
-        throws java.lang.IndexOutOfBoundsException\r
-    {\r
+    public void addAnnotationElement(int index,\r
+        jalview.binding.AnnotationElement vAnnotationElement)\r
+        throws java.lang.IndexOutOfBoundsException {\r
         _annotationElementList.insertElementAt(vAnnotationElement, index);\r
-    } //-- void addAnnotationElement(int, jalview.binding.AnnotationElement)\r
+    }\r
+     //-- void addAnnotationElement(int, jalview.binding.AnnotationElement)\r
 \r
     /**\r
      * Method deleteGraph\r
      *\r
      */\r
-    public void deleteGraph()\r
-    {\r
-        this._has_graph= false;\r
-    } //-- void deleteGraph()\r
+    public void deleteGraph() {\r
+        this._has_graph = false;\r
+    }\r
+     //-- void deleteGraph()\r
 \r
     /**\r
      * Method enumerateAnnotationElement\r
@@ -137,10 +126,10 @@ public class Annotation implements java.io.Serializable {
      *\r
      * @return Enumeration\r
      */\r
-    public java.util.Enumeration enumerateAnnotationElement()\r
-    {\r
+    public java.util.Enumeration enumerateAnnotationElement() {\r
         return _annotationElementList.elements();\r
-    } //-- java.util.Enumeration enumerateAnnotationElement()\r
+    }\r
+     //-- java.util.Enumeration enumerateAnnotationElement()\r
 \r
     /**\r
      * Method getAnnotationElement\r
@@ -151,15 +140,15 @@ public class Annotation implements java.io.Serializable {
      * @return AnnotationElement\r
      */\r
     public jalview.binding.AnnotationElement getAnnotationElement(int index)\r
-        throws java.lang.IndexOutOfBoundsException\r
-    {\r
+        throws java.lang.IndexOutOfBoundsException {\r
         //-- check bounds for index\r
         if ((index < 0) || (index > _annotationElementList.size())) {\r
             throw new IndexOutOfBoundsException();\r
         }\r
 \r
         return (jalview.binding.AnnotationElement) _annotationElementList.elementAt(index);\r
-    } //-- jalview.binding.AnnotationElement getAnnotationElement(int)\r
+    }\r
+     //-- jalview.binding.AnnotationElement getAnnotationElement(int)\r
 \r
     /**\r
      * Method getAnnotationElement\r
@@ -168,15 +157,17 @@ public class Annotation implements java.io.Serializable {
      *\r
      * @return AnnotationElement\r
      */\r
-    public jalview.binding.AnnotationElement[] getAnnotationElement()\r
-    {\r
+    public jalview.binding.AnnotationElement[] getAnnotationElement() {\r
         int size = _annotationElementList.size();\r
         jalview.binding.AnnotationElement[] mArray = new jalview.binding.AnnotationElement[size];\r
+\r
         for (int index = 0; index < size; index++) {\r
             mArray[index] = (jalview.binding.AnnotationElement) _annotationElementList.elementAt(index);\r
         }\r
+\r
         return mArray;\r
-    } //-- jalview.binding.AnnotationElement[] getAnnotationElement()\r
+    }\r
+     //-- jalview.binding.AnnotationElement[] getAnnotationElement()\r
 \r
     /**\r
      * Method getAnnotationElementCount\r
@@ -185,10 +176,10 @@ public class Annotation implements java.io.Serializable {
      *\r
      * @return int\r
      */\r
-    public int getAnnotationElementCount()\r
-    {\r
+    public int getAnnotationElementCount() {\r
         return _annotationElementList.size();\r
-    } //-- int getAnnotationElementCount()\r
+    }\r
+     //-- int getAnnotationElementCount()\r
 \r
     /**\r
      * Returns the value of field 'description'.\r
@@ -196,10 +187,10 @@ public class Annotation implements java.io.Serializable {
      * @return String\r
      * @return the value of field 'description'.\r
      */\r
-    public java.lang.String getDescription()\r
-    {\r
+    public java.lang.String getDescription() {\r
         return this._description;\r
-    } //-- java.lang.String getDescription()\r
+    }\r
+     //-- java.lang.String getDescription()\r
 \r
     /**\r
      * Returns the value of field 'graph'.\r
@@ -207,10 +198,10 @@ public class Annotation implements java.io.Serializable {
      * @return boolean\r
      * @return the value of field 'graph'.\r
      */\r
-    public boolean getGraph()\r
-    {\r
+    public boolean getGraph() {\r
         return this._graph;\r
-    } //-- boolean getGraph()\r
+    }\r
+     //-- boolean getGraph()\r
 \r
     /**\r
      * Returns the value of field 'label'.\r
@@ -218,10 +209,10 @@ public class Annotation implements java.io.Serializable {
      * @return String\r
      * @return the value of field 'label'.\r
      */\r
-    public java.lang.String getLabel()\r
-    {\r
+    public java.lang.String getLabel() {\r
         return this._label;\r
-    } //-- java.lang.String getLabel()\r
+    }\r
+     //-- java.lang.String getLabel()\r
 \r
     /**\r
      * Method hasGraph\r
@@ -230,10 +221,10 @@ public class Annotation implements java.io.Serializable {
      *\r
      * @return boolean\r
      */\r
-    public boolean hasGraph()\r
-    {\r
+    public boolean hasGraph() {\r
         return this._has_graph;\r
-    } //-- boolean hasGraph()\r
+    }\r
+     //-- boolean hasGraph()\r
 \r
     /**\r
      * Method isValid\r
@@ -242,16 +233,16 @@ public class Annotation implements java.io.Serializable {
      *\r
      * @return boolean\r
      */\r
-    public boolean isValid()\r
-    {\r
+    public boolean isValid() {\r
         try {\r
             validate();\r
-        }\r
-        catch (org.exolab.castor.xml.ValidationException vex) {\r
+        } catch (org.exolab.castor.xml.ValidationException vex) {\r
             return false;\r
         }\r
+\r
         return true;\r
-    } //-- boolean isValid()\r
+    }\r
+     //-- boolean isValid()\r
 \r
     /**\r
      * Method marshal\r
@@ -261,11 +252,11 @@ public class Annotation implements java.io.Serializable {
      * @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
+        throws org.exolab.castor.xml.MarshalException, \r
+            org.exolab.castor.xml.ValidationException {\r
         Marshaller.marshal(this, out);\r
-    } //-- void marshal(java.io.Writer)\r
+    }\r
+     //-- void marshal(java.io.Writer)\r
 \r
     /**\r
      * Method marshal\r
@@ -275,20 +266,20 @@ public class Annotation implements java.io.Serializable {
      * @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
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, \r
+            org.exolab.castor.xml.ValidationException {\r
         Marshaller.marshal(this, handler);\r
-    } //-- void marshal(org.xml.sax.ContentHandler)\r
+    }\r
+     //-- void marshal(org.xml.sax.ContentHandler)\r
 \r
     /**\r
      * Method removeAllAnnotationElement\r
      *\r
      */\r
-    public void removeAllAnnotationElement()\r
-    {\r
+    public void removeAllAnnotationElement() {\r
         _annotationElementList.removeAllElements();\r
-    } //-- void removeAllAnnotationElement()\r
+    }\r
+     //-- void removeAllAnnotationElement()\r
 \r
     /**\r
      * Method removeAnnotationElement\r
@@ -298,12 +289,13 @@ public class Annotation implements java.io.Serializable {
      * @param index\r
      * @return AnnotationElement\r
      */\r
-    public jalview.binding.AnnotationElement removeAnnotationElement(int index)\r
-    {\r
+    public jalview.binding.AnnotationElement removeAnnotationElement(int index) {\r
         java.lang.Object obj = _annotationElementList.elementAt(index);\r
         _annotationElementList.removeElementAt(index);\r
+\r
         return (jalview.binding.AnnotationElement) obj;\r
-    } //-- jalview.binding.AnnotationElement removeAnnotationElement(int)\r
+    }\r
+     //-- jalview.binding.AnnotationElement removeAnnotationElement(int)\r
 \r
     /**\r
      * Method setAnnotationElement\r
@@ -313,15 +305,17 @@ public class Annotation implements java.io.Serializable {
      * @param index\r
      * @param vAnnotationElement\r
      */\r
-    public void setAnnotationElement(int index, jalview.binding.AnnotationElement vAnnotationElement)\r
-        throws java.lang.IndexOutOfBoundsException\r
-    {\r
+    public void setAnnotationElement(int index,\r
+        jalview.binding.AnnotationElement vAnnotationElement)\r
+        throws java.lang.IndexOutOfBoundsException {\r
         //-- check bounds for index\r
         if ((index < 0) || (index > _annotationElementList.size())) {\r
             throw new IndexOutOfBoundsException();\r
         }\r
+\r
         _annotationElementList.setElementAt(vAnnotationElement, index);\r
-    } //-- void setAnnotationElement(int, jalview.binding.AnnotationElement)\r
+    }\r
+     //-- void setAnnotationElement(int, jalview.binding.AnnotationElement)\r
 \r
     /**\r
      * Method setAnnotationElement\r
@@ -330,45 +324,47 @@ public class Annotation implements java.io.Serializable {
      *\r
      * @param annotationElementArray\r
      */\r
-    public void setAnnotationElement(jalview.binding.AnnotationElement[] annotationElementArray)\r
-    {\r
+    public void setAnnotationElement(\r
+        jalview.binding.AnnotationElement[] annotationElementArray) {\r
         //-- copy array\r
         _annotationElementList.removeAllElements();\r
+\r
         for (int i = 0; i < annotationElementArray.length; i++) {\r
             _annotationElementList.addElement(annotationElementArray[i]);\r
         }\r
-    } //-- void setAnnotationElement(jalview.binding.AnnotationElement)\r
+    }\r
+     //-- void setAnnotationElement(jalview.binding.AnnotationElement)\r
 \r
     /**\r
      * Sets the value of field 'description'.\r
      *\r
      * @param description the value of field 'description'.\r
      */\r
-    public void setDescription(java.lang.String description)\r
-    {\r
+    public void setDescription(java.lang.String description) {\r
         this._description = description;\r
-    } //-- void setDescription(java.lang.String)\r
+    }\r
+     //-- void setDescription(java.lang.String)\r
 \r
     /**\r
      * Sets the value of field 'graph'.\r
      *\r
      * @param graph the value of field 'graph'.\r
      */\r
-    public void setGraph(boolean graph)\r
-    {\r
+    public void setGraph(boolean graph) {\r
         this._graph = graph;\r
         this._has_graph = true;\r
-    } //-- void setGraph(boolean)\r
+    }\r
+     //-- void setGraph(boolean)\r
 \r
     /**\r
      * Sets the value of field 'label'.\r
      *\r
      * @param label the value of field 'label'.\r
      */\r
-    public void setLabel(java.lang.String label)\r
-    {\r
+    public void setLabel(java.lang.String label) {\r
         this._label = label;\r
-    } //-- void setLabel(java.lang.String)\r
+    }\r
+     //-- void setLabel(java.lang.String)\r
 \r
     /**\r
      * Method unmarshal\r
@@ -379,20 +375,20 @@ public class Annotation implements java.io.Serializable {
      * @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.binding.Annotation) Unmarshaller.unmarshal(jalview.binding.Annotation.class, reader);\r
-    } //-- java.lang.Object unmarshal(java.io.Reader)\r
+        throws org.exolab.castor.xml.MarshalException, \r
+            org.exolab.castor.xml.ValidationException {\r
+        return (jalview.binding.Annotation) Unmarshaller.unmarshal(jalview.binding.Annotation.class,\r
+            reader);\r
+    }\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
+    public void validate() throws org.exolab.castor.xml.ValidationException {\r
         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
         validator.validate(this);\r
-    } //-- void validate()\r
-\r
+    }\r
+     //-- void validate()\r
 }\r
index 211810d..3c6eba4 100755 (executable)
@@ -4,7 +4,6 @@
  * Schema.\r
  * $Id$\r
  */\r
-\r
 /*\r
 * Jalview - A Sequence Alignment Editor and Viewer\r
 * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\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.binding;\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
+\r
 import org.xml.sax.ContentHandler;\r
 \r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
+//---------------------------------/\r
+import java.io.IOException;\r
+import java.io.Reader;\r
+import java.io.Serializable;\r
+import java.io.Writer;\r
+\r
+\r
 /**\r
  * Class AnnotationElement.\r
  *\r
  * @version $Revision$ $Date$\r
  */\r
 public class AnnotationElement implements java.io.Serializable {\r
-\r
-\r
-      //--------------------------/\r
-     //- Class/Member Variables -/\r
+    //--------------------------/\r
+    //- Class/Member Variables -/\r
     //--------------------------/\r
 \r
     /**\r
@@ -87,37 +85,28 @@ public class AnnotationElement implements java.io.Serializable {
      */\r
     private boolean _has_value;\r
 \r
-\r
-      //----------------/\r
-     //- Constructors -/\r
     //----------------/\r
-\r
+    //- Constructors -/\r
+    //----------------/\r
     public AnnotationElement() {\r
         super();\r
-    } //-- jalview.binding.AnnotationElement()\r
-\r
-\r
-      //-----------/\r
-     //- Methods -/\r
-    //-----------/\r
+    }\r
+     //-- jalview.binding.AnnotationElement()\r
+ //-----------/\r
 \r
-    /**\r
-     * Method deletePosition\r
-     *\r
-     */\r
-    public void deletePosition()\r
-    {\r
-        this._has_position= false;\r
-    } //-- void deletePosition()\r
+    public void deletePosition() {\r
+        this._has_position = false;\r
+    }\r
+     //-- void deletePosition()\r
 \r
     /**\r
      * Method deleteValue\r
      *\r
      */\r
-    public void deleteValue()\r
-    {\r
-        this._has_value= false;\r
-    } //-- void deleteValue()\r
+    public void deleteValue() {\r
+        this._has_value = false;\r
+    }\r
+     //-- void deleteValue()\r
 \r
     /**\r
      * Returns the value of field 'description'.\r
@@ -125,10 +114,10 @@ public class AnnotationElement implements java.io.Serializable {
      * @return String\r
      * @return the value of field 'description'.\r
      */\r
-    public java.lang.String getDescription()\r
-    {\r
+    public java.lang.String getDescription() {\r
         return this._description;\r
-    } //-- java.lang.String getDescription()\r
+    }\r
+     //-- java.lang.String getDescription()\r
 \r
     /**\r
      * Returns the value of field 'displayCharacter'.\r
@@ -136,10 +125,10 @@ public class AnnotationElement implements java.io.Serializable {
      * @return String\r
      * @return the value of field 'displayCharacter'.\r
      */\r
-    public java.lang.String getDisplayCharacter()\r
-    {\r
+    public java.lang.String getDisplayCharacter() {\r
         return this._displayCharacter;\r
-    } //-- java.lang.String getDisplayCharacter()\r
+    }\r
+     //-- java.lang.String getDisplayCharacter()\r
 \r
     /**\r
      * Returns the value of field 'position'.\r
@@ -147,10 +136,10 @@ public class AnnotationElement implements java.io.Serializable {
      * @return int\r
      * @return the value of field 'position'.\r
      */\r
-    public int getPosition()\r
-    {\r
+    public int getPosition() {\r
         return this._position;\r
-    } //-- int getPosition()\r
+    }\r
+     //-- int getPosition()\r
 \r
     /**\r
      * Returns the value of field 'secondaryStructure'.\r
@@ -158,10 +147,10 @@ public class AnnotationElement implements java.io.Serializable {
      * @return String\r
      * @return the value of field 'secondaryStructure'.\r
      */\r
-    public java.lang.String getSecondaryStructure()\r
-    {\r
+    public java.lang.String getSecondaryStructure() {\r
         return this._secondaryStructure;\r
-    } //-- java.lang.String getSecondaryStructure()\r
+    }\r
+     //-- java.lang.String getSecondaryStructure()\r
 \r
     /**\r
      * Returns the value of field 'value'.\r
@@ -169,10 +158,10 @@ public class AnnotationElement implements java.io.Serializable {
      * @return float\r
      * @return the value of field 'value'.\r
      */\r
-    public float getValue()\r
-    {\r
+    public float getValue() {\r
         return this._value;\r
-    } //-- float getValue()\r
+    }\r
+     //-- float getValue()\r
 \r
     /**\r
      * Method hasPosition\r
@@ -181,10 +170,10 @@ public class AnnotationElement implements java.io.Serializable {
      *\r
      * @return boolean\r
      */\r
-    public boolean hasPosition()\r
-    {\r
+    public boolean hasPosition() {\r
         return this._has_position;\r
-    } //-- boolean hasPosition()\r
+    }\r
+     //-- boolean hasPosition()\r
 \r
     /**\r
      * Method hasValue\r
@@ -193,10 +182,10 @@ public class AnnotationElement implements java.io.Serializable {
      *\r
      * @return boolean\r
      */\r
-    public boolean hasValue()\r
-    {\r
+    public boolean hasValue() {\r
         return this._has_value;\r
-    } //-- boolean hasValue()\r
+    }\r
+     //-- boolean hasValue()\r
 \r
     /**\r
      * Method isValid\r
@@ -205,16 +194,16 @@ public class AnnotationElement implements java.io.Serializable {
      *\r
      * @return boolean\r
      */\r
-    public boolean isValid()\r
-    {\r
+    public boolean isValid() {\r
         try {\r
             validate();\r
-        }\r
-        catch (org.exolab.castor.xml.ValidationException vex) {\r
+        } catch (org.exolab.castor.xml.ValidationException vex) {\r
             return false;\r
         }\r
+\r
         return true;\r
-    } //-- boolean isValid()\r
+    }\r
+     //-- boolean isValid()\r
 \r
     /**\r
      * Method marshal\r
@@ -224,11 +213,11 @@ public class AnnotationElement implements java.io.Serializable {
      * @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
+        throws org.exolab.castor.xml.MarshalException, \r
+            org.exolab.castor.xml.ValidationException {\r
         Marshaller.marshal(this, out);\r
-    } //-- void marshal(java.io.Writer)\r
+    }\r
+     //-- void marshal(java.io.Writer)\r
 \r
     /**\r
      * Method marshal\r
@@ -238,42 +227,42 @@ public class AnnotationElement implements java.io.Serializable {
      * @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
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, \r
+            org.exolab.castor.xml.ValidationException {\r
         Marshaller.marshal(this, handler);\r
-    } //-- void marshal(org.xml.sax.ContentHandler)\r
+    }\r
+     //-- void marshal(org.xml.sax.ContentHandler)\r
 \r
     /**\r
      * Sets the value of field 'description'.\r
      *\r
      * @param description the value of field 'description'.\r
      */\r
-    public void setDescription(java.lang.String description)\r
-    {\r
+    public void setDescription(java.lang.String description) {\r
         this._description = description;\r
-    } //-- void setDescription(java.lang.String)\r
+    }\r
+     //-- void setDescription(java.lang.String)\r
 \r
     /**\r
      * Sets the value of field 'displayCharacter'.\r
      *\r
      * @param displayCharacter the value of field 'displayCharacter'\r
      */\r
-    public void setDisplayCharacter(java.lang.String displayCharacter)\r
-    {\r
+    public void setDisplayCharacter(java.lang.String displayCharacter) {\r
         this._displayCharacter = displayCharacter;\r
-    } //-- void setDisplayCharacter(java.lang.String)\r
+    }\r
+     //-- void setDisplayCharacter(java.lang.String)\r
 \r
     /**\r
      * Sets the value of field 'position'.\r
      *\r
      * @param position the value of field 'position'.\r
      */\r
-    public void setPosition(int position)\r
-    {\r
+    public void setPosition(int position) {\r
         this._position = position;\r
         this._has_position = true;\r
-    } //-- void setPosition(int)\r
+    }\r
+     //-- void setPosition(int)\r
 \r
     /**\r
      * Sets the value of field 'secondaryStructure'.\r
@@ -281,21 +270,21 @@ public class AnnotationElement implements java.io.Serializable {
      * @param secondaryStructure the value of field\r
      * 'secondaryStructure'.\r
      */\r
-    public void setSecondaryStructure(java.lang.String secondaryStructure)\r
-    {\r
+    public void setSecondaryStructure(java.lang.String secondaryStructure) {\r
         this._secondaryStructure = secondaryStructure;\r
-    } //-- void setSecondaryStructure(java.lang.String)\r
+    }\r
+     //-- void setSecondaryStructure(java.lang.String)\r
 \r
     /**\r
      * Sets the value of field 'value'.\r
      *\r
      * @param value the value of field 'value'.\r
      */\r
-    public void setValue(float value)\r
-    {\r
+    public void setValue(float value) {\r
         this._value = value;\r
         this._has_value = true;\r
-    } //-- void setValue(float)\r
+    }\r
+     //-- void setValue(float)\r
 \r
     /**\r
      * Method unmarshal\r
@@ -306,20 +295,20 @@ public class AnnotationElement implements java.io.Serializable {
      * @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.binding.AnnotationElement) Unmarshaller.unmarshal(jalview.binding.AnnotationElement.class, reader);\r
-    } //-- java.lang.Object unmarshal(java.io.Reader)\r
+        throws org.exolab.castor.xml.MarshalException, \r
+            org.exolab.castor.xml.ValidationException {\r
+        return (jalview.binding.AnnotationElement) Unmarshaller.unmarshal(jalview.binding.AnnotationElement.class,\r
+            reader);\r
+    }\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
+    public void validate() throws org.exolab.castor.xml.ValidationException {\r
         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
         validator.validate(this);\r
-    } //-- void validate()\r
-\r
+    }\r
+     //-- void validate()\r
 }\r
index 2a3423d..7cd04b3 100755 (executable)
@@ -4,7 +4,6 @@
  * Schema.\r
  * $Id$\r
  */\r
-\r
 /*\r
 * Jalview - A Sequence Alignment Editor and Viewer\r
 * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\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.binding;\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
+\r
 import org.xml.sax.ContentHandler;\r
 \r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
+//---------------------------------/\r
+import java.io.IOException;\r
+import java.io.Reader;\r
+import java.io.Serializable;\r
+import java.io.Writer;\r
+\r
+\r
 /**\r
  * Class Colour.\r
  *\r
  * @version $Revision$ $Date$\r
  */\r
 public class Colour implements java.io.Serializable {\r
-\r
-\r
-      //--------------------------/\r
-     //- Class/Member Variables -/\r
+    //--------------------------/\r
+    //- Class/Member Variables -/\r
     //--------------------------/\r
 \r
     /**\r
@@ -62,30 +60,19 @@ public class Colour implements java.io.Serializable {
      */\r
     private java.lang.String _RGB;\r
 \r
-\r
-      //----------------/\r
-     //- Constructors -/\r
     //----------------/\r
-\r
+    //- Constructors -/\r
+    //----------------/\r
     public Colour() {\r
         super();\r
-    } //-- jalview.binding.Colour()\r
-\r
+    }\r
+     //-- jalview.binding.Colour()\r
+ //-----------/\r
 \r
-      //-----------/\r
-     //- Methods -/\r
-    //-----------/\r
-\r
-    /**\r
-     * Returns the value of field 'name'.\r
-     *\r
-     * @return String\r
-     * @return the value of field 'name'.\r
-     */\r
-    public java.lang.String getName()\r
-    {\r
+    public java.lang.String getName() {\r
         return this._name;\r
-    } //-- java.lang.String getName()\r
+    }\r
+     //-- java.lang.String getName()\r
 \r
     /**\r
      * Returns the value of field 'RGB'.\r
@@ -93,10 +80,10 @@ public class Colour implements java.io.Serializable {
      * @return String\r
      * @return the value of field 'RGB'.\r
      */\r
-    public java.lang.String getRGB()\r
-    {\r
+    public java.lang.String getRGB() {\r
         return this._RGB;\r
-    } //-- java.lang.String getRGB()\r
+    }\r
+     //-- java.lang.String getRGB()\r
 \r
     /**\r
      * Method isValid\r
@@ -105,16 +92,16 @@ public class Colour implements java.io.Serializable {
      *\r
      * @return boolean\r
      */\r
-    public boolean isValid()\r
-    {\r
+    public boolean isValid() {\r
         try {\r
             validate();\r
-        }\r
-        catch (org.exolab.castor.xml.ValidationException vex) {\r
+        } catch (org.exolab.castor.xml.ValidationException vex) {\r
             return false;\r
         }\r
+\r
         return true;\r
-    } //-- boolean isValid()\r
+    }\r
+     //-- boolean isValid()\r
 \r
     /**\r
      * Method marshal\r
@@ -124,11 +111,11 @@ public class Colour implements java.io.Serializable {
      * @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
+        throws org.exolab.castor.xml.MarshalException, \r
+            org.exolab.castor.xml.ValidationException {\r
         Marshaller.marshal(this, out);\r
-    } //-- void marshal(java.io.Writer)\r
+    }\r
+     //-- void marshal(java.io.Writer)\r
 \r
     /**\r
      * Method marshal\r
@@ -138,31 +125,31 @@ public class Colour implements java.io.Serializable {
      * @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
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, \r
+            org.exolab.castor.xml.ValidationException {\r
         Marshaller.marshal(this, handler);\r
-    } //-- void marshal(org.xml.sax.ContentHandler)\r
+    }\r
+     //-- void marshal(org.xml.sax.ContentHandler)\r
 \r
     /**\r
      * Sets the value of field 'name'.\r
      *\r
      * @param name the value of field 'name'.\r
      */\r
-    public void setName(java.lang.String name)\r
-    {\r
+    public void setName(java.lang.String name) {\r
         this._name = name;\r
-    } //-- void setName(java.lang.String)\r
+    }\r
+     //-- void setName(java.lang.String)\r
 \r
     /**\r
      * Sets the value of field 'RGB'.\r
      *\r
      * @param RGB the value of field 'RGB'.\r
      */\r
-    public void setRGB(java.lang.String RGB)\r
-    {\r
+    public void setRGB(java.lang.String RGB) {\r
         this._RGB = RGB;\r
-    } //-- void setRGB(java.lang.String)\r
+    }\r
+     //-- void setRGB(java.lang.String)\r
 \r
     /**\r
      * Method unmarshal\r
@@ -173,20 +160,20 @@ public class Colour implements java.io.Serializable {
      * @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.binding.Colour) Unmarshaller.unmarshal(jalview.binding.Colour.class, reader);\r
-    } //-- java.lang.Object unmarshal(java.io.Reader)\r
+        throws org.exolab.castor.xml.MarshalException, \r
+            org.exolab.castor.xml.ValidationException {\r
+        return (jalview.binding.Colour) Unmarshaller.unmarshal(jalview.binding.Colour.class,\r
+            reader);\r
+    }\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
+    public void validate() throws org.exolab.castor.xml.ValidationException {\r
         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
         validator.validate(this);\r
-    } //-- void validate()\r
-\r
+    }\r
+     //-- void validate()\r
 }\r
index eef4a28..3b5c0b8 100755 (executable)
@@ -4,7 +4,6 @@
  * Schema.\r
  * $Id$\r
  */\r
-\r
 /*\r
 * Jalview - A Sequence Alignment Editor and Viewer\r
 * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\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.binding;\r
 \r
-  //---------------------------------/\r
- //- Imported classes and packages -/\r
-//---------------------------------/\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
+\r
+import org.xml.sax.ContentHandler;\r
 \r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
+//---------------------------------/\r
 import java.io.IOException;\r
 import java.io.Reader;\r
 import java.io.Serializable;\r
 import java.io.Writer;\r
+\r
 import java.util.Enumeration;\r
 import java.util.Vector;\r
-import org.exolab.castor.xml.MarshalException;\r
-import org.exolab.castor.xml.Marshaller;\r
-import org.exolab.castor.xml.Unmarshaller;\r
-import org.exolab.castor.xml.ValidationException;\r
-import org.xml.sax.ContentHandler;\r
+\r
 \r
 /**\r
  * Class JGroup.\r
@@ -48,10 +49,8 @@ import org.xml.sax.ContentHandler;
  * @version $Revision$ $Date$\r
  */\r
 public class JGroup implements java.io.Serializable {\r
-\r
-\r
-      //--------------------------/\r
-     //- Class/Member Variables -/\r
+    //--------------------------/\r
+    //- Class/Member Variables -/\r
     //--------------------------/\r
 \r
     /**\r
@@ -149,33 +148,20 @@ public class JGroup implements java.io.Serializable {
      */\r
     private java.util.Vector _seqList;\r
 \r
-\r
-      //----------------/\r
-     //- Constructors -/\r
     //----------------/\r
-\r
+    //- Constructors -/\r
+    //----------------/\r
     public JGroup() {\r
         super();\r
         _seqList = new Vector();\r
-    } //-- jalview.binding.JGroup()\r
-\r
+    }\r
+     //-- jalview.binding.JGroup()\r
+ //-----------/\r
 \r
-      //-----------/\r
-     //- Methods -/\r
-    //-----------/\r
-\r
-    /**\r
-     * Method addSeq\r
-     *\r
-     *\r
-     *\r
-     * @param vSeq\r
-     */\r
-    public void addSeq(int vSeq)\r
-        throws java.lang.IndexOutOfBoundsException\r
-    {\r
+    public void addSeq(int vSeq) throws java.lang.IndexOutOfBoundsException {\r
         _seqList.addElement(new java.lang.Integer(vSeq));\r
-    } //-- void addSeq(int)\r
+    }\r
+     //-- void addSeq(int)\r
 \r
     /**\r
      * Method addSeq\r
@@ -186,82 +172,82 @@ public class JGroup implements java.io.Serializable {
      * @param vSeq\r
      */\r
     public void addSeq(int index, int vSeq)\r
-        throws java.lang.IndexOutOfBoundsException\r
-    {\r
+        throws java.lang.IndexOutOfBoundsException {\r
         _seqList.insertElementAt(new java.lang.Integer(vSeq), index);\r
-    } //-- void addSeq(int, int)\r
+    }\r
+     //-- void addSeq(int, int)\r
 \r
     /**\r
      * Method deleteColourText\r
      *\r
      */\r
-    public void deleteColourText()\r
-    {\r
-        this._has_colourText= false;\r
-    } //-- void deleteColourText()\r
+    public void deleteColourText() {\r
+        this._has_colourText = false;\r
+    }\r
+     //-- void deleteColourText()\r
 \r
     /**\r
      * Method deleteConsThreshold\r
      *\r
      */\r
-    public void deleteConsThreshold()\r
-    {\r
-        this._has_consThreshold= false;\r
-    } //-- void deleteConsThreshold()\r
+    public void deleteConsThreshold() {\r
+        this._has_consThreshold = false;\r
+    }\r
+     //-- void deleteConsThreshold()\r
 \r
     /**\r
      * Method deleteDisplayBoxes\r
      *\r
      */\r
-    public void deleteDisplayBoxes()\r
-    {\r
-        this._has_displayBoxes= false;\r
-    } //-- void deleteDisplayBoxes()\r
+    public void deleteDisplayBoxes() {\r
+        this._has_displayBoxes = false;\r
+    }\r
+     //-- void deleteDisplayBoxes()\r
 \r
     /**\r
      * Method deleteDisplayText\r
      *\r
      */\r
-    public void deleteDisplayText()\r
-    {\r
-        this._has_displayText= false;\r
-    } //-- void deleteDisplayText()\r
+    public void deleteDisplayText() {\r
+        this._has_displayText = false;\r
+    }\r
+     //-- void deleteDisplayText()\r
 \r
     /**\r
      * Method deleteEnd\r
      *\r
      */\r
-    public void deleteEnd()\r
-    {\r
-        this._has_end= false;\r
-    } //-- void deleteEnd()\r
+    public void deleteEnd() {\r
+        this._has_end = false;\r
+    }\r
+     //-- void deleteEnd()\r
 \r
     /**\r
      * Method deleteOutlineColour\r
      *\r
      */\r
-    public void deleteOutlineColour()\r
-    {\r
-        this._has_outlineColour= false;\r
-    } //-- void deleteOutlineColour()\r
+    public void deleteOutlineColour() {\r
+        this._has_outlineColour = false;\r
+    }\r
+     //-- void deleteOutlineColour()\r
 \r
     /**\r
      * Method deletePidThreshold\r
      *\r
      */\r
-    public void deletePidThreshold()\r
-    {\r
-        this._has_pidThreshold= false;\r
-    } //-- void deletePidThreshold()\r
+    public void deletePidThreshold() {\r
+        this._has_pidThreshold = false;\r
+    }\r
+     //-- void deletePidThreshold()\r
 \r
     /**\r
      * Method deleteStart\r
      *\r
      */\r
-    public void deleteStart()\r
-    {\r
-        this._has_start= false;\r
-    } //-- void deleteStart()\r
+    public void deleteStart() {\r
+        this._has_start = false;\r
+    }\r
+     //-- void deleteStart()\r
 \r
     /**\r
      * Method enumerateSeq\r
@@ -270,10 +256,10 @@ public class JGroup implements java.io.Serializable {
      *\r
      * @return Enumeration\r
      */\r
-    public java.util.Enumeration enumerateSeq()\r
-    {\r
+    public java.util.Enumeration enumerateSeq() {\r
         return _seqList.elements();\r
-    } //-- java.util.Enumeration enumerateSeq()\r
+    }\r
+     //-- java.util.Enumeration enumerateSeq()\r
 \r
     /**\r
      * Returns the value of field 'colour'.\r
@@ -281,10 +267,10 @@ public class JGroup implements java.io.Serializable {
      * @return String\r
      * @return the value of field 'colour'.\r
      */\r
-    public java.lang.String getColour()\r
-    {\r
+    public java.lang.String getColour() {\r
         return this._colour;\r
-    } //-- java.lang.String getColour()\r
+    }\r
+     //-- java.lang.String getColour()\r
 \r
     /**\r
      * Returns the value of field 'colourText'.\r
@@ -292,10 +278,10 @@ public class JGroup implements java.io.Serializable {
      * @return boolean\r
      * @return the value of field 'colourText'.\r
      */\r
-    public boolean getColourText()\r
-    {\r
+    public boolean getColourText() {\r
         return this._colourText;\r
-    } //-- boolean getColourText()\r
+    }\r
+     //-- boolean getColourText()\r
 \r
     /**\r
      * Returns the value of field 'consThreshold'.\r
@@ -303,10 +289,10 @@ public class JGroup implements java.io.Serializable {
      * @return int\r
      * @return the value of field 'consThreshold'.\r
      */\r
-    public int getConsThreshold()\r
-    {\r
+    public int getConsThreshold() {\r
         return this._consThreshold;\r
-    } //-- int getConsThreshold()\r
+    }\r
+     //-- int getConsThreshold()\r
 \r
     /**\r
      * Returns the value of field 'displayBoxes'.\r
@@ -314,10 +300,10 @@ public class JGroup implements java.io.Serializable {
      * @return boolean\r
      * @return the value of field 'displayBoxes'.\r
      */\r
-    public boolean getDisplayBoxes()\r
-    {\r
+    public boolean getDisplayBoxes() {\r
         return this._displayBoxes;\r
-    } //-- boolean getDisplayBoxes()\r
+    }\r
+     //-- boolean getDisplayBoxes()\r
 \r
     /**\r
      * Returns the value of field 'displayText'.\r
@@ -325,10 +311,10 @@ public class JGroup implements java.io.Serializable {
      * @return boolean\r
      * @return the value of field 'displayText'.\r
      */\r
-    public boolean getDisplayText()\r
-    {\r
+    public boolean getDisplayText() {\r
         return this._displayText;\r
-    } //-- boolean getDisplayText()\r
+    }\r
+     //-- boolean getDisplayText()\r
 \r
     /**\r
      * Returns the value of field 'end'.\r
@@ -336,10 +322,10 @@ public class JGroup implements java.io.Serializable {
      * @return int\r
      * @return the value of field 'end'.\r
      */\r
-    public int getEnd()\r
-    {\r
+    public int getEnd() {\r
         return this._end;\r
-    } //-- int getEnd()\r
+    }\r
+     //-- int getEnd()\r
 \r
     /**\r
      * Returns the value of field 'name'.\r
@@ -347,10 +333,10 @@ public class JGroup implements java.io.Serializable {
      * @return String\r
      * @return the value of field 'name'.\r
      */\r
-    public java.lang.String getName()\r
-    {\r
+    public java.lang.String getName() {\r
         return this._name;\r
-    } //-- java.lang.String getName()\r
+    }\r
+     //-- java.lang.String getName()\r
 \r
     /**\r
      * Returns the value of field 'outlineColour'.\r
@@ -358,10 +344,10 @@ public class JGroup implements java.io.Serializable {
      * @return int\r
      * @return the value of field 'outlineColour'.\r
      */\r
-    public int getOutlineColour()\r
-    {\r
+    public int getOutlineColour() {\r
         return this._outlineColour;\r
-    } //-- int getOutlineColour()\r
+    }\r
+     //-- int getOutlineColour()\r
 \r
     /**\r
      * Returns the value of field 'pidThreshold'.\r
@@ -369,10 +355,10 @@ public class JGroup implements java.io.Serializable {
      * @return int\r
      * @return the value of field 'pidThreshold'.\r
      */\r
-    public int getPidThreshold()\r
-    {\r
+    public int getPidThreshold() {\r
         return this._pidThreshold;\r
-    } //-- int getPidThreshold()\r
+    }\r
+     //-- int getPidThreshold()\r
 \r
     /**\r
      * Method getSeq\r
@@ -382,16 +368,15 @@ public class JGroup implements java.io.Serializable {
      * @param index\r
      * @return int\r
      */\r
-    public int getSeq(int index)\r
-        throws java.lang.IndexOutOfBoundsException\r
-    {\r
+    public int getSeq(int index) throws java.lang.IndexOutOfBoundsException {\r
         //-- check bounds for index\r
         if ((index < 0) || (index > _seqList.size())) {\r
             throw new IndexOutOfBoundsException();\r
         }\r
 \r
-        return ((java.lang.Integer)_seqList.elementAt(index)).intValue();\r
-    } //-- int getSeq(int)\r
+        return ((java.lang.Integer) _seqList.elementAt(index)).intValue();\r
+    }\r
+     //-- int getSeq(int)\r
 \r
     /**\r
      * Method getSeq\r
@@ -400,15 +385,17 @@ public class JGroup implements java.io.Serializable {
      *\r
      * @return int\r
      */\r
-    public int[] getSeq()\r
-    {\r
+    public int[] getSeq() {\r
         int size = _seqList.size();\r
         int[] mArray = new int[size];\r
+\r
         for (int index = 0; index < size; index++) {\r
-            mArray[index] = ((java.lang.Integer)_seqList.elementAt(index)).intValue();\r
+            mArray[index] = ((java.lang.Integer) _seqList.elementAt(index)).intValue();\r
         }\r
+\r
         return mArray;\r
-    } //-- int[] getSeq()\r
+    }\r
+     //-- int[] getSeq()\r
 \r
     /**\r
      * Method getSeqCount\r
@@ -417,10 +404,10 @@ public class JGroup implements java.io.Serializable {
      *\r
      * @return int\r
      */\r
-    public int getSeqCount()\r
-    {\r
+    public int getSeqCount() {\r
         return _seqList.size();\r
-    } //-- int getSeqCount()\r
+    }\r
+     //-- int getSeqCount()\r
 \r
     /**\r
      * Returns the value of field 'start'.\r
@@ -428,10 +415,10 @@ public class JGroup implements java.io.Serializable {
      * @return int\r
      * @return the value of field 'start'.\r
      */\r
-    public int getStart()\r
-    {\r
+    public int getStart() {\r
         return this._start;\r
-    } //-- int getStart()\r
+    }\r
+     //-- int getStart()\r
 \r
     /**\r
      * Method hasColourText\r
@@ -440,10 +427,10 @@ public class JGroup implements java.io.Serializable {
      *\r
      * @return boolean\r
      */\r
-    public boolean hasColourText()\r
-    {\r
+    public boolean hasColourText() {\r
         return this._has_colourText;\r
-    } //-- boolean hasColourText()\r
+    }\r
+     //-- boolean hasColourText()\r
 \r
     /**\r
      * Method hasConsThreshold\r
@@ -452,10 +439,10 @@ public class JGroup implements java.io.Serializable {
      *\r
      * @return boolean\r
      */\r
-    public boolean hasConsThreshold()\r
-    {\r
+    public boolean hasConsThreshold() {\r
         return this._has_consThreshold;\r
-    } //-- boolean hasConsThreshold()\r
+    }\r
+     //-- boolean hasConsThreshold()\r
 \r
     /**\r
      * Method hasDisplayBoxes\r
@@ -464,10 +451,10 @@ public class JGroup implements java.io.Serializable {
      *\r
      * @return boolean\r
      */\r
-    public boolean hasDisplayBoxes()\r
-    {\r
+    public boolean hasDisplayBoxes() {\r
         return this._has_displayBoxes;\r
-    } //-- boolean hasDisplayBoxes()\r
+    }\r
+     //-- boolean hasDisplayBoxes()\r
 \r
     /**\r
      * Method hasDisplayText\r
@@ -476,10 +463,10 @@ public class JGroup implements java.io.Serializable {
      *\r
      * @return boolean\r
      */\r
-    public boolean hasDisplayText()\r
-    {\r
+    public boolean hasDisplayText() {\r
         return this._has_displayText;\r
-    } //-- boolean hasDisplayText()\r
+    }\r
+     //-- boolean hasDisplayText()\r
 \r
     /**\r
      * Method hasEnd\r
@@ -488,10 +475,10 @@ public class JGroup implements java.io.Serializable {
      *\r
      * @return boolean\r
      */\r
-    public boolean hasEnd()\r
-    {\r
+    public boolean hasEnd() {\r
         return this._has_end;\r
-    } //-- boolean hasEnd()\r
+    }\r
+     //-- boolean hasEnd()\r
 \r
     /**\r
      * Method hasOutlineColour\r
@@ -500,10 +487,10 @@ public class JGroup implements java.io.Serializable {
      *\r
      * @return boolean\r
      */\r
-    public boolean hasOutlineColour()\r
-    {\r
+    public boolean hasOutlineColour() {\r
         return this._has_outlineColour;\r
-    } //-- boolean hasOutlineColour()\r
+    }\r
+     //-- boolean hasOutlineColour()\r
 \r
     /**\r
      * Method hasPidThreshold\r
@@ -512,10 +499,10 @@ public class JGroup implements java.io.Serializable {
      *\r
      * @return boolean\r
      */\r
-    public boolean hasPidThreshold()\r
-    {\r
+    public boolean hasPidThreshold() {\r
         return this._has_pidThreshold;\r
-    } //-- boolean hasPidThreshold()\r
+    }\r
+     //-- boolean hasPidThreshold()\r
 \r
     /**\r
      * Method hasStart\r
@@ -524,10 +511,10 @@ public class JGroup implements java.io.Serializable {
      *\r
      * @return boolean\r
      */\r
-    public boolean hasStart()\r
-    {\r
+    public boolean hasStart() {\r
         return this._has_start;\r
-    } //-- boolean hasStart()\r
+    }\r
+     //-- boolean hasStart()\r
 \r
     /**\r
      * Method isValid\r
@@ -536,16 +523,16 @@ public class JGroup implements java.io.Serializable {
      *\r
      * @return boolean\r
      */\r
-    public boolean isValid()\r
-    {\r
+    public boolean isValid() {\r
         try {\r
             validate();\r
-        }\r
-        catch (org.exolab.castor.xml.ValidationException vex) {\r
+        } catch (org.exolab.castor.xml.ValidationException vex) {\r
             return false;\r
         }\r
+\r
         return true;\r
-    } //-- boolean isValid()\r
+    }\r
+     //-- boolean isValid()\r
 \r
     /**\r
      * Method marshal\r
@@ -555,11 +542,11 @@ public class JGroup implements java.io.Serializable {
      * @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
+        throws org.exolab.castor.xml.MarshalException, \r
+            org.exolab.castor.xml.ValidationException {\r
         Marshaller.marshal(this, out);\r
-    } //-- void marshal(java.io.Writer)\r
+    }\r
+     //-- void marshal(java.io.Writer)\r
 \r
     /**\r
      * Method marshal\r
@@ -569,20 +556,20 @@ public class JGroup implements java.io.Serializable {
      * @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
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, \r
+            org.exolab.castor.xml.ValidationException {\r
         Marshaller.marshal(this, handler);\r
-    } //-- void marshal(org.xml.sax.ContentHandler)\r
+    }\r
+     //-- void marshal(org.xml.sax.ContentHandler)\r
 \r
     /**\r
      * Method removeAllSeq\r
      *\r
      */\r
-    public void removeAllSeq()\r
-    {\r
+    public void removeAllSeq() {\r
         _seqList.removeAllElements();\r
-    } //-- void removeAllSeq()\r
+    }\r
+     //-- void removeAllSeq()\r
 \r
     /**\r
      * Method removeSeq\r
@@ -592,109 +579,110 @@ public class JGroup implements java.io.Serializable {
      * @param index\r
      * @return int\r
      */\r
-    public int removeSeq(int index)\r
-    {\r
+    public int removeSeq(int index) {\r
         java.lang.Object obj = _seqList.elementAt(index);\r
         _seqList.removeElementAt(index);\r
-        return ((java.lang.Integer)obj).intValue();\r
-    } //-- int removeSeq(int)\r
+\r
+        return ((java.lang.Integer) obj).intValue();\r
+    }\r
+     //-- int removeSeq(int)\r
 \r
     /**\r
      * Sets the value of field 'colour'.\r
      *\r
      * @param colour the value of field 'colour'.\r
      */\r
-    public void setColour(java.lang.String colour)\r
-    {\r
+    public void setColour(java.lang.String colour) {\r
         this._colour = colour;\r
-    } //-- void setColour(java.lang.String)\r
+    }\r
+     //-- void setColour(java.lang.String)\r
 \r
     /**\r
      * Sets the value of field 'colourText'.\r
      *\r
      * @param colourText the value of field 'colourText'.\r
      */\r
-    public void setColourText(boolean colourText)\r
-    {\r
+    public void setColourText(boolean colourText) {\r
         this._colourText = colourText;\r
         this._has_colourText = true;\r
-    } //-- void setColourText(boolean)\r
+    }\r
+     //-- void setColourText(boolean)\r
 \r
     /**\r
      * Sets the value of field 'consThreshold'.\r
      *\r
      * @param consThreshold the value of field 'consThreshold'.\r
      */\r
-    public void setConsThreshold(int consThreshold)\r
-    {\r
+    public void setConsThreshold(int consThreshold) {\r
         this._consThreshold = consThreshold;\r
         this._has_consThreshold = true;\r
-    } //-- void setConsThreshold(int)\r
+    }\r
+     //-- void setConsThreshold(int)\r
 \r
     /**\r
      * Sets the value of field 'displayBoxes'.\r
      *\r
      * @param displayBoxes the value of field 'displayBoxes'.\r
      */\r
-    public void setDisplayBoxes(boolean displayBoxes)\r
-    {\r
+    public void setDisplayBoxes(boolean displayBoxes) {\r
         this._displayBoxes = displayBoxes;\r
         this._has_displayBoxes = true;\r
-    } //-- void setDisplayBoxes(boolean)\r
+    }\r
+     //-- void setDisplayBoxes(boolean)\r
 \r
     /**\r
      * Sets the value of field 'displayText'.\r
      *\r
      * @param displayText the value of field 'displayText'.\r
      */\r
-    public void setDisplayText(boolean displayText)\r
-    {\r
+    public void setDisplayText(boolean displayText) {\r
         this._displayText = displayText;\r
         this._has_displayText = true;\r
-    } //-- void setDisplayText(boolean)\r
+    }\r
+     //-- void setDisplayText(boolean)\r
 \r
     /**\r
      * Sets the value of field 'end'.\r
      *\r
      * @param end the value of field 'end'.\r
      */\r
-    public void setEnd(int end)\r
-    {\r
+    public void setEnd(int end) {\r
         this._end = end;\r
         this._has_end = true;\r
-    } //-- void setEnd(int)\r
+    }\r
+     //-- void setEnd(int)\r
 \r
     /**\r
      * Sets the value of field 'name'.\r
      *\r
      * @param name the value of field 'name'.\r
      */\r
-    public void setName(java.lang.String name)\r
-    {\r
+    public void setName(java.lang.String name) {\r
         this._name = name;\r
-    } //-- void setName(java.lang.String)\r
+    }\r
+     //-- void setName(java.lang.String)\r
 \r
     /**\r
      * Sets the value of field 'outlineColour'.\r
      *\r
      * @param outlineColour the value of field 'outlineColour'.\r
      */\r
-    public void setOutlineColour(int outlineColour)\r
-    {\r
+    public void setOutlineColour(int outlineColour) {\r
         this._outlineColour = outlineColour;\r
         this._has_outlineColour = true;\r
-    } //-- void setOutlineColour(int)\r
+    }\r
+     //-- void setOutlineColour(int)\r
 \r
     /**\r
      * Sets the value of field 'pidThreshold'.\r
      *\r
      * @param pidThreshold the value of field 'pidThreshold'.\r
      */\r
-    public void setPidThreshold(int pidThreshold)\r
-    {\r
+    public void setPidThreshold(int pidThreshold) {\r
         this._pidThreshold = pidThreshold;\r
         this._has_pidThreshold = true;\r
-    } //-- void setPidThreshold(int)\r
+    }\r
+     //-- void setPidThreshold(int)\r
 \r
     /**\r
      * Method setSeq\r
@@ -705,14 +693,15 @@ public class JGroup implements java.io.Serializable {
      * @param vSeq\r
      */\r
     public void setSeq(int index, int vSeq)\r
-        throws java.lang.IndexOutOfBoundsException\r
-    {\r
+        throws java.lang.IndexOutOfBoundsException {\r
         //-- check bounds for index\r
         if ((index < 0) || (index > _seqList.size())) {\r
             throw new IndexOutOfBoundsException();\r
         }\r
+\r
         _seqList.setElementAt(new java.lang.Integer(vSeq), index);\r
-    } //-- void setSeq(int, int)\r
+    }\r
+     //-- void setSeq(int, int)\r
 \r
     /**\r
      * Method setSeq\r
@@ -721,25 +710,26 @@ public class JGroup implements java.io.Serializable {
      *\r
      * @param seqArray\r
      */\r
-    public void setSeq(int[] seqArray)\r
-    {\r
+    public void setSeq(int[] seqArray) {\r
         //-- copy array\r
         _seqList.removeAllElements();\r
+\r
         for (int i = 0; i < seqArray.length; i++) {\r
             _seqList.addElement(new java.lang.Integer(seqArray[i]));\r
         }\r
-    } //-- void setSeq(int)\r
+    }\r
+     //-- void setSeq(int)\r
 \r
     /**\r
      * Sets the value of field 'start'.\r
      *\r
      * @param start the value of field 'start'.\r
      */\r
-    public void setStart(int start)\r
-    {\r
+    public void setStart(int start) {\r
         this._start = start;\r
         this._has_start = true;\r
-    } //-- void setStart(int)\r
+    }\r
+     //-- void setStart(int)\r
 \r
     /**\r
      * Method unmarshal\r
@@ -750,20 +740,20 @@ public class JGroup implements java.io.Serializable {
      * @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.binding.JGroup) Unmarshaller.unmarshal(jalview.binding.JGroup.class, reader);\r
-    } //-- java.lang.Object unmarshal(java.io.Reader)\r
+        throws org.exolab.castor.xml.MarshalException, \r
+            org.exolab.castor.xml.ValidationException {\r
+        return (jalview.binding.JGroup) Unmarshaller.unmarshal(jalview.binding.JGroup.class,\r
+            reader);\r
+    }\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
+    public void validate() throws org.exolab.castor.xml.ValidationException {\r
         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
         validator.validate(this);\r
-    } //-- void validate()\r
-\r
+    }\r
+     //-- void validate()\r
 }\r
index 9e02e60..cabf5c8 100755 (executable)
@@ -4,7 +4,6 @@
  * Schema.\r
  * $Id$\r
  */\r
-\r
 /*\r
 * Jalview - A Sequence Alignment Editor and Viewer\r
 * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\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.binding;\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
+\r
 import org.xml.sax.ContentHandler;\r
 \r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
+//---------------------------------/\r
+import java.io.IOException;\r
+import java.io.Reader;\r
+import java.io.Serializable;\r
+import java.io.Writer;\r
+\r
+\r
 /**\r
  * Class JSeq.\r
  *\r
  * @version $Revision$ $Date$\r
  */\r
 public class JSeq implements java.io.Serializable {\r
-\r
-\r
-      //--------------------------/\r
-     //- Class/Member Variables -/\r
+    //--------------------------/\r
+    //- Class/Member Variables -/\r
     //--------------------------/\r
 \r
     /**\r
@@ -92,55 +90,46 @@ public class JSeq implements java.io.Serializable {
      */\r
     private boolean _has_id;\r
 \r
-\r
-      //----------------/\r
-     //- Constructors -/\r
     //----------------/\r
-\r
+    //- Constructors -/\r
+    //----------------/\r
     public JSeq() {\r
         super();\r
-    } //-- jalview.binding.JSeq()\r
-\r
-\r
-      //-----------/\r
-     //- Methods -/\r
-    //-----------/\r
+    }\r
+     //-- jalview.binding.JSeq()\r
+ //-----------/\r
 \r
-    /**\r
-     * Method deleteColour\r
-     *\r
-     */\r
-    public void deleteColour()\r
-    {\r
-        this._has_colour= false;\r
-    } //-- void deleteColour()\r
+    public void deleteColour() {\r
+        this._has_colour = false;\r
+    }\r
+     //-- void deleteColour()\r
 \r
     /**\r
      * Method deleteEnd\r
      *\r
      */\r
-    public void deleteEnd()\r
-    {\r
-        this._has_end= false;\r
-    } //-- void deleteEnd()\r
+    public void deleteEnd() {\r
+        this._has_end = false;\r
+    }\r
+     //-- void deleteEnd()\r
 \r
     /**\r
      * Method deleteId\r
      *\r
      */\r
-    public void deleteId()\r
-    {\r
-        this._has_id= false;\r
-    } //-- void deleteId()\r
+    public void deleteId() {\r
+        this._has_id = false;\r
+    }\r
+     //-- void deleteId()\r
 \r
     /**\r
      * Method deleteStart\r
      *\r
      */\r
-    public void deleteStart()\r
-    {\r
-        this._has_start= false;\r
-    } //-- void deleteStart()\r
+    public void deleteStart() {\r
+        this._has_start = false;\r
+    }\r
+     //-- void deleteStart()\r
 \r
     /**\r
      * Returns the value of field 'colour'.\r
@@ -148,10 +137,10 @@ public class JSeq implements java.io.Serializable {
      * @return int\r
      * @return the value of field 'colour'.\r
      */\r
-    public int getColour()\r
-    {\r
+    public int getColour() {\r
         return this._colour;\r
-    } //-- int getColour()\r
+    }\r
+     //-- int getColour()\r
 \r
     /**\r
      * Returns the value of field 'end'.\r
@@ -159,10 +148,10 @@ public class JSeq implements java.io.Serializable {
      * @return int\r
      * @return the value of field 'end'.\r
      */\r
-    public int getEnd()\r
-    {\r
+    public int getEnd() {\r
         return this._end;\r
-    } //-- int getEnd()\r
+    }\r
+     //-- int getEnd()\r
 \r
     /**\r
      * Returns the value of field 'id'.\r
@@ -170,10 +159,10 @@ public class JSeq implements java.io.Serializable {
      * @return int\r
      * @return the value of field 'id'.\r
      */\r
-    public int getId()\r
-    {\r
+    public int getId() {\r
         return this._id;\r
-    } //-- int getId()\r
+    }\r
+     //-- int getId()\r
 \r
     /**\r
      * Returns the value of field 'start'.\r
@@ -181,10 +170,10 @@ public class JSeq implements java.io.Serializable {
      * @return int\r
      * @return the value of field 'start'.\r
      */\r
-    public int getStart()\r
-    {\r
+    public int getStart() {\r
         return this._start;\r
-    } //-- int getStart()\r
+    }\r
+     //-- int getStart()\r
 \r
     /**\r
      * Method hasColour\r
@@ -193,10 +182,10 @@ public class JSeq implements java.io.Serializable {
      *\r
      * @return boolean\r
      */\r
-    public boolean hasColour()\r
-    {\r
+    public boolean hasColour() {\r
         return this._has_colour;\r
-    } //-- boolean hasColour()\r
+    }\r
+     //-- boolean hasColour()\r
 \r
     /**\r
      * Method hasEnd\r
@@ -205,10 +194,10 @@ public class JSeq implements java.io.Serializable {
      *\r
      * @return boolean\r
      */\r
-    public boolean hasEnd()\r
-    {\r
+    public boolean hasEnd() {\r
         return this._has_end;\r
-    } //-- boolean hasEnd()\r
+    }\r
+     //-- boolean hasEnd()\r
 \r
     /**\r
      * Method hasId\r
@@ -217,10 +206,10 @@ public class JSeq implements java.io.Serializable {
      *\r
      * @return boolean\r
      */\r
-    public boolean hasId()\r
-    {\r
+    public boolean hasId() {\r
         return this._has_id;\r
-    } //-- boolean hasId()\r
+    }\r
+     //-- boolean hasId()\r
 \r
     /**\r
      * Method hasStart\r
@@ -229,10 +218,10 @@ public class JSeq implements java.io.Serializable {
      *\r
      * @return boolean\r
      */\r
-    public boolean hasStart()\r
-    {\r
+    public boolean hasStart() {\r
         return this._has_start;\r
-    } //-- boolean hasStart()\r
+    }\r
+     //-- boolean hasStart()\r
 \r
     /**\r
      * Method isValid\r
@@ -241,16 +230,16 @@ public class JSeq implements java.io.Serializable {
      *\r
      * @return boolean\r
      */\r
-    public boolean isValid()\r
-    {\r
+    public boolean isValid() {\r
         try {\r
             validate();\r
-        }\r
-        catch (org.exolab.castor.xml.ValidationException vex) {\r
+        } catch (org.exolab.castor.xml.ValidationException vex) {\r
             return false;\r
         }\r
+\r
         return true;\r
-    } //-- boolean isValid()\r
+    }\r
+     //-- boolean isValid()\r
 \r
     /**\r
      * Method marshal\r
@@ -260,11 +249,11 @@ public class JSeq implements java.io.Serializable {
      * @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
+        throws org.exolab.castor.xml.MarshalException, \r
+            org.exolab.castor.xml.ValidationException {\r
         Marshaller.marshal(this, out);\r
-    } //-- void marshal(java.io.Writer)\r
+    }\r
+     //-- void marshal(java.io.Writer)\r
 \r
     /**\r
      * Method marshal\r
@@ -274,55 +263,55 @@ public class JSeq implements java.io.Serializable {
      * @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
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, \r
+            org.exolab.castor.xml.ValidationException {\r
         Marshaller.marshal(this, handler);\r
-    } //-- void marshal(org.xml.sax.ContentHandler)\r
+    }\r
+     //-- void marshal(org.xml.sax.ContentHandler)\r
 \r
     /**\r
      * Sets the value of field 'colour'.\r
      *\r
      * @param colour the value of field 'colour'.\r
      */\r
-    public void setColour(int colour)\r
-    {\r
+    public void setColour(int colour) {\r
         this._colour = colour;\r
         this._has_colour = true;\r
-    } //-- void setColour(int)\r
+    }\r
+     //-- void setColour(int)\r
 \r
     /**\r
      * Sets the value of field 'end'.\r
      *\r
      * @param end the value of field 'end'.\r
      */\r
-    public void setEnd(int end)\r
-    {\r
+    public void setEnd(int end) {\r
         this._end = end;\r
         this._has_end = true;\r
-    } //-- void setEnd(int)\r
+    }\r
+     //-- void setEnd(int)\r
 \r
     /**\r
      * Sets the value of field 'id'.\r
      *\r
      * @param id the value of field 'id'.\r
      */\r
-    public void setId(int id)\r
-    {\r
+    public void setId(int id) {\r
         this._id = id;\r
         this._has_id = true;\r
-    } //-- void setId(int)\r
+    }\r
+     //-- void setId(int)\r
 \r
     /**\r
      * Sets the value of field 'start'.\r
      *\r
      * @param start the value of field 'start'.\r
      */\r
-    public void setStart(int start)\r
-    {\r
+    public void setStart(int start) {\r
         this._start = start;\r
         this._has_start = true;\r
-    } //-- void setStart(int)\r
+    }\r
+     //-- void setStart(int)\r
 \r
     /**\r
      * Method unmarshal\r
@@ -333,20 +322,20 @@ public class JSeq implements java.io.Serializable {
      * @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.binding.JSeq) Unmarshaller.unmarshal(jalview.binding.JSeq.class, reader);\r
-    } //-- java.lang.Object unmarshal(java.io.Reader)\r
+        throws org.exolab.castor.xml.MarshalException, \r
+            org.exolab.castor.xml.ValidationException {\r
+        return (jalview.binding.JSeq) Unmarshaller.unmarshal(jalview.binding.JSeq.class,\r
+            reader);\r
+    }\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
+    public void validate() throws org.exolab.castor.xml.ValidationException {\r
         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
         validator.validate(this);\r
-    } //-- void validate()\r
-\r
+    }\r
+     //-- void validate()\r
 }\r
index d30e97d..85bfe26 100755 (executable)
@@ -4,7 +4,6 @@
  * Schema.\r
  * $Id$\r
  */\r
-\r
 /*\r
 * Jalview - A Sequence Alignment Editor and Viewer\r
 * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\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.binding;\r
 \r
-  //---------------------------------/\r
- //- Imported classes and packages -/\r
-//---------------------------------/\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
+\r
+import org.xml.sax.ContentHandler;\r
 \r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
+//---------------------------------/\r
 import java.io.IOException;\r
 import java.io.Reader;\r
 import java.io.Serializable;\r
 import java.io.Writer;\r
+\r
 import java.util.Date;\r
-import org.exolab.castor.xml.MarshalException;\r
-import org.exolab.castor.xml.Marshaller;\r
-import org.exolab.castor.xml.Unmarshaller;\r
-import org.exolab.castor.xml.ValidationException;\r
-import org.xml.sax.ContentHandler;\r
+\r
 \r
 /**\r
  * Class JalviewModel.\r
@@ -47,10 +48,8 @@ import org.xml.sax.ContentHandler;
  * @version $Revision$ $Date$\r
  */\r
 public class JalviewModel implements java.io.Serializable {\r
-\r
-\r
-      //--------------------------/\r
-     //- Class/Member Variables -/\r
+    //--------------------------/\r
+    //- Class/Member Variables -/\r
     //--------------------------/\r
 \r
     /**\r
@@ -68,30 +67,19 @@ public class JalviewModel implements java.io.Serializable {
      */\r
     private jalview.binding.JalviewModelSequence _jalviewModelSequence;\r
 \r
-\r
-      //----------------/\r
-     //- Constructors -/\r
     //----------------/\r
-\r
+    //- Constructors -/\r
+    //----------------/\r
     public JalviewModel() {\r
         super();\r
-    } //-- jalview.binding.JalviewModel()\r
-\r
-\r
-      //-----------/\r
-     //- Methods -/\r
-    //-----------/\r
+    }\r
+     //-- jalview.binding.JalviewModel()\r
+ //-----------/\r
 \r
-    /**\r
-     * Returns the value of field 'creationDate'.\r
-     *\r
-     * @return Date\r
-     * @return the value of field 'creationDate'.\r
-     */\r
-    public java.util.Date getCreationDate()\r
-    {\r
+    public java.util.Date getCreationDate() {\r
         return this._creationDate;\r
-    } //-- java.util.Date getCreationDate()\r
+    }\r
+     //-- java.util.Date getCreationDate()\r
 \r
     /**\r
      * Returns the value of field 'jalviewModelSequence'.\r
@@ -99,10 +87,10 @@ public class JalviewModel implements java.io.Serializable {
      * @return JalviewModelSequence\r
      * @return the value of field 'jalviewModelSequence'.\r
      */\r
-    public jalview.binding.JalviewModelSequence getJalviewModelSequence()\r
-    {\r
+    public jalview.binding.JalviewModelSequence getJalviewModelSequence() {\r
         return this._jalviewModelSequence;\r
-    } //-- jalview.binding.JalviewModelSequence getJalviewModelSequence()\r
+    }\r
+     //-- jalview.binding.JalviewModelSequence getJalviewModelSequence()\r
 \r
     /**\r
      * Returns the value of field 'vamsasModel'.\r
@@ -110,10 +98,10 @@ public class JalviewModel implements java.io.Serializable {
      * @return VamsasModel\r
      * @return the value of field 'vamsasModel'.\r
      */\r
-    public jalview.binding.VamsasModel getVamsasModel()\r
-    {\r
+    public jalview.binding.VamsasModel getVamsasModel() {\r
         return this._vamsasModel;\r
-    } //-- jalview.binding.VamsasModel getVamsasModel()\r
+    }\r
+     //-- jalview.binding.VamsasModel getVamsasModel()\r
 \r
     /**\r
      * Method isValid\r
@@ -122,16 +110,16 @@ public class JalviewModel implements java.io.Serializable {
      *\r
      * @return boolean\r
      */\r
-    public boolean isValid()\r
-    {\r
+    public boolean isValid() {\r
         try {\r
             validate();\r
-        }\r
-        catch (org.exolab.castor.xml.ValidationException vex) {\r
+        } catch (org.exolab.castor.xml.ValidationException vex) {\r
             return false;\r
         }\r
+\r
         return true;\r
-    } //-- boolean isValid()\r
+    }\r
+     //-- boolean isValid()\r
 \r
     /**\r
      * Method marshal\r
@@ -141,11 +129,11 @@ public class JalviewModel implements java.io.Serializable {
      * @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
+        throws org.exolab.castor.xml.MarshalException, \r
+            org.exolab.castor.xml.ValidationException {\r
         Marshaller.marshal(this, out);\r
-    } //-- void marshal(java.io.Writer)\r
+    }\r
+     //-- void marshal(java.io.Writer)\r
 \r
     /**\r
      * Method marshal\r
@@ -155,21 +143,21 @@ public class JalviewModel implements java.io.Serializable {
      * @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
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, \r
+            org.exolab.castor.xml.ValidationException {\r
         Marshaller.marshal(this, handler);\r
-    } //-- void marshal(org.xml.sax.ContentHandler)\r
+    }\r
+     //-- void marshal(org.xml.sax.ContentHandler)\r
 \r
     /**\r
      * Sets the value of field 'creationDate'.\r
      *\r
      * @param creationDate the value of field 'creationDate'.\r
      */\r
-    public void setCreationDate(java.util.Date creationDate)\r
-    {\r
+    public void setCreationDate(java.util.Date creationDate) {\r
         this._creationDate = creationDate;\r
-    } //-- void setCreationDate(java.util.Date)\r
+    }\r
+     //-- void setCreationDate(java.util.Date)\r
 \r
     /**\r
      * Sets the value of field 'jalviewModelSequence'.\r
@@ -177,20 +165,21 @@ public class JalviewModel implements java.io.Serializable {
      * @param jalviewModelSequence the value of field\r
      * 'jalviewModelSequence'.\r
      */\r
-    public void setJalviewModelSequence(jalview.binding.JalviewModelSequence jalviewModelSequence)\r
-    {\r
+    public void setJalviewModelSequence(\r
+        jalview.binding.JalviewModelSequence jalviewModelSequence) {\r
         this._jalviewModelSequence = jalviewModelSequence;\r
-    } //-- void setJalviewModelSequence(jalview.binding.JalviewModelSequence)\r
+    }\r
+     //-- void setJalviewModelSequence(jalview.binding.JalviewModelSequence)\r
 \r
     /**\r
      * Sets the value of field 'vamsasModel'.\r
      *\r
      * @param vamsasModel the value of field 'vamsasModel'.\r
      */\r
-    public void setVamsasModel(jalview.binding.VamsasModel vamsasModel)\r
-    {\r
+    public void setVamsasModel(jalview.binding.VamsasModel vamsasModel) {\r
         this._vamsasModel = vamsasModel;\r
-    } //-- void setVamsasModel(jalview.binding.VamsasModel)\r
+    }\r
+     //-- void setVamsasModel(jalview.binding.VamsasModel)\r
 \r
     /**\r
      * Method unmarshal\r
@@ -201,20 +190,20 @@ public class JalviewModel implements java.io.Serializable {
      * @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.binding.JalviewModel) Unmarshaller.unmarshal(jalview.binding.JalviewModel.class, reader);\r
-    } //-- java.lang.Object unmarshal(java.io.Reader)\r
+        throws org.exolab.castor.xml.MarshalException, \r
+            org.exolab.castor.xml.ValidationException {\r
+        return (jalview.binding.JalviewModel) Unmarshaller.unmarshal(jalview.binding.JalviewModel.class,\r
+            reader);\r
+    }\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
+    public void validate() throws org.exolab.castor.xml.ValidationException {\r
         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
         validator.validate(this);\r
-    } //-- void validate()\r
-\r
+    }\r
+     //-- void validate()\r
 }\r
index d22dcd4..2abee13 100755 (executable)
@@ -4,7 +4,6 @@
  * Schema.\r
  * $Id$\r
  */\r
-\r
 /*\r
 * Jalview - A Sequence Alignment Editor and Viewer\r
 * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\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.binding;\r
 \r
-  //---------------------------------/\r
- //- Imported classes and packages -/\r
-//---------------------------------/\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
 \r
+import org.xml.sax.ContentHandler;\r
+\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
+//---------------------------------/\r
 import java.io.IOException;\r
 import java.io.Reader;\r
 import java.io.Serializable;\r
 import java.io.Writer;\r
+\r
 import java.util.Enumeration;\r
 import java.util.Vector;\r
-import org.exolab.castor.xml.MarshalException;\r
-import org.exolab.castor.xml.Marshaller;\r
-import org.exolab.castor.xml.Unmarshaller;\r
-import org.exolab.castor.xml.ValidationException;\r
-import org.xml.sax.ContentHandler;\r
+\r
 \r
 /**\r
  * Class JalviewModelSequence.\r
@@ -48,10 +49,8 @@ import org.xml.sax.ContentHandler;
  * @version $Revision$ $Date$\r
  */\r
 public class JalviewModelSequence implements java.io.Serializable {\r
-\r
-\r
-      //--------------------------/\r
-     //- Class/Member Variables -/\r
+    //--------------------------/\r
+    //- Class/Member Variables -/\r
     //--------------------------/\r
 \r
     /**\r
@@ -74,36 +73,24 @@ public class JalviewModelSequence implements java.io.Serializable {
      */\r
     private java.util.Vector _userColoursList;\r
 \r
-\r
-      //----------------/\r
-     //- Constructors -/\r
     //----------------/\r
-\r
+    //- Constructors -/\r
+    //----------------/\r
     public JalviewModelSequence() {\r
         super();\r
         _JSeqList = new Vector();\r
         _JGroupList = new Vector();\r
         _viewportList = new Vector();\r
         _userColoursList = new Vector();\r
-    } //-- jalview.binding.JalviewModelSequence()\r
-\r
-\r
-      //-----------/\r
-     //- Methods -/\r
-    //-----------/\r
+    }\r
+     //-- jalview.binding.JalviewModelSequence()\r
+ //-----------/\r
 \r
-    /**\r
-     * Method addJGroup\r
-     *\r
-     *\r
-     *\r
-     * @param vJGroup\r
-     */\r
     public void addJGroup(jalview.binding.JGroup vJGroup)\r
-        throws java.lang.IndexOutOfBoundsException\r
-    {\r
+        throws java.lang.IndexOutOfBoundsException {\r
         _JGroupList.addElement(vJGroup);\r
-    } //-- void addJGroup(jalview.binding.JGroup)\r
+    }\r
+     //-- void addJGroup(jalview.binding.JGroup)\r
 \r
     /**\r
      * Method addJGroup\r
@@ -114,10 +101,10 @@ public class JalviewModelSequence implements java.io.Serializable {
      * @param vJGroup\r
      */\r
     public void addJGroup(int index, jalview.binding.JGroup vJGroup)\r
-        throws java.lang.IndexOutOfBoundsException\r
-    {\r
+        throws java.lang.IndexOutOfBoundsException {\r
         _JGroupList.insertElementAt(vJGroup, index);\r
-    } //-- void addJGroup(int, jalview.binding.JGroup)\r
+    }\r
+     //-- void addJGroup(int, jalview.binding.JGroup)\r
 \r
     /**\r
      * Method addJSeq\r
@@ -127,10 +114,10 @@ public class JalviewModelSequence implements java.io.Serializable {
      * @param vJSeq\r
      */\r
     public void addJSeq(jalview.binding.JSeq vJSeq)\r
-        throws java.lang.IndexOutOfBoundsException\r
-    {\r
+        throws java.lang.IndexOutOfBoundsException {\r
         _JSeqList.addElement(vJSeq);\r
-    } //-- void addJSeq(jalview.binding.JSeq)\r
+    }\r
+     //-- void addJSeq(jalview.binding.JSeq)\r
 \r
     /**\r
      * Method addJSeq\r
@@ -141,10 +128,10 @@ public class JalviewModelSequence implements java.io.Serializable {
      * @param vJSeq\r
      */\r
     public void addJSeq(int index, jalview.binding.JSeq vJSeq)\r
-        throws java.lang.IndexOutOfBoundsException\r
-    {\r
+        throws java.lang.IndexOutOfBoundsException {\r
         _JSeqList.insertElementAt(vJSeq, index);\r
-    } //-- void addJSeq(int, jalview.binding.JSeq)\r
+    }\r
+     //-- void addJSeq(int, jalview.binding.JSeq)\r
 \r
     /**\r
      * Method addUserColours\r
@@ -154,10 +141,10 @@ public class JalviewModelSequence implements java.io.Serializable {
      * @param vUserColours\r
      */\r
     public void addUserColours(jalview.binding.UserColours vUserColours)\r
-        throws java.lang.IndexOutOfBoundsException\r
-    {\r
+        throws java.lang.IndexOutOfBoundsException {\r
         _userColoursList.addElement(vUserColours);\r
-    } //-- void addUserColours(jalview.binding.UserColours)\r
+    }\r
+     //-- void addUserColours(jalview.binding.UserColours)\r
 \r
     /**\r
      * Method addUserColours\r
@@ -167,11 +154,12 @@ public class JalviewModelSequence implements java.io.Serializable {
      * @param index\r
      * @param vUserColours\r
      */\r
-    public void addUserColours(int index, jalview.binding.UserColours vUserColours)\r
-        throws java.lang.IndexOutOfBoundsException\r
-    {\r
+    public void addUserColours(int index,\r
+        jalview.binding.UserColours vUserColours)\r
+        throws java.lang.IndexOutOfBoundsException {\r
         _userColoursList.insertElementAt(vUserColours, index);\r
-    } //-- void addUserColours(int, jalview.binding.UserColours)\r
+    }\r
+     //-- void addUserColours(int, jalview.binding.UserColours)\r
 \r
     /**\r
      * Method addViewport\r
@@ -181,10 +169,10 @@ public class JalviewModelSequence implements java.io.Serializable {
      * @param vViewport\r
      */\r
     public void addViewport(jalview.binding.Viewport vViewport)\r
-        throws java.lang.IndexOutOfBoundsException\r
-    {\r
+        throws java.lang.IndexOutOfBoundsException {\r
         _viewportList.addElement(vViewport);\r
-    } //-- void addViewport(jalview.binding.Viewport)\r
+    }\r
+     //-- void addViewport(jalview.binding.Viewport)\r
 \r
     /**\r
      * Method addViewport\r
@@ -195,10 +183,10 @@ public class JalviewModelSequence implements java.io.Serializable {
      * @param vViewport\r
      */\r
     public void addViewport(int index, jalview.binding.Viewport vViewport)\r
-        throws java.lang.IndexOutOfBoundsException\r
-    {\r
+        throws java.lang.IndexOutOfBoundsException {\r
         _viewportList.insertElementAt(vViewport, index);\r
-    } //-- void addViewport(int, jalview.binding.Viewport)\r
+    }\r
+     //-- void addViewport(int, jalview.binding.Viewport)\r
 \r
     /**\r
      * Method enumerateJGroup\r
@@ -207,10 +195,10 @@ public class JalviewModelSequence implements java.io.Serializable {
      *\r
      * @return Enumeration\r
      */\r
-    public java.util.Enumeration enumerateJGroup()\r
-    {\r
+    public java.util.Enumeration enumerateJGroup() {\r
         return _JGroupList.elements();\r
-    } //-- java.util.Enumeration enumerateJGroup()\r
+    }\r
+     //-- java.util.Enumeration enumerateJGroup()\r
 \r
     /**\r
      * Method enumerateJSeq\r
@@ -219,10 +207,10 @@ public class JalviewModelSequence implements java.io.Serializable {
      *\r
      * @return Enumeration\r
      */\r
-    public java.util.Enumeration enumerateJSeq()\r
-    {\r
+    public java.util.Enumeration enumerateJSeq() {\r
         return _JSeqList.elements();\r
-    } //-- java.util.Enumeration enumerateJSeq()\r
+    }\r
+     //-- java.util.Enumeration enumerateJSeq()\r
 \r
     /**\r
      * Method enumerateUserColours\r
@@ -231,10 +219,10 @@ public class JalviewModelSequence implements java.io.Serializable {
      *\r
      * @return Enumeration\r
      */\r
-    public java.util.Enumeration enumerateUserColours()\r
-    {\r
+    public java.util.Enumeration enumerateUserColours() {\r
         return _userColoursList.elements();\r
-    } //-- java.util.Enumeration enumerateUserColours()\r
+    }\r
+     //-- java.util.Enumeration enumerateUserColours()\r
 \r
     /**\r
      * Method enumerateViewport\r
@@ -243,10 +231,10 @@ public class JalviewModelSequence implements java.io.Serializable {
      *\r
      * @return Enumeration\r
      */\r
-    public java.util.Enumeration enumerateViewport()\r
-    {\r
+    public java.util.Enumeration enumerateViewport() {\r
         return _viewportList.elements();\r
-    } //-- java.util.Enumeration enumerateViewport()\r
+    }\r
+     //-- java.util.Enumeration enumerateViewport()\r
 \r
     /**\r
      * Method getJGroup\r
@@ -257,15 +245,15 @@ public class JalviewModelSequence implements java.io.Serializable {
      * @return JGroup\r
      */\r
     public jalview.binding.JGroup getJGroup(int index)\r
-        throws java.lang.IndexOutOfBoundsException\r
-    {\r
+        throws java.lang.IndexOutOfBoundsException {\r
         //-- check bounds for index\r
         if ((index < 0) || (index > _JGroupList.size())) {\r
             throw new IndexOutOfBoundsException();\r
         }\r
 \r
         return (jalview.binding.JGroup) _JGroupList.elementAt(index);\r
-    } //-- jalview.binding.JGroup getJGroup(int)\r
+    }\r
+     //-- jalview.binding.JGroup getJGroup(int)\r
 \r
     /**\r
      * Method getJGroup\r
@@ -274,15 +262,17 @@ public class JalviewModelSequence implements java.io.Serializable {
      *\r
      * @return JGroup\r
      */\r
-    public jalview.binding.JGroup[] getJGroup()\r
-    {\r
+    public jalview.binding.JGroup[] getJGroup() {\r
         int size = _JGroupList.size();\r
         jalview.binding.JGroup[] mArray = new jalview.binding.JGroup[size];\r
+\r
         for (int index = 0; index < size; index++) {\r
             mArray[index] = (jalview.binding.JGroup) _JGroupList.elementAt(index);\r
         }\r
+\r
         return mArray;\r
-    } //-- jalview.binding.JGroup[] getJGroup()\r
+    }\r
+     //-- jalview.binding.JGroup[] getJGroup()\r
 \r
     /**\r
      * Method getJGroupCount\r
@@ -291,10 +281,10 @@ public class JalviewModelSequence implements java.io.Serializable {
      *\r
      * @return int\r
      */\r
-    public int getJGroupCount()\r
-    {\r
+    public int getJGroupCount() {\r
         return _JGroupList.size();\r
-    } //-- int getJGroupCount()\r
+    }\r
+     //-- int getJGroupCount()\r
 \r
     /**\r
      * Method getJSeq\r
@@ -305,15 +295,15 @@ public class JalviewModelSequence implements java.io.Serializable {
      * @return JSeq\r
      */\r
     public jalview.binding.JSeq getJSeq(int index)\r
-        throws java.lang.IndexOutOfBoundsException\r
-    {\r
+        throws java.lang.IndexOutOfBoundsException {\r
         //-- check bounds for index\r
         if ((index < 0) || (index > _JSeqList.size())) {\r
             throw new IndexOutOfBoundsException();\r
         }\r
 \r
         return (jalview.binding.JSeq) _JSeqList.elementAt(index);\r
-    } //-- jalview.binding.JSeq getJSeq(int)\r
+    }\r
+     //-- jalview.binding.JSeq getJSeq(int)\r
 \r
     /**\r
      * Method getJSeq\r
@@ -322,15 +312,17 @@ public class JalviewModelSequence implements java.io.Serializable {
      *\r
      * @return JSeq\r
      */\r
-    public jalview.binding.JSeq[] getJSeq()\r
-    {\r
+    public jalview.binding.JSeq[] getJSeq() {\r
         int size = _JSeqList.size();\r
         jalview.binding.JSeq[] mArray = new jalview.binding.JSeq[size];\r
+\r
         for (int index = 0; index < size; index++) {\r
             mArray[index] = (jalview.binding.JSeq) _JSeqList.elementAt(index);\r
         }\r
+\r
         return mArray;\r
-    } //-- jalview.binding.JSeq[] getJSeq()\r
+    }\r
+     //-- jalview.binding.JSeq[] getJSeq()\r
 \r
     /**\r
      * Method getJSeqCount\r
@@ -339,10 +331,10 @@ public class JalviewModelSequence implements java.io.Serializable {
      *\r
      * @return int\r
      */\r
-    public int getJSeqCount()\r
-    {\r
+    public int getJSeqCount() {\r
         return _JSeqList.size();\r
-    } //-- int getJSeqCount()\r
+    }\r
+     //-- int getJSeqCount()\r
 \r
     /**\r
      * Method getUserColours\r
@@ -353,15 +345,15 @@ public class JalviewModelSequence implements java.io.Serializable {
      * @return UserColours\r
      */\r
     public jalview.binding.UserColours getUserColours(int index)\r
-        throws java.lang.IndexOutOfBoundsException\r
-    {\r
+        throws java.lang.IndexOutOfBoundsException {\r
         //-- check bounds for index\r
         if ((index < 0) || (index > _userColoursList.size())) {\r
             throw new IndexOutOfBoundsException();\r
         }\r
 \r
         return (jalview.binding.UserColours) _userColoursList.elementAt(index);\r
-    } //-- jalview.binding.UserColours getUserColours(int)\r
+    }\r
+     //-- jalview.binding.UserColours getUserColours(int)\r
 \r
     /**\r
      * Method getUserColours\r
@@ -370,15 +362,17 @@ public class JalviewModelSequence implements java.io.Serializable {
      *\r
      * @return UserColours\r
      */\r
-    public jalview.binding.UserColours[] getUserColours()\r
-    {\r
+    public jalview.binding.UserColours[] getUserColours() {\r
         int size = _userColoursList.size();\r
         jalview.binding.UserColours[] mArray = new jalview.binding.UserColours[size];\r
+\r
         for (int index = 0; index < size; index++) {\r
             mArray[index] = (jalview.binding.UserColours) _userColoursList.elementAt(index);\r
         }\r
+\r
         return mArray;\r
-    } //-- jalview.binding.UserColours[] getUserColours()\r
+    }\r
+     //-- jalview.binding.UserColours[] getUserColours()\r
 \r
     /**\r
      * Method getUserColoursCount\r
@@ -387,10 +381,10 @@ public class JalviewModelSequence implements java.io.Serializable {
      *\r
      * @return int\r
      */\r
-    public int getUserColoursCount()\r
-    {\r
+    public int getUserColoursCount() {\r
         return _userColoursList.size();\r
-    } //-- int getUserColoursCount()\r
+    }\r
+     //-- int getUserColoursCount()\r
 \r
     /**\r
      * Method getViewport\r
@@ -401,15 +395,15 @@ public class JalviewModelSequence implements java.io.Serializable {
      * @return Viewport\r
      */\r
     public jalview.binding.Viewport getViewport(int index)\r
-        throws java.lang.IndexOutOfBoundsException\r
-    {\r
+        throws java.lang.IndexOutOfBoundsException {\r
         //-- check bounds for index\r
         if ((index < 0) || (index > _viewportList.size())) {\r
             throw new IndexOutOfBoundsException();\r
         }\r
 \r
         return (jalview.binding.Viewport) _viewportList.elementAt(index);\r
-    } //-- jalview.binding.Viewport getViewport(int)\r
+    }\r
+     //-- jalview.binding.Viewport getViewport(int)\r
 \r
     /**\r
      * Method getViewport\r
@@ -418,15 +412,17 @@ public class JalviewModelSequence implements java.io.Serializable {
      *\r
      * @return Viewport\r
      */\r
-    public jalview.binding.Viewport[] getViewport()\r
-    {\r
+    public jalview.binding.Viewport[] getViewport() {\r
         int size = _viewportList.size();\r
         jalview.binding.Viewport[] mArray = new jalview.binding.Viewport[size];\r
+\r
         for (int index = 0; index < size; index++) {\r
             mArray[index] = (jalview.binding.Viewport) _viewportList.elementAt(index);\r
         }\r
+\r
         return mArray;\r
-    } //-- jalview.binding.Viewport[] getViewport()\r
+    }\r
+     //-- jalview.binding.Viewport[] getViewport()\r
 \r
     /**\r
      * Method getViewportCount\r
@@ -435,10 +431,10 @@ public class JalviewModelSequence implements java.io.Serializable {
      *\r
      * @return int\r
      */\r
-    public int getViewportCount()\r
-    {\r
+    public int getViewportCount() {\r
         return _viewportList.size();\r
-    } //-- int getViewportCount()\r
+    }\r
+     //-- int getViewportCount()\r
 \r
     /**\r
      * Method isValid\r
@@ -447,16 +443,16 @@ public class JalviewModelSequence implements java.io.Serializable {
      *\r
      * @return boolean\r
      */\r
-    public boolean isValid()\r
-    {\r
+    public boolean isValid() {\r
         try {\r
             validate();\r
-        }\r
-        catch (org.exolab.castor.xml.ValidationException vex) {\r
+        } catch (org.exolab.castor.xml.ValidationException vex) {\r
             return false;\r
         }\r
+\r
         return true;\r
-    } //-- boolean isValid()\r
+    }\r
+     //-- boolean isValid()\r
 \r
     /**\r
      * Method marshal\r
@@ -466,11 +462,11 @@ public class JalviewModelSequence implements java.io.Serializable {
      * @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
+        throws org.exolab.castor.xml.MarshalException, \r
+            org.exolab.castor.xml.ValidationException {\r
         Marshaller.marshal(this, out);\r
-    } //-- void marshal(java.io.Writer)\r
+    }\r
+     //-- void marshal(java.io.Writer)\r
 \r
     /**\r
      * Method marshal\r
@@ -480,47 +476,47 @@ public class JalviewModelSequence implements java.io.Serializable {
      * @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
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, \r
+            org.exolab.castor.xml.ValidationException {\r
         Marshaller.marshal(this, handler);\r
-    } //-- void marshal(org.xml.sax.ContentHandler)\r
+    }\r
+     //-- void marshal(org.xml.sax.ContentHandler)\r
 \r
     /**\r
      * Method removeAllJGroup\r
      *\r
      */\r
-    public void removeAllJGroup()\r
-    {\r
+    public void removeAllJGroup() {\r
         _JGroupList.removeAllElements();\r
-    } //-- void removeAllJGroup()\r
+    }\r
+     //-- void removeAllJGroup()\r
 \r
     /**\r
      * Method removeAllJSeq\r
      *\r
      */\r
-    public void removeAllJSeq()\r
-    {\r
+    public void removeAllJSeq() {\r
         _JSeqList.removeAllElements();\r
-    } //-- void removeAllJSeq()\r
+    }\r
+     //-- void removeAllJSeq()\r
 \r
     /**\r
      * Method removeAllUserColours\r
      *\r
      */\r
-    public void removeAllUserColours()\r
-    {\r
+    public void removeAllUserColours() {\r
         _userColoursList.removeAllElements();\r
-    } //-- void removeAllUserColours()\r
+    }\r
+     //-- void removeAllUserColours()\r
 \r
     /**\r
      * Method removeAllViewport\r
      *\r
      */\r
-    public void removeAllViewport()\r
-    {\r
+    public void removeAllViewport() {\r
         _viewportList.removeAllElements();\r
-    } //-- void removeAllViewport()\r
+    }\r
+     //-- void removeAllViewport()\r
 \r
     /**\r
      * Method removeJGroup\r
@@ -530,12 +526,13 @@ public class JalviewModelSequence implements java.io.Serializable {
      * @param index\r
      * @return JGroup\r
      */\r
-    public jalview.binding.JGroup removeJGroup(int index)\r
-    {\r
+    public jalview.binding.JGroup removeJGroup(int index) {\r
         java.lang.Object obj = _JGroupList.elementAt(index);\r
         _JGroupList.removeElementAt(index);\r
+\r
         return (jalview.binding.JGroup) obj;\r
-    } //-- jalview.binding.JGroup removeJGroup(int)\r
+    }\r
+     //-- jalview.binding.JGroup removeJGroup(int)\r
 \r
     /**\r
      * Method removeJSeq\r
@@ -545,12 +542,13 @@ public class JalviewModelSequence implements java.io.Serializable {
      * @param index\r
      * @return JSeq\r
      */\r
-    public jalview.binding.JSeq removeJSeq(int index)\r
-    {\r
+    public jalview.binding.JSeq removeJSeq(int index) {\r
         java.lang.Object obj = _JSeqList.elementAt(index);\r
         _JSeqList.removeElementAt(index);\r
+\r
         return (jalview.binding.JSeq) obj;\r
-    } //-- jalview.binding.JSeq removeJSeq(int)\r
+    }\r
+     //-- jalview.binding.JSeq removeJSeq(int)\r
 \r
     /**\r
      * Method removeUserColours\r
@@ -560,12 +558,13 @@ public class JalviewModelSequence implements java.io.Serializable {
      * @param index\r
      * @return UserColours\r
      */\r
-    public jalview.binding.UserColours removeUserColours(int index)\r
-    {\r
+    public jalview.binding.UserColours removeUserColours(int index) {\r
         java.lang.Object obj = _userColoursList.elementAt(index);\r
         _userColoursList.removeElementAt(index);\r
+\r
         return (jalview.binding.UserColours) obj;\r
-    } //-- jalview.binding.UserColours removeUserColours(int)\r
+    }\r
+     //-- jalview.binding.UserColours removeUserColours(int)\r
 \r
     /**\r
      * Method removeViewport\r
@@ -575,12 +574,13 @@ public class JalviewModelSequence implements java.io.Serializable {
      * @param index\r
      * @return Viewport\r
      */\r
-    public jalview.binding.Viewport removeViewport(int index)\r
-    {\r
+    public jalview.binding.Viewport removeViewport(int index) {\r
         java.lang.Object obj = _viewportList.elementAt(index);\r
         _viewportList.removeElementAt(index);\r
+\r
         return (jalview.binding.Viewport) obj;\r
-    } //-- jalview.binding.Viewport removeViewport(int)\r
+    }\r
+     //-- jalview.binding.Viewport removeViewport(int)\r
 \r
     /**\r
      * Method setJGroup\r
@@ -591,14 +591,15 @@ public class JalviewModelSequence implements java.io.Serializable {
      * @param vJGroup\r
      */\r
     public void setJGroup(int index, jalview.binding.JGroup vJGroup)\r
-        throws java.lang.IndexOutOfBoundsException\r
-    {\r
+        throws java.lang.IndexOutOfBoundsException {\r
         //-- check bounds for index\r
         if ((index < 0) || (index > _JGroupList.size())) {\r
             throw new IndexOutOfBoundsException();\r
         }\r
+\r
         _JGroupList.setElementAt(vJGroup, index);\r
-    } //-- void setJGroup(int, jalview.binding.JGroup)\r
+    }\r
+     //-- void setJGroup(int, jalview.binding.JGroup)\r
 \r
     /**\r
      * Method setJGroup\r
@@ -607,14 +608,15 @@ public class JalviewModelSequence implements java.io.Serializable {
      *\r
      * @param JGroupArray\r
      */\r
-    public void setJGroup(jalview.binding.JGroup[] JGroupArray)\r
-    {\r
+    public void setJGroup(jalview.binding.JGroup[] JGroupArray) {\r
         //-- copy array\r
         _JGroupList.removeAllElements();\r
+\r
         for (int i = 0; i < JGroupArray.length; i++) {\r
             _JGroupList.addElement(JGroupArray[i]);\r
         }\r
-    } //-- void setJGroup(jalview.binding.JGroup)\r
+    }\r
+     //-- void setJGroup(jalview.binding.JGroup)\r
 \r
     /**\r
      * Method setJSeq\r
@@ -625,14 +627,15 @@ public class JalviewModelSequence implements java.io.Serializable {
      * @param vJSeq\r
      */\r
     public void setJSeq(int index, jalview.binding.JSeq vJSeq)\r
-        throws java.lang.IndexOutOfBoundsException\r
-    {\r
+        throws java.lang.IndexOutOfBoundsException {\r
         //-- check bounds for index\r
         if ((index < 0) || (index > _JSeqList.size())) {\r
             throw new IndexOutOfBoundsException();\r
         }\r
+\r
         _JSeqList.setElementAt(vJSeq, index);\r
-    } //-- void setJSeq(int, jalview.binding.JSeq)\r
+    }\r
+     //-- void setJSeq(int, jalview.binding.JSeq)\r
 \r
     /**\r
      * Method setJSeq\r
@@ -641,14 +644,15 @@ public class JalviewModelSequence implements java.io.Serializable {
      *\r
      * @param JSeqArray\r
      */\r
-    public void setJSeq(jalview.binding.JSeq[] JSeqArray)\r
-    {\r
+    public void setJSeq(jalview.binding.JSeq[] JSeqArray) {\r
         //-- copy array\r
         _JSeqList.removeAllElements();\r
+\r
         for (int i = 0; i < JSeqArray.length; i++) {\r
             _JSeqList.addElement(JSeqArray[i]);\r
         }\r
-    } //-- void setJSeq(jalview.binding.JSeq)\r
+    }\r
+     //-- void setJSeq(jalview.binding.JSeq)\r
 \r
     /**\r
      * Method setUserColours\r
@@ -658,15 +662,17 @@ public class JalviewModelSequence implements java.io.Serializable {
      * @param index\r
      * @param vUserColours\r
      */\r
-    public void setUserColours(int index, jalview.binding.UserColours vUserColours)\r
-        throws java.lang.IndexOutOfBoundsException\r
-    {\r
+    public void setUserColours(int index,\r
+        jalview.binding.UserColours vUserColours)\r
+        throws java.lang.IndexOutOfBoundsException {\r
         //-- check bounds for index\r
         if ((index < 0) || (index > _userColoursList.size())) {\r
             throw new IndexOutOfBoundsException();\r
         }\r
+\r
         _userColoursList.setElementAt(vUserColours, index);\r
-    } //-- void setUserColours(int, jalview.binding.UserColours)\r
+    }\r
+     //-- void setUserColours(int, jalview.binding.UserColours)\r
 \r
     /**\r
      * Method setUserColours\r
@@ -675,14 +681,15 @@ public class JalviewModelSequence implements java.io.Serializable {
      *\r
      * @param userColoursArray\r
      */\r
-    public void setUserColours(jalview.binding.UserColours[] userColoursArray)\r
-    {\r
+    public void setUserColours(jalview.binding.UserColours[] userColoursArray) {\r
         //-- copy array\r
         _userColoursList.removeAllElements();\r
+\r
         for (int i = 0; i < userColoursArray.length; i++) {\r
             _userColoursList.addElement(userColoursArray[i]);\r
         }\r
-    } //-- void setUserColours(jalview.binding.UserColours)\r
+    }\r
+     //-- void setUserColours(jalview.binding.UserColours)\r
 \r
     /**\r
      * Method setViewport\r
@@ -693,14 +700,15 @@ public class JalviewModelSequence implements java.io.Serializable {
      * @param vViewport\r
      */\r
     public void setViewport(int index, jalview.binding.Viewport vViewport)\r
-        throws java.lang.IndexOutOfBoundsException\r
-    {\r
+        throws java.lang.IndexOutOfBoundsException {\r
         //-- check bounds for index\r
         if ((index < 0) || (index > _viewportList.size())) {\r
             throw new IndexOutOfBoundsException();\r
         }\r
+\r
         _viewportList.setElementAt(vViewport, index);\r
-    } //-- void setViewport(int, jalview.binding.Viewport)\r
+    }\r
+     //-- void setViewport(int, jalview.binding.Viewport)\r
 \r
     /**\r
      * Method setViewport\r
@@ -709,14 +717,15 @@ public class JalviewModelSequence implements java.io.Serializable {
      *\r
      * @param viewportArray\r
      */\r
-    public void setViewport(jalview.binding.Viewport[] viewportArray)\r
-    {\r
+    public void setViewport(jalview.binding.Viewport[] viewportArray) {\r
         //-- copy array\r
         _viewportList.removeAllElements();\r
+\r
         for (int i = 0; i < viewportArray.length; i++) {\r
             _viewportList.addElement(viewportArray[i]);\r
         }\r
-    } //-- void setViewport(jalview.binding.Viewport)\r
+    }\r
+     //-- void setViewport(jalview.binding.Viewport)\r
 \r
     /**\r
      * Method unmarshal\r
@@ -727,20 +736,20 @@ public class JalviewModelSequence implements java.io.Serializable {
      * @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.binding.JalviewModelSequence) Unmarshaller.unmarshal(jalview.binding.JalviewModelSequence.class, reader);\r
-    } //-- java.lang.Object unmarshal(java.io.Reader)\r
+        throws org.exolab.castor.xml.MarshalException, \r
+            org.exolab.castor.xml.ValidationException {\r
+        return (jalview.binding.JalviewModelSequence) Unmarshaller.unmarshal(jalview.binding.JalviewModelSequence.class,\r
+            reader);\r
+    }\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
+    public void validate() throws org.exolab.castor.xml.ValidationException {\r
         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
         validator.validate(this);\r
-    } //-- void validate()\r
-\r
+    }\r
+     //-- void validate()\r
 }\r
index 0cf1942..add536e 100755 (executable)
@@ -4,7 +4,6 @@
  * Schema.\r
  * $Id$\r
  */\r
-\r
 /*\r
 * Jalview - A Sequence Alignment Editor and Viewer\r
 * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\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.binding;\r
 \r
-  //---------------------------------/\r
- //- Imported classes and packages -/\r
-//---------------------------------/\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
+\r
+import org.xml.sax.ContentHandler;\r
 \r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
+//---------------------------------/\r
 import java.io.IOException;\r
 import java.io.Reader;\r
 import java.io.Serializable;\r
 import java.io.Writer;\r
+\r
 import java.util.Enumeration;\r
 import java.util.Vector;\r
-import org.exolab.castor.xml.MarshalException;\r
-import org.exolab.castor.xml.Marshaller;\r
-import org.exolab.castor.xml.Unmarshaller;\r
-import org.exolab.castor.xml.ValidationException;\r
-import org.xml.sax.ContentHandler;\r
+\r
 \r
 /**\r
  * Class JalviewModelSequence2.\r
@@ -48,10 +49,8 @@ import org.xml.sax.ContentHandler;
  * @version $Revision$ $Date$\r
  */\r
 public class JalviewModelSequence2 implements java.io.Serializable {\r
-\r
-\r
-      //--------------------------/\r
-     //- Class/Member Variables -/\r
+    //--------------------------/\r
+    //- Class/Member Variables -/\r
     //--------------------------/\r
 \r
     /**\r
@@ -59,33 +58,22 @@ public class JalviewModelSequence2 implements java.io.Serializable {
      */\r
     private java.util.Vector _items;\r
 \r
-\r
-      //----------------/\r
-     //- Constructors -/\r
     //----------------/\r
-\r
+    //- Constructors -/\r
+    //----------------/\r
     public JalviewModelSequence2() {\r
         super();\r
         _items = new Vector();\r
-    } //-- jalview.binding.JalviewModelSequence2()\r
-\r
+    }\r
+     //-- jalview.binding.JalviewModelSequence2()\r
+ //-----------/\r
 \r
-      //-----------/\r
-     //- Methods -/\r
-    //-----------/\r
-\r
-    /**\r
-     * Method addJalviewModelSequence2Item\r
-     *\r
-     *\r
-     *\r
-     * @param vJalviewModelSequence2Item\r
-     */\r
-    public void addJalviewModelSequence2Item(jalview.binding.JalviewModelSequence2Item vJalviewModelSequence2Item)\r
-        throws java.lang.IndexOutOfBoundsException\r
-    {\r
+    public void addJalviewModelSequence2Item(\r
+        jalview.binding.JalviewModelSequence2Item vJalviewModelSequence2Item)\r
+        throws java.lang.IndexOutOfBoundsException {\r
         _items.addElement(vJalviewModelSequence2Item);\r
-    } //-- void addJalviewModelSequence2Item(jalview.binding.JalviewModelSequence2Item)\r
+    }\r
+     //-- void addJalviewModelSequence2Item(jalview.binding.JalviewModelSequence2Item)\r
 \r
     /**\r
      * Method addJalviewModelSequence2Item\r
@@ -95,11 +83,12 @@ public class JalviewModelSequence2 implements java.io.Serializable {
      * @param index\r
      * @param vJalviewModelSequence2Item\r
      */\r
-    public void addJalviewModelSequence2Item(int index, jalview.binding.JalviewModelSequence2Item vJalviewModelSequence2Item)\r
-        throws java.lang.IndexOutOfBoundsException\r
-    {\r
+    public void addJalviewModelSequence2Item(int index,\r
+        jalview.binding.JalviewModelSequence2Item vJalviewModelSequence2Item)\r
+        throws java.lang.IndexOutOfBoundsException {\r
         _items.insertElementAt(vJalviewModelSequence2Item, index);\r
-    } //-- void addJalviewModelSequence2Item(int, jalview.binding.JalviewModelSequence2Item)\r
+    }\r
+     //-- void addJalviewModelSequence2Item(int, jalview.binding.JalviewModelSequence2Item)\r
 \r
     /**\r
      * Method enumerateJalviewModelSequence2Item\r
@@ -108,10 +97,10 @@ public class JalviewModelSequence2 implements java.io.Serializable {
      *\r
      * @return Enumeration\r
      */\r
-    public java.util.Enumeration enumerateJalviewModelSequence2Item()\r
-    {\r
+    public java.util.Enumeration enumerateJalviewModelSequence2Item() {\r
         return _items.elements();\r
-    } //-- java.util.Enumeration enumerateJalviewModelSequence2Item()\r
+    }\r
+     //-- java.util.Enumeration enumerateJalviewModelSequence2Item()\r
 \r
     /**\r
      * Method getJalviewModelSequence2Item\r
@@ -121,16 +110,16 @@ public class JalviewModelSequence2 implements java.io.Serializable {
      * @param index\r
      * @return JalviewModelSequence2Item\r
      */\r
-    public jalview.binding.JalviewModelSequence2Item getJalviewModelSequence2Item(int index)\r
-        throws java.lang.IndexOutOfBoundsException\r
-    {\r
+    public jalview.binding.JalviewModelSequence2Item getJalviewModelSequence2Item(\r
+        int index) throws java.lang.IndexOutOfBoundsException {\r
         //-- check bounds for index\r
         if ((index < 0) || (index > _items.size())) {\r
             throw new IndexOutOfBoundsException();\r
         }\r
 \r
         return (jalview.binding.JalviewModelSequence2Item) _items.elementAt(index);\r
-    } //-- jalview.binding.JalviewModelSequence2Item getJalviewModelSequence2Item(int)\r
+    }\r
+     //-- jalview.binding.JalviewModelSequence2Item getJalviewModelSequence2Item(int)\r
 \r
     /**\r
      * Method getJalviewModelSequence2Item\r
@@ -139,15 +128,17 @@ public class JalviewModelSequence2 implements java.io.Serializable {
      *\r
      * @return JalviewModelSequence2Item\r
      */\r
-    public jalview.binding.JalviewModelSequence2Item[] getJalviewModelSequence2Item()\r
-    {\r
+    public jalview.binding.JalviewModelSequence2Item[] getJalviewModelSequence2Item() {\r
         int size = _items.size();\r
         jalview.binding.JalviewModelSequence2Item[] mArray = new jalview.binding.JalviewModelSequence2Item[size];\r
+\r
         for (int index = 0; index < size; index++) {\r
             mArray[index] = (jalview.binding.JalviewModelSequence2Item) _items.elementAt(index);\r
         }\r
+\r
         return mArray;\r
-    } //-- jalview.binding.JalviewModelSequence2Item[] getJalviewModelSequence2Item()\r
+    }\r
+     //-- jalview.binding.JalviewModelSequence2Item[] getJalviewModelSequence2Item()\r
 \r
     /**\r
      * Method getJalviewModelSequence2ItemCount\r
@@ -156,10 +147,10 @@ public class JalviewModelSequence2 implements java.io.Serializable {
      *\r
      * @return int\r
      */\r
-    public int getJalviewModelSequence2ItemCount()\r
-    {\r
+    public int getJalviewModelSequence2ItemCount() {\r
         return _items.size();\r
-    } //-- int getJalviewModelSequence2ItemCount()\r
+    }\r
+     //-- int getJalviewModelSequence2ItemCount()\r
 \r
     /**\r
      * Method isValid\r
@@ -168,16 +159,16 @@ public class JalviewModelSequence2 implements java.io.Serializable {
      *\r
      * @return boolean\r
      */\r
-    public boolean isValid()\r
-    {\r
+    public boolean isValid() {\r
         try {\r
             validate();\r
-        }\r
-        catch (org.exolab.castor.xml.ValidationException vex) {\r
+        } catch (org.exolab.castor.xml.ValidationException vex) {\r
             return false;\r
         }\r
+\r
         return true;\r
-    } //-- boolean isValid()\r
+    }\r
+     //-- boolean isValid()\r
 \r
     /**\r
      * Method marshal\r
@@ -187,11 +178,11 @@ public class JalviewModelSequence2 implements java.io.Serializable {
      * @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
+        throws org.exolab.castor.xml.MarshalException, \r
+            org.exolab.castor.xml.ValidationException {\r
         Marshaller.marshal(this, out);\r
-    } //-- void marshal(java.io.Writer)\r
+    }\r
+     //-- void marshal(java.io.Writer)\r
 \r
     /**\r
      * Method marshal\r
@@ -201,20 +192,20 @@ public class JalviewModelSequence2 implements java.io.Serializable {
      * @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
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, \r
+            org.exolab.castor.xml.ValidationException {\r
         Marshaller.marshal(this, handler);\r
-    } //-- void marshal(org.xml.sax.ContentHandler)\r
+    }\r
+     //-- void marshal(org.xml.sax.ContentHandler)\r
 \r
     /**\r
      * Method removeAllJalviewModelSequence2Item\r
      *\r
      */\r
-    public void removeAllJalviewModelSequence2Item()\r
-    {\r
+    public void removeAllJalviewModelSequence2Item() {\r
         _items.removeAllElements();\r
-    } //-- void removeAllJalviewModelSequence2Item()\r
+    }\r
+     //-- void removeAllJalviewModelSequence2Item()\r
 \r
     /**\r
      * Method removeJalviewModelSequence2Item\r
@@ -224,12 +215,14 @@ public class JalviewModelSequence2 implements java.io.Serializable {
      * @param index\r
      * @return JalviewModelSequence2Item\r
      */\r
-    public jalview.binding.JalviewModelSequence2Item removeJalviewModelSequence2Item(int index)\r
-    {\r
+    public jalview.binding.JalviewModelSequence2Item removeJalviewModelSequence2Item(\r
+        int index) {\r
         java.lang.Object obj = _items.elementAt(index);\r
         _items.removeElementAt(index);\r
+\r
         return (jalview.binding.JalviewModelSequence2Item) obj;\r
-    } //-- jalview.binding.JalviewModelSequence2Item removeJalviewModelSequence2Item(int)\r
+    }\r
+     //-- jalview.binding.JalviewModelSequence2Item removeJalviewModelSequence2Item(int)\r
 \r
     /**\r
      * Method setJalviewModelSequence2Item\r
@@ -239,15 +232,17 @@ public class JalviewModelSequence2 implements java.io.Serializable {
      * @param index\r
      * @param vJalviewModelSequence2Item\r
      */\r
-    public void setJalviewModelSequence2Item(int index, jalview.binding.JalviewModelSequence2Item vJalviewModelSequence2Item)\r
-        throws java.lang.IndexOutOfBoundsException\r
-    {\r
+    public void setJalviewModelSequence2Item(int index,\r
+        jalview.binding.JalviewModelSequence2Item vJalviewModelSequence2Item)\r
+        throws java.lang.IndexOutOfBoundsException {\r
         //-- check bounds for index\r
         if ((index < 0) || (index > _items.size())) {\r
             throw new IndexOutOfBoundsException();\r
         }\r
+\r
         _items.setElementAt(vJalviewModelSequence2Item, index);\r
-    } //-- void setJalviewModelSequence2Item(int, jalview.binding.JalviewModelSequence2Item)\r
+    }\r
+     //-- void setJalviewModelSequence2Item(int, jalview.binding.JalviewModelSequence2Item)\r
 \r
     /**\r
      * Method setJalviewModelSequence2Item\r
@@ -256,14 +251,16 @@ public class JalviewModelSequence2 implements java.io.Serializable {
      *\r
      * @param jalviewModelSequence2ItemArray\r
      */\r
-    public void setJalviewModelSequence2Item(jalview.binding.JalviewModelSequence2Item[] jalviewModelSequence2ItemArray)\r
-    {\r
+    public void setJalviewModelSequence2Item(\r
+        jalview.binding.JalviewModelSequence2Item[] jalviewModelSequence2ItemArray) {\r
         //-- copy array\r
         _items.removeAllElements();\r
+\r
         for (int i = 0; i < jalviewModelSequence2ItemArray.length; i++) {\r
             _items.addElement(jalviewModelSequence2ItemArray[i]);\r
         }\r
-    } //-- void setJalviewModelSequence2Item(jalview.binding.JalviewModelSequence2Item)\r
+    }\r
+     //-- void setJalviewModelSequence2Item(jalview.binding.JalviewModelSequence2Item)\r
 \r
     /**\r
      * Method unmarshal\r
@@ -274,20 +271,20 @@ public class JalviewModelSequence2 implements java.io.Serializable {
      * @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.binding.JalviewModelSequence2) Unmarshaller.unmarshal(jalview.binding.JalviewModelSequence2.class, reader);\r
-    } //-- java.lang.Object unmarshal(java.io.Reader)\r
+        throws org.exolab.castor.xml.MarshalException, \r
+            org.exolab.castor.xml.ValidationException {\r
+        return (jalview.binding.JalviewModelSequence2) Unmarshaller.unmarshal(jalview.binding.JalviewModelSequence2.class,\r
+            reader);\r
+    }\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
+    public void validate() throws org.exolab.castor.xml.ValidationException {\r
         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
         validator.validate(this);\r
-    } //-- void validate()\r
-\r
+    }\r
+     //-- void validate()\r
 }\r
index dcd3ebc..7998794 100755 (executable)
@@ -4,7 +4,6 @@
  * Schema.\r
  * $Id$\r
  */\r
-\r
 /*\r
 * Jalview - A Sequence Alignment Editor and Viewer\r
 * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\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.binding;\r
 \r
-  //---------------------------------/\r
- //- Imported classes and packages -/\r
-//---------------------------------/\r
+import org.exolab.castor.xml.Marshaller;\r
+import org.exolab.castor.xml.Unmarshaller;\r
 \r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
+//---------------------------------/\r
 import java.io.Serializable;\r
+\r
 import java.util.Enumeration;\r
 import java.util.Vector;\r
-import org.exolab.castor.xml.Marshaller;\r
-import org.exolab.castor.xml.Unmarshaller;\r
+\r
 \r
 /**\r
  * Class JalviewModelSequence2Item.\r
@@ -42,10 +42,8 @@ import org.exolab.castor.xml.Unmarshaller;
  * @version $Revision$ $Date$\r
  */\r
 public class JalviewModelSequence2Item implements java.io.Serializable {\r
-\r
-\r
-      //--------------------------/\r
-     //- Class/Member Variables -/\r
+    //--------------------------/\r
+    //- Class/Member Variables -/\r
     //--------------------------/\r
 \r
     /**\r
@@ -53,33 +51,22 @@ public class JalviewModelSequence2Item implements java.io.Serializable {
      */\r
     private java.util.Vector _userColourSchemeList;\r
 \r
-\r
-      //----------------/\r
-     //- Constructors -/\r
     //----------------/\r
-\r
+    //- Constructors -/\r
+    //----------------/\r
     public JalviewModelSequence2Item() {\r
         super();\r
         _userColourSchemeList = new Vector();\r
-    } //-- jalview.binding.JalviewModelSequence2Item()\r
-\r
+    }\r
+     //-- jalview.binding.JalviewModelSequence2Item()\r
+ //-----------/\r
 \r
-      //-----------/\r
-     //- Methods -/\r
-    //-----------/\r
-\r
-    /**\r
-     * Method addUserColourScheme\r
-     *\r
-     *\r
-     *\r
-     * @param vUserColourScheme\r
-     */\r
-    public void addUserColourScheme(jalview.binding.UserColourScheme vUserColourScheme)\r
-        throws java.lang.IndexOutOfBoundsException\r
-    {\r
+    public void addUserColourScheme(\r
+        jalview.binding.UserColourScheme vUserColourScheme)\r
+        throws java.lang.IndexOutOfBoundsException {\r
         _userColourSchemeList.addElement(vUserColourScheme);\r
-    } //-- void addUserColourScheme(jalview.binding.UserColourScheme)\r
+    }\r
+     //-- void addUserColourScheme(jalview.binding.UserColourScheme)\r
 \r
     /**\r
      * Method addUserColourScheme\r
@@ -89,11 +76,12 @@ public class JalviewModelSequence2Item implements java.io.Serializable {
      * @param index\r
      * @param vUserColourScheme\r
      */\r
-    public void addUserColourScheme(int index, jalview.binding.UserColourScheme vUserColourScheme)\r
-        throws java.lang.IndexOutOfBoundsException\r
-    {\r
+    public void addUserColourScheme(int index,\r
+        jalview.binding.UserColourScheme vUserColourScheme)\r
+        throws java.lang.IndexOutOfBoundsException {\r
         _userColourSchemeList.insertElementAt(vUserColourScheme, index);\r
-    } //-- void addUserColourScheme(int, jalview.binding.UserColourScheme)\r
+    }\r
+     //-- void addUserColourScheme(int, jalview.binding.UserColourScheme)\r
 \r
     /**\r
      * Method enumerateUserColourScheme\r
@@ -102,10 +90,10 @@ public class JalviewModelSequence2Item implements java.io.Serializable {
      *\r
      * @return Enumeration\r
      */\r
-    public java.util.Enumeration enumerateUserColourScheme()\r
-    {\r
+    public java.util.Enumeration enumerateUserColourScheme() {\r
         return _userColourSchemeList.elements();\r
-    } //-- java.util.Enumeration enumerateUserColourScheme()\r
+    }\r
+     //-- java.util.Enumeration enumerateUserColourScheme()\r
 \r
     /**\r
      * Method getUserColourScheme\r
@@ -116,15 +104,15 @@ public class JalviewModelSequence2Item implements java.io.Serializable {
      * @return UserColourScheme\r
      */\r
     public jalview.binding.UserColourScheme getUserColourScheme(int index)\r
-        throws java.lang.IndexOutOfBoundsException\r
-    {\r
+        throws java.lang.IndexOutOfBoundsException {\r
         //-- check bounds for index\r
         if ((index < 0) || (index > _userColourSchemeList.size())) {\r
             throw new IndexOutOfBoundsException();\r
         }\r
 \r
         return (jalview.binding.UserColourScheme) _userColourSchemeList.elementAt(index);\r
-    } //-- jalview.binding.UserColourScheme getUserColourScheme(int)\r
+    }\r
+     //-- jalview.binding.UserColourScheme getUserColourScheme(int)\r
 \r
     /**\r
      * Method getUserColourScheme\r
@@ -133,15 +121,17 @@ public class JalviewModelSequence2Item implements java.io.Serializable {
      *\r
      * @return UserColourScheme\r
      */\r
-    public jalview.binding.UserColourScheme[] getUserColourScheme()\r
-    {\r
+    public jalview.binding.UserColourScheme[] getUserColourScheme() {\r
         int size = _userColourSchemeList.size();\r
         jalview.binding.UserColourScheme[] mArray = new jalview.binding.UserColourScheme[size];\r
+\r
         for (int index = 0; index < size; index++) {\r
             mArray[index] = (jalview.binding.UserColourScheme) _userColourSchemeList.elementAt(index);\r
         }\r
+\r
         return mArray;\r
-    } //-- jalview.binding.UserColourScheme[] getUserColourScheme()\r
+    }\r
+     //-- jalview.binding.UserColourScheme[] getUserColourScheme()\r
 \r
     /**\r
      * Method getUserColourSchemeCount\r
@@ -150,19 +140,19 @@ public class JalviewModelSequence2Item implements java.io.Serializable {
      *\r
      * @return int\r
      */\r
-    public int getUserColourSchemeCount()\r
-    {\r
+    public int getUserColourSchemeCount() {\r
         return _userColourSchemeList.size();\r
-    } //-- int getUserColourSchemeCount()\r
+    }\r
+     //-- int getUserColourSchemeCount()\r
 \r
     /**\r
      * Method removeAllUserColourScheme\r
      *\r
      */\r
-    public void removeAllUserColourScheme()\r
-    {\r
+    public void removeAllUserColourScheme() {\r
         _userColourSchemeList.removeAllElements();\r
-    } //-- void removeAllUserColourScheme()\r
+    }\r
+     //-- void removeAllUserColourScheme()\r
 \r
     /**\r
      * Method removeUserColourScheme\r
@@ -172,12 +162,13 @@ public class JalviewModelSequence2Item implements java.io.Serializable {
      * @param index\r
      * @return UserColourScheme\r
      */\r
-    public jalview.binding.UserColourScheme removeUserColourScheme(int index)\r
-    {\r
+    public jalview.binding.UserColourScheme removeUserColourScheme(int index) {\r
         java.lang.Object obj = _userColourSchemeList.elementAt(index);\r
         _userColourSchemeList.removeElementAt(index);\r
+\r
         return (jalview.binding.UserColourScheme) obj;\r
-    } //-- jalview.binding.UserColourScheme removeUserColourScheme(int)\r
+    }\r
+     //-- jalview.binding.UserColourScheme removeUserColourScheme(int)\r
 \r
     /**\r
      * Method setUserColourScheme\r
@@ -187,15 +178,17 @@ public class JalviewModelSequence2Item implements java.io.Serializable {
      * @param index\r
      * @param vUserColourScheme\r
      */\r
-    public void setUserColourScheme(int index, jalview.binding.UserColourScheme vUserColourScheme)\r
-        throws java.lang.IndexOutOfBoundsException\r
-    {\r
+    public void setUserColourScheme(int index,\r
+        jalview.binding.UserColourScheme vUserColourScheme)\r
+        throws java.lang.IndexOutOfBoundsException {\r
         //-- check bounds for index\r
         if ((index < 0) || (index > _userColourSchemeList.size())) {\r
             throw new IndexOutOfBoundsException();\r
         }\r
+\r
         _userColourSchemeList.setElementAt(vUserColourScheme, index);\r
-    } //-- void setUserColourScheme(int, jalview.binding.UserColourScheme)\r
+    }\r
+     //-- void setUserColourScheme(int, jalview.binding.UserColourScheme)\r
 \r
     /**\r
      * Method setUserColourScheme\r
@@ -204,13 +197,14 @@ public class JalviewModelSequence2Item implements java.io.Serializable {
      *\r
      * @param userColourSchemeArray\r
      */\r
-    public void setUserColourScheme(jalview.binding.UserColourScheme[] userColourSchemeArray)\r
-    {\r
+    public void setUserColourScheme(\r
+        jalview.binding.UserColourScheme[] userColourSchemeArray) {\r
         //-- copy array\r
         _userColourSchemeList.removeAllElements();\r
+\r
         for (int i = 0; i < userColourSchemeArray.length; i++) {\r
             _userColourSchemeList.addElement(userColourSchemeArray[i]);\r
         }\r
-    } //-- void setUserColourScheme(jalview.binding.UserColourScheme)\r
-\r
+    }\r
+     //-- void setUserColourScheme(jalview.binding.UserColourScheme)\r
 }\r
index 354dc2f..bbb1b97 100755 (executable)
@@ -4,7 +4,6 @@
  * Schema.\r
  * $Id$\r
  */\r
-\r
 /*\r
 * Jalview - A Sequence Alignment Editor and Viewer\r
 * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\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.binding;\r
 \r
-  //---------------------------------/\r
- //- Imported classes and packages -/\r
-//---------------------------------/\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
+\r
+import org.xml.sax.ContentHandler;\r
 \r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
+//---------------------------------/\r
 import java.io.IOException;\r
 import java.io.Reader;\r
 import java.io.Serializable;\r
 import java.io.Writer;\r
+\r
 import java.util.Enumeration;\r
 import java.util.Vector;\r
-import org.exolab.castor.xml.MarshalException;\r
-import org.exolab.castor.xml.Marshaller;\r
-import org.exolab.castor.xml.Unmarshaller;\r
-import org.exolab.castor.xml.ValidationException;\r
-import org.xml.sax.ContentHandler;\r
+\r
 \r
 /**\r
  * Class JalviewUserColours.\r
@@ -48,10 +49,8 @@ import org.xml.sax.ContentHandler;
  * @version $Revision$ $Date$\r
  */\r
 public class JalviewUserColours implements java.io.Serializable {\r
-\r
-\r
-      //--------------------------/\r
-     //- Class/Member Variables -/\r
+    //--------------------------/\r
+    //- Class/Member Variables -/\r
     //--------------------------/\r
 \r
     /**\r
@@ -59,33 +58,21 @@ public class JalviewUserColours implements java.io.Serializable {
      */\r
     private java.util.Vector _colourList;\r
 \r
-\r
-      //----------------/\r
-     //- Constructors -/\r
     //----------------/\r
-\r
+    //- Constructors -/\r
+    //----------------/\r
     public JalviewUserColours() {\r
         super();\r
         _colourList = new Vector();\r
-    } //-- jalview.binding.JalviewUserColours()\r
-\r
+    }\r
+     //-- jalview.binding.JalviewUserColours()\r
+ //-----------/\r
 \r
-      //-----------/\r
-     //- Methods -/\r
-    //-----------/\r
-\r
-    /**\r
-     * Method addColour\r
-     *\r
-     *\r
-     *\r
-     * @param vColour\r
-     */\r
     public void addColour(jalview.binding.Colour vColour)\r
-        throws java.lang.IndexOutOfBoundsException\r
-    {\r
+        throws java.lang.IndexOutOfBoundsException {\r
         _colourList.addElement(vColour);\r
-    } //-- void addColour(jalview.binding.Colour)\r
+    }\r
+     //-- void addColour(jalview.binding.Colour)\r
 \r
     /**\r
      * Method addColour\r
@@ -96,10 +83,10 @@ public class JalviewUserColours implements java.io.Serializable {
      * @param vColour\r
      */\r
     public void addColour(int index, jalview.binding.Colour vColour)\r
-        throws java.lang.IndexOutOfBoundsException\r
-    {\r
+        throws java.lang.IndexOutOfBoundsException {\r
         _colourList.insertElementAt(vColour, index);\r
-    } //-- void addColour(int, jalview.binding.Colour)\r
+    }\r
+     //-- void addColour(int, jalview.binding.Colour)\r
 \r
     /**\r
      * Method enumerateColour\r
@@ -108,10 +95,10 @@ public class JalviewUserColours implements java.io.Serializable {
      *\r
      * @return Enumeration\r
      */\r
-    public java.util.Enumeration enumerateColour()\r
-    {\r
+    public java.util.Enumeration enumerateColour() {\r
         return _colourList.elements();\r
-    } //-- java.util.Enumeration enumerateColour()\r
+    }\r
+     //-- java.util.Enumeration enumerateColour()\r
 \r
     /**\r
      * Method getColour\r
@@ -122,15 +109,15 @@ public class JalviewUserColours implements java.io.Serializable {
      * @return Colour\r
      */\r
     public jalview.binding.Colour getColour(int index)\r
-        throws java.lang.IndexOutOfBoundsException\r
-    {\r
+        throws java.lang.IndexOutOfBoundsException {\r
         //-- check bounds for index\r
         if ((index < 0) || (index > _colourList.size())) {\r
             throw new IndexOutOfBoundsException();\r
         }\r
 \r
         return (jalview.binding.Colour) _colourList.elementAt(index);\r
-    } //-- jalview.binding.Colour getColour(int)\r
+    }\r
+     //-- jalview.binding.Colour getColour(int)\r
 \r
     /**\r
      * Method getColour\r
@@ -139,15 +126,17 @@ public class JalviewUserColours implements java.io.Serializable {
      *\r
      * @return Colour\r
      */\r
-    public jalview.binding.Colour[] getColour()\r
-    {\r
+    public jalview.binding.Colour[] getColour() {\r
         int size = _colourList.size();\r
         jalview.binding.Colour[] mArray = new jalview.binding.Colour[size];\r
+\r
         for (int index = 0; index < size; index++) {\r
             mArray[index] = (jalview.binding.Colour) _colourList.elementAt(index);\r
         }\r
+\r
         return mArray;\r
-    } //-- jalview.binding.Colour[] getColour()\r
+    }\r
+     //-- jalview.binding.Colour[] getColour()\r
 \r
     /**\r
      * Method getColourCount\r
@@ -156,10 +145,10 @@ public class JalviewUserColours implements java.io.Serializable {
      *\r
      * @return int\r
      */\r
-    public int getColourCount()\r
-    {\r
+    public int getColourCount() {\r
         return _colourList.size();\r
-    } //-- int getColourCount()\r
+    }\r
+     //-- int getColourCount()\r
 \r
     /**\r
      * Method isValid\r
@@ -168,16 +157,16 @@ public class JalviewUserColours implements java.io.Serializable {
      *\r
      * @return boolean\r
      */\r
-    public boolean isValid()\r
-    {\r
+    public boolean isValid() {\r
         try {\r
             validate();\r
-        }\r
-        catch (org.exolab.castor.xml.ValidationException vex) {\r
+        } catch (org.exolab.castor.xml.ValidationException vex) {\r
             return false;\r
         }\r
+\r
         return true;\r
-    } //-- boolean isValid()\r
+    }\r
+     //-- boolean isValid()\r
 \r
     /**\r
      * Method marshal\r
@@ -187,11 +176,11 @@ public class JalviewUserColours implements java.io.Serializable {
      * @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
+        throws org.exolab.castor.xml.MarshalException, \r
+            org.exolab.castor.xml.ValidationException {\r
         Marshaller.marshal(this, out);\r
-    } //-- void marshal(java.io.Writer)\r
+    }\r
+     //-- void marshal(java.io.Writer)\r
 \r
     /**\r
      * Method marshal\r
@@ -201,20 +190,20 @@ public class JalviewUserColours implements java.io.Serializable {
      * @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
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, \r
+            org.exolab.castor.xml.ValidationException {\r
         Marshaller.marshal(this, handler);\r
-    } //-- void marshal(org.xml.sax.ContentHandler)\r
+    }\r
+     //-- void marshal(org.xml.sax.ContentHandler)\r
 \r
     /**\r
      * Method removeAllColour\r
      *\r
      */\r
-    public void removeAllColour()\r
-    {\r
+    public void removeAllColour() {\r
         _colourList.removeAllElements();\r
-    } //-- void removeAllColour()\r
+    }\r
+     //-- void removeAllColour()\r
 \r
     /**\r
      * Method removeColour\r
@@ -224,12 +213,13 @@ public class JalviewUserColours implements java.io.Serializable {
      * @param index\r
      * @return Colour\r
      */\r
-    public jalview.binding.Colour removeColour(int index)\r
-    {\r
+    public jalview.binding.Colour removeColour(int index) {\r
         java.lang.Object obj = _colourList.elementAt(index);\r
         _colourList.removeElementAt(index);\r
+\r
         return (jalview.binding.Colour) obj;\r
-    } //-- jalview.binding.Colour removeColour(int)\r
+    }\r
+     //-- jalview.binding.Colour removeColour(int)\r
 \r
     /**\r
      * Method setColour\r
@@ -240,14 +230,15 @@ public class JalviewUserColours implements java.io.Serializable {
      * @param vColour\r
      */\r
     public void setColour(int index, jalview.binding.Colour vColour)\r
-        throws java.lang.IndexOutOfBoundsException\r
-    {\r
+        throws java.lang.IndexOutOfBoundsException {\r
         //-- check bounds for index\r
         if ((index < 0) || (index > _colourList.size())) {\r
             throw new IndexOutOfBoundsException();\r
         }\r
+\r
         _colourList.setElementAt(vColour, index);\r
-    } //-- void setColour(int, jalview.binding.Colour)\r
+    }\r
+     //-- void setColour(int, jalview.binding.Colour)\r
 \r
     /**\r
      * Method setColour\r
@@ -256,14 +247,15 @@ public class JalviewUserColours implements java.io.Serializable {
      *\r
      * @param colourArray\r
      */\r
-    public void setColour(jalview.binding.Colour[] colourArray)\r
-    {\r
+    public void setColour(jalview.binding.Colour[] colourArray) {\r
         //-- copy array\r
         _colourList.removeAllElements();\r
+\r
         for (int i = 0; i < colourArray.length; i++) {\r
             _colourList.addElement(colourArray[i]);\r
         }\r
-    } //-- void setColour(jalview.binding.Colour)\r
+    }\r
+     //-- void setColour(jalview.binding.Colour)\r
 \r
     /**\r
      * Method unmarshal\r
@@ -274,20 +266,20 @@ public class JalviewUserColours implements java.io.Serializable {
      * @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.binding.JalviewUserColours) Unmarshaller.unmarshal(jalview.binding.JalviewUserColours.class, reader);\r
-    } //-- java.lang.Object unmarshal(java.io.Reader)\r
+        throws org.exolab.castor.xml.MarshalException, \r
+            org.exolab.castor.xml.ValidationException {\r
+        return (jalview.binding.JalviewUserColours) Unmarshaller.unmarshal(jalview.binding.JalviewUserColours.class,\r
+            reader);\r
+    }\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
+    public void validate() throws org.exolab.castor.xml.ValidationException {\r
         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
         validator.validate(this);\r
-    } //-- void validate()\r
-\r
+    }\r
+     //-- void validate()\r
 }\r
index b7abdc5..ae96562 100755 (executable)
@@ -4,7 +4,6 @@
  * Schema.\r
  * $Id$\r
  */\r
-\r
 /*\r
 * Jalview - A Sequence Alignment Editor and Viewer\r
 * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\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.binding;\r
 \r
-  //---------------------------------/\r
- //- Imported classes and packages -/\r
-//---------------------------------/\r
-\r
-import java.io.Serializable;\r
 import org.exolab.castor.xml.Marshaller;\r
 import org.exolab.castor.xml.Unmarshaller;\r
 \r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
+//---------------------------------/\r
+import java.io.Serializable;\r
+\r
+\r
 /**\r
  * Class JalviewUserColoursItem.\r
  *\r
  * @version $Revision$ $Date$\r
  */\r
 public class JalviewUserColoursItem implements java.io.Serializable {\r
-\r
-\r
-      //--------------------------/\r
-     //- Class/Member Variables -/\r
+    //--------------------------/\r
+    //- Class/Member Variables -/\r
     //--------------------------/\r
 \r
     /**\r
@@ -51,39 +48,27 @@ public class JalviewUserColoursItem implements java.io.Serializable {
      */\r
     private jalview.binding.Colour _colour;\r
 \r
-\r
-      //----------------/\r
-     //- Constructors -/\r
     //----------------/\r
-\r
+    //- Constructors -/\r
+    //----------------/\r
     public JalviewUserColoursItem() {\r
         super();\r
-    } //-- jalview.binding.JalviewUserColoursItem()\r
-\r
+    }\r
+     //-- jalview.binding.JalviewUserColoursItem()\r
+ //-----------/\r
 \r
-      //-----------/\r
-     //- Methods -/\r
-    //-----------/\r
-\r
-    /**\r
-     * Returns the value of field 'colour'.\r
-     *\r
-     * @return Colour\r
-     * @return the value of field 'colour'.\r
-     */\r
-    public jalview.binding.Colour getColour()\r
-    {\r
+    public jalview.binding.Colour getColour() {\r
         return this._colour;\r
-    } //-- jalview.binding.Colour getColour()\r
+    }\r
+     //-- jalview.binding.Colour getColour()\r
 \r
     /**\r
      * Sets the value of field 'colour'.\r
      *\r
      * @param colour the value of field 'colour'.\r
      */\r
-    public void setColour(jalview.binding.Colour colour)\r
-    {\r
+    public void setColour(jalview.binding.Colour colour) {\r
         this._colour = colour;\r
-    } //-- void setColour(jalview.binding.Colour)\r
-\r
+    }\r
+     //-- void setColour(jalview.binding.Colour)\r
 }\r
index 9e68130..ff0cb63 100755 (executable)
@@ -4,7 +4,6 @@
  * Schema.\r
  * $Id$\r
  */\r
-\r
 /*\r
 * Jalview - A Sequence Alignment Editor and Viewer\r
 * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\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.binding;\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
+\r
 import org.xml.sax.ContentHandler;\r
 \r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
+//---------------------------------/\r
+import java.io.IOException;\r
+import java.io.Reader;\r
+import java.io.Serializable;\r
+import java.io.Writer;\r
+\r
+\r
 /**\r
  * Class Residue.\r
  *\r
  * @version $Revision$ $Date$\r
  */\r
 public class Residue implements java.io.Serializable {\r
-\r
-\r
-      //--------------------------/\r
-     //- Class/Member Variables -/\r
+    //--------------------------/\r
+    //- Class/Member Variables -/\r
     //--------------------------/\r
 \r
     /**\r
@@ -67,28 +65,19 @@ public class Residue implements java.io.Serializable {
      */\r
     private boolean _has_RGB;\r
 \r
-\r
-      //----------------/\r
-     //- Constructors -/\r
     //----------------/\r
-\r
+    //- Constructors -/\r
+    //----------------/\r
     public Residue() {\r
         super();\r
-    } //-- jalview.binding.Residue()\r
-\r
-\r
-      //-----------/\r
-     //- Methods -/\r
-    //-----------/\r
+    }\r
+     //-- jalview.binding.Residue()\r
+ //-----------/\r
 \r
-    /**\r
-     * Method deleteRGB\r
-     *\r
-     */\r
-    public void deleteRGB()\r
-    {\r
-        this._has_RGB= false;\r
-    } //-- void deleteRGB()\r
+    public void deleteRGB() {\r
+        this._has_RGB = false;\r
+    }\r
+     //-- void deleteRGB()\r
 \r
     /**\r
      * Returns the value of field 'name'.\r
@@ -96,10 +85,10 @@ public class Residue implements java.io.Serializable {
      * @return String\r
      * @return the value of field 'name'.\r
      */\r
-    public java.lang.String getName()\r
-    {\r
+    public java.lang.String getName() {\r
         return this._name;\r
-    } //-- java.lang.String getName()\r
+    }\r
+     //-- java.lang.String getName()\r
 \r
     /**\r
      * Returns the value of field 'RGB'.\r
@@ -107,10 +96,10 @@ public class Residue implements java.io.Serializable {
      * @return int\r
      * @return the value of field 'RGB'.\r
      */\r
-    public int getRGB()\r
-    {\r
+    public int getRGB() {\r
         return this._RGB;\r
-    } //-- int getRGB()\r
+    }\r
+     //-- int getRGB()\r
 \r
     /**\r
      * Method hasRGB\r
@@ -119,10 +108,10 @@ public class Residue implements java.io.Serializable {
      *\r
      * @return boolean\r
      */\r
-    public boolean hasRGB()\r
-    {\r
+    public boolean hasRGB() {\r
         return this._has_RGB;\r
-    } //-- boolean hasRGB()\r
+    }\r
+     //-- boolean hasRGB()\r
 \r
     /**\r
      * Method isValid\r
@@ -131,16 +120,16 @@ public class Residue implements java.io.Serializable {
      *\r
      * @return boolean\r
      */\r
-    public boolean isValid()\r
-    {\r
+    public boolean isValid() {\r
         try {\r
             validate();\r
-        }\r
-        catch (org.exolab.castor.xml.ValidationException vex) {\r
+        } catch (org.exolab.castor.xml.ValidationException vex) {\r
             return false;\r
         }\r
+\r
         return true;\r
-    } //-- boolean isValid()\r
+    }\r
+     //-- boolean isValid()\r
 \r
     /**\r
      * Method marshal\r
@@ -150,11 +139,11 @@ public class Residue implements java.io.Serializable {
      * @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
+        throws org.exolab.castor.xml.MarshalException, \r
+            org.exolab.castor.xml.ValidationException {\r
         Marshaller.marshal(this, out);\r
-    } //-- void marshal(java.io.Writer)\r
+    }\r
+     //-- void marshal(java.io.Writer)\r
 \r
     /**\r
      * Method marshal\r
@@ -164,32 +153,32 @@ public class Residue implements java.io.Serializable {
      * @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
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, \r
+            org.exolab.castor.xml.ValidationException {\r
         Marshaller.marshal(this, handler);\r
-    } //-- void marshal(org.xml.sax.ContentHandler)\r
+    }\r
+     //-- void marshal(org.xml.sax.ContentHandler)\r
 \r
     /**\r
      * Sets the value of field 'name'.\r
      *\r
      * @param name the value of field 'name'.\r
      */\r
-    public void setName(java.lang.String name)\r
-    {\r
+    public void setName(java.lang.String name) {\r
         this._name = name;\r
-    } //-- void setName(java.lang.String)\r
+    }\r
+     //-- void setName(java.lang.String)\r
 \r
     /**\r
      * Sets the value of field 'RGB'.\r
      *\r
      * @param RGB the value of field 'RGB'.\r
      */\r
-    public void setRGB(int RGB)\r
-    {\r
+    public void setRGB(int RGB) {\r
         this._RGB = RGB;\r
         this._has_RGB = true;\r
-    } //-- void setRGB(int)\r
+    }\r
+     //-- void setRGB(int)\r
 \r
     /**\r
      * Method unmarshal\r
@@ -200,20 +189,20 @@ public class Residue implements java.io.Serializable {
      * @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.binding.Residue) Unmarshaller.unmarshal(jalview.binding.Residue.class, reader);\r
-    } //-- java.lang.Object unmarshal(java.io.Reader)\r
+        throws org.exolab.castor.xml.MarshalException, \r
+            org.exolab.castor.xml.ValidationException {\r
+        return (jalview.binding.Residue) Unmarshaller.unmarshal(jalview.binding.Residue.class,\r
+            reader);\r
+    }\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
+    public void validate() throws org.exolab.castor.xml.ValidationException {\r
         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
         validator.validate(this);\r
-    } //-- void validate()\r
-\r
+    }\r
+     //-- void validate()\r
 }\r
index 290354e..628e209 100755 (executable)
@@ -4,7 +4,6 @@
  * Schema.\r
  * $Id$\r
  */\r
-\r
 /*\r
 * Jalview - A Sequence Alignment Editor and Viewer\r
 * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\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.binding;\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
+\r
 import org.xml.sax.ContentHandler;\r
 \r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
+//---------------------------------/\r
+import java.io.IOException;\r
+import java.io.Reader;\r
+import java.io.Serializable;\r
+import java.io.Writer;\r
+\r
+\r
 /**\r
  * Class Sequence.\r
  *\r
  * @version $Revision$ $Date$\r
  */\r
-public class Sequence extends SequenceType\r
-implements java.io.Serializable\r
-{\r
-\r
-\r
-      //----------------/\r
-     //- Constructors -/\r
+public class Sequence extends SequenceType implements java.io.Serializable {\r
+    //----------------/\r
+    //- Constructors -/\r
     //----------------/\r
-\r
     public Sequence() {\r
         super();\r
-    } //-- jalview.binding.Sequence()\r
+    }\r
+     //-- jalview.binding.Sequence()\r
+ //-----------/\r
 \r
-\r
-      //-----------/\r
-     //- Methods -/\r
-    //-----------/\r
-\r
-    /**\r
-     * Method isValid\r
-     *\r
-     *\r
-     *\r
-     * @return boolean\r
-     */\r
-    public boolean isValid()\r
-    {\r
+    public boolean isValid() {\r
         try {\r
             validate();\r
-        }\r
-        catch (org.exolab.castor.xml.ValidationException vex) {\r
+        } catch (org.exolab.castor.xml.ValidationException vex) {\r
             return false;\r
         }\r
+\r
         return true;\r
-    } //-- boolean isValid()\r
+    }\r
+     //-- boolean isValid()\r
 \r
     /**\r
      * Method marshal\r
@@ -89,11 +74,11 @@ implements java.io.Serializable
      * @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
+        throws org.exolab.castor.xml.MarshalException, \r
+            org.exolab.castor.xml.ValidationException {\r
         Marshaller.marshal(this, out);\r
-    } //-- void marshal(java.io.Writer)\r
+    }\r
+     //-- void marshal(java.io.Writer)\r
 \r
     /**\r
      * Method marshal\r
@@ -103,11 +88,11 @@ implements java.io.Serializable
      * @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
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, \r
+            org.exolab.castor.xml.ValidationException {\r
         Marshaller.marshal(this, handler);\r
-    } //-- void marshal(org.xml.sax.ContentHandler)\r
+    }\r
+     //-- void marshal(org.xml.sax.ContentHandler)\r
 \r
     /**\r
      * Method unmarshal\r
@@ -118,20 +103,20 @@ implements java.io.Serializable
      * @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.binding.Sequence) Unmarshaller.unmarshal(jalview.binding.Sequence.class, reader);\r
-    } //-- java.lang.Object unmarshal(java.io.Reader)\r
+        throws org.exolab.castor.xml.MarshalException, \r
+            org.exolab.castor.xml.ValidationException {\r
+        return (jalview.binding.Sequence) Unmarshaller.unmarshal(jalview.binding.Sequence.class,\r
+            reader);\r
+    }\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
+    public void validate() throws org.exolab.castor.xml.ValidationException {\r
         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
         validator.validate(this);\r
-    } //-- void validate()\r
-\r
+    }\r
+     //-- void validate()\r
 }\r
index 7ef5fe7..4300c39 100755 (executable)
@@ -4,7 +4,6 @@
  * Schema.\r
  * $Id$\r
  */\r
-\r
 /*\r
 * Jalview - A Sequence Alignment Editor and Viewer\r
 * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\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.binding;\r
 \r
-  //---------------------------------/\r
- //- Imported classes and packages -/\r
-//---------------------------------/\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
+\r
+import org.xml.sax.ContentHandler;\r
 \r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
+//---------------------------------/\r
 import java.io.IOException;\r
 import java.io.Reader;\r
 import java.io.Serializable;\r
 import java.io.Writer;\r
+\r
 import java.util.Enumeration;\r
 import java.util.Vector;\r
-import org.exolab.castor.xml.MarshalException;\r
-import org.exolab.castor.xml.Marshaller;\r
-import org.exolab.castor.xml.Unmarshaller;\r
-import org.exolab.castor.xml.ValidationException;\r
-import org.xml.sax.ContentHandler;\r
+\r
 \r
 /**\r
  * Class SequenceSet.\r
@@ -48,10 +49,8 @@ import org.xml.sax.ContentHandler;
  * @version $Revision$ $Date$\r
  */\r
 public class SequenceSet implements java.io.Serializable {\r
-\r
-\r
-      //--------------------------/\r
-     //- Class/Member Variables -/\r
+    //--------------------------/\r
+    //- Class/Member Variables -/\r
     //--------------------------/\r
 \r
     /**\r
@@ -79,34 +78,22 @@ public class SequenceSet implements java.io.Serializable {
      */\r
     private java.util.Vector _annotationList;\r
 \r
-\r
-      //----------------/\r
-     //- Constructors -/\r
     //----------------/\r
-\r
+    //- Constructors -/\r
+    //----------------/\r
     public SequenceSet() {\r
         super();\r
         _sequenceList = new Vector();\r
         _annotationList = new Vector();\r
-    } //-- jalview.binding.SequenceSet()\r
+    }\r
+     //-- jalview.binding.SequenceSet()\r
+ //-----------/\r
 \r
-\r
-      //-----------/\r
-     //- Methods -/\r
-    //-----------/\r
-\r
-    /**\r
-     * Method addAnnotation\r
-     *\r
-     *\r
-     *\r
-     * @param vAnnotation\r
-     */\r
     public void addAnnotation(jalview.binding.Annotation vAnnotation)\r
-        throws java.lang.IndexOutOfBoundsException\r
-    {\r
+        throws java.lang.IndexOutOfBoundsException {\r
         _annotationList.addElement(vAnnotation);\r
-    } //-- void addAnnotation(jalview.binding.Annotation)\r
+    }\r
+     //-- void addAnnotation(jalview.binding.Annotation)\r
 \r
     /**\r
      * Method addAnnotation\r
@@ -117,10 +104,10 @@ public class SequenceSet implements java.io.Serializable {
      * @param vAnnotation\r
      */\r
     public void addAnnotation(int index, jalview.binding.Annotation vAnnotation)\r
-        throws java.lang.IndexOutOfBoundsException\r
-    {\r
+        throws java.lang.IndexOutOfBoundsException {\r
         _annotationList.insertElementAt(vAnnotation, index);\r
-    } //-- void addAnnotation(int, jalview.binding.Annotation)\r
+    }\r
+     //-- void addAnnotation(int, jalview.binding.Annotation)\r
 \r
     /**\r
      * Method addSequence\r
@@ -130,10 +117,10 @@ public class SequenceSet implements java.io.Serializable {
      * @param vSequence\r
      */\r
     public void addSequence(jalview.binding.Sequence vSequence)\r
-        throws java.lang.IndexOutOfBoundsException\r
-    {\r
+        throws java.lang.IndexOutOfBoundsException {\r
         _sequenceList.addElement(vSequence);\r
-    } //-- void addSequence(jalview.binding.Sequence)\r
+    }\r
+     //-- void addSequence(jalview.binding.Sequence)\r
 \r
     /**\r
      * Method addSequence\r
@@ -144,19 +131,19 @@ public class SequenceSet implements java.io.Serializable {
      * @param vSequence\r
      */\r
     public void addSequence(int index, jalview.binding.Sequence vSequence)\r
-        throws java.lang.IndexOutOfBoundsException\r
-    {\r
+        throws java.lang.IndexOutOfBoundsException {\r
         _sequenceList.insertElementAt(vSequence, index);\r
-    } //-- void addSequence(int, jalview.binding.Sequence)\r
+    }\r
+     //-- void addSequence(int, jalview.binding.Sequence)\r
 \r
     /**\r
      * Method deleteAligned\r
      *\r
      */\r
-    public void deleteAligned()\r
-    {\r
-        this._has_aligned= false;\r
-    } //-- void deleteAligned()\r
+    public void deleteAligned() {\r
+        this._has_aligned = false;\r
+    }\r
+     //-- void deleteAligned()\r
 \r
     /**\r
      * Method enumerateAnnotation\r
@@ -165,10 +152,10 @@ public class SequenceSet implements java.io.Serializable {
      *\r
      * @return Enumeration\r
      */\r
-    public java.util.Enumeration enumerateAnnotation()\r
-    {\r
+    public java.util.Enumeration enumerateAnnotation() {\r
         return _annotationList.elements();\r
-    } //-- java.util.Enumeration enumerateAnnotation()\r
+    }\r
+     //-- java.util.Enumeration enumerateAnnotation()\r
 \r
     /**\r
      * Method enumerateSequence\r
@@ -177,10 +164,10 @@ public class SequenceSet implements java.io.Serializable {
      *\r
      * @return Enumeration\r
      */\r
-    public java.util.Enumeration enumerateSequence()\r
-    {\r
+    public java.util.Enumeration enumerateSequence() {\r
         return _sequenceList.elements();\r
-    } //-- java.util.Enumeration enumerateSequence()\r
+    }\r
+     //-- java.util.Enumeration enumerateSequence()\r
 \r
     /**\r
      * Returns the value of field 'aligned'.\r
@@ -188,10 +175,10 @@ public class SequenceSet implements java.io.Serializable {
      * @return boolean\r
      * @return the value of field 'aligned'.\r
      */\r
-    public boolean getAligned()\r
-    {\r
+    public boolean getAligned() {\r
         return this._aligned;\r
-    } //-- boolean getAligned()\r
+    }\r
+     //-- boolean getAligned()\r
 \r
     /**\r
      * Method getAnnotation\r
@@ -202,15 +189,15 @@ public class SequenceSet implements java.io.Serializable {
      * @return Annotation\r
      */\r
     public jalview.binding.Annotation getAnnotation(int index)\r
-        throws java.lang.IndexOutOfBoundsException\r
-    {\r
+        throws java.lang.IndexOutOfBoundsException {\r
         //-- check bounds for index\r
         if ((index < 0) || (index > _annotationList.size())) {\r
             throw new IndexOutOfBoundsException();\r
         }\r
 \r
         return (jalview.binding.Annotation) _annotationList.elementAt(index);\r
-    } //-- jalview.binding.Annotation getAnnotation(int)\r
+    }\r
+     //-- jalview.binding.Annotation getAnnotation(int)\r
 \r
     /**\r
      * Method getAnnotation\r
@@ -219,15 +206,17 @@ public class SequenceSet implements java.io.Serializable {
      *\r
      * @return Annotation\r
      */\r
-    public jalview.binding.Annotation[] getAnnotation()\r
-    {\r
+    public jalview.binding.Annotation[] getAnnotation() {\r
         int size = _annotationList.size();\r
         jalview.binding.Annotation[] mArray = new jalview.binding.Annotation[size];\r
+\r
         for (int index = 0; index < size; index++) {\r
             mArray[index] = (jalview.binding.Annotation) _annotationList.elementAt(index);\r
         }\r
+\r
         return mArray;\r
-    } //-- jalview.binding.Annotation[] getAnnotation()\r
+    }\r
+     //-- jalview.binding.Annotation[] getAnnotation()\r
 \r
     /**\r
      * Method getAnnotationCount\r
@@ -236,10 +225,10 @@ public class SequenceSet implements java.io.Serializable {
      *\r
      * @return int\r
      */\r
-    public int getAnnotationCount()\r
-    {\r
+    public int getAnnotationCount() {\r
         return _annotationList.size();\r
-    } //-- int getAnnotationCount()\r
+    }\r
+     //-- int getAnnotationCount()\r
 \r
     /**\r
      * Returns the value of field 'gapChar'.\r
@@ -247,10 +236,10 @@ public class SequenceSet implements java.io.Serializable {
      * @return String\r
      * @return the value of field 'gapChar'.\r
      */\r
-    public java.lang.String getGapChar()\r
-    {\r
+    public java.lang.String getGapChar() {\r
         return this._gapChar;\r
-    } //-- java.lang.String getGapChar()\r
+    }\r
+     //-- java.lang.String getGapChar()\r
 \r
     /**\r
      * Method getSequence\r
@@ -261,15 +250,15 @@ public class SequenceSet implements java.io.Serializable {
      * @return Sequence\r
      */\r
     public jalview.binding.Sequence getSequence(int index)\r
-        throws java.lang.IndexOutOfBoundsException\r
-    {\r
+        throws java.lang.IndexOutOfBoundsException {\r
         //-- check bounds for index\r
         if ((index < 0) || (index > _sequenceList.size())) {\r
             throw new IndexOutOfBoundsException();\r
         }\r
 \r
         return (jalview.binding.Sequence) _sequenceList.elementAt(index);\r
-    } //-- jalview.binding.Sequence getSequence(int)\r
+    }\r
+     //-- jalview.binding.Sequence getSequence(int)\r
 \r
     /**\r
      * Method getSequence\r
@@ -278,15 +267,17 @@ public class SequenceSet implements java.io.Serializable {
      *\r
      * @return Sequence\r
      */\r
-    public jalview.binding.Sequence[] getSequence()\r
-    {\r
+    public jalview.binding.Sequence[] getSequence() {\r
         int size = _sequenceList.size();\r
         jalview.binding.Sequence[] mArray = new jalview.binding.Sequence[size];\r
+\r
         for (int index = 0; index < size; index++) {\r
             mArray[index] = (jalview.binding.Sequence) _sequenceList.elementAt(index);\r
         }\r
+\r
         return mArray;\r
-    } //-- jalview.binding.Sequence[] getSequence()\r
+    }\r
+     //-- jalview.binding.Sequence[] getSequence()\r
 \r
     /**\r
      * Method getSequenceCount\r
@@ -295,10 +286,10 @@ public class SequenceSet implements java.io.Serializable {
      *\r
      * @return int\r
      */\r
-    public int getSequenceCount()\r
-    {\r
+    public int getSequenceCount() {\r
         return _sequenceList.size();\r
-    } //-- int getSequenceCount()\r
+    }\r
+     //-- int getSequenceCount()\r
 \r
     /**\r
      * Method hasAligned\r
@@ -307,10 +298,10 @@ public class SequenceSet implements java.io.Serializable {
      *\r
      * @return boolean\r
      */\r
-    public boolean hasAligned()\r
-    {\r
+    public boolean hasAligned() {\r
         return this._has_aligned;\r
-    } //-- boolean hasAligned()\r
+    }\r
+     //-- boolean hasAligned()\r
 \r
     /**\r
      * Method isValid\r
@@ -319,16 +310,16 @@ public class SequenceSet implements java.io.Serializable {
      *\r
      * @return boolean\r
      */\r
-    public boolean isValid()\r
-    {\r
+    public boolean isValid() {\r
         try {\r
             validate();\r
-        }\r
-        catch (org.exolab.castor.xml.ValidationException vex) {\r
+        } catch (org.exolab.castor.xml.ValidationException vex) {\r
             return false;\r
         }\r
+\r
         return true;\r
-    } //-- boolean isValid()\r
+    }\r
+     //-- boolean isValid()\r
 \r
     /**\r
      * Method marshal\r
@@ -338,11 +329,11 @@ public class SequenceSet implements java.io.Serializable {
      * @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
+        throws org.exolab.castor.xml.MarshalException, \r
+            org.exolab.castor.xml.ValidationException {\r
         Marshaller.marshal(this, out);\r
-    } //-- void marshal(java.io.Writer)\r
+    }\r
+     //-- void marshal(java.io.Writer)\r
 \r
     /**\r
      * Method marshal\r
@@ -352,29 +343,29 @@ public class SequenceSet implements java.io.Serializable {
      * @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
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, \r
+            org.exolab.castor.xml.ValidationException {\r
         Marshaller.marshal(this, handler);\r
-    } //-- void marshal(org.xml.sax.ContentHandler)\r
+    }\r
+     //-- void marshal(org.xml.sax.ContentHandler)\r
 \r
     /**\r
      * Method removeAllAnnotation\r
      *\r
      */\r
-    public void removeAllAnnotation()\r
-    {\r
+    public void removeAllAnnotation() {\r
         _annotationList.removeAllElements();\r
-    } //-- void removeAllAnnotation()\r
+    }\r
+     //-- void removeAllAnnotation()\r
 \r
     /**\r
      * Method removeAllSequence\r
      *\r
      */\r
-    public void removeAllSequence()\r
-    {\r
+    public void removeAllSequence() {\r
         _sequenceList.removeAllElements();\r
-    } //-- void removeAllSequence()\r
+    }\r
+     //-- void removeAllSequence()\r
 \r
     /**\r
      * Method removeAnnotation\r
@@ -384,12 +375,13 @@ public class SequenceSet implements java.io.Serializable {
      * @param index\r
      * @return Annotation\r
      */\r
-    public jalview.binding.Annotation removeAnnotation(int index)\r
-    {\r
+    public jalview.binding.Annotation removeAnnotation(int index) {\r
         java.lang.Object obj = _annotationList.elementAt(index);\r
         _annotationList.removeElementAt(index);\r
+\r
         return (jalview.binding.Annotation) obj;\r
-    } //-- jalview.binding.Annotation removeAnnotation(int)\r
+    }\r
+     //-- jalview.binding.Annotation removeAnnotation(int)\r
 \r
     /**\r
      * Method removeSequence\r
@@ -399,23 +391,24 @@ public class SequenceSet implements java.io.Serializable {
      * @param index\r
      * @return Sequence\r
      */\r
-    public jalview.binding.Sequence removeSequence(int index)\r
-    {\r
+    public jalview.binding.Sequence removeSequence(int index) {\r
         java.lang.Object obj = _sequenceList.elementAt(index);\r
         _sequenceList.removeElementAt(index);\r
+\r
         return (jalview.binding.Sequence) obj;\r
-    } //-- jalview.binding.Sequence removeSequence(int)\r
+    }\r
+     //-- jalview.binding.Sequence removeSequence(int)\r
 \r
     /**\r
      * Sets the value of field 'aligned'.\r
      *\r
      * @param aligned the value of field 'aligned'.\r
      */\r
-    public void setAligned(boolean aligned)\r
-    {\r
+    public void setAligned(boolean aligned) {\r
         this._aligned = aligned;\r
         this._has_aligned = true;\r
-    } //-- void setAligned(boolean)\r
+    }\r
+     //-- void setAligned(boolean)\r
 \r
     /**\r
      * Method setAnnotation\r
@@ -426,14 +419,15 @@ public class SequenceSet implements java.io.Serializable {
      * @param vAnnotation\r
      */\r
     public void setAnnotation(int index, jalview.binding.Annotation vAnnotation)\r
-        throws java.lang.IndexOutOfBoundsException\r
-    {\r
+        throws java.lang.IndexOutOfBoundsException {\r
         //-- check bounds for index\r
         if ((index < 0) || (index > _annotationList.size())) {\r
             throw new IndexOutOfBoundsException();\r
         }\r
+\r
         _annotationList.setElementAt(vAnnotation, index);\r
-    } //-- void setAnnotation(int, jalview.binding.Annotation)\r
+    }\r
+     //-- void setAnnotation(int, jalview.binding.Annotation)\r
 \r
     /**\r
      * Method setAnnotation\r
@@ -442,24 +436,25 @@ public class SequenceSet implements java.io.Serializable {
      *\r
      * @param annotationArray\r
      */\r
-    public void setAnnotation(jalview.binding.Annotation[] annotationArray)\r
-    {\r
+    public void setAnnotation(jalview.binding.Annotation[] annotationArray) {\r
         //-- copy array\r
         _annotationList.removeAllElements();\r
+\r
         for (int i = 0; i < annotationArray.length; i++) {\r
             _annotationList.addElement(annotationArray[i]);\r
         }\r
-    } //-- void setAnnotation(jalview.binding.Annotation)\r
+    }\r
+     //-- void setAnnotation(jalview.binding.Annotation)\r
 \r
     /**\r
      * Sets the value of field 'gapChar'.\r
      *\r
      * @param gapChar the value of field 'gapChar'.\r
      */\r
-    public void setGapChar(java.lang.String gapChar)\r
-    {\r
+    public void setGapChar(java.lang.String gapChar) {\r
         this._gapChar = gapChar;\r
-    } //-- void setGapChar(java.lang.String)\r
+    }\r
+     //-- void setGapChar(java.lang.String)\r
 \r
     /**\r
      * Method setSequence\r
@@ -470,14 +465,15 @@ public class SequenceSet implements java.io.Serializable {
      * @param vSequence\r
      */\r
     public void setSequence(int index, jalview.binding.Sequence vSequence)\r
-        throws java.lang.IndexOutOfBoundsException\r
-    {\r
+        throws java.lang.IndexOutOfBoundsException {\r
         //-- check bounds for index\r
         if ((index < 0) || (index > _sequenceList.size())) {\r
             throw new IndexOutOfBoundsException();\r
         }\r
+\r
         _sequenceList.setElementAt(vSequence, index);\r
-    } //-- void setSequence(int, jalview.binding.Sequence)\r
+    }\r
+     //-- void setSequence(int, jalview.binding.Sequence)\r
 \r
     /**\r
      * Method setSequence\r
@@ -486,14 +482,15 @@ public class SequenceSet implements java.io.Serializable {
      *\r
      * @param sequenceArray\r
      */\r
-    public void setSequence(jalview.binding.Sequence[] sequenceArray)\r
-    {\r
+    public void setSequence(jalview.binding.Sequence[] sequenceArray) {\r
         //-- copy array\r
         _sequenceList.removeAllElements();\r
+\r
         for (int i = 0; i < sequenceArray.length; i++) {\r
             _sequenceList.addElement(sequenceArray[i]);\r
         }\r
-    } //-- void setSequence(jalview.binding.Sequence)\r
+    }\r
+     //-- void setSequence(jalview.binding.Sequence)\r
 \r
     /**\r
      * Method unmarshal\r
@@ -504,20 +501,20 @@ public class SequenceSet implements java.io.Serializable {
      * @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.binding.SequenceSet) Unmarshaller.unmarshal(jalview.binding.SequenceSet.class, reader);\r
-    } //-- java.lang.Object unmarshal(java.io.Reader)\r
+        throws org.exolab.castor.xml.MarshalException, \r
+            org.exolab.castor.xml.ValidationException {\r
+        return (jalview.binding.SequenceSet) Unmarshaller.unmarshal(jalview.binding.SequenceSet.class,\r
+            reader);\r
+    }\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
+    public void validate() throws org.exolab.castor.xml.ValidationException {\r
         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
         validator.validate(this);\r
-    } //-- void validate()\r
-\r
+    }\r
+     //-- void validate()\r
 }\r
index bf560bb..6060e77 100755 (executable)
@@ -4,7 +4,6 @@
  * Schema.\r
  * $Id$\r
  */\r
-\r
 /*\r
 * Jalview - A Sequence Alignment Editor and Viewer\r
 * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\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.binding;\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
+\r
 import org.xml.sax.ContentHandler;\r
 \r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
+//---------------------------------/\r
+import java.io.IOException;\r
+import java.io.Reader;\r
+import java.io.Serializable;\r
+import java.io.Writer;\r
+\r
+\r
 /**\r
  * Class SequenceType.\r
  *\r
  * @version $Revision$ $Date$\r
  */\r
 public class SequenceType implements java.io.Serializable {\r
-\r
-\r
-      //--------------------------/\r
-     //- Class/Member Variables -/\r
+    //--------------------------/\r
+    //- Class/Member Variables -/\r
     //--------------------------/\r
 \r
     /**\r
@@ -67,30 +65,19 @@ public class SequenceType implements java.io.Serializable {
      */\r
     private java.lang.String _name;\r
 \r
-\r
-      //----------------/\r
-     //- Constructors -/\r
     //----------------/\r
-\r
+    //- Constructors -/\r
+    //----------------/\r
     public SequenceType() {\r
         super();\r
-    } //-- jalview.binding.SequenceType()\r
-\r
+    }\r
+     //-- jalview.binding.SequenceType()\r
+ //-----------/\r
 \r
-      //-----------/\r
-     //- Methods -/\r
-    //-----------/\r
-\r
-    /**\r
-     * Returns the value of field 'id'.\r
-     *\r
-     * @return String\r
-     * @return the value of field 'id'.\r
-     */\r
-    public java.lang.String getId()\r
-    {\r
+    public java.lang.String getId() {\r
         return this._id;\r
-    } //-- java.lang.String getId()\r
+    }\r
+     //-- java.lang.String getId()\r
 \r
     /**\r
      * Returns the value of field 'name'.\r
@@ -98,10 +85,10 @@ public class SequenceType implements java.io.Serializable {
      * @return String\r
      * @return the value of field 'name'.\r
      */\r
-    public java.lang.String getName()\r
-    {\r
+    public java.lang.String getName() {\r
         return this._name;\r
-    } //-- java.lang.String getName()\r
+    }\r
+     //-- java.lang.String getName()\r
 \r
     /**\r
      * Returns the value of field 'sequence'.\r
@@ -109,10 +96,10 @@ public class SequenceType implements java.io.Serializable {
      * @return String\r
      * @return the value of field 'sequence'.\r
      */\r
-    public java.lang.String getSequence()\r
-    {\r
+    public java.lang.String getSequence() {\r
         return this._sequence;\r
-    } //-- java.lang.String getSequence()\r
+    }\r
+     //-- java.lang.String getSequence()\r
 \r
     /**\r
      * Method isValid\r
@@ -121,16 +108,16 @@ public class SequenceType implements java.io.Serializable {
      *\r
      * @return boolean\r
      */\r
-    public boolean isValid()\r
-    {\r
+    public boolean isValid() {\r
         try {\r
             validate();\r
-        }\r
-        catch (org.exolab.castor.xml.ValidationException vex) {\r
+        } catch (org.exolab.castor.xml.ValidationException vex) {\r
             return false;\r
         }\r
+\r
         return true;\r
-    } //-- boolean isValid()\r
+    }\r
+     //-- boolean isValid()\r
 \r
     /**\r
      * Method marshal\r
@@ -140,11 +127,11 @@ public class SequenceType implements java.io.Serializable {
      * @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
+        throws org.exolab.castor.xml.MarshalException, \r
+            org.exolab.castor.xml.ValidationException {\r
         Marshaller.marshal(this, out);\r
-    } //-- void marshal(java.io.Writer)\r
+    }\r
+     //-- void marshal(java.io.Writer)\r
 \r
     /**\r
      * Method marshal\r
@@ -154,41 +141,41 @@ public class SequenceType implements java.io.Serializable {
      * @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
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, \r
+            org.exolab.castor.xml.ValidationException {\r
         Marshaller.marshal(this, handler);\r
-    } //-- void marshal(org.xml.sax.ContentHandler)\r
+    }\r
+     //-- void marshal(org.xml.sax.ContentHandler)\r
 \r
     /**\r
      * Sets the value of field 'id'.\r
      *\r
      * @param id the value of field 'id'.\r
      */\r
-    public void setId(java.lang.String id)\r
-    {\r
+    public void setId(java.lang.String id) {\r
         this._id = id;\r
-    } //-- void setId(java.lang.String)\r
+    }\r
+     //-- void setId(java.lang.String)\r
 \r
     /**\r
      * Sets the value of field 'name'.\r
      *\r
      * @param name the value of field 'name'.\r
      */\r
-    public void setName(java.lang.String name)\r
-    {\r
+    public void setName(java.lang.String name) {\r
         this._name = name;\r
-    } //-- void setName(java.lang.String)\r
+    }\r
+     //-- void setName(java.lang.String)\r
 \r
     /**\r
      * Sets the value of field 'sequence'.\r
      *\r
      * @param sequence the value of field 'sequence'.\r
      */\r
-    public void setSequence(java.lang.String sequence)\r
-    {\r
+    public void setSequence(java.lang.String sequence) {\r
         this._sequence = sequence;\r
-    } //-- void setSequence(java.lang.String)\r
+    }\r
+     //-- void setSequence(java.lang.String)\r
 \r
     /**\r
      * Method unmarshal\r
@@ -199,20 +186,20 @@ public class SequenceType implements java.io.Serializable {
      * @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.binding.SequenceType) Unmarshaller.unmarshal(jalview.binding.SequenceType.class, reader);\r
-    } //-- java.lang.Object unmarshal(java.io.Reader)\r
+        throws org.exolab.castor.xml.MarshalException, \r
+            org.exolab.castor.xml.ValidationException {\r
+        return (jalview.binding.SequenceType) Unmarshaller.unmarshal(jalview.binding.SequenceType.class,\r
+            reader);\r
+    }\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
+    public void validate() throws org.exolab.castor.xml.ValidationException {\r
         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
         validator.validate(this);\r
-    } //-- void validate()\r
-\r
+    }\r
+     //-- void validate()\r
 }\r
index fba081c..3ecb7bc 100755 (executable)
@@ -4,7 +4,6 @@
  * Schema.\r
  * $Id$\r
  */\r
-\r
 /*\r
 * Jalview - A Sequence Alignment Editor and Viewer\r
 * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\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.binding;\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
+\r
 import org.xml.sax.ContentHandler;\r
 \r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
+//---------------------------------/\r
+import java.io.IOException;\r
+import java.io.Reader;\r
+import java.io.Serializable;\r
+import java.io.Writer;\r
+\r
+\r
 /**\r
  * Class UserColour.\r
  *\r
  * @version $Revision$ $Date$\r
  */\r
 public class UserColour implements java.io.Serializable {\r
-\r
-\r
-      //--------------------------/\r
-     //- Class/Member Variables -/\r
+    //--------------------------/\r
+    //- Class/Member Variables -/\r
     //--------------------------/\r
 \r
     /**\r
@@ -67,28 +65,19 @@ public class UserColour implements java.io.Serializable {
      */\r
     private jalview.binding.UserColourScheme _userColourScheme;\r
 \r
-\r
-      //----------------/\r
-     //- Constructors -/\r
     //----------------/\r
-\r
+    //- Constructors -/\r
+    //----------------/\r
     public UserColour() {\r
         super();\r
-    } //-- jalview.binding.UserColour()\r
-\r
-\r
-      //-----------/\r
-     //- Methods -/\r
-    //-----------/\r
+    }\r
+     //-- jalview.binding.UserColour()\r
+ //-----------/\r
 \r
-    /**\r
-     * Method deleteId\r
-     *\r
-     */\r
-    public void deleteId()\r
-    {\r
-        this._has_id= false;\r
-    } //-- void deleteId()\r
+    public void deleteId() {\r
+        this._has_id = false;\r
+    }\r
+     //-- void deleteId()\r
 \r
     /**\r
      * Returns the value of field 'id'.\r
@@ -96,10 +85,10 @@ public class UserColour implements java.io.Serializable {
      * @return int\r
      * @return the value of field 'id'.\r
      */\r
-    public int getId()\r
-    {\r
+    public int getId() {\r
         return this._id;\r
-    } //-- int getId()\r
+    }\r
+     //-- int getId()\r
 \r
     /**\r
      * Returns the value of field 'userColourScheme'.\r
@@ -107,10 +96,10 @@ public class UserColour implements java.io.Serializable {
      * @return UserColourScheme\r
      * @return the value of field 'userColourScheme'.\r
      */\r
-    public jalview.binding.UserColourScheme getUserColourScheme()\r
-    {\r
+    public jalview.binding.UserColourScheme getUserColourScheme() {\r
         return this._userColourScheme;\r
-    } //-- jalview.binding.UserColourScheme getUserColourScheme()\r
+    }\r
+     //-- jalview.binding.UserColourScheme getUserColourScheme()\r
 \r
     /**\r
      * Method hasId\r
@@ -119,10 +108,10 @@ public class UserColour implements java.io.Serializable {
      *\r
      * @return boolean\r
      */\r
-    public boolean hasId()\r
-    {\r
+    public boolean hasId() {\r
         return this._has_id;\r
-    } //-- boolean hasId()\r
+    }\r
+     //-- boolean hasId()\r
 \r
     /**\r
      * Method isValid\r
@@ -131,16 +120,16 @@ public class UserColour implements java.io.Serializable {
      *\r
      * @return boolean\r
      */\r
-    public boolean isValid()\r
-    {\r
+    public boolean isValid() {\r
         try {\r
             validate();\r
-        }\r
-        catch (org.exolab.castor.xml.ValidationException vex) {\r
+        } catch (org.exolab.castor.xml.ValidationException vex) {\r
             return false;\r
         }\r
+\r
         return true;\r
-    } //-- boolean isValid()\r
+    }\r
+     //-- boolean isValid()\r
 \r
     /**\r
      * Method marshal\r
@@ -150,11 +139,11 @@ public class UserColour implements java.io.Serializable {
      * @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
+        throws org.exolab.castor.xml.MarshalException, \r
+            org.exolab.castor.xml.ValidationException {\r
         Marshaller.marshal(this, out);\r
-    } //-- void marshal(java.io.Writer)\r
+    }\r
+     //-- void marshal(java.io.Writer)\r
 \r
     /**\r
      * Method marshal\r
@@ -164,32 +153,33 @@ public class UserColour implements java.io.Serializable {
      * @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
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, \r
+            org.exolab.castor.xml.ValidationException {\r
         Marshaller.marshal(this, handler);\r
-    } //-- void marshal(org.xml.sax.ContentHandler)\r
+    }\r
+     //-- void marshal(org.xml.sax.ContentHandler)\r
 \r
     /**\r
      * Sets the value of field 'id'.\r
      *\r
      * @param id the value of field 'id'.\r
      */\r
-    public void setId(int id)\r
-    {\r
+    public void setId(int id) {\r
         this._id = id;\r
         this._has_id = true;\r
-    } //-- void setId(int)\r
+    }\r
+     //-- void setId(int)\r
 \r
     /**\r
      * Sets the value of field 'userColourScheme'.\r
      *\r
      * @param userColourScheme the value of field 'userColourScheme'\r
      */\r
-    public void setUserColourScheme(jalview.binding.UserColourScheme userColourScheme)\r
-    {\r
+    public void setUserColourScheme(\r
+        jalview.binding.UserColourScheme userColourScheme) {\r
         this._userColourScheme = userColourScheme;\r
-    } //-- void setUserColourScheme(jalview.binding.UserColourScheme)\r
+    }\r
+     //-- void setUserColourScheme(jalview.binding.UserColourScheme)\r
 \r
     /**\r
      * Method unmarshal\r
@@ -200,20 +190,20 @@ public class UserColour implements java.io.Serializable {
      * @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.binding.UserColour) Unmarshaller.unmarshal(jalview.binding.UserColour.class, reader);\r
-    } //-- java.lang.Object unmarshal(java.io.Reader)\r
+        throws org.exolab.castor.xml.MarshalException, \r
+            org.exolab.castor.xml.ValidationException {\r
+        return (jalview.binding.UserColour) Unmarshaller.unmarshal(jalview.binding.UserColour.class,\r
+            reader);\r
+    }\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
+    public void validate() throws org.exolab.castor.xml.ValidationException {\r
         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
         validator.validate(this);\r
-    } //-- void validate()\r
-\r
+    }\r
+     //-- void validate()\r
 }\r
index f8c2fdb..e66e468 100755 (executable)
@@ -4,7 +4,6 @@
  * Schema.\r
  * $Id$\r
  */\r
-\r
 /*\r
 * Jalview - A Sequence Alignment Editor and Viewer\r
 * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\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.binding;\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
+\r
 import org.xml.sax.ContentHandler;\r
 \r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
+//---------------------------------/\r
+import java.io.IOException;\r
+import java.io.Reader;\r
+import java.io.Serializable;\r
+import java.io.Writer;\r
+\r
+\r
 /**\r
  * Class UserColourScheme.\r
  *\r
  * @version $Revision$ $Date$\r
  */\r
 public class UserColourScheme extends JalviewUserColours\r
-implements java.io.Serializable\r
-{\r
-\r
-\r
-      //----------------/\r
-     //- Constructors -/\r
+    implements java.io.Serializable {\r
+    //----------------/\r
+    //- Constructors -/\r
     //----------------/\r
-\r
     public UserColourScheme() {\r
         super();\r
-    } //-- jalview.binding.UserColourScheme()\r
+    }\r
+     //-- jalview.binding.UserColourScheme()\r
+ //-----------/\r
 \r
-\r
-      //-----------/\r
-     //- Methods -/\r
-    //-----------/\r
-\r
-    /**\r
-     * Method isValid\r
-     *\r
-     *\r
-     *\r
-     * @return boolean\r
-     */\r
-    public boolean isValid()\r
-    {\r
+    public boolean isValid() {\r
         try {\r
             validate();\r
-        }\r
-        catch (org.exolab.castor.xml.ValidationException vex) {\r
+        } catch (org.exolab.castor.xml.ValidationException vex) {\r
             return false;\r
         }\r
+\r
         return true;\r
-    } //-- boolean isValid()\r
+    }\r
+     //-- boolean isValid()\r
 \r
     /**\r
      * Method marshal\r
@@ -89,11 +75,11 @@ implements java.io.Serializable
      * @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
+        throws org.exolab.castor.xml.MarshalException, \r
+            org.exolab.castor.xml.ValidationException {\r
         Marshaller.marshal(this, out);\r
-    } //-- void marshal(java.io.Writer)\r
+    }\r
+     //-- void marshal(java.io.Writer)\r
 \r
     /**\r
      * Method marshal\r
@@ -103,11 +89,11 @@ implements java.io.Serializable
      * @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
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, \r
+            org.exolab.castor.xml.ValidationException {\r
         Marshaller.marshal(this, handler);\r
-    } //-- void marshal(org.xml.sax.ContentHandler)\r
+    }\r
+     //-- void marshal(org.xml.sax.ContentHandler)\r
 \r
     /**\r
      * Method unmarshal\r
@@ -118,20 +104,20 @@ implements java.io.Serializable
      * @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.binding.UserColourScheme) Unmarshaller.unmarshal(jalview.binding.UserColourScheme.class, reader);\r
-    } //-- java.lang.Object unmarshal(java.io.Reader)\r
+        throws org.exolab.castor.xml.MarshalException, \r
+            org.exolab.castor.xml.ValidationException {\r
+        return (jalview.binding.UserColourScheme) Unmarshaller.unmarshal(jalview.binding.UserColourScheme.class,\r
+            reader);\r
+    }\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
+    public void validate() throws org.exolab.castor.xml.ValidationException {\r
         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
         validator.validate(this);\r
-    } //-- void validate()\r
-\r
+    }\r
+     //-- void validate()\r
 }\r
index 2c4e91b..2dbffc1 100755 (executable)
@@ -4,7 +4,6 @@
  * Schema.\r
  * $Id$\r
  */\r
-\r
 /*\r
 * Jalview - A Sequence Alignment Editor and Viewer\r
 * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\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.binding;\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
+\r
 import org.xml.sax.ContentHandler;\r
 \r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
+//---------------------------------/\r
+import java.io.IOException;\r
+import java.io.Reader;\r
+import java.io.Serializable;\r
+import java.io.Writer;\r
+\r
+\r
 /**\r
  * Class UserColours.\r
  *\r
  * @version $Revision$ $Date$\r
  */\r
 public class UserColours implements java.io.Serializable {\r
-\r
-\r
-      //--------------------------/\r
-     //- Class/Member Variables -/\r
+    //--------------------------/\r
+    //- Class/Member Variables -/\r
     //--------------------------/\r
 \r
     /**\r
@@ -62,30 +60,19 @@ public class UserColours implements java.io.Serializable {
      */\r
     private jalview.binding.UserColourScheme _userColourScheme;\r
 \r
-\r
-      //----------------/\r
-     //- Constructors -/\r
     //----------------/\r
-\r
+    //- Constructors -/\r
+    //----------------/\r
     public UserColours() {\r
         super();\r
-    } //-- jalview.binding.UserColours()\r
-\r
-\r
-      //-----------/\r
-     //- Methods -/\r
-    //-----------/\r
+    }\r
+     //-- jalview.binding.UserColours()\r
+ //-----------/\r
 \r
-    /**\r
-     * Returns the value of field 'id'.\r
-     *\r
-     * @return String\r
-     * @return the value of field 'id'.\r
-     */\r
-    public java.lang.String getId()\r
-    {\r
+    public java.lang.String getId() {\r
         return this._id;\r
-    } //-- java.lang.String getId()\r
+    }\r
+     //-- java.lang.String getId()\r
 \r
     /**\r
      * Returns the value of field 'userColourScheme'.\r
@@ -93,10 +80,10 @@ public class UserColours implements java.io.Serializable {
      * @return UserColourScheme\r
      * @return the value of field 'userColourScheme'.\r
      */\r
-    public jalview.binding.UserColourScheme getUserColourScheme()\r
-    {\r
+    public jalview.binding.UserColourScheme getUserColourScheme() {\r
         return this._userColourScheme;\r
-    } //-- jalview.binding.UserColourScheme getUserColourScheme()\r
+    }\r
+     //-- jalview.binding.UserColourScheme getUserColourScheme()\r
 \r
     /**\r
      * Method isValid\r
@@ -105,16 +92,16 @@ public class UserColours implements java.io.Serializable {
      *\r
      * @return boolean\r
      */\r
-    public boolean isValid()\r
-    {\r
+    public boolean isValid() {\r
         try {\r
             validate();\r
-        }\r
-        catch (org.exolab.castor.xml.ValidationException vex) {\r
+        } catch (org.exolab.castor.xml.ValidationException vex) {\r
             return false;\r
         }\r
+\r
         return true;\r
-    } //-- boolean isValid()\r
+    }\r
+     //-- boolean isValid()\r
 \r
     /**\r
      * Method marshal\r
@@ -124,11 +111,11 @@ public class UserColours implements java.io.Serializable {
      * @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
+        throws org.exolab.castor.xml.MarshalException, \r
+            org.exolab.castor.xml.ValidationException {\r
         Marshaller.marshal(this, out);\r
-    } //-- void marshal(java.io.Writer)\r
+    }\r
+     //-- void marshal(java.io.Writer)\r
 \r
     /**\r
      * Method marshal\r
@@ -138,31 +125,32 @@ public class UserColours implements java.io.Serializable {
      * @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
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, \r
+            org.exolab.castor.xml.ValidationException {\r
         Marshaller.marshal(this, handler);\r
-    } //-- void marshal(org.xml.sax.ContentHandler)\r
+    }\r
+     //-- void marshal(org.xml.sax.ContentHandler)\r
 \r
     /**\r
      * Sets the value of field 'id'.\r
      *\r
      * @param id the value of field 'id'.\r
      */\r
-    public void setId(java.lang.String id)\r
-    {\r
+    public void setId(java.lang.String id) {\r
         this._id = id;\r
-    } //-- void setId(java.lang.String)\r
+    }\r
+     //-- void setId(java.lang.String)\r
 \r
     /**\r
      * Sets the value of field 'userColourScheme'.\r
      *\r
      * @param userColourScheme the value of field 'userColourScheme'\r
      */\r
-    public void setUserColourScheme(jalview.binding.UserColourScheme userColourScheme)\r
-    {\r
+    public void setUserColourScheme(\r
+        jalview.binding.UserColourScheme userColourScheme) {\r
         this._userColourScheme = userColourScheme;\r
-    } //-- void setUserColourScheme(jalview.binding.UserColourScheme)\r
+    }\r
+     //-- void setUserColourScheme(jalview.binding.UserColourScheme)\r
 \r
     /**\r
      * Method unmarshal\r
@@ -173,20 +161,20 @@ public class UserColours implements java.io.Serializable {
      * @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.binding.UserColours) Unmarshaller.unmarshal(jalview.binding.UserColours.class, reader);\r
-    } //-- java.lang.Object unmarshal(java.io.Reader)\r
+        throws org.exolab.castor.xml.MarshalException, \r
+            org.exolab.castor.xml.ValidationException {\r
+        return (jalview.binding.UserColours) Unmarshaller.unmarshal(jalview.binding.UserColours.class,\r
+            reader);\r
+    }\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
+    public void validate() throws org.exolab.castor.xml.ValidationException {\r
         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
         validator.validate(this);\r
-    } //-- void validate()\r
-\r
+    }\r
+     //-- void validate()\r
 }\r
index 2190b2f..5bc9b12 100755 (executable)
@@ -4,7 +4,6 @@
  * Schema.\r
  * $Id$\r
  */\r
-\r
 /*\r
 * Jalview - A Sequence Alignment Editor and Viewer\r
 * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\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.binding;\r
 \r
-  //---------------------------------/\r
- //- Imported classes and packages -/\r
-//---------------------------------/\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
 \r
+import org.xml.sax.ContentHandler;\r
+\r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
+//---------------------------------/\r
 import java.io.IOException;\r
 import java.io.Reader;\r
 import java.io.Serializable;\r
 import java.io.Writer;\r
+\r
 import java.util.Enumeration;\r
 import java.util.Vector;\r
-import org.exolab.castor.xml.MarshalException;\r
-import org.exolab.castor.xml.Marshaller;\r
-import org.exolab.castor.xml.Unmarshaller;\r
-import org.exolab.castor.xml.ValidationException;\r
-import org.xml.sax.ContentHandler;\r
+\r
 \r
 /**\r
  * Class VAMSAS.\r
@@ -48,10 +49,8 @@ import org.xml.sax.ContentHandler;
  * @version $Revision$ $Date$\r
  */\r
 public class VAMSAS implements java.io.Serializable {\r
-\r
-\r
-      //--------------------------/\r
-     //- Class/Member Variables -/\r
+    //--------------------------/\r
+    //- Class/Member Variables -/\r
     //--------------------------/\r
 \r
     /**\r
@@ -69,35 +68,23 @@ public class VAMSAS implements java.io.Serializable {
      */\r
     private java.util.Vector _sequenceSetList;\r
 \r
-\r
-      //----------------/\r
-     //- Constructors -/\r
     //----------------/\r
-\r
+    //- Constructors -/\r
+    //----------------/\r
     public VAMSAS() {\r
         super();\r
         _alignmentList = new Vector();\r
         _treeList = new Vector();\r
         _sequenceSetList = new Vector();\r
-    } //-- jalview.binding.VAMSAS()\r
+    }\r
+     //-- jalview.binding.VAMSAS()\r
+ //-----------/\r
 \r
-\r
-      //-----------/\r
-     //- Methods -/\r
-    //-----------/\r
-\r
-    /**\r
-     * Method addAlignment\r
-     *\r
-     *\r
-     *\r
-     * @param vAlignment\r
-     */\r
     public void addAlignment(jalview.binding.Alignment vAlignment)\r
-        throws java.lang.IndexOutOfBoundsException\r
-    {\r
+        throws java.lang.IndexOutOfBoundsException {\r
         _alignmentList.addElement(vAlignment);\r
-    } //-- void addAlignment(jalview.binding.Alignment)\r
+    }\r
+     //-- void addAlignment(jalview.binding.Alignment)\r
 \r
     /**\r
      * Method addAlignment\r
@@ -108,10 +95,10 @@ public class VAMSAS implements java.io.Serializable {
      * @param vAlignment\r
      */\r
     public void addAlignment(int index, jalview.binding.Alignment vAlignment)\r
-        throws java.lang.IndexOutOfBoundsException\r
-    {\r
+        throws java.lang.IndexOutOfBoundsException {\r
         _alignmentList.insertElementAt(vAlignment, index);\r
-    } //-- void addAlignment(int, jalview.binding.Alignment)\r
+    }\r
+     //-- void addAlignment(int, jalview.binding.Alignment)\r
 \r
     /**\r
      * Method addSequenceSet\r
@@ -121,10 +108,10 @@ public class VAMSAS implements java.io.Serializable {
      * @param vSequenceSet\r
      */\r
     public void addSequenceSet(jalview.binding.SequenceSet vSequenceSet)\r
-        throws java.lang.IndexOutOfBoundsException\r
-    {\r
+        throws java.lang.IndexOutOfBoundsException {\r
         _sequenceSetList.addElement(vSequenceSet);\r
-    } //-- void addSequenceSet(jalview.binding.SequenceSet)\r
+    }\r
+     //-- void addSequenceSet(jalview.binding.SequenceSet)\r
 \r
     /**\r
      * Method addSequenceSet\r
@@ -134,11 +121,12 @@ public class VAMSAS implements java.io.Serializable {
      * @param index\r
      * @param vSequenceSet\r
      */\r
-    public void addSequenceSet(int index, jalview.binding.SequenceSet vSequenceSet)\r
-        throws java.lang.IndexOutOfBoundsException\r
-    {\r
+    public void addSequenceSet(int index,\r
+        jalview.binding.SequenceSet vSequenceSet)\r
+        throws java.lang.IndexOutOfBoundsException {\r
         _sequenceSetList.insertElementAt(vSequenceSet, index);\r
-    } //-- void addSequenceSet(int, jalview.binding.SequenceSet)\r
+    }\r
+     //-- void addSequenceSet(int, jalview.binding.SequenceSet)\r
 \r
     /**\r
      * Method addTree\r
@@ -148,10 +136,10 @@ public class VAMSAS implements java.io.Serializable {
      * @param vTree\r
      */\r
     public void addTree(java.lang.String vTree)\r
-        throws java.lang.IndexOutOfBoundsException\r
-    {\r
+        throws java.lang.IndexOutOfBoundsException {\r
         _treeList.addElement(vTree);\r
-    } //-- void addTree(java.lang.String)\r
+    }\r
+     //-- void addTree(java.lang.String)\r
 \r
     /**\r
      * Method addTree\r
@@ -162,10 +150,10 @@ public class VAMSAS implements java.io.Serializable {
      * @param vTree\r
      */\r
     public void addTree(int index, java.lang.String vTree)\r
-        throws java.lang.IndexOutOfBoundsException\r
-    {\r
+        throws java.lang.IndexOutOfBoundsException {\r
         _treeList.insertElementAt(vTree, index);\r
-    } //-- void addTree(int, java.lang.String)\r
+    }\r
+     //-- void addTree(int, java.lang.String)\r
 \r
     /**\r
      * Method enumerateAlignment\r
@@ -174,10 +162,10 @@ public class VAMSAS implements java.io.Serializable {
      *\r
      * @return Enumeration\r
      */\r
-    public java.util.Enumeration enumerateAlignment()\r
-    {\r
+    public java.util.Enumeration enumerateAlignment() {\r
         return _alignmentList.elements();\r
-    } //-- java.util.Enumeration enumerateAlignment()\r
+    }\r
+     //-- java.util.Enumeration enumerateAlignment()\r
 \r
     /**\r
      * Method enumerateSequenceSet\r
@@ -186,10 +174,10 @@ public class VAMSAS implements java.io.Serializable {
      *\r
      * @return Enumeration\r
      */\r
-    public java.util.Enumeration enumerateSequenceSet()\r
-    {\r
+    public java.util.Enumeration enumerateSequenceSet() {\r
         return _sequenceSetList.elements();\r
-    } //-- java.util.Enumeration enumerateSequenceSet()\r
+    }\r
+     //-- java.util.Enumeration enumerateSequenceSet()\r
 \r
     /**\r
      * Method enumerateTree\r
@@ -198,10 +186,10 @@ public class VAMSAS implements java.io.Serializable {
      *\r
      * @return Enumeration\r
      */\r
-    public java.util.Enumeration enumerateTree()\r
-    {\r
+    public java.util.Enumeration enumerateTree() {\r
         return _treeList.elements();\r
-    } //-- java.util.Enumeration enumerateTree()\r
+    }\r
+     //-- java.util.Enumeration enumerateTree()\r
 \r
     /**\r
      * Method getAlignment\r
@@ -212,15 +200,15 @@ public class VAMSAS implements java.io.Serializable {
      * @return Alignment\r
      */\r
     public jalview.binding.Alignment getAlignment(int index)\r
-        throws java.lang.IndexOutOfBoundsException\r
-    {\r
+        throws java.lang.IndexOutOfBoundsException {\r
         //-- check bounds for index\r
         if ((index < 0) || (index > _alignmentList.size())) {\r
             throw new IndexOutOfBoundsException();\r
         }\r
 \r
         return (jalview.binding.Alignment) _alignmentList.elementAt(index);\r
-    } //-- jalview.binding.Alignment getAlignment(int)\r
+    }\r
+     //-- jalview.binding.Alignment getAlignment(int)\r
 \r
     /**\r
      * Method getAlignment\r
@@ -229,15 +217,17 @@ public class VAMSAS implements java.io.Serializable {
      *\r
      * @return Alignment\r
      */\r
-    public jalview.binding.Alignment[] getAlignment()\r
-    {\r
+    public jalview.binding.Alignment[] getAlignment() {\r
         int size = _alignmentList.size();\r
         jalview.binding.Alignment[] mArray = new jalview.binding.Alignment[size];\r
+\r
         for (int index = 0; index < size; index++) {\r
             mArray[index] = (jalview.binding.Alignment) _alignmentList.elementAt(index);\r
         }\r
+\r
         return mArray;\r
-    } //-- jalview.binding.Alignment[] getAlignment()\r
+    }\r
+     //-- jalview.binding.Alignment[] getAlignment()\r
 \r
     /**\r
      * Method getAlignmentCount\r
@@ -246,10 +236,10 @@ public class VAMSAS implements java.io.Serializable {
      *\r
      * @return int\r
      */\r
-    public int getAlignmentCount()\r
-    {\r
+    public int getAlignmentCount() {\r
         return _alignmentList.size();\r
-    } //-- int getAlignmentCount()\r
+    }\r
+     //-- int getAlignmentCount()\r
 \r
     /**\r
      * Method getSequenceSet\r
@@ -260,15 +250,15 @@ public class VAMSAS implements java.io.Serializable {
      * @return SequenceSet\r
      */\r
     public jalview.binding.SequenceSet getSequenceSet(int index)\r
-        throws java.lang.IndexOutOfBoundsException\r
-    {\r
+        throws java.lang.IndexOutOfBoundsException {\r
         //-- check bounds for index\r
         if ((index < 0) || (index > _sequenceSetList.size())) {\r
             throw new IndexOutOfBoundsException();\r
         }\r
 \r
         return (jalview.binding.SequenceSet) _sequenceSetList.elementAt(index);\r
-    } //-- jalview.binding.SequenceSet getSequenceSet(int)\r
+    }\r
+     //-- jalview.binding.SequenceSet getSequenceSet(int)\r
 \r
     /**\r
      * Method getSequenceSet\r
@@ -277,15 +267,17 @@ public class VAMSAS implements java.io.Serializable {
      *\r
      * @return SequenceSet\r
      */\r
-    public jalview.binding.SequenceSet[] getSequenceSet()\r
-    {\r
+    public jalview.binding.SequenceSet[] getSequenceSet() {\r
         int size = _sequenceSetList.size();\r
         jalview.binding.SequenceSet[] mArray = new jalview.binding.SequenceSet[size];\r
+\r
         for (int index = 0; index < size; index++) {\r
             mArray[index] = (jalview.binding.SequenceSet) _sequenceSetList.elementAt(index);\r
         }\r
+\r
         return mArray;\r
-    } //-- jalview.binding.SequenceSet[] getSequenceSet()\r
+    }\r
+     //-- jalview.binding.SequenceSet[] getSequenceSet()\r
 \r
     /**\r
      * Method getSequenceSetCount\r
@@ -294,10 +286,10 @@ public class VAMSAS implements java.io.Serializable {
      *\r
      * @return int\r
      */\r
-    public int getSequenceSetCount()\r
-    {\r
+    public int getSequenceSetCount() {\r
         return _sequenceSetList.size();\r
-    } //-- int getSequenceSetCount()\r
+    }\r
+     //-- int getSequenceSetCount()\r
 \r
     /**\r
      * Method getTree\r
@@ -308,15 +300,15 @@ public class VAMSAS implements java.io.Serializable {
      * @return String\r
      */\r
     public java.lang.String getTree(int index)\r
-        throws java.lang.IndexOutOfBoundsException\r
-    {\r
+        throws java.lang.IndexOutOfBoundsException {\r
         //-- check bounds for index\r
         if ((index < 0) || (index > _treeList.size())) {\r
             throw new IndexOutOfBoundsException();\r
         }\r
 \r
-        return (String)_treeList.elementAt(index);\r
-    } //-- java.lang.String getTree(int)\r
+        return (String) _treeList.elementAt(index);\r
+    }\r
+     //-- java.lang.String getTree(int)\r
 \r
     /**\r
      * Method getTree\r
@@ -325,15 +317,17 @@ public class VAMSAS implements java.io.Serializable {
      *\r
      * @return String\r
      */\r
-    public java.lang.String[] getTree()\r
-    {\r
+    public java.lang.String[] getTree() {\r
         int size = _treeList.size();\r
         java.lang.String[] mArray = new java.lang.String[size];\r
+\r
         for (int index = 0; index < size; index++) {\r
-            mArray[index] = (String)_treeList.elementAt(index);\r
+            mArray[index] = (String) _treeList.elementAt(index);\r
         }\r
+\r
         return mArray;\r
-    } //-- java.lang.String[] getTree()\r
+    }\r
+     //-- java.lang.String[] getTree()\r
 \r
     /**\r
      * Method getTreeCount\r
@@ -342,10 +336,10 @@ public class VAMSAS implements java.io.Serializable {
      *\r
      * @return int\r
      */\r
-    public int getTreeCount()\r
-    {\r
+    public int getTreeCount() {\r
         return _treeList.size();\r
-    } //-- int getTreeCount()\r
+    }\r
+     //-- int getTreeCount()\r
 \r
     /**\r
      * Method isValid\r
@@ -354,16 +348,16 @@ public class VAMSAS implements java.io.Serializable {
      *\r
      * @return boolean\r
      */\r
-    public boolean isValid()\r
-    {\r
+    public boolean isValid() {\r
         try {\r
             validate();\r
-        }\r
-        catch (org.exolab.castor.xml.ValidationException vex) {\r
+        } catch (org.exolab.castor.xml.ValidationException vex) {\r
             return false;\r
         }\r
+\r
         return true;\r
-    } //-- boolean isValid()\r
+    }\r
+     //-- boolean isValid()\r
 \r
     /**\r
      * Method marshal\r
@@ -373,11 +367,11 @@ public class VAMSAS implements java.io.Serializable {
      * @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
+        throws org.exolab.castor.xml.MarshalException, \r
+            org.exolab.castor.xml.ValidationException {\r
         Marshaller.marshal(this, out);\r
-    } //-- void marshal(java.io.Writer)\r
+    }\r
+     //-- void marshal(java.io.Writer)\r
 \r
     /**\r
      * Method marshal\r
@@ -387,11 +381,11 @@ public class VAMSAS implements java.io.Serializable {
      * @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
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, \r
+            org.exolab.castor.xml.ValidationException {\r
         Marshaller.marshal(this, handler);\r
-    } //-- void marshal(org.xml.sax.ContentHandler)\r
+    }\r
+     //-- void marshal(org.xml.sax.ContentHandler)\r
 \r
     /**\r
      * Method removeAlignment\r
@@ -401,39 +395,40 @@ public class VAMSAS implements java.io.Serializable {
      * @param index\r
      * @return Alignment\r
      */\r
-    public jalview.binding.Alignment removeAlignment(int index)\r
-    {\r
+    public jalview.binding.Alignment removeAlignment(int index) {\r
         java.lang.Object obj = _alignmentList.elementAt(index);\r
         _alignmentList.removeElementAt(index);\r
+\r
         return (jalview.binding.Alignment) obj;\r
-    } //-- jalview.binding.Alignment removeAlignment(int)\r
+    }\r
+     //-- jalview.binding.Alignment removeAlignment(int)\r
 \r
     /**\r
      * Method removeAllAlignment\r
      *\r
      */\r
-    public void removeAllAlignment()\r
-    {\r
+    public void removeAllAlignment() {\r
         _alignmentList.removeAllElements();\r
-    } //-- void removeAllAlignment()\r
+    }\r
+     //-- void removeAllAlignment()\r
 \r
     /**\r
      * Method removeAllSequenceSet\r
      *\r
      */\r
-    public void removeAllSequenceSet()\r
-    {\r
+    public void removeAllSequenceSet() {\r
         _sequenceSetList.removeAllElements();\r
-    } //-- void removeAllSequenceSet()\r
+    }\r
+     //-- void removeAllSequenceSet()\r
 \r
     /**\r
      * Method removeAllTree\r
      *\r
      */\r
-    public void removeAllTree()\r
-    {\r
+    public void removeAllTree() {\r
         _treeList.removeAllElements();\r
-    } //-- void removeAllTree()\r
+    }\r
+     //-- void removeAllTree()\r
 \r
     /**\r
      * Method removeSequenceSet\r
@@ -443,12 +438,13 @@ public class VAMSAS implements java.io.Serializable {
      * @param index\r
      * @return SequenceSet\r
      */\r
-    public jalview.binding.SequenceSet removeSequenceSet(int index)\r
-    {\r
+    public jalview.binding.SequenceSet removeSequenceSet(int index) {\r
         java.lang.Object obj = _sequenceSetList.elementAt(index);\r
         _sequenceSetList.removeElementAt(index);\r
+\r
         return (jalview.binding.SequenceSet) obj;\r
-    } //-- jalview.binding.SequenceSet removeSequenceSet(int)\r
+    }\r
+     //-- jalview.binding.SequenceSet removeSequenceSet(int)\r
 \r
     /**\r
      * Method removeTree\r
@@ -458,12 +454,13 @@ public class VAMSAS implements java.io.Serializable {
      * @param index\r
      * @return String\r
      */\r
-    public java.lang.String removeTree(int index)\r
-    {\r
+    public java.lang.String removeTree(int index) {\r
         java.lang.Object obj = _treeList.elementAt(index);\r
         _treeList.removeElementAt(index);\r
-        return (String)obj;\r
-    } //-- java.lang.String removeTree(int)\r
+\r
+        return (String) obj;\r
+    }\r
+     //-- java.lang.String removeTree(int)\r
 \r
     /**\r
      * Method setAlignment\r
@@ -474,14 +471,15 @@ public class VAMSAS implements java.io.Serializable {
      * @param vAlignment\r
      */\r
     public void setAlignment(int index, jalview.binding.Alignment vAlignment)\r
-        throws java.lang.IndexOutOfBoundsException\r
-    {\r
+        throws java.lang.IndexOutOfBoundsException {\r
         //-- check bounds for index\r
         if ((index < 0) || (index > _alignmentList.size())) {\r
             throw new IndexOutOfBoundsException();\r
         }\r
+\r
         _alignmentList.setElementAt(vAlignment, index);\r
-    } //-- void setAlignment(int, jalview.binding.Alignment)\r
+    }\r
+     //-- void setAlignment(int, jalview.binding.Alignment)\r
 \r
     /**\r
      * Method setAlignment\r
@@ -490,14 +488,15 @@ public class VAMSAS implements java.io.Serializable {
      *\r
      * @param alignmentArray\r
      */\r
-    public void setAlignment(jalview.binding.Alignment[] alignmentArray)\r
-    {\r
+    public void setAlignment(jalview.binding.Alignment[] alignmentArray) {\r
         //-- copy array\r
         _alignmentList.removeAllElements();\r
+\r
         for (int i = 0; i < alignmentArray.length; i++) {\r
             _alignmentList.addElement(alignmentArray[i]);\r
         }\r
-    } //-- void setAlignment(jalview.binding.Alignment)\r
+    }\r
+     //-- void setAlignment(jalview.binding.Alignment)\r
 \r
     /**\r
      * Method setSequenceSet\r
@@ -507,15 +506,17 @@ public class VAMSAS implements java.io.Serializable {
      * @param index\r
      * @param vSequenceSet\r
      */\r
-    public void setSequenceSet(int index, jalview.binding.SequenceSet vSequenceSet)\r
-        throws java.lang.IndexOutOfBoundsException\r
-    {\r
+    public void setSequenceSet(int index,\r
+        jalview.binding.SequenceSet vSequenceSet)\r
+        throws java.lang.IndexOutOfBoundsException {\r
         //-- check bounds for index\r
         if ((index < 0) || (index > _sequenceSetList.size())) {\r
             throw new IndexOutOfBoundsException();\r
         }\r
+\r
         _sequenceSetList.setElementAt(vSequenceSet, index);\r
-    } //-- void setSequenceSet(int, jalview.binding.SequenceSet)\r
+    }\r
+     //-- void setSequenceSet(int, jalview.binding.SequenceSet)\r
 \r
     /**\r
      * Method setSequenceSet\r
@@ -524,14 +525,15 @@ public class VAMSAS implements java.io.Serializable {
      *\r
      * @param sequenceSetArray\r
      */\r
-    public void setSequenceSet(jalview.binding.SequenceSet[] sequenceSetArray)\r
-    {\r
+    public void setSequenceSet(jalview.binding.SequenceSet[] sequenceSetArray) {\r
         //-- copy array\r
         _sequenceSetList.removeAllElements();\r
+\r
         for (int i = 0; i < sequenceSetArray.length; i++) {\r
             _sequenceSetList.addElement(sequenceSetArray[i]);\r
         }\r
-    } //-- void setSequenceSet(jalview.binding.SequenceSet)\r
+    }\r
+     //-- void setSequenceSet(jalview.binding.SequenceSet)\r
 \r
     /**\r
      * Method setTree\r
@@ -542,14 +544,15 @@ public class VAMSAS implements java.io.Serializable {
      * @param vTree\r
      */\r
     public void setTree(int index, java.lang.String vTree)\r
-        throws java.lang.IndexOutOfBoundsException\r
-    {\r
+        throws java.lang.IndexOutOfBoundsException {\r
         //-- check bounds for index\r
         if ((index < 0) || (index > _treeList.size())) {\r
             throw new IndexOutOfBoundsException();\r
         }\r
+\r
         _treeList.setElementAt(vTree, index);\r
-    } //-- void setTree(int, java.lang.String)\r
+    }\r
+     //-- void setTree(int, java.lang.String)\r
 \r
     /**\r
      * Method setTree\r
@@ -558,14 +561,15 @@ public class VAMSAS implements java.io.Serializable {
      *\r
      * @param treeArray\r
      */\r
-    public void setTree(java.lang.String[] treeArray)\r
-    {\r
+    public void setTree(java.lang.String[] treeArray) {\r
         //-- copy array\r
         _treeList.removeAllElements();\r
+\r
         for (int i = 0; i < treeArray.length; i++) {\r
             _treeList.addElement(treeArray[i]);\r
         }\r
-    } //-- void setTree(java.lang.String)\r
+    }\r
+     //-- void setTree(java.lang.String)\r
 \r
     /**\r
      * Method unmarshal\r
@@ -576,20 +580,20 @@ public class VAMSAS implements java.io.Serializable {
      * @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.binding.VAMSAS) Unmarshaller.unmarshal(jalview.binding.VAMSAS.class, reader);\r
-    } //-- java.lang.Object unmarshal(java.io.Reader)\r
+        throws org.exolab.castor.xml.MarshalException, \r
+            org.exolab.castor.xml.ValidationException {\r
+        return (jalview.binding.VAMSAS) Unmarshaller.unmarshal(jalview.binding.VAMSAS.class,\r
+            reader);\r
+    }\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
+    public void validate() throws org.exolab.castor.xml.ValidationException {\r
         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
         validator.validate(this);\r
-    } //-- void validate()\r
-\r
+    }\r
+     //-- void validate()\r
 }\r
index 4133b84..f802039 100755 (executable)
@@ -4,7 +4,6 @@
  * Schema.\r
  * $Id$\r
  */\r
-\r
 /*\r
 * Jalview - A Sequence Alignment Editor and Viewer\r
 * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\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.binding;\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
+\r
 import org.xml.sax.ContentHandler;\r
 \r
+//---------------------------------/\r
+//- Imported classes and packages -/\r
+//---------------------------------/\r
+import java.io.IOException;\r
+import java.io.Reader;\r
+import java.io.Serializable;\r
+import java.io.Writer;\r
+\r
+\r
 /**\r
  * Class VamsasModel.\r
  *\r
  * @version $Revision$ $Date$\r
  */\r
-public class VamsasModel extends VAMSAS\r
-implements java.io.Serializable\r
-{\r
-\r
-\r
-      //----------------/\r
-     //- Constructors -/\r
+public class VamsasModel extends VAMSAS implements java.io.Serializable {\r
+    //----------------/\r
+    //- Constructors -/\r
     //----------------/\r
-\r
     public VamsasModel() {\r
         super();\r
-    } //-- jalview.binding.VamsasModel()\r
+    }\r
+     //-- jalview.binding.VamsasModel()\r
+ //-----------/\r
 \r
-\r
-      //-----------/\r
-     //- Methods -/\r
-    //-----------/\r
-\r
-    /**\r
-     * Method isValid\r
-     *\r
-     *\r
-     *\r
-     * @return boolean\r
-     */\r
-    public boolean isValid()\r
-    {\r
+    public boolean isValid() {\r
         try {\r
             validate();\r
-        }\r
-        catch (org.exolab.castor.xml.ValidationException vex) {\r
+        } catch (org.exolab.castor.xml.ValidationException vex) {\r
             return false;\r
         }\r
+\r
         return true;\r
-    } //-- boolean isValid()\r
+    }\r
+     //-- boolean isValid()\r
 \r
     /**\r
      * Method marshal\r
@@ -89,11 +74,11 @@ implements java.io.Serializable
      * @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
+        throws org.exolab.castor.xml.MarshalException, \r
+            org.exolab.castor.xml.ValidationException {\r
         Marshaller.marshal(this, out);\r
-    } //-- void marshal(java.io.Writer)\r
+    }\r
+     //-- void marshal(java.io.Writer)\r
 \r
     /**\r
      * Method marshal\r
@@ -103,11 +88,11 @@ implements java.io.Serializable
      * @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
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, \r
+            org.exolab.castor.xml.ValidationException {\r
         Marshaller.marshal(this, handler);\r
-    } //-- void marshal(org.xml.sax.ContentHandler)\r
+    }\r
+     //-- void marshal(org.xml.sax.ContentHandler)\r
 \r
     /**\r
      * Method unmarshal\r
@@ -118,20 +103,20 @@ implements java.io.Serializable
      * @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.binding.VamsasModel) Unmarshaller.unmarshal(jalview.binding.VamsasModel.class, reader);\r
-    } //-- java.lang.Object unmarshal(java.io.Reader)\r
+        throws org.exolab.castor.xml.MarshalException, \r
+            org.exolab.castor.xml.ValidationException {\r
+        return (jalview.binding.VamsasModel) Unmarshaller.unmarshal(jalview.binding.VamsasModel.class,\r
+            reader);\r
+    }\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
+    public void validate() throws org.exolab.castor.xml.ValidationException {\r
         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
         validator.validate(this);\r
-    } //-- void validate()\r
-\r
+    }\r
+     //-- void validate()\r
 }\r
index 99dbd1b..8bdee5d 100755 (executable)
 * 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
 /*\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
+package jalview.binding;\r
 \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
 \r
-package jalview.binding;\r
+import org.xml.sax.ContentHandler;\r
 \r
-  //---------------------------------/\r
- //- Imported classes and packages -/\r
 //---------------------------------/\r
-\r
+//- Imported classes and packages -/\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
 /**\r
  * Class Viewport.\r
@@ -47,10 +46,8 @@ import org.xml.sax.ContentHandler;
  * @version $Revision$ $Date$\r
  */\r
 public class Viewport implements java.io.Serializable {\r
-\r
-\r
-      //--------------------------/\r
-     //- Class/Member Variables -/\r
+    //--------------------------/\r
+    //- Class/Member Variables -/\r
     //--------------------------/\r
 \r
     /**\r
@@ -298,226 +295,217 @@ public class Viewport implements java.io.Serializable {
      */\r
     private boolean _has_fontStyle;\r
 \r
-\r
-      //----------------/\r
-     //- Constructors -/\r
     //----------------/\r
-\r
+    //- Constructors -/\r
+    //----------------/\r
     public Viewport() {\r
         super();\r
-    } //-- jalview.binding.Viewport()\r
-\r
-\r
-      //-----------/\r
-     //- Methods -/\r
-    //-----------/\r
+    }\r
+     //-- jalview.binding.Viewport()\r
+ //-----------/\r
 \r
-    /**\r
-     * Method deleteConsThreshold\r
-     *\r
-     */\r
-    public void deleteConsThreshold()\r
-    {\r
-        this._has_consThreshold= false;\r
-    } //-- void deleteConsThreshold()\r
+    public void deleteConsThreshold() {\r
+        this._has_consThreshold = false;\r
+    }\r
+     //-- void deleteConsThreshold()\r
 \r
     /**\r
      * Method deleteConservationSelected\r
      *\r
      */\r
-    public void deleteConservationSelected()\r
-    {\r
-        this._has_conservationSelected= false;\r
-    } //-- void deleteConservationSelected()\r
+    public void deleteConservationSelected() {\r
+        this._has_conservationSelected = false;\r
+    }\r
+     //-- void deleteConservationSelected()\r
 \r
     /**\r
      * Method deleteFontSize\r
      *\r
      */\r
-    public void deleteFontSize()\r
-    {\r
-        this._has_fontSize= false;\r
-    } //-- void deleteFontSize()\r
+    public void deleteFontSize() {\r
+        this._has_fontSize = false;\r
+    }\r
+     //-- void deleteFontSize()\r
 \r
     /**\r
      * Method deleteFontStyle\r
      *\r
      */\r
-    public void deleteFontStyle()\r
-    {\r
-        this._has_fontStyle= false;\r
-    } //-- void deleteFontStyle()\r
+    public void deleteFontStyle() {\r
+        this._has_fontStyle = false;\r
+    }\r
+     //-- void deleteFontStyle()\r
 \r
     /**\r
      * Method deleteHeight\r
      *\r
      */\r
-    public void deleteHeight()\r
-    {\r
-        this._has_height= false;\r
-    } //-- void deleteHeight()\r
+    public void deleteHeight() {\r
+        this._has_height = false;\r
+    }\r
+     //-- void deleteHeight()\r
 \r
     /**\r
      * Method deletePidSelected\r
      *\r
      */\r
-    public void deletePidSelected()\r
-    {\r
-        this._has_pidSelected= false;\r
-    } //-- void deletePidSelected()\r
+    public void deletePidSelected() {\r
+        this._has_pidSelected = false;\r
+    }\r
+     //-- void deletePidSelected()\r
 \r
     /**\r
      * Method deletePidThreshold\r
      *\r
      */\r
-    public void deletePidThreshold()\r
-    {\r
-        this._has_pidThreshold= false;\r
-    } //-- void deletePidThreshold()\r
+    public void deletePidThreshold() {\r
+        this._has_pidThreshold = false;\r
+    }\r
+     //-- void deletePidThreshold()\r
 \r
     /**\r
      * Method deleteRenderGaps\r
      *\r
      */\r
-    public void deleteRenderGaps()\r
-    {\r
-        this._has_renderGaps= false;\r
-    } //-- void deleteRenderGaps()\r
+    public void deleteRenderGaps() {\r
+        this._has_renderGaps = false;\r
+    }\r
+     //-- void deleteRenderGaps()\r
 \r
     /**\r
      * Method deleteShowAnnotation\r
      *\r
      */\r
-    public void deleteShowAnnotation()\r
-    {\r
-        this._has_showAnnotation= false;\r
-    } //-- void deleteShowAnnotation()\r
+    public void deleteShowAnnotation() {\r
+        this._has_showAnnotation = false;\r
+    }\r
+     //-- void deleteShowAnnotation()\r
 \r
     /**\r
      * Method deleteShowBoxes\r
      *\r
      */\r
-    public void deleteShowBoxes()\r
-    {\r
-        this._has_showBoxes= false;\r
-    } //-- void deleteShowBoxes()\r
+    public void deleteShowBoxes() {\r
+        this._has_showBoxes = false;\r
+    }\r
+     //-- void deleteShowBoxes()\r
 \r
     /**\r
      * Method deleteShowColourText\r
      *\r
      */\r
-    public void deleteShowColourText()\r
-    {\r
-        this._has_showColourText= false;\r
-    } //-- void deleteShowColourText()\r
+    public void deleteShowColourText() {\r
+        this._has_showColourText = false;\r
+    }\r
+     //-- void deleteShowColourText()\r
 \r
     /**\r
      * Method deleteShowConservation\r
      *\r
      */\r
-    public void deleteShowConservation()\r
-    {\r
-        this._has_showConservation= false;\r
-    } //-- void deleteShowConservation()\r
+    public void deleteShowConservation() {\r
+        this._has_showConservation = false;\r
+    }\r
+     //-- void deleteShowConservation()\r
 \r
     /**\r
      * Method deleteShowFullId\r
      *\r
      */\r
-    public void deleteShowFullId()\r
-    {\r
-        this._has_showFullId= false;\r
-    } //-- void deleteShowFullId()\r
+    public void deleteShowFullId() {\r
+        this._has_showFullId = false;\r
+    }\r
+     //-- void deleteShowFullId()\r
 \r
     /**\r
      * Method deleteShowIdentity\r
      *\r
      */\r
-    public void deleteShowIdentity()\r
-    {\r
-        this._has_showIdentity= false;\r
-    } //-- void deleteShowIdentity()\r
+    public void deleteShowIdentity() {\r
+        this._has_showIdentity = false;\r
+    }\r
+     //-- void deleteShowIdentity()\r
 \r
     /**\r
      * Method deleteShowQuality\r
      *\r
      */\r
-    public void deleteShowQuality()\r
-    {\r
-        this._has_showQuality= false;\r
-    } //-- void deleteShowQuality()\r
+    public void deleteShowQuality() {\r
+        this._has_showQuality = false;\r
+    }\r
+     //-- void deleteShowQuality()\r
 \r
     /**\r
      * Method deleteShowSequenceFeatures\r
      *\r
      */\r
-    public void deleteShowSequenceFeatures()\r
-    {\r
-        this._has_showSequenceFeatures= false;\r
-    } //-- void deleteShowSequenceFeatures()\r
+    public void deleteShowSequenceFeatures() {\r
+        this._has_showSequenceFeatures = false;\r
+    }\r
+     //-- void deleteShowSequenceFeatures()\r
 \r
     /**\r
      * Method deleteShowText\r
      *\r
      */\r
-    public void deleteShowText()\r
-    {\r
-        this._has_showText= false;\r
-    } //-- void deleteShowText()\r
+    public void deleteShowText() {\r
+        this._has_showText = false;\r
+    }\r
+     //-- void deleteShowText()\r
 \r
     /**\r
      * Method deleteStartRes\r
      *\r
      */\r
-    public void deleteStartRes()\r
-    {\r
-        this._has_startRes= false;\r
-    } //-- void deleteStartRes()\r
+    public void deleteStartRes() {\r
+        this._has_startRes = false;\r
+    }\r
+     //-- void deleteStartRes()\r
 \r
     /**\r
      * Method deleteStartSeq\r
      *\r
      */\r
-    public void deleteStartSeq()\r
-    {\r
-        this._has_startSeq= false;\r
-    } //-- void deleteStartSeq()\r
+    public void deleteStartSeq() {\r
+        this._has_startSeq = false;\r
+    }\r
+     //-- void deleteStartSeq()\r
 \r
     /**\r
      * Method deleteWidth\r
      *\r
      */\r
-    public void deleteWidth()\r
-    {\r
-        this._has_width= false;\r
-    } //-- void deleteWidth()\r
+    public void deleteWidth() {\r
+        this._has_width = false;\r
+    }\r
+     //-- void deleteWidth()\r
 \r
     /**\r
      * Method deleteWrapAlignment\r
      *\r
      */\r
-    public void deleteWrapAlignment()\r
-    {\r
-        this._has_wrapAlignment= false;\r
-    } //-- void deleteWrapAlignment()\r
+    public void deleteWrapAlignment() {\r
+        this._has_wrapAlignment = false;\r
+    }\r
+     //-- void deleteWrapAlignment()\r
 \r
     /**\r
      * Method deleteXpos\r
      *\r
      */\r
-    public void deleteXpos()\r
-    {\r
-        this._has_xpos= false;\r
-    } //-- void deleteXpos()\r
+    public void deleteXpos() {\r
+        this._has_xpos = false;\r
+    }\r
+     //-- void deleteXpos()\r
 \r
     /**\r
      * Method deleteYpos\r
      *\r
      */\r
-    public void deleteYpos()\r
-    {\r
-        this._has_ypos= false;\r
-    } //-- void deleteYpos()\r
+    public void deleteYpos() {\r
+        this._has_ypos = false;\r
+    }\r
+     //-- void deleteYpos()\r
 \r
     /**\r
      * Returns the value of field 'bgColour'.\r
@@ -525,10 +513,10 @@ public class Viewport implements java.io.Serializable {
      * @return String\r
      * @return the value of field 'bgColour'.\r
      */\r
-    public java.lang.String getBgColour()\r
-    {\r
+    public java.lang.String getBgColour() {\r
         return this._bgColour;\r
-    } //-- java.lang.String getBgColour()\r
+    }\r
+     //-- java.lang.String getBgColour()\r
 \r
     /**\r
      * Returns the value of field 'consThreshold'.\r
@@ -536,10 +524,10 @@ public class Viewport implements java.io.Serializable {
      * @return int\r
      * @return the value of field 'consThreshold'.\r
      */\r
-    public int getConsThreshold()\r
-    {\r
+    public int getConsThreshold() {\r
         return this._consThreshold;\r
-    } //-- int getConsThreshold()\r
+    }\r
+     //-- int getConsThreshold()\r
 \r
     /**\r
      * Returns the value of field 'conservationSelected'.\r
@@ -547,10 +535,10 @@ public class Viewport implements java.io.Serializable {
      * @return boolean\r
      * @return the value of field 'conservationSelected'.\r
      */\r
-    public boolean getConservationSelected()\r
-    {\r
+    public boolean getConservationSelected() {\r
         return this._conservationSelected;\r
-    } //-- boolean getConservationSelected()\r
+    }\r
+     //-- boolean getConservationSelected()\r
 \r
     /**\r
      * Returns the value of field 'fontName'.\r
@@ -558,10 +546,10 @@ public class Viewport implements java.io.Serializable {
      * @return String\r
      * @return the value of field 'fontName'.\r
      */\r
-    public java.lang.String getFontName()\r
-    {\r
+    public java.lang.String getFontName() {\r
         return this._fontName;\r
-    } //-- java.lang.String getFontName()\r
+    }\r
+     //-- java.lang.String getFontName()\r
 \r
     /**\r
      * Returns the value of field 'fontSize'.\r
@@ -569,10 +557,10 @@ public class Viewport implements java.io.Serializable {
      * @return int\r
      * @return the value of field 'fontSize'.\r
      */\r
-    public int getFontSize()\r
-    {\r
+    public int getFontSize() {\r
         return this._fontSize;\r
-    } //-- int getFontSize()\r
+    }\r
+     //-- int getFontSize()\r
 \r
     /**\r
      * Returns the value of field 'fontStyle'.\r
@@ -580,10 +568,10 @@ public class Viewport implements java.io.Serializable {
      * @return int\r
      * @return the value of field 'fontStyle'.\r
      */\r
-    public int getFontStyle()\r
-    {\r
+    public int getFontStyle() {\r
         return this._fontStyle;\r
-    } //-- int getFontStyle()\r
+    }\r
+     //-- int getFontStyle()\r
 \r
     /**\r
      * Returns the value of field 'height'.\r
@@ -591,10 +579,10 @@ public class Viewport implements java.io.Serializable {
      * @return int\r
      * @return the value of field 'height'.\r
      */\r
-    public int getHeight()\r
-    {\r
+    public int getHeight() {\r
         return this._height;\r
-    } //-- int getHeight()\r
+    }\r
+     //-- int getHeight()\r
 \r
     /**\r
      * Returns the value of field 'pidSelected'.\r
@@ -602,10 +590,10 @@ public class Viewport implements java.io.Serializable {
      * @return boolean\r
      * @return the value of field 'pidSelected'.\r
      */\r
-    public boolean getPidSelected()\r
-    {\r
+    public boolean getPidSelected() {\r
         return this._pidSelected;\r
-    } //-- boolean getPidSelected()\r
+    }\r
+     //-- boolean getPidSelected()\r
 \r
     /**\r
      * Returns the value of field 'pidThreshold'.\r
@@ -613,10 +601,10 @@ public class Viewport implements java.io.Serializable {
      * @return int\r
      * @return the value of field 'pidThreshold'.\r
      */\r
-    public int getPidThreshold()\r
-    {\r
+    public int getPidThreshold() {\r
         return this._pidThreshold;\r
-    } //-- int getPidThreshold()\r
+    }\r
+     //-- int getPidThreshold()\r
 \r
     /**\r
      * Returns the value of field 'renderGaps'.\r
@@ -624,10 +612,10 @@ public class Viewport implements java.io.Serializable {
      * @return boolean\r
      * @return the value of field 'renderGaps'.\r
      */\r
-    public boolean getRenderGaps()\r
-    {\r
+    public boolean getRenderGaps() {\r
         return this._renderGaps;\r
-    } //-- boolean getRenderGaps()\r
+    }\r
+     //-- boolean getRenderGaps()\r
 \r
     /**\r
      * Returns the value of field 'showAnnotation'.\r
@@ -635,10 +623,10 @@ public class Viewport implements java.io.Serializable {
      * @return boolean\r
      * @return the value of field 'showAnnotation'.\r
      */\r
-    public boolean getShowAnnotation()\r
-    {\r
+    public boolean getShowAnnotation() {\r
         return this._showAnnotation;\r
-    } //-- boolean getShowAnnotation()\r
+    }\r
+     //-- boolean getShowAnnotation()\r
 \r
     /**\r
      * Returns the value of field 'showBoxes'.\r
@@ -646,10 +634,10 @@ public class Viewport implements java.io.Serializable {
      * @return boolean\r
      * @return the value of field 'showBoxes'.\r
      */\r
-    public boolean getShowBoxes()\r
-    {\r
+    public boolean getShowBoxes() {\r
         return this._showBoxes;\r
-    } //-- boolean getShowBoxes()\r
+    }\r
+     //-- boolean getShowBoxes()\r
 \r
     /**\r
      * Returns the value of field 'showColourText'.\r
@@ -657,10 +645,10 @@ public class Viewport implements java.io.Serializable {
      * @return boolean\r
      * @return the value of field 'showColourText'.\r
      */\r
-    public boolean getShowColourText()\r
-    {\r
+    public boolean getShowColourText() {\r
         return this._showColourText;\r
-    } //-- boolean getShowColourText()\r
+    }\r
+     //-- boolean getShowColourText()\r
 \r
     /**\r
      * Returns the value of field 'showConservation'.\r
@@ -668,10 +656,10 @@ public class Viewport implements java.io.Serializable {
      * @return boolean\r
      * @return the value of field 'showConservation'.\r
      */\r
-    public boolean getShowConservation()\r
-    {\r
+    public boolean getShowConservation() {\r
         return this._showConservation;\r
-    } //-- boolean getShowConservation()\r
+    }\r
+     //-- boolean getShowConservation()\r
 \r
     /**\r
      * Returns the value of field 'showFullId'.\r
@@ -679,10 +667,10 @@ public class Viewport implements java.io.Serializable {
      * @return boolean\r
      * @return the value of field 'showFullId'.\r
      */\r
-    public boolean getShowFullId()\r
-    {\r
+    public boolean getShowFullId() {\r
         return this._showFullId;\r
-    } //-- boolean getShowFullId()\r
+    }\r
+     //-- boolean getShowFullId()\r
 \r
     /**\r
      * Returns the value of field 'showIdentity'.\r
@@ -690,10 +678,10 @@ public class Viewport implements java.io.Serializable {
      * @return boolean\r
      * @return the value of field 'showIdentity'.\r
      */\r
-    public boolean getShowIdentity()\r
-    {\r
+    public boolean getShowIdentity() {\r
         return this._showIdentity;\r
-    } //-- boolean getShowIdentity()\r
+    }\r
+     //-- boolean getShowIdentity()\r
 \r
     /**\r
      * Returns the value of field 'showQuality'.\r
@@ -701,10 +689,10 @@ public class Viewport implements java.io.Serializable {
      * @return boolean\r
      * @return the value of field 'showQuality'.\r
      */\r
-    public boolean getShowQuality()\r
-    {\r
+    public boolean getShowQuality() {\r
         return this._showQuality;\r
-    } //-- boolean getShowQuality()\r
+    }\r
+     //-- boolean getShowQuality()\r
 \r
     /**\r
      * Returns the value of field 'showSequenceFeatures'.\r
@@ -712,10 +700,10 @@ public class Viewport implements java.io.Serializable {
      * @return boolean\r
      * @return the value of field 'showSequenceFeatures'.\r
      */\r
-    public boolean getShowSequenceFeatures()\r
-    {\r
+    public boolean getShowSequenceFeatures() {\r
         return this._showSequenceFeatures;\r
-    } //-- boolean getShowSequenceFeatures()\r
+    }\r
+     //-- boolean getShowSequenceFeatures()\r
 \r
     /**\r
      * Returns the value of field 'showText'.\r
@@ -723,10 +711,10 @@ public class Viewport implements java.io.Serializable {
      * @return boolean\r
      * @return the value of field 'showText'.\r
      */\r
-    public boolean getShowText()\r
-    {\r
+    public boolean getShowText() {\r
         return this._showText;\r
-    } //-- boolean getShowText()\r
+    }\r
+     //-- boolean getShowText()\r
 \r
     /**\r
      * Returns the value of field 'startRes'.\r
@@ -734,10 +722,10 @@ public class Viewport implements java.io.Serializable {
      * @return int\r
      * @return the value of field 'startRes'.\r
      */\r
-    public int getStartRes()\r
-    {\r
+    public int getStartRes() {\r
         return this._startRes;\r
-    } //-- int getStartRes()\r
+    }\r
+     //-- int getStartRes()\r
 \r
     /**\r
      * Returns the value of field 'startSeq'.\r
@@ -745,10 +733,10 @@ public class Viewport implements java.io.Serializable {
      * @return int\r
      * @return the value of field 'startSeq'.\r
      */\r
-    public int getStartSeq()\r
-    {\r
+    public int getStartSeq() {\r
         return this._startSeq;\r
-    } //-- int getStartSeq()\r
+    }\r
+     //-- int getStartSeq()\r
 \r
     /**\r
      * Returns the value of field 'title'.\r
@@ -756,10 +744,10 @@ public class Viewport implements java.io.Serializable {
      * @return String\r
      * @return the value of field 'title'.\r
      */\r
-    public java.lang.String getTitle()\r
-    {\r
+    public java.lang.String getTitle() {\r
         return this._title;\r
-    } //-- java.lang.String getTitle()\r
+    }\r
+     //-- java.lang.String getTitle()\r
 \r
     /**\r
      * Returns the value of field 'width'.\r
@@ -767,10 +755,10 @@ public class Viewport implements java.io.Serializable {
      * @return int\r
      * @return the value of field 'width'.\r
      */\r
-    public int getWidth()\r
-    {\r
+    public int getWidth() {\r
         return this._width;\r
-    } //-- int getWidth()\r
+    }\r
+     //-- int getWidth()\r
 \r
     /**\r
      * Returns the value of field 'wrapAlignment'.\r
@@ -778,10 +766,10 @@ public class Viewport implements java.io.Serializable {
      * @return boolean\r
      * @return the value of field 'wrapAlignment'.\r
      */\r
-    public boolean getWrapAlignment()\r
-    {\r
+    public boolean getWrapAlignment() {\r
         return this._wrapAlignment;\r
-    } //-- boolean getWrapAlignment()\r
+    }\r
+     //-- boolean getWrapAlignment()\r
 \r
     /**\r
      * Returns the value of field 'xpos'.\r
@@ -789,10 +777,10 @@ public class Viewport implements java.io.Serializable {
      * @return int\r
      * @return the value of field 'xpos'.\r
      */\r
-    public int getXpos()\r
-    {\r
+    public int getXpos() {\r
         return this._xpos;\r
-    } //-- int getXpos()\r
+    }\r
+     //-- int getXpos()\r
 \r
     /**\r
      * Returns the value of field 'ypos'.\r
@@ -800,10 +788,10 @@ public class Viewport implements java.io.Serializable {
      * @return int\r
      * @return the value of field 'ypos'.\r
      */\r
-    public int getYpos()\r
-    {\r
+    public int getYpos() {\r
         return this._ypos;\r
-    } //-- int getYpos()\r
+    }\r
+     //-- int getYpos()\r
 \r
     /**\r
      * Method hasConsThreshold\r
@@ -812,10 +800,10 @@ public class Viewport implements java.io.Serializable {
      *\r
      * @return boolean\r
      */\r
-    public boolean hasConsThreshold()\r
-    {\r
+    public boolean hasConsThreshold() {\r
         return this._has_consThreshold;\r
-    } //-- boolean hasConsThreshold()\r
+    }\r
+     //-- boolean hasConsThreshold()\r
 \r
     /**\r
      * Method hasConservationSelected\r
@@ -824,10 +812,10 @@ public class Viewport implements java.io.Serializable {
      *\r
      * @return boolean\r
      */\r
-    public boolean hasConservationSelected()\r
-    {\r
+    public boolean hasConservationSelected() {\r
         return this._has_conservationSelected;\r
-    } //-- boolean hasConservationSelected()\r
+    }\r
+     //-- boolean hasConservationSelected()\r
 \r
     /**\r
      * Method hasFontSize\r
@@ -836,10 +824,10 @@ public class Viewport implements java.io.Serializable {
      *\r
      * @return boolean\r
      */\r
-    public boolean hasFontSize()\r
-    {\r
+    public boolean hasFontSize() {\r
         return this._has_fontSize;\r
-    } //-- boolean hasFontSize()\r
+    }\r
+     //-- boolean hasFontSize()\r
 \r
     /**\r
      * Method hasFontStyle\r
@@ -848,10 +836,10 @@ public class Viewport implements java.io.Serializable {
      *\r
      * @return boolean\r
      */\r
-    public boolean hasFontStyle()\r
-    {\r
+    public boolean hasFontStyle() {\r
         return this._has_fontStyle;\r
-    } //-- boolean hasFontStyle()\r
+    }\r
+     //-- boolean hasFontStyle()\r
 \r
     /**\r
      * Method hasHeight\r
@@ -860,10 +848,10 @@ public class Viewport implements java.io.Serializable {
      *\r
      * @return boolean\r
      */\r
-    public boolean hasHeight()\r
-    {\r
+    public boolean hasHeight() {\r
         return this._has_height;\r
-    } //-- boolean hasHeight()\r
+    }\r
+     //-- boolean hasHeight()\r
 \r
     /**\r
      * Method hasPidSelected\r
@@ -872,10 +860,10 @@ public class Viewport implements java.io.Serializable {
      *\r
      * @return boolean\r
      */\r
-    public boolean hasPidSelected()\r
-    {\r
+    public boolean hasPidSelected() {\r
         return this._has_pidSelected;\r
-    } //-- boolean hasPidSelected()\r
+    }\r
+     //-- boolean hasPidSelected()\r
 \r
     /**\r
      * Method hasPidThreshold\r
@@ -884,10 +872,10 @@ public class Viewport implements java.io.Serializable {
      *\r
      * @return boolean\r
      */\r
-    public boolean hasPidThreshold()\r
-    {\r
+    public boolean hasPidThreshold() {\r
         return this._has_pidThreshold;\r
-    } //-- boolean hasPidThreshold()\r
+    }\r
+     //-- boolean hasPidThreshold()\r
 \r
     /**\r
      * Method hasRenderGaps\r
@@ -896,10 +884,10 @@ public class Viewport implements java.io.Serializable {
      *\r
      * @return boolean\r
      */\r
-    public boolean hasRenderGaps()\r
-    {\r
+    public boolean hasRenderGaps() {\r
         return this._has_renderGaps;\r
-    } //-- boolean hasRenderGaps()\r
+    }\r
+     //-- boolean hasRenderGaps()\r
 \r
     /**\r
      * Method hasShowAnnotation\r
@@ -908,10 +896,10 @@ public class Viewport implements java.io.Serializable {
      *\r
      * @return boolean\r
      */\r
-    public boolean hasShowAnnotation()\r
-    {\r
+    public boolean hasShowAnnotation() {\r
         return this._has_showAnnotation;\r
-    } //-- boolean hasShowAnnotation()\r
+    }\r
+     //-- boolean hasShowAnnotation()\r
 \r
     /**\r
      * Method hasShowBoxes\r
@@ -920,10 +908,10 @@ public class Viewport implements java.io.Serializable {
      *\r
      * @return boolean\r
      */\r
-    public boolean hasShowBoxes()\r
-    {\r
+    public boolean hasShowBoxes() {\r
         return this._has_showBoxes;\r
-    } //-- boolean hasShowBoxes()\r
+    }\r
+     //-- boolean hasShowBoxes()\r
 \r
     /**\r
      * Method hasShowColourText\r
@@ -932,10 +920,10 @@ public class Viewport implements java.io.Serializable {
      *\r
      * @return boolean\r
      */\r
-    public boolean hasShowColourText()\r
-    {\r
+    public boolean hasShowColourText() {\r
         return this._has_showColourText;\r
-    } //-- boolean hasShowColourText()\r
+    }\r
+     //-- boolean hasShowColourText()\r
 \r
     /**\r
      * Method hasShowConservation\r
@@ -944,10 +932,10 @@ public class Viewport implements java.io.Serializable {
      *\r
      * @return boolean\r
      */\r
-    public boolean hasShowConservation()\r
-    {\r
+    public boolean hasShowConservation() {\r
         return this._has_showConservation;\r
-    } //-- boolean hasShowConservation()\r
+    }\r
+     //-- boolean hasShowConservation()\r
 \r
     /**\r
      * Method hasShowFullId\r
@@ -956,10 +944,10 @@ public class Viewport implements java.io.Serializable {
      *\r
      * @return boolean\r
      */\r
-    public boolean hasShowFullId()\r
-    {\r
+    public boolean hasShowFullId() {\r
         return this._has_showFullId;\r
-    } //-- boolean hasShowFullId()\r
+    }\r
+     //-- boolean hasShowFullId()\r
 \r
     /**\r
      * Method hasShowIdentity\r
@@ -968,10 +956,10 @@ public class Viewport implements java.io.Serializable {
      *\r
      * @return boolean\r
      */\r
-    public boolean hasShowIdentity()\r
-    {\r
+    public boolean hasShowIdentity() {\r
         return this._has_showIdentity;\r
-    } //-- boolean hasShowIdentity()\r
+    }\r
+     //-- boolean hasShowIdentity()\r
 \r
     /**\r
      * Method hasShowQuality\r
@@ -980,10 +968,10 @@ public class Viewport implements java.io.Serializable {
      *\r
      * @return boolean\r
      */\r
-    public boolean hasShowQuality()\r
-    {\r
+    public boolean hasShowQuality() {\r
         return this._has_showQuality;\r
-    } //-- boolean hasShowQuality()\r
+    }\r
+     //-- boolean hasShowQuality()\r
 \r
     /**\r
      * Method hasShowSequenceFeatures\r
@@ -992,10 +980,10 @@ public class Viewport implements java.io.Serializable {
      *\r
      * @return boolean\r
      */\r
-    public boolean hasShowSequenceFeatures()\r
-    {\r
+    public boolean hasShowSequenceFeatures() {\r
         return this._has_showSequenceFeatures;\r
-    } //-- boolean hasShowSequenceFeatures()\r
+    }\r
+     //-- boolean hasShowSequenceFeatures()\r
 \r
     /**\r
      * Method hasShowText\r
@@ -1004,10 +992,10 @@ public class Viewport implements java.io.Serializable {
      *\r
      * @return boolean\r
      */\r
-    public boolean hasShowText()\r
-    {\r
+    public boolean hasShowText() {\r
         return this._has_showText;\r
-    } //-- boolean hasShowText()\r
+    }\r
+     //-- boolean hasShowText()\r
 \r
     /**\r
      * Method hasStartRes\r
@@ -1016,10 +1004,10 @@ public class Viewport implements java.io.Serializable {
      *\r
      * @return boolean\r
      */\r
-    public boolean hasStartRes()\r
-    {\r
+    public boolean hasStartRes() {\r
         return this._has_startRes;\r
-    } //-- boolean hasStartRes()\r
+    }\r
+     //-- boolean hasStartRes()\r
 \r
     /**\r
      * Method hasStartSeq\r
@@ -1028,10 +1016,10 @@ public class Viewport implements java.io.Serializable {
      *\r
      * @return boolean\r
      */\r
-    public boolean hasStartSeq()\r
-    {\r
+    public boolean hasStartSeq() {\r
         return this._has_startSeq;\r
-    } //-- boolean hasStartSeq()\r
+    }\r
+     //-- boolean hasStartSeq()\r
 \r
     /**\r
      * Method hasWidth\r
@@ -1040,10 +1028,10 @@ public class Viewport implements java.io.Serializable {
      *\r
      * @return boolean\r
      */\r
-    public boolean hasWidth()\r
-    {\r
+    public boolean hasWidth() {\r
         return this._has_width;\r
-    } //-- boolean hasWidth()\r
+    }\r
+     //-- boolean hasWidth()\r
 \r
     /**\r
      * Method hasWrapAlignment\r
@@ -1052,10 +1040,10 @@ public class Viewport implements java.io.Serializable {
      *\r
      * @return boolean\r
      */\r
-    public boolean hasWrapAlignment()\r
-    {\r
+    public boolean hasWrapAlignment() {\r
         return this._has_wrapAlignment;\r
-    } //-- boolean hasWrapAlignment()\r
+    }\r
+     //-- boolean hasWrapAlignment()\r
 \r
     /**\r
      * Method hasXpos\r
@@ -1064,10 +1052,10 @@ public class Viewport implements java.io.Serializable {
      *\r
      * @return boolean\r
      */\r
-    public boolean hasXpos()\r
-    {\r
+    public boolean hasXpos() {\r
         return this._has_xpos;\r
-    } //-- boolean hasXpos()\r
+    }\r
+     //-- boolean hasXpos()\r
 \r
     /**\r
      * Method hasYpos\r
@@ -1076,10 +1064,10 @@ public class Viewport implements java.io.Serializable {
      *\r
      * @return boolean\r
      */\r
-    public boolean hasYpos()\r
-    {\r
+    public boolean hasYpos() {\r
         return this._has_ypos;\r
-    } //-- boolean hasYpos()\r
+    }\r
+     //-- boolean hasYpos()\r
 \r
     /**\r
      * Method isValid\r
@@ -1088,16 +1076,16 @@ public class Viewport implements java.io.Serializable {
      *\r
      * @return boolean\r
      */\r
-    public boolean isValid()\r
-    {\r
+    public boolean isValid() {\r
         try {\r
             validate();\r
-        }\r
-        catch (org.exolab.castor.xml.ValidationException vex) {\r
+        } catch (org.exolab.castor.xml.ValidationException vex) {\r
             return false;\r
         }\r
+\r
         return true;\r
-    } //-- boolean isValid()\r
+    }\r
+     //-- boolean isValid()\r
 \r
     /**\r
      * Method marshal\r
@@ -1107,11 +1095,11 @@ public class Viewport implements java.io.Serializable {
      * @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
+        throws org.exolab.castor.xml.MarshalException, \r
+            org.exolab.castor.xml.ValidationException {\r
         Marshaller.marshal(this, out);\r
-    } //-- void marshal(java.io.Writer)\r
+    }\r
+     //-- void marshal(java.io.Writer)\r
 \r
     /**\r
      * Method marshal\r
@@ -1121,32 +1109,32 @@ public class Viewport implements java.io.Serializable {
      * @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
+        throws java.io.IOException, org.exolab.castor.xml.MarshalException, \r
+            org.exolab.castor.xml.ValidationException {\r
         Marshaller.marshal(this, handler);\r
-    } //-- void marshal(org.xml.sax.ContentHandler)\r
+    }\r
+     //-- void marshal(org.xml.sax.ContentHandler)\r
 \r
     /**\r
      * Sets the value of field 'bgColour'.\r
      *\r
      * @param bgColour the value of field 'bgColour'.\r
      */\r
-    public void setBgColour(java.lang.String bgColour)\r
-    {\r
+    public void setBgColour(java.lang.String bgColour) {\r
         this._bgColour = bgColour;\r
-    } //-- void setBgColour(java.lang.String)\r
+    }\r
+     //-- void setBgColour(java.lang.String)\r
 \r
     /**\r
      * Sets the value of field 'consThreshold'.\r
      *\r
      * @param consThreshold the value of field 'consThreshold'.\r
      */\r
-    public void setConsThreshold(int consThreshold)\r
-    {\r
+    public void setConsThreshold(int consThreshold) {\r
         this._consThreshold = consThreshold;\r
         this._has_consThreshold = true;\r
-    } //-- void setConsThreshold(int)\r
+    }\r
+     //-- void setConsThreshold(int)\r
 \r
     /**\r
      * Sets the value of field 'conservationSelected'.\r
@@ -1154,164 +1142,164 @@ public class Viewport implements java.io.Serializable {
      * @param conservationSelected the value of field\r
      * 'conservationSelected'.\r
      */\r
-    public void setConservationSelected(boolean conservationSelected)\r
-    {\r
+    public void setConservationSelected(boolean conservationSelected) {\r
         this._conservationSelected = conservationSelected;\r
         this._has_conservationSelected = true;\r
-    } //-- void setConservationSelected(boolean)\r
+    }\r
+     //-- void setConservationSelected(boolean)\r
 \r
     /**\r
      * Sets the value of field 'fontName'.\r
      *\r
      * @param fontName the value of field 'fontName'.\r
      */\r
-    public void setFontName(java.lang.String fontName)\r
-    {\r
+    public void setFontName(java.lang.String fontName) {\r
         this._fontName = fontName;\r
-    } //-- void setFontName(java.lang.String)\r
+    }\r
+     //-- void setFontName(java.lang.String)\r
 \r
     /**\r
      * Sets the value of field 'fontSize'.\r
      *\r
      * @param fontSize the value of field 'fontSize'.\r
      */\r
-    public void setFontSize(int fontSize)\r
-    {\r
+    public void setFontSize(int fontSize) {\r
         this._fontSize = fontSize;\r
         this._has_fontSize = true;\r
-    } //-- void setFontSize(int)\r
+    }\r
+     //-- void setFontSize(int)\r
 \r
     /**\r
      * Sets the value of field 'fontStyle'.\r
      *\r
      * @param fontStyle the value of field 'fontStyle'.\r
      */\r
-    public void setFontStyle(int fontStyle)\r
-    {\r
+    public void setFontStyle(int fontStyle) {\r
         this._fontStyle = fontStyle;\r
         this._has_fontStyle = true;\r
-    } //-- void setFontStyle(int)\r
+    }\r
+     //-- void setFontStyle(int)\r
 \r
     /**\r
      * Sets the value of field 'height'.\r
      *\r
      * @param height the value of field 'height'.\r
      */\r
-    public void setHeight(int height)\r
-    {\r
+    public void setHeight(int height) {\r
         this._height = height;\r
         this._has_height = true;\r
-    } //-- void setHeight(int)\r
+    }\r
+     //-- void setHeight(int)\r
 \r
     /**\r
      * Sets the value of field 'pidSelected'.\r
      *\r
      * @param pidSelected the value of field 'pidSelected'.\r
      */\r
-    public void setPidSelected(boolean pidSelected)\r
-    {\r
+    public void setPidSelected(boolean pidSelected) {\r
         this._pidSelected = pidSelected;\r
         this._has_pidSelected = true;\r
-    } //-- void setPidSelected(boolean)\r
+    }\r
+     //-- void setPidSelected(boolean)\r
 \r
     /**\r
      * Sets the value of field 'pidThreshold'.\r
      *\r
      * @param pidThreshold the value of field 'pidThreshold'.\r
      */\r
-    public void setPidThreshold(int pidThreshold)\r
-    {\r
+    public void setPidThreshold(int pidThreshold) {\r
         this._pidThreshold = pidThreshold;\r
         this._has_pidThreshold = true;\r
-    } //-- void setPidThreshold(int)\r
+    }\r
+     //-- void setPidThreshold(int)\r
 \r
     /**\r
      * Sets the value of field 'renderGaps'.\r
      *\r
      * @param renderGaps the value of field 'renderGaps'.\r
      */\r
-    public void setRenderGaps(boolean renderGaps)\r
-    {\r
+    public void setRenderGaps(boolean renderGaps) {\r
         this._renderGaps = renderGaps;\r
         this._has_renderGaps = true;\r
-    } //-- void setRenderGaps(boolean)\r
+    }\r
+     //-- void setRenderGaps(boolean)\r
 \r
     /**\r
      * Sets the value of field 'showAnnotation'.\r
      *\r
      * @param showAnnotation the value of field 'showAnnotation'.\r
      */\r
-    public void setShowAnnotation(boolean showAnnotation)\r
-    {\r
+    public void setShowAnnotation(boolean showAnnotation) {\r
         this._showAnnotation = showAnnotation;\r
         this._has_showAnnotation = true;\r
-    } //-- void setShowAnnotation(boolean)\r
+    }\r
+     //-- void setShowAnnotation(boolean)\r
 \r
     /**\r
      * Sets the value of field 'showBoxes'.\r
      *\r
      * @param showBoxes the value of field 'showBoxes'.\r
      */\r
-    public void setShowBoxes(boolean showBoxes)\r
-    {\r
+    public void setShowBoxes(boolean showBoxes) {\r
         this._showBoxes = showBoxes;\r
         this._has_showBoxes = true;\r
-    } //-- void setShowBoxes(boolean)\r
+    }\r
+     //-- void setShowBoxes(boolean)\r
 \r
     /**\r
      * Sets the value of field 'showColourText'.\r
      *\r
      * @param showColourText the value of field 'showColourText'.\r
      */\r
-    public void setShowColourText(boolean showColourText)\r
-    {\r
+    public void setShowColourText(boolean showColourText) {\r
         this._showColourText = showColourText;\r
         this._has_showColourText = true;\r
-    } //-- void setShowColourText(boolean)\r
+    }\r
+     //-- void setShowColourText(boolean)\r
 \r
     /**\r
      * Sets the value of field 'showConservation'.\r
      *\r
      * @param showConservation the value of field 'showConservation'\r
      */\r
-    public void setShowConservation(boolean showConservation)\r
-    {\r
+    public void setShowConservation(boolean showConservation) {\r
         this._showConservation = showConservation;\r
         this._has_showConservation = true;\r
-    } //-- void setShowConservation(boolean)\r
+    }\r
+     //-- void setShowConservation(boolean)\r
 \r
     /**\r
      * Sets the value of field 'showFullId'.\r
      *\r
      * @param showFullId the value of field 'showFullId'.\r
      */\r
-    public void setShowFullId(boolean showFullId)\r
-    {\r
+    public void setShowFullId(boolean showFullId) {\r
         this._showFullId = showFullId;\r
         this._has_showFullId = true;\r
-    } //-- void setShowFullId(boolean)\r
+    }\r
+     //-- void setShowFullId(boolean)\r
 \r
     /**\r
      * Sets the value of field 'showIdentity'.\r
      *\r
      * @param showIdentity the value of field 'showIdentity'.\r
      */\r
-    public void setShowIdentity(boolean showIdentity)\r
-    {\r
+    public void setShowIdentity(boolean showIdentity) {\r
         this._showIdentity = showIdentity;\r
         this._has_showIdentity = true;\r
-    } //-- void setShowIdentity(boolean)\r
+    }\r
+     //-- void setShowIdentity(boolean)\r
 \r
     /**\r
      * Sets the value of field 'showQuality'.\r
      *\r
      * @param showQuality the value of field 'showQuality'.\r
      */\r
-    public void setShowQuality(boolean showQuality)\r
-    {\r
+    public void setShowQuality(boolean showQuality) {\r
         this._showQuality = showQuality;\r
         this._has_showQuality = true;\r
-    } //-- void setShowQuality(boolean)\r
+    }\r
+     //-- void setShowQuality(boolean)\r
 \r
     /**\r
      * Sets the value of field 'showSequenceFeatures'.\r
@@ -1319,98 +1307,98 @@ public class Viewport implements java.io.Serializable {
      * @param showSequenceFeatures the value of field\r
      * 'showSequenceFeatures'.\r
      */\r
-    public void setShowSequenceFeatures(boolean showSequenceFeatures)\r
-    {\r
+    public void setShowSequenceFeatures(boolean showSequenceFeatures) {\r
         this._showSequenceFeatures = showSequenceFeatures;\r
         this._has_showSequenceFeatures = true;\r
-    } //-- void setShowSequenceFeatures(boolean)\r
+    }\r
+     //-- void setShowSequenceFeatures(boolean)\r
 \r
     /**\r
      * Sets the value of field 'showText'.\r
      *\r
      * @param showText the value of field 'showText'.\r
      */\r
-    public void setShowText(boolean showText)\r
-    {\r
+    public void setShowText(boolean showText) {\r
         this._showText = showText;\r
         this._has_showText = true;\r
-    } //-- void setShowText(boolean)\r
+    }\r
+     //-- void setShowText(boolean)\r
 \r
     /**\r
      * Sets the value of field 'startRes'.\r
      *\r
      * @param startRes the value of field 'startRes'.\r
      */\r
-    public void setStartRes(int startRes)\r
-    {\r
+    public void setStartRes(int startRes) {\r
         this._startRes = startRes;\r
         this._has_startRes = true;\r
-    } //-- void setStartRes(int)\r
+    }\r
+     //-- void setStartRes(int)\r
 \r
     /**\r
      * Sets the value of field 'startSeq'.\r
      *\r
      * @param startSeq the value of field 'startSeq'.\r
      */\r
-    public void setStartSeq(int startSeq)\r
-    {\r
+    public void setStartSeq(int startSeq) {\r
         this._startSeq = startSeq;\r
         this._has_startSeq = true;\r
-    } //-- void setStartSeq(int)\r
+    }\r
+     //-- void setStartSeq(int)\r
 \r
     /**\r
      * Sets the value of field 'title'.\r
      *\r
      * @param title the value of field 'title'.\r
      */\r
-    public void setTitle(java.lang.String title)\r
-    {\r
+    public void setTitle(java.lang.String title) {\r
         this._title = title;\r
-    } //-- void setTitle(java.lang.String)\r
+    }\r
+     //-- void setTitle(java.lang.String)\r
 \r
     /**\r
      * Sets the value of field 'width'.\r
      *\r
      * @param width the value of field 'width'.\r
      */\r
-    public void setWidth(int width)\r
-    {\r
+    public void setWidth(int width) {\r
         this._width = width;\r
         this._has_width = true;\r
-    } //-- void setWidth(int)\r
+    }\r
+     //-- void setWidth(int)\r
 \r
     /**\r
      * Sets the value of field 'wrapAlignment'.\r
      *\r
      * @param wrapAlignment the value of field 'wrapAlignment'.\r
      */\r
-    public void setWrapAlignment(boolean wrapAlignment)\r
-    {\r
+    public void setWrapAlignment(boolean wrapAlignment) {\r
         this._wrapAlignment = wrapAlignment;\r
         this._has_wrapAlignment = true;\r
-    } //-- void setWrapAlignment(boolean)\r
+    }\r
+     //-- void setWrapAlignment(boolean)\r
 \r
     /**\r
      * Sets the value of field 'xpos'.\r
      *\r
      * @param xpos the value of field 'xpos'.\r
      */\r
-    public void setXpos(int xpos)\r
-    {\r
+    public void setXpos(int xpos) {\r
         this._xpos = xpos;\r
         this._has_xpos = true;\r
-    } //-- void setXpos(int)\r
+    }\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
+    public void setYpos(int ypos) {\r
         this._ypos = ypos;\r
         this._has_ypos = true;\r
-    } //-- void setYpos(int)\r
+    }\r
+     //-- void setYpos(int)\r
 \r
     /**\r
      * Method unmarshal\r
@@ -1421,20 +1409,20 @@ public class Viewport implements java.io.Serializable {
      * @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.binding.Viewport) Unmarshaller.unmarshal(jalview.binding.Viewport.class, reader);\r
-    } //-- java.lang.Object unmarshal(java.io.Reader)\r
+        throws org.exolab.castor.xml.MarshalException, \r
+            org.exolab.castor.xml.ValidationException {\r
+        return (jalview.binding.Viewport) Unmarshaller.unmarshal(jalview.binding.Viewport.class,\r
+            reader);\r
+    }\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
+    public void validate() throws org.exolab.castor.xml.ValidationException {\r
         org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator();\r
         validator.validate(this);\r
-    } //-- void validate()\r
-\r
+    }\r
+     //-- void validate()\r
 }\r
index 804414a..b3cf890 100755 (executable)
 * 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.datamodel;\r
 \r
 import jalview.analysis.*;\r
+\r
 import jalview.util.*;\r
+\r
 import java.util.*;\r
 \r
+\r
 /** Data structure to hold and manipulate a multiple sequence alignment\r
  */\r
-public class Alignment implements AlignmentI\r
-{\r
+public class Alignment implements AlignmentI {\r
+    protected Vector sequences;\r
+    protected Vector groups = new Vector();\r
+    protected Vector superGroup = new Vector();\r
+    protected char gapCharacter = '-';\r
+    public AlignmentAnnotation[] annotations;\r
+    public boolean featuresAdded = false;\r
+\r
+    /** Make an alignment from an array of Sequences.\r
+    *\r
+    * @param sequences\r
+    */\r
+    public Alignment(SequenceI[] seqs) {\r
+        sequences = new Vector();\r
 \r
-  protected Vector      sequences;\r
-  protected Vector      groups = new Vector();\r
-  protected Vector   superGroup = new Vector();\r
-  protected char        gapCharacter = '-';\r
-  public AlignmentAnnotation [] annotations;\r
+        for (int i = 0; i < seqs.length; i++)\r
+            sequences.addElement(seqs[i]);\r
 \r
-  public boolean featuresAdded = false;\r
+        getWidth();\r
+    }\r
 \r
-  /** Make an alignment from an array of Sequences.\r
-  *\r
-  * @param sequences\r
-  */\r
-  public Alignment(SequenceI[] seqs) {\r
-    sequences = new Vector();\r
+    public Vector getSequences() {\r
+        return sequences;\r
+    }\r
 \r
-    for (int i=0; i < seqs.length; i++)\r
-      sequences.addElement(seqs[i]);\r
+    public SequenceI getSequenceAt(int i) {\r
+        if (i < sequences.size()) {\r
+            return (SequenceI) sequences.elementAt(i);\r
+        }\r
 \r
-    getWidth();\r
-  }\r
+        return null;\r
+    }\r
 \r
-  public Vector      getSequences() {\r
-    return sequences;\r
-  }\r
+    /** Adds a sequence to the alignment.  Recalculates maxLength and size.\r
+     *\r
+     * @param snew\r
+     */\r
+    public void addSequence(SequenceI snew) {\r
+        sequences.addElement(snew);\r
+    }\r
 \r
-  public SequenceI getSequenceAt(int i) {\r
-    if (i < sequences.size()) {\r
-      return (SequenceI)sequences.elementAt(i);\r
+    public void addSequence(SequenceI[] seq) {\r
+        for (int i = 0; i < seq.length; i++) {\r
+            addSequence(seq[i]);\r
+        }\r
     }\r
 \r
-    return null;\r
-  }\r
+    /** Adds a sequence to the alignment.  Recalculates maxLength and size.\r
+      *\r
+     * @param snew\r
+     */\r
+    public void setSequenceAt(int i, SequenceI snew) {\r
+        SequenceI oldseq = getSequenceAt(i);\r
+        deleteSequence(oldseq);\r
 \r
-  /** Adds a sequence to the alignment.  Recalculates maxLength and size.\r
-   *\r
-   * @param snew\r
-   */\r
-  public void addSequence(SequenceI snew) {\r
-    sequences.addElement(snew);\r
-  }\r
+        sequences.setElementAt(snew, i);\r
+    }\r
 \r
-  public void addSequence(SequenceI[] seq) {\r
-    for (int i=0; i < seq.length; i++) {\r
-      addSequence(seq[i]);\r
+    public Vector getGroups() {\r
+        return groups;\r
     }\r
-  }\r
 \r
-  /** Adds a sequence to the alignment.  Recalculates maxLength and size.\r
-    *\r
-   * @param snew\r
-   */\r
-  public void setSequenceAt(int i,SequenceI snew) {\r
-    SequenceI oldseq = getSequenceAt(i);\r
-    deleteSequence(oldseq);\r
+    /** Sorts the sequences by sequence group size - largest to smallest.\r
+     * Uses QuickSort.\r
+     */\r
+    public void sortGroups() {\r
+        float[] arr = new float[groups.size()];\r
+        Object[] s = new Object[groups.size()];\r
 \r
-    sequences.setElementAt(snew,i);\r
-  }\r
+        for (int i = 0; i < groups.size(); i++) {\r
+            arr[i] = ((SequenceGroup) groups.elementAt(i)).sequences.size();\r
+            s[i] = groups.elementAt(i);\r
+        }\r
 \r
-  public Vector getGroups() {\r
-    return groups;\r
-  }\r
-\r
-  /** Sorts the sequences by sequence group size - largest to smallest.\r
-   * Uses QuickSort.\r
-   */\r
-  public void sortGroups() {\r
-    float[]  arr = new float [groups.size()];\r
-    Object[] s   = new Object[groups.size()];\r
-\r
-    for (int i=0; i < groups.size(); i++) {\r
-      arr[i] = ((SequenceGroup)groups.elementAt(i)).sequences.size();\r
-      s[i]   = groups.elementAt(i);\r
-    }\r
+        QuickSort.sort(arr, s);\r
 \r
-    QuickSort.sort(arr,s);\r
+        Vector newg = new Vector(groups.size());\r
 \r
-    Vector newg = new Vector(groups.size());\r
+        for (int i = groups.size() - 1; i >= 0; i--) {\r
+            newg.addElement(s[i]);\r
+        }\r
 \r
-    for (int i=groups.size()-1; i >= 0; i--) {\r
-      newg.addElement(s[i]);\r
+        groups = newg;\r
     }\r
 \r
-    groups = newg;\r
-  }\r
+    /** Takes out columns consisting entirely of gaps (-,.," ")\r
+     */\r
+    public void removeGaps() {\r
+        SequenceI current;\r
+        int iSize = getWidth();\r
+\r
+        for (int i = 0; i < iSize; i++) {\r
+            boolean delete = true;\r
+\r
+            for (int j = 0; j < getHeight(); j++) {\r
+                current = getSequenceAt(j);\r
+\r
+                if (current.getLength() > i) {\r
+                    /* MC Should move this to a method somewhere */\r
+                    if (!jalview.util.Comparison.isGap(current.getCharAt(i))) {\r
+                        delete = false;\r
+                    }\r
+                }\r
+            }\r
+\r
+            if (delete) {\r
+                deleteColumns(i, i);\r
+                iSize--;\r
+                i--;\r
+            }\r
+        }\r
+    }\r
 \r
-  /** Takes out columns consisting entirely of gaps (-,.," ")\r
-   */\r
-  public void removeGaps()\r
-  {\r
+    /** Returns an array of Sequences containing columns\r
+     * start to end (inclusive) only.\r
+     *\r
+     * @param start start column to fetch\r
+     * @param end end column to fetch\r
+     * @return Array of Sequences, ready to put into a new Alignment\r
+     */\r
+    public SequenceI[] getColumns(int start, int end) {\r
+        return getColumns(0, getHeight() - 1, start, end);\r
+    }\r
 \r
-    SequenceI current;\r
-    int iSize = getWidth();\r
-    for (int i=0; i < iSize; i++)\r
-    {\r
-      boolean delete = true;\r
-      for (int j=0; j < getHeight(); j++)\r
-      {\r
-        current = getSequenceAt(j);\r
-        if (current.getLength() > i)\r
-        {\r
-           /* MC Should move this to a method somewhere */\r
-          if ( !jalview.util.Comparison.isGap(current.getCharAt(i)))\r
-            delete = false;\r
+    /** Removes a range of columns (start to end inclusive).\r
+     *\r
+     * @param start Start column in the alignment\r
+     * @param end End column in the alignment\r
+     */\r
+    public void deleteColumns(int start, int end) {\r
+        deleteColumns(0, getHeight() - 1, start, end);\r
+    }\r
 \r
+    public void deleteColumns(int seq1, int seq2, int start, int end) {\r
+        for (int i = 0; i <= (end - start); i++) {\r
+            for (int j = seq1; j <= seq2; j++) {\r
+                getSequenceAt(j).deleteCharAt(start);\r
+            }\r
         }\r
-      }\r
+    }\r
 \r
-      if ( delete )\r
-      {\r
-        deleteColumns(i,i);\r
-        iSize--;\r
-        i--;\r
-      }\r
+    public void insertColumns(SequenceI[] seqs, int pos) {\r
+        if (seqs.length == getHeight()) {\r
+            for (int i = 0; i < getHeight(); i++) {\r
+                String tmp = new String(getSequenceAt(i).getSequence());\r
+                getSequenceAt(i).setSequence(tmp.substring(0, pos) +\r
+                    seqs[i].getSequence() + tmp.substring(pos));\r
+            }\r
+        }\r
     }\r
 \r
+    public SequenceI[] getColumns(int seq1, int seq2, int start, int end) {\r
+        SequenceI[] seqs = new Sequence[(seq2 - seq1) + 1];\r
 \r
-  }\r
+        for (int i = seq1; i <= seq2; i++) {\r
+            seqs[i] = new Sequence(getSequenceAt(i).getName(),\r
+                    getSequenceAt(i).getSequence().substring(start, end),\r
+                    getSequenceAt(i).findPosition(start),\r
+                    getSequenceAt(i).findPosition(end));\r
+        }\r
 \r
-  /** Returns an array of Sequences containing columns\r
-   * start to end (inclusive) only.\r
-   *\r
-   * @param start start column to fetch\r
-   * @param end end column to fetch\r
-   * @return Array of Sequences, ready to put into a new Alignment\r
-   */\r
-  public SequenceI[] getColumns(int start, int end) {\r
-    return getColumns(0,getHeight()-1,start,end);\r
-  }\r
-\r
-  /** Removes a range of columns (start to end inclusive).\r
-   *\r
-   * @param start Start column in the alignment\r
-   * @param end End column in the alignment\r
-   */\r
-  public void deleteColumns(int start, int end) {\r
-    deleteColumns(0,getHeight()-1,start,end);\r
-  }\r
+        return seqs;\r
+    }\r
 \r
-  public void deleteColumns(int seq1, int seq2, int start, int end) {\r
+    public void trimLeft(int i) {\r
+        for (int j = 0; j < getHeight(); j++) {\r
+            SequenceI s = getSequenceAt(j);\r
+            int newstart = s.findPosition(i);\r
 \r
-    for (int i=0; i <= (end-start); i++) {\r
-      for (int j=seq1; j <= seq2; j++) {\r
-        getSequenceAt(j).deleteCharAt(start);\r
-      }\r
+            s.setStart(newstart);\r
+            s.setSequence(s.getSequence().substring(i));\r
+        }\r
     }\r
-  }\r
 \r
-  public void insertColumns(SequenceI[] seqs, int pos) {\r
-    if (seqs.length == getHeight()) {\r
-      for (int i=0; i < getHeight();i++) {\r
-        String tmp = new String(getSequenceAt(i).getSequence());\r
-        getSequenceAt(i).setSequence(tmp.substring(0,pos) + seqs[i].getSequence() + tmp.substring(pos));\r
-      }\r
+    public void trimRight(int i) {\r
+        for (int j = 0; j < getHeight(); j++) {\r
+            SequenceI s = getSequenceAt(j);\r
+            int newend = s.findPosition(i);\r
 \r
+            s.setEnd(newend);\r
+            s.setSequence(s.getSequence().substring(0, i + 1));\r
+        }\r
     }\r
-  }\r
 \r
-  public SequenceI[] getColumns(int seq1, int seq2, int start, int end) {\r
-    SequenceI[] seqs = new Sequence[(seq2-seq1)+1];\r
-    for (int i=seq1; i<= seq2; i++ ) {\r
-      seqs[i] = new Sequence(getSequenceAt(i).getName(),\r
-                             getSequenceAt(i).getSequence().substring(start,end),\r
-                             getSequenceAt(i).findPosition(start),\r
-                             getSequenceAt(i).findPosition(end));\r
+    public void deleteSequence(SequenceI s) {\r
+        for (int i = 0; i < getHeight(); i++)\r
+            if (getSequenceAt(i) == s) {\r
+                deleteSequence(i);\r
+            }\r
     }\r
-    return seqs;\r
-  }\r
 \r
-  public void trimLeft(int i) {\r
-    for (int j = 0;j< getHeight();j++) {\r
+    public void deleteSequence(int i) {\r
+        sequences.removeElementAt(i);\r
+    }\r
 \r
-      SequenceI s        = getSequenceAt(j);\r
-      int       newstart = s.findPosition(i);\r
+    public Vector removeRedundancy(float threshold, Vector sel) {\r
+        Vector del = new Vector();\r
+\r
+        for (int i = 1; i < sel.size(); i++) {\r
+            for (int j = 0; j < i; j++) {\r
+                // Only do the comparison if either have not been deleted\r
+                if (!del.contains((SequenceI) sel.elementAt(i)) ||\r
+                        !del.contains((SequenceI) sel.elementAt(j))) {\r
+                    // use PID instead of Comparison (which is really not pleasant)\r
+                    float pid = Comparison.PID((SequenceI) sel.elementAt(j),\r
+                            (SequenceI) sel.elementAt(i));\r
+\r
+                    if (pid >= threshold) {\r
+                        // Delete the shortest one\r
+                        if (((SequenceI) sel.elementAt(j)).getSequence().length() > ((SequenceI) sel\r
+                                                                                         .elementAt(\r
+                                    i)).getSequence().length()) {\r
+                            del.addElement(sel.elementAt(i));\r
+                        } else {\r
+                            del.addElement(sel.elementAt(i));\r
+                        }\r
+                    }\r
+                }\r
+            }\r
+        }\r
 \r
-      s.setStart(newstart);\r
-      s.setSequence(s.getSequence().substring(i));\r
+        // Now delete the sequences\r
+        for (int i = 0; i < del.size(); i++)\r
+            deleteSequence((SequenceI) del.elementAt(i));\r
 \r
+        return del;\r
     }\r
-  }\r
 \r
-  public void  trimRight(int i) {\r
-    for (int j = 0;j< getHeight();j++) {\r
-      SequenceI s      = getSequenceAt(j);\r
-      int       newend = s.findPosition(i);\r
+    public void sortByPID(SequenceI s) {\r
+        float[] scores = new float[getHeight()];\r
+        SequenceI[] seqs = new SequenceI[getHeight()];\r
+\r
+        for (int i = 0; i < getHeight(); i++) {\r
+            scores[i] = Comparison.compare(getSequenceAt(i), s);\r
+            seqs[i] = getSequenceAt(i);\r
+        }\r
+\r
+        QuickSort.sort(scores, 0, scores.length - 1, seqs);\r
+\r
+        int len = 0;\r
+\r
+        if ((getHeight() % 2) == 0) {\r
+            len = getHeight() / 2;\r
+        } else {\r
+            len = (getHeight() + 1) / 2;\r
+        }\r
 \r
-      s.setEnd(newend);\r
-      s.setSequence(s.getSequence().substring(0,i+1));\r
+        for (int i = 0; i < len; i++) {\r
+            SequenceI tmp = seqs[i];\r
+            sequences.setElementAt(seqs[getHeight() - i - 1], i);\r
+            sequences.setElementAt(tmp, getHeight() - i - 1);\r
+        }\r
     }\r
-  }\r
 \r
-  public void deleteSequence(SequenceI s)\r
-  {\r
-    for (int i=0; i < getHeight(); i++)\r
-      if (getSequenceAt(i) == s)\r
-        deleteSequence(i);\r
-  }\r
+    public void sortByID() {\r
+        String[] ids = new String[getHeight()];\r
+        SequenceI[] seqs = new SequenceI[getHeight()];\r
 \r
-  public void  deleteSequence(int i)\r
-  {\r
-    sequences.removeElementAt(i);\r
-  }\r
+        for (int i = 0; i < getHeight(); i++) {\r
+            ids[i] = getSequenceAt(i).getName();\r
+            seqs[i] = getSequenceAt(i);\r
+        }\r
 \r
+        QuickSort.sort(ids, seqs);\r
 \r
-  public Vector removeRedundancy(float threshold, Vector sel) {\r
-    Vector del = new Vector();\r
+        int len = 0;\r
 \r
-    for (int i = 1; i < sel.size(); i++)\r
-    {\r
-      for (int j = 0; j < i; j++)\r
-      {\r
-        // Only do the comparison if either have not been deleted\r
-        if (!del.contains( (SequenceI) sel.elementAt(i)) ||\r
-            !del.contains( (SequenceI) sel.elementAt(j)))\r
-        {\r
-          // use PID instead of Comparison (which is really not pleasant)\r
-          float pid = Comparison.PID( (SequenceI) sel.elementAt(j),\r
-                                         (SequenceI) sel.elementAt(i));\r
+        if ((getHeight() % 2) == 0) {\r
+            len = getHeight() / 2;\r
+        } else {\r
+            len = (getHeight() + 1) / 2;\r
+            System.out.println("DEBUG:Sort len is odd = " + len); // log.\r
+        }\r
 \r
-          if (pid >= threshold)\r
-          {\r
-            // Delete the shortest one\r
-            if ( ( (SequenceI) sel.elementAt(j)).getSequence().length() >\r
-                ( (SequenceI) sel.elementAt(i)).getSequence().length())\r
-              del.addElement(sel.elementAt(i));\r
-            else\r
-              del.addElement(sel.elementAt(i));\r
-          }\r
+        for (int i = 0; i < len; i++) {\r
+            System.out.println("DEBUG:Swapping " + seqs[i].getName() + " and " +\r
+                seqs[getHeight() - i - 1].getName()); // log.\r
+\r
+            SequenceI tmp = seqs[i];\r
+            sequences.setElementAt(seqs[getHeight() - i - 1], i);\r
+            sequences.setElementAt(tmp, getHeight() - i - 1);\r
         }\r
-      }\r
     }\r
 \r
-    // Now delete the sequences\r
-    for (int i=0; i < del.size(); i++)\r
-      deleteSequence((SequenceI)del.elementAt(i));\r
-\r
-    return del;\r
-  }\r
+    /**    */\r
+    public SequenceGroup findGroup(int i) {\r
+        return findGroup(getSequenceAt(i));\r
+    }\r
 \r
-  public void sortByPID(SequenceI s) {\r
+    /**    */\r
+    public SequenceGroup findGroup(SequenceI s) {\r
+        for (int i = 0; i < this.groups.size(); i++) {\r
+            SequenceGroup sg = (SequenceGroup) groups.elementAt(i);\r
 \r
-    float     scores[] = new float[getHeight()];\r
-    SequenceI seqs[]   = new SequenceI[getHeight()];\r
+            if (sg.sequences.contains(s)) {\r
+                return sg;\r
+            }\r
+        }\r
 \r
-    for (int i = 0; i < getHeight(); i++) {\r
-      scores[i] = Comparison.compare(getSequenceAt(i),s);\r
-      seqs[i]   = getSequenceAt(i);\r
+        return null;\r
     }\r
 \r
-    QuickSort.sort(scores,0,scores.length-1,seqs);\r
+    public SequenceGroup[] findAllGroups(SequenceI s) {\r
+        Vector temp = new Vector();\r
+\r
+        for (int i = 0; i < this.groups.size(); i++) {\r
+            SequenceGroup sg = (SequenceGroup) groups.elementAt(i);\r
+\r
+            if (sg.sequences.contains(s)) {\r
+                temp.addElement(sg);\r
+            }\r
+        }\r
+\r
+        SequenceGroup[] ret = new SequenceGroup[temp.size()];\r
 \r
-    int len = 0;\r
+        for (int i = 0; i < temp.size(); i++)\r
+            ret[i] = (SequenceGroup) temp.elementAt(i);\r
 \r
-    if (getHeight()%2 == 0) {\r
-      len = getHeight()/2;\r
-    } else {\r
-      len = (getHeight()+1)/2;\r
+        return ret;\r
     }\r
 \r
-    for (int i = 0; i < len; i++) {\r
-      SequenceI tmp = seqs[i];\r
-      sequences.setElementAt(seqs[getHeight()-i-1],i);\r
-      sequences.setElementAt(tmp,getHeight()-i-1);\r
+    /**    */\r
+    public void addToGroup(SequenceGroup g, SequenceI s) {\r
+        if (!(g.sequences.contains(s))) {\r
+            g.sequences.addElement(s);\r
+        }\r
     }\r
-  }\r
 \r
-  public void sortByID() {\r
-    String    ids[]   = new String[getHeight()];\r
-    SequenceI seqs[]  = new SequenceI[getHeight()];\r
+    /**    */\r
+    public void removeFromGroup(SequenceGroup g, SequenceI s) {\r
+        if ((g != null) && (g.sequences != null)) {\r
+            if (g.sequences.contains(s)) {\r
+                g.sequences.removeElement(s);\r
+\r
+                if (g.sequences.size() == 0) {\r
+                    groups.removeElement(g);\r
+                }\r
+            }\r
+        }\r
+    }\r
 \r
-    for (int i = 0; i < getHeight(); i++) {\r
-      ids[i]  = getSequenceAt(i).getName();\r
-      seqs[i] = getSequenceAt(i);\r
+    public void addSuperGroup(SuperGroup sg) {\r
+        superGroup.addElement(sg);\r
     }\r
 \r
-    QuickSort.sort(ids,seqs);\r
+    public void removeSuperGroup(SuperGroup sg) {\r
+        superGroup.removeElement(sg);\r
+    }\r
 \r
-    int len = 0;\r
+    public SuperGroup getSuperGroup(SequenceGroup sg) {\r
+        for (int i = 0; i < this.superGroup.size(); i++) {\r
+            SuperGroup temp = (SuperGroup) superGroup.elementAt(i);\r
 \r
-    if (getHeight()%2 == 0) {\r
-      len = getHeight()/2;\r
-    } else {\r
-      len = (getHeight()+1)/2;\r
-      System.out.println("DEBUG:Sort len is odd = " + len); // log.\r
+            if (temp.sequenceGroups.contains(sg)) {\r
+                return temp;\r
+            }\r
+        }\r
+\r
+        return null;\r
     }\r
-    for (int i = 0; i < len; i++) {\r
-      System.out.println("DEBUG:Swapping " + seqs[i].getName() + " and " + seqs[getHeight()-i-1].getName()); // log.\r
-      SequenceI tmp = seqs[i];\r
-      sequences.setElementAt(seqs[getHeight()-i-1],i);\r
-      sequences.setElementAt(tmp,getHeight()-i-1);\r
+\r
+    /**    */\r
+    public void addGroup(SequenceGroup sg) {\r
+        if (!groups.contains(sg)) {\r
+            groups.addElement(sg);\r
+        }\r
     }\r
-  }\r
 \r
-  /**    */\r
-  public SequenceGroup findGroup(int i) {\r
-    return findGroup(getSequenceAt(i));\r
-  }\r
+    public void deleteAllGroups() {\r
+        groups.removeAllElements();\r
+        superGroup.removeAllElements();\r
+\r
+        int i = 0;\r
 \r
-  /**    */\r
-  public SequenceGroup findGroup(SequenceI s) {\r
-    for (int i = 0; i < this.groups.size();i++)\r
-    {\r
-      SequenceGroup sg = (SequenceGroup)groups.elementAt(i);\r
-      if (sg.sequences.contains(s))\r
-        return sg;\r
+        while (i < sequences.size()) {\r
+            SequenceI s = getSequenceAt(i);\r
+            s.setColor(java.awt.Color.white);\r
+            i++;\r
+        }\r
+    }\r
 \r
+    /**    */\r
+    public void deleteGroup(SequenceGroup g) {\r
+        if (groups.contains(g)) {\r
+            groups.removeElement(g);\r
+        }\r
     }\r
-    return null;\r
-  }\r
 \r
-  public SequenceGroup [] findAllGroups(SequenceI s)\r
-  {\r
+    /**    */\r
+    public SequenceI findName(String name) {\r
+        int i = 0;\r
 \r
-    Vector temp = new Vector();\r
+        while (i < sequences.size()) {\r
+            SequenceI s = getSequenceAt(i);\r
 \r
-    for (int i = 0; i < this.groups.size();i++)\r
-    {\r
-      SequenceGroup sg = (SequenceGroup)groups.elementAt(i);\r
+            if (s.getName().equals(name)) {\r
+                return s;\r
+            }\r
 \r
-      if (sg.sequences.contains(s))\r
-       temp.addElement(sg);\r
+            i++;\r
+        }\r
+\r
+        return null;\r
     }\r
 \r
-    SequenceGroup [] ret = new SequenceGroup[temp.size()];\r
-    for(int i=0; i<temp.size(); i++)\r
-      ret[i] = (SequenceGroup)temp.elementAt(i);\r
+    /**    */\r
+    public SequenceI findbyDisplayId(String name) {\r
+        int i = 0;\r
+\r
+        while (i < sequences.size()) {\r
+            SequenceI s = getSequenceAt(i);\r
 \r
-    return ret;\r
+            if (s.getDisplayId().equals(name)) {\r
+                return s;\r
+            }\r
 \r
-  }\r
-  /**    */\r
-  public void addToGroup(SequenceGroup g, SequenceI s) {\r
-    if (!(g.sequences.contains(s))) {\r
-      g.sequences.addElement(s);\r
+            i++;\r
+        }\r
+\r
+        return null;\r
     }\r
-  }\r
-  /**    */\r
-  public void removeFromGroup(SequenceGroup g,SequenceI s) {\r
-    if (g != null && g.sequences != null) {\r
-      if (g.sequences.contains(s)) {\r
-        g.sequences.removeElement(s);\r
-        if (g.sequences.size() == 0) {\r
-          groups.removeElement(g);\r
+\r
+    /**    */\r
+    public int findIndex(SequenceI s) {\r
+        int i = 0;\r
+\r
+        while (i < sequences.size()) {\r
+            if (s == getSequenceAt(i)) {\r
+                return i;\r
+            }\r
+\r
+            i++;\r
         }\r
-      }\r
+\r
+        return -1;\r
+    }\r
+\r
+    public int getHeight() {\r
+        return sequences.size();\r
     }\r
-  }\r
 \r
-  public void addSuperGroup(SuperGroup sg)\r
-  {\r
-    superGroup.addElement(sg);\r
-  }\r
+    public int getWidth() {\r
+        int maxLength = -1;\r
 \r
-  public void removeSuperGroup(SuperGroup sg)\r
-  {\r
-    superGroup.removeElement(sg);\r
-  }\r
+        for (int i = 0; i < sequences.size(); i++) {\r
+            if (getSequenceAt(i).getLength() > maxLength) {\r
+                maxLength = getSequenceAt(i).getLength();\r
+            }\r
+        }\r
 \r
-  public SuperGroup     getSuperGroup(SequenceGroup sg)\r
-  {\r
-    for (int i = 0; i < this.superGroup.size(); i++)\r
-    {\r
-      SuperGroup temp = (SuperGroup) superGroup.elementAt(i);\r
-      if (temp.sequenceGroups.contains(sg))\r
-        return temp;\r
+        return maxLength;\r
     }\r
-    return null;\r
-  }\r
 \r
-  /**    */\r
-  public void addGroup(SequenceGroup sg) {\r
-    if(!groups.contains(sg))\r
-      groups.addElement(sg);\r
-  }\r
+    public int getMaxIdLength() {\r
+        int max = 0;\r
+        int i = 0;\r
 \r
-  public void deleteAllGroups()\r
-  {\r
-    groups.removeAllElements();\r
-    superGroup.removeAllElements();\r
-   int i=0;\r
-    while (i < sequences.size()) {\r
-     SequenceI s = getSequenceAt(i);\r
-     s.setColor(java.awt.Color.white);\r
-     i++;\r
-   }\r
-\r
-\r
-  }\r
-\r
-  /**    */\r
-  public void deleteGroup(SequenceGroup g) {\r
-    if (groups.contains(g)) {\r
-      groups.removeElement(g);\r
-    }\r
-  }\r
-\r
-  /**    */\r
-  public SequenceI findName(String name) {\r
-    int i = 0;\r
-    while (i < sequences.size()) {\r
-      SequenceI s = getSequenceAt(i);\r
-      if (s.getName().equals(name))\r
-        return s;\r
-\r
-      i++;\r
-    }\r
-    return null;\r
-  }\r
-\r
-  /**    */\r
-  public SequenceI findbyDisplayId(String name) {\r
-    int i = 0;\r
-    while (i < sequences.size()) {\r
-      SequenceI s = getSequenceAt(i);\r
-      if (s.getDisplayId().equals(name))\r
-        return s;\r
-\r
-      i++;\r
-    }\r
-    return null;\r
-  }\r
-\r
-  /**    */\r
-  public int findIndex(SequenceI s)\r
-  {\r
-    int i=0;\r
-    while (i < sequences.size())\r
-    {\r
-      if (s == getSequenceAt(i))\r
-        return i;\r
-\r
-      i++;\r
-    }\r
-    return -1;\r
-  }\r
-\r
-  public int getHeight() {\r
-    return sequences.size();\r
-  }\r
-\r
-\r
-  public int getWidth()\r
-  {\r
-    int maxLength = -1;\r
-    for (int i = 0; i < sequences.size(); i++)\r
-    {\r
-      if (getSequenceAt(i).getLength() > maxLength)\r
-        maxLength = getSequenceAt(i).getLength();\r
-    }\r
-\r
-    return maxLength;\r
-  }\r
-\r
-\r
-  public int getMaxIdLength() {\r
-    int max = 0;\r
-    int i   = 0;\r
-\r
-    while (i < sequences.size()) {\r
-      SequenceI seq = getSequenceAt(i);\r
-      String    tmp = seq.getName() + "/" + seq.getStart() + "-" + seq.getEnd();\r
-\r
-      if (tmp.length() > max) {\r
-        max = tmp.length();\r
-      }\r
-\r
-      i++;\r
-    }\r
-    return max;\r
-  }\r
-\r
-  public void setGapCharacter(char gc)\r
-  {\r
-    gapCharacter = gc;\r
-    for (int i=0; i < sequences.size(); i++)\r
-     {\r
-       Sequence seq = (Sequence)sequences.elementAt(i);\r
-       seq.sequence = seq.sequence.replace('.', gc);\r
-       seq.sequence = seq.sequence.replace('-', gc);\r
-     }\r
-  }\r
+        while (i < sequences.size()) {\r
+            SequenceI seq = getSequenceAt(i);\r
+            String tmp = seq.getName() + "/" + seq.getStart() + "-" +\r
+                seq.getEnd();\r
 \r
-  public char getGapCharacter() {\r
-    return gapCharacter;\r
-  }\r
+            if (tmp.length() > max) {\r
+                max = tmp.length();\r
+            }\r
 \r
-  public Vector getAAFrequency()\r
-  {\r
-    return AAFrequency.calculate(sequences, 0, getWidth());\r
-  }\r
+            i++;\r
+        }\r
 \r
-  public boolean isAligned()\r
-  {\r
-    int width = getWidth();\r
-    for (int i = 0; i < sequences.size(); i++)\r
-      if (getSequenceAt(i).getLength() != width)\r
-        return false;\r
-\r
-    return true;\r
-  }\r
+        return max;\r
+    }\r
 \r
-   public void deleteAnnotation(AlignmentAnnotation aa)\r
-   {\r
-     int aSize = 1;\r
-     if(annotations!=null)\r
-       aSize = annotations.length;\r
+    public void setGapCharacter(char gc) {\r
+        gapCharacter = gc;\r
 \r
-     AlignmentAnnotation [] temp = new AlignmentAnnotation [aSize-1];\r
+        for (int i = 0; i < sequences.size(); i++) {\r
+            Sequence seq = (Sequence) sequences.elementAt(i);\r
+            seq.sequence = seq.sequence.replace('.', gc);\r
+            seq.sequence = seq.sequence.replace('-', gc);\r
+        }\r
+    }\r
 \r
-     int tIndex = 0;\r
-     for (int i = 0; i < aSize; i++)\r
-      {\r
-        if(annotations[i]==aa)\r
-          continue;\r
+    public char getGapCharacter() {\r
+        return gapCharacter;\r
+    }\r
 \r
+    public Vector getAAFrequency() {\r
+        return AAFrequency.calculate(sequences, 0, getWidth());\r
+    }\r
 \r
-        temp[tIndex] = annotations[i];\r
-        tIndex++;\r
-      }\r
+    public boolean isAligned() {\r
+        int width = getWidth();\r
 \r
-     annotations = temp;\r
+        for (int i = 0; i < sequences.size(); i++)\r
+            if (getSequenceAt(i).getLength() != width) {\r
+                return false;\r
+            }\r
 \r
-   }\r
+        return true;\r
+    }\r
 \r
-  public void addAnnotation(AlignmentAnnotation aa)\r
-  {\r
-    int aSize = 1;\r
-    if(annotations!=null)\r
-      aSize = annotations.length+1;\r
+    public void deleteAnnotation(AlignmentAnnotation aa) {\r
+        int aSize = 1;\r
 \r
-    AlignmentAnnotation [] temp = new AlignmentAnnotation [aSize];\r
-    int i=0;\r
-    if (aSize > 1)\r
-      for (i = 0; i < aSize-1; i++)\r
-        temp[i] = annotations[i];\r
+        if (annotations != null) {\r
+            aSize = annotations.length;\r
+        }\r
 \r
-    temp[i] = aa;\r
+        AlignmentAnnotation[] temp = new AlignmentAnnotation[aSize - 1];\r
 \r
-    annotations = temp;\r
-  }\r
-  public AlignmentAnnotation[] getAlignmentAnnotation()\r
-  {\r
-    return annotations;\r
-  }\r
+        int tIndex = 0;\r
 \r
-}\r
+        for (int i = 0; i < aSize; i++) {\r
+            if (annotations[i] == aa) {\r
+                continue;\r
+            }\r
 \r
+            temp[tIndex] = annotations[i];\r
+            tIndex++;\r
+        }\r
+\r
+        annotations = temp;\r
+    }\r
 \r
+    public void addAnnotation(AlignmentAnnotation aa) {\r
+        int aSize = 1;\r
 \r
+        if (annotations != null) {\r
+            aSize = annotations.length + 1;\r
+        }\r
 \r
+        AlignmentAnnotation[] temp = new AlignmentAnnotation[aSize];\r
+        int i = 0;\r
 \r
+        if (aSize > 1) {\r
+            for (i = 0; i < (aSize - 1); i++)\r
+                temp[i] = annotations[i];\r
+        }\r
 \r
+        temp[i] = aa;\r
 \r
+        annotations = temp;\r
+    }\r
 \r
+    public AlignmentAnnotation[] getAlignmentAnnotation() {\r
+        return annotations;\r
+    }\r
+}\r
index 337d879..35297b5 100755 (executable)
 * 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.datamodel;\r
 \r
-public class AlignmentAnnotation\r
-{\r
-  public String label;\r
-  public String description;\r
-  public Annotation  [] annotations;\r
-  public boolean isGraph = false;\r
-  public float graphMin, graphMax;\r
-  public int windowLength;\r
-\r
-  // Graphical hints and tips\r
-  public boolean editable = false;\r
-  public boolean hasIcons; //\r
-  public boolean hasText;\r
-  public boolean visible = true;\r
-  public int height=0;\r
-\r
-  public AlignmentAnnotation(String label, String description, Annotation [] annotations)\r
-  {\r
-    // always editable?\r
-    editable = true;\r
-    this.label = label;\r
-    this.description = description;\r
-    this.annotations = annotations;\r
-    for(int i=0; i<annotations.length; i++)\r
-    {\r
-      if (annotations[i]!=null &&(\r
-          annotations[i].secondaryStructure == 'H' ||\r
-          annotations[i].secondaryStructure == 'E'))\r
-        hasIcons = true;\r
-\r
-      if (annotations[i]!=null && annotations[i].displayCharacter.length()>0)\r
-        hasText = true;\r
-    }\r
-  }\r
-\r
-  public AlignmentAnnotation(String label, String description, Annotation [] annotations, float min, float max, int winLength)\r
-  {\r
-    // graphs are not editable\r
-    this.label = label;\r
-    this.description = description;\r
-    this.annotations = annotations;\r
-    isGraph = true;\r
-    if(min==max)\r
-    {\r
-      for(int i=0; i<annotations.length; i++)\r
-      {\r
-        if(annotations[i]==null)\r
-          continue;\r
-        if(annotations[i].value>max)\r
-          max = annotations[i].value;\r
-        if(annotations[i].value<min)\r
-          min = annotations[i].value;\r
-      }\r
+public class AlignmentAnnotation {\r
+    public String label;\r
+    public String description;\r
+    public Annotation[] annotations;\r
+    public boolean isGraph = false;\r
+    public float graphMin;\r
+    public float graphMax;\r
+    public int windowLength;\r
+\r
+    // Graphical hints and tips\r
+    public boolean editable = false;\r
+    public boolean hasIcons; //\r
+    public boolean hasText;\r
+    public boolean visible = true;\r
+    public int height = 0;\r
+\r
+    public AlignmentAnnotation(String label, String description,\r
+        Annotation[] annotations) {\r
+        // always editable?\r
+        editable = true;\r
+        this.label = label;\r
+        this.description = description;\r
+        this.annotations = annotations;\r
+\r
+        for (int i = 0; i < annotations.length; i++) {\r
+            if ((annotations[i] != null) &&\r
+                    ((annotations[i].secondaryStructure == 'H') ||\r
+                    (annotations[i].secondaryStructure == 'E'))) {\r
+                hasIcons = true;\r
+            }\r
+\r
+            if ((annotations[i] != null) &&\r
+                    (annotations[i].displayCharacter.length() > 0)) {\r
+                hasText = true;\r
+            }\r
+        }\r
     }\r
 \r
-    graphMin = min;\r
-    graphMax = max;\r
-    windowLength = winLength;\r
-    for(int i=0; i<annotations.length; i++)\r
-    {\r
-      if (annotations[i]!=null &&(\r
-          annotations[i].secondaryStructure == 'H' ||\r
-          annotations[i].secondaryStructure == 'E'))\r
-        hasIcons = true;\r
-\r
-      if (annotations[i]!=null && annotations[i].displayCharacter.length()>0)\r
-        hasText = true;\r
+    public AlignmentAnnotation(String label, String description,\r
+        Annotation[] annotations, float min, float max, int winLength) {\r
+        // graphs are not editable\r
+        this.label = label;\r
+        this.description = description;\r
+        this.annotations = annotations;\r
+        isGraph = true;\r
+\r
+        if (min == max) {\r
+            for (int i = 0; i < annotations.length; i++) {\r
+                if (annotations[i] == null) {\r
+                    continue;\r
+                }\r
+\r
+                if (annotations[i].value > max) {\r
+                    max = annotations[i].value;\r
+                }\r
+\r
+                if (annotations[i].value < min) {\r
+                    min = annotations[i].value;\r
+                }\r
+            }\r
+        }\r
+\r
+        graphMin = min;\r
+        graphMax = max;\r
+        windowLength = winLength;\r
+\r
+        for (int i = 0; i < annotations.length; i++) {\r
+            if ((annotations[i] != null) &&\r
+                    ((annotations[i].secondaryStructure == 'H') ||\r
+                    (annotations[i].secondaryStructure == 'E'))) {\r
+                hasIcons = true;\r
+            }\r
+\r
+            if ((annotations[i] != null) &&\r
+                    (annotations[i].displayCharacter.length() > 0)) {\r
+                hasText = true;\r
+            }\r
+        }\r
     }\r
-  }\r
-\r
-  public String toString()\r
-  {\r
-    StringBuffer buffer = new StringBuffer();\r
-    for(int i=0; i<annotations.length; i++)\r
-   {\r
-     if(annotations[i]!=null)\r
-     {\r
-       if(isGraph)\r
-         buffer.append(annotations[i].value);\r
-       else if(hasIcons)\r
-         buffer.append(annotations[i].secondaryStructure);\r
-       else\r
-         buffer.append(annotations[i].displayCharacter);\r
-\r
-     }\r
-     buffer.append(", ");\r
-   }\r
-   if(label.equals("Consensus"))\r
-   {\r
-     buffer.append("\n");\r
-     for (int i = 0; i < annotations.length; i++)\r
-     {\r
-       if (annotations[i] != null)\r
-           buffer.append(annotations[i].description);\r
-       buffer.append(", ");\r
-     }\r
-   }\r
-   return buffer.toString();\r
-  }\r
 \r
+    public String toString() {\r
+        StringBuffer buffer = new StringBuffer();\r
+\r
+        for (int i = 0; i < annotations.length; i++) {\r
+            if (annotations[i] != null) {\r
+                if (isGraph) {\r
+                    buffer.append(annotations[i].value);\r
+                } else if (hasIcons) {\r
+                    buffer.append(annotations[i].secondaryStructure);\r
+                } else {\r
+                    buffer.append(annotations[i].displayCharacter);\r
+                }\r
+            }\r
+\r
+            buffer.append(", ");\r
+        }\r
+\r
+        if (label.equals("Consensus")) {\r
+            buffer.append("\n");\r
+\r
+            for (int i = 0; i < annotations.length; i++) {\r
+                if (annotations[i] != null) {\r
+                    buffer.append(annotations[i].description);\r
+                }\r
+\r
+                buffer.append(", ");\r
+            }\r
+        }\r
+\r
+        return buffer.toString();\r
+    }\r
 }\r
index e48ff36..8a14a08 100755 (executable)
 * 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.datamodel;\r
 \r
 import java.util.*;\r
 \r
+\r
 /** Data structure to hold and manipulate a multiple sequence alignment\r
  */\r
 public interface AlignmentI {\r
+    public int getHeight();\r
 \r
-  public int         getHeight() ;\r
-  public int         getWidth() ;\r
-  public int         getMaxIdLength() ;\r
+    public int getWidth();\r
 \r
-  public boolean isAligned();\r
+    public int getMaxIdLength();\r
 \r
-  public Vector      getSequences();\r
-  public SequenceI   getSequenceAt(int i);\r
+    public boolean isAligned();\r
 \r
-  public void        addSequence(SequenceI seq) ;\r
-  public void        setSequenceAt(int i,SequenceI seq);\r
+    public Vector getSequences();\r
 \r
-  public void        deleteSequence(SequenceI s) ;\r
-  public void        deleteSequence(int i) ;\r
+    public SequenceI getSequenceAt(int i);\r
 \r
-  public SequenceI[] getColumns(int start, int end) ;\r
-  public SequenceI[] getColumns(int seq1, int seq2, int start, int end) ;\r
+    public void addSequence(SequenceI seq);\r
 \r
-  public void        deleteColumns(int start, int end) ;\r
-  public void        deleteColumns(int seq1, int seq2, int start, int end) ;\r
+    public void setSequenceAt(int i, SequenceI seq);\r
 \r
-  public void        insertColumns(SequenceI[] seqs, int pos) ;\r
+    public void deleteSequence(SequenceI s);\r
 \r
-  public SequenceI   findName(String name) ;\r
-  public SequenceI   findbyDisplayId(String name);\r
+    public void deleteSequence(int i);\r
 \r
-  public int         findIndex(SequenceI s) ;\r
+    public SequenceI[] getColumns(int start, int end);\r
 \r
-  // Modifying\r
-  public void        trimLeft(int i) ;\r
-  public void        trimRight(int i) ;\r
+    public SequenceI[] getColumns(int seq1, int seq2, int start, int end);\r
 \r
-  public void        removeGaps() ;\r
-  public Vector      removeRedundancy(float threshold, Vector sel) ;\r
+    public void deleteColumns(int start, int end);\r
 \r
+    public void deleteColumns(int seq1, int seq2, int start, int end);\r
 \r
-  // Grouping methods\r
-  public SequenceGroup findGroup(int i) ;\r
-  public SequenceGroup findGroup(SequenceI s) ;\r
-  public SequenceGroup [] findAllGroups(SequenceI s);\r
-  public void          addToGroup(SequenceGroup g, SequenceI s) ;\r
-  public void          removeFromGroup(SequenceGroup g,SequenceI s) ;\r
-  public void          addGroup(SequenceGroup sg) ;\r
-  public void          deleteGroup(SequenceGroup g) ;\r
-  public Vector        getGroups();\r
-  public void deleteAllGroups();\r
+    public void insertColumns(SequenceI[] seqs, int pos);\r
 \r
-  public void          addSuperGroup(SuperGroup sg);\r
-  public void          removeSuperGroup(SuperGroup sg);\r
-  public SuperGroup    getSuperGroup(SequenceGroup sg);\r
+    public SequenceI findName(String name);\r
 \r
-  // Sorting\r
-  public void          sortGroups() ;\r
-  public void          sortByPID(SequenceI s) ;\r
-  public void          sortByID() ;\r
+    public SequenceI findbyDisplayId(String name);\r
 \r
-  //Annotations\r
-  public void addAnnotation(AlignmentAnnotation aa);\r
-  public void deleteAnnotation(AlignmentAnnotation aa);\r
-  public AlignmentAnnotation [] getAlignmentAnnotation();\r
+    public int findIndex(SequenceI s);\r
 \r
-  public void          setGapCharacter(char gc);\r
-  public char          getGapCharacter();\r
+    // Modifying\r
+    public void trimLeft(int i);\r
 \r
-  public Vector        getAAFrequency();\r
-}\r
+    public void trimRight(int i);\r
+\r
+    public void removeGaps();\r
+\r
+    public Vector removeRedundancy(float threshold, Vector sel);\r
+\r
+    // Grouping methods\r
+    public SequenceGroup findGroup(int i);\r
+\r
+    public SequenceGroup findGroup(SequenceI s);\r
+\r
+    public SequenceGroup[] findAllGroups(SequenceI s);\r
+\r
+    public void addToGroup(SequenceGroup g, SequenceI s);\r
+\r
+    public void removeFromGroup(SequenceGroup g, SequenceI s);\r
+\r
+    public void addGroup(SequenceGroup sg);\r
+\r
+    public void deleteGroup(SequenceGroup g);\r
 \r
+    public Vector getGroups();\r
 \r
+    public void deleteAllGroups();\r
 \r
+    public void addSuperGroup(SuperGroup sg);\r
+\r
+    public void removeSuperGroup(SuperGroup sg);\r
+\r
+    public SuperGroup getSuperGroup(SequenceGroup sg);\r
+\r
+    // Sorting\r
+    public void sortGroups();\r
+\r
+    public void sortByPID(SequenceI s);\r
+\r
+    public void sortByID();\r
+\r
+    //Annotations\r
+    public void addAnnotation(AlignmentAnnotation aa);\r
+\r
+    public void deleteAnnotation(AlignmentAnnotation aa);\r
+\r
+    public AlignmentAnnotation[] getAlignmentAnnotation();\r
+\r
+    public void setGapCharacter(char gc);\r
+\r
+    public char getGapCharacter();\r
+\r
+    public Vector getAAFrequency();\r
+}\r
index 3e6fd9f..c0da1fc 100755 (executable)
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
-*/
-
-package jalview.datamodel;
-
-import java.util.*;
-
+*/\r
+package jalview.datamodel;\r
+\r
+import java.util.*;\r
+\r
+\r
 /**
  * <p>Title: </p>
  *
@@ -32,105 +32,94 @@ import java.util.*;
  *
  * @author not attributable
  * @version 1.0
- */
-public class AlignmentOrder
-{
-  public AlignmentOrder()
-  {
-  }
-
-  public void setType(int Type)
-  {
-    this.Type = Type;
-  }
-
-  public int getType()
-  {
-    return Type;
-  }
-
-  public void setName(String Name)
-  {
-    this.Name = Name;
-  }
-
-  public String getName()
-  {
-    return Name;
-  }
-
-  public void setOrder(Vector Order)
-  {
-    this.Order = Order;
-  }
-
-  public Vector getOrder()
-  {
-
-    return Order;
-  }
-// JBPNote : this method would return a vector containing all sequences in seqset
-// with those also contained in order at the beginning of the vector in the order
-// given by order. AlignmentSorter.vectorSubsetToArray already does this, but that method
-// should be here for completeness.
-
-/*  public Vector getOrder(AlignmentI seqset)
+ */\r
+public class AlignmentOrder {\r
+    // JBPNote : this method would return a vector containing all sequences in seqset\r
+    // with those also contained in order at the beginning of the vector in the order\r
+    // given by order. AlignmentSorter.vectorSubsetToArray already does this, but that method\r
+    // should be here for completeness.\r
+\r
+    /*  public Vector getOrder(AlignmentI seqset)
   {
     Vector perm = new Vector(seqset.getHeight());
     for (i=0, o = 0, n=seqset.getHeight(), p = Order.size(); i<n; i++)
       perm.setElement(i,...).
     return Order;
   }
- */
-  public static final int FILE = 0;
-  public static final int MSA = 1;
-  public static final int USER = 2;
-
-  private int Type = 0;
-  private String Name;
-  private Vector Order = null;
-
-  /**
-   * AlignmentOrder
-   *
-   * @param anOrder Vector
-   */
-  public AlignmentOrder(Vector anOrder)
-  {
-    Order = anOrder;
-  }
-
-  /**
-   * AlignmentOrder
-   *
-   * @param orderFrom AlignmentI
-   */
-  public AlignmentOrder(AlignmentI orderFrom)
-  {
-    Order = new Vector();
-
-    for (int i=0,ns=orderFrom.getHeight(); i<ns; i++)
-      Order.addElement(orderFrom.getSequenceAt(i));
-  }
-  public AlignmentOrder(SequenceI[] orderFrom) {
-    Order = new Vector();
-    for (int i=0,ns=orderFrom.length; i<ns; i++)
-      Order.addElement(orderFrom[i]);
-  }
-
-
-
-  /**
-   * AlignmentOrder
-   *
-   * @param orderThis AlignmentI
-   * @param byThat AlignmentI
-   */
-  /* public AlignmentOrder(AlignmentI orderThis, AlignmentI byThat)
-  {
-    // Vector is an ordering of this alignment using the order of sequence objects in byThat,
-    // where ids and unaligned sequences must match
-
-  } */
+ */\r
+    public static final int FILE = 0;\r
+    public static final int MSA = 1;\r
+    public static final int USER = 2;\r
+    private int Type = 0;\r
+    private String Name;\r
+    private Vector Order = null;\r
+\r
+    public AlignmentOrder() {\r
+    }\r
+\r
+    /**
+ * AlignmentOrder
+ *
+ * @param anOrder Vector
+ */\r
+    public AlignmentOrder(Vector anOrder) {\r
+        Order = anOrder;\r
+    }\r
+\r
+    /**
+ * AlignmentOrder
+ *
+ * @param orderFrom AlignmentI
+ */\r
+    public AlignmentOrder(AlignmentI orderFrom) {\r
+        Order = new Vector();\r
+\r
+        for (int i = 0, ns = orderFrom.getHeight(); i < ns; i++)\r
+            Order.addElement(orderFrom.getSequenceAt(i));\r
+    }\r
+\r
+    public AlignmentOrder(SequenceI[] orderFrom) {\r
+        Order = new Vector();\r
+\r
+        for (int i = 0, ns = orderFrom.length; i < ns; i++)\r
+            Order.addElement(orderFrom[i]);\r
+    }\r
+\r
+    public void setType(int Type) {\r
+        this.Type = Type;\r
+    }\r
+\r
+    public int getType() {\r
+        return Type;\r
+    }\r
+\r
+    public void setName(String Name) {\r
+        this.Name = Name;\r
+    }\r
+\r
+    public String getName() {\r
+        return Name;\r
+    }\r
+\r
+    public void setOrder(Vector Order) {\r
+        this.Order = Order;\r
+    }\r
+\r
+    public Vector getOrder() {\r
+        return Order;\r
+    }\r
+\r
+    /**
+ * AlignmentOrder
+ *
+ * @param orderThis AlignmentI
+ * @param byThat AlignmentI
+ */\r
+\r
+    /* public AlignmentOrder(AlignmentI orderThis, AlignmentI byThat)
+{
+  // Vector is an ordering of this alignment using the order of sequence objects in byThat,
+  // where ids and unaligned sequences must match
 
-}
+} */\r
+}\r
index b99ce9f..7858e3f 100755 (executable)
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
-*/
-
-package jalview.datamodel;
-import java.awt.*;
-
-public class Annotation
-{
-  public String displayCharacter="";
-  public String description="";       // currently used as mouse over
-  public char secondaryStructure=' '; // recognises H and E
-  public float value;
-
-  // add visual cues here
-  public Color colour = Color.black;
-
-  public Annotation(String displayChar, String desc, char ss, float val)
-  {
-    displayCharacter = displayChar;
-    description = desc;
-    secondaryStructure = ss;
-    value = val;
-  }
-  public Annotation(String displayChar, String desc, char ss, float val, Color colour) {
-    this(displayChar, desc, ss, val);
-    this.colour = colour;
-  }
-}
+*/\r
+package jalview.datamodel;\r
+\r
+import java.awt.*;\r
+\r
+\r
+public class Annotation {\r
+    public String displayCharacter = "";\r
+    public String description = ""; // currently used as mouse over\r
+    public char secondaryStructure = ' '; // recognises H and E\r
+    public float value;\r
+\r
+    // add visual cues here\r
+    public Color colour = Color.black;\r
+\r
+    public Annotation(String displayChar, String desc, char ss, float val) {\r
+        displayCharacter = displayChar;\r
+        description = desc;\r
+        secondaryStructure = ss;\r
+        value = val;\r
+    }\r
+\r
+    public Annotation(String displayChar, String desc, char ss, float val,\r
+        Color colour) {\r
+        this(displayChar, desc, ss, val);\r
+        this.colour = colour;\r
+    }\r
+}\r
index cefbc22..850730b 100755 (executable)
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
-*/
-
-package jalview.datamodel;
-
-public class BinaryNode
-{
-
-  Object element;
-  String name;
-  BinaryNode left;
-  BinaryNode right;
-  BinaryNode parent;
-  public int bootstrap;
-
-  public BinaryNode()
-  {
-    left = right = parent = null;
-    bootstrap = 0;
-  }
-
-  public BinaryNode(Object element, BinaryNode parent, String name)
-  {
-    this.element = element;
-    this.parent = parent;
-    this.name = name;
-
-    left = right = null;
-  }
-
-  public Object element()
-  {
-    return element;
-  }
-
-  public Object setElement(Object v)
-  {
-    return element = v;
-  }
-
-  public BinaryNode left()
-  {
-    return left;
-  }
-
-  public BinaryNode setLeft(BinaryNode n)
-  {
-    return left = n;
-  }
-
-  public BinaryNode right()
-  {
-    return right;
-  }
-
-  public BinaryNode setRight(BinaryNode n)
-  {
-    return right = n;
-  }
-
-  public BinaryNode parent()
-  {
-    return parent;
-  }
-
-  public BinaryNode setParent(BinaryNode n)
-  {
-    return parent = n;
-  }
-
-  public boolean isLeaf()
-  {
-    return (left == null) && (right == null);
-  }
-
-  /**
-   * attaches FIRST and SECOND node arguments as the LEFT and RIGHT children of this node (removing any old references)
-   * a null parameter DOES NOT mean that the pointer to the corresponding child node is set to  NULL - you  should use
-   * setChild(null), or detach() for this.
-   *
-   */
-  public void SetChildren(BinaryNode leftchild, BinaryNode rightchild)
-  {
-    if (leftchild != null)
-    {
-      this.setLeft(leftchild);
-      leftchild.detach();
-      leftchild.setParent(this);
-
-    }
-    if (rightchild != null)
-    {
-      this.setRight(rightchild);
-      rightchild.detach();
-      rightchild.setParent(this);
-    }
-  }
-
-  /**
-   * Detaches the node from the binary tree, along with all its child nodes.
-   * @return BinaryNode The detached node.
-   */
-  public BinaryNode detach()
-  {
-    if (this.parent!=null) {
-      if (this.parent.left == this)
-      {
-        this.parent.left = null;
-      }
-      else
-      {
-        if (this.parent.right == this)
-        {
-          this.parent.right = null;
-        }
-      }
-    }
-    this.parent = null;
-    return this;
-  }
-  /**
-   * Traverses up through the tree until a node with a free leftchild is discovered.
-   * @return BinaryNode
-   */
-  public BinaryNode ascendLeft() {
-    BinaryNode c = this;
-    do {
-      c = c.parent();
-    }  while (c!=null && c.left()!=null && !c.left().isLeaf());
-    return c;
-  }
-  /**
-   * Traverses up through the tree until a node with a free rightchild is discovered.
-   * Jalview builds trees by descent on the left, so this may be unused.
-   * @return BinaryNode
-   */
-  public BinaryNode ascendRight() {
-    BinaryNode c = this;
-    do {
-      c = c.parent();
-    }  while (c!=null && c.right()!=null && !c.right().isLeaf());
-    return c;
-  }
-
-
-  public void setName(String name)
-  {
-    this.name = name;
-  }
-
-  public String getName()
-  {
-    return this.name;
-  }
-
-  public void setBootstrap(int boot)
-  {
-    this.bootstrap = boot;
-  }
-
-  public int getBootstrap()
-  {
-    return bootstrap;
-  }
-}
+*/\r
+package jalview.datamodel;\r
+\r
+public class BinaryNode {\r
+    Object element;\r
+    String name;\r
+    BinaryNode left;\r
+    BinaryNode right;\r
+    BinaryNode parent;\r
+    public int bootstrap;\r
+\r
+    public BinaryNode() {\r
+        left = right = parent = null;\r
+        bootstrap = 0;\r
+    }\r
+\r
+    public BinaryNode(Object element, BinaryNode parent, String name) {\r
+        this.element = element;\r
+        this.parent = parent;\r
+        this.name = name;\r
+\r
+        left = right = null;\r
+    }\r
+\r
+    public Object element() {\r
+        return element;\r
+    }\r
+\r
+    public Object setElement(Object v) {\r
+        return element = v;\r
+    }\r
+\r
+    public BinaryNode left() {\r
+        return left;\r
+    }\r
+\r
+    public BinaryNode setLeft(BinaryNode n) {\r
+        return left = n;\r
+    }\r
+\r
+    public BinaryNode right() {\r
+        return right;\r
+    }\r
+\r
+    public BinaryNode setRight(BinaryNode n) {\r
+        return right = n;\r
+    }\r
+\r
+    public BinaryNode parent() {\r
+        return parent;\r
+    }\r
+\r
+    public BinaryNode setParent(BinaryNode n) {\r
+        return parent = n;\r
+    }\r
+\r
+    public boolean isLeaf() {\r
+        return (left == null) && (right == null);\r
+    }\r
+\r
+    /**
+ * attaches FIRST and SECOND node arguments as the LEFT and RIGHT children of this node (removing any old references)
+ * a null parameter DOES NOT mean that the pointer to the corresponding child node is set to  NULL - you  should use
+ * setChild(null), or detach() for this.
+ *
+ */\r
+    public void SetChildren(BinaryNode leftchild, BinaryNode rightchild) {\r
+        if (leftchild != null) {\r
+            this.setLeft(leftchild);\r
+            leftchild.detach();\r
+            leftchild.setParent(this);\r
+        }\r
+\r
+        if (rightchild != null) {\r
+            this.setRight(rightchild);\r
+            rightchild.detach();\r
+            rightchild.setParent(this);\r
+        }\r
+    }\r
+\r
+    /**
+ * Detaches the node from the binary tree, along with all its child nodes.
+ * @return BinaryNode The detached node.
+ */\r
+    public BinaryNode detach() {\r
+        if (this.parent != null) {\r
+            if (this.parent.left == this) {\r
+                this.parent.left = null;\r
+            } else {\r
+                if (this.parent.right == this) {\r
+                    this.parent.right = null;\r
+                }\r
+            }\r
+        }\r
+\r
+        this.parent = null;\r
+\r
+        return this;\r
+    }\r
+\r
+    /**
+ * Traverses up through the tree until a node with a free leftchild is discovered.
+ * @return BinaryNode
+ */\r
+    public BinaryNode ascendLeft() {\r
+        BinaryNode c = this;\r
+\r
+        do {\r
+            c = c.parent();\r
+        } while ((c != null) && (c.left() != null) && !c.left().isLeaf());\r
+\r
+        return c;\r
+    }\r
+\r
+    /**
+ * Traverses up through the tree until a node with a free rightchild is discovered.
+ * Jalview builds trees by descent on the left, so this may be unused.
+ * @return BinaryNode
+ */\r
+    public BinaryNode ascendRight() {\r
+        BinaryNode c = this;\r
+\r
+        do {\r
+            c = c.parent();\r
+        } while ((c != null) && (c.right() != null) && !c.right().isLeaf());\r
+\r
+        return c;\r
+    }\r
+\r
+    public void setName(String name) {\r
+        this.name = name;\r
+    }\r
+\r
+    public String getName() {\r
+        return this.name;\r
+    }\r
+\r
+    public void setBootstrap(int boot) {\r
+        this.bootstrap = boot;\r
+    }\r
+\r
+    public int getBootstrap() {\r
+        return bootstrap;\r
+    }\r
+}\r
index 63c8d86..a351b04 100755 (executable)
 * 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.datamodel;\r
 \r
-import jalview.io.*;\r
 import jalview.analysis.PCA;\r
+\r
+import jalview.io.*;\r
+\r
 import jalview.jbgui.*;\r
+\r
 import jalview.schemes.*;\r
 \r
 import java.awt.*;\r
 \r
+\r
 public class BinarySequence extends Sequence {\r
-  int[] binary;\r
-  double[] dbinary;\r
-\r
-  public BinarySequence(SequenceI s) {\r
-    super(s.getName(),s.getSequence(),s.getStart(),s.getEnd());\r
-  }\r
-\r
-  public BinarySequence(String name, String sequence, int start, int end) {\r
-    super(name,sequence,start,end);\r
-  }\r
-\r
-  public void encode() {\r
-    // Set all matrix to 0\r
-    dbinary = new double[getSequence().length() * 21];\r
-    int nores = 21;\r
-    for (int i = 0; i < dbinary.length; i++) {\r
-      dbinary[i] = 0.0;\r
+    int[] binary;\r
+    double[] dbinary;\r
+\r
+    public BinarySequence(SequenceI s) {\r
+        super(s.getName(), s.getSequence(), s.getStart(), s.getEnd());\r
+    }\r
+\r
+    public BinarySequence(String name, String sequence, int start, int end) {\r
+        super(name, sequence, start, end);\r
     }\r
 \r
-    for (int i=0; i < getSequence().length(); i++ ) {\r
-      int aanum = 20;\r
-      try {\r
-        aanum = ((Integer)ResidueProperties.getAAHash().get(getSequence().substring(i,i+1))).intValue();\r
-      } catch (NullPointerException e) {\r
-        aanum = 20;\r
-      }\r
-      if (aanum > 20) {\r
-        aanum = 20;\r
-      }\r
+    public void encode() {\r
+        // Set all matrix to 0\r
+        dbinary = new double[getSequence().length() * 21];\r
 \r
-      dbinary[i* nores + aanum] = 1.0;\r
+        int nores = 21;\r
 \r
+        for (int i = 0; i < dbinary.length; i++) {\r
+            dbinary[i] = 0.0;\r
+        }\r
+\r
+        for (int i = 0; i < getSequence().length(); i++) {\r
+            int aanum = 20;\r
+\r
+            try {\r
+                aanum = ((Integer) ResidueProperties.getAAHash().get(getSequence()\r
+                                                                         .substring(i,\r
+                            i + 1))).intValue();\r
+            } catch (NullPointerException e) {\r
+                aanum = 20;\r
+            }\r
+\r
+            if (aanum > 20) {\r
+                aanum = 20;\r
+            }\r
+\r
+            dbinary[(i * nores) + aanum] = 1.0;\r
+        }\r
     }\r
-  }\r
-\r
-  public void blosumEncode() {\r
-\r
-    // Set all matrix to 0\r
-    dbinary = new double[getSequence().length() * 21];\r
-    int nores = 21;\r
-    //for (int i = 0; i < dbinary.length; i++) {\r
-    //  dbinary[i] = 0.0;\r
-    //}\r
-\r
-    for (int i=0; i < getSequence().length(); i++ ) {\r
-      int aanum = 20;\r
-      try {\r
-        aanum = ((Integer)ResidueProperties.getAAHash().get(getSequence().substring(i,i+1))).intValue();\r
-      } catch (NullPointerException e) {\r
-        aanum = 20;\r
-      }\r
-      if (aanum > 20) {\r
-        aanum = 20;\r
-      }\r
-\r
-      // Do the blosum thing\r
-      for (int j = 0;j < 20;j++) {\r
-        dbinary[i * nores + j] = ResidueProperties.getBLOSUM62()[aanum][j];\r
-      }\r
 \r
+    public void blosumEncode() {\r
+        // Set all matrix to 0\r
+        dbinary = new double[getSequence().length() * 21];\r
+\r
+        int nores = 21;\r
+\r
+        //for (int i = 0; i < dbinary.length; i++) {\r
+        //  dbinary[i] = 0.0;\r
+        //}\r
+        for (int i = 0; i < getSequence().length(); i++) {\r
+            int aanum = 20;\r
+\r
+            try {\r
+                aanum = ((Integer) ResidueProperties.getAAHash().get(getSequence()\r
+                                                                         .substring(i,\r
+                            i + 1))).intValue();\r
+            } catch (NullPointerException e) {\r
+                aanum = 20;\r
+            }\r
+\r
+            if (aanum > 20) {\r
+                aanum = 20;\r
+            }\r
+\r
+            // Do the blosum thing\r
+            for (int j = 0; j < 20; j++) {\r
+                dbinary[(i * nores) + j] = ResidueProperties.getBLOSUM62()[aanum][j];\r
+            }\r
+        }\r
     }\r
-  }\r
-\r
-  public String toBinaryString() {\r
-    String out = "";\r
-    for (int i=0; i < binary.length;i++) {\r
-      out += (new Integer(binary[i])).toString();\r
-      if (i < binary.length-1) {\r
-        out += " ";\r
-      }\r
+\r
+    public String toBinaryString() {\r
+        String out = "";\r
+\r
+        for (int i = 0; i < binary.length; i++) {\r
+            out += (new Integer(binary[i])).toString();\r
+\r
+            if (i < (binary.length - 1)) {\r
+                out += " ";\r
+            }\r
+        }\r
+\r
+        return out;\r
     }\r
-    return out;\r
-  }\r
 \r
-  public double[] getDBinary() {\r
-    return dbinary;\r
-  }\r
+    public double[] getDBinary() {\r
+        return dbinary;\r
+    }\r
 \r
-  public static void printMemory(Runtime rt) {\r
-    System.out.println("DEBUG: Free memory = " + rt.freeMemory()); // log.\r
-  }\r
+    public static void printMemory(Runtime rt) {\r
+        System.out.println("DEBUG: Free memory = " + rt.freeMemory()); // log.\r
+    }\r
 }\r
index bb18b66..ed119e8 100755 (executable)
 * 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.datamodel;\r
 \r
 import java.util.*;\r
 \r
-public class HistoryItem\r
-{\r
-  public static final int EDIT = 0;\r
-  public static final int SORT = 1;\r
-  public static final int HIDE = 2;\r
-  public static final int PASTE= 3;\r
 \r
-  final int type;\r
-  Vector sequences;\r
-  Vector alignIndex;\r
-  String description;\r
-  Vector hiddenSeqs;\r
+public class HistoryItem {\r
+    public static final int EDIT = 0;\r
+    public static final int SORT = 1;\r
+    public static final int HIDE = 2;\r
+    public static final int PASTE = 3;\r
+    final int type;\r
+    Vector sequences;\r
+    Vector alignIndex;\r
+    String description;\r
+    Vector hiddenSeqs;\r
 \r
-  public HistoryItem(String description, AlignmentI al, int type)\r
-  {\r
-    this.type = type;\r
-    this.description = description;\r
-    sequences = new Vector();\r
-    alignIndex = new Vector();\r
-    hiddenSeqs = new Vector();\r
+    public HistoryItem(String description, AlignmentI al, int type) {\r
+        this.type = type;\r
+        this.description = description;\r
+        sequences = new Vector();\r
+        alignIndex = new Vector();\r
+        hiddenSeqs = new Vector();\r
 \r
-    for (int i = 0; i < al.getHeight(); i++)\r
-    {\r
-      SequenceI seq = al.getSequenceAt(i);\r
-      sequences.addElement(seq);\r
-      alignIndex.addElement(i + "");\r
-      hiddenSeqs.addElement(seq.getSequence().toString());\r
+        for (int i = 0; i < al.getHeight(); i++) {\r
+            SequenceI seq = al.getSequenceAt(i);\r
+            sequences.addElement(seq);\r
+            alignIndex.addElement(i + "");\r
+            hiddenSeqs.addElement(seq.getSequence().toString());\r
+        }\r
     }\r
-  }\r
-\r
-  public int getType()\r
-  {return type;}\r
 \r
-  public Vector getSequences()\r
-  {return sequences;}\r
+    public int getType() {\r
+        return type;\r
+    }\r
 \r
-  public String getDescription()\r
-  {return description; }\r
+    public Vector getSequences() {\r
+        return sequences;\r
+    }\r
 \r
-  public Vector getHidden()\r
-  { return hiddenSeqs; }\r
+    public String getDescription() {\r
+        return description;\r
+    }\r
 \r
-  public int getAlignIndex(int seq)\r
-  {\r
-    return Integer.parseInt(alignIndex.elementAt(seq).toString());\r
-  }\r
+    public Vector getHidden() {\r
+        return hiddenSeqs;\r
+    }\r
 \r
+    public int getAlignIndex(int seq) {\r
+        return Integer.parseInt(alignIndex.elementAt(seq).toString());\r
+    }\r
 }\r
index d7f2b9f..3853af9 100755 (executable)
 * 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.datamodel;\r
 \r
+import MCview.*;\r
+\r
 import jalview.analysis.*;\r
+\r
 import java.awt.*;\r
+\r
 import java.util.*;\r
-import MCview.*;\r
 \r
 \r
-public class Sequence implements SequenceI\r
-{\r
-  protected String name;\r
-  protected String sequence;\r
-  protected String description;\r
-  protected int start;\r
-  protected int end;\r
-  protected String displayId;\r
-  protected Color color = Color.white;\r
-  String pdbId;\r
-\r
-   public Vector sequenceFeatures = new Vector();\r
-   public void setSequenceFeatures(Vector v)\r
-   {\r
-     sequenceFeatures = v;\r
-   }\r
-\r
-   public Vector getSequenceFeatures()\r
-   {return sequenceFeatures; }\r
-\r
-   public void setPDBId(String id)\r
-   {\r
-     pdbId = id;\r
-   }\r
-   public String getPDBId()\r
-   {\r
-     return pdbId;\r
-   }\r
-\r
-\r
-  public Sequence(String name, String sequence, int start, int end)\r
-  {\r
-\r
-    this.name     = name;\r
-    this.sequence = sequence;\r
-    this.start    = start;\r
-    this.end      = end;\r
-\r
-    setDisplayId();\r
-\r
-  }\r
-\r
-  public Sequence(String name,String sequence) {\r
-    this(name,sequence,1,sequence.length());\r
-  }\r
-  public Sequence(SequenceI seq) {\r
-    this(seq.getName(),seq.getSequence(),seq.getStart(),seq.getEnd());\r
-  }\r
-  public String getDisplayId() {\r
-    return displayId;\r
-  }\r
-  public void setDisplayId() {\r
-    displayId = name + "/" + start + "-" + end;\r
-  }\r
-  public void setName(String name) {\r
-    this.name = name;\r
-    setDisplayId();\r
-  }\r
-  public String getName() {\r
-    return this.name;\r
-  }\r
-  public void setStart(int start) {\r
-    this.start = start;\r
-    setDisplayId();\r
-  }\r
-  public int getStart() {\r
-    return this.start;\r
-  }\r
-  public void setEnd(int end) {\r
-    this.end = end;\r
-    setDisplayId();\r
-  }\r
-  public int getEnd() {\r
-    return this.end;\r
-  }\r
-  public int getLength() {\r
-    return this.sequence.length();\r
-  }\r
-  public void setSequence(String seq) {\r
-    this.sequence = seq;\r
-  }\r
-  public String getSequence() {\r
-    return this.sequence;\r
-  }\r
-  public String getSequence(int start,int end) {\r
-    // JBPNote - left to user to pad the result here (TODO:Decide on this policy)\r
-    if(start>=sequence.length())\r
-      return "";\r
-\r
-    if(end>=sequence.length())\r
-      end = sequence.length();\r
-\r
-    return this.sequence.substring(start,end);\r
-  }\r
-\r
-  public char getCharAt(int i) {\r
-    if (i < sequence.length()) {\r
-      return sequence.charAt(i);\r
-    } else {\r
-      return ' ';\r
-    }\r
-  }\r
-  public void setDescription(String desc) {\r
-    this.description = desc;\r
-  }\r
-  public String getDescription() {\r
-    return this.description;\r
-  }\r
-\r
-  public int findIndex(int pos) {\r
-    // returns the alignment position for a residue\r
-    int j = start;\r
-    int i = 0;\r
-\r
-    while (i< sequence.length() && j <= end && j <= pos) {\r
-\r
-      char c = sequence.charAt(i);\r
-\r
-      if (!jalview.util.Comparison.isGap((c)))\r
-        j++;\r
-\r
-      i++;\r
-    }\r
-    if (j == end && j < pos)\r
-      return end+1;\r
-    else\r
-      return i;\r
-\r
-  }\r
-\r
-  public int findPosition(int i) {\r
-    // Returns the sequence position for an alignment position\r
-    int j   = 0;\r
-    int pos = start;\r
-\r
-    while (j < i && j<sequence.length())\r
-    {\r
-      char c = sequence.charAt(j);\r
-      if (!jalview.util.Comparison.isGap((c)))\r
-        pos++;\r
-\r
-      j++;\r
-    }\r
-    return pos;\r
-  }\r
-\r
-  public int[] gapMap() {\r
-    // Returns an int array giving the position of each residue in the sequence in the alignment\r
-    String seq = jalview.analysis.AlignSeq.extractGaps("-. ",sequence);\r
-    int[] map = new int[seq.length()];\r
-    int j=0;\r
-    int p=0;\r
-    while (j<sequence.length()) {\r
-      if (!jalview.util.Comparison.isGap(sequence.charAt(j))) {\r
-        map[p++]=j;\r
-      }\r
-      j++;\r
-    }\r
-    return map;\r
-  }\r
-\r
-  public void deleteCharAt(int i)\r
-  {\r
-    if (i>=sequence.length())\r
-      return;\r
-    sequence = sequence.substring(0,i) + sequence.substring(i+1);\r
-  }\r
-\r
-  public void deleteChars(int i, int j)\r
-  {\r
-    if (i>=sequence.length())\r
-      return;\r
-    if (j>=sequence.length())\r
-      sequence = sequence.substring(0,i);\r
-    else\r
-      sequence = sequence.substring(0,i) + sequence.substring(j);\r
-  }\r
-\r
-  public void insertCharAt(int i, char c)\r
-  {\r
-    insertCharAt(i,c,true);\r
-  }\r
-\r
-  public void insertCharAt(int i,char c,boolean chop) {\r
-\r
-    String tmp = new String(sequence);\r
-\r
-    if (i < sequence.length()) {\r
-      sequence = tmp.substring(0,i) + String.valueOf(c) + tmp.substring(i);\r
-    } else {\r
-      // JBPNote : padding char at end of sequence. We'll not get away with this when we insert residues, I bet!\r
-      char[] ch = new char[1+i-sequence.length()];\r
-      for (int j=0, k=ch.length; j<k; j++)\r
-        ch[j] = c;\r
-      sequence = tmp + String.valueOf(ch);\r
-    }\r
-\r
-  }\r
-\r
-  public void        setColor(Color c) {\r
-    this.color = c;\r
-  }\r
-\r
-  public Color       getColor() {\r
-    return color;\r
-  }\r
+public class Sequence implements SequenceI {\r
+    protected String name;\r
+    protected String sequence;\r
+    protected String description;\r
+    protected int start;\r
+    protected int end;\r
+    protected String displayId;\r
+    protected Color color = Color.white;\r
+    String pdbId;\r
+    public Vector sequenceFeatures = new Vector();\r
+\r
+    public Sequence(String name, String sequence, int start, int end) {\r
+        this.name = name;\r
+        this.sequence = sequence;\r
+        this.start = start;\r
+        this.end = end;\r
+\r
+        setDisplayId();\r
+    }\r
+\r
+    public Sequence(String name, String sequence) {\r
+        this(name, sequence, 1, sequence.length());\r
+    }\r
+\r
+    public Sequence(SequenceI seq) {\r
+        this(seq.getName(), seq.getSequence(), seq.getStart(), seq.getEnd());\r
+    }\r
+\r
+    public void setSequenceFeatures(Vector v) {\r
+        sequenceFeatures = v;\r
+    }\r
+\r
+    public Vector getSequenceFeatures() {\r
+        return sequenceFeatures;\r
+    }\r
+\r
+    public void setPDBId(String id) {\r
+        pdbId = id;\r
+    }\r
+\r
+    public String getPDBId() {\r
+        return pdbId;\r
+    }\r
+\r
+    public String getDisplayId() {\r
+        return displayId;\r
+    }\r
+\r
+    public void setDisplayId() {\r
+        displayId = name + "/" + start + "-" + end;\r
+    }\r
+\r
+    public void setName(String name) {\r
+        this.name = name;\r
+        setDisplayId();\r
+    }\r
+\r
+    public String getName() {\r
+        return this.name;\r
+    }\r
+\r
+    public void setStart(int start) {\r
+        this.start = start;\r
+        setDisplayId();\r
+    }\r
+\r
+    public int getStart() {\r
+        return this.start;\r
+    }\r
+\r
+    public void setEnd(int end) {\r
+        this.end = end;\r
+        setDisplayId();\r
+    }\r
+\r
+    public int getEnd() {\r
+        return this.end;\r
+    }\r
+\r
+    public int getLength() {\r
+        return this.sequence.length();\r
+    }\r
+\r
+    public void setSequence(String seq) {\r
+        this.sequence = seq;\r
+    }\r
+\r
+    public String getSequence() {\r
+        return this.sequence;\r
+    }\r
+\r
+    public String getSequence(int start, int end) {\r
+        // JBPNote - left to user to pad the result here (TODO:Decide on this policy)\r
+        if (start >= sequence.length()) {\r
+            return "";\r
+        }\r
+\r
+        if (end >= sequence.length()) {\r
+            end = sequence.length();\r
+        }\r
+\r
+        return this.sequence.substring(start, end);\r
+    }\r
+\r
+    public char getCharAt(int i) {\r
+        if (i < sequence.length()) {\r
+            return sequence.charAt(i);\r
+        } else {\r
+            return ' ';\r
+        }\r
+    }\r
+\r
+    public void setDescription(String desc) {\r
+        this.description = desc;\r
+    }\r
+\r
+    public String getDescription() {\r
+        return this.description;\r
+    }\r
+\r
+    public int findIndex(int pos) {\r
+        // returns the alignment position for a residue\r
+        int j = start;\r
+        int i = 0;\r
+\r
+        while ((i < sequence.length()) && (j <= end) && (j <= pos)) {\r
+            char c = sequence.charAt(i);\r
+\r
+            if (!jalview.util.Comparison.isGap((c))) {\r
+                j++;\r
+            }\r
+\r
+            i++;\r
+        }\r
+\r
+        if ((j == end) && (j < pos)) {\r
+            return end + 1;\r
+        } else {\r
+            return i;\r
+        }\r
+    }\r
+\r
+    public int findPosition(int i) {\r
+        // Returns the sequence position for an alignment position\r
+        int j = 0;\r
+        int pos = start;\r
+\r
+        while ((j < i) && (j < sequence.length())) {\r
+            char c = sequence.charAt(j);\r
+\r
+            if (!jalview.util.Comparison.isGap((c))) {\r
+                pos++;\r
+            }\r
+\r
+            j++;\r
+        }\r
+\r
+        return pos;\r
+    }\r
+\r
+    public int[] gapMap() {\r
+        // Returns an int array giving the position of each residue in the sequence in the alignment\r
+        String seq = jalview.analysis.AlignSeq.extractGaps("-. ", sequence);\r
+        int[] map = new int[seq.length()];\r
+        int j = 0;\r
+        int p = 0;\r
+\r
+        while (j < sequence.length()) {\r
+            if (!jalview.util.Comparison.isGap(sequence.charAt(j))) {\r
+                map[p++] = j;\r
+            }\r
+\r
+            j++;\r
+        }\r
+\r
+        return map;\r
+    }\r
+\r
+    public void deleteCharAt(int i) {\r
+        if (i >= sequence.length()) {\r
+            return;\r
+        }\r
+\r
+        sequence = sequence.substring(0, i) + sequence.substring(i + 1);\r
+    }\r
+\r
+    public void deleteChars(int i, int j) {\r
+        if (i >= sequence.length()) {\r
+            return;\r
+        }\r
+\r
+        if (j >= sequence.length()) {\r
+            sequence = sequence.substring(0, i);\r
+        } else {\r
+            sequence = sequence.substring(0, i) + sequence.substring(j);\r
+        }\r
+    }\r
 \r
+    public void insertCharAt(int i, char c) {\r
+        insertCharAt(i, c, true);\r
+    }\r
+\r
+    public void insertCharAt(int i, char c, boolean chop) {\r
+        String tmp = new String(sequence);\r
+\r
+        if (i < sequence.length()) {\r
+            sequence = tmp.substring(0, i) + String.valueOf(c) +\r
+                tmp.substring(i);\r
+        } else {\r
+            // JBPNote : padding char at end of sequence. We'll not get away with this when we insert residues, I bet!\r
+            char[] ch = new char[(1 + i) - sequence.length()];\r
+\r
+            for (int j = 0, k = ch.length; j < k; j++)\r
+                ch[j] = c;\r
+\r
+            sequence = tmp + String.valueOf(ch);\r
+        }\r
+    }\r
+\r
+    public void setColor(Color c) {\r
+        this.color = c;\r
+    }\r
+\r
+    public Color getColor() {\r
+        return color;\r
+    }\r
 }\r
index a2856fa..f7d8d89 100755 (executable)
 * 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.datamodel;\r
 \r
 import java.awt.*;\r
 \r
+\r
 public class SequenceFeature {\r
-  int begin;\r
-  int end;\r
-  String type;\r
-  String description;\r
-  String status;\r
+    int begin;\r
+    int end;\r
+    String type;\r
+    String description;\r
+    String status;\r
 \r
-  public SequenceFeature()\r
-  {\r
-  }\r
+    public SequenceFeature() {\r
+    }\r
 \r
-  public SequenceFeature(String type, int start, int end, String description, String status)\r
-  {\r
-    this.type = type;\r
-    this.begin = start;\r
-    this.end = end;\r
-    this.description = description;\r
-    this.status = status;\r
-  }\r
+    public SequenceFeature(String type, int start, int end, String description,\r
+        String status) {\r
+        this.type = type;\r
+        this.begin = start;\r
+        this.end = end;\r
+        this.description = description;\r
+        this.status = status;\r
+    }\r
 \r
-  public int getStart() {\r
-    return begin;\r
-  }\r
-  public int getEnd() {\r
-    return end;\r
-  }\r
-  public String getType() {\r
-    return type;\r
-  }\r
-  public String getDescription() {\r
-    return description;\r
-  }\r
-  public String getStatus()\r
-  {return status;}\r
+    public int getStart() {\r
+        return begin;\r
+    }\r
 \r
+    public int getEnd() {\r
+        return end;\r
+    }\r
 \r
-/*\r
-      <xs:enumeration value="active site" />\r
-<xs:enumeration value="binding site" />\r
-<xs:enumeration value="calcium-binding region" />\r
-<xs:enumeration value="chain" />\r
-<xs:enumeration value="cross-link" />\r
-<xs:enumeration value="disulfide bond" />\r
-<xs:enumeration value="DNA-binding region" />\r
-<xs:enumeration value="domain" />\r
-<xs:enumeration value="glycosylation site" />\r
-<xs:enumeration value="helix" />\r
-<xs:enumeration value="initiator methionine" />\r
-<xs:enumeration value="lipid moiety-binding region" />\r
-<xs:enumeration value="metal ion-binding site" />\r
-<xs:enumeration value="modified residue" />\r
-<xs:enumeration value="mutagenesis site" />\r
-<xs:enumeration value="non-consecutive residues" />\r
-<xs:enumeration value="non-terminal residue" />\r
-<xs:enumeration value="nucleotide phosphate-binding region" />\r
-<xs:enumeration value="peptide" />\r
-<xs:enumeration value="propeptide" />\r
-<xs:enumeration value="repeat" />\r
-<xs:enumeration value="selenocysteine" />\r
-<xs:enumeration value="sequence conflict" />\r
-<xs:enumeration value="sequence variant" />\r
-<xs:enumeration value="signal peptide" />\r
-<xs:enumeration value="similar" />\r
-<xs:enumeration value="site" />\r
-<xs:enumeration value="splice variant" />\r
-<xs:enumeration value="strand" />\r
-<xs:enumeration value="thioether bond" />\r
-<xs:enumeration value="thiolester bond" />\r
-<xs:enumeration value="transit peptide" />\r
-<xs:enumeration value="transmembrane region" />\r
-<xs:enumeration value="turn" />\r
-<xs:enumeration value="unsure residue" />\r
-<xs:enumeration value="zinc finger region" />\r
-*/\r
+    public String getType() {\r
+        return type;\r
+    }\r
 \r
-}\r
+    public String getDescription() {\r
+        return description;\r
+    }\r
+\r
+    public String getStatus() {\r
+        return status;\r
+    }\r
 \r
+    /*\r
+          <xs:enumeration value="active site" />\r
+    <xs:enumeration value="binding site" />\r
+    <xs:enumeration value="calcium-binding region" />\r
+    <xs:enumeration value="chain" />\r
+    <xs:enumeration value="cross-link" />\r
+    <xs:enumeration value="disulfide bond" />\r
+    <xs:enumeration value="DNA-binding region" />\r
+    <xs:enumeration value="domain" />\r
+    <xs:enumeration value="glycosylation site" />\r
+    <xs:enumeration value="helix" />\r
+    <xs:enumeration value="initiator methionine" />\r
+    <xs:enumeration value="lipid moiety-binding region" />\r
+    <xs:enumeration value="metal ion-binding site" />\r
+    <xs:enumeration value="modified residue" />\r
+    <xs:enumeration value="mutagenesis site" />\r
+    <xs:enumeration value="non-consecutive residues" />\r
+    <xs:enumeration value="non-terminal residue" />\r
+    <xs:enumeration value="nucleotide phosphate-binding region" />\r
+    <xs:enumeration value="peptide" />\r
+    <xs:enumeration value="propeptide" />\r
+    <xs:enumeration value="repeat" />\r
+    <xs:enumeration value="selenocysteine" />\r
+    <xs:enumeration value="sequence conflict" />\r
+    <xs:enumeration value="sequence variant" />\r
+    <xs:enumeration value="signal peptide" />\r
+    <xs:enumeration value="similar" />\r
+    <xs:enumeration value="site" />\r
+    <xs:enumeration value="splice variant" />\r
+    <xs:enumeration value="strand" />\r
+    <xs:enumeration value="thioether bond" />\r
+    <xs:enumeration value="thiolester bond" />\r
+    <xs:enumeration value="transit peptide" />\r
+    <xs:enumeration value="transmembrane region" />\r
+    <xs:enumeration value="turn" />\r
+    <xs:enumeration value="unsure residue" />\r
+    <xs:enumeration value="zinc finger region" />\r
+    */\r
+}\r
index d6ea5dd..0ae9ec2 100755 (executable)
 * 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.datamodel;\r
 \r
-import jalview.schemes.*;\r
 import jalview.analysis.*;\r
+\r
 import jalview.datamodel.*;\r
-import java.util.Vector;\r
+\r
+import jalview.schemes.*;\r
+\r
 import java.awt.*;\r
 \r
-public class SequenceGroup\r
-{\r
-  String groupName;\r
-  Conservation conserve;\r
-  Vector aaFrequency;\r
-  boolean displayBoxes;\r
-  boolean displayText;\r
-  boolean colourText;\r
-  public Vector sequences = new Vector();\r
-  int width = -1;\r
-  public ColourSchemeI cs;\r
-  int startRes = 0;\r
-  int endRes = 0;\r
-  Color outlineColour = Color.black;\r
-\r
-  public SequenceGroup()\r
-  {\r
-    groupName = "Group";\r
-    this.displayBoxes = true;\r
-    this.displayText = true;\r
-    this.colourText = false;\r
-    cs = null;\r
-  }\r
-\r
-  public SequenceGroup(String groupName, ColourSchemeI scheme,\r
-                       boolean displayBoxes, boolean displayText,\r
-                       boolean colourText,\r
-                       int start,\r
-                       int end)\r
-  {\r
-\r
-    this.groupName = groupName;\r
-    this.displayBoxes = displayBoxes;\r
-    this.displayText = displayText;\r
-    this.colourText = colourText;\r
-    this.cs = scheme;\r
-    startRes = start;\r
-    endRes = end;\r
-  }\r
-\r
-  public boolean adjustForRemoveLeft(int col)\r
-  {\r
-    // return value is true if the group still exists\r
-    if(startRes>=col)\r
-      startRes = startRes - col;\r
-    if(endRes>=col)\r
-    {\r
-      endRes = endRes - col;\r
-      if(startRes>endRes)\r
-        startRes = 0;\r
+import java.util.Vector;\r
+\r
+\r
+public class SequenceGroup {\r
+    String groupName;\r
+    Conservation conserve;\r
+    Vector aaFrequency;\r
+    boolean displayBoxes;\r
+    boolean displayText;\r
+    boolean colourText;\r
+    public Vector sequences = new Vector();\r
+    int width = -1;\r
+    public ColourSchemeI cs;\r
+    int startRes = 0;\r
+    int endRes = 0;\r
+    Color outlineColour = Color.black;\r
+\r
+    public SequenceGroup() {\r
+        groupName = "Group";\r
+        this.displayBoxes = true;\r
+        this.displayText = true;\r
+        this.colourText = false;\r
+        cs = null;\r
+    }\r
+\r
+    public SequenceGroup(String groupName, ColourSchemeI scheme,\r
+        boolean displayBoxes, boolean displayText, boolean colourText,\r
+        int start, int end) {\r
+        this.groupName = groupName;\r
+        this.displayBoxes = displayBoxes;\r
+        this.displayText = displayText;\r
+        this.colourText = colourText;\r
+        this.cs = scheme;\r
+        startRes = start;\r
+        endRes = end;\r
+    }\r
+\r
+    public boolean adjustForRemoveLeft(int col) {\r
+        // return value is true if the group still exists\r
+        if (startRes >= col) {\r
+            startRes = startRes - col;\r
+        }\r
+\r
+        if (endRes >= col) {\r
+            endRes = endRes - col;\r
+\r
+            if (startRes > endRes) {\r
+                startRes = 0;\r
+            }\r
+        } else {\r
+            // must delete this group!!\r
+            return false;\r
+        }\r
+\r
+        return true;\r
+    }\r
+\r
+    public boolean adjustForRemoveRight(int col) {\r
+        if (startRes > col) {\r
+            // delete this group\r
+            return false;\r
+        }\r
+\r
+        if (endRes >= col) {\r
+            endRes = col;\r
+        }\r
+\r
+        return true;\r
+    }\r
+\r
+    public String getName() {\r
+        return groupName;\r
+    }\r
+\r
+    public void setName(String name) {\r
+        groupName = name;\r
+    }\r
+\r
+    public Conservation getConservation() {\r
+        return conserve;\r
+    }\r
+\r
+    public void setConservation(Conservation c) {\r
+        conserve = c;\r
+    }\r
+\r
+    public void addSequence(SequenceI s) {\r
+        if (!sequences.contains(s)) {\r
+            sequences.addElement(s);\r
+        }\r
+\r
+        if (cs != null) {\r
+            cs.setConsensus(AAFrequency.calculate(sequences, 0, getWidth()));\r
+        }\r
+\r
+        if (cs instanceof ConservationColourScheme) {\r
+            recalcConservation();\r
+        }\r
+    }\r
+\r
+    void recalcConservation() {\r
+        Conservation c = new Conservation(groupName,\r
+                ResidueProperties.propHash, 3, sequences, 0, getWidth());\r
+        c.calculate();\r
+        c.verdict(false, 25);\r
+\r
+        ConservationColourScheme ccs = (ConservationColourScheme) cs;\r
+        ccs.conserve = c;\r
     }\r
-    else\r
-    {\r
-        // must delete this group!!\r
-        return false;\r
+\r
+    public void addOrRemove(SequenceI s) {\r
+        if (sequences.contains(s)) {\r
+            deleteSequence(s);\r
+        } else {\r
+            addSequence(s);\r
+        }\r
+    }\r
+\r
+    public void deleteSequence(SequenceI s) {\r
+        sequences.removeElement(s);\r
+\r
+        if (cs != null) {\r
+            cs.setConsensus(AAFrequency.calculate(sequences, 0, getWidth()));\r
+        }\r
+\r
+        if (cs instanceof ConservationColourScheme) {\r
+            recalcConservation();\r
+        }\r
+    }\r
+\r
+    public int getStartRes() {\r
+        return startRes;\r
+    }\r
+\r
+    public int getEndRes() {\r
+        return endRes;\r
+    }\r
+\r
+    public void setStartRes(int i) {\r
+        startRes = i;\r
     }\r
 \r
-    return true;\r
-  }\r
+    public void setEndRes(int i) {\r
+        endRes = i;\r
+    }\r
 \r
-  public boolean adjustForRemoveRight(int col)\r
-  {\r
+    public int getSize() {\r
+        return sequences.size();\r
+    }\r
 \r
-    if(startRes>col)\r
-    {\r
-      // delete this group\r
-      return false;\r
+    public SequenceI getSequenceAt(int i) {\r
+        return (SequenceI) sequences.elementAt(i);\r
     }\r
 \r
-    if(endRes>=col)\r
-      endRes = col;\r
-\r
-    return true;\r
-  }\r
-\r
-\r
-  public String getName()\r
-  {\r
-    return groupName;\r
-  }\r
-\r
-  public void setName(String name)\r
-  {\r
-    groupName = name;\r
-  }\r
-\r
-  public Conservation getConservation()\r
-  {\r
-    return conserve;\r
-  }\r
-\r
-  public void setConservation(Conservation c)\r
-  {\r
-    conserve = c;\r
-  }\r
-\r
-  public void addSequence(SequenceI s)\r
-  {\r
-    if(!sequences.contains(s))\r
-      sequences.addElement(s);\r
-\r
-\r
-    if(cs!=null)\r
-      cs.setConsensus( AAFrequency.calculate(sequences, 0, getWidth()) );\r
-\r
-    if(cs instanceof ConservationColourScheme)\r
-      recalcConservation();\r
-  }\r
-\r
-  void recalcConservation()\r
-  {\r
-      Conservation c = new Conservation(groupName,\r
-                                        ResidueProperties.propHash, 3,\r
-                                        sequences, 0, getWidth());\r
-      c.calculate();\r
-      c.verdict(false, 25);\r
-      ConservationColourScheme ccs = (ConservationColourScheme)cs;\r
-      ccs.conserve = c;\r
-  }\r
-\r
-  public void addOrRemove(SequenceI s)\r
-  {\r
-    if(sequences.contains(s))\r
-      deleteSequence(s);\r
-    else\r
-      addSequence(s);\r
-  }\r
-\r
-  public void deleteSequence(SequenceI s)\r
-  {\r
-    sequences.removeElement(s);\r
-\r
-    if(cs!=null)\r
-      cs.setConsensus( AAFrequency.calculate(sequences, 0, getWidth()) );\r
-\r
-    if(cs instanceof ConservationColourScheme)\r
-      recalcConservation();\r
-  }\r
-\r
-\r
-  public int getStartRes()\r
-  {\r
-    return startRes;\r
-  }\r
-\r
-  public int getEndRes()\r
-  {\r
-    return endRes;\r
-  }\r
-\r
-  public void setStartRes(int i)\r
-  {\r
-    startRes = i;\r
-  }\r
-\r
-  public void setEndRes(int i)\r
-  {\r
-    endRes = i;\r
-  }\r
-\r
-  public int getSize()\r
-  {\r
-    return sequences.size();\r
-  }\r
-\r
-  public SequenceI getSequenceAt(int i)\r
-  {\r
-    return (SequenceI) sequences.elementAt(i);\r
-  }\r
-\r
-  public void setColourText(boolean state)\r
-  {\r
-    colourText = state;\r
-  }\r
-\r
-  public boolean getColourText()\r
-  {\r
-    return colourText;\r
-  }\r
-\r
-  public void setDisplayText(boolean state)\r
-  {\r
-    displayText = state;\r
-  }\r
-\r
-  public boolean getDisplayText()\r
-  {\r
-    return displayText;\r
-  }\r
-\r
-  public void setDisplayBoxes(boolean state)\r
-  {\r
-    displayBoxes = state;\r
-  }\r
-\r
-  public boolean getDisplayBoxes()\r
-  {\r
-    return displayBoxes;\r
-  }\r
-\r
-  public int getWidth()\r
-  {\r
-    // MC This needs to get reset when characters are inserted and deleted\r
-    if (sequences.size()>0)\r
-      width = ((SequenceI) sequences.elementAt(0)).getLength();\r
-    for (int i = 1; i < sequences.size(); i++)\r
-    {\r
-      SequenceI seq = (SequenceI) sequences.elementAt(i);\r
-      if (seq.getLength() > width)\r
-        width = seq.getLength();\r
+    public void setColourText(boolean state) {\r
+        colourText = state;\r
     }\r
-    return width;\r
-  }\r
-\r
-\r
-  public void setOutlineColour(Color c)\r
-  {\r
-    outlineColour = c;\r
-  }\r
-  public Color getOutlineColour()\r
-  {\r
-    return outlineColour;\r
-  }\r
-  /**\r
-   *\r
-   * returns the sequences in the group ordered by the ordering given by al\r
-   *\r
-   * @param al Alignment\r
-   * @return SequenceI[]\r
-   */\r
-  public SequenceI[] getSequencesInOrder(Alignment al) {\r
-    int sz;\r
-    java.util.Hashtable orderedSeqs = new java.util.Hashtable();\r
-    SequenceI[] seqs=new SequenceI[sz=sequences.size()];\r
-    for(int i=0; i<sz; i++)\r
-    {\r
-      SequenceI seq = (SequenceI) sequences.elementAt(i);\r
-      int index = al.findIndex(seq);\r
-      orderedSeqs.put(index+"", seq);\r
+\r
+    public boolean getColourText() {\r
+        return colourText;\r
     }\r
 \r
-    int index=0;\r
-    for(int i=0; i<sz; i++) {\r
-      SequenceI seq = null;\r
-      while (seq == null)\r
-      {\r
-        if (orderedSeqs.containsKey(index + ""))\r
-        {\r
-          seq = (SequenceI) orderedSeqs.get(index + "");\r
-          index++;\r
-          break;\r
+    public void setDisplayText(boolean state) {\r
+        displayText = state;\r
+    }\r
+\r
+    public boolean getDisplayText() {\r
+        return displayText;\r
+    }\r
+\r
+    public void setDisplayBoxes(boolean state) {\r
+        displayBoxes = state;\r
+    }\r
+\r
+    public boolean getDisplayBoxes() {\r
+        return displayBoxes;\r
+    }\r
+\r
+    public int getWidth() {\r
+        // MC This needs to get reset when characters are inserted and deleted\r
+        if (sequences.size() > 0) {\r
+            width = ((SequenceI) sequences.elementAt(0)).getLength();\r
+        }\r
+\r
+        for (int i = 1; i < sequences.size(); i++) {\r
+            SequenceI seq = (SequenceI) sequences.elementAt(i);\r
+\r
+            if (seq.getLength() > width) {\r
+                width = seq.getLength();\r
+            }\r
         }\r
-        else\r
-          index++;\r
-      }\r
-      seqs[index] = seq;\r
+\r
+        return width;\r
+    }\r
+\r
+    public void setOutlineColour(Color c) {\r
+        outlineColour = c;\r
+    }\r
+\r
+    public Color getOutlineColour() {\r
+        return outlineColour;\r
+    }\r
+\r
+    /**\r
+     *\r
+     * returns the sequences in the group ordered by the ordering given by al\r
+     *\r
+     * @param al Alignment\r
+     * @return SequenceI[]\r
+     */\r
+    public SequenceI[] getSequencesInOrder(Alignment al) {\r
+        int sz;\r
+        java.util.Hashtable orderedSeqs = new java.util.Hashtable();\r
+        SequenceI[] seqs = new SequenceI[sz = sequences.size()];\r
+\r
+        for (int i = 0; i < sz; i++) {\r
+            SequenceI seq = (SequenceI) sequences.elementAt(i);\r
+            int index = al.findIndex(seq);\r
+            orderedSeqs.put(index + "", seq);\r
+        }\r
+\r
+        int index = 0;\r
+\r
+        for (int i = 0; i < sz; i++) {\r
+            SequenceI seq = null;\r
+\r
+            while (seq == null) {\r
+                if (orderedSeqs.containsKey(index + "")) {\r
+                    seq = (SequenceI) orderedSeqs.get(index + "");\r
+                    index++;\r
+\r
+                    break;\r
+                } else {\r
+                    index++;\r
+                }\r
+            }\r
+\r
+            seqs[index] = seq;\r
+        }\r
+\r
+        return seqs;\r
     }\r
-    return seqs;\r
-  }\r
 }\r
index 9c2ab48..f16c009 100755 (executable)
 * 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.datamodel;\r
 \r
 import jalview.jbgui.*;\r
+\r
 import java.awt.*;\r
 \r
 import java.util.Vector;\r
 \r
+\r
 public interface SequenceI {\r
-  public void        setName(String name);\r
-  public String      getName();\r
+    public void setName(String name);\r
+\r
+    public String getName();\r
+\r
+    public void setStart(int start);\r
+\r
+    public int getStart();\r
+\r
+    public String getDisplayId();\r
 \r
-  public void        setStart(int start);\r
-  public int         getStart();\r
+    public void setEnd(int end);\r
 \r
-  public String      getDisplayId();\r
+    public int getEnd();\r
 \r
-  public void        setEnd(int end);\r
-  public int         getEnd();\r
+    public int getLength();\r
 \r
-  public int         getLength();\r
+    public void setSequence(String sequence);\r
 \r
-  public void        setSequence(String sequence);\r
-  public String      getSequence();\r
-  public String      getSequence(int start,int end);\r
-  public char        getCharAt(int i);\r
+    public String getSequence();\r
 \r
-  public void        setDescription(String desc);\r
-  public String      getDescription();\r
+    public String getSequence(int start, int end);\r
 \r
-  public int         findIndex(int pos);\r
-  public int         findPosition(int i);\r
-  public int[]         gapMap();\r
-  public void       deleteChars(int i, int j);\r
-  public void       deleteCharAt(int i);\r
-  public void       insertCharAt(int i, char c);\r
-  public void       insertCharAt(int i,char c,boolean chop);\r
+    public char getCharAt(int i);\r
 \r
-  public void        setColor(Color c);\r
-  public Color       getColor();\r
+    public void setDescription(String desc);\r
 \r
-  public Vector     getSequenceFeatures();\r
-  public void       setSequenceFeatures(Vector v);\r
+    public String getDescription();\r
 \r
-  public void setPDBId(String id);\r
-  public String getPDBId();\r
+    public int findIndex(int pos);\r
 \r
-  }\r
+    public int findPosition(int i);\r
 \r
+    public int[] gapMap();\r
 \r
+    public void deleteChars(int i, int j);\r
 \r
+    public void deleteCharAt(int i);\r
 \r
+    public void insertCharAt(int i, char c);\r
 \r
+    public void insertCharAt(int i, char c, boolean chop);\r
 \r
+    public void setColor(Color c);\r
 \r
+    public Color getColor();\r
 \r
+    public Vector getSequenceFeatures();\r
 \r
+    public void setSequenceFeatures(Vector v);\r
 \r
+    public void setPDBId(String id);\r
 \r
+    public String getPDBId();\r
+}\r
index 74776ea..f86c63e 100755 (executable)
 * 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.datamodel;\r
 \r
 import java.awt.*;\r
 \r
+\r
 public class SequenceNode extends BinaryNode {\r
+    public float dist;\r
+    public int count;\r
+    public float height;\r
+    public float ycount;\r
+    public Color color = Color.black;\r
+    public boolean dummy = false;\r
+    private boolean placeholder = false;\r
+\r
+    public SequenceNode() {\r
+        super();\r
+    }\r
 \r
-  public float dist;\r
-  public int count;\r
-  public float height;\r
-  public float ycount;\r
-  public Color color = Color.black;\r
-  public boolean dummy = false;\r
-  private boolean placeholder = false;\r
+    public SequenceNode(Object val, SequenceNode parent, float dist, String name) {\r
+        super(val, parent, name);\r
+        this.dist = dist;\r
+    }\r
 \r
-  public SequenceNode() {\r
-    super();\r
-  }\r
+    public SequenceNode(Object val, SequenceNode parent, String name,\r
+        float dist, int bootstrap, boolean dummy) {\r
+        super(val, parent, name);\r
+        this.dist = dist;\r
+        this.bootstrap = bootstrap;\r
+        this.dummy = dummy;\r
+    }\r
 \r
-  public SequenceNode(Object val, SequenceNode parent, float dist,String name) {\r
-    super(val,parent,name);\r
-    this.dist = dist;\r
-  }\r
-  public SequenceNode(Object val, SequenceNode parent, String name, float dist, int bootstrap, boolean dummy) {\r
-    super(val,parent,name);\r
-    this.dist = dist;\r
-    this.bootstrap = bootstrap;\r
-    this.dummy = dummy;\r
-  }\r
+    /**\r
+     * @param dummy true if node is created for the representation of polytomous trees\r
+     */\r
+    public boolean isDummy() {\r
+        return dummy;\r
+    }\r
 \r
+    /* @param placeholder is true if the sequence refered to in the\r
+     *  element node is not actually present in the associated alignment\r
+     */\r
+    public boolean isPlaceholder() {\r
+        return placeholder;\r
+    }\r
 \r
-  /**\r
-   * @param dummy true if node is created for the representation of polytomous trees\r
-   */\r
+    public boolean setDummy(boolean newstate) {\r
+        boolean oldstate = dummy;\r
+        dummy = newstate;\r
 \r
-  public boolean isDummy() {\r
-    return dummy;\r
-  }\r
-  /* @param placeholder is true if the sequence refered to in the\r
-   *  element node is not actually present in the associated alignment\r
-   */\r
-  public boolean isPlaceholder()\r
-  {\r
-    return placeholder;\r
-  }\r
+        return oldstate;\r
+    }\r
 \r
-  public boolean setDummy(boolean newstate) {\r
-    boolean oldstate = dummy;\r
-    dummy = newstate;\r
-    return oldstate;\r
-  }\r
+    public void setPlaceholder(boolean Placeholder) {\r
+        this.placeholder = Placeholder;\r
+    }\r
 \r
-  public void setPlaceholder(boolean Placeholder)\r
-  {\r
-    this.placeholder = Placeholder;\r
-  }\r
+    /**\r
+     * ascends the tree but doesn't stop until a non-dummy node is discovered.\r
+     * This will probably break if the tree is a mixture of BinaryNodes and SequenceNodes.\r
+     */\r
+    public SequenceNode AscendTree() {\r
+        SequenceNode c = this;\r
 \r
-  /**\r
-   * ascends the tree but doesn't stop until a non-dummy node is discovered.\r
-   * This will probably break if the tree is a mixture of BinaryNodes and SequenceNodes.\r
-   */\r
+        do {\r
+            c = (SequenceNode) c.parent();\r
+        } while ((c != null) && c.dummy);\r
 \r
-  public SequenceNode AscendTree() {\r
-    SequenceNode c = this;\r
-    do {\r
-      c = (SequenceNode) c.parent();\r
-    } while (c!=null && c.dummy);\r
-    return c;\r
-  }\r
+        return c;\r
+    }\r
 }\r
index 5da4d64..fa91e59 100755 (executable)
 * 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.datamodel;\r
-import java.util.*;\r
-import java.awt.*;\r
 \r
+import java.awt.*;\r
 \r
-public class SequencePoint {\r
+import java.util.*;\r
 \r
-  // SMJS PUBLIC\r
-  public SequenceI sequence;\r
-  public float[] coord;\r
-  // SMJS ENDPUBLIC\r
 \r
-  public SequencePoint(SequenceI sequence, float[] coord) {\r
-    this.sequence = sequence;\r
-    this.coord = coord;\r
-  }\r
+public class SequencePoint {\r
+    // SMJS PUBLIC\r
+    public SequenceI sequence;\r
+    public float[] coord;\r
 \r
+    // SMJS ENDPUBLIC\r
+    public SequencePoint(SequenceI sequence, float[] coord) {\r
+        this.sequence = sequence;\r
+        this.coord = coord;\r
+    }\r
 }\r
index cd86ef6..ad6f703 100755 (executable)
 * 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.datamodel;\r
 \r
-import jalview.schemes.*;\r
 import jalview.analysis.*;\r
+\r
 import jalview.datamodel.*;\r
+\r
+import jalview.schemes.*;\r
+\r
 import java.util.*;\r
 \r
-public class SuperGroup\r
-{\r
-  String groupName;\r
-  boolean displayBoxes;\r
-  boolean displayText;\r
-  boolean colourText;\r
-  public ColourSchemeI cs;\r
-  Vector sequenceGroups = new Vector();\r
-\r
-  public SuperGroup()\r
-  {\r
-    groupName = "Super group";\r
-    this.displayBoxes = true;\r
-    this.displayText = true;\r
-    this.colourText = false;\r
-    cs = null;\r
-  }\r
-\r
-\r
-  public SuperGroup(String groupName, ColourSchemeI scheme,\r
-                       boolean displayBoxes, boolean displayText,\r
-                       boolean colourText)\r
-     {\r
-       this.groupName = groupName;\r
-       this.displayBoxes = displayBoxes;\r
-       this.displayText = displayText;\r
-       this.colourText = colourText;\r
-       this.cs = scheme;\r
-     }\r
-\r
-  public String getName()\r
-  {\r
-    return groupName;\r
-  }\r
-\r
-  public void setName(String name)\r
-  {\r
-    groupName = name;\r
-  }\r
-\r
-\r
-  public void addGroup(SequenceGroup sg)\r
-  {\r
-    if(!sequenceGroups.contains(sg))\r
-      sequenceGroups.addElement(sg);\r
-  }\r
-\r
-  public void addOrRemove(SequenceGroup sg)\r
-  {\r
-    if(sequenceGroups.contains(sg))\r
-      deleteGroup(sg);\r
-    else\r
-      addGroup(sg);\r
-  }\r
-\r
-  public void deleteGroup(SequenceGroup sg)\r
-  {\r
-    sequenceGroups.removeElement(sg);\r
-  }\r
-\r
-  public void setSuperGroupProperties(SequenceGroup sg)\r
-  {\r
-    cs = sg.cs;\r
-    colourText = sg.colourText;\r
-    displayText = sg.displayText;\r
-    displayBoxes = sg.displayBoxes;\r
-\r
-    for(int i=0; i<sequenceGroups.size(); i++)\r
-    {\r
-      SequenceGroup temp = (SequenceGroup)sequenceGroups.elementAt(i);\r
-      temp.cs = sg.cs;\r
-      temp.colourText = sg.colourText;\r
-      temp.displayText = sg.displayText;\r
-      temp.displayBoxes = sg.displayBoxes;\r
+\r
+public class SuperGroup {\r
+    String groupName;\r
+    boolean displayBoxes;\r
+    boolean displayText;\r
+    boolean colourText;\r
+    public ColourSchemeI cs;\r
+    Vector sequenceGroups = new Vector();\r
+\r
+    public SuperGroup() {\r
+        groupName = "Super group";\r
+        this.displayBoxes = true;\r
+        this.displayText = true;\r
+        this.colourText = false;\r
+        cs = null;\r
+    }\r
+\r
+    public SuperGroup(String groupName, ColourSchemeI scheme,\r
+        boolean displayBoxes, boolean displayText, boolean colourText) {\r
+        this.groupName = groupName;\r
+        this.displayBoxes = displayBoxes;\r
+        this.displayText = displayText;\r
+        this.colourText = colourText;\r
+        this.cs = scheme;\r
+    }\r
+\r
+    public String getName() {\r
+        return groupName;\r
     }\r
-  }\r
 \r
+    public void setName(String name) {\r
+        groupName = name;\r
+    }\r
+\r
+    public void addGroup(SequenceGroup sg) {\r
+        if (!sequenceGroups.contains(sg)) {\r
+            sequenceGroups.addElement(sg);\r
+        }\r
+    }\r
 \r
-  public int getSize()\r
-  {\r
-    return sequenceGroups.size();\r
-  }\r
+    public void addOrRemove(SequenceGroup sg) {\r
+        if (sequenceGroups.contains(sg)) {\r
+            deleteGroup(sg);\r
+        } else {\r
+            addGroup(sg);\r
+        }\r
+    }\r
+\r
+    public void deleteGroup(SequenceGroup sg) {\r
+        sequenceGroups.removeElement(sg);\r
+    }\r
 \r
-  public SequenceGroup getGroupeAt(int i)\r
-  {\r
-    return (SequenceGroup) sequenceGroups.elementAt(i);\r
-  }\r
+    public void setSuperGroupProperties(SequenceGroup sg) {\r
+        cs = sg.cs;\r
+        colourText = sg.colourText;\r
+        displayText = sg.displayText;\r
+        displayBoxes = sg.displayBoxes;\r
+\r
+        for (int i = 0; i < sequenceGroups.size(); i++) {\r
+            SequenceGroup temp = (SequenceGroup) sequenceGroups.elementAt(i);\r
+            temp.cs = sg.cs;\r
+            temp.colourText = sg.colourText;\r
+            temp.displayText = sg.displayText;\r
+            temp.displayBoxes = sg.displayBoxes;\r
+        }\r
+    }\r
+\r
+    public int getSize() {\r
+        return sequenceGroups.size();\r
+    }\r
+\r
+    public SequenceGroup getGroupeAt(int i) {\r
+        return (SequenceGroup) sequenceGroups.elementAt(i);\r
+    }\r
 }\r
index 8cb12d1..9bc4bc0 100755 (executable)
-/*
-* Jalview - A Sequence Alignment Editor and Viewer
-* Copyright (C) 2005 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.gui;
-
-import java.util.*;
-
-import java.awt.*;
-import java.awt.datatransfer.*;
-import java.awt.event.*;
-import java.awt.print.*;
-import javax.swing.*;
-import javax.swing.event.*;
-
-import jalview.analysis.*;
-import jalview.datamodel.*;
-import jalview.io.*;
-import jalview.jbgui.*;
-import jalview.schemes.*;
-import jalview.ws.*;
-import java.beans.PropertyChangeEvent;
-
-public class AlignFrame extends GAlignFrame
-{
-  final AlignmentPanel alignPanel;
-  final AlignViewport viewport;
-  public static final int NEW_WINDOW_WIDTH = 700;
-  public static final int NEW_WINDOW_HEIGHT = 500;
-  public String currentFileFormat = "Jalview";
-
-  public AlignFrame(AlignmentI al)
-  {
-    viewport = new AlignViewport(al);
-
-    alignPanel = new AlignmentPanel(this, viewport);
-    alignPanel.annotationPanel.adjustPanelHeight();
-    alignPanel.annotationSpaceFillerHolder.setPreferredSize(alignPanel.annotationPanel.getPreferredSize());
-    alignPanel.annotationScroller.setPreferredSize(alignPanel.annotationPanel.getPreferredSize());
-    alignPanel.setAnnotationVisible( viewport.getShowAnnotation() );
-
-    getContentPane().add(alignPanel, java.awt.BorderLayout.CENTER);
-
-    addInternalFrameListener(new InternalFrameAdapter()
-   {
-     public void internalFrameActivated(InternalFrameEvent evt)
-     {
-          javax.swing.SwingUtilities.invokeLater(new Runnable()
-          {
-            public void run()
-            {      alignPanel.requestFocus();    }
-          });
-
-     }
-   });
-
-  }
-
-  public void saveAlignmentMenu_actionPerformed(ActionEvent e)
-  {
-    JalviewFileChooser chooser = new JalviewFileChooser(jalview.bin.Cache.getProperty("LAST_DIRECTORY")
-        ,  new String[]{"fa, fasta, fastq", "aln",  "pfam", "msf", "pir","blc","jar"},
-          new String[]{"Fasta", "Clustal", "PFAM", "MSF", "PIR", "BLC", "Jalview"},
-          currentFileFormat);
-
-    chooser.setAcceptAllFileFilterUsed(false);
-    chooser.setFileView(new JalviewFileView());
-    chooser.setDialogTitle("Save Alignment to file");
-    chooser.setToolTipText("Save");
-    int value = chooser.showSaveDialog(this);
-    if(value == JalviewFileChooser.APPROVE_OPTION)
-    {
-      currentFileFormat  = chooser.getSelectedFormat();
-      jalview.bin.Cache.setProperty("DEFAULT_FILE_FORMAT", currentFileFormat);
-
-      if (currentFileFormat.equals("Jalview"))
-      {
-        String shortName = title;
-        if(shortName.indexOf(java.io.File.separatorChar)>-1)
-              shortName = shortName.substring(
-                    shortName.lastIndexOf(java.io.File.separatorChar)+1);
-
-        String choice = chooser.getSelectedFile().getPath();
-        Jalview2XML.SaveState(this, choice, shortName);
-        // USE Jalview2XML to save this file
-        return;
-      }
-
-      String choice =  chooser.getSelectedFile().getPath();
-      jalview.bin.Cache.setProperty("LAST_DIRECTORY", choice);
-      String output = FormatAdapter.formatSequences(currentFileFormat, viewport.getAlignment().getSequences());
-      try{
-        java.io.PrintWriter out = new java.io.PrintWriter( new java.io.FileWriter( choice )  );
-        out.println(output);
-        out.close();
-      }
-      catch(Exception ex){}
-    }
-
-  }
-
-  protected void outputText_actionPerformed(ActionEvent e)
-  {
-     CutAndPasteTransfer cap = new CutAndPasteTransfer();
-     Desktop.addInternalFrame(cap, "Alignment output - "+e.getActionCommand(), 600, 500);
-     cap.setText( FormatAdapter.formatSequences(e.getActionCommand(), viewport.getAlignment().getSequences()));
-  }
-
-  protected void htmlMenuItem_actionPerformed(ActionEvent e)
-  {
-    new HTMLOutput(viewport);
-  }
-
-  protected void createPNG_actionPerformed(ActionEvent e)
-  {
-    alignPanel.makePNG();
-  }
-
-  protected void epsFile_actionPerformed(ActionEvent e)
-  {
-    alignPanel.makeEPS();
-  }
-
-
-  public void printMenuItem_actionPerformed(ActionEvent e)
-  {
-    //Putting in a thread avoids Swing painting problems
-    PrintThread thread = new PrintThread();
-    thread.start();
-  }
-
-  class PrintThread extends Thread
-  {
-    public void run()
-    {
-      PrinterJob printJob = PrinterJob.getPrinterJob();
-      PageFormat pf = printJob.pageDialog(printJob.defaultPage());
-      printJob.setPrintable(alignPanel, pf);
-      if (printJob.printDialog())
-      {
-        try
-        {
-          printJob.print();
-        }
-        catch (Exception PrintException)
-        {
-          PrintException.printStackTrace();
-        }
-      }
-    }
-
-  }
-
-
-
-
-  public void closeMenuItem_actionPerformed(ActionEvent e)
-  {
-    try{
-      this.setClosed(true);
-    }catch(Exception ex){}
-  }
-
-  Stack historyList = new Stack();
-  Stack redoList = new Stack();
-  private int treeCount = 0;
-
-  void updateEditMenuBar()
-   {
-     if(historyList.size()>0)
-      {
-        undoMenuItem.setEnabled(true);
-        HistoryItem hi = (HistoryItem)historyList.peek();
-        undoMenuItem.setText("Undo "+hi.getDescription());
-      }
-     else
-     {
-       undoMenuItem.setEnabled(false);
-       undoMenuItem.setText("Undo");
-     }
-
-     if(redoList.size()>0)
-      {
-        redoMenuItem.setEnabled(true);
-        HistoryItem hi = (HistoryItem)redoList.peek();
-        redoMenuItem.setText("Redo "+hi.getDescription());
-      }
-     else
-     {
-       redoMenuItem.setEnabled(false);
-       redoMenuItem.setText("Redo");
-     }
-   }
-
-   public void addHistoryItem(HistoryItem hi)
-   {
-     historyList.push(hi);
-     updateEditMenuBar();
-   }
-
-   protected void undoMenuItem_actionPerformed(ActionEvent e)
-   {
-       HistoryItem hi = (HistoryItem)historyList.pop();
-       redoList.push(new HistoryItem(hi.getDescription(), viewport.alignment, HistoryItem.HIDE));
-       restoreHistoryItem(hi);
-   }
-
-
-   protected void redoMenuItem_actionPerformed(ActionEvent e)
-   {
-      HistoryItem hi = (HistoryItem)redoList.pop();
-      restoreHistoryItem(hi);
-      updateEditMenuBar();
-      viewport.updateConsensus();
-      alignPanel.repaint();
-      alignPanel.repaint();
-   }
-
-
-   // used by undo and redo
-   void restoreHistoryItem(HistoryItem hi)
-   {
-      if(hi.getType()== HistoryItem.SORT)
-      {
-           for(int i=0; i<hi.getSequences().size(); i++)
-             viewport.alignment.getSequences().setElementAt(hi.getSequences().elementAt(i), i);
-      }
-      else
-      {
-        for (int i = 0; i < hi.getSequences().size(); i++)
-        {
-          SequenceI restore = (SequenceI) hi.getSequences().elementAt(i);
-          if(restore.getLength()==0)
-          {
-            restore.setSequence(hi.getHidden().elementAt(i).toString());
-            viewport.alignment.getSequences().insertElementAt(
-               restore,
-               hi.getAlignIndex(i));
-          }
-          else
-            restore.setSequence(hi.getHidden().elementAt(i).toString());
-        }
-        if(hi.getType()==HistoryItem.PASTE)
-        {
-          for(int i=viewport.alignment.getHeight()-1;i>hi.getSequences().size()-1; i--)
-            viewport.alignment.deleteSequence(i);
-        }
-      }
-      updateEditMenuBar();
-
-      viewport.updateConsensus();
-      viewport.updateConservation();
-      alignPanel.repaint();
-      viewport.firePropertyChange("alignment", null, viewport.getAlignment().getSequences());
-  }
-
-  public void moveSelectedSequences(boolean up)
-  {
-    SequenceGroup sg = viewport.getSelectionGroup();
-    if (sg == null)
-      return;
-
-    if (up)
-    {
-      for (int i = 1; i < viewport.alignment.getHeight(); i++)
-      {
-        SequenceI seq = viewport.alignment.getSequenceAt(i);
-        if (!sg.sequences.contains(seq))
-          continue;
-
-        SequenceI temp = viewport.alignment.getSequenceAt(i - 1);
-        if (sg.sequences.contains(temp))
-          continue;
-
-        viewport.alignment.getSequences().setElementAt(temp, i);
-        viewport.alignment.getSequences().setElementAt(seq, i - 1);
-      }
-    }
-    else
-    {
-      for (int i = viewport.alignment.getHeight() - 2; i > -1; i--)
-      {
-        SequenceI seq = viewport.alignment.getSequenceAt(i);
-        if (!sg.sequences.contains(seq))
-          continue;
-
-        SequenceI temp = viewport.alignment.getSequenceAt(i + 1);
-        if (sg.sequences.contains(temp))
-          continue;
-
-        viewport.alignment.getSequences().setElementAt(temp, i);
-        viewport.alignment.getSequences().setElementAt(seq, i + 1);
-      }
-    }
-
-    alignPanel.repaint();
-  }
-
-
-
-  protected void copy_actionPerformed(ActionEvent e)
-  {
-     if(viewport.getSelectionGroup()==null)
-       return;
-
-     SequenceGroup sg = viewport.getSelectionGroup();
-
-     Clipboard c = Toolkit.getDefaultToolkit().getSystemClipboard();
-     StringBuffer buffer= new StringBuffer();
-
-     Hashtable orderedSeqs = new Hashtable();
-     for(int i=0; i<sg.getSize(); i++)
-     {
-        SequenceI seq = sg.getSequenceAt(i);
-        int index = viewport.alignment.findIndex(seq);
-        orderedSeqs.put(index+"", seq);
-     }
-
-     int index=0;
-     for(int i=0; i<sg.getSize(); i++)
-     {
-       SequenceI seq = null;
-       while( seq == null )
-       {
-         if(orderedSeqs.containsKey(index+""))
-         {
-           seq = (SequenceI) orderedSeqs.get(index + "");
-           index++;
-           break;
-         }
-         else
-           index++;
-       }
-
-         buffer.append( seq.getName()+"\t"+seq.findPosition( sg.getStartRes() ) +"\t"
-                        +seq.findPosition( sg.getEndRes() )+ "\t"
-                        +sg.getSequenceAt(i).getSequence(sg.getStartRes(), sg.getEndRes()+1)+"\n");
-     }
-     c.setContents( new StringSelection( buffer.toString()) , null ) ;
-
-  }
-
-
-  protected void pasteNew_actionPerformed(ActionEvent e)
-  {
-    paste(true);
-  }
-
-  protected void pasteThis_actionPerformed(ActionEvent e)
-  {
-    addHistoryItem(new HistoryItem("Paste Sequences", viewport.alignment, HistoryItem.PASTE));
-    paste(false);
-  }
-
-  void paste(boolean newAlignment)
-  {
-    try{
-      Clipboard c = Toolkit.getDefaultToolkit().getSystemClipboard();
-      Transferable contents = c.getContents(this);
-      if (contents == null)
-        return;
-
-      String str = (String) contents.getTransferData(DataFlavor.stringFlavor);
-      StringTokenizer st = new StringTokenizer(str);
-      ArrayList seqs = new ArrayList();
-      while (st.hasMoreElements())
-      {
-        String name = st.nextToken();
-        int start = Integer.parseInt(st.nextToken());
-        int end = Integer.parseInt(st.nextToken());
-        Sequence sequence = new Sequence(name,st.nextToken(), start, end);
-
-        if(!newAlignment)
-          viewport.alignment.addSequence(sequence);
-        else
-          seqs.add(sequence);
-      }
-
-      if(newAlignment)
-      {
-        SequenceI[] newSeqs = new SequenceI[seqs.size()];
-        seqs.toArray(newSeqs);
-        AlignFrame af = new AlignFrame(new Alignment(newSeqs));
-        String newtitle = new String("Copied sequences");
-        if( title.startsWith("Copied sequences"))
-         newtitle = title;
-       else
-         newtitle = newtitle.concat("- from "+title);
-
-        Desktop.addInternalFrame(af, newtitle, NEW_WINDOW_WIDTH, NEW_WINDOW_HEIGHT);
-      }
-      else
-      {
-        viewport.firePropertyChange("alignment", null, viewport.getAlignment().getSequences());
-        viewport.setEndSeq(viewport.alignment.getHeight());
-        viewport.alignment.getWidth();
-        viewport.updateConservation();
-        viewport.updateConsensus();
-        alignPanel.repaint();
-      }
-
-    }catch(Exception ex){}// could be anything being pasted in here
-
-  }
-
-
-  protected void cut_actionPerformed(ActionEvent e)
-  {
-    copy_actionPerformed(null);
-    delete_actionPerformed(null);
-  }
-
-  protected void delete_actionPerformed(ActionEvent e)
-  {
-    boolean seqsdeleted=false;
-
-    if (viewport.getSelectionGroup() == null)
-      return;
-
-    addHistoryItem(new HistoryItem("Delete Sequences", viewport.alignment, HistoryItem.HIDE));
-
-     SequenceGroup sg = viewport.getSelectionGroup();
-     for (int i=0;i < sg.sequences.size(); i++)
-     {
-       SequenceI seq = sg.getSequenceAt(i);
-       int index = viewport.getAlignment().findIndex(seq);
-       seq.deleteChars(sg.getStartRes(),sg.getEndRes()+1);
-
-       if(seq.getSequence().length()<1) {
-         seqsdeleted=true;
-         viewport.getAlignment().deleteSequence(seq);
-        } else {
-         viewport.getAlignment().getSequences().setElementAt(seq, index);
-       }
-     }
-
-     viewport.setSelectionGroup(null);
-     viewport.alignment.deleteGroup(sg);
-     if (seqsdeleted)
-       viewport.firePropertyChange("alignment", null, viewport.getAlignment().getSequences());
-     viewport.resetSeqLimits( alignPanel.seqPanel.seqCanvas.getHeight());
-     if(viewport.getAlignment().getHeight()<1)
-     try
-     {
-       this.setClosed(true);
-     }catch(Exception ex){}
-   viewport.updateConservation();
-   viewport.updateConsensus();
-   alignPanel.repaint();
- }
-
-
-  protected void deleteGroups_actionPerformed(ActionEvent e)
-  {
-    viewport.alignment.deleteAllGroups();
-    viewport.setSelectionGroup(null);
-    alignPanel.repaint();
-  }
-
-
-
-  public void selectAllSequenceMenuItem_actionPerformed(ActionEvent e)
-  {
-    SequenceGroup sg = new SequenceGroup();
-    for (int i=0; i<viewport.getAlignment().getSequences().size(); i++)
-      sg.addSequence( viewport.getAlignment().getSequenceAt(i));
-    sg.setEndRes(viewport.alignment.getWidth());
-    viewport.setSelectionGroup(sg);
-    PaintRefresher.Refresh(null);
-  }
-
-  public void deselectAllSequenceMenuItem_actionPerformed(ActionEvent e)
-  {
-    viewport.setSelectionGroup(null);
-    viewport.getColumnSelection().clear();
-    viewport.setSelectionGroup(null);
-    PaintRefresher.Refresh(null);
-  }
-
-  public void invertSequenceMenuItem_actionPerformed(ActionEvent e)
-  {
-    SequenceGroup sg = viewport.getSelectionGroup();
-    for (int i=0; i<viewport.getAlignment().getSequences().size(); i++)
-      sg.addOrRemove (viewport.getAlignment().getSequenceAt(i));
-
-    PaintRefresher.Refresh(null);
-  }
-
-  public void remove2LeftMenuItem_actionPerformed(ActionEvent e)
-  {
-    ColumnSelection colSel = viewport.getColumnSelection();
-    if (colSel.size() > 0)
-    {
-      addHistoryItem(new HistoryItem("Remove Left",viewport.alignment,
-                                     HistoryItem.HIDE));
-      int min = colSel.getMin();
-      viewport.getAlignment().trimLeft(min);
-      colSel.compensateForEdit(0,min);
-
-      if(viewport.getSelectionGroup()!=null)
-        viewport.getSelectionGroup().adjustForRemoveLeft(min);
-
-      Vector groups = viewport.alignment.getGroups();
-      for(int i=0; i<groups.size(); i++)
-      {
-        SequenceGroup sg = (SequenceGroup) groups.get(i);
-        if(!sg.adjustForRemoveLeft(min))
-          viewport.alignment.deleteGroup(sg);
-      }
-
-      alignPanel.repaint();
-    }
-  }
-
-  public void remove2RightMenuItem_actionPerformed(ActionEvent e)
-  {
-    ColumnSelection colSel = viewport.getColumnSelection();
-    if (colSel.size() > 0)
-    {
-      addHistoryItem(new HistoryItem("Remove Right",viewport.alignment,
-                                     HistoryItem.HIDE));
-
-      int max = colSel.getMax();
-      viewport.getAlignment().trimRight(max);
-      if(viewport.getSelectionGroup()!=null)
-        viewport.getSelectionGroup().adjustForRemoveRight(max);
-
-      Vector groups = viewport.alignment.getGroups();
-      for(int i=0; i<groups.size(); i++)
-      {
-        SequenceGroup sg = (SequenceGroup) groups.get(i);
-        if(!sg.adjustForRemoveRight(max))
-          viewport.alignment.deleteGroup(sg);
-      }
-
-
-
-      alignPanel.repaint();
-    }
-
-  }
-
-  public void removeGappedColumnMenuItem_actionPerformed(ActionEvent e)
-  {
-    addHistoryItem(new HistoryItem("Remove Gapped Columns",
-                                   viewport.alignment,
-                                   HistoryItem.HIDE));
-
-    viewport.getAlignment().removeGaps();
-    viewport.updateConservation();
-    viewport.updateConsensus();
-    alignPanel.repaint();
-  }
-
-  public void removeAllGapsMenuItem_actionPerformed(ActionEvent e)
-  {
-    addHistoryItem(new HistoryItem("Remove Gaps",
-                                   viewport.alignment,
-                                   HistoryItem.HIDE));
-    SequenceI current;
-    int jSize;
-    for (int i=0; i < viewport.getAlignment().getSequences().size();i++)
-    {
-      current = viewport.getAlignment().getSequenceAt(i);
-      jSize = current.getLength();
-      for (int j=0; j < jSize; j++)
-        if(jalview.util.Comparison.isGap(current.getCharAt(j)))
-        {
-          current.deleteCharAt(j);
-          j--;
-          jSize--;
-        }
-    }
-    viewport.updateConservation();
-    viewport.updateConsensus();
-    alignPanel.repaint();
-  }
-
-
-  public void padGapsMenuitem_actionPerformed(ActionEvent e)
-    {
-      addHistoryItem(new HistoryItem("Pad Gaps",
-                                     viewport.alignment,
-                                     HistoryItem.HIDE));
-      SequenceI current;
-      int Width = viewport.getAlignment().getWidth()-1;
-      for (int i=0; i < viewport.getAlignment().getSequences().size();i++)
-      {
-        current = viewport.getAlignment().getSequenceAt(i);
-
-        if (current.getLength()<Width)
-          current.insertCharAt(Width, viewport.getGapCharacter());
-      }
-      viewport.updateConservation();
-      viewport.updateConsensus();
-      alignPanel.repaint();
-  }
-
-
-  public void findMenuItem_actionPerformed(ActionEvent e)
-  {
-    JInternalFrame frame = new JInternalFrame();
-    Finder finder = new Finder(viewport, alignPanel, frame);
-    frame.setContentPane(finder);
-    Desktop.addInternalFrame(frame, "Find", 340,110);
-    frame.setLayer(JLayeredPane.PALETTE_LAYER);
-
-  }
-
-
-  public void font_actionPerformed(ActionEvent e)
-  {
-    FontChooser fc = new FontChooser( alignPanel );
-  }
-
-  protected void fullSeqId_actionPerformed(ActionEvent e)
-  {
-    viewport.setShowFullId( fullSeqId.isSelected() );
-
-    alignPanel.idPanel.idCanvas.setPreferredSize( alignPanel.calculateIdWidth() );
-    alignPanel.repaint();
-  }
-
-  protected void colourTextMenuItem_actionPerformed(ActionEvent e)
-  {
-      viewport.setColourText( colourTextMenuItem.isSelected() );
-      alignPanel.repaint();
-  }
-
-  protected void wrapMenuItem_actionPerformed(ActionEvent e)
-  {
-    viewport.setWrapAlignment( wrapMenuItem.isSelected() );
-    alignPanel.setWrapAlignment( wrapMenuItem.isSelected() );
-    scaleAbove.setVisible( wrapMenuItem.isSelected() );
-    scaleLeft.setVisible( wrapMenuItem.isSelected() );
-    scaleRight.setVisible( wrapMenuItem.isSelected() );
-    alignPanel.repaint();
-  }
-
-  protected void scaleAbove_actionPerformed(ActionEvent e)
-  {
-    viewport.setScaleAboveWrapped(scaleAbove.isSelected());
-    alignPanel.repaint();
-  }
-
-  protected void scaleLeft_actionPerformed(ActionEvent e)
-  {
-    viewport.setScaleLeftWrapped(scaleLeft.isSelected());
-    alignPanel.repaint();
-  }
-
-  protected void scaleRight_actionPerformed(ActionEvent e)
-  {
-    viewport.setScaleRightWrapped(scaleRight.isSelected());
-    alignPanel.repaint();
-  }
-
-
-
-  public void viewBoxesMenuItem_actionPerformed(ActionEvent e)
-  {
-    viewport.setShowBoxes( viewBoxesMenuItem.isSelected() );
-    alignPanel.repaint();
-  }
-
-  public void viewTextMenuItem_actionPerformed(ActionEvent e)
-  {
-    viewport.setShowText( viewTextMenuItem.isSelected() );
-    alignPanel.repaint();
-  }
-
-
-  protected void renderGapsMenuItem_actionPerformed(ActionEvent e)
-  {
-    viewport.setRenderGaps(renderGapsMenuItem.isSelected());
-    alignPanel.repaint();
-  }
-
-  public void sequenceFeatures_actionPerformed(ActionEvent evt)
-  {
-    viewport.showSequenceFeatures(sequenceFeatures.isSelected());
-    if(viewport.showSequenceFeatures && !((Alignment)viewport.alignment).featuresAdded)
-    {
-         SequenceFeatureFetcher sft = new SequenceFeatureFetcher(viewport.alignment, alignPanel);
-         ((Alignment)viewport.alignment).featuresAdded = true;
-    }
-    alignPanel.repaint();
-  }
-
-  public void annotationPanelMenuItem_actionPerformed(ActionEvent e)
-  {
-    if(annotationPanelMenuItem.isSelected() && viewport.getWrapAlignment())
-    {
-      annotationPanelMenuItem.setSelected(false);
-      return;
-    }
-    viewport.setShowAnnotation( annotationPanelMenuItem.isSelected() );
-    alignPanel.setAnnotationVisible( annotationPanelMenuItem.isSelected() );
-  }
-
-  public void overviewMenuItem_actionPerformed(ActionEvent e)
-  {
-    if (alignPanel.overviewPanel != null)
-      return;
-
-    JInternalFrame frame = new JInternalFrame();
-    OverviewPanel overview = new OverviewPanel(alignPanel);
-     frame.setContentPane(overview);
-    Desktop.addInternalFrame(frame, "Overview " + this.getTitle(),
-                             frame.getWidth(), frame.getHeight());
-    frame.pack();
-    frame.setLayer(JLayeredPane.PALETTE_LAYER);
-    frame.addInternalFrameListener(new javax.swing.event.InternalFrameAdapter()
-    { public void internalFrameClosed(javax.swing.event.InternalFrameEvent evt)
-      {
-            alignPanel.setOverviewPanel(null);
-      };
-    });
-
-    alignPanel.setOverviewPanel( overview );
-
-
-  }
-
-  protected void noColourmenuItem_actionPerformed(ActionEvent e)
-  {
-    changeColour( null );
-  }
-
-
-  public void clustalColour_actionPerformed(ActionEvent e)
-  {
-    changeColour(new ClustalxColourScheme(viewport.alignment.getSequences(), viewport.alignment.getWidth()));
-  }
-
-  public void zappoColour_actionPerformed(ActionEvent e)
-  {
-    changeColour(new ZappoColourScheme());
-  }
-
-  public void taylorColour_actionPerformed(ActionEvent e)
-  {
-    changeColour(new TaylorColourScheme());
-  }
-
-
-  public void hydrophobicityColour_actionPerformed(ActionEvent e)
-  {
-    changeColour( new HydrophobicColourScheme() );
-  }
-
-  public void helixColour_actionPerformed(ActionEvent e)
-  {
-    changeColour(new HelixColourScheme() );
-  }
-
-
-  public void strandColour_actionPerformed(ActionEvent e)
-  {
-    changeColour(new StrandColourScheme());
-  }
-
-
-  public void turnColour_actionPerformed(ActionEvent e)
-  {
-    changeColour(new TurnColourScheme());
-  }
-
-
-  public void buriedColour_actionPerformed(ActionEvent e)
-  {
-    changeColour(new BuriedColourScheme() );
-  }
-
-  public void nucleotideColour_actionPerformed(ActionEvent e)
-  {
-    changeColour(new NucleotideColourScheme());
-  }
-
-
-  protected void applyToAllGroups_actionPerformed(ActionEvent e)
-  {
-    viewport.setColourAppliesToAllGroups(applyToAllGroups.isSelected());
-  }
-
-
-
-  void changeColour(ColourSchemeI cs)
-  {
-    int threshold = 0;
-
-    if ( viewport.getAbovePIDThreshold() )
-    {
-      threshold = SliderPanel.setPIDSliderSource(alignPanel, cs, "Background");
-
-      if (cs instanceof ResidueColourScheme)
-        ( (ResidueColourScheme) cs).setThreshold(threshold);
-      else if (cs instanceof ScoreColourScheme)
-        ( (ScoreColourScheme) cs).setThreshold(threshold);
-
-      viewport.setGlobalColourScheme(cs);
-    }
-    else if (cs instanceof ResidueColourScheme)
-      ( (ResidueColourScheme) cs).setThreshold(0);
-    else if (cs instanceof ScoreColourScheme)
-      ( (ScoreColourScheme) cs).setThreshold(0);
-
-
-
-    if (viewport.getConservationSelected())
-    {
-      ConservationColourScheme ccs = null;
-
-      Alignment al = (Alignment) viewport.alignment;
-      Conservation c = new Conservation("All",
-                                        ResidueProperties.propHash, 3,
-                                        al.getSequences(), 0,
-                                        al.getWidth() - 1);
-
-      c.calculate();
-      c.verdict(false, viewport.ConsPercGaps);
-
-      ccs = new ConservationColourScheme(c, cs);
-
-      // MUST NOTIFY THE COLOURSCHEME OF CONSENSUS!
-      ccs.setConsensus( viewport.vconsensus );
-      viewport.setGlobalColourScheme(ccs);
-
-      ccs.inc = SliderPanel.setConservationSlider(alignPanel, ccs, "Background");
-
-    }
-    else
-    {
-        // MUST NOTIFY THE COLOURSCHEME OF CONSENSUS!
-        if (cs != null)
-          cs.setConsensus(viewport.vconsensus);
-        viewport.setGlobalColourScheme(cs);
-    }
-
-
-    if(viewport.getColourAppliesToAllGroups())
-    {
-      Vector groups = viewport.alignment.getGroups();
-      for(int i=0; i<groups.size(); i++)
-      {
-        SequenceGroup sg = (SequenceGroup)groups.elementAt(i);
-
-        if(cs==null)
-          sg.cs = null;
-        else if (cs instanceof ClustalxColourScheme)
-          sg.cs = new ClustalxColourScheme(sg.sequences, sg.getWidth());
-        else if (cs instanceof UserColourScheme)
-          sg.cs = new UserColourScheme( ((UserColourScheme)cs).getColours());
-        else
-          try{
-            sg.cs = (ColourSchemeI) cs.getClass().newInstance();
-          }catch(Exception ex){}
-
-        if(viewport.getAbovePIDThreshold())
-        {
-          if (sg.cs instanceof ResidueColourScheme)
-            ( (ResidueColourScheme) sg.cs).setThreshold(threshold);
-          else if (sg.cs instanceof ScoreColourScheme)
-            ( (ScoreColourScheme) sg.cs).setThreshold(threshold);
-
-           sg.cs.setConsensus( AAFrequency.calculate(sg.sequences, 0, sg.getWidth()) );
-        }
-
-        if( viewport.getConservationSelected() )
-        {
-          Conservation c = new Conservation("Group",
-                                            ResidueProperties.propHash, 3,
-                                            sg.sequences, 0, viewport.alignment.getWidth()-1);
-          c.calculate();
-          c.verdict(false, viewport.ConsPercGaps);
-          ConservationColourScheme ccs = new ConservationColourScheme(c, sg.cs);
-
-          // MUST NOTIFY THE COLOURSCHEME OF CONSENSUS!
-          ccs.setConsensus( AAFrequency.calculate(sg.sequences, 0, sg.getWidth()));
-          sg.cs = ccs;
-        }
-        else if(cs!=null)
-        {
-          // MUST NOTIFY THE COLOURSCHEME OF CONSENSUS!
-          sg.cs.setConsensus(AAFrequency.calculate(sg.sequences, 0, sg.getWidth()));
-        }
-
-      }
-    }
-
-    if(alignPanel.getOverviewPanel()!=null)
-      alignPanel.getOverviewPanel().updateOverviewImage();
-    alignPanel.repaint();
-  }
-
-  protected void modifyPID_actionPerformed(ActionEvent e)
-  {
-      if(viewport.getAbovePIDThreshold())
-      {
-        SliderPanel.setPIDSliderSource(alignPanel, viewport.getGlobalColourScheme(),
-                                   "Background");
-        SliderPanel.showPIDSlider();
-      }
-  }
-
-  protected void modifyConservation_actionPerformed(ActionEvent e)
-  {
-    if(viewport.getConservationSelected())
-    {
-      SliderPanel.setConservationSlider(alignPanel, viewport.globalColourScheme,
-                                        "Background");
-      SliderPanel.showConservationSlider();
-    }
-  }
-
-
-  protected  void conservationMenuItem_actionPerformed(ActionEvent e)
-  {
-    viewport.setConservationSelected(conservationMenuItem.isSelected());
-
-    viewport.setAbovePIDThreshold(false);
-    abovePIDThreshold.setSelected(false);
-
-   ColourSchemeI cs = viewport.getGlobalColourScheme();
-   if(cs instanceof ConservationColourScheme )
-     changeColour( ((ConservationColourScheme)cs).cs );
-    else
-      changeColour( cs );
-
-    modifyConservation_actionPerformed(null);
-  }
-
-  public void abovePIDThreshold_actionPerformed(ActionEvent e)
-  {
-    viewport.setAbovePIDThreshold(abovePIDThreshold.isSelected());
-
-    conservationMenuItem.setSelected(false);
-    viewport.setConservationSelected(false);
-
-    ColourSchemeI cs = viewport.getGlobalColourScheme();
-
-    if(cs instanceof ConservationColourScheme )
-        changeColour( ((ConservationColourScheme)cs).cs );
-    else
-        changeColour( cs );
-
-    modifyPID_actionPerformed(null);
-  }
-
-
-
-  public void userDefinedColour_actionPerformed(ActionEvent e)
-  {
-    new UserDefinedColours( alignPanel, null);
-  }
-
-  public void PIDColour_actionPerformed(ActionEvent e)
-  {
-    changeColour( new PIDColourScheme() );
-  }
-
-
-  public void BLOSUM62Colour_actionPerformed(ActionEvent e)
-  {
-    changeColour(new Blosum62ColourScheme() );
-  }
-
-
-
-  public void sortPairwiseMenuItem_actionPerformed(ActionEvent e)
-  {
-    addHistoryItem(new HistoryItem("Pairwise Sort", viewport.alignment, HistoryItem.SORT));
-    AlignmentSorter.sortByPID(viewport.getAlignment(), viewport.getAlignment().getSequenceAt(0));
-    alignPanel.repaint();
-  }
-
-  public void sortIDMenuItem_actionPerformed(ActionEvent e)
-  {
-    addHistoryItem(new HistoryItem("ID Sort", viewport.alignment, HistoryItem.SORT));
-    AlignmentSorter.sortByID( viewport.getAlignment() );
-    alignPanel.repaint();
-  }
-
-  public void sortGroupMenuItem_actionPerformed(ActionEvent e)
-  {
-    addHistoryItem(new HistoryItem("Group Sort", viewport.alignment, HistoryItem.SORT));
-  //  AlignmentSorter.sortByGroup(viewport.getAlignment());
-    AlignmentSorter.sortGroups(viewport.getAlignment());
-    alignPanel.repaint();
-  }
-
-  public void removeRedundancyMenuItem_actionPerformed(ActionEvent e)
-  {
-    RedundancyPanel sp = new RedundancyPanel(alignPanel,this);
-    JInternalFrame frame = new JInternalFrame();
-    frame.setContentPane(sp);
-    Desktop.addInternalFrame(frame, "Redundancy threshold selection", 400, 100, false);
-
-  }
-
-  public void pairwiseAlignmentMenuItem_actionPerformed(ActionEvent e)
-  {
-    if((viewport.getSelectionGroup()==null) ||
-       viewport.getSelectionGroup().getSize()<2)
-      JOptionPane.showInternalMessageDialog(this, "You must select at least 2 sequences.", "Invalid Selection", JOptionPane.WARNING_MESSAGE);
-    else
-    {
-      JInternalFrame frame = new JInternalFrame();
-      frame.setContentPane(new PairwiseAlignPanel(viewport));
-      Desktop.addInternalFrame(frame, "Pairwise Alignment", 600, 500);
-    }
-  }
-
-  public void PCAMenuItem_actionPerformed(ActionEvent e)
-  {
-
-    if( (viewport.getSelectionGroup()!=null && viewport.getSelectionGroup().getSize()<4 && viewport.getSelectionGroup().getSize()>0)
-       || viewport.getAlignment().getHeight()<4)
-    {
-      JOptionPane.showInternalMessageDialog(this, "Principal component analysis must take\n"
-                                    +"at least 4 input sequences.",
-                                    "Sequence selection insufficient",
-                                    JOptionPane.WARNING_MESSAGE);
-      return;
-    }
-
-    try{
-      PCAPanel pcaPanel = new PCAPanel(viewport, null);
-      JInternalFrame frame = new JInternalFrame();
-      frame.setContentPane(pcaPanel);
-      Desktop.addInternalFrame(frame, "Principal component analysis", 400, 400);
-   }catch(java.lang.OutOfMemoryError ex)
-   {
-     JOptionPane.showInternalMessageDialog(this, "Too many sequences selected\nfor Principal Component Analysis!!",
-                                   "Out of memory", JOptionPane.WARNING_MESSAGE);
-   }
-
-
-  }
-
-  public void averageDistanceTreeMenuItem_actionPerformed(ActionEvent e)
-  {
-    NewTreePanel("AV", "PID", "Average distance tree using PID");
-  }
-
-  public void neighbourTreeMenuItem_actionPerformed(ActionEvent e)
-  {
-    NewTreePanel("NJ", "PID", "Neighbour joining tree using PID");
-  }
-
-
-  protected void njTreeBlosumMenuItem_actionPerformed(ActionEvent e)
-  {
-    NewTreePanel("NJ", "BL", "Neighbour joining tree using BLOSUM62");
-  }
-
-  protected void avTreeBlosumMenuItem_actionPerformed(ActionEvent e)
-  {
-    NewTreePanel("AV", "BL", "Average distance tree using BLOSUM62");
-  }
-
-  void NewTreePanel(String type, String pwType, String title)
-  {
-    String ltitle;
-    final TreePanel tp;
-    if (viewport.getSelectionGroup() != null &&
-        viewport.getSelectionGroup().getSize() > 3)
-    {
-      int s=0;
-      SequenceGroup sg = viewport.getSelectionGroup();
-
-      /* Decide if the selection is a column region */
-      while (s<sg.sequences.size()) {
-        if (((SequenceI) sg.sequences.elementAt(s++)).getLength()<sg.getEndRes()) {
-          JOptionPane.showMessageDialog(Desktop.desktop,
-                                        "The selected region to create a tree may\nonly contain residues or gaps.\n"
-                                       +"Try using the Pad function in the edit menu,\n"
-                                      +"or one of the multiple sequence alignment web services.",
-                                        "Sequences in selection are not aligned", JOptionPane.WARNING_MESSAGE);
-          return;
-        }
-
-      }
-      title=title+" on region";
-      tp = new TreePanel(viewport, viewport.getSelectionGroup().sequences, type,
-                         pwType,
-                         sg.getStartRes(), sg.getEndRes());
-    }
-    else
-    {
-
-     //are the sequences aligned?
-     if(!viewport.alignment.isAligned())
-     {
-       JOptionPane.showMessageDialog(Desktop.desktop, "The sequences must be aligned before creating a tree.\n"
-                                     +"Try using the Pad function in the edit menu,\n"
-                                     +"or one of the multiple sequence alignment web services.",
-                                     "Sequences not aligned", JOptionPane.WARNING_MESSAGE);
-       return;
-     }
-     tp = new TreePanel(viewport, viewport.getAlignment().getSequences(),
-                        type, pwType, 0, viewport.alignment.getWidth());
-   }
-
-   addTreeMenuItem(tp, title);
-   viewport.setCurrentTree(tp.getTree());
-
-   Desktop.addInternalFrame(tp, title+" from "+this.title, 600, 500);
-  }
-
-  public void addSortByOrderMenuItem(String title, final AlignmentOrder order) {
-    final JMenuItem item = new JMenuItem("by "+title);
-    sort.add(item);
-    item.addActionListener(new java.awt.event.ActionListener()
-    {
-      public void actionPerformed(ActionEvent e)
-      {
-        addHistoryItem(new HistoryItem("Sort", viewport.alignment,
-                                       HistoryItem.SORT));
-        // TODO: JBPNote - have to map order entries to curent SequenceI pointers
-        AlignmentSorter.sortBy(viewport.getAlignment(), order);
-        alignPanel.repaint();
-      }
-    });
-  }
-
-  void addTreeMenuItem(final TreePanel treePanel, String title)
-  {
-    final JMenuItem item = new JMenuItem(title);
-
-    treeCount++;
-
-    if (treeCount==1)
-      sort.add(sortByTreeMenu);
-
-    sortByTreeMenu.add(item);
-    item.addActionListener(new java.awt.event.ActionListener()
-    {
-      public void actionPerformed(ActionEvent e)
-      {
-        addHistoryItem(new HistoryItem("Tree Sort", viewport.alignment,
-                                       HistoryItem.SORT));
-        AlignmentSorter.sortByTree(viewport.getAlignment(), treePanel.getTree());
-        alignPanel.repaint();
-      }
-    });
-
-    treePanel.addInternalFrameListener(new javax.swing.event.InternalFrameAdapter()
-    {
-      public void internalFrameClosed(javax.swing.event.InternalFrameEvent evt)
-      {
-        treeCount--;
-        sortByTreeMenu.remove(item);
-        if (treeCount==0)
-          sort.remove(sortByTreeMenu);
-      };
-    });
-    viewport.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
-      public void propertyChange(PropertyChangeEvent evt)
-      {
-        if (evt.getPropertyName().equals("alignment")) {
-          treePanel.getTree().UpdatePlaceHolders( (Vector) evt.getNewValue());
-          treePanel.repaint();
-        }
-      }
-
-    }
-    );
-  }
-
-
-  public void clustalAlignMenuItem_actionPerformed(ActionEvent e)
-  {
-      // TODO:resolve which menu item was actually selected
-      // Now, check we have enough sequences
-        SequenceI[] msa=null;
-        if (viewport.getSelectionGroup() != null && viewport.getSelectionGroup().getSize()>1)
-        {
-          // JBPNote UGLY! To prettify, make SequenceGroup and Alignment conform to some common interface!
-          SequenceGroup seqs = viewport.getSelectionGroup();
-          int sz;
-          msa = new SequenceI[sz=seqs.getSize()];
-          for (int i = 0; i < sz; i++)
-          {
-            msa[i] = (SequenceI) seqs.getSequenceAt(i);
-          }
-
-          }
-        else
-        {
-          Vector seqs = viewport.getAlignment().getSequences();
-
-          if (seqs.size() > 1) {
-            msa = new SequenceI[seqs.size()];
-            for (int i = 0; i < seqs.size(); i++)
-            {
-              msa[i] = (SequenceI) seqs.elementAt(i);
-            }
-
-          }
-
-        }
-        if (msa!=null) {
-          jalview.ws.MsaWSClient ct = new jalview.ws.MsaWSClient("ClustalWS", title, msa, false, true);
-        }
-  }
-  public void ClustalRealign_actionPerformed(ActionEvent e)
-  {
-      // TODO:resolve which menu item was actually selected
-      // Now, check we have enough sequences
-        SequenceI[] msa=null;
-        if (viewport.getSelectionGroup() != null && viewport.getSelectionGroup().getSize()>1)
-        {
-          // JBPNote UGLY! To prettify, make SequenceGroup and Alignment conform to some common interface!
-          SequenceGroup seqs = viewport.getSelectionGroup();
-          int sz;
-          msa = new SequenceI[sz=seqs.getSize()];
-          for (int i = 0; i < sz; i++)
-          {
-            msa[i] = (SequenceI) seqs.getSequenceAt(i);
-          }
-
-          }
-        else
-        {
-          Vector seqs = viewport.getAlignment().getSequences();
-
-          if (seqs.size() > 1) {
-            msa = new SequenceI[seqs.size()];
-            for (int i = 0; i < seqs.size(); i++)
-            {
-              msa[i] = (SequenceI) seqs.elementAt(i);
-            }
-
-          }
-
-        }
-        if (msa!=null) {
-          jalview.ws.MsaWSClient ct = new jalview.ws.MsaWSClient("ClustalWS", title, msa, true, true);
-        }
-  }
-
-
-  protected void jpred_actionPerformed(ActionEvent e)
-{
-    SequenceI seq=null;
-    SequenceI[] msa=null;
-
-    if (viewport.getSelectionGroup() != null && viewport.getSelectionGroup().getSize()>0)
-    {
-      // JBPNote UGLY! To prettify, make SequenceGroup and Alignment conform to some common interface!
-      SequenceGroup seqs = viewport.getSelectionGroup();
-      if (seqs.getSize() == 1 || !viewport.alignment.isAligned())
-      {
-        seq = (SequenceI)seqs.getSequenceAt(0);
-      }
-      else
-      {
-        int sz;
-        msa = new SequenceI[sz=seqs.getSize()];
-        for (int i = 0; i < sz; i++)
-        {
-          msa[i] = (SequenceI) seqs.getSequenceAt(i);
-        }
-      }
-    }
-    else
-    {
-      Vector seqs = viewport.getAlignment().getSequences();
-
-      if (seqs.size() == 1 || !viewport.alignment.isAligned())
-      {
-        seq = (SequenceI) seqs.elementAt(0);
-      }
-      else
-      {
-        msa = new SequenceI[seqs.size()];
-        for (int i = 0; i < seqs.size(); i++)
-        {
-          msa[i] = (SequenceI) seqs.elementAt(i);
-        }
-      }
-    }
-    if (msa!=null) {
-      JPredClient ct = new JPredClient(title, msa);
-    } else
-    if (seq!=null) {
-      JPredClient ct = new JPredClient(title, seq);
-    } else {
-      System.err.print("JALVIEW ERROR! - Unexpected JPred selection state!\n");
-    }
-  }
-  protected void msaAlignMenuItem_actionPerformed(ActionEvent e)
-  {
-    // TODO:resolve which menu item was actually selected
-    // Now, check we have enough sequences
-    SequenceI[] msa=null;
-    if (viewport.getSelectionGroup() != null && viewport.getSelectionGroup().getSize()>1)
-      {
-        // JBPNote UGLY! To prettify, make SequenceGroup and Alignment conform to some common interface!
-        SequenceGroup seqs = viewport.getSelectionGroup();
-        int sz;
-        msa = new SequenceI[sz=seqs.getSize()];
-        for (int i = 0; i < sz; i++)
-        {
-          msa[i] = (SequenceI) seqs.getSequenceAt(i);
-        }
-
-
-      }
-      else
-      {
-        Vector seqs = viewport.getAlignment().getSequences();
-
-        if (seqs.size() > 1) {
-          msa = new SequenceI[seqs.size()];
-          for (int i = 0; i < seqs.size(); i++)
-          {
-            msa[i] = (SequenceI) seqs.elementAt(i);
-          }
-
-        }
-
-      }
-      if (msa!=null) {
-        MsaWSClient ct = new jalview.ws.MsaWSClient("MuscleWS",title, msa, false, true);
-      }
-  }
-    protected void LoadtreeMenuItem_actionPerformed(ActionEvent e) {
-    // Pick the tree file
-    JalviewFileChooser chooser = new JalviewFileChooser(jalview.bin.Cache.
-        getProperty("LAST_DIRECTORY"));
-    chooser.setFileView(new JalviewFileView());
-    chooser.setDialogTitle("Select a newick-like tree file");
-    chooser.setToolTipText("Load a tree file");
-    int value = chooser.showOpenDialog(null);
-    if (value == JalviewFileChooser.APPROVE_OPTION)
-    {
-      String choice = chooser.getSelectedFile().getPath();
-      jalview.bin.Cache.setProperty("LAST_DIRECTORY", choice);
-      try
-      {
-        jalview.io.NewickFile fin = new jalview.io.NewickFile(choice, "File");
-        ShowNewickTree(fin, choice);
-      }
-      catch (Exception ex)
-      {
-        JOptionPane.showMessageDialog(Desktop.desktop,
-                                      "Problem reading tree file",
-                                      ex.getMessage(),
-                                      JOptionPane.WARNING_MESSAGE);
-        ex.printStackTrace();
-      }
-    }
-  }
-
-  public void ShowNewickTree(NewickFile nf, String title)
-  {
-    try{
-      nf.parse();
-      if (nf.getTree() != null)
-      {
-        TreePanel tp = new TreePanel(viewport,
-                                     viewport.getAlignment().getSequences(),
-                                     nf, "FromFile", title);
-        Desktop.addInternalFrame(tp, title, 600, 500);
-        addTreeMenuItem(tp, title);
-        viewport.setCurrentTree(tp.getTree());
-      }
-     }catch(Exception ex){ex.printStackTrace();}
-  }
-
-}
+/*\r
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
+ */\r
+package jalview.gui;\r
+\r
+import java.beans.*;\r
+import java.util.*;\r
+\r
+import java.awt.*;\r
+import java.awt.datatransfer.*;\r
+import java.awt.event.*;\r
+import java.awt.print.*;\r
+import javax.swing.*;\r
+import javax.swing.event.*;\r
+\r
+import jalview.analysis.*;\r
+import jalview.datamodel.*;\r
+import jalview.io.*;\r
+import jalview.jbgui.*;\r
+import jalview.schemes.*;\r
+import jalview.ws.*;\r
+\r
+public class AlignFrame\r
+    extends GAlignFrame\r
+{\r
+  public static final int NEW_WINDOW_WIDTH = 700;\r
+  public static final int NEW_WINDOW_HEIGHT = 500;\r
+  final AlignmentPanel alignPanel;\r
+  final AlignViewport viewport;\r
+  public String currentFileFormat = "Jalview";\r
+  Stack historyList = new Stack();\r
+  Stack redoList = new Stack();\r
+  private int treeCount = 0;\r
+\r
+  public AlignFrame(AlignmentI al)\r
+  {\r
+    viewport = new AlignViewport(al);\r
+\r
+    alignPanel = new AlignmentPanel(this, viewport);\r
+    alignPanel.annotationPanel.adjustPanelHeight();\r
+    alignPanel.annotationSpaceFillerHolder.setPreferredSize(alignPanel.\r
+        annotationPanel.getPreferredSize());\r
+    alignPanel.annotationScroller.setPreferredSize(alignPanel.annotationPanel.\r
+        getPreferredSize());\r
+    alignPanel.setAnnotationVisible(viewport.getShowAnnotation());\r
+\r
+    getContentPane().add(alignPanel, java.awt.BorderLayout.CENTER);\r
+\r
+    addInternalFrameListener(new InternalFrameAdapter()\r
+    {\r
+      public void internalFrameActivated(InternalFrameEvent evt)\r
+      {\r
+        javax.swing.SwingUtilities.invokeLater(new Runnable()\r
+        {\r
+          public void run()\r
+          {\r
+            alignPanel.requestFocus();\r
+          }\r
+        });\r
+      }\r
+    });\r
+  }\r
+\r
+  public void saveAlignmentMenu_actionPerformed(ActionEvent e)\r
+  {\r
+    JalviewFileChooser chooser = new JalviewFileChooser(jalview.bin.Cache.\r
+        getProperty(\r
+            "LAST_DIRECTORY"),\r
+        new String[]\r
+        {\r
+        "fa, fasta, fastq", "aln", "pfam", "msf", "pir", "blc",\r
+        "jar"\r
+    },\r
+        new String[]\r
+        {\r
+        "Fasta", "Clustal", "PFAM", "MSF", "PIR", "BLC", "Jalview"\r
+    }, currentFileFormat);\r
+\r
+    chooser.setAcceptAllFileFilterUsed(false);\r
+    chooser.setFileView(new JalviewFileView());\r
+    chooser.setDialogTitle("Save Alignment to file");\r
+    chooser.setToolTipText("Save");\r
+\r
+    int value = chooser.showSaveDialog(this);\r
+\r
+    if (value == JalviewFileChooser.APPROVE_OPTION)\r
+    {\r
+      currentFileFormat = chooser.getSelectedFormat();\r
+      jalview.bin.Cache.setProperty("DEFAULT_FILE_FORMAT",\r
+                                    currentFileFormat);\r
+\r
+      if (currentFileFormat.equals("Jalview"))\r
+      {\r
+        String shortName = title;\r
+\r
+        if (shortName.indexOf(java.io.File.separatorChar) > -1)\r
+        {\r
+          shortName = shortName.substring(shortName.lastIndexOf(\r
+              java.io.File.separatorChar) + 1);\r
+        }\r
+\r
+        String choice = chooser.getSelectedFile().getPath();\r
+        Jalview2XML.SaveState(this, choice, shortName);\r
+\r
+        // USE Jalview2XML to save this file\r
+        return;\r
+      }\r
+\r
+      String choice = chooser.getSelectedFile().getPath();\r
+      jalview.bin.Cache.setProperty("LAST_DIRECTORY", choice);\r
+\r
+      String output = FormatAdapter.formatSequences(currentFileFormat,\r
+          viewport.getAlignment().getSequences());\r
+\r
+      try\r
+      {\r
+        java.io.PrintWriter out = new java.io.PrintWriter(new java.io.\r
+            FileWriter(\r
+                choice));\r
+        out.println(output);\r
+        out.close();\r
+      }\r
+      catch (Exception ex)\r
+      {\r
+      }\r
+    }\r
+  }\r
+\r
+  protected void outputText_actionPerformed(ActionEvent e)\r
+  {\r
+    CutAndPasteTransfer cap = new CutAndPasteTransfer();\r
+    Desktop.addInternalFrame(cap,\r
+                             "Alignment output - " + e.getActionCommand(), 600,\r
+                             500);\r
+    cap.setText(FormatAdapter.formatSequences(e.getActionCommand(),\r
+                                              viewport.getAlignment().\r
+                                              getSequences()));\r
+  }\r
+\r
+  protected void htmlMenuItem_actionPerformed(ActionEvent e)\r
+  {\r
+    new HTMLOutput(viewport);\r
+  }\r
+\r
+  protected void createPNG_actionPerformed(ActionEvent e)\r
+  {\r
+    alignPanel.makePNG();\r
+  }\r
+\r
+  protected void epsFile_actionPerformed(ActionEvent e)\r
+  {\r
+    alignPanel.makeEPS();\r
+  }\r
+\r
+  public void printMenuItem_actionPerformed(ActionEvent e)\r
+  {\r
+    //Putting in a thread avoids Swing painting problems\r
+    PrintThread thread = new PrintThread();\r
+    thread.start();\r
+  }\r
+\r
+  public void closeMenuItem_actionPerformed(ActionEvent e)\r
+  {\r
+    try\r
+    {\r
+      this.setClosed(true);\r
+    }\r
+    catch (Exception ex)\r
+    {\r
+    }\r
+  }\r
+\r
+  void updateEditMenuBar()\r
+  {\r
+    if (historyList.size() > 0)\r
+    {\r
+      undoMenuItem.setEnabled(true);\r
+\r
+      HistoryItem hi = (HistoryItem) historyList.peek();\r
+      undoMenuItem.setText("Undo " + hi.getDescription());\r
+    }\r
+    else\r
+    {\r
+      undoMenuItem.setEnabled(false);\r
+      undoMenuItem.setText("Undo");\r
+    }\r
+\r
+    if (redoList.size() > 0)\r
+    {\r
+      redoMenuItem.setEnabled(true);\r
+\r
+      HistoryItem hi = (HistoryItem) redoList.peek();\r
+      redoMenuItem.setText("Redo " + hi.getDescription());\r
+    }\r
+    else\r
+    {\r
+      redoMenuItem.setEnabled(false);\r
+      redoMenuItem.setText("Redo");\r
+    }\r
+  }\r
+\r
+  public void addHistoryItem(HistoryItem hi)\r
+  {\r
+    historyList.push(hi);\r
+    updateEditMenuBar();\r
+  }\r
+\r
+  protected void undoMenuItem_actionPerformed(ActionEvent e)\r
+  {\r
+    HistoryItem hi = (HistoryItem) historyList.pop();\r
+    redoList.push(new HistoryItem(hi.getDescription(), viewport.alignment,\r
+                                  HistoryItem.HIDE));\r
+    restoreHistoryItem(hi);\r
+  }\r
+\r
+  protected void redoMenuItem_actionPerformed(ActionEvent e)\r
+  {\r
+    HistoryItem hi = (HistoryItem) redoList.pop();\r
+    restoreHistoryItem(hi);\r
+    updateEditMenuBar();\r
+    viewport.updateConsensus();\r
+    alignPanel.repaint();\r
+    alignPanel.repaint();\r
+  }\r
+\r
+  // used by undo and redo\r
+  void restoreHistoryItem(HistoryItem hi)\r
+  {\r
+    if (hi.getType() == HistoryItem.SORT)\r
+    {\r
+      for (int i = 0; i < hi.getSequences().size(); i++)\r
+      {\r
+        viewport.alignment.getSequences().setElementAt(hi.getSequences()\r
+            .elementAt(i),\r
+            i);\r
+      }\r
+    }\r
+    else\r
+    {\r
+      for (int i = 0; i < hi.getSequences().size(); i++)\r
+      {\r
+        SequenceI restore = (SequenceI) hi.getSequences().elementAt(i);\r
+\r
+        if (restore.getLength() == 0)\r
+        {\r
+          restore.setSequence(hi.getHidden().elementAt(i).toString());\r
+          viewport.alignment.getSequences().insertElementAt(restore,\r
+              hi.getAlignIndex(i));\r
+        }\r
+        else\r
+        {\r
+          restore.setSequence(hi.getHidden().elementAt(i).toString());\r
+        }\r
+      }\r
+\r
+      if (hi.getType() == HistoryItem.PASTE)\r
+      {\r
+        for (int i = viewport.alignment.getHeight() - 1;\r
+             i > (hi.getSequences().size() - 1); i--)\r
+        {\r
+          viewport.alignment.deleteSequence(i);\r
+        }\r
+      }\r
+    }\r
+\r
+    updateEditMenuBar();\r
+\r
+    viewport.updateConsensus();\r
+    viewport.updateConservation();\r
+    alignPanel.repaint();\r
+    viewport.firePropertyChange("alignment", null,\r
+                                viewport.getAlignment().getSequences());\r
+  }\r
+\r
+  public void moveSelectedSequences(boolean up)\r
+  {\r
+    SequenceGroup sg = viewport.getSelectionGroup();\r
+\r
+    if (sg == null)\r
+    {\r
+      return;\r
+    }\r
+\r
+    if (up)\r
+    {\r
+      for (int i = 1; i < viewport.alignment.getHeight(); i++)\r
+      {\r
+        SequenceI seq = viewport.alignment.getSequenceAt(i);\r
+\r
+        if (!sg.sequences.contains(seq))\r
+        {\r
+          continue;\r
+        }\r
+\r
+        SequenceI temp = viewport.alignment.getSequenceAt(i - 1);\r
+\r
+        if (sg.sequences.contains(temp))\r
+        {\r
+          continue;\r
+        }\r
+\r
+        viewport.alignment.getSequences().setElementAt(temp, i);\r
+        viewport.alignment.getSequences().setElementAt(seq, i - 1);\r
+      }\r
+    }\r
+    else\r
+    {\r
+      for (int i = viewport.alignment.getHeight() - 2; i > -1; i--)\r
+      {\r
+        SequenceI seq = viewport.alignment.getSequenceAt(i);\r
+\r
+        if (!sg.sequences.contains(seq))\r
+        {\r
+          continue;\r
+        }\r
+\r
+        SequenceI temp = viewport.alignment.getSequenceAt(i + 1);\r
+\r
+        if (sg.sequences.contains(temp))\r
+        {\r
+          continue;\r
+        }\r
+\r
+        viewport.alignment.getSequences().setElementAt(temp, i);\r
+        viewport.alignment.getSequences().setElementAt(seq, i + 1);\r
+      }\r
+    }\r
+\r
+    alignPanel.repaint();\r
+  }\r
+\r
+  protected void copy_actionPerformed(ActionEvent e)\r
+  {\r
+    if (viewport.getSelectionGroup() == null)\r
+    {\r
+      return;\r
+    }\r
+\r
+    SequenceGroup sg = viewport.getSelectionGroup();\r
+\r
+    Clipboard c = Toolkit.getDefaultToolkit().getSystemClipboard();\r
+    StringBuffer buffer = new StringBuffer();\r
+\r
+    Hashtable orderedSeqs = new Hashtable();\r
+\r
+    for (int i = 0; i < sg.getSize(); i++)\r
+    {\r
+      SequenceI seq = sg.getSequenceAt(i);\r
+      int index = viewport.alignment.findIndex(seq);\r
+      orderedSeqs.put(index + "", seq);\r
+    }\r
+\r
+    int index = 0;\r
+\r
+    for (int i = 0; i < sg.getSize(); i++)\r
+    {\r
+      SequenceI seq = null;\r
+\r
+      while (seq == null)\r
+      {\r
+        if (orderedSeqs.containsKey(index + ""))\r
+        {\r
+          seq = (SequenceI) orderedSeqs.get(index + "");\r
+          index++;\r
+\r
+          break;\r
+        }\r
+        else\r
+        {\r
+          index++;\r
+        }\r
+      }\r
+\r
+      buffer.append(seq.getName() + "\t" +\r
+                    seq.findPosition(sg.getStartRes()) + "\t" +\r
+                    seq.findPosition(sg.getEndRes()) + "\t" +\r
+                    sg.getSequenceAt(i).getSequence(sg.getStartRes(),\r
+          sg.getEndRes() + 1) + "\n");\r
+    }\r
+\r
+    c.setContents(new StringSelection(buffer.toString()), null);\r
+  }\r
+\r
+  protected void pasteNew_actionPerformed(ActionEvent e)\r
+  {\r
+    paste(true);\r
+  }\r
+\r
+  protected void pasteThis_actionPerformed(ActionEvent e)\r
+  {\r
+    addHistoryItem(new HistoryItem("Paste Sequences", viewport.alignment,\r
+                                   HistoryItem.PASTE));\r
+    paste(false);\r
+  }\r
+\r
+  void paste(boolean newAlignment)\r
+  {\r
+    try\r
+    {\r
+      Clipboard c = Toolkit.getDefaultToolkit().getSystemClipboard();\r
+      Transferable contents = c.getContents(this);\r
+\r
+      if (contents == null)\r
+      {\r
+        return;\r
+      }\r
+\r
+      String str = (String) contents.getTransferData(DataFlavor.stringFlavor);\r
+      StringTokenizer st = new StringTokenizer(str);\r
+      ArrayList seqs = new ArrayList();\r
+\r
+      while (st.hasMoreElements())\r
+      {\r
+        String name = st.nextToken();\r
+        int start = Integer.parseInt(st.nextToken());\r
+        int end = Integer.parseInt(st.nextToken());\r
+        Sequence sequence = new Sequence(name, st.nextToken(), start,\r
+                                         end);\r
+\r
+        if (!newAlignment)\r
+        {\r
+          viewport.alignment.addSequence(sequence);\r
+        }\r
+        else\r
+        {\r
+          seqs.add(sequence);\r
+        }\r
+      }\r
+\r
+      if (newAlignment)\r
+      {\r
+        SequenceI[] newSeqs = new SequenceI[seqs.size()];\r
+        seqs.toArray(newSeqs);\r
+\r
+        AlignFrame af = new AlignFrame(new Alignment(newSeqs));\r
+        String newtitle = new String("Copied sequences");\r
+\r
+        if (title.startsWith("Copied sequences"))\r
+        {\r
+          newtitle = title;\r
+        }\r
+        else\r
+        {\r
+          newtitle = newtitle.concat("- from " + title);\r
+        }\r
+\r
+        Desktop.addInternalFrame(af, newtitle, NEW_WINDOW_WIDTH,\r
+                                 NEW_WINDOW_HEIGHT);\r
+      }\r
+      else\r
+      {\r
+        viewport.firePropertyChange("alignment", null,\r
+                                    viewport.getAlignment().getSequences());\r
+        viewport.setEndSeq(viewport.alignment.getHeight());\r
+        viewport.alignment.getWidth();\r
+        viewport.updateConservation();\r
+        viewport.updateConsensus();\r
+        alignPanel.repaint();\r
+      }\r
+    }\r
+    catch (Exception ex)\r
+    {\r
+    }\r
+\r
+    // could be anything being pasted in here\r
+  }\r
+\r
+  protected void cut_actionPerformed(ActionEvent e)\r
+  {\r
+    copy_actionPerformed(null);\r
+    delete_actionPerformed(null);\r
+  }\r
+\r
+  protected void delete_actionPerformed(ActionEvent e)\r
+  {\r
+    boolean seqsdeleted = false;\r
+\r
+    if (viewport.getSelectionGroup() == null)\r
+    {\r
+      return;\r
+    }\r
+\r
+    addHistoryItem(new HistoryItem("Delete Sequences", viewport.alignment,\r
+                                   HistoryItem.HIDE));\r
+\r
+    SequenceGroup sg = viewport.getSelectionGroup();\r
+\r
+    for (int i = 0; i < sg.sequences.size(); i++)\r
+    {\r
+      SequenceI seq = sg.getSequenceAt(i);\r
+      int index = viewport.getAlignment().findIndex(seq);\r
+      seq.deleteChars(sg.getStartRes(), sg.getEndRes() + 1);\r
+\r
+      if (seq.getSequence().length() < 1)\r
+      {\r
+        seqsdeleted = true;\r
+        viewport.getAlignment().deleteSequence(seq);\r
+      }\r
+      else\r
+      {\r
+        viewport.getAlignment().getSequences().setElementAt(seq, index);\r
+      }\r
+    }\r
+\r
+    viewport.setSelectionGroup(null);\r
+    viewport.alignment.deleteGroup(sg);\r
+\r
+    if (seqsdeleted)\r
+    {\r
+      viewport.firePropertyChange("alignment", null,\r
+                                  viewport.getAlignment().getSequences());\r
+    }\r
+\r
+    viewport.resetSeqLimits(alignPanel.seqPanel.seqCanvas.getHeight());\r
+\r
+    if (viewport.getAlignment().getHeight() < 1)\r
+    {\r
+      try\r
+      {\r
+        this.setClosed(true);\r
+      }\r
+      catch (Exception ex)\r
+      {\r
+      }\r
+    }\r
+\r
+    viewport.updateConservation();\r
+    viewport.updateConsensus();\r
+    alignPanel.repaint();\r
+  }\r
+\r
+  protected void deleteGroups_actionPerformed(ActionEvent e)\r
+  {\r
+    viewport.alignment.deleteAllGroups();\r
+    viewport.setSelectionGroup(null);\r
+    alignPanel.repaint();\r
+  }\r
+\r
+  public void selectAllSequenceMenuItem_actionPerformed(ActionEvent e)\r
+  {\r
+    SequenceGroup sg = new SequenceGroup();\r
+\r
+    for (int i = 0; i < viewport.getAlignment().getSequences().size();\r
+         i++)\r
+    {\r
+      sg.addSequence(viewport.getAlignment().getSequenceAt(i));\r
+    }\r
+\r
+    sg.setEndRes(viewport.alignment.getWidth());\r
+    viewport.setSelectionGroup(sg);\r
+    PaintRefresher.Refresh(null);\r
+  }\r
+\r
+  public void deselectAllSequenceMenuItem_actionPerformed(ActionEvent e)\r
+  {\r
+    viewport.setSelectionGroup(null);\r
+    viewport.getColumnSelection().clear();\r
+    viewport.setSelectionGroup(null);\r
+    PaintRefresher.Refresh(null);\r
+  }\r
+\r
+  public void invertSequenceMenuItem_actionPerformed(ActionEvent e)\r
+  {\r
+    SequenceGroup sg = viewport.getSelectionGroup();\r
+\r
+    for (int i = 0; i < viewport.getAlignment().getSequences().size();\r
+         i++)\r
+    {\r
+      sg.addOrRemove(viewport.getAlignment().getSequenceAt(i));\r
+    }\r
+\r
+    PaintRefresher.Refresh(null);\r
+  }\r
+\r
+  public void remove2LeftMenuItem_actionPerformed(ActionEvent e)\r
+  {\r
+    ColumnSelection colSel = viewport.getColumnSelection();\r
+\r
+    if (colSel.size() > 0)\r
+    {\r
+      addHistoryItem(new HistoryItem("Remove Left", viewport.alignment,\r
+                                     HistoryItem.HIDE));\r
+\r
+      int min = colSel.getMin();\r
+      viewport.getAlignment().trimLeft(min);\r
+      colSel.compensateForEdit(0, min);\r
+\r
+      if (viewport.getSelectionGroup() != null)\r
+      {\r
+        viewport.getSelectionGroup().adjustForRemoveLeft(min);\r
+      }\r
+\r
+      Vector groups = viewport.alignment.getGroups();\r
+\r
+      for (int i = 0; i < groups.size(); i++)\r
+      {\r
+        SequenceGroup sg = (SequenceGroup) groups.get(i);\r
+\r
+        if (!sg.adjustForRemoveLeft(min))\r
+        {\r
+          viewport.alignment.deleteGroup(sg);\r
+        }\r
+      }\r
+\r
+      alignPanel.repaint();\r
+    }\r
+  }\r
+\r
+  public void remove2RightMenuItem_actionPerformed(ActionEvent e)\r
+  {\r
+    ColumnSelection colSel = viewport.getColumnSelection();\r
+\r
+    if (colSel.size() > 0)\r
+    {\r
+      addHistoryItem(new HistoryItem("Remove Right", viewport.alignment,\r
+                                     HistoryItem.HIDE));\r
+\r
+      int max = colSel.getMax();\r
+      viewport.getAlignment().trimRight(max);\r
+\r
+      if (viewport.getSelectionGroup() != null)\r
+      {\r
+        viewport.getSelectionGroup().adjustForRemoveRight(max);\r
+      }\r
+\r
+      Vector groups = viewport.alignment.getGroups();\r
+\r
+      for (int i = 0; i < groups.size(); i++)\r
+      {\r
+        SequenceGroup sg = (SequenceGroup) groups.get(i);\r
+\r
+        if (!sg.adjustForRemoveRight(max))\r
+        {\r
+          viewport.alignment.deleteGroup(sg);\r
+        }\r
+      }\r
+\r
+      alignPanel.repaint();\r
+    }\r
+  }\r
+\r
+  public void removeGappedColumnMenuItem_actionPerformed(ActionEvent e)\r
+  {\r
+    addHistoryItem(new HistoryItem("Remove Gapped Columns",\r
+                                   viewport.alignment, HistoryItem.HIDE));\r
+\r
+    viewport.getAlignment().removeGaps();\r
+    viewport.updateConservation();\r
+    viewport.updateConsensus();\r
+    alignPanel.repaint();\r
+  }\r
+\r
+  public void removeAllGapsMenuItem_actionPerformed(ActionEvent e)\r
+  {\r
+    addHistoryItem(new HistoryItem("Remove Gaps", viewport.alignment,\r
+                                   HistoryItem.HIDE));\r
+\r
+    SequenceI current;\r
+    int jSize;\r
+\r
+    for (int i = 0; i < viewport.getAlignment().getSequences().size();\r
+         i++)\r
+    {\r
+      current = viewport.getAlignment().getSequenceAt(i);\r
+      jSize = current.getLength();\r
+\r
+      for (int j = 0; j < jSize; j++)\r
+      {\r
+        if (jalview.util.Comparison.isGap(current.getCharAt(j)))\r
+        {\r
+          current.deleteCharAt(j);\r
+          j--;\r
+          jSize--;\r
+        }\r
+      }\r
+    }\r
+\r
+    viewport.updateConservation();\r
+    viewport.updateConsensus();\r
+    alignPanel.repaint();\r
+  }\r
+\r
+  public void padGapsMenuitem_actionPerformed(ActionEvent e)\r
+  {\r
+    addHistoryItem(new HistoryItem("Pad Gaps", viewport.alignment,\r
+                                   HistoryItem.HIDE));\r
+\r
+    SequenceI current;\r
+    int Width = viewport.getAlignment().getWidth() - 1;\r
+\r
+    for (int i = 0; i < viewport.getAlignment().getSequences().size();\r
+         i++)\r
+    {\r
+      current = viewport.getAlignment().getSequenceAt(i);\r
+\r
+      if (current.getLength() < Width)\r
+      {\r
+        current.insertCharAt(Width, viewport.getGapCharacter());\r
+      }\r
+    }\r
+\r
+    viewport.updateConservation();\r
+    viewport.updateConsensus();\r
+    alignPanel.repaint();\r
+  }\r
+\r
+  public void findMenuItem_actionPerformed(ActionEvent e)\r
+  {\r
+    JInternalFrame frame = new JInternalFrame();\r
+    Finder finder = new Finder(viewport, alignPanel, frame);\r
+    frame.setContentPane(finder);\r
+    Desktop.addInternalFrame(frame, "Find", 340, 110);\r
+    frame.setLayer(JLayeredPane.PALETTE_LAYER);\r
+  }\r
+\r
+  public void font_actionPerformed(ActionEvent e)\r
+  {\r
+    FontChooser fc = new FontChooser(alignPanel);\r
+  }\r
+\r
+  protected void fullSeqId_actionPerformed(ActionEvent e)\r
+  {\r
+    viewport.setShowFullId(fullSeqId.isSelected());\r
+\r
+    alignPanel.idPanel.idCanvas.setPreferredSize(alignPanel.calculateIdWidth());\r
+    alignPanel.repaint();\r
+  }\r
+\r
+  protected void colourTextMenuItem_actionPerformed(ActionEvent e)\r
+  {\r
+    viewport.setColourText(colourTextMenuItem.isSelected());\r
+    alignPanel.repaint();\r
+  }\r
+\r
+  protected void wrapMenuItem_actionPerformed(ActionEvent e)\r
+  {\r
+    viewport.setWrapAlignment(wrapMenuItem.isSelected());\r
+    alignPanel.setWrapAlignment(wrapMenuItem.isSelected());\r
+    scaleAbove.setVisible(wrapMenuItem.isSelected());\r
+    scaleLeft.setVisible(wrapMenuItem.isSelected());\r
+    scaleRight.setVisible(wrapMenuItem.isSelected());\r
+    alignPanel.repaint();\r
+  }\r
+\r
+  protected void scaleAbove_actionPerformed(ActionEvent e)\r
+  {\r
+    viewport.setScaleAboveWrapped(scaleAbove.isSelected());\r
+    alignPanel.repaint();\r
+  }\r
+\r
+  protected void scaleLeft_actionPerformed(ActionEvent e)\r
+  {\r
+    viewport.setScaleLeftWrapped(scaleLeft.isSelected());\r
+    alignPanel.repaint();\r
+  }\r
+\r
+  protected void scaleRight_actionPerformed(ActionEvent e)\r
+  {\r
+    viewport.setScaleRightWrapped(scaleRight.isSelected());\r
+    alignPanel.repaint();\r
+  }\r
+\r
+  public void viewBoxesMenuItem_actionPerformed(ActionEvent e)\r
+  {\r
+    viewport.setShowBoxes(viewBoxesMenuItem.isSelected());\r
+    alignPanel.repaint();\r
+  }\r
+\r
+  public void viewTextMenuItem_actionPerformed(ActionEvent e)\r
+  {\r
+    viewport.setShowText(viewTextMenuItem.isSelected());\r
+    alignPanel.repaint();\r
+  }\r
+\r
+  protected void renderGapsMenuItem_actionPerformed(ActionEvent e)\r
+  {\r
+    viewport.setRenderGaps(renderGapsMenuItem.isSelected());\r
+    alignPanel.repaint();\r
+  }\r
+\r
+  public void sequenceFeatures_actionPerformed(ActionEvent evt)\r
+  {\r
+    viewport.showSequenceFeatures(sequenceFeatures.isSelected());\r
+\r
+    if (viewport.showSequenceFeatures &&\r
+        ! ( (Alignment) viewport.alignment).featuresAdded)\r
+    {\r
+      SequenceFeatureFetcher sft = new SequenceFeatureFetcher(viewport.\r
+          alignment,\r
+          alignPanel);\r
+      ( (Alignment) viewport.alignment).featuresAdded = true;\r
+    }\r
+\r
+    alignPanel.repaint();\r
+  }\r
+\r
+  public void annotationPanelMenuItem_actionPerformed(ActionEvent e)\r
+  {\r
+    if (annotationPanelMenuItem.isSelected() &&\r
+        viewport.getWrapAlignment())\r
+    {\r
+      annotationPanelMenuItem.setSelected(false);\r
+\r
+      return;\r
+    }\r
+\r
+    viewport.setShowAnnotation(annotationPanelMenuItem.isSelected());\r
+    alignPanel.setAnnotationVisible(annotationPanelMenuItem.isSelected());\r
+  }\r
+\r
+  public void overviewMenuItem_actionPerformed(ActionEvent e)\r
+  {\r
+    if (alignPanel.overviewPanel != null)\r
+    {\r
+      return;\r
+    }\r
+\r
+    JInternalFrame frame = new JInternalFrame();\r
+    OverviewPanel overview = new OverviewPanel(alignPanel);\r
+    frame.setContentPane(overview);\r
+    Desktop.addInternalFrame(frame, "Overview " + this.getTitle(),\r
+                             frame.getWidth(), frame.getHeight());\r
+    frame.pack();\r
+    frame.setLayer(JLayeredPane.PALETTE_LAYER);\r
+    frame.addInternalFrameListener(new javax.swing.event.InternalFrameAdapter()\r
+    {\r
+      public void internalFrameClosed(\r
+          javax.swing.event.InternalFrameEvent evt)\r
+      {\r
+        alignPanel.setOverviewPanel(null);\r
+      }\r
+      ;\r
+    });\r
+\r
+    alignPanel.setOverviewPanel(overview);\r
+  }\r
+\r
+  protected void noColourmenuItem_actionPerformed(ActionEvent e)\r
+  {\r
+    changeColour(null);\r
+  }\r
+\r
+  public void clustalColour_actionPerformed(ActionEvent e)\r
+  {\r
+    changeColour(new ClustalxColourScheme(\r
+        viewport.alignment.getSequences(), viewport.alignment.getWidth()));\r
+  }\r
+\r
+  public void zappoColour_actionPerformed(ActionEvent e)\r
+  {\r
+    changeColour(new ZappoColourScheme());\r
+  }\r
+\r
+  public void taylorColour_actionPerformed(ActionEvent e)\r
+  {\r
+    changeColour(new TaylorColourScheme());\r
+  }\r
+\r
+  public void hydrophobicityColour_actionPerformed(ActionEvent e)\r
+  {\r
+    changeColour(new HydrophobicColourScheme());\r
+  }\r
+\r
+  public void helixColour_actionPerformed(ActionEvent e)\r
+  {\r
+    changeColour(new HelixColourScheme());\r
+  }\r
+\r
+  public void strandColour_actionPerformed(ActionEvent e)\r
+  {\r
+    changeColour(new StrandColourScheme());\r
+  }\r
+\r
+  public void turnColour_actionPerformed(ActionEvent e)\r
+  {\r
+    changeColour(new TurnColourScheme());\r
+  }\r
+\r
+  public void buriedColour_actionPerformed(ActionEvent e)\r
+  {\r
+    changeColour(new BuriedColourScheme());\r
+  }\r
+\r
+  public void nucleotideColour_actionPerformed(ActionEvent e)\r
+  {\r
+    changeColour(new NucleotideColourScheme());\r
+  }\r
+\r
+  protected void applyToAllGroups_actionPerformed(ActionEvent e)\r
+  {\r
+    viewport.setColourAppliesToAllGroups(applyToAllGroups.isSelected());\r
+  }\r
+\r
+  void changeColour(ColourSchemeI cs)\r
+  {\r
+    int threshold = 0;\r
+\r
+    if (viewport.getAbovePIDThreshold())\r
+    {\r
+      threshold = SliderPanel.setPIDSliderSource(alignPanel, cs,\r
+                                                 "Background");\r
+\r
+      if (cs instanceof ResidueColourScheme)\r
+      {\r
+        ( (ResidueColourScheme) cs).setThreshold(threshold);\r
+      }\r
+      else if (cs instanceof ScoreColourScheme)\r
+      {\r
+        ( (ScoreColourScheme) cs).setThreshold(threshold);\r
+      }\r
+\r
+      viewport.setGlobalColourScheme(cs);\r
+    }\r
+    else if (cs instanceof ResidueColourScheme)\r
+    {\r
+      ( (ResidueColourScheme) cs).setThreshold(0);\r
+    }\r
+    else if (cs instanceof ScoreColourScheme)\r
+    {\r
+      ( (ScoreColourScheme) cs).setThreshold(0);\r
+    }\r
+\r
+    if (viewport.getConservationSelected())\r
+    {\r
+      ConservationColourScheme ccs = null;\r
+\r
+      Alignment al = (Alignment) viewport.alignment;\r
+      Conservation c = new Conservation("All",\r
+                                        ResidueProperties.propHash, 3,\r
+                                        al.getSequences(), 0,\r
+                                        al.getWidth() - 1);\r
+\r
+      c.calculate();\r
+      c.verdict(false, viewport.ConsPercGaps);\r
+\r
+      ccs = new ConservationColourScheme(c, cs);\r
+\r
+      // MUST NOTIFY THE COLOURSCHEME OF CONSENSUS!\r
+      ccs.setConsensus(viewport.vconsensus);\r
+      viewport.setGlobalColourScheme(ccs);\r
+\r
+      ccs.inc = SliderPanel.setConservationSlider(alignPanel, ccs,\r
+                                                  "Background");\r
+    }\r
+    else\r
+    {\r
+      // MUST NOTIFY THE COLOURSCHEME OF CONSENSUS!\r
+      if (cs != null)\r
+      {\r
+        cs.setConsensus(viewport.vconsensus);\r
+      }\r
+\r
+      viewport.setGlobalColourScheme(cs);\r
+    }\r
+\r
+    if (viewport.getColourAppliesToAllGroups())\r
+    {\r
+      Vector groups = viewport.alignment.getGroups();\r
+\r
+      for (int i = 0; i < groups.size(); i++)\r
+      {\r
+        SequenceGroup sg = (SequenceGroup) groups.elementAt(i);\r
+\r
+        if (cs == null)\r
+        {\r
+          sg.cs = null;\r
+        }\r
+        else if (cs instanceof ClustalxColourScheme)\r
+        {\r
+          sg.cs = new ClustalxColourScheme(sg.sequences, sg.getWidth());\r
+        }\r
+        else if (cs instanceof UserColourScheme)\r
+        {\r
+          sg.cs = new UserColourScheme( ( (UserColourScheme) cs).getColours());\r
+        }\r
+        else\r
+        {\r
+          try\r
+          {\r
+            sg.cs = (ColourSchemeI) cs.getClass().newInstance();\r
+          }\r
+          catch (Exception ex)\r
+          {\r
+          }\r
+        }\r
+\r
+        if (viewport.getAbovePIDThreshold())\r
+        {\r
+          if (sg.cs instanceof ResidueColourScheme)\r
+          {\r
+            ( (ResidueColourScheme) sg.cs).setThreshold(threshold);\r
+          }\r
+          else if (sg.cs instanceof ScoreColourScheme)\r
+          {\r
+            ( (ScoreColourScheme) sg.cs).setThreshold(threshold);\r
+          }\r
+\r
+          sg.cs.setConsensus(AAFrequency.calculate(sg.sequences, 0,\r
+              sg.getWidth()));\r
+        }\r
+\r
+        if (viewport.getConservationSelected())\r
+        {\r
+          Conservation c = new Conservation("Group",\r
+                                            ResidueProperties.propHash, 3,\r
+                                            sg.sequences, 0,\r
+                                            viewport.alignment.getWidth() - 1);\r
+          c.calculate();\r
+          c.verdict(false, viewport.ConsPercGaps);\r
+\r
+          ConservationColourScheme ccs = new ConservationColourScheme(c,\r
+              sg.cs);\r
+\r
+          // MUST NOTIFY THE COLOURSCHEME OF CONSENSUS!\r
+          ccs.setConsensus(AAFrequency.calculate(sg.sequences, 0,\r
+                                                 sg.getWidth()));\r
+          sg.cs = ccs;\r
+        }\r
+        else if (cs != null)\r
+        {\r
+          // MUST NOTIFY THE COLOURSCHEME OF CONSENSUS!\r
+          sg.cs.setConsensus(AAFrequency.calculate(sg.sequences, 0,\r
+              sg.getWidth()));\r
+        }\r
+      }\r
+    }\r
+\r
+    if (alignPanel.getOverviewPanel() != null)\r
+    {\r
+      alignPanel.getOverviewPanel().updateOverviewImage();\r
+    }\r
+\r
+    alignPanel.repaint();\r
+  }\r
+\r
+  protected void modifyPID_actionPerformed(ActionEvent e)\r
+  {\r
+    if (viewport.getAbovePIDThreshold())\r
+    {\r
+      SliderPanel.setPIDSliderSource(alignPanel,\r
+                                     viewport.getGlobalColourScheme(),\r
+                                     "Background");\r
+      SliderPanel.showPIDSlider();\r
+    }\r
+  }\r
+\r
+  protected void modifyConservation_actionPerformed(ActionEvent e)\r
+  {\r
+    if (viewport.getConservationSelected())\r
+    {\r
+      SliderPanel.setConservationSlider(alignPanel,\r
+                                        viewport.globalColourScheme,\r
+                                        "Background");\r
+      SliderPanel.showConservationSlider();\r
+    }\r
+  }\r
+\r
+  protected void conservationMenuItem_actionPerformed(ActionEvent e)\r
+  {\r
+    viewport.setConservationSelected(conservationMenuItem.isSelected());\r
+\r
+    viewport.setAbovePIDThreshold(false);\r
+    abovePIDThreshold.setSelected(false);\r
+\r
+    ColourSchemeI cs = viewport.getGlobalColourScheme();\r
+\r
+    if (cs instanceof ConservationColourScheme)\r
+    {\r
+      changeColour( ( (ConservationColourScheme) cs).cs);\r
+    }\r
+    else\r
+    {\r
+      changeColour(cs);\r
+    }\r
+\r
+    modifyConservation_actionPerformed(null);\r
+  }\r
+\r
+  public void abovePIDThreshold_actionPerformed(ActionEvent e)\r
+  {\r
+    viewport.setAbovePIDThreshold(abovePIDThreshold.isSelected());\r
+\r
+    conservationMenuItem.setSelected(false);\r
+    viewport.setConservationSelected(false);\r
+\r
+    ColourSchemeI cs = viewport.getGlobalColourScheme();\r
+\r
+    if (cs instanceof ConservationColourScheme)\r
+    {\r
+      changeColour( ( (ConservationColourScheme) cs).cs);\r
+    }\r
+    else\r
+    {\r
+      changeColour(cs);\r
+    }\r
+\r
+    modifyPID_actionPerformed(null);\r
+  }\r
+\r
+  public void userDefinedColour_actionPerformed(ActionEvent e)\r
+  {\r
+    new UserDefinedColours(alignPanel, null);\r
+  }\r
+\r
+  public void PIDColour_actionPerformed(ActionEvent e)\r
+  {\r
+    changeColour(new PIDColourScheme());\r
+  }\r
+\r
+  public void BLOSUM62Colour_actionPerformed(ActionEvent e)\r
+  {\r
+    changeColour(new Blosum62ColourScheme());\r
+  }\r
+\r
+  public void sortPairwiseMenuItem_actionPerformed(ActionEvent e)\r
+  {\r
+    addHistoryItem(new HistoryItem("Pairwise Sort", viewport.alignment,\r
+                                   HistoryItem.SORT));\r
+    AlignmentSorter.sortByPID(viewport.getAlignment(),\r
+                              viewport.getAlignment().getSequenceAt(0));\r
+    alignPanel.repaint();\r
+  }\r
+\r
+  public void sortIDMenuItem_actionPerformed(ActionEvent e)\r
+  {\r
+    addHistoryItem(new HistoryItem("ID Sort", viewport.alignment,\r
+                                   HistoryItem.SORT));\r
+    AlignmentSorter.sortByID(viewport.getAlignment());\r
+    alignPanel.repaint();\r
+  }\r
+\r
+  public void sortGroupMenuItem_actionPerformed(ActionEvent e)\r
+  {\r
+    addHistoryItem(new HistoryItem("Group Sort", viewport.alignment,\r
+                                   HistoryItem.SORT));\r
+\r
+    //  AlignmentSorter.sortByGroup(viewport.getAlignment());\r
+    AlignmentSorter.sortGroups(viewport.getAlignment());\r
+    alignPanel.repaint();\r
+  }\r
+\r
+  public void removeRedundancyMenuItem_actionPerformed(ActionEvent e)\r
+  {\r
+    RedundancyPanel sp = new RedundancyPanel(alignPanel, this);\r
+    JInternalFrame frame = new JInternalFrame();\r
+    frame.setContentPane(sp);\r
+    Desktop.addInternalFrame(frame, "Redundancy threshold selection", 400,\r
+                             100, false);\r
+  }\r
+\r
+  public void pairwiseAlignmentMenuItem_actionPerformed(ActionEvent e)\r
+  {\r
+    if ( (viewport.getSelectionGroup() == null) ||\r
+        (viewport.getSelectionGroup().getSize() < 2))\r
+    {\r
+      JOptionPane.showInternalMessageDialog(this,\r
+                                            "You must select at least 2 sequences.",\r
+                                            "Invalid Selection",\r
+                                            JOptionPane.WARNING_MESSAGE);\r
+    }\r
+    else\r
+    {\r
+      JInternalFrame frame = new JInternalFrame();\r
+      frame.setContentPane(new PairwiseAlignPanel(viewport));\r
+      Desktop.addInternalFrame(frame, "Pairwise Alignment", 600, 500);\r
+    }\r
+  }\r
+\r
+  public void PCAMenuItem_actionPerformed(ActionEvent e)\r
+  {\r
+    if ( ( (viewport.getSelectionGroup() != null) &&\r
+          (viewport.getSelectionGroup().getSize() < 4) &&\r
+          (viewport.getSelectionGroup().getSize() > 0)) ||\r
+        (viewport.getAlignment().getHeight() < 4))\r
+    {\r
+      JOptionPane.showInternalMessageDialog(this,\r
+                                            "Principal component analysis must take\n" +\r
+                                            "at least 4 input sequences.",\r
+                                            "Sequence selection insufficient",\r
+                                            JOptionPane.WARNING_MESSAGE);\r
+\r
+      return;\r
+    }\r
+\r
+    try\r
+    {\r
+      PCAPanel pcaPanel = new PCAPanel(viewport, null);\r
+      JInternalFrame frame = new JInternalFrame();\r
+      frame.setContentPane(pcaPanel);\r
+      Desktop.addInternalFrame(frame, "Principal component analysis",\r
+                               400, 400);\r
+    }\r
+    catch (java.lang.OutOfMemoryError ex)\r
+    {\r
+      JOptionPane.showInternalMessageDialog(this,\r
+                                            "Too many sequences selected\nfor Principal Component Analysis!!",\r
+                                            "Out of memory",\r
+                                            JOptionPane.WARNING_MESSAGE);\r
+    }\r
+  }\r
+\r
+  public void averageDistanceTreeMenuItem_actionPerformed(ActionEvent e)\r
+  {\r
+    NewTreePanel("AV", "PID", "Average distance tree using PID");\r
+  }\r
+\r
+  public void neighbourTreeMenuItem_actionPerformed(ActionEvent e)\r
+  {\r
+    NewTreePanel("NJ", "PID", "Neighbour joining tree using PID");\r
+  }\r
+\r
+  protected void njTreeBlosumMenuItem_actionPerformed(ActionEvent e)\r
+  {\r
+    NewTreePanel("NJ", "BL", "Neighbour joining tree using BLOSUM62");\r
+  }\r
+\r
+  protected void avTreeBlosumMenuItem_actionPerformed(ActionEvent e)\r
+  {\r
+    NewTreePanel("AV", "BL", "Average distance tree using BLOSUM62");\r
+  }\r
+\r
+  void NewTreePanel(String type, String pwType, String title)\r
+  {\r
+    String ltitle;\r
+    final TreePanel tp;\r
+\r
+    if ( (viewport.getSelectionGroup() != null) &&\r
+        (viewport.getSelectionGroup().getSize() > 3))\r
+    {\r
+      int s = 0;\r
+      SequenceGroup sg = viewport.getSelectionGroup();\r
+\r
+      /* Decide if the selection is a column region */\r
+      while (s < sg.sequences.size())\r
+      {\r
+        if ( ( (SequenceI) sg.sequences.elementAt(s++)).getLength() <\r
+            sg.getEndRes())\r
+        {\r
+          JOptionPane.showMessageDialog(Desktop.desktop,\r
+                                        "The selected region to create a tree may\nonly contain residues or gaps.\n" +\r
+                                        "Try using the Pad function in the edit menu,\n" +\r
+                                        "or one of the multiple sequence alignment web services.",\r
+                                        "Sequences in selection are not aligned",\r
+                                        JOptionPane.WARNING_MESSAGE);\r
+\r
+          return;\r
+        }\r
+      }\r
+\r
+      title = title + " on region";\r
+      tp = new TreePanel(viewport,\r
+                         viewport.getSelectionGroup().sequences, type, pwType,\r
+                         sg.getStartRes(), sg.getEndRes());\r
+    }\r
+    else\r
+    {\r
+      //are the sequences aligned?\r
+      if (!viewport.alignment.isAligned())\r
+      {\r
+        JOptionPane.showMessageDialog(Desktop.desktop,\r
+                                      "The sequences must be aligned before creating a tree.\n" +\r
+                                      "Try using the Pad function in the edit menu,\n" +\r
+                                      "or one of the multiple sequence alignment web services.",\r
+                                      "Sequences not aligned",\r
+                                      JOptionPane.WARNING_MESSAGE);\r
+\r
+        return;\r
+      }\r
+\r
+      tp = new TreePanel(viewport,\r
+                         viewport.getAlignment().getSequences(), type, pwType,\r
+                         0,\r
+                         viewport.alignment.getWidth());\r
+    }\r
+\r
+    addTreeMenuItem(tp, title);\r
+    viewport.setCurrentTree(tp.getTree());\r
+\r
+    Desktop.addInternalFrame(tp, title + " from " + this.title, 600, 500);\r
+  }\r
+\r
+  public void addSortByOrderMenuItem(String title, final AlignmentOrder order)\r
+  {\r
+    final JMenuItem item = new JMenuItem("by " + title);\r
+    sort.add(item);\r
+    item.addActionListener(new java.awt.event.ActionListener()\r
+    {\r
+      public void actionPerformed(ActionEvent e)\r
+      {\r
+        addHistoryItem(new HistoryItem("Sort", viewport.alignment,\r
+                                       HistoryItem.SORT));\r
+\r
+        // TODO: JBPNote - have to map order entries to curent SequenceI pointers\r
+        AlignmentSorter.sortBy(viewport.getAlignment(), order);\r
+        alignPanel.repaint();\r
+      }\r
+    });\r
+  }\r
+\r
+  void addTreeMenuItem(final TreePanel treePanel, String title)\r
+  {\r
+    final JMenuItem item = new JMenuItem(title);\r
+\r
+    treeCount++;\r
+\r
+    if (treeCount == 1)\r
+    {\r
+      sort.add(sortByTreeMenu);\r
+    }\r
+\r
+    sortByTreeMenu.add(item);\r
+    item.addActionListener(new java.awt.event.ActionListener()\r
+    {\r
+      public void actionPerformed(ActionEvent e)\r
+      {\r
+        addHistoryItem(new HistoryItem("Tree Sort",\r
+                                       viewport.alignment, HistoryItem.SORT));\r
+        AlignmentSorter.sortByTree(viewport.getAlignment(),\r
+                                   treePanel.getTree());\r
+        alignPanel.repaint();\r
+      }\r
+    });\r
+\r
+    treePanel.addInternalFrameListener(new javax.swing.event.\r
+                                       InternalFrameAdapter()\r
+    {\r
+      public void internalFrameClosed(\r
+          javax.swing.event.InternalFrameEvent evt)\r
+      {\r
+        treeCount--;\r
+        sortByTreeMenu.remove(item);\r
+\r
+        if (treeCount == 0)\r
+        {\r
+          sort.remove(sortByTreeMenu);\r
+        }\r
+      }\r
+      ;\r
+    });\r
+    viewport.addPropertyChangeListener(new java.beans.PropertyChangeListener()\r
+    {\r
+      public void propertyChange(PropertyChangeEvent evt)\r
+      {\r
+        if (evt.getPropertyName().equals("alignment"))\r
+        {\r
+          treePanel.getTree().UpdatePlaceHolders( (Vector) evt.getNewValue());\r
+          treePanel.repaint();\r
+        }\r
+      }\r
+    });\r
+  }\r
+\r
+  public void clustalAlignMenuItem_actionPerformed(ActionEvent e)\r
+  {\r
+    // TODO:resolve which menu item was actually selected\r
+    // Now, check we have enough sequences\r
+    SequenceI[] msa = null;\r
+\r
+    if ( (viewport.getSelectionGroup() != null) &&\r
+        (viewport.getSelectionGroup().getSize() > 1))\r
+    {\r
+      // JBPNote UGLY! To prettify, make SequenceGroup and Alignment conform to some common interface!\r
+      SequenceGroup seqs = viewport.getSelectionGroup();\r
+      int sz;\r
+      msa = new SequenceI[sz = seqs.getSize()];\r
+\r
+      for (int i = 0; i < sz; i++)\r
+      {\r
+        msa[i] = (SequenceI) seqs.getSequenceAt(i);\r
+      }\r
+    }\r
+    else\r
+    {\r
+      Vector seqs = viewport.getAlignment().getSequences();\r
+\r
+      if (seqs.size() > 1)\r
+      {\r
+        msa = new SequenceI[seqs.size()];\r
+\r
+        for (int i = 0; i < seqs.size(); i++)\r
+        {\r
+          msa[i] = (SequenceI) seqs.elementAt(i);\r
+        }\r
+      }\r
+    }\r
+\r
+    if (msa != null)\r
+    {\r
+      jalview.ws.MsaWSClient ct = new jalview.ws.MsaWSClient("ClustalWS",\r
+          title, msa, false, true);\r
+    }\r
+  }\r
+\r
+  public void ClustalRealign_actionPerformed(ActionEvent e)\r
+  {\r
+    // TODO:resolve which menu item was actually selected\r
+    // Now, check we have enough sequences\r
+    SequenceI[] msa = null;\r
+\r
+    if ( (viewport.getSelectionGroup() != null) &&\r
+        (viewport.getSelectionGroup().getSize() > 1))\r
+    {\r
+      // JBPNote UGLY! To prettify, make SequenceGroup and Alignment conform to some common interface!\r
+      SequenceGroup seqs = viewport.getSelectionGroup();\r
+      int sz;\r
+      msa = new SequenceI[sz = seqs.getSize()];\r
+\r
+      for (int i = 0; i < sz; i++)\r
+      {\r
+        msa[i] = (SequenceI) seqs.getSequenceAt(i);\r
+      }\r
+    }\r
+    else\r
+    {\r
+      Vector seqs = viewport.getAlignment().getSequences();\r
+\r
+      if (seqs.size() > 1)\r
+      {\r
+        msa = new SequenceI[seqs.size()];\r
+\r
+        for (int i = 0; i < seqs.size(); i++)\r
+        {\r
+          msa[i] = (SequenceI) seqs.elementAt(i);\r
+        }\r
+      }\r
+    }\r
+\r
+    if (msa != null)\r
+    {\r
+      jalview.ws.MsaWSClient ct = new jalview.ws.MsaWSClient("ClustalWS",\r
+          title, msa, true, true);\r
+    }\r
+  }\r
+\r
+  protected void jpred_actionPerformed(ActionEvent e)\r
+  {\r
+    SequenceI seq = null;\r
+    SequenceI[] msa = null;\r
+\r
+    if ( (viewport.getSelectionGroup() != null) &&\r
+        (viewport.getSelectionGroup().getSize() > 0))\r
+    {\r
+      // JBPNote UGLY! To prettify, make SequenceGroup and Alignment conform to some common interface!\r
+      SequenceGroup seqs = viewport.getSelectionGroup();\r
+\r
+      if ( (seqs.getSize() == 1) || !viewport.alignment.isAligned())\r
+      {\r
+        seq = (SequenceI) seqs.getSequenceAt(0);\r
+      }\r
+      else\r
+      {\r
+        int sz;\r
+        msa = new SequenceI[sz = seqs.getSize()];\r
+\r
+        for (int i = 0; i < sz; i++)\r
+        {\r
+          msa[i] = (SequenceI) seqs.getSequenceAt(i);\r
+        }\r
+      }\r
+    }\r
+    else\r
+    {\r
+      Vector seqs = viewport.getAlignment().getSequences();\r
+\r
+      if ( (seqs.size() == 1) || !viewport.alignment.isAligned())\r
+      {\r
+        seq = (SequenceI) seqs.elementAt(0);\r
+      }\r
+      else\r
+      {\r
+        msa = new SequenceI[seqs.size()];\r
+\r
+        for (int i = 0; i < seqs.size(); i++)\r
+        {\r
+          msa[i] = (SequenceI) seqs.elementAt(i);\r
+        }\r
+      }\r
+    }\r
+\r
+    if (msa != null)\r
+    {\r
+      JPredClient ct = new JPredClient(title, msa);\r
+    }\r
+    else if (seq != null)\r
+    {\r
+      JPredClient ct = new JPredClient(title, seq);\r
+    }\r
+    else\r
+    {\r
+      System.err.print(\r
+          "JALVIEW ERROR! - Unexpected JPred selection state!\n");\r
+    }\r
+  }\r
+\r
+  protected void msaAlignMenuItem_actionPerformed(ActionEvent e)\r
+  {\r
+    // TODO:resolve which menu item was actually selected\r
+    // Now, check we have enough sequences\r
+    SequenceI[] msa = null;\r
+\r
+    if ( (viewport.getSelectionGroup() != null) &&\r
+        (viewport.getSelectionGroup().getSize() > 1))\r
+    {\r
+      // JBPNote UGLY! To prettify, make SequenceGroup and Alignment conform to some common interface!\r
+      SequenceGroup seqs = viewport.getSelectionGroup();\r
+      int sz;\r
+      msa = new SequenceI[sz = seqs.getSize()];\r
+\r
+      for (int i = 0; i < sz; i++)\r
+      {\r
+        msa[i] = (SequenceI) seqs.getSequenceAt(i);\r
+      }\r
+    }\r
+    else\r
+    {\r
+      Vector seqs = viewport.getAlignment().getSequences();\r
+\r
+      if (seqs.size() > 1)\r
+      {\r
+        msa = new SequenceI[seqs.size()];\r
+\r
+        for (int i = 0; i < seqs.size(); i++)\r
+        {\r
+          msa[i] = (SequenceI) seqs.elementAt(i);\r
+        }\r
+      }\r
+    }\r
+\r
+    if (msa != null)\r
+    {\r
+      MsaWSClient ct = new jalview.ws.MsaWSClient("MuscleWS", title, msa,\r
+                                                  false, true);\r
+    }\r
+  }\r
+\r
+  protected void LoadtreeMenuItem_actionPerformed(ActionEvent e)\r
+  {\r
+    // Pick the tree file\r
+    JalviewFileChooser chooser = new JalviewFileChooser(jalview.bin.Cache.\r
+        getProperty(\r
+            "LAST_DIRECTORY"));\r
+    chooser.setFileView(new JalviewFileView());\r
+    chooser.setDialogTitle("Select a newick-like tree file");\r
+    chooser.setToolTipText("Load a tree file");\r
+\r
+    int value = chooser.showOpenDialog(null);\r
+\r
+    if (value == JalviewFileChooser.APPROVE_OPTION)\r
+    {\r
+      String choice = chooser.getSelectedFile().getPath();\r
+      jalview.bin.Cache.setProperty("LAST_DIRECTORY", choice);\r
+\r
+      try\r
+      {\r
+        jalview.io.NewickFile fin = new jalview.io.NewickFile(choice,\r
+            "File");\r
+        ShowNewickTree(fin, choice);\r
+      }\r
+      catch (Exception ex)\r
+      {\r
+        JOptionPane.showMessageDialog(Desktop.desktop,\r
+                                      "Problem reading tree file",\r
+                                      ex.getMessage(),\r
+                                      JOptionPane.WARNING_MESSAGE);\r
+        ex.printStackTrace();\r
+      }\r
+    }\r
+  }\r
+\r
+  public void ShowNewickTree(NewickFile nf, String title)\r
+  {\r
+    try\r
+    {\r
+      nf.parse();\r
+\r
+      if (nf.getTree() != null)\r
+      {\r
+        TreePanel tp = new TreePanel(viewport,\r
+                                     viewport.getAlignment().getSequences(), nf,\r
+                                     "FromFile",\r
+                                     title);\r
+        Desktop.addInternalFrame(tp, title, 600, 500);\r
+        addTreeMenuItem(tp, title);\r
+        viewport.setCurrentTree(tp.getTree());\r
+      }\r
+    }\r
+    catch (Exception ex)\r
+    {\r
+      ex.printStackTrace();\r
+    }\r
+  }\r
+\r
+  class PrintThread\r
+      extends Thread\r
+  {\r
+    public void run()\r
+    {\r
+      PrinterJob printJob = PrinterJob.getPrinterJob();\r
+      PageFormat pf = printJob.pageDialog(printJob.defaultPage());\r
+      printJob.setPrintable(alignPanel, pf);\r
+\r
+      if (printJob.printDialog())\r
+      {\r
+        try\r
+        {\r
+          printJob.print();\r
+        }\r
+        catch (Exception PrintException)\r
+        {\r
+          PrintException.printStackTrace();\r
+        }\r
+      }\r
+    }\r
+  }\r
+}\r
index 1f5ec79..bd43a97 100755 (executable)
@@ -1,90 +1,86 @@
 /*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 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
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
+ */\r
 package jalview.gui;\r
 \r
+import java.util.*;\r
+\r
 import java.awt.*;\r
+\r
 import jalview.analysis.*;\r
-import jalview.analysis.NJTree;\r
+import jalview.bin.*;\r
 import jalview.datamodel.*;\r
 import jalview.schemes.*;\r
-import java.util.*;\r
-import jalview.bin.Cache;\r
 \r
 public class AlignViewport\r
 {\r
   int startRes;\r
   int endRes;\r
-\r
   int startSeq;\r
   int endSeq;\r
-\r
   boolean showFullId = false;\r
-  boolean showText=true;\r
-  boolean showColourText=false;\r
-  boolean showBoxes=true;\r
-  boolean wrapAlignment=false;\r
+  boolean showText = true;\r
+  boolean showColourText = false;\r
+  boolean showBoxes = true;\r
+  boolean wrapAlignment = false;\r
   boolean renderGaps = true;\r
   boolean showSequenceFeatures = false;\r
   boolean showAnnotation = true;\r
   boolean showConservation = true;\r
   boolean showQuality = true;\r
   boolean showIdentity = true;\r
-\r
   boolean colourAppliesToAllGroups = true;\r
   ColourSchemeI globalColourScheme = null;\r
   boolean conservationColourSelected = false;\r
   boolean abovePIDThreshold = false;\r
-\r
   SequenceGroup selectionGroup = new SequenceGroup();\r
-\r
-\r
-  int             charHeight;\r
-  int             charWidth;\r
-  int             chunkWidth;\r
-  int             chunkHeight;\r
-\r
-  Font            font = new Font("SansSerif",Font.PLAIN,10);\r
-  AlignmentI      alignment;\r
-\r
+  int charHeight;\r
+  int charWidth;\r
+  int chunkWidth;\r
+  int chunkHeight;\r
+  Font font = new Font("SansSerif", Font.PLAIN, 10);\r
+  AlignmentI alignment;\r
   ColumnSelection colSel = new ColumnSelection();\r
-\r
   int threshold;\r
   int increment;\r
-\r
   NJTree currentTree = null;\r
-\r
   boolean scaleAboveWrapped = false;\r
-  boolean scaleLeftWrapped  = true;\r
+  boolean scaleLeftWrapped = true;\r
   boolean scaleRightWrapped = true;\r
+  public Vector vconsensus;\r
+  AlignmentAnnotation consensus;\r
+  AlignmentAnnotation conservation;\r
+  AlignmentAnnotation quality;\r
+  public int ConsPercGaps = 25; // JBPNote : This should be a scalable property!\r
 \r
+  // JBPNote Prolly only need this in the applet version.\r
+  private java.beans.PropertyChangeSupport changeSupport = new java.beans.\r
+      PropertyChangeSupport(this);\r
 \r
   public AlignViewport(AlignmentI al)\r
   {\r
     setAlignment(al);\r
     this.startRes = 0;\r
-    this.endRes = al.getWidth()-1;\r
+    this.endRes = al.getWidth() - 1;\r
     this.startSeq = 0;\r
-    this.endSeq = al.getHeight()-1;\r
+    this.endSeq = al.getHeight() - 1;\r
 \r
     updateFromPreferences();\r
-\r
   }\r
 \r
   public void updateFromPreferences()\r
@@ -95,20 +91,30 @@ public class AlignViewport
     showQuality = Preferences.showQuality;\r
     showIdentity = Preferences.showIdentity;\r
     showFullId = Preferences.showFullId;\r
+\r
     String fontName = Preferences.fontName;\r
     String fontStyle = Preferences.fontStyle;\r
     String fontSize = Cache.getProperty("FONT_SIZE");\r
-    if (fontName != null && fontStyle != null && fontSize != null)\r
+\r
+    if ( (fontName != null) && (fontStyle != null) && (fontSize != null))\r
     {\r
       int style = 0;\r
-      if(fontStyle.equals("bold"))\r
+\r
+      if (fontStyle.equals("bold"))\r
+      {\r
         style = 1;\r
-      else if(fontStyle.equals("italic"))\r
+      }\r
+      else if (fontStyle.equals("italic"))\r
+      {\r
         style = 2;\r
+      }\r
+\r
       setFont(new Font(fontName, style, Integer.parseInt(fontSize)));\r
     }\r
     else\r
+    {\r
       setFont(font);\r
+    }\r
 \r
     alignment.setGapCharacter(Preferences.gapSymbol);\r
 \r
@@ -116,49 +122,55 @@ public class AlignViewport
     // as Blosum and Clustal require this to be done\r
     updateConservation();\r
     updateConsensus();\r
-    if(Preferences.defaultColour!=null)\r
+\r
+    if (Preferences.defaultColour != null)\r
     {\r
-      globalColourScheme = ColourSchemeProperty.getColour(alignment, Preferences.defaultColour);\r
-      if(globalColourScheme instanceof UserColourScheme)\r
+      globalColourScheme = ColourSchemeProperty.getColour(alignment,\r
+          Preferences.defaultColour);\r
+\r
+      if (globalColourScheme instanceof UserColourScheme)\r
       {\r
         globalColourScheme = UserDefinedColours.loadDefaultColours();\r
       }\r
-      if(globalColourScheme!=null)\r
-        globalColourScheme.setConsensus( vconsensus );\r
-   }\r
-\r
- }\r
 \r
- public void showSequenceFeatures(boolean b)\r
- {\r
-   showSequenceFeatures = b;\r
- }\r
-\r
-  public Vector vconsensus;\r
-  AlignmentAnnotation consensus;\r
-  AlignmentAnnotation conservation;\r
-  AlignmentAnnotation quality;\r
+      if (globalColourScheme != null)\r
+      {\r
+        globalColourScheme.setConsensus(vconsensus);\r
+      }\r
+    }\r
+  }\r
 \r
-  public int ConsPercGaps = 25; // JBPNote : This should be a scalable property!\r
+  public void showSequenceFeatures(boolean b)\r
+  {\r
+    showSequenceFeatures = b;\r
+  }\r
 \r
   public void updateConservation()\r
   {\r
     Conservation cons = new jalview.analysis.Conservation("All",\r
         jalview.schemes.ResidueProperties.propHash, 3,\r
-        alignment.getSequences(), 0,\r
-        alignment.getWidth()-1);\r
+        alignment.getSequences(), 0, alignment.getWidth() - 1);\r
     cons.calculate();\r
     cons.verdict(false, ConsPercGaps);\r
     cons.findQuality();\r
+\r
     int alWidth = alignment.getWidth();\r
-    Annotation [] annotations = new Annotation[alWidth];\r
-    Annotation [] qannotations = new Annotation[alWidth];\r
+    Annotation[] annotations = new Annotation[alWidth];\r
+    Annotation[] qannotations = new Annotation[alWidth];\r
     String sequence = cons.getConsSequence().getSequence();\r
-    float minR,minG,minB, maxR,maxG,maxB;\r
+    float minR;\r
+    float minG;\r
+    float minB;\r
+    float maxR;\r
+    float maxG;\r
+    float maxB;\r
     minR = 0.3f;\r
     minG = 0.0f;\r
     minB = 0f;\r
-    maxR = 1.0f-minR; maxG=0.9f-minG; maxB=0f-minB; // scalable range for colouring both Conservation and Quality\r
+    maxR = 1.0f - minR;\r
+    maxG = 0.9f - minG;\r
+    maxB = 0f - minB; // scalable range for colouring both Conservation and Quality\r
+\r
     float min = 0f;\r
     float max = 11f;\r
     float qmin = cons.qualityRange[0].floatValue();\r
@@ -167,108 +179,140 @@ public class AlignViewport
     for (int i = 0; i < alWidth; i++)\r
     {\r
       float value = 0;\r
+\r
       try\r
+      {\r
+        value = Integer.parseInt(sequence.charAt(i) + "");\r
+      }\r
+      catch (Exception ex)\r
+      {\r
+        if (sequence.charAt(i) == '*')\r
         {\r
-          value = Integer.parseInt(sequence.charAt(i) + "");\r
+          value = 11;\r
         }\r
-      catch (Exception ex)\r
+\r
+        if (sequence.charAt(i) == '+')\r
         {\r
-          if (sequence.charAt(i) == '*') value = 11;\r
-          if (sequence.charAt(i) == '+') value = 10;\r
+          value = 10;\r
         }\r
-      float vprop = value-min;\r
-      vprop/=max;\r
-      annotations[i] = new Annotation(sequence.charAt(i) + "",\r
-                                      "", ' ', value, new Color(minR+maxR*vprop, minG+maxG*vprop, minB+maxB*vprop));\r
+      }\r
+\r
+      float vprop = value - min;\r
+      vprop /= max;\r
+      annotations[i] = new Annotation(sequence.charAt(i) + "", "", ' ',\r
+                                      value,\r
+                                      new Color(minR + (maxR * vprop),\r
+                                                minG + (maxG * vprop),\r
+                                                minB + (maxB * vprop)));\r
+\r
       // Quality calc\r
-      value = ((Double) cons.quality.get(i)).floatValue();\r
+      value = ( (Double) cons.quality.get(i)).floatValue();\r
       vprop = value - qmin;\r
-      vprop/=qmax;\r
-      qannotations[i] = new Annotation(" ",\r
-                                      String.valueOf(value), ' ', value, new Color(minR+maxR*vprop, minG+maxG*vprop, minB+maxB*vprop));\r
+      vprop /= qmax;\r
+      qannotations[i] = new Annotation(" ", String.valueOf(value), ' ',\r
+                                       value,\r
+                                       new Color(minR + (maxR * vprop),\r
+                                                 minG + (maxG * vprop),\r
+                                                 minB + (maxB * vprop)));\r
     }\r
 \r
-    if(conservation==null)\r
+    if (conservation == null)\r
     {\r
       conservation = new AlignmentAnnotation("Conservation",\r
-                                             "Conservation of total alignment less than "+ConsPercGaps+"% gaps",\r
-                                             annotations,\r
-                                             0f, // cons.qualityRange[0].floatValue(),\r
+                                             "Conservation of total alignment less than " +\r
+                                             ConsPercGaps + "% gaps",\r
+                                             annotations, 0f, // cons.qualityRange[0].floatValue(),\r
                                              11f, // cons.qualityRange[1].floatValue()\r
                                              1);\r
-      if(showConservation)\r
-      alignment.addAnnotation(conservation);\r
+\r
+      if (showConservation)\r
+      {\r
+        alignment.addAnnotation(conservation);\r
+      }\r
+\r
       quality = new AlignmentAnnotation("Quality",\r
                                         "Alignment Quality based on Blosum62 scores",\r
                                         qannotations,\r
                                         cons.qualityRange[0].floatValue(),\r
-                                        cons.qualityRange[1].floatValue(),\r
-                                        1);\r
-      if(showQuality)\r
+                                        cons.qualityRange[1].floatValue(), 1);\r
+\r
+      if (showQuality)\r
+      {\r
         alignment.addAnnotation(quality);\r
+      }\r
     }\r
-    else {\r
+    else\r
+    {\r
       conservation.annotations = annotations;\r
       quality.annotations = qannotations;\r
       quality.graphMax = cons.qualityRange[1].floatValue();\r
     }\r
-\r
-\r
   }\r
 \r
   public void updateConsensus()\r
   {\r
-    Annotation [] annotations = new Annotation[alignment.getWidth()];\r
+    Annotation[] annotations = new Annotation[alignment.getWidth()];\r
 \r
     // this routine prevents vconsensus becoming a new object each time\r
     // consenus is calculated. Important for speed of Blosum62\r
     // and PID colouring of alignment\r
-    if(vconsensus == null)\r
-        vconsensus = alignment.getAAFrequency();\r
+    if (vconsensus == null)\r
+    {\r
+      vconsensus = alignment.getAAFrequency();\r
+    }\r
     else\r
     {\r
-        Vector temp = alignment.getAAFrequency();\r
-        vconsensus.clear();\r
-        Enumeration e = temp.elements();\r
-        while(e.hasMoreElements())\r
-        {\r
-          vconsensus.add(e.nextElement());\r
-        }\r
+      Vector temp = alignment.getAAFrequency();\r
+      vconsensus.clear();\r
+\r
+      Enumeration e = temp.elements();\r
+\r
+      while (e.hasMoreElements())\r
+      {\r
+        vconsensus.add(e.nextElement());\r
+      }\r
     }\r
+\r
     Hashtable hash = null;\r
-    for (int i = 0; i<alignment.getWidth(); i++)\r
+\r
+    for (int i = 0; i < alignment.getWidth(); i++)\r
     {\r
-        hash = (Hashtable) vconsensus.elementAt(i);\r
-        float value = Float.parseFloat(hash.get("maxCount").toString());\r
-        value /= Float.parseFloat(hash.get("size").toString());\r
-\r
-        value *= 100;\r
-        String maxRes = hash.get("maxResidue")+" ";\r
-        String mouseOver = hash.get("maxResidue")+" ";\r
-        if(maxRes.length()>2)\r
-        {\r
-          mouseOver = "["+maxRes+"] ";\r
-          maxRes = "+ ";\r
-        }\r
+      hash = (Hashtable) vconsensus.elementAt(i);\r
+\r
+      float value = Float.parseFloat(hash.get("maxCount").toString());\r
+      value /= Float.parseFloat(hash.get("size").toString());\r
+\r
+      value *= 100;\r
 \r
-        mouseOver += (int)value+"%";\r
-        annotations[i] = new Annotation(maxRes, mouseOver, ' ', value);\r
+      String maxRes = hash.get("maxResidue") + " ";\r
+      String mouseOver = hash.get("maxResidue") + " ";\r
+\r
+      if (maxRes.length() > 2)\r
+      {\r
+        mouseOver = "[" + maxRes + "] ";\r
+        maxRes = "+ ";\r
+      }\r
 \r
+      mouseOver += ( (int) value + "%");\r
+      annotations[i] = new Annotation(maxRes, mouseOver, ' ', value);\r
     }\r
 \r
-     if(consensus==null)\r
-     {\r
-       consensus = new AlignmentAnnotation("Consensus",\r
-                                           "PID", annotations, 0f, 100f, 1);\r
-       if(showIdentity)\r
-         alignment.addAnnotation(consensus);\r
-     }\r
-     else\r
-       consensus.annotations = annotations;\r
+    if (consensus == null)\r
+    {\r
+      consensus = new AlignmentAnnotation("Consensus", "PID",\r
+                                          annotations, 0f, 100f, 1);\r
 \r
+      if (showIdentity)\r
+      {\r
+        alignment.addAnnotation(consensus);\r
+      }\r
+    }\r
+    else\r
+    {\r
+      consensus.annotations = annotations;\r
+    }\r
   }\r
 \r
-\r
   public SequenceGroup getSelectionGroup()\r
   {\r
     return selectionGroup;\r
@@ -279,42 +323,44 @@ public class AlignViewport
     selectionGroup = sg;\r
   }\r
 \r
+  public boolean getConservationSelected()\r
+  {\r
+    return conservationColourSelected;\r
+  }\r
 \r
- public boolean getConservationSelected()\r
- {\r
-   return conservationColourSelected;\r
- }\r
-\r
- public void setConservationSelected(boolean b)\r
- {\r
-   conservationColourSelected = b;\r
- }\r
+  public void setConservationSelected(boolean b)\r
+  {\r
+    conservationColourSelected = b;\r
+  }\r
 \r
- public boolean getAbovePIDThreshold()\r
- {\r
-   return abovePIDThreshold;\r
- }\r
+  public boolean getAbovePIDThreshold()\r
+  {\r
+    return abovePIDThreshold;\r
+  }\r
 \r
- public void setAbovePIDThreshold(boolean b)\r
- {\r
-   abovePIDThreshold = b;\r
- }\r
+  public void setAbovePIDThreshold(boolean b)\r
+  {\r
+    abovePIDThreshold = b;\r
+  }\r
 \r
-  public int getStartRes() {\r
+  public int getStartRes()\r
+  {\r
     return startRes;\r
   }\r
 \r
-  public int getEndRes() {\r
+  public int getEndRes()\r
+  {\r
     return endRes;\r
   }\r
 \r
-  public int getStartSeq() {\r
+  public int getStartSeq()\r
+  {\r
     return startSeq;\r
   }\r
 \r
   public void setGlobalColourScheme(ColourSchemeI cs)\r
   {\r
-     globalColourScheme = cs;\r
+    globalColourScheme = cs;\r
   }\r
 \r
   public ColourSchemeI getGlobalColourScheme()\r
@@ -322,91 +368,134 @@ public class AlignViewport
     return globalColourScheme;\r
   }\r
 \r
-\r
-  public void setStartRes(int res) {\r
+  public void setStartRes(int res)\r
+  {\r
     this.startRes = res;\r
   }\r
-  public void setStartSeq(int seq) {\r
+\r
+  public void setStartSeq(int seq)\r
+  {\r
     this.startSeq = seq;\r
   }\r
-  public void setEndRes(int res) {\r
-    if (res > alignment.getWidth()-1) {\r
+\r
+  public void setEndRes(int res)\r
+  {\r
+    if (res > (alignment.getWidth() - 1))\r
+    {\r
       // log.System.out.println(" Corrected res from " + res + " to maximum " + (alignment.getWidth()-1));\r
-       res = alignment.getWidth()-1;\r
+      res = alignment.getWidth() - 1;\r
     }\r
-    if (res < 0) {\r
+\r
+    if (res < 0)\r
+    {\r
       res = 0;\r
     }\r
+\r
     this.endRes = res;\r
   }\r
-  public void setEndSeq(int seq) {\r
-    if (seq > alignment.getHeight()) {\r
+\r
+  public void setEndSeq(int seq)\r
+  {\r
+    if (seq > alignment.getHeight())\r
+    {\r
       seq = alignment.getHeight();\r
     }\r
-    if (seq < 0) {\r
+\r
+    if (seq < 0)\r
+    {\r
       seq = 0;\r
     }\r
+\r
     this.endSeq = seq;\r
   }\r
-  public int getEndSeq() {\r
+\r
+  public int getEndSeq()\r
+  {\r
     return endSeq;\r
   }\r
 \r
-  public void setFont(Font f) {\r
+  public void setFont(Font f)\r
+  {\r
     font = f;\r
+\r
     javax.swing.JFrame temp = new javax.swing.JFrame();\r
     temp.addNotify();\r
+\r
     java.awt.FontMetrics fm = temp.getGraphics().getFontMetrics(font);\r
     setCharHeight(fm.getHeight());\r
     setCharWidth(fm.charWidth('M'));\r
   }\r
 \r
-  public Font getFont() {\r
+  public Font getFont()\r
+  {\r
     return font;\r
   }\r
-  public void setCharWidth(int w) {\r
+\r
+  public void setCharWidth(int w)\r
+  {\r
     this.charWidth = w;\r
   }\r
-  public int getCharWidth() {\r
+\r
+  public int getCharWidth()\r
+  {\r
     return charWidth;\r
   }\r
-  public void setCharHeight(int h) {\r
+\r
+  public void setCharHeight(int h)\r
+  {\r
     this.charHeight = h;\r
   }\r
-  public int getCharHeight() {\r
+\r
+  public int getCharHeight()\r
+  {\r
     return charHeight;\r
   }\r
-  public void setChunkWidth(int w) {\r
+\r
+  public void setChunkWidth(int w)\r
+  {\r
     this.chunkWidth = w;\r
   }\r
-  public int getChunkWidth() {\r
+\r
+  public int getChunkWidth()\r
+  {\r
     return chunkWidth;\r
   }\r
-  public void setChunkHeight(int h) {\r
+\r
+  public void setChunkHeight(int h)\r
+  {\r
     this.chunkHeight = h;\r
   }\r
-  public int getChunkHeight() {\r
+\r
+  public int getChunkHeight()\r
+  {\r
     return chunkHeight;\r
   }\r
-  public AlignmentI getAlignment() {\r
+\r
+  public AlignmentI getAlignment()\r
+  {\r
     return alignment;\r
   }\r
-  public void setAlignment(AlignmentI align) {\r
+\r
+  public void setAlignment(AlignmentI align)\r
+  {\r
     this.alignment = align;\r
   }\r
 \r
-  public void setWrapAlignment(boolean state) {\r
+  public void setWrapAlignment(boolean state)\r
+  {\r
     wrapAlignment = state;\r
   }\r
-  public void setShowText(boolean state) {\r
+\r
+  public void setShowText(boolean state)\r
+  {\r
     showText = state;\r
   }\r
 \r
-  public void setRenderGaps(boolean state){\r
+  public void setRenderGaps(boolean state)\r
+  {\r
     renderGaps = state;\r
   }\r
 \r
-\r
   public boolean getColourText()\r
   {\r
     return showColourText;\r
@@ -417,79 +506,117 @@ public class AlignViewport
     showColourText = state;\r
   }\r
 \r
-  public void setShowBoxes(boolean state) {\r
+  public void setShowBoxes(boolean state)\r
+  {\r
     showBoxes = state;\r
   }\r
 \r
-  public boolean getWrapAlignment() {\r
-      return wrapAlignment;\r
+  public boolean getWrapAlignment()\r
+  {\r
+    return wrapAlignment;\r
   }\r
-  public boolean getShowText() {\r
+\r
+  public boolean getShowText()\r
+  {\r
     return showText;\r
   }\r
-  public boolean getShowBoxes() {\r
+\r
+  public boolean getShowBoxes()\r
+  {\r
     return showBoxes;\r
   }\r
 \r
-  public char getGapCharacter() {\r
+  public char getGapCharacter()\r
+  {\r
     return getAlignment().getGapCharacter();\r
   }\r
-  public void setGapCharacter(char gap) {\r
-    if (getAlignment() != null) {\r
+\r
+  public void setGapCharacter(char gap)\r
+  {\r
+    if (getAlignment() != null)\r
+    {\r
       getAlignment().setGapCharacter(gap);\r
     }\r
   }\r
-  public void setThreshold(int thresh) {\r
+\r
+  public void setThreshold(int thresh)\r
+  {\r
     threshold = thresh;\r
   }\r
-  public int getThreshold() {\r
+\r
+  public int getThreshold()\r
+  {\r
     return threshold;\r
   }\r
-  public void setIncrement(int inc) {\r
+\r
+  public void setIncrement(int inc)\r
+  {\r
     increment = inc;\r
   }\r
-  public int getIncrement() {\r
+\r
+  public int getIncrement()\r
+  {\r
     return increment;\r
   }\r
-  public int getIndex(int y) {\r
-    int y1     = 0;\r
+\r
+  public int getIndex(int y)\r
+  {\r
+    int y1 = 0;\r
     int starty = getStartSeq();\r
-    int endy   = getEndSeq();\r
+    int endy = getEndSeq();\r
 \r
-    for (int i = starty; i <= endy; i++) {\r
-      if (i < alignment.getHeight() && alignment.getSequenceAt(i) != null) {\r
+    for (int i = starty; i <= endy; i++)\r
+    {\r
+      if ( (i < alignment.getHeight()) &&\r
+          (alignment.getSequenceAt(i) != null))\r
+      {\r
         int y2 = y1 + getCharHeight();\r
 \r
-        if (y>=y1 && y <=y2) {\r
+        if ( (y >= y1) && (y <= y2))\r
+        {\r
           return i;\r
         }\r
-        y1  = y2;\r
-      } else {\r
+\r
+        y1 = y2;\r
+      }\r
+      else\r
+      {\r
         return -1;\r
       }\r
     }\r
+\r
     return -1;\r
   }\r
 \r
-  public ColumnSelection getColumnSelection() {\r
+  public ColumnSelection getColumnSelection()\r
+  {\r
     return colSel;\r
   }\r
 \r
-  public void resetSeqLimits(int height) {\r
-    setEndSeq(height/getCharHeight());\r
+  public void resetSeqLimits(int height)\r
+  {\r
+    setEndSeq(height / getCharHeight());\r
   }\r
-  public void setCurrentTree(NJTree tree) {\r
-      currentTree = tree;\r
+\r
+  public void setCurrentTree(NJTree tree)\r
+  {\r
+    currentTree = tree;\r
   }\r
-  public NJTree getCurrentTree() {\r
+\r
+  public NJTree getCurrentTree()\r
+  {\r
     return currentTree;\r
   }\r
 \r
   public void setColourAppliesToAllGroups(boolean b)\r
-  {   colourAppliesToAllGroups = b; }\r
+  {\r
+    colourAppliesToAllGroups = b;\r
+  }\r
 \r
   public boolean getColourAppliesToAllGroups()\r
-  {return colourAppliesToAllGroups; }\r
+  {\r
+    return colourAppliesToAllGroups;\r
+  }\r
 \r
   public boolean getShowFullId()\r
   {\r
@@ -502,38 +629,59 @@ public class AlignViewport
   }\r
 \r
   public boolean getShowAnnotation()\r
-  {   return showAnnotation;  }\r
+  {\r
+    return showAnnotation;\r
+  }\r
 \r
   public void setShowAnnotation(boolean b)\r
-  {    showAnnotation = b;  }\r
+  {\r
+    showAnnotation = b;\r
+  }\r
 \r
   public boolean getScaleAboveWrapped()\r
-  { return scaleAboveWrapped;}\r
+  {\r
+    return scaleAboveWrapped;\r
+  }\r
 \r
   public boolean getScaleLeftWrapped()\r
-  { return scaleLeftWrapped; }\r
+  {\r
+    return scaleLeftWrapped;\r
+  }\r
 \r
   public boolean getScaleRightWrapped()\r
-  { return scaleRightWrapped; }\r
+  {\r
+    return scaleRightWrapped;\r
+  }\r
 \r
   public void setScaleAboveWrapped(boolean b)\r
-  { scaleAboveWrapped = b; }\r
+  {\r
+    scaleAboveWrapped = b;\r
+  }\r
 \r
   public void setScaleLeftWrapped(boolean b)\r
-  { scaleLeftWrapped = b; }\r
+  {\r
+    scaleLeftWrapped = b;\r
+  }\r
 \r
   public void setScaleRightWrapped(boolean b)\r
-  { scaleRightWrapped = b; }\r
-  // JBPNote Prolly only need this in the applet version.\r
-  private java.beans.PropertyChangeSupport changeSupport = new java.beans.PropertyChangeSupport(this);\r
-  public void addPropertyChangeListener(java.beans.PropertyChangeListener listener) {\r
+  {\r
+    scaleRightWrapped = b;\r
+  }\r
+\r
+  public void addPropertyChangeListener(\r
+      java.beans.PropertyChangeListener listener)\r
+  {\r
     changeSupport.addPropertyChangeListener(listener);\r
   }\r
 \r
-  public void removePropertyChangeListener(java.beans.PropertyChangeListener listener) {\r
+  public void removePropertyChangeListener(\r
+      java.beans.PropertyChangeListener listener)\r
+  {\r
     changeSupport.removePropertyChangeListener(listener);\r
   }\r
-  public void firePropertyChange(String prop, Object oldvalue, Object newvalue) {\r
+\r
+  public void firePropertyChange(String prop, Object oldvalue, Object newvalue)\r
+  {\r
     changeSupport.firePropertyChange(prop, oldvalue, newvalue);\r
   }\r
 }\r
index 7a8a811..1a48af6 100755 (executable)
@@ -1,46 +1,45 @@
 /*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 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
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
+ */\r
 package jalview.gui;\r
 \r
-import jalview.jbgui.GAlignmentPanel;\r
-import jalview.schemes.*;\r
-import jalview.analysis.*;\r
-import jalview.datamodel.*;\r
+import java.io.*;\r
+import javax.imageio.*;\r
+\r
 import java.awt.*;\r
 import java.awt.event.*;\r
-import java.awt.print.*;\r
-import java.io.*;\r
 import java.awt.image.*;\r
-import org.jibble.epsgraphics.*;\r
-import javax.imageio.*;\r
+import java.awt.print.*;\r
 import javax.swing.*;\r
 \r
+import org.jibble.epsgraphics.*;\r
+import jalview.analysis.*;\r
+import jalview.datamodel.*;\r
+import jalview.jbgui.*;\r
+import jalview.schemes.*;\r
 \r
-\r
-public class AlignmentPanel extends GAlignmentPanel implements AdjustmentListener, Printable\r
+public class AlignmentPanel\r
+    extends GAlignmentPanel implements AdjustmentListener, Printable\r
 {\r
-\r
-  AlignViewport     av;\r
+  AlignViewport av;\r
   OverviewPanel overviewPanel;\r
-  SeqPanel   seqPanel;\r
-  IdPanel    idPanel;\r
+  SeqPanel seqPanel;\r
+  IdPanel idPanel;\r
   IdwidthAdjuster idwidthAdjuster;\r
   public AlignFrame alignFrame;\r
   ScalePanel scalePanel;\r
@@ -49,13 +48,15 @@ public class AlignmentPanel extends GAlignmentPanel implements AdjustmentListene
 \r
   // this value is set false when selection area being dragged\r
   boolean fastPaint = true;\r
+  int hextent = 0;\r
+  int vextent = 0;\r
 \r
   public AlignmentPanel(AlignFrame af, final AlignViewport av)\r
   {\r
     alignFrame = af;\r
-    this.av         = av;\r
-    seqPanel        = new SeqPanel  (av, this);\r
-    idPanel         = new IdPanel   (av, this);\r
+    this.av = av;\r
+    seqPanel = new SeqPanel(av, this);\r
+    idPanel = new IdPanel(av, this);\r
 \r
     scalePanel = new ScalePanel(av, this);\r
 \r
@@ -66,7 +67,8 @@ public class AlignmentPanel extends GAlignmentPanel implements AdjustmentListene
     annotationPanel = new AnnotationPanel(this);\r
     alabels = new AnnotationLabels(this);\r
 \r
-    annotationSpaceFillerHolder.setPreferredSize(annotationPanel.getPreferredSize());\r
+    annotationSpaceFillerHolder.setPreferredSize(annotationPanel.\r
+                                                 getPreferredSize());\r
     annotationScroller.setPreferredSize(annotationPanel.getPreferredSize());\r
     annotationScroller.setViewportView(annotationPanel);\r
     annotationSpaceFillerHolder.add(alabels, BorderLayout.CENTER);\r
@@ -81,27 +83,31 @@ public class AlignmentPanel extends GAlignmentPanel implements AdjustmentListene
     hscroll.addAdjustmentListener(this);\r
     vscroll.addAdjustmentListener(this);\r
 \r
-   setFocusable(true);\r
-   addKeyListener(new KeyAdapter()\r
-   {\r
-     public void keyPressed(KeyEvent evt)\r
-     {\r
-       switch(evt.getKeyCode())\r
-       {\r
-         case  27: // escape key\r
-           av.setSelectionGroup(null);\r
-           repaint();\r
-           break;\r
-\r
-        case KeyEvent.VK_DOWN:\r
-          alignFrame.moveSelectedSequences(false);\r
-          break;\r
-        case KeyEvent.VK_UP:\r
-          alignFrame.moveSelectedSequences(true);\r
-          break;\r
-       }\r
-     }\r
-   });\r
+    setFocusable(true);\r
+    addKeyListener(new KeyAdapter()\r
+    {\r
+      public void keyPressed(KeyEvent evt)\r
+      {\r
+        switch (evt.getKeyCode())\r
+        {\r
+          case 27: // escape key\r
+            av.setSelectionGroup(null);\r
+            repaint();\r
+\r
+            break;\r
+\r
+          case KeyEvent.VK_DOWN:\r
+            alignFrame.moveSelectedSequences(false);\r
+\r
+            break;\r
+\r
+          case KeyEvent.VK_UP:\r
+            alignFrame.moveSelectedSequences(true);\r
+\r
+            break;\r
+        }\r
+      }\r
+    });\r
   }\r
 \r
   public void fontChanged()\r
@@ -110,11 +116,14 @@ public class AlignmentPanel extends GAlignmentPanel implements AdjustmentListene
     // to prevent drawing old image\r
     FontMetrics fm = getFontMetrics(av.getFont());\r
 \r
-    scalePanelHolder.setPreferredSize(new Dimension(10, av.charHeight+fm.getDescent()));\r
-    idSpaceFillerPanel1.setPreferredSize(new Dimension(10, av.charHeight+fm.getDescent()));\r
+    scalePanelHolder.setPreferredSize(new Dimension(10,\r
+        av.charHeight + fm.getDescent()));\r
+    idSpaceFillerPanel1.setPreferredSize(new Dimension(10,\r
+        av.charHeight + fm.getDescent()));\r
 \r
     idPanel.idCanvas.gg = null;\r
     annotationPanel.adjustPanelHeight();\r
+\r
     Dimension d = calculateIdWidth();\r
     d.setSize(d.width + 4, d.height);\r
     idPanel.idCanvas.setPreferredSize(d);\r
@@ -122,11 +131,11 @@ public class AlignmentPanel extends GAlignmentPanel implements AdjustmentListene
     repaint();\r
   }\r
 \r
-\r
   Dimension calculateIdWidth()\r
   {\r
     Graphics g = this.getGraphics();\r
-    if(g==null)\r
+\r
+    if (g == null)\r
     {\r
       javax.swing.JFrame f = new javax.swing.JFrame();\r
       f.addNotify();\r
@@ -136,70 +145,83 @@ public class AlignmentPanel extends GAlignmentPanel implements AdjustmentListene
     FontMetrics fm = g.getFontMetrics(av.font);\r
     AlignmentI al = av.getAlignment();\r
 \r
-       int i   = 0;\r
-       int idWidth = 0;\r
-       String id;\r
-       while (i < al.getHeight() && al.getSequenceAt(i) != null)\r
-       {\r
-         SequenceI s   = al.getSequenceAt(i);\r
-         if(av.getShowFullId())\r
-           id   = s.getDisplayId();\r
-         else\r
-           id = s.getName();\r
-\r
-         if (fm.stringWidth(id) > idWidth)\r
-           idWidth = fm.stringWidth(id);\r
-         i++;\r
-       }\r
-\r
-       // Also check annotation label widths\r
-       i=0;\r
-       if(al.getAlignmentAnnotation()!=null)\r
-       {\r
-         fm = g.getFontMetrics(alabels.getFont());\r
-         while (i < al.getAlignmentAnnotation().length)\r
-         {\r
-           String label = al.getAlignmentAnnotation()[i].label;\r
-           if (fm.stringWidth(label) > idWidth)\r
-             idWidth = fm.stringWidth(label);\r
-           i++;\r
-         }\r
-       }\r
-\r
-       return new Dimension(idWidth, 12);\r
-  }\r
+    int i = 0;\r
+    int idWidth = 0;\r
+    String id;\r
 \r
+    while ( (i < al.getHeight()) && (al.getSequenceAt(i) != null))\r
+    {\r
+      SequenceI s = al.getSequenceAt(i);\r
 \r
- public void highlightSearchResults(int [] results)\r
- {\r
-   seqPanel.seqCanvas.highlightSearchResults( results );\r
+      if (av.getShowFullId())\r
+      {\r
+        id = s.getDisplayId();\r
+      }\r
+      else\r
+      {\r
+        id = s.getName();\r
+      }\r
 \r
-   // do we need to scroll the panel?\r
-   if(results!=null)\r
+      if (fm.stringWidth(id) > idWidth)\r
+      {\r
+        idWidth = fm.stringWidth(id);\r
+      }\r
+\r
+      i++;\r
+    }\r
+\r
+    // Also check annotation label widths\r
+    i = 0;\r
+\r
+    if (al.getAlignmentAnnotation() != null)\r
     {\r
-      SequenceI seq = av.alignment.getSequenceAt(results[0]);\r
-      int start = seq.findIndex( results[1] )-1;\r
-      int end = seq.findIndex( results[2] )-1;\r
-      if( av.getStartRes() > start\r
-          || av.getEndRes() < end\r
-          || (av.getStartSeq() > results[0]\r
-          || av.getEndSeq() < results[0]))\r
-        setScrollValues(start, results[0]);\r
+      fm = g.getFontMetrics(alabels.getFont());\r
+\r
+      while (i < al.getAlignmentAnnotation().length)\r
+      {\r
+        String label = al.getAlignmentAnnotation()[i].label;\r
+\r
+        if (fm.stringWidth(label) > idWidth)\r
+        {\r
+          idWidth = fm.stringWidth(label);\r
+        }\r
+\r
+        i++;\r
+      }\r
     }\r
 \r
- }\r
+    return new Dimension(idWidth, 12);\r
+  }\r
+\r
+  public void highlightSearchResults(int[] results)\r
+  {\r
+    seqPanel.seqCanvas.highlightSearchResults(results);\r
 \r
+    // do we need to scroll the panel?\r
+    if (results != null)\r
+    {\r
+      SequenceI seq = av.alignment.getSequenceAt(results[0]);\r
+      int start = seq.findIndex(results[1]) - 1;\r
+      int end = seq.findIndex(results[2]) - 1;\r
 \r
- public OverviewPanel getOverviewPanel()\r
- {\r
-   return overviewPanel;\r
- }\r
+      if ( (av.getStartRes() > start) || (av.getEndRes() < end) ||\r
+          ( (av.getStartSeq() > results[0]) ||\r
+           (av.getEndSeq() < results[0])))\r
+      {\r
+        setScrollValues(start, results[0]);\r
+      }\r
+    }\r
+  }\r
 \r
- public void setOverviewPanel(OverviewPanel op)\r
- {\r
-   overviewPanel = op;\r
- }\r
+  public OverviewPanel getOverviewPanel()\r
+  {\r
+    return overviewPanel;\r
+  }\r
 \r
+  public void setOverviewPanel(OverviewPanel op)\r
+  {\r
+    overviewPanel = op;\r
+  }\r
 \r
   public void setAnnotationVisible(boolean b)\r
   {\r
@@ -207,7 +229,6 @@ public class AlignmentPanel extends GAlignmentPanel implements AdjustmentListene
     annotationScroller.setVisible(b);\r
   }\r
 \r
-\r
   public void setWrapAlignment(boolean wrap)\r
   {\r
     scalePanelHolder.setVisible(!wrap);\r
@@ -220,112 +241,130 @@ public class AlignmentPanel extends GAlignmentPanel implements AdjustmentListene
     idSpaceFillerPanel1.setVisible(!wrap);\r
 \r
     repaint();\r
-\r
   }\r
 \r
-\r
   public void setColourScheme()\r
   {\r
     ColourSchemeI cs = av.getGlobalColourScheme();\r
 \r
-    if(av.getConservationSelected())\r
+    if (av.getConservationSelected())\r
     {\r
+      Alignment al = (Alignment) av.getAlignment();\r
+      Conservation c = new Conservation("All",\r
+                                        ResidueProperties.propHash, 3,\r
+                                        al.getSequences(), 0,\r
+                                        al.getWidth());\r
 \r
-       Alignment al = (Alignment)av.getAlignment();\r
-       Conservation c = new Conservation("All",\r
-                            ResidueProperties.propHash, 3, al.getSequences(), 0,\r
-                            al.getWidth() );\r
-\r
-       c.calculate();\r
-       c.verdict(false, av.ConsPercGaps);\r
-       ConservationColourScheme ccs = new ConservationColourScheme(c, cs);\r
+      c.calculate();\r
+      c.verdict(false, av.ConsPercGaps);\r
 \r
-       av.setGlobalColourScheme( ccs );\r
+      ConservationColourScheme ccs = new ConservationColourScheme(c, cs);\r
 \r
+      av.setGlobalColourScheme(ccs);\r
     }\r
 \r
     repaint();\r
   }\r
 \r
-\r
-  int hextent = 0;\r
-  int vextent = 0;\r
-\r
   // return value is true if the scroll is valid\r
   public boolean scrollUp(boolean up)\r
   {\r
-    if(up)\r
+    if (up)\r
     {\r
-      if(vscroll.getValue()<1)\r
+      if (vscroll.getValue() < 1)\r
+      {\r
         return false;\r
-      fastPaint  = false;\r
+      }\r
+\r
+      fastPaint = false;\r
       vscroll.setValue(vscroll.getValue() - 1);\r
     }\r
     else\r
     {\r
-     if(vextent+vscroll.getValue() >= av.getAlignment().getHeight())\r
-       return false;\r
-      fastPaint  = false;\r
+      if ( (vextent + vscroll.getValue()) >= av.getAlignment().getHeight())\r
+      {\r
+        return false;\r
+      }\r
+\r
+      fastPaint = false;\r
       vscroll.setValue(vscroll.getValue() + 1);\r
     }\r
+\r
     fastPaint = true;\r
+\r
     return true;\r
   }\r
 \r
   public boolean scrollRight(boolean right)\r
   {\r
-\r
     if (right)\r
     {\r
       if (hscroll.getValue() < 1)\r
+      {\r
         return false;\r
+      }\r
+\r
       fastPaint = false;\r
       hscroll.setValue(hscroll.getValue() - 1);\r
     }\r
     else\r
     {\r
-      if (hextent + hscroll.getValue() >= av.getAlignment().getWidth())\r
+      if ( (hextent + hscroll.getValue()) >= av.getAlignment().getWidth())\r
+      {\r
         return false;\r
+      }\r
+\r
       fastPaint = false;\r
       hscroll.setValue(hscroll.getValue() + 1);\r
     }\r
+\r
     fastPaint = true;\r
+\r
     return true;\r
   }\r
 \r
-\r
   public void setScrollValues(int x, int y)\r
   {\r
-    av.setEndRes(x + seqPanel.seqCanvas.getWidth()/av.getCharWidth()-1);\r
+    av.setEndRes( (x + (seqPanel.seqCanvas.getWidth() / av.getCharWidth())) -\r
+                 1);\r
 \r
-    hextent = seqPanel.seqCanvas.getWidth()/av.charWidth;\r
-    vextent = seqPanel.seqCanvas.getHeight()/av.charHeight;\r
+    hextent = seqPanel.seqCanvas.getWidth() / av.charWidth;\r
+    vextent = seqPanel.seqCanvas.getHeight() / av.charHeight;\r
 \r
-    if(hextent > av.alignment.getWidth())\r
+    if (hextent > av.alignment.getWidth())\r
+    {\r
       hextent = av.alignment.getWidth();\r
-    if(vextent > av.alignment.getHeight())\r
+    }\r
+\r
+    if (vextent > av.alignment.getHeight())\r
+    {\r
       vextent = av.alignment.getHeight();\r
+    }\r
 \r
-    if(hextent+x  >  av.getAlignment().getWidth())\r
-      x =  av.getAlignment().getWidth()- hextent;\r
+    if ( (hextent + x) > av.getAlignment().getWidth())\r
+    {\r
+      x = av.getAlignment().getWidth() - hextent;\r
+    }\r
 \r
-    if(vextent+y > av.getAlignment().getHeight())\r
+    if ( (vextent + y) > av.getAlignment().getHeight())\r
+    {\r
       y = av.getAlignment().getHeight() - vextent;\r
+    }\r
 \r
-    if(y<0)\r
+    if (y < 0)\r
+    {\r
       y = 0;\r
+    }\r
 \r
-    if(x<0)\r
-      x=0;\r
-\r
-    hscroll.setValues(x,hextent,0,av.getAlignment().getWidth());\r
-    vscroll.setValues(y,vextent,0,av.getAlignment().getHeight() );\r
-\r
-\r
+    if (x < 0)\r
+    {\r
+      x = 0;\r
+    }\r
 \r
+    hscroll.setValues(x, hextent, 0, av.getAlignment().getWidth());\r
+    vscroll.setValues(y, vextent, 0, av.getAlignment().getHeight());\r
   }\r
 \r
-\r
   public void adjustmentValueChanged(AdjustmentEvent evt)\r
   {\r
     int oldX = av.getStartRes();\r
@@ -335,30 +374,38 @@ public class AlignmentPanel extends GAlignmentPanel implements AdjustmentListene
     {\r
       int x = hscroll.getValue();\r
       av.setStartRes(x);\r
-      av.setEndRes(x + seqPanel.seqCanvas.getWidth()/av.getCharWidth()-1);\r
+      av.setEndRes( (x +\r
+                     (seqPanel.seqCanvas.getWidth() / av.getCharWidth())) - 1);\r
     }\r
 \r
     if (evt.getSource() == vscroll)\r
     {\r
       int offy = vscroll.getValue();\r
+\r
       if (av.getWrapAlignment())\r
       {\r
-        int rowSize = seqPanel.seqCanvas.getWrappedCanvasWidth(seqPanel.seqCanvas.getWidth());\r
-        av.setStartRes( vscroll.getValue() * rowSize );\r
-        av.setEndRes( (vscroll.getValue()+1) * rowSize );\r
+        int rowSize = seqPanel.seqCanvas.getWrappedCanvasWidth(seqPanel.\r
+            seqCanvas.getWidth());\r
+        av.setStartRes(vscroll.getValue() * rowSize);\r
+        av.setEndRes( (vscroll.getValue() + 1) * rowSize);\r
       }\r
       else\r
       {\r
         av.setStartSeq(offy);\r
-        av.setEndSeq(offy + seqPanel.seqCanvas.getHeight() / av.getCharHeight());\r
+        av.setEndSeq(offy +\r
+                     (seqPanel.seqCanvas.getHeight() / av.getCharHeight()));\r
       }\r
     }\r
 \r
-    if(overviewPanel!=null)\r
+    if (overviewPanel != null)\r
+    {\r
       overviewPanel.setBoxPosition();\r
+    }\r
 \r
-    if(av.getWrapAlignment() || !fastPaint)\r
+    if (av.getWrapAlignment() || !fastPaint)\r
+    {\r
       repaint();\r
+    }\r
     else\r
     {\r
       idPanel.idCanvas.fastPaint(av.getStartSeq() - oldY);\r
@@ -366,16 +413,18 @@ public class AlignmentPanel extends GAlignmentPanel implements AdjustmentListene
                                    av.getStartSeq() - oldY);\r
 \r
       scalePanel.repaint();\r
+\r
       if (av.getShowAnnotation())\r
+      {\r
         annotationPanel.fastPaint(av.getStartRes() - oldX);\r
+      }\r
     }\r
-\r
   }\r
 \r
-\r
   public void paintComponent(Graphics g)\r
   {\r
     invalidate();\r
+\r
     Dimension d = idPanel.idCanvas.getPreferredSize();\r
     idPanelHolder.setPreferredSize(d);\r
     hscrollFillerPanel.setPreferredSize(new Dimension(d.width, 12));\r
@@ -383,7 +432,8 @@ public class AlignmentPanel extends GAlignmentPanel implements AdjustmentListene
 \r
     if (av.getWrapAlignment())\r
     {\r
-      int max = av.alignment.getWidth() / seqPanel.seqCanvas.getWrappedCanvasWidth(seqPanel.seqCanvas.getWidth());\r
+      int max = av.alignment.getWidth() /\r
+          seqPanel.seqCanvas.getWrappedCanvasWidth(seqPanel.seqCanvas.getWidth());\r
       vscroll.setMaximum(max);\r
       vscroll.setUnitIncrement(1);\r
       vscroll.setVisibleAmount(1);\r
@@ -392,226 +442,270 @@ public class AlignmentPanel extends GAlignmentPanel implements AdjustmentListene
     {\r
       setScrollValues(av.getStartRes(), av.getStartSeq());\r
     }\r
-\r
-\r
-\r
   }\r
 \r
-  public int print(Graphics pg, PageFormat pf, int pi) throws PrinterException\r
+  public int print(Graphics pg, PageFormat pf, int pi)\r
+      throws PrinterException\r
   {\r
-    pg.translate((int)pf.getImageableX(), (int)pf.getImageableY());\r
+    pg.translate( (int) pf.getImageableX(), (int) pf.getImageableY());\r
 \r
     int pwidth = (int) pf.getImageableWidth();\r
     int pheight = (int) pf.getImageableHeight();\r
 \r
     if (av.getWrapAlignment())\r
-      return printWrappedAlignment(pg, pwidth,pheight, pi);\r
+    {\r
+      return printWrappedAlignment(pg, pwidth, pheight, pi);\r
+    }\r
     else\r
-      return printUnwrapped(pg,pwidth, pheight,pi);\r
+    {\r
+      return printUnwrapped(pg, pwidth, pheight, pi);\r
+    }\r
   }\r
 \r
-  public int printUnwrapped(Graphics pg, int pwidth, int pheight, int pi) throws PrinterException\r
+  public int printUnwrapped(Graphics pg, int pwidth, int pheight, int pi)\r
+      throws PrinterException\r
   {\r
+    int idWidth = calculateIdWidth().width + 4;\r
+    FontMetrics fm = getFontMetrics(av.getFont());\r
+    int scaleHeight = av.charHeight + fm.getDescent();\r
 \r
-      int idWidth = calculateIdWidth().width + 4;\r
-      FontMetrics fm = getFontMetrics(av.getFont());\r
-      int scaleHeight = av.charHeight + fm.getDescent();\r
+    pg.setColor(Color.white);\r
+    pg.fillRect(0, 0, pwidth, pheight);\r
+    pg.setFont(av.getFont());\r
 \r
-      pg.setColor(Color.white);\r
-      pg.fillRect(0, 0, pwidth, pheight);\r
-      pg.setFont(av.getFont());\r
+    ////////////////////////////////////\r
+    /// How many sequences and residues can we fit on a printable page?\r
+    int totalRes = (pwidth - idWidth) / av.getCharWidth();\r
 \r
-      ////////////////////////////////////\r
-      /// How many sequences and residues can we fit on a printable page?\r
-      int totalRes = (pwidth - idWidth) / av.getCharWidth();\r
+    int totalSeq = (int) ( (pheight - scaleHeight) / av.getCharHeight()) -\r
+        1;\r
 \r
-      int totalSeq = (int) ( (pheight - scaleHeight) / av.getCharHeight()) - 1;\r
+    int pagesWide = (av.getAlignment().getWidth() / totalRes) + 1;\r
 \r
-      int pagesWide = av.getAlignment().getWidth() / totalRes + 1;\r
+    /////////////////////////////\r
+    /// Only print these sequences and residues on this page\r
+    int startRes;\r
 \r
-      /////////////////////////////\r
-      /// Only print these sequences and residues on this page\r
-      int startRes, endRes, startSeq, endSeq;\r
-      startRes = (pi % pagesWide) * totalRes;\r
-      endRes = startRes + totalRes - 1;\r
-      if (endRes > av.getAlignment().getWidth()-1)\r
-        endRes = av.getAlignment().getWidth()-1;\r
+    /////////////////////////////\r
+    /// Only print these sequences and residues on this page\r
+    int endRes;\r
 \r
-      startSeq = (pi / pagesWide) * totalSeq;\r
-      endSeq = startSeq + totalSeq;\r
-      if (endSeq > av.getAlignment().getHeight())\r
-        endSeq = av.getAlignment().getHeight();\r
+    /////////////////////////////\r
+    /// Only print these sequences and residues on this page\r
+    int startSeq;\r
 \r
-      int pagesHigh = ( (av.alignment.getHeight() / totalSeq) + 1) * pheight;\r
+    /////////////////////////////\r
+    /// Only print these sequences and residues on this page\r
+    int endSeq;\r
+    startRes = (pi % pagesWide) * totalRes;\r
+    endRes = (startRes + totalRes) - 1;\r
 \r
-      if (av.showAnnotation)\r
-        pagesHigh += annotationPanel.getHeight();\r
+    if (endRes > (av.getAlignment().getWidth() - 1))\r
+    {\r
+      endRes = av.getAlignment().getWidth() - 1;\r
+    }\r
+\r
+    startSeq = (pi / pagesWide) * totalSeq;\r
+    endSeq = startSeq + totalSeq;\r
 \r
-      pagesHigh /= pheight;\r
+    if (endSeq > av.getAlignment().getHeight())\r
+    {\r
+      endSeq = av.getAlignment().getHeight();\r
+    }\r
 \r
-      if (pi >= pagesWide * pagesHigh)\r
-        return Printable.NO_SUCH_PAGE;\r
+    int pagesHigh = ( (av.alignment.getHeight() / totalSeq) + 1) * pheight;\r
 \r
-        //draw Scale\r
-      pg.translate(idWidth, 0);\r
-      scalePanel.drawScale(pg, startRes, endRes, pwidth - idWidth, scaleHeight);\r
-      pg.translate( -idWidth, scaleHeight);\r
-      ////////////////\r
-      // Draw the ids\r
-      Color currentColor = null;\r
-      Color currentTextColor = null;\r
-      for (int i = startSeq; i < endSeq; i++)\r
-      {\r
-        if (av.getSelectionGroup() != null &&\r
-            av.getSelectionGroup().sequences.\r
-            contains(av.getAlignment().getSequenceAt(i)))\r
-        {\r
-          currentColor = Color.gray;\r
-          currentTextColor = Color.black;\r
-        }\r
-        else\r
-        {\r
-          currentColor = av.getAlignment().getSequenceAt(i).getColor();\r
-          currentTextColor = Color.black;\r
-        }\r
+    if (av.showAnnotation)\r
+    {\r
+      pagesHigh += annotationPanel.getHeight();\r
+    }\r
 \r
-        pg.setColor(currentColor);\r
-        pg.fillRect(0,\r
-                    jalview.analysis.AlignmentUtil.getPixelHeight(startSeq, i,\r
-            av.getCharHeight()),\r
-                    idWidth,\r
-                    av.getCharHeight());\r
+    pagesHigh /= pheight;\r
+\r
+    if (pi >= (pagesWide * pagesHigh))\r
+    {\r
+      return Printable.NO_SUCH_PAGE;\r
+    }\r
 \r
-        pg.setColor(currentTextColor);\r
+    //draw Scale\r
+    pg.translate(idWidth, 0);\r
+    scalePanel.drawScale(pg, startRes, endRes, pwidth - idWidth, scaleHeight);\r
+    pg.translate( -idWidth, scaleHeight);\r
 \r
-        String string = av.getAlignment().getSequenceAt(i).getName();\r
-        if (av.getShowFullId())\r
-          string = av.getAlignment().getSequenceAt(i).getDisplayId();\r
+    ////////////////\r
+    // Draw the ids\r
+    Color currentColor = null;\r
+    Color currentTextColor = null;\r
 \r
-        pg.drawString(string, 0, jalview.analysis.AlignmentUtil.getPixelHeight\r
-                      (startSeq, i, av.getCharHeight()) + av.getCharHeight() -\r
-                      (av.getCharHeight() / 5));\r
+    for (int i = startSeq; i < endSeq; i++)\r
+    {\r
+      if ( (av.getSelectionGroup() != null) &&\r
+          av.getSelectionGroup().sequences.contains(\r
+              av.getAlignment().getSequenceAt(i)))\r
+      {\r
+        currentColor = Color.gray;\r
+        currentTextColor = Color.black;\r
+      }\r
+      else\r
+      {\r
+        currentColor = av.getAlignment().getSequenceAt(i).getColor();\r
+        currentTextColor = Color.black;\r
       }\r
 \r
-      // draw main sequence panel\r
-      pg.translate(idWidth, 0);\r
-      seqPanel.seqCanvas.drawPanel(pg, startRes, endRes, startSeq, endSeq,\r
-                                   startRes, startSeq, 0);\r
+      pg.setColor(currentColor);\r
+      pg.fillRect(0,\r
+                  jalview.analysis.AlignmentUtil.getPixelHeight(startSeq, i,\r
+          av.getCharHeight()), idWidth, av.getCharHeight());\r
 \r
+      pg.setColor(currentTextColor);\r
 \r
-      if (av.showAnnotation && endSeq == av.alignment.getHeight())\r
+      String string = av.getAlignment().getSequenceAt(i).getName();\r
+\r
+      if (av.getShowFullId())\r
       {\r
-        pg.translate( -idWidth, (endSeq - startSeq) * av.charHeight);\r
-        alabels.drawComponent( (Graphics2D) pg);\r
-        pg.translate(idWidth, 0);\r
-        annotationPanel.drawComponent( (Graphics2D) pg, startRes, endRes+1);\r
+        string = av.getAlignment().getSequenceAt(i).getDisplayId();\r
       }\r
 \r
-      return Printable.PAGE_EXISTS;\r
+      pg.drawString(string, 0,\r
+                    (jalview.analysis.AlignmentUtil.getPixelHeight(startSeq, i,\r
+          av.getCharHeight()) + av.getCharHeight()) -\r
+                    (av.getCharHeight() / 5));\r
+    }\r
 \r
-  }\r
+    // draw main sequence panel\r
+    pg.translate(idWidth, 0);\r
+    seqPanel.seqCanvas.drawPanel(pg, startRes, endRes, startSeq, endSeq,\r
+                                 startRes, startSeq, 0);\r
 \r
+    if (av.showAnnotation && (endSeq == av.alignment.getHeight()))\r
+    {\r
+      pg.translate( -idWidth, (endSeq - startSeq) * av.charHeight);\r
+      alabels.drawComponent( (Graphics2D) pg);\r
+      pg.translate(idWidth, 0);\r
+      annotationPanel.drawComponent( (Graphics2D) pg, startRes, endRes +\r
+                                    1);\r
+    }\r
 \r
-  public int printWrappedAlignment(Graphics pg, int pwidth, int pheight, int pi) throws PrinterException\r
+    return Printable.PAGE_EXISTS;\r
+  }\r
+\r
+  public int printWrappedAlignment(Graphics pg, int pwidth, int pheight,\r
+                                   int pi)\r
+      throws PrinterException\r
   {\r
-      int idWidth = calculateIdWidth().width + 4;\r
+    int idWidth = calculateIdWidth().width + 4;\r
 \r
-      int resWidth = seqPanel.seqCanvas.getWrappedCanvasWidth(pwidth - idWidth);\r
-      int totalHeight = totalHeight = (av.alignment.getHeight() + 2) *\r
-          ( (av.alignment.getWidth()\r
-             / resWidth) + 1) * av.charHeight;\r
+    int resWidth = seqPanel.seqCanvas.getWrappedCanvasWidth(pwidth -\r
+        idWidth);\r
+    int totalHeight = totalHeight = (av.alignment.getHeight() + 2) *\r
+        ( (av.alignment.getWidth() / resWidth) +\r
+         1) * av.charHeight;\r
 \r
+    pg.setColor(Color.white);\r
+    pg.fillRect(0, 0, pwidth, pheight);\r
+    pg.setFont(av.getFont());\r
 \r
-      pg.setColor(Color.white);\r
-      pg.fillRect(0, 0, pwidth, pheight);\r
-      pg.setFont(av.getFont());\r
+    ////////////////\r
+    // Draw the ids\r
+    pg.setColor(Color.black);\r
 \r
-      ////////////////\r
-      // Draw the ids\r
-      pg.setColor(Color.black);\r
+    pg.translate(0, -pi * pheight);\r
 \r
-      pg.translate(0, -pi * pheight);\r
+    pg.setClip(0, pi * pheight, pwidth, pheight);\r
 \r
-      pg.setClip(0,pi*pheight,pwidth, pheight);\r
+    int ypos = 2 * av.charHeight;\r
 \r
-      int ypos = 2 * av.charHeight;\r
-      do\r
+    do\r
+    {\r
+      for (int i = 0; i < av.alignment.getHeight(); i++)\r
       {\r
-        for (int i = 0; i < av.alignment.getHeight(); i++)\r
-        {\r
-          SequenceI s = av.alignment.getSequenceAt(i);\r
-          String string = s.getName();\r
-          if (av.getShowFullId())\r
-            string = s.getDisplayId();\r
-\r
-          pg.drawString(string, 0,\r
-                        AlignmentUtil.getPixelHeight(0, i, av.charHeight) +\r
-                        ypos +\r
-                        av.charHeight - (av.charHeight / 5));\r
+        SequenceI s = av.alignment.getSequenceAt(i);\r
+        String string = s.getName();\r
 \r
+        if (av.getShowFullId())\r
+        {\r
+          string = s.getDisplayId();\r
         }\r
 \r
-        ypos += (av.alignment.getHeight() + 2) * av.charHeight;\r
-\r
+        pg.drawString(string, 0,\r
+                      (AlignmentUtil.getPixelHeight(0, i, av.charHeight) + ypos +\r
+                       av.charHeight) - (av.charHeight / 5));\r
       }\r
-      while (ypos < totalHeight);\r
-\r
-      pg.translate(idWidth, 0);\r
 \r
-      seqPanel.seqCanvas.drawWrappedPanel(pg, pwidth - idWidth, totalHeight, 0);\r
-\r
-      if (pi * pheight < totalHeight)\r
-        return Printable.PAGE_EXISTS;\r
-      else\r
-        return Printable.NO_SUCH_PAGE;\r
+      ypos += ( (av.alignment.getHeight() + 2) * av.charHeight);\r
+    }\r
+    while (ypos < totalHeight);\r
 \r
+    pg.translate(idWidth, 0);\r
 \r
+    seqPanel.seqCanvas.drawWrappedPanel(pg, pwidth - idWidth, totalHeight, 0);\r
 \r
+    if ( (pi * pheight) < totalHeight)\r
+    {\r
+      return Printable.PAGE_EXISTS;\r
+    }\r
+    else\r
+    {\r
+      return Printable.NO_SUCH_PAGE;\r
+    }\r
   }\r
 \r
-\r
   public void makeEPS()\r
   {\r
-    int height = (av.alignment.getWidth() / av.getChunkWidth() +1) * av.chunkHeight;\r
+    int height = ( (av.alignment.getWidth() / av.getChunkWidth()) + 1) *\r
+        av.chunkHeight;\r
     int width = seqPanel.getWidth() + idPanel.getWidth();\r
 \r
     if (!av.getWrapAlignment())\r
     {\r
-      height = (av.alignment.getHeight()+1) * av.charHeight + 30;\r
-      width = idPanel.getWidth() + av.alignment.getWidth() * av.charWidth;\r
+      height = ( (av.alignment.getHeight() + 1) * av.charHeight) + 30;\r
+      width = idPanel.getWidth() +\r
+          (av.alignment.getWidth() * av.charWidth);\r
+    }\r
+\r
+    if (av.getShowAnnotation())\r
+    {\r
+      height += annotationPanel.getPreferredSize().height;\r
     }\r
-    if(av.getShowAnnotation())\r
-   {\r
-     height += annotationPanel.getPreferredSize().height;\r
-   }\r
 \r
     try\r
     {\r
-      jalview.io.JalviewFileChooser chooser = new jalview.io.JalviewFileChooser(jalview.bin.Cache.getProperty(\r
-          "LAST_DIRECTORY"),\r
-              new String[]{"eps"},\r
-              new String[]{"Encapsulated Postscript"},\r
-              "Encapsulated Postscript");\r
+      jalview.io.JalviewFileChooser chooser = new jalview.io.JalviewFileChooser(\r
+          jalview.bin.Cache.getProperty(\r
+              "LAST_DIRECTORY"), new String[]\r
+          {"eps"},\r
+          new String[]\r
+          {"Encapsulated Postscript"},\r
+          "Encapsulated Postscript");\r
       chooser.setFileView(new jalview.io.JalviewFileView());\r
       chooser.setDialogTitle("Create EPS file from alignment");\r
       chooser.setToolTipText("Save");\r
 \r
       int value = chooser.showSaveDialog(this);\r
+\r
       if (value != jalview.io.JalviewFileChooser.APPROVE_OPTION)\r
+      {\r
         return;\r
+      }\r
 \r
-      jalview.bin.Cache.setProperty("LAST_DIRECTORY",chooser.getSelectedFile().getParent());\r
-      FileOutputStream out = new FileOutputStream(chooser.getSelectedFile());\r
-      EpsGraphics2D pg = new EpsGraphics2D("Example", out, 0, 0, width, height);\r
+      jalview.bin.Cache.setProperty("LAST_DIRECTORY",\r
+                                    chooser.getSelectedFile().getParent());\r
 \r
-        if (av.getWrapAlignment())\r
-          printWrappedAlignment(pg, width, height, 0);\r
-        else\r
-          printUnwrapped(pg, width, height, 0);\r
+      FileOutputStream out = new FileOutputStream(chooser.getSelectedFile());\r
+      EpsGraphics2D pg = new EpsGraphics2D("Example", out, 0, 0, width,\r
+                                           height);\r
 \r
+      if (av.getWrapAlignment())\r
+      {\r
+        printWrappedAlignment(pg, width, height, 0);\r
+      }\r
+      else\r
+      {\r
+        printUnwrapped(pg, width, height, 0);\r
+      }\r
 \r
-        pg.flush();\r
-        pg.close();\r
+      pg.flush();\r
+      pg.close();\r
     }\r
     catch (Exception ex)\r
     {\r
@@ -621,64 +715,76 @@ public class AlignmentPanel extends GAlignmentPanel implements AdjustmentListene
 \r
   public void makePNG()\r
   {\r
-      int height = (av.alignment.getWidth() / av.getChunkWidth() +1) * av.chunkHeight;\r
-      int width = seqPanel.getWidth() + idPanel.getWidth();\r
-\r
-      if (!av.getWrapAlignment())\r
-      {\r
-        height = (av.alignment.getHeight()+1) * av.charHeight + 30;\r
-        width = idPanel.getWidth() + av.alignment.getWidth() * av.charWidth;\r
-      }\r
-\r
-      if(av.getShowAnnotation())\r
-      {\r
-        height += annotationPanel.getPreferredSize().height;\r
-      }\r
+    int height = ( (av.alignment.getWidth() / av.getChunkWidth()) + 1) *\r
+        av.chunkHeight;\r
+    int width = seqPanel.getWidth() + idPanel.getWidth();\r
 \r
+    if (!av.getWrapAlignment())\r
+    {\r
+      height = ( (av.alignment.getHeight() + 1) * av.charHeight) + 30;\r
+      width = idPanel.getWidth() +\r
+          (av.alignment.getWidth() * av.charWidth);\r
+    }\r
 \r
+    if (av.getShowAnnotation())\r
+    {\r
+      height += annotationPanel.getPreferredSize().height;\r
+    }\r
 \r
     try\r
     {\r
-      jalview.io.JalviewFileChooser chooser = new jalview.io.JalviewFileChooser(jalview.bin.Cache.getProperty(\r
-          "LAST_DIRECTORY"),\r
-              new String[]{"png"},\r
-              new String[]{"Portable network graphics"},\r
-              "Portable network graphics");\r
+      jalview.io.JalviewFileChooser chooser = new jalview.io.JalviewFileChooser(\r
+          jalview.bin.Cache.getProperty(\r
+              "LAST_DIRECTORY"), new String[]\r
+          {"png"},\r
+          new String[]\r
+          {"Portable network graphics"},\r
+          "Portable network graphics");\r
       chooser.setFileView(new jalview.io.JalviewFileView());\r
       chooser.setDialogTitle("Create EPS file from alignment");\r
       chooser.setToolTipText("Save");\r
 \r
       int value = chooser.showSaveDialog(this);\r
+\r
       if (value != jalview.io.JalviewFileChooser.APPROVE_OPTION)\r
+      {\r
         return;\r
+      }\r
+\r
+      jalview.bin.Cache.setProperty("LAST_DIRECTORY",\r
+                                    chooser.getSelectedFile().getParent());\r
 \r
-      jalview.bin.Cache.setProperty("LAST_DIRECTORY",chooser.getSelectedFile().getParent());\r
       FileOutputStream out = new FileOutputStream(chooser.getSelectedFile());\r
 \r
-      BufferedImage bi = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);\r
-      Graphics2D png = (Graphics2D)bi.getGraphics();\r
+      BufferedImage bi = new BufferedImage(width, height,\r
+                                           BufferedImage.TYPE_INT_RGB);\r
+      Graphics2D png = (Graphics2D) bi.getGraphics();\r
 \r
-      png.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);\r
+      png.setRenderingHint(RenderingHints.KEY_ANTIALIASING,\r
+                           RenderingHints.VALUE_ANTIALIAS_ON);\r
 \r
-        if (av.getWrapAlignment())\r
-          printWrappedAlignment(png, width, height, 0);\r
-        else\r
-          printUnwrapped(png, width, height, 0);\r
+      if (av.getWrapAlignment())\r
+      {\r
+        printWrappedAlignment(png, width, height, 0);\r
+      }\r
+      else\r
+      {\r
+        printUnwrapped(png, width, height, 0);\r
+      }\r
 \r
-        ImageIO.write(bi, "png", out);\r
-        out.close();\r
+      ImageIO.write(bi, "png", out);\r
+      out.close();\r
     }\r
     catch (Exception ex)\r
     {\r
       ex.printStackTrace();\r
     }\r
   }\r
-\r
 }\r
 \r
-class Preview extends JFrame\r
+class Preview\r
+    extends JFrame\r
 {\r
-\r
   public Preview(Image image)\r
   {\r
     setResizable(true);\r
@@ -691,22 +797,25 @@ class Preview extends JFrame
   }\r
 }\r
 \r
-class PreviewPanel extends JPanel\r
+class PreviewPanel\r
+    extends JPanel\r
 {\r
   Image image;\r
+\r
   public PreviewPanel(Image image)\r
   {\r
     this.image = image;\r
   }\r
+\r
   public void paintComponent(Graphics g)\r
   {\r
-    if(image!=null)\r
-      g.drawImage(image,0,0,this);\r
+    if (image != null)\r
+    {\r
+      g.drawImage(image, 0, 0, this);\r
+    }\r
     else\r
+    {\r
       System.out.println("DEBUG:image is null");\r
+    }\r
   }\r
 }\r
-\r
-\r
-\r
-\r
index f2603ea..1b9fd8f 100755 (executable)
@@ -1,44 +1,45 @@
-\r
 /*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 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
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
+ */\r
 package jalview.gui;\r
 \r
-import javax.swing.*;\r
-import java.awt.event.*;\r
 import java.awt.*;\r
+import java.awt.event.*;\r
 import java.awt.image.*;\r
+import javax.swing.*;\r
+\r
 import jalview.datamodel.*;\r
-import jalview.io.FormatAdapter;\r
 \r
-public class AnnotationLabels extends JPanel implements MouseListener, MouseMotionListener, ActionListener\r
+public class AnnotationLabels\r
+    extends JPanel implements MouseListener,\r
+    MouseMotionListener, ActionListener\r
 {\r
-  boolean active = false;\r
-  Image image;\r
-  AlignmentPanel ap ;\r
-  boolean resizing = false;\r
-  int oldY, mouseX;\r
   static String ADDNEW = "Add New Row";\r
   static String HIDE = "Hide This Row";\r
   static String DELETE = "Delete This Row";\r
-  static String SHOWALL="Show All Hidden Rows";\r
-  static String OUTPUT_TEXT="Show Values In Textbox";\r
+  static String SHOWALL = "Show All Hidden Rows";\r
+  static String OUTPUT_TEXT = "Show Values In Textbox";\r
+  boolean active = false;\r
+  Image image;\r
+  AlignmentPanel ap;\r
+  boolean resizing = false;\r
+  int oldY;\r
+  int mouseX;\r
   int selectedRow = 0;\r
   int scrollOffset = 0;\r
 \r
@@ -48,8 +49,11 @@ public class AnnotationLabels extends JPanel implements MouseListener, MouseMoti
 \r
     java.net.URL url = getClass().getResource("/images/idwidth.gif");\r
     Image temp = null;\r
+\r
     if (url != null)\r
+    {\r
       temp = java.awt.Toolkit.getDefaultToolkit().createImage(url);\r
+    }\r
 \r
     try\r
     {\r
@@ -57,9 +61,12 @@ public class AnnotationLabels extends JPanel implements MouseListener, MouseMoti
       mt.addImage(temp, 0);\r
       mt.waitForID(0);\r
     }\r
-    catch (Exception ex) {}\r
+    catch (Exception ex)\r
+    {\r
+    }\r
 \r
-    BufferedImage bi = new BufferedImage(temp.getHeight(this), temp.getWidth(this),\r
+    BufferedImage bi = new BufferedImage(temp.getHeight(this),\r
+                                         temp.getWidth(this),\r
                                          BufferedImage.TYPE_INT_RGB);\r
     Graphics2D g = (Graphics2D) bi.getGraphics();\r
     g.rotate(Math.toRadians(90));\r
@@ -80,126 +87,175 @@ public class AnnotationLabels extends JPanel implements MouseListener, MouseMoti
   {\r
     AlignmentAnnotation[] aa = ap.av.alignment.getAlignmentAnnotation();\r
 \r
-    if(evt.getActionCommand().equals(ADDNEW))\r
+    if (evt.getActionCommand().equals(ADDNEW))\r
     {\r
-      String label = JOptionPane.showInputDialog(this, "Label for annotation");\r
-      if(label==null)\r
+      String label = JOptionPane.showInputDialog(this,\r
+                                                 "Label for annotation");\r
+\r
+      if (label == null)\r
+      {\r
         label = "";\r
-      ap.av.alignment.addAnnotation(new AlignmentAnnotation\r
-                                      (label,\r
-                                       "New description",\r
-                                       new Annotation[ap.av.alignment.getWidth()]));\r
+      }\r
+\r
+      ap.av.alignment.addAnnotation(new AlignmentAnnotation(label,\r
+          "New description",\r
+          new Annotation[ap.av.alignment.getWidth()]));\r
+    }\r
+    else if (evt.getActionCommand().equals(HIDE))\r
+    {\r
+      aa[selectedRow].visible = false;\r
+\r
+      if (aa[selectedRow].label.equals("Conservation"))\r
+      {\r
+        ap.av.showConservation = false;\r
+      }\r
+\r
+      if (aa[selectedRow].label.equals("Quality"))\r
+      {\r
+        ap.av.showQuality = false;\r
+      }\r
+\r
+      if (aa[selectedRow].label.equals("Consensus"))\r
+      {\r
+        ap.av.showIdentity = false;\r
+      }\r
+    }\r
+    else if (evt.getActionCommand().equals(DELETE))\r
+    {\r
+      ap.av.alignment.deleteAnnotation(aa[selectedRow]);\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();\r
+      Desktop.addInternalFrame(cap,\r
+                               ap.alignFrame.getTitle() + " - " +\r
+                               aa[selectedRow].label, 500,\r
+                               100);\r
+      cap.setText(aa[selectedRow].toString());\r
     }\r
-   else if(evt.getActionCommand().equals(HIDE))\r
-   {\r
-     aa[selectedRow].visible = false;\r
-     if(aa[selectedRow].label.equals("Conservation"))\r
-       ap.av.showConservation = false;\r
-     if(aa[selectedRow].label.equals("Quality"))\r
-       ap.av.showQuality = false;\r
-     if(aa[selectedRow].label.equals("Consensus"))\r
-       ap.av.showIdentity = false;\r
-   }\r
-   else if(evt.getActionCommand().equals(DELETE))\r
-   {\r
-     ap.av.alignment.deleteAnnotation(aa[selectedRow]);\r
-   }\r
-   else if(evt.getActionCommand().equals(SHOWALL))\r
-   {\r
-       for(int i=0; i<aa.length; i++)\r
-         aa[i].visible = true;\r
-   }\r
-   else if(evt.getActionCommand().equals(OUTPUT_TEXT))\r
-   {\r
-     CutAndPasteTransfer cap = new CutAndPasteTransfer();\r
-     Desktop.addInternalFrame(cap, ap.alignFrame.getTitle()+" - "+ aa[selectedRow].label, 500, 100);\r
-     cap.setText( aa[selectedRow].toString() );\r
-   }\r
-\r
-   ap.annotationPanel.adjustPanelHeight();\r
-   ap.repaint();\r
 \r
+    ap.annotationPanel.adjustPanelHeight();\r
+    ap.repaint();\r
   }\r
 \r
   public void mousePressed(MouseEvent evt)\r
   {\r
     int y = evt.getY() - scrollOffset;\r
 \r
-      AlignmentAnnotation[] aa = ap.av.alignment.getAlignmentAnnotation();\r
-       if(aa==null || aa.length==0)\r
-       {\r
-            JPopupMenu pop = new JPopupMenu("Annotations");\r
-            JMenuItem item = new JMenuItem(ADDNEW);\r
-            item.addActionListener(this);\r
-            pop.add(item);\r
-            pop.show(this, evt.getX(), evt.getY());\r
-            return;\r
-       }\r
-\r
-       int height = 0;\r
-       for (int i = 0; i < aa.length; i++)\r
-       {\r
-         if(!aa[i].visible)\r
-           continue;\r
-\r
-         height += aa[i].height;\r
-         if(y<height)\r
-         {\r
-           selectedRow = i;\r
-           break;\r
-         }\r
-       }\r
+    AlignmentAnnotation[] aa = ap.av.alignment.getAlignmentAnnotation();\r
 \r
+    if ( (aa == null) || (aa.length == 0))\r
+    {\r
       JPopupMenu pop = new JPopupMenu("Annotations");\r
       JMenuItem item = new JMenuItem(ADDNEW);\r
       item.addActionListener(this);\r
       pop.add(item);\r
-      item = new JMenuItem(HIDE);\r
-      item.addActionListener(this);\r
-      pop.add(item);\r
-      item = new JMenuItem(DELETE);\r
-      item.addActionListener(this);\r
-      pop.add(item);\r
-      item = new JMenuItem(SHOWALL);\r
-      item.addActionListener(this);\r
-      pop.add(item);\r
-      item = new JMenuItem(OUTPUT_TEXT);\r
-      item.addActionListener(this);\r
-      pop.add(item);\r
       pop.show(this, evt.getX(), evt.getY());\r
 \r
+      return;\r
+    }\r
+\r
+    int height = 0;\r
+\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
+\r
+      if (y < height)\r
+      {\r
+        selectedRow = i;\r
+\r
+        break;\r
+      }\r
+    }\r
+\r
+    JPopupMenu pop = new JPopupMenu("Annotations");\r
+    JMenuItem item = new JMenuItem(ADDNEW);\r
+    item.addActionListener(this);\r
+    pop.add(item);\r
+    item = new JMenuItem(HIDE);\r
+    item.addActionListener(this);\r
+    pop.add(item);\r
+    item = new JMenuItem(DELETE);\r
+    item.addActionListener(this);\r
+    pop.add(item);\r
+    item = new JMenuItem(SHOWALL);\r
+    item.addActionListener(this);\r
+    pop.add(item);\r
+    item = new JMenuItem(OUTPUT_TEXT);\r
+    item.addActionListener(this);\r
+    pop.add(item);\r
+    pop.show(this, evt.getX(), evt.getY());\r
+\r
     oldY = evt.getY();\r
   }\r
 \r
-  public void mouseReleased(MouseEvent evt){ active = false; repaint(); }\r
-  public void mouseEntered(MouseEvent evt) { active = true;  repaint();}\r
-  public void mouseExited(MouseEvent evt)  { active = false; repaint();}\r
+  public void mouseReleased(MouseEvent evt)\r
+  {\r
+    active = false;\r
+    repaint();\r
+  }\r
+\r
+  public void mouseEntered(MouseEvent evt)\r
+  {\r
+    active = true;\r
+    repaint();\r
+  }\r
+\r
+  public void mouseExited(MouseEvent evt)\r
+  {\r
+    active = false;\r
+    repaint();\r
+  }\r
+\r
   public void mouseDragged(MouseEvent evt)\r
   {\r
     active = true;\r
+\r
     Dimension d = ap.annotationScroller.getPreferredSize();\r
     int dif = evt.getY() - oldY;\r
 \r
     dif /= ap.av.charHeight;\r
     dif *= ap.av.charHeight;\r
 \r
-    if(d.height-dif>20)\r
+    if ( (d.height - dif) > 20)\r
     {\r
-      ap.annotationScroller.setPreferredSize(new Dimension(d.width,d.height - dif));\r
+      ap.annotationScroller.setPreferredSize(new Dimension(d.width,\r
+          d.height - dif));\r
       d = ap.annotationSpaceFillerHolder.getPreferredSize();\r
-      ap.annotationSpaceFillerHolder.setPreferredSize(new Dimension(d.width,d.height - dif));\r
+      ap.annotationSpaceFillerHolder.setPreferredSize(new Dimension(\r
+          d.width, d.height - dif));\r
       ap.repaint();\r
     }\r
+\r
     ap.addNotify();\r
   }\r
 \r
-  public void mouseMoved(MouseEvent evt)   {}\r
-  public void mouseClicked(MouseEvent evt) {}\r
+  public void mouseMoved(MouseEvent evt)\r
+  {\r
+  }\r
+\r
+  public void mouseClicked(MouseEvent evt)\r
+  {\r
+  }\r
 \r
   public void paintComponent(Graphics g1)\r
   {\r
-    Graphics2D g = (Graphics2D)g1;\r
-    g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);\r
+    Graphics2D g = (Graphics2D) g1;\r
+    g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,\r
+                       RenderingHints.VALUE_ANTIALIAS_ON);\r
 \r
     drawComponent(g);\r
   }\r
@@ -208,48 +264,56 @@ public class AnnotationLabels extends JPanel implements MouseListener, MouseMoti
   {\r
     FontMetrics fm = g.getFontMetrics(g.getFont());\r
     g.setColor(Color.white);\r
-    g.fillRect(0,0, getWidth(), getHeight());\r
+    g.fillRect(0, 0, getWidth(), getHeight());\r
 \r
     g.translate(0, scrollOffset);\r
     g.setColor(Color.black);\r
 \r
-   AlignmentAnnotation[] aa = ap.av.alignment.getAlignmentAnnotation();\r
-   int y = g.getFont().getSize();\r
-   int x = 0;\r
-\r
-   if(aa!=null)\r
-   for(int i=0; i<aa.length; i++)\r
-   {\r
-     if(!aa[i].visible)\r
-       continue;\r
-\r
-     x = getWidth() - fm.stringWidth(aa[i].label)-3;\r
-\r
-     if(aa[i].isGraph)\r
-       y+=(aa[i].height/3);\r
-\r
-     g.drawString(aa[i].label, x, y);\r
-\r
-     if(aa[i].isGraph)\r
-       y+=(2*aa[i].height/3);\r
-    else\r
-       y+=aa[i].height;\r
-   }\r
-\r
-   if (active)\r
-   {\r
-     if (image != null)\r
-       g.drawImage(image, 2, 0, this);\r
-   }\r
-\r
-   if (aa == null || aa.length<1)\r
-   {\r
-     g.drawString("Right click", 2, 8);\r
-     g.drawString("to add annotation", 2, 18);\r
-   }\r
+    AlignmentAnnotation[] aa = ap.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 = getWidth() - fm.stringWidth(aa[i].label) - 3;\r
+\r
+        if (aa[i].isGraph)\r
+        {\r
+          y += (aa[i].height / 3);\r
+        }\r
+\r
+        g.drawString(aa[i].label, x, y);\r
+\r
+        if (aa[i].isGraph)\r
+        {\r
+          y += ( (2 * aa[i].height) / 3);\r
+        }\r
+        else\r
+        {\r
+          y += aa[i].height;\r
+        }\r
+      }\r
+    }\r
 \r
+    if (active)\r
+    {\r
+      if (image != null)\r
+      {\r
+        g.drawImage(image, 2, 0, this);\r
+      }\r
+    }\r
 \r
+    if ( (aa == null) || (aa.length < 1))\r
+    {\r
+      g.drawString("Right click", 2, 8);\r
+      g.drawString("to add annotation", 2, 18);\r
+    }\r
   }\r
-\r
 }\r
index 41bbb43..449c449 100755 (executable)
@@ -1,59 +1,55 @@
 /*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 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
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
+ */\r
 package jalview.gui;\r
 \r
-import jalview.datamodel.*;\r
+import java.util.*;\r
 \r
-import javax.swing.*;\r
 import java.awt.*;\r
 import java.awt.event.*;\r
-import java.util.*;\r
 import java.awt.image.*;\r
+import javax.swing.*;\r
 \r
-public class AnnotationPanel extends JPanel implements MouseListener, MouseMotionListener, ActionListener, AdjustmentListener\r
-{\r
-  AlignViewport av;\r
-  AlignmentPanel ap;\r
-  int activeRow =-1;\r
+import jalview.datamodel.*;\r
 \r
-  ArrayList activeRes;\r
-  static String HELIX ="Helix";\r
-  static String SHEET ="Sheet";\r
-  static String LABEL ="Label";\r
-  static String REMOVE="Remove Annotation";\r
-  static String COLOUR="Colour";\r
+public class AnnotationPanel\r
+    extends JPanel implements MouseListener,\r
+    MouseMotionListener, ActionListener, AdjustmentListener\r
+{\r
+  static String HELIX = "Helix";\r
+  static String SHEET = "Sheet";\r
+  static String LABEL = "Label";\r
+  static String REMOVE = "Remove Annotation";\r
+  static String COLOUR = "Colour";\r
   static Color HELIX_COLOUR = Color.red.darker();\r
   static Color SHEET_COLOUR = Color.green.darker().darker();\r
 \r
-\r
+  public static int GRAPH_HEIGHT = 40;\r
+  AlignViewport av;\r
+  AlignmentPanel ap;\r
+  int activeRow = -1;\r
+  ArrayList activeRes;\r
   BufferedImage image;\r
   Graphics2D gg;\r
   FontMetrics fm;\r
-  int imgWidth=0;\r
-\r
+  int imgWidth = 0;\r
   boolean fastPaint = false;\r
 \r
-  public static int GRAPH_HEIGHT = 40;\r
-\r
-\r
-\r
   public AnnotationPanel(AlignmentPanel ap)\r
   {\r
     this.ap = ap;\r
@@ -63,13 +59,12 @@ public class AnnotationPanel extends JPanel implements MouseListener, MouseMotio
     addMouseMotionListener(this);\r
     adjustPanelHeight();\r
 \r
-\r
-    ap.annotationScroller.getVerticalScrollBar().addAdjustmentListener( this );\r
+    ap.annotationScroller.getVerticalScrollBar().addAdjustmentListener(this);\r
   }\r
 \r
   public void adjustmentValueChanged(AdjustmentEvent evt)\r
   {\r
-    ap.alabels.setScrollOffset( -evt.getValue() );\r
+    ap.alabels.setScrollOffset( -evt.getValue());\r
   }\r
 \r
   public void adjustPanelHeight()\r
@@ -77,148 +72,199 @@ public class AnnotationPanel extends JPanel implements MouseListener, MouseMotio
     // setHeight of panels\r
     AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();\r
     int height = 0;\r
-    if(aa!=null)\r
-    for (int i = 0; i < aa.length; i++)\r
+\r
+    if (aa != null)\r
     {\r
-      if(!aa[i].visible)\r
-        continue;\r
+      for (int i = 0; i < aa.length; i++)\r
+      {\r
+        if (!aa[i].visible)\r
+        {\r
+          continue;\r
+        }\r
 \r
-      aa[i].height = 0;\r
+        aa[i].height = 0;\r
 \r
-      if(aa[i].hasText)\r
-        aa[i].height += av.charHeight;\r
-      if (aa[i].hasIcons)\r
-        aa[i].height += 16;\r
+        if (aa[i].hasText)\r
+        {\r
+          aa[i].height += av.charHeight;\r
+        }\r
+\r
+        if (aa[i].hasIcons)\r
+        {\r
+          aa[i].height += 16;\r
+        }\r
 \r
-      if (aa[i].isGraph)\r
-        aa[i].height += GRAPH_HEIGHT;\r
+        if (aa[i].isGraph)\r
+        {\r
+          aa[i].height += GRAPH_HEIGHT;\r
+        }\r
 \r
-      if(aa[i].height==0)\r
-        aa[i].height = 20;\r
-      height += aa[i].height;\r
+        if (aa[i].height == 0)\r
+        {\r
+          aa[i].height = 20;\r
+        }\r
+\r
+        height += aa[i].height;\r
+      }\r
+    }\r
+    else\r
+    {\r
+      height = 20;\r
     }\r
-  else height=20;\r
-    this.setPreferredSize(new Dimension(1, height));\r
 \r
+    this.setPreferredSize(new Dimension(1, height));\r
   }\r
 \r
   public void addEditableColumn(int i)\r
   {\r
-    if(activeRow==-1)\r
+    if (activeRow == -1)\r
     {\r
-      AlignmentAnnotation [] aa = av.alignment.getAlignmentAnnotation();\r
-      for(int j=0; j<aa.length; j++)\r
-        if(aa[j].editable)\r
+      AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();\r
+\r
+      for (int j = 0; j < aa.length; j++)\r
+      {\r
+        if (aa[j].editable)\r
         {\r
           activeRow = j;\r
+\r
           break;\r
         }\r
+      }\r
     }\r
 \r
-    if(activeRes==null)\r
+    if (activeRes == null)\r
     {\r
       activeRes = new ArrayList();\r
       activeRes.add(String.valueOf(i));\r
+\r
       return;\r
     }\r
 \r
     activeRes.add(String.valueOf(i));\r
-\r
   }\r
 \r
-\r
   public void actionPerformed(ActionEvent evt)\r
   {\r
+    AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();\r
+    Annotation[] anot = aa[activeRow].annotations;\r
 \r
-    AlignmentAnnotation [] aa = av.alignment.getAlignmentAnnotation();\r
-    Annotation [] anot = aa[activeRow].annotations;\r
-\r
-    if(evt.getActionCommand().equals(REMOVE))\r
+    if (evt.getActionCommand().equals(REMOVE))\r
     {\r
-      for(int i=0; i<activeRes.size(); i++)\r
+      for (int i = 0; i < activeRes.size(); i++)\r
       {\r
         anot[Integer.parseInt(activeRes.get(i).toString())] = null;\r
         anot[Integer.parseInt(activeRes.get(i).toString())] = null;\r
       }\r
     }\r
-    else if(evt.getActionCommand().equals(LABEL))\r
+    else if (evt.getActionCommand().equals(LABEL))\r
     {\r
-      String label = JOptionPane.showInputDialog(this, "Enter Label ", "Enter label", JOptionPane.QUESTION_MESSAGE );\r
-      if(label==null)\r
+      String label = JOptionPane.showInputDialog(this, "Enter Label ",\r
+                                                 "Enter label",\r
+                                                 JOptionPane.QUESTION_MESSAGE);\r
+\r
+      if (label == null)\r
+      {\r
         label = "";\r
+      }\r
 \r
-      if(label.length()>0 && !aa[activeRow].hasText)\r
-       aa[activeRow].hasText = true;\r
+      if ( (label.length() > 0) && !aa[activeRow].hasText)\r
+      {\r
+        aa[activeRow].hasText = true;\r
+      }\r
 \r
-      for(int i=0; i<activeRes.size(); i++)\r
+      for (int i = 0; i < activeRes.size(); i++)\r
       {\r
         int index = Integer.parseInt(activeRes.get(i).toString());\r
-        if(anot[index]==null)\r
-          anot[index] = new Annotation(label, "", ' ',0);\r
+\r
+        if (anot[index] == null)\r
+        {\r
+          anot[index] = new Annotation(label, "", ' ', 0);\r
+        }\r
+\r
         anot[index].displayCharacter = label;\r
       }\r
     }\r
-    else if(evt.getActionCommand().equals(COLOUR))\r
+    else if (evt.getActionCommand().equals(COLOUR))\r
     {\r
-     Color col = JColorChooser.showDialog(this, "Choose foreground colour", Color.black);\r
-     for (int i = 0; i < activeRes.size(); i++)\r
-     {\r
-       int index = Integer.parseInt(activeRes.get(i).toString());\r
-       if (anot[index] == null)\r
-         anot[index] = new Annotation("", "", ' ', 0);\r
-       anot[index].colour = col;\r
-     }\r
+      Color col = JColorChooser.showDialog(this,\r
+                                           "Choose foreground colour",\r
+                                           Color.black);\r
+\r
+      for (int i = 0; i < activeRes.size(); i++)\r
+      {\r
+        int index = Integer.parseInt(activeRes.get(i).toString());\r
+\r
+        if (anot[index] == null)\r
+        {\r
+          anot[index] = new Annotation("", "", ' ', 0);\r
+        }\r
+\r
+        anot[index].colour = col;\r
+      }\r
     }\r
     else // HELIX OR SHEET\r
     {\r
-    char type = 0;\r
-    String symbol = "\u03B1";\r
-    if(evt.getActionCommand().equals(HELIX))\r
-       type = 'H';\r
-    else if(evt.getActionCommand().equals(SHEET))\r
-    {\r
-      type = 'E';\r
-      symbol = "\u03B2";\r
-    }\r
+      char type = 0;\r
+      String symbol = "\u03B1";\r
 \r
-    if(!aa[activeRow].hasIcons)\r
-      aa[activeRow].hasIcons = true;\r
+      if (evt.getActionCommand().equals(HELIX))\r
+      {\r
+        type = 'H';\r
+      }\r
+      else if (evt.getActionCommand().equals(SHEET))\r
+      {\r
+        type = 'E';\r
+        symbol = "\u03B2";\r
+      }\r
 \r
+      if (!aa[activeRow].hasIcons)\r
+      {\r
+        aa[activeRow].hasIcons = true;\r
+      }\r
 \r
-    String label = JOptionPane.showInputDialog("Enter a label for the structure?", symbol );\r
-    if(label==null)\r
-       label="";\r
+      String label = JOptionPane.showInputDialog(\r
+          "Enter a label for the structure?",\r
+          symbol);\r
 \r
-    if(label.length()>0 && !aa[activeRow].hasText)\r
-       aa[activeRow].hasText = true;\r
+      if (label == null)\r
+      {\r
+        label = "";\r
+      }\r
 \r
-    for(int i=0; i<activeRes.size(); i++)\r
-    {\r
-      int index = Integer.parseInt(activeRes.get(i).toString());\r
-      if (anot[index] == null)\r
+      if ( (label.length() > 0) && !aa[activeRow].hasText)\r
       {\r
-        anot[index] = new Annotation(label, "", type, 0);\r
+        aa[activeRow].hasText = true;\r
       }\r
 \r
-        anot[ index ].secondaryStructure = type;\r
-        anot[ index ].displayCharacter = label;\r
-    }\r
+      for (int i = 0; i < activeRes.size(); i++)\r
+      {\r
+        int index = Integer.parseInt(activeRes.get(i).toString());\r
+\r
+        if (anot[index] == null)\r
+        {\r
+          anot[index] = new Annotation(label, "", type, 0);\r
+        }\r
+\r
+        anot[index].secondaryStructure = type;\r
+        anot[index].displayCharacter = label;\r
+      }\r
     }\r
 \r
     adjustPanelHeight();\r
     activeRes = null;\r
     repaint();\r
-    return;\r
-\r
 \r
+    return;\r
   }\r
 \r
   public void mousePressed(MouseEvent evt)\r
   {\r
     if (SwingUtilities.isRightMouseButton(evt))\r
     {\r
-      if(activeRes==null)\r
+      if (activeRes == null)\r
+      {\r
         return;\r
+      }\r
 \r
       JPopupMenu pop = new JPopupMenu("Structure type");\r
       JMenuItem item = new JMenuItem(HELIX);\r
@@ -237,371 +283,481 @@ public class AnnotationPanel extends JPanel implements MouseListener, MouseMotio
       item.addActionListener(this);\r
       pop.add(item);\r
       pop.show(this, evt.getX(), evt.getY());\r
+\r
       return;\r
     }\r
 \r
+    AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();\r
 \r
-    AlignmentAnnotation [] aa = av.alignment.getAlignmentAnnotation();\r
-    if(aa==null)\r
+    if (aa == null)\r
+    {\r
       return;\r
+    }\r
 \r
     int height = 0;\r
     activeRow = -1;\r
-    for(int i=0; i<aa.length; i++)\r
+\r
+    for (int i = 0; i < aa.length; i++)\r
     {\r
-      height+= aa[i].height;\r
+      height += aa[i].height;\r
 \r
-      if(evt.getY()<height)\r
+      if (evt.getY() < height)\r
       {\r
-        if(!aa[i].editable)\r
+        if (!aa[i].editable)\r
         {\r
           activeRes = null;\r
+\r
           continue;\r
         }\r
 \r
         activeRow = i;\r
+\r
         break;\r
       }\r
     }\r
 \r
+    int res = (evt.getX() / av.getCharWidth()) + av.getStartRes();\r
 \r
-    int res = evt.getX() / av.getCharWidth() + av.getStartRes();\r
-\r
-    if(evt.isControlDown() || evt.isAltDown())\r
+    if (evt.isControlDown() || evt.isAltDown())\r
+    {\r
       addEditableColumn(res);\r
-\r
-    else if(evt.isShiftDown())\r
+    }\r
+    else if (evt.isShiftDown())\r
     {\r
-\r
-      if(activeRes==null)\r
-        activeRes=new ArrayList();\r
+      if (activeRes == null)\r
+      {\r
+        activeRes = new ArrayList();\r
+      }\r
       else\r
       {\r
-          int start =  Integer.parseInt( activeRes.get( activeRes.size()-1 ).toString() );\r
-          int end = res;\r
-          if(end<start)\r
-          {\r
-            int temp = end;\r
-            end = start;\r
-            start = temp;\r
-          }\r
-          for(int n=start; n<=end; n++)\r
-            addEditableColumn(n);\r
+        int start = Integer.parseInt(activeRes.get(activeRes.size() -\r
+            1).toString());\r
+        int end = res;\r
 \r
+        if (end < start)\r
+        {\r
+          int temp = end;\r
+          end = start;\r
+          start = temp;\r
+        }\r
+\r
+        for (int n = start; n <= end; n++)\r
+        {\r
+          addEditableColumn(n);\r
+        }\r
       }\r
     }\r
     else\r
     {\r
-        activeRes = new ArrayList();\r
-        activeRes.add( String.valueOf(res) );\r
+      activeRes = new ArrayList();\r
+      activeRes.add(String.valueOf(res));\r
     }\r
 \r
     repaint();\r
-\r
   }\r
+\r
   public void mouseReleased(MouseEvent evt)\r
-  {  }\r
+  {\r
+  }\r
+\r
   public void mouseEntered(MouseEvent evt)\r
-  {  }\r
+  {\r
+  }\r
+\r
   public void mouseExited(MouseEvent evt)\r
-  {  }\r
+  {\r
+  }\r
+\r
   public void mouseDragged(MouseEvent evt)\r
-  {  }\r
+  {\r
+  }\r
+\r
   public void mouseMoved(MouseEvent evt)\r
   {\r
     ToolTipManager.sharedInstance().registerComponent(this);\r
-    AlignmentAnnotation [] aa = av.alignment.getAlignmentAnnotation();\r
-    if(aa==null)\r
+\r
+    AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();\r
+\r
+    if (aa == null)\r
+    {\r
       return;\r
+    }\r
 \r
     int row = -1;\r
-    int height=0;\r
-    for(int i=0; i<aa.length; i++)\r
-    {\r
+    int height = 0;\r
 \r
-      if( aa[i].visible )\r
+    for (int i = 0; i < aa.length; i++)\r
+    {\r
+      if (aa[i].visible)\r
+      {\r
         height += aa[i].height;\r
+      }\r
 \r
-      if(evt.getY()<height)\r
+      if (evt.getY() < height)\r
       {\r
         row = i;\r
+\r
         break;\r
       }\r
     }\r
 \r
-    int res = evt.getX() / av.getCharWidth() + av.getStartRes();\r
-    if(row>-1 && res<aa[row].annotations.length && aa[row].annotations[res]!=null)\r
+    int res = (evt.getX() / av.getCharWidth()) + av.getStartRes();\r
+\r
+    if ( (row > -1) && (res < aa[row].annotations.length) &&\r
+        (aa[row].annotations[res] != null))\r
     {\r
       this.setToolTipText(aa[row].annotations[res].description);\r
-      StringBuffer text = new StringBuffer("Sequence position " + (res + 1) +\r
-                                           "  " +\r
+\r
+      StringBuffer text = new StringBuffer("Sequence position " +\r
+                                           (res + 1) + "  " +\r
                                            aa[row].annotations[res].description);\r
       ap.alignFrame.statusBar.setText(text.toString());\r
     }\r
-\r
-\r
   }\r
-  public void mouseClicked(MouseEvent evt) {}\r
 \r
+  public void mouseClicked(MouseEvent evt)\r
+  {\r
+  }\r
 \r
   public void paintComponent(Graphics g)\r
   {\r
     g.setColor(Color.white);\r
-    g.fillRect(0,0,getWidth(), getHeight());\r
+    g.fillRect(0, 0, getWidth(), getHeight());\r
 \r
-    if(fastPaint)\r
+    if (fastPaint)\r
     {\r
       g.drawImage(image, 0, 0, this);\r
       fastPaint = false;\r
+\r
       return;\r
     }\r
 \r
-    imgWidth = (av.endRes-av.startRes+1) *av.charWidth;\r
+    imgWidth = (av.endRes - av.startRes + 1) * av.charWidth;\r
 \r
-    image = new BufferedImage(imgWidth,\r
-                                ap.annotationPanel.getHeight(),\r
-                                BufferedImage.TYPE_INT_RGB);\r
-      gg = (Graphics2D) image.getGraphics();\r
-      gg.setRenderingHint(RenderingHints.KEY_ANTIALIASING,\r
-                          RenderingHints.VALUE_ANTIALIAS_ON);\r
+    image = new BufferedImage(imgWidth, ap.annotationPanel.getHeight(),\r
+                              BufferedImage.TYPE_INT_RGB);\r
+    gg = (Graphics2D) image.getGraphics();\r
+    gg.setRenderingHint(RenderingHints.KEY_ANTIALIASING,\r
+                        RenderingHints.VALUE_ANTIALIAS_ON);\r
 \r
-      gg.setFont(av.getFont());\r
-      fm = gg.getFontMetrics();\r
-\r
-    drawComponent( gg, av.startRes, av.endRes+1);\r
-    g.drawImage( image, 0, 0, this);\r
+    gg.setFont(av.getFont());\r
+    fm = gg.getFontMetrics();\r
 \r
+    drawComponent(gg, av.startRes, av.endRes + 1);\r
+    g.drawImage(image, 0, 0, this);\r
   }\r
 \r
   public void fastPaint(int horizontal)\r
-{\r
-  if( horizontal == 0\r
-     || av.alignment.getAlignmentAnnotation()==null\r
-     || av.alignment.getAlignmentAnnotation().length<1\r
-    )\r
   {\r
-    repaint();\r
-    return;\r
-  }\r
+    if ( (horizontal == 0) ||\r
+        (av.alignment.getAlignmentAnnotation() == null) ||\r
+        (av.alignment.getAlignmentAnnotation().length < 1))\r
+    {\r
+      repaint();\r
 \r
-  gg.copyArea( 0,0, imgWidth, getHeight(), -horizontal*av.charWidth, 0 );\r
-  int sr=av.startRes, er=av.endRes+1, transX=0;\r
+      return;\r
+    }\r
 \r
-  if(horizontal>0) // scrollbar pulled right, image to the left\r
-  {\r
-    transX =  (er-sr-horizontal)*av.charWidth;\r
-    sr = er - horizontal ;\r
-  }\r
-  else if(horizontal<0)\r
-  {\r
-    er = sr-horizontal;\r
-  }\r
+    gg.copyArea(0, 0, imgWidth, getHeight(), -horizontal * av.charWidth, 0);\r
 \r
+    int sr = av.startRes;\r
+    int er = av.endRes + 1;\r
+    int transX = 0;\r
 \r
-  gg.translate(transX, 0);\r
+    if (horizontal > 0) // scrollbar pulled right, image to the left\r
+    {\r
+      transX = (er - sr - horizontal) * av.charWidth;\r
+      sr = er - horizontal;\r
+    }\r
+    else if (horizontal < 0)\r
+    {\r
+      er = sr - horizontal;\r
+    }\r
 \r
-  drawComponent(gg, sr, er);\r
+    gg.translate(transX, 0);\r
 \r
-  gg.translate( -transX, 0 );\r
+    drawComponent(gg, sr, er);\r
 \r
-  fastPaint = true;\r
-  repaint();\r
-}\r
+    gg.translate( -transX, 0);\r
 \r
+    fastPaint = true;\r
+    repaint();\r
+  }\r
 \r
   public void drawComponent(Graphics2D g, int startRes, int endRes)\r
   {\r
     g.setColor(Color.white);\r
-    g.fillRect(0,0,(endRes-startRes) *av.charWidth, getHeight());\r
-    if(av.alignment.getAlignmentAnnotation()==null || av.alignment.getAlignmentAnnotation().length<1)\r
+    g.fillRect(0, 0, (endRes - startRes) * av.charWidth, getHeight());\r
+\r
+    if ( (av.alignment.getAlignmentAnnotation() == null) ||\r
+        (av.alignment.getAlignmentAnnotation().length < 1))\r
     {\r
       g.setColor(Color.white);\r
-      g.fillRect(0,0,getWidth(), getHeight());\r
+      g.fillRect(0, 0, getWidth(), getHeight());\r
       g.setColor(Color.black);\r
-      g.drawString("Alignment has no annotations",20,15);\r
+      g.drawString("Alignment has no annotations", 20, 15);\r
+\r
       return;\r
     }\r
 \r
-    AlignmentAnnotation [] aa = av.alignment.getAlignmentAnnotation();\r
+    AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();\r
 \r
-    int j, x=0, y=0;\r
-    char [] lastSS = new char[aa.length];\r
-    int  [] lastSSX= new int[aa.length] ;\r
-    int iconOffset = av.charHeight/2;\r
+    int j;\r
+    int x = 0;\r
+    int y = 0;\r
+    char[] lastSS = new char[aa.length];\r
+    int[] lastSSX = new int[aa.length];\r
+    int iconOffset = av.charHeight / 2;\r
     boolean validRes = false;\r
-    //\u03B2 \u03B1\r
 \r
-    for(int i=0; i<aa.length; i++)\r
+    //\u03B2 \u03B1\r
+    for (int i = 0; i < aa.length; i++)\r
     {\r
       AlignmentAnnotation row = aa[i];\r
-      if(!row.visible)\r
+\r
+      if (!row.visible)\r
+      {\r
         continue;\r
+      }\r
 \r
-      if(row.isGraph)\r
+      if (row.isGraph)\r
       {\r
         // this is so that we draw the characters below the graph\r
         y += row.height;\r
-        if(row.hasText)\r
+\r
+        if (row.hasText)\r
+        {\r
           y -= av.charHeight;\r
+        }\r
+      }\r
+\r
+      if (row.hasText)\r
+      {\r
+        iconOffset = av.charHeight / 2;\r
       }\r
-      if(row.hasText)\r
-        iconOffset = av.charHeight/2;\r
       else\r
+      {\r
         iconOffset = 0;\r
+      }\r
 \r
-      for(j=startRes; j<endRes; j++)\r
+      for (j = startRes; j < endRes; j++)\r
       {\r
-        if(row.annotations.length<=j || row.annotations[j]==null)\r
-        validRes = false;\r
-       else\r
-         validRes = true;\r
-\r
-       x = (j-startRes)*av.charWidth;\r
+        if ( (row.annotations.length <= j) ||\r
+            (row.annotations[j] == null))\r
+        {\r
+          validRes = false;\r
+        }\r
+        else\r
+        {\r
+          validRes = true;\r
+        }\r
 \r
+        x = (j - startRes) * av.charWidth;\r
 \r
-       if(activeRow==i)\r
-       {\r
+        if (activeRow == i)\r
+        {\r
+          g.setColor(Color.red);\r
 \r
-         g.setColor(Color.red);\r
+          if (activeRes != null)\r
+          {\r
+            for (int n = 0; n < activeRes.size(); n++)\r
+            {\r
+              int v = Integer.parseInt(activeRes.get(n).toString());\r
+\r
+              if (v == j)\r
+              {\r
+                g.fillRect( (j - startRes) * av.charWidth, y,\r
+                           av.charWidth, row.height);\r
+              }\r
+            }\r
+          }\r
+        }\r
 \r
-         if(activeRes!=null)\r
-           for (int n = 0; n < activeRes.size(); n++)\r
-           {\r
-             int v = Integer.parseInt(activeRes.get(n).toString()) ;\r
-             if (v == j)\r
-               g.fillRect( (j-startRes) * av.charWidth, y, av.charWidth, row.height);\r
-           }\r
-       }\r
+        if (validRes &&\r
+            (row.annotations[j].displayCharacter.length() > 0))\r
+        {\r
+          int charOffset = (av.charWidth -\r
+                            fm.charWidth(row.annotations[j].displayCharacter.\r
+                                         charAt(\r
+                                             0))) / 2;\r
+          g.setColor(row.annotations[j].colour);\r
 \r
+          if (j == 0)\r
+          {\r
+            if ( (row.annotations[0].secondaryStructure == 'H') ||\r
+                (row.annotations[0].secondaryStructure == 'E'))\r
+            {\r
+              g.drawString(row.annotations[j].displayCharacter,\r
+                           x, y + iconOffset + 2);\r
+            }\r
+          }\r
+          else if ( ( (row.annotations[j].secondaryStructure == 'H') ||\r
+                     (row.annotations[j].secondaryStructure == 'E')) &&\r
+                   ( (row.annotations[j - 1] == null) ||\r
+                    (row.annotations[j].secondaryStructure != row.annotations[j -\r
+                     1].secondaryStructure)))\r
+          {\r
+            g.drawString(row.annotations[j].displayCharacter, x,\r
+                         y + iconOffset + 2);\r
+          }\r
 \r
+          if (!row.hasIcons)\r
+          {\r
+            g.drawString(row.annotations[j].displayCharacter,\r
+                         x + charOffset, y + iconOffset + 2);\r
+          }\r
+        }\r
 \r
-       if(validRes && row.annotations[j].displayCharacter.length()>0)\r
-       {\r
-         int charOffset = (av.charWidth - fm.charWidth(row.annotations[j].displayCharacter.charAt(0)))/2;\r
-         g.setColor( row.annotations[j].colour);\r
-          if(j==0)\r
+        if (row.hasIcons)\r
+        {\r
+          if (!validRes ||\r
+              (row.annotations[j].secondaryStructure != lastSS[i]))\r
           {\r
-            if (row.annotations[0].secondaryStructure == 'H'\r
-                || row.annotations[0].secondaryStructure == 'E')\r
-              g.drawString(row.annotations[j].displayCharacter, x,\r
-                           y + iconOffset + 2);\r
+            switch (lastSS[i])\r
+            {\r
+              case 'H':\r
+                g.setColor(HELIX_COLOUR);\r
+                g.fillRoundRect(lastSSX[i], y + 4 + iconOffset,\r
+                                x - lastSSX[i], 7, 8, 8);\r
+\r
+                break;\r
+\r
+              case 'E':\r
+                g.setColor(SHEET_COLOUR);\r
+                g.fillRect(lastSSX[i], y + 4 + iconOffset,\r
+                           x - lastSSX[i] - 4, 7);\r
+                g.fillPolygon(new int[]\r
+                              {x - 4, x - 4, x},\r
+                              new int[]\r
+                              {\r
+                              y + iconOffset, y + 14 + iconOffset,\r
+                              y + 8 + iconOffset\r
+                }, 3);\r
+\r
+                break;\r
+\r
+              case 'C':\r
+                break;\r
+\r
+              default:\r
+                g.setColor(Color.gray);\r
+                g.fillRect(lastSSX[i], y + 6 + iconOffset,\r
+                           x - lastSSX[i], 2);\r
+\r
+                break;\r
+            }\r
+\r
+            if (validRes)\r
+            {\r
+              lastSS[i] = row.annotations[j].secondaryStructure;\r
+            }\r
+            else\r
+            {\r
+              lastSS[i] = ' ';\r
+            }\r
+\r
+            lastSSX[i] = x;\r
           }\r
-         else if( (row.annotations[j].secondaryStructure=='H'\r
-               || row.annotations[j].secondaryStructure=='E') &&\r
-               (row.annotations[j-1]==null ||\r
-                row.annotations[j].secondaryStructure!=row.annotations[j-1].secondaryStructure))\r
+        }\r
 \r
-        g.drawString(row.annotations[j].displayCharacter, x, y + iconOffset + 2);\r
+        if (validRes && row.isGraph)\r
+        {\r
+          g.setColor(new Color(0, 0, 180));\r
 \r
-        if(!row.hasIcons)\r
-            g.drawString(row.annotations[j].displayCharacter, x + charOffset,\r
-                         y + iconOffset + 2);\r
-       }\r
-\r
-       if(row.hasIcons)\r
-       if(!validRes || row.annotations[j].secondaryStructure!=lastSS[i])\r
-       {\r
-         switch (lastSS[i])\r
-         {\r
-           case 'H':\r
-             g.setColor(HELIX_COLOUR);\r
-             g.fillRoundRect(lastSSX[i], y+4 + iconOffset, x-lastSSX[i], 7, 8, 8);\r
-             break;\r
-           case 'E':\r
-             g.setColor(SHEET_COLOUR);\r
-             g.fillRect(lastSSX[i], y + 4 + iconOffset, x-lastSSX[i]-4, 7);\r
-             g.fillPolygon(new int[] {x - 4, x- 4, x }\r
-                           , new int[]{y+ iconOffset, y + 14+ iconOffset, y + 8+ iconOffset}, 3);\r
-             break;\r
-           case 'C':\r
-             break;\r
-           default :\r
-             g.setColor(Color.gray);\r
-             g.fillRect(lastSSX[i], y+6+ iconOffset, x-lastSSX[i], 2);\r
-             break;\r
-         }\r
-\r
-         if(validRes)\r
-           lastSS[i] = row.annotations[j].secondaryStructure;\r
-          else\r
-            lastSS[i] = ' ';\r
-         lastSSX[i] = x;\r
-       }\r
-\r
-       if (validRes && row.isGraph)\r
-       {\r
-         g.setColor(new Color(0,0,180));\r
-         int height = (int)((row.annotations[j].value / row.graphMax)*GRAPH_HEIGHT);\r
-\r
-         if(row.windowLength>1)\r
-         {\r
-           int total =0;\r
-           for(int i2=j- (row.windowLength/2); i2<j+(row.windowLength/2); i2++)\r
-           {\r
-             if(i2<0 || i2>=av.alignment.getWidth())\r
-               continue;\r
-\r
-             total += row.annotations[i2].value;\r
-           }\r
-\r
-           total/=row.windowLength;\r
-           height = (int)( (total / row.graphMax) *GRAPH_HEIGHT);\r
-\r
-         }\r
-         g.setColor(row.annotations[j].colour);\r
-         g.fillRect(x, y-height, av.charWidth, height );\r
-       }\r
+          int height = (int) ( (row.annotations[j].value / row.graphMax) *\r
+                              GRAPH_HEIGHT);\r
+\r
+          if (row.windowLength > 1)\r
+          {\r
+            int total = 0;\r
 \r
+            for (int i2 = j - (row.windowLength / 2);\r
+                 i2 < (j + (row.windowLength / 2)); i2++)\r
+            {\r
+              if ( (i2 < 0) || (i2 >= av.alignment.getWidth()))\r
+              {\r
+                continue;\r
+              }\r
+\r
+              total += row.annotations[i2].value;\r
+            }\r
+\r
+            total /= row.windowLength;\r
+            height = (int) ( (total / row.graphMax) * GRAPH_HEIGHT);\r
+          }\r
 \r
+          g.setColor(row.annotations[j].colour);\r
+          g.fillRect(x, y - height, av.charWidth, height);\r
+        }\r
       }\r
 \r
-      x+=av.charWidth;\r
+      x += av.charWidth;\r
 \r
-      if(row.hasIcons)\r
-      switch (lastSS[i])\r
+      if (row.hasIcons)\r
       {\r
-        case 'H':\r
-          g.setColor(HELIX_COLOUR);\r
-          g.fillRoundRect(lastSSX[i], y+4+ iconOffset, x - lastSSX[i], 7, 8, 8);\r
-          break;\r
-        case 'E':\r
-          g.setColor(SHEET_COLOUR);\r
-          g.fillRect(lastSSX[i], y + 4+ iconOffset, x - lastSSX[i] - 4, 7);\r
-          g.fillPolygon(new int[]\r
-                        {x - 4, x - 4, x}\r
-                        , new int[]\r
-                        {y + iconOffset, y + 14+ iconOffset, y + 7+ iconOffset}\r
-                        , 3);\r
-          break;\r
-        case 'C':\r
-          break;\r
-        default:\r
-          g.setColor(Color.gray);\r
-          g.fillRect(lastSSX[i], y+6+ iconOffset, x-lastSSX[i], 2);\r
-          break;\r
+        switch (lastSS[i])\r
+        {\r
+          case 'H':\r
+            g.setColor(HELIX_COLOUR);\r
+            g.fillRoundRect(lastSSX[i], y + 4 + iconOffset,\r
+                            x - lastSSX[i], 7, 8, 8);\r
+\r
+            break;\r
+\r
+          case 'E':\r
+            g.setColor(SHEET_COLOUR);\r
+            g.fillRect(lastSSX[i], y + 4 + iconOffset,\r
+                       x - lastSSX[i] - 4, 7);\r
+            g.fillPolygon(new int[]\r
+                          {x - 4, x - 4, x},\r
+                          new int[]\r
+                          {\r
+                          y + iconOffset, y + 14 + iconOffset,\r
+                          y + 7 + iconOffset\r
+            }, 3);\r
+\r
+            break;\r
+\r
+          case 'C':\r
+            break;\r
+\r
+          default:\r
+            g.setColor(Color.gray);\r
+            g.fillRect(lastSSX[i], y + 6 + iconOffset, x - lastSSX[i], 2);\r
+\r
+            break;\r
+        }\r
+      }\r
 \r
+      if (row.isGraph && row.hasText)\r
+      {\r
+        y += av.charHeight;\r
       }\r
 \r
-       if(row.isGraph && row.hasText)\r
-         y+=av.charHeight;\r
-       if(!row.isGraph)\r
-          y+=aa[i].height;\r
+      if (!row.isGraph)\r
+      {\r
+        y += aa[i].height;\r
+      }\r
     }\r
   }\r
 \r
   // used by overview window\r
-  public void drawGraph(Graphics g, AlignmentAnnotation aa,int width, int y)\r
+  public void drawGraph(Graphics g, AlignmentAnnotation aa, int width, int y)\r
   {\r
     g.setColor(Color.white);\r
-    g.fillRect(0,0,width, y);\r
-    g.setColor(new Color(0,0,180));\r
+    g.fillRect(0, 0, width, y);\r
+    g.setColor(new Color(0, 0, 180));\r
+\r
     int x = 0;\r
-    for(int j=0; j<aa.annotations.length; j++)\r
+\r
+    for (int j = 0; j < aa.annotations.length; j++)\r
     {\r
       g.setColor(new Color(0, 0, 180));\r
-      int height = (int) ( (aa.annotations[j].value / aa.graphMax) * GRAPH_HEIGHT );\r
+\r
+      int height = (int) ( (aa.annotations[j].value / aa.graphMax) *\r
+                          GRAPH_HEIGHT);\r
       g.fillRect(x, y - height, av.charWidth, height);\r
-      x+=av.charWidth;\r
+      x += av.charWidth;\r
     }\r
   }\r
 }\r
index 5761184..fc11698 100755 (executable)
@@ -1,22 +1,21 @@
 /*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 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
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
+ */\r
 package jalview.gui;\r
 \r
 import java.util.*;\r
@@ -24,70 +23,95 @@ import java.util.*;
 /**\r
  * NOTE: Columns are zero based.\r
  */\r
-public class ColumnSelection{\r
+public class ColumnSelection\r
+{\r
   Vector selected = new Vector();\r
 \r
-  public void addElement(int col) {\r
+  public void addElement(int col)\r
+  {\r
     selected.addElement(new Integer(col));\r
   }\r
 \r
-  public void clear() {\r
+  public void clear()\r
+  {\r
     selected.removeAllElements();\r
   }\r
 \r
-  public void removeElement(int col) {\r
+  public void removeElement(int col)\r
+  {\r
     Integer colInt = new Integer(col);\r
-    if (selected.contains(colInt)) {\r
+\r
+    if (selected.contains(colInt))\r
+    {\r
       selected.removeElement(colInt);\r
-    } else {\r
-      System.err.println("WARNING: Tried to remove Integer NOT in ColumnSelection");\r
+    }\r
+    else\r
+    {\r
+      System.err.println(\r
+          "WARNING: Tried to remove Integer NOT in ColumnSelection");\r
     }\r
   }\r
 \r
-  public boolean contains(int col) {\r
+  public boolean contains(int col)\r
+  {\r
     return selected.contains(new Integer(col));\r
   }\r
 \r
-  public int columnAt(int i) {\r
-    return ((Integer)selected.elementAt(i)).intValue();\r
+  public int columnAt(int i)\r
+  {\r
+    return ( (Integer) selected.elementAt(i)).intValue();\r
   }\r
 \r
-  public int size() {\r
+  public int size()\r
+  {\r
     return selected.size();\r
   }\r
 \r
-  public int getMax() {\r
+  public int getMax()\r
+  {\r
     int max = -1;\r
 \r
-    for (int i=0;i<selected.size();i++) {\r
-      if (columnAt(i) > max) {\r
+    for (int i = 0; i < selected.size(); i++)\r
+    {\r
+      if (columnAt(i) > max)\r
+      {\r
         max = columnAt(i);\r
       }\r
     }\r
+\r
     return max;\r
   }\r
 \r
-  public int getMin() {\r
+  public int getMin()\r
+  {\r
     int min = 1000000000;\r
 \r
-    for (int i=0;i<selected.size();i++) {\r
-      if (columnAt(i) < min) {\r
+    for (int i = 0; i < selected.size(); i++)\r
+    {\r
+      if (columnAt(i) < min)\r
+      {\r
         min = columnAt(i);\r
       }\r
     }\r
+\r
     return min;\r
   }\r
 \r
-  public Vector asVector() {\r
+  public Vector asVector()\r
+  {\r
     return selected;\r
   }\r
 \r
-  public void compensateForEdit(int start, int change) {\r
-    for (int i=0; i < size();i++) {\r
+  public void compensateForEdit(int start, int change)\r
+  {\r
+    for (int i = 0; i < size(); i++)\r
+    {\r
       int temp = columnAt(i);\r
 \r
       if (temp >= start)\r
-        selected.setElementAt(new Integer(temp-change),i);\r
+      {\r
+        selected.setElementAt(new Integer(temp - change), i);\r
+      }\r
     }\r
   }\r
 }\r
index 262fc41..175a609 100755 (executable)
-/*
-* Jalview - A Sequence Alignment Editor and Viewer
-* Copyright (C) 2005 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.gui;
-
-import jalview.jbgui.GCutAndPasteTransfer;
-import java.awt.*;
-import java.awt.event.ActionEvent;
-import java.awt.datatransfer.*;
-import jalview.datamodel.Alignment;
-import jalview.io.FormatAdapter;
-import jalview.datamodel.SequenceI;
-import javax.swing.JOptionPane;
-import jalview.io.IdentifyFile;
-
-public class CutAndPasteTransfer extends GCutAndPasteTransfer
-{
-  public void setForInput()
-  {
-    getContentPane().add(inputButtonPanel, java.awt.BorderLayout.SOUTH);
-  }
-
-  public String getText()
-  {
-    return textarea.getText();
-  }
-
-  public void setText(String text)
-  {
-    textarea.setText(text);
-  }
-
-  public void copyItem_actionPerformed(ActionEvent e)
-  {
-    Clipboard c = Toolkit.getDefaultToolkit().getSystemClipboard();
-    c.setContents( new StringSelection( textarea.getText()) , null ) ;
-  }
-
-  public void pasteMenu_actionPerformed(ActionEvent e)
-  {
-    Clipboard c = Toolkit.getDefaultToolkit().getSystemClipboard();
-    Transferable contents = c.getContents(this);
-    if (contents == null)
-      return;
-    try{
-      textarea.setText( (String) contents.getTransferData(DataFlavor.
-          stringFlavor));
-    }catch(Exception ex){}
-  }
-
-  public void ok_actionPerformed(ActionEvent e)
-  {
-      String format = IdentifyFile.Identify(getText(), "Paste");
-      SequenceI [] sequences = null;
-
-      if (FormatAdapter.formats.contains( format ))
-        sequences = FormatAdapter.readFile(getText(), "Paste", format);
-
-
-        if(sequences!=null)
-        {
-          AlignFrame af = new AlignFrame(new Alignment(sequences));
-          af.currentFileFormat = format;
-          Desktop.addInternalFrame(af, "Cut & Paste input - " + format,
-                                   AlignFrame.NEW_WINDOW_WIDTH,
-                                   AlignFrame.NEW_WINDOW_HEIGHT);
-          af.statusBar.setText("Successfully pasted alignment file");
-          try
-          {  af.setMaximum(Preferences.showFullscreen);    }
-          catch (Exception ex)
-          {}
-          try
-          {
-            this.setClosed(true);
-          }
-          catch (Exception ex)
-          {}
-
-
-        }
-        else
-          JOptionPane.showInternalMessageDialog(Desktop.desktop,
-                                                "Couldn't read the pasted text.\n"
-                                                + "Formats currently supported are\n"
-                                                +
-              "Fasta, MSF, Clustal, BLC, PIR, MSP, and PFAM",
-                                                "Error parsing text",
-                                                JOptionPane.WARNING_MESSAGE);
-  }
-
-  public void cancel_actionPerformed(ActionEvent e)
-  {
-    try{
-      this.setClosed(true);
-    }catch(Exception ex){}
-  }
-
-
-}
+/*\r
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
+ */\r
+package jalview.gui;\r
+\r
+import java.awt.*;\r
+import java.awt.datatransfer.*;\r
+import java.awt.event.*;\r
+import javax.swing.*;\r
+\r
+import jalview.datamodel.*;\r
+import jalview.io.*;\r
+import jalview.jbgui.*;\r
+\r
+public class CutAndPasteTransfer\r
+    extends GCutAndPasteTransfer\r
+{\r
+  public void setForInput()\r
+  {\r
+    getContentPane().add(inputButtonPanel, java.awt.BorderLayout.SOUTH);\r
+  }\r
+\r
+  public String getText()\r
+  {\r
+    return textarea.getText();\r
+  }\r
+\r
+  public void setText(String text)\r
+  {\r
+    textarea.setText(text);\r
+  }\r
+\r
+  public void copyItem_actionPerformed(ActionEvent e)\r
+  {\r
+    Clipboard c = Toolkit.getDefaultToolkit().getSystemClipboard();\r
+    c.setContents(new StringSelection(textarea.getText()), null);\r
+  }\r
+\r
+  public void pasteMenu_actionPerformed(ActionEvent e)\r
+  {\r
+    Clipboard c = Toolkit.getDefaultToolkit().getSystemClipboard();\r
+    Transferable contents = c.getContents(this);\r
+\r
+    if (contents == null)\r
+    {\r
+      return;\r
+    }\r
+\r
+    try\r
+    {\r
+      textarea.setText( (String) contents.getTransferData(\r
+          DataFlavor.stringFlavor));\r
+    }\r
+    catch (Exception ex)\r
+    {\r
+    }\r
+  }\r
+\r
+  public void ok_actionPerformed(ActionEvent e)\r
+  {\r
+    String format = IdentifyFile.Identify(getText(), "Paste");\r
+    SequenceI[] sequences = null;\r
+\r
+    if (FormatAdapter.formats.contains(format))\r
+    {\r
+      sequences = FormatAdapter.readFile(getText(), "Paste", format);\r
+    }\r
+\r
+    if (sequences != null)\r
+    {\r
+      AlignFrame af = new AlignFrame(new Alignment(sequences));\r
+      af.currentFileFormat = format;\r
+      Desktop.addInternalFrame(af, "Cut & Paste input - " + format,\r
+                               AlignFrame.NEW_WINDOW_WIDTH,\r
+                               AlignFrame.NEW_WINDOW_HEIGHT);\r
+      af.statusBar.setText("Successfully pasted alignment file");\r
+\r
+      try\r
+      {\r
+        af.setMaximum(Preferences.showFullscreen);\r
+      }\r
+      catch (Exception ex)\r
+      {\r
+      }\r
+\r
+      try\r
+      {\r
+        this.setClosed(true);\r
+      }\r
+      catch (Exception ex)\r
+      {\r
+      }\r
+    }\r
+    else\r
+    {\r
+      JOptionPane.showInternalMessageDialog(Desktop.desktop,\r
+                                            "Couldn't read the pasted text.\n" +\r
+                                            "Formats currently supported are\n" +\r
+                                            "Fasta, MSF, Clustal, BLC, PIR, MSP, and PFAM",\r
+                                            "Error parsing text",\r
+                                            JOptionPane.WARNING_MESSAGE);\r
+    }\r
+  }\r
+\r
+  public void cancel_actionPerformed(ActionEvent e)\r
+  {\r
+    try\r
+    {\r
+      this.setClosed(true);\r
+    }\r
+    catch (Exception ex)\r
+    {\r
+    }\r
+  }\r
+}\r
index fca0acc..e239a10 100755 (executable)
@@ -1,57 +1,61 @@
 /*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 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
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
+ */\r
 package jalview.gui;\r
 \r
-import jalview.gui.*;\r
-import jalview.io.*;\r
-import jalview.datamodel.*;\r
-import javax.swing.*;\r
 import java.awt.*;\r
-import java.awt.event.*;\r
+import java.awt.datatransfer.*;\r
 import java.awt.dnd.*;\r
+import java.awt.event.*;\r
 import javax.swing.*;\r
-import java.awt.datatransfer.*;\r
-import jalview.bin.Cache;\r
 \r
+import jalview.datamodel.*;\r
+import jalview.io.*;\r
 \r
-public class Desktop extends jalview.jbgui.GDesktop implements DropTargetListener\r
+public class Desktop\r
+    extends jalview.jbgui.GDesktop implements DropTargetListener\r
 {\r
   public static JDesktopPane desktop;\r
   static int openFrameCount = 0;\r
-  static final int xOffset = 30, yOffset = 30;\r
+  static final int xOffset = 30;\r
+  static final int yOffset = 30;\r
 \r
   public Desktop()\r
   {\r
-    Image image =null;\r
-    try{\r
+    Image image = null;\r
+\r
+    try\r
+    {\r
       java.net.URL url = getClass().getResource("/images/logo.gif");\r
-      if(url!=null)\r
+\r
+      if (url != null)\r
       {\r
         image = java.awt.Toolkit.getDefaultToolkit().createImage(url);\r
+\r
         MediaTracker mt = new MediaTracker(this);\r
         mt.addImage(image, 0);\r
         mt.waitForID(0);\r
         setIconImage(image);\r
       }\r
-\r
-    }catch(Exception ex){}\r
+    }\r
+    catch (Exception ex)\r
+    {\r
+    }\r
 \r
     setTitle("Jalview 2005");\r
     setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\r
@@ -60,11 +64,9 @@ public class Desktop extends jalview.jbgui.GDesktop implements DropTargetListene
     setContentPane(desktop);\r
     desktop.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE);\r
 \r
-\r
     // This line prevents Windows Look&Feel resizing all new windows to maximum\r
     // if previous window was maximised\r
-    desktop.setDesktopManager( new DefaultDesktopManager() );\r
-\r
+    desktop.setDesktopManager(new DefaultDesktopManager());\r
 \r
     Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();\r
     String x = jalview.bin.Cache.getProperty("SCREEN_X");\r
@@ -72,311 +74,396 @@ public class Desktop extends jalview.jbgui.GDesktop implements DropTargetListene
     String width = jalview.bin.Cache.getProperty("SCREEN_WIDTH");\r
     String height = jalview.bin.Cache.getProperty("SCREEN_HEIGHT");\r
 \r
-    if(x!=null && y!=null && width!=null && height!=null)\r
+    if ( (x != null) && (y != null) && (width != null) && (height != null))\r
     {\r
-      setBounds( Integer.parseInt(x), Integer.parseInt(y),\r
-                 Integer.parseInt(width), Integer.parseInt(height));\r
+      setBounds(Integer.parseInt(x), Integer.parseInt(y),\r
+                Integer.parseInt(width), Integer.parseInt(height));\r
     }\r
     else\r
-      setBounds( (int)(screenSize.width-900)/2,\r
-           (int)(screenSize.height-650)/2,\r
-          900 ,\r
-          650);\r
+    {\r
+      setBounds( (int) (screenSize.width - 900) / 2,\r
+                (int) (screenSize.height - 650) / 2, 900, 650);\r
+    }\r
 \r
-this.addWindowListener(new WindowAdapter()\r
-{\r
-public void windowClosing(WindowEvent evt)\r
-{\r
- jalview.bin.Cache.setProperty("SCREEN_X",\r
-                               getBounds().x + "");\r
- jalview.bin.Cache.setProperty("SCREEN_Y",\r
-                               getBounds().y + "");\r
- jalview.bin.Cache.setProperty("SCREEN_WIDTH", getWidth() + "");\r
- jalview.bin.Cache.setProperty("SCREEN_HEIGHT", getHeight() + "");\r
-}\r
-});\r
-setVisible(true);\r
+    this.addWindowListener(new WindowAdapter()\r
+    {\r
+      public void windowClosing(WindowEvent evt)\r
+      {\r
+        jalview.bin.Cache.setProperty("SCREEN_X", getBounds().x +\r
+                                      "");\r
+        jalview.bin.Cache.setProperty("SCREEN_Y", getBounds().y +\r
+                                      "");\r
+        jalview.bin.Cache.setProperty("SCREEN_WIDTH",\r
+                                      getWidth() + "");\r
+        jalview.bin.Cache.setProperty("SCREEN_HEIGHT",\r
+                                      getHeight() + "");\r
+      }\r
+    });\r
+    setVisible(true);\r
 \r
-this.setDropTarget(new java.awt.dnd.DropTarget(desktop, this));\r
+    this.setDropTarget(new java.awt.dnd.DropTarget(desktop, this));\r
 \r
-/////////Add a splashscreen on startup\r
-   /////////Add a splashscreen on startup\r
+    /////////Add a splashscreen on startup\r
+    /////////Add a splashscreen on startup\r
     JInternalFrame frame = new JInternalFrame();\r
 \r
     SplashScreen splash = new SplashScreen(frame, image);\r
     frame.setContentPane(splash);\r
     frame.setLayer(JLayeredPane.PALETTE_LAYER);\r
-    addInternalFrame(frame, "", 750,160, false);\r
-    frame.setLocation( (int)((getWidth()-750) /2), (int)((getHeight()-160) /2));\r
+    addInternalFrame(frame, "", 750, 160, false);\r
+    frame.setLocation( (int) ( (getWidth() - 750) / 2),\r
+                      (int) ( (getHeight() - 160) / 2));\r
   }\r
-  public static void addInternalFrame(final JInternalFrame frame, String title, int w, int h)\r
+\r
+  public static void addInternalFrame(final JInternalFrame frame,\r
+                                      String title, int w, int h)\r
   {\r
     addInternalFrame(frame, title, w, h, true);\r
   }\r
 \r
-  public static void addInternalFrame(final JInternalFrame frame, String title,\r
-                                      int w,\r
-                                      int h,\r
-                                      boolean resizable )\r
+  public static void addInternalFrame(final JInternalFrame frame,\r
+                                      String title, int w, int h,\r
+                                      boolean resizable)\r
   {\r
-   desktop.add(frame);\r
-   openFrameCount++;\r
-   try {\r
-       frame.setSelected(true);\r
-   } catch (java.beans.PropertyVetoException e) {}\r
-   frame.setTitle(title);\r
-   frame.setSize(w,h);\r
-   frame.setClosable(true);\r
-   frame.setResizable(resizable);\r
-   frame.setMaximizable(resizable);\r
-   frame.setIconifiable(resizable);\r
-   frame.setFrameIcon(null);\r
-   frame.setLocation(xOffset*openFrameCount, yOffset*openFrameCount);\r
-   frame.toFront();\r
-   final JMenuItem menuItem = new JMenuItem(title);\r
-   frame.addInternalFrameListener(new javax.swing.event.InternalFrameAdapter()\r
-   {\r
-     public void internalFrameClosed(javax.swing.event.InternalFrameEvent evt)\r
-     {\r
-       openFrameCount--;\r
-       windowMenu.remove(menuItem);\r
-     };\r
-   });\r
-\r
-   menuItem.addActionListener(new ActionListener()\r
+    desktop.add(frame);\r
+    openFrameCount++;\r
+\r
+    try\r
+    {\r
+      frame.setSelected(true);\r
+    }\r
+    catch (java.beans.PropertyVetoException e)\r
+    {\r
+    }\r
+\r
+    frame.setTitle(title);\r
+    frame.setSize(w, h);\r
+    frame.setClosable(true);\r
+    frame.setResizable(resizable);\r
+    frame.setMaximizable(resizable);\r
+    frame.setIconifiable(resizable);\r
+    frame.setFrameIcon(null);\r
+    frame.setLocation(xOffset * openFrameCount, yOffset * openFrameCount);\r
+    frame.toFront();\r
+\r
+    final JMenuItem menuItem = new JMenuItem(title);\r
+    frame.addInternalFrameListener(new javax.swing.event.InternalFrameAdapter()\r
+    {\r
+      public void internalFrameClosed(\r
+          javax.swing.event.InternalFrameEvent evt)\r
+      {\r
+        openFrameCount--;\r
+        windowMenu.remove(menuItem);\r
+      }\r
+      ;\r
+    });\r
+\r
+    menuItem.addActionListener(new ActionListener()\r
     {\r
       public void actionPerformed(ActionEvent e)\r
       {\r
-        try{  frame.setSelected(true);   frame.setIcon(false); }\r
-        catch(java.beans.PropertyVetoException ex){};\r
+        try\r
+        {\r
+          frame.setSelected(true);\r
+          frame.setIcon(false);\r
+        }\r
+        catch (java.beans.PropertyVetoException ex)\r
+        {\r
+        }\r
+\r
+        ;\r
       }\r
     });\r
 \r
-   frame.setVisible(true);\r
-   windowMenu.add(menuItem);\r
- }\r
+    frame.setVisible(true);\r
+    windowMenu.add(menuItem);\r
+  }\r
 \r
- public void dragEnter(DropTargetDragEvent evt){}\r
- public void dragExit(DropTargetEvent evt){}\r
- public void dragOver(DropTargetDragEvent evt){}\r
- public void dropActionChanged(DropTargetDragEvent evt){}\r
- public void drop(DropTargetDropEvent evt)\r
-{\r
-   Transferable t = evt.getTransferable();\r
-   if(!t.isDataFlavorSupported(DataFlavor.javaFileListFlavor))\r
-     return;\r
-\r
-   evt.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE);\r
-   try{\r
-     java.util.List files = (java.util.List) t.getTransferData(DataFlavor.javaFileListFlavor);\r
-\r
-     for (int i = 0; i < files.size(); i++)\r
-     {\r
-       String file = files.get(i).toString();\r
-       String protocol = "File";\r
-       if(file.endsWith(".jar"))\r
-                Jalview2XML.LoadJalviewAlign(file);\r
+  public void dragEnter(DropTargetDragEvent evt)\r
+  {\r
+  }\r
+\r
+  public void dragExit(DropTargetEvent evt)\r
+  {\r
+  }\r
+\r
+  public void dragOver(DropTargetDragEvent evt)\r
+  {\r
+  }\r
+\r
+  public void dropActionChanged(DropTargetDragEvent evt)\r
+  {\r
+  }\r
+\r
+  public void drop(DropTargetDropEvent evt)\r
+  {\r
+    Transferable t = evt.getTransferable();\r
+\r
+    if (!t.isDataFlavorSupported(DataFlavor.javaFileListFlavor))\r
+    {\r
+      return;\r
+    }\r
+\r
+    evt.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE);\r
+\r
+    try\r
+    {\r
+      java.util.List files = (java.util.List) t.getTransferData(DataFlavor.\r
+          javaFileListFlavor);\r
+\r
+      for (int i = 0; i < files.size(); i++)\r
+      {\r
+        String file = files.get(i).toString();\r
+        String protocol = "File";\r
+\r
+        if (file.endsWith(".jar"))\r
+        {\r
+          Jalview2XML.LoadJalviewAlign(file);\r
+        }\r
+        else\r
+        {\r
+          String format = jalview.io.IdentifyFile.Identify(file,\r
+              protocol);\r
+          LoadFile(file, protocol, format);\r
+        }\r
+      }\r
+    }\r
+    catch (Exception ex)\r
+    {\r
+      ex.printStackTrace();\r
+    }\r
+  }\r
+\r
+  public void inputLocalFileMenuItem_actionPerformed(ActionEvent e)\r
+  {\r
+    JalviewFileChooser chooser = new JalviewFileChooser(jalview.bin.Cache.\r
+        getProperty(\r
+            "LAST_DIRECTORY"),\r
+        new String[]\r
+        {\r
+        "fa, fasta, fastq", "aln", "pfam", "msf", "pir", "blc",\r
+        "jar"\r
+    },\r
+        new String[]\r
+        {\r
+        "Fasta", "Clustal", "PFAM", "MSF", "PIR", "BLC", "Jalview"\r
+    }, jalview.bin.Cache.getProperty("DEFAULT_FILE_FORMAT"));\r
+\r
+    chooser.setFileView(new JalviewFileView());\r
+    chooser.setDialogTitle("Open local file");\r
+    chooser.setToolTipText("Open");\r
+\r
+    int value = chooser.showOpenDialog(this);\r
+\r
+    if (value == JalviewFileChooser.APPROVE_OPTION)\r
+    {\r
+      String choice = chooser.getSelectedFile().getPath();\r
+      jalview.bin.Cache.setProperty("LAST_DIRECTORY",\r
+                                    chooser.getSelectedFile().getParent());\r
+\r
+      if (chooser.getSelectedFormat().equals("Jalview"))\r
+      {\r
+        jalview.bin.Cache.setProperty("DEFAULT_FILE_FORMAT", "Jalivew");\r
+        Jalview2XML.LoadJalviewAlign(choice);\r
+      }\r
       else\r
       {\r
-        String format = jalview.io.IdentifyFile.Identify(file, protocol);\r
-        LoadFile(file, protocol, format);\r
+        String format = IdentifyFile.Identify(choice, "File");\r
+        jalview.bin.Cache.setProperty("DEFAULT_FILE_FORMAT", format);\r
+        LoadFile(choice, "File", format);\r
       }\r
-     }\r
+    }\r
+  }\r
 \r
-   }catch(Exception ex){ex.printStackTrace();}\r
+  public void LoadFile(String file, String protocol, String format)\r
+  {\r
+    LoadingThread loader = new LoadingThread(file, protocol, format);\r
+    loader.start();\r
   }\r
 \r
+  public void inputURLMenuItem_actionPerformed(ActionEvent e)\r
+  {\r
+    String url = JOptionPane.showInternalInputDialog(Desktop.desktop,\r
+        "Enter url of input file", "Input alignment from URL",\r
+        JOptionPane.QUESTION_MESSAGE, null, null, "http://www.")\r
+        .toString();\r
+\r
+    if (url == null)\r
+    {\r
+      return;\r
+    }\r
 \r
- public void inputLocalFileMenuItem_actionPerformed(ActionEvent e)\r
- {\r
-   JalviewFileChooser chooser = new JalviewFileChooser(jalview.bin.Cache.getProperty("LAST_DIRECTORY"),\r
-       new String[]{"fa, fasta, fastq", "aln",  "pfam", "msf", "pir","blc","jar"},\r
-       new String[]{"Fasta", "Clustal", "PFAM", "MSF", "PIR", "BLC", "Jalview"}\r
-       ,jalview.bin.Cache.getProperty("DEFAULT_FILE_FORMAT"));\r
-\r
-   chooser.setFileView(new JalviewFileView());\r
-   chooser.setDialogTitle("Open local file");\r
-   chooser.setToolTipText("Open");\r
-   int value = chooser.showOpenDialog(this);\r
-   if(value == JalviewFileChooser.APPROVE_OPTION)\r
-   {\r
-     String choice =  chooser.getSelectedFile().getPath();\r
-     jalview.bin.Cache.setProperty("LAST_DIRECTORY", chooser.getSelectedFile().getParent());\r
-     if(chooser.getSelectedFormat().equals("Jalview"))\r
-     {\r
-       jalview.bin.Cache.setProperty("DEFAULT_FILE_FORMAT", "Jalivew");\r
-       Jalview2XML.LoadJalviewAlign(choice);\r
-     }\r
-     else\r
-     {\r
-       String format = IdentifyFile.Identify(choice, "File");\r
-       jalview.bin.Cache.setProperty("DEFAULT_FILE_FORMAT", format);\r
-       LoadFile(choice, "File", format);\r
-     }\r
-   }\r
- }\r
-\r
- public void LoadFile(String file, String protocol,  String format)\r
- {\r
-   LoadingThread loader = new LoadingThread(file, protocol, format);\r
-   loader.start();\r
- }\r
-\r
- class LoadingThread extends Thread\r
- {\r
-   String file, protocol, format;\r
-\r
-   public LoadingThread(String file, String protocol,  String format)\r
-   {\r
-     this.file = file;\r
-     this.protocol = protocol;\r
-     this.format = format;\r
-   }\r
-   public void run()\r
-   {\r
-     SequenceI [] sequences = null;\r
-\r
-     if (FormatAdapter.formats.contains(format))\r
-         sequences = FormatAdapter.readFile(file, protocol, format);\r
-\r
-     if (sequences != null && sequences.length>0)\r
-     {\r
-       AlignFrame af = new AlignFrame(new Alignment(sequences));\r
-       addInternalFrame(af, file, AlignFrame.NEW_WINDOW_WIDTH, AlignFrame.NEW_WINDOW_HEIGHT);\r
-       af.currentFileFormat = format;\r
-       af.statusBar.setText("Successfully loaded file " + file);\r
-       try{\r
-           af.setMaximum(Preferences.showFullscreen);\r
-       }catch(Exception ex){}\r
-\r
-     }\r
-     else\r
-       JOptionPane.showInternalMessageDialog(Desktop.desktop,  "Couldn't open file.\n"\r
-                            + "Formats currently supported are\n"\r
-                            + "Fasta, MSF, Clustal, BLC, PIR, MSP, and PFAM" // JBPNote - message should be generated through FormatAdapter!\r
-                            ,"Error loading file",\r
-                                     JOptionPane.WARNING_MESSAGE);\r
-\r
-   }\r
- }\r
-\r
-\r
- public void inputURLMenuItem_actionPerformed(ActionEvent e)\r
- {\r
-   String url = JOptionPane.showInternalInputDialog(Desktop.desktop,"Enter url of input file",\r
-                                            "Input alignment from URL",\r
-                                            JOptionPane.QUESTION_MESSAGE,\r
-                                            null, null,\r
-                                            "http://www.").toString();\r
-   if (url == null)\r
-     return;\r
-\r
-   String format = IdentifyFile.Identify(url, "URL");\r
-\r
-   if (format.equals("URL NOT FOUND"))\r
-   {\r
-     JOptionPane.showInternalMessageDialog(Desktop.desktop,"Couldn't locate " + url,\r
-                                   "URL not found",\r
-                                   JOptionPane.WARNING_MESSAGE);\r
-     return;\r
-   }\r
+    String format = IdentifyFile.Identify(url, "URL");\r
+\r
+    if (format.equals("URL NOT FOUND"))\r
+    {\r
+      JOptionPane.showInternalMessageDialog(Desktop.desktop,\r
+                                            "Couldn't locate " + url,\r
+                                            "URL not found",\r
+                                            JOptionPane.WARNING_MESSAGE);\r
+\r
+      return;\r
+    }\r
 \r
     LoadFile(url, "URL", format);\r
- }\r
+  }\r
 \r
- public void inputTextboxMenuItem_actionPerformed(ActionEvent e)\r
- {\r
-   CutAndPasteTransfer cap = new CutAndPasteTransfer();\r
-   cap.setForInput();\r
-   Desktop.addInternalFrame(cap, "Cut & Paste Alignment File", 600, 500);\r
- }\r
+  public void inputTextboxMenuItem_actionPerformed(ActionEvent e)\r
+  {\r
+    CutAndPasteTransfer cap = new CutAndPasteTransfer();\r
+    cap.setForInput();\r
+    Desktop.addInternalFrame(cap, "Cut & Paste Alignment File", 600, 500);\r
+  }\r
 \r
-/*\r
-* Exit the program\r
-*/\r
- public void quit_actionPerformed(ActionEvent e)\r
- {\r
-   if(jalview.bin.Jalview.applet!=null)\r
-     jalview.bin.Jalview.applet.destroy();\r
+  /*\r
+   * Exit the program\r
+   */\r
+  public void quit_actionPerformed(ActionEvent e)\r
+  {\r
+    if (jalview.bin.Jalview.applet != null)\r
+    {\r
+      jalview.bin.Jalview.applet.destroy();\r
+    }\r
     else\r
+    {\r
       System.exit(0);\r
- }\r
-\r
-\r
-\r
- public void aboutMenuItem_actionPerformed(ActionEvent e)\r
- {\r
-   JOptionPane.showInternalMessageDialog(Desktop.desktop,\r
-                                         "JalView 2005 version " + jalview.bin.Cache.VERSION+"; last updated: "+jalview.bin.Cache.BUILD_DATE\r
-                                       +"\nAuthors:  Michele Clamp, James Cuff, Steve Searle, Andrew Waterhouse, Jim Procter & Geoff Barton."\r
-                                       +"\nCurrent development managed by Andrew Waterhouse; Barton Group, University of Dundee."\r
-                                       +"\nFor all issues relating to Jalview, email help@jalview.org"\r
-                                       +"\n\nIf  you use JalView, please cite:"\r
-                                       +"\n\"Clamp, M., Cuff, J., Searle, S. M. and Barton, G. J. (2004), The Jalview Java Alignment Editor\""\r
-                                       +"\nBioinformatics,  2004 12;426-7.",\r
-                                         "About Jalview",\r
-                                         JOptionPane.INFORMATION_MESSAGE);\r
- }\r
-\r
- public void documentationMenuItem_actionPerformed(ActionEvent e)\r
- {\r
-   try\r
-   {\r
+    }\r
+  }\r
+\r
+  public void aboutMenuItem_actionPerformed(ActionEvent e)\r
+  {\r
+    JOptionPane.showInternalMessageDialog(Desktop.desktop,\r
+                                          "JalView 2005 version " +\r
+                                          jalview.bin.Cache.VERSION +\r
+                                          "; last updated: " +\r
+                                          jalview.bin.Cache.BUILD_DATE +\r
+                                          "\nAuthors:  Michele Clamp, James Cuff, Steve Searle, Andrew Waterhouse, Jim Procter & Geoff Barton." +\r
+                                          "\nCurrent development managed by Andrew Waterhouse; Barton Group, University of Dundee." +\r
+                                          "\nFor all issues relating to Jalview, email help@jalview.org" +\r
+                                          "\n\nIf  you use JalView, please cite:" +\r
+                                          "\n\"Clamp, M., Cuff, J., Searle, S. M. and Barton, G. J. (2004), The Jalview Java Alignment Editor\"" +\r
+                                          "\nBioinformatics,  2004 12;426-7.",\r
+                                          "About Jalview",\r
+                                          JOptionPane.INFORMATION_MESSAGE);\r
+  }\r
+\r
+  public void documentationMenuItem_actionPerformed(ActionEvent e)\r
+  {\r
+    try\r
+    {\r
       ClassLoader cl = jalview.gui.Desktop.class.getClassLoader();\r
-      java.net.URL url = javax.help.HelpSet.findHelpSet(cl,"help/help");\r
-      javax.help.HelpSet hs = new javax.help.HelpSet(cl,url);\r
+      java.net.URL url = javax.help.HelpSet.findHelpSet(cl, "help/help");\r
+      javax.help.HelpSet hs = new javax.help.HelpSet(cl, url);\r
 \r
       javax.help.HelpBroker hb = hs.createHelpBroker();\r
       hb.setLocation(new Point(200, 50));\r
-      hb.setSize(new Dimension(800,700));\r
+      hb.setSize(new Dimension(800, 700));\r
       hb.setCurrentID("home");\r
       hb.setDisplayed(true);\r
-   }\r
-   catch (Exception ex)\r
-   {\r
-     ex.printStackTrace();\r
-   }\r
- }\r
-\r
- protected void preferences_actionPerformed(ActionEvent e)\r
- {\r
-   Preferences pref = new Preferences();\r
- }\r
-\r
- public void saveState_actionPerformed(ActionEvent e)\r
- {\r
-   JalviewFileChooser chooser = new JalviewFileChooser(jalview.bin.Cache.\r
-       getProperty("LAST_DIRECTORY"),\r
-       new String[]\r
-       {"jar"}, new String[]{"Jalview Project"}, "Jalview Project");\r
-\r
-   chooser.setFileView(new JalviewFileView());\r
-   chooser.setDialogTitle("Save State");\r
-   int value = chooser.showSaveDialog(this);\r
-   if (value == JalviewFileChooser.APPROVE_OPTION)\r
-   {\r
-     java.io.File choice = chooser.getSelectedFile();\r
-     jalview.bin.Cache.setProperty("LAST_DIRECTORY", choice.getParent());\r
-     Jalview2XML.SaveState(choice);\r
-   }\r
-\r
- }\r
-\r
-\r
- public void loadState_actionPerformed(ActionEvent e)\r
- {\r
-   JalviewFileChooser chooser = new JalviewFileChooser(jalview.bin.Cache.getProperty("LAST_DIRECTORY"),\r
-       new String[]{"jar"}, new String[]{"Jalview Project"}, "Jalview Project");\r
-   chooser.setFileView(new JalviewFileView());\r
-   chooser.setDialogTitle("Restore state");\r
-   int value = chooser.showOpenDialog(this);\r
-   if(value == JalviewFileChooser.APPROVE_OPTION)\r
-   {\r
-     String choice =  chooser.getSelectedFile().getAbsolutePath();\r
-     jalview.bin.Cache.setProperty("LAST_DIRECTORY", chooser.getSelectedFile().getParent());\r
-     Jalview2XML.LoadJalviewAlign(choice);\r
-   }\r
- }\r
-}\r
+    }\r
+    catch (Exception ex)\r
+    {\r
+      ex.printStackTrace();\r
+    }\r
+  }\r
+\r
+  protected void preferences_actionPerformed(ActionEvent e)\r
+  {\r
+    Preferences pref = new Preferences();\r
+  }\r
+\r
+  public void saveState_actionPerformed(ActionEvent e)\r
+  {\r
+    JalviewFileChooser chooser = new JalviewFileChooser(jalview.bin.Cache.\r
+        getProperty(\r
+            "LAST_DIRECTORY"), new String[]\r
+        {"jar"},\r
+        new String[]\r
+        {"Jalview Project"}, "Jalview Project");\r
+\r
+    chooser.setFileView(new JalviewFileView());\r
+    chooser.setDialogTitle("Save State");\r
+\r
+    int value = chooser.showSaveDialog(this);\r
 \r
+    if (value == JalviewFileChooser.APPROVE_OPTION)\r
+    {\r
+      java.io.File choice = chooser.getSelectedFile();\r
+      jalview.bin.Cache.setProperty("LAST_DIRECTORY", choice.getParent());\r
+      Jalview2XML.SaveState(choice);\r
+    }\r
+  }\r
 \r
+  public void loadState_actionPerformed(ActionEvent e)\r
+  {\r
+    JalviewFileChooser chooser = new JalviewFileChooser(jalview.bin.Cache.\r
+        getProperty(\r
+            "LAST_DIRECTORY"), new String[]\r
+        {"jar"},\r
+        new String[]\r
+        {"Jalview Project"}, "Jalview Project");\r
+    chooser.setFileView(new JalviewFileView());\r
+    chooser.setDialogTitle("Restore state");\r
+\r
+    int value = chooser.showOpenDialog(this);\r
+\r
+    if (value == JalviewFileChooser.APPROVE_OPTION)\r
+    {\r
+      String choice = chooser.getSelectedFile().getAbsolutePath();\r
+      jalview.bin.Cache.setProperty("LAST_DIRECTORY",\r
+                                    chooser.getSelectedFile().getParent());\r
+      Jalview2XML.LoadJalviewAlign(choice);\r
+    }\r
+  }\r
+\r
+  class LoadingThread\r
+      extends Thread\r
+  {\r
+    String file;\r
+    String protocol;\r
+    String format;\r
+\r
+    public LoadingThread(String file, String protocol, String format)\r
+    {\r
+      this.file = file;\r
+      this.protocol = protocol;\r
+      this.format = format;\r
+    }\r
+\r
+    public void run()\r
+    {\r
+      SequenceI[] sequences = null;\r
+\r
+      if (FormatAdapter.formats.contains(format))\r
+      {\r
+        sequences = FormatAdapter.readFile(file, protocol, format);\r
+      }\r
+\r
+      if ( (sequences != null) && (sequences.length > 0))\r
+      {\r
+        AlignFrame af = new AlignFrame(new Alignment(sequences));\r
+        addInternalFrame(af, file, AlignFrame.NEW_WINDOW_WIDTH,\r
+                         AlignFrame.NEW_WINDOW_HEIGHT);\r
+        af.currentFileFormat = format;\r
+        af.statusBar.setText("Successfully loaded file " + file);\r
+\r
+        try\r
+        {\r
+          af.setMaximum(Preferences.showFullscreen);\r
+        }\r
+        catch (Exception ex)\r
+        {\r
+        }\r
+      }\r
+      else\r
+      {\r
+        JOptionPane.showInternalMessageDialog(Desktop.desktop,\r
+                                              "Couldn't open file.\n" +\r
+                                              "Formats currently supported are\n" +\r
+                                              "Fasta, MSF, Clustal, BLC, PIR, MSP, and PFAM" // JBPNote - message should be generated through FormatAdapter!\r
+                                              , "Error loading file",\r
+                                              JOptionPane.WARNING_MESSAGE);\r
+      }\r
+    }\r
+  }\r
+}\r
index 1dd434d..e80d01a 100755 (executable)
@@ -1,35 +1,34 @@
 /*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 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
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
+ */\r
 package jalview.gui;\r
 \r
-import jalview.datamodel.*;\r
-import jalview.schemes.*;\r
-import java.awt.*;\r
 import java.util.*;\r
 \r
+import java.awt.*;\r
+\r
+import jalview.datamodel.*;\r
+\r
 public class FeatureRenderer\r
 {\r
   AlignViewport av;\r
-\r
   SequenceGroup currentSequenceGroup = null;\r
-  SequenceGroup [] allGroups = null;\r
+  SequenceGroup[] allGroups = null;\r
   Color resBoxColour;\r
   Graphics graphics;\r
 \r
@@ -38,48 +37,60 @@ public class FeatureRenderer
     this.av = av;\r
   }\r
 \r
-\r
-  public void drawSequence(Graphics g,SequenceI seq,SequenceGroup [] sg, int start, int end, int x1, int y1, int width, int height)\r
+  public void drawSequence(Graphics g, SequenceI seq, SequenceGroup[] sg,\r
+                           int start, int end, int x1, int y1, int width,\r
+                           int height)\r
   {\r
     Vector features = seq.getSequenceFeatures();\r
     Enumeration e = features.elements();\r
-    while( e.hasMoreElements() )\r
+\r
+    while (e.hasMoreElements())\r
     {\r
-      SequenceFeature sf = (SequenceFeature)e.nextElement();\r
-      if(sf.getStart()>seq.getEnd())\r
+      SequenceFeature sf = (SequenceFeature) e.nextElement();\r
+\r
+      if (sf.getStart() > seq.getEnd())\r
+      {\r
         continue;\r
+      }\r
 \r
-      int fstart = seq.findIndex(sf.getStart())-1;\r
-      int fend = seq.findIndex(sf.getEnd())-1;\r
+      int fstart = seq.findIndex(sf.getStart()) - 1;\r
+      int fend = seq.findIndex(sf.getEnd()) - 1;\r
 \r
-      if(   (fstart<=end && fend>=start)  )\r
+      if ( ( (fstart <= end) && (fend >= start)))\r
       {\r
-        if(fstart<0) // fix for if the feature we have starts before the sequence start,\r
-          fstart = 0;// but the feature end is still valid!!\r
+        if (fstart < 0)\r
+        { // fix for if the feature we have starts before the sequence start,\r
+          fstart = 0; // but the feature end is still valid!!\r
+        }\r
 \r
-        if(fstart==fend)\r
+        if (fstart == fend)\r
         {\r
           g.setColor(Color.red);\r
-          g.fillRoundRect( (fstart - start) * width, y1, width, height, 4,4);\r
+          g.fillRoundRect( (fstart - start) * width, y1, width,\r
+                          height, 4, 4);\r
           g.setColor(Color.white);\r
 \r
           char s = seq.getSequence().charAt(fstart);\r
           FontMetrics fm = g.getFontMetrics();\r
-          int charOffset =  (width - fm.charWidth(s))/2;\r
-          int pady = height/5;\r
-          g.drawString(String.valueOf(s), charOffset + x1 + width * (fstart - start), y1 + height - pady);\r
-\r
+          int charOffset = (width - fm.charWidth(s)) / 2;\r
+          int pady = height / 5;\r
+          g.drawString(String.valueOf(s),\r
+                       charOffset + x1 + (width * (fstart - start)),\r
+                       (y1 + height) - pady);\r
         }\r
         else\r
         {\r
           for (int i = fstart; i <= fend; i++)\r
           {\r
             char s = seq.getSequence().charAt(i);\r
-            if( jalview.util.Comparison.isGap(s) )\r
+\r
+            if (jalview.util.Comparison.isGap(s))\r
+            {\r
               continue;\r
+            }\r
 \r
             g.setColor(Color.blue);\r
-            g.fillRect( (i-start) * width, y1, width, height);\r
+            g.fillRect( (i - start) * width, y1, width, height);\r
 \r
             g.setColor(Color.white);\r
 \r
@@ -87,13 +98,11 @@ public class FeatureRenderer
             int charOffset = (width - fm.charWidth(s)) / 2;\r
             int pady = height / 5;\r
             g.drawString(String.valueOf(s),\r
-                         charOffset + x1 + width * (i-start),\r
-                         y1 + height - pady);\r
+                         charOffset + x1 + (width * (i - start)),\r
+                         (y1 + height) - pady);\r
           }\r
         }\r
       }\r
-\r
     }\r
-   }\r
-\r
+  }\r
 }\r
index d20cb65..af1888c 100755 (executable)
@@ -1,42 +1,44 @@
 /*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 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
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
+ */\r
 package jalview.gui;\r
 \r
-import jalview.jbgui.GFinder;\r
-import jalview.datamodel.*;\r
+import java.util.*;\r
+\r
+import java.awt.*;\r
 import java.awt.event.*;\r
 import javax.swing.*;\r
 import javax.swing.event.*;\r
-import java.util.*;\r
-import java.awt.*;\r
 \r
-public class Finder extends GFinder\r
+import jalview.datamodel.*;\r
+import jalview.jbgui.*;\r
+\r
+public class Finder\r
+    extends GFinder\r
 {\r
   AlignViewport av;\r
   AlignmentPanel ap;\r
   JInternalFrame frame;\r
   SuperGroup searchGroup;\r
   Vector searchResults;\r
-\r
   int seqIndex = 0;\r
   int resIndex = 0;\r
+\r
   public Finder(AlignViewport av, AlignmentPanel ap, JInternalFrame f)\r
   {\r
     this.av = av;\r
@@ -52,16 +54,17 @@ public class Finder extends GFinder
         SwingUtilities.invokeLater(new Runnable()\r
         {\r
           public void run()\r
-          {   textfield.requestFocus();      }\r
-       });\r
-     }\r
-\r
-     public void internalFrameClosing(InternalFrameEvent evt)\r
-     {\r
-       cancel_actionPerformed(null);\r
-     }\r
-});\r
+          {\r
+            textfield.requestFocus();\r
+          }\r
+        });\r
+      }\r
 \r
+      public void internalFrameClosing(InternalFrameEvent evt)\r
+      {\r
+        cancel_actionPerformed(null);\r
+      }\r
+    });\r
   }\r
 \r
   public void textfield_actionPerformed(ActionEvent e)\r
@@ -76,213 +79,257 @@ public class Finder extends GFinder
 \r
   public void findAll_actionPerformed(ActionEvent e)\r
   {\r
-    resIndex=0;\r
-    seqIndex=0;\r
+    resIndex = 0;\r
+    seqIndex = 0;\r
     doSearch(true);\r
   }\r
 \r
   public void cancel_actionPerformed(ActionEvent e)\r
   {\r
-    try{\r
+    try\r
+    {\r
       // if allResults is null, this effectively switches displaySearch flag in seqCanvas\r
-      ap.highlightSearchResults( null );\r
-      ap.idPanel.highlightSearchResults( null );\r
-     // frame.setClosed(true);\r
-    }catch(Exception ex){ }\r
-  }\r
+      ap.highlightSearchResults(null);\r
+      ap.idPanel.highlightSearchResults(null);\r
 \r
+      // frame.setClosed(true);\r
+    }\r
+    catch (Exception ex)\r
+    {\r
+    }\r
+  }\r
 \r
   public void createNewGroup_actionPerformed(ActionEvent e)\r
   {\r
+    Color[] newColors = new Color[24];\r
 \r
-   Color [] newColors = new Color[24];\r
-   for(int i=0; i<24; i++)\r
-     newColors[i] = new Color(60,160,115);\r
-\r
-   jalview.schemes.UserColourScheme ucs = new jalview.schemes.UserColourScheme(newColors);\r
-   String searchString = textfield.getText();\r
+    for (int i = 0; i < 24; i++)\r
+    {\r
+      newColors[i] = new Color(60, 160, 115);\r
+    }\r
 \r
-   searchGroup = new SuperGroup(searchString, ucs , true, true, false);\r
+    jalview.schemes.UserColourScheme ucs = new jalview.schemes.UserColourScheme(\r
+        newColors);\r
+    String searchString = textfield.getText();\r
 \r
+    searchGroup = new SuperGroup(searchString, ucs, true, true, false);\r
 \r
-    for(int i=0; i<searchResults.size(); i+=3)\r
+    for (int i = 0; i < searchResults.size(); i += 3)\r
     {\r
       // its possible edits may have occurred since search was performed\r
       // account for this here\r
-\r
-      SequenceI seq = av.alignment.getSequenceAt( Integer.parseInt(searchResults.elementAt(i).toString()) );\r
-      int startRes = seq.findIndex( Integer.parseInt(searchResults.elementAt(i+1).toString()) )-1;\r
-      int endRes = seq.findIndex(   Integer.parseInt(searchResults.elementAt(i+2).toString()) )-1;\r
-\r
-      SequenceGroup sg = new SequenceGroup(searchString, ucs, true, true, false, startRes , endRes  );\r
+      SequenceI seq = av.alignment.getSequenceAt(Integer.parseInt(\r
+          searchResults.elementAt(i).toString()));\r
+      int startRes = seq.findIndex(Integer.parseInt(\r
+          searchResults.elementAt(i + 1).toString())) - 1;\r
+      int endRes = seq.findIndex(Integer.parseInt(\r
+          searchResults.elementAt(i + 2).toString())) - 1;\r
+\r
+      SequenceGroup sg = new SequenceGroup(searchString, ucs, true, true,\r
+                                           false, startRes, endRes);\r
       sg.addSequence(seq);\r
       av.alignment.addGroup(sg);\r
-      searchGroup.addGroup( sg );\r
-\r
+      searchGroup.addGroup(sg);\r
     }\r
 \r
     ap.av.alignment.addSuperGroup(searchGroup);\r
-    ap.highlightSearchResults( null );\r
+    ap.highlightSearchResults(null);\r
   }\r
 \r
-\r
   void doSearch(boolean findAll)\r
   {\r
     createNewGroup.setEnabled(false);\r
 \r
     String searchString = textfield.getText().toUpperCase();\r
 \r
-    com.stevesoft.pat.Regex regex = new  com.stevesoft.pat.Regex(searchString);\r
+    com.stevesoft.pat.Regex regex = new com.stevesoft.pat.Regex(searchString);\r
 \r
     searchResults = new Vector();\r
-    int [] allResults = null;\r
+\r
+    int[] allResults = null;\r
 \r
     Sequence seq;\r
-    String item=null;\r
+    String item = null;\r
     boolean found = false;\r
 \r
     ////// is the searchString a residue number?\r
-    try{\r
+    try\r
+    {\r
       int res = Integer.parseInt(searchString);\r
       found = true;\r
 \r
-      if(av.getSelectionGroup().getSize()>0)\r
-        seq = (Sequence)(av.getSelectionGroup().getSequenceAt(0));\r
+      if (av.getSelectionGroup().getSize() > 0)\r
+      {\r
+        seq = (Sequence) (av.getSelectionGroup().getSequenceAt(0));\r
+      }\r
       else\r
-        seq = (Sequence)av.getAlignment().getSequenceAt(0);\r
+      {\r
+        seq = (Sequence) av.getAlignment().getSequenceAt(0);\r
+      }\r
 \r
-      searchResults.add( Integer.toString( av.getAlignment().findIndex(seq) ) );\r
-      searchResults.add( Integer.toString( seq.findIndex(res)-1 ) );\r
-      searchResults.add( Integer.toString( seq.findIndex(res)-1 ) );\r
+      searchResults.add(Integer.toString(av.getAlignment().findIndex(seq)));\r
+      searchResults.add(Integer.toString(seq.findIndex(res) - 1));\r
+      searchResults.add(Integer.toString(seq.findIndex(res) - 1));\r
+    }\r
+    catch (NumberFormatException ex)\r
+    {\r
+    }\r
 \r
-    }catch(NumberFormatException ex){}\r
     ///////////////////////////////////////////////\r
+    Color[] newColors = new Color[24];\r
 \r
+    for (int i = 0; i < 24; i++)\r
+    {\r
+      newColors[i] = new Color(60, 160, 115);\r
+    }\r
 \r
+    jalview.schemes.UserColourScheme ucs = new jalview.schemes.UserColourScheme(\r
+        newColors);\r
 \r
-    Color [] newColors = new Color[24];\r
-    for(int i=0; i<24; i++)\r
-      newColors[i] = new Color(60,160,115);\r
-\r
-    jalview.schemes.UserColourScheme ucs = new jalview.schemes.UserColourScheme(newColors);\r
-\r
-    searchGroup = new SuperGroup(searchString, ucs , true, true, false);\r
+    searchGroup = new SuperGroup(searchString, ucs, true, true, false);\r
 \r
     int end = av.alignment.getHeight();\r
 \r
     SequenceGroup selection = av.getSelectionGroup();\r
-    if(selection!=null)\r
-     if(selection.getSize()<1 || (selection.getEndRes()-selection.getStartRes()<2))\r
-      selection = null;\r
 \r
-    while( !found && seqIndex<end)\r
+    if (selection != null)\r
     {\r
-      seq = (Sequence)av.alignment.getSequenceAt(seqIndex);\r
+      if ( (selection.getSize() < 1) ||\r
+          ( (selection.getEndRes() - selection.getStartRes()) < 2))\r
+      {\r
+        selection = null;\r
+      }\r
+    }\r
 \r
+    while (!found && (seqIndex < end))\r
+    {\r
+      seq = (Sequence) av.alignment.getSequenceAt(seqIndex);\r
 \r
-      if(selection!=null && !selection.sequences.contains(seq))\r
+      if ( (selection != null) && !selection.sequences.contains(seq))\r
       {\r
         seqIndex++;\r
-        resIndex=0;\r
+        resIndex = 0;\r
+\r
         continue;\r
       }\r
 \r
       item = seq.getSequence().toUpperCase();\r
 \r
-      if(selection!=null && selection.getEndRes()<av.alignment.getWidth())\r
-          item = item.substring(0, selection.getEndRes()+1);\r
+      if ( (selection != null) &&\r
+          (selection.getEndRes() < av.alignment.getWidth()))\r
+      {\r
+        item = item.substring(0, selection.getEndRes() + 1);\r
+      }\r
 \r
       ///Shall we ignore gaps????\r
       StringBuffer noGaps = new StringBuffer();\r
-      int insertCount=0;\r
+      int insertCount = 0;\r
       Vector spaces = new Vector();\r
 \r
-      for (int j=0; j < item.length(); j++)\r
+      for (int j = 0; j < item.length(); j++)\r
       {\r
-\r
-        if(!jalview.util.Comparison.isGap(item.charAt(j)))\r
-         {\r
-           noGaps.append(item.charAt(j));\r
-           spaces.add(new Integer(insertCount));\r
-         }\r
+        if (!jalview.util.Comparison.isGap(item.charAt(j)))\r
+        {\r
+          noGaps.append(item.charAt(j));\r
+          spaces.add(new Integer(insertCount));\r
+        }\r
         else\r
-           insertCount++;\r
+        {\r
+          insertCount++;\r
+        }\r
       }\r
 \r
-\r
-\r
-      for(int r = resIndex; r<noGaps.length(); r++)\r
+      for (int r = resIndex; r < noGaps.length(); r++)\r
       {\r
-\r
-       if( regex.searchFrom( noGaps.toString(), r ) )\r
-       {\r
-         resIndex = regex.matchedFrom();\r
-         if(selection!=null && ( resIndex+ Integer.parseInt(spaces.get(resIndex).toString()) )<selection.getStartRes())\r
-           continue;\r
-\r
-         searchResults.add( Integer.toString( seqIndex) );\r
-\r
-         int sres = seq.findPosition( resIndex+ Integer.parseInt(spaces.elementAt(resIndex).toString()) );\r
-         int eres = seq.findPosition( regex.matchedTo()-1 + Integer.parseInt(spaces.elementAt(regex.matchedTo()-1).toString()) );\r
-\r
-          searchResults.addElement( sres+"" );\r
-          searchResults.addElement( eres+"" );\r
-\r
-         if(!findAll)\r
-         {\r
-           // thats enough, break and display the result\r
-           found = true;\r
-           resIndex++;\r
-           break;\r
-         }\r
-\r
-         r=resIndex;\r
-       }\r
+        if (regex.searchFrom(noGaps.toString(), r))\r
+        {\r
+          resIndex = regex.matchedFrom();\r
+\r
+          if ( (selection != null) &&\r
+              ( (resIndex +\r
+                 Integer.parseInt(spaces.get(resIndex).toString())) <\r
+               selection.getStartRes()))\r
+          {\r
+            continue;\r
+          }\r
+\r
+          searchResults.add(Integer.toString(seqIndex));\r
+\r
+          int sres = seq.findPosition(resIndex +\r
+                                      Integer.parseInt(spaces.elementAt(\r
+              resIndex)\r
+              .toString()));\r
+          int eres = seq.findPosition(regex.matchedTo() - 1 +\r
+                                      Integer.parseInt(spaces.elementAt(regex.\r
+              matchedTo() -\r
+              1).toString()));\r
+\r
+          searchResults.addElement(sres + "");\r
+          searchResults.addElement(eres + "");\r
+\r
+          if (!findAll)\r
+          {\r
+            // thats enough, break and display the result\r
+            found = true;\r
+            resIndex++;\r
+\r
+            break;\r
+          }\r
+\r
+          r = resIndex;\r
+        }\r
       }\r
-      if(!found)\r
+\r
+      if (!found)\r
       {\r
         seqIndex++;\r
         resIndex = 0;\r
       }\r
     }\r
 \r
-\r
     Vector idMatch = new Vector();\r
-    for(int id = 0; id<av.alignment.getHeight(); id++)\r
+\r
+    for (int id = 0; id < av.alignment.getHeight(); id++)\r
     {\r
-      if(   regex.search( av.alignment.getSequenceAt(id).getName() ) )\r
-        idMatch.add( av.alignment.getSequenceAt(id) );\r
+      if (regex.search(av.alignment.getSequenceAt(id).getName()))\r
+      {\r
+        idMatch.add(av.alignment.getSequenceAt(id));\r
+      }\r
     }\r
 \r
-    if(searchResults.size()==0 && idMatch.size()>0)\r
-      ap.idPanel.highlightSearchResults( idMatch );\r
-\r
+    if ( (searchResults.size() == 0) && (idMatch.size() > 0))\r
+    {\r
+      ap.idPanel.highlightSearchResults(idMatch);\r
+    }\r
 \r
-    if(searchResults.size()>0)\r
+    if (searchResults.size() > 0)\r
     {\r
       allResults = new int[searchResults.size()];\r
-      for(int i=0; i<searchResults.size(); i++)\r
+\r
+      for (int i = 0; i < searchResults.size(); i++)\r
+      {\r
         allResults[i] = Integer.parseInt(searchResults.get(i).toString());\r
+      }\r
 \r
       createNewGroup.setEnabled(true);\r
     }\r
     else\r
     {\r
-      JOptionPane.showInternalMessageDialog(this, "Finished searching", null, JOptionPane.INFORMATION_MESSAGE);\r
-      resIndex=0;\r
-      seqIndex=0;\r
+      JOptionPane.showInternalMessageDialog(this, "Finished searching",\r
+                                            null,\r
+                                            JOptionPane.INFORMATION_MESSAGE);\r
+      resIndex = 0;\r
+      seqIndex = 0;\r
     }\r
 \r
     // if allResults is null, this effectively switches displaySearch flag in seqCanvas\r
-    ap.highlightSearchResults( allResults );\r
+    ap.highlightSearchResults(allResults);\r
 \r
     if (findAll)\r
     {\r
-      String message =  (searchResults.size()/3) + " matches found.";\r
+      String message = (searchResults.size() / 3) + " matches found.";\r
       JOptionPane.showInternalMessageDialog(this, message, null,\r
                                             JOptionPane.INFORMATION_MESSAGE);\r
     }\r
-\r
   }\r
-\r
 }\r
index d781d72..b911d7d 100755 (executable)
@@ -1,34 +1,32 @@
 /*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 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
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
+ */\r
 package jalview.gui;\r
 \r
-import jalview.jbgui.GFontChooser;\r
-import jalview.gui.*;\r
 import java.awt.*;\r
 import java.awt.event.*;\r
 import javax.swing.*;\r
-import javax.swing.event.*;\r
-import jalview.bin.Cache;\r
 \r
+import jalview.bin.*;\r
+import jalview.jbgui.*;\r
 \r
-public class FontChooser extends GFontChooser\r
+public class FontChooser\r
+    extends GFontChooser\r
 {\r
   AlignmentPanel ap;\r
   Font oldFont;\r
@@ -39,37 +37,50 @@ public class FontChooser extends GFontChooser
   {\r
     frame = new JInternalFrame();\r
     frame.setContentPane(this);\r
-    Desktop.addInternalFrame(frame, "Change Font", 480,100, false);\r
+    Desktop.addInternalFrame(frame, "Change Font", 480, 100, false);\r
     frame.setLayer(JLayeredPane.PALETTE_LAYER);\r
 \r
     this.ap = ap;\r
-    String fonts[] = java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames();\r
-    for(int i=0; i<fonts.length; i++)\r
+\r
+    String[] fonts = java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment()\r
+        .getAvailableFontFamilyNames();\r
+\r
+    for (int i = 0; i < fonts.length; i++)\r
+    {\r
       fontName.addItem(fonts[i]);\r
+    }\r
 \r
-    for(int i=1; i<31; i++)\r
-      fontSize.addItem(i+"");\r
+    for (int i = 1; i < 31; i++)\r
+    {\r
+      fontSize.addItem(i + "");\r
+    }\r
 \r
-   fontStyle.addItem("plain");\r
-   fontStyle.addItem("bold");\r
-   fontStyle.addItem("italic");\r
+    fontStyle.addItem("plain");\r
+    fontStyle.addItem("bold");\r
+    fontStyle.addItem("italic");\r
 \r
-   oldFont = ap.av.getFont();\r
-   fontName.setSelectedItem(oldFont.getName());\r
-   fontSize.setSelectedItem(oldFont.getSize()+"");\r
-   fontStyle.setSelectedIndex(oldFont.getStyle());\r
+    oldFont = ap.av.getFont();\r
+    fontName.setSelectedItem(oldFont.getName());\r
+    fontSize.setSelectedItem(oldFont.getSize() + "");\r
+    fontStyle.setSelectedIndex(oldFont.getStyle());\r
 \r
-   init = false;\r
+    init = false;\r
   }\r
 \r
   protected void ok_actionPerformed(ActionEvent e)\r
   {\r
-    try{\r
+    try\r
+    {\r
       frame.setClosed(true);\r
-    }catch(Exception ex){}\r
-\r
-   if(ap.getOverviewPanel()!=null)\r
-     ap.getOverviewPanel().updateOverviewImage();\r
+    }\r
+    catch (Exception ex)\r
+    {\r
+    }\r
+\r
+    if (ap.getOverviewPanel() != null)\r
+    {\r
+      ap.getOverviewPanel().updateOverviewImage();\r
+    }\r
   }\r
 \r
   protected void cancel_actionPerformed(ActionEvent e)\r
@@ -77,48 +88,62 @@ public class FontChooser extends GFontChooser
     ap.av.setFont(oldFont);\r
     ap.repaint();\r
     fontName.setSelectedItem(oldFont.getName());\r
-    fontSize.setSelectedItem(oldFont.getSize()+"");\r
+    fontSize.setSelectedItem(oldFont.getSize() + "");\r
     fontStyle.setSelectedIndex(oldFont.getStyle());\r
-    try{\r
+\r
+    try\r
+    {\r
       frame.setClosed(true);\r
-    }catch(Exception ex){}\r
+    }\r
+    catch (Exception ex)\r
+    {\r
+    }\r
   }\r
 \r
   void changeFont()\r
   {\r
     Font newFont = new Font(fontName.getSelectedItem().toString(),\r
                             fontStyle.getSelectedIndex(),\r
-                            Integer.parseInt(fontSize.getSelectedItem().toString())\r
-                            );\r
+                            Integer.parseInt(fontSize.getSelectedItem().\r
+                                             toString()));\r
     ap.av.setFont(newFont);\r
     ap.fontChanged();\r
   }\r
 \r
   protected void fontName_actionPerformed(ActionEvent e)\r
   {\r
-    if(init) return;\r
+    if (init)\r
+    {\r
+      return;\r
+    }\r
+\r
     changeFont();\r
   }\r
 \r
   protected void fontSize_actionPerformed(ActionEvent e)\r
   {\r
-    if(init) return;\r
+    if (init)\r
+    {\r
+      return;\r
+    }\r
+\r
     changeFont();\r
   }\r
 \r
   protected void fontStyle_actionPerformed(ActionEvent e)\r
   {\r
-    if(init) return;\r
+    if (init)\r
+    {\r
+      return;\r
+    }\r
+\r
     changeFont();\r
   }\r
 \r
   public void defaultButton_actionPerformed(ActionEvent e)\r
   {\r
     Cache.setProperty("FONT_NAME", fontName.getSelectedItem().toString());\r
-    Cache.setProperty("FONT_STYLE", fontStyle.getSelectedIndex()+"");\r
+    Cache.setProperty("FONT_STYLE", fontStyle.getSelectedIndex() + "");\r
     Cache.setProperty("FONT_SIZE", fontSize.getSelectedItem().toString());\r
   }\r
-\r
-\r
-\r
 }\r
index c523060..e30be30 100755 (executable)
 /*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 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
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
+ */\r
 package jalview.gui;\r
 \r
 import java.awt.*;\r
-import java.awt.Graphics2D.*;\r
 import java.awt.image.*;\r
 import javax.swing.*;\r
-import jalview.datamodel.*;\r
+\r
 import jalview.analysis.*;\r
-public class IdCanvas extends JPanel\r
+import jalview.datamodel.*;\r
+\r
+public class IdCanvas\r
+    extends JPanel\r
 {\r
   protected AlignViewport av;\r
-\r
-  protected boolean showScores  = true;\r
-\r
-  protected int     maxIdLength = -1;\r
-  protected String  maxIdStr    = null;\r
+  protected boolean showScores = true;\r
+  protected int maxIdLength = -1;\r
+  protected String maxIdStr = null;\r
   BufferedImage image;\r
   Graphics2D gg;\r
-  int imgHeight=0;\r
+  int imgHeight = 0;\r
   boolean fastPaint = false;\r
-\r
   java.util.Vector searchResults;\r
 \r
   public IdCanvas(AlignViewport av)\r
   {\r
     setLayout(new BorderLayout());\r
-    this.av         = av;\r
+    this.av = av;\r
     PaintRefresher.Register(this);\r
   }\r
 \r
-  public void drawIdString(Graphics2D gg,SequenceI s,int i, int starty, int ypos) {\r
-      int charHeight = av.getCharHeight();\r
+  public void drawIdString(Graphics2D gg, SequenceI s, int i, int starty,\r
+                           int ypos)\r
+  {\r
+    int charHeight = av.getCharHeight();\r
 \r
-      if(searchResults!=null && searchResults.contains(s))\r
-      {\r
-        gg.setColor(Color.black);\r
-        gg.fillRect(0,AlignmentUtil.getPixelHeight(starty,i,charHeight)+ ypos,getWidth(),charHeight);\r
-        gg.setColor(Color.white);\r
-      }\r
-      else if (av.getSelectionGroup()!=null && av.getSelectionGroup().sequences.contains(s)) {\r
-         gg.setColor(Color.lightGray);\r
-         gg.fillRect(0,AlignmentUtil.getPixelHeight(starty,i,charHeight)+ ypos,getWidth(),charHeight);\r
-         gg.setColor(Color.white);\r
-      } else {\r
-         gg.setColor(s.getColor());\r
-         gg.fillRect(0,AlignmentUtil.getPixelHeight(starty,i,charHeight)+ ypos,getWidth(),charHeight);\r
-         gg.setColor(Color.black);\r
-      }\r
+    if ( (searchResults != null) && searchResults.contains(s))\r
+    {\r
+      gg.setColor(Color.black);\r
+      gg.fillRect(0,\r
+                  AlignmentUtil.getPixelHeight(starty, i, charHeight) + ypos,\r
+                  getWidth(), charHeight);\r
+      gg.setColor(Color.white);\r
+    }\r
+    else if ( (av.getSelectionGroup() != null) &&\r
+             av.getSelectionGroup().sequences.contains(s))\r
+    {\r
+      gg.setColor(Color.lightGray);\r
+      gg.fillRect(0,\r
+                  AlignmentUtil.getPixelHeight(starty, i, charHeight) + ypos,\r
+                  getWidth(), charHeight);\r
+      gg.setColor(Color.white);\r
+    }\r
+    else\r
+    {\r
+      gg.setColor(s.getColor());\r
+      gg.fillRect(0,\r
+                  AlignmentUtil.getPixelHeight(starty, i, charHeight) + ypos,\r
+                  getWidth(), charHeight);\r
+      gg.setColor(Color.black);\r
+    }\r
 \r
-      String string = s.getName();\r
-      if(av.getShowFullId())\r
-        string = s.getDisplayId();\r
+    String string = s.getName();\r
 \r
-      gg.drawString(string,0,AlignmentUtil.getPixelHeight(starty,i,charHeight) + ypos + charHeight-   (charHeight/5));\r
+    if (av.getShowFullId())\r
+    {\r
+      string = s.getDisplayId();\r
+    }\r
 \r
+    gg.drawString(string, 0,\r
+                  (AlignmentUtil.getPixelHeight(starty, i, charHeight) + ypos +\r
+                   charHeight) - (charHeight / 5));\r
   }\r
 \r
   public void fastPaint(int vertical)\r
   {\r
-    if(gg==null)\r
-    {  repaint(); return;}\r
+    if (gg == null)\r
+    {\r
+      repaint();\r
 \r
-    gg.copyArea( 0,0, getWidth(), imgHeight, 0, -vertical*av.charHeight );\r
+      return;\r
+    }\r
 \r
-    int ss=av.startSeq, es=av.endSeq, transY = 0;\r
-    if (vertical > 0) // scroll down\r
-     {\r
-       ss = es - vertical;\r
-       if(ss<av.startSeq) // ie scrolling too fast, more than a page at a time\r
-         ss = av.startSeq;\r
-       else\r
-         transY = imgHeight - vertical * av.charHeight;\r
-     }\r
-     else if (vertical < 0)\r
-     {\r
-       es = ss - vertical;\r
-       if(es > av.endSeq)\r
-         es = av.endSeq;\r
-     }\r
+    gg.copyArea(0, 0, getWidth(), imgHeight, 0, -vertical * av.charHeight);\r
 \r
+    int ss = av.startSeq;\r
+    int es = av.endSeq;\r
+    int transY = 0;\r
 \r
+    if (vertical > 0) // scroll down\r
+    {\r
+      ss = es - vertical;\r
 \r
-        gg.translate(0, transY);\r
+      if (ss < av.startSeq)\r
+      { // ie scrolling too fast, more than a page at a time\r
+        ss = av.startSeq;\r
+      }\r
+      else\r
+      {\r
+        transY = imgHeight - (vertical * av.charHeight);\r
+      }\r
+    }\r
+    else if (vertical < 0)\r
+    {\r
+      es = ss - vertical;\r
+\r
+      if (es > av.endSeq)\r
+      {\r
+        es = av.endSeq;\r
+      }\r
+    }\r
 \r
-        drawIds(ss, es);\r
+    gg.translate(0, transY);\r
 \r
-        gg.translate( 0, -transY );\r
+    drawIds(ss, es);\r
 \r
+    gg.translate(0, -transY);\r
 \r
-      fastPaint = true;\r
-      repaint();\r
+    fastPaint = true;\r
+    repaint();\r
   }\r
 \r
   public void paintComponent(Graphics g)\r
@@ -119,70 +145,74 @@ public class IdCanvas extends JPanel
     {\r
       fastPaint = false;\r
       g.drawImage(image, 0, 0, this);\r
+\r
       return;\r
     }\r
 \r
     imgHeight = getHeight();\r
-    imgHeight -= imgHeight % av.charHeight;\r
+    imgHeight -= (imgHeight % av.charHeight);\r
 \r
-    if (imgHeight<1)\r
+    if (imgHeight < 1)\r
+    {\r
       return;\r
+    }\r
 \r
-    image = new BufferedImage(getWidth(), imgHeight, BufferedImage.TYPE_INT_RGB);\r
+    image = new BufferedImage(getWidth(), imgHeight,\r
+                              BufferedImage.TYPE_INT_RGB);\r
     gg = (Graphics2D) image.getGraphics();\r
+\r
     //Fill in the background\r
     gg.setColor(Color.white);\r
     gg.fillRect(0, 0, getWidth(), imgHeight);\r
     gg.setRenderingHint(RenderingHints.KEY_ANTIALIASING,\r
                         RenderingHints.VALUE_ANTIALIAS_ON);\r
+\r
     Font italic = new Font(av.getFont().getName(), Font.ITALIC,\r
                            av.getFont().getSize());\r
     gg.setFont(italic);\r
 \r
-    drawIds( av.getStartSeq(), av.endSeq);\r
+    drawIds(av.getStartSeq(), av.endSeq);\r
 \r
     g.drawImage(image, 0, 0, this);\r
   }\r
 \r
   void drawIds(int starty, int endy)\r
   {\r
-    Color currentColor     = Color.white;\r
+    Color currentColor = Color.white;\r
     Color currentTextColor = Color.black;\r
 \r
     if (av.getWrapAlignment())\r
     {\r
+      int rowSize = av.getEndRes() - av.getStartRes();\r
 \r
-          int rowSize =  av.getEndRes() - av.getStartRes();\r
-          // Draw the rest of the panels\r
-\r
-          for(int ypos=2*av.charHeight, row=av.startRes;\r
-              ypos <= getHeight() && row<av.alignment.getWidth();\r
-              ypos += av.chunkHeight, row+=rowSize )\r
-          {\r
-            for (int i = starty; i < av.alignment.getHeight(); i++)\r
-            {\r
-              SequenceI s = av.alignment.getSequenceAt(i);\r
-              drawIdString(gg, s, i, 0, ypos);\r
-            }\r
-          }\r
-\r
-\r
-    } else\r
+      // Draw the rest of the panels\r
+      for (int ypos = 2 * av.charHeight, row = av.startRes;\r
+           (ypos <= getHeight()) && (row < av.alignment.getWidth());\r
+           ypos += av.chunkHeight, row += rowSize)\r
+      {\r
+        for (int i = starty; i < av.alignment.getHeight(); i++)\r
+        {\r
+          SequenceI s = av.alignment.getSequenceAt(i);\r
+          drawIdString(gg, s, i, 0, ypos);\r
+        }\r
+      }\r
+    }\r
+    else\r
     {\r
-\r
       //Now draw the id strings\r
       for (int i = starty; i < endy; i++)\r
       {\r
         // Selected sequence colours\r
-\r
-        if(searchResults!=null && searchResults.contains(av.alignment.getSequenceAt(i)))\r
+        if ( (searchResults != null) &&\r
+            searchResults.contains(av.alignment.getSequenceAt(i)))\r
         {\r
           gg.setColor(Color.black);\r
           currentColor = Color.black;\r
           currentTextColor = Color.white;\r
-      }\r
-      else if (av.getSelectionGroup()!= null\r
-            && av.getSelectionGroup().sequences.contains(av.alignment.getSequenceAt(i)))\r
+        }\r
+        else if ( (av.getSelectionGroup() != null) &&\r
+                 av.getSelectionGroup().sequences.contains(\r
+                     av.alignment.getSequenceAt(i)))\r
         {\r
           currentColor = Color.lightGray;\r
           currentTextColor = Color.black;\r
@@ -197,23 +227,26 @@ public class IdCanvas extends JPanel
 \r
         gg.fillRect(0,\r
                     AlignmentUtil.getPixelHeight(starty, i, av.charHeight),\r
-                    getWidth(),\r
-                    av.charHeight);\r
+                    getWidth(), av.charHeight);\r
 \r
         gg.setColor(currentTextColor);\r
+\r
         String string = av.alignment.getSequenceAt(i).getName();\r
-        if(av.getShowFullId())\r
+\r
+        if (av.getShowFullId())\r
+        {\r
           string = av.alignment.getSequenceAt(i).getDisplayId();\r
+        }\r
+\r
         gg.drawString(string, 0,\r
-                      AlignmentUtil.getPixelHeight(starty, i, av.charHeight) +\r
-                      av.charHeight - (av.charHeight / 5));\r
+                      (AlignmentUtil.getPixelHeight(starty, i, av.charHeight) +\r
+                       av.charHeight) - (av.charHeight / 5));\r
       }\r
 \r
       // add a border\r
       gg.setColor(Color.white);\r
-      gg.fillRect(getWidth()-4,0,4,getHeight());\r
+      gg.fillRect(getWidth() - 4, 0, 4, getHeight());\r
     }\r
-\r
   }\r
 \r
   public void setHighlighted(java.util.Vector found)\r
index 4236cf8..4efef45 100755 (executable)
@@ -1,46 +1,45 @@
 /*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 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
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
+ */\r
 package jalview.gui;\r
 \r
 import java.awt.*;\r
 import java.awt.event.*;\r
-\r
-import jalview.datamodel.*;\r
-\r
 import javax.swing.*;\r
 \r
-public class IdPanel extends JPanel implements MouseListener, MouseMotionListener {\r
+import jalview.datamodel.*;\r
 \r
-  protected IdCanvas       idCanvas;\r
-  protected AlignViewport  av;\r
+public class IdPanel\r
+    extends JPanel implements MouseListener,\r
+    MouseMotionListener\r
+{\r
+  protected IdCanvas idCanvas;\r
+  protected AlignViewport av;\r
   protected AlignmentPanel alignPanel;\r
   ScrollThread scrollThread = null;\r
-\r
-  int            offy;\r
-  int            width;\r
+  int offy;\r
+  int width;\r
   int lastid = -1;\r
   boolean mouseDragging = false;\r
 \r
   public IdPanel(AlignViewport av, AlignmentPanel parent)\r
   {\r
-    this.av         = av;\r
+    this.av = av;\r
     alignPanel = parent;\r
     idCanvas = new IdCanvas(av);\r
     setLayout(new BorderLayout());\r
@@ -49,24 +48,36 @@ public class IdPanel extends JPanel implements MouseListener, MouseMotionListene
     addMouseMotionListener(this);\r
   }\r
 \r
-  public void mouseMoved(MouseEvent e) {}\r
-\r
+  public void mouseMoved(MouseEvent e)\r
+  {\r
+  }\r
 \r
-  public void mouseDragged(MouseEvent e) {\r
+  public void mouseDragged(MouseEvent e)\r
+  {\r
     mouseDragging = true;\r
 \r
     int y = e.getY();\r
-    if(av.getWrapAlignment())\r
-      y-=2*av.charHeight;\r
+\r
+    if (av.getWrapAlignment())\r
+    {\r
+      y -= (2 * av.charHeight);\r
+    }\r
+\r
     int seq = av.getIndex(y);\r
 \r
-    if(seq<0)\r
+    if (seq < 0)\r
+    {\r
       return;\r
+    }\r
 \r
     if (seq < lastid)\r
+    {\r
       selectSeqs(lastid - 1, seq);\r
+    }\r
     else if (seq > lastid)\r
+    {\r
       selectSeqs(lastid + 1, seq);\r
+    }\r
 \r
     lastid = seq;\r
     alignPanel.repaint();\r
@@ -76,95 +87,128 @@ public class IdPanel extends JPanel implements MouseListener, MouseMotionListene
   {\r
     if (e.getClickCount() == 2)\r
     {\r
-       int y = e.getY();\r
-       if(av.getWrapAlignment())\r
-         y-=2*av.charHeight;\r
-\r
-       int seq = av.getIndex(y);\r
-       String id = av.getAlignment().getSequenceAt(seq).getName();\r
-\r
-       try{\r
-         jalview.util.BrowserLauncher.openURL(\r
-             "http://srs.ebi.ac.uk/srs7bin/cgi-bin/wgetz?-e+[swall-id:" + id +\r
-             "]+-vn+2");\r
-       }catch(Exception ex){\r
-         // TODO: JBPNote : state dependent error message for real browserLaunch problems rather than unix misconfiguration.\r
-         System.err.println(\r
-             ex.getMessage()+"\nUnixers: Try adding this jalview.browser property line \n"\r
-             +"in your jalview.properties file (/usr/local/bin/firefox is an exanmple browser path):\n"\r
-             +"jalview.browser=/usr/local/bin/firefox\n");\r
-         //ex.printStackTrace();\r
-       }\r
-    }\r
+      int y = e.getY();\r
 \r
+      if (av.getWrapAlignment())\r
+      {\r
+        y -= (2 * av.charHeight);\r
+      }\r
+\r
+      int seq = av.getIndex(y);\r
+      String id = av.getAlignment().getSequenceAt(seq).getName();\r
+\r
+      try\r
+      {\r
+        jalview.util.BrowserLauncher.openURL(\r
+            "http://srs.ebi.ac.uk/srs7bin/cgi-bin/wgetz?-e+[swall-id:" +\r
+            id + "]+-vn+2");\r
+      }\r
+      catch (Exception ex)\r
+      {\r
+        // TODO: JBPNote : state dependent error message for real browserLaunch problems rather than unix misconfiguration.\r
+        System.err.println(ex.getMessage() +\r
+                           "\nUnixers: Try adding this jalview.browser property line \n" +\r
+                           "in your jalview.properties file (/usr/local/bin/firefox is an exanmple browser path):\n" +\r
+                           "jalview.browser=/usr/local/bin/firefox\n");\r
+\r
+        //ex.printStackTrace();\r
+      }\r
+    }\r
   }\r
+\r
   public void mouseEntered(MouseEvent e)\r
   {\r
-    if(scrollThread!=null)\r
+    if (scrollThread != null)\r
+    {\r
       scrollThread.running = false;\r
+    }\r
   }\r
 \r
-  public void mouseExited (MouseEvent e)\r
+  public void mouseExited(MouseEvent e)\r
   {\r
-    if(av.getWrapAlignment())\r
+    if (av.getWrapAlignment())\r
+    {\r
       return;\r
+    }\r
 \r
-    if(mouseDragging && e.getY()<0 && av.getStartSeq()>0)\r
+    if (mouseDragging && (e.getY() < 0) && (av.getStartSeq() > 0))\r
     {\r
       scrollThread = new ScrollThread(true);\r
     }\r
 \r
-    if(mouseDragging && e.getY()>=getHeight() && av.alignment.getHeight()>av.getEndSeq())\r
+    if (mouseDragging && (e.getY() >= getHeight()) &&\r
+        (av.alignment.getHeight() > av.getEndSeq()))\r
     {\r
       scrollThread = new ScrollThread(false);\r
     }\r
   }\r
 \r
-\r
-  public void mousePressed(MouseEvent e) {\r
+  public void mousePressed(MouseEvent e)\r
+  {\r
     if (e.getClickCount() == 2)\r
+    {\r
       return;\r
+    }\r
 \r
     int y = e.getY();\r
-    if(av.getWrapAlignment())\r
-      y-=2*av.charHeight;\r
+\r
+    if (av.getWrapAlignment())\r
+    {\r
+      y -= (2 * av.charHeight);\r
+    }\r
 \r
     int seq = av.getIndex(y);\r
+\r
     if (seq == -1)\r
+    {\r
       return;\r
+    }\r
 \r
     if (javax.swing.SwingUtilities.isRightMouseButton(e))\r
     {\r
       jalview.gui.PopupMenu pop = new jalview.gui.PopupMenu(alignPanel,\r
-          (Sequence)av.getAlignment().getSequenceAt(seq));\r
+          (Sequence) av.getAlignment().getSequenceAt(seq));\r
       pop.show(this, e.getX(), y);\r
+\r
       return;\r
     }\r
 \r
-    if(!e.isControlDown() && !e.isShiftDown() && av.alignment.findGroup( av.alignment.getSequenceAt(seq))!=null)\r
+    if (!e.isControlDown() && !e.isShiftDown() &&\r
+        (av.alignment.findGroup(av.alignment.getSequenceAt(seq)) != null))\r
     {\r
-\r
       SequenceGroup selection = new SequenceGroup();\r
-      SequenceGroup sg = av.alignment.findGroup(av.alignment.getSequenceAt(seq));\r
+      SequenceGroup sg = av.alignment.findGroup(av.alignment.getSequenceAt(\r
+          seq));\r
       selection.setStartRes(0);\r
-      selection.setEndRes(av.alignment.getWidth()-1);\r
-      for (int i =0; i< sg.getSize(); i++)\r
+      selection.setEndRes(av.alignment.getWidth() - 1);\r
+\r
+      for (int i = 0; i < sg.getSize(); i++)\r
+      {\r
         selection.addSequence(sg.getSequenceAt(i));\r
+      }\r
 \r
       av.setSelectionGroup(selection);\r
+\r
       return;\r
     }\r
 \r
-    if(av.getSelectionGroup()==null || ( !e.isControlDown() && av.getSelectionGroup()!=null))\r
+    if ( (av.getSelectionGroup() == null) ||\r
+        (!e.isControlDown() && (av.getSelectionGroup() != null)))\r
+    {\r
       av.setSelectionGroup(new SequenceGroup());\r
+    }\r
 \r
     av.getSelectionGroup().setStartRes(0);\r
-    av.getSelectionGroup().setEndRes(av.alignment.getWidth()-1);\r
+    av.getSelectionGroup().setEndRes(av.alignment.getWidth() - 1);\r
 \r
-    if(e.isShiftDown() && lastid!=-1)\r
+    if (e.isShiftDown() && (lastid != -1))\r
+    {\r
       selectSeqs(lastid, seq);\r
+    }\r
     else\r
+    {\r
       selectSeq(seq);\r
+    }\r
 \r
     alignPanel.repaint();\r
   }\r
@@ -172,48 +216,56 @@ public class IdPanel extends JPanel implements MouseListener, MouseMotionListene
   void selectSeq(int seq)\r
   {\r
     lastid = seq;\r
+\r
     SequenceI pickedSeq = av.getAlignment().getSequenceAt(seq);\r
     av.getSelectionGroup().addOrRemove(pickedSeq);\r
   }\r
 \r
-  void selectSeqs(int start, int end) {\r
-\r
+  void selectSeqs(int start, int end)\r
+  {\r
     lastid = start;\r
-    if (end < start)\r
-     {\r
-       int tmp = start;\r
-       start = end;\r
-       end   = tmp;\r
-       lastid = end;\r
-     }\r
-\r
-     for (int i = start; i <= end; i++)\r
-        av.getSelectionGroup().addSequence(av.getAlignment().getSequenceAt(i));\r
 \r
-   }\r
+    if (end < start)\r
+    {\r
+      int tmp = start;\r
+      start = end;\r
+      end = tmp;\r
+      lastid = end;\r
+    }\r
 \r
+    for (int i = start; i <= end; i++)\r
+    {\r
+      av.getSelectionGroup().addSequence(av.getAlignment().getSequenceAt(i));\r
+    }\r
+  }\r
 \r
   public void mouseReleased(MouseEvent e)\r
   {\r
-    if(scrollThread!=null)\r
+    if (scrollThread != null)\r
+    {\r
       scrollThread.running = false;\r
+    }\r
 \r
     mouseDragging = false;\r
     PaintRefresher.Refresh(this);\r
   }\r
 \r
-  public void highlightSearchResults( java.util.Vector found )\r
+  public void highlightSearchResults(java.util.Vector found)\r
   {\r
-    idCanvas.setHighlighted( found );\r
+    idCanvas.setHighlighted(found);\r
 \r
-    if(found == null)\r
+    if (found == null)\r
+    {\r
       return;\r
+    }\r
 \r
-    int index = av.alignment.findIndex( (SequenceI)found.get(0));\r
+    int index = av.alignment.findIndex( (SequenceI) found.get(0));\r
 \r
     // do we need to scroll the panel?\r
-    if(av.getStartSeq()>index || av.getEndSeq()<index)\r
-        alignPanel.setScrollValues( av.getStartRes(), index);\r
+    if ( (av.getStartSeq() > index) || (av.getEndSeq() < index))\r
+    {\r
+      alignPanel.setScrollValues(av.getStartRes(), index);\r
+    }\r
   }\r
 \r
   // this class allows scrolling off the bottom of the visible alignment\r
@@ -222,6 +274,7 @@ public class IdPanel extends JPanel implements MouseListener, MouseMotionListene
   {\r
     boolean running = false;\r
     boolean up = true;\r
+\r
     public ScrollThread(boolean up)\r
     {\r
       this.up = up;\r
@@ -236,34 +289,45 @@ public class IdPanel extends JPanel implements MouseListener, MouseMotionListene
     public void run()\r
     {\r
       running = true;\r
+\r
       while (running)\r
       {\r
-        if(alignPanel.scrollUp(up))\r
+        if (alignPanel.scrollUp(up))\r
         {\r
           // scroll was ok, so add new sequence to selection\r
           int seq = av.getStartSeq();\r
-          if(!up)\r
+\r
+          if (!up)\r
+          {\r
             seq = av.getEndSeq();\r
+          }\r
 \r
           if (seq < lastid)\r
+          {\r
             selectSeqs(lastid - 1, seq);\r
+          }\r
           else if (seq > lastid)\r
+          {\r
             selectSeqs(lastid + 1, seq);\r
+          }\r
 \r
           lastid = seq;\r
         }\r
         else\r
+        {\r
           running = false;\r
+        }\r
 \r
         alignPanel.repaint();\r
+\r
         try\r
         {\r
           Thread.sleep(100);\r
         }\r
         catch (Exception ex)\r
-        {}\r
+        {\r
+        }\r
       }\r
     }\r
-}\r
-\r
+  }\r
 }\r
index ead38dc..5599a6d 100755 (executable)
 /*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 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
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
+ */\r
 package jalview.gui;\r
 \r
-import javax.swing.*;\r
-import java.awt.event.*;\r
 import java.awt.*;\r
+import java.awt.event.*;\r
+import javax.swing.*;\r
 \r
-\r
-public class IdwidthAdjuster extends JPanel implements MouseListener, MouseMotionListener\r
+public class IdwidthAdjuster\r
+    extends JPanel implements MouseListener,\r
+    MouseMotionListener\r
 {\r
   boolean active = false;\r
-  int oldX=0;\r
+  int oldX = 0;\r
   Image image;\r
-  AlignmentPanel ap ;\r
+  AlignmentPanel ap;\r
 \r
   public IdwidthAdjuster(AlignmentPanel ap)\r
   {\r
     this.ap = ap;\r
+\r
     java.net.URL url = getClass().getResource("/images/idwidth.gif");\r
-       if (url != null)\r
-         image = java.awt.Toolkit.getDefaultToolkit().createImage(url);\r
+\r
+    if (url != null)\r
+    {\r
+      image = java.awt.Toolkit.getDefaultToolkit().createImage(url);\r
+    }\r
 \r
     addMouseListener(this);\r
     addMouseMotionListener(this);\r
   }\r
 \r
   public void mousePressed(MouseEvent evt)\r
-  { oldX = evt.getX(); }\r
+  {\r
+    oldX = evt.getX();\r
+  }\r
+\r
+  public void mouseReleased(MouseEvent evt)\r
+  {\r
+    active = false;\r
+    repaint();\r
+  }\r
+\r
+  public void mouseEntered(MouseEvent evt)\r
+  {\r
+    active = true;\r
+    repaint();\r
+  }\r
+\r
+  public void mouseExited(MouseEvent evt)\r
+  {\r
+    active = false;\r
+    repaint();\r
+  }\r
 \r
-  public void mouseReleased(MouseEvent evt){ active = false; repaint(); }\r
-  public void mouseEntered(MouseEvent evt) { active = true;  repaint();}\r
-  public void mouseExited(MouseEvent evt)  { active = false; repaint();}\r
   public void mouseDragged(MouseEvent evt)\r
   {\r
     active = true;\r
+\r
     Dimension d = ap.idPanel.idCanvas.getPreferredSize();\r
     int dif = evt.getX() - oldX;\r
 \r
-    if(d.width+dif>20 || dif>0)\r
+    if ( ( (d.width + dif) > 20) || (dif > 0))\r
     {\r
-      ap.idPanel.idCanvas.setPreferredSize(new Dimension(d.width + dif,d.height));\r
+      ap.idPanel.idCanvas.setPreferredSize(new Dimension(d.width + dif,\r
+          d.height));\r
       ap.repaint();\r
     }\r
 \r
     oldX = evt.getX();\r
   }\r
 \r
-  public void mouseMoved(MouseEvent evt)   {}\r
-  public void mouseClicked(MouseEvent evt) {}\r
+  public void mouseMoved(MouseEvent evt)\r
+  {\r
+  }\r
+\r
+  public void mouseClicked(MouseEvent evt)\r
+  {\r
+  }\r
 \r
   public void paintComponent(Graphics g)\r
   {\r
     g.setColor(Color.white);\r
-    g.fillRect(0,0, getWidth(), getHeight());\r
-    if(active)\r
+    g.fillRect(0, 0, getWidth(), getHeight());\r
+\r
+    if (active)\r
     {\r
-      if(image!=null)\r
-        g.drawImage(image, getWidth()-20, 2, this);\r
+      if (image != null)\r
+      {\r
+        g.drawImage(image, getWidth() - 20, 2, this);\r
+      }\r
     }\r
   }\r
-\r
 }\r
index 89a7bfc..bfd97f0 100755 (executable)
 /*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 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
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
+ */\r
 package jalview.gui;\r
 \r
 import java.io.*;\r
+import java.net.*;\r
 import java.util.*;\r
 import java.util.jar.*;\r
 \r
+import javax.swing.*;\r
+\r
 import jalview.binding.*;\r
+import jalview.io.*;\r
 import jalview.schemes.*;\r
-import javax.swing.JInternalFrame;\r
-import java.net.URL;\r
-import jalview.io.SequenceFeatureFetcher;\r
-\r
 \r
 public class Jalview2XML\r
 {\r
-\r
   // SAVES SEVERAL ALIGNEMENT WINDOWS TO SAME JARFILE\r
   public static void SaveState(File statefile)\r
   {\r
-      long creation = System.currentTimeMillis();\r
-      JInternalFrame[] frames = Desktop.desktop.getAllFrames();\r
-      if(frames==null)\r
-        return;\r
-\r
-      try{\r
-        FileOutputStream fos = new FileOutputStream(statefile);\r
-        JarOutputStream jout = new JarOutputStream(fos);\r
-        //NOTE UTF-8 MUST BE USED FOR WRITING UNICODE CHARS\r
-        ////////////////////////////////////////////////////\r
-        PrintWriter out = new PrintWriter(new OutputStreamWriter(jout, "UTF-8"));\r
-\r
-        Vector shortNames = new Vector();\r
-        //REVERSE ORDER\r
-        for (int i = frames.length-1; i > -1; i--)\r
+    long creation = System.currentTimeMillis();\r
+    JInternalFrame[] frames = Desktop.desktop.getAllFrames();\r
+\r
+    if (frames == null)\r
+    {\r
+      return;\r
+    }\r
+\r
+    try\r
+    {\r
+      FileOutputStream fos = new FileOutputStream(statefile);\r
+      JarOutputStream jout = new JarOutputStream(fos);\r
+\r
+      //NOTE UTF-8 MUST BE USED FOR WRITING UNICODE CHARS\r
+      ////////////////////////////////////////////////////\r
+      PrintWriter out = new PrintWriter(new OutputStreamWriter(jout,\r
+          "UTF-8"));\r
+\r
+      Vector shortNames = new Vector();\r
+\r
+      //REVERSE ORDER\r
+      for (int i = frames.length - 1; i > -1; i--)\r
+      {\r
+        if (frames[i] instanceof AlignFrame)\r
         {\r
-          if (frames[i] instanceof AlignFrame)\r
-          {\r
-            AlignFrame af = (AlignFrame) frames[i];\r
+          AlignFrame af = (AlignFrame) frames[i];\r
 \r
-            String shortName = af.getTitle();\r
+          String shortName = af.getTitle();\r
 \r
-            if(shortName.indexOf(File.separatorChar)>-1)\r
-              shortName = shortName.substring(\r
-                    shortName.lastIndexOf(File.separatorChar)+1);\r
+          if (shortName.indexOf(File.separatorChar) > -1)\r
+          {\r
+            shortName = shortName.substring(shortName.lastIndexOf(\r
+                File.separatorChar) + 1);\r
+          }\r
 \r
-            int count=1;\r
-            while( shortNames.contains(shortName) )\r
-            {\r
-              if(shortName.endsWith("_"+(count-1)))\r
-                shortName = shortName.substring(0, shortName.lastIndexOf("_"));\r
+          int count = 1;\r
 \r
-              shortName = shortName.concat("_"+count);\r
-              count++;\r
+          while (shortNames.contains(shortName))\r
+          {\r
+            if (shortName.endsWith("_" + (count - 1)))\r
+            {\r
+              shortName = shortName.substring(0,\r
+                                              shortName.lastIndexOf("_"));\r
             }\r
-            shortNames.addElement(shortName);\r
 \r
-            if(!shortName.endsWith(".xml"))\r
-              shortName = shortName+".xml";\r
+            shortName = shortName.concat("_" + count);\r
+            count++;\r
+          }\r
+\r
+          shortNames.addElement(shortName);\r
+\r
+          if (!shortName.endsWith(".xml"))\r
+          {\r
+            shortName = shortName + ".xml";\r
+          }\r
 \r
-            SaveState( af, creation, shortName, jout, out);\r
-           }\r
+          SaveState(af, creation, shortName, jout, out);\r
         }\r
-        out.close();\r
-        jout.close();\r
       }\r
-      catch(Exception ex){ex.printStackTrace();}\r
+\r
+      out.close();\r
+      jout.close();\r
+    }\r
+    catch (Exception ex)\r
+    {\r
+      ex.printStackTrace();\r
+    }\r
   }\r
 \r
   // USE THIS METHOD TO SAVE A SINGLE ALIGNMENT WINDOW\r
-  public static void SaveState( AlignFrame af, String jarFile, String fileName)\r
+  public static void SaveState(AlignFrame af, String jarFile, String fileName)\r
   {\r
-    try{\r
+    try\r
+    {\r
       FileOutputStream fos = new FileOutputStream(jarFile);\r
       JarOutputStream jout = new JarOutputStream(fos);\r
+\r
       //NOTE UTF-8 MUST BE USED FOR WRITING UNICODE CHARS\r
       ////////////////////////////////////////////////////\r
-      PrintWriter out = new PrintWriter(new OutputStreamWriter(jout, "UTF-8"));\r
+      PrintWriter out = new PrintWriter(new OutputStreamWriter(jout,\r
+          "UTF-8"));\r
 \r
       SaveState(af, System.currentTimeMillis(), fileName, jout, out);\r
       out.close();\r
       jout.close();\r
-    }catch(Exception ex){}\r
+    }\r
+    catch (Exception ex)\r
+    {\r
+    }\r
   }\r
 \r
-  public static void SaveState( AlignFrame af, long timeStamp,\r
-      String fileName, JarOutputStream jout, PrintWriter out)\r
+  public static void SaveState(AlignFrame af, long timeStamp,\r
+                               String fileName, JarOutputStream jout,\r
+                               PrintWriter out)\r
   {\r
-\r
     Vector seqids = new Vector();\r
     Vector userColours = new Vector();\r
 \r
     AlignViewport av = af.viewport;\r
 \r
     JalviewModel object = new JalviewModel();\r
-    object.setVamsasModel( new VamsasModel() );\r
+    object.setVamsasModel(new VamsasModel());\r
 \r
-    object.setCreationDate( new java.util.Date(timeStamp) );\r
+    object.setCreationDate(new java.util.Date(timeStamp));\r
 \r
     jalview.datamodel.AlignmentI jal = af.viewport.alignment;\r
 \r
@@ -121,19 +145,19 @@ public class Jalview2XML
     Sequence vamsasSeq;\r
     JalviewModelSequence jms = new JalviewModelSequence();\r
 \r
-    vamsasSet.setGapChar(jal.getGapCharacter()+"");\r
+    vamsasSet.setGapChar(jal.getGapCharacter() + "");\r
 \r
     JSeq jseq;\r
 \r
-\r
     //SAVE SEQUENCES\r
     int id = 0;\r
-    for(int i=0; i<jal.getHeight(); i++)\r
+\r
+    for (int i = 0; i < jal.getHeight(); i++)\r
     {\r
       seqids.add(jal.getSequenceAt(i));\r
 \r
-      vamsasSeq = new Sequence( );\r
-      vamsasSeq.setId(id+"");\r
+      vamsasSeq = new Sequence();\r
+      vamsasSeq.setId(id + "");\r
       vamsasSeq.setName(jal.getSequenceAt(i).getName());\r
       vamsasSeq.setSequence(jal.getSequenceAt(i).getSequence());\r
 \r
@@ -143,7 +167,7 @@ public class Jalview2XML
 \r
       jseq.setColour(jal.getSequenceAt(i).getColor().getRGB());\r
 \r
-      jseq.setId( id );\r
+      jseq.setId(id);\r
 \r
       jms.addJSeq(jseq);\r
       vamsasSet.addSequence(vamsasSeq);\r
@@ -151,22 +175,24 @@ public class Jalview2XML
     }\r
 \r
     //SAVE TREES\r
-    if(af.viewport.currentTree!=null)\r
+    if (af.viewport.currentTree != null)\r
     {\r
       object.getVamsasModel().addTree(af.viewport.currentTree.toString());\r
     }\r
 \r
     //SAVE ANNOTATIONS\r
-    if(jal.getAlignmentAnnotation()!=null)\r
+    if (jal.getAlignmentAnnotation() != null)\r
     {\r
+      jalview.datamodel.AlignmentAnnotation[] aa = jal.getAlignmentAnnotation();\r
 \r
-      jalview.datamodel.AlignmentAnnotation [] aa = jal.getAlignmentAnnotation();\r
-      for(int i=0; i<aa.length; i++)\r
+      for (int i = 0; i < aa.length; i++)\r
       {\r
-        if(aa[i].label.equals("Quality")\r
-        || aa[i].label.equals("Conservation")\r
-        || aa[i].label.equals("Consensus"))\r
-       {    continue;}\r
+        if (aa[i].label.equals("Quality") ||\r
+            aa[i].label.equals("Conservation") ||\r
+            aa[i].label.equals("Consensus"))\r
+        {\r
+          continue;\r
+        }\r
 \r
         Annotation an = new Annotation();\r
         an.setDescription(aa[i].description);\r
@@ -175,127 +201,154 @@ public class Jalview2XML
 \r
         AnnotationElement ae;\r
 \r
-        for(int a=0; a<aa[i].annotations.length; a++)\r
+        for (int a = 0; a < aa[i].annotations.length; a++)\r
         {\r
-          if(aa[i]==null || aa[i].annotations[a]==null)\r
+          if ( (aa[i] == null) || (aa[i].annotations[a] == null))\r
+          {\r
             continue;\r
+          }\r
 \r
           ae = new AnnotationElement();\r
           ae.setDescription(aa[i].annotations[a].description);\r
           ae.setDisplayCharacter(aa[i].annotations[a].displayCharacter);\r
           ae.setValue(aa[i].annotations[a].value);\r
           ae.setPosition(a);\r
-          ae.setSecondaryStructure(aa[i].annotations[a].secondaryStructure+"");\r
+          ae.setSecondaryStructure(aa[i].annotations[a].secondaryStructure +\r
+                                   "");\r
           an.addAnnotationElement(ae);\r
         }\r
 \r
         vamsasSet.addAnnotation(an);\r
       }\r
-\r
     }\r
 \r
     //SAVE GROUPS\r
-    if(jal.getGroups()!=null)\r
+    if (jal.getGroups() != null)\r
     {\r
-      JGroup [] groups = new JGroup[jal.getGroups().size()];\r
-      for(int i=0; i<groups.length; i++)\r
+      JGroup[] groups = new JGroup[jal.getGroups().size()];\r
+\r
+      for (int i = 0; i < groups.length; i++)\r
       {\r
         groups[i] = new JGroup();\r
-        jalview.datamodel.SequenceGroup sg\r
-            = (jalview.datamodel.SequenceGroup)jal.getGroups().elementAt(i);\r
-        groups[i].setStart( sg.getStartRes() );\r
-        groups[i].setEnd( sg.getEndRes() );\r
-        groups[i].setName( sg.getName());\r
 \r
-        if(sg.cs instanceof ConservationColourScheme)\r
-          groups[i].setConsThreshold( ((ConservationColourScheme)sg.cs).inc);\r
+        jalview.datamodel.SequenceGroup sg = (jalview.datamodel.SequenceGroup)\r
+            jal.getGroups()\r
+            .elementAt(i);\r
+        groups[i].setStart(sg.getStartRes());\r
+        groups[i].setEnd(sg.getEndRes());\r
+        groups[i].setName(sg.getName());\r
+\r
+        if (sg.cs instanceof ConservationColourScheme)\r
+        {\r
+          groups[i].setConsThreshold( ( (ConservationColourScheme) sg.cs).inc);\r
+        }\r
 \r
         if (sg.cs instanceof ResidueColourScheme)\r
-          groups[i].setPidThreshold( ( (ResidueColourScheme) sg.cs).getThreshold());\r
+        {\r
+          groups[i].setPidThreshold( ( (ResidueColourScheme) sg.cs).\r
+                                    getThreshold());\r
+        }\r
         else if (sg.cs instanceof ScoreColourScheme)\r
+        {\r
           groups[i].setPidThreshold( ( (ScoreColourScheme) sg.cs).getThreshold());\r
-\r
+        }\r
 \r
         if (sg.cs instanceof jalview.schemes.UserColourScheme)\r
-          groups[i].setColour(SetUserColourScheme(sg.cs, userColours, jms));\r
+        {\r
+          groups[i].setColour(SetUserColourScheme(sg.cs, userColours,\r
+                                                  jms));\r
+        }\r
         else\r
-          groups[i].setColour(ColourSchemeProperty.getColourName(sg.cs));\r
+        {\r
+          groups[i].setColour(ColourSchemeProperty.getColourName(\r
+              sg.cs));\r
+        }\r
 \r
         groups[i].setOutlineColour(sg.getOutlineColour().getRGB());\r
         groups[i].setDisplayBoxes(sg.getDisplayBoxes());\r
         groups[i].setDisplayText(sg.getDisplayText());\r
         groups[i].setColourText(sg.getColourText());\r
 \r
-        for(int s=0; s<sg.getSize(); s++)\r
+        for (int s = 0; s < sg.getSize(); s++)\r
         {\r
-          jalview.datamodel.Sequence seq = (jalview.datamodel.Sequence)sg.getSequenceAt(s);\r
+          jalview.datamodel.Sequence seq = (jalview.datamodel.Sequence) sg.\r
+              getSequenceAt(s);\r
           int index = seqids.indexOf(seq);\r
           groups[i].addSeq(index);\r
         }\r
-\r
       }\r
-      jms.setJGroup(groups);\r
 \r
+      jms.setJGroup(groups);\r
     }\r
 \r
     ///////////SAVE VIEWPORT\r
     Viewport view = new Viewport();\r
-   view.setTitle(af.getTitle());\r
-   view.setXpos(af.getX());\r
-   view.setYpos(af.getY());\r
-   view.setWidth(af.getWidth());\r
-   view.setHeight(af.getHeight());\r
-   view.setStartRes(av.startRes);\r
-   view.setStartSeq(av.startSeq);\r
-\r
-\r
- if( av.getGlobalColourScheme() instanceof jalview.schemes.UserColourScheme)\r
-   view.setBgColour( SetUserColourScheme(av.getGlobalColourScheme(),\r
-                                         userColours, jms) );\r
- else\r
-   view.setBgColour( ColourSchemeProperty.getColourName\r
-                     ( av.getGlobalColourScheme()));\r
-\r
-   ColourSchemeI cs = av.getGlobalColourScheme();\r
-   if(cs instanceof ConservationColourScheme)\r
-     view.setConsThreshold( ((ConservationColourScheme)cs).inc);\r
-\r
-   if (cs instanceof ResidueColourScheme)\r
-     view.setPidThreshold( ( (ResidueColourScheme) cs).getThreshold());\r
-  else if (cs instanceof ScoreColourScheme)\r
-     view.setPidThreshold( ( (ScoreColourScheme) cs).getThreshold());\r
-\r
-\r
-   view.setConservationSelected(av.getConservationSelected());\r
-   view.setPidSelected(av.getAbovePIDThreshold());\r
-   view.setFontName(av.font.getFontName());\r
-   view.setFontSize(av.font.getSize());\r
-   view.setFontStyle(av.font.getStyle());\r
-   view.setRenderGaps(av.renderGaps);\r
-   view.setShowAnnotation(av.getShowAnnotation());\r
-   view.setShowBoxes(av.getShowBoxes());\r
-   view.setShowColourText(av.getColourText());\r
-   view.setShowConservation(av.showConservation);\r
-   view.setShowFullId(av.getShowFullId());\r
-   view.setShowIdentity(av.showIdentity);\r
-   view.setShowQuality(av.showQuality);\r
-   view.setShowSequenceFeatures(av.showSequenceFeatures);\r
-   view.setShowText(av.getShowText());\r
-   view.setWrapAlignment(av.getWrapAlignment());\r
-\r
-   jms.addViewport( view );\r
+    view.setTitle(af.getTitle());\r
+    view.setXpos(af.getX());\r
+    view.setYpos(af.getY());\r
+    view.setWidth(af.getWidth());\r
+    view.setHeight(af.getHeight());\r
+    view.setStartRes(av.startRes);\r
+    view.setStartSeq(av.startSeq);\r
+\r
+    if (av.getGlobalColourScheme() instanceof jalview.schemes.UserColourScheme)\r
+    {\r
+      view.setBgColour(SetUserColourScheme(av.getGlobalColourScheme(),\r
+                                           userColours, jms));\r
+    }\r
+    else\r
+    {\r
+      view.setBgColour(ColourSchemeProperty.getColourName(\r
+          av.getGlobalColourScheme()));\r
+    }\r
+\r
+    ColourSchemeI cs = av.getGlobalColourScheme();\r
+\r
+    if (cs instanceof ConservationColourScheme)\r
+    {\r
+      view.setConsThreshold( ( (ConservationColourScheme) cs).inc);\r
+    }\r
+\r
+    if (cs instanceof ResidueColourScheme)\r
+    {\r
+      view.setPidThreshold( ( (ResidueColourScheme) cs).getThreshold());\r
+    }\r
+    else if (cs instanceof ScoreColourScheme)\r
+    {\r
+      view.setPidThreshold( ( (ScoreColourScheme) cs).getThreshold());\r
+    }\r
+\r
+    view.setConservationSelected(av.getConservationSelected());\r
+    view.setPidSelected(av.getAbovePIDThreshold());\r
+    view.setFontName(av.font.getFontName());\r
+    view.setFontSize(av.font.getSize());\r
+    view.setFontStyle(av.font.getStyle());\r
+    view.setRenderGaps(av.renderGaps);\r
+    view.setShowAnnotation(av.getShowAnnotation());\r
+    view.setShowBoxes(av.getShowBoxes());\r
+    view.setShowColourText(av.getColourText());\r
+    view.setShowConservation(av.showConservation);\r
+    view.setShowFullId(av.getShowFullId());\r
+    view.setShowIdentity(av.showIdentity);\r
+    view.setShowQuality(av.showQuality);\r
+    view.setShowSequenceFeatures(av.showSequenceFeatures);\r
+    view.setShowText(av.getShowText());\r
+    view.setWrapAlignment(av.getWrapAlignment());\r
+\r
+    jms.addViewport(view);\r
 \r
     object.setJalviewModelSequence(jms);\r
     object.getVamsasModel().addSequenceSet(vamsasSet);\r
 \r
-\r
     try\r
     {\r
-     if(!fileName.endsWith(".xml"))\r
-              fileName = fileName+".xml";\r
+      if (!fileName.endsWith(".xml"))\r
+      {\r
+        fileName = fileName + ".xml";\r
+      }\r
 \r
-     JarEntry entry = new JarEntry(fileName);\r
-     jout.putNextEntry(entry);\r
+      JarEntry entry = new JarEntry(fileName);\r
+      jout.putNextEntry(entry);\r
 \r
       object.marshal(out);\r
     }\r
@@ -309,194 +362,245 @@ public class Jalview2XML
                                     Vector userColours,\r
                                     JalviewModelSequence jms)\r
   {\r
-    String id=null;\r
-    jalview.schemes.UserColourScheme ucs = (jalview.schemes.UserColourScheme)cs;\r
+    String id = null;\r
+    jalview.schemes.UserColourScheme ucs = (jalview.schemes.UserColourScheme)\r
+        cs;\r
+\r
     if (!userColours.contains(ucs))\r
     {\r
       userColours.add(ucs);\r
-      java.awt.Color [] colours = ucs.getColours();\r
+\r
+      java.awt.Color[] colours = ucs.getColours();\r
       jalview.binding.UserColours uc = new jalview.binding.UserColours();\r
-      jalview.binding.UserColourScheme jbucs = new jalview.binding.UserColourScheme();\r
-      for(int i=0; i<colours.length; i++)\r
+      jalview.binding.UserColourScheme jbucs = new jalview.binding.\r
+          UserColourScheme();\r
+\r
+      for (int i = 0; i < colours.length; i++)\r
       {\r
-             jalview.binding.Colour col = new jalview.binding.Colour();\r
-             col.setRGB( jalview.util.Format.getHexString(colours[i]) );\r
-             jbucs.addColour(col);\r
+        jalview.binding.Colour col = new jalview.binding.Colour();\r
+        col.setRGB(jalview.util.Format.getHexString(colours[i]));\r
+        jbucs.addColour(col);\r
       }\r
-      id = "ucs"+userColours.indexOf(ucs);\r
+\r
+      id = "ucs" + userColours.indexOf(ucs);\r
       uc.setId(id);\r
       uc.setUserColourScheme(jbucs);\r
       jms.addUserColours(uc);\r
     }\r
+\r
     return id;\r
   }\r
 \r
-  static jalview.schemes.UserColourScheme GetUserColourScheme(JalviewModelSequence jms, String id)\r
+  static jalview.schemes.UserColourScheme GetUserColourScheme(\r
+      JalviewModelSequence jms, String id)\r
   {\r
-    UserColours [] uc = jms.getUserColours();\r
-    UserColours colours=null;\r
-    for(int i=0; i<uc.length; i++)\r
+    UserColours[] uc = jms.getUserColours();\r
+    UserColours colours = null;\r
+\r
+    for (int i = 0; i < uc.length; i++)\r
     {\r
-       if(uc[i].getId().equals(id))\r
-       {  colours = uc[i]; break;  }\r
+      if (uc[i].getId().equals(id))\r
+      {\r
+        colours = uc[i];\r
+\r
+        break;\r
+      }\r
     }\r
-    int csize = colours.getUserColourScheme().getColourCount();\r
-    java.awt.Color [] newColours = new java.awt.Color[csize];\r
 \r
-    for(int i=0; i<csize;i++)\r
-      newColours[i] = new java.awt.Color(\r
-        Integer.parseInt( colours.getUserColourScheme().getColour(i).getRGB(), 16) );\r
+    int csize = colours.getUserColourScheme().getColourCount();\r
+    java.awt.Color[] newColours = new java.awt.Color[csize];\r
 \r
-    return  new jalview.schemes.UserColourScheme(newColours);\r
+    for (int i = 0; i < csize; i++)\r
+    {\r
+      newColours[i] = new java.awt.Color(Integer.parseInt(\r
+          colours.getUserColourScheme().getColour(i).getRGB(), 16));\r
+    }\r
 \r
+    return new jalview.schemes.UserColourScheme(newColours);\r
   }\r
 \r
-\r
   public static void LoadJalviewAlign(String file)\r
   {\r
     JalviewModel object = new JalviewModel();\r
-    try{\r
-      //UNMARSHALLER SEEMS TO CLOSE JARINPUTSTREAM, MOST ANNOYING\r
 \r
+    try\r
+    {\r
+      //UNMARSHALLER SEEMS TO CLOSE JARINPUTSTREAM, MOST ANNOYING\r
       URL url = null;\r
-      if( file.startsWith("http://"))\r
-       url = new URL(file);\r
+\r
+      if (file.startsWith("http://"))\r
+      {\r
+        url = new URL(file);\r
+      }\r
 \r
       JarInputStream jin = null;\r
-      JarEntry jarentry=null;\r
+      JarEntry jarentry = null;\r
       int entryCount = 1;\r
-      do{\r
+\r
+      do\r
+      {\r
         if (url != null)\r
+        {\r
           jin = new JarInputStream(url.openStream());\r
+        }\r
         else\r
+        {\r
           jin = new JarInputStream(new FileInputStream(file));\r
+        }\r
 \r
-        for(int i=0; i<entryCount; i++)\r
+        for (int i = 0; i < entryCount; i++)\r
+        {\r
           jarentry = jin.getNextJarEntry();\r
+        }\r
 \r
-        if(jarentry!=null)\r
+        if (jarentry != null)\r
         {\r
           InputStreamReader in = new InputStreamReader(jin, "UTF-8");\r
           object = (JalviewModel) object.unmarshal(in);\r
           LoadFromObject(object);\r
           entryCount++;\r
         }\r
-      }while(jarentry!=null);\r
-\r
+      }\r
+      while (jarentry != null);\r
     }\r
-    catch(Exception ex)\r
-    {   System.err.println("Exception whilst loading jalview XML file : "+ex+"\n");\r
-     ex.printStackTrace(); return; }\r
+    catch (Exception ex)\r
+    {\r
+      System.err.println("Exception whilst loading jalview XML file : " +\r
+                         ex + "\n");\r
+      ex.printStackTrace();\r
 \r
+      return;\r
+    }\r
   }\r
 \r
   static void LoadFromObject(JalviewModel object)\r
   {\r
-     Vector seqids = new Vector();\r
-     SequenceSet vamsasSet = object.getVamsasModel().getSequenceSet(0);\r
-     Sequence [] vamsasSeq = vamsasSet.getSequence();\r
-\r
-     JalviewModelSequence jms = object.getJalviewModelSequence();\r
-     //////////////////////////////////\r
-     //LOAD SEQUENCES\r
-     jalview.datamodel.Sequence [] jseqs = new jalview.datamodel.Sequence[vamsasSeq.length];\r
-     JSeq [] JSEQ = object.getJalviewModelSequence().getJSeq();\r
-     for(int i=0; i<vamsasSeq.length; i++)\r
-     {\r
-       jseqs[i] = new jalview.datamodel.Sequence(vamsasSeq[i].getName(),\r
-                                                 vamsasSeq[i].getSequence());\r
-\r
-       jseqs[i].setStart( JSEQ[i].getStart());\r
-       jseqs[i].setEnd( JSEQ[i].getEnd());\r
-       jseqs[i].setColor( new java.awt.Color(JSEQ[i].getColour()) );\r
-       seqids.add(jseqs[i]);\r
-     }\r
-\r
-     /////////////////////////////////\r
-     jalview.datamodel.Alignment al = new jalview.datamodel.Alignment(jseqs);\r
-     /////////////////////////////////\r
-\r
-     //////////////////////////////////\r
-     //LOAD ANNOTATIONS\r
-     if(vamsasSet.getAnnotation()!=null)\r
-     {\r
-       Annotation[] an = vamsasSet.getAnnotation();\r
-       for (int i = 0; i < an.length; i++)\r
-       {\r
-         AnnotationElement[] ae = an[i].getAnnotationElement();\r
-         jalview.datamodel.Annotation anot[]\r
-             = new jalview.datamodel.Annotation[al.getWidth()];\r
-         for (int aa = 0; aa < ae.length; aa++)\r
-         {\r
-           anot[ae[aa].getPosition()]\r
-               = new jalview.datamodel.Annotation(\r
-                   ae[aa].getDisplayCharacter(),\r
-                   ae[aa].getDescription(),\r
-                   ae[aa].getSecondaryStructure().charAt(0),\r
-                   ae[aa].getValue()\r
-               );\r
-         }\r
-\r
-\r
-          jalview.datamodel.AlignmentAnnotation jaa = null;\r
-          if(an[i].getGraph())\r
-            jaa = new jalview.datamodel.AlignmentAnnotation(an[i].getLabel(),\r
-                                        an[i].getDescription(), anot,\r
-                                        0,0,1);\r
-          else\r
-            jaa = new jalview.datamodel.AlignmentAnnotation(an[i].getLabel(),\r
-                                        an[i].getDescription(), anot);\r
-          al.addAnnotation(jaa);\r
-       }\r
-     }\r
-\r
-      /////////////////////////////////\r
-      // LOAD VIEWPORT\r
-      Viewport[] views = jms.getViewport();\r
-      Viewport view = views[0]; // DEAL WITH MULTIPLE VIEWPORTS LATER\r
-\r
-      AlignFrame af = new AlignFrame(al);\r
-    //  af.changeColour() );\r
+    Vector seqids = new Vector();\r
+    SequenceSet vamsasSet = object.getVamsasModel().getSequenceSet(0);\r
+    Sequence[] vamsasSeq = vamsasSet.getSequence();\r
+\r
+    JalviewModelSequence jms = object.getJalviewModelSequence();\r
+\r
+    //////////////////////////////////\r
+    //LOAD SEQUENCES\r
+    jalview.datamodel.Sequence[] jseqs = new jalview.datamodel.Sequence[\r
+        vamsasSeq.length];\r
+    JSeq[] JSEQ = object.getJalviewModelSequence().getJSeq();\r
+\r
+    for (int i = 0; i < vamsasSeq.length; i++)\r
+    {\r
+      jseqs[i] = new jalview.datamodel.Sequence(vamsasSeq[i].getName(),\r
+                                                vamsasSeq[i].getSequence());\r
+\r
+      jseqs[i].setStart(JSEQ[i].getStart());\r
+      jseqs[i].setEnd(JSEQ[i].getEnd());\r
+      jseqs[i].setColor(new java.awt.Color(JSEQ[i].getColour()));\r
+      seqids.add(jseqs[i]);\r
+    }\r
+\r
+    /////////////////////////////////\r
+    jalview.datamodel.Alignment al = new jalview.datamodel.Alignment(jseqs);\r
+\r
+    /////////////////////////////////\r
+    //////////////////////////////////\r
+    //LOAD ANNOTATIONS\r
+    if (vamsasSet.getAnnotation() != null)\r
+    {\r
+      Annotation[] an = vamsasSet.getAnnotation();\r
+\r
+      for (int i = 0; i < an.length; i++)\r
+      {\r
+        AnnotationElement[] ae = an[i].getAnnotationElement();\r
+        jalview.datamodel.Annotation[] anot = new jalview.datamodel.Annotation[\r
+            al.getWidth()];\r
+\r
+        for (int aa = 0; aa < ae.length; aa++)\r
+        {\r
+          anot[ae[aa].getPosition()] = new jalview.datamodel.Annotation(ae[aa].\r
+              getDisplayCharacter(),\r
+              ae[aa].getDescription(),\r
+              ae[aa].getSecondaryStructure().charAt(0),\r
+              ae[aa].getValue());\r
+        }\r
+\r
+        jalview.datamodel.AlignmentAnnotation jaa = null;\r
+\r
+        if (an[i].getGraph())\r
+        {\r
+          jaa = new jalview.datamodel.AlignmentAnnotation(an[i].getLabel(),\r
+              an[i].getDescription(), anot, 0, 0, 1);\r
+        }\r
+        else\r
+        {\r
+          jaa = new jalview.datamodel.AlignmentAnnotation(an[i].getLabel(),\r
+              an[i].getDescription(), anot);\r
+        }\r
+\r
+        al.addAnnotation(jaa);\r
+      }\r
+    }\r
 \r
+    /////////////////////////////////\r
+    // LOAD VIEWPORT\r
+    Viewport[] views = jms.getViewport();\r
+    Viewport view = views[0]; // DEAL WITH MULTIPLE VIEWPORTS LATER\r
+\r
+    AlignFrame af = new AlignFrame(al);\r
+\r
+    //  af.changeColour() );\r
     /////////////////////////\r
     //LOAD GROUPS\r
-    if (jms.getJGroupCount()>0)\r
+    if (jms.getJGroupCount() > 0)\r
     {\r
       JGroup[] groups = jms.getJGroup();\r
+\r
       for (int i = 0; i < groups.length; i++)\r
       {\r
-       ColourSchemeI cs=null;\r
-       if(groups[i].getColour()!=null)\r
-       {\r
-         if (groups[i].getColour().startsWith("ucs"))\r
-           cs = GetUserColourScheme(jms, groups[i].getColour());\r
-         else\r
-           cs = ColourSchemeProperty.getColour(al, groups[i].getColour());\r
-\r
-         if (cs instanceof ResidueColourScheme)\r
-           ( (ResidueColourScheme) cs).setThreshold(groups[i].getPidThreshold());\r
-         else if (cs instanceof ScoreColourScheme)\r
-           ( (ScoreColourScheme) cs).setThreshold(groups[i].getPidThreshold());\r
-       }\r
-\r
-        jalview.datamodel.SequenceGroup sg = new jalview.datamodel.SequenceGroup\r
-                (groups[i].getName(),\r
-                 cs,\r
-                 groups[i].getDisplayBoxes(),\r
-                 groups[i].getDisplayText(),\r
-                 groups[i].getColourText(),\r
-                 groups[i].getStart(),\r
-                 groups[i].getEnd()) ;\r
-        sg.setOutlineColour( new java.awt.Color(groups[i].getOutlineColour()));\r
-        int [] ids = groups[i].getSeq();\r
-        for(int s=0; s<ids.length; s++)\r
-            sg.addSequence( (jalview.datamodel.SequenceI)seqids.elementAt( ids[s] ));\r
-\r
-        if(groups[i].getConsThreshold()!=0)\r
+        ColourSchemeI cs = null;\r
+\r
+        if (groups[i].getColour() != null)\r
+        {\r
+          if (groups[i].getColour().startsWith("ucs"))\r
+          {\r
+            cs = GetUserColourScheme(jms, groups[i].getColour());\r
+          }\r
+          else\r
+          {\r
+            cs = ColourSchemeProperty.getColour(al,\r
+                                                groups[i].getColour());\r
+          }\r
+\r
+          if (cs instanceof ResidueColourScheme)\r
+          {\r
+            ( (ResidueColourScheme) cs).setThreshold(groups[i].getPidThreshold());\r
+          }\r
+          else if (cs instanceof ScoreColourScheme)\r
+          {\r
+            ( (ScoreColourScheme) cs).setThreshold(groups[i].getPidThreshold());\r
+          }\r
+        }\r
+\r
+        jalview.datamodel.SequenceGroup sg = new jalview.datamodel.\r
+            SequenceGroup(groups[i].getName(),\r
+                          cs, groups[i].getDisplayBoxes(),\r
+                          groups[i].getDisplayText(), groups[i].getColourText(),\r
+                          groups[i].getStart(), groups[i].getEnd());\r
+        sg.setOutlineColour(new java.awt.Color(\r
+            groups[i].getOutlineColour()));\r
+\r
+        int[] ids = groups[i].getSeq();\r
+\r
+        for (int s = 0; s < ids.length; s++)\r
+        {\r
+          sg.addSequence( (jalview.datamodel.SequenceI) seqids.elementAt(\r
+              ids[s]));\r
+        }\r
+\r
+        if (groups[i].getConsThreshold() != 0)\r
         {\r
-          jalview.analysis.Conservation c = new jalview.analysis.Conservation("All",\r
-              ResidueProperties.propHash, 3,\r
-              sg.sequences, 0,\r
+          jalview.analysis.Conservation c = new jalview.analysis.Conservation(\r
+              "All",\r
+              ResidueProperties.propHash, 3, sg.sequences, 0,\r
               sg.getWidth() - 1);\r
           c.calculate();\r
           c.verdict(false, 25);\r
@@ -504,33 +608,34 @@ public class Jalview2XML
           sg.cs = cs;\r
         }\r
 \r
-\r
         al.addGroup(sg);\r
       }\r
     }\r
 \r
-\r
-    Desktop.addInternalFrame(af, view.getTitle(), AlignFrame.NEW_WINDOW_WIDTH, AlignFrame.NEW_WINDOW_HEIGHT);\r
-    af.setBounds(view.getXpos(), view.getYpos(), view.getWidth(), view.getHeight());\r
-    af.viewport.setStartRes( view.getStartRes() );\r
-    af.viewport.setStartSeq( view.getStartSeq() );\r
+    Desktop.addInternalFrame(af, view.getTitle(),\r
+                             AlignFrame.NEW_WINDOW_WIDTH,\r
+                             AlignFrame.NEW_WINDOW_HEIGHT);\r
+    af.setBounds(view.getXpos(), view.getYpos(), view.getWidth(),\r
+                 view.getHeight());\r
+    af.viewport.setStartRes(view.getStartRes());\r
+    af.viewport.setStartSeq(view.getStartSeq());\r
     af.viewport.showConservation = view.getShowConservation();\r
     af.viewport.showQuality = view.getShowQuality();\r
-    af.viewport.showIdentity= view.getShowIdentity();\r
-    af.viewport.setAbovePIDThreshold( view.getPidSelected() );\r
-    af.viewport.setColourText( view.getShowColourText() );\r
-    af.viewport.setConservationSelected( view.getConservationSelected());\r
-    af.viewport.setShowFullId( view.getShowFullId());\r
-    af.viewport.setFont( new java.awt.Font( view.getFontName(),\r
-                                            view.getFontStyle(),\r
-                                            view.getFontSize()));\r
+    af.viewport.showIdentity = view.getShowIdentity();\r
+    af.viewport.setAbovePIDThreshold(view.getPidSelected());\r
+    af.viewport.setColourText(view.getShowColourText());\r
+    af.viewport.setConservationSelected(view.getConservationSelected());\r
+    af.viewport.setShowFullId(view.getShowFullId());\r
+    af.viewport.setFont(new java.awt.Font(view.getFontName(),\r
+                                          view.getFontStyle(), view.getFontSize()));\r
     af.alignPanel.fontChanged();\r
 \r
     af.sequenceFeatures_actionPerformed(null);\r
-    af.viewport.setRenderGaps( view.getRenderGaps() );\r
+    af.viewport.setRenderGaps(view.getRenderGaps());\r
 \r
-    af.viewport.setWrapAlignment( view.getWrapAlignment() );\r
-    if(view.getWrapAlignment())\r
+    af.viewport.setWrapAlignment(view.getWrapAlignment());\r
+\r
+    if (view.getWrapAlignment())\r
     {\r
       af.alignPanel.setWrapAlignment(view.getWrapAlignment());\r
     }\r
@@ -540,51 +645,67 @@ public class Jalview2XML
       af.alignPanel.setAnnotationVisible(view.getShowAnnotation());\r
     }\r
 \r
-    af.viewport.setShowBoxes( view.getShowBoxes() );\r
-    af.viewport.setShowText( view.getShowText() );\r
+    af.viewport.setShowBoxes(view.getShowBoxes());\r
+    af.viewport.setShowText(view.getShowText());\r
 \r
-    ColourSchemeI cs=null;\r
-    if(view.getBgColour()!=null)\r
-    {\r
+    ColourSchemeI cs = null;\r
 \r
+    if (view.getBgColour() != null)\r
+    {\r
       if (view.getBgColour().startsWith("ucs"))\r
+      {\r
         cs = GetUserColourScheme(jms, view.getBgColour());\r
+      }\r
       else\r
+      {\r
         cs = ColourSchemeProperty.getColour(al, view.getBgColour());\r
+      }\r
 \r
       if (cs instanceof ConservationColourScheme)\r
+      {\r
         ( (ConservationColourScheme) cs).inc = view.getConsThreshold();\r
+      }\r
 \r
       if (cs instanceof ResidueColourScheme)\r
+      {\r
         ( (ResidueColourScheme) cs).setThreshold(view.getPidThreshold());\r
+      }\r
       else if (cs instanceof ScoreColourScheme)\r
+      {\r
         ( (ScoreColourScheme) cs).setThreshold(view.getPidThreshold());\r
-\r
+      }\r
     }\r
-    af.viewport.setGlobalColourScheme( cs );\r
 \r
+    af.viewport.setGlobalColourScheme(cs);\r
 \r
     af.viewport.setColourAppliesToAllGroups(false);\r
     af.changeColour(af.viewport.getGlobalColourScheme());\r
     af.viewport.setColourAppliesToAllGroups(true);\r
 \r
     System.out.println(view.getShowSequenceFeatures());\r
-    if( view.getShowSequenceFeatures() );\r
+\r
+    if (view.getShowSequenceFeatures())\r
     {\r
-      SequenceFeatureFetcher sft = new SequenceFeatureFetcher(al, af.alignPanel);\r
+      ;\r
+    }\r
+\r
+    {\r
+      SequenceFeatureFetcher sft = new SequenceFeatureFetcher(al,\r
+          af.alignPanel);\r
     }\r
 \r
     //LOAD TREES - THIS RELEASE ONLY ALLOWS 1 TREE\r
-    if(object.getVamsasModel().getTreeCount()>0)\r
+    if (object.getVamsasModel().getTreeCount() > 0)\r
     {\r
-      try{\r
+      try\r
+      {\r
         af.ShowNewickTree(new jalview.io.NewickFile(\r
-            (String)object.getVamsasModel().getTree(0)), "Tree");\r
-      }catch(Exception ex){ex.printStackTrace();}\r
+            (String) object.getVamsasModel().getTree(0)), "Tree");\r
+      }\r
+      catch (Exception ex)\r
+      {\r
+        ex.printStackTrace();\r
+      }\r
     }\r
-\r
   }\r
 }\r
-\r
-\r
-\r
index a55af89..244d884 100755 (executable)
@@ -1,41 +1,43 @@
 /*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 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
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
+ */\r
 package jalview.gui;\r
 \r
-import javax.swing.*;\r
+import java.awt.*;\r
 import java.awt.event.*;\r
 import java.awt.image.*;\r
-import java.awt.*;\r
+import javax.swing.*;\r
 \r
-public class OverviewPanel extends JPanel implements Runnable\r
+public class OverviewPanel\r
+    extends JPanel implements Runnable\r
 {\r
   BufferedImage miniMe;\r
   AlignViewport av;\r
   AlignmentPanel ap;\r
   float scalew = 1f;\r
   float scaleh = 1f;\r
-\r
-  int width, sequencesHeight;\r
-  int graphHeight=30;\r
-  int boxX=-1, boxY=-1, boxWidth=-1, boxHeight=-1;\r
-\r
+  int width;\r
+  int sequencesHeight;\r
+  int graphHeight = 30;\r
+  int boxX = -1;\r
+  int boxY = -1;\r
+  int boxWidth = -1;\r
+  int boxHeight = -1;\r
   boolean resizing = false;\r
 \r
   public OverviewPanel(AlignmentPanel ap)\r
@@ -45,50 +47,61 @@ public class OverviewPanel extends JPanel implements Runnable
     setLayout(null);\r
 \r
     // scale the initial size of overviewpanel to shape of alignment\r
-    float initialScale = (float)av.alignment.getWidth()/(float)av.alignment.getHeight();\r
-    if(av.alignment.getWidth() > av.alignment.getHeight())\r
+    float initialScale = (float) av.alignment.getWidth() /\r
+        (float) av.alignment.getHeight();\r
+\r
+    if (av.alignment.getWidth() > av.alignment.getHeight())\r
     {\r
       // wider\r
       width = 400;\r
-      sequencesHeight = (int)(400f/initialScale);\r
+      sequencesHeight = (int) (400f / initialScale);\r
     }\r
     else\r
     {\r
       // taller\r
-      width = (int)(400f*initialScale);\r
+      width = (int) (400f * initialScale);\r
       sequencesHeight = 300;\r
-      if(width<120)\r
+\r
+      if (width < 120)\r
+      {\r
         width = 120;\r
+      }\r
     }\r
 \r
     addComponentListener(new ComponentAdapter()\r
-   {\r
-\r
-       public void componentResized(ComponentEvent evt)\r
-       {\r
-         if( getWidth()!=width || getHeight()!=sequencesHeight+graphHeight)\r
-         {\r
-           updateOverviewImage();\r
-         }\r
-       }\r
-   });\r
+    {\r
+      public void componentResized(ComponentEvent evt)\r
+      {\r
+        if ( (getWidth() != width) ||\r
+            (getHeight() != (sequencesHeight + graphHeight)))\r
+        {\r
+          updateOverviewImage();\r
+        }\r
+      }\r
+    });\r
 \r
     addMouseMotionListener(new MouseMotionAdapter()\r
-           {\r
-             public void mouseDragged(MouseEvent evt)\r
-             { doMouseDragged(evt);}\r
-           });\r
+    {\r
+      public void mouseDragged(MouseEvent evt)\r
+      {\r
+        doMouseDragged(evt);\r
+      }\r
+    });\r
 \r
     addMouseListener(new MouseAdapter()\r
     {\r
       public void mousePressed(MouseEvent evt)\r
-      { doMousePressed(evt);}\r
+      {\r
+        doMousePressed(evt);\r
+      }\r
+\r
       public void mouseReleased(MouseEvent evt)\r
-      { doMouseReleased(evt);}\r
+      {\r
+        doMouseReleased(evt);\r
+      }\r
     });\r
 \r
     updateOverviewImage();\r
-\r
   }\r
 \r
   public void doMousePressed(MouseEvent evt)\r
@@ -105,9 +118,12 @@ public class OverviewPanel extends JPanel implements Runnable
     boxX = evt.getX();\r
     boxY = evt.getY();\r
     checkValid();\r
-    if(!resizing)\r
-    ap.setScrollValues( (int)(boxX/scalew/av.getCharWidth()),\r
-                        (int)(boxY/scaleh/av.getCharHeight()) );\r
+\r
+    if (!resizing)\r
+    {\r
+      ap.setScrollValues( (int) (boxX / scalew / av.getCharWidth()),\r
+                         (int) (boxY / scaleh / av.getCharHeight()));\r
+    }\r
   }\r
 \r
   public void doMouseDragged(MouseEvent evt)\r
@@ -115,34 +131,46 @@ public class OverviewPanel extends JPanel implements Runnable
     boxX = evt.getX();\r
     boxY = evt.getY();\r
     checkValid();\r
-    if(!resizing)\r
-    ap.setScrollValues( (int)(boxX/scalew/av.getCharWidth()),\r
-                        (int)(boxY/scaleh/av.getCharHeight()) );\r
+\r
+    if (!resizing)\r
+    {\r
+      ap.setScrollValues( (int) (boxX / scalew / av.getCharWidth()),\r
+                         (int) (boxY / scaleh / av.getCharHeight()));\r
+    }\r
   }\r
 \r
   void checkValid()\r
   {\r
     if (boxY < 0)\r
+    {\r
       boxY = 0;\r
+    }\r
 \r
-    if (boxY > sequencesHeight - boxHeight)\r
-      boxY = sequencesHeight - boxHeight+1;\r
+    if (boxY > (sequencesHeight - boxHeight))\r
+    {\r
+      boxY = sequencesHeight - boxHeight + 1;\r
+    }\r
 \r
     if (boxX < 0)\r
+    {\r
       boxX = 0;\r
+    }\r
 \r
-    if (boxX > width - boxWidth)\r
+    if (boxX > (width - boxWidth))\r
+    {\r
       boxX = width - boxWidth;\r
+    }\r
   }\r
 \r
   public void updateOverviewImage()\r
   {\r
-    if(resizing)\r
+    if (resizing)\r
     {\r
       return;\r
     }\r
 \r
     resizing = true;\r
+\r
     Thread thread = new Thread(this);\r
     thread.start();\r
     repaint();\r
@@ -151,18 +179,19 @@ public class OverviewPanel extends JPanel implements Runnable
   public void run()\r
   {\r
     miniMe = null;\r
+\r
     int alwidth = av.alignment.getWidth();\r
     int alheight = av.alignment.getHeight();\r
 \r
-    if(getWidth()>0 && getHeight()>0)\r
+    if ( (getWidth() > 0) && (getHeight() > 0))\r
     {\r
       width = getWidth();\r
       sequencesHeight = getHeight() - graphHeight;\r
     }\r
 \r
-    setPreferredSize (new Dimension(width, sequencesHeight+graphHeight));\r
+    setPreferredSize(new Dimension(width, sequencesHeight + graphHeight));\r
 \r
-    int fullsizeWidth  = alwidth * av.getCharWidth();\r
+    int fullsizeWidth = alwidth * av.getCharWidth();\r
     int fullsizeHeight = alheight * av.getCharHeight();\r
 \r
     scalew = (float) width / (float) fullsizeWidth;\r
@@ -172,70 +201,85 @@ public class OverviewPanel extends JPanel implements Runnable
                                BufferedImage.TYPE_INT_RGB);\r
 \r
     Graphics mg = miniMe.getGraphics();\r
-    BufferedImage consensus = new BufferedImage(fullsizeWidth,\r
-                                           60,\r
-                                           BufferedImage.TYPE_3BYTE_BGR);\r
+    BufferedImage consensus = new BufferedImage(fullsizeWidth, 60,\r
+                                                BufferedImage.TYPE_3BYTE_BGR);\r
     Graphics g = consensus.getGraphics();\r
     ap.annotationPanel.drawGraph(g, av.conservation, fullsizeWidth, 60);\r
     mg.drawImage(consensus, 0, sequencesHeight, width,\r
-             sequencesHeight + graphHeight, 0, 0, fullsizeWidth, 60, this);\r
-\r
+                 sequencesHeight + graphHeight, 0, 0, fullsizeWidth, 60, this);\r
 \r
     boolean oldRenderGaps = av.renderGaps;\r
-    try{\r
-    // We'll have to draw the full size alignment in chunks, as an image of the\r
-    // whole alignment requires too much memory\r
 \r
+    try\r
+    {\r
+      // We'll have to draw the full size alignment in chunks, as an image of the\r
+      // whole alignment requires too much memory\r
       // Max size depends on the font size, the following is a\r
       // guess at a size which works\r
-      int maxSize = 2000 /  av.getFont().getSize();\r
+      int maxSize = 2000 / av.getFont().getSize();\r
       BufferedImage block;\r
-      int blockx=0, blocky=0, blockw=0, blockh=0, eRes=0, eSeq=0;\r
+      int blockx = 0;\r
+      int blocky = 0;\r
+      int blockw = 0;\r
+      int blockh = 0;\r
+      int eRes = 0;\r
+      int eSeq = 0;\r
 \r
       av.setRenderGaps(false);\r
-      for(int sRes=0, chunkx=0; sRes<alwidth; sRes+=maxSize, chunkx++)\r
+\r
+      for (int sRes = 0, chunkx = 0; sRes < alwidth;\r
+           sRes += maxSize, chunkx++)\r
       {\r
-          eSeq = 0;\r
-          eRes+=maxSize;\r
-          if(eRes>alwidth)\r
-            eRes = alwidth;\r
+        eSeq = 0;\r
+        eRes += maxSize;\r
 \r
-          for(int sSeq=0, chunky=0; sSeq<alheight; sSeq+=maxSize, chunky++)\r
-          {\r
-            eSeq+=maxSize;\r
-            if(eSeq>alheight)\r
-              eSeq = alheight;\r
+        if (eRes > alwidth)\r
+        {\r
+          eRes = alwidth;\r
+        }\r
 \r
-            blocky = 0;\r
-            blockx = (int)((float)sRes/(float)alwidth * width);\r
+        for (int sSeq = 0, chunky = 0; sSeq < alheight;\r
+             sSeq += maxSize, chunky++)\r
+        {\r
+          eSeq += maxSize;\r
 \r
-            block = new BufferedImage((eRes-sRes)*av.charWidth,\r
-              (eSeq-sSeq)*av.charHeight,\r
-              BufferedImage.TYPE_3BYTE_BGR);\r
-            g = block.getGraphics();\r
+          if (eSeq > alheight)\r
+          {\r
+            eSeq = alheight;\r
+          }\r
 \r
-           ap.seqPanel.seqCanvas.drawPanel(g, sRes, eRes, sSeq, eSeq, sRes, sSeq, 0);\r
+          blocky = 0;\r
+          blockx = (int) ( (float) sRes / (float) alwidth * width);\r
 \r
-           blockh = (int)( (float)(eSeq-sSeq)/(float)alheight *  sequencesHeight  )+1 ;\r
-           blockw = (int)( (float)(eRes-sRes)/(float)alwidth  *   width )+1;\r
+          block = new BufferedImage( (eRes - sRes) * av.charWidth,\r
+                                    (eSeq - sSeq) * av.charHeight,\r
+                                    BufferedImage.TYPE_3BYTE_BGR);\r
+          g = block.getGraphics();\r
 \r
-           blocky += (int) ((float)sSeq/(float)alheight* sequencesHeight);\r
+          ap.seqPanel.seqCanvas.drawPanel(g, sRes, eRes, sSeq, eSeq,\r
+                                          sRes, sSeq, 0);\r
 \r
-           mg.drawImage(block,  blockx,\r
-                              blocky ,\r
-                            blockx + blockw,\r
-                            blocky + blockh,\r
+          blockh = (int) ( (float) (eSeq - sSeq) / (float) alheight *\r
+                          sequencesHeight) +\r
+              1;\r
+          blockw = (int) ( (float) (eRes - sRes) / (float) alwidth * width) +\r
+              1;\r
 \r
-                         0, 0, block.getWidth(),block.getHeight(), this);\r
+          blocky += (int) ( (float) sSeq / (float) alheight * sequencesHeight);\r
 \r
-          block = null;\r
-          }\r
+          mg.drawImage(block, blockx, blocky, blockx + blockw,\r
+                       blocky + blockh, 0, 0, block.getWidth(),\r
+                       block.getHeight(), this);\r
 \r
+          block = null;\r
+        }\r
       }\r
-\r
-    }catch(OutOfMemoryError error)\r
-    {     System.err.println("Out of memory when trying to calculate the overview window image!");   }\r
-\r
+    }\r
+    catch (OutOfMemoryError error)\r
+    {\r
+      System.err.println(\r
+          "Out of memory when trying to calculate the overview window image!");\r
+    }\r
 \r
     av.setRenderGaps(oldRenderGaps);\r
     resizing = false;\r
@@ -245,35 +289,37 @@ public class OverviewPanel extends JPanel implements Runnable
 \r
   public void setBoxPosition()\r
   {\r
-      boxX = (int) (av.getStartRes() * av.getCharWidth() * scalew);\r
-      boxY = (int) (av.getStartSeq() * av.getCharHeight() * scaleh);\r
-      boxWidth = (int) ((av.getEndRes()-av.getStartRes()+1)* av.getCharWidth() * scalew) ;\r
-      boxHeight = (int) (av.getEndSeq() * av.getCharHeight() * scaleh) - boxY;\r
-      repaint();\r
+    boxX = (int) (av.getStartRes() * av.getCharWidth() * scalew);\r
+    boxY = (int) (av.getStartSeq() * av.getCharHeight() * scaleh);\r
+    boxWidth = (int) ( (av.getEndRes() - av.getStartRes() + 1) *\r
+                      av.getCharWidth() * scalew);\r
+    boxHeight = (int) (av.getEndSeq() * av.getCharHeight() * scaleh) -\r
+        boxY;\r
+    repaint();\r
   }\r
 \r
-\r
   public void paintComponent(Graphics g)\r
   {\r
     g.setColor(Color.white);\r
-    g.fillRect(0,0,getWidth(),getHeight());\r
+    g.fillRect(0, 0, getWidth(), getHeight());\r
     g.setColor(Color.black);\r
 \r
-    if(resizing)\r
+    if (resizing)\r
     {\r
       g.setFont(new Font("Verdana", Font.BOLD, 15));\r
-      g.drawString("Recalculating", 5, sequencesHeight/2);\r
-      g.drawString("Overview.....", 5, sequencesHeight/2 +20);\r
+      g.drawString("Recalculating", 5, sequencesHeight / 2);\r
+      g.drawString("Overview.....", 5, (sequencesHeight / 2) + 20);\r
     }\r
     else\r
     {\r
-      if(miniMe!=null)\r
-        g.drawImage(miniMe, 0,0,this);\r
+      if (miniMe != null)\r
+      {\r
+        g.drawImage(miniMe, 0, 0, this);\r
+      }\r
 \r
       g.setColor(Color.red);\r
       g.drawRect(boxX, boxY, boxWidth, boxHeight);\r
-      g.drawRect(boxX+1, boxY+1, boxWidth-2, boxHeight-2);\r
+      g.drawRect(boxX + 1, boxY + 1, boxWidth - 2, boxHeight - 2);\r
     }\r
   }\r
-\r
 }\r
index 8f3ff73..ebde9cb 100755 (executable)
 /*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 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
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
+ */\r
 package jalview.gui;\r
 \r
-import jalview.datamodel.*;\r
-import jalview.analysis.PCA;\r
-import jalview.jbgui.*;\r
+import java.util.*;\r
+\r
 import java.awt.*;\r
 import java.awt.event.*;\r
-import java.util.*;\r
 \r
+import jalview.analysis.*;\r
+import jalview.datamodel.*;\r
+import jalview.jbgui.*;\r
 \r
-public class PCAPanel extends GPCAPanel implements Runnable\r
+public class PCAPanel\r
+    extends GPCAPanel implements Runnable\r
 {\r
   PCA pca;\r
   int top;\r
   RotatableCanvas rc;\r
   AlignViewport av;\r
 \r
-  public void run()\r
+  public PCAPanel(AlignViewport av, SequenceI[] s)\r
   {\r
-    // do stuff\r
-  }\r
-\r
-  public PCAPanel(AlignViewport av, SequenceI[] s) {\r
-\r
     this.av = av;\r
-    if(av.getSelectionGroup()!=null && av.getSelectionGroup().getSize()>3)\r
+\r
+    if ( (av.getSelectionGroup() != null) &&\r
+        (av.getSelectionGroup().getSize() > 3))\r
     {\r
       s = new Sequence[av.getSelectionGroup().getSize()];\r
-      for(int i=0; i<s.length; i++)\r
+\r
+      for (int i = 0; i < s.length; i++)\r
+      {\r
         s[i] = av.getSelectionGroup().getSequenceAt(i);\r
+      }\r
     }\r
 \r
-\r
-    if(s==null)\r
+    if (s == null)\r
     {\r
       s = new Sequence[av.getAlignment().getHeight()];\r
+\r
       for (int i = 0; i < av.getAlignment().getHeight(); i++)\r
+      {\r
         s[i] = av.getAlignment().getSequenceAt(i);\r
-     }\r
+      }\r
+    }\r
 \r
-//////////////////////This part was done in PCATHread originally. Is it too slow???\r
+    //////////////////////This part was done in PCATHread originally. Is it too slow???\r
     pca = new PCA(s);\r
     pca.run();\r
 \r
     // Now find the component coordinates\r
-    int ii=0;\r
-    while (ii < s.length && s[ii] != null)\r
+    int ii = 0;\r
+\r
+    while ( (ii < s.length) && (s[ii] != null))\r
     {\r
       ii++;\r
     }\r
 \r
     double[][] comps = new double[ii][ii];\r
 \r
-    for (int i=0; i < ii; i++ )\r
+    for (int i = 0; i < ii; i++)\r
     {\r
       if (pca.getEigenvalue(i) > 1e-4)\r
       {\r
-        comps[i]  = pca.component(i);\r
+        comps[i] = pca.component(i);\r
       }\r
     }\r
 \r
     //////////////////\r
-\r
     xCombobox.setSelectedIndex(0);\r
     yCombobox.setSelectedIndex(1);\r
     zCombobox.setSelectedIndex(2);\r
 \r
-    top = pca.getM().rows-1;\r
+    top = pca.getM().rows - 1;\r
 \r
     Vector points = new Vector();\r
-    float[][] scores = pca.getComponents(top-1,top-2,top-3,100);\r
+    float[][] scores = pca.getComponents(top - 1, top - 2, top - 3, 100);\r
 \r
-    for (int i =0; i < pca.getM().rows; i++ )\r
+    for (int i = 0; i < pca.getM().rows; i++)\r
     {\r
-      SequencePoint sp = new SequencePoint(s[i],scores[i]);\r
+      SequencePoint sp = new SequencePoint(s[i], scores[i]);\r
       points.addElement(sp);\r
     }\r
 \r
-    rc = new RotatableCanvas(av,points,pca.getM().rows);\r
+    rc = new RotatableCanvas(av, points, pca.getM().rows);\r
 \r
     //rc.printPoints();\r
-\r
     add(rc, BorderLayout.CENTER);\r
   }\r
 \r
+  public void run()\r
+  {\r
+    // do stuff\r
+  }\r
 \r
   void doDimensionChange()\r
   {\r
-    if(top==0)\r
+    if (top == 0)\r
+    {\r
       return;\r
+    }\r
 \r
     int dim1 = top - xCombobox.getSelectedIndex();\r
     int dim2 = top - yCombobox.getSelectedIndex();\r
     int dim3 = top - zCombobox.getSelectedIndex();\r
 \r
-    float[][] scores  = pca.getComponents(dim1,dim2,dim3,100);\r
-    for (int i=0; i < pca.getM().rows; i++) {\r
-      ((SequencePoint)rc.points.elementAt(i)).coord = scores[i];\r
+    float[][] scores = pca.getComponents(dim1, dim2, dim3, 100);\r
+\r
+    for (int i = 0; i < pca.getM().rows; i++)\r
+    {\r
+      ( (SequencePoint) rc.points.elementAt(i)).coord = scores[i];\r
     }\r
 \r
     rc.img = null;\r
@@ -137,5 +147,4 @@ public class PCAPanel extends GPCAPanel implements Runnable
   {\r
     doDimensionChange();\r
   }\r
-\r
 }\r
index 12545af..6bec8fd 100755 (executable)
@@ -1,54 +1,62 @@
 /*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 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
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
+ */\r
 package jalview.gui;\r
-import java.awt.*;\r
+\r
 import java.util.*;\r
 \r
+import java.awt.*;\r
+\r
 public class PaintRefresher\r
 {\r
   static Vector components = new Vector();\r
 \r
   public static void Register(Component c)\r
   {\r
-    if(!components.contains(c))\r
+    if (!components.contains(c))\r
+    {\r
       components.add(c);\r
+    }\r
     else\r
+    {\r
       components.remove(c);\r
+    }\r
   }\r
 \r
   public static void Refresh(Component c)\r
   {\r
     Component temp;\r
     Enumeration e = components.elements();\r
-    while( e.hasMoreElements() )\r
+\r
+    while (e.hasMoreElements())\r
     {\r
-      temp = (Component)e.nextElement();\r
+      temp = (Component) e.nextElement();\r
 \r
-      if(!temp.isValid())\r
-        components.removeElement( temp );\r
-      else if( temp == c )\r
-           continue;\r
+      if (!temp.isValid())\r
+      {\r
+        components.removeElement(temp);\r
+      }\r
+      else if (temp == c)\r
+      {\r
+        continue;\r
+      }\r
 \r
       temp.repaint();\r
     }\r
-\r
   }\r
-\r
 }\r
index 2825467..69789b9 100755 (executable)
 /*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 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
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
+ */\r
 package jalview.gui;\r
 \r
-import jalview.datamodel.*;\r
-import jalview.jbgui.GPairwiseAlignPanel;\r
-import jalview.analysis.*;\r
-import java.awt.event.*;\r
-import javax.swing.*;\r
 import java.util.*;\r
 \r
+import java.awt.event.*;\r
+\r
+import jalview.analysis.*;\r
+import jalview.datamodel.*;\r
+import jalview.jbgui.*;\r
 \r
-public class PairwiseAlignPanel extends GPairwiseAlignPanel\r
+public class PairwiseAlignPanel\r
+    extends GPairwiseAlignPanel\r
 {\r
-    Vector sequences = new Vector();\r
-    AlignViewport av;\r
+  Vector sequences = new Vector();\r
+  AlignViewport av;\r
+\r
+  public PairwiseAlignPanel(AlignViewport av)\r
+  {\r
+    super();\r
+    this.av = av;\r
 \r
-    public PairwiseAlignPanel(AlignViewport av)\r
+    Vector selsubset = new Vector();\r
+\r
+    for (int i = 0, j = av.getSelectionGroup().getSize(); i < j; i++)\r
     {\r
-      super();\r
-      this.av = av;\r
-      Vector selsubset = new Vector();\r
-      for (int i=0, j=av.getSelectionGroup().getSize(); i<j; i++)\r
-        if (av.getAlignment().getSequences().contains(av.getSelectionGroup().getSequenceAt(i)))\r
-          selsubset.add(av.getSelectionGroup().getSequenceAt(i));\r
-      float scores[][] = new float[selsubset.size()][selsubset.size()];\r
-      double totscore = 0;\r
-      int count = selsubset.size();\r
-\r
-      int acount = 0;\r
-      for (int i = 1; i < count; i++)\r
+      if (av.getAlignment().getSequences().contains(av.getSelectionGroup()\r
+          .getSequenceAt(i)))\r
       {\r
-        for (int j = 0; j < i; j++)\r
-        {\r
-          acount++;\r
-          AlignSeq as = new AlignSeq( (SequenceI) selsubset.elementAt(i),\r
-                                     (SequenceI) selsubset.elementAt(j), "pep");\r
-          as.calcScoreMatrix();\r
-          as.traceAlignment();\r
-          as.printAlignment();\r
-          scores[i][j] = (float) as.getMaxScore() /\r
-              (float) as.getASeq1().length;\r
-          totscore = totscore + scores[i][j];\r
-\r
-          textarea.append(as.getOutput());\r
-          sequences.add(new Sequence(as.getS1().getName(), as.getAStr1()));\r
-          sequences.add(new Sequence(as.getS2().getName(), as.getAStr2()));\r
-        }\r
+        selsubset.add(av.getSelectionGroup().getSequenceAt(i));\r
       }\r
-      if (count > 2)\r
-      {\r
-        System.out.println("Pairwise alignment scaled similarity score matrix\n");\r
-        for (int i = 0; i < count;i++)\r
-          jalview.util.Format.print(System.out, "%s \n", (""+i)+" "+((SequenceI) selsubset.elementAt(i)).getName());\r
-        System.out.println("\n");\r
-        for (int i = 0; i < count;i++)\r
-          for (int j = 0; j < i; j++)\r
-            jalview.util.Format.print(System.out,"%7.3f",scores[i][j]/totscore);\r
-        System.out.println("\n");\r
+    }\r
+\r
+    float[][] scores = new float[selsubset.size()][selsubset.size()];\r
+    double totscore = 0;\r
+    int count = selsubset.size();\r
 \r
+    int acount = 0;\r
+\r
+    for (int i = 1; i < count; i++)\r
+    {\r
+      for (int j = 0; j < i; j++)\r
+      {\r
+        acount++;\r
+\r
+        AlignSeq as = new AlignSeq( (SequenceI) selsubset.elementAt(i),\r
+                                   (SequenceI) selsubset.elementAt(j), "pep");\r
+        as.calcScoreMatrix();\r
+        as.traceAlignment();\r
+        as.printAlignment();\r
+        scores[i][j] = (float) as.getMaxScore() / (float) as.getASeq1().length;\r
+        totscore = totscore + scores[i][j];\r
+\r
+        textarea.append(as.getOutput());\r
+        sequences.add(new Sequence(as.getS1().getName(), as.getAStr1()));\r
+        sequences.add(new Sequence(as.getS2().getName(), as.getAStr2()));\r
       }\r
     }\r
 \r
+    if (count > 2)\r
+    {\r
+      System.out.println(\r
+          "Pairwise alignment scaled similarity score matrix\n");\r
 \r
-  protected void viewInEditorButton_actionPerformed(ActionEvent e)\r
-  {\r
+      for (int i = 0; i < count; i++)\r
+      {\r
+        jalview.util.Format.print(System.out, "%s \n",\r
+                                  ("" + i) + " " +\r
+                                  ( (SequenceI) selsubset.elementAt(i)).getName());\r
+      }\r
 \r
-      Sequence [] seq = new Sequence[sequences.size()];\r
+      System.out.println("\n");\r
 \r
-      for (int i=0;i<sequences.size();i++)\r
-       seq[i] = (Sequence) sequences.elementAt(i);\r
+      for (int i = 0; i < count; i++)\r
+      {\r
+        for (int j = 0; j < i; j++)\r
+        {\r
+          jalview.util.Format.print(System.out, "%7.3f",\r
+                                    scores[i][j] / totscore);\r
+        }\r
+      }\r
 \r
+      System.out.println("\n");\r
+    }\r
+  }\r
 \r
-      AlignFrame af = new AlignFrame(new Alignment(seq));\r
-      Desktop.addInternalFrame(af, "Pairwise Aligned Sequences",\r
-                               AlignFrame.NEW_WINDOW_WIDTH,\r
-                               AlignFrame.NEW_WINDOW_HEIGHT);\r
+  protected void viewInEditorButton_actionPerformed(ActionEvent e)\r
+  {\r
+    Sequence[] seq = new Sequence[sequences.size()];\r
 \r
-  }\r
+    for (int i = 0; i < sequences.size(); i++)\r
+    {\r
+      seq[i] = (Sequence) sequences.elementAt(i);\r
+    }\r
 \r
+    AlignFrame af = new AlignFrame(new Alignment(seq));\r
+    Desktop.addInternalFrame(af, "Pairwise Aligned Sequences",\r
+                             AlignFrame.NEW_WINDOW_WIDTH,\r
+                             AlignFrame.NEW_WINDOW_HEIGHT);\r
+  }\r
 }\r
index 7133e44..7576173 100755 (executable)
@@ -1,41 +1,43 @@
 /*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 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
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
+ */\r
 package jalview.gui;\r
 \r
-import jalview.datamodel.*;\r
-import jalview.analysis.*;\r
-import jalview.schemes.*;\r
 import java.awt.*;\r
-import javax.swing.*;\r
 import java.awt.event.*;\r
-import jalview.io.*;\r
+import javax.swing.*;\r
+\r
 import MCview.*;\r
+import jalview.analysis.*;\r
+import jalview.datamodel.*;\r
+import jalview.io.*;\r
+import jalview.schemes.*;\r
 \r
-public class PopupMenu extends JPopupMenu\r
+public class PopupMenu\r
+    extends JPopupMenu\r
 {\r
   JMenu groupMenu = new JMenu();\r
   JMenuItem groupName = new JMenuItem();\r
   protected JRadioButtonMenuItem clustalColour = new JRadioButtonMenuItem();\r
   protected JRadioButtonMenuItem zappoColour = new JRadioButtonMenuItem();\r
   protected JRadioButtonMenuItem taylorColour = new JRadioButtonMenuItem();\r
-  protected JRadioButtonMenuItem hydrophobicityColour = new JRadioButtonMenuItem();\r
+  protected JRadioButtonMenuItem hydrophobicityColour = new\r
+      JRadioButtonMenuItem();\r
   protected JRadioButtonMenuItem helixColour = new JRadioButtonMenuItem();\r
   protected JRadioButtonMenuItem strandColour = new JRadioButtonMenuItem();\r
   protected JRadioButtonMenuItem turnColour = new JRadioButtonMenuItem();\r
@@ -46,8 +48,6 @@ public class PopupMenu extends JPopupMenu
   protected JRadioButtonMenuItem BLOSUM62Colour = new JRadioButtonMenuItem();\r
   JRadioButtonMenuItem noColourmenuItem = new JRadioButtonMenuItem();\r
   protected JCheckBoxMenuItem conservationMenuItem = new JCheckBoxMenuItem();\r
-\r
-\r
   AlignmentPanel ap;\r
   JMenu sequenceMenu = new JMenu();\r
   JMenuItem sequenceName = new JMenuItem();\r
@@ -69,7 +69,6 @@ public class PopupMenu extends JPopupMenu
     //\r
     // If from the IDPanel, we must display the sequence menu\r
     //////////////////////////////////////////////////////////\r
-\r
     this.ap = ap;\r
     sequence = seq;\r
 \r
@@ -89,57 +88,96 @@ public class PopupMenu extends JPopupMenu
     colours.add(BLOSUM62Colour);\r
 \r
     try\r
-    {     jbInit();   }\r
-    catch(Exception e)\r
-    {    e.printStackTrace();    }\r
+    {\r
+      jbInit();\r
+    }\r
+    catch (Exception e)\r
+    {\r
+      e.printStackTrace();\r
+    }\r
 \r
     SequenceGroup sg = ap.av.getSelectionGroup();\r
-    if(sg!=null)\r
+\r
+    if (sg != null)\r
     {\r
       groupName.setText(sg.getName());\r
-      if(sg.cs instanceof ZappoColourScheme)\r
+\r
+      if (sg.cs instanceof ZappoColourScheme)\r
+      {\r
         zappoColour.setSelected(true);\r
-      else if(sg.cs instanceof TaylorColourScheme)\r
+      }\r
+      else if (sg.cs instanceof TaylorColourScheme)\r
+      {\r
         taylorColour.setSelected(true);\r
+      }\r
       else if (sg.cs instanceof PIDColourScheme)\r
+      {\r
         PIDColour.setSelected(true);\r
+      }\r
       else if (sg.cs instanceof Blosum62ColourScheme)\r
+      {\r
         BLOSUM62Colour.setSelected(true);\r
+      }\r
       else if (sg.cs instanceof UserColourScheme)\r
+      {\r
         userDefinedColour.setSelected(true);\r
+      }\r
       else if (sg.cs instanceof HydrophobicColourScheme)\r
+      {\r
         hydrophobicityColour.setSelected(true);\r
+      }\r
       else if (sg.cs instanceof HelixColourScheme)\r
+      {\r
         helixColour.setSelected(true);\r
+      }\r
       else if (sg.cs instanceof StrandColourScheme)\r
+      {\r
         strandColour.setSelected(true);\r
+      }\r
       else if (sg.cs instanceof TurnColourScheme)\r
+      {\r
         turnColour.setSelected(true);\r
+      }\r
       else if (sg.cs instanceof BuriedColourScheme)\r
+      {\r
         buriedColour.setSelected(true);\r
+      }\r
       else if (sg.cs instanceof ClustalxColourScheme)\r
+      {\r
         clustalColour.setSelected(true);\r
+      }\r
       else\r
+      {\r
         noColourmenuItem.setSelected(true);\r
+      }\r
 \r
       if (sg.cs instanceof ConservationColourScheme)\r
+      {\r
         conservationMenuItem.setSelected(true);\r
+      }\r
 \r
       showText.setSelected(sg.getDisplayText());\r
       showColourText.setSelected(sg.getColourText());\r
       showBoxes.setSelected(sg.getDisplayBoxes());\r
     }\r
 \r
-    if( !ap.av.alignment.getGroups().contains(sg))\r
+    if (!ap.av.alignment.getGroups().contains(sg))\r
+    {\r
       unGroupMenuItem.setVisible(false);\r
+    }\r
     else\r
+    {\r
       groupMenu.insertSeparator(3);\r
+    }\r
 \r
-    if(seq==null)\r
-       sequenceMenu.setVisible(false);\r
-\r
+    if (seq == null)\r
+    {\r
+      sequenceMenu.setVisible(false);\r
+    }\r
   }\r
-  private void jbInit() throws Exception\r
+\r
+  private void jbInit()\r
+      throws Exception\r
   {\r
     groupMenu.setText("Group");\r
     groupMenu.setText("Define");\r
@@ -356,24 +394,24 @@ public class PopupMenu extends JPopupMenu
       }\r
     });\r
     conservationMenuItem.setText("Conservation");\r
-   conservationMenuItem.addActionListener(new java.awt.event.ActionListener()\r
-   {\r
-     public void actionPerformed(ActionEvent e)\r
-     {\r
-       conservationMenuItem_actionPerformed(e);\r
-     }\r
-   });\r
-\r
-\r
-\r
+    conservationMenuItem.addActionListener(new java.awt.event.ActionListener()\r
+    {\r
+      public void actionPerformed(ActionEvent e)\r
+      {\r
+        conservationMenuItem_actionPerformed(e);\r
+      }\r
+    });\r
   }\r
 \r
   void refresh()\r
   {\r
     SequenceGroup sg = getGroup();\r
-    SuperGroup superG = ap.av.alignment.getSuperGroup( sg );\r
-    if( superG !=null)\r
-      superG.setSuperGroupProperties( sg );\r
+    SuperGroup superG = ap.av.alignment.getSuperGroup(sg);\r
+\r
+    if (superG != null)\r
+    {\r
+      superG.setSuperGroupProperties(sg);\r
+    }\r
 \r
     ap.seqPanel.repaint();\r
   }\r
@@ -381,7 +419,8 @@ public class PopupMenu extends JPopupMenu
   protected void clustalColour_actionPerformed(ActionEvent e)\r
   {\r
     SequenceGroup sg = getGroup();\r
-    sg.cs = new ClustalxColourScheme(sg.sequences, ap.av.alignment.getWidth());\r
+    sg.cs = new ClustalxColourScheme(sg.sequences,\r
+                                     ap.av.alignment.getWidth());\r
     refresh();\r
   }\r
 \r
@@ -397,7 +436,6 @@ public class PopupMenu extends JPopupMenu
     refresh();\r
   }\r
 \r
-\r
   protected void hydrophobicityColour_actionPerformed(ActionEvent e)\r
   {\r
     getGroup().cs = new HydrophobicColourScheme();\r
@@ -434,24 +472,28 @@ public class PopupMenu extends JPopupMenu
     refresh();\r
   }\r
 \r
-\r
-\r
   protected void abovePIDColour_actionPerformed(ActionEvent e)\r
   {\r
     SequenceGroup sg = getGroup();\r
+\r
     if (abovePIDColour.isSelected())\r
     {\r
       sg.cs.setConsensus(AAFrequency.calculate(sg.sequences, 0,\r
                                                ap.av.alignment.getWidth()));\r
-      int threshold = SliderPanel.setPIDSliderSource(ap, sg.cs, getGroup().getName());\r
+\r
+      int threshold = SliderPanel.setPIDSliderSource(ap, sg.cs,\r
+          getGroup().getName());\r
+\r
       if (sg.cs instanceof ResidueColourScheme)\r
-        ( (ResidueColourScheme)sg. cs).setThreshold(threshold);\r
+      {\r
+        ( (ResidueColourScheme) sg.cs).setThreshold(threshold);\r
+      }\r
       else if (sg.cs instanceof ScoreColourScheme)\r
+      {\r
         ( (ScoreColourScheme) sg.cs).setThreshold(threshold);\r
+      }\r
 \r
       SliderPanel.showPIDSlider();\r
-\r
-\r
     }\r
     else // remove PIDColouring\r
     {\r
@@ -461,13 +503,11 @@ public class PopupMenu extends JPopupMenu
     }\r
 \r
     refresh();\r
-\r
   }\r
 \r
-\r
   protected void userDefinedColour_actionPerformed(ActionEvent e)\r
   {\r
-    new UserDefinedColours( ap, getGroup());\r
+    new UserDefinedColours(ap, getGroup());\r
   }\r
 \r
   protected void PIDColour_actionPerformed(ActionEvent e)\r
@@ -475,7 +515,7 @@ public class PopupMenu extends JPopupMenu
     SequenceGroup sg = getGroup();\r
     sg.cs = new PIDColourScheme();\r
     sg.cs.setConsensus(AAFrequency.calculate(sg.sequences, 0,\r
-                                               ap.av.alignment.getWidth()));\r
+                                             ap.av.alignment.getWidth()));\r
     refresh();\r
   }\r
 \r
@@ -486,34 +526,32 @@ public class PopupMenu extends JPopupMenu
     sg.cs = new Blosum62ColourScheme();\r
 \r
     sg.cs.setConsensus(AAFrequency.calculate(sg.sequences, 0,\r
-                                               ap.av.alignment.getWidth()));\r
+                                             ap.av.alignment.getWidth()));\r
 \r
     refresh();\r
   }\r
 \r
-\r
   protected void noColourmenuItem_actionPerformed(ActionEvent e)\r
   {\r
     getGroup().cs = null;\r
     refresh();\r
   }\r
 \r
-  protected  void conservationMenuItem_actionPerformed(ActionEvent e)\r
+  protected void conservationMenuItem_actionPerformed(ActionEvent e)\r
   {\r
     SequenceGroup sg = getGroup();\r
 \r
-    if(conservationMenuItem.isSelected())\r
+    if (conservationMenuItem.isSelected())\r
     {\r
+      Conservation c = new Conservation("Group",\r
+                                        ResidueProperties.propHash, 3,\r
+                                        sg.sequences, 0,\r
+                                        ap.av.alignment.getWidth());\r
 \r
-        Conservation c = new Conservation("Group",\r
-                                          ResidueProperties.propHash, 3,\r
-                                          sg.sequences, 0,\r
-                                          ap.av.alignment.getWidth());\r
-\r
-        c.calculate();\r
-        c.verdict(false, ap.av.ConsPercGaps);\r
-        ConservationColourScheme ccs = new ConservationColourScheme(c, sg.cs);\r
+      c.calculate();\r
+      c.verdict(false, ap.av.ConsPercGaps);\r
 \r
+      ConservationColourScheme ccs = new ConservationColourScheme(c, sg.cs);\r
 \r
       sg.cs = ccs;\r
 \r
@@ -522,45 +560,48 @@ public class PopupMenu extends JPopupMenu
     }\r
     else // remove ConservationColouring\r
     {\r
-        ConservationColourScheme ccs = (ConservationColourScheme)sg.cs;\r
-        sg.cs = ccs.cs;\r
+      ConservationColourScheme ccs = (ConservationColourScheme) sg.cs;\r
+      sg.cs = ccs.cs;\r
     }\r
 \r
-     refresh();\r
+    refresh();\r
   }\r
 \r
-\r
   protected void groupName_actionPerformed(ActionEvent e)\r
   {\r
     SequenceGroup sg = getGroup();\r
-    String reply = JOptionPane.showInternalInputDialog(Desktop.desktop, "Enter new group name", "Edit group name", JOptionPane.QUESTION_MESSAGE);\r
-    if(reply==null)\r
+    String reply = JOptionPane.showInternalInputDialog(Desktop.desktop,\r
+        "Enter new group name", "Edit group name",\r
+        JOptionPane.QUESTION_MESSAGE);\r
+\r
+    if (reply == null)\r
+    {\r
       return;\r
+    }\r
 \r
     sg.setName(reply);\r
     groupName.setText(reply);\r
   }\r
 \r
-\r
   protected void analyze_actionPerformed(ActionEvent e)\r
   {\r
-     CutAndPasteTransfer cap = new CutAndPasteTransfer();\r
-     JInternalFrame frame = new JInternalFrame();\r
-     frame.setContentPane(cap);\r
-     Desktop.addInternalFrame(frame, "Analyze this - ", 400, 300);\r
-     SequenceGroup sg = getGroup();\r
-     StringBuffer sb = new StringBuffer();\r
-\r
-     for(int i=0; i<sg.sequences.size(); i++)\r
-     {\r
-       Sequence tmp = (Sequence)sg.sequences.get(i);\r
-       sb.append(  tmp.getSequence(sg.getStartRes(), sg.getEndRes()+1));\r
-       sb.append("\n");\r
-     }\r
-\r
-     sb.append("Something amazing will happen soon");\r
-     cap.setText( sb.toString() );\r
+    CutAndPasteTransfer cap = new CutAndPasteTransfer();\r
+    JInternalFrame frame = new JInternalFrame();\r
+    frame.setContentPane(cap);\r
+    Desktop.addInternalFrame(frame, "Analyze this - ", 400, 300);\r
+\r
+    SequenceGroup sg = getGroup();\r
+    StringBuffer sb = new StringBuffer();\r
 \r
+    for (int i = 0; i < sg.sequences.size(); i++)\r
+    {\r
+      Sequence tmp = (Sequence) sg.sequences.get(i);\r
+      sb.append(tmp.getSequence(sg.getStartRes(), sg.getEndRes() + 1));\r
+      sb.append("\n");\r
+    }\r
+\r
+    sb.append("Something amazing will happen soon");\r
+    cap.setText(sb.toString());\r
   }\r
 \r
   SequenceGroup getGroup()\r
@@ -576,47 +617,47 @@ public class PopupMenu extends JPopupMenu
   void sequenceName_actionPerformed(ActionEvent e)\r
   {\r
     String id = sequence.getName();\r
-    String s = (String)JOptionPane.showInternalInputDialog(\r
-                ap,\r
-                "Edit sequence name",\r
-                "Edit sequence name ("+sequence.getName()+")",\r
-                JOptionPane.PLAIN_MESSAGE,\r
-                null,\r
-                null,\r
-                id);\r
+    String s = (String) JOptionPane.showInternalInputDialog(ap,\r
+        "Edit sequence name",\r
+        "Edit sequence name (" + sequence.getName() + ")",\r
+        JOptionPane.PLAIN_MESSAGE, null, null, id);\r
 \r
-    if(s!=null)\r
+    if (s != null)\r
     {\r
       sequence.setName(s);\r
       ap.repaint();\r
     }\r
-\r
   }\r
 \r
   void unGroupMenuItem_actionPerformed(ActionEvent e)\r
   {\r
-     SequenceGroup sg = ap.av.getSelectionGroup();\r
-     ap.av.alignment.deleteGroup(sg);\r
-     ap.av.setSelectionGroup(null);\r
-     ap.repaint();\r
+    SequenceGroup sg = ap.av.getSelectionGroup();\r
+    ap.av.alignment.deleteGroup(sg);\r
+    ap.av.setSelectionGroup(null);\r
+    ap.repaint();\r
   }\r
 \r
   void pdbMenuItem_actionPerformed(ActionEvent e)\r
   {\r
-    if(sequence.getPDBId()==null)\r
+    if (sequence.getPDBId() == null)\r
+    {\r
       return;\r
+    }\r
 \r
     try\r
     {\r
       EBIFetchClient ebi = new EBIFetchClient();\r
-      String[] result = ebi.fetchData("pdb:" + sequence.getPDBId(), null, null);\r
+      String[] result = ebi.fetchData("pdb:" + sequence.getPDBId(), null,\r
+                                      null);\r
 \r
       PDBfile pdb = new PDBfile(result);\r
 \r
       rotCanvas rc = new rotCanvas(pdb, sequence, ap.av);\r
       JInternalFrame frame = new JInternalFrame();\r
       frame.setContentPane(rc);\r
-      Desktop.addInternalFrame(frame,sequence.getName()+" "+ sequence.getPDBId(), 400, 400);\r
+      Desktop.addInternalFrame(frame,\r
+                               sequence.getName() + " " + sequence.getPDBId(),\r
+                               400, 400);\r
     }\r
     catch (Exception ex)\r
     {\r
@@ -627,9 +668,14 @@ public class PopupMenu extends JPopupMenu
   protected void outline_actionPerformed(ActionEvent e)\r
   {\r
     SequenceGroup sg = getGroup();\r
-    Color col = JColorChooser.showDialog(this, "Select Outline Colour", Color.BLUE);\r
-    if(col!=null)\r
+    Color col = JColorChooser.showDialog(this, "Select Outline Colour",\r
+                                         Color.BLUE);\r
+\r
+    if (col != null)\r
+    {\r
       sg.setOutlineColour(col);\r
+    }\r
+\r
     ap.repaint();\r
   }\r
 \r
@@ -650,5 +696,4 @@ public class PopupMenu extends JPopupMenu
     getGroup().setColourText(showColourText.isSelected());\r
     refresh();\r
   }\r
-\r
 }\r
index 4708ced..b16ae32 100755 (executable)
 /*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 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
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
+ */\r
 package jalview.gui;\r
 \r
-import jalview.jbgui.*;\r
-import jalview.schemes.*;\r
-import jalview.io.*;\r
-\r
-import jalview.bin.Cache;\r
-import javax.swing.*;\r
-import java.awt.event.ActionEvent;\r
 import java.awt.*;\r
+import java.awt.event.*;\r
+import javax.swing.*;\r
 \r
+import jalview.bin.*;\r
+import jalview.io.*;\r
+import jalview.jbgui.*;\r
+import jalview.schemes.*;\r
 \r
-public class Preferences extends GPreferences\r
+public class Preferences\r
+    extends GPreferences\r
 {\r
-  static boolean preferencesLoaded=false;\r
-\r
-  public static boolean showFullscreen=false;\r
-  public static boolean showFullId=true;\r
-  public static boolean showAnnotation=true;\r
-  public static boolean showConservation=true;\r
-  public static boolean showQuality=true;\r
-  public static boolean showIdentity=true;\r
-  public static String fontName="SansSerif";\r
-  public static String fontSize="10";\r
-  public static String fontStyle=Font.PLAIN+"";\r
-  public static char gapSymbol='-';\r
-  public static String defaultColour=null;\r
-  public static boolean showStartupFile=true;\r
-  public static String startupFile = "http://www.jalview.org/examples/exampleFile.jar";\r
-\r
+  static boolean preferencesLoaded = false;\r
+  public static boolean showFullscreen = false;\r
+  public static boolean showFullId = true;\r
+  public static boolean showAnnotation = true;\r
+  public static boolean showConservation = true;\r
+  public static boolean showQuality = true;\r
+  public static boolean showIdentity = true;\r
+  public static String fontName = "SansSerif";\r
+  public static String fontSize = "10";\r
+  public static String fontStyle = Font.PLAIN + "";\r
+  public static char gapSymbol = '-';\r
+  public static String defaultColour = null;\r
+  public static boolean showStartupFile = true;\r
+  public static String startupFile =\r
+      "http://www.jalview.org/examples/exampleFile.jar";\r
   JInternalFrame frame;\r
 \r
-  public static void initPreferences()\r
-  {\r
-  String string = Cache.getProperty("SHOW_FULL_ID");\r
-  if(string!=null)\r
-    showFullId = Boolean.valueOf(string).booleanValue();\r
-\r
-  string = Cache.getProperty("SHOW_FULLSCREEN");\r
-  if(string!=null)\r
-    showFullscreen = Boolean.valueOf(string).booleanValue();\r
-\r
-  string = Cache.getProperty("SHOW_ANNOTATIONS");\r
-      if(string!=null)\r
-    showAnnotation = Boolean.valueOf(string).booleanValue();\r
-\r
-  string = Cache.getProperty("SHOW_CONSERVATION");\r
-      if(string!=null)\r
-    showConservation = Boolean.valueOf(string).booleanValue();\r
-  string = Cache.getProperty("SHOW_QUALITY");\r
-      if(string!=null)\r
-    showQuality = Boolean.valueOf(string).booleanValue();\r
-  string = Cache.getProperty("SHOW_IDENTITY");\r
-      if(string!=null)\r
-    showIdentity = Boolean.valueOf(string).booleanValue();\r
-\r
-  string = Cache.getProperty("GAP_SYMBOL");\r
-      if(string!=null)\r
-    gapSymbol = string.charAt(0);\r
-\r
-  string = Cache.getProperty("SHOW_FULL_ID");\r
-    if(string!=null)\r
-      showFullId = Boolean.valueOf(string).booleanValue();\r
-\r
-    string = Cache.getProperty("FONT_NAME");\r
-    if (string != null)\r
-      fontName = string;\r
-\r
-    string = Cache.getProperty("FONT_STYLE");\r
-    if (string != null)\r
-      fontStyle = string;\r
-\r
-    string = Cache.getProperty("FONT_SIZE");\r
-    if (string != null)\r
-      fontSize = string;\r
-\r
-\r
-  string = Cache.getProperty("DEFAULT_COLOUR");\r
-  if(string!=null)\r
-      defaultColour = string;\r
-\r
-  string = Cache.getProperty("STARTUP_FILE");\r
-    if(string!=null)\r
-      startupFile = string;\r
-\r
-  string = Cache.getProperty("SHOW_STARTUP_FILE");\r
-        if(string!=null)\r
-      showStartupFile = Boolean.valueOf(string).booleanValue();\r
-\r
-      preferencesLoaded = true;\r
-  }\r
-\r
   public Preferences()\r
   {\r
     initPreferences();\r
 \r
     frame = new JInternalFrame();\r
     frame.setContentPane(this);\r
-    Desktop.addInternalFrame(frame, "Preferences", 480,390 );\r
+    Desktop.addInternalFrame(frame, "Preferences", 480, 390);\r
 \r
     fullID.setSelected(showFullId);\r
+\r
     String string = Cache.getProperty("SHOW_FULLSCREEN");\r
     boolean value = false;\r
-    if(string!=null)\r
-      value =  Boolean.valueOf(string).booleanValue();\r
+\r
+    if (string != null)\r
+    {\r
+      value = Boolean.valueOf(string).booleanValue();\r
+    }\r
 \r
     fullScreen.setSelected(value);\r
     annotations.setSelected(showAnnotation);\r
@@ -134,43 +76,158 @@ public class Preferences extends GPreferences
     quality.setSelected(showQuality);\r
     identity.setSelected(showIdentity);\r
 \r
-    for(int i=0; i<12; i++)\r
-      colour.addItem( ColourSchemeProperty.getColourName(i) );\r
+    for (int i = 0; i < 12; i++)\r
+    {\r
+      colour.addItem(ColourSchemeProperty.getColourName(i));\r
+    }\r
 \r
     string = Cache.getProperty("DEFAULT_COLOUR");\r
-    if(string!=null)\r
-      colour.setSelectedItem( string );\r
+\r
+    if (string != null)\r
+    {\r
+      colour.setSelectedItem(string);\r
+    }\r
     else\r
-      colour.setSelectedIndex( 11 );\r
+    {\r
+      colour.setSelectedIndex(11);\r
+    }\r
 \r
-    String fonts[] = java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames();\r
-    for(int i=0; i<fonts.length; i++)\r
+    String[] fonts = java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment()\r
+        .getAvailableFontFamilyNames();\r
+\r
+    for (int i = 0; i < fonts.length; i++)\r
+    {\r
       fontNameCB.addItem(fonts[i]);\r
+    }\r
+\r
+    for (int i = 1; i < 31; i++)\r
+    {\r
+      fontSizeCB.addItem(i + "");\r
+    }\r
+\r
+    fontStyleCB.addItem("plain");\r
+    fontStyleCB.addItem("bold");\r
+    fontStyleCB.addItem("italic");\r
+\r
+    fontNameCB.setSelectedItem(fontName);\r
+    fontSizeCB.setSelectedItem(fontSize);\r
+    fontStyleCB.setSelectedItem(fontStyle);\r
+\r
+    gapSymbolCB.addItem("-");\r
+    gapSymbolCB.addItem(".");\r
+\r
+    gapSymbolCB.setSelectedItem(gapSymbol + "");\r
+\r
+    startupCheckbox.setSelected(showStartupFile);\r
+    startupFileTextfield.setText(startupFile);\r
+  }\r
+\r
+  public static void initPreferences()\r
+  {\r
+    String string = Cache.getProperty("SHOW_FULL_ID");\r
 \r
-    for(int i=1; i<31; i++)\r
-      fontSizeCB.addItem(i+"");\r
+    if (string != null)\r
+    {\r
+      showFullId = Boolean.valueOf(string).booleanValue();\r
+    }\r
+\r
+    string = Cache.getProperty("SHOW_FULLSCREEN");\r
+\r
+    if (string != null)\r
+    {\r
+      showFullscreen = Boolean.valueOf(string).booleanValue();\r
+    }\r
+\r
+    string = Cache.getProperty("SHOW_ANNOTATIONS");\r
+\r
+    if (string != null)\r
+    {\r
+      showAnnotation = Boolean.valueOf(string).booleanValue();\r
+    }\r
+\r
+    string = Cache.getProperty("SHOW_CONSERVATION");\r
+\r
+    if (string != null)\r
+    {\r
+      showConservation = Boolean.valueOf(string).booleanValue();\r
+    }\r
+\r
+    string = Cache.getProperty("SHOW_QUALITY");\r
+\r
+    if (string != null)\r
+    {\r
+      showQuality = Boolean.valueOf(string).booleanValue();\r
+    }\r
+\r
+    string = Cache.getProperty("SHOW_IDENTITY");\r
+\r
+    if (string != null)\r
+    {\r
+      showIdentity = Boolean.valueOf(string).booleanValue();\r
+    }\r
+\r
+    string = Cache.getProperty("GAP_SYMBOL");\r
+\r
+    if (string != null)\r
+    {\r
+      gapSymbol = string.charAt(0);\r
+    }\r
+\r
+    string = Cache.getProperty("SHOW_FULL_ID");\r
+\r
+    if (string != null)\r
+    {\r
+      showFullId = Boolean.valueOf(string).booleanValue();\r
+    }\r
+\r
+    string = Cache.getProperty("FONT_NAME");\r
 \r
-   fontStyleCB.addItem("plain");\r
-   fontStyleCB.addItem("bold");\r
-   fontStyleCB.addItem("italic");\r
+    if (string != null)\r
+    {\r
+      fontName = string;\r
+    }\r
+\r
+    string = Cache.getProperty("FONT_STYLE");\r
+\r
+    if (string != null)\r
+    {\r
+      fontStyle = string;\r
+    }\r
+\r
+    string = Cache.getProperty("FONT_SIZE");\r
+\r
+    if (string != null)\r
+    {\r
+      fontSize = string;\r
+    }\r
+\r
+    string = Cache.getProperty("DEFAULT_COLOUR");\r
 \r
-   fontNameCB.setSelectedItem(fontName);\r
-   fontSizeCB.setSelectedItem(fontSize);\r
-   fontStyleCB.setSelectedItem(fontStyle);\r
+    if (string != null)\r
+    {\r
+      defaultColour = string;\r
+    }\r
 \r
-   gapSymbolCB.addItem("-");\r
-   gapSymbolCB.addItem(".");\r
+    string = Cache.getProperty("STARTUP_FILE");\r
 \r
-   gapSymbolCB.setSelectedItem( gapSymbol+"" );\r
+    if (string != null)\r
+    {\r
+      startupFile = string;\r
+    }\r
 \r
-   startupCheckbox.setSelected(showStartupFile);\r
-   startupFileTextfield.setText(startupFile);\r
+    string = Cache.getProperty("SHOW_STARTUP_FILE");\r
 \r
+    if (string != null)\r
+    {\r
+      showStartupFile = Boolean.valueOf(string).booleanValue();\r
+    }\r
+\r
+    preferencesLoaded = true;\r
   }\r
 \r
   public void ok_actionPerformed(ActionEvent e)\r
   {\r
-    showFullId =  fullID.isSelected() ;\r
+    showFullId = fullID.isSelected();\r
     showFullscreen = fullScreen.isSelected();\r
     showAnnotation = annotations.isSelected();\r
     showConservation = conservation.isSelected();\r
@@ -185,15 +242,16 @@ public class Preferences extends GPreferences
     showStartupFile = startupCheckbox.isSelected();\r
 \r
     Cache.setProperty("SHOW_FULL_ID", Boolean.toString(showFullId));\r
-    Cache.setProperty("SHOW_FULLSCREEN", Boolean.toString( showFullscreen ) );\r
+    Cache.setProperty("SHOW_FULLSCREEN", Boolean.toString(showFullscreen));\r
 \r
-    Cache.setProperty("SHOW_ANNOTATIONS", Boolean.toString( showAnnotation  ));\r
-    Cache.setProperty("SHOW_CONSERVATION", Boolean.toString( showConservation ));\r
-    Cache.setProperty("SHOW_QUALITY", Boolean.toString( showQuality ));\r
-    Cache.setProperty("SHOW_IDENTITY", Boolean.toString( showIdentity ));\r
+    Cache.setProperty("SHOW_ANNOTATIONS", Boolean.toString(showAnnotation));\r
+    Cache.setProperty("SHOW_CONSERVATION",\r
+                      Boolean.toString(showConservation));\r
+    Cache.setProperty("SHOW_QUALITY", Boolean.toString(showQuality));\r
+    Cache.setProperty("SHOW_IDENTITY", Boolean.toString(showIdentity));\r
 \r
     Cache.setProperty("DEFAULT_COLOUR", defaultColour);\r
-    Cache.setProperty("GAP_SYMBOL", gapSymbol+"");\r
+    Cache.setProperty("GAP_SYMBOL", gapSymbol + "");\r
 \r
     Cache.setProperty("FONT_NAME", fontName);\r
     Cache.setProperty("FONT_STYLE", fontStyle);\r
@@ -202,36 +260,52 @@ public class Preferences extends GPreferences
     Cache.setProperty("STARTUP_FILE", startupFile);\r
     Cache.setProperty("SHOW_STARTUP_FILE", Boolean.toString(showStartupFile));\r
 \r
-\r
-\r
-    try    {\r
+    try\r
+    {\r
       frame.setClosed(true);\r
-    }    catch (Exception ex)  {}\r
-\r
+    }\r
+    catch (Exception ex)\r
+    {\r
+    }\r
   }\r
 \r
   public void startupFileTextfield_mouseClicked()\r
   {\r
-    JalviewFileChooser chooser = new JalviewFileChooser(jalview.bin.Cache.getProperty("LAST_DIRECTORY"),\r
-        new String[]{"fa, fasta, fastq", "aln",  "pfam", "msf", "pir","blc","jar"},\r
-        new String[]{"Fasta", "Clustal", "PFAM", "MSF", "PIR", "BLC", "Jalview"}\r
-       ,jalview.bin.Cache.getProperty("DEFAULT_FILE_FORMAT"));\r
-   chooser.setFileView(new JalviewFileView());\r
-   chooser.setDialogTitle("Select startup file");\r
-   int value = chooser.showOpenDialog(this);\r
-   if(value == JalviewFileChooser.APPROVE_OPTION)\r
-   {\r
-     jalview.bin.Cache.setProperty("DEFAULT_FILE_FORMAT", chooser.getSelectedFormat());\r
-     startupFileTextfield.setText( chooser.getSelectedFile().getAbsolutePath() );\r
-   }\r
+    JalviewFileChooser chooser = new JalviewFileChooser(jalview.bin.Cache.\r
+        getProperty(\r
+            "LAST_DIRECTORY"),\r
+        new String[]\r
+        {\r
+        "fa, fasta, fastq", "aln", "pfam", "msf", "pir", "blc",\r
+        "jar"\r
+    },\r
+        new String[]\r
+        {\r
+        "Fasta", "Clustal", "PFAM", "MSF", "PIR", "BLC", "Jalview"\r
+    }, jalview.bin.Cache.getProperty("DEFAULT_FILE_FORMAT"));\r
+    chooser.setFileView(new JalviewFileView());\r
+    chooser.setDialogTitle("Select startup file");\r
+\r
+    int value = chooser.showOpenDialog(this);\r
+\r
+    if (value == JalviewFileChooser.APPROVE_OPTION)\r
+    {\r
+      jalview.bin.Cache.setProperty("DEFAULT_FILE_FORMAT",\r
+                                    chooser.getSelectedFormat());\r
+      startupFileTextfield.setText(chooser.getSelectedFile()\r
+                                   .getAbsolutePath());\r
+    }\r
   }\r
 \r
-\r
   public void cancel_actionPerformed(ActionEvent e)\r
   {\r
-    try{\r
+    try\r
+    {\r
       frame.setClosed(true);\r
-    }catch(Exception ex){}\r
+    }\r
+    catch (Exception ex)\r
+    {\r
+    }\r
   }\r
 \r
   public void annotations_actionPerformed(ActionEvent e)\r
@@ -240,5 +314,4 @@ public class Preferences extends GPreferences
     quality.setEnabled(annotations.isSelected());\r
     identity.setEnabled(annotations.isSelected());\r
   }\r
-\r
 }\r
index e4ef46e..44aa447 100755 (executable)
@@ -1,30 +1,31 @@
 /*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 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
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
+ */\r
 package jalview.gui;\r
 \r
-import jalview.jbgui.*;\r
-import jalview.datamodel.*;\r
-import java.awt.event.*;\r
 import java.util.*;\r
+\r
+import java.awt.event.*;\r
 import javax.swing.event.*;\r
 \r
+import jalview.datamodel.*;\r
+import jalview.jbgui.*;\r
+\r
 public class RedundancyPanel\r
     extends GSliderPanel\r
 {\r
@@ -49,7 +50,6 @@ public class RedundancyPanel
     slider.setMinimum(0);\r
     slider.setMaximum(100);\r
     slider.setValue(100);\r
-\r
   }\r
 \r
   public void applyButton_actionPerformed(ActionEvent e)\r
@@ -57,19 +57,24 @@ public class RedundancyPanel
     float threshold = slider.getValue();\r
     Vector del;\r
     HistoryItem it;\r
-    historyList.push(it=new HistoryItem("Remove redundancy",\r
-                                      ap.av.alignment, HistoryItem.HIDE));\r
-    if (historyList.size()==1\r
-        || !af.historyList.contains(historyList.firstElement())) {\r
-      af.addHistoryItem((HistoryItem) historyList.firstElement());\r
+    historyList.push(it = new HistoryItem("Remove redundancy",\r
+                                          ap.av.alignment, HistoryItem.HIDE));\r
+\r
+    if ( (historyList.size() == 1) ||\r
+        !af.historyList.contains(historyList.firstElement()))\r
+    {\r
+      af.addHistoryItem( (HistoryItem) historyList.firstElement());\r
       af.updateEditMenuBar();\r
     }\r
+\r
     undoButton.setEnabled(true);\r
+\r
     SequenceGroup sg = ap.av.getSelectionGroup();\r
-    if (sg != null && sg.getSize() >= 1)\r
-    {\r
 \r
+    if ( (sg != null) && (sg.getSize() >= 1))\r
+    {\r
       del = ap.av.alignment.removeRedundancy(threshold, sg.sequences);\r
+\r
       for (int i = 0; i < del.size(); i++)\r
       {\r
         if (sg.sequences.contains( (SequenceI) del.elementAt(i)))\r
@@ -77,32 +82,36 @@ public class RedundancyPanel
           sg.deleteSequence( (SequenceI) del.elementAt(i));\r
         }\r
       }\r
-\r
     }\r
     else\r
     {\r
       Vector s = new Vector();\r
       int i = 0;\r
+\r
       while (i < ap.av.alignment.getHeight())\r
       {\r
         s.addElement(ap.av.alignment.getSequenceAt(i));\r
         i++;\r
       }\r
+\r
       del = ap.av.alignment.removeRedundancy(threshold, s);\r
     }\r
 \r
     // This has to be done before the restoreHistoryItem method of alignFrame will\r
     // actually restore these sequences.\r
-\r
-    if (del.size()>0)\r
-      for (int i=0,j=del.size(); i<j; i++) {\r
+    if (del.size() > 0)\r
+    {\r
+      for (int i = 0, j = del.size(); i < j; i++)\r
+      {\r
         SequenceI sq = (SequenceI) del.elementAt(i);\r
-        sq.deleteChars(0,sq.getLength());\r
+        sq.deleteChars(0, sq.getLength());\r
       }\r
+    }\r
 \r
     ap.av.firePropertyChange("alignment", null,\r
                              ap.av.getAlignment().getSequences());\r
     ap.av.resetSeqLimits(ap.seqPanel.seqCanvas.getHeight());\r
+\r
     if (ap.av.getAlignment().getHeight() < 1)\r
     {\r
       try\r
@@ -110,22 +119,25 @@ public class RedundancyPanel
         af.setClosed(true);\r
       }\r
       catch (Exception ex)\r
-      {}\r
+      {\r
+      }\r
     }\r
+\r
     ap.av.updateConservation();\r
     ap.av.updateConsensus();\r
     af.updateEditMenuBar();\r
     ap.repaint();\r
-\r
   }\r
 \r
   public void undoButton_actionPerformed(ActionEvent e)\r
   {\r
     HistoryItem hi = (HistoryItem) historyList.pop();\r
     af.restoreHistoryItem(hi);\r
+\r
     if (historyList.size() == 0)\r
     {\r
       undoButton.setEnabled(false);\r
+\r
       if (af.historyList.contains(hi))\r
       {\r
         af.historyList.remove(hi);\r
@@ -133,6 +145,7 @@ public class RedundancyPanel
       }\r
     }\r
   }\r
+\r
   public void valueField_actionPerformed(ActionEvent e)\r
   {\r
     try\r
index 0d5025e..0fc83c3 100755 (executable)
 /*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 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
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
+ */\r
 package jalview.gui;\r
 \r
-import jalview.math.*;\r
-import jalview.datamodel.*;\r
-import jalview.util.*;\r
+import java.util.*;\r
 \r
 import java.awt.*;\r
 import java.awt.event.*;\r
 import javax.swing.*;\r
-import java.util.*;\r
 \r
+import jalview.datamodel.*;\r
+import jalview.math.*;\r
+import jalview.util.*;\r
 \r
-public class RotatableCanvas extends JPanel implements MouseListener,\r
-                                                       MouseMotionListener,\r
-                                                       KeyListener\r
-                                                       //RubberbandListener,\r
-                                                       //SequenceSelectionListener\r
+public class RotatableCanvas\r
+    extends JPanel implements MouseListener,\r
+    MouseMotionListener, KeyListener\r
+//RubberbandListener,\r
+//SequenceSelectionListener\r
 {\r
-  RotatableMatrix idmat  = new RotatableMatrix(3,3);\r
-  RotatableMatrix objmat = new RotatableMatrix(3,3);\r
-  RotatableMatrix rotmat = new RotatableMatrix(3,3);\r
+  RotatableMatrix idmat = new RotatableMatrix(3, 3);\r
+  RotatableMatrix objmat = new RotatableMatrix(3, 3);\r
+  RotatableMatrix rotmat = new RotatableMatrix(3, 3);\r
 \r
   //RubberbandRectangle rubberband;\r
-\r
   boolean drawAxes = true;\r
-\r
   int omx = 0;\r
   int mx = 0;\r
   int omy = 0;\r
   int my = 0;\r
-\r
   Image img;\r
   Graphics ig;\r
-\r
   Dimension prefsize;\r
-\r
-  float centre[] = new float[3];\r
-  float width[] = new float[3];\r
-\r
-  float max[] = new float[3];\r
-  float min[] = new float[3];\r
-\r
+  float[] centre = new float[3];\r
+  float[] width = new float[3];\r
+  float[] max = new float[3];\r
+  float[] min = new float[3];\r
   float maxwidth;\r
   float scale;\r
-\r
   int npoint;\r
-\r
   Vector points;\r
   float[][] orig;\r
   float[][] axes;\r
-\r
   int startx;\r
   int starty;\r
-\r
   int lastx;\r
   int lasty;\r
-\r
   int rectx1;\r
   int recty1;\r
   int rectx2;\r
   int recty2;\r
-\r
   float scalefactor = 1;\r
-\r
   AlignViewport av;\r
-//  Controller    controller;\r
-\r
 \r
-  public RotatableCanvas(AlignViewport av,\r
-                          Vector points, int npoint) {\r
+  //  Controller    controller;\r
+  public RotatableCanvas(AlignViewport av, Vector points, int npoint)\r
+  {\r
     this.points = points;\r
     this.npoint = npoint;\r
     this.av = av;\r
     ToolTipManager.sharedInstance().registerComponent(this);\r
     PaintRefresher.Register(this);\r
-//\r
+\r
+    //\r
     prefsize = getPreferredSize();\r
     orig = new float[npoint][3];\r
 \r
-    for (int i=0; i < npoint; i++) {\r
-      SequencePoint sp = (SequencePoint)points.elementAt(i);\r
-      for (int j=0; j < 3; j++) {\r
+    for (int i = 0; i < npoint; i++)\r
+    {\r
+      SequencePoint sp = (SequencePoint) points.elementAt(i);\r
+\r
+      for (int j = 0; j < 3; j++)\r
+      {\r
         orig[i][j] = sp.coord[j];\r
       }\r
     }\r
-    //Initialize the matrices to identity\r
 \r
-    for (int i = 0; i < 3; i++) {\r
-      for (int j = 0; j < 3 ; j++) {\r
-        if (i != j) {\r
-          idmat.addElement(i,j,0);\r
-          objmat.addElement(i,j,0);\r
-          rotmat.addElement(i,j,0);\r
-        } else {\r
-          idmat.addElement(i,j,0);\r
-          objmat.addElement(i,j,0);\r
-          rotmat.addElement(i,j,0);\r
+    //Initialize the matrices to identity\r
+    for (int i = 0; i < 3; i++)\r
+    {\r
+      for (int j = 0; j < 3; j++)\r
+      {\r
+        if (i != j)\r
+        {\r
+          idmat.addElement(i, j, 0);\r
+          objmat.addElement(i, j, 0);\r
+          rotmat.addElement(i, j, 0);\r
+        }\r
+        else\r
+        {\r
+          idmat.addElement(i, j, 0);\r
+          objmat.addElement(i, j, 0);\r
+          rotmat.addElement(i, j, 0);\r
         }\r
       }\r
     }\r
@@ -127,62 +120,74 @@ public class RotatableCanvas extends JPanel implements MouseListener,
     scale = findScale();\r
 \r
     //    System.out.println("Scale factor = " + scale);\r
-\r
     addMouseListener(this);\r
     addKeyListener(this);\r
-   // if (getParent() != null) {\r
-   //   getParent().addKeyListener(this);\r
+\r
+    // if (getParent() != null) {\r
+    //   getParent().addKeyListener(this);\r
     //}\r
     addMouseMotionListener(this);\r
 \r
     // Add rubberband\r
- //   rubberband  = new RubberbandRectangle(this);\r
-  //  rubberband.setActive(true);\r
- //   rubberband.addListener(this);\r
-  }\r
-\r
- /* public boolean handleSequenceSelectionEvent(SequenceSelectionEvent evt) {\r
-    redrawneeded = true;\r
-    repaint();\r
-    return true;\r
+    //   rubberband  = new RubberbandRectangle(this);\r
+    //  rubberband.setActive(true);\r
+    //   rubberband.addListener(this);\r
   }\r
 \r
-  public void removeNotify() {\r
-    controller.removeListener(this);\r
-    super.removeNotify();\r
-  }*/\r
-\r
-  public void initAxes() {\r
-    for (int i = 0; i < 3; i++) {\r
-      for (int j=0; j < 3; j++) {\r
-        if (i != j) {\r
+  /* public boolean handleSequenceSelectionEvent(SequenceSelectionEvent evt) {\r
+     redrawneeded = true;\r
+     repaint();\r
+     return true;\r
+   }\r
+\r
+   public void removeNotify() {\r
+     controller.removeListener(this);\r
+     super.removeNotify();\r
+   }*/\r
+  public void initAxes()\r
+  {\r
+    for (int i = 0; i < 3; i++)\r
+    {\r
+      for (int j = 0; j < 3; j++)\r
+      {\r
+        if (i != j)\r
+        {\r
           axes[i][j] = 0;\r
-        } else {\r
+        }\r
+        else\r
+        {\r
           axes[i][j] = 1;\r
         }\r
       }\r
     }\r
   }\r
 \r
-  public void findWidth() {\r
+  public void findWidth()\r
+  {\r
     max = new float[3];\r
     min = new float[3];\r
 \r
-    max[0] = (float)-1e30;\r
-    max[1] = (float)-1e30;\r
-    max[2] = (float)-1e30;\r
+    max[0] = (float) - 1e30;\r
+    max[1] = (float) - 1e30;\r
+    max[2] = (float) - 1e30;\r
+\r
+    min[0] = (float) 1e30;\r
+    min[1] = (float) 1e30;\r
+    min[2] = (float) 1e30;\r
 \r
-    min[0] = (float)1e30;\r
-    min[1] = (float)1e30;\r
-    min[2] = (float)1e30;\r
+    for (int i = 0; i < 3; i++)\r
+    {\r
+      for (int j = 0; j < npoint; j++)\r
+      {\r
+        SequencePoint sp = (SequencePoint) points.elementAt(j);\r
 \r
-    for (int i = 0; i < 3; i++) {\r
-      for (int j = 0; j < npoint; j++) {\r
-        SequencePoint sp = (SequencePoint)points.elementAt(j);\r
-        if (sp.coord[i] >= max[i]) {\r
+        if (sp.coord[i] >= max[i])\r
+        {\r
           max[i] = sp.coord[i];\r
         }\r
-        if (sp.coord[i] <= min[i]) {\r
+\r
+        if (sp.coord[i] <= min[i])\r
+        {\r
           min[i] = sp.coord[i];\r
         }\r
       }\r
@@ -191,7 +196,6 @@ public class RotatableCanvas extends JPanel implements MouseListener,
     //    System.out.println("xmax " + max[0] + " min " + min[0]);\r
     //System.out.println("ymax " + max[1] + " min " + min[1]);\r
     //System.out.println("zmax " + max[2] + " min " + min[2]);\r
-\r
     width[0] = Math.abs(max[0] - min[0]);\r
     width[1] = Math.abs(max[1] - min[1]);\r
     width[2] = Math.abs(max[2] - min[2]);\r
@@ -199,186 +203,253 @@ public class RotatableCanvas extends JPanel implements MouseListener,
     maxwidth = width[0];\r
 \r
     if (width[1] > width[0])\r
+    {\r
       maxwidth = width[1];\r
+    }\r
+\r
     if (width[2] > width[1])\r
+    {\r
       maxwidth = width[2];\r
+    }\r
 \r
     //System.out.println("Maxwidth = " + maxwidth);\r
   }\r
 \r
-  public float findScale() {\r
-    int dim, width, height;\r
-    if (getWidth() != 0) {\r
+  public float findScale()\r
+  {\r
+    int dim;\r
+    int width;\r
+    int height;\r
+\r
+    if (getWidth() != 0)\r
+    {\r
       width = getWidth();\r
       height = getHeight();\r
-    } else {\r
+    }\r
+    else\r
+    {\r
       width = prefsize.width;\r
       height = prefsize.height;\r
     }\r
 \r
-    if (width < height) {\r
+    if (width < height)\r
+    {\r
       dim = width;\r
-    } else {\r
+    }\r
+    else\r
+    {\r
       dim = height;\r
     }\r
 \r
-    return (float)(dim*scalefactor/(2*maxwidth));\r
+    return (float) ( (dim * scalefactor) / (2 * maxwidth));\r
   }\r
 \r
-  public void findCentre() {\r
+  public void findCentre()\r
+  {\r
     //Find centre coordinate\r
     findWidth();\r
 \r
-    centre[0] = (max[0] + min[0])/2;\r
-    centre[1] = (max[1] + min[1])/2;\r
-    centre[2] = (max[2] + min[2])/2;\r
+    centre[0] = (max[0] + min[0]) / 2;\r
+    centre[1] = (max[1] + min[1]) / 2;\r
+    centre[2] = (max[2] + min[2]) / 2;\r
 \r
     //    System.out.println("Centre x " + centre[0]);\r
     //System.out.println("Centre y " + centre[1]);\r
     //System.out.println("Centre z " + centre[2]);\r
   }\r
 \r
-  public Dimension getPreferredSize() {\r
-    if (prefsize != null) {\r
+  public Dimension getPreferredSize()\r
+  {\r
+    if (prefsize != null)\r
+    {\r
       return prefsize;\r
-    } else {\r
-      return new Dimension(400,400);\r
+    }\r
+    else\r
+    {\r
+      return new Dimension(400, 400);\r
     }\r
   }\r
 \r
-  public Dimension getMinimumSize() {\r
+  public Dimension getMinimumSize()\r
+  {\r
     return getPreferredSize();\r
   }\r
 \r
-  public void paintComponent(Graphics g) {\r
+  public void paintComponent(Graphics g)\r
+  {\r
     //Only create the image at the beginning -\r
-    if ((img == null) || (prefsize.width != getWidth()) || (prefsize.height != getHeight())) {\r
+    if ( (img == null) || (prefsize.width != getWidth()) ||\r
+        (prefsize.height != getHeight()))\r
+    {\r
       prefsize.width = getWidth();\r
       prefsize.height = getHeight();\r
 \r
       scale = findScale();\r
 \r
       //      System.out.println("New scale = " + scale);\r
-      img = createImage(getWidth(),getHeight());\r
+      img = createImage(getWidth(), getHeight());\r
       ig = img.getGraphics();\r
-\r
     }\r
 \r
+    drawBackground(ig, Color.black);\r
+    drawScene(ig);\r
 \r
-      drawBackground(ig,Color.black);\r
-      drawScene(ig);\r
-      if (drawAxes == true)\r
-      {\r
-        drawAxes(ig);\r
-      }\r
-\r
+    if (drawAxes == true)\r
+    {\r
+      drawAxes(ig);\r
+    }\r
 \r
-    g.drawImage(img,0,0,this);\r
+    g.drawImage(img, 0, 0, this);\r
   }\r
 \r
-  public void drawAxes(Graphics g) {\r
-\r
+  public void drawAxes(Graphics g)\r
+  {\r
     g.setColor(Color.yellow);\r
-    for (int i=0; i < 3 ; i++) {\r
-      g.drawLine(getWidth()/2,getHeight()/2,\r
-                 (int)(axes[i][0]*scale*max[0] + getWidth()/2),\r
-                 (int)(axes[i][1]*scale*max[1] + getHeight()/2));\r
+\r
+    for (int i = 0; i < 3; i++)\r
+    {\r
+      g.drawLine(getWidth() / 2, getHeight() / 2,\r
+                 (int) ( (axes[i][0] * scale * max[0]) + (getWidth() / 2)),\r
+                 (int) ( (axes[i][1] * scale * max[1]) + (getHeight() / 2)));\r
     }\r
   }\r
 \r
-  public void drawBackground(Graphics g, Color col) {\r
+  public void drawBackground(Graphics g, Color col)\r
+  {\r
     g.setColor(col);\r
-    g.fillRect(0,0,prefsize.width,prefsize.height);\r
+    g.fillRect(0, 0, prefsize.width, prefsize.height);\r
   }\r
 \r
-\r
-  public void drawScene(Graphics g) {\r
+  public void drawScene(Graphics g)\r
+  {\r
     boolean darker = false;\r
 \r
-    int halfwidth = getWidth()/2;\r
-    int halfheight = getHeight()/2;\r
+    int halfwidth = getWidth() / 2;\r
+    int halfheight = getHeight() / 2;\r
 \r
-    for (int i = 0; i < npoint; i++) {\r
-      SequencePoint sp = (SequencePoint)points.elementAt(i);\r
-      int x = (int)((float)(sp.coord[0] - centre[0])*scale) + halfwidth;\r
-      int y = (int)((float)(sp.coord[1] - centre[1])*scale) + halfheight;\r
+    for (int i = 0; i < npoint; i++)\r
+    {\r
+      SequencePoint sp = (SequencePoint) points.elementAt(i);\r
+      int x = (int) ( (float) (sp.coord[0] - centre[0]) * scale) +\r
+          halfwidth;\r
+      int y = (int) ( (float) (sp.coord[1] - centre[1]) * scale) +\r
+          halfheight;\r
       float z = sp.coord[1] - centre[2];\r
 \r
-\r
-\r
-\r
       if (sp.sequence.getColor() == Color.black)\r
-          g.setColor(Color.white);\r
+      {\r
+        g.setColor(Color.white);\r
+      }\r
       else\r
-          g.setColor(sp.sequence.getColor());\r
-\r
+      {\r
+        g.setColor(sp.sequence.getColor());\r
+      }\r
 \r
       if (av.getSelectionGroup() != null)\r
       {\r
-        if (av.getSelectionGroup().sequences.contains(((SequencePoint)points.elementAt(i)).sequence))\r
+        if (av.getSelectionGroup().sequences.contains(\r
+            ( (SequencePoint) points.elementAt(i)).sequence))\r
+        {\r
           g.setColor(Color.gray);\r
+        }\r
       }\r
+\r
       if (z < 0)\r
+      {\r
         g.setColor(g.getColor().darker());\r
+      }\r
 \r
-\r
-      g.fillRect(x-3,y-3,6,6);\r
+      g.fillRect(x - 3, y - 3, 6, 6);\r
       g.setColor(Color.red);\r
     }\r
-//    //Now the rectangle\r
-//    if (rectx2 != -1 && recty2 != -1) {\r
-//      g.setColor(Color.white);\r
-//\r
-//      g.drawRect(rectx1,recty1,rectx2-rectx1,recty2-recty1);\r
-//    }\r
+\r
+    //    //Now the rectangle\r
+    //    if (rectx2 != -1 && recty2 != -1) {\r
+    //      g.setColor(Color.white);\r
+    //\r
+    //      g.drawRect(rectx1,recty1,rectx2-rectx1,recty2-recty1);\r
+    //    }\r
   }\r
 \r
-  public Dimension minimumsize() {\r
+  public Dimension minimumsize()\r
+  {\r
     return prefsize;\r
   }\r
 \r
-  public Dimension preferredsize() {\r
+  public Dimension preferredsize()\r
+  {\r
     return prefsize;\r
   }\r
 \r
-  public void keyTyped(KeyEvent evt) { }\r
-  public void keyReleased(KeyEvent evt) { }\r
+  public void keyTyped(KeyEvent evt)\r
+  {\r
+  }\r
 \r
-  public void keyPressed(KeyEvent evt) {\r
+  public void keyReleased(KeyEvent evt)\r
+  {\r
+  }\r
+\r
+  public void keyPressed(KeyEvent evt)\r
+  {\r
     requestFocus();\r
-    if (evt.getKeyCode() == KeyEvent.VK_UP) {\r
-      scalefactor = (float)(scalefactor * 1.1);\r
+\r
+    if (evt.getKeyCode() == KeyEvent.VK_UP)\r
+    {\r
+      scalefactor = (float) (scalefactor * 1.1);\r
       scale = findScale();\r
-    } else if (evt.getKeyCode() == KeyEvent.VK_DOWN) {\r
-      scalefactor = (float)(scalefactor * 0.9);\r
+    }\r
+    else if (evt.getKeyCode() == KeyEvent.VK_DOWN)\r
+    {\r
+      scalefactor = (float) (scalefactor * 0.9);\r
       scale = findScale();\r
-    } else if (evt.getKeyChar() == 's') {\r
+    }\r
+    else if (evt.getKeyChar() == 's')\r
+    {\r
       System.err.println("DEBUG: Rectangle selection"); // log.debug\r
-      if (rectx2 != -1 && recty2 != -1) {\r
-        rectSelect(rectx1,recty1,rectx2,recty2);\r
 \r
+      if ( (rectx2 != -1) && (recty2 != -1))\r
+      {\r
+        rectSelect(rectx1, recty1, rectx2, recty2);\r
       }\r
     }\r
+\r
     repaint();\r
   }\r
 \r
-  public void printPoints() {\r
-    for (int i=0; i < npoint; i++) {\r
-      SequencePoint sp = (SequencePoint)points.elementAt(i);\r
-      Format.print(System.out,"%5d ", i);\r
-      for (int j=0; j < 3;j++) {\r
-        Format.print(System.out,"%13.3f  ",sp.coord[j]);\r
+  public void printPoints()\r
+  {\r
+    for (int i = 0; i < npoint; i++)\r
+    {\r
+      SequencePoint sp = (SequencePoint) points.elementAt(i);\r
+      Format.print(System.out, "%5d ", i);\r
+\r
+      for (int j = 0; j < 3; j++)\r
+      {\r
+        Format.print(System.out, "%13.3f  ", sp.coord[j]);\r
       }\r
+\r
       System.out.println();\r
     }\r
   }\r
 \r
-  public void mouseClicked(MouseEvent evt) { }\r
-  public void mouseEntered(MouseEvent evt) { }\r
-  public void mouseExited(MouseEvent evt) { }\r
-  public void mouseReleased(MouseEvent evt) { }\r
+  public void mouseClicked(MouseEvent evt)\r
+  {\r
+  }\r
+\r
+  public void mouseEntered(MouseEvent evt)\r
+  {\r
+  }\r
+\r
+  public void mouseExited(MouseEvent evt)\r
+  {\r
+  }\r
 \r
-  public void mousePressed(MouseEvent evt) {\r
+  public void mouseReleased(MouseEvent evt)\r
+  {\r
+  }\r
+\r
+  public void mousePressed(MouseEvent evt)\r
+  {\r
     int x = evt.getX();\r
     int y = evt.getY();\r
 \r
@@ -397,7 +468,7 @@ public class RotatableCanvas extends JPanel implements MouseListener,
     rectx2 = -1;\r
     recty2 = -1;\r
 \r
-    SequenceI found = findPoint(x,y);\r
+    SequenceI found = findPoint(x, y);\r
 \r
     if (found != null)\r
     {\r
@@ -408,49 +479,59 @@ public class RotatableCanvas extends JPanel implements MouseListener,
       }\r
       else\r
       {\r
-          av.setSelectionGroup(new SequenceGroup());\r
-          av.getSelectionGroup().addOrRemove(found);\r
-          av.getSelectionGroup().setEndRes(av.alignment.getWidth());\r
-\r
+        av.setSelectionGroup(new SequenceGroup());\r
+        av.getSelectionGroup().addOrRemove(found);\r
+        av.getSelectionGroup().setEndRes(av.alignment.getWidth());\r
       }\r
     }\r
+\r
     repaint();\r
   }\r
 \r
- // private void fireSequenceSelectionEvent(Selection sel) {\r
- //   controller.handleSequenceSelectionEvent(new SequenceSelectionEvent(this,sel));\r
+  // private void fireSequenceSelectionEvent(Selection sel) {\r
+  //   controller.handleSequenceSelectionEvent(new SequenceSelectionEvent(this,sel));\r
   //}\r
-\r
   public void mouseMoved(MouseEvent evt)\r
   {\r
-   SequenceI found = findPoint(evt.getX(), evt.getY());\r
-   if (found != null)\r
-     this.setToolTipText(found.getName());\r
-   else\r
-     this.setToolTipText(null);\r
- }\r
-\r
-  public void mouseDragged(MouseEvent evt) {\r
+    SequenceI found = findPoint(evt.getX(), evt.getY());\r
+\r
+    if (found != null)\r
+    {\r
+      this.setToolTipText(found.getName());\r
+    }\r
+    else\r
+    {\r
+      this.setToolTipText(null);\r
+    }\r
+  }\r
+\r
+  public void mouseDragged(MouseEvent evt)\r
+  {\r
     mx = evt.getX();\r
     my = evt.getY();\r
+\r
     //Check if this is a rectangle drawing drag\r
-    if ((evt.getModifiers() & InputEvent.BUTTON2_MASK) != 0) {\r
-//      rectx2 = evt.getX();\r
-//      recty2 = evt.getY();\r
-    } else {\r
+    if ( (evt.getModifiers() & InputEvent.BUTTON2_MASK) != 0)\r
+    {\r
+      //      rectx2 = evt.getX();\r
+      //      recty2 = evt.getY();\r
+    }\r
+    else\r
+    {\r
       rotmat.setIdentity();\r
 \r
-      rotmat.rotate((float)(my-omy),'x');\r
-      rotmat.rotate((float)(mx-omx),'y');\r
+      rotmat.rotate( (float) (my - omy), 'x');\r
+      rotmat.rotate( (float) (mx - omx), 'y');\r
 \r
-      for (int i = 0; i < npoint; i++) {\r
-        SequencePoint sp = (SequencePoint)points.elementAt(i);\r
+      for (int i = 0; i < npoint; i++)\r
+      {\r
+        SequencePoint sp = (SequencePoint) points.elementAt(i);\r
         sp.coord[0] -= centre[0];\r
         sp.coord[1] -= centre[1];\r
         sp.coord[2] -= centre[2];\r
 \r
         //Now apply the rotation matrix\r
-        sp.coord= rotmat.vectorMultiply(sp.coord);\r
+        sp.coord = rotmat.vectorMultiply(sp.coord);\r
 \r
         //Now translate back again\r
         sp.coord[0] += centre[0];\r
@@ -458,26 +539,34 @@ public class RotatableCanvas extends JPanel implements MouseListener,
         sp.coord[2] += centre[2];\r
       }\r
 \r
-      for (int i=0; i < 3; i++) {\r
+      for (int i = 0; i < 3; i++)\r
+      {\r
         axes[i] = rotmat.vectorMultiply(axes[i]);\r
       }\r
+\r
       omx = mx;\r
       omy = my;\r
 \r
       paint(this.getGraphics());\r
     }\r
-\r
   }\r
 \r
-  public void rectSelect(int x1, int y1, int x2, int y2) {\r
+  public void rectSelect(int x1, int y1, int x2, int y2)\r
+  {\r
     boolean changedSel = false;\r
-    for (int i=0; i < npoint; i++) {\r
-      SequencePoint sp = (SequencePoint)points.elementAt(i);\r
-      int tmp1 = (int)((sp.coord[0] - centre[0])*scale + (float)getWidth()/2.0);\r
-      int tmp2 = (int)((sp.coord[1] - centre[1])*scale + (float)getHeight()/2.0);\r
 \r
-      if (tmp1 > x1 && tmp1 < x2 && tmp2 > y1 && tmp2 < y2) {\r
-        if (av != null) {\r
+    for (int i = 0; i < npoint; i++)\r
+    {\r
+      SequencePoint sp = (SequencePoint) points.elementAt(i);\r
+      int tmp1 = (int) ( ( (sp.coord[0] - centre[0]) * scale) +\r
+                        ( (float) getWidth() / 2.0));\r
+      int tmp2 = (int) ( ( (sp.coord[1] - centre[1]) * scale) +\r
+                        ( (float) getHeight() / 2.0));\r
+\r
+      if ( (tmp1 > x1) && (tmp1 < x2) && (tmp2 > y1) && (tmp2 < y2))\r
+      {\r
+        if (av != null)\r
+        {\r
           if (!av.getSelectionGroup().sequences.contains(sp.sequence))\r
           {\r
             changedSel = true;\r
@@ -486,54 +575,62 @@ public class RotatableCanvas extends JPanel implements MouseListener,
         }\r
       }\r
     }\r
-   // if (changedSel) {\r
-   //    fireSequenceSelectionEvent(av.getSelection());\r
-   // }\r
+\r
+    // if (changedSel) {\r
+    //    fireSequenceSelectionEvent(av.getSelection());\r
+    // }\r
   }\r
-  public SequenceI findPoint(int x, int y) {\r
 \r
-    int halfwidth = getWidth()/2;\r
-    int halfheight = getHeight()/2;\r
+  public SequenceI findPoint(int x, int y)\r
+  {\r
+    int halfwidth = getWidth() / 2;\r
+    int halfheight = getHeight() / 2;\r
 \r
     int found = -1;\r
 \r
-    for (int i=0; i < npoint; i++) {\r
-\r
-      SequencePoint sp = (SequencePoint)points.elementAt(i);\r
-      int px = (int)((float)(sp.coord[0] - centre[0])*scale) + halfwidth;\r
-      int py = (int)((float)(sp.coord[1] - centre[1])*scale) + halfheight;\r
-\r
+    for (int i = 0; i < npoint; i++)\r
+    {\r
+      SequencePoint sp = (SequencePoint) points.elementAt(i);\r
+      int px = (int) ( (float) (sp.coord[0] - centre[0]) * scale) +\r
+          halfwidth;\r
+      int py = (int) ( (float) (sp.coord[1] - centre[1]) * scale) +\r
+          halfheight;\r
 \r
-      if (Math.abs(px-x)<3 && Math.abs(py - y) < 3 ) {\r
+      if ( (Math.abs(px - x) < 3) && (Math.abs(py - y) < 3))\r
+      {\r
         found = i;\r
       }\r
     }\r
-    if (found != -1) {\r
-      return ((SequencePoint)points.elementAt(found)).sequence;\r
-    } else {\r
+\r
+    if (found != -1)\r
+    {\r
+      return ( (SequencePoint) points.elementAt(found)).sequence;\r
+    }\r
+    else\r
+    {\r
       return null;\r
     }\r
   }\r
-/*  public boolean handleRubberbandEvent(RubberbandEvent evt) {\r
-    System.out.println("Rubberband handler called in RotatableCanvas with " +\r
-                       evt.getBounds());\r
 \r
-    Rubberband rb = (Rubberband)evt.getSource();\r
+  /*  public boolean handleRubberbandEvent(RubberbandEvent evt) {\r
+      System.out.println("Rubberband handler called in RotatableCanvas with " +\r
+                         evt.getBounds());\r
 \r
-    // Clear the current selection (instance variable)\r
-    //if ((rb.getModifiers() & Event.SHIFT_MASK) == 0) {\r
-    //   clearSelection();\r
-    //}\r
+      Rubberband rb = (Rubberband)evt.getSource();\r
 \r
-    if (rb.getComponent() == this) {\r
-      Rectangle bounds = evt.getBounds();\r
-      rectSelect(bounds.x,bounds.y,bounds.x+bounds.width,bounds.y+bounds.height);\r
-    }\r
+      // Clear the current selection (instance variable)\r
+      //if ((rb.getModifiers() & Event.SHIFT_MASK) == 0) {\r
+      //   clearSelection();\r
+      //}\r
 \r
-    redrawneeded = true;\r
-    paint(this.getGraphics());\r
+      if (rb.getComponent() == this) {\r
+        Rectangle bounds = evt.getBounds();\r
+   rectSelect(bounds.x,bounds.y,bounds.x+bounds.width,bounds.y+bounds.height);\r
+      }\r
 \r
-    return true;\r
-  }*/\r
+      redrawneeded = true;\r
+      paint(this.getGraphics());\r
 \r
+      return true;\r
+    }*/\r
 }\r
index de0a7b1..250998f 100755 (executable)
@@ -1,43 +1,41 @@
 /*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 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
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
+ */\r
 package jalview.gui;\r
 \r
-import jalview.datamodel.*;\r
 import java.awt.*;\r
 import java.awt.event.*;\r
 import javax.swing.*;\r
 \r
-public class ScalePanel extends JPanel\r
-{\r
+import jalview.datamodel.*;\r
 \r
+public class ScalePanel\r
+    extends JPanel\r
+{\r
   protected int offy = 4;\r
-  public    int width;\r
-\r
+  public int width;\r
   protected AlignViewport av;\r
   AlignmentPanel ap;\r
-\r
   boolean stretchingGroup = false;\r
 \r
   public ScalePanel(AlignViewport av, AlignmentPanel ap)\r
   {\r
-    this.av         = av;\r
+    this.av = av;\r
     this.ap = ap;\r
 \r
     addMouseListener(new MouseAdapter()\r
@@ -46,11 +44,11 @@ public class ScalePanel extends JPanel
       {\r
         doMousePressed(evt);\r
       }\r
+\r
       public void mouseReleased(MouseEvent evt)\r
       {\r
         doMouseReleased(evt);\r
       }\r
-\r
     });\r
     addMouseMotionListener(new MouseMotionAdapter()\r
     {\r
@@ -59,71 +57,90 @@ public class ScalePanel extends JPanel
         doMouseDragged(evt);\r
       }\r
     });\r
-\r
   }\r
 \r
-\r
-  public void doMousePressed(MouseEvent evt) {\r
+  public void doMousePressed(MouseEvent evt)\r
+  {\r
     int x = evt.getX();\r
-    int res = x/av.getCharWidth() + av.getStartRes();\r
+    int res = (x / av.getCharWidth()) + av.getStartRes();\r
     SequenceGroup sg = null;\r
 \r
     if (av.getColumnSelection().contains(res))\r
+    {\r
       av.getColumnSelection().removeElement(res);\r
+    }\r
     else\r
     {\r
       av.getColumnSelection().addElement(res);\r
 \r
       sg = new SequenceGroup();\r
+\r
       for (int i = 0; i < av.alignment.getSequences().size(); i++)\r
+      {\r
         sg.addSequence(av.alignment.getSequenceAt(i));\r
+      }\r
 \r
       sg.setStartRes(res);\r
       sg.setEndRes(res);\r
 \r
       ap.annotationPanel.addEditableColumn(res);\r
     }\r
+\r
     av.setSelectionGroup(sg);\r
     ap.repaint();\r
   }\r
 \r
   public void doMouseReleased(MouseEvent evt)\r
   {\r
-    if(!stretchingGroup)\r
+    if (!stretchingGroup)\r
+    {\r
       return;\r
+    }\r
 \r
     int x = evt.getX();\r
-    int res = x/av.getCharWidth() + av.getStartRes();\r
+    int res = (x / av.getCharWidth()) + av.getStartRes();\r
 \r
-   if (! av.getColumnSelection().contains(res))\r
-     av.getColumnSelection().addElement(res);\r
+    if (!av.getColumnSelection().contains(res))\r
+    {\r
+      av.getColumnSelection().addElement(res);\r
+    }\r
 \r
-   SequenceGroup sg = av.getSelectionGroup();\r
+    SequenceGroup sg = av.getSelectionGroup();\r
 \r
-   if(res>sg.getStartRes())\r
-     sg.setEndRes(res);\r
-   else if(res<sg.getStartRes())\r
-     sg.setStartRes(res);\r
+    if (res > sg.getStartRes())\r
+    {\r
+      sg.setEndRes(res);\r
+    }\r
+    else if (res < sg.getStartRes())\r
+    {\r
+      sg.setStartRes(res);\r
+    }\r
 \r
-   stretchingGroup = false;\r
-   ap.repaint();\r
+    stretchingGroup = false;\r
+    ap.repaint();\r
   }\r
 \r
   public void doMouseDragged(MouseEvent evt)\r
   {\r
     int x = evt.getX();\r
-    int res = x/av.getCharWidth() + av.getStartRes();\r
+    int res = (x / av.getCharWidth()) + av.getStartRes();\r
 \r
     SequenceGroup sg = av.getSelectionGroup();\r
-    if(sg!=null)\r
+\r
+    if (sg != null)\r
     {\r
       stretchingGroup = true;\r
+\r
       if (res > sg.getStartRes())\r
+      {\r
         sg.setEndRes(res);\r
+      }\r
       else if (res < sg.getStartRes())\r
+      {\r
         sg.setStartRes(res);\r
+      }\r
 \r
-       ap.annotationPanel.addEditableColumn(res);\r
+      ap.annotationPanel.addEditableColumn(res);\r
       ap.repaint();\r
     }\r
   }\r
@@ -133,59 +150,66 @@ public class ScalePanel extends JPanel
     drawScale(g, av.getStartRes(), av.getEndRes(), getWidth(), getHeight());\r
   }\r
 \r
-// scalewidth will normally be screenwidth,\r
-  public void drawScale(Graphics g, int startx, int endx, int width, int height)\r
+  // scalewidth will normally be screenwidth,\r
+  public void drawScale(Graphics g, int startx, int endx, int width,\r
+                        int height)\r
   {\r
-    Graphics2D gg = (Graphics2D)g;\r
+    Graphics2D gg = (Graphics2D) g;\r
     gg.setFont(av.getFont());\r
-    gg.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);\r
+    gg.setRenderingHint(RenderingHints.KEY_ANTIALIASING,\r
+                        RenderingHints.VALUE_ANTIALIAS_ON);\r
 \r
     //Fill in the background\r
     gg.setColor(Color.white);\r
-    gg.fillRect(0,0,width, height);\r
+    gg.fillRect(0, 0, width, height);\r
     gg.setColor(Color.black);\r
 \r
-\r
     //Fill the selected columns\r
     ColumnSelection cs = av.getColumnSelection();\r
-    gg.setColor(new Color(220,0,0));\r
-    for (int i=0; i<cs.size(); i++)\r
+    gg.setColor(new Color(220, 0, 0));\r
+\r
+    for (int i = 0; i < cs.size(); i++)\r
     {\r
-      int sel  = cs.columnAt(i);\r
-      if ( sel >= startx  && sel <= endx)\r
-        gg.fillRect((sel-startx)*av.charWidth,0,av.charWidth,getHeight());\r
-    }\r
+      int sel = cs.columnAt(i);\r
 \r
+      if ( (sel >= startx) && (sel <= endx))\r
+      {\r
+        gg.fillRect( (sel - startx) * av.charWidth, 0, av.charWidth,\r
+                    getHeight());\r
+      }\r
+    }\r
 \r
     // Draw the scale numbers\r
     gg.setColor(Color.black);\r
-    int scalestartx = (startx/10) * 10;\r
+\r
+    int scalestartx = (startx / 10) * 10;\r
 \r
     FontMetrics fm = gg.getFontMetrics(av.getFont());\r
-    int y = av.charHeight -fm.getDescent();\r
+    int y = av.charHeight - fm.getDescent();\r
 \r
-    if(scalestartx%10==0)\r
-      scalestartx+=5;\r
+    if ( (scalestartx % 10) == 0)\r
+    {\r
+      scalestartx += 5;\r
+    }\r
 \r
-    for (int i=scalestartx;i < endx; i+= 5)\r
+    for (int i = scalestartx; i < endx; i += 5)\r
     {\r
-      if(i%10==0)\r
+      if ( (i % 10) == 0)\r
       {\r
-        gg.drawString(String.valueOf(i), (i - startx - 1) * av.charWidth, y);\r
-        gg.drawLine( (int) ( (i - startx - 1) * av.charWidth + av.charWidth / 2),\r
-                    y+2,\r
-                    (int) ( (i - startx - 1) * av.charWidth + av.charWidth / 2),\r
-                    y+fm.getDescent()*2);\r
+        gg.drawString(String.valueOf(i),\r
+                      (i - startx - 1) * av.charWidth, y);\r
+        gg.drawLine( (int) ( ( (i - startx - 1) * av.charWidth) +\r
+                            (av.charWidth / 2)), y + 2,\r
+                    (int) ( ( (i - startx - 1) * av.charWidth) +\r
+                           (av.charWidth / 2)), y + (fm.getDescent() * 2));\r
       }\r
       else\r
-        gg.drawLine( (int) ( (i - startx - 1) * av.charWidth + av.charWidth / 2),\r
-                    y+fm.getDescent(),\r
-                    (int) ( (i - startx - 1) * av.charWidth + av.charWidth / 2),\r
-                   y+fm.getDescent()*2);\r
-\r
-\r
+      {\r
+        gg.drawLine( (int) ( ( (i - startx - 1) * av.charWidth) +\r
+                            (av.charWidth / 2)), y + fm.getDescent(),\r
+                    (int) ( ( (i - startx - 1) * av.charWidth) +\r
+                           (av.charWidth / 2)), y + (fm.getDescent() * 2));\r
+      }\r
     }\r
   }\r
-\r
-\r
 }\r
index d40f971..1194d08 100755 (executable)
@@ -1,64 +1,61 @@
 /*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 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
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
+ */\r
 package jalview.gui;\r
 \r
 import java.awt.*;\r
 import java.awt.image.*;\r
 import javax.swing.*;\r
-import jalview.datamodel.*;\r
-import jalview.analysis.*;\r
 \r
+import jalview.analysis.*;\r
+import jalview.datamodel.*;\r
 \r
-public class SeqCanvas extends JComponent\r
+public class SeqCanvas\r
+    extends JComponent\r
 {\r
-     FeatureRenderer fr;\r
-     SequenceRenderer sr;\r
-    BufferedImage             img;\r
-    Graphics2D          gg;\r
-    int               imgWidth;\r
-    int               imgHeight;\r
-\r
-    AlignViewport     av;\r
-\r
-    boolean showScores = false;\r
-    boolean displaySearch = false;\r
-    int [] searchResults = null;\r
-\r
-    int chunkHeight;\r
-    int chunkWidth;\r
-\r
-    boolean fastPaint = false;\r
-\r
-\r
-    public SeqCanvas(AlignViewport av)\r
-    {\r
-       this.av         = av;\r
-       fr = new FeatureRenderer(av);\r
-       sr = new SequenceRenderer(av);\r
-       setLayout(new BorderLayout());\r
-       PaintRefresher.Register(this);\r
-\r
-    }\r
+  FeatureRenderer fr;\r
+  SequenceRenderer sr;\r
+  BufferedImage img;\r
+  Graphics2D gg;\r
+  int imgWidth;\r
+  int imgHeight;\r
+  AlignViewport av;\r
+  boolean showScores = false;\r
+  boolean displaySearch = false;\r
+  int[] searchResults = null;\r
+  int chunkHeight;\r
+  int chunkWidth;\r
+  boolean fastPaint = false;\r
+  int LABEL_WEST;\r
+  int LABEL_EAST;\r
+\r
+  public SeqCanvas(AlignViewport av)\r
+  {\r
+    this.av = av;\r
+    fr = new FeatureRenderer(av);\r
+    sr = new SequenceRenderer(av);\r
+    setLayout(new BorderLayout());\r
+    PaintRefresher.Register(this);\r
+  }\r
 \r
-  void drawNorthScale(Graphics g, int startx, int endx,int ypos) {\r
-    int scalestartx = startx - startx % 10 + 10;\r
+  void drawNorthScale(Graphics g, int startx, int endx, int ypos)\r
+  {\r
+    int scalestartx = startx - (startx % 10) + 10;\r
 \r
     g.setColor(Color.black);\r
 \r
@@ -67,131 +64,154 @@ public class SeqCanvas extends JComponent
     {\r
       String string = String.valueOf(i);\r
       g.drawString(string, (i - startx - 1) * av.charWidth,\r
-                   ypos - av.charHeight / 2);\r
-\r
-      g.drawLine( (i - startx - 1) * av.charWidth + av.charWidth / 2,\r
-                 ypos + 2 - av.charHeight / 2,\r
-                 (i - startx - 1) * av.charWidth + av.charWidth / 2, ypos - 2);\r
+                   ypos - (av.charHeight / 2));\r
 \r
+      g.drawLine( ( (i - startx - 1) * av.charWidth) + (av.charWidth / 2),\r
+                 (ypos + 2) - (av.charHeight / 2),\r
+                 ( (i - startx - 1) * av.charWidth) + (av.charWidth / 2), ypos -\r
+                 2);\r
     }\r
   }\r
 \r
   void drawWestScale(Graphics g, int startx, int endx, int ypos)\r
   {\r
     FontMetrics fm = getFontMetrics(av.getFont());\r
-    ypos+= av.charHeight;\r
-      // EAST SCALE\r
+    ypos += av.charHeight;\r
+\r
+    // EAST SCALE\r
     for (int i = 0; i < av.alignment.getHeight(); i++)\r
     {\r
       SequenceI seq = av.alignment.getSequenceAt(i);\r
       int index = startx;\r
       int value = -1;\r
+\r
       while (index < endx)\r
       {\r
         if (jalview.util.Comparison.isGap(seq.getCharAt(index)))\r
         {\r
           index++;\r
+\r
           continue;\r
         }\r
 \r
         value = av.alignment.getSequenceAt(i).findPosition(index);\r
+\r
         break;\r
       }\r
-      if(value!=-1)\r
+\r
+      if (value != -1)\r
       {\r
-        int x = LABEL_WEST - fm.stringWidth(value+"");\r
-        g.drawString(value + "", x,  ypos +  i*av.charHeight - av.charHeight/5);\r
+        int x = LABEL_WEST - fm.stringWidth(value + "");\r
+        g.drawString(value + "", x,\r
+                     (ypos + (i * av.charHeight)) - (av.charHeight / 5));\r
       }\r
     }\r
   }\r
 \r
   void drawEastScale(Graphics g, int startx, int endx, int ypos)\r
-{\r
-    ypos+= av.charHeight;\r
-    // EAST SCALE\r
-  for (int i = 0; i < av.alignment.getHeight(); i++)\r
   {\r
-    SequenceI seq = av.alignment.getSequenceAt(i);\r
-    int index = endx;\r
-    int value = -1;\r
-    while (index > startx)\r
-    {\r
-      if (jalview.util.Comparison.isGap(seq.getCharAt(index)))\r
-      {\r
-        index--;\r
-        continue;\r
-      }\r
+    ypos += av.charHeight;\r
 \r
-      value = av.alignment.getSequenceAt(i).findPosition(index);\r
-      break;\r
-    }\r
-    if(value!=-1)\r
-       g.drawString(value + "", 0,  ypos +  i*av.charHeight - av.charHeight/5);\r
-  }\r
+    // EAST SCALE\r
+    for (int i = 0; i < av.alignment.getHeight(); i++)\r
+    {\r
+      SequenceI seq = av.alignment.getSequenceAt(i);\r
+      int index = endx;\r
+      int value = -1;\r
 \r
-}\r
+      while (index > startx)\r
+      {\r
+        if (jalview.util.Comparison.isGap(seq.getCharAt(index)))\r
+        {\r
+          index--;\r
 \r
+          continue;\r
+        }\r
 \r
+        value = av.alignment.getSequenceAt(i).findPosition(index);\r
 \r
+        break;\r
+      }\r
 \r
+      if (value != -1)\r
+      {\r
+        g.drawString(value + "", 0,\r
+                     (ypos + (i * av.charHeight)) - (av.charHeight / 5));\r
+      }\r
+    }\r
+  }\r
 \r
-public void fastPaint(int horizontal, int vertical)\r
-{\r
-    if (horizontal == 0 && vertical == 0 || gg==null)\r
+  public void fastPaint(int horizontal, int vertical)\r
+  {\r
+    if ( ( (horizontal == 0) && (vertical == 0)) || (gg == null))\r
+    {\r
       return;\r
+    }\r
 \r
     gg.copyArea(0, 0, imgWidth, imgHeight, -horizontal * av.charWidth,\r
                 -vertical * av.charHeight);\r
 \r
-    int sr = av.startRes, er = av.endRes, ss = av.startSeq, es = av.endSeq,\r
-        transX = 0, transY = 0;\r
+    int sr = av.startRes;\r
+    int er = av.endRes;\r
+    int ss = av.startSeq;\r
+    int es = av.endSeq;\r
+    int transX = 0;\r
+    int transY = 0;\r
+\r
     if (horizontal > 0) // scrollbar pulled right, image to the left\r
     {\r
       transX = (er - sr - horizontal) * av.charWidth;\r
       sr = er - horizontal;\r
     }\r
     else if (horizontal < 0)\r
+    {\r
       er = sr - horizontal;\r
-\r
+    }\r
     else if (vertical > 0) // scroll down\r
     {\r
       ss = es - vertical;\r
-      if(ss<av.startSeq) // ie scrolling too fast, more than a page at a time\r
+\r
+      if (ss < av.startSeq)\r
+      { // ie scrolling too fast, more than a page at a time\r
         ss = av.startSeq;\r
+      }\r
       else\r
-        transY = imgHeight - vertical * av.charHeight;\r
+      {\r
+        transY = imgHeight - (vertical * av.charHeight);\r
+      }\r
     }\r
     else if (vertical < 0)\r
     {\r
       es = ss - vertical;\r
-      if(es > av.endSeq)\r
+\r
+      if (es > av.endSeq)\r
+      {\r
         es = av.endSeq;\r
+      }\r
     }\r
 \r
-\r
     gg.translate(transX, transY);\r
 \r
     gg.setColor(Color.white);\r
-    gg.fillRect(0,0, (er-sr+1)*av.charWidth, (es-ss)*av.charHeight);\r
+    gg.fillRect(0, 0, (er - sr + 1) * av.charWidth,\r
+                (es - ss) * av.charHeight);\r
     drawPanel(gg, sr, er, ss, es, sr, ss, 0);\r
     gg.translate( -transX, -transY);\r
 \r
     fastPaint = true;\r
     repaint();\r
+  }\r
 \r
-}\r
-\r
-/**\r
- * Definitions of startx and endx (hopefully):\r
- * SMJS This is what I'm working towards!\r
- *   startx is the first residue (starting at 0) to display.\r
- *   endx   is the last residue to display (starting at 0).\r
- *   starty is the first sequence to display (starting at 0).\r
- *   endy   is the last sequence to display (starting at 0).\r
- * NOTE 1: The av limits are set in setFont in this class and\r
- * in the adjustment listener in SeqPanel when the scrollbars move.\r
- */\r
-\r
+  /**\r
+   * Definitions of startx and endx (hopefully):\r
+   * SMJS This is what I'm working towards!\r
+   *   startx is the first residue (starting at 0) to display.\r
+   *   endx   is the last residue to display (starting at 0).\r
+   *   starty is the first sequence to display (starting at 0).\r
+   *   endy   is the last sequence to display (starting at 0).\r
+   * NOTE 1: The av limits are set in setFont in this class and\r
+   * in the adjustment listener in SeqPanel when the scrollbars move.\r
+   */\r
   public void paintComponent(Graphics g)\r
   {\r
     g.setColor(Color.white);\r
@@ -201,44 +221,50 @@ public void fastPaint(int horizontal, int vertical)
     {\r
       g.drawImage(img, 0, 0, this);\r
       fastPaint = false;\r
+\r
       return;\r
     }\r
 \r
     // this draws the whole of the alignment\r
-      imgWidth  = getWidth();\r
-      imgHeight = getHeight();\r
+    imgWidth = getWidth();\r
+    imgHeight = getHeight();\r
 \r
-      imgWidth -= imgWidth%av.charWidth;\r
-      imgHeight-= imgHeight%av.charHeight;\r
+    imgWidth -= (imgWidth % av.charWidth);\r
+    imgHeight -= (imgHeight % av.charHeight);\r
 \r
-      if(imgWidth<1 || imgHeight<1)\r
-        return;\r
+    if ( (imgWidth < 1) || (imgHeight < 1))\r
+    {\r
+      return;\r
+    }\r
 \r
-      img = new BufferedImage(imgWidth,imgHeight,BufferedImage.TYPE_INT_RGB);\r
-      gg  = (Graphics2D)img.getGraphics();\r
-      gg.setFont(av.getFont());\r
-      gg.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);\r
+    img = new BufferedImage(imgWidth, imgHeight, BufferedImage.TYPE_INT_RGB);\r
+    gg = (Graphics2D) img.getGraphics();\r
+    gg.setFont(av.getFont());\r
+    gg.setRenderingHint(RenderingHints.KEY_ANTIALIASING,\r
+                        RenderingHints.VALUE_ANTIALIAS_ON);\r
 \r
-      gg.setColor(Color.white);\r
-      gg.fillRect(0,0,imgWidth,imgHeight);\r
+    gg.setColor(Color.white);\r
+    gg.fillRect(0, 0, imgWidth, imgHeight);\r
 \r
-    chunkWidth  =   getWrappedCanvasWidth( getWidth() );\r
-    chunkHeight =  (av.getAlignment().getHeight() + 2)*av.charHeight;\r
+    chunkWidth = getWrappedCanvasWidth(getWidth());\r
+    chunkHeight = (av.getAlignment().getHeight() + 2) * av.charHeight;\r
 \r
     av.setChunkHeight(chunkHeight);\r
     av.setChunkWidth(chunkWidth);\r
 \r
-\r
     if (av.getWrapAlignment())\r
+    {\r
       drawWrappedPanel(gg, getWidth(), getHeight(), av.startRes);\r
+    }\r
     else\r
-      drawPanel(gg, av.startRes, av.endRes, av.startSeq, av.endSeq, av.startRes, av.startSeq, 0);\r
+    {\r
+      drawPanel(gg, av.startRes, av.endRes, av.startSeq, av.endSeq,\r
+                av.startRes, av.startSeq, 0);\r
+    }\r
 \r
     g.drawImage(img, 0, 0, this);\r
-\r
   }\r
 \r
-  int LABEL_WEST, LABEL_EAST;\r
   public int getWrappedCanvasWidth(int cwidth)\r
   {\r
     FontMetrics fm = getFontMetrics(av.getFont());\r
@@ -246,161 +272,199 @@ public void fastPaint(int horizontal, int vertical)
     LABEL_EAST = 0;\r
     LABEL_WEST = 0;\r
 \r
-    if(av.scaleRightWrapped)\r
-      LABEL_EAST = fm.stringWidth( av.alignment.getWidth()+"000" );\r
+    if (av.scaleRightWrapped)\r
+    {\r
+      LABEL_EAST = fm.stringWidth(av.alignment.getWidth() + "000");\r
+    }\r
 \r
-    if(av.scaleLeftWrapped)\r
-      LABEL_WEST = fm.stringWidth( av.alignment.getWidth()+"" );\r
+    if (av.scaleLeftWrapped)\r
+    {\r
+      LABEL_WEST = fm.stringWidth(av.alignment.getWidth() + "");\r
+    }\r
 \r
-    return  (cwidth - LABEL_EAST -LABEL_WEST)/av.charWidth;\r
+    return (cwidth - LABEL_EAST - LABEL_WEST) / av.charWidth;\r
   }\r
 \r
-  public void drawWrappedPanel(Graphics g, int canvasWidth, int canvasHeight, int startRes)\r
+  public void drawWrappedPanel(Graphics g, int canvasWidth, int canvasHeight,\r
+                               int startRes)\r
   {\r
-      AlignmentI al = av.getAlignment();\r
+    AlignmentI al = av.getAlignment();\r
+\r
+    FontMetrics fm = getFontMetrics(av.getFont());\r
+\r
+    int LABEL_EAST = 0;\r
+\r
+    if (av.scaleRightWrapped)\r
+    {\r
+      LABEL_EAST = fm.stringWidth(al.getWidth() + "000");\r
+    }\r
 \r
-      FontMetrics fm = getFontMetrics(av.getFont());\r
+    int LABEL_WEST = 0;\r
 \r
-      int LABEL_EAST = 0;\r
-      if(av.scaleRightWrapped)\r
-        LABEL_EAST = fm.stringWidth( al.getWidth()+"000" );\r
-      int LABEL_WEST = 0;\r
-      if(av.scaleLeftWrapped)\r
-        LABEL_WEST = fm.stringWidth(al.getWidth()+"0");\r
+    if (av.scaleLeftWrapped)\r
+    {\r
+      LABEL_WEST = fm.stringWidth(al.getWidth() + "0");\r
+    }\r
 \r
+    int cWidth = (canvasWidth - LABEL_EAST - LABEL_WEST) / av.charWidth;\r
+    int cHeight = (av.getAlignment().getHeight() + 2) * av.charHeight;\r
 \r
-      int cWidth  =   (canvasWidth - LABEL_EAST -LABEL_WEST)/av.charWidth;\r
-      int cHeight =  (av.getAlignment().getHeight() + 2)*av.charHeight;\r
+    av.endRes = av.startRes + cWidth;\r
 \r
-      av.endRes = av.startRes + cWidth;\r
+    int endx = (startRes + cWidth) - 1;\r
+    int ypos = 2 * av.charHeight;\r
 \r
-      int  endx   = startRes+cWidth-1;\r
-      int  ypos  = 2*av.charHeight;\r
+    while ( (ypos <= canvasHeight) && (startRes < av.alignment.getWidth()))\r
+    {\r
+      g.setColor(Color.black);\r
 \r
-      while (ypos <= canvasHeight && startRes<av.alignment.getWidth() )\r
+      if (av.scaleLeftWrapped)\r
       {\r
-        g.setColor(Color.black);\r
+        drawWestScale(g, startRes, endx, ypos);\r
+      }\r
 \r
-        if(av.scaleLeftWrapped)\r
-          drawWestScale(g, startRes, endx, ypos);\r
+      if (av.scaleRightWrapped)\r
+      {\r
+        g.translate(canvasWidth - LABEL_EAST + av.charWidth, 0);\r
+        drawEastScale(g, startRes, endx, ypos);\r
+        g.translate( - (canvasWidth - LABEL_EAST + av.charWidth), 0);\r
+      }\r
 \r
-        if(av.scaleRightWrapped)\r
-        {\r
-          g.translate(canvasWidth - LABEL_EAST +av.charWidth, 0);\r
-          drawEastScale(g, startRes, endx, ypos);\r
-          g.translate( - (canvasWidth - LABEL_EAST+av.charWidth), 0);\r
-        }\r
+      g.translate(LABEL_WEST, 0);\r
 \r
-        g.translate(LABEL_WEST,0);\r
-        if(av.scaleAboveWrapped)\r
-          drawNorthScale(g, startRes, endx, ypos);\r
-\r
-\r
-        // When printing we have an extra clipped region,\r
-        // the Printable page which we need to account for here\r
-        Shape clip = g.getClip();\r
-        if(clip==null)\r
-          g.setClip(0, 0, cWidth*av.charWidth, canvasHeight);\r
-        else\r
-          g.setClip(0,\r
-                    (int)clip.getBounds().getY(),\r
-                    cWidth*av.charWidth,\r
-                    (int)clip.getBounds().getHeight()\r
-                    );\r
-\r
-        drawPanel(g, startRes, endx, 0, al.getHeight(), startRes, 0, ypos);\r
-        g.setClip(clip);\r
-        g.translate(-LABEL_WEST,0);\r
-\r
-        ypos += cHeight;\r
-        startRes += cWidth;\r
-        endx = startRes + cWidth - 1;\r
-\r
-        if (endx > al.getWidth())\r
-          endx = al.getWidth();\r
+      if (av.scaleAboveWrapped)\r
+      {\r
+        drawNorthScale(g, startRes, endx, ypos);\r
       }\r
 \r
-  }\r
+      // When printing we have an extra clipped region,\r
+      // the Printable page which we need to account for here\r
+      Shape clip = g.getClip();\r
+\r
+      if (clip == null)\r
+      {\r
+        g.setClip(0, 0, cWidth * av.charWidth, canvasHeight);\r
+      }\r
+      else\r
+      {\r
+        g.setClip(0, (int) clip.getBounds().getY(),\r
+                  cWidth * av.charWidth, (int) clip.getBounds().getHeight());\r
+      }\r
 \r
+      drawPanel(g, startRes, endx, 0, al.getHeight(), startRes, 0, ypos);\r
+      g.setClip(clip);\r
+      g.translate( -LABEL_WEST, 0);\r
 \r
-  synchronized public void drawPanel(Graphics g1,int x1,int x2, int y1, int y2,int startx, int starty,int offset) {\r
+      ypos += cHeight;\r
+      startRes += cWidth;\r
+      endx = (startRes + cWidth) - 1;\r
+\r
+      if (endx > al.getWidth())\r
+      {\r
+        endx = al.getWidth();\r
+      }\r
+    }\r
+  }\r
 \r
-    Graphics2D g = (Graphics2D)g1;\r
+  synchronized public void drawPanel(Graphics g1, int x1, int x2, int y1,\r
+                                     int y2, int startx, int starty, int offset)\r
+  {\r
+    Graphics2D g = (Graphics2D) g1;\r
     g.setFont(av.getFont());\r
     sr.renderGaps(av.renderGaps);\r
 \r
-\r
     SequenceI nextSeq;\r
 \r
     /// First draw the sequences\r
     /////////////////////////////\r
-    for (int i = y1 ; i < y2 ;i++)\r
+    for (int i = y1; i < y2; i++)\r
     {\r
-     nextSeq = av.alignment.getSequenceAt(i);\r
-\r
-     sr.drawSequence(g, nextSeq, av.alignment.findAllGroups( nextSeq ),x1,x2,\r
-                 (x1 - startx) * av.charWidth,\r
-                 offset + AlignmentUtil.getPixelHeight(starty, i, av.charHeight),\r
-                 av.charWidth,av.charHeight);\r
-\r
-     if(av.showSequenceFeatures)\r
-     {\r
-       fr.drawSequence(g, nextSeq, av.alignment.findAllGroups( nextSeq ), x1, x2,\r
-                       (x1 - startx) * av.charWidth,\r
-                       offset +\r
-                       AlignmentUtil.getPixelHeight(starty, i, av.charHeight),\r
-                       av.charWidth, av.charHeight);\r
-     }\r
+      nextSeq = av.alignment.getSequenceAt(i);\r
+\r
+      sr.drawSequence(g, nextSeq, av.alignment.findAllGroups(nextSeq),\r
+                      x1, x2, (x1 - startx) * av.charWidth,\r
+                      offset +\r
+                      AlignmentUtil.getPixelHeight(starty, i, av.charHeight),\r
+                      av.charWidth, av.charHeight);\r
+\r
+      if (av.showSequenceFeatures)\r
+      {\r
+        fr.drawSequence(g, nextSeq,\r
+                        av.alignment.findAllGroups(nextSeq), x1, x2,\r
+                        (x1 - startx) * av.charWidth,\r
+                        offset +\r
+                        AlignmentUtil.getPixelHeight(starty, i, av.charHeight),\r
+                        av.charWidth, av.charHeight);\r
+      }\r
     }\r
+\r
     //\r
     /////////////////////////////////////\r
-\r
     // Now outline any areas if necessary\r
     /////////////////////////////////////\r
     SequenceGroup group = av.getSelectionGroup();\r
     java.util.Vector groups = av.alignment.getGroups();\r
 \r
-    int sx = -1, sy = -1, ex = -1;\r
+    int sx = -1;\r
+    int sy = -1;\r
+    int ex = -1;\r
     int groupIndex = -1;\r
-    if (group == null && groups.size() > 0)\r
+\r
+    if ( (group == null) && (groups.size() > 0))\r
     {\r
       group = (SequenceGroup) groups.elementAt(0);\r
       groupIndex = 0;\r
     }\r
 \r
     if (group != null)\r
+    {\r
       do\r
       {\r
         int oldY = -1;\r
         int i = 0;\r
         boolean inGroup = false;\r
-        int top=-1, bottom =-1;\r
+        int top = -1;\r
+        int bottom = -1;\r
+\r
         for (i = y1; i < y2; i++)\r
         {\r
           sx = (group.getStartRes() - startx) * av.charWidth;\r
-          sy = offset + AlignmentUtil.getPixelHeight(starty, i, av.charHeight);\r
-          ex = (group.getEndRes() + 1 - group.getStartRes()) * av.charWidth -1;\r
-\r
-          if (sx < getWidth()\r
-              && ex > 0\r
-              && group.sequences.contains(av.alignment.getSequenceAt(i)))\r
+          sy = offset +\r
+              AlignmentUtil.getPixelHeight(starty, i, av.charHeight);\r
+          ex = ( ( (group.getEndRes() + 1) - group.getStartRes()) *\r
+                av.charWidth) -\r
+              1;\r
+\r
+          if ( (sx < getWidth()) && (ex > 0) &&\r
+              group.sequences.contains(av.alignment.getSequenceAt(\r
+                  i)))\r
           {\r
-            if (bottom == -1 &&\r
-                !group.sequences.contains(av.alignment.getSequenceAt(i + 1)))\r
-              bottom = sy + av.charHeight ;\r
+            if ( (bottom == -1) &&\r
+                !group.sequences.contains(\r
+                    av.alignment.getSequenceAt(i + 1)))\r
+            {\r
+              bottom = sy + av.charHeight;\r
+            }\r
 \r
             if (!inGroup)\r
             {\r
-              if (top == -1 && i==0 ||\r
-                  !group.sequences.contains(av.alignment.getSequenceAt(i - 1)))\r
+              if ( ( (top == -1) && (i == 0)) ||\r
+                  !group.sequences.contains(\r
+                      av.alignment.getSequenceAt(i - 1)))\r
+              {\r
                 top = sy;\r
-\r
+              }\r
 \r
               oldY = sy;\r
               inGroup = true;\r
+\r
               if (group == av.getSelectionGroup())\r
               {\r
-                g.setStroke(new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND, 3f, new float[]{5f,3f}, 0f ));\r
+                g.setStroke(new BasicStroke(1,\r
+                                            BasicStroke.CAP_BUTT,\r
+                                            BasicStroke.JOIN_ROUND, 3f,\r
+                                            new float[]\r
+                                            {5f, 3f}, 0f));\r
                 g.setColor(Color.RED);\r
               }\r
               else\r
@@ -414,21 +478,21 @@ public void fastPaint(int horizontal, int vertical)
           {\r
             if (inGroup)\r
             {\r
-              g.drawLine(sx, oldY, sx, sy );\r
-              g.drawLine(sx+ex, oldY, sx+ex, sy );\r
+              g.drawLine(sx, oldY, sx, sy);\r
+              g.drawLine(sx + ex, oldY, sx + ex, sy);\r
 \r
               if (top != -1)\r
               {\r
                 g.drawLine(sx, top, sx + ex, top);\r
-                top =-1;\r
+                top = -1;\r
               }\r
+\r
               if (bottom != -1)\r
               {\r
                 g.drawLine(sx, bottom, sx + ex, bottom);\r
                 bottom = -1;\r
               }\r
 \r
-\r
               inGroup = false;\r
             }\r
           }\r
@@ -436,83 +500,89 @@ public void fastPaint(int horizontal, int vertical)
 \r
         if (inGroup)\r
         {\r
-\r
-          if(top!=-1)\r
+          if (top != -1)\r
           {\r
             g.drawLine(sx, top, sx + ex, top);\r
-            top =-1;\r
+            top = -1;\r
+          }\r
+\r
+          if (bottom != -1)\r
+          {\r
+            g.drawLine(sx, bottom - 1, sx + ex, bottom - 1);\r
+            bottom = -1;\r
           }\r
-          if(bottom!=-1)\r
-           {\r
-             g.drawLine(sx, bottom-1, sx + ex, bottom-1);\r
-             bottom = -1;\r
-\r
-           }\r
-          sy = offset + AlignmentUtil.getPixelHeight(starty, i, av.charHeight);\r
-          g.drawLine(sx, oldY, sx, sy );\r
-          g.drawLine(sx+ex, oldY, sx+ex, sy );\r
+\r
+          sy = offset +\r
+              AlignmentUtil.getPixelHeight(starty, i, av.charHeight);\r
+          g.drawLine(sx, oldY, sx, sy);\r
+          g.drawLine(sx + ex, oldY, sx + ex, sy);\r
           inGroup = false;\r
         }\r
+\r
         groupIndex++;\r
+\r
         if (groupIndex >= groups.size())\r
+        {\r
           break;\r
+        }\r
 \r
         group = (SequenceGroup) groups.elementAt(groupIndex);\r
-\r
       }\r
       while (groupIndex < groups.size());\r
-\r
+    }\r
 \r
     /// Highlight search Results once all sequences have been drawn\r
     //////////////////////////////////////////////////////////\r
-    if(displaySearch)\r
+    if (displaySearch)\r
     {\r
-      for(int r=0; r<searchResults.length; r+=3)\r
+      for (int r = 0; r < searchResults.length; r += 3)\r
       {\r
         int searchSeq = searchResults[r];\r
 \r
-        if (searchSeq >= y1 && searchSeq < y2)\r
+        if ( (searchSeq >= y1) && (searchSeq < y2))\r
         {\r
           SequenceI seq = av.getAlignment().getSequenceAt(searchSeq);\r
 \r
-          int searchStart = seq.findIndex( searchResults[r+1] )-1;\r
-          int searchEnd =  seq.findIndex(  searchResults[r+2] )-1;\r
+          int searchStart = seq.findIndex(searchResults[r + 1]) - 1;\r
+          int searchEnd = seq.findIndex(searchResults[r + 2]) - 1;\r
 \r
           SequenceRenderer ssr = (SequenceRenderer) sr;\r
-          if(searchStart<x1)\r
+\r
+          if (searchStart < x1)\r
+          {\r
             searchStart = x1;\r
-          if(searchEnd > x2)\r
+          }\r
+\r
+          if (searchEnd > x2)\r
+          {\r
             searchEnd = x2;\r
+          }\r
 \r
-          ssr.drawHighlightedText(seq,\r
-                                  searchStart,\r
-                                  searchEnd,\r
+          ssr.drawHighlightedText(seq, searchStart, searchEnd,\r
                                   (searchStart - startx) * av.charWidth,\r
                                   offset +\r
-                                  AlignmentUtil.getPixelHeight(starty, searchSeq,\r
-              av.charHeight),\r
-                                  av.charWidth,\r
-                                  av.charHeight);\r
+                                  AlignmentUtil.getPixelHeight(starty,\r
+              searchSeq,\r
+              av.charHeight), av.charWidth, av.charHeight);\r
         }\r
       }\r
     }\r
-\r
   }\r
 \r
-\r
-\r
-  public void highlightSearchResults(int [] results)\r
+  public void highlightSearchResults(int[] results)\r
   {\r
     // results are in the order sequence, startRes, endRes\r
-    if(results==null)\r
+    if (results == null)\r
+    {\r
       displaySearch = false;\r
+    }\r
     else\r
+    {\r
       displaySearch = true;\r
+    }\r
 \r
     searchResults = results;\r
 \r
     repaint();\r
   }\r
-\r
-\r
 }\r
index 44cf4d4..f4d77c3 100755 (executable)
 /*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 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
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
+ */\r
 package jalview.gui;\r
 \r
+import java.util.*;\r
+\r
 import java.awt.*;\r
 import java.awt.event.*;\r
-import jalview.datamodel.*;\r
 import javax.swing.*;\r
-import java.util.*;\r
+\r
+import jalview.analysis.*;\r
+import jalview.datamodel.*;\r
 import jalview.schemes.*;\r
-import jalview.analysis.Conservation;\r
 \r
-public class SeqPanel extends JPanel\r
+public class SeqPanel\r
+    extends JPanel\r
 {\r
-\r
-  public    SeqCanvas         seqCanvas;\r
-  public    AlignmentPanel    ap;\r
-\r
+  public SeqCanvas seqCanvas;\r
+  public AlignmentPanel ap;\r
   protected int lastres;\r
   protected int startseq;\r
-  int startEdit=-1;\r
-  int endEdit=-1;\r
-\r
+  int startEdit = -1;\r
+  int endEdit = -1;\r
   protected AlignViewport av;\r
 \r
   // if character is inserted or deleted, we will need to recalculate the conservation\r
   int seqEditOccurred = -1;\r
-\r
   ScrollThread scrollThread = null;\r
   boolean mouseDragging = false;\r
-\r
   boolean editingSeqs = false;\r
   boolean groupEditing = false;\r
 \r
+  //////////////////////////////////////////\r
+  /////Everything below this is for defining the boundary of the rubberband\r
+  //////////////////////////////////////////\r
+  int oldSeq = -1;\r
+  boolean changeEndSeq = false;\r
+  boolean changeStartSeq = false;\r
+  boolean changeEndRes = false;\r
+  boolean changeStartRes = false;\r
+  SequenceGroup stretchGroup = null;\r
+  boolean remove = false;\r
 \r
-  public SeqPanel(AlignViewport avp, AlignmentPanel p) {\r
-    this.av         = avp;\r
+  public SeqPanel(AlignViewport avp, AlignmentPanel p)\r
+  {\r
+    this.av = avp;\r
 \r
-    seqCanvas  = new SeqCanvas(avp);\r
+    seqCanvas = new SeqCanvas(avp);\r
     setLayout(new BorderLayout());\r
     add(seqCanvas, BorderLayout.CENTER);\r
 \r
     ap = p;\r
 \r
-    addMouseMotionListener( new MouseMotionAdapter()\r
+    addMouseMotionListener(new MouseMotionAdapter()\r
     {\r
       public void mouseMoved(MouseEvent evt)\r
       {\r
-       if(av.getWrapAlignment())\r
-         return;\r
-        doMouseMoved(evt);    }\r
+        if (av.getWrapAlignment())\r
+        {\r
+          return;\r
+        }\r
+\r
+        doMouseMoved(evt);\r
+      }\r
 \r
       public void mouseDragged(MouseEvent evt)\r
       {\r
-        if(av.getWrapAlignment())\r
-         return;\r
-        if( editingSeqs )\r
+        if (av.getWrapAlignment())\r
+        {\r
+          return;\r
+        }\r
+\r
+        if (editingSeqs)\r
+        {\r
           doMouseDragged(evt);\r
+        }\r
         else\r
+        {\r
           doMouseDraggedDefineMode(evt);\r
+        }\r
       }\r
     });\r
 \r
-    addMouseListener( new MouseAdapter()\r
+    addMouseListener(new MouseAdapter()\r
     {\r
       public void mouseReleased(MouseEvent evt)\r
       {\r
-        if(av.getWrapAlignment())\r
-         return;\r
-        if(editingSeqs)\r
+        if (av.getWrapAlignment())\r
+        {\r
+          return;\r
+        }\r
+\r
+        if (editingSeqs)\r
+        {\r
           doMouseReleased(evt);\r
+        }\r
         else\r
+        {\r
           doMouseReleasedDefineMode(evt);\r
-\r
+        }\r
       }\r
+\r
       public void mousePressed(MouseEvent evt)\r
       {\r
-        if(av.getWrapAlignment())\r
-         return;\r
-        if(evt.isShiftDown() || evt.isAltDown() || evt.isControlDown())\r
+        if (av.getWrapAlignment())\r
         {\r
-          if(evt.isAltDown() || evt.isControlDown())\r
+          return;\r
+        }\r
+\r
+        if (evt.isShiftDown() || evt.isAltDown() ||\r
+            evt.isControlDown())\r
+        {\r
+          if (evt.isAltDown() || evt.isControlDown())\r
+          {\r
             groupEditing = true;\r
+          }\r
 \r
           editingSeqs = true;\r
           doMousePressed(evt);\r
         }\r
         else\r
+        {\r
           doMousePressedDefineMode(evt);\r
+        }\r
       }\r
+\r
       public void mouseExited(MouseEvent evt)\r
       {\r
         if (av.getWrapAlignment() || editingSeqs)\r
-                return;\r
-              doMouseExitedDefineMode(evt);\r
+        {\r
+          return;\r
+        }\r
 \r
+        doMouseExitedDefineMode(evt);\r
       }\r
+\r
       public void mouseEntered(MouseEvent evt)\r
       {\r
         if (av.getWrapAlignment() || editingSeqs)\r
+        {\r
           return;\r
+        }\r
+\r
         doMouseEnteredDefineMode(evt);\r
       }\r
-\r
     });\r
     repaint();\r
   }\r
 \r
-\r
-  public void doMouseReleased(MouseEvent evt) {\r
-\r
-    if(seqEditOccurred>-1)\r
+  public void doMouseReleased(MouseEvent evt)\r
+  {\r
+    if (seqEditOccurred > -1)\r
+    {\r
       editOccurred(seqEditOccurred);\r
+    }\r
 \r
     startseq = -1;\r
-    lastres  = -1;\r
+    lastres = -1;\r
     seqEditOccurred = -1;\r
-    editingSeqs  = false;\r
+    editingSeqs = false;\r
     groupEditing = false;\r
 \r
     ap.repaint();\r
   }\r
 \r
-  public void doMousePressed(MouseEvent evt) {\r
-\r
-    ap.alignFrame.addHistoryItem( new HistoryItem(\r
-        "Edit Sequence",av.alignment, HistoryItem.EDIT));\r
+  public void doMousePressed(MouseEvent evt)\r
+  {\r
+    ap.alignFrame.addHistoryItem(new HistoryItem("Edit Sequence",\r
+                                                 av.alignment, HistoryItem.EDIT));\r
 \r
     int seq;\r
     int res;\r
@@ -149,11 +190,11 @@ public class SeqPanel extends JPanel
     int x = evt.getX();\r
     int y = evt.getY();\r
 \r
-    res = x/av.getCharWidth() + av.getStartRes();\r
-    seq = y/av.getCharHeight() + av.getStartSeq();\r
+    res = (x / av.getCharWidth()) + av.getStartRes();\r
+    seq = (y / av.getCharHeight()) + av.getStartSeq();\r
 \r
-    if (seq < av.getAlignment().getHeight() &&\r
-        res < av.getAlignment().getSequenceAt(seq).getLength())\r
+    if ( (seq < av.getAlignment().getHeight()) &&\r
+        (res < av.getAlignment().getSequenceAt(seq).getLength()))\r
     {\r
       startseq = seq;\r
       lastres = res;\r
@@ -172,189 +213,232 @@ public class SeqPanel extends JPanel
 \r
   public void doMouseMoved(MouseEvent evt)\r
   {\r
-    int res=0, seq=0;\r
+    int res = 0;\r
+    int seq = 0;\r
     int x = evt.getX();\r
     int y = evt.getY();\r
-    if(av.wrapAlignment)\r
+\r
+    if (av.wrapAlignment)\r
     {\r
-      y -= 2*av.charHeight;\r
-      int chunkHeight = (av.getAlignment().getHeight()+2)*av.charHeight;\r
+      y -= (2 * av.charHeight);\r
 \r
+      int chunkHeight = (av.getAlignment().getHeight() + 2) * av.charHeight;\r
 \r
-      res =   (int)((y/chunkHeight)*(getWidth()/av.charWidth)) +  x/av.getCharWidth() + av.getStartRes();\r
+      res = (int) ( (y / chunkHeight) * (getWidth() / av.charWidth)) +\r
+          (x / av.getCharWidth()) + av.getStartRes();\r
 \r
       y %= chunkHeight;\r
-      seq =     y / av.getCharHeight() + av.getStartSeq();\r
-\r
+      seq = (y / av.getCharHeight()) + av.getStartSeq();\r
     }\r
     else\r
     {\r
-      res = x / av.getCharWidth()  + av.getStartRes();\r
-      seq = y / av.getCharHeight() + av.getStartSeq();\r
+      res = (x / av.getCharWidth()) + av.getStartRes();\r
+      seq = (y / av.getCharHeight()) + av.getStartSeq();\r
     }\r
 \r
-\r
-    if(seq>=av.getAlignment().getHeight())\r
+    if (seq >= av.getAlignment().getHeight())\r
+    {\r
       return;\r
+    }\r
 \r
     SequenceI sequence = av.getAlignment().getSequenceAt(seq);\r
-    if(res>sequence.getLength())\r
+\r
+    if (res > sequence.getLength())\r
+    {\r
       return;\r
+    }\r
 \r
-    Object obj = ResidueProperties.aa2Triplet.get( sequence.getCharAt(res)+"" ) ;\r
+    Object obj = ResidueProperties.aa2Triplet.get(sequence.getCharAt(res) +\r
+                                                  "");\r
     String aa = "";\r
-    if(obj!=null)\r
-         aa = obj.toString();\r
 \r
-    StringBuffer text = new StringBuffer("Sequence " +(seq+1)+" ID: "+sequence.getName());\r
-    if(aa!="")\r
-      text.append("  Residue: "+aa+" ("+  av.getAlignment().getSequenceAt(seq).findPosition(res)+")");\r
+    if (obj != null)\r
+    {\r
+      aa = obj.toString();\r
+    }\r
+\r
+    StringBuffer text = new StringBuffer("Sequence " + (seq + 1) + " ID: " +\r
+                                         sequence.getName());\r
+\r
+    if (aa != "")\r
+    {\r
+      text.append("  Residue: " + aa + " (" +\r
+                  av.getAlignment().getSequenceAt(seq).findPosition(res) + ")");\r
+    }\r
 \r
     ap.alignFrame.statusBar.setText(text.toString());\r
 \r
     // use aa to see if the mouse pointer is on a\r
-    if(  av.showSequenceFeatures)\r
+    if (av.showSequenceFeatures)\r
     {\r
       Vector features = sequence.getSequenceFeatures();\r
       Enumeration e = features.elements();\r
       StringBuffer sbuffer = new StringBuffer();\r
 \r
-\r
       while (e.hasMoreElements())\r
       {\r
         SequenceFeature sf = (SequenceFeature) e.nextElement();\r
-        if (sf.getStart() <= sequence.findPosition(res) &&\r
-            sf.getEnd() >= sequence.findPosition(res))\r
+\r
+        if ( (sf.getStart() <= sequence.findPosition(res)) &&\r
+            (sf.getEnd() >= sequence.findPosition(res)))\r
         {\r
-          if(sbuffer.length()>0)\r
+          if (sbuffer.length() > 0)\r
+          {\r
             sbuffer.append("; ");\r
+          }\r
+\r
           sbuffer.append(sf.getType() + " " + sf.getDescription());\r
-          if(sf.getStatus().length()>0)\r
-            sbuffer.append(" ("+sf.getStatus()+")");\r
-        }\r
 \r
+          if (sf.getStatus().length() > 0)\r
+          {\r
+            sbuffer.append(" (" + sf.getStatus() + ")");\r
+          }\r
+        }\r
       }\r
 \r
       ToolTipManager.sharedInstance().registerComponent(this);\r
       this.setToolTipText(sbuffer.toString());\r
     }\r
-\r
-\r
   }\r
 \r
-  public void doMouseDragged(MouseEvent evt) {\r
-\r
+  public void doMouseDragged(MouseEvent evt)\r
+  {\r
     // If we're dragging we're editing\r
-    int res = evt.getX() / av.getCharWidth() + av.getStartRes();\r
+    int res = (evt.getX() / av.getCharWidth()) + av.getStartRes();\r
+\r
     if (res < 0)\r
+    {\r
       res = 0;\r
+    }\r
 \r
-    if (lastres == -1 || lastres == res)\r
+    if ( (lastres == -1) || (lastres == res))\r
+    {\r
       return;\r
+    }\r
 \r
     boolean dragRight = true;\r
-    if (res < av.getAlignment().getWidth() && res < lastres)\r
-      dragRight = false;\r
 \r
+    if ( (res < av.getAlignment().getWidth()) && (res < lastres))\r
+    {\r
+      dragRight = false;\r
+    }\r
 \r
     if (res != lastres)\r
     {\r
-        // Group editing\r
-        if (groupEditing)\r
+      // Group editing\r
+      if (groupEditing)\r
+      {\r
+        SequenceGroup sg = av.getSelectionGroup();\r
+\r
+        if (sg == null)\r
         {\r
-          SequenceGroup sg = av.getSelectionGroup();\r
-          if(sg==null)\r
-          {\r
-            lastres=-1;\r
-            return;\r
-          }\r
+          lastres = -1;\r
 \r
-            // drag to right\r
-            if(dragRight)\r
-                sg.setEndRes(sg.getEndRes() + (res-lastres));\r
+          return;\r
+        }\r
 \r
-            // drag to left\r
-            else\r
+        // drag to right\r
+        if (dragRight)\r
+        {\r
+          sg.setEndRes(sg.getEndRes() + (res - lastres));\r
+        }\r
+        // drag to left\r
+        else\r
+        {\r
+          /// Are we able to delete?\r
+          // ie are all columns blank?\r
+          boolean deleteAllowed = false;\r
+\r
+          for (int s = 0; s < sg.getSize(); s++)\r
+          {\r
+            SequenceI seq = sg.getSequenceAt(s);\r
+\r
+            for (int j = res; j < lastres; j++)\r
             {\r
-               /// Are we able to delete?\r
-               // ie are all columns blank?\r
-               boolean deleteAllowed = false;\r
-              for (int s = 0; s < sg.getSize(); s++)\r
+              if (seq.getSequence().length() <= j)\r
               {\r
-                SequenceI seq = sg.getSequenceAt(s);\r
-                for (int j=res; j<lastres; j++)\r
-                {\r
-                  if(seq.getSequence().length()<=j)\r
-                    continue;\r
-\r
-                  if(!jalview.util.Comparison.isGap(seq.getSequence().charAt(j)))\r
-                  {\r
-                    // Not a gap, block edit not valid\r
-                    res=j+1;\r
-                    deleteAllowed = false;\r
-                    continue;\r
-                  }\r
-                  deleteAllowed = true;\r
-                }\r
+                continue;\r
               }\r
 \r
-              if(!deleteAllowed)\r
+              if (!jalview.util.Comparison.isGap(\r
+                  seq.getSequence().charAt(j)))\r
               {\r
-                lastres = -1;\r
-                return;\r
+                // Not a gap, block edit not valid\r
+                res = j + 1;\r
+                deleteAllowed = false;\r
+\r
+                continue;\r
               }\r
 \r
-              sg.setEndRes(sg.getEndRes() - (lastres-res));\r
+              deleteAllowed = true;\r
             }\r
+          }\r
 \r
+          if (!deleteAllowed)\r
+          {\r
+            lastres = -1;\r
 \r
-            for (int i = 0; i < sg.getSize(); i++)\r
-            {\r
-              SequenceI s = sg.getSequenceAt(i);\r
-              int k = av.alignment.findIndex(s);\r
+            return;\r
+          }\r
+\r
+          sg.setEndRes(sg.getEndRes() - (lastres - res));\r
+        }\r
 \r
-              // drag to right\r
-              if (dragRight)\r
-                for (int j = lastres; j < res; j++)\r
-                  insertChar(j, k);\r
+        for (int i = 0; i < sg.getSize(); i++)\r
+        {\r
+          SequenceI s = sg.getSequenceAt(i);\r
+          int k = av.alignment.findIndex(s);\r
 \r
-              // drag to left\r
-              else\r
+          // drag to right\r
+          if (dragRight)\r
+          {\r
+            for (int j = lastres; j < res; j++)\r
+            {\r
+              insertChar(j, k);\r
+            }\r
+          }\r
+          // drag to left\r
+          else\r
+          {\r
+            for (int j = res; j < lastres; j++)\r
+            {\r
+              if (s.getLength() > j)\r
               {\r
-                for (int j = res; j < lastres; j++)\r
-                {\r
-                  if(s.getLength()>j)\r
-                    deleteChar(res, k);\r
-                }\r
+                deleteChar(res, k);\r
               }\r
             }\r
+          }\r
         }\r
-        else /////Editing a single sequence///////////\r
+      }\r
+      else /////Editing a single sequence///////////\r
+      {\r
+        if ( (res < av.getAlignment().getWidth()) && (res > lastres))\r
         {\r
-          if (res < av.getAlignment().getWidth() && res > lastres)\r
+          // dragging to the right\r
+          for (int j = lastres; j < res; j++)\r
           {\r
-            // dragging to the right\r
-            for (int j = lastres; j < res; j++)\r
-              insertChar(j, startseq);\r
+            insertChar(j, startseq);\r
           }\r
-          else if (res < av.getAlignment().getWidth() && res < lastres)\r
+        }\r
+        else if ( (res < av.getAlignment().getWidth()) &&\r
+                 (res < lastres))\r
+        {\r
+          // dragging to the left\r
+          for (int j = lastres; j > res; j--)\r
           {\r
-            // dragging to the left\r
-            for (int j = lastres; j > res; j--)\r
+            if (jalview.util.Comparison.isGap(\r
+                av.alignment.getSequenceAt(startseq)\r
+                .getSequence().charAt(res)))\r
             {\r
-              if( jalview.util.Comparison.isGap(\r
-                av.alignment.getSequenceAt(startseq).getSequence().charAt(res)))\r
-\r
               deleteChar(res, startseq);\r
-              else\r
-              {\r
-\r
-                break;\r
-              }\r
+            }\r
+            else\r
+            {\r
+              break;\r
             }\r
           }\r
-\r
         }\r
+      }\r
     }\r
 \r
     endEdit = res;\r
@@ -362,30 +446,31 @@ public class SeqPanel extends JPanel
     repaint();\r
   }\r
 \r
-  public void drawChars(int seqstart, int seqend, int start) {\r
-    seqCanvas.drawPanel(seqCanvas.gg, start,av.getEndRes(),seqstart,seqend,av.getStartRes(),av.getStartSeq(),0);\r
+  public void drawChars(int seqstart, int seqend, int start)\r
+  {\r
+    seqCanvas.drawPanel(seqCanvas.gg, start, av.getEndRes(), seqstart,\r
+                        seqend, av.getStartRes(), av.getStartSeq(), 0);\r
     repaint();\r
   }\r
 \r
   public void insertChar(int j, int seq)\r
   {\r
     av.alignment.getSequenceAt(seq).insertCharAt(j, av.getGapCharacter());\r
-    seqEditOccurred=seq;\r
+    seqEditOccurred = seq;\r
   }\r
 \r
   public void deleteChar(int j, int seq)\r
   {\r
     av.alignment.getSequenceAt(seq).deleteCharAt(j);\r
-    seqEditOccurred=seq;\r
+    seqEditOccurred = seq;\r
 \r
     av.alignment.getWidth();\r
     repaint();\r
   }\r
 \r
-\r
   void editOccurred(int i)\r
   {\r
-    if(endEdit==startEdit)\r
+    if (endEdit == startEdit)\r
     {\r
       ap.alignFrame.historyList.pop();\r
       ap.alignFrame.updateEditMenuBar();\r
@@ -396,11 +481,13 @@ public class SeqPanel extends JPanel
 \r
     // Y O Y CLUSTALX\r
     ColourSchemeI cs = av.getGlobalColourScheme();\r
-    if(cs instanceof ConservationColourScheme)\r
+\r
+    if (cs instanceof ConservationColourScheme)\r
     {\r
-      ConservationColourScheme ccs =  (ConservationColourScheme) cs;\r
-      if(ccs.cs instanceof ClustalxColourScheme)\r
-     {\r
+      ConservationColourScheme ccs = (ConservationColourScheme) cs;\r
+\r
+      if (ccs.cs instanceof ClustalxColourScheme)\r
+      {\r
         Conservation c = new Conservation("All",\r
                                           ResidueProperties.propHash, 3,\r
                                           av.alignment.getSequences(), 0,\r
@@ -408,135 +495,151 @@ public class SeqPanel extends JPanel
         c.calculate();\r
         c.verdict(false, av.ConsPercGaps);\r
 \r
-        ClustalxColourScheme cxs = (ClustalxColourScheme)ccs.cs;\r
-        cxs.resetClustalX(av.alignment.getSequences(),  av.alignment.getWidth());\r
+        ClustalxColourScheme cxs = (ClustalxColourScheme) ccs.cs;\r
+        cxs.resetClustalX(av.alignment.getSequences(),\r
+                          av.alignment.getWidth());\r
         ccs = new ConservationColourScheme(c, cxs);\r
         av.setGlobalColourScheme(ccs);\r
-     }\r
+      }\r
     }\r
 \r
-    if(cs instanceof ClustalxColourScheme)\r
+    if (cs instanceof ClustalxColourScheme)\r
     {\r
-      ((ClustalxColourScheme)cs).resetClustalX(av.alignment.getSequences(),\r
-                                    av.alignment.getWidth());\r
+      ( (ClustalxColourScheme) cs).resetClustalX(av.alignment.getSequences(),\r
+                                                 av.alignment.getWidth());\r
       av.setGlobalColourScheme(cs);\r
     }\r
-\r
   }\r
 \r
-//////////////////////////////////////////\r
-/////Everything below this is for defining the boundary of the rubberband\r
-//////////////////////////////////////////\r
-  int oldSeq = -1;\r
   public void doMousePressedDefineMode(MouseEvent evt)\r
   {\r
-    int res = evt.getX()/av.getCharWidth() + av.getStartRes();\r
-    int seq = evt.getY()/av.getCharHeight() + av.getStartSeq();\r
+    int res = (evt.getX() / av.getCharWidth()) + av.getStartRes();\r
+    int seq = (evt.getY() / av.getCharHeight()) + av.getStartSeq();\r
     oldSeq = seq;\r
 \r
     SequenceI sequence = (Sequence) av.getAlignment().getSequenceAt(seq);\r
 \r
-    if(sequence==null || res>sequence.getLength())\r
+    if ( (sequence == null) || (res > sequence.getLength()))\r
+    {\r
       return;\r
+    }\r
 \r
     stretchGroup = av.getSelectionGroup();\r
 \r
-    if(stretchGroup == null)\r
-     {\r
-       stretchGroup = av.alignment.findGroup( sequence );\r
-       if(stretchGroup!=null && res>stretchGroup.getStartRes() && res<stretchGroup.getEndRes())\r
-         av.setSelectionGroup(stretchGroup);\r
-       else\r
-         stretchGroup = null;\r
-     }\r
-\r
-    else if(!stretchGroup.sequences.contains(sequence)\r
-            || stretchGroup.getStartRes()>res\r
-            || stretchGroup.getEndRes()<res)\r
-     {\r
-       stretchGroup = null;\r
-\r
-       SequenceGroup[] allGroups = av.alignment.findAllGroups( sequence );\r
-\r
-       if (allGroups != null)\r
-         for (int i = 0; i < allGroups.length; i++)\r
-           if (allGroups[i].getStartRes() <= res &&\r
-               allGroups[i].getEndRes() >= res)\r
-           {\r
-             stretchGroup = allGroups[i];\r
-             av.setSelectionGroup(stretchGroup);\r
-             break;\r
-           }\r
-     }\r
-\r
-    if(stretchGroup==null)\r
+    if (stretchGroup == null)\r
+    {\r
+      stretchGroup = av.alignment.findGroup(sequence);\r
+\r
+      if ( (stretchGroup != null) && (res > stretchGroup.getStartRes()) &&\r
+          (res < stretchGroup.getEndRes()))\r
+      {\r
+        av.setSelectionGroup(stretchGroup);\r
+      }\r
+      else\r
+      {\r
+        stretchGroup = null;\r
+      }\r
+    }\r
+    else if (!stretchGroup.sequences.contains(sequence) ||\r
+             (stretchGroup.getStartRes() > res) ||\r
+             (stretchGroup.getEndRes() < res))\r
+    {\r
+      stretchGroup = null;\r
+\r
+      SequenceGroup[] allGroups = av.alignment.findAllGroups(sequence);\r
+\r
+      if (allGroups != null)\r
+      {\r
+        for (int i = 0; i < allGroups.length; i++)\r
+        {\r
+          if ( (allGroups[i].getStartRes() <= res) &&\r
+              (allGroups[i].getEndRes() >= res))\r
+          {\r
+            stretchGroup = allGroups[i];\r
+            av.setSelectionGroup(stretchGroup);\r
+\r
+            break;\r
+          }\r
+        }\r
+      }\r
+    }\r
+\r
+    if (stretchGroup == null)\r
     {\r
       // define a new group here\r
       SequenceGroup sg = new SequenceGroup();\r
       sg.setStartRes(res);\r
       sg.setEndRes(res);\r
-      sg.addSequence( sequence );\r
-      av.setSelectionGroup( sg );\r
+      sg.addSequence(sequence);\r
+      av.setSelectionGroup(sg);\r
       stretchGroup = sg;\r
 \r
-      if(av.getConservationSelected())\r
-        SliderPanel.setConservationSlider(ap, av.getGlobalColourScheme(), "Background");\r
-      if(av.getAbovePIDThreshold())\r
-        SliderPanel.setPIDSliderSource(ap, av.getGlobalColourScheme(), "Background");\r
+      if (av.getConservationSelected())\r
+      {\r
+        SliderPanel.setConservationSlider(ap,\r
+                                          av.getGlobalColourScheme(),\r
+                                          "Background");\r
+      }\r
 \r
+      if (av.getAbovePIDThreshold())\r
+      {\r
+        SliderPanel.setPIDSliderSource(ap, av.getGlobalColourScheme(),\r
+                                       "Background");\r
+      }\r
     }\r
-    else if( javax.swing.SwingUtilities.isRightMouseButton(evt))\r
+    else if (javax.swing.SwingUtilities.isRightMouseButton(evt))\r
     {\r
-        jalview.gui.PopupMenu pop = new jalview.gui.PopupMenu( ap , null);\r
-        pop.show(this, evt.getX(), evt.getY());\r
+      jalview.gui.PopupMenu pop = new jalview.gui.PopupMenu(ap, null);\r
+      pop.show(this, evt.getX(), evt.getY());\r
 \r
-    // edit the properties of existing group\r
+      // edit the properties of existing group\r
     }\r
 \r
-    if(stretchGroup!=null && stretchGroup.getEndRes()==res)\r
+    if ( (stretchGroup != null) && (stretchGroup.getEndRes() == res))\r
+    {\r
       // Edit end res position of selected group\r
       changeEndRes = true;\r
-\r
-   else if(stretchGroup!=null && stretchGroup.getStartRes()==res)\r
+    }\r
+    else if ( (stretchGroup != null) && (stretchGroup.getStartRes() == res))\r
+    {\r
       // Edit end res position of selected group\r
       changeStartRes = true;\r
+    }\r
 \r
     stretchGroup.getWidth();\r
 \r
     repaint();\r
-\r
   }\r
 \r
-  boolean changeEndSeq = false;\r
-  boolean changeStartSeq = false;\r
-  boolean changeEndRes = false;\r
-  boolean changeStartRes = false;\r
-  SequenceGroup stretchGroup = null;\r
-\r
   public void doMouseReleasedDefineMode(MouseEvent evt)\r
   {\r
     mouseDragging = false;\r
 \r
-    if(stretchGroup==null)\r
+    if (stretchGroup == null)\r
+    {\r
       return;\r
+    }\r
 \r
-    if(stretchGroup.cs instanceof ClustalxColourScheme)\r
+    if (stretchGroup.cs instanceof ClustalxColourScheme)\r
     {\r
-      stretchGroup.cs = new ClustalxColourScheme(stretchGroup.sequences, av.alignment.getWidth());\r
+      stretchGroup.cs = new ClustalxColourScheme(stretchGroup.sequences,\r
+                                                 av.alignment.getWidth());\r
       repaint();\r
     }\r
-\r
-    else if(stretchGroup.cs instanceof ConservationColourScheme)\r
+    else if (stretchGroup.cs instanceof ConservationColourScheme)\r
     {\r
-       ConservationColourScheme ccs = (ConservationColourScheme)stretchGroup.cs;\r
-       stretchGroup.cs = ccs;\r
-       SliderPanel.setConservationSlider(ap, stretchGroup.cs, stretchGroup.getName()) ;\r
+      ConservationColourScheme ccs = (ConservationColourScheme) stretchGroup.cs;\r
+      stretchGroup.cs = ccs;\r
+      SliderPanel.setConservationSlider(ap, stretchGroup.cs,\r
+                                        stretchGroup.getName());\r
 \r
-       repaint();\r
+      repaint();\r
     }\r
     else\r
-        SliderPanel.setPIDSliderSource(ap, stretchGroup.cs, stretchGroup.getName());\r
-\r
+    {\r
+      SliderPanel.setPIDSliderSource(ap, stretchGroup.cs,\r
+                                     stretchGroup.getName());\r
+    }\r
 \r
     changeEndRes = false;\r
     changeStartRes = false;\r
@@ -544,58 +647,75 @@ public class SeqPanel extends JPanel
     ap.idPanel.repaint();\r
   }\r
 \r
-\r
-  boolean remove = false;\r
   public void doMouseDraggedDefineMode(MouseEvent evt)\r
   {\r
-    int res = evt.getX()/av.getCharWidth() + av.getStartRes();\r
-    int y = evt.getY()/av.getCharHeight() + av.getStartSeq();\r
+    int res = (evt.getX() / av.getCharWidth()) + av.getStartRes();\r
+    int y = (evt.getY() / av.getCharHeight()) + av.getStartSeq();\r
 \r
-    if(stretchGroup==null)\r
+    if (stretchGroup == null)\r
+    {\r
       return;\r
+    }\r
 \r
-    if(res>av.alignment.getWidth())\r
-      res = av.alignment.getWidth()-1;\r
-\r
+    if (res > av.alignment.getWidth())\r
+    {\r
+      res = av.alignment.getWidth() - 1;\r
+    }\r
 \r
-    if(stretchGroup.getEndRes()==res)\r
+    if (stretchGroup.getEndRes() == res)\r
+    {\r
       // Edit end res position of selected group\r
       changeEndRes = true;\r
-\r
-    else if(stretchGroup.getStartRes()==res)\r
+    }\r
+    else if (stretchGroup.getStartRes() == res)\r
+    {\r
       // Edit start res position of selected group\r
       changeStartRes = true;\r
+    }\r
 \r
-\r
-    if(res<av.getStartRes())\r
+    if (res < av.getStartRes())\r
+    {\r
       res = av.getStartRes();\r
-    else if(res>av.getEndRes())\r
+    }\r
+    else if (res > av.getEndRes())\r
+    {\r
       res = av.getEndRes();\r
+    }\r
 \r
-    if(changeEndRes)\r
+    if (changeEndRes)\r
     {\r
-      if(res>stretchGroup.getStartRes()-1)\r
-        stretchGroup.setEndRes( res );\r
+      if (res > (stretchGroup.getStartRes() - 1))\r
+      {\r
+        stretchGroup.setEndRes(res);\r
+      }\r
     }\r
-    else if(changeStartRes)\r
+    else if (changeStartRes)\r
     {\r
-      if(res<stretchGroup.getEndRes()+1)\r
-        stretchGroup.setStartRes( res );\r
+      if (res < (stretchGroup.getEndRes() + 1))\r
+      {\r
+        stretchGroup.setStartRes(res);\r
+      }\r
     }\r
 \r
     int dragDirection = 0;\r
+\r
     if (y > oldSeq)\r
+    {\r
       dragDirection = 1;\r
+    }\r
     else if (y < oldSeq)\r
+    {\r
       dragDirection = -1;\r
+    }\r
 \r
-    while (y != oldSeq && oldSeq>0 && y<av.alignment.getHeight())\r
+    while ( (y != oldSeq) && (oldSeq > 0) && (y < av.alignment.getHeight()))\r
     {\r
       // This routine ensures we don't skip any sequences, as the\r
       // selection is quite slow.\r
       Sequence seq = (Sequence) av.getAlignment().getSequenceAt(oldSeq);\r
 \r
       oldSeq += dragDirection;\r
+\r
       Sequence nextSeq = (Sequence) av.getAlignment().getSequenceAt(oldSeq);\r
 \r
       if (stretchGroup.sequences.contains(nextSeq))\r
@@ -605,15 +725,22 @@ public class SeqPanel extends JPanel
       }\r
       else\r
       {\r
-       if(seq!=null)\r
-        stretchGroup.addSequence(seq);\r
+        if (seq != null)\r
+        {\r
+          stretchGroup.addSequence(seq);\r
+        }\r
+\r
         stretchGroup.addSequence(nextSeq);\r
       }\r
     }\r
+\r
     oldSeq = y;\r
     mouseDragging = true;\r
-    if(scrollThread!=null)\r
+\r
+    if (scrollThread != null)\r
+    {\r
       scrollThread.setEvent(evt);\r
+    }\r
 \r
     repaint();\r
   }\r
@@ -621,23 +748,31 @@ public class SeqPanel extends JPanel
   public void doMouseEnteredDefineMode(MouseEvent e)\r
   {\r
     if (scrollThread != null)\r
+    {\r
       scrollThread.running = false;\r
+    }\r
   }\r
 \r
   public void doMouseExitedDefineMode(MouseEvent e)\r
   {\r
     if (av.getWrapAlignment())\r
+    {\r
       return;\r
+    }\r
 \r
-    if(mouseDragging)\r
+    if (mouseDragging)\r
+    {\r
       scrollThread = new ScrollThread();\r
-\r
+    }\r
   }\r
+\r
   // this class allows scrolling off the bottom of the visible alignment\r
-  class ScrollThread extends Thread\r
+  class ScrollThread\r
+      extends Thread\r
   {\r
     MouseEvent evt;\r
     boolean running = false;\r
+\r
     public ScrollThread()\r
     {\r
       start();\r
@@ -656,23 +791,31 @@ public class SeqPanel extends JPanel
     public void run()\r
     {\r
       running = true;\r
+\r
       while (running)\r
       {\r
-        if(evt!=null)\r
+        if (evt != null)\r
         {\r
-\r
-          if (mouseDragging && evt.getY() < 0 && av.getStartSeq() > 0)\r
+          if (mouseDragging && (evt.getY() < 0) &&\r
+              (av.getStartSeq() > 0))\r
+          {\r
             running = ap.scrollUp(true);\r
+          }\r
 \r
-          if (mouseDragging && evt.getY() >= getHeight() &&\r
-              av.alignment.getHeight() > av.getEndSeq())\r
+          if (mouseDragging && (evt.getY() >= getHeight()) &&\r
+              (av.alignment.getHeight() > av.getEndSeq()))\r
+          {\r
             running = ap.scrollUp(false);\r
+          }\r
 \r
-          if (mouseDragging && evt.getX() < 0)\r
+          if (mouseDragging && (evt.getX() < 0))\r
+          {\r
             running = ap.scrollRight(true);\r
-\r
-          else if (mouseDragging && evt.getX() >= getWidth())\r
+          }\r
+          else if (mouseDragging && (evt.getX() >= getWidth()))\r
+          {\r
             running = ap.scrollRight(false);\r
+          }\r
         }\r
 \r
         try\r
@@ -680,15 +823,9 @@ public class SeqPanel extends JPanel
           Thread.sleep(75);\r
         }\r
         catch (Exception ex)\r
-        {}\r
+        {\r
+        }\r
       }\r
     }\r
+  }\r
 }\r
-\r
-\r
-\r
-}\r
-\r
-\r
-\r
-\r
index 2c98754..896fda5 100755 (executable)
@@ -1,27 +1,27 @@
 /*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 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
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
+ */\r
 package jalview.gui;\r
 \r
+import java.awt.*;\r
+\r
 import jalview.datamodel.*;\r
 import jalview.schemes.*;\r
-import java.awt.*;\r
 \r
 public class SequenceRenderer\r
 {\r
@@ -29,7 +29,7 @@ public class SequenceRenderer
   FontMetrics fm;\r
   boolean renderGaps = true;\r
   SequenceGroup currentSequenceGroup = null;\r
-  SequenceGroup [] allGroups = null;\r
+  SequenceGroup[] allGroups = null;\r
   Color resBoxColour;\r
   Graphics graphics;\r
 \r
@@ -38,7 +38,6 @@ public class SequenceRenderer
     this.av = av;\r
   }\r
 \r
-\r
   public void renderGaps(boolean b)\r
   {\r
     renderGaps = b;\r
@@ -47,18 +46,25 @@ public class SequenceRenderer
   public Color getResidueBoxColour(ColourSchemeI cs, SequenceI seq, int i)\r
   {\r
     getBoxColour(cs, seq, i);\r
+\r
     return resBoxColour;\r
   }\r
 \r
   void getBoxColour(ColourSchemeI cs, SequenceI seq, int i)\r
   {\r
-   if (cs != null)\r
-       resBoxColour = cs.findColour(seq.getSequence(i, i + 1), i);\r
-   else\r
-       resBoxColour = Color.white;\r
+    if (cs != null)\r
+    {\r
+      resBoxColour = cs.findColour(seq.getSequence(i, i + 1), i);\r
+    }\r
+    else\r
+    {\r
+      resBoxColour = Color.white;\r
+    }\r
   }\r
 \r
-  public void drawSequence(Graphics g,SequenceI seq,SequenceGroup [] sg, int start, int end, int x1, int y1, int width, int height)\r
+  public void drawSequence(Graphics g, SequenceI seq, SequenceGroup[] sg,\r
+                           int start, int end, int x1, int y1, int width,\r
+                           int height)\r
   {\r
     allGroups = sg;\r
 \r
@@ -67,145 +73,182 @@ public class SequenceRenderer
     drawBoxes(seq, start, end, x1, y1, (int) width, height);\r
 \r
     fm = g.getFontMetrics();\r
-    drawText(seq,start,end,x1,y1,(int)width,height);\r
-\r
+    drawText(seq, start, end, x1, y1, (int) width, height);\r
   }\r
 \r
-  public void drawBoxes(SequenceI seq,int start, int end, int x1, int y1, int width, int height) {\r
-    int i      = start;\r
+  public void drawBoxes(SequenceI seq, int start, int end, int x1, int y1,\r
+                        int width, int height)\r
+  {\r
+    int i = start;\r
     int length = seq.getLength();\r
 \r
     int curStart = -1;\r
     int curWidth = width;\r
 \r
     Color tempColour = null;\r
-    while (i <= end && i < length)\r
+\r
+    while ( (i <= end) && (i < length))\r
     {\r
-      if(inCurrentSequenceGroup(i))\r
+      if (inCurrentSequenceGroup(i))\r
       {\r
-        if( currentSequenceGroup.getDisplayBoxes())\r
-             getBoxColour(currentSequenceGroup.cs, seq, i);\r
+        if (currentSequenceGroup.getDisplayBoxes())\r
+        {\r
+          getBoxColour(currentSequenceGroup.cs, seq, i);\r
+        }\r
         else\r
-             resBoxColour = Color.white;\r
+        {\r
+          resBoxColour = Color.white;\r
+        }\r
+      }\r
+      else if (av.getShowBoxes())\r
+      {\r
+        getBoxColour(av.getGlobalColourScheme(), seq, i);\r
       }\r
-      else if(av.getShowBoxes())\r
-            getBoxColour(av.getGlobalColourScheme(), seq, i);\r
       else\r
+      {\r
         resBoxColour = Color.white;\r
-\r
+      }\r
 \r
       if (resBoxColour != tempColour)\r
       {\r
-        if(tempColour!=null)\r
-          graphics.fillRect(x1+width*(curStart-start),y1,curWidth,height);\r
+        if (tempColour != null)\r
+        {\r
+          graphics.fillRect(x1 + (width * (curStart - start)), y1,\r
+                            curWidth, height);\r
+        }\r
+\r
         graphics.setColor(resBoxColour);\r
 \r
         curStart = i;\r
         curWidth = width;\r
         tempColour = resBoxColour;\r
-\r
       }\r
       else\r
+      {\r
         curWidth += width;\r
+      }\r
 \r
       i++;\r
     }\r
 \r
-\r
-     graphics.fillRect(x1+width*(curStart-start),y1,curWidth,height);\r
+    graphics.fillRect(x1 + (width * (curStart - start)), y1, curWidth,\r
+                      height);\r
   }\r
 \r
-  public void drawText(SequenceI seq,int start, int end, int x1, int y1, int width, int height)\r
+  public void drawText(SequenceI seq, int start, int end, int x1, int y1,\r
+                       int width, int height)\r
   {\r
-    int pady = height/5;\r
-    int charOffset=0;\r
+    int pady = height / 5;\r
+    int charOffset = 0;\r
     char s;\r
-    // Need to find the sequence position here.\r
 \r
+    // Need to find the sequence position here.\r
+    String sequence = seq.getSequence();\r
 \r
-    String sequence  = seq.getSequence();\r
     for (int i = start; i <= end; i++)\r
     {\r
-        graphics.setColor(Color.black);\r
+      graphics.setColor(Color.black);\r
 \r
-        if(i<sequence.length())\r
-          s = sequence.charAt(i);\r
-        else\r
-          s = ' ';\r
+      if (i < sequence.length())\r
+      {\r
+        s = sequence.charAt(i);\r
+      }\r
+      else\r
+      {\r
+        s = ' ';\r
+      }\r
 \r
-        if(!renderGaps && jalview.util.Comparison.isGap(s))\r
-          continue;\r
+      if (!renderGaps && jalview.util.Comparison.isGap(s))\r
+      {\r
+        continue;\r
+      }\r
 \r
+      if (inCurrentSequenceGroup(i))\r
+      {\r
+        if (!currentSequenceGroup.getDisplayText())\r
+        {\r
+          continue;\r
+        }\r
 \r
-        if (inCurrentSequenceGroup(i))\r
+        if (currentSequenceGroup.getColourText())\r
         {\r
-          if(!currentSequenceGroup.getDisplayText())\r
-            continue;\r
-\r
-            if (currentSequenceGroup.getColourText())\r
-            {\r
-              getBoxColour(currentSequenceGroup.cs, seq, i);\r
-              graphics.setColor(resBoxColour.darker());\r
-            }\r
+          getBoxColour(currentSequenceGroup.cs, seq, i);\r
+          graphics.setColor(resBoxColour.darker());\r
         }\r
-        else\r
+      }\r
+      else\r
+      {\r
+        if (!av.getShowText())\r
         {\r
-          if(!av.getShowText())\r
-            continue;\r
-\r
-          if(av.getColourText())\r
-           {\r
-             getBoxColour(av.getGlobalColourScheme(), seq, i);\r
-             if(av.getShowBoxes())\r
-              graphics.setColor(resBoxColour.darker());\r
-            else\r
-              graphics.setColor(resBoxColour);\r
-           }\r
+          continue;\r
         }\r
 \r
-          charOffset =  (width - fm.charWidth(s))/2;\r
-          graphics.drawString(String.valueOf(s),\r
-                              charOffset + x1 + width * (i - start),\r
-                              y1 + height - pady);\r
+        if (av.getColourText())\r
+        {\r
+          getBoxColour(av.getGlobalColourScheme(), seq, i);\r
+\r
+          if (av.getShowBoxes())\r
+          {\r
+            graphics.setColor(resBoxColour.darker());\r
+          }\r
+          else\r
+          {\r
+            graphics.setColor(resBoxColour);\r
+          }\r
         }\r
+      }\r
 \r
-\r
+      charOffset = (width - fm.charWidth(s)) / 2;\r
+      graphics.drawString(String.valueOf(s),\r
+                          charOffset + x1 + (width * (i - start)),\r
+                          (y1 + height) - pady);\r
+    }\r
   }\r
 \r
   boolean inCurrentSequenceGroup(int res)\r
   {\r
-    if(allGroups ==null)\r
+    if (allGroups == null)\r
+    {\r
       return false;\r
+    }\r
 \r
-    for(int i=0; i<allGroups.length; i++)\r
-      if(allGroups[i].getStartRes()<=res && allGroups[i].getEndRes()>=res)\r
+    for (int i = 0; i < allGroups.length; i++)\r
+    {\r
+      if ( (allGroups[i].getStartRes() <= res) &&\r
+          (allGroups[i].getEndRes() >= res))\r
       {\r
-         currentSequenceGroup = allGroups[i];\r
-         return true;\r
+        currentSequenceGroup = allGroups[i];\r
+\r
+        return true;\r
       }\r
+    }\r
 \r
     return false;\r
   }\r
 \r
-  public void drawHighlightedText(SequenceI seq,int start, int end, int x1, int y1, int width, int height)\r
+  public void drawHighlightedText(SequenceI seq, int start, int end, int x1,\r
+                                  int y1, int width, int height)\r
   {\r
-    int pady = height/5;\r
-    int charOffset=0;\r
+    int pady = height / 5;\r
+    int charOffset = 0;\r
     graphics.setColor(Color.BLACK);\r
-    graphics.fillRect(x1,y1,width*(end-start+1),height);\r
+    graphics.fillRect(x1, y1, width * (end - start + 1), height);\r
     graphics.setColor(Color.white);\r
 \r
-    char s='~';\r
+    char s = '~';\r
+\r
     // Need to find the sequence position here.\r
     for (int i = start; i <= end; i++)\r
     {\r
-       if(i<seq.getLength())\r
-          s = seq.getSequence().charAt(i);\r
+      if (i < seq.getLength())\r
+      {\r
+        s = seq.getSequence().charAt(i);\r
+      }\r
 \r
-     charOffset =  (width - fm.charWidth(s))/2;\r
-      graphics.drawString(String.valueOf(s), charOffset + x1 + width * (i - start), y1 + height - pady);\r
+      charOffset = (width - fm.charWidth(s)) / 2;\r
+      graphics.drawString(String.valueOf(s),\r
+                          charOffset + x1 + (width * (i - start)),\r
+                          (y1 + height) - pady);\r
     }\r
   }\r
-\r
-\r
 }\r
index 97c5e10..f95f84b 100755 (executable)
@@ -1,47 +1,84 @@
 /*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 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
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
+ */\r
 package jalview.gui;\r
 \r
-import jalview.jbgui.*;\r
-import jalview.schemes.*;\r
-import jalview.datamodel.*;\r
+import java.util.*;\r
+\r
 import java.awt.event.*;\r
-import javax.swing.event.*;\r
 import javax.swing.*;\r
-import java.util.*;\r
+import javax.swing.event.*;\r
+\r
+import jalview.datamodel.*;\r
+import jalview.jbgui.*;\r
+import jalview.schemes.*;\r
 \r
-public class SliderPanel extends GSliderPanel\r
+public class SliderPanel\r
+    extends GSliderPanel\r
 {\r
+  static JInternalFrame conservationSlider;\r
+  static JInternalFrame PIDSlider;\r
   AlignmentPanel ap;\r
   boolean forConservation = true;\r
   ColourSchemeI cs;\r
 \r
-  static JInternalFrame conservationSlider;\r
-  static JInternalFrame PIDSlider;\r
+  public SliderPanel(AlignmentPanel ap, int value, boolean forConserve,\r
+                     ColourSchemeI cs)\r
+  {\r
+    this.ap = ap;\r
+    this.cs = cs;\r
+    forConservation = forConserve;\r
+    undoButton.setVisible(false);\r
+    applyButton.setVisible(false);\r
 \r
-  public static int setConservationSlider(AlignmentPanel ap, ColourSchemeI cs, String source)\r
+    if (forConservation)\r
+    {\r
+      label.setText("Enter value to increase conservation visibility");\r
+      slider.setMinimum(0);\r
+      slider.setMaximum(50);\r
+    }\r
+    else\r
+    {\r
+      label.setText("Enter % identity above which to colour residues");\r
+      slider.setMinimum(0);\r
+      slider.setMaximum(100);\r
+    }\r
+\r
+    slider.addChangeListener(new ChangeListener()\r
+    {\r
+      public void stateChanged(ChangeEvent evt)\r
+      {\r
+        valueField.setText(slider.getValue() + "");\r
+        valueChanged(slider.getValue());\r
+      }\r
+    });\r
+\r
+    slider.setValue(value);\r
+    valueField.setText(value + "");\r
+  }\r
+\r
+  public static int setConservationSlider(AlignmentPanel ap,\r
+                                          ColourSchemeI cs, String source)\r
   {\r
     SliderPanel sp = null;\r
-    ConservationColourScheme ccs = (ConservationColourScheme)cs;\r
+    ConservationColourScheme ccs = (ConservationColourScheme) cs;\r
 \r
-    if(conservationSlider == null)\r
+    if (conservationSlider == null)\r
     {\r
       sp = new SliderPanel(ap, ccs.inc, true, cs);\r
       conservationSlider = new JInternalFrame();\r
@@ -50,175 +87,169 @@ public class SliderPanel extends GSliderPanel
     }\r
     else\r
     {\r
-        sp = (SliderPanel)conservationSlider.getContentPane();\r
-        sp.cs = cs;\r
+      sp = (SliderPanel) conservationSlider.getContentPane();\r
+      sp.cs = cs;\r
     }\r
 \r
-    conservationSlider.setTitle("Conservation Colour Increment  ("+source+")");\r
-    if(ap.av.alignment.getGroups()!=null)\r
-      sp.setAllGroupsCheckEnabled( true );\r
+    conservationSlider.setTitle("Conservation Colour Increment  (" +\r
+                                source + ")");\r
+\r
+    if (ap.av.alignment.getGroups() != null)\r
+    {\r
+      sp.setAllGroupsCheckEnabled(true);\r
+    }\r
     else\r
-      sp.setAllGroupsCheckEnabled( false);\r
+    {\r
+      sp.setAllGroupsCheckEnabled(false);\r
+    }\r
 \r
     return sp.getValue();\r
   }\r
 \r
   public static void showConservationSlider()\r
   {\r
-    try{\r
+    try\r
+    {\r
       PIDSlider.setClosed(true);\r
       PIDSlider = null;\r
-    }catch(Exception ex){}\r
-\r
+    }\r
+    catch (Exception ex)\r
+    {\r
+    }\r
 \r
-    if(!conservationSlider.isVisible())\r
+    if (!conservationSlider.isVisible())\r
     {\r
-      Desktop.addInternalFrame(conservationSlider, conservationSlider.getTitle(), 420, 90, false);\r
+      Desktop.addInternalFrame(conservationSlider,\r
+                               conservationSlider.getTitle(), 420, 90, false);\r
       conservationSlider.addInternalFrameListener(new javax.swing.event.\r
                                                   InternalFrameAdapter()\r
       {\r
-        public void internalFrameClosed(javax.swing.event.InternalFrameEvent e)\r
+        public void internalFrameClosed(\r
+            javax.swing.event.InternalFrameEvent e)\r
         {\r
           conservationSlider = null;\r
         }\r
       });\r
       conservationSlider.setLayer(JLayeredPane.PALETTE_LAYER);\r
     }\r
-\r
   }\r
 \r
-  public static int setPIDSliderSource(AlignmentPanel ap, ColourSchemeI cs, String source)\r
-   {\r
-     SliderPanel pid = null;\r
-\r
-     int threshold = 50;\r
-     if (cs instanceof ResidueColourScheme)\r
-       threshold = ( ( (ResidueColourScheme) cs).getThreshold());\r
-     else if (cs instanceof ScoreColourScheme)\r
-       threshold = ( ( (ScoreColourScheme) cs).getThreshold());\r
-\r
-\r
-     if(PIDSlider == null)\r
-     {\r
-       pid = new SliderPanel(ap, threshold, false, cs);\r
-       PIDSlider = new JInternalFrame();\r
-       PIDSlider.setContentPane(pid);\r
-       PIDSlider.setLayer(JLayeredPane.PALETTE_LAYER);\r
-     }\r
-     else\r
-     {\r
-         pid = (SliderPanel)PIDSlider.getContentPane();\r
-         pid.cs = cs;\r
-     }\r
-     PIDSlider.setTitle("Percentage Identity Threshold ("+source+")");\r
-\r
-     if (ap.av.alignment.getGroups() != null)\r
-       pid.setAllGroupsCheckEnabled(true);\r
-     else\r
-       pid.setAllGroupsCheckEnabled(false);\r
-\r
-     return pid.getValue();\r
-\r
-   }\r
-\r
-   public static void showPIDSlider()\r
-   {\r
-     try{\r
-       conservationSlider.setClosed(true);\r
-       conservationSlider = null;\r
-     }catch(Exception ex){}\r
-\r
-     if(!PIDSlider.isVisible())\r
-    {\r
-      Desktop.addInternalFrame(PIDSlider, PIDSlider.getTitle(), 420, 90, false);\r
-      PIDSlider.setLayer(JLayeredPane.PALETTE_LAYER);\r
-      PIDSlider.addInternalFrameListener(new javax.swing.event.\r
-                                                  InternalFrameAdapter()\r
-      {\r
-        public void internalFrameClosed(javax.swing.event.InternalFrameEvent e)\r
-        {\r
-          PIDSlider = null;\r
-        }\r
-      });\r
-      PIDSlider.setLayer(JLayeredPane.PALETTE_LAYER);\r
+  public static int setPIDSliderSource(AlignmentPanel ap, ColourSchemeI cs,\r
+                                       String source)\r
+  {\r
+    SliderPanel pid = null;\r
+\r
+    int threshold = 50;\r
+\r
+    if (cs instanceof ResidueColourScheme)\r
+    {\r
+      threshold = ( ( (ResidueColourScheme) cs).getThreshold());\r
+    }\r
+    else if (cs instanceof ScoreColourScheme)\r
+    {\r
+      threshold = ( ( (ScoreColourScheme) cs).getThreshold());\r
     }\r
 \r
-   }\r
+    if (PIDSlider == null)\r
+    {\r
+      pid = new SliderPanel(ap, threshold, false, cs);\r
+      PIDSlider = new JInternalFrame();\r
+      PIDSlider.setContentPane(pid);\r
+      PIDSlider.setLayer(JLayeredPane.PALETTE_LAYER);\r
+    }\r
+    else\r
+    {\r
+      pid = (SliderPanel) PIDSlider.getContentPane();\r
+      pid.cs = cs;\r
+    }\r
 \r
+    PIDSlider.setTitle("Percentage Identity Threshold (" + source + ")");\r
 \r
-  public SliderPanel(AlignmentPanel ap, int value, boolean forConserve, ColourSchemeI cs)\r
-  {\r
-    this.ap = ap;\r
-    this.cs = cs;\r
-    forConservation = forConserve;\r
-    undoButton.setVisible(false);\r
-    applyButton.setVisible(false);\r
-    if(forConservation)\r
+    if (ap.av.alignment.getGroups() != null)\r
     {\r
-      label.setText("Enter value to increase conservation visibility");\r
-      slider.setMinimum(0);\r
-      slider.setMaximum(50);\r
+      pid.setAllGroupsCheckEnabled(true);\r
     }\r
     else\r
     {\r
-      label.setText("Enter % identity above which to colour residues");\r
-      slider.setMinimum(0);\r
-      slider.setMaximum(100);\r
+      pid.setAllGroupsCheckEnabled(false);\r
     }\r
 \r
+    return pid.getValue();\r
+  }\r
 \r
+  public static void showPIDSlider()\r
+  {\r
+    try\r
+    {\r
+      conservationSlider.setClosed(true);\r
+      conservationSlider = null;\r
+    }\r
+    catch (Exception ex)\r
+    {\r
+    }\r
 \r
-    slider.addChangeListener( new ChangeListener()\r
+    if (!PIDSlider.isVisible())\r
     {\r
-      public void stateChanged(ChangeEvent evt)\r
+      Desktop.addInternalFrame(PIDSlider, PIDSlider.getTitle(), 420, 90,\r
+                               false);\r
+      PIDSlider.setLayer(JLayeredPane.PALETTE_LAYER);\r
+      PIDSlider.addInternalFrameListener(new javax.swing.event.\r
+                                         InternalFrameAdapter()\r
       {\r
-        valueField.setText( slider.getValue()+"" );\r
-        valueChanged( slider.getValue() );\r
-      }\r
-    });\r
-\r
-    slider.setValue(value);\r
-    valueField.setText(value+"");\r
+        public void internalFrameClosed(\r
+            javax.swing.event.InternalFrameEvent e)\r
+        {\r
+          PIDSlider = null;\r
+        }\r
+      });\r
+      PIDSlider.setLayer(JLayeredPane.PALETTE_LAYER);\r
+    }\r
   }\r
 \r
   public void valueChanged(int i)\r
   {\r
-    if(cs == null)\r
+    if (cs == null)\r
+    {\r
       return;\r
+    }\r
 \r
     ColourSchemeI toChange = null;\r
     Vector allGroups = null;\r
     int groupIndex = 0;\r
 \r
-    if(allGroupsCheck.isSelected())\r
+    if (allGroupsCheck.isSelected())\r
     {\r
       allGroups = ap.av.alignment.getGroups();\r
-      groupIndex = allGroups.size()-1;\r
+      groupIndex = allGroups.size() - 1;\r
     }\r
     else\r
+    {\r
       toChange = cs;\r
+    }\r
 \r
-\r
-    while( groupIndex > -1 )\r
+    while (groupIndex > -1)\r
     {\r
-      if(allGroups!=null)\r
-        toChange = ((SequenceGroup)allGroups.get(groupIndex)).cs;\r
+      if (allGroups != null)\r
+      {\r
+        toChange = ( (SequenceGroup) allGroups.get(groupIndex)).cs;\r
+      }\r
 \r
       if (forConservation)\r
       {\r
         if (toChange instanceof ConservationColourScheme)\r
+        {\r
           ( (ConservationColourScheme) toChange).inc = i;\r
+        }\r
       }\r
       else\r
       {\r
-          ( (ResidueColourScheme) toChange).setThreshold(i);\r
+        ( (ResidueColourScheme) toChange).setThreshold(i);\r
       }\r
 \r
       groupIndex--;\r
     }\r
 \r
     ap.seqPanel.seqCanvas.repaint();\r
-\r
   }\r
 \r
   public void setAllGroupsCheckEnabled(boolean b)\r
@@ -226,16 +257,16 @@ public class SliderPanel extends GSliderPanel
     allGroupsCheck.setEnabled(b);\r
   }\r
 \r
-\r
   public void valueField_actionPerformed(ActionEvent e)\r
   {\r
-    try{\r
+    try\r
+    {\r
       int i = Integer.parseInt(valueField.getText());\r
       slider.setValue(i);\r
     }\r
-    catch(Exception ex)\r
+    catch (Exception ex)\r
     {\r
-      valueField.setText( slider.getValue()+"" );\r
+      valueField.setText(slider.getValue() + "");\r
     }\r
   }\r
 \r
@@ -243,10 +274,9 @@ public class SliderPanel extends GSliderPanel
   {\r
     slider.setValue(value);\r
   }\r
+\r
   public int getValue()\r
   {\r
     return Integer.parseInt(valueField.getText());\r
   }\r
-\r
-\r
 }\r
index 794bbb8..6edab5d 100755 (executable)
@@ -1,66 +1,78 @@
 /*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 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
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
+ */\r
 package jalview.gui;\r
 \r
-import javax.swing.*;\r
 import java.awt.*;\r
 import java.awt.event.*;\r
+import javax.swing.*;\r
 \r
-public class SplashScreen extends JPanel implements Runnable\r
+public class SplashScreen\r
+    extends JPanel implements Runnable\r
 {\r
   boolean visible = true;\r
   JInternalFrame iframe;\r
   Image image;\r
+  int fontSize = 11;\r
+  int yoffset = 30;\r
 \r
   public SplashScreen(JInternalFrame iframe, Image i)\r
   {\r
     this.iframe = iframe;\r
     image = i;\r
+\r
     Thread t = new Thread(this);\r
     t.start();\r
     addMouseListener(new MouseAdapter()\r
-    { public void mousePressed(MouseEvent evt)\r
+    {\r
+      public void mousePressed(MouseEvent evt)\r
       {\r
         try\r
-        {   closeSplash();  }\r
+        {\r
+          closeSplash();\r
+        }\r
         catch (Exception ex)\r
-        {}\r
+        {\r
+        }\r
       }\r
-      });\r
+    });\r
   }\r
 \r
-\r
   public void run()\r
   {\r
-    long startTime =  System.currentTimeMillis()/1000;\r
+    long startTime = System.currentTimeMillis() / 1000;\r
 \r
-    while( visible )\r
+    while (visible)\r
     {\r
-      if( System.currentTimeMillis()/1000 - startTime > 5)\r
+      if ( ( (System.currentTimeMillis() / 1000) - startTime) > 5)\r
+      {\r
         visible = false;\r
+      }\r
 \r
-      try{\r
+      try\r
+      {\r
         Thread.sleep(1000);\r
       }\r
-      catch(Exception ex){}\r
+      catch (Exception ex)\r
+      {\r
+      }\r
     }\r
+\r
     closeSplash();\r
   }\r
 \r
@@ -71,29 +83,36 @@ public class SplashScreen extends JPanel implements Runnable
       iframe.setClosed(true);\r
     }\r
     catch (Exception ex)\r
-    {}\r
-\r
+    {\r
+    }\r
   }\r
 \r
-  int fontSize = 11;\r
-  int yoffset = 30;\r
   public void paintComponent(Graphics g)\r
   {\r
     g.setColor(Color.white);\r
-    g.fillRect(0,0,getWidth(),getHeight());\r
+    g.fillRect(0, 0, getWidth(), getHeight());\r
     g.setColor(Color.black);\r
-    g.setFont( new Font("Verdana", Font.BOLD, fontSize+6));\r
-    if(image!=null)\r
-    g.drawImage(image, 5,yoffset+12,this);\r
-    g.drawString("JalView 2005 ", 50,yoffset);\r
-    g.setFont( new Font("Verdana", Font.BOLD, fontSize+2));\r
-    g.drawString("Version "+jalview.bin.Cache.VERSION+"; Last updated: "+jalview.bin.Cache.BUILD_DATE, 180,yoffset);\r
-    g.setFont( new Font("Verdana", Font.BOLD, fontSize));\r
-    g.drawString("Authors: Michele Clamp, James Cuff, Steve Searle, Andrew Waterhouse, Jim Procter & Geoff Barton.",50,yoffset+20);\r
-    g.drawString("Current development managed by Andrew Waterhouse; Barton Group, University of Dundee.",50,yoffset+24+fontSize);\r
-    g.drawString("If  you use JalView, please cite: Clamp, M., Cuff, J., Searle, S. M. and Barton, G. J. (2004),",50,yoffset+28+fontSize*2);\r
-    g.drawString("\"The Jalview Java Alignment Editor\" Bioinformatics,  2004 12;426-7.",50,yoffset+32+fontSize*3);\r
+    g.setFont(new Font("Verdana", Font.BOLD, fontSize + 6));\r
 \r
-  }\r
+    if (image != null)\r
+    {\r
+      g.drawImage(image, 5, yoffset + 12, this);\r
+    }\r
 \r
+    g.drawString("JalView 2005 ", 50, yoffset);\r
+    g.setFont(new Font("Verdana", Font.BOLD, fontSize + 2));\r
+    g.drawString("Version " + jalview.bin.Cache.VERSION +\r
+                 "; Last updated: " + jalview.bin.Cache.BUILD_DATE, 180,\r
+                 yoffset);\r
+    g.setFont(new Font("Verdana", Font.BOLD, fontSize));\r
+    g.drawString("Authors: Michele Clamp, James Cuff, Steve Searle, Andrew Waterhouse, Jim Procter & Geoff Barton.",\r
+                 50, yoffset + 20);\r
+    g.drawString("Current development managed by Andrew Waterhouse; Barton Group, University of Dundee.",\r
+                 50, yoffset + 24 + fontSize);\r
+    g.drawString("If  you use JalView, please cite: Clamp, M., Cuff, J., Searle, S. M. and Barton, G. J. (2004),",\r
+                 50, yoffset + 28 + (fontSize * 2));\r
+    g.drawString(\r
+        "\"The Jalview Java Alignment Editor\" Bioinformatics,  2004 12;426-7.",\r
+        50, yoffset + 32 + (fontSize * 3));\r
+  }\r
 }\r
index 5ebf323..12416ae 100755 (executable)
@@ -1,68 +1,65 @@
 /*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 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
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
+ */\r
 package jalview.gui;\r
 \r
+import java.util.*;\r
 \r
-import jalview.analysis.*;\r
-import jalview.datamodel.*;\r
-import jalview.util.*;\r
-import jalview.schemes.*;\r
-import javax.swing.*;\r
 import java.awt.*;\r
 import java.awt.event.*;\r
-import java.util.*;\r
 import java.awt.print.*;\r
+import javax.swing.*;\r
 \r
-public class TreeCanvas extends JPanel implements MouseListener, Runnable, Printable\r
+import jalview.analysis.*;\r
+import jalview.datamodel.*;\r
+import jalview.schemes.*;\r
+import jalview.util.*;\r
+\r
+public class TreeCanvas\r
+    extends JPanel implements MouseListener, Runnable,\r
+    Printable\r
 {\r
+  public static final String PLACEHOLDER = " * ";\r
   NJTree tree;\r
   JScrollPane scrollPane;\r
   AlignViewport av;\r
-  public static final String PLACEHOLDER=" * ";\r
   Font font;\r
-  int  fontSize = 12;\r
-\r
+  int fontSize = 12;\r
   boolean fitToWindow = true;\r
   boolean showDistances = false;\r
   boolean showBootstrap = false;\r
   boolean markPlaceholders = false;\r
-\r
   int offx = 20;\r
   int offy = 20;\r
-\r
   float threshold;\r
-\r
   String longestName;\r
-  int labelLength=-1;\r
+  int labelLength = -1;\r
 \r
   //RubberbandRectangle rubberband;\r
-\r
-  Vector    listeners;\r
-\r
+  Vector listeners;\r
   Hashtable nameHash = new Hashtable();\r
   Hashtable nodeHash = new Hashtable();\r
 \r
-  public TreeCanvas(AlignViewport av, NJTree tree, JScrollPane scroller, String label)\r
+  public TreeCanvas(AlignViewport av, NJTree tree, JScrollPane scroller,\r
+                    String label)\r
   {\r
     this.av = av;\r
-    this.tree     = tree;\r
+    this.tree = tree;\r
     scrollPane = scroller;\r
     addMouseListener(this);\r
     tree.findHeight(tree.getTopNode());\r
@@ -70,10 +67,12 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable, Print
 \r
     PaintRefresher.Register(this);\r
   }\r
+\r
   public void TreeSelectionChanged(Sequence sequence)\r
- {\r
+  {\r
     SequenceGroup selected = av.getSelectionGroup();\r
-    if(selected == null)\r
+\r
+    if (selected == null)\r
     {\r
       selected = new SequenceGroup();\r
       av.setSelectionGroup(selected);\r
@@ -82,205 +81,259 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable, Print
     selected.setEndRes(av.alignment.getWidth());\r
     selected.addOrRemove(sequence);\r
 \r
-\r
     PaintRefresher.Refresh(this);\r
     repaint();\r
- }\r
-\r
-\r
+  }\r
 \r
-  public void setTree(NJTree tree) {\r
+  public void setTree(NJTree tree)\r
+  {\r
     this.tree = tree;\r
     tree.findHeight(tree.getTopNode());\r
   }\r
 \r
-    public void drawNode(Graphics g,SequenceNode node, float chunk, float scale, int width,int offx, int offy) {\r
-    if (node == null) {\r
+  public void drawNode(Graphics g, SequenceNode node, float chunk,\r
+                       float scale, int width, int offx, int offy)\r
+  {\r
+    if (node == null)\r
+    {\r
       return;\r
     }\r
 \r
-    if (node.left() == null && node.right() == null) {\r
+    if ( (node.left() == null) && (node.right() == null))\r
+    {\r
       // Drawing leaf node\r
-\r
       float height = node.height;\r
-      float dist   = node.dist;\r
+      float dist = node.dist;\r
 \r
-      int xstart = (int)((height-dist)*scale) + offx;\r
-      int xend =   (int)(height*scale)        + offx;\r
+      int xstart = (int) ( (height - dist) * scale) + offx;\r
+      int xend = (int) (height * scale) + offx;\r
 \r
-      int ypos = (int)(node.ycount * chunk) + offy;\r
+      int ypos = (int) (node.ycount * chunk) + offy;\r
 \r
       if (node.element() instanceof SequenceI)\r
       {\r
-       if ( ( (SequenceI) ( (SequenceNode) node).element()).getColor() == Color.white)\r
-       {\r
-         g.setColor(Color.black);\r
-       }\r
-       else\r
-        g.setColor( ( (SequenceI) ( (SequenceNode) node).element()).getColor().\r
-                   darker());\r
-\r
+        if ( ( (SequenceI) ( (SequenceNode) node).element()).getColor() ==\r
+            Color.white)\r
+        {\r
+          g.setColor(Color.black);\r
+        }\r
+        else\r
+        {\r
+          g.setColor( ( (SequenceI) ( (SequenceNode) node).element()).getColor()\r
+                     .darker());\r
+        }\r
       }\r
       else\r
-          g.setColor(Color.black);\r
-\r
+      {\r
+        g.setColor(Color.black);\r
+      }\r
 \r
       // Draw horizontal line\r
-      g.drawLine(xstart,ypos,xend,ypos);\r
+      g.drawLine(xstart, ypos, xend, ypos);\r
 \r
       String nodeLabel = "";\r
-      if (showDistances && node.dist > 0) {\r
+\r
+      if (showDistances && (node.dist > 0))\r
+      {\r
         nodeLabel = new Format("%5.2f").form(node.dist);\r
       }\r
-      if (showBootstrap) {\r
-        if (showDistances) {\r
+\r
+      if (showBootstrap)\r
+      {\r
+        if (showDistances)\r
+        {\r
           nodeLabel = nodeLabel + " : ";\r
         }\r
+\r
         nodeLabel = nodeLabel + String.valueOf(node.getBootstrap());\r
       }\r
-      if (! nodeLabel.equals("")) {\r
-      g.drawString(nodeLabel,xstart,ypos - 10);\r
+\r
+      if (!nodeLabel.equals(""))\r
+      {\r
+        g.drawString(nodeLabel, xstart, ypos - 10);\r
       }\r
 \r
-      String name    = (markPlaceholders && node.isPlaceholder()) ? (PLACEHOLDER+node.getName()) : node.getName();\r
+      String name = (markPlaceholders && node.isPlaceholder())\r
+          ? (PLACEHOLDER + node.getName()) : node.getName();\r
       FontMetrics fm = g.getFontMetrics(font);\r
-      int charWidth  = fm.stringWidth(name) + 3;\r
+      int charWidth = fm.stringWidth(name) + 3;\r
       int charHeight = fm.getHeight();\r
 \r
-      Rectangle rect = new Rectangle(xend+20,ypos-charHeight,\r
-                                     charWidth,charHeight);\r
+      Rectangle rect = new Rectangle(xend + 20, ypos - charHeight,\r
+                                     charWidth, charHeight);\r
 \r
-      nameHash.put((SequenceI)node.element(),rect);\r
+      nameHash.put( (SequenceI) node.element(), rect);\r
 \r
       // Colour selected leaves differently\r
       SequenceGroup selected = av.getSelectionGroup();\r
-      if (selected!=null && selected.sequences.contains((SequenceI)node.element())) {\r
+\r
+      if ( (selected != null) &&\r
+          selected.sequences.contains( (SequenceI) node.element()))\r
+      {\r
         g.setColor(Color.gray);\r
 \r
-        g.fillRect(xend + 10, ypos - charHeight + 3,charWidth,charHeight);\r
+        g.fillRect(xend + 10, ypos - charHeight + 3, charWidth,\r
+                   charHeight);\r
         g.setColor(Color.white);\r
       }\r
-      g.drawString(name,xend+10,ypos);\r
+\r
+      g.drawString(name, xend + 10, ypos);\r
       g.setColor(Color.black);\r
-    } else {\r
-      drawNode(g,(SequenceNode)node.left(), chunk,scale,width,offx,offy);\r
-      drawNode(g,(SequenceNode)node.right(),chunk,scale,width,offx,offy);\r
+    }\r
+    else\r
+    {\r
+      drawNode(g, (SequenceNode) node.left(), chunk, scale, width, offx,\r
+               offy);\r
+      drawNode(g, (SequenceNode) node.right(), chunk, scale, width, offx,\r
+               offy);\r
 \r
       float height = node.height;\r
-      float dist   = node.dist;\r
+      float dist = node.dist;\r
 \r
-      int xstart = (int)((height-dist)*scale) + offx;\r
-      int xend   = (int)(height       *scale) + offx;\r
-      int ypos   = (int)(node.ycount  *chunk) + offy;\r
+      int xstart = (int) ( (height - dist) * scale) + offx;\r
+      int xend = (int) (height * scale) + offx;\r
+      int ypos = (int) (node.ycount * chunk) + offy;\r
 \r
-      g.setColor(((SequenceNode)node).color.darker());\r
+      g.setColor( ( (SequenceNode) node).color.darker());\r
 \r
       // Draw horizontal line\r
-      g.drawLine(xstart,ypos,xend,ypos);\r
-      g.fillRect(xend-2, ypos-2, 4,4);\r
+      g.drawLine(xstart, ypos, xend, ypos);\r
+      g.fillRect(xend - 2, ypos - 2, 4, 4);\r
 \r
-      int ystart = (int)(((SequenceNode)node.left()) .ycount * chunk) + offy;\r
-      int yend   = (int)(((SequenceNode)node.right()).ycount * chunk) + offy;\r
+      int ystart = (int) ( ( (SequenceNode) node.left()).ycount * chunk) +\r
+          offy;\r
+      int yend = (int) ( ( (SequenceNode) node.right()).ycount * chunk) +\r
+          offy;\r
 \r
-      Rectangle pos = new Rectangle(xend-2,ypos-2,5,5);\r
-      nodeHash.put(node,pos);\r
+      Rectangle pos = new Rectangle(xend - 2, ypos - 2, 5, 5);\r
+      nodeHash.put(node, pos);\r
 \r
-      g.drawLine((int)(height*scale) + offx, ystart,\r
-                 (int)(height*scale) + offx, yend);\r
+      g.drawLine( (int) (height * scale) + offx, ystart,\r
+                 (int) (height * scale) + offx, yend);\r
 \r
-      if (showDistances && node.dist > 0) {\r
-        g.drawString(new Format("%5.2f").form(node.dist),xstart,ypos - 5);\r
+      if (showDistances && (node.dist > 0))\r
+      {\r
+        g.drawString(new Format("%5.2f").form(node.dist), xstart,\r
+                     ypos - 5);\r
       }\r
-\r
     }\r
   }\r
-  public Object findElement(int x, int y) {\r
-       Enumeration keys = nameHash.keys();\r
 \r
-    while (keys.hasMoreElements()) {\r
-            Object ob = keys.nextElement();\r
-            Rectangle rect = (Rectangle)nameHash.get(ob);\r
+  public Object findElement(int x, int y)\r
+  {\r
+    Enumeration keys = nameHash.keys();\r
 \r
-            if (x >= rect.x && x <= (rect.x + rect.width) &&\r
-              y >= rect.y && y <= (rect.y + rect.height)) {\r
-              return ob;\r
-            }\r
-  }\r
-  keys = nodeHash.keys();\r
+    while (keys.hasMoreElements())\r
+    {\r
+      Object ob = keys.nextElement();\r
+      Rectangle rect = (Rectangle) nameHash.get(ob);\r
 \r
-    while (keys.hasMoreElements()) {\r
-            Object ob = keys.nextElement();\r
-            Rectangle rect = (Rectangle)nodeHash.get(ob);\r
+      if ( (x >= rect.x) && (x <= (rect.x + rect.width)) && (y >= rect.y) &&\r
+          (y <= (rect.y + rect.height)))\r
+      {\r
+        return ob;\r
+      }\r
+    }\r
 \r
-            if (x >= rect.x && x <= (rect.x + rect.width) &&\r
-              y >= rect.y && y <= (rect.y + rect.height)) {\r
-              return ob;\r
-            }\r
+    keys = nodeHash.keys();\r
+\r
+    while (keys.hasMoreElements())\r
+    {\r
+      Object ob = keys.nextElement();\r
+      Rectangle rect = (Rectangle) nodeHash.get(ob);\r
+\r
+      if ( (x >= rect.x) && (x <= (rect.x + rect.width)) && (y >= rect.y) &&\r
+          (y <= (rect.y + rect.height)))\r
+      {\r
+        return ob;\r
+      }\r
     }\r
-      return null;\r
 \r
+    return null;\r
   }\r
 \r
-  public void pickNodes(Rectangle pickBox) {\r
-    int width  = getWidth();\r
+  public void pickNodes(Rectangle pickBox)\r
+  {\r
+    int width = getWidth();\r
     int height = getHeight();\r
 \r
     SequenceNode top = tree.getTopNode();\r
 \r
-    float wscale = (float)(width*.8-offx*2)/tree.getMaxHeight()\r
-;\r
-    if (top.count == 0) {\r
-      top.count = ((SequenceNode)top.left()).count + ((SequenceNode)top.right()).count ;\r
+    float wscale = (float) ( (width * .8) - (offx * 2)) / tree.getMaxHeight();\r
+\r
+    if (top.count == 0)\r
+    {\r
+      top.count = ( (SequenceNode) top.left()).count +\r
+          ( (SequenceNode) top.right()).count;\r
     }\r
-    float chunk = (float)(height-offy*2)/top.count;\r
 \r
-    pickNode(pickBox,top,chunk,wscale,width,offx,offy);\r
+    float chunk = (float) (height - (offy * 2)) / top.count;\r
+\r
+    pickNode(pickBox, top, chunk, wscale, width, offx, offy);\r
   }\r
 \r
-  public void pickNode(Rectangle pickBox, SequenceNode node, float chunk, float scale, int width,int offx, int offy) {\r
-    if (node == null) {\r
+  public void pickNode(Rectangle pickBox, SequenceNode node, float chunk,\r
+                       float scale, int width, int offx, int offy)\r
+  {\r
+    if (node == null)\r
+    {\r
       return;\r
     }\r
 \r
-    if (node.left() == null && node.right() == null) {\r
+    if ( (node.left() == null) && (node.right() == null))\r
+    {\r
       float height = node.height;\r
-      float dist   = node.dist;\r
+      float dist = node.dist;\r
 \r
-      int xstart = (int)((height-dist)*scale) + offx;\r
-      int xend   = (int)(height*scale) + offx;\r
+      int xstart = (int) ( (height - dist) * scale) + offx;\r
+      int xend = (int) (height * scale) + offx;\r
 \r
-      int ypos = (int)(node.ycount * chunk) + offy;\r
+      int ypos = (int) (node.ycount * chunk) + offy;\r
 \r
-      if (pickBox.contains(new Point(xend,ypos))) {\r
-        if (node.element() instanceof SequenceI) {\r
-          SequenceI seq = (SequenceI)node.element();\r
+      if (pickBox.contains(new Point(xend, ypos)))\r
+      {\r
+        if (node.element() instanceof SequenceI)\r
+        {\r
+          SequenceI seq = (SequenceI) node.element();\r
           SequenceGroup sg = av.getSelectionGroup();\r
-          if(sg!=null)\r
+\r
+          if (sg != null)\r
+          {\r
             sg.addOrRemove(seq);\r
+          }\r
         }\r
       }\r
-    } else {\r
-      pickNode(pickBox,(SequenceNode)node.left(), chunk,scale,width,offx,offy);\r
-      pickNode(pickBox,(SequenceNode)node.right(),chunk,scale,width,offx,offy);\r
+    }\r
+    else\r
+    {\r
+      pickNode(pickBox, (SequenceNode) node.left(), chunk, scale, width,\r
+               offx, offy);\r
+      pickNode(pickBox, (SequenceNode) node.right(), chunk, scale, width,\r
+               offx, offy);\r
     }\r
   }\r
 \r
   public void setColor(SequenceNode node, Color c)\r
   {\r
     if (node == null)\r
+    {\r
       return;\r
+    }\r
 \r
-    if (node.left() == null && node.right() == null)\r
+    if ( (node.left() == null) && (node.right() == null))\r
     {\r
       node.color = c;\r
 \r
       if (node.element() instanceof SequenceI)\r
-          ((SequenceI)node.element()).setColor(c);\r
-    } else\r
+      {\r
+        ( (SequenceI) node.element()).setColor(c);\r
+      }\r
+    }\r
+    else\r
     {\r
       node.color = c;\r
-      setColor((SequenceNode)node.left(),c);\r
-      setColor((SequenceNode)node.right(),c);\r
+      setColor( (SequenceNode) node.left(), c);\r
+      setColor( (SequenceNode) node.right(), c);\r
     }\r
   }\r
 \r
@@ -297,6 +350,7 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable, Print
     PageFormat pf = printJob.pageDialog(printJob.defaultPage());\r
 \r
     printJob.setPrintable(this, pf);\r
+\r
     if (printJob.printDialog())\r
     {\r
       try\r
@@ -310,216 +364,259 @@ public class TreeCanvas extends JPanel implements MouseListener, Runnable, Print
     }\r
   }\r
 \r
-\r
-  public int print(Graphics pg, PageFormat pf, int pi) throws PrinterException\r
+  public int print(Graphics pg, PageFormat pf, int pi)\r
+      throws PrinterException\r
   {\r
-\r
     pg.setFont(font);\r
-    pg.translate((int)pf.getImageableX(), (int)pf.getImageableY());\r
+    pg.translate( (int) pf.getImageableX(), (int) pf.getImageableY());\r
+\r
     int pwidth = (int) pf.getImageableWidth();\r
     int pheight = (int) pf.getImageableHeight();\r
 \r
     int noPages = getHeight() / pheight;\r
-    if(pi>noPages)\r
-      return Printable.NO_SUCH_PAGE;\r
 \r
+    if (pi > noPages)\r
+    {\r
+      return Printable.NO_SUCH_PAGE;\r
+    }\r
 \r
     if (pwidth > getWidth())\r
-        pwidth = getWidth();\r
+    {\r
+      pwidth = getWidth();\r
+    }\r
 \r
-    if(fitToWindow)\r
+    if (fitToWindow)\r
     {\r
       if (pheight > getHeight())\r
+      {\r
         pheight = getHeight();\r
+      }\r
 \r
       noPages = 0;\r
     }\r
     else\r
     {\r
-\r
-        FontMetrics fm = pg.getFontMetrics(font);\r
-        int height = fm.getHeight() * nameHash.size();\r
-        pg.translate(0, -pi*pheight  );\r
-        pg.setClip(0,pi*pheight, pwidth,pi*pheight + pheight);\r
-       // translate number of pages,\r
-       // height is screen size as this is the\r
-       // non overlapping text size\r
-        pheight = height;\r
+      FontMetrics fm = pg.getFontMetrics(font);\r
+      int height = fm.getHeight() * nameHash.size();\r
+      pg.translate(0, -pi * pheight);\r
+      pg.setClip(0, pi * pheight, pwidth, (pi * pheight) + pheight);\r
+\r
+      // translate number of pages,\r
+      // height is screen size as this is the\r
+      // non overlapping text size\r
+      pheight = height;\r
     }\r
 \r
     draw(pg, pwidth, pheight);\r
 \r
     return Printable.PAGE_EXISTS;\r
-\r
   }\r
 \r
   public void paintComponent(Graphics g)\r
   {\r
-\r
-    font = new Font("Verdana",Font.PLAIN,fontSize);\r
+    font = new Font("Verdana", Font.PLAIN, fontSize);\r
     g.setFont(font);\r
 \r
     FontMetrics fm = g.getFontMetrics(font);\r
 \r
-    if(nameHash.size()==0)\r
+    if (nameHash.size() == 0)\r
+    {\r
       repaint();\r
+    }\r
 \r
-\r
-    if( fitToWindow || (!fitToWindow && scrollPane.getHeight() > fm.getHeight() * nameHash.size()+offy ) )\r
-     {\r
-         draw(g,scrollPane.getWidth(),scrollPane.getHeight());\r
-         setPreferredSize(null);\r
-     }\r
+    if (fitToWindow ||\r
+        (!fitToWindow &&\r
+         (scrollPane.getHeight() > ( (fm.getHeight() * nameHash.size()) +\r
+                                    offy))))\r
+    {\r
+      draw(g, scrollPane.getWidth(), scrollPane.getHeight());\r
+      setPreferredSize(null);\r
+    }\r
     else\r
-     {\r
-         setPreferredSize(new Dimension(scrollPane.getWidth(), fm.getHeight() * nameHash.size()));\r
-         draw( g,scrollPane.getWidth(), fm.getHeight() * nameHash.size());\r
-     }\r
+    {\r
+      setPreferredSize(new Dimension(scrollPane.getWidth(),\r
+                                     fm.getHeight() * nameHash.size()));\r
+      draw(g, scrollPane.getWidth(), fm.getHeight() * nameHash.size());\r
+    }\r
 \r
     scrollPane.revalidate();\r
   }\r
-    public int getFontSize() {\r
-        return fontSize;\r
-    }\r
-    public void setFontSize(int fontSize) {\r
-        this.fontSize = fontSize;\r
-        repaint();\r
-    }\r
-  public void draw(Graphics g1, int width, int height) {\r
 \r
-      Graphics2D g2 = (Graphics2D)g1;\r
-      g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);\r
-      g2.setColor(Color.white);\r
-      g2.fillRect(0,0,width,height);\r
+  public int getFontSize()\r
+  {\r
+    return fontSize;\r
+  }\r
 \r
+  public void setFontSize(int fontSize)\r
+  {\r
+    this.fontSize = fontSize;\r
+    repaint();\r
+  }\r
 \r
-      labelLength = g2.getFontMetrics(font).stringWidth(longestName)+ 20;//20 allows for scrollbar\r
+  public void draw(Graphics g1, int width, int height)\r
+  {\r
+    Graphics2D g2 = (Graphics2D) g1;\r
+    g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,\r
+                        RenderingHints.VALUE_ANTIALIAS_ON);\r
+    g2.setColor(Color.white);\r
+    g2.fillRect(0, 0, width, height);\r
 \r
-      float wscale =(float)(width - labelLength -offx*2)/tree.getMaxHeight();\r
+    labelLength = g2.getFontMetrics(font).stringWidth(longestName) + 20; //20 allows for scrollbar\r
 \r
-      SequenceNode top = tree.getTopNode();\r
+    float wscale = (float) (width - labelLength - (offx * 2)) /\r
+        tree.getMaxHeight();\r
 \r
-      if (top.count == 0) {\r
-          top.count = ((SequenceNode)top.left()).count + ((SequenceNode)top.right()).count ;\r
-      }\r
-      float chunk = (float)(height-offy*2)/top.count ;\r
+    SequenceNode top = tree.getTopNode();\r
 \r
-      drawNode(g2,tree.getTopNode(),chunk,wscale,width,offx,offy);\r
+    if (top.count == 0)\r
+    {\r
+      top.count = ( (SequenceNode) top.left()).count +\r
+          ( (SequenceNode) top.right()).count;\r
+    }\r
 \r
-      if (threshold != 0)\r
-      {\r
-        if(av.getCurrentTree() == tree)\r
-          g2.setColor(Color.red);\r
-        else\r
-          g2.setColor(Color.gray);\r
+    float chunk = (float) (height - (offy * 2)) / top.count;\r
 \r
-          int x = (int)(    threshold * (float)(getWidth()-labelLength - 2*offx) +offx   ) ;\r
+    drawNode(g2, tree.getTopNode(), chunk, wscale, width, offx, offy);\r
 \r
-          g2.drawLine(x,0,x,getHeight());\r
+    if (threshold != 0)\r
+    {\r
+      if (av.getCurrentTree() == tree)\r
+      {\r
+        g2.setColor(Color.red);\r
       }\r
-\r
-  }\r
-\r
-  public void mouseReleased(MouseEvent e) { }\r
-  public void mouseEntered(MouseEvent e) { }\r
-  public void mouseExited(MouseEvent e) { }\r
-  public void mouseClicked(MouseEvent e) {\r
-  }\r
-\r
-  public void mousePressed(MouseEvent e) {\r
-\r
-      av.setCurrentTree(tree);\r
-\r
-      int x = e.getX();\r
-      int y = e.getY();\r
-\r
-      Object ob = findElement(x,y);\r
-\r
-      if (ob instanceof SequenceI)\r
+      else\r
       {\r
-          TreeSelectionChanged((Sequence)ob);\r
-          repaint();\r
-          return;\r
-\r
-      } else if (ob instanceof SequenceNode) {\r
-          SequenceNode tmpnode = (SequenceNode)ob;\r
-          tree.swapNodes(tmpnode);\r
-          tree.reCount(tree.getTopNode());\r
-          tree.findHeight(tree.getTopNode());\r
-      } else {\r
-          // Find threshold\r
+        g2.setColor(Color.gray);\r
+      }\r
 \r
-          if (tree.getMaxHeight() != 0) {\r
-              threshold = (float)(x - offx)/(float)(getWidth()-labelLength - 2*offx);\r
+      int x = (int) ( (threshold * (float) (getWidth() - labelLength -\r
+                                            (2 * offx))) + offx);\r
 \r
-              tree.getGroups().removeAllElements();\r
-              tree.groupNodes(tree.getTopNode(),threshold);\r
-              setColor(tree.getTopNode(),Color.black);\r
+      g2.drawLine(x, 0, x, getHeight());\r
+    }\r
+  }\r
 \r
-              av.setSelectionGroup(null);\r
-              av.alignment.deleteAllGroups();\r
+  public void mouseReleased(MouseEvent e)\r
+  {\r
+  }\r
 \r
-              for (int i=0; i < tree.getGroups().size(); i++)\r
-              {\r
+  public void mouseEntered(MouseEvent e)\r
+  {\r
+  }\r
 \r
-                  Color col = new Color((int)(Math.random()*255),\r
-                                        (int)(Math.random()*255),\r
-                                        (int)(Math.random()*255));\r
-                  setColor((SequenceNode)tree.getGroups().elementAt(i),col.brighter());\r
+  public void mouseExited(MouseEvent e)\r
+  {\r
+  }\r
 \r
-                  Vector l = tree.findLeaves((SequenceNode)tree.getGroups().elementAt(i),new Vector());\r
-                  SequenceGroup sg = null;\r
-                  for (int j = 0; j < l.size(); j++)\r
-                  {\r
-                    SequenceNode sn = (SequenceNode) l.elementAt(j);\r
-                    if(sg==null)\r
-                       sg = new SequenceGroup("TreeGroup", av.getGlobalColourScheme(), true, true,false,0,av.alignment.getWidth());\r
+  public void mouseClicked(MouseEvent e)\r
+  {\r
+  }\r
 \r
-                    sg.addSequence( (Sequence) sn.element());\r
-                  }\r
+  public void mousePressed(MouseEvent e)\r
+  {\r
+    av.setCurrentTree(tree);\r
 \r
-                  if (av.getGlobalColourScheme() instanceof ConservationColourScheme)\r
-                  {\r
-                    ConservationColourScheme ccs = (ConservationColourScheme) av.getGlobalColourScheme();\r
-                    Conservation c = new Conservation("Group",\r
-                                                      ResidueProperties.propHash, 3,\r
-                                                      sg.sequences, sg.getStartRes(),\r
-                                                      sg.getEndRes());\r
+    int x = e.getX();\r
+    int y = e.getY();\r
 \r
-                    c.calculate();\r
-                    c.verdict(false, av.ConsPercGaps);\r
-                    ccs = new ConservationColourScheme(c, ccs.cs);\r
+    Object ob = findElement(x, y);\r
 \r
-                    sg.cs = ccs;\r
+    if (ob instanceof SequenceI)\r
+    {\r
+      TreeSelectionChanged( (Sequence) ob);\r
+      repaint();\r
 \r
-                  }\r
+      return;\r
+    }\r
+    else if (ob instanceof SequenceNode)\r
+    {\r
+      SequenceNode tmpnode = (SequenceNode) ob;\r
+      tree.swapNodes(tmpnode);\r
+      tree.reCount(tree.getTopNode());\r
+      tree.findHeight(tree.getTopNode());\r
+    }\r
+    else\r
+    {\r
+      // Find threshold\r
+      if (tree.getMaxHeight() != 0)\r
+      {\r
+        threshold = (float) (x - offx) / (float) (getWidth() -\r
+                                                  labelLength - (2 * offx));\r
+\r
+        tree.getGroups().removeAllElements();\r
+        tree.groupNodes(tree.getTopNode(), threshold);\r
+        setColor(tree.getTopNode(), Color.black);\r
+\r
+        av.setSelectionGroup(null);\r
+        av.alignment.deleteAllGroups();\r
+\r
+        for (int i = 0; i < tree.getGroups().size(); i++)\r
+        {\r
+          Color col = new Color( (int) (Math.random() * 255),\r
+                                (int) (Math.random() * 255),\r
+                                (int) (Math.random() * 255));\r
+          setColor( (SequenceNode) tree.getGroups().elementAt(i),\r
+                   col.brighter());\r
+\r
+          Vector l = tree.findLeaves( (SequenceNode) tree.getGroups()\r
+                                     .elementAt(i),\r
+                                     new Vector());\r
+          SequenceGroup sg = null;\r
+\r
+          for (int j = 0; j < l.size(); j++)\r
+          {\r
+            SequenceNode sn = (SequenceNode) l.elementAt(j);\r
+\r
+            if (sg == null)\r
+            {\r
+              sg = new SequenceGroup("TreeGroup",\r
+                                     av.getGlobalColourScheme(), true, true,\r
+                                     false, 0, av.alignment.getWidth());\r
+            }\r
 \r
+            sg.addSequence( (Sequence) sn.element());\r
+          }\r
 \r
+          if (av.getGlobalColourScheme() instanceof ConservationColourScheme)\r
+          {\r
+            ConservationColourScheme ccs = (ConservationColourScheme) av.\r
+                getGlobalColourScheme();\r
+            Conservation c = new Conservation("Group",\r
+                                              ResidueProperties.propHash, 3,\r
+                                              sg.sequences,\r
+                                              sg.getStartRes(), sg.getEndRes());\r
 \r
-                  av.alignment.addGroup(sg);\r
+            c.calculate();\r
+            c.verdict(false, av.ConsPercGaps);\r
+            ccs = new ConservationColourScheme(c, ccs.cs);\r
 \r
-              }\r
+            sg.cs = ccs;\r
           }\r
-      }\r
 \r
-      PaintRefresher.Refresh(this);\r
-      repaint();\r
+          av.alignment.addGroup(sg);\r
+        }\r
+      }\r
+    }\r
 \r
+    PaintRefresher.Refresh(this);\r
+    repaint();\r
   }\r
 \r
-    public void setShowDistances(boolean state) {\r
-        this.showDistances = state;\r
-        repaint();\r
-    }\r
+  public void setShowDistances(boolean state)\r
+  {\r
+    this.showDistances = state;\r
+    repaint();\r
+  }\r
 \r
-    public void setShowBootstrap(boolean state) {\r
-      this.showBootstrap = state;\r
-      repaint();\r
-    }\r
-    public void setMarkPlaceholders(boolean state) {\r
-            this.markPlaceholders = state;\r
-            repaint();\r
-    }\r
+  public void setShowBootstrap(boolean state)\r
+  {\r
+    this.showBootstrap = state;\r
+    repaint();\r
+  }\r
 \r
+  public void setMarkPlaceholders(boolean state)\r
+  {\r
+    this.markPlaceholders = state;\r
+    repaint();\r
+  }\r
 }\r
-\r
index a574795..2a8c9b4 100755 (executable)
@@ -1,40 +1,40 @@
 /*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 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
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
+ */\r
 package jalview.gui;\r
 \r
-import jalview.datamodel.*;\r
-import jalview.analysis.*;\r
-import jalview.jbgui.GTreePanel;\r
-import jalview.io.*;\r
-import java.awt.event.*;\r
-import java.util.*;\r
 import java.io.*;\r
-import javax.swing.*;\r
-import java.awt.*;\r
-import java.awt.image.*;\r
-import org.jibble.epsgraphics.*;\r
+import java.util.*;\r
 import javax.imageio.*;\r
 \r
+import java.awt.*;\r
+import java.awt.event.*;\r
+import java.awt.image.*;\r
+import javax.swing.*;\r
 \r
+import org.jibble.epsgraphics.*;\r
+import jalview.analysis.*;\r
+import jalview.datamodel.*;\r
+import jalview.io.*;\r
+import jalview.jbgui.*;\r
 \r
-public class TreePanel extends GTreePanel\r
+public class TreePanel\r
+    extends GTreePanel\r
 {\r
   SequenceI[] seq;\r
   String type;\r
@@ -45,12 +45,8 @@ public class TreePanel extends GTreePanel
   TreeCanvas treeCanvas;\r
   NJTree tree;\r
 \r
-  public NJTree getTree()\r
-  {\r
-    return tree;\r
-  }\r
-\r
-  public TreePanel(AlignViewport av, Vector seqVector, String type, String pwtype, int s, int e)\r
+  public TreePanel(AlignViewport av, Vector seqVector, String type,\r
+                   String pwtype, int s, int e)\r
   {\r
     super();\r
 \r
@@ -61,12 +57,16 @@ public class TreePanel extends GTreePanel
     end = e;\r
 \r
     String longestName = "";\r
-    seq = new Sequence [seqVector.size()];\r
-    for (int i=0;i < seqVector.size();i++)\r
+    seq = new Sequence[seqVector.size()];\r
+\r
+    for (int i = 0; i < seqVector.size(); i++)\r
     {\r
       seq[i] = (Sequence) seqVector.elementAt(i);\r
-      if(seq[i].getName().length()>longestName.length())\r
+\r
+      if (seq[i].getName().length() > longestName.length())\r
+      {\r
         longestName = seq[i].getName();\r
+      }\r
     }\r
 \r
     tree = new NJTree(seq, type, pwtype, start, end);\r
@@ -77,108 +77,145 @@ public class TreePanel extends GTreePanel
     tree.reCount(tree.getTopNode());\r
     tree.findHeight(tree.getTopNode());\r
     scrollPane.setViewportView(treeCanvas);\r
-\r
   }\r
-  private void setViewStateFromTreeCanvas(TreeCanvas tree) {\r
-    // update view menu state from treeCanvas render state\r
-    distanceMenu.setSelected(tree.showDistances);\r
-    bootstrapMenu.setSelected(tree.showBootstrap);\r
-    placeholdersMenu.setSelected(tree.markPlaceholders);\r
-  }\r
-\r
-  private void setTreeCanvasFromViewState(TreeCanvas tree) {\r
-      // update view menu state from treeCanvas render state\r
-      tree.showDistances = distanceMenu.isSelected();\r
-      tree.showBootstrap = bootstrapMenu.isSelected();\r
-      tree.markPlaceholders = placeholdersMenu.isSelected();\r
-    }\r
-\r
 \r
   public TreePanel(AlignViewport av, Vector seqVector, NewickFile newtree,\r
                    String type, String pwtype)\r
+  {\r
+    super();\r
+\r
+    // These are probably only  arbitrary strings reflecting source of tree\r
+    this.type = type;\r
+    this.pwtype = pwtype;\r
+\r
+    start = 0;\r
+    end = seqVector.size();\r
+\r
+    String longestName = "";\r
+    seq = new Sequence[seqVector.size()];\r
+\r
+    for (int i = 0; i < seqVector.size(); i++)\r
     {\r
-      super();\r
-      // These are probably only  arbitrary strings reflecting source of tree\r
-      this.type = type;\r
-      this.pwtype = pwtype;\r
+      seq[i] = (Sequence) seqVector.elementAt(i);\r
+    }\r
+\r
+    // This constructor matches sequence names to treenodes and sets up the tree layouts.\r
+    tree = new NJTree(seq, newtree);\r
+\r
+    // Now have to calculate longest name based on the leaves\r
+    Vector leaves = tree.findLeaves(tree.getTopNode(), new Vector());\r
+    boolean has_placeholders = false;\r
 \r
-      start = 0;\r
-      end = seqVector.size();\r
+    for (int i = 0; i < leaves.size(); i++)\r
+    {\r
+      SequenceNode lf = (SequenceNode) leaves.elementAt(i);\r
 \r
-      String longestName = "";\r
-      seq = new Sequence [seqVector.size()];\r
-      for (int i=0;i < seqVector.size();i++)\r
+      if (lf.isPlaceholder())\r
       {\r
-        seq[i] = (Sequence) seqVector.elementAt(i);\r
+        has_placeholders = true;\r
       }\r
-      // This constructor matches sequence names to treenodes and sets up the tree layouts.\r
-      tree = new NJTree(seq, newtree);\r
-      // Now have to calculate longest name based on the leaves\r
-      Vector leaves = tree.findLeaves(tree.getTopNode(),new Vector());\r
-      boolean has_placeholders = false;\r
-      for (int i=0;i < leaves.size();i++) {\r
-        SequenceNode lf = (SequenceNode) leaves.elementAt(i);\r
-        if (lf.isPlaceholder())\r
-          has_placeholders = true;\r
-        if (longestName.length()<((Sequence) lf.element()).getName().length())\r
-          longestName = TreeCanvas.PLACEHOLDER+((Sequence) lf.element()).getName();\r
+\r
+      if (longestName.length() < ( (Sequence) lf.element()).getName()\r
+          .length())\r
+      {\r
+        longestName = TreeCanvas.PLACEHOLDER +\r
+            ( (Sequence) lf.element()).getName();\r
       }\r
-      tree.reCount(tree.getTopNode());\r
-      tree.findHeight(tree.getTopNode());\r
-\r
-      treeCanvas = new TreeCanvas(av, tree, scrollPane, longestName);\r
-      treeCanvas.setShowBootstrap(newtree.HasBootstrap());\r
-      treeCanvas.setShowDistances(newtree.HasDistances());\r
-      scrollPane.setViewportView(treeCanvas);\r
-      treeCanvas.setMarkPlaceholders(has_placeholders);\r
-      setViewStateFromTreeCanvas(treeCanvas);\r
-      // JBPNote TODO: preference for always marking placeholders in new associated tree\r
     }\r
 \r
+    tree.reCount(tree.getTopNode());\r
+    tree.findHeight(tree.getTopNode());\r
 \r
-    public void textbox_actionPerformed(ActionEvent e)\r
-    {\r
-      CutAndPasteTransfer cap = new CutAndPasteTransfer();\r
+    treeCanvas = new TreeCanvas(av, tree, scrollPane, longestName);\r
+    treeCanvas.setShowBootstrap(newtree.HasBootstrap());\r
+    treeCanvas.setShowDistances(newtree.HasDistances());\r
+    scrollPane.setViewportView(treeCanvas);\r
+    treeCanvas.setMarkPlaceholders(has_placeholders);\r
+    setViewStateFromTreeCanvas(treeCanvas);\r
+\r
+    // JBPNote TODO: preference for always marking placeholders in new associated tree\r
+  }\r
 \r
-      StringBuffer buffer = new StringBuffer();\r
+  public NJTree getTree()\r
+  {\r
+    return tree;\r
+  }\r
 \r
-      if(type.equals("AV"))\r
-        buffer.append("Average distance tree using ");\r
-      else\r
-        buffer.append("Neighbour joining tree using ");\r
+  private void setViewStateFromTreeCanvas(TreeCanvas tree)\r
+  {\r
+    // update view menu state from treeCanvas render state\r
+    distanceMenu.setSelected(tree.showDistances);\r
+    bootstrapMenu.setSelected(tree.showBootstrap);\r
+    placeholdersMenu.setSelected(tree.markPlaceholders);\r
+  }\r
 \r
-      if(pwtype.equals("BL"))\r
-       buffer.append("BLOSUM62");\r
-      else\r
-        buffer.append("PID");\r
+  private void setTreeCanvasFromViewState(TreeCanvas tree)\r
+  {\r
+    // update view menu state from treeCanvas render state\r
+    tree.showDistances = distanceMenu.isSelected();\r
+    tree.showBootstrap = bootstrapMenu.isSelected();\r
+    tree.markPlaceholders = placeholdersMenu.isSelected();\r
+  }\r
 \r
-      Desktop.addInternalFrame(cap,buffer.toString(), 500, 100);\r
-      jalview.io.NewickFile fout = new jalview.io.NewickFile(tree.getTopNode());\r
-      cap.setText(  fout.print(false,true) );\r
+  public void textbox_actionPerformed(ActionEvent e)\r
+  {\r
+    CutAndPasteTransfer cap = new CutAndPasteTransfer();\r
 \r
-    }\r
+    StringBuffer buffer = new StringBuffer();\r
 \r
+    if (type.equals("AV"))\r
+    {\r
+      buffer.append("Average distance tree using ");\r
+    }\r
+    else\r
+    {\r
+      buffer.append("Neighbour joining tree using ");\r
+    }\r
 \r
-    public void saveAsNewick_actionPerformed(ActionEvent e)\r
+    if (pwtype.equals("BL"))\r
+    {\r
+      buffer.append("BLOSUM62");\r
+    }\r
+    else\r
     {\r
+      buffer.append("PID");\r
+    }\r
 \r
-  JalviewFileChooser chooser = new JalviewFileChooser(jalview.bin.Cache.\r
-        getProperty("LAST_DIRECTORY"));\r
+    Desktop.addInternalFrame(cap, buffer.toString(), 500, 100);\r
+\r
+    jalview.io.NewickFile fout = new jalview.io.NewickFile(tree.getTopNode());\r
+    cap.setText(fout.print(false, true));\r
+  }\r
+\r
+  public void saveAsNewick_actionPerformed(ActionEvent e)\r
+  {\r
+    JalviewFileChooser chooser = new JalviewFileChooser(jalview.bin.Cache.\r
+        getProperty(\r
+            "LAST_DIRECTORY"));\r
     chooser.setFileView(new JalviewFileView());\r
     chooser.setDialogTitle("Save tree as newick file");\r
     chooser.setToolTipText("Save");\r
+\r
     int value = chooser.showSaveDialog(null);\r
-    if (value == JalviewFileChooser.APPROVE_OPTION) {\r
-      String choice =  chooser.getSelectedFile().getPath();\r
-      jalview.bin.Cache.setProperty("LAST_DIRECTORY",  chooser.getSelectedFile().getParent());\r
-      try{\r
+\r
+    if (value == JalviewFileChooser.APPROVE_OPTION)\r
+    {\r
+      String choice = chooser.getSelectedFile().getPath();\r
+      jalview.bin.Cache.setProperty("LAST_DIRECTORY",\r
+                                    chooser.getSelectedFile().getParent());\r
+\r
+      try\r
+      {\r
         jalview.io.NewickFile fout = new jalview.io.NewickFile(tree.getTopNode());\r
-        String output = fout.print(false,true); // distances only\r
-        java.io.PrintWriter out = new java.io.PrintWriter( new java.io.FileWriter( choice )  );\r
+        String output = fout.print(false, true); // distances only\r
+        java.io.PrintWriter out = new java.io.PrintWriter(new java.io.\r
+            FileWriter(\r
+                choice));\r
         out.println(output);\r
         out.close();\r
       }\r
-      catch (Exception ex) {\r
+      catch (Exception ex)\r
+      {\r
         ex.printStackTrace();\r
       }\r
     }\r
@@ -186,7 +223,6 @@ public class TreePanel extends GTreePanel
 \r
   protected void printMenu_actionPerformed(ActionEvent e)\r
   {\r
-\r
     //Putting in a thread avoids Swing painting problems\r
     treeCanvas.startPrinting();\r
   }\r
@@ -197,29 +233,33 @@ public class TreePanel extends GTreePanel
     repaint();\r
   }\r
 \r
-\r
   protected void fontSize_actionPerformed(ActionEvent e)\r
   {\r
-    if( treeCanvas==null )\r
-     return;\r
-\r
-   String size = fontSize.getText().substring( fontSize.getText().indexOf("-")+1);\r
-\r
-   Object selection = JOptionPane.showInternalInputDialog(Desktop.desktop,\r
-                               "Select font size",\r
-                               "Font size",\r
-                               JOptionPane.QUESTION_MESSAGE,\r
-                               null, new String[]{"1","2","4","6","8","10","12","14","16","18","20"}\r
-                               ,"Font Size - "+size);\r
-   if(selection!=null)\r
-   {\r
-     fontSize.setText("Font Size - " + selection);\r
-\r
-     int i = Integer.parseInt(selection.toString());\r
-     treeCanvas.setFontSize(i);\r
-   }\r
-    scrollPane.setViewportView(treeCanvas);\r
+    if (treeCanvas == null)\r
+    {\r
+      return;\r
+    }\r
+\r
+    String size = fontSize.getText().substring(fontSize.getText().indexOf("-") +\r
+                                               1);\r
+\r
+    Object selection = JOptionPane.showInternalInputDialog(Desktop.desktop,\r
+        "Select font size", "Font size", JOptionPane.QUESTION_MESSAGE,\r
+        null,\r
+        new String[]\r
+        {\r
+        "1", "2", "4", "6", "8", "10", "12", "14", "16", "18", "20"\r
+    }, "Font Size - " + size);\r
 \r
+    if (selection != null)\r
+    {\r
+      fontSize.setText("Font Size - " + selection);\r
+\r
+      int i = Integer.parseInt(selection.toString());\r
+      treeCanvas.setFontSize(i);\r
+    }\r
+\r
+    scrollPane.setViewportView(treeCanvas);\r
   }\r
 \r
   protected void distanceMenu_actionPerformed(ActionEvent e)\r
@@ -233,37 +273,46 @@ public class TreePanel extends GTreePanel
   }\r
 \r
   protected void placeholdersMenu_actionPerformed(ActionEvent e)\r
-    {\r
-      treeCanvas.setMarkPlaceholders(placeholdersMenu.isSelected());\r
+  {\r
+    treeCanvas.setMarkPlaceholders(placeholdersMenu.isSelected());\r
   }\r
 \r
   protected void epsTree_actionPerformed(ActionEvent e)\r
   {\r
-    int width = treeCanvas.getWidth(), height=treeCanvas.getHeight();\r
+    int width = treeCanvas.getWidth();\r
+    int height = treeCanvas.getHeight();\r
+\r
     try\r
     {\r
-      jalview.io.JalviewFileChooser chooser = new jalview.io.JalviewFileChooser(jalview.bin.Cache.getProperty(\r
-          "LAST_DIRECTORY"),\r
-              new String[]{"eps"},\r
-              new String[]{"Encapsulated Postscript"},\r
-              "Encapsulated Postscript");\r
+      jalview.io.JalviewFileChooser chooser = new jalview.io.JalviewFileChooser(\r
+          jalview.bin.Cache.getProperty(\r
+              "LAST_DIRECTORY"), new String[]\r
+          {"eps"},\r
+          new String[]\r
+          {"Encapsulated Postscript"},\r
+          "Encapsulated Postscript");\r
       chooser.setFileView(new jalview.io.JalviewFileView());\r
       chooser.setDialogTitle("Create EPS file from tree");\r
       chooser.setToolTipText("Save");\r
 \r
       int value = chooser.showSaveDialog(this);\r
+\r
       if (value != jalview.io.JalviewFileChooser.APPROVE_OPTION)\r
+      {\r
         return;\r
+      }\r
 \r
-      jalview.bin.Cache.setProperty("LAST_DIRECTORY",chooser.getSelectedFile().getParent());\r
-      FileOutputStream out = new FileOutputStream(chooser.getSelectedFile());\r
-      EpsGraphics2D pg = new EpsGraphics2D("Tree", out, 0, 0, width, height);\r
+      jalview.bin.Cache.setProperty("LAST_DIRECTORY",\r
+                                    chooser.getSelectedFile().getParent());\r
 \r
+      FileOutputStream out = new FileOutputStream(chooser.getSelectedFile());\r
+      EpsGraphics2D pg = new EpsGraphics2D("Tree", out, 0, 0, width,\r
+                                           height);\r
 \r
       treeCanvas.draw(pg, width, height);\r
 \r
-        pg.flush();\r
-        pg.close();\r
+      pg.flush();\r
+      pg.close();\r
     }\r
     catch (Exception ex)\r
     {\r
@@ -272,14 +321,18 @@ public class TreePanel extends GTreePanel
   }\r
 \r
   protected void pngTree_actionPerformed(ActionEvent e)\r
- {\r
-  int width = treeCanvas.getWidth(), height = treeCanvas.getHeight();\r
+  {\r
+    int width = treeCanvas.getWidth();\r
+    int height = treeCanvas.getHeight();\r
+\r
     try\r
     {\r
       jalview.io.JalviewFileChooser chooser = new jalview.io.JalviewFileChooser(\r
-          jalview.bin.Cache.getProperty("LAST_DIRECTORY"),\r
-          new String[] {"png"},\r
-          new String[] {"Portable network graphics"},\r
+          jalview.bin.Cache.getProperty(\r
+              "LAST_DIRECTORY"), new String[]\r
+          {"png"},\r
+          new String[]\r
+          {"Portable network graphics"},\r
           "Portable network graphics");\r
 \r
       chooser.setFileView(new jalview.io.JalviewFileView());\r
@@ -287,24 +340,29 @@ public class TreePanel extends GTreePanel
       chooser.setToolTipText("Save");\r
 \r
       int value = chooser.showSaveDialog(this);\r
+\r
       if (value != jalview.io.JalviewFileChooser.APPROVE_OPTION)\r
+      {\r
         return;\r
+      }\r
+\r
+      jalview.bin.Cache.setProperty("LAST_DIRECTORY",\r
+                                    chooser.getSelectedFile().getParent());\r
 \r
-      jalview.bin.Cache.setProperty("LAST_DIRECTORY",chooser.getSelectedFile().getParent());\r
       FileOutputStream out = new FileOutputStream(chooser.getSelectedFile());\r
 \r
-      BufferedImage bi = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);\r
+      BufferedImage bi = new BufferedImage(width, height,\r
+                                           BufferedImage.TYPE_INT_RGB);\r
       Graphics png = bi.getGraphics();\r
 \r
       treeCanvas.draw(png, width, height);\r
 \r
-        ImageIO.write(bi, "png", out);\r
-        out.close();\r
+      ImageIO.write(bi, "png", out);\r
+      out.close();\r
     }\r
     catch (Exception ex)\r
     {\r
       ex.printStackTrace();\r
     }\r
   }\r
-\r
 }\r
index f0cf6c1..18382fb 100755 (executable)
@@ -1,39 +1,39 @@
 /*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 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
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
+ */\r
 package jalview.gui;\r
 \r
-import jalview.jbgui.GUserDefinedColours;\r
-import jalview.datamodel.*;\r
-import jalview.io.*;\r
-import javax.swing.*;\r
+import java.io.*;\r
+import java.util.*;\r
+\r
 import java.awt.*;\r
 import java.awt.event.*;\r
+import javax.swing.*;\r
 import javax.swing.event.*;\r
-import jalview.schemes.*;\r
-import java.io.*;\r
-import java.util.*;\r
 \r
+import jalview.datamodel.*;\r
+import jalview.io.*;\r
+import jalview.jbgui.*;\r
+import jalview.schemes.*;\r
 \r
-public class UserDefinedColours extends GUserDefinedColours implements ChangeListener\r
+public class UserDefinedColours\r
+    extends GUserDefinedColours implements ChangeListener\r
 {\r
-\r
   AlignmentPanel ap;\r
   SequenceGroup seqGroup;\r
   JButton selectedButton;\r
@@ -41,55 +41,66 @@ public class UserDefinedColours extends GUserDefinedColours implements ChangeLis
   ColourSchemeI oldColourScheme;\r
   JInternalFrame frame;\r
 \r
-\r
   public UserDefinedColours(AlignmentPanel ap, SequenceGroup sg)\r
   {\r
     super();\r
     frame = new JInternalFrame();\r
     frame.setContentPane(this);\r
-    Desktop.addInternalFrame(frame, "User Defined Colours", 450,530, false );\r
-    if(System.getProperty("os.name").startsWith("Mac"))\r
-      frame.setSize(450,560);\r
+    Desktop.addInternalFrame(frame, "User Defined Colours", 450, 530, false);\r
 \r
-    if(sg!=null)\r
-        frame.setTitle( frame.getTitle()+ " ("+sg.getName()+")");\r
+    if (System.getProperty("os.name").startsWith("Mac"))\r
+    {\r
+      frame.setSize(450, 560);\r
+    }\r
+\r
+    if (sg != null)\r
+    {\r
+      frame.setTitle(frame.getTitle() + " (" + sg.getName() + ")");\r
+    }\r
 \r
     colorChooser.getSelectionModel().addChangeListener(this);\r
 \r
     this.ap = ap;\r
     seqGroup = sg;\r
 \r
+    if (seqGroup != null)\r
+    {\r
+      oldColourScheme = seqGroup.cs;\r
+    }\r
+    else\r
+    {\r
+      oldColourScheme = ap.av.getGlobalColourScheme();\r
+    }\r
 \r
-      if (seqGroup != null)\r
-        oldColourScheme = seqGroup.cs;\r
-      else\r
-        oldColourScheme = ap.av.getGlobalColourScheme();\r
-\r
-      for (int i = 0; i < 20; i++)\r
-        makeButton(ResidueProperties.aa2Triplet.get(ResidueProperties.aa[i]) +\r
-                   "", ResidueProperties.aa[i]);\r
+    for (int i = 0; i < 20; i++)\r
+    {\r
+      makeButton(ResidueProperties.aa2Triplet.get(ResidueProperties.aa[i]) +\r
+                 "", ResidueProperties.aa[i]);\r
+    }\r
 \r
-      makeButton("B", "B");\r
-      makeButton("Z", "Z");\r
-      makeButton("X", "X");\r
-      makeButton("Gap", "'.','-',' '");\r
+    makeButton("B", "B");\r
+    makeButton("Z", "Z");\r
+    makeButton("X", "X");\r
+    makeButton("Gap", "'.','-',' '");\r
 \r
-      if(jalview.bin.Cache.getProperty("USER_DEFINED_COLOUR")!=null)\r
-      {\r
-        loadColours(jalview.bin.Cache.getProperty("USER_DEFINED_COLOUR"));\r
-      }\r
+    if (jalview.bin.Cache.getProperty("USER_DEFINED_COLOUR") != null)\r
+    {\r
+      loadColours(jalview.bin.Cache.getProperty("USER_DEFINED_COLOUR"));\r
+    }\r
   }\r
 \r
- public void stateChanged(ChangeEvent evt)\r
- {\r
-   if(selectedButton!=null)\r
-     selectedButton.setBackground( colorChooser.getColor() );\r
- }\r
+  public void stateChanged(ChangeEvent evt)\r
+  {\r
+    if (selectedButton != null)\r
+    {\r
+      selectedButton.setBackground(colorChooser.getColor());\r
+    }\r
+  }\r
 \r
   public void colourButtonPressed(MouseEvent e)\r
   {\r
-     selectedButton = (JButton)e.getSource();\r
-     colorChooser.setColor(selectedButton.getBackground());\r
+    selectedButton = (JButton) e.getSource();\r
+    colorChooser.setColor(selectedButton.getBackground());\r
   }\r
 \r
   void makeButton(String label, String aa)\r
@@ -97,15 +108,18 @@ public class UserDefinedColours extends GUserDefinedColours implements ChangeLis
     final JButton button = new JButton();\r
     Color col = Color.white;\r
 \r
-\r
-    try{\r
+    try\r
+    {\r
       col = oldColourScheme.findColour(aa, -1);\r
-    }catch(Exception ex){}\r
+    }\r
+    catch (Exception ex)\r
+    {\r
+    }\r
 \r
-    button.setBackground(  col );\r
-    oldColours.addElement( col );\r
-    button.setText( label );\r
-    button.setForeground( col.darker().darker().darker() );\r
+    button.setBackground(col);\r
+    oldColours.addElement(col);\r
+    button.setText(label);\r
+    button.setForeground(col.darker().darker().darker());\r
     button.setFont(new java.awt.Font("Verdana", 1, 10));\r
     button.addMouseListener(new java.awt.event.MouseAdapter()\r
     {\r
@@ -118,167 +132,207 @@ public class UserDefinedColours extends GUserDefinedColours implements ChangeLis
     buttonPanel.add(button, null);\r
   }\r
 \r
-\r
   protected void okButton_actionPerformed(ActionEvent e)\r
   {\r
     applyButton_actionPerformed(null);\r
-    try{\r
+\r
+    try\r
+    {\r
       frame.setClosed(true);\r
-    }catch(Exception ex){}\r
+    }\r
+    catch (Exception ex)\r
+    {\r
+    }\r
   }\r
 \r
   protected void applyButton_actionPerformed(ActionEvent e)\r
   {\r
-    Color [] newColours = new Color[24];\r
-    for(int i=0; i<24; i++)\r
+    Color[] newColours = new Color[24];\r
+\r
+    for (int i = 0; i < 24; i++)\r
     {\r
-          JButton button = (JButton)buttonPanel.getComponent(i);\r
-          newColours[i] = button.getBackground();\r
+      JButton button = (JButton) buttonPanel.getComponent(i);\r
+      newColours[i] = button.getBackground();\r
     }\r
 \r
     UserColourScheme ucs = new UserColourScheme(newColours);\r
     ucs.setThreshold(0);\r
 \r
-    if(seqGroup!=null)\r
+    if (seqGroup != null)\r
     {\r
       seqGroup.cs = ucs;\r
       ap.repaint();\r
     }\r
     else\r
+    {\r
       ap.alignFrame.changeColour(ucs);\r
-\r
+    }\r
   }\r
 \r
   protected void loadbutton_actionPerformed(ActionEvent e)\r
   {\r
-    JalviewFileChooser chooser = new JalviewFileChooser(\r
-      jalview.bin.Cache.getProperty("LAST_DIRECTORY"),\r
-        new String[]{"jc"},\r
-        new String[]{"Jalview User Colours"},\r
-          "Jalview User Colours");\r
+    JalviewFileChooser chooser = new JalviewFileChooser(jalview.bin.Cache.\r
+        getProperty(\r
+            "LAST_DIRECTORY"), new String[]\r
+        {"jc"},\r
+        new String[]\r
+        {"Jalview User Colours"}, "Jalview User Colours");\r
     chooser.setFileView(new jalview.io.JalviewFileView());\r
     chooser.setDialogTitle("Load colour scheme");\r
     chooser.setToolTipText("Load");\r
+\r
     int value = chooser.showOpenDialog(this);\r
+\r
     if (value == JalviewFileChooser.APPROVE_OPTION)\r
     {\r
       File choice = chooser.getSelectedFile();\r
-      jalview.bin.Cache.setProperty("LAST_DIRECTORY",  choice.getParent());\r
-      jalview.bin.Cache.setProperty("USER_DEFINED_COLOUR", choice.getPath());\r
+      jalview.bin.Cache.setProperty("LAST_DIRECTORY", choice.getParent());\r
+      jalview.bin.Cache.setProperty("USER_DEFINED_COLOUR",\r
+                                    choice.getPath());\r
+\r
       Color[] colors = loadColours(choice.getAbsolutePath());\r
+\r
       for (int i = 0; i < colors.length; i++)\r
       {\r
         JButton button = (JButton) buttonPanel.getComponent(i);\r
         button.setBackground(colors[i]);\r
       }\r
-\r
     }\r
   }\r
 \r
   public static UserColourScheme loadDefaultColours()\r
   {\r
-    if(jalview.bin.Cache.getProperty("USER_DEFINED_COLOUR")!=null)\r
-      return loadDefaultColours(jalview.bin.Cache.getProperty("USER_DEFINED_COLOUR"));\r
+    if (jalview.bin.Cache.getProperty("USER_DEFINED_COLOUR") != null)\r
+    {\r
+      return loadDefaultColours(jalview.bin.Cache.getProperty(\r
+          "USER_DEFINED_COLOUR"));\r
+    }\r
     else\r
+    {\r
       return null;\r
+    }\r
   }\r
 \r
   public static UserColourScheme loadDefaultColours(String file)\r
   {\r
-      UserColourScheme ucs = null;\r
-      Color cols[] = loadColours(file);\r
-      if(cols!=null)\r
-      {\r
-        ucs = new UserColourScheme(cols);\r
-        ucs.setThreshold(0);\r
-      }\r
-      return ucs;\r
+    UserColourScheme ucs = null;\r
+    Color[] cols = loadColours(file);\r
+\r
+    if (cols != null)\r
+    {\r
+      ucs = new UserColourScheme(cols);\r
+      ucs.setThreshold(0);\r
+    }\r
+\r
+    return ucs;\r
   }\r
 \r
-  static Color [] loadColours(String file)\r
+  static Color[] loadColours(String file)\r
   {\r
-    Color [] newColours=null;\r
+    Color[] newColours = null;\r
+\r
     try\r
     {\r
-      InputStreamReader in = new InputStreamReader(\r
-          new FileInputStream(file), "UTF-8");\r
+      InputStreamReader in = new InputStreamReader(new FileInputStream(\r
+          file), "UTF-8");\r
 \r
-      jalview.binding.JalviewUserColours ucs = new jalview.binding.JalviewUserColours();\r
-      ucs = (jalview.binding.JalviewUserColours)ucs.unmarshal(in);\r
+      jalview.binding.JalviewUserColours ucs = new jalview.binding.\r
+          JalviewUserColours();\r
+      ucs = (jalview.binding.JalviewUserColours) ucs.unmarshal(in);\r
 \r
       newColours = new Color[ucs.getColourCount()];\r
-      for (int i = 0; i < 24; i++)\r
-        newColours[i] = new Color(Integer.parseInt(ucs.getColour(i).getRGB(), 16));\r
 \r
+      for (int i = 0; i < 24; i++)\r
+      {\r
+        newColours[i] = new Color(Integer.parseInt(\r
+            ucs.getColour(i).getRGB(), 16));\r
+      }\r
     }\r
     catch (Exception ex)\r
-    {System.out.println("Error loading UserColourFile "+file);}\r
+    {\r
+      System.out.println("Error loading UserColourFile " + file);\r
+    }\r
 \r
     return newColours;\r
   }\r
 \r
   protected void savebutton_actionPerformed(ActionEvent e)\r
   {\r
-    JalviewFileChooser chooser = new JalviewFileChooser(\r
-    jalview.bin.Cache.getProperty("LAST_DIRECTORY"),\r
-    new String[]{"jc"},\r
-    new String[]{"Jalview User Colours"},\r
-      "Jalview User Colours");\r
+    JalviewFileChooser chooser = new JalviewFileChooser(jalview.bin.Cache.\r
+        getProperty(\r
+            "LAST_DIRECTORY"), new String[]\r
+        {"jc"},\r
+        new String[]\r
+        {"Jalview User Colours"}, "Jalview User Colours");\r
 \r
     chooser.setFileView(new jalview.io.JalviewFileView());\r
     chooser.setDialogTitle("Save colour scheme");\r
     chooser.setToolTipText("Save");\r
+\r
     int value = chooser.showSaveDialog(this);\r
+\r
     if (value == JalviewFileChooser.APPROVE_OPTION)\r
     {\r
       String choice = chooser.getSelectedFile().getPath();\r
       jalview.bin.Cache.setProperty("USER_DEFINED_COLOUR", choice);\r
-      jalview.binding.JalviewUserColours ucs = new jalview.binding.JalviewUserColours();\r
 \r
-      try{\r
+      jalview.binding.JalviewUserColours ucs = new jalview.binding.\r
+          JalviewUserColours();\r
+\r
+      try\r
+      {\r
         PrintWriter out = new PrintWriter(new OutputStreamWriter(\r
-                                     new FileOutputStream(choice), "UTF-8"));\r
-        for(int i=0; i<24; i++)\r
+            new FileOutputStream(choice), "UTF-8"));\r
+\r
+        for (int i = 0; i < 24; i++)\r
         {\r
-         JButton button = (JButton)buttonPanel.getComponent(i);\r
-         jalview.binding.Colour col = new jalview.binding.Colour();\r
-         col.setName(button.getText());\r
-         col.setRGB( jalview.util.Format.getHexString( button.getBackground() ));\r
-         ucs.addColour(col);\r
+          JButton button = (JButton) buttonPanel.getComponent(i);\r
+          jalview.binding.Colour col = new jalview.binding.Colour();\r
+          col.setName(button.getText());\r
+          col.setRGB(jalview.util.Format.getHexString(\r
+              button.getBackground()));\r
+          ucs.addColour(col);\r
         }\r
 \r
         ucs.marshal(out);\r
         out.close();\r
       }\r
-      catch(Exception ex)\r
-      {ex.printStackTrace();}\r
+      catch (Exception ex)\r
+      {\r
+        ex.printStackTrace();\r
+      }\r
     }\r
-\r
   }\r
 \r
   protected void cancelButton_actionPerformed(ActionEvent e)\r
   {\r
+    Color[] newColours = new Color[24];\r
 \r
-    Color [] newColours = new Color[24];\r
-    for(int i=0; i<24; i++)\r
+    for (int i = 0; i < 24; i++)\r
     {\r
-          newColours[i] = (Color)oldColours.elementAt(i);\r
-          buttonPanel.getComponent(i).setBackground(newColours[i]);\r
+      newColours[i] = (Color) oldColours.elementAt(i);\r
+      buttonPanel.getComponent(i).setBackground(newColours[i]);\r
     }\r
 \r
-    UserColourScheme ucs = new UserColourScheme( newColours );\r
+    UserColourScheme ucs = new UserColourScheme(newColours);\r
 \r
     if (seqGroup != null)\r
+    {\r
       seqGroup.cs = ucs;\r
+    }\r
     else\r
+    {\r
       ap.av.setGlobalColourScheme(ucs);\r
+    }\r
 \r
     ap.repaint();\r
 \r
-    try{\r
+    try\r
+    {\r
       frame.setClosed(true);\r
-    }catch(Exception ex){}\r
+    }\r
+    catch (Exception ex)\r
+    {\r
+    }\r
   }\r
-\r
-\r
 }\r
index 9e980c5..0a098e5 100755 (executable)
@@ -1,32 +1,32 @@
 /*\r
-* Jalview - A Sequence Alignment Editor and Viewer\r
-* Copyright (C) 2005 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
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
+ */\r
 package jalview.gui;\r
 \r
 import java.awt.*;\r
 import java.awt.event.*;\r
 import javax.swing.*;\r
-import jalview.jbgui.GWebserviceInfo;\r
 \r
-public class WebserviceInfo extends GWebserviceInfo\r
-{\r
+import jalview.jbgui.*;\r
 \r
+public class WebserviceInfo\r
+    extends GWebserviceInfo\r
+{\r
   public static final int STATE_QUEUING = 0;\r
   public static final int STATE_RUNNING = 1;\r
   public static final int STATE_STOPPED_OK = 2;\r
@@ -36,17 +36,9 @@ public class WebserviceInfo extends GWebserviceInfo
   int currentStatus = STATE_QUEUING;\r
   Image image;\r
   int angle = 0;\r
-\r
-  String title="";\r
+  String title = "";\r
   jalview.ws.WSClientI thisService;\r
   boolean serviceIsCancellable;\r
-  public jalview.ws.WSClientI getthisService() {\r
-    return thisService;\r
-  }\r
-  public void setthisService(jalview.ws.WSClientI newservice) {\r
-    thisService = newservice;\r
-    serviceIsCancellable = newservice.isCancellable();\r
-  }\r
 \r
   public WebserviceInfo(String title, String info)\r
   {\r
@@ -58,6 +50,17 @@ public class WebserviceInfo extends GWebserviceInfo
     init(title, info, width, height);\r
   }\r
 \r
+  public jalview.ws.WSClientI getthisService()\r
+  {\r
+    return thisService;\r
+  }\r
+\r
+  public void setthisService(jalview.ws.WSClientI newservice)\r
+  {\r
+    thisService = newservice;\r
+    serviceIsCancellable = newservice.isCancellable();\r
+  }\r
+\r
   void init(String title, String info, int width, int height)\r
   {\r
     JInternalFrame frame = new JInternalFrame();\r
@@ -66,20 +69,24 @@ public class WebserviceInfo extends GWebserviceInfo
 \r
     this.title = title;\r
     setInfoText(info);\r
+\r
     java.net.URL url = getClass().getResource("/images/logo.gif");\r
     image = java.awt.Toolkit.getDefaultToolkit().createImage(url);\r
+\r
     MediaTracker mt = new MediaTracker(this);\r
     mt.addImage(image, 0);\r
+\r
     try\r
     {\r
       mt.waitForID(0);\r
     }\r
     catch (Exception ex)\r
-    {}\r
-\r
+    {\r
+    }\r
 \r
     AnimatedPanel ap = new AnimatedPanel();\r
     titlePanel.add(ap, BorderLayout.CENTER);\r
+\r
     Thread thread = new Thread(ap);\r
     thread.start();\r
   }\r
@@ -90,97 +97,130 @@ public class WebserviceInfo extends GWebserviceInfo
   }\r
 \r
   public String getInfoText()\r
-  {   return infoText.getText();  }\r
+  {\r
+    return infoText.getText();\r
+  }\r
 \r
   public void setInfoText(String text)\r
-  {   infoText.setText(text);     }\r
+  {\r
+    infoText.setText(text);\r
+  }\r
 \r
   public void appendInfoText(String text)\r
-  {  infoText.append(text);  }\r
+  {\r
+    infoText.append(text);\r
+  }\r
 \r
   public String getProgressText()\r
-  {   return progressText.getText();  }\r
+  {\r
+    return progressText.getText();\r
+  }\r
 \r
   public void setProgressText(String text)\r
-  {   progressText.setText(text);   }\r
+  {\r
+    progressText.setText(text);\r
+  }\r
 \r
   public void appendProgressText(String text)\r
-  {   progressText.append(text);  }\r
+  {\r
+    progressText.append(text);\r
+  }\r
 \r
   protected void cancel_actionPerformed(ActionEvent e)\r
   {\r
     if (!serviceIsCancellable)\r
+    {\r
       JOptionPane.showInternalMessageDialog(Desktop.desktop,\r
-                                            "This job cannot be cancelled." ,\r
-                                            "Cancel job"\r
-                                            ,JOptionPane.WARNING_MESSAGE);\r
+                                            "This job cannot be cancelled.",\r
+                                            "Cancel job",\r
+                                            JOptionPane.WARNING_MESSAGE);\r
+    }\r
     else\r
+    {\r
       thisService.cancelJob();\r
+    }\r
   }\r
 \r
-\r
-  class AnimatedPanel extends JPanel implements Runnable\r
+  class AnimatedPanel\r
+      extends JPanel implements Runnable\r
   {\r
-    long startTime=0;\r
+    long startTime = 0;\r
+\r
     public void run()\r
     {\r
       startTime = System.currentTimeMillis();\r
-      while(currentStatus<STATE_STOPPED_OK)\r
-      try\r
-      {\r
-        Thread.sleep(50);\r
 \r
-        int units =  (int)((System.currentTimeMillis()-startTime)/10f);\r
-        angle += units;\r
-        angle %= 360;\r
-        startTime = System.currentTimeMillis();\r
-        repaint();\r
+      while (currentStatus < STATE_STOPPED_OK)\r
+      {\r
 \r
+        try\r
+        {\r
+          Thread.sleep(50);\r
+\r
+          int units = (int) ( (System.currentTimeMillis() - startTime) / 10f);\r
+          angle += units;\r
+          angle %= 360;\r
+          startTime = System.currentTimeMillis();\r
+          repaint();\r
+        }\r
+        catch (Exception ex)\r
+        {\r
+        }\r
       }\r
-      catch (Exception ex)\r
-      {}\r
+\r
       angle = 0;\r
       cancel.setEnabled(false);\r
-\r
     }\r
 \r
-   synchronized public void  paintComponent(Graphics g1)\r
+    synchronized public void paintComponent(Graphics g1)\r
     {\r
       Graphics2D g = (Graphics2D) g1;\r
       g.setColor(Color.white);\r
       g.fillRect(0, 0, getWidth(), getHeight());\r
+\r
       if (image != null)\r
       {\r
         g.rotate(Math.toRadians(angle), 28, 28);\r
         g.drawImage(image, 10, 10, this);\r
         g.rotate( -Math.toRadians(angle), 28, 28);\r
       }\r
+\r
       g.setFont(new Font("Arial", Font.BOLD, 12));\r
       g.setColor(Color.black);\r
-      switch(currentStatus)\r
+\r
+      switch (currentStatus)\r
       {\r
         case STATE_QUEUING:\r
           g.drawString(title.concat(" - queuing"), 60, 30);\r
+\r
           break;\r
+\r
         case STATE_RUNNING:\r
           g.drawString(title.concat(" - running"), 60, 30);\r
+\r
           break;\r
+\r
         case STATE_STOPPED_OK:\r
           g.drawString(title.concat(" - complete"), 60, 30);\r
+\r
           break;\r
 \r
         case STATE_CANCELLED_OK:\r
           g.drawString(title.concat(" - job cancelled!"), 60, 30);\r
+\r
           break;\r
 \r
         case STATE_STOPPED_ERROR:\r
           g.drawString(title.concat(" - job error!"), 60, 30);\r
+\r
           break;\r
+\r
         case STATE_STOPPED_SERVERERROR:\r
-          g.drawString(title.concat(" - Server Error! (try later)"), 60, 30);\r
+          g.drawString(title.concat(" - Server Error! (try later)"), 60,\r
+                       30);\r
+\r
           break;\r
       }\r
-\r
     }\r
   }\r
 }\r
index 0dfef6a..04ddff3 100755 (executable)
 * along with this program; if not, write to the Free Software\r
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
 */\r
-\r
 package jalview.io;\r
 \r
 import jalview.datamodel.*;\r
 \r
 import java.io.*;\r
+\r
 import java.util.*;\r
 \r
+\r
 public abstract class AlignFile extends FileParse {\r
-  int noSeqs    = 0;\r
-  int maxLength = 0;\r
-\r
-  Vector    seqs;\r
-  Vector    headers;\r
-\r
-  long start;\r
-  long end;\r
-\r
-  public AlignFile()\r
-  {}\r
-\r
-  public AlignFile(String inStr) {\r
-    initData();\r
-System.out.println("is this ever called??");\r
-    try{\r
-      parse();\r
-    }catch(Exception ex){}\r
-  }\r
-\r
-/**\r
- * Constructor which parses the data from a file of some specified type.\r
- * @param inFile Filename to read from.\r
- * @param type   What type of file to read from (File, URL)\r
- */\r
-  public AlignFile(String inFile, String type) throws IOException {\r
-    super(inFile,type);\r
-\r
-    initData();\r
-\r
-    parse();\r
-\r
-  }\r
-\r
-/**\r
- * Return the seqs Vector\r
- */\r
-  public Vector getSeqs() {\r
-    return seqs;\r
-  }\r
-\r
-/**\r
- * Return the Sequences in the seqs Vector as an array of Sequences\r
- */\r
-  public SequenceI [] getSeqsAsArray() {\r
-    SequenceI [] s = new SequenceI[seqs.size()];\r
-    for (int i=0;i < seqs.size();i++) {\r
-      s[i] = (SequenceI)seqs.elementAt(i);\r
+    int noSeqs = 0;\r
+    int maxLength = 0;\r
+    Vector seqs;\r
+    Vector headers;\r
+    long start;\r
+    long end;\r
+\r
+    public AlignFile() {\r
+    }\r
+\r
+    public AlignFile(String inStr) {\r
+        initData();\r
+        System.out.println("is this ever called??");\r
+\r
+        try {\r
+            parse();\r
+        } catch (Exception ex) {\r
+        }\r
     }\r
-    return s;\r
-  }\r
-\r
-\r
-/**\r
- * Initialise objects to store sequence data in.\r
- */\r
-  protected void initData() {\r
-    seqs    = new Vector();\r
-    headers = new Vector();\r
-  }\r
-\r
-  protected void setSeqs(SequenceI [] s) {\r
-    seqs = new Vector();\r
-    for (int i=0; i<s.length; i++) {\r
-      seqs.addElement(s[i]);\r
+\r
+    /**\r
+     * Constructor which parses the data from a file of some specified type.\r
+     * @param inFile Filename to read from.\r
+     * @param type   What type of file to read from (File, URL)\r
+     */\r
+    public AlignFile(String inFile, String type) throws IOException {\r
+        super(inFile, type);\r
+\r
+        initData();\r
+\r
+        parse();\r
     }\r
-  }\r
 \r
-  // Checks whether sequence is valid aa characters\r
-  protected boolean isValidProteinSequence(String sequence)\r
-  {\r
-    for (int i = 0; i < sequence.length(); i++)\r
-      if (!jalview.schemes.ResidueProperties.aaHash.containsKey(String.valueOf(sequence.charAt(i))))\r
-        return false;\r
+    /**\r
+     * Return the seqs Vector\r
+     */\r
+    public Vector getSeqs() {\r
+        return seqs;\r
+    }\r
 \r
-    return true;\r
-  }\r
+    /**\r
+     * Return the Sequences in the seqs Vector as an array of Sequences\r
+     */\r
+    public SequenceI[] getSeqsAsArray() {\r
+        SequenceI[] s = new SequenceI[seqs.size()];\r
 \r
+        for (int i = 0; i < seqs.size(); i++) {\r
+            s[i] = (SequenceI) seqs.elementAt(i);\r
+        }\r
 \r
-/**\r
- * This method must be implemented to parse the contents of the file.\r
- */\r
-  public abstract void parse() throws IOException;\r
+        return s;\r
+    }\r
+\r
+    /**\r
+     * Initialise objects to store sequence data in.\r
+     */\r
+    protected void initData() {\r
+        seqs = new Vector();\r
+        headers = new Vector();\r
+    }\r
+\r
+    protected void setSeqs(SequenceI[] s) {\r
+        seqs = new Vector();\r
+\r
+        for (int i = 0; i < s.length; i++) {\r
+            seqs.addElement(s[i]);\r
+        }\r
+    }\r
+\r
+    // Checks whether sequence is valid aa characters\r
+    protected boolean isValidProteinSequence(String sequence) {\r
+        for (int i = 0; i < sequence.length(); i++)\r
+            if (!jalview.schemes.ResidueProperties.aaHash.containsKey(\r
+                        String.valueOf(sequence.charAt(i)))) {\r
+                return false;\r
+            }\r
+\r
+        return true;\r
+    }\r
 \r
+    /**\r
+     * This method must be implemented to parse the contents of the file.\r
+     */\r
+    public abstract void parse() throws IOException;\r
 \r
-/**\r
- * Print out in alignment file format the Sequences in the seqs Vector.\r
- */\r
-  public abstract String print();\r
+    /**\r
+     * Print out in alignment file format the Sequences in the seqs Vector.\r
+     */\r
+    public abstract String print();\r
 }\r
index 7961810..687eef9 100755 (executable)
 * along with this program; if not, write to the Free Software\r
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
 */\r
-\r
 package jalview.io;\r
 \r
 import jalview.datamodel.*;\r
 \r
 import java.io.*;\r
+\r
 import java.util.*;\r
 \r
+\r
 public class BLCFile extends AlignFile {\r
+    Vector titles;\r
 \r
-  Vector titles;\r
-\r
-  public BLCFile()\r
-  {}\r
-\r
-  public BLCFile(String inStr) {\r
-    super(inStr);\r
-  }\r
-\r
-  public void initData() {\r
-    super.initData();\r
-    titles = new Vector();\r
-  }\r
-\r
-  public BLCFile(String inFile, String type) throws IOException {\r
-    super(inFile,type);\r
-  }\r
-\r
-\r
-  public void parse()\r
-  {\r
-    boolean idsFound=false;\r
-    Vector ids = new Vector();\r
-    StringBuffer seqstrings [];\r
-    Vector starts = new Vector();\r
-    Vector ends = new Vector();\r
-\r
-   String line=null;\r
-   try{\r
-     do{\r
-      line = nextLine();\r
-\r
-      // seek end of ids\r
-      if (line.indexOf("*") > -1)\r
-      {\r
-        idsFound=true;\r
-        break;\r
-      }\r
-\r
-      int abracket = line.indexOf(">");\r
-\r
-      if (abracket > -1)\r
-      {\r
-\r
-        if(line.indexOf(" ")>-1)//\r
-        {\r
-          ///Colur it be this format?\r
-          //>54402046         0             1   137   137:\r
-          // or this??\r
-          //     1   >L1H14       30539  343\r
-          try{\r
-            ids.addElement(line.substring(abracket + 1,\r
-                                          line.indexOf(" ", abracket + 1)));\r
-\r
-\r
-            // remove p Value\r
-            line = line.substring(abracket + 1);\r
-            line = line.substring(line.indexOf(" ") + 1);\r
-            line = line.trim();\r
-            line = line.substring(line.indexOf(" ") + 1);\r
-            line = line.trim();\r
-            int value = Integer.parseInt(line.substring(0, line.indexOf(" ")));\r
-            starts.addElement(value+"");\r
-            line = line.substring(line.indexOf(" ") + 1);\r
-            line = line.trim();\r
-            value = Integer.parseInt(line.substring(0, line.indexOf(" ")));\r
-            ends.addElement(value+"");\r
-\r
-          }catch(Exception ex)\r
-          {\r
-            System.err.println("Error during blockfile read.");\r
-            ex.printStackTrace();\r
-            starts.addElement("0");\r
-            ends.addElement("0");\r
-          }\r
+    public BLCFile() {\r
+    }\r
 \r
-        }\r
-        else\r
-        {\r
-          ids.addElement( line.substring(abracket + 1, line.indexOf("/")));\r
-          line = line.substring(line.indexOf("/") + 1);\r
-          starts.addElement(line.substring(0, line.indexOf("-")));\r
-          ends.addElement(line.substring(line.indexOf("-") + 1));\r
-        }\r
-      }\r
-    }while(!idsFound);\r
-\r
-    int starCol = line.indexOf("*");\r
-    seqstrings = new StringBuffer[ids.size()];\r
-    for(int i=0; i<ids.size(); i++)\r
-    {\r
-      if(seqstrings[i]==null)\r
-        seqstrings[i] = new StringBuffer();\r
+    public BLCFile(String inStr) {\r
+        super(inStr);\r
+    }\r
+\r
+    public BLCFile(String inFile, String type) throws IOException {\r
+        super(inFile, type);\r
     }\r
 \r
-    while ((line = nextLine()).indexOf("*")==-1)\r
-    {\r
-      for(int i=0; i<ids.size(); i++)\r
-      {\r
-        if(line.length()>i+starCol)\r
-          seqstrings[i].append(line.charAt(i + starCol));\r
-      }\r
+    public void initData() {\r
+        super.initData();\r
+        titles = new Vector();\r
     }\r
 \r
-    for(int i=0; i<ids.size(); i++)\r
-    {\r
-      Sequence newSeq = new Sequence(ids.elementAt(i).toString(),\r
-                                     seqstrings[i].toString(),\r
-                                     Integer.parseInt(starts.elementAt(i).toString()),\r
-                                     Integer.parseInt(ends.elementAt(i).toString()));\r
-      seqs.addElement(newSeq);\r
+    public void parse() {\r
+        boolean idsFound = false;\r
+        Vector ids = new Vector();\r
+        StringBuffer[] seqstrings;\r
+        Vector starts = new Vector();\r
+        Vector ends = new Vector();\r
+\r
+        String line = null;\r
+\r
+        try {\r
+            do {\r
+                line = nextLine();\r
+\r
+                // seek end of ids\r
+                if (line.indexOf("*") > -1) {\r
+                    idsFound = true;\r
+\r
+                    break;\r
+                }\r
+\r
+                int abracket = line.indexOf(">");\r
+\r
+                if (abracket > -1) {\r
+                    if (line.indexOf(" ") > -1) //\r
+                     {\r
+                        ///Colur it be this format?\r
+                        //>54402046         0             1   137   137:\r
+                        // or this??\r
+                        //     1   >L1H14       30539  343\r
+                        try {\r
+                            ids.addElement(line.substring(abracket + 1,\r
+                                    line.indexOf(" ", abracket + 1)));\r
+\r
+                            // remove p Value\r
+                            line = line.substring(abracket + 1);\r
+                            line = line.substring(line.indexOf(" ") + 1);\r
+                            line = line.trim();\r
+                            line = line.substring(line.indexOf(" ") + 1);\r
+                            line = line.trim();\r
+\r
+                            int value = Integer.parseInt(line.substring(0,\r
+                                        line.indexOf(" ")));\r
+                            starts.addElement(value + "");\r
+                            line = line.substring(line.indexOf(" ") + 1);\r
+                            line = line.trim();\r
+                            value = Integer.parseInt(line.substring(0,\r
+                                        line.indexOf(" ")));\r
+                            ends.addElement(value + "");\r
+                        } catch (Exception ex) {\r
+                            System.err.println("Error during blockfile read.");\r
+                            ex.printStackTrace();\r
+                            starts.addElement("0");\r
+                            ends.addElement("0");\r
+                        }\r
+                    } else {\r
+                        ids.addElement(line.substring(abracket + 1,\r
+                                line.indexOf("/")));\r
+                        line = line.substring(line.indexOf("/") + 1);\r
+                        starts.addElement(line.substring(0, line.indexOf("-")));\r
+                        ends.addElement(line.substring(line.indexOf("-") + 1));\r
+                    }\r
+                }\r
+            } while (!idsFound);\r
+\r
+            int starCol = line.indexOf("*");\r
+            seqstrings = new StringBuffer[ids.size()];\r
+\r
+            for (int i = 0; i < ids.size(); i++) {\r
+                if (seqstrings[i] == null) {\r
+                    seqstrings[i] = new StringBuffer();\r
+                }\r
+            }\r
+\r
+            while ((line = nextLine()).indexOf("*") == -1) {\r
+                for (int i = 0; i < ids.size(); i++) {\r
+                    if (line.length() > (i + starCol)) {\r
+                        seqstrings[i].append(line.charAt(i + starCol));\r
+                    }\r
+                }\r
+            }\r
+\r
+            for (int i = 0; i < ids.size(); i++) {\r
+                Sequence newSeq = new Sequence(ids.elementAt(i).toString(),\r
+                        seqstrings[i].toString(),\r
+                        Integer.parseInt(starts.elementAt(i).toString()),\r
+                        Integer.parseInt(ends.elementAt(i).toString()));\r
+                seqs.addElement(newSeq);\r
+            }\r
+        } catch (Exception ex) {\r
+            ex.printStackTrace();\r
+        }\r
     }\r
 \r
-   }catch(Exception ex){ex.printStackTrace();}\r
-  }\r
-\r
-  public String print() {\r
-    return print(getSeqsAsArray());\r
-  }\r
-  public static String print(SequenceI[] s) {\r
-    StringBuffer out = new StringBuffer();\r
-\r
-    int i=0;\r
-    int max = -1;\r
-    while (i < s.length && s[i] != null) {\r
-      out.append(">" + s[i].getName() + "/" + s[i].getStart() + "-" + s[i].getEnd() + "\n");\r
-      if (s[i].getSequence().length() > max) { max = s[i].getSequence().length();}\r
-      i++;\r
+    public String print() {\r
+        return print(getSeqsAsArray());\r
     }\r
 \r
-      out.append("* iteration 1\n");\r
-      for (int j = 0; j < max; j++) {\r
-        i=0;\r
-        while (i < s.length && s[i] != null) {\r
-          if(s[i].getSequence().length()>j )\r
-            out.append(s[i].getSequence().substring(j,j+1));\r
-          else\r
-            out.append("-");\r
-          i++;\r
+    public static String print(SequenceI[] s) {\r
+        StringBuffer out = new StringBuffer();\r
+\r
+        int i = 0;\r
+        int max = -1;\r
+\r
+        while ((i < s.length) && (s[i] != null)) {\r
+            out.append(">" + s[i].getName() + "/" + s[i].getStart() + "-" +\r
+                s[i].getEnd() + "\n");\r
+\r
+            if (s[i].getSequence().length() > max) {\r
+                max = s[i].getSequence().length();\r
+            }\r
+\r
+            i++;\r
         }\r
-        out.append("\n");\r
-      }\r
-    out.append("*\n");\r
-    return out.toString();\r
 \r
-  }\r
+        out.append("* iteration 1\n");\r
+\r
+        for (int j = 0; j < max; j++) {\r
+            i = 0;\r
+\r
+            while ((i < s.length) && (s[i] != null)) {\r
+                if (s[i].getSequence().length() > j) {\r
+                    out.append(s[i].getSequence().substring(j, j + 1));\r
+                } else {\r
+                    out.append("-");\r
+                }\r
+\r
+                i++;\r
+            }\r
+\r
+            out.append("\n");\r
+        }\r
+\r
+        out.append("*\n");\r
+\r
+        return out.toString();\r
+    }\r
 }\r
index 9b56526..b0d46b2 100755 (executable)
 * along with this program; if not, write to the Free Software\r
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
 */\r
-\r
 package jalview.io;\r
 \r
 import jalview.datamodel.*;\r
+\r
 import jalview.util.*;\r
 \r
 import java.io.*;\r
+\r
 import java.util.*;\r
 \r
+\r
 public class ClustalFile extends AlignFile {\r
+    Vector ids;\r
 \r
-  Vector ids;\r
-\r
-  public ClustalFile()\r
-  {}\r
-\r
-  public ClustalFile(String inStr) {\r
-    super(inStr);\r
-  }\r
-\r
-\r
-  public void initData() {\r
-    super.initData();\r
-    ids = new Vector();\r
-  }\r
-\r
-  public ClustalFile(String inFile, String type) throws IOException {\r
-    super(inFile,type);\r
-  }\r
-\r
-  public void parse() {\r
-    int     i    = 0;\r
-    boolean flag = false;\r
-\r
-    Vector    headers = new Vector();\r
-    Hashtable seqhash = new Hashtable();\r
-\r
-    String line;\r
-\r
-    try {\r
-      while ((line = nextLine()) != null) {\r
-       if (line.indexOf(" ") != 0) {\r
-         StringTokenizer str = new StringTokenizer(line," ");\r
-         String id = "";\r
-\r
-         if (str.hasMoreTokens()) {\r
-           id = str.nextToken();\r
-           if (id.equals("CLUSTAL")) {\r
-             flag = true;\r
-           } else {\r
-             if (flag) {\r
-               StringBuffer tempseq;\r
-               if (seqhash.containsKey(id)) {\r
-                 tempseq = (StringBuffer)seqhash.get(id);\r
-               } else {\r
-                 tempseq = new StringBuffer();\r
-                 seqhash.put(id,tempseq);\r
-               }\r
-\r
-               if (!(headers.contains(id))) {\r
-                 headers.addElement(id);\r
-               }\r
-\r
-                if(str.hasMoreTokens())\r
-                  tempseq.append(str.nextToken());\r
-             }\r
-           }\r
-         }\r
-       }\r
-      }\r
-    } catch (IOException e) {\r
-      System.err.println("Exception parsing clustal file " + e);\r
-      e.printStackTrace();\r
+    public ClustalFile() {\r
     }\r
 \r
-    if (flag) {\r
-      this.noSeqs = headers.size();\r
-\r
-      //Add sequences to the hash\r
-      for (i = 0; i < headers.size(); i++ ) {\r
-        int start = -1;\r
-        int end   = -1;\r
-\r
-        if ( seqhash.get(headers.elementAt(i)) != null) {\r
-          if (maxLength <  seqhash.get(headers.elementAt(i)).toString().length() ) {\r
-            maxLength =  seqhash.get(headers.elementAt(i)).toString().length();\r
-          }\r
-          String head =  headers.elementAt(i).toString();\r
-          start = 1;\r
-          end   =  seqhash.get(headers.elementAt(i)).toString().length();\r
-\r
-          if (head.indexOf("/") > 0 ) {\r
-            StringTokenizer st = new StringTokenizer(head,"/");\r
-            if (st.countTokens() == 2) {\r
-\r
-              ids.addElement(st.nextToken());\r
-\r
-              String tmp = st.nextToken();\r
-              st = new StringTokenizer(tmp,"-");\r
-              if (st.countTokens() == 2) {\r
-                start = Integer.valueOf(st.nextToken()).intValue();\r
-                end = Integer.valueOf(st.nextToken()).intValue();\r
-              }\r
-            } else {\r
-              ids.addElement(headers.elementAt(i));\r
-            }\r
-          }  else {\r
-            ids.addElement(headers.elementAt(i));\r
+    public ClustalFile(String inStr) {\r
+        super(inStr);\r
+    }\r
+\r
+    public ClustalFile(String inFile, String type) throws IOException {\r
+        super(inFile, type);\r
+    }\r
 \r
-          }\r
-          Sequence newSeq = new Sequence(ids.elementAt(i).toString(),\r
-                                         seqhash.get(headers.elementAt(i).toString()).toString(),start,end);\r
+    public void initData() {\r
+        super.initData();\r
+        ids = new Vector();\r
+    }\r
 \r
-          seqs.addElement(newSeq);\r
+    public void parse() {\r
+        int i = 0;\r
+        boolean flag = false;\r
+\r
+        Vector headers = new Vector();\r
+        Hashtable seqhash = new Hashtable();\r
+\r
+        String line;\r
+\r
+        try {\r
+            while ((line = nextLine()) != null) {\r
+                if (line.indexOf(" ") != 0) {\r
+                    StringTokenizer str = new StringTokenizer(line, " ");\r
+                    String id = "";\r
+\r
+                    if (str.hasMoreTokens()) {\r
+                        id = str.nextToken();\r
+\r
+                        if (id.equals("CLUSTAL")) {\r
+                            flag = true;\r
+                        } else {\r
+                            if (flag) {\r
+                                StringBuffer tempseq;\r
+\r
+                                if (seqhash.containsKey(id)) {\r
+                                    tempseq = (StringBuffer) seqhash.get(id);\r
+                                } else {\r
+                                    tempseq = new StringBuffer();\r
+                                    seqhash.put(id, tempseq);\r
+                                }\r
+\r
+                                if (!(headers.contains(id))) {\r
+                                    headers.addElement(id);\r
+                                }\r
+\r
+                                if (str.hasMoreTokens()) {\r
+                                    tempseq.append(str.nextToken());\r
+                                }\r
+                            }\r
+                        }\r
+                    }\r
+                }\r
+            }\r
+        } catch (IOException e) {\r
+            System.err.println("Exception parsing clustal file " + e);\r
+            e.printStackTrace();\r
+        }\r
 \r
-        } else {\r
-          System.err.println("Clustal File Reader: Can't find sequence for " + headers.elementAt(i));\r
+        if (flag) {\r
+            this.noSeqs = headers.size();\r
+\r
+            //Add sequences to the hash\r
+            for (i = 0; i < headers.size(); i++) {\r
+                int start = -1;\r
+                int end = -1;\r
+\r
+                if (seqhash.get(headers.elementAt(i)) != null) {\r
+                    if (maxLength < seqhash.get(headers.elementAt(i)).toString()\r
+                                               .length()) {\r
+                        maxLength = seqhash.get(headers.elementAt(i)).toString()\r
+                                           .length();\r
+                    }\r
+\r
+                    String head = headers.elementAt(i).toString();\r
+                    start = 1;\r
+                    end = seqhash.get(headers.elementAt(i)).toString().length();\r
+\r
+                    if (head.indexOf("/") > 0) {\r
+                        StringTokenizer st = new StringTokenizer(head, "/");\r
+\r
+                        if (st.countTokens() == 2) {\r
+                            ids.addElement(st.nextToken());\r
+\r
+                            String tmp = st.nextToken();\r
+                            st = new StringTokenizer(tmp, "-");\r
+\r
+                            if (st.countTokens() == 2) {\r
+                                start = Integer.valueOf(st.nextToken())\r
+                                               .intValue();\r
+                                end = Integer.valueOf(st.nextToken()).intValue();\r
+                            }\r
+                        } else {\r
+                            ids.addElement(headers.elementAt(i));\r
+                        }\r
+                    } else {\r
+                        ids.addElement(headers.elementAt(i));\r
+                    }\r
+\r
+                    Sequence newSeq = new Sequence(ids.elementAt(i).toString(),\r
+                            seqhash.get(headers.elementAt(i).toString())\r
+                                   .toString(), start, end);\r
+\r
+                    seqs.addElement(newSeq);\r
+                } else {\r
+                    System.err.println(\r
+                        "Clustal File Reader: Can't find sequence for " +\r
+                        headers.elementAt(i));\r
+                }\r
+            }\r
         }\r
-      }\r
     }\r
 \r
-  }\r
+    public String print() {\r
+        return print(getSeqsAsArray());\r
+    }\r
+\r
+    public static String print(SequenceI[] s) {\r
+        StringBuffer out = new StringBuffer("CLUSTAL\n\n");\r
 \r
-  public String print() {\r
-    return print(getSeqsAsArray());\r
-  }\r
-  public static String print(SequenceI[] s) {\r
+        int max = 0;\r
+        int maxid = 0;\r
 \r
-    StringBuffer out = new StringBuffer("CLUSTAL\n\n");\r
+        int i = 0;\r
 \r
-    int max = 0;\r
-    int maxid = 0;\r
+        while ((i < s.length) && (s[i] != null)) {\r
+            String tmp = s[i].getName() + "/" + s[i].getStart() + "-" +\r
+                s[i].getEnd();\r
 \r
-    int i = 0;\r
+            if (s[i].getSequence().length() > max) {\r
+                max = s[i].getSequence().length();\r
+            }\r
 \r
-    while (i < s.length && s[i] != null) {\r
-      String tmp = s[i].getName() + "/" + s[i].getStart() + "-" + s[i].getEnd();\r
+            if (tmp.length() > maxid) {\r
+                maxid = tmp.length();\r
+            }\r
 \r
-      if (s[i].getSequence().length() > max) {\r
-        max = s[i].getSequence().length();\r
-      }\r
-      if (tmp.length() > maxid) {\r
-        maxid = tmp.length();\r
-      }\r
-      i++;\r
-    }\r
+            i++;\r
+        }\r
 \r
-    if (maxid < 15) {\r
-      maxid = 15;\r
-    }\r
-    maxid++;\r
-    int len = 60;\r
-    int nochunks =  max / len + 1;\r
-\r
-    for (i = 0; i < nochunks; i++) {\r
-      int j = 0;\r
-      while ( j < s.length && s[j] != null) {\r
-        out.append( new Format("%-" + maxid + "s").form(s[j].getName() + "/" + s[j].getStart() + "-" + s[j].getEnd()) + " ");\r
-        int start = i*len;\r
-        int end = start + len;\r
-\r
-        if (end < s[j].getSequence().length() && start < s[j].getSequence().length() )\r
-          out.append(s[j].getSequence().substring(start,end));\r
-        else\r
-        {\r
-          if (start < s[j].getSequence().length())\r
-            out.append(s[j].getSequence().substring(start));\r
+        if (maxid < 15) {\r
+            maxid = 15;\r
         }\r
-        out.append("\n");\r
-        j++;\r
-      }\r
-      out.append("\n");\r
 \r
-    }\r
+        maxid++;\r
+\r
+        int len = 60;\r
+        int nochunks = (max / len) + 1;\r
 \r
-    return out.toString();\r
-  }\r
+        for (i = 0; i < nochunks; i++) {\r
+            int j = 0;\r
 \r
+            while ((j < s.length) && (s[j] != null)) {\r
+                out.append(new Format("%-" + maxid + "s").form(s[j].getName() +\r
+                        "/" + s[j].getStart() + "-" + s[j].getEnd()) + " ");\r
 \r
+                int start = i * len;\r
+                int end = start + len;\r
+\r
+                if ((end < s[j].getSequence().length()) &&\r
+                        (start < s[j].getSequence().length())) {\r
+                    out.append(s[j].getSequence().substring(start, end));\r
+                } else {\r
+                    if (start < s[j].getSequence().length()) {\r
+                        out.append(s[j].getSequence().substring(start));\r
+                    }\r
+                }\r
+\r
+                out.append("\n");\r
+                j++;\r
+            }\r
+\r
+            out.append("\n");\r
+        }\r
+\r
+        return out.toString();\r
+    }\r
 }\r
index 3c6e5f9..5b21bfe 100755 (executable)
 * along with this program; if not, write to the Free Software\r
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
 */\r
-\r
 package jalview.io;\r
 \r
-import org.apache.axis.client.*;\r
-\r
-import java.io.*;\r
-\r
-import javax.activation.DataHandler;\r
 import org.apache.axis.AxisFault;\r
+import org.apache.axis.client.*;\r
 import org.apache.axis.encoding.XMLType;\r
-import javax.xml.rpc.ParameterMode;\r
-import javax.xml.namespace.QName;\r
-import org.apache.axis.encoding.ser.JAFDataHandlerSerializerFactory;\r
 import org.apache.axis.encoding.ser.JAFDataHandlerDeserializerFactory;\r
+import org.apache.axis.encoding.ser.JAFDataHandlerSerializerFactory;\r
 \r
+import java.io.*;\r
 \r
-public class EBIFetchClient\r
-{\r
-  Call call;\r
-  String format = "default";\r
-  String style = "raw";\r
-\r
-  public EBIFetchClient()\r
-  {\r
-    try{\r
-      call = (Call)new Service().createCall();\r
-      call.setTargetEndpointAddress(new java.net.URL(\r
-          "http://www.ebi.ac.uk/ws/services/Dbfetch"));\r
-    }catch(Exception ex){}\r
-  }\r
-\r
-\r
-  public String []  getSupportedDBs()\r
-  {\r
-       try{\r
-\r
-         call.setOperationName(new QName("urn:Dbfetch", "getSupportedDBs"));\r
-         call.setReturnType(XMLType.SOAP_ARRAY);\r
-         return (String[]) call.invoke(new Object[]{});\r
-\r
-       }catch(Exception ex){return null;}\r
-  }\r
+import javax.activation.DataHandler;\r
 \r
-  public String [] getSupportedFormats()\r
-  {\r
-      try{\r
-        call.setOperationName(new QName("urn:Dbfetch", "getSupportedFormats"));\r
-        call.setReturnType(XMLType.SOAP_ARRAY);\r
-        return (String[]) call.invoke(new Object[] {});\r
+import javax.xml.namespace.QName;\r
+import javax.xml.rpc.ParameterMode;\r
 \r
-      }catch(Exception ex){ return null; }\r
-   }\r
 \r
-   public String [] getSupportedStyles()\r
-   {\r
-        try{\r
-          call.setOperationName(new QName("urn:Dbfetch", "getSupportedStyles"));\r
-          call.setReturnType(XMLType.SOAP_ARRAY);\r
-          return (String[]) call.invoke(new Object[] {});\r
+public class EBIFetchClient {\r
+    Call call;\r
+    String format = "default";\r
+    String style = "raw";\r
 \r
-         }catch(Exception ex){return null;}\r
+    public EBIFetchClient() {\r
+        try {\r
+            call = (Call) new Service().createCall();\r
+            call.setTargetEndpointAddress(new java.net.URL(\r
+                    "http://www.ebi.ac.uk/ws/services/Dbfetch"));\r
+        } catch (Exception ex) {\r
+        }\r
     }\r
 \r
-    public String [] fetchData(String ids, String f, String s)\r
-    {\r
-      // ids should be of the form uniprot:25KD_SARPE;ADHR_DROPS;\r
-      // max 50 ids can be added at one time\r
-      try{\r
-        call.setOperationName(new QName("urn:Dbfetch", "fetchData"));\r
-        call.addParameter("query", XMLType.XSD_STRING, ParameterMode.IN);\r
-        call.addParameter("format", XMLType.XSD_STRING, ParameterMode.IN);\r
-        call.addParameter("style", XMLType.XSD_STRING, ParameterMode.IN);\r
-        call.setReturnType(XMLType.SOAP_ARRAY);\r
-\r
-        if (f != null)\r
-          format = f;\r
-\r
-        if (s != null)\r
-          style = s;\r
-\r
-        return (String[]) call.invoke(new Object[] {ids, format, style});\r
-\r
-      }catch(Exception ex){return null;}\r
+    public String[] getSupportedDBs() {\r
+        try {\r
+            call.setOperationName(new QName("urn:Dbfetch", "getSupportedDBs"));\r
+            call.setReturnType(XMLType.SOAP_ARRAY);\r
 \r
+            return (String[]) call.invoke(new Object[] {  });\r
+        } catch (Exception ex) {\r
+            return null;\r
+        }\r
     }\r
 \r
-    public String fetchDataFile(String arg, String f, String s)\r
-    {\r
-\r
-      if (f != null)\r
-        format = f;\r
+    public String[] getSupportedFormats() {\r
+        try {\r
+            call.setOperationName(new QName("urn:Dbfetch", "getSupportedFormats"));\r
+            call.setReturnType(XMLType.SOAP_ARRAY);\r
 \r
-      if (s != null)\r
-        style = s;\r
-\r
-\r
-      call.setOperationName(new QName("urn:Dbfetch", "fetchDataFile"));\r
-      call.addParameter("query", XMLType.XSD_STRING, ParameterMode.IN);\r
-      call.addParameter("format", XMLType.XSD_STRING, ParameterMode.IN);\r
-      call.addParameter("style", XMLType.XSD_STRING, ParameterMode.IN);\r
-\r
-      QName qnameAttachment = new QName("urn:Dbfetch", "DataHandler");\r
-      call.registerTypeMapping(javax.activation.DataSource.class,\r
-                               qnameAttachment,\r
-                               JAFDataHandlerSerializerFactory.class,\r
-                               JAFDataHandlerDeserializerFactory.class);\r
+            return (String[]) call.invoke(new Object[] {  });\r
+        } catch (Exception ex) {\r
+            return null;\r
+        }\r
+    }\r
 \r
-      call.setReturnType(qnameAttachment);\r
+    public String[] getSupportedStyles() {\r
+        try {\r
+            call.setOperationName(new QName("urn:Dbfetch", "getSupportedStyles"));\r
+            call.setReturnType(XMLType.SOAP_ARRAY);\r
 \r
-      try{\r
-        Object ret = call.invoke(new Object[]\r
-                                 {arg, format, style});\r
+            return (String[]) call.invoke(new Object[] {  });\r
+        } catch (Exception ex) {\r
+            return null;\r
+        }\r
+    }\r
 \r
-        if (null == ret)\r
-        {\r
-          System.err.println("Received null ");\r
-          throw new AxisFault("", "Received null", null, null);\r
+    public String[] fetchData(String ids, String f, String s) {\r
+        // ids should be of the form uniprot:25KD_SARPE;ADHR_DROPS;\r
+        // max 50 ids can be added at one time\r
+        try {\r
+            call.setOperationName(new QName("urn:Dbfetch", "fetchData"));\r
+            call.addParameter("query", XMLType.XSD_STRING, ParameterMode.IN);\r
+            call.addParameter("format", XMLType.XSD_STRING, ParameterMode.IN);\r
+            call.addParameter("style", XMLType.XSD_STRING, ParameterMode.IN);\r
+            call.setReturnType(XMLType.SOAP_ARRAY);\r
+\r
+            if (f != null) {\r
+                format = f;\r
+            }\r
+\r
+            if (s != null) {\r
+                style = s;\r
+            }\r
+\r
+            return (String[]) call.invoke(new Object[] { ids, format, style });\r
+        } catch (Exception ex) {\r
+            return null;\r
         }\r
-        if (ret instanceof String)\r
-        {\r
-          System.err.println("Received problem response from server: " + ret);\r
-          throw new AxisFault("", (String) ret, null, null);\r
+    }\r
+\r
+    public String fetchDataFile(String arg, String f, String s) {\r
+        if (f != null) {\r
+            format = f;\r
         }\r
-        if (! (ret instanceof DataHandler))\r
-        {\r
-          //The wrong type of object that what was expected.\r
-          System.err.println("Received problem response from server:" +\r
-                             ret.getClass().getName());\r
-          throw new AxisFault("", "Received problem response from server:" +\r
-                              ret.getClass().getName(), null, null);\r
 \r
+        if (s != null) {\r
+            style = s;\r
         }\r
-        //Still here, so far so good.\r
-        DataHandler rdh = (DataHandler) ret;\r
 \r
-        //From here we'll just treat the data resource as file.\r
-        String receivedfileName = rdh.getName(); //Get the filename.\r
+        call.setOperationName(new QName("urn:Dbfetch", "fetchDataFile"));\r
+        call.addParameter("query", XMLType.XSD_STRING, ParameterMode.IN);\r
+        call.addParameter("format", XMLType.XSD_STRING, ParameterMode.IN);\r
+        call.addParameter("style", XMLType.XSD_STRING, ParameterMode.IN);\r
 \r
-        if (receivedfileName == null)\r
-        {\r
-          System.err.println("Could not get the file name.");\r
-          throw new AxisFault("", "Could not get the file name.", null, null);\r
+        QName qnameAttachment = new QName("urn:Dbfetch", "DataHandler");\r
+        call.registerTypeMapping(javax.activation.DataSource.class,\r
+            qnameAttachment, JAFDataHandlerSerializerFactory.class,\r
+            JAFDataHandlerDeserializerFactory.class);\r
+\r
+        call.setReturnType(qnameAttachment);\r
+\r
+        try {\r
+            Object ret = call.invoke(new Object[] { arg, format, style });\r
+\r
+            if (null == ret) {\r
+                System.err.println("Received null ");\r
+                throw new AxisFault("", "Received null", null, null);\r
+            }\r
+\r
+            if (ret instanceof String) {\r
+                System.err.println("Received problem response from server: " +\r
+                    ret);\r
+                throw new AxisFault("", (String) ret, null, null);\r
+            }\r
+\r
+            if (!(ret instanceof DataHandler)) {\r
+                //The wrong type of object that what was expected.\r
+                System.err.println("Received problem response from server:" +\r
+                    ret.getClass().getName());\r
+                throw new AxisFault("",\r
+                    "Received problem response from server:" +\r
+                    ret.getClass().getName(), null, null);\r
+            }\r
+\r
+            //Still here, so far so good.\r
+            DataHandler rdh = (DataHandler) ret;\r
+\r
+            //From here we'll just treat the data resource as file.\r
+            String receivedfileName = rdh.getName(); //Get the filename.\r
+\r
+            if (receivedfileName == null) {\r
+                System.err.println("Could not get the file name.");\r
+                throw new AxisFault("", "Could not get the file name.", null,\r
+                    null);\r
+            }\r
+\r
+            if (arg.equalsIgnoreCase("medline")) {\r
+                return receivedfileName;\r
+            } else if (arg.equalsIgnoreCase("interpro")) {\r
+                return receivedfileName;\r
+            } else {\r
+                System.err.println(receivedfileName);\r
+            }\r
+        } catch (Exception ex) {\r
+            ex.printStackTrace();\r
         }\r
-        if (arg.equalsIgnoreCase("medline"))\r
-        {\r
-          return receivedfileName;\r
-        }\r
-        else if (arg.equalsIgnoreCase("interpro"))\r
-        {\r
-          return receivedfileName;\r
-        }\r
-        else\r
-          System.err.println(receivedfileName);\r
-      }catch(Exception ex)\r
-      {\r
-        ex.printStackTrace();\r
-      }\r
-\r
-      return "ERROR";\r
-    }\r
-\r
 \r
+        return "ERROR";\r
+    }\r
 }\r
index 7910340..7e7e06b 100755 (executable)
 * along with this program; if not, write to the Free Software\r
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
 */\r
-\r
 package jalview.io;\r
 \r
-import jalview.datamodel.*;\r
 import jalview.analysis.*;\r
 \r
+import jalview.datamodel.*;\r
+\r
 import java.io.*;\r
+\r
 import java.util.*;\r
 \r
+\r
 public class FastaFile extends AlignFile {\r
+    public FastaFile() {\r
+    }\r
 \r
-  public FastaFile()\r
-  {}\r
-\r
-  public FastaFile(String inStr) {\r
-    super(inStr);\r
-  }\r
-\r
-  public FastaFile(String inFile, String type) throws IOException {\r
-    super(inFile,type);\r
-  }\r
-\r
-  public void parse() throws IOException\r
-  {\r
-\r
-    String       id    = "";\r
-    StringBuffer seq   = new StringBuffer();\r
-    int          count = 0;\r
-    boolean      flag  = false;\r
-\r
-    int          sstart = 0;\r
-    int          send   = 0;\r
-\r
-    String line;\r
-\r
-      while ((line = nextLine()) != null) {\r
-\r
-       if (line.length() > 0) {\r
-\r
-         // Do we have an id line?\r
-\r
-         if (line.substring(0,1).equals(">")) {\r
-\r
-           if (count != 0) {\r
-             if (sstart != 0) {\r
-               seqs.addElement(new Sequence(id,seq.toString().toUpperCase(),sstart,send));\r
-             } else {\r
-               seqs.addElement(new Sequence(id,seq.toString().toUpperCase(),1,seq.length()));\r
-             }\r
-           }\r
-\r
-           count++;\r
-\r
-           StringTokenizer str = new StringTokenizer(line," ");\r
-\r
-           id = str.nextToken();\r
-           id = id.substring(1);\r
-            com.stevesoft.pat.Regex dbId = new com.stevesoft.pat.Regex("[A-Za-z-]+/[A-Za-z-]+\\|(\\w+)\\|(.+)");\r
-            if (dbId.search(id))\r
-               {\r
-                 String dbid = dbId.stringMatched(1);\r
-                 String idname = dbId.stringMatched(2);\r
-                 if (idname.length()>0 && idname.indexOf("_") > -1)\r
-                 {\r
-                   id = idname; // just use friendly name // JBPNote: we may lose uniprot standardised ID here.\r
-                 }\r
-                 else\r
-                 {\r
-                   id = dbid; // use dbid to ensure sensible queries\r
-                 }\r
-\r
-               }\r
-           if (id.indexOf("/") > 0 ) {\r
-\r
-             StringTokenizer st = new StringTokenizer(id,"/");\r
-             if (st.countTokens() == 2) {\r
-               id = st.nextToken();\r
-               String tmp = st.nextToken();\r
-\r
-               st = new StringTokenizer(tmp,"-");\r
-\r
-               if (st.countTokens() == 2) {\r
-                 sstart = Integer.valueOf(st.nextToken()).intValue();\r
-                 send   = Integer.valueOf(st.nextToken()).intValue();\r
-               }\r
-             }\r
-           }\r
-\r
-           seq = new StringBuffer();\r
-\r
-         } else {\r
-           seq = seq.append(line);\r
-         }\r
-       }\r
-      }\r
-      if (count > 0) {\r
-\r
-        if(!isValidProteinSequence(seq.toString().toUpperCase()))\r
-          throw new IOException("Invalid protein sequence");\r
-\r
-       if (sstart != 0) {\r
-         seqs.addElement(new Sequence(id,seq.toString().toUpperCase(),sstart,send));\r
-       } else {\r
-         seqs.addElement(new Sequence(id,seq.toString().toUpperCase(),1,seq.length()));\r
-       }\r
-      }\r
-\r
-  }\r
-\r
-  public static String print(SequenceI[] s) {\r
-    return print(s,72);\r
-  }\r
-  public static String print(SequenceI[] s, int len) {\r
-    return print(s,len,true);\r
-  }\r
-\r
-  public static String print(SequenceI[] s, int len,boolean gaps) {\r
-    return print(s,len,gaps,true);\r
-  }\r
-\r
-  public static String print(SequenceI[] s, int len,boolean gaps, boolean displayId) {\r
-    StringBuffer out = new StringBuffer();\r
-    int i = 0;\r
-    while (i < s.length && s[i] != null) {\r
-      String seq = "";\r
-      if (gaps) {\r
-        seq = s[i].getSequence();\r
-      } else {\r
-        seq = AlignSeq.extractGaps("-. ",s[i].getSequence());\r
-      }\r
-      // used to always put this here: + "/" + s[i].getStart() + "-" + s[i].getEnd() +\r
-      out.append(">" + ((displayId) ? s[i].getDisplayId() : s[i].getName())+"\n");\r
-\r
-      int nochunks = seq.length() / len + 1;\r
-\r
-      for (int j = 0; j < nochunks; j++) {\r
-        int start = j*len;\r
-        int end = start + len;\r
-\r
-        if (end < seq.length()) {\r
-          out.append(seq.substring(start,end) + "\n");\r
-        } else if (start < seq.length()) {\r
-          out.append(seq.substring(start) + "\n");\r
+    public FastaFile(String inStr) {\r
+        super(inStr);\r
+    }\r
+\r
+    public FastaFile(String inFile, String type) throws IOException {\r
+        super(inFile, type);\r
+    }\r
+\r
+    public void parse() throws IOException {\r
+        String id = "";\r
+        StringBuffer seq = new StringBuffer();\r
+        int count = 0;\r
+        boolean flag = false;\r
+\r
+        int sstart = 0;\r
+        int send = 0;\r
+\r
+        String line;\r
+\r
+        while ((line = nextLine()) != null) {\r
+            if (line.length() > 0) {\r
+                // Do we have an id line?\r
+                if (line.substring(0, 1).equals(">")) {\r
+                    if (count != 0) {\r
+                        if (sstart != 0) {\r
+                            seqs.addElement(new Sequence(id,\r
+                                    seq.toString().toUpperCase(), sstart, send));\r
+                        } else {\r
+                            seqs.addElement(new Sequence(id,\r
+                                    seq.toString().toUpperCase(), 1,\r
+                                    seq.length()));\r
+                        }\r
+                    }\r
+\r
+                    count++;\r
+\r
+                    StringTokenizer str = new StringTokenizer(line, " ");\r
+\r
+                    id = str.nextToken();\r
+                    id = id.substring(1);\r
+\r
+                    com.stevesoft.pat.Regex dbId = new com.stevesoft.pat.Regex(\r
+                            "[A-Za-z-]+/[A-Za-z-]+\\|(\\w+)\\|(.+)");\r
+\r
+                    if (dbId.search(id)) {\r
+                        String dbid = dbId.stringMatched(1);\r
+                        String idname = dbId.stringMatched(2);\r
+\r
+                        if ((idname.length() > 0) &&\r
+                                (idname.indexOf("_") > -1)) {\r
+                            id = idname; // just use friendly name // JBPNote: we may lose uniprot standardised ID here.\r
+                        } else {\r
+                            id = dbid; // use dbid to ensure sensible queries\r
+                        }\r
+                    }\r
+\r
+                    if (id.indexOf("/") > 0) {\r
+                        StringTokenizer st = new StringTokenizer(id, "/");\r
+\r
+                        if (st.countTokens() == 2) {\r
+                            id = st.nextToken();\r
+\r
+                            String tmp = st.nextToken();\r
+\r
+                            st = new StringTokenizer(tmp, "-");\r
+\r
+                            if (st.countTokens() == 2) {\r
+                                sstart = Integer.valueOf(st.nextToken())\r
+                                                .intValue();\r
+                                send = Integer.valueOf(st.nextToken()).intValue();\r
+                            }\r
+                        }\r
+                    }\r
+\r
+                    seq = new StringBuffer();\r
+                } else {\r
+                    seq = seq.append(line);\r
+                }\r
+            }\r
+        }\r
+\r
+        if (count > 0) {\r
+            if (!isValidProteinSequence(seq.toString().toUpperCase())) {\r
+                throw new IOException("Invalid protein sequence");\r
+            }\r
+\r
+            if (sstart != 0) {\r
+                seqs.addElement(new Sequence(id, seq.toString().toUpperCase(),\r
+                        sstart, send));\r
+            } else {\r
+                seqs.addElement(new Sequence(id, seq.toString().toUpperCase(),\r
+                        1, seq.length()));\r
+            }\r
         }\r
-      }\r
-      i++;\r
     }\r
-    return out.toString();\r
-  }\r
 \r
-  public String print() {\r
-    return print(getSeqsAsArray());\r
-  }\r
-}\r
+    public static String print(SequenceI[] s) {\r
+        return print(s, 72);\r
+    }\r
 \r
+    public static String print(SequenceI[] s, int len) {\r
+        return print(s, len, true);\r
+    }\r
+\r
+    public static String print(SequenceI[] s, int len, boolean gaps) {\r
+        return print(s, len, gaps, true);\r
+    }\r
+\r
+    public static String print(SequenceI[] s, int len, boolean gaps,\r
+        boolean displayId) {\r
+        StringBuffer out = new StringBuffer();\r
+        int i = 0;\r
+\r
+        while ((i < s.length) && (s[i] != null)) {\r
+            String seq = "";\r
+\r
+            if (gaps) {\r
+                seq = s[i].getSequence();\r
+            } else {\r
+                seq = AlignSeq.extractGaps("-. ", s[i].getSequence());\r
+            }\r
+\r
+            // used to always put this here: + "/" + s[i].getStart() + "-" + s[i].getEnd() +\r
+            out.append(">" +\r
+                ((displayId) ? s[i].getDisplayId() : s[i].getName()) + "\n");\r
+\r
+            int nochunks = (seq.length() / len) + 1;\r
 \r
+            for (int j = 0; j < nochunks; j++) {\r
+                int start = j * len;\r
+                int end = start + len;\r
 \r
+                if (end < seq.length()) {\r
+                    out.append(seq.substring(start, end) + "\n");\r
+                } else if (start < seq.length()) {\r
+                    out.append(seq.substring(start) + "\n");\r
+                }\r
+            }\r
+\r
+            i++;\r
+        }\r
+\r
+        return out.toString();\r
+    }\r
+\r
+    public String print() {\r
+        return print(getSeqsAsArray());\r
+    }\r
+}\r
index ea86ae0..0c46a17 100755 (executable)
 * along with this program; if not, write to the Free Software\r
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
 */\r
-\r
 package jalview.io;\r
 \r
 import java.io.*;\r
-import java.net.*;\r
-\r
-public class FileParse {\r
-\r
-  public File   inFile;\r
-  public int    fileSize;\r
-  public int    noLines;\r
 \r
-  protected String          type;\r
-  protected BufferedReader dataIn;\r
+import java.net.*;\r
 \r
-  public FileParse() {}\r
 \r
-  public FileParse(String fileStr, String type) throws MalformedURLException, IOException\r
-  {\r
+public class FileParse {\r
+    public File inFile;\r
+    public int fileSize;\r
+    public int noLines;\r
+    protected String type;\r
+    protected BufferedReader dataIn;\r
 \r
-    this.type = type;\r
+    public FileParse() {\r
+    }\r
 \r
-    if (type.equals("File")) {\r
-      this.inFile = new File(fileStr);\r
-      this.fileSize = (int)inFile.length();\r
+    public FileParse(String fileStr, String type)\r
+        throws MalformedURLException, IOException {\r
+        this.type = type;\r
+\r
+        if (type.equals("File")) {\r
+            this.inFile = new File(fileStr);\r
+            this.fileSize = (int) inFile.length();\r
+\r
+            dataIn = new BufferedReader(new FileReader(fileStr));\r
+        } else if (type.equals("URL")) {\r
+            URL url = new URL(fileStr);\r
+            this.fileSize = 0;\r
+            dataIn = new BufferedReader(new InputStreamReader(url.openStream()));\r
+        } else if (type.equals("Paste")) {\r
+            dataIn = new BufferedReader(new StringReader(fileStr));\r
+        }\r
+    }\r
 \r
-      dataIn = new BufferedReader(new FileReader( fileStr ));\r
+    public String nextLine() throws IOException {\r
+        String next = dataIn.readLine();\r
 \r
-    } else if (type.equals("URL")) {\r
-      URL url = new URL(fileStr);\r
-      this.fileSize = 0;\r
-      dataIn = new BufferedReader(new InputStreamReader( url.openStream() ));\r
-    } else if(type.equals("Paste"))\r
-    {\r
-      dataIn = new BufferedReader(new StringReader(fileStr));\r
-    }\r
-  }\r
+        if (next != null) {\r
+            noLines++;\r
+        }\r
 \r
-  public String nextLine() throws IOException {\r
-    String next = dataIn.readLine();\r
-    if (next != null) {\r
-      noLines++;\r
+        return next;\r
     }\r
-    return next;\r
-  }\r
-\r
 }\r
index 0382cee..e59c191 100755 (executable)
 * along with this program; if not, write to the Free Software\r
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
 */\r
-\r
 package jalview.io;\r
 \r
 import jalview.datamodel.*;\r
+\r
 import java.util.Vector;\r
-public class FormatAdapter\r
-{\r
-\r
-  public static Vector formats = new Vector();\r
-  static{\r
-    formats.addElement("FASTA");\r
-    formats.addElement("MSF");\r
-    formats.addElement("PileUp");\r
-    formats.addElement("CLUSTAL");\r
-    formats.addElement("BLC");\r
-    formats.addElement("PIR");\r
-    formats.addElement("PFAM");\r
-  }\r
-\r
-  public static SequenceI[] readFile(String inFile, String type, String format)\r
-  {\r
-\r
-    try\r
-    {\r
-      AlignFile afile = null;\r
-      if (format.equals("FASTA"))\r
-        afile = new FastaFile(inFile, type);\r
-      else if (format.equals("MSF"))\r
-        afile = new MSFfile(inFile, type);\r
-      else if (format.equals("PileUp"))\r
-              afile = new PileUpfile(inFile, type);\r
-      else if (format.equals("CLUSTAL"))\r
-        afile = new ClustalFile(inFile, type);\r
-      else if (format.equals("BLC"))\r
-        afile = new BLCFile(inFile, type);\r
-      else if (format.equals("PIR"))\r
-        afile = new PIRFile(inFile, type);\r
-      else if (format.equals("PFAM"))\r
-        afile = new PfamFile(inFile, type);\r
-\r
-      return afile.getSeqsAsArray();\r
-    }\r
-    catch (Exception e)  {\r
-    System.err.println("Failed to read alignment using the '"+format+"' reader.");\r
-    e.printStackTrace();\r
-    }\r
 \r
-    return null;\r
-  }\r
-\r
-\r
-  public static String formatSequences(String format, Vector seqs)\r
-  {\r
-    SequenceI [] s = new SequenceI[seqs.size()];\r
-\r
-    for (int i = 0; i < seqs.size(); i++)\r
-      s[i] = (SequenceI) seqs.elementAt(i);\r
-\r
-    try\r
-    {\r
-      AlignFile afile = null;\r
-      if (format.equals("FASTA"))\r
-        afile = new FastaFile();\r
-      else if (format.equals("MSF"))\r
-        afile = new MSFfile();\r
-      else if (format.equals("PileUp"))\r
-        afile = new PileUpfile();\r
-      else if (format.equals("CLUSTAL"))\r
-        afile = new ClustalFile();\r
-      else if (format.equals("BLC"))\r
-        afile = new BLCFile();\r
-      else if (format.equals("PIR"))\r
-        afile = new PIRFile();\r
-      else if (format.equals("PFAM"))\r
-        afile = new PfamFile();\r
-\r
-      afile.setSeqs(s);\r
-      return afile.print();\r
+\r
+public class FormatAdapter {\r
+    public static Vector formats = new Vector();\r
+\r
+    static {\r
+        formats.addElement("FASTA");\r
+        formats.addElement("MSF");\r
+        formats.addElement("PileUp");\r
+        formats.addElement("CLUSTAL");\r
+        formats.addElement("BLC");\r
+        formats.addElement("PIR");\r
+        formats.addElement("PFAM");\r
     }\r
-    catch (Exception e)  {\r
-      System.err.println("Failed to write alignment as a '"+format+"' file\n");\r
-      e.printStackTrace();\r
+\r
+    public static SequenceI[] readFile(String inFile, String type, String format) {\r
+        try {\r
+            AlignFile afile = null;\r
+\r
+            if (format.equals("FASTA")) {\r
+                afile = new FastaFile(inFile, type);\r
+            } else if (format.equals("MSF")) {\r
+                afile = new MSFfile(inFile, type);\r
+            } else if (format.equals("PileUp")) {\r
+                afile = new PileUpfile(inFile, type);\r
+            } else if (format.equals("CLUSTAL")) {\r
+                afile = new ClustalFile(inFile, type);\r
+            } else if (format.equals("BLC")) {\r
+                afile = new BLCFile(inFile, type);\r
+            } else if (format.equals("PIR")) {\r
+                afile = new PIRFile(inFile, type);\r
+            } else if (format.equals("PFAM")) {\r
+                afile = new PfamFile(inFile, type);\r
+            }\r
+\r
+            return afile.getSeqsAsArray();\r
+        } catch (Exception e) {\r
+            System.err.println("Failed to read alignment using the '" + format +\r
+                "' reader.");\r
+            e.printStackTrace();\r
+        }\r
+\r
+        return null;\r
     }\r
 \r
-    return null;\r
-  }\r
+    public static String formatSequences(String format, Vector seqs) {\r
+        SequenceI[] s = new SequenceI[seqs.size()];\r
+\r
+        for (int i = 0; i < seqs.size(); i++)\r
+            s[i] = (SequenceI) seqs.elementAt(i);\r
+\r
+        try {\r
+            AlignFile afile = null;\r
+\r
+            if (format.equals("FASTA")) {\r
+                afile = new FastaFile();\r
+            } else if (format.equals("MSF")) {\r
+                afile = new MSFfile();\r
+            } else if (format.equals("PileUp")) {\r
+                afile = new PileUpfile();\r
+            } else if (format.equals("CLUSTAL")) {\r
+                afile = new ClustalFile();\r
+            } else if (format.equals("BLC")) {\r
+                afile = new BLCFile();\r
+            } else if (format.equals("PIR")) {\r
+                afile = new PIRFile();\r
+            } else if (format.equals("PFAM")) {\r
+                afile = new PfamFile();\r
+            }\r
+\r
+            afile.setSeqs(s);\r
+\r
+            return afile.print();\r
+        } catch (Exception e) {\r
+            System.err.println("Failed to write alignment as a '" + format +\r
+                "' file\n");\r
+            e.printStackTrace();\r
+        }\r
+\r
+        return null;\r
+    }\r
 }\r
index 290dee7..54b9595 100755 (executable)
 * along with this program; if not, write to the Free Software\r
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
 */\r
-\r
 package jalview.io;\r
 \r
-import jalview.gui.*;\r
 import jalview.datamodel.*;\r
+\r
+import jalview.gui.*;\r
+\r
 import jalview.schemes.*;\r
+\r
 import java.awt.*;\r
-import javax.swing.*;\r
+\r
 import java.io.*;\r
-import java.util.*;\r
 \r
+import java.util.*;\r
 \r
-public class HTMLOutput\r
-{\r
-  AlignViewport av;\r
-  SequenceRenderer sr;\r
-  Color color;\r
-\r
-  public HTMLOutput(AlignViewport av)\r
-  {\r
-    this.av = av;\r
-    sr = new SequenceRenderer(av);\r
-    JalviewFileChooser chooser = new JalviewFileChooser(\r
-      jalview.bin.Cache.getProperty("LAST_DIRECTORY"),\r
-      new String[]{"html"},\r
-      new String[]{"HTML files"},\r
-      "HTML files");\r
-\r
-    chooser.setFileView(new JalviewFileView());\r
-    chooser.setDialogTitle("Save as HTML");\r
-    chooser.setToolTipText("Save");\r
-    int value = chooser.showSaveDialog(null);\r
-    if(value == JalviewFileChooser.APPROVE_OPTION)\r
-    {\r
-      String choice =  chooser.getSelectedFile().getPath();\r
-      jalview.bin.Cache.setProperty("LAST_DIRECTORY", chooser.getSelectedFile().getParent());\r
-      try{\r
-        PrintWriter out = new java.io.PrintWriter(new java.io.FileWriter(choice));\r
-        out.println("<HTML>");\r
-        out.println("<style type=\"text/css\">");\r
-        out.println("<!--");\r
-        out.print("td {font-family: \""+av.getFont().getFamily()+"\", \""+av.getFont().getName()+ "\", mono; "\r
-                   +"font-size: "+av.getFont().getSize()+"px; ");\r
-\r
-\r
-        if (av.getFont().getStyle() == Font.BOLD)\r
-           out.print("font-weight: BOLD; ");\r
-\r
-        if (av.getFont().getStyle() == Font.ITALIC)\r
-           out.print("font-style: italic; ");\r
-\r
-        out.println("text-align: center; }");\r
-\r
-        out.println("-->");\r
-        out.println("</style>");\r
-        out.println("<BODY>");\r
-\r
-\r
-        if(av.getWrapAlignment())\r
-           drawWrappedAlignment(out);\r
-        else\r
-           drawUnwrappedAlignment(out);\r
-\r
-        out.println("\n</body>\n</html>");\r
-        out.close();\r
-        jalview.util.BrowserLauncher.openURL( "file:///"+choice );\r
-      }\r
-      catch(Exception ex){ex.printStackTrace();}\r
-    }\r
-  }\r
+import javax.swing.*;\r
 \r
-  void drawUnwrappedAlignment(PrintWriter out)\r
-  {\r
 \r
-    out.println("<table border=\"1\"><tr><td>\n");\r
-    out.println("<table border=\"0\"  cellpadding=\"0\" cellspacing=\"0\">\n");\r
+public class HTMLOutput {\r
+    AlignViewport av;\r
+    SequenceRenderer sr;\r
+    Color color;\r
 \r
+    public HTMLOutput(AlignViewport av) {\r
+        this.av = av;\r
+        sr = new SequenceRenderer(av);\r
 \r
-    //////////////\r
-    SequenceGroup [] groups;\r
-    SequenceI seq;\r
-    ColourSchemeI cs = null;\r
-    AlignmentI alignment = av.getAlignment();\r
-    String r,g,b;\r
+        JalviewFileChooser chooser = new JalviewFileChooser(jalview.bin.Cache.getProperty(\r
+                    "LAST_DIRECTORY"), new String[] { "html" },\r
+                new String[] { "HTML files" }, "HTML files");\r
 \r
-  // draws the top row, the measure rule\r
-    out.println("<tr><td colspan=\"6\"></td>");\r
-    int i=0;\r
-    for(i=10; i<alignment.getWidth()-10; i+=10)\r
-      out.println("<td colspan=\"9\">"+i+"<br>|</td><td></td>");\r
+        chooser.setFileView(new JalviewFileView());\r
+        chooser.setDialogTitle("Save as HTML");\r
+        chooser.setToolTipText("Save");\r
 \r
-    out.println("<td colspan=\"3\"></td><td colspan=\"3\">"+i+"<br>|</td>");\r
-    out.println("</tr>");\r
+        int value = chooser.showSaveDialog(null);\r
 \r
-    for (i = 0; i < alignment.getHeight(); i++)\r
-    {\r
-      seq = alignment.getSequenceAt(i);\r
-      groups = alignment.findAllGroups( seq );\r
-      if(av.getShowFullId())\r
-        out.println("<tr><td nowrap>"+seq.getDisplayId()+"&nbsp;&nbsp;</td>");\r
-      else\r
-        out.println("<tr><td nowrap>"+seq.getName()+"&nbsp;&nbsp;</td>");\r
+        if (value == JalviewFileChooser.APPROVE_OPTION) {\r
+            String choice = chooser.getSelectedFile().getPath();\r
+            jalview.bin.Cache.setProperty("LAST_DIRECTORY",\r
+                chooser.getSelectedFile().getParent());\r
 \r
+            try {\r
+                PrintWriter out = new java.io.PrintWriter(new java.io.FileWriter(\r
+                            choice));\r
+                out.println("<HTML>");\r
+                out.println("<style type=\"text/css\">");\r
+                out.println("<!--");\r
+                out.print("td {font-family: \"" + av.getFont().getFamily() +\r
+                    "\", \"" + av.getFont().getName() + "\", mono; " +\r
+                    "font-size: " + av.getFont().getSize() + "px; ");\r
 \r
+                if (av.getFont().getStyle() == Font.BOLD) {\r
+                    out.print("font-weight: BOLD; ");\r
+                }\r
 \r
-      for (int res = 0; res < seq.getLength(); res++)\r
-      {\r
-        cs = av.getGlobalColourScheme();\r
+                if (av.getFont().getStyle() == Font.ITALIC) {\r
+                    out.print("font-style: italic; ");\r
+                }\r
 \r
-        if(groups!=null)\r
-         {\r
-           for (int k = 0; k < groups.length; k++)\r
-             if (groups[k].getStartRes() <= res && groups[k].getEndRes() >= res)\r
-             {\r
-               cs = groups[k].cs;\r
-               break;\r
-             }\r
-         }\r
+                out.println("text-align: center; }");\r
 \r
+                out.println("-->");\r
+                out.println("</style>");\r
+                out.println("<BODY>");\r
 \r
-        color = sr.getResidueBoxColour(cs, seq, res);\r
+                if (av.getWrapAlignment()) {\r
+                    drawWrappedAlignment(out);\r
+                } else {\r
+                    drawUnwrappedAlignment(out);\r
+                }\r
 \r
-        if(color.getRGB()<-1)\r
-        {\r
-          out.println("<td bgcolor=\"#"\r
-                      + jalview.util.Format.getHexString(color)\r
-                      + "\">"+seq.getCharAt(res)+"</td>");\r
+                out.println("\n</body>\n</html>");\r
+                out.close();\r
+                jalview.util.BrowserLauncher.openURL("file:///" + choice);\r
+            } catch (Exception ex) {\r
+                ex.printStackTrace();\r
+            }\r
         }\r
-        else\r
-          out.println("<td>"+seq.getCharAt(res)+"</td>");\r
-\r
-      }\r
-\r
-      out.println("</tr>");\r
     }\r
-    //////////////\r
-    out.println("</table>");\r
-    out.println("</td></tr></table>");\r
-\r
-  }\r
-\r
-  void drawWrappedAlignment(PrintWriter out)\r
-  {\r
-     ////////////////////////////////////\r
-     /// How many sequences and residues can we fit on a printable page?\r
-     AlignmentI al = av.getAlignment();\r
-     SequenceGroup [] groups;\r
-     SequenceI seq;\r
-     ColourSchemeI cs = null;\r
-     String r,g,b;\r
-\r
-     out.println("<table border=\"1\"><tr><td>\n");\r
-     out.println("<table border=\"0\"  cellpadding=\"0\" cellspacing=\"0\">\n");\r
-\r
-     for(int startRes=0; startRes<al.getWidth(); startRes+=av.getChunkWidth())\r
-     {\r
-\r
-       int endRes = startRes+av.getChunkWidth();\r
-       if(endRes>al.getWidth())\r
-           endRes = al.getWidth();\r
-\r
-     out.println("<tr>");\r
-     out.println("<td colspan=\"6\">&nbsp;</td>");\r
-     for (int i = startRes+10; i < endRes; i += 10)\r
-       out.println("<td colspan=\"9\">" + i + "<br>|</td><td></td>");\r
-\r
-    // out.println("<td colspan=\"3\"></td><td colspan=\"3\">" + i +\r
-    //             "<br>|</td>");\r
-     out.println("</tr>");\r
-\r
-\r
-\r
-       for (int s = 0; s < al.getHeight(); s++)\r
-       {\r
-         out.println("<tr>");\r
-         seq = al.getSequenceAt(s);\r
-         groups = al.findAllGroups( seq );\r
-         if(av.getShowFullId())\r
-           out.println("<td nowrap>"+seq.getDisplayId()+"&nbsp;&nbsp;</td>");\r
-         else\r
-           out.println("<td nowrap>"+seq.getName()+"&nbsp;&nbsp;</td>");\r
-\r
-         for (int res = startRes; res < endRes; res++)\r
-              {\r
+\r
+    void drawUnwrappedAlignment(PrintWriter out) {\r
+        out.println("<table border=\"1\"><tr><td>\n");\r
+        out.println(\r
+            "<table border=\"0\"  cellpadding=\"0\" cellspacing=\"0\">\n");\r
+\r
+        //////////////\r
+        SequenceGroup[] groups;\r
+        SequenceI seq;\r
+        ColourSchemeI cs = null;\r
+        AlignmentI alignment = av.getAlignment();\r
+        String r;\r
+        String g;\r
+        String b;\r
+\r
+        // draws the top row, the measure rule\r
+        out.println("<tr><td colspan=\"6\"></td>");\r
+\r
+        int i = 0;\r
+\r
+        for (i = 10; i < (alignment.getWidth() - 10); i += 10)\r
+            out.println("<td colspan=\"9\">" + i + "<br>|</td><td></td>");\r
+\r
+        out.println("<td colspan=\"3\"></td><td colspan=\"3\">" + i +\r
+            "<br>|</td>");\r
+        out.println("</tr>");\r
+\r
+        for (i = 0; i < alignment.getHeight(); i++) {\r
+            seq = alignment.getSequenceAt(i);\r
+            groups = alignment.findAllGroups(seq);\r
+\r
+            if (av.getShowFullId()) {\r
+                out.println("<tr><td nowrap>" + seq.getDisplayId() +\r
+                    "&nbsp;&nbsp;</td>");\r
+            } else {\r
+                out.println("<tr><td nowrap>" + seq.getName() +\r
+                    "&nbsp;&nbsp;</td>");\r
+            }\r
+\r
+            for (int res = 0; res < seq.getLength(); res++) {\r
                 cs = av.getGlobalColourScheme();\r
-                if(groups!=null)\r
-                 {\r
-                   for (int k = 0; k < groups.length; k++)\r
-                     if (groups[k].getStartRes() <= res && groups[k].getEndRes() >= res)\r
-                     {\r
-                       cs = groups[k].cs;\r
-                       break;\r
-                     }\r
-                 }\r
+\r
+                if (groups != null) {\r
+                    for (int k = 0; k < groups.length; k++)\r
+                        if ((groups[k].getStartRes() <= res) &&\r
+                                (groups[k].getEndRes() >= res)) {\r
+                            cs = groups[k].cs;\r
+\r
+                            break;\r
+                        }\r
+                }\r
 \r
                 color = sr.getResidueBoxColour(cs, seq, res);\r
 \r
-                if(color.getRGB()<-1)\r
-                {\r
-                  r = Integer.toHexString(color.getRed());\r
-                  if(r.length()<2)\r
-                    r = "0"+r;\r
-                  g = Integer.toHexString(color.getGreen());\r
-                  if(g.length()<2)\r
-                    g = "0"+g;\r
-                  b = Integer.toHexString(color.getBlue());\r
-                  if(b.length()<2)\r
-                    b = "0"+b;\r
-                  out.println("<td bgcolor=\"#"+ r + g + b + "\">"+seq.getCharAt(res)+"</td>");\r
+                if (color.getRGB() < -1) {\r
+                    out.println("<td bgcolor=\"#" +\r
+                        jalview.util.Format.getHexString(color) + "\">" +\r
+                        seq.getCharAt(res) + "</td>");\r
+                } else {\r
+                    out.println("<td>" + seq.getCharAt(res) + "</td>");\r
+                }\r
+            }\r
+\r
+            out.println("</tr>");\r
+        }\r
+\r
+        //////////////\r
+        out.println("</table>");\r
+        out.println("</td></tr></table>");\r
+    }\r
+\r
+    void drawWrappedAlignment(PrintWriter out) {\r
+        ////////////////////////////////////\r
+        /// How many sequences and residues can we fit on a printable page?\r
+        AlignmentI al = av.getAlignment();\r
+        SequenceGroup[] groups;\r
+        SequenceI seq;\r
+        ColourSchemeI cs = null;\r
+        String r;\r
+        String g;\r
+        String b;\r
+\r
+        out.println("<table border=\"1\"><tr><td>\n");\r
+        out.println(\r
+            "<table border=\"0\"  cellpadding=\"0\" cellspacing=\"0\">\n");\r
+\r
+        for (int startRes = 0; startRes < al.getWidth();\r
+                startRes += av.getChunkWidth()) {\r
+            int endRes = startRes + av.getChunkWidth();\r
+\r
+            if (endRes > al.getWidth()) {\r
+                endRes = al.getWidth();\r
+            }\r
+\r
+            out.println("<tr>");\r
+            out.println("<td colspan=\"6\">&nbsp;</td>");\r
+\r
+            for (int i = startRes + 10; i < endRes; i += 10)\r
+                out.println("<td colspan=\"9\">" + i + "<br>|</td><td></td>");\r
+\r
+            // out.println("<td colspan=\"3\"></td><td colspan=\"3\">" + i +\r
+            //             "<br>|</td>");\r
+            out.println("</tr>");\r
+\r
+            for (int s = 0; s < al.getHeight(); s++) {\r
+                out.println("<tr>");\r
+                seq = al.getSequenceAt(s);\r
+                groups = al.findAllGroups(seq);\r
+\r
+                if (av.getShowFullId()) {\r
+                    out.println("<td nowrap>" + seq.getDisplayId() +\r
+                        "&nbsp;&nbsp;</td>");\r
+                } else {\r
+                    out.println("<td nowrap>" + seq.getName() +\r
+                        "&nbsp;&nbsp;</td>");\r
                 }\r
-                else\r
-                  out.println("<td>"+seq.getCharAt(res)+"</td>");\r
 \r
-              }\r
+                for (int res = startRes; res < endRes; res++) {\r
+                    cs = av.getGlobalColourScheme();\r
+\r
+                    if (groups != null) {\r
+                        for (int k = 0; k < groups.length; k++)\r
+                            if ((groups[k].getStartRes() <= res) &&\r
+                                    (groups[k].getEndRes() >= res)) {\r
+                                cs = groups[k].cs;\r
 \r
-         out.println("</tr>");\r
+                                break;\r
+                            }\r
+                    }\r
 \r
-       }\r
-       if(endRes<al.getWidth())\r
-           out.println("<tr><td height=\"5\"></td></tr>");\r
+                    color = sr.getResidueBoxColour(cs, seq, res);\r
 \r
+                    if (color.getRGB() < -1) {\r
+                        r = Integer.toHexString(color.getRed());\r
 \r
+                        if (r.length() < 2) {\r
+                            r = "0" + r;\r
+                        }\r
 \r
-     }\r
+                        g = Integer.toHexString(color.getGreen());\r
 \r
-    out.println("</table>");\r
-    out.println("</table>");\r
+                        if (g.length() < 2) {\r
+                            g = "0" + g;\r
+                        }\r
 \r
+                        b = Integer.toHexString(color.getBlue());\r
 \r
+                        if (b.length() < 2) {\r
+                            b = "0" + b;\r
+                        }\r
 \r
-  }\r
+                        out.println("<td bgcolor=\"#" + r + g + b + "\">" +\r
+                            seq.getCharAt(res) + "</td>");\r
+                    } else {\r
+                        out.println("<td>" + seq.getCharAt(res) + "</td>");\r
+                    }\r
+                }\r
+\r
+                out.println("</tr>");\r
+            }\r
 \r
+            if (endRes < al.getWidth()) {\r
+                out.println("<tr><td height=\"5\"></td></tr>");\r
+            }\r
+        }\r
 \r
+        out.println("</table>");\r
+        out.println("</table>");\r
+    }\r
 }\r
index f1cf1e0..2442b4b 100755 (executable)
 * along with this program; if not, write to the Free Software\r
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
 */\r
-\r
 package jalview.io;\r
 \r
 import java.io.*;\r
+\r
 import java.net.*;\r
 \r
-public class IdentifyFile\r
-{\r
-  public static String Identify(String file, String protocol)\r
-  {\r
-    String reply = "PFAM";\r
-    try{\r
-\r
-      BufferedReader reader = null;\r
-\r
-      if(protocol.equals("File"))\r
-        reader = new BufferedReader(new FileReader(file));\r
-\r
-      else if (protocol.equals("URL"))\r
-      {\r
-        reply = "URL NOT FOUND";\r
-        URL url = new URL(file);\r
-        reader = new BufferedReader(new InputStreamReader( url.openStream() ) );\r
-        reply = "error";\r
-      }\r
-      else if( protocol.equals("Paste"))\r
-        reader = new BufferedReader( new StringReader(file) );\r
-\r
-\r
-      String data;\r
-      while( (data=reader.readLine())!=null)\r
-      {\r
-        data = data.toUpperCase();\r
-        if(data.indexOf("#")==0 || data.length()<1)\r
-          continue;\r
-\r
-        if(data.indexOf("PILEUP")>-1)\r
-        {\r
-          reply = "PileUp";\r
-          break;\r
-        }\r
-        if((data.indexOf("//")==0)\r
-           || ((data.indexOf("!!")>-1)\r
-           && (data.indexOf("!!")<data.indexOf("_MULTIPLE_ALIGNMENT "))))\r
-        {\r
-          reply = "MSF";\r
-          break;\r
-        }\r
-        else if(data.indexOf("CLUSTAL")>-1)\r
-        {\r
-          reply = "CLUSTAL";\r
-          break;\r
-        }\r
-        else if(data.indexOf(">P1;")>-1 || data.indexOf(">DL;")>-1)\r
-        {\r
-          reply = "PIR";\r
-          break;\r
-        }\r
-        else if(data.indexOf(">")>-1)\r
-        {\r
-          // could be BLC file, read next line to confirm\r
-          data = reader.readLine();\r
-          if(data.indexOf(">")>-1)\r
-            reply = "BLC";\r
-          else\r
-            reply = "FASTA";\r
-\r
-            break;\r
-        }\r
-      }\r
-      reader.close();\r
-    }\r
-    catch(Exception ex){\r
-      System.err.println("File Identification failed!\n"+ex);}\r
 \r
-    return reply;\r
-  }\r
+public class IdentifyFile {\r
+    public static String Identify(String file, String protocol) {\r
+        String reply = "PFAM";\r
+\r
+        try {\r
+            BufferedReader reader = null;\r
+\r
+            if (protocol.equals("File")) {\r
+                reader = new BufferedReader(new FileReader(file));\r
+            }\r
+            else if (protocol.equals("URL")) {\r
+                reply = "URL NOT FOUND";\r
+\r
+                URL url = new URL(file);\r
+                reader = new BufferedReader(new InputStreamReader(\r
+                            url.openStream()));\r
+                reply = "error";\r
+            } else if (protocol.equals("Paste")) {\r
+                reader = new BufferedReader(new StringReader(file));\r
+            }\r
+\r
+            String data;\r
 \r
+            while ((data = reader.readLine()) != null) {\r
+                data = data.toUpperCase();\r
 \r
+                if ((data.indexOf("#") == 0) || (data.length() < 1)) {\r
+                    continue;\r
+                }\r
+\r
+                if (data.indexOf("PILEUP") > -1) {\r
+                    reply = "PileUp";\r
+\r
+                    break;\r
+                }\r
+\r
+                if ((data.indexOf("//") == 0) ||\r
+                        ((data.indexOf("!!") > -1) &&\r
+                        (data.indexOf("!!") < data.indexOf(\r
+                            "_MULTIPLE_ALIGNMENT ")))) {\r
+                    reply = "MSF";\r
+\r
+                    break;\r
+                } else if (data.indexOf("CLUSTAL") > -1) {\r
+                    reply = "CLUSTAL";\r
+\r
+                    break;\r
+                } else if ((data.indexOf(">P1;") > -1) ||\r
+                        (data.indexOf(">DL;") > -1)) {\r
+                    reply = "PIR";\r
+\r
+                    break;\r
+                } else if (data.indexOf(">") > -1) {\r
+                    // could be BLC file, read next line to confirm\r
+                    data = reader.readLine();\r
+\r
+                    if (data.indexOf(">") > -1) {\r
+                        reply = "BLC";\r
+                    } else {\r
+                        reply = "FASTA";\r
+                    }\r
+\r
+                    break;\r
+                }\r
+            }\r
+\r
+            reader.close();\r
+        } catch (Exception ex) {\r
+            System.err.println("File Identification failed!\n" + ex);\r
+        }\r
+\r
+        return reply;\r
+    }\r
 }\r
index 38addf7..12be9de 100755 (executable)
 * 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
-*/
-
+*/\r
+\r
 /**
  * PredFile.java
  * JalviewX / Vamsas Project
  * JPred.seq.concise reader
- */
-
-package jalview.io;
-
-import jalview.datamodel.*;
-import jalview.util.*;
-
-import java.io.*;
-import java.util.*;
-
-public class JPredFile
-    extends AlignFile
-{
-  Vector ids;
-  Vector conf;
-  Hashtable Scores; // Hash of names and score vectors
-  Hashtable Symscores; // indexes of symbol annotation properties in sequenceI vector
-  private int QuerySeqPosition;
-  public void setQuerySeqPosition(int QuerySeqPosition)
-  {
-    this.QuerySeqPosition = QuerySeqPosition;
-  }
-
-  public int getQuerySeqPosition()
-  {
-    return QuerySeqPosition;
-  }
-  public Hashtable getScores() {
-    return Scores;
-  }
-  public Hashtable getSymscores() {
-    return Symscores;
-  }
-
-  public JPredFile(String inStr)
-  {
-    super(inStr);
-  }
-
-  public void initData()
-  {
-
-    super.initData();
-    Scores = new Hashtable();
-    ids = null;
-    conf = null;
-  }
-
-  public JPredFile(String inFile, String type)
-      throws IOException
-  {
-
-    super(inFile, type);
-  }
+ */\r
+package jalview.io;\r
+\r
+import jalview.datamodel.*;\r
+\r
+import jalview.util.*;\r
+\r
+import java.io.*;\r
+\r
+import java.util.*;\r
+\r
+\r
+public class JPredFile extends AlignFile {\r
+    Vector ids;\r
+    Vector conf;\r
+    Hashtable Scores; // Hash of names and score vectors\r
+    Hashtable Symscores; // indexes of symbol annotation properties in sequenceI vector\r
+    private int QuerySeqPosition;\r
+\r
+    public JPredFile(String inStr) {\r
+        super(inStr);\r
+    }\r
+\r
+    public JPredFile(String inFile, String type) throws IOException {\r
+        super(inFile, type);\r
+    }\r
+\r
+    public void setQuerySeqPosition(int QuerySeqPosition) {\r
+        this.QuerySeqPosition = QuerySeqPosition;\r
+    }\r
+\r
+    public int getQuerySeqPosition() {\r
+        return QuerySeqPosition;\r
+    }\r
+\r
+    public Hashtable getScores() {\r
+        return Scores;\r
+    }\r
+\r
+    public Hashtable getSymscores() {\r
+        return Symscores;\r
+    }\r
+\r
+    public void initData() {\r
+        super.initData();\r
+        Scores = new Hashtable();\r
+        ids = null;\r
+        conf = null;\r
+    }\r
+\r
+    /**
+ * parse a JPred concise file into a sequence-alignment like object.
+ */\r
+    public void parse() throws IOException {\r
+        // JBPNote log.System.out.println("all read in ");\r
+        String line;\r
+        QuerySeqPosition = -1;\r
+        noSeqs = 0;\r
+\r
+        Vector seq_entries = new Vector();\r
+        Vector ids = new Vector();\r
+        Hashtable Symscores = new Hashtable();\r
+\r
+        while ((line = nextLine()) != null) {\r
+            // Concise format allows no comments or non comma-formatted data\r
+            StringTokenizer str = new StringTokenizer(line, ":");\r
+            String id = "";\r
+\r
+            if (!str.hasMoreTokens()) {\r
+                continue;\r
+            }\r
+\r
+            id = str.nextToken();\r
+\r
+            String seqsym = str.nextToken();\r
+            StringTokenizer symbols = new StringTokenizer(seqsym, ",");\r
+\r
+            // decide if we have more than just alphanumeric symbols\r
+            int numSymbols = symbols.countTokens();\r
+\r
+            if (numSymbols == 0) {\r
+                continue;\r
+            }\r
+\r
+            if (seqsym.length() != (2 * numSymbols)) {\r
+                // Set of scalars for some property\r
+                if (Scores.containsKey(id)) {\r
+                    int i = 1;\r
+\r
+                    while (Scores.containsKey(id + "_" + i)) {\r
+                        i++;\r
+                    }\r
+\r
+                    id = id + "_" + i;\r
+                }\r
+\r
+                Vector scores = new Vector();\r
+\r
+                // Typecheck from first entry\r
+                int i = 0;\r
+                String ascore = "dead";\r
+\r
+                try {\r
+                    // store elements as floats...\r
+                    while (symbols.hasMoreTokens()) {\r
+                        ascore = symbols.nextToken();\r
+\r
+                        Float score = new Float(ascore);\r
+                        scores.addElement((Object) score);\r
+                    }\r
+\r
+                    Scores.put(id, scores);\r
+                } catch (Exception e) {\r
+                    // or just keep them as strings\r
+                    i = scores.size();\r
+\r
+                    for (int j = 0; j < i; j++) {\r
+                        scores.set(j,\r
+                            (Object) ((Float) scores.get(j)).toString());\r
+                    }\r
+\r
+                    scores.addElement((Object) ascore);\r
+\r
+                    while (symbols.hasMoreTokens()) {\r
+                        ascore = symbols.nextToken();\r
+                        scores.addElement((Object) ascore);\r
+                    }\r
+\r
+                    Scores.put(id, scores);\r
+                }\r
+            } else if (id.equals("jnetconf")) {\r
+                // log.debug System.out.println("here");\r
+                id = "Prediction Confidence";\r
+                this.conf = new Vector(numSymbols);\r
+\r
+                for (int i = 0; i < numSymbols; i++) {\r
+                    conf.set(i, (Object) symbols.nextToken());\r
+                }\r
+            } else {\r
+                // Sequence or a prediction string (rendered as sequence)\r
+                StringBuffer newseq = new StringBuffer();\r
+\r
+                for (int i = 0; i < numSymbols; i++) {\r
+                    newseq.append(symbols.nextToken());\r
+                }\r
+\r
+                if (id.indexOf(";") > -1) {\r
+                    seq_entries.addElement(newseq);\r
+\r
+                    int i = 1;\r
+                    String name = id.substring(id.indexOf(";") + 1);\r
+\r
+                    while (ids.lastIndexOf(name) > -1) {\r
+                        name = id.substring(id.indexOf(";") + 1) + "_" + 1;\r
+                    }\r
+\r
+                    ids.addElement(name);\r
+\r
+                    noSeqs++;\r
+                } else {\r
+                    if (id.equals("JNETPRED")) {\r
+                        id = "Predicted Secondary Structure";\r
+                    }\r
+\r
+                    seq_entries.addElement(newseq.toString());\r
+                    ids.addElement(id);\r
+                    Symscores.put((Object) id,\r
+                        (Object) new Integer(ids.size() - 1));\r
+                }\r
+            }\r
+        }\r
+\r
+        if (noSeqs < 1) {\r
+            throw new IOException(\r
+                "JpredFile Parser: No sequence in the prediction!");\r
+        }\r
+\r
+        maxLength = seq_entries.elementAt(0).toString().length();\r
+\r
+        for (int i = 0; i < ids.size(); i++) {\r
+            // Add all sequence like objects\r
+            Sequence newSeq = new Sequence(ids.elementAt(i).toString(),\r
+                    seq_entries.elementAt(i).toString(), 1,\r
+                    seq_entries.elementAt(i).toString().length());\r
+\r
+            if (!Symscores.containsKey(ids.elementAt(i)) &&\r
+                    !isValidProteinSequence(newSeq.getSequence())) {\r
+                throw new IOException(\r
+                    "JPredConcise: Not a valid protein sequence - (" +\r
+                    ids.elementAt(i).toString() + ")");\r
+            }\r
+\r
+            if (maxLength != seq_entries.elementAt(i).toString().length()) {\r
+                throw new IOException("JPredConcise: Entry (" +\r
+                    ids.elementAt(i).toString() +\r
+                    ") has an unexpected number of columns");\r
+            }\r
+\r
+            if (newSeq.getName().startsWith("QUERY") &&\r
+                    (QuerySeqPosition == -1)) {\r
+                QuerySeqPosition = seqs.size();\r
+            }\r
+\r
+            seqs.addElement(newSeq);\r
+        }\r
+    }\r
+\r
+    /**
+ * print
+ *
+ * @return String
+   */\r
+    public String print() {\r
+        return "Not Supported";\r
+    }\r
+\r
+    public static void main(String[] args) {\r
+        try {\r
+            JPredFile blc = new JPredFile(args[0], "File");\r
+\r
+            for (int i = 0; i < blc.seqs.size(); i++) {\r
+                System.out.println(((Sequence) blc.seqs.elementAt(i)).getName() +\r
+                    "\n" + ((Sequence) blc.seqs.elementAt(i)).getSequence() +\r
+                    "\n");\r
+            }\r
+        } catch (java.io.IOException e) {\r
+            System.err.println("Exception " + e);\r
+            e.printStackTrace();\r
+        }\r
+    }\r
+}\r
+\r
+\r
+/*
+ StringBuffer out = new StringBuffer();
+
+ out.append("START PRED\n");
+ for (int i = 0; i < s[0].sequence.length(); i++)
+ {
+  out.append(s[0].sequence.substring(i, i + 1) + " ");
+  out.append(s[1].sequence.substring(i, i + 1) + " ");
+  out.append(s[1].score[0].elementAt(i) + " ");
+  out.append(s[1].score[1].elementAt(i) + " ");
+  out.append(s[1].score[2].elementAt(i) + " ");
+  out.append(s[1].score[3].elementAt(i) + " ");
+
+  out.append("\n");
+ }
+ out.append("END PRED\n");
+ return out.toString();
+ }
 
-  /**
-   * parse a JPred concise file into a sequence-alignment like object.
-   */
-  public void parse()
-      throws IOException
+    public static void main(String[] args)
+ {
+  try
   {
-    // JBPNote log.System.out.println("all read in ");
-    String line;
-    QuerySeqPosition = -1;
-    noSeqs = 0;
-    Vector seq_entries = new Vector();
-    Vector ids = new Vector();
-    Hashtable Symscores = new Hashtable();
-    while ( (line = nextLine()) != null)
+    BLCFile blc = new BLCFile(args[0], "File");
+    DrawableSequence[] s = new DrawableSequence[blc.seqs.size()];
+    for (int i = 0; i < blc.seqs.size(); i++)
     {
-      // Concise format allows no comments or non comma-formatted data
-      StringTokenizer str = new StringTokenizer(line, ":");
-      String id = "";
-      if (!str.hasMoreTokens())
-      {
-        continue;
-      }
-
-      id = str.nextToken();
-      String seqsym = str.nextToken();
-      StringTokenizer symbols = new StringTokenizer(seqsym, ",");
-      // decide if we have more than just alphanumeric symbols
-      int numSymbols = symbols.countTokens();
-
-      if (numSymbols==0) {
-        continue;
-      }
-
-      if (seqsym.length() != (2 * numSymbols))
-      {
-        // Set of scalars for some property
-        if (Scores.containsKey(id))
-        {
-          int i = 1;
-          while (Scores.containsKey(id + "_" + i))
-          {
-            i++;
-          }
-          id = id + "_" + i;
-        }
-        Vector scores = new Vector();
-        // Typecheck from first entry
-        int i = 0;
-        String ascore="dead";
-        try
-        {
-          // store elements as floats...
-          while (symbols.hasMoreTokens()) {
-            ascore = symbols.nextToken();
-            Float score = new Float(ascore);
-            scores.addElement( (Object) score);
-          }
-          Scores.put(id, scores);
-        }
-        catch (Exception e)
-        {
-          // or just keep them as strings
-          i = scores.size();
-          for (int j = 0; j < i; j++)
-          {
-            scores.set(j,
-                       (Object) ( (Float) scores.get(j)).toString());
-          }
-          scores.addElement((Object) ascore);
-          while (symbols.hasMoreTokens()) {
-            {
-              ascore = symbols.nextToken();
-              scores.addElement( (Object) ascore);
-            }
-          }
-          Scores.put(id, scores);
-        }
-      }
-      else if (id.equals("jnetconf"))
-      {
-        // log.debug System.out.println("here");
-        id = "Prediction Confidence";
-        this.conf = new Vector(numSymbols);
-        for (int i = 0; i < numSymbols; i++)
-        {
-          conf.set(i, (Object) symbols.nextToken());
-        }
-      }
-      else
-        {
-          // Sequence or a prediction string (rendered as sequence)
-
-          StringBuffer newseq = new StringBuffer();
-
-          for (int i = 0; i < numSymbols; i++) {
-            newseq.append(symbols.nextToken());
-          }
-
-          if (id.indexOf(";") > -1) {
-            seq_entries.addElement(newseq);
-            int i=1;
-            String name = id.substring(id.indexOf(";")+1);
-            while (ids.lastIndexOf(name)>-1) {
-              name = id.substring(id.indexOf(";")+1)+"_"+1;
-            }
-            ids.addElement(name);
-
-            noSeqs++;
-          }
-          else
-          {
-            if (id.equals("JNETPRED")) {
-              id = "Predicted Secondary Structure";
-            }
-            seq_entries.addElement( newseq.toString() );
-            ids.addElement(id);
-            Symscores.put((Object) id, (Object) new Integer(ids.size()-1));
-          }
-      }
-    }
-
-
-    if (noSeqs < 1)
-    {
-      throw new IOException(
-      "JpredFile Parser: No sequence in the prediction!");
+      s[i] = new DrawableSequence( (Sequence) blc.seqs.elementAt(i));
     }
-    maxLength = seq_entries.elementAt(0).toString().length();
-    for (int i = 0; i < ids.size(); i++)
-    {
-      // Add all sequence like objects
-
-      Sequence newSeq = new Sequence(ids.elementAt(i).toString(),
-                                     seq_entries.elementAt(i).toString(), 1,
-                                     seq_entries.elementAt(i).toString().
-                                     length());
-      if (!Symscores.containsKey(ids.elementAt(i))
-          && !isValidProteinSequence(newSeq.getSequence()))
-      {
-        throw new IOException(
-      "JPredConcise: Not a valid protein sequence - ("
-      + ids.elementAt(i).toString() + ")");
-      }
+    String out = BLCFile.print(s);
 
-      if (maxLength != seq_entries.elementAt(i).toString().length())
-      {
-        throw new IOException("JPredConcise: Entry (" +
-                              ids.elementAt(i).toString()
-                              + ") has an unexpected number of columns");
-      }
-      if (newSeq.getName().startsWith("QUERY") && QuerySeqPosition==-1) {
-        QuerySeqPosition = seqs.size();
-      }
-
-      seqs.addElement(newSeq);
-
-    }
+    AlignFrame af = new AlignFrame(null, s);
+    af.resize(700, 500);
+    af.show();
+    System.out.println(out);
   }
-
-  /**
-   * print
-   *
-   * @return String
-     */
-
-    public String print()
-    {
-      return "Not Supported";
-    }
-
-    public static void main(String[] args)
-    {
-      try
-      {
-        JPredFile blc = new JPredFile(args[0], "File");
-        for (int i = 0; i < blc.seqs.size(); i++)
-        {
-          System.out.println( ( (Sequence) blc.seqs.elementAt(i)).getName()
-                             + "\n" +
-                             ( (Sequence) blc.seqs.elementAt(i)).getSequence()
-                             + "\n");
-        }
-      }
-      catch (java.io.IOException e)
-      {
-        System.err.println("Exception " + e);
-        e.printStackTrace();
-      }
-    }
+  catch (java.io.IOException e)
+  {
+    System.out.println("Exception " + e);
   }
+ }
 
-  /*
-   StringBuffer out = new StringBuffer();
-
-   out.append("START PRED\n");
-   for (int i = 0; i < s[0].sequence.length(); i++)
-   {
-    out.append(s[0].sequence.substring(i, i + 1) + " ");
-    out.append(s[1].sequence.substring(i, i + 1) + " ");
-    out.append(s[1].score[0].elementAt(i) + " ");
-    out.append(s[1].score[1].elementAt(i) + " ");
-    out.append(s[1].score[2].elementAt(i) + " ");
-    out.append(s[1].score[3].elementAt(i) + " ");
-
-    out.append("\n");
-   }
-   out.append("END PRED\n");
-   return out.toString();
-   }
-
-      public static void main(String[] args)
-   {
-    try
-    {
-      BLCFile blc = new BLCFile(args[0], "File");
-      DrawableSequence[] s = new DrawableSequence[blc.seqs.size()];
-      for (int i = 0; i < blc.seqs.size(); i++)
-      {
-        s[i] = new DrawableSequence( (Sequence) blc.seqs.elementAt(i));
-      }
-      String out = BLCFile.print(s);
-
-      AlignFrame af = new AlignFrame(null, s);
-      af.resize(700, 500);
-      af.show();
-      System.out.println(out);
-    }
-    catch (java.io.IOException e)
-    {
-      System.out.println("Exception " + e);
-    }
-   }
-
-   }
-   */
+ }
+ */\r
index 5a29ba7..d44275a 100755 (executable)
 * 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
-\r
 /*///////////////////////////////////////////////////////////////////\r
 // This file was taken from java forum\r
 // Re: JFileChooser functioning like normal Windows Apps FileChooser\r
 // Author: ddanimal\r
 // http://forum.java.sun.com/thread.jspa?forumID=57&threadID=327712\r
-*///////////////////////////////////////////////////////////////////\r
+*/\r
 \r
+//////////////////////////////////////////////////////////////////\r
 package jalview.io;\r
 \r
 import java.awt.*;\r
 import java.awt.event.*;\r
+\r
 import java.io.*;\r
+\r
 import java.util.*;\r
 \r
 import javax.swing.*;\r
@@ -38,341 +39,367 @@ import javax.swing.plaf.basic.*;
 import javax.swing.plaf.metal.*;\r
 import javax.swing.table.*;\r
 \r
-public class JalviewFileChooser extends JFileChooser\r
-{\r
-\r
-  private static final int COLUMN_FILENAME = 0;\r
-  private static final int COLUMN_FILESIZE = 1;\r
-  private static final int COLUMN_FILETYPE = 2;\r
-  private static final int COLUMN_FILEDATE = 3;\r
-  private static final int COLUMN_FILEATTR = 4;\r
-  private static final int COLUMN_COLCOUNT = 5;\r
-  private static String[] COLUMNS = null;\r
-\r
-\r
-  public JalviewFileChooser(String dir, String [] suffix, String [] desc, String selected)\r
-  {\r
-    super(dir);\r
-\r
-    JalviewFileFilter chosen = null;\r
-    for(int i=0; i<suffix.length; i++)\r
-    {\r
-      JalviewFileFilter jvf = new JalviewFileFilter(suffix[i], desc[i]);\r
-      addChoosableFileFilter(jvf);\r
-      if(selected!=null && selected.equalsIgnoreCase(desc[i]))\r
-        chosen = jvf;\r
+\r
+public class JalviewFileChooser extends JFileChooser {\r
+    private static final int COLUMN_FILENAME = 0;\r
+    private static final int COLUMN_FILESIZE = 1;\r
+    private static final int COLUMN_FILETYPE = 2;\r
+    private static final int COLUMN_FILEDATE = 3;\r
+    private static final int COLUMN_FILEATTR = 4;\r
+    private static final int COLUMN_COLCOUNT = 5;\r
+    private static String[] COLUMNS = null;\r
+\r
+    public JalviewFileChooser(String dir, String[] suffix, String[] desc,\r
+        String selected) {\r
+        super(dir);\r
+\r
+        JalviewFileFilter chosen = null;\r
+\r
+        for (int i = 0; i < suffix.length; i++) {\r
+            JalviewFileFilter jvf = new JalviewFileFilter(suffix[i], desc[i]);\r
+            addChoosableFileFilter(jvf);\r
+\r
+            if ((selected != null) && selected.equalsIgnoreCase(desc[i])) {\r
+                chosen = jvf;\r
+            }\r
+        }\r
+\r
+        if (chosen != null) {\r
+            setFileFilter(chosen);\r
+        }\r
+\r
+        initColumns();\r
     }\r
-    if(chosen!=null)\r
-      setFileFilter(chosen);\r
-    initColumns();\r
-  }\r
-\r
-  public String getSelectedFormat()\r
-  {\r
-\r
-    String format = getFileFilter().getDescription();\r
-\r
-    if (format.toUpperCase().startsWith("JALVIEW"))\r
-      format = "Jalview";\r
-    else if (format.toUpperCase().startsWith("FASTA"))\r
-      format = "FASTA";\r
-    else if (format.toUpperCase().startsWith("MSF"))\r
-      format = "MSF";\r
-    else if (format.toUpperCase().startsWith("CLUSTAL"))\r
-      format = "CLUSTAL";\r
-    else if (format.toUpperCase().startsWith("BLC"))\r
-      format = "BLC";\r
-    else if (format.toUpperCase().startsWith("PIR"))\r
-      format = "PIR";\r
-    else if (format.toUpperCase().startsWith("PFAM"))\r
-      format = "PFAM";\r
-\r
-    return format;\r
-  }\r
-  public JalviewFileChooser(String dir)\r
-  {\r
-    super(dir);\r
-    initColumns();\r
-  }\r
-\r
-  public int showSaveDialog(Component parent) throws HeadlessException {\r
-      setDialogType(SAVE_DIALOG);\r
-      int ret = showDialog(parent, null);\r
-\r
-      if(getFileFilter() instanceof JalviewFileFilter)\r
-      {\r
-        JalviewFileFilter jvf = (JalviewFileFilter) getFileFilter();\r
-        if (!jvf.accept(getSelectedFile()))\r
-        {\r
-          String withExtension = getSelectedFile() + "." + jvf.getAcceptableExtension();\r
-          setSelectedFile(new File(withExtension));\r
+\r
+    public JalviewFileChooser(String dir) {\r
+        super(dir);\r
+        initColumns();\r
+    }\r
+\r
+    public String getSelectedFormat() {\r
+        String format = getFileFilter().getDescription();\r
+\r
+        if (format.toUpperCase().startsWith("JALVIEW")) {\r
+            format = "Jalview";\r
+        } else if (format.toUpperCase().startsWith("FASTA")) {\r
+            format = "FASTA";\r
+        } else if (format.toUpperCase().startsWith("MSF")) {\r
+            format = "MSF";\r
+        } else if (format.toUpperCase().startsWith("CLUSTAL")) {\r
+            format = "CLUSTAL";\r
+        } else if (format.toUpperCase().startsWith("BLC")) {\r
+            format = "BLC";\r
+        } else if (format.toUpperCase().startsWith("PIR")) {\r
+            format = "PIR";\r
+        } else if (format.toUpperCase().startsWith("PFAM")) {\r
+            format = "PFAM";\r
         }\r
-      }\r
-\r
-      if(ret == JalviewFileChooser.APPROVE_OPTION  &&  getSelectedFile().exists() )\r
-      {\r
-       int confirm =  JOptionPane.showConfirmDialog(parent,\r
-                                      "Overwrite existing file?",\r
-                                      "File exists",\r
-                                      JOptionPane.YES_NO_OPTION);\r
-       if(confirm!=JOptionPane.YES_OPTION)\r
-         ret = this.CANCEL_OPTION;\r
-      }\r
-      return ret;\r
-  }\r
-\r
-\r
-  void initColumns()\r
-  {\r
-    if (COLUMNS == null)\r
-    {\r
-        Locale l = getLocale();\r
-        COLUMNS = new String[]{\r
-        UIManager.getString("FileChooser.fileNameHeaderText",l),\r
-        UIManager.getString("FileChooser.fileSizeHeaderText",l),\r
-        UIManager.getString("FileChooser.fileTypeHeaderText",l),\r
-        UIManager.getString("FileChooser.fileDateHeaderText",l),\r
-        UIManager.getString("FileChooser.fileAttrHeaderText",l)\r
-      };\r
+\r
+        return format;\r
     }\r
-  }\r
-\r
-  /**************************************************************************\r
-   * Always create the local UI\r
-   * @param comp\r
-   *************************************************************************/\r
-  public final void setUI(ComponentUI comp)\r
-  {\r
-    super.setUI(new UI(this));\r
-  }\r
-\r
-   /**************************************************************************\r
-    * Internal implementation of Metal LookAndFeel to create the table sorting\r
-    * ability.\r
-    *************************************************************************/\r
-   private final static class UI extends MetalFileChooserUI\r
-   {\r
-     private DirectoryModel model;\r
-\r
-     /**************************************************************************\r
-      * Must be overridden to extend\r
-      * @param e\r
-      *************************************************************************/\r
-     public UI(JFileChooser e)\r
-     {\r
-       super(e);\r
-     }\r
-\r
-     /**************************************************************************\r
-      * Overridden to create our own model\r
-      *************************************************************************/\r
-     protected final void createModel()\r
-     {\r
-       model = new DirectoryModel(getFileChooser());\r
-     }\r
-\r
-     /**************************************************************************\r
-      * Overridden to get our own model\r
-      * @return\r
-      *************************************************************************/\r
-     public final BasicDirectoryModel getModel() {       return model;     }\r
-\r
-     /**************************************************************************\r
-      * Calls the default method then adds a MouseListener to the JTable\r
-      * @param chooser\r
-      * @return\r
-      *************************************************************************/\r
-     protected final JPanel createDetailsView(JFileChooser chooser)\r
-     {\r
-       final JPanel panel = super.createDetailsView(chooser);\r
-\r
-       //Since we can't access MetalFileChooserUI's private member detailsTable\r
-       //directly, we have to find it in the JPanel\r
-       final JTable tbl = findJTable(panel.getComponents());\r
-       if (tbl != null)\r
-       {\r
-         //Fix the columns so they can't be rearranged, if we don't do this\r
-         //we would need to keep track when each column is moved\r
-         tbl.getTableHeader().setReorderingAllowed(false);\r
-\r
-         //Add a mouselistener to listen for clicks on column headers\r
-         tbl.getTableHeader().addMouseListener(new MouseAdapter(){\r
-           public void mouseClicked(MouseEvent e)\r
-           {\r
-             //Only process single clicks\r
-             if (e.getClickCount() > 1) return;\r
-             e.consume();\r
-             final int col = tbl.getTableHeader().columnAtPoint(e.getPoint());\r
-             if (col == COLUMN_FILENAME || col == COLUMN_FILESIZE ||\r
-                 col == COLUMN_FILEDATE)\r
-               model.sort(col,tbl);\r
-           }\r
-         });\r
-       }\r
-       return panel;\r
-     }\r
-\r
-     /**************************************************************************\r
-      * Finds the JTable in the panel so we can add MouseListener\r
-      * @param comp\r
-      * @return\r
-      *************************************************************************/\r
-     private final static JTable findJTable(Component[] comp)\r
-     {\r
-       for (int i=0;i<comp.length;i++)\r
-       {\r
-         if (comp[i] instanceof JTable)\r
-         {\r
-           return (JTable)comp[i];\r
-         }\r
-         if (comp[i] instanceof Container)\r
-         {\r
-           JTable tbl = findJTable(((Container)comp[i]).getComponents());\r
-           if (tbl != null) return tbl;\r
-         }\r
-       }\r
-       return null;\r
-     }\r
-   }\r
-\r
-  /***************************************************************************\r
-   * Implementation of BasicDirectoryModel that sorts the Files by column\r
-   **************************************************************************/\r
-  private final static class DirectoryModel extends BasicDirectoryModel\r
-   {\r
-     int col = 0;\r
-     boolean ascending;\r
-\r
-     /**************************************************************************\r
-      * Must be overridden to extend BasicDirectoryModel\r
-      * @param chooser\r
-      *************************************************************************/\r
-     DirectoryModel(JFileChooser chooser)\r
-     {\r
-       super(chooser);\r
-     }\r
-\r
-\r
-     /**************************************************************************\r
-      * Supposedly this is not used anymore, hopefully not.  We implemented\r
-      * some basic attempt at sorting just in case\r
-      * @param a\r
-      * @param b\r
-      * @return\r
-      *************************************************************************/\r
-     protected final boolean lt(File a, File b)\r
-     {\r
-       System.out.println("DEBUG:LT called?");\r
-       boolean less = false;\r
-       switch (col)\r
-       {\r
-         case COLUMN_FILEDATE:\r
-           less = a.lastModified() > b.lastModified();\r
-           break;\r
-         case COLUMN_FILESIZE:\r
-           less = a.length() > b.length();\r
-           break;\r
-         default:\r
-           less = a.getName().compareToIgnoreCase(b.getName()) > 0;\r
-         break;\r
-       }\r
-       if (ascending) return less = !less;\r
-       return less;\r
-     }\r
-\r
-     /**************************************************************************\r
-      * Resorts the JFileChooser table based on new column\r
-      * @param c\r
-      *************************************************************************/\r
-     protected final void sort(int c, JTable tbl)\r
-     {\r
-       //Set column and order\r
-       col = c;\r
-       ascending = !ascending;\r
-       String indicator = " (^)";\r
-       if (ascending)\r
-         indicator = " (v)";\r
-\r
-       final JTableHeader th = tbl.getTableHeader();\r
-       final TableColumnModel tcm = th.getColumnModel();\r
-\r
-       for (int i=0;i<JalviewFileChooser.COLUMN_COLCOUNT;i++)\r
-       {\r
-         final TableColumn tc = tcm.getColumn( i ); // the column to change\r
-         tc.setHeaderValue( COLUMNS[i] );\r
-       }\r
-\r
-       final TableColumn tc = tcm.getColumn( col ); // the column to change\r
-       tc.setHeaderValue( COLUMNS[col] + indicator );\r
-\r
-       th.repaint();\r
-\r
-       //Requery the file listing\r
-       validateFileCache();\r
-     }\r
-\r
-     /**************************************************************************\r
-      * Sorts the data based on current column setting\r
-      * @param data\r
-      *************************************************************************/\r
-     protected final void sort(Vector data)\r
-     {\r
-       switch (col)\r
-       {\r
-         case COLUMN_FILEDATE:\r
-           Collections.sort(data,new Comparator(){\r
-             public int compare(Object o1,Object o2)\r
-             {\r
-               int ret = 1;\r
-               final File a = (File)o1;\r
-               final File b = (File)o2;\r
-               if (a.lastModified() > b.lastModified())\r
-                 ret = -1;\r
-               else if (a.lastModified() == b.lastModified())\r
-                 ret = 0;\r
-\r
-               if (ascending)\r
-                 ret *= -1;\r
-               return ret;\r
-             }\r
-\r
-           });\r
-           break;\r
-         case COLUMN_FILESIZE:\r
-           Collections.sort(data,new Comparator(){\r
-             public int compare(Object o1,Object o2)\r
-             {\r
-               int ret = 1;\r
-               final File a = (File)o1;\r
-               final File b = (File)o2;\r
-               if (a.length() > b.length())\r
-                 ret = -1;\r
-               else if (a.length() == b.length())\r
-                 ret = 0;\r
-\r
-               if (ascending)\r
-                 ret *= -1;\r
-               return ret;\r
-             }\r
-\r
-           });\r
-           break;\r
-         case COLUMN_FILENAME:\r
-           Collections.sort(data,new Comparator(){\r
-             public int compare(Object o1,Object o2)\r
-             {\r
-               final File a = (File)o1;\r
-               final File b = (File)o2;\r
-               if (ascending)\r
-                 return a.getName().compareToIgnoreCase(b.getName());\r
-               else\r
-                 return -1 * a.getName().compareToIgnoreCase(b.getName());\r
-             }\r
-\r
-           });\r
-           break;\r
-       }\r
-     }\r
-  }\r
-}\r
 \r
+    public int showSaveDialog(Component parent) throws HeadlessException {\r
+        setDialogType(SAVE_DIALOG);\r
+\r
+        int ret = showDialog(parent, null);\r
+\r
+        if (getFileFilter() instanceof JalviewFileFilter) {\r
+            JalviewFileFilter jvf = (JalviewFileFilter) getFileFilter();\r
+\r
+            if (!jvf.accept(getSelectedFile())) {\r
+                String withExtension = getSelectedFile() + "." +\r
+                    jvf.getAcceptableExtension();\r
+                setSelectedFile(new File(withExtension));\r
+            }\r
+        }\r
+\r
+        if ((ret == JalviewFileChooser.APPROVE_OPTION) &&\r
+                getSelectedFile().exists()) {\r
+            int confirm = JOptionPane.showConfirmDialog(parent,\r
+                    "Overwrite existing file?", "File exists",\r
+                    JOptionPane.YES_NO_OPTION);\r
+\r
+            if (confirm != JOptionPane.YES_OPTION) {\r
+                ret = this.CANCEL_OPTION;\r
+            }\r
+        }\r
+\r
+        return ret;\r
+    }\r
+\r
+    void initColumns() {\r
+        if (COLUMNS == null) {\r
+            Locale l = getLocale();\r
+            COLUMNS = new String[] {\r
+                    UIManager.getString("FileChooser.fileNameHeaderText", l),\r
+                    UIManager.getString("FileChooser.fileSizeHeaderText", l),\r
+                    UIManager.getString("FileChooser.fileTypeHeaderText", l),\r
+                    UIManager.getString("FileChooser.fileDateHeaderText", l),\r
+                    UIManager.getString("FileChooser.fileAttrHeaderText", l)\r
+                };\r
+        }\r
+    }\r
+\r
+    /**************************************************************************\r
+     * Always create the local UI\r
+     * @param comp\r
+     *************************************************************************/\r
+    public final void setUI(ComponentUI comp) {\r
+        super.setUI(new UI(this));\r
+    }\r
+\r
+    /**************************************************************************\r
+     * Internal implementation of Metal LookAndFeel to create the table sorting\r
+     * ability.\r
+     *************************************************************************/\r
+    private final static class UI extends MetalFileChooserUI {\r
+        private DirectoryModel model;\r
+\r
+        /**************************************************************************\r
+         * Must be overridden to extend\r
+         * @param e\r
+         *************************************************************************/\r
+        public UI(JFileChooser e) {\r
+            super(e);\r
+        }\r
+\r
+        /**************************************************************************\r
+         * Overridden to create our own model\r
+         *************************************************************************/\r
+        protected final void createModel() {\r
+            model = new DirectoryModel(getFileChooser());\r
+        }\r
+\r
+        /**************************************************************************\r
+         * Overridden to get our own model\r
+         * @return\r
+         *************************************************************************/\r
+        public final BasicDirectoryModel getModel() {\r
+            return model;\r
+        }\r
+\r
+        /**************************************************************************\r
+         * Calls the default method then adds a MouseListener to the JTable\r
+         * @param chooser\r
+         * @return\r
+         *************************************************************************/\r
+        protected final JPanel createDetailsView(JFileChooser chooser) {\r
+            final JPanel panel = super.createDetailsView(chooser);\r
+\r
+            //Since we can't access MetalFileChooserUI's private member detailsTable\r
+            //directly, we have to find it in the JPanel\r
+            final JTable tbl = findJTable(panel.getComponents());\r
+\r
+            if (tbl != null) {\r
+                //Fix the columns so they can't be rearranged, if we don't do this\r
+                //we would need to keep track when each column is moved\r
+                tbl.getTableHeader().setReorderingAllowed(false);\r
+\r
+                //Add a mouselistener to listen for clicks on column headers\r
+                tbl.getTableHeader().addMouseListener(new MouseAdapter() {\r
+                        public void mouseClicked(MouseEvent e) {\r
+                            //Only process single clicks\r
+                            if (e.getClickCount() > 1) {\r
+                                return;\r
+                            }\r
+\r
+                            e.consume();\r
+\r
+                            final int col = tbl.getTableHeader().columnAtPoint(e.getPoint());\r
+\r
+                            if ((col == COLUMN_FILENAME) ||\r
+                                    (col == COLUMN_FILESIZE) ||\r
+                                    (col == COLUMN_FILEDATE)) {\r
+                                model.sort(col, tbl);\r
+                            }\r
+                        }\r
+                    });\r
+            }\r
+\r
+            return panel;\r
+        }\r
+\r
+        /**************************************************************************\r
+         * Finds the JTable in the panel so we can add MouseListener\r
+         * @param comp\r
+         * @return\r
+         *************************************************************************/\r
+        private final static JTable findJTable(Component[] comp) {\r
+            for (int i = 0; i < comp.length; i++) {\r
+                if (comp[i] instanceof JTable) {\r
+                    return (JTable) comp[i];\r
+                }\r
+\r
+                if (comp[i] instanceof Container) {\r
+                    JTable tbl = findJTable(((Container) comp[i]).getComponents());\r
+\r
+                    if (tbl != null) {\r
+                        return tbl;\r
+                    }\r
+                }\r
+            }\r
+\r
+            return null;\r
+        }\r
+    }\r
+\r
+    /***************************************************************************\r
+     * Implementation of BasicDirectoryModel that sorts the Files by column\r
+     **************************************************************************/\r
+    private final static class DirectoryModel extends BasicDirectoryModel {\r
+        int col = 0;\r
+        boolean ascending;\r
+\r
+        /**************************************************************************\r
+         * Must be overridden to extend BasicDirectoryModel\r
+         * @param chooser\r
+         *************************************************************************/\r
+        DirectoryModel(JFileChooser chooser) {\r
+            super(chooser);\r
+        }\r
+\r
+        /**************************************************************************\r
+         * Supposedly this is not used anymore, hopefully not.  We implemented\r
+         * some basic attempt at sorting just in case\r
+         * @param a\r
+         * @param b\r
+         * @return\r
+         *************************************************************************/\r
+        protected final boolean lt(File a, File b) {\r
+            System.out.println("DEBUG:LT called?");\r
+\r
+            boolean less = false;\r
+\r
+            switch (col) {\r
+            case COLUMN_FILEDATE:\r
+                less = a.lastModified() > b.lastModified();\r
+\r
+                break;\r
+\r
+            case COLUMN_FILESIZE:\r
+                less = a.length() > b.length();\r
+\r
+                break;\r
+\r
+            default:\r
+                less = a.getName().compareToIgnoreCase(b.getName()) > 0;\r
+\r
+                break;\r
+            }\r
+\r
+            if (ascending) {\r
+                return less = !less;\r
+            }\r
+\r
+            return less;\r
+        }\r
+\r
+        /**************************************************************************\r
+         * Resorts the JFileChooser table based on new column\r
+         * @param c\r
+         *************************************************************************/\r
+        protected final void sort(int c, JTable tbl) {\r
+            //Set column and order\r
+            col = c;\r
+            ascending = !ascending;\r
+\r
+            String indicator = " (^)";\r
+\r
+            if (ascending) {\r
+                indicator = " (v)";\r
+            }\r
+\r
+            final JTableHeader th = tbl.getTableHeader();\r
+            final TableColumnModel tcm = th.getColumnModel();\r
+\r
+            for (int i = 0; i < JalviewFileChooser.COLUMN_COLCOUNT; i++) {\r
+                final TableColumn tc = tcm.getColumn(i); // the column to change\r
+                tc.setHeaderValue(COLUMNS[i]);\r
+            }\r
+\r
+            final TableColumn tc = tcm.getColumn(col); // the column to change\r
+            tc.setHeaderValue(COLUMNS[col] + indicator);\r
+\r
+            th.repaint();\r
+\r
+            //Requery the file listing\r
+            validateFileCache();\r
+        }\r
+\r
+        /**************************************************************************\r
+         * Sorts the data based on current column setting\r
+         * @param data\r
+         *************************************************************************/\r
+        protected final void sort(Vector data) {\r
+            switch (col) {\r
+            case COLUMN_FILEDATE:\r
+                Collections.sort(data,\r
+                    new Comparator() {\r
+                        public int compare(Object o1, Object o2) {\r
+                            int ret = 1;\r
+                            final File a = (File) o1;\r
+                            final File b = (File) o2;\r
+\r
+                            if (a.lastModified() > b.lastModified()) {\r
+                                ret = -1;\r
+                            } else if (a.lastModified() == b.lastModified()) {\r
+                                ret = 0;\r
+                            }\r
+\r
+                            if (ascending) {\r
+                                ret *= -1;\r
+                            }\r
+\r
+                            return ret;\r
+                        }\r
+                    });\r
+\r
+\r
+                break;\r
+\r
+            case COLUMN_FILESIZE:\r
+                Collections.sort(data,\r
+                    new Comparator() {\r
+                        public int compare(Object o1, Object o2) {\r
+                            int ret = 1;\r
+                            final File a = (File) o1;\r
+                            final File b = (File) o2;\r
+\r
+                            if (a.length() > b.length()) {\r
+                                ret = -1;\r
+                            } else if (a.length() == b.length()) {\r
+                                ret = 0;\r
+                            }\r
+\r
+                            if (ascending) {\r
+                                ret *= -1;\r
+                            }\r
+\r
+                            return ret;\r
+                        }\r
+                    });\r
+\r
+\r
+                break;\r
+\r
+            case COLUMN_FILENAME:\r
+                Collections.sort(data,\r
+                    new Comparator() {\r
+                        public int compare(Object o1, Object o2) {\r
+                            final File a = (File) o1;\r
+                            final File b = (File) o2;\r
+\r
+                            if (ascending) {\r
+                                return a.getName().compareToIgnoreCase(b.getName());\r
+                            } else {\r
+                                return -1 * a.getName().compareToIgnoreCase(b.getName());\r
+                            }\r
+                        }\r
+                    });\r
+\r
+\r
+                break;\r
+            }\r
+        }\r
+    }\r
+}\r
index d6c6d4b..e2692e2 100755 (executable)
 * along with this program; if not, write to the Free Software\r
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
 */\r
-\r
 package jalview.io;\r
 \r
-import javax.swing.filechooser.*;\r
 import java.io.File;\r
+\r
 import java.util.*;\r
 \r
-public class JalviewFileFilter extends FileFilter\r
-{\r
-      private static String TYPE_UNKNOWN = "Type Unknown";\r
-      private static String HIDDEN_FILE = "Hidden File";\r
-      public static Hashtable suffixHash = new Hashtable();\r
+import javax.swing.filechooser.*;\r
+\r
+\r
+public class JalviewFileFilter extends FileFilter {\r
+    private static String TYPE_UNKNOWN = "Type Unknown";\r
+    private static String HIDDEN_FILE = "Hidden File";\r
+    public static Hashtable suffixHash = new Hashtable();\r
+    private Hashtable filters = null;\r
+    private String description = "no description";\r
+    private String fullDescription = "full description";\r
+    private boolean useExtensionsInDescription = true;\r
 \r
-      private Hashtable filters = null;\r
-      private String description = "no description";\r
-      private String fullDescription = "full description";\r
-      private boolean useExtensionsInDescription = true;\r
+    public JalviewFileFilter(String extension, String description) {\r
+        StringTokenizer st = new StringTokenizer(extension, ",");\r
 \r
+        while (st.hasMoreElements()) {\r
+            addExtension(st.nextToken().trim());\r
+        }\r
 \r
-      public JalviewFileFilter(String extension, String description) {\r
+        setDescription(description);\r
+    }\r
 \r
-       StringTokenizer st = new StringTokenizer(extension, ",");\r
-       while(st.hasMoreElements())\r
-       {\r
-         addExtension(st.nextToken().trim());\r
-       }\r
-       setDescription(description);\r
-      }\r
+    public JalviewFileFilter(String[] filts) {\r
+        this(filts, null);\r
+    }\r
 \r
-      public JalviewFileFilter(String[] filts) {\r
-          this(filts, null);\r
-      }\r
+    public JalviewFileFilter(String[] filts, String description) {\r
+        for (int i = 0; i < filts.length; i++) {\r
+            // add filters one by one\r
+            addExtension(filts[i]);\r
+        }\r
 \r
-      public String getAcceptableExtension()\r
-      {\r
+        if (description != null) {\r
+            setDescription(description);\r
+        }\r
+    }\r
+\r
+    public String getAcceptableExtension() {\r
         return filters.keys().nextElement().toString();\r
-      }\r
-\r
-      public JalviewFileFilter(String[] filts, String description) {\r
-          for (int i = 0; i < filts.length; i++) {\r
-              // add filters one by one\r
-              addExtension(filts[i]);\r
-          }\r
-           if(description!=null) setDescription(description);\r
-      }\r
-\r
-      // takes account of the fact that database is a directory\r
-      public boolean accept(File f) {\r
-          if(f != null) {\r
-              String extension = getExtension(f);\r
-              if(f.isDirectory()) {\r
-                 if(extension == null || extension.equals("")) {\r
+    }\r
+\r
+    // takes account of the fact that database is a directory\r
+    public boolean accept(File f) {\r
+        if (f != null) {\r
+            String extension = getExtension(f);\r
+\r
+            if (f.isDirectory()) {\r
+                if ((extension == null) || extension.equals("")) {\r
                     return true;\r
-                 } else {\r
-                    if(filters.get(getExtension(f)) != null) {\r
-                       return true;\r
+                } else {\r
+                    if (filters.get(getExtension(f)) != null) {\r
+                        return true;\r
+                    }\r
+                }\r
+            }\r
+\r
+            if ((extension != null) && (filters.get(getExtension(f)) != null)) {\r
+                return true;\r
+            }\r
+        }\r
+\r
+        return false;\r
+    }\r
+\r
+    public String getExtension(File f) {\r
+        if (f != null) {\r
+            String filename = f.getName();\r
+            int i = filename.lastIndexOf('.');\r
+\r
+            if ((i > 0) && (i < (filename.length() - 1))) {\r
+                return filename.substring(i + 1).toLowerCase();\r
+            }\r
+\r
+            ;\r
+        }\r
+\r
+        return "";\r
+    }\r
+\r
+    public void addExtension(String extension) {\r
+        if (filters == null) {\r
+            filters = new Hashtable(5);\r
+        }\r
+\r
+        filters.put(extension.toLowerCase(), this);\r
+        fullDescription = null;\r
+    }\r
+\r
+    public String getDescription() {\r
+        if (fullDescription == null) {\r
+            if ((description == null) || isExtensionListInDescription()) {\r
+                fullDescription = (description == null) ? "(" : (description +\r
+                    " (");\r
+\r
+                // build the description from the extension list\r
+                Enumeration extensions = filters.keys();\r
+\r
+                if (extensions != null) {\r
+                    fullDescription += ("." +\r
+                    (String) extensions.nextElement());\r
+\r
+                    while (extensions.hasMoreElements()) {\r
+                        fullDescription += (", " +\r
+                        (String) extensions.nextElement());\r
                     }\r
-                 }\r
-              }\r
-              if(extension != null && filters.get(getExtension(f)) != null) {\r
-                  return true;\r
-              }\r
-          }\r
-          return false;\r
-      }\r
-\r
-       public String getExtension(File f) {\r
-          if(f != null) {\r
-              String filename = f.getName();\r
-              int i = filename.lastIndexOf('.');\r
-              if(i>0 && i<filename.length()-1) {\r
-                  return filename.substring(i+1).toLowerCase();\r
-              };\r
-          }\r
-          return "";\r
-      }\r
-\r
-      public void addExtension(String extension) {\r
-          if(filters == null) {\r
-              filters = new Hashtable(5);\r
-          }\r
-          filters.put(extension.toLowerCase(), this);\r
-          fullDescription = null;\r
-      }\r
-\r
-\r
-      public String getDescription() {\r
-          if(fullDescription == null) {\r
-              if(description == null || isExtensionListInDescription()) {\r
-                   fullDescription = description==null ? "(" : description + " (";\r
-                  // build the description from the extension list\r
-                  Enumeration extensions = filters.keys();\r
-                  if(extensions != null) {\r
-                      fullDescription += "." + (String) extensions.nextElement();\r
-                      while (extensions.hasMoreElements()) {\r
-                          fullDescription += ", " + (String) extensions.nextElement();\r
-                      }\r
-                  }\r
-                  fullDescription += ")";\r
-              } else {\r
-                  fullDescription = description;\r
-              }\r
-          }\r
-          return fullDescription;\r
-      }\r
-\r
-      public void setDescription(String description) {\r
-          this.description = description;\r
-          fullDescription = null;\r
-      }\r
-\r
-      public void setExtensionListInDescription(boolean b) {\r
-          useExtensionsInDescription = b;\r
-          fullDescription = null;\r
-      }\r
-\r
-      public boolean isExtensionListInDescription() {\r
-          return useExtensionsInDescription;\r
-      }\r
-  }\r
+                }\r
+\r
+                fullDescription += ")";\r
+            } else {\r
+                fullDescription = description;\r
+            }\r
+        }\r
+\r
+        return fullDescription;\r
+    }\r
+\r
+    public void setDescription(String description) {\r
+        this.description = description;\r
+        fullDescription = null;\r
+    }\r
+\r
+    public void setExtensionListInDescription(boolean b) {\r
+        useExtensionsInDescription = b;\r
+        fullDescription = null;\r
+    }\r
+\r
+    public boolean isExtensionListInDescription() {\r
+        return useExtensionsInDescription;\r
+    }\r
+}\r
index 4df6576..f4c7f23 100755 (executable)
 * along with this program; if not, write to the Free Software\r
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
 */\r
-\r
 package jalview.io;\r
 \r
-import javax.swing.filechooser.FileView;\r
-import javax.swing.*;\r
 import java.io.*;\r
+\r
 import java.util.*;\r
 \r
-public class JalviewFileView extends FileView\r
-{\r
-  static Hashtable alignSuffix = new Hashtable();\r
-  static{\r
-    alignSuffix.put("fasta", "Fasta file");\r
-    alignSuffix.put("fa", "Fasta file");\r
-    alignSuffix.put("fastq", "Fasta file");\r
-    alignSuffix.put("blc", "BLC file");\r
-    alignSuffix.put("msf", "MSF file");\r
-    alignSuffix.put("pfam", "PFAM file");\r
-    alignSuffix.put("aln", "Clustal file");\r
-    alignSuffix.put("pir", "PIR file");\r
-  }\r
-  public String getTypeDescription(File f)\r
-  {\r
-    String extension = getExtension(f);\r
-    String type = null;\r
-\r
-    if (extension != null)\r
-    {\r
-      if (alignSuffix.containsKey(extension))\r
-      {\r
-        type = alignSuffix.get(extension).toString();\r
-      }\r
+import javax.swing.*;\r
+import javax.swing.filechooser.FileView;\r
+\r
+\r
+public class JalviewFileView extends FileView {\r
+    static Hashtable alignSuffix = new Hashtable();\r
+\r
+    static {\r
+        alignSuffix.put("fasta", "Fasta file");\r
+        alignSuffix.put("fa", "Fasta file");\r
+        alignSuffix.put("fastq", "Fasta file");\r
+        alignSuffix.put("blc", "BLC file");\r
+        alignSuffix.put("msf", "MSF file");\r
+        alignSuffix.put("pfam", "PFAM file");\r
+        alignSuffix.put("aln", "Clustal file");\r
+        alignSuffix.put("pir", "PIR file");\r
     }\r
-    return type;\r
-  }\r
-\r
-  public Icon getIcon(File f)\r
-  {\r
-    String extension = getExtension(f);\r
-    Icon icon = null;\r
-\r
-    if (extension != null)\r
-    {\r
-      if (alignSuffix.containsKey(extension))\r
-      {\r
-        icon = createImageIcon("/images/file.png");\r
-      }\r
+\r
+    public String getTypeDescription(File f) {\r
+        String extension = getExtension(f);\r
+        String type = null;\r
+\r
+        if (extension != null) {\r
+            if (alignSuffix.containsKey(extension)) {\r
+                type = alignSuffix.get(extension).toString();\r
+            }\r
+        }\r
+\r
+        return type;\r
     }\r
-    return icon;\r
-  }\r
-\r
-\r
-  /*\r
-   * Get the extension of a file.\r
-   */\r
-  public static String getExtension(File f) {\r
-      String ext = null;\r
-      String s = f.getName();\r
-      int i = s.lastIndexOf('.');\r
-\r
-      if (i > 0 &&  i < s.length() - 1) {\r
-          ext = s.substring(i+1).toLowerCase();\r
-      }\r
-      return ext;\r
-  }\r
-\r
-  /** Returns an ImageIcon, or null if the path was invalid. */\r
-  protected static ImageIcon createImageIcon(String path) {\r
-      java.net.URL imgURL = JalviewFileView.class.getResource(path);\r
-      if (imgURL != null) {\r
-          return new ImageIcon(imgURL);\r
-      } else {\r
-          System.err.println("JalviewFileView.createImageIcon: Couldn't find file: " + path);\r
-          return null;\r
-      }\r
-  }\r
 \r
-}\r
+    public Icon getIcon(File f) {\r
+        String extension = getExtension(f);\r
+        Icon icon = null;\r
+\r
+        if (extension != null) {\r
+            if (alignSuffix.containsKey(extension)) {\r
+                icon = createImageIcon("/images/file.png");\r
+            }\r
+        }\r
+\r
+        return icon;\r
+    }\r
+\r
+    /*\r
+     * Get the extension of a file.\r
+     */\r
+    public static String getExtension(File f) {\r
+        String ext = null;\r
+        String s = f.getName();\r
+        int i = s.lastIndexOf('.');\r
 \r
+        if ((i > 0) && (i < (s.length() - 1))) {\r
+            ext = s.substring(i + 1).toLowerCase();\r
+        }\r
 \r
+        return ext;\r
+    }\r
+\r
+    /** Returns an ImageIcon, or null if the path was invalid. */\r
+    protected static ImageIcon createImageIcon(String path) {\r
+        java.net.URL imgURL = JalviewFileView.class.getResource(path);\r
+\r
+        if (imgURL != null) {\r
+            return new ImageIcon(imgURL);\r
+        } else {\r
+            System.err.println(\r
+                "JalviewFileView.createImageIcon: Couldn't find file: " + path);\r
+\r
+            return null;\r
+        }\r
+    }\r
+}\r
index 104b9d7..2a6e10f 100755 (executable)
 * along with this program; if not, write to the Free Software\r
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
 */\r
-\r
 package jalview.io;\r
 \r
 import jalview.datamodel.*;\r
+\r
 import jalview.util.*;\r
 \r
 import java.io.*;\r
+\r
 import java.util.*;\r
 \r
+\r
 public class MSFfile extends AlignFile {\r
+    private static com.stevesoft.pat.Regex gapre = new com.stevesoft.pat.Regex("\\~",\r
+            "-");\r
+    private static com.stevesoft.pat.Regex re2gap = new com.stevesoft.pat.Regex(\r
+            "[" + jalview.util.Comparison.GapChars + "]", "\\~");\r
 \r
-  public MSFfile()\r
-  {}\r
+    public MSFfile() {\r
+    }\r
 \r
-  public MSFfile(String inStr) {\r
-    super(inStr);\r
-  }\r
+    public MSFfile(String inStr) {\r
+        super(inStr);\r
+    }\r
 \r
-  public MSFfile(String inFile, String type) throws IOException {\r
-    super(inFile,type);\r
-  }\r
+    public MSFfile(String inFile, String type) throws IOException {\r
+        super(inFile, type);\r
+    }\r
 \r
-  private static com.stevesoft.pat.Regex gapre = new com.stevesoft.pat.Regex("\\~","-");\r
-  private static com.stevesoft.pat.Regex re2gap = new com.stevesoft.pat.Regex("["+jalview.util.Comparison.GapChars+"]","\\~");\r
+    public void parse() {\r
+        int i = 0;\r
+        boolean seqFlag = false;\r
+        String key = new String();\r
+        Vector headers = new Vector();\r
+        Hashtable seqhash = new Hashtable();\r
+        String line;\r
+\r
+        try {\r
+            while ((line = nextLine()) != null) {\r
+                StringTokenizer str = new StringTokenizer(line);\r
+\r
+                while (str.hasMoreTokens()) {\r
+                    String inStr = str.nextToken();\r
+\r
+                    //If line has header information add to the headers vector\r
+                    if (inStr.indexOf("Name:") != -1) {\r
+                        key = str.nextToken();\r
+                        headers.addElement(key);\r
+                    }\r
+\r
+                    //if line has // set SeqFlag to 1 so we know sequences are coming\r
+                    if (inStr.indexOf("//") != -1) {\r
+                        seqFlag = true;\r
+                    }\r
+\r
+                    //Process lines as sequence lines if seqFlag is set\r
+                    if ((inStr.indexOf("//") == -1) && (seqFlag == true)) {\r
+                        //seqeunce id is the first field\r
+                        key = inStr;\r
+\r
+                        StringBuffer tempseq;\r
+\r
+                        //Get sequence from hash if it exists\r
+                        if (seqhash.containsKey(key)) {\r
+                            tempseq = (StringBuffer) seqhash.get(key);\r
+                        } else {\r
+                            tempseq = new StringBuffer();\r
+                            seqhash.put(key, tempseq);\r
+                        }\r
+\r
+                        //loop through the rest of the words\r
+                        while (str.hasMoreTokens()) {\r
+                            //append the word to the sequence\r
+                            tempseq.append(str.nextToken());\r
+                        }\r
+                    }\r
+                }\r
+            }\r
+        } catch (IOException e) {\r
+            System.err.println("Exception parsing MSFFile " + e);\r
+            e.printStackTrace();\r
+        }\r
 \r
-  public void parse() {\r
-    int       i       = 0;\r
-    boolean   seqFlag = false;\r
-    String    key     = new String();\r
-    Vector    headers = new Vector();\r
-    Hashtable seqhash = new Hashtable();\r
-    String    line;\r
+        this.noSeqs = headers.size();\r
 \r
-    try {\r
-    while ((line = nextLine()) != null) {\r
+        //Add sequences to the hash\r
+        for (i = 0; i < headers.size(); i++) {\r
+            if (seqhash.get(headers.elementAt(i)) != null) {\r
+                String head = headers.elementAt(i).toString();\r
+                String seq = seqhash.get(head).toString();\r
 \r
-      StringTokenizer str = new StringTokenizer(line);\r
+                int start = 1;\r
+                int end = seq.length();\r
 \r
-      while (str.hasMoreTokens()) {\r
+                if (maxLength < head.length()) {\r
+                    maxLength = head.length();\r
+                }\r
 \r
-        String inStr = str.nextToken();\r
+                if (head.indexOf("/") > 0) {\r
+                    StringTokenizer st = new StringTokenizer(head, "/");\r
 \r
-        //If line has header information add to the headers vector\r
-        if (inStr.indexOf("Name:") != -1) {\r
-          key = str.nextToken();\r
-          headers.addElement(key);\r
-        }\r
+                    if (st.countTokens() == 2) {\r
+                        head = st.nextToken();\r
 \r
-        //if line has // set SeqFlag to 1 so we know sequences are coming\r
-        if (inStr.indexOf("//") != -1) {\r
-          seqFlag = true;\r
-        }\r
+                        String tmp = st.nextToken();\r
+                        st = new StringTokenizer(tmp, "-");\r
 \r
-        //Process lines as sequence lines if seqFlag is set\r
-        if (( inStr.indexOf("//") == -1) && (seqFlag == true)) {\r
-          //seqeunce id is the first field\r
-          key = inStr;\r
-          StringBuffer tempseq;\r
-\r
-          //Get sequence from hash if it exists\r
-          if (seqhash.containsKey(key)) {\r
-            tempseq = (StringBuffer)seqhash.get(key);\r
-          } else {\r
-           tempseq = new StringBuffer();\r
-           seqhash.put(key,tempseq);\r
-         }\r
-\r
-          //loop through the rest of the words\r
-          while (str.hasMoreTokens()) {\r
-            //append the word to the sequence\r
-            tempseq.append(str.nextToken());\r
-          }\r
-        }\r
-      }\r
-    }\r
-    } catch (IOException e) {\r
-      System.err.println("Exception parsing MSFFile " + e);\r
-      e.printStackTrace();\r
-    }\r
-\r
-    this.noSeqs = headers.size();\r
+                        if (st.countTokens() == 2) {\r
+                            start = Integer.valueOf(st.nextToken()).intValue();\r
+                            end = Integer.valueOf(st.nextToken()).intValue();\r
+                        }\r
+                    }\r
+                }\r
 \r
-    //Add sequences to the hash\r
-    for (i = 0; i < headers.size(); i++ ) {\r
+                // Replace ~ with a sensible gap character\r
+                seq = gapre.replaceAll(seq);\r
 \r
-      if ( seqhash.get(headers.elementAt(i)) != null) {\r
-        String head =  headers.elementAt(i).toString();\r
-        String seq  =  seqhash.get(head).toString();\r
+                Sequence newSeq = new Sequence(head, seq, start, end);\r
 \r
-        int start = 1;\r
-        int end = seq.length();\r
+                seqs.addElement(newSeq);\r
+            } else {\r
+                System.err.println("MSFFile Parser: Can't find sequence for " +\r
+                    headers.elementAt(i));\r
+            }\r
+        }\r
+    }\r
 \r
-        if (maxLength <  head.length() ) {\r
-          maxLength =  head.length();\r
+    public static int checkSum(String seq) {\r
+        //String chars =  "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz.*~&@";\r
+        int check = 0;\r
+\r
+        String index = "--------------------------------------&---*---.-----------------@ABCDEFGHIJKLMNOPQRSTUVWXYZ------ABCDEFGHIJKLMNOPQRSTUVWXYZ----@";\r
+        index += "--------------------------------------------------------------------------------------------------------------------------------";\r
+\r
+        for (int i = 0; i < seq.length(); i++) {\r
+            try {\r
+                if (i < seq.length()) {\r
+                    int pos = index.indexOf(seq.substring(i, i + 1));\r
+\r
+                    if (!index.substring(pos, pos + 1).equals("_")) {\r
+                        check += (((i % 57) + 1) * pos);\r
+                    }\r
+                }\r
+            } catch (Exception e) {\r
+                System.err.println("Exception during MSF Checksum calculation");\r
+                e.printStackTrace();\r
+            }\r
         }\r
 \r
-        if (head.indexOf("/") > 0 ) {\r
+        return check % 10000;\r
+    }\r
+\r
+    public static String print(SequenceI[] s) {\r
+        return print(s, false);\r
+    }\r
+\r
+    public static String print(SequenceI[] s, boolean is_NA) {\r
+        StringBuffer out = new StringBuffer("!!" + (is_NA ? "NA" : "AA") +\r
+                "_MULTIPLE_ALIGNMENT 1.0\n\n"); // TODO: JBPNote : Jalview doesn't remember NA or AA yet.\r
 \r
-          StringTokenizer st = new StringTokenizer(head,"/");\r
+        int max = 0;\r
+        int maxid = 0;\r
+        int i = 0;\r
+        String big = "";\r
 \r
-          if (st.countTokens() == 2) {\r
+        while ((i < s.length) && (s[i] != null)) {\r
+            String sq;\r
+            big += (sq = s[i].getSequence());\r
 \r
-            head = st.nextToken();\r
-            String tmp = st.nextToken();\r
-            st = new StringTokenizer(tmp,"-");\r
-            if (st.countTokens() == 2) {\r
-              start = Integer.valueOf(st.nextToken()).intValue();\r
-              end = Integer.valueOf(st.nextToken()).intValue();\r
+            if (sq.length() > max) {\r
+                max = sq.length();\r
             }\r
-          }\r
-        }\r
-        // Replace ~ with a sensible gap character\r
-        seq = gapre.replaceAll(seq);\r
-        Sequence newSeq = new Sequence(head,seq,start,end);\r
 \r
-        seqs.addElement(newSeq);\r
+            i++;\r
+        }\r
 \r
-      } else {\r
-        System.err.println("MSFFile Parser: Can't find sequence for " + headers.elementAt(i));\r
-      }\r
-    }\r
+        Format maxLenpad = new Format("%" + (new String("" + max)).length() +\r
+                "d");\r
+        Format maxChkpad = new Format("%" + (new String("1" + max)).length() +\r
+                "d");\r
+        i = 0;\r
+\r
+        long bigcheck = checkSum(big);\r
+        long maxNB = 0;\r
+        out.append("   MSF: " + s[0].getSequence().length() + "   Type: " +\r
+            (is_NA ? "N" : "P") + "    Check:  " + bigcheck + "   ..\n\n\n");\r
+\r
+        String[] nameBlock = new String[s.length];\r
+        String[] idBlock = new String[s.length];\r
+\r
+        while ((i < s.length) && (s[i] != null)) {\r
+            String seq = s[i].getSequence();\r
+            String name = s[i].getName() + "/" + s[i].getStart() + "-" +\r
+                s[i].getEnd();\r
+            int check = checkSum(s[i].getSequence());\r
+            nameBlock[i] = new String("  Name: " + name + " ");\r
+            idBlock[i] = new String("Len: " +\r
+                    maxLenpad.form(s[i].getSequence().length()) + "  Check:" +\r
+                    maxChkpad.form(check) + "  Weight: 1.00\n");\r
+\r
+            if (name.length() > maxid) {\r
+                maxid = name.length();\r
+            }\r
 \r
-  }\r
+            if (nameBlock[i].length() > maxNB) {\r
+                maxNB = nameBlock[i].length();\r
+            }\r
 \r
-  public static int checkSum(String seq) {\r
-    //String chars =  "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz.*~&@";\r
-    int check = 0;\r
+            i++;\r
+        }\r
 \r
-    String index =  "--------------------------------------&---*---.-----------------@ABCDEFGHIJKLMNOPQRSTUVWXYZ------ABCDEFGHIJKLMNOPQRSTUVWXYZ----@";\r
-    index += "--------------------------------------------------------------------------------------------------------------------------------";\r
+        if (maxid < 10) {\r
+            maxid = 10;\r
+        }\r
 \r
-    for(int i = 0; i < seq.length(); i++) {\r
-      try {\r
-        if (i <seq.length()) {\r
-          int pos = index.indexOf(seq.substring(i,i+1));\r
-          if (!index.substring(pos,pos+1).equals("_")) {\r
-            check += ((i % 57) + 1) * pos;\r
-          }\r
+        if (maxNB < 15) {\r
+            maxNB = 15;\r
         }\r
-      } catch (Exception e) {\r
-        System.err.println("Exception during MSF Checksum calculation");\r
-        e.printStackTrace();\r
-      }\r
-    }\r
-    return check % 10000;\r
-  }\r
-\r
-  public static String print(SequenceI[] s) {\r
-    return print(s, false);\r
-  }\r
-  public static String print(SequenceI[] s, boolean is_NA) {\r
-    StringBuffer out = new StringBuffer("!!"+(is_NA ? "NA":"AA")+"_MULTIPLE_ALIGNMENT 1.0\n\n"); // TODO: JBPNote : Jalview doesn't remember NA or AA yet.\r
-\r
-    int max = 0;\r
-    int maxid = 0;\r
-    int i = 0;\r
-    String big = "";\r
-\r
-    while (i < s.length && s[i] != null) {\r
-      String sq;\r
-      big += (sq=s[i].getSequence());\r
-      if (sq.length() > max) {\r
-        max = sq.length();\r
-      }\r
-      i++;\r
-    }\r
-    Format maxLenpad = new Format("%"+(new String(""+max)).length()+"d");\r
-    Format maxChkpad = new Format("%"+(new String("1"+max)).length()+"d");\r
-    i = 0;\r
-    long bigcheck = checkSum(big);\r
-    long maxNB=0;\r
-    out.append("   MSF: " + s[0].getSequence().length() + "   Type: "+(is_NA?"N":"P")+"    Check:  " + bigcheck + "   ..\n\n\n");\r
-    String nameBlock[] = new String[s.length];\r
-    String idBlock[] = new String[s.length];\r
-    while (i < s.length && s[i] != null) {\r
-      String seq = s[i].getSequence();\r
-      String name =  s[i].getName()+ "/" + s[i].getStart() + "-" + s[i].getEnd();\r
-      int check = checkSum(s[i].getSequence());\r
-      nameBlock[i]=new String("  Name: "+name+" ");\r
-      idBlock[i] = new String("Len: " + maxLenpad.form(s[i].getSequence().length()) + "  Check:" + maxChkpad.form(check) + "  Weight: 1.00\n");\r
-\r
-      if (name.length() > maxid) {\r
-        maxid = name.length();\r
-      }\r
-      if (nameBlock[i].length()>maxNB) {\r
-        maxNB=nameBlock[i].length();\r
-      }\r
-\r
-      i++;\r
-    }\r
-    if (maxid < 10) {\r
-      maxid = 10;\r
-    }\r
-    if (maxNB<15) {\r
-      maxNB=15;\r
-    }\r
-    Format nbFormat = new Format("%-"+maxNB+"s");\r
-    for (i=0;i<s.length && s[i]!=null;i++) {\r
-      out.append(nbFormat.form(nameBlock[i])+idBlock[i]);\r
-    }\r
-    maxid++;\r
-    out.append( "\n\n//\n\n");\r
 \r
-    int len = 50;\r
+        Format nbFormat = new Format("%-" + maxNB + "s");\r
 \r
-    int nochunks =  max / len + 1;\r
-    if (max%len == 0) {\r
-      nochunks--;\r
-    }\r
-    for (i = 0; i < nochunks; i++) {\r
-      int j = 0;\r
-      while (j < s.length && s[j] != null) {\r
-        String name =  s[j].getName();\r
-        out.append( new Format("%-" + maxid + "s").form(name + "/" + s[j].getStart() + "-" + s[j].getEnd()) + " ");\r
-        for (int k = 0; k < 5; k++) {\r
-\r
-          int start = i*50 + k*10;\r
-          int end = start + 10;\r
-\r
-          if (end < s[j].getSequence().length() && start < s[j].getSequence().length() ) {\r
-            out.append(re2gap.replaceAll(s[j].getSequence().substring(start,end)));\r
-            if (k < 4) {\r
-              // out.append(" ");\r
-            } else {\r
-              out.append("\n");\r
-            }\r
-          } else {\r
-            if (start < s[j].getSequence().length()) {\r
-              out.append(re2gap.replaceAll(s[j].getSequence().substring(start)));\r
-              out.append("\n");\r
-            } else {\r
-              if (k == 0) {\r
-                out.append("\n");\r
-              }\r
-            }\r
-          }\r
+        for (i = 0; (i < s.length) && (s[i] != null); i++) {\r
+            out.append(nbFormat.form(nameBlock[i]) + idBlock[i]);\r
         }\r
-        j++;\r
-      }\r
-      out.append("\n");\r
 \r
-    }\r
-    return out.toString();\r
-  }\r
-  public String print() {\r
-    return print(getSeqsAsArray());\r
-  }\r
-}\r
+        maxid++;\r
+        out.append("\n\n//\n\n");\r
 \r
+        int len = 50;\r
 \r
+        int nochunks = (max / len) + 1;\r
 \r
+        if ((max % len) == 0) {\r
+            nochunks--;\r
+        }\r
 \r
+        for (i = 0; i < nochunks; i++) {\r
+            int j = 0;\r
+\r
+            while ((j < s.length) && (s[j] != null)) {\r
+                String name = s[j].getName();\r
+                out.append(new Format("%-" + maxid + "s").form(name + "/" +\r
+                        s[j].getStart() + "-" + s[j].getEnd()) + " ");\r
+\r
+                for (int k = 0; k < 5; k++) {\r
+                    int start = (i * 50) + (k * 10);\r
+                    int end = start + 10;\r
+\r
+                    if ((end < s[j].getSequence().length()) &&\r
+                            (start < s[j].getSequence().length())) {\r
+                        out.append(re2gap.replaceAll(s[j].getSequence()\r
+                                                         .substring(start, end)));\r
+\r
+                        if (k < 4) {\r
+                            // out.append(" ");\r
+                        } else {\r
+                            out.append("\n");\r
+                        }\r
+                    } else {\r
+                        if (start < s[j].getSequence().length()) {\r
+                            out.append(re2gap.replaceAll(\r
+                                    s[j].getSequence().substring(start)));\r
+                            out.append("\n");\r
+                        } else {\r
+                            if (k == 0) {\r
+                                out.append("\n");\r
+                            }\r
+                        }\r
+                    }\r
+                }\r
+\r
+                j++;\r
+            }\r
 \r
+            out.append("\n");\r
+        }\r
 \r
+        return out.toString();\r
+    }\r
 \r
+    public String print() {\r
+        return print(getSeqsAsArray());\r
+    }\r
+}\r
index a372ed3..a6f1580 100755 (executable)
 * 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
-*/
-
-// NewickFile.java
-// Tree I/O
-// http://evolution.genetics.washington.edu/phylip/newick_doc.html
-
-package jalview.io;
-
-import java.io.*;
-import java.util.*;
-import jalview.datamodel.*;
-
-public class NewickFile extends FileParse
-{
-  SequenceNode root;
-
-  private boolean HasBootstrap = false;
-  private boolean HasDistances = false;
-  private boolean RootHasDistance = false;
-
-  private String ErrorStringrange(String Error, String Er, int r, int p, String s) {
-    return ((Error==null) ? "" : Error)
-        + Er +
-        " at position "+p+" ( "
-        + s.substring((p-r)<0 ? 0 : (p-r),
-                      (p+r)>s.length() ? s.length() : (p+r))
-        + " )\n";
-  }
-
-  // @tree annotations
-  // These are set automatically by the reader
-  public boolean HasBootstrap() {
-    return HasBootstrap;
-  }
-
-  public boolean HasDistances() {
-    return HasDistances;
-  }
-  public NewickFile(String inStr) throws IOException
-  {
-    super(inStr, "Paste");
-  }
-
-  public NewickFile(String inFile, String type)
-      throws IOException
-  {
-
-    super(inFile, type);
-  }
-  // File IO Flags
-  boolean ReplaceUnderscores = false;
-
-  public void parse() throws IOException
-  {
-    String nf;
-
-    { // fill nf with complete tree file
-      StringBuffer file = new StringBuffer();
-      while ( (nf = nextLine()) != null)
-      {
-        file.append(nf);
-      }
-      nf = file.toString();
-    }
-
-    root = new SequenceNode();
-    SequenceNode realroot = null;
-    SequenceNode c = root;
-
-    int d = -1;
-    int cp = 0;
-    int flen = nf.length();
-
-    String Error = null;
-    String nodename = null;
-
-    float DefDistance = (float) 0.00001; // @param Default distance for a node - very very small
-    int DefBootstrap = 0; // @param Default bootstrap for a node
-
-    float distance=DefDistance;
-    int bootstrap=DefBootstrap;
-
-    boolean ascending = false; // flag indicating that we are leaving the current node
-
-    com.stevesoft.pat.Regex majorsyms = new com.stevesoft.pat.Regex("[(\\['),;]");
-
-    while (majorsyms.searchFrom(nf, cp) && Error==null) {
-      int fcp = majorsyms.matchedFrom();
-      switch (nf.charAt(fcp)) {
-
-        case '[': // Comment or structured/extended NH format info
-          com.stevesoft.pat.Regex comment = new com.stevesoft.pat.Regex("]");
-          if (comment.searchFrom(nf, fcp))
-          {
-            // Skip the comment field
-            cp = 1 + comment.matchedFrom();
-          }
-          else
-          {
-            Error = ErrorStringrange(Error, "Unterminated comment", 3, fcp, nf);
-          }
-          ;
-          break;
-
-        case '(':
-
-          // ascending should not be set
-          // New Internal node
-          if (ascending)
-          {
-            Error = ErrorStringrange(Error, "Unexpected '('", 7, fcp, nf);
-            continue;
-          }
-          ;
-          d++;
-          if (c.right() == null)
-          {
-            c.setRight(new SequenceNode(null, c, null, DefDistance, DefBootstrap, false));
-            c = (SequenceNode) c.right();
-          }
-          else
-          {
-            if (c.left() != null)
-            {
-              // Dummy node for polytomy - keeps c.left free for new node
-              SequenceNode tmpn = new SequenceNode(null, c, null, 0, 0, true);
-              tmpn.SetChildren(c.left(), c.right());
-              c.setRight(tmpn);
-            }
-            c.setLeft(new SequenceNode(null, c, null, DefDistance, DefBootstrap, false));
-            c = (SequenceNode) c.left();
-          }
-          if (realroot==null) {
-            realroot = c;
-          }
-          nodename = null;
-          distance = DefDistance;
-          bootstrap = DefBootstrap;
-          cp = fcp + 1;
-          break;
-
-          // Deal with quoted fields
-        case '\'':
-          com.stevesoft.pat.Regex qnodename = new com.stevesoft.pat.Regex(
-              "([^']|'')+'");
-          if (qnodename.searchFrom(nf, fcp))
-          {
-            int nl = qnodename.stringMatched().length();
-            nodename = new String(qnodename.stringMatched().substring(0, nl - 1));
-            cp = fcp + nl + 1;
-          }
-          else
-          {
-            Error = ErrorStringrange(Error, "Unterminated quotes for nodename",
-                                     7, fcp, nf);
-          }
-          break;
-
-        case ';':
-          if (d != -1)
-          {
-            Error = ErrorStringrange(Error,
-                                     "Wayward semicolon (depth=" + d + ")", 7,
-                                     fcp, nf);
-          }
-          // cp advanced at the end of default
-
-        default:
-
-          // Parse simpler field strings
-          String fstring = nf.substring(cp, fcp);
-          com.stevesoft.pat.Regex uqnodename = new com.stevesoft.pat.Regex(
-              "\\b([^' :;\\](),]+)");
-          com.stevesoft.pat.Regex nbootstrap = new com.stevesoft.pat.Regex(
-              "\\S+([0-9+]+)\\S*:");
-          com.stevesoft.pat.Regex ndist = new com.stevesoft.pat.Regex(
-              ":([-0-9.+]+)");
-          if (uqnodename.search(fstring)
-              && (uqnodename.matchedFrom(1) == 0
-                  || fstring.charAt(uqnodename.matchedFrom(1) - 1) != ':')) // JBPNote HACK!
-
-          {
-            if (nodename == null)
-            {
-              if (ReplaceUnderscores) {
-                nodename = uqnodename.stringMatched(1).replace('_', ' ');
-              } else {
-                nodename = uqnodename.stringMatched(1);
-              }
-            }
-            else
-            {
-              Error = ErrorStringrange(Error,
-                                       "File has broken algorithm - overwritten nodename",
-                                       10, fcp,
-                                       nf);
-            }
-          }
-          if (nbootstrap.search(fstring)
-              &&
-              nbootstrap.matchedFrom(1)
-              > uqnodename.matchedFrom(1) + uqnodename.stringMatched().length())
-          {
-            try
-            {
-              bootstrap = (new Integer(nbootstrap.stringMatched(1))).intValue();
-              HasBootstrap = true;
-            }
-            catch (Exception e)
-            {
-              Error = ErrorStringrange(Error, "Can't parse bootstrap value", 4,
-                                       cp + nbootstrap.matchedFrom(), nf);
-            }
-          }
-          boolean nodehasdistance=false;
-          if (ndist.search(fstring))
-          {
-            try
-            {
-              distance = (new Float(ndist.stringMatched(1))).floatValue();
-              HasDistances = true;
-              nodehasdistance = true;
-            }
-            catch (Exception e)
-            {
-              Error = ErrorStringrange(Error, "Can't parse node distance value",
-                                       7, cp + ndist.matchedFrom(), nf);
-            }
-          }
-
-          if (ascending)
-          {
-            // Write node info here
-            c.setName(nodename);
-            c.dist = (HasDistances) ? distance : 0;
-            c.setBootstrap((HasBootstrap) ? bootstrap : 0);
-            if (c==realroot) {
-              RootHasDistance = nodehasdistance; // JBPNote This is really UGLY!!!
-            }
-          }
-          else
-          {
-            // Find a place to put the leaf
-            SequenceNode newnode =
-            new SequenceNode(null, c,
-                             nodename,
-                             (HasDistances) ? distance : DefDistance,
-                             (HasBootstrap) ? bootstrap : DefBootstrap,
-                             false);
-
-            if (c.right() == null)
-            {
-              c.setRight(newnode);
-            }
-            else
-            {
-              if (c.left() == null)
-              {
-                c.setLeft(newnode);
-              }
-              else
-              {
-                // Insert a dummy node for polytomy
-                SequenceNode newdummy = new SequenceNode(null, c, null, 0, 0, true);
-                newdummy.SetChildren(c.left(), newnode);
-                c.setLeft(newdummy);
-              }
-            }
-          }
-          if (ascending)
-          {
-            // move back up the tree from preceding closure
-            c = c.AscendTree();
-            if (d > -1 && c == null)
-            {
-              Error = ErrorStringrange(Error,
-                                       "File broke algorithm: Lost place in tree (is there an extra ')' ?)",
-                                       7, fcp, nf);
-            }
-          }
-
-          if (nf.charAt(fcp) == ')') {
-            d--;
-            ascending = true;
-          } else {
-            if (nf.charAt(fcp) == ',') {
-              if (ascending) {
-               ascending = false;
-             } else {
-               // Just advance focus, if we need to
-               if (c.left()!=null && (!c.left().isLeaf())) {
-                 c = (SequenceNode) c.left();
-               }
-             }
-            } // else : We do nothing if ';' is encountered.
-          }
-          // Reset new node properties to obvious fakes
-          nodename = null;
-          distance = DefDistance;
-          bootstrap = DefBootstrap;
-
-          cp=fcp+1;
-      }
-    }
-
-    if (Error!=null) {
-      throw(new IOException("NewickFile: "+Error+"\n"));
-    }
-
-    root = (SequenceNode) root.right().detach(); // remove the imaginary root.
-    if (!RootHasDistance) {
-      root.dist = 0;
-    }
-
-  }
-
-  public NewickFile(SequenceNode newtree) {
-    root = newtree;
-  }
-
-  public NewickFile(SequenceNode newtree, boolean bootstrap) {
-    HasBootstrap = bootstrap;
-    root=newtree;
-  }
-  public NewickFile(SequenceNode newtree, boolean bootstrap, boolean distances) {
-    root = newtree;
-    HasBootstrap = bootstrap;
-    HasDistances = distances;
-  }
-
-  public NewickFile(SequenceNode newtree, boolean bootstrap, boolean distances, boolean rootdistance) {
-      root = newtree;
-      HasBootstrap = bootstrap;
-      HasDistances = distances;
-      RootHasDistance = rootdistance;
-    }
-
-  public SequenceNode getTree() {
-    return root;
-  }
-
-  public String print() {
-    synchronized (this) {
-      StringBuffer tf = new StringBuffer();
-      print(tf, root);
-      return (tf.append(";").toString());
-    }
-  }
-
-  public String print(boolean withbootstraps) {
-    synchronized(this) {
-      boolean boots = this.HasBootstrap;
-      this.HasBootstrap = withbootstraps;
-      String rv = print();
-      this.HasBootstrap = boots;
-      return rv;
-    }
-  }
-
-  public String print(boolean withbootstraps, boolean withdists) {
-    synchronized(this) {
-      boolean dists = this.HasDistances;
-      this.HasDistances = withdists;
-      String rv = print(withbootstraps);
-      this.HasDistances = dists;
-      return rv;
-    }
-  }
-  boolean printRootInfo = false;
-
-
-  public String print(boolean withbootstraps, boolean withdists, boolean printRootInfo) {
-    synchronized(this) {
-      boolean rootinfo = printRootInfo;
-      this.printRootInfo = printRootInfo;
-      String rv = print(withbootstraps, withdists);
-      this.printRootInfo = rootinfo;
-      return rv;
-    }
-  }
-  private com.stevesoft.pat.Regex[] NodeSafeName =
-      new com.stevesoft.pat.Regex[]
-      { new com.stevesoft.pat.Regex().perlCode("m/[\\[,:'()]/"), // test for requiring quotes
-      new com.stevesoft.pat.Regex().perlCode("s/'/''/"), // escaping quote characters
-      new com.stevesoft.pat.Regex().perlCode("s/\\/w/_/") // unqoted whitespace transformation
-  };
-  char QuoteChar='\'';
-  char getQuoteChar() {
-    return QuoteChar;
-  }
-
-  char setQuoteChar(char c) {
-    char old = QuoteChar;
-    QuoteChar = c;
-    return old;
-  }
-
-  private String nodeName(String name) {
-    if (NodeSafeName[0].search(name)) {
-      return QuoteChar + NodeSafeName[1].replaceAll(name) + QuoteChar;
-    } else {
-      return NodeSafeName[2].replaceAll(name);
-    }
-  }
-  private String printNodeField(SequenceNode c) {
-
-    return ( (c.getName() == null) ? ""
-             : nodeName(c.getName()))
-        + ( (HasBootstrap)
-            ? ( (c.getBootstrap() > -1)
-                ? " " + c.getBootstrap()
-                : "")
-            : "")
-        + ( (HasDistances)
-            ? ":" + c.dist : "");
-  }
-  private String printRootField(SequenceNode root) {
-
-      return (printRootInfo)
-          ? (( (root.getName() == null) ? ""
-               : nodeName(root.getName()))
-             + ( (HasBootstrap)
-                 ? ( (root.getBootstrap() > -1)
-                     ? " " + root.getBootstrap()
-                     : "")
-                 : "")
-             + ( (RootHasDistance)
-                 ? ":" + root.dist : ""))
-          : "";
-    }
-
-// Non recursive call deals with root node properties
-  public void print(StringBuffer tf, SequenceNode root) {
-    if (root!=null) {
-      if (root.isLeaf() && printRootInfo) {
-        tf.append(printRootField(root));
-      } else {
-        if (root.isDummy()) {
-          _print(tf, (SequenceNode) root.right());
-          _print(tf, (SequenceNode) root.left());
-        } else {
-          tf.append("(");
-          _print(tf, (SequenceNode) root.right());
-          if (root.left() != null) {
-            tf.append(",");
-          }
-          _print(tf, (SequenceNode) root.left());
-          tf.append(")" + printRootField(root));
-        }
-      }
-    }
-  }
-
-  // Recursive call for non-root nodes
-  public void _print(StringBuffer tf, SequenceNode c) {
-    if (c!=null) {
-      if (c.isLeaf()) {
-        tf.append(printNodeField(c));
-      } else {
-        if (c.isDummy()) {
-          _print(tf, (SequenceNode) c.right());
-          _print(tf, (SequenceNode) c.left());
-        } else {
-          tf.append("(");
-          _print(tf, (SequenceNode) c.right());
-          if (c.left() != null) {
-            tf.append(",");
-          }
-          _print(tf, (SequenceNode) c.left());
-          tf.append(")" + printNodeField(c));
-        }
-      }
-    }
-  }
-
-// Test
-  public static void main(String[] args)
-{
-  try
-  {
-    File fn = new File(args[0]);
-
-    StringBuffer newickfile =  new StringBuffer();
-    BufferedReader treefile =
-        new BufferedReader(new FileReader(fn));
-    String l;
-    while ((l = treefile.readLine())!=null) {
-      newickfile.append(l);
-    }
-    treefile.close();
-    System.out.println("Read file :\n");
-    NewickFile trf = new NewickFile(args[0], "File");
-    trf.parse();
-    System.out.println("Original file :\n");
-    com.stevesoft.pat.Regex nonl = new com.stevesoft.pat.Regex("\n+", "");
-    System.out.println(nonl.replaceAll(newickfile.toString())+"\n");
-
-    System.out.println("Parsed file.\n");
-    System.out.println("Default output type for original input.\n");
-    System.out.println(trf.print());
-    System.out.println("Without bootstraps.\n");
-    System.out.println(trf.print(false));
-    System.out.println("Without distances.\n");
-    System.out.println(trf.print(true,false));
-    System.out.println("Without bootstraps but with distanecs.\n");
-    System.out.println(trf.print(false, true));
-    System.out.println("Without bootstraps or distanecs.\n");
-    System.out.println(trf.print(false, false));
-    System.out.println("With bootstraps and with distances.\n");
-    System.out.println(trf.print(true, true));
-  }
-  catch (java.io.IOException e)
-  {
-    System.err.println("Exception\n" + e);
-    e.printStackTrace();
-  }
-}
-
-}
+*/\r
+\r
+// NewickFile.java\r
+// Tree I/O\r
+// http://evolution.genetics.washington.edu/phylip/newick_doc.html\r
+package jalview.io;\r
+\r
+import jalview.datamodel.*;\r
+\r
+import java.io.*;\r
+\r
+import java.util.*;\r
+\r
+\r
+public class NewickFile extends FileParse {\r
+    SequenceNode root;\r
+    private boolean HasBootstrap = false;\r
+    private boolean HasDistances = false;\r
+    private boolean RootHasDistance = false;\r
+\r
+    // File IO Flags\r
+    boolean ReplaceUnderscores = false;\r
+    boolean printRootInfo = false;\r
+    private com.stevesoft.pat.Regex[] NodeSafeName = new com.stevesoft.pat.Regex[] {\r
+            new com.stevesoft.pat.Regex().perlCode("m/[\\[,:'()]/"), // test for requiring quotes\r
+            new com.stevesoft.pat.Regex().perlCode("s/'/''/"), // escaping quote characters\r
+            new com.stevesoft.pat.Regex().perlCode("s/\\/w/_/") // unqoted whitespace transformation\r
+        };\r
+    char QuoteChar = '\'';\r
+\r
+    public NewickFile(String inStr) throws IOException {\r
+        super(inStr, "Paste");\r
+    }\r
+\r
+    public NewickFile(String inFile, String type) throws IOException {\r
+        super(inFile, type);\r
+    }\r
+\r
+    public NewickFile(SequenceNode newtree) {\r
+        root = newtree;\r
+    }\r
+\r
+    public NewickFile(SequenceNode newtree, boolean bootstrap) {\r
+        HasBootstrap = bootstrap;\r
+        root = newtree;\r
+    }\r
+\r
+    public NewickFile(SequenceNode newtree, boolean bootstrap, boolean distances) {\r
+        root = newtree;\r
+        HasBootstrap = bootstrap;\r
+        HasDistances = distances;\r
+    }\r
+\r
+    public NewickFile(SequenceNode newtree, boolean bootstrap,\r
+        boolean distances, boolean rootdistance) {\r
+        root = newtree;\r
+        HasBootstrap = bootstrap;\r
+        HasDistances = distances;\r
+        RootHasDistance = rootdistance;\r
+    }\r
+\r
+    private String ErrorStringrange(String Error, String Er, int r, int p,\r
+        String s) {\r
+        return ((Error == null) ? "" : Error) + Er + " at position " + p +\r
+        " ( " +\r
+        s.substring(((p - r) < 0) ? 0 : (p - r),\r
+            ((p + r) > s.length()) ? s.length() : (p + r)) + " )\n";\r
+    }\r
+\r
+    // @tree annotations\r
+    // These are set automatically by the reader\r
+    public boolean HasBootstrap() {\r
+        return HasBootstrap;\r
+    }\r
+\r
+    public boolean HasDistances() {\r
+        return HasDistances;\r
+    }\r
+\r
+    public void parse() throws IOException {\r
+        String nf;\r
+\r
+        { // fill nf with complete tree file\r
+\r
+            StringBuffer file = new StringBuffer();\r
+\r
+            while ((nf = nextLine()) != null) {\r
+                file.append(nf);\r
+            }\r
+\r
+            nf = file.toString();\r
+        }\r
+\r
+        root = new SequenceNode();\r
+\r
+        SequenceNode realroot = null;\r
+        SequenceNode c = root;\r
+\r
+        int d = -1;\r
+        int cp = 0;\r
+        int flen = nf.length();\r
+\r
+        String Error = null;\r
+        String nodename = null;\r
+\r
+        float DefDistance = (float) 0.00001; // @param Default distance for a node - very very small\r
+        int DefBootstrap = 0; // @param Default bootstrap for a node\r
+\r
+        float distance = DefDistance;\r
+        int bootstrap = DefBootstrap;\r
+\r
+        boolean ascending = false; // flag indicating that we are leaving the current node\r
+\r
+        com.stevesoft.pat.Regex majorsyms = new com.stevesoft.pat.Regex(\r
+                "[(\\['),;]");\r
+\r
+        while (majorsyms.searchFrom(nf, cp) && (Error == null)) {\r
+            int fcp = majorsyms.matchedFrom();\r
+\r
+            switch (nf.charAt(fcp)) {\r
+            case '[': // Comment or structured/extended NH format info\r
+\r
+                com.stevesoft.pat.Regex comment = new com.stevesoft.pat.Regex(\r
+                        "]");\r
+\r
+                if (comment.searchFrom(nf, fcp)) {\r
+                    // Skip the comment field\r
+                    cp = 1 + comment.matchedFrom();\r
+                } else {\r
+                    Error = ErrorStringrange(Error, "Unterminated comment", 3,\r
+                            fcp, nf);\r
+                }\r
+\r
+                ;\r
+\r
+                break;\r
+\r
+            case '(':\r
+\r
+                // ascending should not be set\r
+                // New Internal node\r
+                if (ascending) {\r
+                    Error = ErrorStringrange(Error, "Unexpected '('", 7, fcp, nf);\r
+\r
+                    continue;\r
+                }\r
+\r
+                ;\r
+                d++;\r
+\r
+                if (c.right() == null) {\r
+                    c.setRight(new SequenceNode(null, c, null, DefDistance,\r
+                            DefBootstrap, false));\r
+                    c = (SequenceNode) c.right();\r
+                } else {\r
+                    if (c.left() != null) {\r
+                        // Dummy node for polytomy - keeps c.left free for new node\r
+                        SequenceNode tmpn = new SequenceNode(null, c, null, 0,\r
+                                0, true);\r
+                        tmpn.SetChildren(c.left(), c.right());\r
+                        c.setRight(tmpn);\r
+                    }\r
+\r
+                    c.setLeft(new SequenceNode(null, c, null, DefDistance,\r
+                            DefBootstrap, false));\r
+                    c = (SequenceNode) c.left();\r
+                }\r
+\r
+                if (realroot == null) {\r
+                    realroot = c;\r
+                }\r
+\r
+                nodename = null;\r
+                distance = DefDistance;\r
+                bootstrap = DefBootstrap;\r
+                cp = fcp + 1;\r
+\r
+                break;\r
+\r
+            // Deal with quoted fields\r
+            case '\'':\r
+\r
+                com.stevesoft.pat.Regex qnodename = new com.stevesoft.pat.Regex(\r
+                        "([^']|'')+'");\r
+\r
+                if (qnodename.searchFrom(nf, fcp)) {\r
+                    int nl = qnodename.stringMatched().length();\r
+                    nodename = new String(qnodename.stringMatched().substring(0,\r
+                                nl - 1));\r
+                    cp = fcp + nl + 1;\r
+                } else {\r
+                    Error = ErrorStringrange(Error,\r
+                            "Unterminated quotes for nodename", 7, fcp, nf);\r
+                }\r
+\r
+                break;\r
+\r
+            case ';':\r
+\r
+                if (d != -1) {\r
+                    Error = ErrorStringrange(Error,\r
+                            "Wayward semicolon (depth=" + d + ")", 7, fcp, nf);\r
+                }\r
+\r
+            // cp advanced at the end of default\r
+            default:\r
+\r
+                // Parse simpler field strings\r
+                String fstring = nf.substring(cp, fcp);\r
+                com.stevesoft.pat.Regex uqnodename = new com.stevesoft.pat.Regex(\r
+                        "\\b([^' :;\\](),]+)");\r
+                com.stevesoft.pat.Regex nbootstrap = new com.stevesoft.pat.Regex(\r
+                        "\\S+([0-9+]+)\\S*:");\r
+                com.stevesoft.pat.Regex ndist = new com.stevesoft.pat.Regex(\r
+                        ":([-0-9.+]+)");\r
+\r
+                if (uqnodename.search(fstring) &&\r
+                        ((uqnodename.matchedFrom(1) == 0) ||\r
+                        (fstring.charAt(uqnodename.matchedFrom(1) - 1) != ':'))) // JBPNote HACK!\r
+                 {\r
+                    if (nodename == null) {\r
+                        if (ReplaceUnderscores) {\r
+                            nodename = uqnodename.stringMatched(1).replace('_',\r
+                                    ' ');\r
+                        } else {\r
+                            nodename = uqnodename.stringMatched(1);\r
+                        }\r
+                    } else {\r
+                        Error = ErrorStringrange(Error,\r
+                                "File has broken algorithm - overwritten nodename",\r
+                                10, fcp, nf);\r
+                    }\r
+                }\r
+\r
+                if (nbootstrap.search(fstring) &&\r
+                        (nbootstrap.matchedFrom(1) > (uqnodename.matchedFrom(1) +\r
+                        uqnodename.stringMatched().length()))) {\r
+                    try {\r
+                        bootstrap = (new Integer(nbootstrap.stringMatched(1))).intValue();\r
+                        HasBootstrap = true;\r
+                    } catch (Exception e) {\r
+                        Error = ErrorStringrange(Error,\r
+                                "Can't parse bootstrap value", 4,\r
+                                cp + nbootstrap.matchedFrom(), nf);\r
+                    }\r
+                }\r
+\r
+                boolean nodehasdistance = false;\r
+\r
+                if (ndist.search(fstring)) {\r
+                    try {\r
+                        distance = (new Float(ndist.stringMatched(1))).floatValue();\r
+                        HasDistances = true;\r
+                        nodehasdistance = true;\r
+                    } catch (Exception e) {\r
+                        Error = ErrorStringrange(Error,\r
+                                "Can't parse node distance value", 7,\r
+                                cp + ndist.matchedFrom(), nf);\r
+                    }\r
+                }\r
+\r
+                if (ascending) {\r
+                    // Write node info here\r
+                    c.setName(nodename);\r
+                    c.dist = (HasDistances) ? distance : 0;\r
+                    c.setBootstrap((HasBootstrap) ? bootstrap : 0);\r
+\r
+                    if (c == realroot) {\r
+                        RootHasDistance = nodehasdistance; // JBPNote This is really UGLY!!!\r
+                    }\r
+                } else {\r
+                    // Find a place to put the leaf\r
+                    SequenceNode newnode = new SequenceNode(null, c, nodename,\r
+                            (HasDistances) ? distance : DefDistance,\r
+                            (HasBootstrap) ? bootstrap : DefBootstrap, false);\r
+\r
+                    if (c.right() == null) {\r
+                        c.setRight(newnode);\r
+                    } else {\r
+                        if (c.left() == null) {\r
+                            c.setLeft(newnode);\r
+                        } else {\r
+                            // Insert a dummy node for polytomy\r
+                            SequenceNode newdummy = new SequenceNode(null, c,\r
+                                    null, 0, 0, true);\r
+                            newdummy.SetChildren(c.left(), newnode);\r
+                            c.setLeft(newdummy);\r
+                        }\r
+                    }\r
+                }\r
+\r
+                if (ascending) {\r
+                    // move back up the tree from preceding closure\r
+                    c = c.AscendTree();\r
+\r
+                    if ((d > -1) && (c == null)) {\r
+                        Error = ErrorStringrange(Error,\r
+                                "File broke algorithm: Lost place in tree (is there an extra ')' ?)",\r
+                                7, fcp, nf);\r
+                    }\r
+                }\r
+\r
+                if (nf.charAt(fcp) == ')') {\r
+                    d--;\r
+                    ascending = true;\r
+                } else {\r
+                    if (nf.charAt(fcp) == ',') {\r
+                        if (ascending) {\r
+                            ascending = false;\r
+                        } else {\r
+                            // Just advance focus, if we need to\r
+                            if ((c.left() != null) && (!c.left().isLeaf())) {\r
+                                c = (SequenceNode) c.left();\r
+                            }\r
+                        }\r
+                    }\r
+                     // else : We do nothing if ';' is encountered.\r
+                }\r
+\r
+                // Reset new node properties to obvious fakes\r
+                nodename = null;\r
+                distance = DefDistance;\r
+                bootstrap = DefBootstrap;\r
+\r
+                cp = fcp + 1;\r
+            }\r
+        }\r
+\r
+        if (Error != null) {\r
+            throw (new IOException("NewickFile: " + Error + "\n"));\r
+        }\r
+\r
+        root = (SequenceNode) root.right().detach(); // remove the imaginary root.\r
+\r
+        if (!RootHasDistance) {\r
+            root.dist = 0;\r
+        }\r
+    }\r
+\r
+    public SequenceNode getTree() {\r
+        return root;\r
+    }\r
+\r
+    public String print() {\r
+        synchronized (this) {\r
+            StringBuffer tf = new StringBuffer();\r
+            print(tf, root);\r
+\r
+            return (tf.append(";").toString());\r
+        }\r
+    }\r
+\r
+    public String print(boolean withbootstraps) {\r
+        synchronized (this) {\r
+            boolean boots = this.HasBootstrap;\r
+            this.HasBootstrap = withbootstraps;\r
+\r
+            String rv = print();\r
+            this.HasBootstrap = boots;\r
+\r
+            return rv;\r
+        }\r
+    }\r
+\r
+    public String print(boolean withbootstraps, boolean withdists) {\r
+        synchronized (this) {\r
+            boolean dists = this.HasDistances;\r
+            this.HasDistances = withdists;\r
+\r
+            String rv = print(withbootstraps);\r
+            this.HasDistances = dists;\r
+\r
+            return rv;\r
+        }\r
+    }\r
+\r
+    public String print(boolean withbootstraps, boolean withdists,\r
+        boolean printRootInfo) {\r
+        synchronized (this) {\r
+            boolean rootinfo = printRootInfo;\r
+            this.printRootInfo = printRootInfo;\r
+\r
+            String rv = print(withbootstraps, withdists);\r
+            this.printRootInfo = rootinfo;\r
+\r
+            return rv;\r
+        }\r
+    }\r
+\r
+    char getQuoteChar() {\r
+        return QuoteChar;\r
+    }\r
+\r
+    char setQuoteChar(char c) {\r
+        char old = QuoteChar;\r
+        QuoteChar = c;\r
+\r
+        return old;\r
+    }\r
+\r
+    private String nodeName(String name) {\r
+        if (NodeSafeName[0].search(name)) {\r
+            return QuoteChar + NodeSafeName[1].replaceAll(name) + QuoteChar;\r
+        } else {\r
+            return NodeSafeName[2].replaceAll(name);\r
+        }\r
+    }\r
+\r
+    private String printNodeField(SequenceNode c) {\r
+        return ((c.getName() == null) ? "" : nodeName(c.getName())) +\r
+        ((HasBootstrap)\r
+        ? ((c.getBootstrap() > -1) ? (" " + c.getBootstrap()) : "") : "") +\r
+        ((HasDistances) ? (":" + c.dist) : "");\r
+    }\r
+\r
+    private String printRootField(SequenceNode root) {\r
+        return (printRootInfo)\r
+        ? (((root.getName() == null) ? "" : nodeName(root.getName())) +\r
+        ((HasBootstrap)\r
+        ? ((root.getBootstrap() > -1) ? (" " + root.getBootstrap()) : "") : "") +\r
+        ((RootHasDistance) ? (":" + root.dist) : "")) : "";\r
+    }\r
+\r
+    // Non recursive call deals with root node properties\r
+    public void print(StringBuffer tf, SequenceNode root) {\r
+        if (root != null) {\r
+            if (root.isLeaf() && printRootInfo) {\r
+                tf.append(printRootField(root));\r
+            } else {\r
+                if (root.isDummy()) {\r
+                    _print(tf, (SequenceNode) root.right());\r
+                    _print(tf, (SequenceNode) root.left());\r
+                } else {\r
+                    tf.append("(");\r
+                    _print(tf, (SequenceNode) root.right());\r
+\r
+                    if (root.left() != null) {\r
+                        tf.append(",");\r
+                    }\r
+\r
+                    _print(tf, (SequenceNode) root.left());\r
+                    tf.append(")" + printRootField(root));\r
+                }\r
+            }\r
+        }\r
+    }\r
+\r
+    // Recursive call for non-root nodes\r
+    public void _print(StringBuffer tf, SequenceNode c) {\r
+        if (c != null) {\r
+            if (c.isLeaf()) {\r
+                tf.append(printNodeField(c));\r
+            } else {\r
+                if (c.isDummy()) {\r
+                    _print(tf, (SequenceNode) c.right());\r
+                    _print(tf, (SequenceNode) c.left());\r
+                } else {\r
+                    tf.append("(");\r
+                    _print(tf, (SequenceNode) c.right());\r
+\r
+                    if (c.left() != null) {\r
+                        tf.append(",");\r
+                    }\r
+\r
+                    _print(tf, (SequenceNode) c.left());\r
+                    tf.append(")" + printNodeField(c));\r
+                }\r
+            }\r
+        }\r
+    }\r
+\r
+    // Test\r
+    public static void main(String[] args) {\r
+        try {\r
+            File fn = new File(args[0]);\r
+\r
+            StringBuffer newickfile = new StringBuffer();\r
+            BufferedReader treefile = new BufferedReader(new FileReader(fn));\r
+            String l;\r
+\r
+            while ((l = treefile.readLine()) != null) {\r
+                newickfile.append(l);\r
+            }\r
+\r
+            treefile.close();\r
+            System.out.println("Read file :\n");\r
+\r
+            NewickFile trf = new NewickFile(args[0], "File");\r
+            trf.parse();\r
+            System.out.println("Original file :\n");\r
+\r
+            com.stevesoft.pat.Regex nonl = new com.stevesoft.pat.Regex("\n+", "");\r
+            System.out.println(nonl.replaceAll(newickfile.toString()) + "\n");\r
+\r
+            System.out.println("Parsed file.\n");\r
+            System.out.println("Default output type for original input.\n");\r
+            System.out.println(trf.print());\r
+            System.out.println("Without bootstraps.\n");\r
+            System.out.println(trf.print(false));\r
+            System.out.println("Without distances.\n");\r
+            System.out.println(trf.print(true, false));\r
+            System.out.println("Without bootstraps but with distanecs.\n");\r
+            System.out.println(trf.print(false, true));\r
+            System.out.println("Without bootstraps or distanecs.\n");\r
+            System.out.println(trf.print(false, false));\r
+            System.out.println("With bootstraps and with distances.\n");\r
+            System.out.println(trf.print(true, true));\r
+        } catch (java.io.IOException e) {\r
+            System.err.println("Exception\n" + e);\r
+            e.printStackTrace();\r
+        }\r
+    }\r
+}\r
index 410628f..42334e3 100755 (executable)
 * along with this program; if not, write to the Free Software\r
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
 */\r
-\r
 package jalview.io;\r
 \r
-import jalview.datamodel.*;\r
 import jalview.analysis.*;\r
 \r
+import jalview.datamodel.*;\r
+\r
 import java.io.*;\r
+\r
 import java.util.*;\r
 \r
+\r
 public class PIRFile extends AlignFile {\r
+    Vector words = new Vector(); //Stores the words in a line after splitting\r
+\r
+    public PIRFile() {\r
+    }\r
 \r
-  Vector words = new Vector();  //Stores the words in a line after splitting\r
-\r
-  public PIRFile()\r
-  {}\r
-\r
-  public PIRFile(String inStr) {\r
-    super(inStr);\r
-  }\r
-\r
-  public PIRFile(String inFile, String type) throws IOException {\r
-    super(inFile,type);\r
-  }\r
-\r
-  public void parse() {\r
-    try{\r
-      String id, start, end;\r
-      StringBuffer sequence;\r
-      String line = null;\r
-      while( (line = nextLine())!=null)\r
-      {\r
-        try{\r
-          id = line.substring(line.indexOf(";") + 1, line.indexOf("/"));\r
-          line = line.substring(line.indexOf("/") + 1);\r
-          start = line.substring(0, line.indexOf("-"));\r
-          end = line.substring(line.indexOf("-") + 1);\r
-        }catch(Exception ex)\r
-        {  id="No id"; start="0"; end="0"; }\r
-\r
-        sequence = new StringBuffer();\r
-\r
-        line = nextLine(); // this is the title line\r
-\r
-        boolean starFound = false;\r
-        do\r
-        {\r
-          line = nextLine();\r
-          sequence.append( line );\r
-          if(line.indexOf("*")>-1)\r
-            starFound = true;\r
-\r
-        }while(!starFound);\r
-\r
-        sequence.setLength( sequence.length()-1);\r
-\r
-       Sequence newSeq = new Sequence(id,\r
-                               sequence.toString(),\r
-                               Integer.parseInt(start),\r
-                               Integer.parseInt(end));\r
-         seqs.addElement(newSeq);\r
-      }\r
+    public PIRFile(String inStr) {\r
+        super(inStr);\r
+    }\r
 \r
+    public PIRFile(String inFile, String type) throws IOException {\r
+        super(inFile, type);\r
     }\r
-    catch(Exception ex){ex.printStackTrace();}\r
-  }\r
-\r
-  public String print() {\r
-    return print(getSeqsAsArray());\r
-  }\r
-  public static String print(SequenceI[] s) {\r
-    return print(s,72,true);\r
-  }\r
-  public static String print(SequenceI[] s, int len) {\r
-    return print(s,len,true);\r
-  }\r
-  public static String print(SequenceI[] s, int len,boolean gaps) {\r
-    StringBuffer out = new StringBuffer();\r
-    int i = 0;\r
-\r
-    while (i < s.length && s[i] != null) {\r
-      String seq = "";\r
-      if (gaps) {\r
-        seq = s[i].getSequence() + "*";\r
-      } else {\r
-        seq = AlignSeq.extractGaps(s[i].getSequence(),"-");\r
-        seq = AlignSeq.extractGaps(seq,".");\r
-        seq = AlignSeq.extractGaps(seq," ");\r
-        seq = seq + "*";\r
-      }\r
-\r
-      out.append(">P1;" + s[i].getName() + "/" + s[i].getStart()+ "-" + s[i].getEnd() + "\n");\r
-      out.append(" Dummy title\n");\r
-      int nochunks = seq.length() / len + 1;\r
-\r
-      for (int j = 0; j < nochunks; j++) {\r
-        int start = j*len;\r
-        int end = start + len;\r
-\r
-        if (end < seq.length()) {\r
-          out.append(seq.substring(start,end) + "\n");\r
-        } else if (start < seq.length()) {\r
-          out.append(seq.substring(start) + "\n");\r
+\r
+    public void parse() {\r
+        try {\r
+            String id;\r
+            String start;\r
+            String end;\r
+            StringBuffer sequence;\r
+            String line = null;\r
+\r
+            while ((line = nextLine()) != null) {\r
+                try {\r
+                    id = line.substring(line.indexOf(";") + 1, line.indexOf("/"));\r
+                    line = line.substring(line.indexOf("/") + 1);\r
+                    start = line.substring(0, line.indexOf("-"));\r
+                    end = line.substring(line.indexOf("-") + 1);\r
+                } catch (Exception ex) {\r
+                    id = "No id";\r
+                    start = "0";\r
+                    end = "0";\r
+                }\r
+\r
+                sequence = new StringBuffer();\r
+\r
+                line = nextLine(); // this is the title line\r
+\r
+                boolean starFound = false;\r
+\r
+                do {\r
+                    line = nextLine();\r
+                    sequence.append(line);\r
+\r
+                    if (line.indexOf("*") > -1) {\r
+                        starFound = true;\r
+                    }\r
+                } while (!starFound);\r
+\r
+                sequence.setLength(sequence.length() - 1);\r
+\r
+                Sequence newSeq = new Sequence(id, sequence.toString(),\r
+                        Integer.parseInt(start), Integer.parseInt(end));\r
+                seqs.addElement(newSeq);\r
+            }\r
+        } catch (Exception ex) {\r
+            ex.printStackTrace();\r
         }\r
-      }\r
-      i++;\r
     }\r
-    return out.toString();\r
-  }\r
 \r
-  public static void main(String[] args) {\r
-    String inStr = ">P1;LCAT_MOUSE_90.35\nMGLPGSPWQRVLLLLGLLLPPATPFWLLNVLFPPHTTPKAELSNHTRPVILVPGCLGNRLEAKLDKPDVVNW\nMCYRKTEDFFTIWLDFNLFLPLGVDCWIDNTRIVYNHSSGRVSNAPGVQIRVPGFGKTESVEYVDDNKLAGY\n\n>LCAT_PAPAN_95.78\nMGPPGSPWQWVPLLLGLLLPPAAPFWLLNVLFPPHTTPKAELSNHTRPVILVPGCLGNQLEAKLDKPDVVNW\nMCYRKTEDFFTIWLDLNMFLPLGVDCWIDNTRVVYNRSSGLVSNAPGVQIRVPGFGKTYSVEYLDSSKLAGY\nLHTLVQNLVNNGYVRDETVRAAPYDWRLEPGQQEEYYHKLAGLVEEMHAAYGKPVFLIGHSLGCLHLLYFLL\n";\r
-    PIRFile fa = new PIRFile(inStr);\r
-  }\r
-}\r
+    public String print() {\r
+        return print(getSeqsAsArray());\r
+    }\r
 \r
+    public static String print(SequenceI[] s) {\r
+        return print(s, 72, true);\r
+    }\r
 \r
+    public static String print(SequenceI[] s, int len) {\r
+        return print(s, len, true);\r
+    }\r
 \r
+    public static String print(SequenceI[] s, int len, boolean gaps) {\r
+        StringBuffer out = new StringBuffer();\r
+        int i = 0;\r
+\r
+        while ((i < s.length) && (s[i] != null)) {\r
+            String seq = "";\r
+\r
+            if (gaps) {\r
+                seq = s[i].getSequence() + "*";\r
+            } else {\r
+                seq = AlignSeq.extractGaps(s[i].getSequence(), "-");\r
+                seq = AlignSeq.extractGaps(seq, ".");\r
+                seq = AlignSeq.extractGaps(seq, " ");\r
+                seq = seq + "*";\r
+            }\r
+\r
+            out.append(">P1;" + s[i].getName() + "/" + s[i].getStart() + "-" +\r
+                s[i].getEnd() + "\n");\r
+            out.append(" Dummy title\n");\r
+\r
+            int nochunks = (seq.length() / len) + 1;\r
+\r
+            for (int j = 0; j < nochunks; j++) {\r
+                int start = j * len;\r
+                int end = start + len;\r
+\r
+                if (end < seq.length()) {\r
+                    out.append(seq.substring(start, end) + "\n");\r
+                } else if (start < seq.length()) {\r
+                    out.append(seq.substring(start) + "\n");\r
+                }\r
+            }\r
+\r
+            i++;\r
+        }\r
+\r
+        return out.toString();\r
+    }\r
+\r
+    public static void main(String[] args) {\r
+        String inStr = ">P1;LCAT_MOUSE_90.35\nMGLPGSPWQRVLLLLGLLLPPATPFWLLNVLFPPHTTPKAELSNHTRPVILVPGCLGNRLEAKLDKPDVVNW\nMCYRKTEDFFTIWLDFNLFLPLGVDCWIDNTRIVYNHSSGRVSNAPGVQIRVPGFGKTESVEYVDDNKLAGY\n\n>LCAT_PAPAN_95.78\nMGPPGSPWQWVPLLLGLLLPPAAPFWLLNVLFPPHTTPKAELSNHTRPVILVPGCLGNQLEAKLDKPDVVNW\nMCYRKTEDFFTIWLDLNMFLPLGVDCWIDNTRVVYNRSSGLVSNAPGVQIRVPGFGKTYSVEYLDSSKLAGY\nLHTLVQNLVNNGYVRDETVRAAPYDWRLEPGQQEEYYHKLAGLVEEMHAAYGKPVFLIGHSLGCLHLLYFLL\n";\r
+        PIRFile fa = new PIRFile(inStr);\r
+    }\r
+}\r
index d0ffbc9..b31a148 100755 (executable)
 * along with this program; if not, write to the Free Software\r
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
 */\r
-\r
 package jalview.io;\r
 \r
 import jalview.datamodel.*;\r
+\r
 import jalview.util.*;\r
 \r
 import java.io.*;\r
-import java.util.*;\r
-\r
-public class PfamFile extends AlignFile {\r
-\r
-  Vector ids;\r
 \r
-  public PfamFile()\r
-  {}\r
+import java.util.*;\r
 \r
-  public PfamFile(String inStr) {\r
-    super(inStr);\r
-  }\r
 \r
-  public void initData() {\r
-    super.initData();\r
-    ids = new Vector();\r
-  }\r
+public class PfamFile extends AlignFile {\r
+    Vector ids;\r
 \r
-  public PfamFile(String inFile, String type) throws IOException {\r
-    super(inFile,type);\r
-  }\r
+    public PfamFile() {\r
+    }\r
 \r
-  public void parse() throws IOException{\r
-    int i = 0;\r
-    String line;\r
+    public PfamFile(String inStr) {\r
+        super(inStr);\r
+    }\r
 \r
+    public PfamFile(String inFile, String type) throws IOException {\r
+        super(inFile, type);\r
+    }\r
 \r
-    Hashtable seqhash = new Hashtable();\r
-    Vector    headers = new Vector();\r
+    public void initData() {\r
+        super.initData();\r
+        ids = new Vector();\r
+    }\r
 \r
+    public void parse() throws IOException {\r
+        int i = 0;\r
+        String line;\r
 \r
-      while ((line = nextLine()) != null)\r
-      {\r
+        Hashtable seqhash = new Hashtable();\r
+        Vector headers = new Vector();\r
 \r
-      if (line.indexOf(" ") != 0)\r
-      {\r
-        if (line.indexOf("#") != 0)\r
-        {\r
+        while ((line = nextLine()) != null) {\r
+            if (line.indexOf(" ") != 0) {\r
+                if (line.indexOf("#") != 0) {\r
+                    StringTokenizer str = new StringTokenizer(line, " ");\r
+                    String id = "";\r
 \r
-          StringTokenizer str = new StringTokenizer(line," ");\r
-          String id = "";\r
+                    if (str.hasMoreTokens()) {\r
+                        id = str.nextToken();\r
 \r
-          if (str.hasMoreTokens())\r
-          {\r
-            id = str.nextToken();\r
+                        StringBuffer tempseq;\r
 \r
-            StringBuffer tempseq;\r
+                        if (seqhash.containsKey(id)) {\r
+                            tempseq = (StringBuffer) seqhash.get(id);\r
+                        } else {\r
+                            tempseq = new StringBuffer();\r
+                            seqhash.put(id, tempseq);\r
+                        }\r
 \r
-            if (seqhash.containsKey(id))\r
-              tempseq = (StringBuffer)seqhash.get(id);\r
-           else\r
-           {\r
-             tempseq = new StringBuffer();\r
-             seqhash.put(id,tempseq);\r
-           }\r
+                        if (!(headers.contains(id))) {\r
+                            headers.addElement(id);\r
+                        }\r
 \r
-            if (!(headers.contains(id)))\r
-              headers.addElement(id);\r
+                        tempseq.append(str.nextToken());\r
+                    }\r
+                }\r
+            }\r
+        }\r
 \r
+        this.noSeqs = headers.size();\r
 \r
-            tempseq.append(str.nextToken());\r
-          }\r
+        if (noSeqs < 1) {\r
+            throw new IOException("No sequences found (PFAM input)");\r
         }\r
-      }\r
-    }\r
 \r
-    this.noSeqs = headers.size();\r
-    if(noSeqs<1)\r
-      throw new IOException("No sequences found (PFAM input)");\r
-\r
-    for (i = 0; i < headers.size(); i++ ) {\r
-\r
-      if ( seqhash.get(headers.elementAt(i)) != null) {\r
-        if (maxLength <  seqhash.get(headers.elementAt(i)).toString().length() )\r
-          maxLength =  seqhash.get(headers.elementAt(i)).toString().length();\r
-\r
-        String head =  headers.elementAt(i).toString();\r
-        int start = 1;\r
-        int end =  seqhash.get(headers.elementAt(i)).toString().length();\r
-\r
-        if (head.indexOf("/") > 0 ) {\r
-          StringTokenizer st = new StringTokenizer(head,"/");\r
-          if (st.countTokens() == 2) {\r
-            ids.addElement(st.nextToken());\r
-            String tmp = st.nextToken();\r
-            st = new StringTokenizer(tmp,"-");\r
-            if (st.countTokens() == 2) {\r
-              start = Integer.valueOf(st.nextToken()).intValue();\r
-              end = Integer.valueOf(st.nextToken()).intValue();\r
-            } else\r
-            {\r
-              start = -1;\r
-              end = -1;\r
+        for (i = 0; i < headers.size(); i++) {\r
+            if (seqhash.get(headers.elementAt(i)) != null) {\r
+                if (maxLength < seqhash.get(headers.elementAt(i)).toString()\r
+                                           .length()) {\r
+                    maxLength = seqhash.get(headers.elementAt(i)).toString()\r
+                                       .length();\r
+                }\r
+\r
+                String head = headers.elementAt(i).toString();\r
+                int start = 1;\r
+                int end = seqhash.get(headers.elementAt(i)).toString().length();\r
+\r
+                if (head.indexOf("/") > 0) {\r
+                    StringTokenizer st = new StringTokenizer(head, "/");\r
+\r
+                    if (st.countTokens() == 2) {\r
+                        ids.addElement(st.nextToken());\r
+\r
+                        String tmp = st.nextToken();\r
+                        st = new StringTokenizer(tmp, "-");\r
+\r
+                        if (st.countTokens() == 2) {\r
+                            start = Integer.valueOf(st.nextToken()).intValue();\r
+                            end = Integer.valueOf(st.nextToken()).intValue();\r
+                        } else {\r
+                            start = -1;\r
+                            end = -1;\r
+                        }\r
+                    } else {\r
+                        ids.addElement(headers.elementAt(i));\r
+                    }\r
+                } else {\r
+                    ids.addElement(headers.elementAt(i));\r
+                }\r
+\r
+                Sequence newSeq = null;\r
+\r
+                if ((start != -1) && (end != -1)) {\r
+                    newSeq = new Sequence(ids.elementAt(i).toString(),\r
+                            seqhash.get(headers.elementAt(i).toString())\r
+                                   .toString(), start, end);\r
+                    seqs.addElement(newSeq);\r
+                } else {\r
+                    newSeq = new Sequence(ids.elementAt(i).toString(),\r
+                            seqhash.get(headers.elementAt(i).toString())\r
+                                   .toString(), 1,\r
+                            seqhash.get(headers.elementAt(i).toString())\r
+                                   .toString().length());\r
+                    seqs.addElement(newSeq);\r
+                }\r
+\r
+                if (!isValidProteinSequence(newSeq.getSequence())) {\r
+                    throw new IOException(\r
+                        "Not a valid protein sequence - (PFAM input)");\r
+                }\r
+            } else {\r
+                System.err.println("PFAM File reader: Can't find sequence for " +\r
+                    headers.elementAt(i));\r
             }\r
-          } else\r
-            ids.addElement(headers.elementAt(i));\r
-\r
         }\r
-        else\r
-          ids.addElement(headers.elementAt(i));\r
+    }\r
 \r
+    public static String print(SequenceI[] s) {\r
+        StringBuffer out = new StringBuffer("");\r
 \r
-        Sequence newSeq = null;\r
-        if (start != -1 && end != -1)\r
-        {\r
-          newSeq = new Sequence(ids.elementAt(i).toString(),\r
-                                         seqhash.get(headers.elementAt(i).toString()).toString(),start,end);\r
-          seqs.addElement(newSeq);\r
-        }\r
-        else\r
-        {\r
-          newSeq = new Sequence(ids.elementAt(i).toString(),\r
-                                         seqhash.get(headers.elementAt(i).toString()).toString(),1,\r
-                                         seqhash.get(headers.elementAt(i).toString()).toString().length());\r
-          seqs.addElement(newSeq);\r
-        }\r
+        int max = 0;\r
+        int maxid = 0;\r
 \r
-        if(!isValidProteinSequence(newSeq.getSequence()))\r
-          throw new IOException("Not a valid protein sequence - (PFAM input)");\r
-      }\r
-      else\r
-        System.err.println("PFAM File reader: Can't find sequence for " + headers.elementAt(i));\r
+        int i = 0;\r
 \r
-    }\r
+        while ((i < s.length) && (s[i] != null)) {\r
+            String tmp = s[i].getName() + "/" + s[i].getStart() + "-" +\r
+                s[i].getEnd();\r
 \r
-  }\r
+            if (s[i].getSequence().length() > max) {\r
+                max = s[i].getSequence().length();\r
+            }\r
 \r
-  public static String print(SequenceI[] s) {\r
-    StringBuffer out = new StringBuffer("");\r
+            if (tmp.length() > maxid) {\r
+                maxid = tmp.length();\r
+            }\r
 \r
-    int max = 0;\r
-    int maxid = 0;\r
+            i++;\r
+        }\r
 \r
-    int i = 0;\r
+        if (maxid < 15) {\r
+            maxid = 15;\r
+        }\r
 \r
-    while (i < s.length && s[i] != null) {\r
-      String tmp = s[i].getName() + "/" + s[i].getStart()+ "-" + s[i].getEnd();\r
+        int j = 0;\r
 \r
-      if (s[i].getSequence().length() > max) {\r
-        max = s[i].getSequence().length();\r
-      }\r
-      if (tmp.length() > maxid) {\r
-        maxid = tmp.length();\r
-      }\r
-      i++;\r
-    }\r
+        while ((j < s.length) && (s[j] != null)) {\r
+            out.append(new Format("%-" + maxid + "s").form(s[j].getName() +\r
+                    "/" + s[j].getStart() + "-" + s[j].getEnd()) + " ");\r
 \r
-    if (maxid < 15) {\r
-      maxid = 15;\r
-    }\r
+            out.append(s[j].getSequence() + "\n");\r
+            j++;\r
+        }\r
 \r
-    int j = 0;\r
-    while ( j < s.length && s[j] != null) {\r
-      out.append( new Format("%-" + maxid + "s").form(s[j].getName() + "/" + s[j].getStart() + "-" + s[j].getEnd() ) + " ");\r
+        out.append("\n");\r
 \r
-      out.append(s[j].getSequence() + "\n");\r
-      j++;\r
+        return out.toString();\r
     }\r
-    out.append("\n");\r
-\r
-    return out.toString();\r
-  }\r
 \r
-  public String print() {\r
-    return print(getSeqsAsArray());\r
-  }\r
+    public String print() {\r
+        return print(getSeqsAsArray());\r
+    }\r
 }\r
index f5f709e..9f879c0 100755 (executable)
 * 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.io;
-
+*/\r
+package jalview.io;\r
+\r
+\r
 /**
  * <p>Title: </p>
  *  PileUpfile
@@ -29,239 +29,248 @@ package jalview.io;
  *  of a subset of the MSF alignment format. But, that was updated to reflect current
  *  GCG style IO fashion, as found in Emboss (thanks David Martin!)
  *
- **/
-
-
-import jalview.datamodel.*;
-import jalview.util.*;
-
-import java.io.*;
-import java.util.*;
-
-
-public class PileUpfile
-    extends AlignFile
-{
-
-public PileUpfile()
-{}
-
-public PileUpfile(String inStr) {
-  super(inStr);
-}
-
-public PileUpfile(String inFile, String type) throws IOException {
-  super(inFile,type);
-}
-
-public void parse() {
-
-  int       i       = 0;
-  boolean   seqFlag = false;
-  String    key     = new String();
-  Vector    headers = new Vector();
-  Hashtable seqhash = new Hashtable();
-  String    line;
-
-  try {
-  while ((line = nextLine()) != null) {
-
-    StringTokenizer str = new StringTokenizer(line);
-
-    while (str.hasMoreTokens()) {
-
-      String inStr = str.nextToken();
-
-      //If line has header information add to the headers vector
-      if (inStr.indexOf("Name:") != -1) {
-        key = str.nextToken();
-        headers.addElement(key);
-      }
-
-      //if line has // set SeqFlag to 1 so we know sequences are coming
-      if (inStr.indexOf("//") != -1) {
-        seqFlag = true;
-      }
-
-      //Process lines as sequence lines if seqFlag is set
-      if (( inStr.indexOf("//") == -1) && (seqFlag == true)) {
-        //seqeunce id is the first field
-        key = inStr;
-        StringBuffer tempseq;
-
-        //Get sequence from hash if it exists
-        if (seqhash.containsKey(key)) {
-          tempseq = (StringBuffer)seqhash.get(key);
-        } else {
-          tempseq = new StringBuffer();
-          seqhash.put(key,tempseq);
-        }
-
-        //loop through the rest of the words
-        while (str.hasMoreTokens()) {
-          //append the word to the sequence
-          tempseq.append(str.nextToken());
-        }
-      }
-    }
-  }
-  } catch (IOException e) {
-    System.err.println("Exception parsing PileUpfile " + e);
-    e.printStackTrace();
-  }
-
-  this.noSeqs = headers.size();
-
-  //Add sequences to the hash
-  for (i = 0; i < headers.size(); i++ ) {
-
-    if ( seqhash.get(headers.elementAt(i)) != null) {
-      String head =  headers.elementAt(i).toString();
-      String seq  =  seqhash.get(head).toString();
-
-      int start = 1;
-      int end = seq.length();
-
-      if (maxLength <  head.length() ) {
-        maxLength =  head.length();
-      }
-
-      if (head.indexOf("/") > 0 ) {
-
-        StringTokenizer st = new StringTokenizer(head,"/");
-
-        if (st.countTokens() == 2) {
-
-          head = st.nextToken();
-          String tmp = st.nextToken();
-          st = new StringTokenizer(tmp,"-");
-          if (st.countTokens() == 2) {
-            start = Integer.valueOf(st.nextToken()).intValue();
-            end = Integer.valueOf(st.nextToken()).intValue();
-          }
-        }
-      }
-
-      Sequence newSeq = new Sequence(head,seq,start,end);
-
-      seqs.addElement(newSeq);
-
-    } else {
-      System.err.println("PileUpfile Parser: Can't find sequence for " + headers.elementAt(i));
-    }
-  }
-
-}
-
-public static int checkSum(String seq) {
-  //String chars =  "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz.*~&@";
-  int check = 0;
-
-  String index =  "--------------------------------------&---*---.-----------------@ABCDEFGHIJKLMNOPQRSTUVWXYZ------ABCDEFGHIJKLMNOPQRSTUVWXYZ----@";
-  index += "--------------------------------------------------------------------------------------------------------------------------------";
-
-  for(int i = 0; i < seq.length(); i++) {
-    try {
-      if (i <seq.length()) {
-        int pos = index.indexOf(seq.substring(i,i+1));
-        if (!index.substring(pos,pos+1).equals("_")) {
-          check += ((i % 57) + 1) * pos;
-        }
-      }
-    } catch (Exception e) {
-      System.err.println("Exception during MSF Checksum calculation");
-      e.printStackTrace();
-    }
-  }
-  return check % 10000;
-}
-
-public static String print(SequenceI[] s) {
-  StringBuffer out = new StringBuffer("PileUp\n\n");
-
-  int max = 0;
-  int maxid = 0;
-
-  int i = 0;
-  String big = "";
-  while (i < s.length && s[i] != null) {
-    big += s[i].getSequence();
-    i++;
-  }
-  i = 0;
-  int bigcheck = checkSum(big);
-
-  out.append("   MSF: " + s[0].getSequence().length() + "   Type: P    Check:  " + bigcheck + "   ..\n\n\n");
-
-  while (i < s.length && s[i] != null) {
-    String seq = s[i].getSequence();
-    String name =  s[i].getName()+ "/" + s[i].getStart() + "-" + s[i].getEnd();
-    int check = checkSum(s[i].getSequence());
-    out.append(" Name: " + name + " oo  Len:  " + s[i].getSequence().length() + "  Check:  " + check + "  Weight:  1.00\n");
-    if (seq.length() > max) {
-      max = seq.length();
-    }
-    if (name.length() > maxid) {
-      maxid = name.length();
-    }
-    i++;
-  }
-
-  if (maxid < 10) {
-    maxid = 10;
-  }
-  maxid++;
-  out.append( "\n\n//\n\n");
-
-  int len = 50;
-
-  int nochunks =  max / len + 1;
-  if (max%len == 0) {
-    nochunks--;
-  }
-  for (i = 0; i < nochunks; i++) {
-    int j = 0;
-    while (j < s.length && s[j] != null) {
-      String name =  s[j].getName();
-      out.append( new Format("%-" + maxid + "s").form(name + "/" + s[j].getStart() + "-" + s[j].getEnd()) + " ");
-      for (int k = 0; k < 5; k++) {
-
-        int start = i*50 + k*10;
-        int end = start + 10;
-
-        if (end < s[j].getSequence().length() && start < s[j].getSequence().length() ) {
-          out.append(s[j].getSequence().substring(start,end));
-          if (k < 4) {
-            out.append(" ");
-          } else {
-            out.append("\n");
-          }
-        } else {
-          if (start < s[j].getSequence().length()) {
-            out.append(s[j].getSequence().substring(start));
-            out.append("\n");
-          } else {
-            if (k == 0) {
-              out.append("\n");
-            }
-          }
-        }
-      }
-      j++;
-    }
-    out.append("\n");
-
-  }
-  return out.toString();
-}
-public String print() {
-  return print(getSeqsAsArray());
-}
-}
-
-
-
-
-
-
-
+ **/\r
+import jalview.datamodel.*;\r
+\r
+import jalview.util.*;\r
+\r
+import java.io.*;\r
+\r
+import java.util.*;\r
+\r
+\r
+public class PileUpfile extends AlignFile {\r
+    public PileUpfile() {\r
+    }\r
+\r
+    public PileUpfile(String inStr) {\r
+        super(inStr);\r
+    }\r
+\r
+    public PileUpfile(String inFile, String type) throws IOException {\r
+        super(inFile, type);\r
+    }\r
+\r
+    public void parse() {\r
+        int i = 0;\r
+        boolean seqFlag = false;\r
+        String key = new String();\r
+        Vector headers = new Vector();\r
+        Hashtable seqhash = new Hashtable();\r
+        String line;\r
+\r
+        try {\r
+            while ((line = nextLine()) != null) {\r
+                StringTokenizer str = new StringTokenizer(line);\r
+\r
+                while (str.hasMoreTokens()) {\r
+                    String inStr = str.nextToken();\r
+\r
+                    //If line has header information add to the headers vector\r
+                    if (inStr.indexOf("Name:") != -1) {\r
+                        key = str.nextToken();\r
+                        headers.addElement(key);\r
+                    }\r
+\r
+                    //if line has // set SeqFlag to 1 so we know sequences are coming\r
+                    if (inStr.indexOf("//") != -1) {\r
+                        seqFlag = true;\r
+                    }\r
+\r
+                    //Process lines as sequence lines if seqFlag is set\r
+                    if ((inStr.indexOf("//") == -1) && (seqFlag == true)) {\r
+                        //seqeunce id is the first field\r
+                        key = inStr;\r
+\r
+                        StringBuffer tempseq;\r
+\r
+                        //Get sequence from hash if it exists\r
+                        if (seqhash.containsKey(key)) {\r
+                            tempseq = (StringBuffer) seqhash.get(key);\r
+                        } else {\r
+                            tempseq = new StringBuffer();\r
+                            seqhash.put(key, tempseq);\r
+                        }\r
+\r
+                        //loop through the rest of the words\r
+                        while (str.hasMoreTokens()) {\r
+                            //append the word to the sequence\r
+                            tempseq.append(str.nextToken());\r
+                        }\r
+                    }\r
+                }\r
+            }\r
+        } catch (IOException e) {\r
+            System.err.println("Exception parsing PileUpfile " + e);\r
+            e.printStackTrace();\r
+        }\r
+\r
+        this.noSeqs = headers.size();\r
+\r
+        //Add sequences to the hash\r
+        for (i = 0; i < headers.size(); i++) {\r
+            if (seqhash.get(headers.elementAt(i)) != null) {\r
+                String head = headers.elementAt(i).toString();\r
+                String seq = seqhash.get(head).toString();\r
+\r
+                int start = 1;\r
+                int end = seq.length();\r
+\r
+                if (maxLength < head.length()) {\r
+                    maxLength = head.length();\r
+                }\r
+\r
+                if (head.indexOf("/") > 0) {\r
+                    StringTokenizer st = new StringTokenizer(head, "/");\r
+\r
+                    if (st.countTokens() == 2) {\r
+                        head = st.nextToken();\r
+\r
+                        String tmp = st.nextToken();\r
+                        st = new StringTokenizer(tmp, "-");\r
+\r
+                        if (st.countTokens() == 2) {\r
+                            start = Integer.valueOf(st.nextToken()).intValue();\r
+                            end = Integer.valueOf(st.nextToken()).intValue();\r
+                        }\r
+                    }\r
+                }\r
+\r
+                Sequence newSeq = new Sequence(head, seq, start, end);\r
+\r
+                seqs.addElement(newSeq);\r
+            } else {\r
+                System.err.println(\r
+                    "PileUpfile Parser: Can't find sequence for " +\r
+                    headers.elementAt(i));\r
+            }\r
+        }\r
+    }\r
+\r
+    public static int checkSum(String seq) {\r
+        //String chars =  "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz.*~&@";\r
+        int check = 0;\r
+\r
+        String index = "--------------------------------------&---*---.-----------------@ABCDEFGHIJKLMNOPQRSTUVWXYZ------ABCDEFGHIJKLMNOPQRSTUVWXYZ----@";\r
+        index += "--------------------------------------------------------------------------------------------------------------------------------";\r
+\r
+        for (int i = 0; i < seq.length(); i++) {\r
+            try {\r
+                if (i < seq.length()) {\r
+                    int pos = index.indexOf(seq.substring(i, i + 1));\r
+\r
+                    if (!index.substring(pos, pos + 1).equals("_")) {\r
+                        check += (((i % 57) + 1) * pos);\r
+                    }\r
+                }\r
+            } catch (Exception e) {\r
+                System.err.println("Exception during MSF Checksum calculation");\r
+                e.printStackTrace();\r
+            }\r
+        }\r
+\r
+        return check % 10000;\r
+    }\r
+\r
+    public static String print(SequenceI[] s) {\r
+        StringBuffer out = new StringBuffer("PileUp\n\n");\r
+\r
+        int max = 0;\r
+        int maxid = 0;\r
+\r
+        int i = 0;\r
+        String big = "";\r
+\r
+        while ((i < s.length) && (s[i] != null)) {\r
+            big += s[i].getSequence();\r
+            i++;\r
+        }\r
+\r
+        i = 0;\r
+\r
+        int bigcheck = checkSum(big);\r
+\r
+        out.append("   MSF: " + s[0].getSequence().length() +\r
+            "   Type: P    Check:  " + bigcheck + "   ..\n\n\n");\r
+\r
+        while ((i < s.length) && (s[i] != null)) {\r
+            String seq = s[i].getSequence();\r
+            String name = s[i].getName() + "/" + s[i].getStart() + "-" +\r
+                s[i].getEnd();\r
+            int check = checkSum(s[i].getSequence());\r
+            out.append(" Name: " + name + " oo  Len:  " +\r
+                s[i].getSequence().length() + "  Check:  " + check +\r
+                "  Weight:  1.00\n");\r
+\r
+            if (seq.length() > max) {\r
+                max = seq.length();\r
+            }\r
+\r
+            if (name.length() > maxid) {\r
+                maxid = name.length();\r
+            }\r
+\r
+            i++;\r
+        }\r
+\r
+        if (maxid < 10) {\r
+            maxid = 10;\r
+        }\r
+\r
+        maxid++;\r
+        out.append("\n\n//\n\n");\r
+\r
+        int len = 50;\r
+\r
+        int nochunks = (max / len) + 1;\r
+\r
+        if ((max % len) == 0) {\r
+            nochunks--;\r
+        }\r
+\r
+        for (i = 0; i < nochunks; i++) {\r
+            int j = 0;\r
+\r
+            while ((j < s.length) && (s[j] != null)) {\r
+                String name = s[j].getName();\r
+                out.append(new Format("%-" + maxid + "s").form(name + "/" +\r
+                        s[j].getStart() + "-" + s[j].getEnd()) + " ");\r
+\r
+                for (int k = 0; k < 5; k++) {\r
+                    int start = (i * 50) + (k * 10);\r
+                    int end = start + 10;\r
+\r
+                    if ((end < s[j].getSequence().length()) &&\r
+                            (start < s[j].getSequence().length())) {\r
+                        out.append(s[j].getSequence().substring(start, end));\r
+\r
+                        if (k < 4) {\r
+                            out.append(" ");\r
+                        } else {\r
+                            out.append("\n");\r
+                        }\r
+                    } else {\r
+                        if (start < s[j].getSequence().length()) {\r
+                            out.append(s[j].getSequence().substring(start));\r
+                            out.append("\n");\r
+                        } else {\r
+                            if (k == 0) {\r
+                                out.append("\n");\r
+                            }\r
+                        }\r
+                    }\r
+                }\r
+\r
+                j++;\r
+            }\r
+\r
+            out.append("\n");\r
+        }\r
+\r
+        return out.toString();\r
+    }\r
+\r
+    public String print() {\r
+        return print(getSeqsAsArray());\r
+    }\r
+}\r
index b8300a0..c8c39dc 100755 (executable)
 * along with this program; if not, write to the Free Software\r
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
 */\r
-\r
 package jalview.io;\r
 \r
+import jalview.datamodel.*;\r
+\r
+import jalview.gui.*;\r
+\r
+import jalview.io.*;\r
+\r
 import java.io.*;\r
+\r
 import java.util.*;\r
+\r
 import javax.swing.*;\r
-import jalview.io.*;\r
-import jalview.gui.*;\r
-import jalview.datamodel.*;\r
 \r
-public class SequenceFeatureFetcher implements Runnable\r
-{\r
-  AlignmentI align;\r
-  AlignmentPanel ap;\r
-  ArrayList unknownSequences;\r
-  CutAndPasteTransfer output = new CutAndPasteTransfer();\r
-  StringBuffer sbuffer = new StringBuffer();\r
-\r
-  public SequenceFeatureFetcher(AlignmentI align, AlignmentPanel ap)\r
-  {\r
-    unknownSequences = new ArrayList();\r
-    this.align = align;\r
-    this.ap = ap;\r
-    Thread thread = new Thread(this);\r
-    thread.start();\r
-  }\r
-\r
-  public void run()\r
-{\r
-\r
-  String cache = jalview.bin.Cache.getProperty("UNIPROT_CACHE");\r
-\r
-  RandomAccessFile out = null;\r
-\r
-  try{\r
-    if (cache == null)\r
-    {\r
-      jalview.bin.Cache.setProperty("UNIPROT_CACHE", System.getProperty("user.home")+"/uniprot.xml");\r
-      cache = jalview.bin.Cache.getProperty("UNIPROT_CACHE");\r
-    }\r
 \r
+public class SequenceFeatureFetcher implements Runnable {\r
+    AlignmentI align;\r
+    AlignmentPanel ap;\r
+    ArrayList unknownSequences;\r
+    CutAndPasteTransfer output = new CutAndPasteTransfer();\r
+    StringBuffer sbuffer = new StringBuffer();\r
 \r
+    public SequenceFeatureFetcher(AlignmentI align, AlignmentPanel ap) {\r
+        unknownSequences = new ArrayList();\r
+        this.align = align;\r
+        this.ap = ap;\r
 \r
-    File test = new File(cache);\r
-    if( !test.exists() )\r
-    {\r
-      out = new RandomAccessFile(cache, "rw");\r
-      out.writeBytes("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");\r
-      out.writeBytes("<UNIPROT_CACHE>\n");\r
-    }\r
-    else\r
-    {\r
-      out = new RandomAccessFile(cache, "rw");\r
-      // open exisiting cache and remove </UNIPROT_CACHE> from the end\r
-      long lastLine = 0;\r
-      String data;\r
-      while ( (data = out.readLine()) != null)\r
-      {\r
-        if (data.indexOf("</entry>") > -1)\r
-          lastLine = out.getFilePointer();\r
-\r
-      }\r
-      out.seek(lastLine);\r
+        Thread thread = new Thread(this);\r
+        thread.start();\r
     }\r
 \r
-    int seqIndex = 0;\r
-    Vector sequences = align.getSequences();\r
+    public void run() {\r
+        String cache = jalview.bin.Cache.getProperty("UNIPROT_CACHE");\r
 \r
-    while (seqIndex < sequences.size())\r
-    {\r
-      ArrayList ids = new ArrayList();\r
-      for (int i = 0; seqIndex < sequences.size() && i < 50; seqIndex++, i++)\r
-      {\r
-        SequenceI sequence = (SequenceI) sequences.get(seqIndex);\r
-        ids.add(sequence.getName());\r
-      }\r
+        RandomAccessFile out = null;\r
 \r
-      tryLocalCacheFirst(ids, align);\r
+        try {\r
+            if (cache == null) {\r
+                jalview.bin.Cache.setProperty("UNIPROT_CACHE",\r
+                    System.getProperty("user.home") + "/uniprot.xml");\r
+                cache = jalview.bin.Cache.getProperty("UNIPROT_CACHE");\r
+            }\r
 \r
-      if (ids.size() > 0)\r
-      {\r
-        StringBuffer remainingIds = new StringBuffer("uniprot:");\r
-        for (int i = 0; i < ids.size(); i++)\r
-          remainingIds.append(ids.get(i) + ";");\r
+            File test = new File(cache);\r
 \r
-         EBIFetchClient ebi = new EBIFetchClient();\r
-         String[] result = ebi.fetchData(remainingIds.toString(), "xml", null);\r
+            if (!test.exists()) {\r
+                out = new RandomAccessFile(cache, "rw");\r
+                out.writeBytes("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");\r
+                out.writeBytes("<UNIPROT_CACHE>\n");\r
+            } else {\r
+                out = new RandomAccessFile(cache, "rw");\r
 \r
-        if(result!=null)\r
-          ReadUniprotFile(result, out, align);\r
-      }\r
+                // open exisiting cache and remove </UNIPROT_CACHE> from the end\r
+                long lastLine = 0;\r
+                String data;\r
 \r
-    }\r
+                while ((data = out.readLine()) != null) {\r
+                    if (data.indexOf("</entry>") > -1) {\r
+                        lastLine = out.getFilePointer();\r
+                    }\r
+                }\r
 \r
-    if (out != null)\r
-    {\r
-      out.writeBytes("</UNIPROT_CACHE>\n");\r
-      out.close();\r
-    }\r
-  }catch(Exception ex){ex.printStackTrace();}\r
+                out.seek(lastLine);\r
+            }\r
 \r
-  ap.repaint();\r
-  findMissingIds(align);\r
-  if(sbuffer.length()>0)\r
-  {\r
-    output.setText("Your sequences have been matched to Uniprot. Some of the ids have been\n"\r
-                   +"altered, most likely the start/end residue will have been updated.\n"\r
-                   +"Save your alignment to maintain the updated id.\n\n"+sbuffer.toString());\r
-    Desktop.addInternalFrame(output, "Sequence names updated ", 600,300);\r
+            int seqIndex = 0;\r
+            Vector sequences = align.getSequences();\r
 \r
-  }\r
+            while (seqIndex < sequences.size()) {\r
+                ArrayList ids = new ArrayList();\r
 \r
-  if(unknownSequences.size()>0)\r
-  {\r
-    //ignore for now!!!!!!!!!!\r
-  //  WSWUBlastClient blastClient = new WSWUBlastClient(align, unknownSequences);\r
-  }\r
+                for (int i = 0; (seqIndex < sequences.size()) && (i < 50);\r
+                        seqIndex++, i++) {\r
+                    SequenceI sequence = (SequenceI) sequences.get(seqIndex);\r
+                    ids.add(sequence.getName());\r
+                }\r
 \r
-}\r
+                tryLocalCacheFirst(ids, align);\r
+\r
+                if (ids.size() > 0) {\r
+                    StringBuffer remainingIds = new StringBuffer("uniprot:");\r
 \r
-void ReadUniprotFile(String [] result, RandomAccessFile out, AlignmentI align)\r
-{\r
-  SequenceI sequence = null;\r
-  Vector features = null;\r
-  String type, description, status, start, end, pdb = null;\r
-\r
-\r
-  for (int r = 0; r < result.length; r++)\r
-  {\r
-    if(sequence==null && result[r].indexOf("<name>")>-1)\r
-    {\r
-      long filePointer = 0;\r
-\r
-      if(out!=null)\r
-      try{\r
-        filePointer=out.getFilePointer();\r
-        out.writeBytes("<entry>\n");\r
-      }catch(Exception ex){}\r
-\r
-      String seqName = parseElement( result[r], "<name>" , out);\r
-      sequence = align.findName( seqName ) ;\r
-      if(sequence==null)\r
-      {\r
-        sequence = align.findName( seqName.substring(0, seqName.indexOf('_')));\r
-        if(sequence!=null)\r
-        {\r
-          sbuffer.append("changing "+sequence.getName()+" to "+seqName+"\n");\r
-          sequence.setName(seqName);\r
+                    for (int i = 0; i < ids.size(); i++)\r
+                        remainingIds.append(ids.get(i) + ";");\r
+\r
+                    EBIFetchClient ebi = new EBIFetchClient();\r
+                    String[] result = ebi.fetchData(remainingIds.toString(),\r
+                            "xml", null);\r
+\r
+                    if (result != null) {\r
+                        ReadUniprotFile(result, out, align);\r
+                    }\r
+                }\r
+            }\r
+\r
+            if (out != null) {\r
+                out.writeBytes("</UNIPROT_CACHE>\n");\r
+                out.close();\r
+            }\r
+        } catch (Exception ex) {\r
+            ex.printStackTrace();\r
         }\r
-      }\r
-      if(sequence==null)\r
-      {\r
-        sbuffer.append("UNIPROT updated suggestion is "+result[r]+"\n");\r
-        sequence = align.findName( result[r] ) ;\r
-\r
-        // this entry has been suggested by ebi.\r
-        // doesn't match id in alignment file\r
-        try   { out.setLength(filePointer);  }  catch (Exception ex) {}\r
-        // now skip to next entry\r
-        while( result[r].indexOf("</entry>")==-1)\r
-          r++;\r
-      }\r
-\r
-      features = new Vector();\r
-      type=""; start="0"; end="0"; description=""; status=""; pdb="";\r
 \r
+        ap.repaint();\r
+        findMissingIds(align);\r
+\r
+        if (sbuffer.length() > 0) {\r
+            output.setText(\r
+                "Your sequences have been matched to Uniprot. Some of the ids have been\n" +\r
+                "altered, most likely the start/end residue will have been updated.\n" +\r
+                "Save your alignment to maintain the updated id.\n\n" +\r
+                sbuffer.toString());\r
+            Desktop.addInternalFrame(output, "Sequence names updated ", 600, 300);\r
+        }\r
+\r
+        if (unknownSequences.size() > 0) {\r
+            //ignore for now!!!!!!!!!!\r
+            //  WSWUBlastClient blastClient = new WSWUBlastClient(align, unknownSequences);\r
+        }\r
     }\r
 \r
-    if(sequence==null)\r
-      continue;\r
-\r
-     if( result[r].indexOf("<property type=\"pdb accession\"")>-1)\r
-     {\r
-       pdb = parseValue( result[r], "value=" , out);\r
-       sequence.setPDBId(pdb);\r
-     }\r
-\r
-     if(result[r].indexOf("feature type")>-1)\r
-     {\r
-       type = parseValue( result[r], "type=" , out);\r
-       description = parseValue( result[r], "description=" , null );\r
-       status = parseValue ( result[r], "status=", null);\r
-\r
-       while( result[r].indexOf("position")==-1)\r
-       {\r
-           r++;  //<location>\r
-       }\r
-      // r++;\r
-       if(result[r].indexOf("begin")>-1)\r
-       {\r
-         start = parseValue( result[r], "position=" , out);\r
-         end = parseValue( result[++r], "position=" , out);\r
-       }\r
-       else\r
-       {\r
-         start = parseValue( result[r], "position=" , out);\r
-         end = parseValue(   result[r], "position=" , null);\r
-       }\r
-       int sstart = Integer.parseInt(start);\r
-       int eend = Integer.parseInt(end);\r
-       if(out!=null)\r
-         try{ out.writeBytes("</feature>\n"); }catch(Exception ex){}\r
-\r
-         SequenceFeature sf = new SequenceFeature(type,\r
-             sstart,\r
-             eend,\r
-             description,\r
-             status);\r
-         features.add(sf);\r
-     }\r
-\r
-     if(result[r].indexOf("<sequence")>-1)\r
-     {\r
-       StringBuffer seqString = new StringBuffer();\r
-\r
-       if(out!=null)\r
-         try  {  out.writeBytes(result[r]+"\n"); }   catch (Exception ex){}\r
-\r
-       while(result[++r].indexOf("</sequence>")==-1)\r
-       {\r
-         seqString.append(result[r]);\r
-         if(out!=null)\r
-         try  {  out.writeBytes(result[r]+"\n"); }   catch (Exception ex){}\r
-       }\r
-\r
-       if(out!=null)\r
-         try  {  out.writeBytes(result[r]+"\n"); }   catch (Exception ex){}\r
-\r
-       StringBuffer nonGapped = new StringBuffer();\r
-       for (int i = 0; i < sequence.getSequence().length(); i++)\r
-       {\r
-         if (!jalview.util.Comparison.isGap(sequence.getCharAt(i)))\r
-           nonGapped.append(sequence.getCharAt(i));\r
-       }\r
-\r
-       int absStart = seqString.toString().indexOf(nonGapped.toString());\r
-       if(absStart==-1)\r
-       {\r
-         unknownSequences.add(sequence.getName());\r
-         features = null;\r
-         sbuffer.append(sequence.getName()+ " SEQUENCE NOT %100 MATCH \n");\r
-         continue;\r
-       }\r
-\r
-       int absEnd =   absStart + nonGapped.toString().length();\r
-       absStart+=1;\r
-\r
-       if(absStart!=sequence.getStart() || absEnd!=sequence.getEnd())\r
-         sbuffer.append("Updated: "+sequence.getName()+" "+\r
-                           sequence.getStart()+"/"+sequence.getEnd()+"  to  "+ absStart+"/"+absEnd+"\n");\r
-\r
-\r
-       sequence.setStart(absStart);\r
-       sequence.setEnd(absEnd);\r
-\r
-     }\r
-\r
-     if(result[r].indexOf("</entry>")>-1)\r
-     {\r
-       if(features!=null)\r
-         sequence.setSequenceFeatures( features );\r
-       features = null;\r
-       sequence = null;\r
-       if(out!=null)\r
-         try{  out.writeBytes("</entry>\n"); }catch(Exception ex){}\r
-\r
-     }\r
-  }\r
-}\r
+    void ReadUniprotFile(String[] result, RandomAccessFile out, AlignmentI align) {\r
+        SequenceI sequence = null;\r
+        Vector features = null;\r
+        String type;\r
+        String description;\r
+        String status;\r
+        String start;\r
+        String end;\r
+        String pdb = null;\r
+\r
+        for (int r = 0; r < result.length; r++) {\r
+            if ((sequence == null) && (result[r].indexOf("<name>") > -1)) {\r
+                long filePointer = 0;\r
+\r
+                if (out != null) {\r
+                    try {\r
+                        filePointer = out.getFilePointer();\r
+                        out.writeBytes("<entry>\n");\r
+                    } catch (Exception ex) {\r
+                    }\r
+                }\r
+\r
+                String seqName = parseElement(result[r], "<name>", out);\r
+                sequence = align.findName(seqName);\r
+\r
+                if (sequence == null) {\r
+                    sequence = align.findName(seqName.substring(0,\r
+                                seqName.indexOf('_')));\r
+\r
+                    if (sequence != null) {\r
+                        sbuffer.append("changing " + sequence.getName() +\r
+                            " to " + seqName + "\n");\r
+                        sequence.setName(seqName);\r
+                    }\r
+                }\r
+\r
+                if (sequence == null) {\r
+                    sbuffer.append("UNIPROT updated suggestion is " +\r
+                        result[r] + "\n");\r
+                    sequence = align.findName(result[r]);\r
+\r
+                    // this entry has been suggested by ebi.\r
+                    // doesn't match id in alignment file\r
+                    try {\r
+                        out.setLength(filePointer);\r
+                    } catch (Exception ex) {\r
+                    }\r
+\r
+                    // now skip to next entry\r
+                    while (result[r].indexOf("</entry>") == -1)\r
+                        r++;\r
+                }\r
+\r
+                features = new Vector();\r
+                type = "";\r
+                start = "0";\r
+                end = "0";\r
+                description = "";\r
+                status = "";\r
+                pdb = "";\r
+            }\r
+\r
+            if (sequence == null) {\r
+                continue;\r
+            }\r
+\r
+            if (result[r].indexOf("<property type=\"pdb accession\"") > -1) {\r
+                pdb = parseValue(result[r], "value=", out);\r
+                sequence.setPDBId(pdb);\r
+            }\r
+\r
+            if (result[r].indexOf("feature type") > -1) {\r
+                type = parseValue(result[r], "type=", out);\r
+                description = parseValue(result[r], "description=", null);\r
+                status = parseValue(result[r], "status=", null);\r
+\r
+                while (result[r].indexOf("position") == -1) {\r
+                    r++; //<location>\r
+                }\r
+\r
+                // r++;\r
+                if (result[r].indexOf("begin") > -1) {\r
+                    start = parseValue(result[r], "position=", out);\r
+                    end = parseValue(result[++r], "position=", out);\r
+                } else {\r
+                    start = parseValue(result[r], "position=", out);\r
+                    end = parseValue(result[r], "position=", null);\r
+                }\r
+\r
+                int sstart = Integer.parseInt(start);\r
+                int eend = Integer.parseInt(end);\r
+\r
+                if (out != null) {\r
+                    try {\r
+                        out.writeBytes("</feature>\n");\r
+                    } catch (Exception ex) {\r
+                    }\r
+                }\r
+\r
+                SequenceFeature sf = new SequenceFeature(type, sstart, eend,\r
+                        description, status);\r
+                features.add(sf);\r
+            }\r
+\r
+            if (result[r].indexOf("<sequence") > -1) {\r
+                StringBuffer seqString = new StringBuffer();\r
+\r
+                if (out != null) {\r
+                    try {\r
+                        out.writeBytes(result[r] + "\n");\r
+                    } catch (Exception ex) {\r
+                    }\r
+                }\r
+\r
+                while (result[++r].indexOf("</sequence>") == -1) {\r
+                    seqString.append(result[r]);\r
+\r
+                    if (out != null) {\r
+                        try {\r
+                            out.writeBytes(result[r] + "\n");\r
+                        } catch (Exception ex) {\r
+                        }\r
+                    }\r
+                }\r
+\r
+                if (out != null) {\r
+                    try {\r
+                        out.writeBytes(result[r] + "\n");\r
+                    } catch (Exception ex) {\r
+                    }\r
+                }\r
+\r
+                StringBuffer nonGapped = new StringBuffer();\r
+\r
+                for (int i = 0; i < sequence.getSequence().length(); i++) {\r
+                    if (!jalview.util.Comparison.isGap(sequence.getCharAt(i))) {\r
+                        nonGapped.append(sequence.getCharAt(i));\r
+                    }\r
+                }\r
+\r
+                int absStart = seqString.toString().indexOf(nonGapped.toString());\r
+\r
+                if (absStart == -1) {\r
+                    unknownSequences.add(sequence.getName());\r
+                    features = null;\r
+                    sbuffer.append(sequence.getName() +\r
+                        " SEQUENCE NOT %100 MATCH \n");\r
+\r
+                    continue;\r
+                }\r
+\r
+                int absEnd = absStart + nonGapped.toString().length();\r
+                absStart += 1;\r
+\r
+                if ((absStart != sequence.getStart()) ||\r
+                        (absEnd != sequence.getEnd())) {\r
+                    sbuffer.append("Updated: " + sequence.getName() + " " +\r
+                        sequence.getStart() + "/" + sequence.getEnd() +\r
+                        "  to  " + absStart + "/" + absEnd + "\n");\r
+                }\r
+\r
+                sequence.setStart(absStart);\r
+                sequence.setEnd(absEnd);\r
+            }\r
+\r
+            if (result[r].indexOf("</entry>") > -1) {\r
+                if (features != null) {\r
+                    sequence.setSequenceFeatures(features);\r
+                }\r
+\r
+                features = null;\r
+                sequence = null;\r
+\r
+                if (out != null) {\r
+                    try {\r
+                        out.writeBytes("</entry>\n");\r
+                    } catch (Exception ex) {\r
+                    }\r
+                }\r
+            }\r
+        }\r
+    }\r
 \r
-void findMissingIds(AlignmentI align)\r
-{\r
-  String data;\r
-  ArrayList cachedIds = new ArrayList();\r
-\r
-  try\r
-  {\r
-    BufferedReader in = new BufferedReader(\r
-        new FileReader(jalview.bin.Cache.getProperty("UNIPROT_CACHE")));\r
-\r
-    while ( (data = in.readLine()) != null)\r
-    {\r
-      if (data.indexOf("name") > -1)\r
-      {\r
-        String name = parseElement(data, "<name>", null);\r
-        cachedIds.add(name);\r
-      }\r
+    void findMissingIds(AlignmentI align) {\r
+        String data;\r
+        ArrayList cachedIds = new ArrayList();\r
+\r
+        try {\r
+            BufferedReader in = new BufferedReader(new FileReader(\r
+                        jalview.bin.Cache.getProperty("UNIPROT_CACHE")));\r
+\r
+            while ((data = in.readLine()) != null) {\r
+                if (data.indexOf("name") > -1) {\r
+                    String name = parseElement(data, "<name>", null);\r
+                    cachedIds.add(name);\r
+                }\r
+            }\r
+        } catch (Exception ex) {\r
+            ex.printStackTrace();\r
+        }\r
+\r
+        for (int i = 0; i < align.getHeight(); i++)\r
+            if (!cachedIds.contains(align.getSequenceAt(i).getName())) {\r
+                unknownSequences.add(align.getSequenceAt(i).getName());\r
+            }\r
     }\r
-  }\r
-  catch (Exception ex)\r
-  {   ex.printStackTrace();  }\r
 \r
-  for(int i=0; i<align.getHeight(); i++)\r
-    if( !cachedIds.contains( align.getSequenceAt(i).getName() ) )\r
-      unknownSequences.add( align.getSequenceAt(i).getName() );\r
+    void tryLocalCacheFirst(ArrayList ids, AlignmentI align) {\r
+        ArrayList cacheData = new ArrayList();\r
 \r
+        try {\r
+            BufferedReader in = new BufferedReader(new FileReader(\r
+                        jalview.bin.Cache.getProperty("UNIPROT_CACHE")));\r
 \r
-}\r
+            // read through cache file, if the cache has sequences we're looking for\r
+            // add the lines to a new String array, Readthis new array and\r
+            // make sure we remove the ids from the list to retrieve from EBI\r
+            String data;\r
 \r
-void tryLocalCacheFirst(ArrayList ids, AlignmentI align)\r
-{\r
-  ArrayList cacheData = new ArrayList();\r
-  try{\r
-    BufferedReader in = new BufferedReader(\r
-          new FileReader(jalview.bin.Cache.getProperty("UNIPROT_CACHE")));\r
-\r
-    // read through cache file, if the cache has sequences we're looking for\r
-    // add the lines to a new String array, Readthis new array and\r
-    // make sure we remove the ids from the list to retrieve from EBI\r
-    String data;\r
-    while( ( data=in.readLine())!=null)\r
-    {\r
-      if(data.indexOf("name")>-1)\r
-      {\r
-        String name = parseElement( data, "<name>" , null) ;\r
-        if(ids.contains( name ) )\r
-        {\r
-          cacheData.add("<entry>");\r
-          cacheData.add(data);\r
-          while( data.indexOf("</entry>")==-1)\r
-          {\r
-            data = in.readLine();\r
-            cacheData.add(data);\r
-          }\r
-          cacheData.add(data);\r
-\r
-          ids.remove( name );\r
-        }\r
-      }\r
-    }\r
-  }\r
-  catch(Exception ex){ex.printStackTrace();}\r
+            while ((data = in.readLine()) != null) {\r
+                if (data.indexOf("name") > -1) {\r
+                    String name = parseElement(data, "<name>", null);\r
 \r
-  String [] localData = new String[cacheData.size()];\r
-  cacheData.toArray( localData );\r
-  if(localData!=null && localData.length>0)\r
-    ReadUniprotFile(localData, null, align);\r
-}\r
+                    if (ids.contains(name)) {\r
+                        cacheData.add("<entry>");\r
+                        cacheData.add(data);\r
 \r
+                        while (data.indexOf("</entry>") == -1) {\r
+                            data = in.readLine();\r
+                            cacheData.add(data);\r
+                        }\r
 \r
-String parseValue(String line, String tag, RandomAccessFile out)\r
-{\r
-  if(out!=null)\r
-    try{  out.writeBytes(line+"\n"); }catch(Exception ex){}\r
+                        cacheData.add(data);\r
 \r
+                        ids.remove(name);\r
+                    }\r
+                }\r
+            }\r
+        } catch (Exception ex) {\r
+            ex.printStackTrace();\r
+        }\r
 \r
-  int index = line.indexOf(tag)+tag.length()+1;\r
-  if(index==tag.length())\r
-    return "";\r
+        String[] localData = new String[cacheData.size()];\r
+        cacheData.toArray(localData);\r
 \r
-  return line.substring( index, line.indexOf("\"", index+1) );\r
-}\r
+        if ((localData != null) && (localData.length > 0)) {\r
+            ReadUniprotFile(localData, null, align);\r
+        }\r
+    }\r
+\r
+    String parseValue(String line, String tag, RandomAccessFile out) {\r
+        if (out != null) {\r
+            try {\r
+                out.writeBytes(line + "\n");\r
+            } catch (Exception ex) {\r
+            }\r
+        }\r
 \r
+        int index = line.indexOf(tag) + tag.length() + 1;\r
 \r
-String parseElement(String line, String tag, RandomAccessFile out)\r
-{\r
-  if (out != null)\r
-    try\r
-    {\r
-      out.writeBytes(line + "\n");\r
+        if (index == tag.length()) {\r
+            return "";\r
+        }\r
+\r
+        return line.substring(index, line.indexOf("\"", index + 1));\r
     }\r
-    catch (Exception ex)\r
-    {}\r
 \r
-  int index = line.indexOf(tag) + tag.length();\r
-  return line.substring(index, line.indexOf("</"));\r
+    String parseElement(String line, String tag, RandomAccessFile out) {\r
+        if (out != null) {\r
+            try {\r
+                out.writeBytes(line + "\n");\r
+            } catch (Exception ex) {\r
+            }\r
+        }\r
 \r
-  }\r
+        int index = line.indexOf(tag) + tag.length();\r
+\r
+        return line.substring(index, line.indexOf("</"));\r
+    }\r
 }\r
index fd82c9e..29a0900 100755 (executable)
 * along with this program; if not, write to the Free Software\r
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
 */\r
-\r
 package jalview.io;\r
 \r
-import org.apache.axis.client.*;\r
-import javax.xml.namespace.QName;\r
-import java.util.*;\r
 import jalview.datamodel.*;\r
+\r
 import jalview.gui.*;\r
-import javax.swing.*;\r
-import java.util.*;\r
+\r
+import org.apache.axis.client.*;\r
+\r
 import java.awt.*;\r
 \r
-public class WSWUBlastClient\r
-{\r
-  CutAndPasteTransfer output = new CutAndPasteTransfer();\r
-  int jobsRunning = 0;\r
-\r
-  public WSWUBlastClient(AlignmentI al, ArrayList ids)\r
-  {\r
-    output.setText("To display sequence features an exact Uniprot id with 100% sequence identity match must be entered."\r
-                +"\nIn order to display these features, try changing the names of your sequences to the ids suggested below.");\r
-    Desktop.addInternalFrame(output, "BLASTing for unidentified sequences ", 800,300);\r
-\r
-    for(int i=0; i<ids.size(); i++)\r
-    {\r
-     SequenceI sequence =  al.findName( ids.get(i).toString() );\r
-     StringBuffer nonGapped = new StringBuffer();\r
-      for (int n = 0; n < sequence.getSequence().length(); n++)\r
-      {\r
-        if (!jalview.util.Comparison.isGap(sequence.getCharAt(n)))\r
-          nonGapped.append(sequence.getCharAt(n));\r
-      }\r
-\r
-     BlastThread thread = new BlastThread(ids.get(i).toString(),  nonGapped.toString());\r
-     thread.start();\r
-     jobsRunning ++;\r
-     }\r
-     ImageTwirler thread = new ImageTwirler();\r
-     thread.start();\r
-  }\r
-\r
-  class ImageTwirler extends Thread\r
-  {\r
-    ImageIcon [] imageIcon;\r
-    int imageIndex = 0;\r
-    public ImageTwirler()\r
-    {\r
-      imageIcon = new ImageIcon[9];\r
-      for(int i=0; i<9; i++)\r
-      {\r
-        java.net.URL url = getClass().getResource("/images/dna" + (i+1) + ".gif");\r
-        if (url != null)\r
-          imageIcon[i] = new ImageIcon(url);\r
-      }\r
-    }\r
+import java.util.*;\r
 \r
-    public void run()\r
-    {\r
-      while(jobsRunning>0)\r
-      {\r
-        try{\r
-          Thread.sleep(100);\r
-          imageIndex++;\r
-          imageIndex %=9;\r
-          output.setFrameIcon( imageIcon[imageIndex]);\r
-          output.setTitle("BLASTing for unidentified sequences - "+jobsRunning+" jobs running.");\r
+import javax.swing.*;\r
 \r
-        }catch(Exception ex){}\r
+import javax.xml.namespace.QName;\r
 \r
-      }\r
-    }\r
-  }\r
 \r
+public class WSWUBlastClient {\r
+    CutAndPasteTransfer output = new CutAndPasteTransfer();\r
+    int jobsRunning = 0;\r
 \r
+    public WSWUBlastClient(AlignmentI al, ArrayList ids) {\r
+        output.setText(\r
+            "To display sequence features an exact Uniprot id with 100% sequence identity match must be entered." +\r
+            "\nIn order to display these features, try changing the names of your sequences to the ids suggested below.");\r
+        Desktop.addInternalFrame(output,\r
+            "BLASTing for unidentified sequences ", 800, 300);\r
 \r
+        for (int i = 0; i < ids.size(); i++) {\r
+            SequenceI sequence = al.findName(ids.get(i).toString());\r
+            StringBuffer nonGapped = new StringBuffer();\r
 \r
-  class BlastThread extends Thread\r
-  {\r
-    String sequence;\r
-    String seqid;\r
-    String jobid;\r
-    boolean jobComplete = false;\r
+            for (int n = 0; n < sequence.getSequence().length(); n++) {\r
+                if (!jalview.util.Comparison.isGap(sequence.getCharAt(n))) {\r
+                    nonGapped.append(sequence.getCharAt(n));\r
+                }\r
+            }\r
+\r
+            BlastThread thread = new BlastThread(ids.get(i).toString(),\r
+                    nonGapped.toString());\r
+            thread.start();\r
+            jobsRunning++;\r
+        }\r
 \r
-    BlastThread(String id, String sequence)\r
-    {\r
-      this.sequence = sequence;\r
-      seqid = id;\r
+        ImageTwirler thread = new ImageTwirler();\r
+        thread.start();\r
     }\r
 \r
-    public void run()\r
-    {\r
-      StartJob();\r
-\r
-      while (!jobComplete)\r
-      {\r
-        try\r
-        {\r
-          Call call = (Call)new Service().createCall();\r
-          call.setTargetEndpointAddress(new java.net.URL(\r
-              "http://www.ebi.ac.uk/cgi-bin/webservices/WSWUBlast"));\r
-          call.setOperationName(new QName("WSWUBlast", "polljob"));\r
-          String result = (String) call.invoke(new Object[]\r
-                                               {jobid, "xml"});\r
-          if(result.indexOf("JOB PENDING")==-1 && result.indexOf("JOB RUNNING")==-1)\r
-          {\r
-                parseResult(seqid, result);\r
-                jobComplete = true;\r
-                jobsRunning --;\r
-          }\r
-          Thread.sleep(5000);\r
-          // System.out.println("WSWuBlastClient: I'm alive "+seqid+" "+jobid); // log.debug\r
+    void parseResult(String id1, String res) {\r
+        StringTokenizer st = new StringTokenizer(res, "\n");\r
+        String data;\r
+        String id2;\r
+        int maxFound = 90;\r
+        StringBuffer buffer = new StringBuffer("\n\n" + id1 + " :");\r
+\r
+        while (st.hasMoreTokens()) {\r
+            data = st.nextToken();\r
+\r
+            if (data.indexOf("database=\"uniprot\" id=") > -1) {\r
+                int index = data.indexOf("database=\"uniprot\" id=") + 23;\r
+                id2 = data.substring(index, data.indexOf("\"", index));\r
+\r
+                while (data.indexOf("</alignment>") == -1) {\r
+                    data = st.nextToken();\r
+\r
+                    if (data.indexOf("<identity>") > -1) {\r
+                        int value = Integer.parseInt(data.substring(data.indexOf(\r
+                                        "<identity>") + 10,\r
+                                    data.indexOf("</identity>")));\r
+\r
+                        if (value >= maxFound) {\r
+                            maxFound = value;\r
+                            buffer.append(" " + id2 + " " + value + "%; ");\r
+                        }\r
+                    }\r
+                }\r
+            }\r
         }\r
-        catch (Exception ex)\r
-        {}\r
-      }\r
-    }\r
 \r
-    void StartJob()\r
-    {\r
-      HashMap params = new HashMap();\r
-      params.put("database", "uniprot");\r
-      params.put("sensitivity", "low");\r
-      params.put("sort", "totalscore");\r
-      params.put("matrix", "pam10");\r
-      params.put("program", "blastp");\r
-      params.put("alignments", "5");\r
-      params.put("outformat", "xml");\r
-      params.put("searchtype", "1");\r
-      byte[] seqbytes = sequence.getBytes();\r
-\r
-      try\r
-      {\r
-        Call call = (Call)new Service().createCall();\r
-        call.setTargetEndpointAddress(new java.net.URL(\r
-            "http://www.ebi.ac.uk/cgi-bin/webservices/WSWUBlast"));\r
-        call.setOperationName(new QName("WSWUBlast", "doWUBlast"));\r
-        String result = (String) call.invoke(new Object[]\r
-                                             {params, seqbytes});\r
-        jobid = result;\r
-        System.out.println("http://www.ebi.ac.uk/cgi-bin/webservices/WSWUBlast JobId '"+jobid+"'");\r
-\r
-      }\r
-      catch (Exception exp)\r
-      {\r
-        System.err.println("WSWUBlastClient error:\n" + exp.toString());\r
-        exp.printStackTrace();\r
-      }\r
+        output.setText(output.getText() + buffer.toString());\r
     }\r
-  }\r
-\r
-    void parseResult(String id1, String res)\r
-    {\r
-      StringTokenizer st = new StringTokenizer(res, "\n");\r
-      String data;\r
-      String id2;\r
-      int maxFound = 90;\r
-      StringBuffer buffer = new StringBuffer("\n\n"+id1+" :");\r
-\r
-      while( st.hasMoreTokens() )\r
-      {\r
-        data = st.nextToken();\r
-\r
-        if(data.indexOf("database=\"uniprot\" id=")>-1)\r
-        {\r
-          int index =  data.indexOf("database=\"uniprot\" id=")+ 23;\r
-          id2 = data.substring( index, data.indexOf("\"", index) );\r
-          while( data.indexOf("</alignment>")==-1)\r
-          {\r
-            data = st.nextToken();\r
-            if(data.indexOf("<identity>")>-1)\r
-            {\r
-              int value = Integer.parseInt( data.substring(data.indexOf("<identity>")+10, data.indexOf("</identity>")));\r
-              if(value>=maxFound)\r
-              {\r
-                maxFound = value;\r
-                buffer.append(" "+ id2 + " " + value+"%; ");\r
-              }\r
+\r
+    class ImageTwirler extends Thread {\r
+        ImageIcon[] imageIcon;\r
+        int imageIndex = 0;\r
+\r
+        public ImageTwirler() {\r
+            imageIcon = new ImageIcon[9];\r
+\r
+            for (int i = 0; i < 9; i++) {\r
+                java.net.URL url = getClass().getResource("/images/dna" +\r
+                        (i + 1) + ".gif");\r
+\r
+                if (url != null) {\r
+                    imageIcon[i] = new ImageIcon(url);\r
+                }\r
             }\r
-          }\r
+        }\r
 \r
+        public void run() {\r
+            while (jobsRunning > 0) {\r
+                try {\r
+                    Thread.sleep(100);\r
+                    imageIndex++;\r
+                    imageIndex %= 9;\r
+                    output.setFrameIcon(imageIcon[imageIndex]);\r
+                    output.setTitle("BLASTing for unidentified sequences - " +\r
+                        jobsRunning + " jobs running.");\r
+                } catch (Exception ex) {\r
+                }\r
+            }\r
         }\r
+    }\r
 \r
+    class BlastThread extends Thread {\r
+        String sequence;\r
+        String seqid;\r
+        String jobid;\r
+        boolean jobComplete = false;\r
 \r
-      }\r
+        BlastThread(String id, String sequence) {\r
+            this.sequence = sequence;\r
+            seqid = id;\r
+        }\r
 \r
-      output.setText(output.getText()+buffer.toString());\r
-    }\r
+        public void run() {\r
+            StartJob();\r
+\r
+            while (!jobComplete) {\r
+                try {\r
+                    Call call = (Call) new Service().createCall();\r
+                    call.setTargetEndpointAddress(new java.net.URL(\r
+                            "http://www.ebi.ac.uk/cgi-bin/webservices/WSWUBlast"));\r
+                    call.setOperationName(new QName("WSWUBlast", "polljob"));\r
+\r
+                    String result = (String) call.invoke(new Object[] {\r
+                                jobid, "xml"\r
+                            });\r
 \r
+                    if ((result.indexOf("JOB PENDING") == -1) &&\r
+                            (result.indexOf("JOB RUNNING") == -1)) {\r
+                        parseResult(seqid, result);\r
+                        jobComplete = true;\r
+                        jobsRunning--;\r
+                    }\r
+\r
+                    Thread.sleep(5000);\r
+\r
+                    // System.out.println("WSWuBlastClient: I'm alive "+seqid+" "+jobid); // log.debug\r
+                } catch (Exception ex) {\r
+                }\r
+            }\r
+        }\r
+\r
+        void StartJob() {\r
+            HashMap params = new HashMap();\r
+            params.put("database", "uniprot");\r
+            params.put("sensitivity", "low");\r
+            params.put("sort", "totalscore");\r
+            params.put("matrix", "pam10");\r
+            params.put("program", "blastp");\r
+            params.put("alignments", "5");\r
+            params.put("outformat", "xml");\r
+            params.put("searchtype", "1");\r
+\r
+            byte[] seqbytes = sequence.getBytes();\r
+\r
+            try {\r
+                Call call = (Call) new Service().createCall();\r
+                call.setTargetEndpointAddress(new java.net.URL(\r
+                        "http://www.ebi.ac.uk/cgi-bin/webservices/WSWUBlast"));\r
+                call.setOperationName(new QName("WSWUBlast", "doWUBlast"));\r
+\r
+                String result = (String) call.invoke(new Object[] {\r
+                            params, seqbytes\r
+                        });\r
+                jobid = result;\r
+                System.out.println(\r
+                    "http://www.ebi.ac.uk/cgi-bin/webservices/WSWUBlast JobId '" +\r
+                    jobid + "'");\r
+            } catch (Exception exp) {\r
+                System.err.println("WSWUBlastClient error:\n" + exp.toString());\r
+                exp.printStackTrace();\r
+            }\r
+        }\r
+    }\r
 }\r
index 58c8029..a401b6e 100755 (executable)
 * 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.jbappletgui;\r
 \r
-import java.awt.event.*;\r
 import java.awt.*;\r
-\r
-public class GAlignFrame extends Frame\r
-{\r
-  protected MenuBar alignFrameMenuBar = new MenuBar();\r
-  protected Menu fileMenu = new Menu();\r
-  protected MenuItem closeMenuItem = new MenuItem();\r
-  protected Menu editMenu = new Menu();\r
-  protected Menu viewMenu = new Menu();\r
-  protected Menu colourMenu = new Menu();\r
-  protected Menu calculateMenu = new Menu();\r
-  protected MenuItem selectAllSequenceMenuItem = new MenuItem();\r
-  protected MenuItem deselectAllSequenceMenuItem = new MenuItem();\r
-  protected MenuItem invertSequenceMenuItem = new MenuItem();\r
-  protected MenuItem remove2LeftMenuItem = new MenuItem();\r
-  protected MenuItem remove2RightMenuItem = new MenuItem();\r
-  protected MenuItem removeGappedColumnMenuItem = new MenuItem();\r
-  protected MenuItem removeAllGapsMenuItem = new MenuItem();\r
-  protected CheckboxMenuItem viewBoxesMenuItem = new CheckboxMenuItem();\r
-  protected CheckboxMenuItem viewTextMenuItem = new CheckboxMenuItem();\r
-  protected MenuItem sortPairwiseMenuItem = new MenuItem();\r
-  protected MenuItem sortIDMenuItem = new MenuItem();\r
-  protected MenuItem sortGroupMenuItem = new MenuItem();\r
-  protected MenuItem removeRedundancyMenuItem = new MenuItem();\r
-  protected MenuItem pairwiseAlignmentMenuItem = new MenuItem();\r
-  protected MenuItem PCAMenuItem = new MenuItem();\r
-  protected MenuItem averageDistanceTreeMenuItem = new MenuItem();\r
-  protected MenuItem neighbourTreeMenuItem = new MenuItem();\r
-  BorderLayout borderLayout1 = new BorderLayout();\r
-  public Label statusBar = new Label();\r
-  protected Menu outputTextboxMenu = new Menu();\r
-  protected MenuItem clustalColour = new MenuItem();\r
-  protected MenuItem zappoColour = new MenuItem();\r
-  protected MenuItem taylorColour = new MenuItem();\r
-  protected MenuItem hydrophobicityColour = new MenuItem();\r
-  protected MenuItem helixColour = new MenuItem();\r
-  protected MenuItem strandColour = new MenuItem();\r
-  protected MenuItem turnColour = new MenuItem();\r
-  protected MenuItem buriedColour = new MenuItem();\r
-  protected MenuItem userDefinedColour = new MenuItem();\r
-  protected MenuItem PIDColour = new MenuItem();\r
-  protected MenuItem BLOSUM62Colour = new MenuItem();\r
-  MenuItem njTreeBlosumMenuItem = new MenuItem();\r
-  MenuItem avDistanceTreeBlosumMenuItem = new MenuItem();\r
-  protected CheckboxMenuItem annotationPanelMenuItem = new CheckboxMenuItem();\r
-  protected CheckboxMenuItem colourTextMenuItem = new CheckboxMenuItem();\r
-  MenuItem overviewMenuItem = new MenuItem();\r
-  protected MenuItem undoMenuItem = new MenuItem();\r
-  protected MenuItem redoMenuItem = new MenuItem();\r
-  protected CheckboxMenuItem conservationMenuItem = new CheckboxMenuItem();\r
-  MenuItem noColourmenuItem = new MenuItem();\r
-  protected CheckboxMenuItem wrapMenuItem = new CheckboxMenuItem();\r
-  protected CheckboxMenuItem renderGapsMenuItem = new CheckboxMenuItem();\r
-  MenuItem findMenuItem = new MenuItem();\r
-  Menu searchMenu = new Menu();\r
-  protected CheckboxMenuItem abovePIDThreshold = new CheckboxMenuItem();\r
-  protected MenuItem nucleotideColour = new MenuItem();\r
-  MenuItem deleteGroups = new MenuItem();\r
-  MenuItem delete = new MenuItem();\r
-  MenuItem copy = new MenuItem();\r
-  MenuItem cut = new MenuItem();\r
-  Menu Menu1 = new Menu();\r
-  MenuItem pasteNew = new MenuItem();\r
-  MenuItem pasteThis = new MenuItem();\r
-  protected CheckboxMenuItem applyToAllGroups = new CheckboxMenuItem();\r
-  protected MenuItem font = new MenuItem();\r
-  protected CheckboxMenuItem fullSeqId = new CheckboxMenuItem();\r
-  protected CheckboxMenuItem scaleAbove = new CheckboxMenuItem();\r
-  protected CheckboxMenuItem scaleLeft = new CheckboxMenuItem();\r
-  protected CheckboxMenuItem scaleRight = new CheckboxMenuItem();\r
-  MenuItem modifyPID = new MenuItem();\r
-  MenuItem modifyConservation = new MenuItem();\r
-  protected Menu sortByTreeMenu = new Menu();\r
-  Menu sort = new Menu();\r
-  Menu calculate = new Menu();\r
-  MenuItem inputText = new MenuItem();\r
-  Menu helpMenu = new Menu();\r
-  MenuItem documentation = new MenuItem();\r
-  MenuItem about = new MenuItem();\r
-  public GAlignFrame()\r
-  {\r
-    try\r
-    {\r
-      jbInit();\r
-      setMenuBar(alignFrameMenuBar);\r
-\r
-      MenuItem item;\r
-      // dynamically fill save as menu with available formats\r
-      for (int i = 0; i < jalview.io.FormatAdapter.formats.size(); i++) {\r
-        item = new MenuItem((String) jalview.io.FormatAdapter.formats.elementAt(i));\r
-        item.addActionListener(new java.awt.event.ActionListener()\r
-        {\r
-          public void actionPerformed(ActionEvent e)\r
-          {\r
-            saveAs_actionPerformed(e);\r
-          }\r
-        });\r
-\r
-        item = new MenuItem((String) jalview.io.FormatAdapter.formats.elementAt(i));\r
-        item.addActionListener(new java.awt.event.ActionListener()\r
-        {\r
-          public void actionPerformed(ActionEvent e)\r
-          {\r
-            outputText_actionPerformed(e);\r
-          }\r
-        });\r
-\r
-        outputTextboxMenu.add( item );\r
-      }\r
-\r
-    }\r
-    catch(Exception e)\r
-    {\r
-      e.printStackTrace();\r
-    }\r
-\r
-  }\r
-  private void jbInit() throws Exception\r
-  {\r
-    fileMenu.setLabel("File");\r
-    closeMenuItem.setLabel("Close");\r
-    closeMenuItem.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        closeMenuItem_actionPerformed(e);\r
-      }\r
-    });\r
-    editMenu.setLabel("Edit");\r
-    viewMenu.setLabel("View");\r
-    colourMenu.setLabel("Colour");\r
-    calculateMenu.setLabel("Calculate");\r
-    selectAllSequenceMenuItem.setLabel("Select all");\r
-    selectAllSequenceMenuItem.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        selectAllSequenceMenuItem_actionPerformed(e);\r
-      }\r
-    });\r
-    deselectAllSequenceMenuItem.setLabel("Deselect All");\r
-    deselectAllSequenceMenuItem.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        deselectAllSequenceMenuItem_actionPerformed(e);\r
-      }\r
-    });\r
-    invertSequenceMenuItem.setLabel("Invert Selection");\r
-    invertSequenceMenuItem.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        invertSequenceMenuItem_actionPerformed(e);\r
-      }\r
-    });\r
-    remove2LeftMenuItem.setLabel("Remove Left");\r
-    remove2LeftMenuItem.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        remove2LeftMenuItem_actionPerformed(e);\r
-      }\r
-    });\r
-    remove2RightMenuItem.setLabel("Remove Right");\r
-    remove2RightMenuItem.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        remove2RightMenuItem_actionPerformed(e);\r
-      }\r
-    });\r
-    removeGappedColumnMenuItem.setLabel("Remove Empty Columns");\r
-    removeGappedColumnMenuItem.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        removeGappedColumnMenuItem_actionPerformed(e);\r
-      }\r
-    });\r
-    removeAllGapsMenuItem.setLabel("Remove All Gaps");\r
-    removeAllGapsMenuItem.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        removeAllGapsMenuItem_actionPerformed(e);\r
-      }\r
-    });\r
-    viewBoxesMenuItem.setLabel("Boxes");\r
-    viewBoxesMenuItem.setState(true);\r
-    viewBoxesMenuItem.addItemListener(new java.awt.event.ItemListener()\r
-    {\r
-      public void itemStateChanged(ItemEvent e)\r
-      {\r
-        viewBoxesMenuItem_actionPerformed(null);\r
-      }\r
-    });\r
-    viewTextMenuItem.setLabel("Text");\r
-    viewTextMenuItem.setState(true);\r
-    viewTextMenuItem.addItemListener(new java.awt.event.ItemListener()\r
-    {\r
-      public void itemStateChanged(ItemEvent e)\r
-      {\r
-        viewTextMenuItem_actionPerformed(null);\r
-      }\r
-    });\r
-    sortPairwiseMenuItem.setLabel("by Pairwise Identity");\r
-    sortPairwiseMenuItem.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        sortPairwiseMenuItem_actionPerformed(e);\r
-      }\r
-    });\r
-    sortIDMenuItem.setLabel("by ID");\r
-    sortIDMenuItem.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        sortIDMenuItem_actionPerformed(e);\r
-      }\r
-    });\r
-    sortGroupMenuItem.setLabel("by Group");\r
-    sortGroupMenuItem.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        sortGroupMenuItem_actionPerformed(e);\r
-      }\r
-    });\r
-    removeRedundancyMenuItem.setLabel("Remove Redundancy...");\r
-    removeRedundancyMenuItem.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        removeRedundancyMenuItem_actionPerformed(e);\r
-      }\r
-    });\r
-    pairwiseAlignmentMenuItem.setLabel("Pairwise Alignments...");\r
-    pairwiseAlignmentMenuItem.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        pairwiseAlignmentMenuItem_actionPerformed(e);\r
-      }\r
-    });\r
-    PCAMenuItem.setLabel("Principal Component Analysis...");\r
-    PCAMenuItem.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        PCAMenuItem_actionPerformed(e);\r
-      }\r
-    });\r
-    averageDistanceTreeMenuItem.setLabel("Average Distance Using % Identity...");\r
-    averageDistanceTreeMenuItem.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        averageDistanceTreeMenuItem_actionPerformed(e);\r
-      }\r
-    });\r
-    neighbourTreeMenuItem.setLabel("Neighbour Joining Using % Identity...");\r
-    neighbourTreeMenuItem.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        neighbourTreeMenuItem_actionPerformed(e);\r
-      }\r
-    });\r
-    alignFrameMenuBar.setFont(new java.awt.Font("Verdana", 0, 11));\r
-    statusBar.setBackground(Color.white);\r
-    statusBar.setFont(new java.awt.Font("Verdana", 0, 11));\r
-    statusBar.setText("Status bar");\r
-    outputTextboxMenu.setLabel("Output to Textbox");\r
-    clustalColour.setLabel("Clustalx");\r
-\r
-    clustalColour.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        clustalColour_actionPerformed(e);\r
-      }\r
-    });\r
-    zappoColour.setLabel("Zappo");\r
-    zappoColour.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        zappoColour_actionPerformed(e);\r
-      }\r
-    });\r
-    taylorColour.setLabel("Taylor");\r
-    taylorColour.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        taylorColour_actionPerformed(e);\r
-      }\r
-    });\r
-    hydrophobicityColour.setLabel("Hydrophobicity");\r
-    hydrophobicityColour.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        hydrophobicityColour_actionPerformed(e);\r
-      }\r
-    });\r
-    helixColour.setLabel("Helix Propensity");\r
-    helixColour.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        helixColour_actionPerformed(e);\r
-      }\r
-    });\r
-    strandColour.setLabel("Strand Propensity");\r
-    strandColour.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        strandColour_actionPerformed(e);\r
-      }\r
-    });\r
-    turnColour.setLabel("Turn Propensity");\r
-    turnColour.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        turnColour_actionPerformed(e);\r
-      }\r
-    });\r
-    buriedColour.setLabel("Buried Index");\r
-    buriedColour.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        buriedColour_actionPerformed(e);\r
-      }\r
-    });\r
-    userDefinedColour.setLabel("User Defined...");\r
-    userDefinedColour.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        userDefinedColour_actionPerformed(e);\r
-      }\r
-    });\r
-    PIDColour.setLabel("Percentage Identity");\r
-    PIDColour.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        PIDColour_actionPerformed(e);\r
-      }\r
-    });\r
-    BLOSUM62Colour.setLabel("BLOSUM62 Score");\r
-    BLOSUM62Colour.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        BLOSUM62Colour_actionPerformed(e);\r
-      }\r
-    });\r
-    avDistanceTreeBlosumMenuItem.setLabel("Average Distance Using BLOSUM62...");\r
-    avDistanceTreeBlosumMenuItem.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        avTreeBlosumMenuItem_actionPerformed(e);\r
-      }\r
-    });\r
-    njTreeBlosumMenuItem.setLabel("Neighbour Joining Using BLOSUM62...");\r
-    njTreeBlosumMenuItem.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        njTreeBlosumMenuItem_actionPerformed(e);\r
-      }\r
-    });\r
-    annotationPanelMenuItem.setActionCommand("");\r
-    annotationPanelMenuItem.setState(true);\r
-    annotationPanelMenuItem.setLabel("Show Annotations");\r
-    annotationPanelMenuItem.addItemListener(new java.awt.event.ItemListener()\r
-    {\r
-      public void itemStateChanged(ItemEvent e)\r
-      {\r
-        annotationPanelMenuItem_actionPerformed(null);\r
-      }\r
-    });\r
-    colourTextMenuItem.setLabel("Colour Text");\r
-    colourTextMenuItem.addItemListener(new java.awt.event.ItemListener()\r
-    {\r
-      public void itemStateChanged(ItemEvent e)\r
-      {\r
-        colourTextMenuItem_actionPerformed(null);\r
-      }\r
-    });\r
-    overviewMenuItem.setLabel("Overview Window...");\r
-    overviewMenuItem.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        overviewMenuItem_actionPerformed(e);\r
-      }\r
-    });\r
-    undoMenuItem.setEnabled(false);\r
-    undoMenuItem.setLabel("Undo");\r
-    undoMenuItem.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        undoMenuItem_actionPerformed(e);\r
-      }\r
-    });\r
-    redoMenuItem.setEnabled(false);\r
-    redoMenuItem.setLabel("Redo");\r
-    redoMenuItem.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        redoMenuItem_actionPerformed(e);\r
-      }\r
-    });\r
-    conservationMenuItem.setLabel("by Conservation");\r
-    conservationMenuItem.addItemListener(new java.awt.event.ItemListener()\r
-    {\r
-      public void itemStateChanged(ItemEvent e)\r
-      {\r
-        conservationMenuItem_actionPerformed(null);\r
-      }\r
-    });\r
-    noColourmenuItem.setLabel("None");\r
-    noColourmenuItem.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        noColourmenuItem_actionPerformed(e);\r
-      }\r
-    });\r
-    wrapMenuItem.setLabel("Wrap");\r
-    wrapMenuItem.addItemListener(new java.awt.event.ItemListener()\r
-    {\r
-      public void itemStateChanged(ItemEvent e)\r
-      {\r
-        wrapMenuItem_actionPerformed(null);\r
-      }\r
-    });\r
-    renderGapsMenuItem.setLabel("Show Gaps");\r
-    renderGapsMenuItem.setState(true);\r
-    renderGapsMenuItem.addItemListener(new java.awt.event.ItemListener()\r
-    {\r
-\r
-      public void itemStateChanged(ItemEvent e)\r
-      {\r
-\r
-        renderGapsMenuItem_actionPerformed(null);\r
-      }\r
-    });\r
-    findMenuItem.setLabel("Find...");\r
-    findMenuItem.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        findMenuItem_actionPerformed(e);\r
-      }\r
-    });\r
-    searchMenu.setLabel("Search");\r
-\r
-    abovePIDThreshold.setLabel("Above Identity Threshold");\r
-    abovePIDThreshold.addItemListener(new java.awt.event.ItemListener()\r
-    {\r
-      public void itemStateChanged(ItemEvent e)\r
-      {\r
-        abovePIDThreshold_actionPerformed(null);\r
-      }\r
-    });\r
-    nucleotideColour.setLabel("Nucleotide");\r
-    nucleotideColour.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        nucleotideColour_actionPerformed(e);\r
-      }\r
-    });\r
-    deleteGroups.setLabel("Undefine Groups");\r
-    deleteGroups.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        deleteGroups_actionPerformed(e);\r
-      }\r
-    });\r
-    copy.setLabel("Copy");\r
-    copy.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        copy_actionPerformed(e);\r
-      }\r
-    });\r
-    cut.setLabel("Cut");\r
-    cut.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        cut_actionPerformed(e);\r
-      }\r
-    });\r
-    delete.setLabel("Delete");\r
-    delete.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        delete_actionPerformed(e);\r
-      }\r
-    });\r
-    Menu1.setLabel("Paste");\r
-    pasteNew.setLabel("To New Alignment");\r
-    pasteNew.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        pasteNew_actionPerformed(e);\r
-      }\r
-    });\r
-    pasteThis.setLabel("Add To This Alignment");\r
-    pasteThis.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        pasteThis_actionPerformed(e);\r
-      }\r
-    });\r
-    applyToAllGroups.setLabel("Apply Colour To All Groups");\r
-    applyToAllGroups.setState(true);\r
-    applyToAllGroups.addItemListener(new java.awt.event.ItemListener()\r
-   {\r
-     public void itemStateChanged(ItemEvent e)\r
-     {\r
-        applyToAllGroups_actionPerformed(null);\r
-      }\r
-    });\r
-    font.setLabel("Font...");\r
-    font.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        font_actionPerformed(e);\r
-      }\r
-    });\r
-    fullSeqId.setLabel("Show Full Sequence ID");\r
-    fullSeqId.setState(true);\r
-    fullSeqId.addItemListener(new java.awt.event.ItemListener()\r
-    {\r
-\r
-      public void itemStateChanged(ItemEvent e)\r
-      {\r
-        fullSeqId_actionPerformed(null);\r
-      }\r
-    });\r
-    scaleAbove.setLabel("Scale Above");\r
-    scaleAbove.setState(true);\r
-    scaleAbove.addItemListener(new java.awt.event.ItemListener()\r
-    {\r
-\r
-      public void itemStateChanged(ItemEvent e)\r
-      {\r
-\r
-        scaleAbove_actionPerformed(null);\r
-      }\r
-    });\r
-    scaleLeft.setEnabled(false);\r
-    scaleLeft.setState(true);\r
-    scaleLeft.setLabel("Scale Left");\r
-    scaleLeft.addItemListener(new java.awt.event.ItemListener()\r
-    {\r
-\r
-      public void itemStateChanged(ItemEvent e)\r
-      {\r
-\r
-        scaleLeft_actionPerformed(null);\r
-      }\r
-    });\r
-    scaleRight.setEnabled(false);\r
-    scaleRight.setState(true);\r
-    scaleRight.setLabel("Scale Right");\r
-    scaleRight.addItemListener(new java.awt.event.ItemListener()\r
-    {\r
-\r
-      public void itemStateChanged(ItemEvent e)\r
-      {\r
-\r
-        scaleRight_actionPerformed(null);\r
-      }\r
-    });\r
-    modifyPID.setLabel("Modify Identity Threshold...");\r
-    modifyPID.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        modifyPID_actionPerformed(e);\r
-      }\r
-    });\r
-    modifyConservation.setLabel("Modify Conservation Threshold...");\r
-    modifyConservation.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        modifyConservation_actionPerformed(e);\r
-      }\r
-    });\r
-    sortByTreeMenu.setLabel("By Tree Order");\r
-    sort.setLabel("Sort");\r
-    calculate.setLabel("Calculate Tree");\r
-    inputText.setLabel("Input from textbox");\r
-    inputText.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        inputText_actionPerformed(e);\r
-      }\r
-    });\r
-\r
-    helpMenu.setLabel("Help");\r
-    documentation.setLabel("Documentation");\r
-    documentation.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        documentation_actionPerformed(e);\r
-      }\r
-    });\r
-\r
-    about.setLabel("About...");\r
-    about.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        about_actionPerformed(e);\r
-      }\r
-    });\r
-\r
-    alignFrameMenuBar.add(fileMenu);\r
-    alignFrameMenuBar.add(editMenu);\r
-    alignFrameMenuBar.add(searchMenu);\r
-    alignFrameMenuBar.add(viewMenu);\r
-    alignFrameMenuBar.add(colourMenu);\r
-    alignFrameMenuBar.add(calculateMenu);\r
-    alignFrameMenuBar.add(helpMenu);\r
-    fileMenu.add(inputText);\r
-    fileMenu.add(outputTextboxMenu);\r
-    fileMenu.addSeparator();\r
-    fileMenu.add(closeMenuItem);\r
-    editMenu.add(undoMenuItem);\r
-    editMenu.add(redoMenuItem);\r
-    editMenu.add(cut);\r
-    editMenu.add(copy);\r
-    editMenu.add(Menu1);\r
-    editMenu.add(delete);\r
-    editMenu.addSeparator();\r
-    editMenu.add(selectAllSequenceMenuItem);\r
-    editMenu.add(deselectAllSequenceMenuItem);\r
-    editMenu.add(invertSequenceMenuItem);\r
-    editMenu.add(deleteGroups);\r
-    editMenu.addSeparator();\r
-    editMenu.add(remove2LeftMenuItem);\r
-    editMenu.add(remove2RightMenuItem);\r
-    editMenu.add(removeGappedColumnMenuItem);\r
-    editMenu.add(removeAllGapsMenuItem);\r
-    editMenu.add(removeRedundancyMenuItem);\r
-    searchMenu.add(findMenuItem);\r
-    viewMenu.add(font);\r
-    viewMenu.addSeparator();\r
-    viewMenu.add(wrapMenuItem);\r
-    viewMenu.add(scaleAbove);\r
-    viewMenu.add(scaleLeft);\r
-    viewMenu.add(scaleRight);\r
-    viewMenu.addSeparator();\r
-    viewMenu.add(fullSeqId);\r
-    viewMenu.add(viewBoxesMenuItem);\r
-    viewMenu.add(viewTextMenuItem);\r
-    viewMenu.add(colourTextMenuItem);\r
-    viewMenu.add(renderGapsMenuItem);\r
-    viewMenu.add(annotationPanelMenuItem);\r
-    viewMenu.addSeparator();\r
-    viewMenu.add(overviewMenuItem);\r
-    colourMenu.add(applyToAllGroups);\r
-    colourMenu.addSeparator();\r
-    colourMenu.add(noColourmenuItem);\r
-    colourMenu.add(clustalColour);\r
-    colourMenu.add(BLOSUM62Colour);\r
-    colourMenu.add(PIDColour);\r
-    colourMenu.add(zappoColour);\r
-    colourMenu.add(taylorColour);\r
-    colourMenu.add(hydrophobicityColour);\r
-    colourMenu.add(helixColour);\r
-    colourMenu.add(strandColour);\r
-    colourMenu.add(turnColour);\r
-    colourMenu.add(buriedColour);\r
-    colourMenu.add(nucleotideColour);\r
-    colourMenu.add(userDefinedColour);\r
-    colourMenu.addSeparator();\r
-    colourMenu.add(conservationMenuItem);\r
-    colourMenu.add(modifyConservation);\r
-    colourMenu.add(abovePIDThreshold);\r
-    colourMenu.add(modifyPID);\r
-    calculateMenu.add(sort);\r
-    calculateMenu.add(calculate);\r
-    calculateMenu.addSeparator();\r
-    calculateMenu.add(pairwiseAlignmentMenuItem);\r
-    calculateMenu.add(PCAMenuItem);\r
-    this.add(statusBar, BorderLayout.SOUTH);\r
-    Menu1.add(pasteNew);\r
-    Menu1.add(pasteThis);\r
-    sort.add(sortIDMenuItem);\r
-    sort.add(sortByTreeMenu);\r
-    sort.add(sortGroupMenuItem);\r
-    sort.add(sortPairwiseMenuItem);\r
-    calculate.add(averageDistanceTreeMenuItem);\r
-    calculate.add(neighbourTreeMenuItem);\r
-    calculate.add(avDistanceTreeBlosumMenuItem);\r
-    calculate.add(njTreeBlosumMenuItem);\r
-    helpMenu.add(documentation);\r
-    helpMenu.add(about);\r
-  }\r
-\r
-  protected void saveAs_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-  protected void outputText_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-  protected void htmlMenuItem_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-\r
-  protected void closeMenuItem_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-  protected void redoMenuItem_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-  protected void undoMenuItem_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-\r
-  protected void selectAllSequenceMenuItem_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-  protected void deselectAllSequenceMenuItem_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-  protected void invertSequenceMenuItem_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-  protected void remove2LeftMenuItem_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-  protected void remove2RightMenuItem_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-  protected void removeGappedColumnMenuItem_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-  protected void removeAllGapsMenuItem_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-\r
-  protected void wrapMenuItem_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-\r
-  protected void viewBoxesMenuItem_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-  protected void viewTextMenuItem_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-\r
-  protected void colourTextMenuItem_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-  protected void annotationPanelMenuItem_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-  protected void overviewMenuItem_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-  protected void sortPairwiseMenuItem_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-  protected void sortIDMenuItem_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-  protected void sortGroupMenuItem_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-\r
-  protected void removeRedundancyMenuItem_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-  protected void pairwiseAlignmentMenuItem_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-  protected void PCAMenuItem_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-  protected void averageDistanceTreeMenuItem_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-  protected void neighbourTreeMenuItem_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-\r
-  protected void njTreeBlosumMenuItem_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-  protected void avTreeBlosumMenuItem_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-\r
-\r
-  protected void clustalAlignMenuItem_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-\r
-\r
-\r
-  protected void clustalColour_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-  protected void zappoColour_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-  protected void taylorColour_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-\r
-  protected void hydrophobicityColour_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-  protected void helixColour_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-  protected void strandColour_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-  protected void turnColour_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-  protected void buriedColour_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
+import java.awt.event.*;\r
 \r
 \r
-  protected void userDefinedColour_actionPerformed(ActionEvent e)\r
-  {\r
+public class GAlignFrame extends Frame {\r
+    protected MenuBar alignFrameMenuBar = new MenuBar();\r
+    protected Menu fileMenu = new Menu();\r
+    protected MenuItem closeMenuItem = new MenuItem();\r
+    protected Menu editMenu = new Menu();\r
+    protected Menu viewMenu = new Menu();\r
+    protected Menu colourMenu = new Menu();\r
+    protected Menu calculateMenu = new Menu();\r
+    protected MenuItem selectAllSequenceMenuItem = new MenuItem();\r
+    protected MenuItem deselectAllSequenceMenuItem = new MenuItem();\r
+    protected MenuItem invertSequenceMenuItem = new MenuItem();\r
+    protected MenuItem remove2LeftMenuItem = new MenuItem();\r
+    protected MenuItem remove2RightMenuItem = new MenuItem();\r
+    protected MenuItem removeGappedColumnMenuItem = new MenuItem();\r
+    protected MenuItem removeAllGapsMenuItem = new MenuItem();\r
+    protected CheckboxMenuItem viewBoxesMenuItem = new CheckboxMenuItem();\r
+    protected CheckboxMenuItem viewTextMenuItem = new CheckboxMenuItem();\r
+    protected MenuItem sortPairwiseMenuItem = new MenuItem();\r
+    protected MenuItem sortIDMenuItem = new MenuItem();\r
+    protected MenuItem sortGroupMenuItem = new MenuItem();\r
+    protected MenuItem removeRedundancyMenuItem = new MenuItem();\r
+    protected MenuItem pairwiseAlignmentMenuItem = new MenuItem();\r
+    protected MenuItem PCAMenuItem = new MenuItem();\r
+    protected MenuItem averageDistanceTreeMenuItem = new MenuItem();\r
+    protected MenuItem neighbourTreeMenuItem = new MenuItem();\r
+    BorderLayout borderLayout1 = new BorderLayout();\r
+    public Label statusBar = new Label();\r
+    protected Menu outputTextboxMenu = new Menu();\r
+    protected MenuItem clustalColour = new MenuItem();\r
+    protected MenuItem zappoColour = new MenuItem();\r
+    protected MenuItem taylorColour = new MenuItem();\r
+    protected MenuItem hydrophobicityColour = new MenuItem();\r
+    protected MenuItem helixColour = new MenuItem();\r
+    protected MenuItem strandColour = new MenuItem();\r
+    protected MenuItem turnColour = new MenuItem();\r
+    protected MenuItem buriedColour = new MenuItem();\r
+    protected MenuItem userDefinedColour = new MenuItem();\r
+    protected MenuItem PIDColour = new MenuItem();\r
+    protected MenuItem BLOSUM62Colour = new MenuItem();\r
+    MenuItem njTreeBlosumMenuItem = new MenuItem();\r
+    MenuItem avDistanceTreeBlosumMenuItem = new MenuItem();\r
+    protected CheckboxMenuItem annotationPanelMenuItem = new CheckboxMenuItem();\r
+    protected CheckboxMenuItem colourTextMenuItem = new CheckboxMenuItem();\r
+    MenuItem overviewMenuItem = new MenuItem();\r
+    protected MenuItem undoMenuItem = new MenuItem();\r
+    protected MenuItem redoMenuItem = new MenuItem();\r
+    protected CheckboxMenuItem conservationMenuItem = new CheckboxMenuItem();\r
+    MenuItem noColourmenuItem = new MenuItem();\r
+    protected CheckboxMenuItem wrapMenuItem = new CheckboxMenuItem();\r
+    protected CheckboxMenuItem renderGapsMenuItem = new CheckboxMenuItem();\r
+    MenuItem findMenuItem = new MenuItem();\r
+    Menu searchMenu = new Menu();\r
+    protected CheckboxMenuItem abovePIDThreshold = new CheckboxMenuItem();\r
+    protected MenuItem nucleotideColour = new MenuItem();\r
+    MenuItem deleteGroups = new MenuItem();\r
+    MenuItem delete = new MenuItem();\r
+    MenuItem copy = new MenuItem();\r
+    MenuItem cut = new MenuItem();\r
+    Menu Menu1 = new Menu();\r
+    MenuItem pasteNew = new MenuItem();\r
+    MenuItem pasteThis = new MenuItem();\r
+    protected CheckboxMenuItem applyToAllGroups = new CheckboxMenuItem();\r
+    protected MenuItem font = new MenuItem();\r
+    protected CheckboxMenuItem fullSeqId = new CheckboxMenuItem();\r
+    protected CheckboxMenuItem scaleAbove = new CheckboxMenuItem();\r
+    protected CheckboxMenuItem scaleLeft = new CheckboxMenuItem();\r
+    protected CheckboxMenuItem scaleRight = new CheckboxMenuItem();\r
+    MenuItem modifyPID = new MenuItem();\r
+    MenuItem modifyConservation = new MenuItem();\r
+    protected Menu sortByTreeMenu = new Menu();\r
+    Menu sort = new Menu();\r
+    Menu calculate = new Menu();\r
+    MenuItem inputText = new MenuItem();\r
+    Menu helpMenu = new Menu();\r
+    MenuItem documentation = new MenuItem();\r
+    MenuItem about = new MenuItem();\r
+\r
+    public GAlignFrame() {\r
+        try {\r
+            jbInit();\r
+            setMenuBar(alignFrameMenuBar);\r
+\r
+            MenuItem item;\r
+\r
+            // dynamically fill save as menu with available formats\r
+            for (int i = 0; i < jalview.io.FormatAdapter.formats.size(); i++) {\r
+                item = new MenuItem((String) jalview.io.FormatAdapter.formats.elementAt(\r
+                            i));\r
+                item.addActionListener(new java.awt.event.ActionListener() {\r
+                        public void actionPerformed(ActionEvent e) {\r
+                            saveAs_actionPerformed(e);\r
+                        }\r
+                    });\r
+\r
+                item = new MenuItem((String) jalview.io.FormatAdapter.formats.elementAt(\r
+                            i));\r
+                item.addActionListener(new java.awt.event.ActionListener() {\r
+                        public void actionPerformed(ActionEvent e) {\r
+                            outputText_actionPerformed(e);\r
+                        }\r
+                    });\r
+\r
+                outputTextboxMenu.add(item);\r
+            }\r
+        } catch (Exception e) {\r
+            e.printStackTrace();\r
+        }\r
+    }\r
 \r
-  }\r
+    private void jbInit() throws Exception {\r
+        fileMenu.setLabel("File");\r
+        closeMenuItem.setLabel("Close");\r
+        closeMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    closeMenuItem_actionPerformed(e);\r
+                }\r
+            });\r
+        editMenu.setLabel("Edit");\r
+        viewMenu.setLabel("View");\r
+        colourMenu.setLabel("Colour");\r
+        calculateMenu.setLabel("Calculate");\r
+        selectAllSequenceMenuItem.setLabel("Select all");\r
+        selectAllSequenceMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    selectAllSequenceMenuItem_actionPerformed(e);\r
+                }\r
+            });\r
+        deselectAllSequenceMenuItem.setLabel("Deselect All");\r
+        deselectAllSequenceMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    deselectAllSequenceMenuItem_actionPerformed(e);\r
+                }\r
+            });\r
+        invertSequenceMenuItem.setLabel("Invert Selection");\r
+        invertSequenceMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    invertSequenceMenuItem_actionPerformed(e);\r
+                }\r
+            });\r
+        remove2LeftMenuItem.setLabel("Remove Left");\r
+        remove2LeftMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    remove2LeftMenuItem_actionPerformed(e);\r
+                }\r
+            });\r
+        remove2RightMenuItem.setLabel("Remove Right");\r
+        remove2RightMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    remove2RightMenuItem_actionPerformed(e);\r
+                }\r
+            });\r
+        removeGappedColumnMenuItem.setLabel("Remove Empty Columns");\r
+        removeGappedColumnMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    removeGappedColumnMenuItem_actionPerformed(e);\r
+                }\r
+            });\r
+        removeAllGapsMenuItem.setLabel("Remove All Gaps");\r
+        removeAllGapsMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    removeAllGapsMenuItem_actionPerformed(e);\r
+                }\r
+            });\r
+        viewBoxesMenuItem.setLabel("Boxes");\r
+        viewBoxesMenuItem.setState(true);\r
+        viewBoxesMenuItem.addItemListener(new java.awt.event.ItemListener() {\r
+                public void itemStateChanged(ItemEvent e) {\r
+                    viewBoxesMenuItem_actionPerformed(null);\r
+                }\r
+            });\r
+        viewTextMenuItem.setLabel("Text");\r
+        viewTextMenuItem.setState(true);\r
+        viewTextMenuItem.addItemListener(new java.awt.event.ItemListener() {\r
+                public void itemStateChanged(ItemEvent e) {\r
+                    viewTextMenuItem_actionPerformed(null);\r
+                }\r
+            });\r
+        sortPairwiseMenuItem.setLabel("by Pairwise Identity");\r
+        sortPairwiseMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    sortPairwiseMenuItem_actionPerformed(e);\r
+                }\r
+            });\r
+        sortIDMenuItem.setLabel("by ID");\r
+        sortIDMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    sortIDMenuItem_actionPerformed(e);\r
+                }\r
+            });\r
+        sortGroupMenuItem.setLabel("by Group");\r
+        sortGroupMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    sortGroupMenuItem_actionPerformed(e);\r
+                }\r
+            });\r
+        removeRedundancyMenuItem.setLabel("Remove Redundancy...");\r
+        removeRedundancyMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    removeRedundancyMenuItem_actionPerformed(e);\r
+                }\r
+            });\r
+        pairwiseAlignmentMenuItem.setLabel("Pairwise Alignments...");\r
+        pairwiseAlignmentMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    pairwiseAlignmentMenuItem_actionPerformed(e);\r
+                }\r
+            });\r
+        PCAMenuItem.setLabel("Principal Component Analysis...");\r
+        PCAMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    PCAMenuItem_actionPerformed(e);\r
+                }\r
+            });\r
+        averageDistanceTreeMenuItem.setLabel(\r
+            "Average Distance Using % Identity...");\r
+        averageDistanceTreeMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    averageDistanceTreeMenuItem_actionPerformed(e);\r
+                }\r
+            });\r
+        neighbourTreeMenuItem.setLabel("Neighbour Joining Using % Identity...");\r
+        neighbourTreeMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    neighbourTreeMenuItem_actionPerformed(e);\r
+                }\r
+            });\r
+        alignFrameMenuBar.setFont(new java.awt.Font("Verdana", 0, 11));\r
+        statusBar.setBackground(Color.white);\r
+        statusBar.setFont(new java.awt.Font("Verdana", 0, 11));\r
+        statusBar.setText("Status bar");\r
+        outputTextboxMenu.setLabel("Output to Textbox");\r
+        clustalColour.setLabel("Clustalx");\r
+\r
+        clustalColour.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    clustalColour_actionPerformed(e);\r
+                }\r
+            });\r
+        zappoColour.setLabel("Zappo");\r
+        zappoColour.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    zappoColour_actionPerformed(e);\r
+                }\r
+            });\r
+        taylorColour.setLabel("Taylor");\r
+        taylorColour.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    taylorColour_actionPerformed(e);\r
+                }\r
+            });\r
+        hydrophobicityColour.setLabel("Hydrophobicity");\r
+        hydrophobicityColour.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    hydrophobicityColour_actionPerformed(e);\r
+                }\r
+            });\r
+        helixColour.setLabel("Helix Propensity");\r
+        helixColour.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    helixColour_actionPerformed(e);\r
+                }\r
+            });\r
+        strandColour.setLabel("Strand Propensity");\r
+        strandColour.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    strandColour_actionPerformed(e);\r
+                }\r
+            });\r
+        turnColour.setLabel("Turn Propensity");\r
+        turnColour.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    turnColour_actionPerformed(e);\r
+                }\r
+            });\r
+        buriedColour.setLabel("Buried Index");\r
+        buriedColour.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    buriedColour_actionPerformed(e);\r
+                }\r
+            });\r
+        userDefinedColour.setLabel("User Defined...");\r
+        userDefinedColour.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    userDefinedColour_actionPerformed(e);\r
+                }\r
+            });\r
+        PIDColour.setLabel("Percentage Identity");\r
+        PIDColour.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    PIDColour_actionPerformed(e);\r
+                }\r
+            });\r
+        BLOSUM62Colour.setLabel("BLOSUM62 Score");\r
+        BLOSUM62Colour.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    BLOSUM62Colour_actionPerformed(e);\r
+                }\r
+            });\r
+        avDistanceTreeBlosumMenuItem.setLabel(\r
+            "Average Distance Using BLOSUM62...");\r
+        avDistanceTreeBlosumMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    avTreeBlosumMenuItem_actionPerformed(e);\r
+                }\r
+            });\r
+        njTreeBlosumMenuItem.setLabel("Neighbour Joining Using BLOSUM62...");\r
+        njTreeBlosumMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    njTreeBlosumMenuItem_actionPerformed(e);\r
+                }\r
+            });\r
+        annotationPanelMenuItem.setActionCommand("");\r
+        annotationPanelMenuItem.setState(true);\r
+        annotationPanelMenuItem.setLabel("Show Annotations");\r
+        annotationPanelMenuItem.addItemListener(new java.awt.event.ItemListener() {\r
+                public void itemStateChanged(ItemEvent e) {\r
+                    annotationPanelMenuItem_actionPerformed(null);\r
+                }\r
+            });\r
+        colourTextMenuItem.setLabel("Colour Text");\r
+        colourTextMenuItem.addItemListener(new java.awt.event.ItemListener() {\r
+                public void itemStateChanged(ItemEvent e) {\r
+                    colourTextMenuItem_actionPerformed(null);\r
+                }\r
+            });\r
+        overviewMenuItem.setLabel("Overview Window...");\r
+        overviewMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    overviewMenuItem_actionPerformed(e);\r
+                }\r
+            });\r
+        undoMenuItem.setEnabled(false);\r
+        undoMenuItem.setLabel("Undo");\r
+        undoMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    undoMenuItem_actionPerformed(e);\r
+                }\r
+            });\r
+        redoMenuItem.setEnabled(false);\r
+        redoMenuItem.setLabel("Redo");\r
+        redoMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    redoMenuItem_actionPerformed(e);\r
+                }\r
+            });\r
+        conservationMenuItem.setLabel("by Conservation");\r
+        conservationMenuItem.addItemListener(new java.awt.event.ItemListener() {\r
+                public void itemStateChanged(ItemEvent e) {\r
+                    conservationMenuItem_actionPerformed(null);\r
+                }\r
+            });\r
+        noColourmenuItem.setLabel("None");\r
+        noColourmenuItem.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    noColourmenuItem_actionPerformed(e);\r
+                }\r
+            });\r
+        wrapMenuItem.setLabel("Wrap");\r
+        wrapMenuItem.addItemListener(new java.awt.event.ItemListener() {\r
+                public void itemStateChanged(ItemEvent e) {\r
+                    wrapMenuItem_actionPerformed(null);\r
+                }\r
+            });\r
+        renderGapsMenuItem.setLabel("Show Gaps");\r
+        renderGapsMenuItem.setState(true);\r
+        renderGapsMenuItem.addItemListener(new java.awt.event.ItemListener() {\r
+                public void itemStateChanged(ItemEvent e) {\r
+                    renderGapsMenuItem_actionPerformed(null);\r
+                }\r
+            });\r
+        findMenuItem.setLabel("Find...");\r
+        findMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    findMenuItem_actionPerformed(e);\r
+                }\r
+            });\r
+        searchMenu.setLabel("Search");\r
+\r
+        abovePIDThreshold.setLabel("Above Identity Threshold");\r
+        abovePIDThreshold.addItemListener(new java.awt.event.ItemListener() {\r
+                public void itemStateChanged(ItemEvent e) {\r
+                    abovePIDThreshold_actionPerformed(null);\r
+                }\r
+            });\r
+        nucleotideColour.setLabel("Nucleotide");\r
+        nucleotideColour.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    nucleotideColour_actionPerformed(e);\r
+                }\r
+            });\r
+        deleteGroups.setLabel("Undefine Groups");\r
+        deleteGroups.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    deleteGroups_actionPerformed(e);\r
+                }\r
+            });\r
+        copy.setLabel("Copy");\r
+        copy.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    copy_actionPerformed(e);\r
+                }\r
+            });\r
+        cut.setLabel("Cut");\r
+        cut.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    cut_actionPerformed(e);\r
+                }\r
+            });\r
+        delete.setLabel("Delete");\r
+        delete.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    delete_actionPerformed(e);\r
+                }\r
+            });\r
+        Menu1.setLabel("Paste");\r
+        pasteNew.setLabel("To New Alignment");\r
+        pasteNew.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    pasteNew_actionPerformed(e);\r
+                }\r
+            });\r
+        pasteThis.setLabel("Add To This Alignment");\r
+        pasteThis.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    pasteThis_actionPerformed(e);\r
+                }\r
+            });\r
+        applyToAllGroups.setLabel("Apply Colour To All Groups");\r
+        applyToAllGroups.setState(true);\r
+        applyToAllGroups.addItemListener(new java.awt.event.ItemListener() {\r
+                public void itemStateChanged(ItemEvent e) {\r
+                    applyToAllGroups_actionPerformed(null);\r
+                }\r
+            });\r
+        font.setLabel("Font...");\r
+        font.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    font_actionPerformed(e);\r
+                }\r
+            });\r
+        fullSeqId.setLabel("Show Full Sequence ID");\r
+        fullSeqId.setState(true);\r
+        fullSeqId.addItemListener(new java.awt.event.ItemListener() {\r
+                public void itemStateChanged(ItemEvent e) {\r
+                    fullSeqId_actionPerformed(null);\r
+                }\r
+            });\r
+        scaleAbove.setLabel("Scale Above");\r
+        scaleAbove.setState(true);\r
+        scaleAbove.addItemListener(new java.awt.event.ItemListener() {\r
+                public void itemStateChanged(ItemEvent e) {\r
+                    scaleAbove_actionPerformed(null);\r
+                }\r
+            });\r
+        scaleLeft.setEnabled(false);\r
+        scaleLeft.setState(true);\r
+        scaleLeft.setLabel("Scale Left");\r
+        scaleLeft.addItemListener(new java.awt.event.ItemListener() {\r
+                public void itemStateChanged(ItemEvent e) {\r
+                    scaleLeft_actionPerformed(null);\r
+                }\r
+            });\r
+        scaleRight.setEnabled(false);\r
+        scaleRight.setState(true);\r
+        scaleRight.setLabel("Scale Right");\r
+        scaleRight.addItemListener(new java.awt.event.ItemListener() {\r
+                public void itemStateChanged(ItemEvent e) {\r
+                    scaleRight_actionPerformed(null);\r
+                }\r
+            });\r
+        modifyPID.setLabel("Modify Identity Threshold...");\r
+        modifyPID.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    modifyPID_actionPerformed(e);\r
+                }\r
+            });\r
+        modifyConservation.setLabel("Modify Conservation Threshold...");\r
+        modifyConservation.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    modifyConservation_actionPerformed(e);\r
+                }\r
+            });\r
+        sortByTreeMenu.setLabel("By Tree Order");\r
+        sort.setLabel("Sort");\r
+        calculate.setLabel("Calculate Tree");\r
+        inputText.setLabel("Input from textbox");\r
+        inputText.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    inputText_actionPerformed(e);\r
+                }\r
+            });\r
+\r
+        helpMenu.setLabel("Help");\r
+        documentation.setLabel("Documentation");\r
+        documentation.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    documentation_actionPerformed(e);\r
+                }\r
+            });\r
+\r
+        about.setLabel("About...");\r
+        about.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    about_actionPerformed(e);\r
+                }\r
+            });\r
+\r
+        alignFrameMenuBar.add(fileMenu);\r
+        alignFrameMenuBar.add(editMenu);\r
+        alignFrameMenuBar.add(searchMenu);\r
+        alignFrameMenuBar.add(viewMenu);\r
+        alignFrameMenuBar.add(colourMenu);\r
+        alignFrameMenuBar.add(calculateMenu);\r
+        alignFrameMenuBar.add(helpMenu);\r
+        fileMenu.add(inputText);\r
+        fileMenu.add(outputTextboxMenu);\r
+        fileMenu.addSeparator();\r
+        fileMenu.add(closeMenuItem);\r
+        editMenu.add(undoMenuItem);\r
+        editMenu.add(redoMenuItem);\r
+        editMenu.add(cut);\r
+        editMenu.add(copy);\r
+        editMenu.add(Menu1);\r
+        editMenu.add(delete);\r
+        editMenu.addSeparator();\r
+        editMenu.add(selectAllSequenceMenuItem);\r
+        editMenu.add(deselectAllSequenceMenuItem);\r
+        editMenu.add(invertSequenceMenuItem);\r
+        editMenu.add(deleteGroups);\r
+        editMenu.addSeparator();\r
+        editMenu.add(remove2LeftMenuItem);\r
+        editMenu.add(remove2RightMenuItem);\r
+        editMenu.add(removeGappedColumnMenuItem);\r
+        editMenu.add(removeAllGapsMenuItem);\r
+        editMenu.add(removeRedundancyMenuItem);\r
+        searchMenu.add(findMenuItem);\r
+        viewMenu.add(font);\r
+        viewMenu.addSeparator();\r
+        viewMenu.add(wrapMenuItem);\r
+        viewMenu.add(scaleAbove);\r
+        viewMenu.add(scaleLeft);\r
+        viewMenu.add(scaleRight);\r
+        viewMenu.addSeparator();\r
+        viewMenu.add(fullSeqId);\r
+        viewMenu.add(viewBoxesMenuItem);\r
+        viewMenu.add(viewTextMenuItem);\r
+        viewMenu.add(colourTextMenuItem);\r
+        viewMenu.add(renderGapsMenuItem);\r
+        viewMenu.add(annotationPanelMenuItem);\r
+        viewMenu.addSeparator();\r
+        viewMenu.add(overviewMenuItem);\r
+        colourMenu.add(applyToAllGroups);\r
+        colourMenu.addSeparator();\r
+        colourMenu.add(noColourmenuItem);\r
+        colourMenu.add(clustalColour);\r
+        colourMenu.add(BLOSUM62Colour);\r
+        colourMenu.add(PIDColour);\r
+        colourMenu.add(zappoColour);\r
+        colourMenu.add(taylorColour);\r
+        colourMenu.add(hydrophobicityColour);\r
+        colourMenu.add(helixColour);\r
+        colourMenu.add(strandColour);\r
+        colourMenu.add(turnColour);\r
+        colourMenu.add(buriedColour);\r
+        colourMenu.add(nucleotideColour);\r
+        colourMenu.add(userDefinedColour);\r
+        colourMenu.addSeparator();\r
+        colourMenu.add(conservationMenuItem);\r
+        colourMenu.add(modifyConservation);\r
+        colourMenu.add(abovePIDThreshold);\r
+        colourMenu.add(modifyPID);\r
+        calculateMenu.add(sort);\r
+        calculateMenu.add(calculate);\r
+        calculateMenu.addSeparator();\r
+        calculateMenu.add(pairwiseAlignmentMenuItem);\r
+        calculateMenu.add(PCAMenuItem);\r
+        this.add(statusBar, BorderLayout.SOUTH);\r
+        Menu1.add(pasteNew);\r
+        Menu1.add(pasteThis);\r
+        sort.add(sortIDMenuItem);\r
+        sort.add(sortByTreeMenu);\r
+        sort.add(sortGroupMenuItem);\r
+        sort.add(sortPairwiseMenuItem);\r
+        calculate.add(averageDistanceTreeMenuItem);\r
+        calculate.add(neighbourTreeMenuItem);\r
+        calculate.add(avDistanceTreeBlosumMenuItem);\r
+        calculate.add(njTreeBlosumMenuItem);\r
+        helpMenu.add(documentation);\r
+        helpMenu.add(about);\r
+    }\r
 \r
-  protected void PIDColour_actionPerformed(ActionEvent e)\r
-  {\r
+    protected void saveAs_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  }\r
+    protected void outputText_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  protected void BLOSUM62Colour_actionPerformed(ActionEvent e)\r
-  {\r
+    protected void htmlMenuItem_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  }\r
+    protected void closeMenuItem_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
+    protected void redoMenuItem_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  protected void noColourmenuItem_actionPerformed(ActionEvent e)\r
-  {\r
+    protected void undoMenuItem_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  }\r
+    protected void selectAllSequenceMenuItem_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  protected  void conservationMenuItem_actionPerformed(ActionEvent e)\r
-  {\r
+    protected void deselectAllSequenceMenuItem_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  }\r
+    protected void invertSequenceMenuItem_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
+    protected void remove2LeftMenuItem_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  protected void printMenuItem_actionPerformed(ActionEvent e)\r
-  {\r
+    protected void remove2RightMenuItem_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  }\r
+    protected void removeGappedColumnMenuItem_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  protected void renderGapsMenuItem_actionPerformed(ActionEvent e)\r
-  {\r
+    protected void removeAllGapsMenuItem_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  }\r
+    protected void wrapMenuItem_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  protected void findMenuItem_actionPerformed(ActionEvent e)\r
-  {\r
+    protected void viewBoxesMenuItem_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  }\r
+    protected void viewTextMenuItem_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
+    protected void colourTextMenuItem_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  protected void abovePIDThreshold_actionPerformed(ActionEvent e) {\r
+    protected void annotationPanelMenuItem_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  }\r
+    protected void overviewMenuItem_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  public void sequenceFeatures_actionPerformed(ActionEvent actionEvent)\r
-  {\r
+    protected void sortPairwiseMenuItem_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  }\r
+    protected void sortIDMenuItem_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  protected void nucleotideColour_actionPerformed(ActionEvent e)\r
-  {\r
+    protected void sortGroupMenuItem_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  }\r
+    protected void removeRedundancyMenuItem_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  protected void deleteGroups_actionPerformed(ActionEvent e)\r
-  {\r
+    protected void pairwiseAlignmentMenuItem_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  }\r
+    protected void PCAMenuItem_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
- protected void copy_actionPerformed(ActionEvent e)\r
-  {\r
+    protected void averageDistanceTreeMenuItem_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  }\r
+    protected void neighbourTreeMenuItem_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
+    protected void njTreeBlosumMenuItem_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  protected void cut_actionPerformed(ActionEvent e)\r
-  {\r
+    protected void avTreeBlosumMenuItem_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  }\r
+    protected void clustalAlignMenuItem_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  protected void delete_actionPerformed(ActionEvent e)\r
-  {\r
+    protected void clustalColour_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  }\r
+    protected void zappoColour_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  protected void pasteNew_actionPerformed(ActionEvent e)\r
-  {\r
+    protected void taylorColour_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  }\r
+    protected void hydrophobicityColour_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  protected void pasteThis_actionPerformed(ActionEvent e)\r
-  {\r
+    protected void helixColour_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  }\r
+    protected void strandColour_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  protected void applyToAllGroups_actionPerformed(ActionEvent e)\r
-  {\r
+    protected void turnColour_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  }\r
+    protected void buriedColour_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  protected void createPNG_actionPerformed(ActionEvent e)\r
-  {\r
+    protected void userDefinedColour_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  }\r
+    protected void PIDColour_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  protected void font_actionPerformed(ActionEvent e)\r
-  {\r
+    protected void BLOSUM62Colour_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  }\r
+    protected void noColourmenuItem_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  protected void fullSeqId_actionPerformed(ActionEvent e)\r
-  {\r
+    protected void conservationMenuItem_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  }\r
+    protected void printMenuItem_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  protected void epsFile_actionPerformed(ActionEvent e)\r
-  {\r
+    protected void renderGapsMenuItem_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  }\r
+    protected void findMenuItem_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  protected void LoadtreeMenuItem_actionPerformed(ActionEvent e) {\r
+    protected void abovePIDThreshold_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  }\r
+    public void sequenceFeatures_actionPerformed(ActionEvent actionEvent) {\r
+    }\r
 \r
-  protected void jpred_actionPerformed(ActionEvent e)\r
-  {\r
+    protected void nucleotideColour_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  }\r
+    protected void deleteGroups_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  protected void scaleAbove_actionPerformed(ActionEvent e)\r
-  {\r
+    protected void copy_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  }\r
+    protected void cut_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  protected void scaleLeft_actionPerformed(ActionEvent e)\r
-  {\r
+    protected void delete_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  }\r
+    protected void pasteNew_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  protected void scaleRight_actionPerformed(ActionEvent e)\r
-  {\r
+    protected void pasteThis_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  }\r
+    protected void applyToAllGroups_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  protected void modifyPID_actionPerformed(ActionEvent e)\r
-  {\r
+    protected void createPNG_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  }\r
+    protected void font_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  protected void modifyConservation_actionPerformed(ActionEvent e)\r
-  {\r
+    protected void fullSeqId_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  }\r
+    protected void epsFile_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  protected void preferences_actionPerformed(ActionEvent e)\r
-  {\r
+    protected void LoadtreeMenuItem_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  }\r
+    protected void jpred_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  protected void msaAlignMenuItem_actionPerformed(ActionEvent e) {\r
+    protected void scaleAbove_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  }\r
+    protected void scaleLeft_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  protected void inputText_actionPerformed(ActionEvent e) {\r
+    protected void scaleRight_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  }\r
+    protected void modifyPID_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  protected void documentation_actionPerformed(ActionEvent e) {\r
+    protected void modifyConservation_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  }\r
+    protected void preferences_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  protected void about_actionPerformed(ActionEvent e) {\r
+    protected void msaAlignMenuItem_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  }\r
+    protected void inputText_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
+    protected void documentation_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
+    protected void about_actionPerformed(ActionEvent e) {\r
+    }\r
 }\r
-\r
index 272e8df..683c9c1 100755 (executable)
 * 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.jbappletgui;\r
 \r
 import java.awt.*;\r
 \r
-public class GAlignmentPanel extends Panel\r
-{\r
-  protected Panel sequenceHolderPanel = new Panel();\r
-  protected Scrollbar vscroll = new Scrollbar();\r
-  protected  Scrollbar hscroll = new Scrollbar();\r
-  protected Panel seqPanelHolder = new Panel();\r
-  BorderLayout borderLayout1 = new BorderLayout();\r
-  BorderLayout borderLayout3 = new BorderLayout();\r
-  protected Panel scalePanelHolder = new Panel();\r
-  protected Panel idPanelHolder = new Panel();\r
-  BorderLayout borderLayout5 = new BorderLayout();\r
-  protected Panel idSpaceFillerPanel1 = new Panel();\r
-  public Panel annotationSpaceFillerHolder = new Panel();\r
-  BorderLayout borderLayout6 = new BorderLayout();\r
-  BorderLayout borderLayout7 = new BorderLayout();\r
-  Panel hscrollHolder = new Panel();\r
-  BorderLayout borderLayout10 = new BorderLayout();\r
-  protected Panel hscrollFillerPanel = new Panel();\r
-  BorderLayout borderLayout11 = new BorderLayout();\r
-  public Panel annotationScroller = new Panel();\r
-  BorderLayout borderLayout4 = new BorderLayout();\r
-  BorderLayout borderLayout2 = new BorderLayout();\r
 \r
-  public GAlignmentPanel()\r
-  {\r
-    try\r
-    {\r
-      jbInit();\r
-    }\r
-    catch(Exception e)\r
-    {\r
-      e.printStackTrace();\r
+public class GAlignmentPanel extends Panel {\r
+    protected Panel sequenceHolderPanel = new Panel();\r
+    protected Scrollbar vscroll = new Scrollbar();\r
+    protected Scrollbar hscroll = new Scrollbar();\r
+    protected Panel seqPanelHolder = new Panel();\r
+    BorderLayout borderLayout1 = new BorderLayout();\r
+    BorderLayout borderLayout3 = new BorderLayout();\r
+    protected Panel scalePanelHolder = new Panel();\r
+    protected Panel idPanelHolder = new Panel();\r
+    BorderLayout borderLayout5 = new BorderLayout();\r
+    protected Panel idSpaceFillerPanel1 = new Panel();\r
+    public Panel annotationSpaceFillerHolder = new Panel();\r
+    BorderLayout borderLayout6 = new BorderLayout();\r
+    BorderLayout borderLayout7 = new BorderLayout();\r
+    Panel hscrollHolder = new Panel();\r
+    BorderLayout borderLayout10 = new BorderLayout();\r
+    protected Panel hscrollFillerPanel = new Panel();\r
+    BorderLayout borderLayout11 = new BorderLayout();\r
+    public Panel annotationScroller = new Panel();\r
+    BorderLayout borderLayout4 = new BorderLayout();\r
+    BorderLayout borderLayout2 = new BorderLayout();\r
+\r
+    public GAlignmentPanel() {\r
+        try {\r
+            jbInit();\r
+        } catch (Exception e) {\r
+            e.printStackTrace();\r
+        }\r
     }\r
-  }\r
-  private void jbInit() throws Exception\r
-  {\r
-  //  idPanelHolder.setPreferredSize(new Dimension(70, 10));\r
-    this.setLayout(borderLayout7);\r
- //   sequenceHolderPanel.setPreferredSize(new Dimension(150, 150));\r
-    sequenceHolderPanel.setLayout(borderLayout3);\r
-    seqPanelHolder.setLayout(borderLayout1);\r
-    scalePanelHolder.setBackground(Color.white);\r
- // scalePanelHolder.setPreferredSize(new Dimension(10, 30));\r
-    scalePanelHolder.setLayout(borderLayout6);\r
-    idPanelHolder.setLayout(borderLayout5);\r
-    idSpaceFillerPanel1.setBackground(Color.white);\r
-  //  idSpaceFillerPanel1.setPreferredSize(new Dimension(10, 30));\r
-    idSpaceFillerPanel1.setLayout(borderLayout11);\r
-    annotationSpaceFillerHolder.setBackground(Color.white);\r
-  //  annotationSpaceFillerHolder.setPreferredSize(new Dimension(10, 80));\r
-    annotationSpaceFillerHolder.setLayout(borderLayout4);\r
-    hscroll.setOrientation(Scrollbar.HORIZONTAL);\r
-    hscrollHolder.setLayout(borderLayout10);\r
-    hscrollFillerPanel.setBackground(Color.white);\r
-  //  hscrollFillerPanel.setPreferredSize(new Dimension(70, 10));\r
-    hscrollHolder.setBackground(Color.white);\r
- //    annotationScroller.setPreferredSize(new Dimension(10, 80));\r
-  //  this.setPreferredSize(new Dimension(220, 166));\r
-    seqPanelHolder.setBackground(Color.white);\r
-    idPanelHolder.setBackground(Color.white);\r
-    annotationScroller.setLayout(borderLayout2);\r
-    sequenceHolderPanel.add(scalePanelHolder,  BorderLayout.NORTH);\r
-    sequenceHolderPanel.add(seqPanelHolder,  BorderLayout.CENTER);\r
-    seqPanelHolder.add(vscroll, BorderLayout.EAST);\r
-    sequenceHolderPanel.add(annotationScroller, BorderLayout.SOUTH);\r
-  //  Panel3.add(secondaryPanelHolder,  BorderLayout.SOUTH);\r
-    this.add(idPanelHolder, BorderLayout.WEST);\r
-    idPanelHolder.add(idSpaceFillerPanel1,  BorderLayout.NORTH);\r
-    idPanelHolder.add(annotationSpaceFillerHolder, BorderLayout.SOUTH);\r
-    this.add(hscrollHolder,  BorderLayout.SOUTH);\r
-    hscrollHolder.add(hscroll, BorderLayout.CENTER);\r
-    hscrollHolder.add(hscrollFillerPanel,  BorderLayout.WEST);\r
-    this.add(sequenceHolderPanel,  BorderLayout.CENTER);\r
-  }\r
 \r
+    private void jbInit() throws Exception {\r
+        //  idPanelHolder.setPreferredSize(new Dimension(70, 10));\r
+        this.setLayout(borderLayout7);\r
+\r
+        //   sequenceHolderPanel.setPreferredSize(new Dimension(150, 150));\r
+        sequenceHolderPanel.setLayout(borderLayout3);\r
+        seqPanelHolder.setLayout(borderLayout1);\r
+        scalePanelHolder.setBackground(Color.white);\r
+\r
+        // scalePanelHolder.setPreferredSize(new Dimension(10, 30));\r
+        scalePanelHolder.setLayout(borderLayout6);\r
+        idPanelHolder.setLayout(borderLayout5);\r
+        idSpaceFillerPanel1.setBackground(Color.white);\r
 \r
+        //  idSpaceFillerPanel1.setPreferredSize(new Dimension(10, 30));\r
+        idSpaceFillerPanel1.setLayout(borderLayout11);\r
+        annotationSpaceFillerHolder.setBackground(Color.white);\r
+\r
+        //  annotationSpaceFillerHolder.setPreferredSize(new Dimension(10, 80));\r
+        annotationSpaceFillerHolder.setLayout(borderLayout4);\r
+        hscroll.setOrientation(Scrollbar.HORIZONTAL);\r
+        hscrollHolder.setLayout(borderLayout10);\r
+        hscrollFillerPanel.setBackground(Color.white);\r
+\r
+        //  hscrollFillerPanel.setPreferredSize(new Dimension(70, 10));\r
+        hscrollHolder.setBackground(Color.white);\r
+\r
+        //    annotationScroller.setPreferredSize(new Dimension(10, 80));\r
+        //  this.setPreferredSize(new Dimension(220, 166));\r
+        seqPanelHolder.setBackground(Color.white);\r
+        idPanelHolder.setBackground(Color.white);\r
+        annotationScroller.setLayout(borderLayout2);\r
+        sequenceHolderPanel.add(scalePanelHolder, BorderLayout.NORTH);\r
+        sequenceHolderPanel.add(seqPanelHolder, BorderLayout.CENTER);\r
+        seqPanelHolder.add(vscroll, BorderLayout.EAST);\r
+        sequenceHolderPanel.add(annotationScroller, BorderLayout.SOUTH);\r
+\r
+        //  Panel3.add(secondaryPanelHolder,  BorderLayout.SOUTH);\r
+        this.add(idPanelHolder, BorderLayout.WEST);\r
+        idPanelHolder.add(idSpaceFillerPanel1, BorderLayout.NORTH);\r
+        idPanelHolder.add(annotationSpaceFillerHolder, BorderLayout.SOUTH);\r
+        this.add(hscrollHolder, BorderLayout.SOUTH);\r
+        hscrollHolder.add(hscroll, BorderLayout.CENTER);\r
+        hscrollHolder.add(hscrollFillerPanel, BorderLayout.WEST);\r
+        this.add(sequenceHolderPanel, BorderLayout.CENTER);\r
+    }\r
 }\r
index 33fe5a6..df702fd 100755 (executable)
 * 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.jbappletgui;\r
 \r
 import java.awt.*;\r
 import java.awt.event.*;\r
 \r
 \r
-public class GCutAndPasteTransfer extends Panel\r
-{\r
-  protected TextArea textarea = new TextArea();\r
-  Button ok = new Button();\r
-  Button cancel = new Button();\r
-  protected Panel buttonPanel = new Panel();\r
-  BorderLayout borderLayout1 = new BorderLayout();\r
-  public GCutAndPasteTransfer()\r
-  {\r
-    try\r
-    {\r
-      jbInit();\r
-    }\r
-    catch(Exception e)\r
-    {\r
-      e.printStackTrace();\r
-    }\r
-\r
-  }\r
-  private void jbInit() throws Exception\r
-  {\r
-    textarea.setFont(new java.awt.Font("Verdana", 0, 12));\r
-    textarea.setText("Paste your alignment file here");\r
-    textarea.addMouseListener(new java.awt.event.MouseAdapter()\r
-    {\r
-      public void mousePressed(MouseEvent e)\r
-      {\r
-        textarea_mousePressed(e);\r
-      }\r
-    });\r
-    this.setLayout(borderLayout1);\r
-    ok.setLabel("OK");\r
-    ok.addActionListener(new java.awt.event.ActionListener() {\r
-      public void actionPerformed(ActionEvent e) {\r
-        ok_actionPerformed(e);\r
-      }\r
-    });\r
-    cancel.setLabel("Cancel");\r
-    cancel.addActionListener(new java.awt.event.ActionListener() {\r
-      public void actionPerformed(ActionEvent e) {\r
-        cancel_actionPerformed(e);\r
-      }\r
-    });\r
-    this.add(buttonPanel, BorderLayout.SOUTH);\r
-    buttonPanel.add(ok, null);\r
-    buttonPanel.add(cancel, null);\r
-    this.add(textarea, java.awt.BorderLayout.CENTER);\r
-  }\r
-\r
-\r
-\r
+public class GCutAndPasteTransfer extends Panel {\r
+    protected TextArea textarea = new TextArea();\r
+    Button ok = new Button();\r
+    Button cancel = new Button();\r
+    protected Panel buttonPanel = new Panel();\r
+    BorderLayout borderLayout1 = new BorderLayout();\r
 \r
-  void textarea_mousePressed(MouseEvent e)\r
-  {\r
-    if(textarea.getText().equals("Paste your alignment file here"))\r
-      textarea.setText("");\r
-  }\r
-\r
-  protected void ok_actionPerformed(ActionEvent e) {\r
+    public GCutAndPasteTransfer() {\r
+        try {\r
+            jbInit();\r
+        } catch (Exception e) {\r
+            e.printStackTrace();\r
+        }\r
+    }\r
 \r
-  }\r
+    private void jbInit() throws Exception {\r
+        textarea.setFont(new java.awt.Font("Verdana", 0, 12));\r
+        textarea.setText("Paste your alignment file here");\r
+        textarea.addMouseListener(new java.awt.event.MouseAdapter() {\r
+                public void mousePressed(MouseEvent e) {\r
+                    textarea_mousePressed(e);\r
+                }\r
+            });\r
+        this.setLayout(borderLayout1);\r
+        ok.setLabel("OK");\r
+        ok.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    ok_actionPerformed(e);\r
+                }\r
+            });\r
+        cancel.setLabel("Cancel");\r
+        cancel.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    cancel_actionPerformed(e);\r
+                }\r
+            });\r
+        this.add(buttonPanel, BorderLayout.SOUTH);\r
+        buttonPanel.add(ok, null);\r
+        buttonPanel.add(cancel, null);\r
+        this.add(textarea, java.awt.BorderLayout.CENTER);\r
+    }\r
 \r
-  protected void cancel_actionPerformed(ActionEvent e) {\r
+    void textarea_mousePressed(MouseEvent e) {\r
+        if (textarea.getText().equals("Paste your alignment file here")) {\r
+            textarea.setText("");\r
+        }\r
+    }\r
 \r
-  }\r
+    protected void ok_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
+    protected void cancel_actionPerformed(ActionEvent e) {\r
+    }\r
 }\r
index 283b28d..434c8ea 100755 (executable)
 * 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.jbappletgui;\r
 \r
 import java.awt.*;\r
 import java.awt.event.*;\r
 \r
 \r
-public class GFinder extends Panel\r
-{\r
-  Label jLabel1 = new Label();\r
-  protected TextField textfield = new TextField();\r
-  protected Button findAll = new Button();\r
-  protected Button findNext = new Button();\r
-  Panel jPanel1 = new Panel();\r
-  GridLayout gridLayout1 = new GridLayout();\r
-  protected Button createNewGroup = new Button();\r
-\r
-  public GFinder()\r
-  {\r
-    try\r
-    {\r
-      jbInit();\r
+public class GFinder extends Panel {\r
+    Label jLabel1 = new Label();\r
+    protected TextField textfield = new TextField();\r
+    protected Button findAll = new Button();\r
+    protected Button findNext = new Button();\r
+    Panel jPanel1 = new Panel();\r
+    GridLayout gridLayout1 = new GridLayout();\r
+    protected Button createNewGroup = new Button();\r
+\r
+    public GFinder() {\r
+        try {\r
+            jbInit();\r
+        } catch (Exception e) {\r
+            e.printStackTrace();\r
+        }\r
     }\r
-    catch(Exception e)\r
-    {\r
-      e.printStackTrace();\r
-    }\r
-  }\r
-  private void jbInit() throws Exception\r
-  {\r
-    jLabel1.setFont(new java.awt.Font("Verdana", 0, 12));\r
-    jLabel1.setText("Find");\r
-    jLabel1.setBounds(new Rectangle(3, 30, 34, 15));\r
-    this.setLayout(null);\r
-    textfield.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));\r
-    textfield.setText("");\r
-    textfield.setBounds(new Rectangle(40, 27, 133, 21));\r
-    textfield.addKeyListener(new java.awt.event.KeyAdapter()\r
-    {\r
-      public void keyTyped(KeyEvent e)\r
-      {\r
-        textfield_keyTyped(e);\r
-      }\r
-    });\r
-    textfield.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        textfield_actionPerformed(e);\r
-      }\r
-    });\r
-    findAll.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));\r
-    findAll.setLabel("Find all");\r
-    findAll.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        findAll_actionPerformed(e);\r
-      }\r
-    });\r
-    findNext.setEnabled(false);\r
-    findNext.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));\r
-    findNext.setLabel("Find Next");\r
-    findNext.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        findNext_actionPerformed(e);\r
-      }\r
-    });\r
-    jPanel1.setBounds(new Rectangle(180, 5, 141, 64));\r
-    jPanel1.setLayout(gridLayout1);\r
-    gridLayout1.setHgap(0);\r
-    gridLayout1.setRows(3);\r
-    gridLayout1.setVgap(2);\r
-    createNewGroup.setEnabled(false);\r
-    createNewGroup.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));\r
-    createNewGroup.setLabel("Create new group");\r
-    createNewGroup.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        createNewGroup_actionPerformed(e);\r
-      }\r
-    });\r
-    jPanel1.add(findNext, null);\r
-    jPanel1.add(findAll, null);\r
-    jPanel1.add(createNewGroup, null);\r
-    this.add(textfield, null);\r
-    this.add(jLabel1, null);\r
-    this.add(jPanel1, null);\r
-  }\r
-\r
-  protected void findNext_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-  protected void findAll_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
 \r
+    private void jbInit() throws Exception {\r
+        jLabel1.setFont(new java.awt.Font("Verdana", 0, 12));\r
+        jLabel1.setText("Find");\r
+        jLabel1.setBounds(new Rectangle(3, 30, 34, 15));\r
+        this.setLayout(null);\r
+        textfield.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));\r
+        textfield.setText("");\r
+        textfield.setBounds(new Rectangle(40, 27, 133, 21));\r
+        textfield.addKeyListener(new java.awt.event.KeyAdapter() {\r
+                public void keyTyped(KeyEvent e) {\r
+                    textfield_keyTyped(e);\r
+                }\r
+            });\r
+        textfield.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    textfield_actionPerformed(e);\r
+                }\r
+            });\r
+        findAll.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));\r
+        findAll.setLabel("Find all");\r
+        findAll.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    findAll_actionPerformed(e);\r
+                }\r
+            });\r
+        findNext.setEnabled(false);\r
+        findNext.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));\r
+        findNext.setLabel("Find Next");\r
+        findNext.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    findNext_actionPerformed(e);\r
+                }\r
+            });\r
+        jPanel1.setBounds(new Rectangle(180, 5, 141, 64));\r
+        jPanel1.setLayout(gridLayout1);\r
+        gridLayout1.setHgap(0);\r
+        gridLayout1.setRows(3);\r
+        gridLayout1.setVgap(2);\r
+        createNewGroup.setEnabled(false);\r
+        createNewGroup.setFont(new java.awt.Font("Verdana", Font.PLAIN, 10));\r
+        createNewGroup.setLabel("Create new group");\r
+        createNewGroup.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    createNewGroup_actionPerformed(e);\r
+                }\r
+            });\r
+        jPanel1.add(findNext, null);\r
+        jPanel1.add(findAll, null);\r
+        jPanel1.add(createNewGroup, null);\r
+        this.add(textfield, null);\r
+        this.add(jLabel1, null);\r
+        this.add(jPanel1, null);\r
+    }\r
 \r
-  protected void textfield_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
+    protected void findNext_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  void textfield_keyTyped(KeyEvent e)\r
-  {\r
-    findNext.setEnabled(true);\r
-  }\r
+    protected void findAll_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  public void createNewGroup_actionPerformed(ActionEvent e)\r
-  {\r
+    protected void textfield_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  }\r
+    void textfield_keyTyped(KeyEvent e) {\r
+        findNext.setEnabled(true);\r
+    }\r
 \r
+    public void createNewGroup_actionPerformed(ActionEvent e) {\r
+    }\r
 }\r
index 1c087c5..794dbbb 100755 (executable)
 * 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.jbappletgui;\r
 \r
 import java.awt.*;\r
 import java.awt.event.*;\r
 \r
 \r
-public class GFontChooser extends Panel\r
-{\r
-  Label label1 = new Label();\r
-  protected Choice fontSize = new Choice();\r
-  protected Choice fontStyle = new Choice();\r
-  Label label2 = new Label();\r
-  Label label3 = new Label();\r
-  protected Choice fontName = new Choice();\r
-  Button ok = new Button();\r
-  Button cancel = new Button();\r
-  Panel panel1 = new Panel();\r
-  Panel panel2 = new Panel();\r
-  Panel panel3 = new Panel();\r
-  BorderLayout borderLayout1 = new BorderLayout();\r
-  BorderLayout borderLayout2 = new BorderLayout();\r
-  BorderLayout borderLayout3 = new BorderLayout();\r
-  Panel panel4 = new Panel();\r
-  Panel panel5 = new Panel();\r
-  BorderLayout borderLayout4 = new BorderLayout();\r
-\r
-  public GFontChooser()\r
-  {\r
-    try\r
-    {\r
-      jbInit();\r
+public class GFontChooser extends Panel {\r
+    Label label1 = new Label();\r
+    protected Choice fontSize = new Choice();\r
+    protected Choice fontStyle = new Choice();\r
+    Label label2 = new Label();\r
+    Label label3 = new Label();\r
+    protected Choice fontName = new Choice();\r
+    Button ok = new Button();\r
+    Button cancel = new Button();\r
+    Panel panel1 = new Panel();\r
+    Panel panel2 = new Panel();\r
+    Panel panel3 = new Panel();\r
+    BorderLayout borderLayout1 = new BorderLayout();\r
+    BorderLayout borderLayout2 = new BorderLayout();\r
+    BorderLayout borderLayout3 = new BorderLayout();\r
+    Panel panel4 = new Panel();\r
+    Panel panel5 = new Panel();\r
+    BorderLayout borderLayout4 = new BorderLayout();\r
+\r
+    public GFontChooser() {\r
+        try {\r
+            jbInit();\r
+        } catch (Exception e) {\r
+            e.printStackTrace();\r
+        }\r
     }\r
-    catch(Exception e)\r
-    {\r
-      e.printStackTrace();\r
-    }\r
-  }\r
-  private void jbInit() throws Exception\r
-  {\r
-    label1.setFont(new java.awt.Font("Verdana", 0, 11));\r
-    label1.setAlignment(Label.RIGHT);\r
-    label1.setText("Font: ");\r
-    this.setLayout(borderLayout4);\r
-    fontSize.setFont(new java.awt.Font("Verdana", 0, 11));\r
-    fontSize.addItemListener(new java.awt.event.ItemListener()\r
-    {\r
-      public void itemStateChanged(ItemEvent e)\r
-      {\r
-        fontSize_actionPerformed();\r
-      }\r
-    });\r
-    fontStyle.setFont(new java.awt.Font("Verdana", 0, 11));\r
-    fontStyle.addItemListener(new java.awt.event.ItemListener()\r
-    {\r
-      public void itemStateChanged(ItemEvent e)\r
-      {\r
-        fontStyle_actionPerformed();\r
-      }\r
-    });\r
-    label2.setAlignment(Label.RIGHT);\r
-    label2.setFont(new java.awt.Font("Verdana", 0, 11));\r
-     label2.setText("Size: ");\r
-      label3.setAlignment(Label.RIGHT);\r
-    label3.setFont(new java.awt.Font("Verdana", 0, 11));\r
-      label3.setText("Style: ");\r
-    fontName.setFont(new java.awt.Font("Verdana", 0, 11));\r
-     fontName.addItemListener(new java.awt.event.ItemListener()\r
-    {\r
-      public void itemStateChanged(ItemEvent e)\r
-      {\r
-        fontName_actionPerformed();\r
-      }\r
-    });\r
-    ok.setFont(new java.awt.Font("Verdana", 0, 11));\r
-    ok.setLabel("OK");\r
-    ok.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        ok_actionPerformed();\r
-      }\r
-    });\r
-    cancel.setFont(new java.awt.Font("Verdana", 0, 11));\r
-    cancel.setLabel("Cancel");\r
-    cancel.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        cancel_actionPerformed();\r
-      }\r
-    });\r
-    this.setBackground(Color.white);\r
-    panel1.setLayout(borderLayout1);\r
-    panel2.setLayout(borderLayout3);\r
-     panel3.setLayout(borderLayout2);\r
-    panel5.setBackground(Color.white);\r
-    panel4.setBackground(Color.white);\r
-    panel1.setBackground(Color.white);\r
-    panel2.setBackground(Color.white);\r
-    panel3.setBackground(Color.white);\r
-    panel1.add(label1, BorderLayout.WEST);\r
-    panel1.add(fontName, BorderLayout.CENTER);\r
-    panel5.add(panel1, null);\r
-    panel5.add(panel3, null);\r
-    panel5.add(panel2, null);\r
-    panel2.add(label3,  BorderLayout.WEST);\r
-    panel2.add(fontStyle,  BorderLayout.CENTER);\r
-    panel3.add(label2, BorderLayout.WEST);\r
-    panel3.add(fontSize, BorderLayout.CENTER);\r
-    this.add(panel4,  BorderLayout.SOUTH);\r
-    panel4.add(ok, null);\r
-    panel4.add(cancel, null);\r
-    this.add(panel5, BorderLayout.CENTER);\r
-\r
-   }\r
-\r
-  protected void ok_actionPerformed()\r
-  {\r
-\r
-  }\r
-\r
-  protected void cancel_actionPerformed()\r
-  {\r
-\r
-  }\r
 \r
-  protected void fontName_actionPerformed()\r
-  {\r
-\r
-  }\r
+    private void jbInit() throws Exception {\r
+        label1.setFont(new java.awt.Font("Verdana", 0, 11));\r
+        label1.setAlignment(Label.RIGHT);\r
+        label1.setText("Font: ");\r
+        this.setLayout(borderLayout4);\r
+        fontSize.setFont(new java.awt.Font("Verdana", 0, 11));\r
+        fontSize.addItemListener(new java.awt.event.ItemListener() {\r
+                public void itemStateChanged(ItemEvent e) {\r
+                    fontSize_actionPerformed();\r
+                }\r
+            });\r
+        fontStyle.setFont(new java.awt.Font("Verdana", 0, 11));\r
+        fontStyle.addItemListener(new java.awt.event.ItemListener() {\r
+                public void itemStateChanged(ItemEvent e) {\r
+                    fontStyle_actionPerformed();\r
+                }\r
+            });\r
+        label2.setAlignment(Label.RIGHT);\r
+        label2.setFont(new java.awt.Font("Verdana", 0, 11));\r
+        label2.setText("Size: ");\r
+        label3.setAlignment(Label.RIGHT);\r
+        label3.setFont(new java.awt.Font("Verdana", 0, 11));\r
+        label3.setText("Style: ");\r
+        fontName.setFont(new java.awt.Font("Verdana", 0, 11));\r
+        fontName.addItemListener(new java.awt.event.ItemListener() {\r
+                public void itemStateChanged(ItemEvent e) {\r
+                    fontName_actionPerformed();\r
+                }\r
+            });\r
+        ok.setFont(new java.awt.Font("Verdana", 0, 11));\r
+        ok.setLabel("OK");\r
+        ok.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    ok_actionPerformed();\r
+                }\r
+            });\r
+        cancel.setFont(new java.awt.Font("Verdana", 0, 11));\r
+        cancel.setLabel("Cancel");\r
+        cancel.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    cancel_actionPerformed();\r
+                }\r
+            });\r
+        this.setBackground(Color.white);\r
+        panel1.setLayout(borderLayout1);\r
+        panel2.setLayout(borderLayout3);\r
+        panel3.setLayout(borderLayout2);\r
+        panel5.setBackground(Color.white);\r
+        panel4.setBackground(Color.white);\r
+        panel1.setBackground(Color.white);\r
+        panel2.setBackground(Color.white);\r
+        panel3.setBackground(Color.white);\r
+        panel1.add(label1, BorderLayout.WEST);\r
+        panel1.add(fontName, BorderLayout.CENTER);\r
+        panel5.add(panel1, null);\r
+        panel5.add(panel3, null);\r
+        panel5.add(panel2, null);\r
+        panel2.add(label3, BorderLayout.WEST);\r
+        panel2.add(fontStyle, BorderLayout.CENTER);\r
+        panel3.add(label2, BorderLayout.WEST);\r
+        panel3.add(fontSize, BorderLayout.CENTER);\r
+        this.add(panel4, BorderLayout.SOUTH);\r
+        panel4.add(ok, null);\r
+        panel4.add(cancel, null);\r
+        this.add(panel5, BorderLayout.CENTER);\r
+    }\r
 \r
-  protected void fontSize_actionPerformed()\r
-  {\r
+    protected void ok_actionPerformed() {\r
+    }\r
 \r
-  }\r
+    protected void cancel_actionPerformed() {\r
+    }\r
 \r
-  protected void fontStyle_actionPerformed()\r
-  {\r
+    protected void fontName_actionPerformed() {\r
+    }\r
 \r
-  }\r
+    protected void fontSize_actionPerformed() {\r
+    }\r
 \r
+    protected void fontStyle_actionPerformed() {\r
+    }\r
 }\r
index b13b563..f33521c 100755 (executable)
 * 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.jbappletgui;\r
 \r
 import java.awt.*;\r
 import java.awt.event.*;\r
 \r
-public class GPCAPanel extends Panel\r
-{\r
-  Panel jPanel2 = new Panel();\r
-  Label jLabel1 = new Label();\r
-  Label jLabel2 = new Label();\r
-  Label jLabel3 = new Label();\r
-  protected Choice xCombobox = new Choice();\r
-  protected Choice yCombobox = new Choice();\r
-  protected Choice zCombobox = new Choice();\r
-  FlowLayout flowLayout1 = new FlowLayout();\r
-  BorderLayout borderLayout1 = new BorderLayout();\r
-\r
-  public GPCAPanel()\r
-  {\r
-    try\r
-    {\r
-      jbInit();\r
-    }\r
-    catch(Exception e)\r
-    {\r
-      e.printStackTrace();\r
-    }\r
-\r
-    for(int i=1; i<8; i++)\r
-    {\r
-      xCombobox.addItem("dim "+i);\r
-      yCombobox.addItem("dim "+i);\r
-      zCombobox.addItem("dim "+i);\r
-    }\r
-  }\r
-  private void jbInit() throws Exception\r
-  {\r
-    this.setLayout(borderLayout1);\r
-    jPanel2.setLayout(flowLayout1);\r
-    jLabel1.setFont(new java.awt.Font("Verdana", 0, 12));\r
-    jLabel1.setText("x=");\r
-    jLabel2.setFont(new java.awt.Font("Verdana", 0, 12));\r
-    jLabel2.setText("y=");\r
-    jLabel3.setFont(new java.awt.Font("Verdana", 0, 12));\r
-    jLabel3.setText("z=");\r
-    jPanel2.setBackground(Color.white);\r
-    zCombobox.setFont(new java.awt.Font("Verdana", 0, 12));\r
-    zCombobox.addItemListener(new java.awt.event.ItemListener()\r
-    {\r
-      public void itemStateChanged(ItemEvent e)\r
-      {\r
-        zCombobox_actionPerformed(null);\r
-      }\r
-    });\r
-    yCombobox.setFont(new java.awt.Font("Verdana", 0, 12));\r
-    yCombobox.addItemListener(new java.awt.event.ItemListener()\r
-    {\r
-      public void itemStateChanged(ItemEvent e)\r
-      {\r
-        yCombobox_actionPerformed(null);\r
-      }\r
-    });\r
-    xCombobox.setFont(new java.awt.Font("Verdana", 0, 12));\r
-    xCombobox.addItemListener(new java.awt.event.ItemListener()\r
-    {\r
-      public void itemStateChanged(ItemEvent e)\r
-      {\r
-        xCombobox_actionPerformed(null);\r
-      }\r
-    });\r
-    this.add(jPanel2,  BorderLayout.SOUTH);\r
-    jPanel2.add(jLabel1, null);\r
-    jPanel2.add(xCombobox, null);\r
-    jPanel2.add(jLabel2, null);\r
-    jPanel2.add(yCombobox, null);\r
-    jPanel2.add(jLabel3, null);\r
-    jPanel2.add(zCombobox, null);\r
-  }\r
 \r
-  protected void xCombobox_actionPerformed(ActionEvent e)\r
-  {\r
+public class GPCAPanel extends Panel {\r
+    Panel jPanel2 = new Panel();\r
+    Label jLabel1 = new Label();\r
+    Label jLabel2 = new Label();\r
+    Label jLabel3 = new Label();\r
+    protected Choice xCombobox = new Choice();\r
+    protected Choice yCombobox = new Choice();\r
+    protected Choice zCombobox = new Choice();\r
+    FlowLayout flowLayout1 = new FlowLayout();\r
+    BorderLayout borderLayout1 = new BorderLayout();\r
 \r
-  }\r
+    public GPCAPanel() {\r
+        try {\r
+            jbInit();\r
+        } catch (Exception e) {\r
+            e.printStackTrace();\r
+        }\r
 \r
-  protected void yCombobox_actionPerformed(ActionEvent e)\r
-  {\r
+        for (int i = 1; i < 8; i++) {\r
+            xCombobox.addItem("dim " + i);\r
+            yCombobox.addItem("dim " + i);\r
+            zCombobox.addItem("dim " + i);\r
+        }\r
+    }\r
 \r
-  }\r
+    private void jbInit() throws Exception {\r
+        this.setLayout(borderLayout1);\r
+        jPanel2.setLayout(flowLayout1);\r
+        jLabel1.setFont(new java.awt.Font("Verdana", 0, 12));\r
+        jLabel1.setText("x=");\r
+        jLabel2.setFont(new java.awt.Font("Verdana", 0, 12));\r
+        jLabel2.setText("y=");\r
+        jLabel3.setFont(new java.awt.Font("Verdana", 0, 12));\r
+        jLabel3.setText("z=");\r
+        jPanel2.setBackground(Color.white);\r
+        zCombobox.setFont(new java.awt.Font("Verdana", 0, 12));\r
+        zCombobox.addItemListener(new java.awt.event.ItemListener() {\r
+                public void itemStateChanged(ItemEvent e) {\r
+                    zCombobox_actionPerformed(null);\r
+                }\r
+            });\r
+        yCombobox.setFont(new java.awt.Font("Verdana", 0, 12));\r
+        yCombobox.addItemListener(new java.awt.event.ItemListener() {\r
+                public void itemStateChanged(ItemEvent e) {\r
+                    yCombobox_actionPerformed(null);\r
+                }\r
+            });\r
+        xCombobox.setFont(new java.awt.Font("Verdana", 0, 12));\r
+        xCombobox.addItemListener(new java.awt.event.ItemListener() {\r
+                public void itemStateChanged(ItemEvent e) {\r
+                    xCombobox_actionPerformed(null);\r
+                }\r
+            });\r
+        this.add(jPanel2, BorderLayout.SOUTH);\r
+        jPanel2.add(jLabel1, null);\r
+        jPanel2.add(xCombobox, null);\r
+        jPanel2.add(jLabel2, null);\r
+        jPanel2.add(yCombobox, null);\r
+        jPanel2.add(jLabel3, null);\r
+        jPanel2.add(zCombobox, null);\r
+    }\r
 \r
-  protected void zCombobox_actionPerformed(ActionEvent e)\r
-  {\r
+    protected void xCombobox_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  }\r
+    protected void yCombobox_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
+    protected void zCombobox_actionPerformed(ActionEvent e) {\r
+    }\r
 }\r
index 54bb555..10bd01e 100755 (executable)
 * 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.jbappletgui;\r
 \r
 import java.awt.*;\r
 import java.awt.event.*;\r
 \r
 \r
-public class GPairwiseAlignPanel extends Panel\r
-{\r
-  protected ScrollPane scrollPane = new ScrollPane();\r
-  protected TextArea textarea = new TextArea();\r
-  protected Button viewInEditorButton = new Button();\r
-  Panel jPanel1 = new Panel();\r
-  BorderLayout borderLayout1 = new BorderLayout();\r
+public class GPairwiseAlignPanel extends Panel {\r
+    protected ScrollPane scrollPane = new ScrollPane();\r
+    protected TextArea textarea = new TextArea();\r
+    protected Button viewInEditorButton = new Button();\r
+    Panel jPanel1 = new Panel();\r
+    BorderLayout borderLayout1 = new BorderLayout();\r
 \r
-  public GPairwiseAlignPanel()\r
-  {\r
-    try\r
-    {\r
-      jbInit();\r
-    }\r
-    catch(Exception e)\r
-    {\r
-      e.printStackTrace();\r
+    public GPairwiseAlignPanel() {\r
+        try {\r
+            jbInit();\r
+        } catch (Exception e) {\r
+            e.printStackTrace();\r
+        }\r
     }\r
-  }\r
-  private void jbInit() throws Exception\r
-  {\r
-    this.setLayout(borderLayout1);\r
-    textarea.setFont(new java.awt.Font("Monospaced", 0, 12));\r
-    textarea.setText("");\r
-    viewInEditorButton.setFont(new java.awt.Font("Verdana", 0, 12));\r
-    viewInEditorButton.setLabel("View in alignment editor");\r
-    viewInEditorButton.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        viewInEditorButton_actionPerformed(e);\r
-      }\r
-    });\r
-    this.add(scrollPane, BorderLayout.CENTER);\r
-    scrollPane.add(textarea);\r
-    this.add(jPanel1, BorderLayout.SOUTH);\r
-    jPanel1.add(viewInEditorButton, null);\r
-  }\r
-\r
-  protected void viewInEditorButton_actionPerformed(ActionEvent e)\r
-  {\r
 \r
-  }\r
+    private void jbInit() throws Exception {\r
+        this.setLayout(borderLayout1);\r
+        textarea.setFont(new java.awt.Font("Monospaced", 0, 12));\r
+        textarea.setText("");\r
+        viewInEditorButton.setFont(new java.awt.Font("Verdana", 0, 12));\r
+        viewInEditorButton.setLabel("View in alignment editor");\r
+        viewInEditorButton.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    viewInEditorButton_actionPerformed(e);\r
+                }\r
+            });\r
+        this.add(scrollPane, BorderLayout.CENTER);\r
+        scrollPane.add(textarea);\r
+        this.add(jPanel1, BorderLayout.SOUTH);\r
+        jPanel1.add(viewInEditorButton, null);\r
+    }\r
 \r
+    protected void viewInEditorButton_actionPerformed(ActionEvent e) {\r
+    }\r
 }\r
index d8120b4..5e33300 100755 (executable)
 * 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.jbappletgui;\r
 \r
 import java.awt.*;\r
 import java.awt.event.*;\r
 \r
-public class GSliderPanel extends Panel\r
-{\r
-  // this is used for conservation colours, PID colours and redundancy threshold\r
-  protected Scrollbar slider = new Scrollbar();\r
-  protected TextField valueField = new TextField();\r
-  protected Label label = new Label();\r
-  Panel jPanel1 = new Panel();\r
-  Panel jPanel2 = new Panel();\r
-  protected Button applyButton = new Button();\r
-  protected Button undoButton = new Button();\r
-  FlowLayout flowLayout1 = new FlowLayout();\r
-  protected Checkbox allGroupsCheck = new Checkbox();\r
-  BorderLayout borderLayout1 = new BorderLayout();\r
-  BorderLayout borderLayout2 = new BorderLayout();\r
-  FlowLayout flowLayout2 = new FlowLayout();\r
-\r
-  public GSliderPanel()\r
-  {\r
-    try\r
-    {\r
-      jbInit();\r
-    }\r
-    catch(Exception e)\r
-    {\r
-      e.printStackTrace();\r
-    }\r
-  }\r
-  private void jbInit() throws Exception\r
-  {\r
-    this.setLayout(borderLayout2);\r
-   // slider.setMajorTickSpacing(10);\r
-  //  slider.setMinorTickSpacing(1);\r
-  //  slider.setPaintTicks(true);\r
-    slider.setBackground(Color.white);\r
-    slider.setFont(new java.awt.Font("Verdana", 0, 11));\r
-    slider.setOrientation(0);\r
-    valueField.setFont(new java.awt.Font("Verdana", 0, 11));\r
-    valueField.setText("      ");\r
-    valueField.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        valueField_actionPerformed(e);\r
-      }\r
-    });\r
-    label.setFont(new java.awt.Font("Verdana", 0, 11));\r
-    label.setText("set this label text");\r
-    jPanel1.setLayout(borderLayout1);\r
-    jPanel2.setLayout(flowLayout1);\r
-    applyButton.setFont(new java.awt.Font("Verdana", 0, 11));\r
-    applyButton.setLabel("Apply");\r
-    applyButton.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        applyButton_actionPerformed(e);\r
-      }\r
-    });\r
-    undoButton.setEnabled(false);\r
-    undoButton.setFont(new java.awt.Font("Verdana", 0, 11));\r
-    undoButton.setLabel("Undo");\r
-    undoButton.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        undoButton_actionPerformed(e);\r
-      }\r
-    });\r
-    allGroupsCheck.setEnabled(false);\r
-    allGroupsCheck.setFont(new java.awt.Font("Verdana", 0, 11));\r
-    allGroupsCheck.setLabel("Apply threshold to all groups");\r
-    allGroupsCheck.setName("Apply to all Groups");\r
-    allGroupsCheck.addItemListener(new java.awt.event.ItemListener()\r
-    {\r
-      public void itemStateChanged(ItemEvent e)\r
-      {\r
-        allGroupsCheck_actionPerformed();\r
-      }\r
-    });\r
-    this.setBackground(Color.white);\r
-    this.setForeground(Color.black);\r
-    jPanel2.add(label, null);\r
-    jPanel2.add(applyButton, null);\r
-    jPanel2.add(undoButton, null);\r
-    jPanel2.add(allGroupsCheck);\r
-    jPanel1.add(valueField, java.awt.BorderLayout.EAST);\r
-    jPanel1.add(slider, java.awt.BorderLayout.CENTER);\r
-    this.add(jPanel1, java.awt.BorderLayout.SOUTH);\r
-    this.add(jPanel2, java.awt.BorderLayout.CENTER);\r
-  }\r
-\r
-  protected void valueField_actionPerformed(ActionEvent e)\r
-  {\r
 \r
-  }\r
+public class GSliderPanel extends Panel {\r
+    // this is used for conservation colours, PID colours and redundancy threshold\r
+    protected Scrollbar slider = new Scrollbar();\r
+    protected TextField valueField = new TextField();\r
+    protected Label label = new Label();\r
+    Panel jPanel1 = new Panel();\r
+    Panel jPanel2 = new Panel();\r
+    protected Button applyButton = new Button();\r
+    protected Button undoButton = new Button();\r
+    FlowLayout flowLayout1 = new FlowLayout();\r
+    protected Checkbox allGroupsCheck = new Checkbox();\r
+    BorderLayout borderLayout1 = new BorderLayout();\r
+    BorderLayout borderLayout2 = new BorderLayout();\r
+    FlowLayout flowLayout2 = new FlowLayout();\r
 \r
-  protected void applyButton_actionPerformed(ActionEvent e)\r
-  {\r
+    public GSliderPanel() {\r
+        try {\r
+            jbInit();\r
+        } catch (Exception e) {\r
+            e.printStackTrace();\r
+        }\r
+    }\r
 \r
-  }\r
+    private void jbInit() throws Exception {\r
+        this.setLayout(borderLayout2);\r
 \r
-  protected void undoButton_actionPerformed(ActionEvent e)\r
-  {\r
+        // slider.setMajorTickSpacing(10);\r
+        //  slider.setMinorTickSpacing(1);\r
+        //  slider.setPaintTicks(true);\r
+        slider.setBackground(Color.white);\r
+        slider.setFont(new java.awt.Font("Verdana", 0, 11));\r
+        slider.setOrientation(0);\r
+        valueField.setFont(new java.awt.Font("Verdana", 0, 11));\r
+        valueField.setText("      ");\r
+        valueField.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    valueField_actionPerformed(e);\r
+                }\r
+            });\r
+        label.setFont(new java.awt.Font("Verdana", 0, 11));\r
+        label.setText("set this label text");\r
+        jPanel1.setLayout(borderLayout1);\r
+        jPanel2.setLayout(flowLayout1);\r
+        applyButton.setFont(new java.awt.Font("Verdana", 0, 11));\r
+        applyButton.setLabel("Apply");\r
+        applyButton.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    applyButton_actionPerformed(e);\r
+                }\r
+            });\r
+        undoButton.setEnabled(false);\r
+        undoButton.setFont(new java.awt.Font("Verdana", 0, 11));\r
+        undoButton.setLabel("Undo");\r
+        undoButton.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    undoButton_actionPerformed(e);\r
+                }\r
+            });\r
+        allGroupsCheck.setEnabled(false);\r
+        allGroupsCheck.setFont(new java.awt.Font("Verdana", 0, 11));\r
+        allGroupsCheck.setLabel("Apply threshold to all groups");\r
+        allGroupsCheck.setName("Apply to all Groups");\r
+        allGroupsCheck.addItemListener(new java.awt.event.ItemListener() {\r
+                public void itemStateChanged(ItemEvent e) {\r
+                    allGroupsCheck_actionPerformed();\r
+                }\r
+            });\r
+        this.setBackground(Color.white);\r
+        this.setForeground(Color.black);\r
+        jPanel2.add(label, null);\r
+        jPanel2.add(applyButton, null);\r
+        jPanel2.add(undoButton, null);\r
+        jPanel2.add(allGroupsCheck);\r
+        jPanel1.add(valueField, java.awt.BorderLayout.EAST);\r
+        jPanel1.add(slider, java.awt.BorderLayout.CENTER);\r
+        this.add(jPanel1, java.awt.BorderLayout.SOUTH);\r
+        this.add(jPanel2, java.awt.BorderLayout.CENTER);\r
+    }\r
 \r
-  }\r
+    protected void valueField_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  protected void allGroupsCheck_actionPerformed()\r
-  {\r
+    protected void applyButton_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  }\r
+    protected void undoButton_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
+    protected void allGroupsCheck_actionPerformed() {\r
+    }\r
 }\r
index a663402..1810719 100755 (executable)
 * 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.jbappletgui;\r
 \r
 import java.awt.*;\r
 import java.awt.event.*;\r
 \r
-public class GTreePanel extends Frame\r
-{\r
-  BorderLayout borderLayout1 = new BorderLayout();\r
-  protected ScrollPane scrollPane = new ScrollPane();\r
-  MenuBar jMenuBar1 = new MenuBar();\r
-  Menu jMenu2 = new Menu();\r
-  protected MenuItem fontSize = new MenuItem();\r
-  protected CheckboxMenuItem bootstrapMenu = new CheckboxMenuItem();\r
-  protected CheckboxMenuItem distanceMenu = new CheckboxMenuItem();\r
-  protected CheckboxMenuItem placeholdersMenu = new CheckboxMenuItem();\r
-  protected CheckboxMenuItem fitToWindow = new CheckboxMenuItem();\r
-  Menu fileMenu = new Menu();\r
-  MenuItem newickOutput = new MenuItem();\r
 \r
-  public GTreePanel()\r
-  {\r
-    try\r
-    {\r
-      jbInit();\r
-      this.setMenuBar(jMenuBar1);\r
-    }\r
-    catch(Exception e)\r
-    {\r
-      e.printStackTrace();\r
+public class GTreePanel extends Frame {\r
+    BorderLayout borderLayout1 = new BorderLayout();\r
+    protected ScrollPane scrollPane = new ScrollPane();\r
+    MenuBar jMenuBar1 = new MenuBar();\r
+    Menu jMenu2 = new Menu();\r
+    protected MenuItem fontSize = new MenuItem();\r
+    protected CheckboxMenuItem bootstrapMenu = new CheckboxMenuItem();\r
+    protected CheckboxMenuItem distanceMenu = new CheckboxMenuItem();\r
+    protected CheckboxMenuItem placeholdersMenu = new CheckboxMenuItem();\r
+    protected CheckboxMenuItem fitToWindow = new CheckboxMenuItem();\r
+    Menu fileMenu = new Menu();\r
+    MenuItem newickOutput = new MenuItem();\r
+\r
+    public GTreePanel() {\r
+        try {\r
+            jbInit();\r
+            this.setMenuBar(jMenuBar1);\r
+        } catch (Exception e) {\r
+            e.printStackTrace();\r
+        }\r
     }\r
 \r
-  }\r
-  private void jbInit() throws Exception\r
-  {\r
-    setLayout(borderLayout1);\r
-    this.setBackground(Color.white);\r
-    this.setFont(new java.awt.Font("Verdana", 0, 12));\r
-    jMenu2.setLabel("View");\r
-    fontSize.setLabel("Font Size - 12");\r
-    fontSize.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        fontSize_actionPerformed(e);\r
-      }\r
-    });\r
-    bootstrapMenu.setLabel("Show Bootstrap Values");\r
-    bootstrapMenu.addItemListener(new java.awt.event.ItemListener()\r
-    {\r
-      public void itemStateChanged(ItemEvent e)\r
-      {\r
-        bootstrapMenu_actionPerformed(null);\r
-      }\r
-    });\r
-    distanceMenu.setLabel("Show Distances");\r
-    distanceMenu.addItemListener(new java.awt.event.ItemListener()\r
-    {\r
-      public void itemStateChanged(ItemEvent e)\r
-      {\r
-        distanceMenu_actionPerformed(null);\r
-      }\r
-    });\r
-    placeholdersMenu.setLabel("Mark Unassociated Leaves");\r
-    placeholdersMenu.addItemListener(new java.awt.event.ItemListener()\r
-    {\r
-      public void itemStateChanged(ItemEvent e)\r
-      {\r
-        placeholdersMenu_actionPerformed(null);\r
-      }\r
-    });\r
-    fitToWindow.setState(true);\r
-    fitToWindow.setLabel("Fit To Window");\r
-    fitToWindow.addItemListener(new java.awt.event.ItemListener()\r
-    {\r
-      public void itemStateChanged(ItemEvent e)\r
-      {\r
-        fitToWindow_actionPerformed(null);\r
-      }\r
-    });\r
-    fileMenu.setLabel("File");\r
-    newickOutput.setLabel("Newick Format");\r
-    newickOutput.addActionListener(new ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent actionEvent)\r
-      {\r
-        newickOutput_actionPerformed(actionEvent);\r
-      }\r
-    });\r
-    add(scrollPane, BorderLayout.CENTER);\r
-    jMenuBar1.add(fileMenu);\r
-    jMenuBar1.add(jMenu2);\r
-    jMenu2.add(fitToWindow);\r
-    jMenu2.add(fontSize);\r
-    jMenu2.add(distanceMenu);\r
-    jMenu2.add(bootstrapMenu);\r
-    jMenu2.add(placeholdersMenu);\r
-    fileMenu.add(newickOutput);\r
-  }\r
-\r
-\r
-  protected void printMenu_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-  protected void fontSize_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-  protected void distanceMenu_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-  protected void bootstrapMenu_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
+    private void jbInit() throws Exception {\r
+        setLayout(borderLayout1);\r
+        this.setBackground(Color.white);\r
+        this.setFont(new java.awt.Font("Verdana", 0, 12));\r
+        jMenu2.setLabel("View");\r
+        fontSize.setLabel("Font Size - 12");\r
+        fontSize.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    fontSize_actionPerformed(e);\r
+                }\r
+            });\r
+        bootstrapMenu.setLabel("Show Bootstrap Values");\r
+        bootstrapMenu.addItemListener(new java.awt.event.ItemListener() {\r
+                public void itemStateChanged(ItemEvent e) {\r
+                    bootstrapMenu_actionPerformed(null);\r
+                }\r
+            });\r
+        distanceMenu.setLabel("Show Distances");\r
+        distanceMenu.addItemListener(new java.awt.event.ItemListener() {\r
+                public void itemStateChanged(ItemEvent e) {\r
+                    distanceMenu_actionPerformed(null);\r
+                }\r
+            });\r
+        placeholdersMenu.setLabel("Mark Unassociated Leaves");\r
+        placeholdersMenu.addItemListener(new java.awt.event.ItemListener() {\r
+                public void itemStateChanged(ItemEvent e) {\r
+                    placeholdersMenu_actionPerformed(null);\r
+                }\r
+            });\r
+        fitToWindow.setState(true);\r
+        fitToWindow.setLabel("Fit To Window");\r
+        fitToWindow.addItemListener(new java.awt.event.ItemListener() {\r
+                public void itemStateChanged(ItemEvent e) {\r
+                    fitToWindow_actionPerformed(null);\r
+                }\r
+            });\r
+        fileMenu.setLabel("File");\r
+        newickOutput.setLabel("Newick Format");\r
+        newickOutput.addActionListener(new ActionListener() {\r
+                public void actionPerformed(ActionEvent actionEvent) {\r
+                    newickOutput_actionPerformed(actionEvent);\r
+                }\r
+            });\r
+        add(scrollPane, BorderLayout.CENTER);\r
+        jMenuBar1.add(fileMenu);\r
+        jMenuBar1.add(jMenu2);\r
+        jMenu2.add(fitToWindow);\r
+        jMenu2.add(fontSize);\r
+        jMenu2.add(distanceMenu);\r
+        jMenu2.add(bootstrapMenu);\r
+        jMenu2.add(placeholdersMenu);\r
+        fileMenu.add(newickOutput);\r
+    }\r
 \r
-  protected void placeholdersMenu_actionPerformed(ActionEvent e)\r
-  {\r
+    protected void printMenu_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  }\r
+    protected void fontSize_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  protected void fitToWindow_actionPerformed(ActionEvent e)\r
-  {\r
+    protected void distanceMenu_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  }\r
+    protected void bootstrapMenu_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  public void newickOutput_actionPerformed(ActionEvent actionEvent)\r
-  {\r
+    protected void placeholdersMenu_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  }\r
+    protected void fitToWindow_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
+    public void newickOutput_actionPerformed(ActionEvent actionEvent) {\r
+    }\r
 }\r
index 0acc0b1..bc57798 100755 (executable)
 * 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.jbappletgui;\r
 \r
 import java.awt.*;\r
 import java.awt.event.*;\r
 \r
 \r
-public class GUserDefinedColours extends Panel\r
-{\r
-  protected Panel buttonPanel = new Panel();\r
-  protected GridLayout gridLayout = new GridLayout();\r
-  Panel jPanel2 = new Panel();\r
-  protected Button okButton = new Button();\r
-  protected Button applyButton = new Button();\r
-  protected Button cancelButton = new Button();\r
-  protected Scrollbar rScroller = new Scrollbar();\r
-  Label label1 = new Label();\r
-  Panel panel2 = new Panel();\r
-  BorderLayout borderLayout1 = new BorderLayout();\r
-  protected TextField rText = new TextField();\r
-  Panel panel3 = new Panel();\r
-  Label label4 = new Label();\r
-  protected Scrollbar gScroller = new Scrollbar();\r
-  protected TextField gText = new TextField();\r
-  BorderLayout borderLayout2 = new BorderLayout();\r
-  Panel panel4 = new Panel();\r
-  Label label5 = new Label();\r
-  protected Scrollbar bScroller = new Scrollbar();\r
-  protected TextField bText = new TextField();\r
-  BorderLayout borderLayout3 = new BorderLayout();\r
-  protected Panel target = new Panel();\r
-\r
-  public GUserDefinedColours()\r
-  {\r
-    try\r
-    {\r
-      jbInit();\r
+public class GUserDefinedColours extends Panel {\r
+    protected Panel buttonPanel = new Panel();\r
+    protected GridLayout gridLayout = new GridLayout();\r
+    Panel jPanel2 = new Panel();\r
+    protected Button okButton = new Button();\r
+    protected Button applyButton = new Button();\r
+    protected Button cancelButton = new Button();\r
+    protected Scrollbar rScroller = new Scrollbar();\r
+    Label label1 = new Label();\r
+    Panel panel2 = new Panel();\r
+    BorderLayout borderLayout1 = new BorderLayout();\r
+    protected TextField rText = new TextField();\r
+    Panel panel3 = new Panel();\r
+    Label label4 = new Label();\r
+    protected Scrollbar gScroller = new Scrollbar();\r
+    protected TextField gText = new TextField();\r
+    BorderLayout borderLayout2 = new BorderLayout();\r
+    Panel panel4 = new Panel();\r
+    Label label5 = new Label();\r
+    protected Scrollbar bScroller = new Scrollbar();\r
+    protected TextField bText = new TextField();\r
+    BorderLayout borderLayout3 = new BorderLayout();\r
+    protected Panel target = new Panel();\r
+\r
+    public GUserDefinedColours() {\r
+        try {\r
+            jbInit();\r
+        } catch (Exception e) {\r
+            e.printStackTrace();\r
+        }\r
     }\r
-    catch(Exception e)\r
-    {\r
-      e.printStackTrace();\r
-    }\r
-  }\r
-  private void jbInit() throws Exception\r
-  {\r
-    this.setLayout(null);\r
-    buttonPanel.setLayout(gridLayout);\r
-    gridLayout.setColumns(6);\r
-    gridLayout.setRows(4);\r
-    okButton.setFont(new java.awt.Font("Verdana", 0, 11));\r
-    okButton.setLabel("OK");\r
-    okButton.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        okButton_actionPerformed(e);\r
-      }\r
-    });\r
-    applyButton.setFont(new java.awt.Font("Verdana", 0, 11));\r
-    applyButton.setLabel("Apply");\r
-    applyButton.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        applyButton_actionPerformed(e);\r
-      }\r
-    });\r
-    cancelButton.setFont(new java.awt.Font("Verdana", 0, 11));\r
-    cancelButton.setLabel("Cancel");\r
-    cancelButton.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        cancelButton_actionPerformed(e);\r
-      }\r
-    });\r
-    this.setBackground(new Color(212, 208, 223));\r
-    jPanel2.setBounds(new Rectangle(0, 265, 400, 35));\r
-    buttonPanel.setBounds(new Rectangle(0, 123, 400, 142));\r
-    rScroller.setMaximum(255);\r
-    rScroller.setMinimum(0);\r
-    rScroller.setOrientation(0);\r
-    rScroller.setUnitIncrement(1);\r
-    rScroller.addAdjustmentListener(new java.awt.event.AdjustmentListener() {\r
-      public void adjustmentValueChanged(AdjustmentEvent e) {\r
-        rScroller_adjustmentValueChanged(e);\r
-      }\r
-    });\r
-    label1.setText("R");\r
-    panel2.setBounds(new Rectangle(20, 29, 180, 19));\r
-    panel2.setLayout(borderLayout1);\r
-    rText.setText("    0");\r
-    rText.addActionListener(new java.awt.event.ActionListener() {\r
-      public void actionPerformed(ActionEvent e) {\r
-        rText_actionPerformed(e);\r
-      }\r
-    });\r
-    panel3.setLayout(borderLayout2);\r
-    label4.setText("G");\r
-    gScroller.setMaximum(255);\r
-    gScroller.setMinimum(0);\r
-    gScroller.setOrientation(0);\r
-    gScroller.setUnitIncrement(1);\r
-    gScroller.addAdjustmentListener(new java.awt.event.AdjustmentListener() {\r
-      public void adjustmentValueChanged(AdjustmentEvent e) {\r
-        gScroller_adjustmentValueChanged(e);\r
-      }\r
-    });\r
-    gText.setText("    0");\r
-    gText.addActionListener(new java.awt.event.ActionListener() {\r
-      public void actionPerformed(ActionEvent e) {\r
-        gText_actionPerformed(e);\r
-      }\r
-    });\r
-    panel3.setBounds(new Rectangle(19, 54, 181, 20));\r
-    panel4.setLayout(borderLayout3);\r
-    label5.setText("B");\r
-    bScroller.setMaximum(255);\r
-    bScroller.setMinimum(0);\r
-    bScroller.setOrientation(0);\r
-    bScroller.setUnitIncrement(1);\r
-    bScroller.addAdjustmentListener(new java.awt.event.AdjustmentListener() {\r
-      public void adjustmentValueChanged(AdjustmentEvent e) {\r
-        bScroller_adjustmentValueChanged(e);\r
-      }\r
-    });\r
-    bText.setSelectionStart(6);\r
-    bText.setText("    0");\r
-    bText.addActionListener(new java.awt.event.ActionListener() {\r
-      public void actionPerformed(ActionEvent e) {\r
-        bText_actionPerformed(e);\r
-      }\r
-    });\r
-    panel4.setBounds(new Rectangle(19, 87, 180, 20));\r
-    target.setBackground(Color.black);\r
-    target.setBounds(new Rectangle(229, 26, 134, 79));\r
-    this.add(jPanel2, null);\r
-    jPanel2.add(okButton, null);\r
-    jPanel2.add(applyButton, null);\r
-    jPanel2.add(cancelButton, null);\r
-    this.add(buttonPanel, null);\r
-    panel2.add(label1, BorderLayout.WEST);\r
-    panel2.add(rScroller, BorderLayout.CENTER);\r
-    panel2.add(rText, BorderLayout.EAST);\r
-    this.add(target, null);\r
-    this.add(panel4, null);\r
-    panel3.add(label4, BorderLayout.WEST);\r
-    panel3.add(gScroller, BorderLayout.CENTER);\r
-    panel3.add(gText, BorderLayout.EAST);\r
-    this.add(panel2, null);\r
-    panel4.add(label5, BorderLayout.WEST);\r
-    panel4.add(bScroller, BorderLayout.CENTER);\r
-    panel4.add(bText, BorderLayout.EAST);\r
-    this.add(panel3, null);\r
-  }\r
-\r
-\r
-  protected void okButton_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-  protected void applyButton_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-\r
-\r
-  protected void cancelButton_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-  protected void rScroller_adjustmentValueChanged(AdjustmentEvent e) {\r
-\r
-  }\r
 \r
-  protected void gScroller_adjustmentValueChanged(AdjustmentEvent e) {\r
-\r
-  }\r
-\r
-  protected void bScroller_adjustmentValueChanged(AdjustmentEvent e) {\r
-\r
-  }\r
-\r
-  protected void rText_actionPerformed(ActionEvent e) {\r
+    private void jbInit() throws Exception {\r
+        this.setLayout(null);\r
+        buttonPanel.setLayout(gridLayout);\r
+        gridLayout.setColumns(6);\r
+        gridLayout.setRows(4);\r
+        okButton.setFont(new java.awt.Font("Verdana", 0, 11));\r
+        okButton.setLabel("OK");\r
+        okButton.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    okButton_actionPerformed(e);\r
+                }\r
+            });\r
+        applyButton.setFont(new java.awt.Font("Verdana", 0, 11));\r
+        applyButton.setLabel("Apply");\r
+        applyButton.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    applyButton_actionPerformed(e);\r
+                }\r
+            });\r
+        cancelButton.setFont(new java.awt.Font("Verdana", 0, 11));\r
+        cancelButton.setLabel("Cancel");\r
+        cancelButton.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    cancelButton_actionPerformed(e);\r
+                }\r
+            });\r
+        this.setBackground(new Color(212, 208, 223));\r
+        jPanel2.setBounds(new Rectangle(0, 265, 400, 35));\r
+        buttonPanel.setBounds(new Rectangle(0, 123, 400, 142));\r
+        rScroller.setMaximum(255);\r
+        rScroller.setMinimum(0);\r
+        rScroller.setOrientation(0);\r
+        rScroller.setUnitIncrement(1);\r
+        rScroller.addAdjustmentListener(new java.awt.event.AdjustmentListener() {\r
+                public void adjustmentValueChanged(AdjustmentEvent e) {\r
+                    rScroller_adjustmentValueChanged(e);\r
+                }\r
+            });\r
+        label1.setText("R");\r
+        panel2.setBounds(new Rectangle(20, 29, 180, 19));\r
+        panel2.setLayout(borderLayout1);\r
+        rText.setText("    0");\r
+        rText.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    rText_actionPerformed(e);\r
+                }\r
+            });\r
+        panel3.setLayout(borderLayout2);\r
+        label4.setText("G");\r
+        gScroller.setMaximum(255);\r
+        gScroller.setMinimum(0);\r
+        gScroller.setOrientation(0);\r
+        gScroller.setUnitIncrement(1);\r
+        gScroller.addAdjustmentListener(new java.awt.event.AdjustmentListener() {\r
+                public void adjustmentValueChanged(AdjustmentEvent e) {\r
+                    gScroller_adjustmentValueChanged(e);\r
+                }\r
+            });\r
+        gText.setText("    0");\r
+        gText.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    gText_actionPerformed(e);\r
+                }\r
+            });\r
+        panel3.setBounds(new Rectangle(19, 54, 181, 20));\r
+        panel4.setLayout(borderLayout3);\r
+        label5.setText("B");\r
+        bScroller.setMaximum(255);\r
+        bScroller.setMinimum(0);\r
+        bScroller.setOrientation(0);\r
+        bScroller.setUnitIncrement(1);\r
+        bScroller.addAdjustmentListener(new java.awt.event.AdjustmentListener() {\r
+                public void adjustmentValueChanged(AdjustmentEvent e) {\r
+                    bScroller_adjustmentValueChanged(e);\r
+                }\r
+            });\r
+        bText.setSelectionStart(6);\r
+        bText.setText("    0");\r
+        bText.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    bText_actionPerformed(e);\r
+                }\r
+            });\r
+        panel4.setBounds(new Rectangle(19, 87, 180, 20));\r
+        target.setBackground(Color.black);\r
+        target.setBounds(new Rectangle(229, 26, 134, 79));\r
+        this.add(jPanel2, null);\r
+        jPanel2.add(okButton, null);\r
+        jPanel2.add(applyButton, null);\r
+        jPanel2.add(cancelButton, null);\r
+        this.add(buttonPanel, null);\r
+        panel2.add(label1, BorderLayout.WEST);\r
+        panel2.add(rScroller, BorderLayout.CENTER);\r
+        panel2.add(rText, BorderLayout.EAST);\r
+        this.add(target, null);\r
+        this.add(panel4, null);\r
+        panel3.add(label4, BorderLayout.WEST);\r
+        panel3.add(gScroller, BorderLayout.CENTER);\r
+        panel3.add(gText, BorderLayout.EAST);\r
+        this.add(panel2, null);\r
+        panel4.add(label5, BorderLayout.WEST);\r
+        panel4.add(bScroller, BorderLayout.CENTER);\r
+        panel4.add(bText, BorderLayout.EAST);\r
+        this.add(panel3, null);\r
+    }\r
 \r
-  }\r
+    protected void okButton_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  protected void gText_actionPerformed(ActionEvent e) {\r
+    protected void applyButton_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  }\r
+    protected void cancelButton_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  protected void bText_actionPerformed(ActionEvent e) {\r
+    protected void rScroller_adjustmentValueChanged(AdjustmentEvent e) {\r
+    }\r
 \r
-  }\r
+    protected void gScroller_adjustmentValueChanged(AdjustmentEvent e) {\r
+    }\r
 \r
+    protected void bScroller_adjustmentValueChanged(AdjustmentEvent e) {\r
+    }\r
 \r
+    protected void rText_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
+    protected void gText_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
+    protected void bText_actionPerformed(ActionEvent e) {\r
+    }\r
 }\r
index 00b4bc9..81325d5 100755 (executable)
 * 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.jbgui;\r
 \r
-import javax.swing.*;\r
-import java.awt.event.*;\r
-import java.awt.*;\r
-\r
 import jalview.gui.Preferences;\r
-import jalview.schemes.ColourSchemeProperty;\r
-import javax.swing.event.AncestorListener;\r
-import javax.swing.event.AncestorEvent;\r
-\r
-public class GAlignFrame extends JInternalFrame\r
-{\r
-  protected JMenuBar alignFrameMenuBar = new JMenuBar();\r
-  protected JMenu fileMenu = new JMenu();\r
-  protected JMenuItem closeMenuItem = new JMenuItem();\r
-  protected JMenu editMenu = new JMenu();\r
-  protected JMenu viewMenu = new JMenu();\r
-  protected JMenu colourMenu = new JMenu();\r
-  protected JMenu calculateMenu = new JMenu();\r
-  protected JMenu webService = new JMenu();\r
-  protected JMenuItem selectAllSequenceMenuItem = new JMenuItem();\r
-  protected JMenuItem deselectAllSequenceMenuItem = new JMenuItem();\r
-  protected JMenuItem invertSequenceMenuItem = new JMenuItem();\r
-  protected JMenuItem remove2LeftMenuItem = new JMenuItem();\r
-  protected JMenuItem remove2RightMenuItem = new JMenuItem();\r
-  protected JMenuItem removeGappedColumnMenuItem = new JMenuItem();\r
-  protected JMenuItem removeAllGapsMenuItem = new JMenuItem();\r
-  protected JCheckBoxMenuItem viewBoxesMenuItem = new JCheckBoxMenuItem();\r
-  protected JCheckBoxMenuItem viewTextMenuItem = new JCheckBoxMenuItem();\r
-  protected JMenuItem sortPairwiseMenuItem = new JMenuItem();\r
-  protected JMenuItem sortIDMenuItem = new JMenuItem();\r
-  protected JMenuItem sortGroupMenuItem = new JMenuItem();\r
-  protected JMenuItem removeRedundancyMenuItem = new JMenuItem();\r
-  protected JMenuItem pairwiseAlignmentMenuItem = new JMenuItem();\r
-  protected JMenuItem PCAMenuItem = new JMenuItem();\r
-  protected JMenuItem averageDistanceTreeMenuItem = new JMenuItem();\r
-  protected JMenuItem neighbourTreeMenuItem = new JMenuItem();\r
-  protected JMenuItem clustalAlignMenuItem = new JMenuItem();\r
-  BorderLayout borderLayout1 = new BorderLayout();\r
-  public JLabel statusBar = new JLabel();\r
-  protected JMenuItem saveAlignmentMenu = new JMenuItem();\r
-  protected JMenu outputTextboxMenu = new JMenu();\r
-  protected JRadioButtonMenuItem clustalColour = new JRadioButtonMenuItem();\r
-  protected JRadioButtonMenuItem zappoColour = new JRadioButtonMenuItem();\r
-  protected JRadioButtonMenuItem taylorColour = new JRadioButtonMenuItem();\r
-  protected JRadioButtonMenuItem hydrophobicityColour = new JRadioButtonMenuItem();\r
-  protected JRadioButtonMenuItem helixColour = new JRadioButtonMenuItem();\r
-  protected JRadioButtonMenuItem strandColour = new JRadioButtonMenuItem();\r
-  protected JRadioButtonMenuItem turnColour = new JRadioButtonMenuItem();\r
-  protected JRadioButtonMenuItem buriedColour = new JRadioButtonMenuItem();\r
-  protected JRadioButtonMenuItem userDefinedColour = new JRadioButtonMenuItem();\r
-  protected JRadioButtonMenuItem PIDColour = new JRadioButtonMenuItem();\r
-  protected JRadioButtonMenuItem BLOSUM62Colour = new JRadioButtonMenuItem();\r
-  JMenuItem njTreeBlosumMenuItem = new JMenuItem();\r
-  JMenuItem avDistanceTreeBlosumMenuItem = new JMenuItem();\r
-  protected JCheckBoxMenuItem annotationPanelMenuItem = new JCheckBoxMenuItem();\r
-  protected JCheckBoxMenuItem colourTextMenuItem = new JCheckBoxMenuItem();\r
-  JMenuItem htmlMenuItem = new JMenuItem();\r
-  JMenuItem overviewMenuItem = new JMenuItem();\r
-  protected JMenuItem undoMenuItem = new JMenuItem();\r
-  protected JMenuItem redoMenuItem = new JMenuItem();\r
-  protected JCheckBoxMenuItem conservationMenuItem = new JCheckBoxMenuItem();\r
-  JRadioButtonMenuItem noColourmenuItem = new JRadioButtonMenuItem();\r
-  protected JCheckBoxMenuItem wrapMenuItem = new JCheckBoxMenuItem();\r
-  JMenuItem printMenuItem = new JMenuItem();\r
-  protected JCheckBoxMenuItem renderGapsMenuItem = new JCheckBoxMenuItem();\r
-  JMenuItem findMenuItem = new JMenuItem();\r
-  JMenu searchMenu = new JMenu();\r
-  protected JCheckBoxMenuItem abovePIDThreshold = new JCheckBoxMenuItem();\r
-  protected JCheckBoxMenuItem sequenceFeatures = new JCheckBoxMenuItem();\r
-  protected JRadioButtonMenuItem nucleotideColour = new JRadioButtonMenuItem();\r
-  JMenuItem deleteGroups = new JMenuItem();\r
-  JMenuItem delete = new JMenuItem();\r
-  JMenuItem copy = new JMenuItem();\r
-  JMenuItem cut = new JMenuItem();\r
-  JMenu jMenu1 = new JMenu();\r
-  JMenuItem pasteNew = new JMenuItem();\r
-  JMenuItem pasteThis = new JMenuItem();\r
-  protected JCheckBoxMenuItem applyToAllGroups = new JCheckBoxMenuItem();\r
-  JMenuItem createPNG = new JMenuItem();\r
-  protected JMenuItem font = new JMenuItem();\r
-  protected JCheckBoxMenuItem fullSeqId = new JCheckBoxMenuItem();\r
-  JMenuItem epsFile = new JMenuItem();\r
-  JMenuItem LoadtreeMenuItem = new JMenuItem();\r
-  JMenuItem jpred = new JMenuItem();\r
-  protected JCheckBoxMenuItem scaleAbove = new JCheckBoxMenuItem();\r
-  protected JCheckBoxMenuItem scaleLeft = new JCheckBoxMenuItem();\r
-  protected JCheckBoxMenuItem scaleRight = new JCheckBoxMenuItem();\r
-  JMenuItem modifyPID = new JMenuItem();\r
-  JMenuItem modifyConservation = new JMenuItem();\r
-  protected JMenu sortByTreeMenu = new JMenu();\r
-  protected JMenu sort = new JMenu();\r
-  JMenu calculate = new JMenu();\r
-  JMenuItem msaAlignMenuItem = new JMenuItem();\r
-  JMenu jMenu2 = new JMenu();\r
-  JMenuItem padGapsMenuitem = new JMenuItem();\r
-  JMenuItem ClustalRealign = new JMenuItem();\r
-  public GAlignFrame()\r
-  {\r
-    ButtonGroup colours = new ButtonGroup();\r
-    colours.add(noColourmenuItem);\r
-    colours.add(clustalColour);\r
-    colours.add(zappoColour);\r
-    colours.add(taylorColour);\r
-    colours.add(hydrophobicityColour);\r
-    colours.add(helixColour);\r
-    colours.add(strandColour);\r
-    colours.add(turnColour);\r
-    colours.add(buriedColour);\r
-    colours.add(userDefinedColour);\r
-    colours.add(PIDColour);\r
-    colours.add(BLOSUM62Colour);\r
-    colours.add(nucleotideColour);\r
-\r
-   noColourmenuItem.setSelected(true);\r
-   String defaultColour = Preferences.defaultColour;\r
-   if(defaultColour!=null)\r
-   {\r
-   int index = ColourSchemeProperty.getColourIndexFromName(defaultColour);\r
-   switch(index)\r
-   {\r
-     case ColourSchemeProperty.CLUSTAL : clustalColour.setSelected(true); break;\r
-     case ColourSchemeProperty.BLOSUM : BLOSUM62Colour.setSelected(true); break;\r
-     case ColourSchemeProperty.PID : PIDColour.setSelected(true); break;\r
-     case ColourSchemeProperty.ZAPPO : zappoColour.setSelected(true); break;\r
-     case ColourSchemeProperty.HYDROPHOBIC: hydrophobicityColour.setSelected(true); break;\r
-     case ColourSchemeProperty.HELIX: helixColour.setSelected(true); break;\r
-     case ColourSchemeProperty.STRAND: strandColour.setSelected(true); break;\r
-     case ColourSchemeProperty.TURN : turnColour.setSelected(true); break;\r
-     case ColourSchemeProperty.BURIED: buriedColour.setSelected(true); break;\r
-     case ColourSchemeProperty.NUCLEOTIDE: nucleotideColour.setSelected(true); break;\r
-     case ColourSchemeProperty.USER_DEFINED : userDefinedColour.setSelected(true); break;\r
-   }\r
-   }\r
-\r
-\r
-    try\r
-    {\r
-      jbInit();\r
-      setJMenuBar(alignFrameMenuBar);\r
-\r
-      JMenuItem item;\r
-      // dynamically fill save as menu with available formats\r
-      for (int i = 0; i < jalview.io.FormatAdapter.formats.size(); i++) {\r
-        item = new JMenuItem((String) jalview.io.FormatAdapter.formats.elementAt(i));\r
-        item.addActionListener(new java.awt.event.ActionListener()\r
-        {\r
-          public void actionPerformed(ActionEvent e)\r
-          {\r
-            outputText_actionPerformed(e);\r
-          }\r
-        });\r
-\r
-        outputTextboxMenu.add( item );\r
-      }\r
-\r
-    }\r
-    catch(Exception e)\r
-    {\r
-      e.printStackTrace();\r
-    }\r
-\r
-  }\r
-  private void jbInit() throws Exception\r
-  {\r
-    fileMenu.setMnemonic('F');\r
-    fileMenu.setText("File");\r
-    saveAlignmentMenu.setMnemonic('L');\r
-    saveAlignmentMenu.setText("Save As");\r
-    saveAlignmentMenu.addActionListener(new ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        saveAlignmentMenu_actionPerformed(e);\r
-      }\r
-    });\r
-    closeMenuItem.setMnemonic('C');\r
-    closeMenuItem.setText("Close");\r
-    closeMenuItem.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        closeMenuItem_actionPerformed(e);\r
-      }\r
-    });\r
-    editMenu.setText("Edit");\r
-    viewMenu.setText("View");\r
-    colourMenu.setText("Colour");\r
-    calculateMenu.setText("Calculate");\r
-    webService.setText("Web Service");\r
-    selectAllSequenceMenuItem.setText("Select all");\r
-    selectAllSequenceMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(\r
-        java.awt.event.KeyEvent.VK_A, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false));\r
-    selectAllSequenceMenuItem.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        selectAllSequenceMenuItem_actionPerformed(e);\r
-      }\r
-    });\r
-    deselectAllSequenceMenuItem.setText("Deselect All");\r
-    deselectAllSequenceMenuItem.setAccelerator(javax.swing.KeyStroke.\r
-                                               getKeyStroke(java.awt.event.\r
-        KeyEvent.VK_ESCAPE, 0, false));\r
-    deselectAllSequenceMenuItem.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        deselectAllSequenceMenuItem_actionPerformed(e);\r
-      }\r
-    });\r
-    invertSequenceMenuItem.setText("Invert Selection");\r
-    invertSequenceMenuItem.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        invertSequenceMenuItem_actionPerformed(e);\r
-      }\r
-    });\r
-    remove2LeftMenuItem.setText("Remove Left");\r
-    remove2LeftMenuItem.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        remove2LeftMenuItem_actionPerformed(e);\r
-      }\r
-    });\r
-    remove2RightMenuItem.setText("Remove Right");\r
-    remove2RightMenuItem.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        remove2RightMenuItem_actionPerformed(e);\r
-      }\r
-    });\r
-    removeGappedColumnMenuItem.setText("Remove Empty Columns");\r
-    removeGappedColumnMenuItem.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        removeGappedColumnMenuItem_actionPerformed(e);\r
-      }\r
-    });\r
-    removeAllGapsMenuItem.setText("Remove All Gaps");\r
-    removeAllGapsMenuItem.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        removeAllGapsMenuItem_actionPerformed(e);\r
-      }\r
-    });\r
-    viewBoxesMenuItem.setText("Boxes");\r
-    viewBoxesMenuItem.setState(true);\r
-    viewBoxesMenuItem.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        viewBoxesMenuItem_actionPerformed(e);\r
-      }\r
-    });\r
-    viewTextMenuItem.setText("Text");\r
-    viewTextMenuItem.setState(true);\r
-    viewTextMenuItem.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        viewTextMenuItem_actionPerformed(e);\r
-      }\r
-    });\r
-    sortPairwiseMenuItem.setText("by Pairwise Identity");\r
-    sortPairwiseMenuItem.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        sortPairwiseMenuItem_actionPerformed(e);\r
-      }\r
-    });\r
-    sortIDMenuItem.setText("by ID");\r
-    sortIDMenuItem.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        sortIDMenuItem_actionPerformed(e);\r
-      }\r
-    });\r
-    sortGroupMenuItem.setText("by Group");\r
-    sortGroupMenuItem.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        sortGroupMenuItem_actionPerformed(e);\r
-      }\r
-    });\r
-    removeRedundancyMenuItem.setText("Remove Redundancy...");\r
-    removeRedundancyMenuItem.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        removeRedundancyMenuItem_actionPerformed(e);\r
-      }\r
-    });\r
-    pairwiseAlignmentMenuItem.setText("Pairwise Alignments...");\r
-    pairwiseAlignmentMenuItem.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        pairwiseAlignmentMenuItem_actionPerformed(e);\r
-      }\r
-    });\r
-    PCAMenuItem.setText("Principal Component Analysis...");\r
-    PCAMenuItem.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        PCAMenuItem_actionPerformed(e);\r
-      }\r
-    });\r
-    averageDistanceTreeMenuItem.setText("Average Distance Using % Identity...");\r
-    averageDistanceTreeMenuItem.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        averageDistanceTreeMenuItem_actionPerformed(e);\r
-      }\r
-    });\r
-    neighbourTreeMenuItem.setText("Neighbour Joining Using % Identity...");\r
-    neighbourTreeMenuItem.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        neighbourTreeMenuItem_actionPerformed(e);\r
-      }\r
-    });\r
-    clustalAlignMenuItem.setText("Clustal Alignment...");\r
-    clustalAlignMenuItem.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        clustalAlignMenuItem_actionPerformed(e);\r
-      }\r
-    });\r
-    this.getContentPane().setLayout(borderLayout1);\r
-    alignFrameMenuBar.setFont(new java.awt.Font("Verdana", 0, 11));\r
-    alignFrameMenuBar.addAncestorListener(new AncestorListener()\r
-    {\r
-      public void ancestorAdded(AncestorEvent event)\r
-      {\r
-        alignFrameMenuBar_ancestorAdded(event);\r
-      }\r
-\r
-      public void ancestorRemoved(AncestorEvent event)\r
-      {\r
-      }\r
-\r
-      public void ancestorMoved(AncestorEvent event)\r
-      {\r
-      }\r
-    });\r
-    statusBar.setBackground(Color.white);\r
-    statusBar.setFont(new java.awt.Font("Verdana", 0, 11));\r
-    statusBar.setBorder(BorderFactory.createLineBorder(Color.black));\r
-    statusBar.setText("Status bar");\r
-    outputTextboxMenu.setMnemonic('T');\r
-    outputTextboxMenu.setText("Output to Textbox");\r
-    clustalColour.setText("Clustalx");\r
-\r
-    clustalColour.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        clustalColour_actionPerformed(e);\r
-      }\r
-    });\r
-    zappoColour.setText("Zappo");\r
-    zappoColour.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        zappoColour_actionPerformed(e);\r
-      }\r
-    });\r
-    taylorColour.setText("Taylor");\r
-    taylorColour.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        taylorColour_actionPerformed(e);\r
-      }\r
-    });\r
-    hydrophobicityColour.setText("Hydrophobicity");\r
-    hydrophobicityColour.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        hydrophobicityColour_actionPerformed(e);\r
-      }\r
-    });\r
-    helixColour.setText("Helix Propensity");\r
-    helixColour.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        helixColour_actionPerformed(e);\r
-      }\r
-    });\r
-    strandColour.setText("Strand Propensity");\r
-    strandColour.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        strandColour_actionPerformed(e);\r
-      }\r
-    });\r
-    turnColour.setText("Turn Propensity");\r
-    turnColour.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        turnColour_actionPerformed(e);\r
-      }\r
-    });\r
-    buriedColour.setText("Buried Index");\r
-    buriedColour.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        buriedColour_actionPerformed(e);\r
-      }\r
-    });\r
-    userDefinedColour.setText("User Defined...");\r
-    userDefinedColour.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        userDefinedColour_actionPerformed(e);\r
-      }\r
-    });\r
-    PIDColour.setText("Percentage Identity");\r
-    PIDColour.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        PIDColour_actionPerformed(e);\r
-      }\r
-    });\r
-    BLOSUM62Colour.setText("BLOSUM62 Score");\r
-    BLOSUM62Colour.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        BLOSUM62Colour_actionPerformed(e);\r
-      }\r
-    });\r
-    avDistanceTreeBlosumMenuItem.setText("Average Distance Using BLOSUM62...");\r
-    avDistanceTreeBlosumMenuItem.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        avTreeBlosumMenuItem_actionPerformed(e);\r
-      }\r
-    });\r
-    njTreeBlosumMenuItem.setText("Neighbour Joining using BLOSUM62...");\r
-    njTreeBlosumMenuItem.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        njTreeBlosumMenuItem_actionPerformed(e);\r
-      }\r
-    });\r
-    annotationPanelMenuItem.setActionCommand("");\r
-    annotationPanelMenuItem.setText("Show Annotations");\r
-    annotationPanelMenuItem.setState( jalview.gui.Preferences.showAnnotation );\r
-    annotationPanelMenuItem.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        annotationPanelMenuItem_actionPerformed(e);\r
-      }\r
-    });\r
-    colourTextMenuItem.setText("Colour Text");\r
-    colourTextMenuItem.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        colourTextMenuItem_actionPerformed(e);\r
-      }\r
-    });\r
-    htmlMenuItem.setText("HTML");\r
-    htmlMenuItem.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        htmlMenuItem_actionPerformed(e);\r
-      }\r
-    });\r
-    overviewMenuItem.setText("Overview Window...");\r
-    overviewMenuItem.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        overviewMenuItem_actionPerformed(e);\r
-      }\r
-    });\r
-    undoMenuItem.setEnabled(false);\r
-    undoMenuItem.setMnemonic('Z');\r
-    undoMenuItem.setText("Undo");\r
-    undoMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.\r
-        event.KeyEvent.VK_Z, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false));\r
-    undoMenuItem.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        undoMenuItem_actionPerformed(e);\r
-      }\r
-    });\r
-    redoMenuItem.setEnabled(false);\r
-    redoMenuItem.setMnemonic('0');\r
-    redoMenuItem.setText("Redo");\r
-    redoMenuItem.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        redoMenuItem_actionPerformed(e);\r
-      }\r
-    });\r
-    conservationMenuItem.setText("By Conservation");\r
-    conservationMenuItem.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        conservationMenuItem_actionPerformed(e);\r
-      }\r
-    });\r
-    noColourmenuItem.setText("None");\r
-    noColourmenuItem.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        noColourmenuItem_actionPerformed(e);\r
-      }\r
-    });\r
-    wrapMenuItem.setText("Wrap");\r
-    wrapMenuItem.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        wrapMenuItem_actionPerformed(e);\r
-      }\r
-    });\r
-    printMenuItem.setText("Print");\r
-    printMenuItem.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        printMenuItem_actionPerformed(e);\r
-      }\r
-    });\r
-    renderGapsMenuItem.setText("Show Gaps");\r
-    renderGapsMenuItem.setState(true);\r
-    renderGapsMenuItem.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        renderGapsMenuItem_actionPerformed(e);\r
-      }\r
-    });\r
-    findMenuItem.setText("Find...");\r
-    findMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.\r
-        event.KeyEvent.VK_F, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false));\r
-    findMenuItem.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        findMenuItem_actionPerformed(e);\r
-      }\r
-    });\r
-    searchMenu.setText("Search");\r
-\r
-    abovePIDThreshold.setText("Above Identity Threshold");\r
-    abovePIDThreshold.addActionListener(new java.awt.event.ActionListener() {\r
-      public void actionPerformed(ActionEvent e) {\r
-        abovePIDThreshold_actionPerformed(e);\r
-      }\r
-    });\r
-    sequenceFeatures.setText("Sequence Features");\r
-    sequenceFeatures.addActionListener(new ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent actionEvent)\r
-      {\r
-        sequenceFeatures_actionPerformed(actionEvent);\r
-      }\r
-    });\r
-    nucleotideColour.setText("Nucleotide");\r
-    nucleotideColour.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        nucleotideColour_actionPerformed(e);\r
-      }\r
-    });\r
-    deleteGroups.setText("Undefine groups");\r
-    deleteGroups.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        deleteGroups_actionPerformed(e);\r
-      }\r
-    });\r
-    copy.setText("Copy");\r
-    copy.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.\r
-        KeyEvent.VK_C, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false));\r
-    copy.setMnemonic(KeyEvent.VK_C);\r
-\r
-    copy.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        copy_actionPerformed(e);\r
-      }\r
-    });\r
-    cut.setText("Cut");\r
-    cut.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.\r
-        KeyEvent.VK_X, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false));\r
-    cut.setMnemonic(KeyEvent.VK_X);\r
-    cut.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        cut_actionPerformed(e);\r
-      }\r
-    });\r
-    delete.setText("Delete");\r
-    delete.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        delete_actionPerformed(e);\r
-      }\r
-    });\r
-    jMenu1.setMnemonic('V');\r
-    jMenu1.setText("Paste");\r
-    pasteNew.setText("To New Alignment");\r
-    pasteNew.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.\r
-        KeyEvent.VK_V, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false));\r
-    pasteNew.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        pasteNew_actionPerformed(e);\r
-      }\r
-    });\r
-    pasteThis.setText("Add To This Alignment");\r
-    pasteThis.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        pasteThis_actionPerformed(e);\r
-      }\r
-    });\r
-    applyToAllGroups.setText("Apply Colour To All Groups");\r
-    applyToAllGroups.setState(true);\r
-    applyToAllGroups.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        applyToAllGroups_actionPerformed(e);\r
-      }\r
-    });\r
-    createPNG.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        createPNG_actionPerformed(e);\r
-      }\r
-    });\r
-    createPNG.setActionCommand("Save As PNG Image");\r
-    createPNG.setText("PNG");\r
-    font.setText("Font...");\r
-    font.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        font_actionPerformed(e);\r
-      }\r
-    });\r
-    fullSeqId.setText("Show Full Sequence ID");\r
-    fullSeqId.setState(true);\r
-    fullSeqId.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        fullSeqId_actionPerformed(e);\r
-      }\r
-    });\r
-    epsFile.setText("EPS");\r
-    epsFile.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        epsFile_actionPerformed(e);\r
-      }\r
-    });\r
-    LoadtreeMenuItem.setActionCommand("Load a tree for this sequence set");\r
-    LoadtreeMenuItem.setText("Load Assocated Tree");\r
-    LoadtreeMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        LoadtreeMenuItem_actionPerformed(e);\r
-      }\r
-    });\r
-    jpred.setText("JPred...");\r
-    jpred.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        jpred_actionPerformed(e);\r
-      }\r
-    });\r
-    scaleAbove.setVisible(false);\r
-    scaleAbove.setText("Scale Above");\r
-    scaleAbove.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        scaleAbove_actionPerformed(e);\r
-      }\r
-    });\r
-    scaleLeft.setVisible(false);\r
-    scaleLeft.setSelected(true);\r
-    scaleLeft.setText("Scale Left");\r
-    scaleLeft.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        scaleLeft_actionPerformed(e);\r
-      }\r
-    });\r
-    scaleRight.setVisible(false);\r
-    scaleRight.setSelected(true);\r
-    scaleRight.setText("Scale Right");\r
-    scaleRight.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        scaleRight_actionPerformed(e);\r
-      }\r
-    });\r
-    modifyPID.setText("Modify Identity Threshold...");\r
-    modifyPID.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        modifyPID_actionPerformed(e);\r
-      }\r
-    });\r
-    modifyConservation.setText("Modify Conservation Threshold...");\r
-    modifyConservation.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        modifyConservation_actionPerformed(e);\r
-      }\r
-    });\r
-    sortByTreeMenu.setText("By Tree Order");\r
-    sort.setText("Sort");\r
-    calculate.setText("Calculate Tree");\r
-    msaAlignMenuItem.setText("Muscle Alignment...");\r
-    msaAlignMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
-      public void actionPerformed(ActionEvent e) {\r
-        msaAlignMenuItem_actionPerformed(e);\r
-      }\r
-    });\r
-    jMenu2.setText("Export");\r
-    padGapsMenuitem.setText("Pad Gaps");\r
-    padGapsMenuitem.addActionListener(new ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        padGapsMenuitem_actionPerformed(e);\r
-      }\r
-    });\r
-    ClustalRealign.setText("Clustal Realign...");\r
-    ClustalRealign.addActionListener(new ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        ClustalRealign_actionPerformed(e);\r
-      }\r
-    });\r
-    alignFrameMenuBar.add(fileMenu);\r
-    alignFrameMenuBar.add(editMenu);\r
-    alignFrameMenuBar.add(searchMenu);\r
-    alignFrameMenuBar.add(viewMenu);\r
-    alignFrameMenuBar.add(colourMenu);\r
-    alignFrameMenuBar.add(calculateMenu);\r
-    fileMenu.add(saveAlignmentMenu);\r
-    fileMenu.add(jMenu2);\r
-    fileMenu.add(outputTextboxMenu);\r
-    fileMenu.add(printMenuItem);\r
-    fileMenu.addSeparator();\r
-    fileMenu.add(LoadtreeMenuItem);\r
-    fileMenu.addSeparator();\r
-    fileMenu.add(closeMenuItem);\r
-    editMenu.add(undoMenuItem);\r
-    editMenu.add(redoMenuItem);\r
-    editMenu.add(cut);\r
-    editMenu.add(copy);\r
-    editMenu.add(jMenu1);\r
-    editMenu.add(delete);\r
-    editMenu.addSeparator();\r
-    editMenu.add(selectAllSequenceMenuItem);\r
-    editMenu.add(deselectAllSequenceMenuItem);\r
-    editMenu.add(invertSequenceMenuItem);\r
-    editMenu.add(deleteGroups);\r
-    editMenu.addSeparator();\r
-    editMenu.add(remove2LeftMenuItem);\r
-    editMenu.add(remove2RightMenuItem);\r
-    editMenu.add(removeGappedColumnMenuItem);\r
-    editMenu.add(removeAllGapsMenuItem);\r
-    editMenu.add(removeRedundancyMenuItem);\r
-    editMenu.addSeparator();\r
-    editMenu.add(padGapsMenuitem);\r
-    searchMenu.add(findMenuItem);\r
-    viewMenu.add(font);\r
-    viewMenu.addSeparator();\r
-    viewMenu.add(wrapMenuItem);\r
-    viewMenu.add(fullSeqId);\r
-    viewMenu.add(scaleAbove);\r
-    viewMenu.add(scaleLeft);\r
-    viewMenu.add(scaleRight);\r
-    viewMenu.add(viewBoxesMenuItem);\r
-    viewMenu.add(viewTextMenuItem);\r
-    viewMenu.add(colourTextMenuItem);\r
-    viewMenu.add(renderGapsMenuItem);\r
-    viewMenu.add(annotationPanelMenuItem);\r
-    viewMenu.add(sequenceFeatures);\r
-    viewMenu.addSeparator();\r
-    viewMenu.add(overviewMenuItem);\r
-    colourMenu.add(applyToAllGroups);\r
-    colourMenu.addSeparator();\r
-    colourMenu.add(noColourmenuItem);\r
-    colourMenu.add(clustalColour);\r
-    colourMenu.add(BLOSUM62Colour);\r
-    colourMenu.add(PIDColour);\r
-    colourMenu.add(zappoColour);\r
-    colourMenu.add(taylorColour);\r
-    colourMenu.add(hydrophobicityColour);\r
-    colourMenu.add(helixColour);\r
-    colourMenu.add(strandColour);\r
-    colourMenu.add(turnColour);\r
-    colourMenu.add(buriedColour);\r
-    colourMenu.add(nucleotideColour);\r
-    colourMenu.add(userDefinedColour);\r
-    colourMenu.addSeparator();\r
-    colourMenu.add(conservationMenuItem);\r
-    colourMenu.add(modifyConservation);\r
-    colourMenu.add(abovePIDThreshold);\r
-    colourMenu.add(modifyPID);\r
-    calculateMenu.add(sort);\r
-    calculateMenu.add(calculate);\r
-    calculateMenu.addSeparator();\r
-    calculateMenu.add(pairwiseAlignmentMenuItem);\r
-    calculateMenu.add(PCAMenuItem);\r
-    calculateMenu.addSeparator();\r
-    calculateMenu.add(webService);\r
-    webService.add(clustalAlignMenuItem);\r
-    webService.add(msaAlignMenuItem);\r
-    webService.add(jpred);\r
-    webService.add(ClustalRealign);\r
-    this.getContentPane().add(statusBar, BorderLayout.SOUTH);\r
-    jMenu1.add(pasteNew);\r
-    jMenu1.add(pasteThis);\r
-    sort.add(sortIDMenuItem);\r
-    sort.add(sortGroupMenuItem);\r
-    sort.add(sortPairwiseMenuItem);\r
-    calculate.add(averageDistanceTreeMenuItem);\r
-    calculate.add(neighbourTreeMenuItem);\r
-    calculate.add(avDistanceTreeBlosumMenuItem);\r
-    calculate.add(njTreeBlosumMenuItem);\r
-    jMenu2.add(htmlMenuItem);\r
-    jMenu2.add(epsFile);\r
-    jMenu2.add(createPNG);\r
-  }\r
-\r
-  protected void outputText_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-  protected void htmlMenuItem_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-\r
-  protected void closeMenuItem_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-  protected void redoMenuItem_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-  protected void undoMenuItem_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-\r
-  protected void selectAllSequenceMenuItem_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-  protected void deselectAllSequenceMenuItem_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-  protected void invertSequenceMenuItem_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-  protected void remove2LeftMenuItem_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-  protected void remove2RightMenuItem_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-  protected void removeGappedColumnMenuItem_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-  protected void removeAllGapsMenuItem_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-\r
-  protected void wrapMenuItem_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-\r
-  protected void viewBoxesMenuItem_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-  protected void viewTextMenuItem_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-\r
-  protected void colourTextMenuItem_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-  protected void annotationPanelMenuItem_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-  protected void overviewMenuItem_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-  protected void sortPairwiseMenuItem_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-  protected void sortIDMenuItem_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-  protected void sortGroupMenuItem_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-\r
-  protected void removeRedundancyMenuItem_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-  protected void pairwiseAlignmentMenuItem_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-  protected void PCAMenuItem_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-  protected void averageDistanceTreeMenuItem_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-  protected void neighbourTreeMenuItem_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-\r
-  protected void njTreeBlosumMenuItem_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-  protected void avTreeBlosumMenuItem_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-\r
-\r
-  protected void clustalAlignMenuItem_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-\r
-\r
-\r
-  protected void clustalColour_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-  protected void zappoColour_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-  protected void taylorColour_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-\r
-  protected void hydrophobicityColour_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-  protected void helixColour_actionPerformed(ActionEvent e)\r
-  {\r
 \r
-  }\r
-\r
-  protected void strandColour_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
+import jalview.schemes.ColourSchemeProperty;\r
 \r
-  protected void turnColour_actionPerformed(ActionEvent e)\r
-  {\r
+import java.awt.*;\r
+import java.awt.event.*;\r
 \r
-  }\r
+import javax.swing.*;\r
+import javax.swing.event.AncestorEvent;\r
+import javax.swing.event.AncestorListener;\r
 \r
-  protected void buriedColour_actionPerformed(ActionEvent e)\r
-  {\r
 \r
-  }\r
+public class GAlignFrame extends JInternalFrame {\r
+    protected JMenuBar alignFrameMenuBar = new JMenuBar();\r
+    protected JMenu fileMenu = new JMenu();\r
+    protected JMenuItem closeMenuItem = new JMenuItem();\r
+    protected JMenu editMenu = new JMenu();\r
+    protected JMenu viewMenu = new JMenu();\r
+    protected JMenu colourMenu = new JMenu();\r
+    protected JMenu calculateMenu = new JMenu();\r
+    protected JMenu webService = new JMenu();\r
+    protected JMenuItem selectAllSequenceMenuItem = new JMenuItem();\r
+    protected JMenuItem deselectAllSequenceMenuItem = new JMenuItem();\r
+    protected JMenuItem invertSequenceMenuItem = new JMenuItem();\r
+    protected JMenuItem remove2LeftMenuItem = new JMenuItem();\r
+    protected JMenuItem remove2RightMenuItem = new JMenuItem();\r
+    protected JMenuItem removeGappedColumnMenuItem = new JMenuItem();\r
+    protected JMenuItem removeAllGapsMenuItem = new JMenuItem();\r
+    protected JCheckBoxMenuItem viewBoxesMenuItem = new JCheckBoxMenuItem();\r
+    protected JCheckBoxMenuItem viewTextMenuItem = new JCheckBoxMenuItem();\r
+    protected JMenuItem sortPairwiseMenuItem = new JMenuItem();\r
+    protected JMenuItem sortIDMenuItem = new JMenuItem();\r
+    protected JMenuItem sortGroupMenuItem = new JMenuItem();\r
+    protected JMenuItem removeRedundancyMenuItem = new JMenuItem();\r
+    protected JMenuItem pairwiseAlignmentMenuItem = new JMenuItem();\r
+    protected JMenuItem PCAMenuItem = new JMenuItem();\r
+    protected JMenuItem averageDistanceTreeMenuItem = new JMenuItem();\r
+    protected JMenuItem neighbourTreeMenuItem = new JMenuItem();\r
+    protected JMenuItem clustalAlignMenuItem = new JMenuItem();\r
+    BorderLayout borderLayout1 = new BorderLayout();\r
+    public JLabel statusBar = new JLabel();\r
+    protected JMenuItem saveAlignmentMenu = new JMenuItem();\r
+    protected JMenu outputTextboxMenu = new JMenu();\r
+    protected JRadioButtonMenuItem clustalColour = new JRadioButtonMenuItem();\r
+    protected JRadioButtonMenuItem zappoColour = new JRadioButtonMenuItem();\r
+    protected JRadioButtonMenuItem taylorColour = new JRadioButtonMenuItem();\r
+    protected JRadioButtonMenuItem hydrophobicityColour = new JRadioButtonMenuItem();\r
+    protected JRadioButtonMenuItem helixColour = new JRadioButtonMenuItem();\r
+    protected JRadioButtonMenuItem strandColour = new JRadioButtonMenuItem();\r
+    protected JRadioButtonMenuItem turnColour = new JRadioButtonMenuItem();\r
+    protected JRadioButtonMenuItem buriedColour = new JRadioButtonMenuItem();\r
+    protected JRadioButtonMenuItem userDefinedColour = new JRadioButtonMenuItem();\r
+    protected JRadioButtonMenuItem PIDColour = new JRadioButtonMenuItem();\r
+    protected JRadioButtonMenuItem BLOSUM62Colour = new JRadioButtonMenuItem();\r
+    JMenuItem njTreeBlosumMenuItem = new JMenuItem();\r
+    JMenuItem avDistanceTreeBlosumMenuItem = new JMenuItem();\r
+    protected JCheckBoxMenuItem annotationPanelMenuItem = new JCheckBoxMenuItem();\r
+    protected JCheckBoxMenuItem colourTextMenuItem = new JCheckBoxMenuItem();\r
+    JMenuItem htmlMenuItem = new JMenuItem();\r
+    JMenuItem overviewMenuItem = new JMenuItem();\r
+    protected JMenuItem undoMenuItem = new JMenuItem();\r
+    protected JMenuItem redoMenuItem = new JMenuItem();\r
+    protected JCheckBoxMenuItem conservationMenuItem = new JCheckBoxMenuItem();\r
+    JRadioButtonMenuItem noColourmenuItem = new JRadioButtonMenuItem();\r
+    protected JCheckBoxMenuItem wrapMenuItem = new JCheckBoxMenuItem();\r
+    JMenuItem printMenuItem = new JMenuItem();\r
+    protected JCheckBoxMenuItem renderGapsMenuItem = new JCheckBoxMenuItem();\r
+    JMenuItem findMenuItem = new JMenuItem();\r
+    JMenu searchMenu = new JMenu();\r
+    protected JCheckBoxMenuItem abovePIDThreshold = new JCheckBoxMenuItem();\r
+    protected JCheckBoxMenuItem sequenceFeatures = new JCheckBoxMenuItem();\r
+    protected JRadioButtonMenuItem nucleotideColour = new JRadioButtonMenuItem();\r
+    JMenuItem deleteGroups = new JMenuItem();\r
+    JMenuItem delete = new JMenuItem();\r
+    JMenuItem copy = new JMenuItem();\r
+    JMenuItem cut = new JMenuItem();\r
+    JMenu jMenu1 = new JMenu();\r
+    JMenuItem pasteNew = new JMenuItem();\r
+    JMenuItem pasteThis = new JMenuItem();\r
+    protected JCheckBoxMenuItem applyToAllGroups = new JCheckBoxMenuItem();\r
+    JMenuItem createPNG = new JMenuItem();\r
+    protected JMenuItem font = new JMenuItem();\r
+    protected JCheckBoxMenuItem fullSeqId = new JCheckBoxMenuItem();\r
+    JMenuItem epsFile = new JMenuItem();\r
+    JMenuItem LoadtreeMenuItem = new JMenuItem();\r
+    JMenuItem jpred = new JMenuItem();\r
+    protected JCheckBoxMenuItem scaleAbove = new JCheckBoxMenuItem();\r
+    protected JCheckBoxMenuItem scaleLeft = new JCheckBoxMenuItem();\r
+    protected JCheckBoxMenuItem scaleRight = new JCheckBoxMenuItem();\r
+    JMenuItem modifyPID = new JMenuItem();\r
+    JMenuItem modifyConservation = new JMenuItem();\r
+    protected JMenu sortByTreeMenu = new JMenu();\r
+    protected JMenu sort = new JMenu();\r
+    JMenu calculate = new JMenu();\r
+    JMenuItem msaAlignMenuItem = new JMenuItem();\r
+    JMenu jMenu2 = new JMenu();\r
+    JMenuItem padGapsMenuitem = new JMenuItem();\r
+    JMenuItem ClustalRealign = new JMenuItem();\r
+\r
+    public GAlignFrame() {\r
+        ButtonGroup colours = new ButtonGroup();\r
+        colours.add(noColourmenuItem);\r
+        colours.add(clustalColour);\r
+        colours.add(zappoColour);\r
+        colours.add(taylorColour);\r
+        colours.add(hydrophobicityColour);\r
+        colours.add(helixColour);\r
+        colours.add(strandColour);\r
+        colours.add(turnColour);\r
+        colours.add(buriedColour);\r
+        colours.add(userDefinedColour);\r
+        colours.add(PIDColour);\r
+        colours.add(BLOSUM62Colour);\r
+        colours.add(nucleotideColour);\r
+\r
+        noColourmenuItem.setSelected(true);\r
+\r
+        String defaultColour = Preferences.defaultColour;\r
+\r
+        if (defaultColour != null) {\r
+            int index = ColourSchemeProperty.getColourIndexFromName(defaultColour);\r
+\r
+            switch (index) {\r
+            case ColourSchemeProperty.CLUSTAL:\r
+                clustalColour.setSelected(true);\r
+\r
+                break;\r
+\r
+            case ColourSchemeProperty.BLOSUM:\r
+                BLOSUM62Colour.setSelected(true);\r
+\r
+                break;\r
+\r
+            case ColourSchemeProperty.PID:\r
+                PIDColour.setSelected(true);\r
+\r
+                break;\r
+\r
+            case ColourSchemeProperty.ZAPPO:\r
+                zappoColour.setSelected(true);\r
+\r
+                break;\r
+\r
+            case ColourSchemeProperty.HYDROPHOBIC:\r
+                hydrophobicityColour.setSelected(true);\r
+\r
+                break;\r
+\r
+            case ColourSchemeProperty.HELIX:\r
+                helixColour.setSelected(true);\r
+\r
+                break;\r
+\r
+            case ColourSchemeProperty.STRAND:\r
+                strandColour.setSelected(true);\r
+\r
+                break;\r
+\r
+            case ColourSchemeProperty.TURN:\r
+                turnColour.setSelected(true);\r
+\r
+                break;\r
+\r
+            case ColourSchemeProperty.BURIED:\r
+                buriedColour.setSelected(true);\r
+\r
+                break;\r
+\r
+            case ColourSchemeProperty.NUCLEOTIDE:\r
+                nucleotideColour.setSelected(true);\r
+\r
+                break;\r
+\r
+            case ColourSchemeProperty.USER_DEFINED:\r
+                userDefinedColour.setSelected(true);\r
+\r
+                break;\r
+            }\r
+        }\r
 \r
+        try {\r
+            jbInit();\r
+            setJMenuBar(alignFrameMenuBar);\r
 \r
+            JMenuItem item;\r
 \r
-  protected void userDefinedColour_actionPerformed(ActionEvent e)\r
-  {\r
+            // dynamically fill save as menu with available formats\r
+            for (int i = 0; i < jalview.io.FormatAdapter.formats.size(); i++) {\r
+                item = new JMenuItem((String) jalview.io.FormatAdapter.formats.elementAt(\r
+                            i));\r
+                item.addActionListener(new java.awt.event.ActionListener() {\r
+                        public void actionPerformed(ActionEvent e) {\r
+                            outputText_actionPerformed(e);\r
+                        }\r
+                    });\r
 \r
-  }\r
+                outputTextboxMenu.add(item);\r
+            }\r
+        } catch (Exception e) {\r
+            e.printStackTrace();\r
+        }\r
+    }\r
 \r
-  protected void PIDColour_actionPerformed(ActionEvent e)\r
-  {\r
+    private void jbInit() throws Exception {\r
+        fileMenu.setMnemonic('F');\r
+        fileMenu.setText("File");\r
+        saveAlignmentMenu.setMnemonic('L');\r
+        saveAlignmentMenu.setText("Save As");\r
+        saveAlignmentMenu.addActionListener(new ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    saveAlignmentMenu_actionPerformed(e);\r
+                }\r
+            });\r
+        closeMenuItem.setMnemonic('C');\r
+        closeMenuItem.setText("Close");\r
+        closeMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    closeMenuItem_actionPerformed(e);\r
+                }\r
+            });\r
+        editMenu.setText("Edit");\r
+        viewMenu.setText("View");\r
+        colourMenu.setText("Colour");\r
+        calculateMenu.setText("Calculate");\r
+        webService.setText("Web Service");\r
+        selectAllSequenceMenuItem.setText("Select all");\r
+        selectAllSequenceMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(\r
+                java.awt.event.KeyEvent.VK_A,\r
+                Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false));\r
+        selectAllSequenceMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    selectAllSequenceMenuItem_actionPerformed(e);\r
+                }\r
+            });\r
+        deselectAllSequenceMenuItem.setText("Deselect All");\r
+        deselectAllSequenceMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(\r
+                java.awt.event.KeyEvent.VK_ESCAPE, 0, false));\r
+        deselectAllSequenceMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    deselectAllSequenceMenuItem_actionPerformed(e);\r
+                }\r
+            });\r
+        invertSequenceMenuItem.setText("Invert Selection");\r
+        invertSequenceMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    invertSequenceMenuItem_actionPerformed(e);\r
+                }\r
+            });\r
+        remove2LeftMenuItem.setText("Remove Left");\r
+        remove2LeftMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    remove2LeftMenuItem_actionPerformed(e);\r
+                }\r
+            });\r
+        remove2RightMenuItem.setText("Remove Right");\r
+        remove2RightMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    remove2RightMenuItem_actionPerformed(e);\r
+                }\r
+            });\r
+        removeGappedColumnMenuItem.setText("Remove Empty Columns");\r
+        removeGappedColumnMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    removeGappedColumnMenuItem_actionPerformed(e);\r
+                }\r
+            });\r
+        removeAllGapsMenuItem.setText("Remove All Gaps");\r
+        removeAllGapsMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    removeAllGapsMenuItem_actionPerformed(e);\r
+                }\r
+            });\r
+        viewBoxesMenuItem.setText("Boxes");\r
+        viewBoxesMenuItem.setState(true);\r
+        viewBoxesMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    viewBoxesMenuItem_actionPerformed(e);\r
+                }\r
+            });\r
+        viewTextMenuItem.setText("Text");\r
+        viewTextMenuItem.setState(true);\r
+        viewTextMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    viewTextMenuItem_actionPerformed(e);\r
+                }\r
+            });\r
+        sortPairwiseMenuItem.setText("by Pairwise Identity");\r
+        sortPairwiseMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    sortPairwiseMenuItem_actionPerformed(e);\r
+                }\r
+            });\r
+        sortIDMenuItem.setText("by ID");\r
+        sortIDMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    sortIDMenuItem_actionPerformed(e);\r
+                }\r
+            });\r
+        sortGroupMenuItem.setText("by Group");\r
+        sortGroupMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    sortGroupMenuItem_actionPerformed(e);\r
+                }\r
+            });\r
+        removeRedundancyMenuItem.setText("Remove Redundancy...");\r
+        removeRedundancyMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    removeRedundancyMenuItem_actionPerformed(e);\r
+                }\r
+            });\r
+        pairwiseAlignmentMenuItem.setText("Pairwise Alignments...");\r
+        pairwiseAlignmentMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    pairwiseAlignmentMenuItem_actionPerformed(e);\r
+                }\r
+            });\r
+        PCAMenuItem.setText("Principal Component Analysis...");\r
+        PCAMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    PCAMenuItem_actionPerformed(e);\r
+                }\r
+            });\r
+        averageDistanceTreeMenuItem.setText(\r
+            "Average Distance Using % Identity...");\r
+        averageDistanceTreeMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    averageDistanceTreeMenuItem_actionPerformed(e);\r
+                }\r
+            });\r
+        neighbourTreeMenuItem.setText("Neighbour Joining Using % Identity...");\r
+        neighbourTreeMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    neighbourTreeMenuItem_actionPerformed(e);\r
+                }\r
+            });\r
+        clustalAlignMenuItem.setText("Clustal Alignment...");\r
+        clustalAlignMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    clustalAlignMenuItem_actionPerformed(e);\r
+                }\r
+            });\r
+        this.getContentPane().setLayout(borderLayout1);\r
+        alignFrameMenuBar.setFont(new java.awt.Font("Verdana", 0, 11));\r
+        alignFrameMenuBar.addAncestorListener(new AncestorListener() {\r
+                public void ancestorAdded(AncestorEvent event) {\r
+                    alignFrameMenuBar_ancestorAdded(event);\r
+                }\r
+\r
+                public void ancestorRemoved(AncestorEvent event) {\r
+                }\r
+\r
+                public void ancestorMoved(AncestorEvent event) {\r
+                }\r
+            });\r
+        statusBar.setBackground(Color.white);\r
+        statusBar.setFont(new java.awt.Font("Verdana", 0, 11));\r
+        statusBar.setBorder(BorderFactory.createLineBorder(Color.black));\r
+        statusBar.setText("Status bar");\r
+        outputTextboxMenu.setMnemonic('T');\r
+        outputTextboxMenu.setText("Output to Textbox");\r
+        clustalColour.setText("Clustalx");\r
+\r
+        clustalColour.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    clustalColour_actionPerformed(e);\r
+                }\r
+            });\r
+        zappoColour.setText("Zappo");\r
+        zappoColour.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    zappoColour_actionPerformed(e);\r
+                }\r
+            });\r
+        taylorColour.setText("Taylor");\r
+        taylorColour.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    taylorColour_actionPerformed(e);\r
+                }\r
+            });\r
+        hydrophobicityColour.setText("Hydrophobicity");\r
+        hydrophobicityColour.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    hydrophobicityColour_actionPerformed(e);\r
+                }\r
+            });\r
+        helixColour.setText("Helix Propensity");\r
+        helixColour.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    helixColour_actionPerformed(e);\r
+                }\r
+            });\r
+        strandColour.setText("Strand Propensity");\r
+        strandColour.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    strandColour_actionPerformed(e);\r
+                }\r
+            });\r
+        turnColour.setText("Turn Propensity");\r
+        turnColour.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    turnColour_actionPerformed(e);\r
+                }\r
+            });\r
+        buriedColour.setText("Buried Index");\r
+        buriedColour.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    buriedColour_actionPerformed(e);\r
+                }\r
+            });\r
+        userDefinedColour.setText("User Defined...");\r
+        userDefinedColour.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    userDefinedColour_actionPerformed(e);\r
+                }\r
+            });\r
+        PIDColour.setText("Percentage Identity");\r
+        PIDColour.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    PIDColour_actionPerformed(e);\r
+                }\r
+            });\r
+        BLOSUM62Colour.setText("BLOSUM62 Score");\r
+        BLOSUM62Colour.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    BLOSUM62Colour_actionPerformed(e);\r
+                }\r
+            });\r
+        avDistanceTreeBlosumMenuItem.setText(\r
+            "Average Distance Using BLOSUM62...");\r
+        avDistanceTreeBlosumMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    avTreeBlosumMenuItem_actionPerformed(e);\r
+                }\r
+            });\r
+        njTreeBlosumMenuItem.setText("Neighbour Joining using BLOSUM62...");\r
+        njTreeBlosumMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    njTreeBlosumMenuItem_actionPerformed(e);\r
+                }\r
+            });\r
+        annotationPanelMenuItem.setActionCommand("");\r
+        annotationPanelMenuItem.setText("Show Annotations");\r
+        annotationPanelMenuItem.setState(jalview.gui.Preferences.showAnnotation);\r
+        annotationPanelMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    annotationPanelMenuItem_actionPerformed(e);\r
+                }\r
+            });\r
+        colourTextMenuItem.setText("Colour Text");\r
+        colourTextMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    colourTextMenuItem_actionPerformed(e);\r
+                }\r
+            });\r
+        htmlMenuItem.setText("HTML");\r
+        htmlMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    htmlMenuItem_actionPerformed(e);\r
+                }\r
+            });\r
+        overviewMenuItem.setText("Overview Window...");\r
+        overviewMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    overviewMenuItem_actionPerformed(e);\r
+                }\r
+            });\r
+        undoMenuItem.setEnabled(false);\r
+        undoMenuItem.setMnemonic('Z');\r
+        undoMenuItem.setText("Undo");\r
+        undoMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(\r
+                java.awt.event.KeyEvent.VK_Z,\r
+                Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false));\r
+        undoMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    undoMenuItem_actionPerformed(e);\r
+                }\r
+            });\r
+        redoMenuItem.setEnabled(false);\r
+        redoMenuItem.setMnemonic('0');\r
+        redoMenuItem.setText("Redo");\r
+        redoMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    redoMenuItem_actionPerformed(e);\r
+                }\r
+            });\r
+        conservationMenuItem.setText("By Conservation");\r
+        conservationMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    conservationMenuItem_actionPerformed(e);\r
+                }\r
+            });\r
+        noColourmenuItem.setText("None");\r
+        noColourmenuItem.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    noColourmenuItem_actionPerformed(e);\r
+                }\r
+            });\r
+        wrapMenuItem.setText("Wrap");\r
+        wrapMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    wrapMenuItem_actionPerformed(e);\r
+                }\r
+            });\r
+        printMenuItem.setText("Print");\r
+        printMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    printMenuItem_actionPerformed(e);\r
+                }\r
+            });\r
+        renderGapsMenuItem.setText("Show Gaps");\r
+        renderGapsMenuItem.setState(true);\r
+        renderGapsMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    renderGapsMenuItem_actionPerformed(e);\r
+                }\r
+            });\r
+        findMenuItem.setText("Find...");\r
+        findMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(\r
+                java.awt.event.KeyEvent.VK_F,\r
+                Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false));\r
+        findMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    findMenuItem_actionPerformed(e);\r
+                }\r
+            });\r
+        searchMenu.setText("Search");\r
+\r
+        abovePIDThreshold.setText("Above Identity Threshold");\r
+        abovePIDThreshold.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    abovePIDThreshold_actionPerformed(e);\r
+                }\r
+            });\r
+        sequenceFeatures.setText("Sequence Features");\r
+        sequenceFeatures.addActionListener(new ActionListener() {\r
+                public void actionPerformed(ActionEvent actionEvent) {\r
+                    sequenceFeatures_actionPerformed(actionEvent);\r
+                }\r
+            });\r
+        nucleotideColour.setText("Nucleotide");\r
+        nucleotideColour.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    nucleotideColour_actionPerformed(e);\r
+                }\r
+            });\r
+        deleteGroups.setText("Undefine groups");\r
+        deleteGroups.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    deleteGroups_actionPerformed(e);\r
+                }\r
+            });\r
+        copy.setText("Copy");\r
+        copy.setAccelerator(javax.swing.KeyStroke.getKeyStroke(\r
+                java.awt.event.KeyEvent.VK_C,\r
+                Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false));\r
+        copy.setMnemonic(KeyEvent.VK_C);\r
+\r
+        copy.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    copy_actionPerformed(e);\r
+                }\r
+            });\r
+        cut.setText("Cut");\r
+        cut.setAccelerator(javax.swing.KeyStroke.getKeyStroke(\r
+                java.awt.event.KeyEvent.VK_X,\r
+                Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false));\r
+        cut.setMnemonic(KeyEvent.VK_X);\r
+        cut.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    cut_actionPerformed(e);\r
+                }\r
+            });\r
+        delete.setText("Delete");\r
+        delete.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    delete_actionPerformed(e);\r
+                }\r
+            });\r
+        jMenu1.setMnemonic('V');\r
+        jMenu1.setText("Paste");\r
+        pasteNew.setText("To New Alignment");\r
+        pasteNew.setAccelerator(javax.swing.KeyStroke.getKeyStroke(\r
+                java.awt.event.KeyEvent.VK_V,\r
+                Toolkit.getDefaultToolkit().getMenuShortcutKeyMask(), false));\r
+        pasteNew.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    pasteNew_actionPerformed(e);\r
+                }\r
+            });\r
+        pasteThis.setText("Add To This Alignment");\r
+        pasteThis.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    pasteThis_actionPerformed(e);\r
+                }\r
+            });\r
+        applyToAllGroups.setText("Apply Colour To All Groups");\r
+        applyToAllGroups.setState(true);\r
+        applyToAllGroups.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    applyToAllGroups_actionPerformed(e);\r
+                }\r
+            });\r
+        createPNG.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    createPNG_actionPerformed(e);\r
+                }\r
+            });\r
+        createPNG.setActionCommand("Save As PNG Image");\r
+        createPNG.setText("PNG");\r
+        font.setText("Font...");\r
+        font.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    font_actionPerformed(e);\r
+                }\r
+            });\r
+        fullSeqId.setText("Show Full Sequence ID");\r
+        fullSeqId.setState(true);\r
+        fullSeqId.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    fullSeqId_actionPerformed(e);\r
+                }\r
+            });\r
+        epsFile.setText("EPS");\r
+        epsFile.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    epsFile_actionPerformed(e);\r
+                }\r
+            });\r
+        LoadtreeMenuItem.setActionCommand("Load a tree for this sequence set");\r
+        LoadtreeMenuItem.setText("Load Assocated Tree");\r
+        LoadtreeMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    LoadtreeMenuItem_actionPerformed(e);\r
+                }\r
+            });\r
+        jpred.setText("JPred...");\r
+        jpred.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    jpred_actionPerformed(e);\r
+                }\r
+            });\r
+        scaleAbove.setVisible(false);\r
+        scaleAbove.setText("Scale Above");\r
+        scaleAbove.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    scaleAbove_actionPerformed(e);\r
+                }\r
+            });\r
+        scaleLeft.setVisible(false);\r
+        scaleLeft.setSelected(true);\r
+        scaleLeft.setText("Scale Left");\r
+        scaleLeft.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    scaleLeft_actionPerformed(e);\r
+                }\r
+            });\r
+        scaleRight.setVisible(false);\r
+        scaleRight.setSelected(true);\r
+        scaleRight.setText("Scale Right");\r
+        scaleRight.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    scaleRight_actionPerformed(e);\r
+                }\r
+            });\r
+        modifyPID.setText("Modify Identity Threshold...");\r
+        modifyPID.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    modifyPID_actionPerformed(e);\r
+                }\r
+            });\r
+        modifyConservation.setText("Modify Conservation Threshold...");\r
+        modifyConservation.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    modifyConservation_actionPerformed(e);\r
+                }\r
+            });\r
+        sortByTreeMenu.setText("By Tree Order");\r
+        sort.setText("Sort");\r
+        calculate.setText("Calculate Tree");\r
+        msaAlignMenuItem.setText("Muscle Alignment...");\r
+        msaAlignMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    msaAlignMenuItem_actionPerformed(e);\r
+                }\r
+            });\r
+        jMenu2.setText("Export");\r
+        padGapsMenuitem.setText("Pad Gaps");\r
+        padGapsMenuitem.addActionListener(new ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    padGapsMenuitem_actionPerformed(e);\r
+                }\r
+            });\r
+        ClustalRealign.setText("Clustal Realign...");\r
+        ClustalRealign.addActionListener(new ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    ClustalRealign_actionPerformed(e);\r
+                }\r
+            });\r
+        alignFrameMenuBar.add(fileMenu);\r
+        alignFrameMenuBar.add(editMenu);\r
+        alignFrameMenuBar.add(searchMenu);\r
+        alignFrameMenuBar.add(viewMenu);\r
+        alignFrameMenuBar.add(colourMenu);\r
+        alignFrameMenuBar.add(calculateMenu);\r
+        fileMenu.add(saveAlignmentMenu);\r
+        fileMenu.add(jMenu2);\r
+        fileMenu.add(outputTextboxMenu);\r
+        fileMenu.add(printMenuItem);\r
+        fileMenu.addSeparator();\r
+        fileMenu.add(LoadtreeMenuItem);\r
+        fileMenu.addSeparator();\r
+        fileMenu.add(closeMenuItem);\r
+        editMenu.add(undoMenuItem);\r
+        editMenu.add(redoMenuItem);\r
+        editMenu.add(cut);\r
+        editMenu.add(copy);\r
+        editMenu.add(jMenu1);\r
+        editMenu.add(delete);\r
+        editMenu.addSeparator();\r
+        editMenu.add(selectAllSequenceMenuItem);\r
+        editMenu.add(deselectAllSequenceMenuItem);\r
+        editMenu.add(invertSequenceMenuItem);\r
+        editMenu.add(deleteGroups);\r
+        editMenu.addSeparator();\r
+        editMenu.add(remove2LeftMenuItem);\r
+        editMenu.add(remove2RightMenuItem);\r
+        editMenu.add(removeGappedColumnMenuItem);\r
+        editMenu.add(removeAllGapsMenuItem);\r
+        editMenu.add(removeRedundancyMenuItem);\r
+        editMenu.addSeparator();\r
+        editMenu.add(padGapsMenuitem);\r
+        searchMenu.add(findMenuItem);\r
+        viewMenu.add(font);\r
+        viewMenu.addSeparator();\r
+        viewMenu.add(wrapMenuItem);\r
+        viewMenu.add(fullSeqId);\r
+        viewMenu.add(scaleAbove);\r
+        viewMenu.add(scaleLeft);\r
+        viewMenu.add(scaleRight);\r
+        viewMenu.add(viewBoxesMenuItem);\r
+        viewMenu.add(viewTextMenuItem);\r
+        viewMenu.add(colourTextMenuItem);\r
+        viewMenu.add(renderGapsMenuItem);\r
+        viewMenu.add(annotationPanelMenuItem);\r
+        viewMenu.add(sequenceFeatures);\r
+        viewMenu.addSeparator();\r
+        viewMenu.add(overviewMenuItem);\r
+        colourMenu.add(applyToAllGroups);\r
+        colourMenu.addSeparator();\r
+        colourMenu.add(noColourmenuItem);\r
+        colourMenu.add(clustalColour);\r
+        colourMenu.add(BLOSUM62Colour);\r
+        colourMenu.add(PIDColour);\r
+        colourMenu.add(zappoColour);\r
+        colourMenu.add(taylorColour);\r
+        colourMenu.add(hydrophobicityColour);\r
+        colourMenu.add(helixColour);\r
+        colourMenu.add(strandColour);\r
+        colourMenu.add(turnColour);\r
+        colourMenu.add(buriedColour);\r
+        colourMenu.add(nucleotideColour);\r
+        colourMenu.add(userDefinedColour);\r
+        colourMenu.addSeparator();\r
+        colourMenu.add(conservationMenuItem);\r
+        colourMenu.add(modifyConservation);\r
+        colourMenu.add(abovePIDThreshold);\r
+        colourMenu.add(modifyPID);\r
+        calculateMenu.add(sort);\r
+        calculateMenu.add(calculate);\r
+        calculateMenu.addSeparator();\r
+        calculateMenu.add(pairwiseAlignmentMenuItem);\r
+        calculateMenu.add(PCAMenuItem);\r
+        calculateMenu.addSeparator();\r
+        calculateMenu.add(webService);\r
+        webService.add(clustalAlignMenuItem);\r
+        webService.add(msaAlignMenuItem);\r
+        webService.add(jpred);\r
+        webService.add(ClustalRealign);\r
+        this.getContentPane().add(statusBar, BorderLayout.SOUTH);\r
+        jMenu1.add(pasteNew);\r
+        jMenu1.add(pasteThis);\r
+        sort.add(sortIDMenuItem);\r
+        sort.add(sortGroupMenuItem);\r
+        sort.add(sortPairwiseMenuItem);\r
+        calculate.add(averageDistanceTreeMenuItem);\r
+        calculate.add(neighbourTreeMenuItem);\r
+        calculate.add(avDistanceTreeBlosumMenuItem);\r
+        calculate.add(njTreeBlosumMenuItem);\r
+        jMenu2.add(htmlMenuItem);\r
+        jMenu2.add(epsFile);\r
+        jMenu2.add(createPNG);\r
+    }\r
 \r
-  }\r
+    protected void outputText_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  protected void BLOSUM62Colour_actionPerformed(ActionEvent e)\r
-  {\r
+    protected void htmlMenuItem_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  }\r
+    protected void closeMenuItem_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
+    protected void redoMenuItem_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  protected void noColourmenuItem_actionPerformed(ActionEvent e)\r
-  {\r
+    protected void undoMenuItem_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  }\r
+    protected void selectAllSequenceMenuItem_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  protected  void conservationMenuItem_actionPerformed(ActionEvent e)\r
-  {\r
+    protected void deselectAllSequenceMenuItem_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  }\r
+    protected void invertSequenceMenuItem_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
+    protected void remove2LeftMenuItem_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  protected void printMenuItem_actionPerformed(ActionEvent e)\r
-  {\r
+    protected void remove2RightMenuItem_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  }\r
+    protected void removeGappedColumnMenuItem_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  protected void renderGapsMenuItem_actionPerformed(ActionEvent e)\r
-  {\r
+    protected void removeAllGapsMenuItem_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  }\r
+    protected void wrapMenuItem_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  protected void findMenuItem_actionPerformed(ActionEvent e)\r
-  {\r
+    protected void viewBoxesMenuItem_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  }\r
+    protected void viewTextMenuItem_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
+    protected void colourTextMenuItem_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  protected void abovePIDThreshold_actionPerformed(ActionEvent e) {\r
+    protected void annotationPanelMenuItem_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  }\r
+    protected void overviewMenuItem_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  public void sequenceFeatures_actionPerformed(ActionEvent actionEvent)\r
-  {\r
+    protected void sortPairwiseMenuItem_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  }\r
+    protected void sortIDMenuItem_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  protected void nucleotideColour_actionPerformed(ActionEvent e)\r
-  {\r
+    protected void sortGroupMenuItem_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  }\r
+    protected void removeRedundancyMenuItem_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  protected void deleteGroups_actionPerformed(ActionEvent e)\r
-  {\r
+    protected void pairwiseAlignmentMenuItem_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  }\r
+    protected void PCAMenuItem_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
- protected void copy_actionPerformed(ActionEvent e)\r
-  {\r
+    protected void averageDistanceTreeMenuItem_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  }\r
+    protected void neighbourTreeMenuItem_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
+    protected void njTreeBlosumMenuItem_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  protected void cut_actionPerformed(ActionEvent e)\r
-  {\r
+    protected void avTreeBlosumMenuItem_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  }\r
+    protected void clustalAlignMenuItem_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  protected void delete_actionPerformed(ActionEvent e)\r
-  {\r
+    protected void clustalColour_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  }\r
+    protected void zappoColour_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  protected void pasteNew_actionPerformed(ActionEvent e)\r
-  {\r
+    protected void taylorColour_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  }\r
+    protected void hydrophobicityColour_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  protected void pasteThis_actionPerformed(ActionEvent e)\r
-  {\r
+    protected void helixColour_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  }\r
+    protected void strandColour_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  protected void applyToAllGroups_actionPerformed(ActionEvent e)\r
-  {\r
+    protected void turnColour_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  }\r
+    protected void buriedColour_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  protected void createPNG_actionPerformed(ActionEvent e)\r
-  {\r
+    protected void userDefinedColour_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  }\r
+    protected void PIDColour_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  protected void font_actionPerformed(ActionEvent e)\r
-  {\r
+    protected void BLOSUM62Colour_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  }\r
+    protected void noColourmenuItem_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  protected void fullSeqId_actionPerformed(ActionEvent e)\r
-  {\r
+    protected void conservationMenuItem_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  }\r
+    protected void printMenuItem_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  protected void epsFile_actionPerformed(ActionEvent e)\r
-  {\r
+    protected void renderGapsMenuItem_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  }\r
+    protected void findMenuItem_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  protected void LoadtreeMenuItem_actionPerformed(ActionEvent e) {\r
+    protected void abovePIDThreshold_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  }\r
+    public void sequenceFeatures_actionPerformed(ActionEvent actionEvent) {\r
+    }\r
 \r
-  protected void jpred_actionPerformed(ActionEvent e)\r
-  {\r
+    protected void nucleotideColour_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  }\r
+    protected void deleteGroups_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  protected void scaleAbove_actionPerformed(ActionEvent e)\r
-  {\r
+    protected void copy_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  }\r
+    protected void cut_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  protected void scaleLeft_actionPerformed(ActionEvent e)\r
-  {\r
+    protected void delete_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  }\r
+    protected void pasteNew_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  protected void scaleRight_actionPerformed(ActionEvent e)\r
-  {\r
+    protected void pasteThis_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  }\r
+    protected void applyToAllGroups_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  protected void modifyPID_actionPerformed(ActionEvent e)\r
-  {\r
+    protected void createPNG_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  }\r
+    protected void font_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  protected void modifyConservation_actionPerformed(ActionEvent e)\r
-  {\r
+    protected void fullSeqId_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  }\r
+    protected void epsFile_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  protected void preferences_actionPerformed(ActionEvent e)\r
-  {\r
+    protected void LoadtreeMenuItem_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  }\r
+    protected void jpred_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  protected void msaAlignMenuItem_actionPerformed(ActionEvent e) {\r
+    protected void scaleAbove_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  }\r
+    protected void scaleLeft_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  protected void alignFrameMenuBar_ancestorAdded(AncestorEvent event)\r
-  {\r
+    protected void scaleRight_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  }\r
+    protected void modifyPID_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  protected void saveAlignmentMenu_actionPerformed(ActionEvent e)\r
-  {\r
+    protected void modifyConservation_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  }\r
+    protected void preferences_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  protected void padGapsMenuitem_actionPerformed(ActionEvent e)\r
-  {\r
+    protected void msaAlignMenuItem_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  }\r
+    protected void alignFrameMenuBar_ancestorAdded(AncestorEvent event) {\r
+    }\r
 \r
-  protected void ClustalRealign_actionPerformed(ActionEvent e)\r
-  {\r
+    protected void saveAlignmentMenu_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  }\r
+    protected void padGapsMenuitem_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
+    protected void ClustalRealign_actionPerformed(ActionEvent e) {\r
+    }\r
 }\r
index fc6fc1e..fc8b8dd 100755 (executable)
 * 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.jbgui;
-
-import java.awt.*;
-import javax.swing.*;
-import javax.swing.border.*;
-
-public class GAlignmentPanel extends JPanel
-{
-  protected JPanel sequenceHolderPanel = new JPanel();
-  protected JScrollBar vscroll = new JScrollBar();
-  protected  JScrollBar hscroll = new JScrollBar();
-  protected JPanel seqPanelHolder = new JPanel();
-  BorderLayout borderLayout1 = new BorderLayout();
-  BorderLayout borderLayout3 = new BorderLayout();
-  protected JPanel scalePanelHolder = new JPanel();
-  protected JPanel idPanelHolder = new JPanel();
-  BorderLayout borderLayout5 = new BorderLayout();
-  protected JPanel idSpaceFillerPanel1 = new JPanel();
-  public JPanel annotationSpaceFillerHolder = new JPanel();
-  BorderLayout borderLayout6 = new BorderLayout();
-  ButtonGroup buttonGroup1 = new ButtonGroup();
-  BorderLayout borderLayout7 = new BorderLayout();
-  JPanel hscrollHolder = new JPanel();
-  BorderLayout borderLayout10 = new BorderLayout();
-  protected JPanel hscrollFillerPanel = new JPanel();
-  BorderLayout borderLayout11 = new BorderLayout();
-  public JScrollPane annotationScroller = new JScrollPane();
-  Border border1;
-  BorderLayout borderLayout4 = new BorderLayout();
-
-  public GAlignmentPanel()
-  {
-    try
-    {
-      jbInit();
-    }
-    catch(Exception e)
-    {
-      e.printStackTrace();
-    }
-  }
-  private void jbInit() throws Exception
-  {
-    border1 = BorderFactory.createLineBorder(Color.gray,1);
-    idPanelHolder.setBorder(null);
-    idPanelHolder.setPreferredSize(new Dimension(70, 10));
-    this.setLayout(borderLayout7);
-    sequenceHolderPanel.setMaximumSize(new Dimension(2147483647, 2147483647));
-    sequenceHolderPanel.setMinimumSize(new Dimension(150, 150));
-    sequenceHolderPanel.setPreferredSize(new Dimension(150, 150));
-    sequenceHolderPanel.setLayout(borderLayout3);
-    seqPanelHolder.setLayout(borderLayout1);
-    scalePanelHolder.setBackground(Color.white);
-    scalePanelHolder.setMinimumSize(new Dimension(10, 80));
-    scalePanelHolder.setPreferredSize(new Dimension(10, 30));
-    scalePanelHolder.setLayout(borderLayout6);
-    idPanelHolder.setLayout(borderLayout5);
-    idSpaceFillerPanel1.setBackground(Color.white);
-    idSpaceFillerPanel1.setPreferredSize(new Dimension(10, 30));
-    idSpaceFillerPanel1.setLayout(borderLayout11);
-    annotationSpaceFillerHolder.setBackground(Color.white);
-    annotationSpaceFillerHolder.setPreferredSize(new Dimension(10, 80));
-    annotationSpaceFillerHolder.setLayout(borderLayout4);
-    hscroll.setOrientation(JScrollBar.HORIZONTAL);
-    hscrollHolder.setLayout(borderLayout10);
-    hscrollFillerPanel.setBackground(Color.white);
-    hscrollFillerPanel.setPreferredSize(new Dimension(70, 10));
-    hscrollHolder.setBackground(Color.white);
-    annotationScroller.setBorder(null);
-    annotationScroller.setPreferredSize(new Dimension(10, 80));
-    this.setPreferredSize(new Dimension(220, 166));
-    this.setRequestFocusEnabled(true);
-    sequenceHolderPanel.add(scalePanelHolder,  BorderLayout.NORTH);
-    sequenceHolderPanel.add(seqPanelHolder,  BorderLayout.CENTER);
-    seqPanelHolder.add(vscroll, BorderLayout.EAST);
-    sequenceHolderPanel.add(annotationScroller, BorderLayout.SOUTH);
-  //  jPanel3.add(secondaryPanelHolder,  BorderLayout.SOUTH);
-    this.add(idPanelHolder, BorderLayout.WEST);
-    idPanelHolder.add(idSpaceFillerPanel1,  BorderLayout.NORTH);
-    idPanelHolder.add(annotationSpaceFillerHolder, BorderLayout.SOUTH);
-    this.add(hscrollHolder,  BorderLayout.SOUTH);
-    hscrollHolder.add(hscroll, BorderLayout.CENTER);
-    hscrollHolder.add(hscrollFillerPanel,  BorderLayout.WEST);
-    this.add(sequenceHolderPanel,  BorderLayout.CENTER);
-  }
-
-
-}
+*/\r
+package jalview.jbgui;\r
+\r
+import java.awt.*;\r
+\r
+import javax.swing.*;\r
+import javax.swing.border.*;\r
+\r
+\r
+public class GAlignmentPanel extends JPanel {\r
+    protected JPanel sequenceHolderPanel = new JPanel();\r
+    protected JScrollBar vscroll = new JScrollBar();\r
+    protected JScrollBar hscroll = new JScrollBar();\r
+    protected JPanel seqPanelHolder = new JPanel();\r
+    BorderLayout borderLayout1 = new BorderLayout();\r
+    BorderLayout borderLayout3 = new BorderLayout();\r
+    protected JPanel scalePanelHolder = new JPanel();\r
+    protected JPanel idPanelHolder = new JPanel();\r
+    BorderLayout borderLayout5 = new BorderLayout();\r
+    protected JPanel idSpaceFillerPanel1 = new JPanel();\r
+    public JPanel annotationSpaceFillerHolder = new JPanel();\r
+    BorderLayout borderLayout6 = new BorderLayout();\r
+    ButtonGroup buttonGroup1 = new ButtonGroup();\r
+    BorderLayout borderLayout7 = new BorderLayout();\r
+    JPanel hscrollHolder = new JPanel();\r
+    BorderLayout borderLayout10 = new BorderLayout();\r
+    protected JPanel hscrollFillerPanel = new JPanel();\r
+    BorderLayout borderLayout11 = new BorderLayout();\r
+    public JScrollPane annotationScroller = new JScrollPane();\r
+    Border border1;\r
+    BorderLayout borderLayout4 = new BorderLayout();\r
+\r
+    public GAlignmentPanel() {\r
+        try {\r
+            jbInit();\r
+        } catch (Exception e) {\r
+            e.printStackTrace();\r
+        }\r
+    }\r
+\r
+    private void jbInit() throws Exception {\r
+        border1 = BorderFactory.createLineBorder(Color.gray, 1);\r
+        idPanelHolder.setBorder(null);\r
+        idPanelHolder.setPreferredSize(new Dimension(70, 10));\r
+        this.setLayout(borderLayout7);\r
+        sequenceHolderPanel.setMaximumSize(new Dimension(2147483647, 2147483647));\r
+        sequenceHolderPanel.setMinimumSize(new Dimension(150, 150));\r
+        sequenceHolderPanel.setPreferredSize(new Dimension(150, 150));\r
+        sequenceHolderPanel.setLayout(borderLayout3);\r
+        seqPanelHolder.setLayout(borderLayout1);\r
+        scalePanelHolder.setBackground(Color.white);\r
+        scalePanelHolder.setMinimumSize(new Dimension(10, 80));\r
+        scalePanelHolder.setPreferredSize(new Dimension(10, 30));\r
+        scalePanelHolder.setLayout(borderLayout6);\r
+        idPanelHolder.setLayout(borderLayout5);\r
+        idSpaceFillerPanel1.setBackground(Color.white);\r
+        idSpaceFillerPanel1.setPreferredSize(new Dimension(10, 30));\r
+        idSpaceFillerPanel1.setLayout(borderLayout11);\r
+        annotationSpaceFillerHolder.setBackground(Color.white);\r
+        annotationSpaceFillerHolder.setPreferredSize(new Dimension(10, 80));\r
+        annotationSpaceFillerHolder.setLayout(borderLayout4);\r
+        hscroll.setOrientation(JScrollBar.HORIZONTAL);\r
+        hscrollHolder.setLayout(borderLayout10);\r
+        hscrollFillerPanel.setBackground(Color.white);\r
+        hscrollFillerPanel.setPreferredSize(new Dimension(70, 10));\r
+        hscrollHolder.setBackground(Color.white);\r
+        annotationScroller.setBorder(null);\r
+        annotationScroller.setPreferredSize(new Dimension(10, 80));\r
+        this.setPreferredSize(new Dimension(220, 166));\r
+        this.setRequestFocusEnabled(true);\r
+        sequenceHolderPanel.add(scalePanelHolder, BorderLayout.NORTH);\r
+        sequenceHolderPanel.add(seqPanelHolder, BorderLayout.CENTER);\r
+        seqPanelHolder.add(vscroll, BorderLayout.EAST);\r
+        sequenceHolderPanel.add(annotationScroller, BorderLayout.SOUTH);\r
+\r
+        //  jPanel3.add(secondaryPanelHolder,  BorderLayout.SOUTH);\r
+        this.add(idPanelHolder, BorderLayout.WEST);\r
+        idPanelHolder.add(idSpaceFillerPanel1, BorderLayout.NORTH);\r
+        idPanelHolder.add(annotationSpaceFillerHolder, BorderLayout.SOUTH);\r
+        this.add(hscrollHolder, BorderLayout.SOUTH);\r
+        hscrollHolder.add(hscroll, BorderLayout.CENTER);\r
+        hscrollHolder.add(hscrollFillerPanel, BorderLayout.WEST);\r
+        this.add(sequenceHolderPanel, BorderLayout.CENTER);\r
+    }\r
+}\r
index 7b0c621..8b2582c 100755 (executable)
 * 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.jbgui;\r
 \r
-import javax.swing.*;\r
 import java.awt.*;\r
 import java.awt.event.*;\r
-import java.beans.VetoableChangeListener;\r
+\r
 import java.beans.PropertyChangeEvent;\r
 import java.beans.PropertyVetoException;\r
+import java.beans.VetoableChangeListener;\r
 \r
-public class GCutAndPasteTransfer extends JInternalFrame\r
-{\r
-  protected JTextArea textarea = new JTextArea();\r
-  protected JScrollPane scrollPane = new JScrollPane();\r
-  BorderLayout borderLayout1 = new BorderLayout();\r
-  JMenuBar editMenubar = new JMenuBar();\r
-  JMenu editMenu = new JMenu();\r
-  JMenuItem copyItem = new JMenuItem();\r
-  JMenuItem pasteMenu = new JMenuItem();\r
-  BorderLayout borderLayout2 = new BorderLayout();\r
-  protected JPanel inputButtonPanel = new JPanel();\r
-  JButton ok = new JButton();\r
-  JButton cancel = new JButton();\r
-  public GCutAndPasteTransfer()\r
-  {\r
-    try\r
-    {\r
-      setJMenuBar(editMenubar);\r
-      jbInit();\r
-    }\r
-    catch(Exception e)\r
-    {\r
-      e.printStackTrace();\r
-    }\r
-\r
-  }\r
-  private void jbInit() throws Exception\r
-  {\r
-    scrollPane.setBorder(null);\r
-    ok.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
-    ok.setText("Accept");\r
-    ok.addActionListener(new ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        ok_actionPerformed(e);\r
-      }\r
-    });\r
-    cancel.setText("Cancel");\r
-    cancel.addActionListener(new ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        cancel_actionPerformed(e);\r
-      }\r
-    });\r
-    textarea.setBorder(null);\r
-    textarea.addVetoableChangeListener(new VetoableChangeListener()\r
-    {\r
-      public void vetoableChange(PropertyChangeEvent evt)\r
-      {\r
-        try\r
-        {\r
-          textarea_vetoableChange(evt);\r
-        }\r
-        catch (java.beans.PropertyVetoException exception0)\r
-        {\r
-          exception0.printStackTrace();\r
-        }\r
-\r
-      }\r
-    });\r
-    editMenubar.add(editMenu);\r
-    textarea.setFont(new java.awt.Font("Verdana", 0, 12));\r
-    textarea.addMouseListener(new java.awt.event.MouseAdapter()\r
-    {\r
-      public void mousePressed(MouseEvent e)\r
-      {\r
-        textarea_mousePressed(e);\r
-      }\r
-    });\r
-    editMenu.setText("Edit");\r
-    pasteMenu.setText("Paste");\r
-    pasteMenu.addActionListener(new ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        pasteMenu_actionPerformed(e);\r
-      }\r
-    });\r
-    copyItem.setText("Copy");\r
-    copyItem.addActionListener(new ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        copyItem_actionPerformed(e);\r
-      }\r
-    });\r
-    this.getContentPane().setLayout(borderLayout2);\r
-    scrollPane.setBorder(null);\r
-    scrollPane.getViewport().add(textarea, null);\r
-    editMenu.add(copyItem);\r
-    editMenu.add(pasteMenu);\r
-    this.getContentPane().add(scrollPane, java.awt.BorderLayout.CENTER);\r
-    inputButtonPanel.add(ok);\r
-    inputButtonPanel.add(cancel);\r
-\r
-  }\r
-\r
-  void textarea_mousePressed(MouseEvent e)\r
-  {\r
-    if(textarea.getText().equals("Paste your alignment file here"))\r
-      textarea.setText("");\r
-  }\r
-\r
-  public void copyItem_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
+import javax.swing.*;\r
 \r
-  public void pasteMenu_actionPerformed(ActionEvent e)\r
-  {\r
 \r
-  }\r
+public class GCutAndPasteTransfer extends JInternalFrame {\r
+    protected JTextArea textarea = new JTextArea();\r
+    protected JScrollPane scrollPane = new JScrollPane();\r
+    BorderLayout borderLayout1 = new BorderLayout();\r
+    JMenuBar editMenubar = new JMenuBar();\r
+    JMenu editMenu = new JMenu();\r
+    JMenuItem copyItem = new JMenuItem();\r
+    JMenuItem pasteMenu = new JMenuItem();\r
+    BorderLayout borderLayout2 = new BorderLayout();\r
+    protected JPanel inputButtonPanel = new JPanel();\r
+    JButton ok = new JButton();\r
+    JButton cancel = new JButton();\r
+\r
+    public GCutAndPasteTransfer() {\r
+        try {\r
+            setJMenuBar(editMenubar);\r
+            jbInit();\r
+        } catch (Exception e) {\r
+            e.printStackTrace();\r
+        }\r
+    }\r
 \r
-  public void ok_actionPerformed(ActionEvent e)\r
-  {\r
+    private void jbInit() throws Exception {\r
+        scrollPane.setBorder(null);\r
+        ok.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
+        ok.setText("Accept");\r
+        ok.addActionListener(new ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    ok_actionPerformed(e);\r
+                }\r
+            });\r
+        cancel.setText("Cancel");\r
+        cancel.addActionListener(new ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    cancel_actionPerformed(e);\r
+                }\r
+            });\r
+        textarea.setBorder(null);\r
+        textarea.addVetoableChangeListener(new VetoableChangeListener() {\r
+                public void vetoableChange(PropertyChangeEvent evt) {\r
+                    try {\r
+                        textarea_vetoableChange(evt);\r
+                    } catch (java.beans.PropertyVetoException exception0) {\r
+                        exception0.printStackTrace();\r
+                    }\r
+                }\r
+            });\r
+        editMenubar.add(editMenu);\r
+        textarea.setFont(new java.awt.Font("Verdana", 0, 12));\r
+        textarea.addMouseListener(new java.awt.event.MouseAdapter() {\r
+                public void mousePressed(MouseEvent e) {\r
+                    textarea_mousePressed(e);\r
+                }\r
+            });\r
+        editMenu.setText("Edit");\r
+        pasteMenu.setText("Paste");\r
+        pasteMenu.addActionListener(new ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    pasteMenu_actionPerformed(e);\r
+                }\r
+            });\r
+        copyItem.setText("Copy");\r
+        copyItem.addActionListener(new ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    copyItem_actionPerformed(e);\r
+                }\r
+            });\r
+        this.getContentPane().setLayout(borderLayout2);\r
+        scrollPane.setBorder(null);\r
+        scrollPane.getViewport().add(textarea, null);\r
+        editMenu.add(copyItem);\r
+        editMenu.add(pasteMenu);\r
+        this.getContentPane().add(scrollPane, java.awt.BorderLayout.CENTER);\r
+        inputButtonPanel.add(ok);\r
+        inputButtonPanel.add(cancel);\r
+    }\r
 \r
-  }\r
+    void textarea_mousePressed(MouseEvent e) {\r
+        if (textarea.getText().equals("Paste your alignment file here")) {\r
+            textarea.setText("");\r
+        }\r
+    }\r
 \r
-  public void cancel_actionPerformed(ActionEvent e)\r
-  {\r
+    public void copyItem_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  }\r
+    public void pasteMenu_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  public void textarea_vetoableChange(PropertyChangeEvent evt)\r
-      throws PropertyVetoException\r
-  {\r
+    public void ok_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  }\r
+    public void cancel_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
+    public void textarea_vetoableChange(PropertyChangeEvent evt)\r
+        throws PropertyVetoException {\r
+    }\r
 }\r
index 1dc49b7..06340c3 100755 (executable)
 * 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.jbgui;\r
 \r
-import javax.swing.*;\r
-import java.awt.event.*;\r
 import java.awt.*;\r
+import java.awt.event.*;\r
+\r
+import javax.swing.*;\r
+\r
+\r
+public class GDesktop extends JFrame {\r
+    protected static JMenu windowMenu = new JMenu();\r
+    JMenuBar DesktopMenubar = new JMenuBar();\r
+    JMenu FileMenu = new JMenu();\r
+    JMenu HelpMenu = new JMenu();\r
+    JMenuItem inputLocalFileMenuItem = new JMenuItem();\r
+    JMenuItem inputURLMenuItem = new JMenuItem();\r
+    JMenuItem inputTextboxMenuItem = new JMenuItem();\r
+    JMenuItem quit = new JMenuItem();\r
+    JMenuItem aboutMenuItem = new JMenuItem();\r
+    JMenuItem documentationMenuItem = new JMenuItem();\r
+    FlowLayout flowLayout1 = new FlowLayout();\r
+    JMenu toolsMenu = new JMenu();\r
+    JMenuItem preferences = new JMenuItem();\r
+    JMenuItem saveState = new JMenuItem();\r
+    JMenuItem loadState = new JMenuItem();\r
+    JMenu jMenu1 = new JMenu();\r
+\r
+    public GDesktop() {\r
+        try {\r
+            jbInit();\r
+            this.setJMenuBar(DesktopMenubar);\r
+        } catch (Exception e) {\r
+            e.printStackTrace();\r
+        }\r
+    }\r
+\r
+    private void jbInit() throws Exception {\r
+        FileMenu.setMnemonic('F');\r
+        FileMenu.setText("File");\r
+        HelpMenu.setText("Help");\r
+        inputLocalFileMenuItem.setMnemonic('L');\r
+        inputLocalFileMenuItem.setText("from File");\r
+        inputLocalFileMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    inputLocalFileMenuItem_actionPerformed(e);\r
+                }\r
+            });\r
+        inputURLMenuItem.setMnemonic('U');\r
+        inputURLMenuItem.setText("from URL");\r
+        inputURLMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    inputURLMenuItem_actionPerformed(e);\r
+                }\r
+            });\r
+        inputTextboxMenuItem.setMnemonic('C');\r
+        inputTextboxMenuItem.setText("from Textbox");\r
+        inputTextboxMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    inputTextboxMenuItem_actionPerformed(e);\r
+                }\r
+            });\r
+        quit.setMnemonic('Q');\r
+        quit.setText("Quit");\r
+        quit.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    quit_actionPerformed(e);\r
+                }\r
+            });\r
+        aboutMenuItem.setText("About");\r
+        aboutMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    aboutMenuItem_actionPerformed(e);\r
+                }\r
+            });\r
+        documentationMenuItem.setText("Documentation");\r
+        documentationMenuItem.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    documentationMenuItem_actionPerformed(e);\r
+                }\r
+            });\r
+        this.getContentPane().setLayout(flowLayout1);\r
+        windowMenu.setText("Window");\r
+        preferences.setText("Preferences...");\r
+        preferences.addActionListener(new ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    preferences_actionPerformed(e);\r
+                }\r
+            });\r
+        toolsMenu.setText("Tools");\r
+        saveState.setMnemonic('S');\r
+        saveState.setText("Save Project");\r
+        saveState.addActionListener(new ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    saveState_actionPerformed(e);\r
+                }\r
+            });\r
+        loadState.setMnemonic('L');\r
+        loadState.setText("Load Project");\r
+        loadState.addActionListener(new ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    loadState_actionPerformed(e);\r
+                }\r
+            });\r
+        jMenu1.setMnemonic('I');\r
+        jMenu1.setText("Input Alignment");\r
+        DesktopMenubar.add(FileMenu);\r
+        DesktopMenubar.add(toolsMenu);\r
+        DesktopMenubar.add(HelpMenu);\r
+        DesktopMenubar.add(windowMenu);\r
+        FileMenu.addSeparator();\r
+        FileMenu.add(jMenu1);\r
+        FileMenu.addSeparator();\r
+        FileMenu.add(saveState);\r
+        FileMenu.add(loadState);\r
+        FileMenu.addSeparator();\r
+        FileMenu.add(quit);\r
+        HelpMenu.add(aboutMenuItem);\r
+        HelpMenu.add(documentationMenuItem);\r
+        toolsMenu.add(preferences);\r
+        jMenu1.add(inputLocalFileMenuItem);\r
+        jMenu1.add(inputURLMenuItem);\r
+        jMenu1.add(inputTextboxMenuItem);\r
+    }\r
+\r
+    protected void inputLocalFileMenuItem_actionPerformed(ActionEvent e) {\r
+    }\r
+\r
+    protected void inputURLMenuItem_actionPerformed(ActionEvent e) {\r
+    }\r
+\r
+    protected void inputTextboxMenuItem_actionPerformed(ActionEvent e) {\r
+    }\r
+\r
+    protected void quit_actionPerformed(ActionEvent e) {\r
+    }\r
+\r
+    protected void aboutMenuItem_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
+    protected void documentationMenuItem_actionPerformed(ActionEvent e) {\r
+    }\r
+\r
+    public void SaveState_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-public class GDesktop extends JFrame\r
-{\r
-  JMenuBar DesktopMenubar = new JMenuBar();\r
-  JMenu FileMenu = new JMenu();\r
-  JMenu HelpMenu = new JMenu();\r
-  JMenuItem inputLocalFileMenuItem = new JMenuItem();\r
-  JMenuItem inputURLMenuItem = new JMenuItem();\r
-  JMenuItem inputTextboxMenuItem = new JMenuItem();\r
-  JMenuItem quit = new JMenuItem();\r
-  JMenuItem aboutMenuItem = new JMenuItem();\r
-  JMenuItem documentationMenuItem = new JMenuItem();\r
-  FlowLayout flowLayout1 = new FlowLayout();\r
-  protected static JMenu windowMenu = new JMenu();\r
-  JMenu toolsMenu = new JMenu();\r
-  JMenuItem preferences = new JMenuItem();\r
-  JMenuItem saveState = new JMenuItem();\r
-  JMenuItem loadState = new JMenuItem();\r
-  JMenu jMenu1 = new JMenu();\r
-  public GDesktop()\r
-  {\r
-    try\r
-    {\r
-      jbInit();\r
-      this.setJMenuBar(DesktopMenubar);\r
+    protected void preferences_actionPerformed(ActionEvent e) {\r
     }\r
-    catch(Exception e)\r
-    {\r
-      e.printStackTrace();\r
+\r
+    public void saveState_actionPerformed(ActionEvent e) {\r
     }\r
 \r
-  }\r
-  private void jbInit() throws Exception\r
-  {\r
-    FileMenu.setMnemonic('F');\r
-    FileMenu.setText("File");\r
-    HelpMenu.setText("Help");\r
-    inputLocalFileMenuItem.setMnemonic('L');\r
-    inputLocalFileMenuItem.setText("from File");\r
-    inputLocalFileMenuItem.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        inputLocalFileMenuItem_actionPerformed(e);\r
-      }\r
-    });\r
-    inputURLMenuItem.setMnemonic('U');\r
-    inputURLMenuItem.setText("from URL");\r
-    inputURLMenuItem.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        inputURLMenuItem_actionPerformed(e);\r
-      }\r
-    });\r
-    inputTextboxMenuItem.setMnemonic('C');\r
-    inputTextboxMenuItem.setText("from Textbox");\r
-    inputTextboxMenuItem.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        inputTextboxMenuItem_actionPerformed(e);\r
-      }\r
-    });\r
-    quit.setMnemonic('Q');\r
-    quit.setText("Quit");\r
-    quit.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        quit_actionPerformed(e);\r
-      }\r
-    });\r
-    aboutMenuItem.setText("About");\r
-    aboutMenuItem.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        aboutMenuItem_actionPerformed(e);\r
-      }\r
-    });\r
-    documentationMenuItem.setText("Documentation");\r
-    documentationMenuItem.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        documentationMenuItem_actionPerformed(e);\r
-      }\r
-    });\r
-    this.getContentPane().setLayout(flowLayout1);\r
-    windowMenu.setText("Window");\r
-    preferences.setText("Preferences...");\r
-    preferences.addActionListener(new ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-\r
-        preferences_actionPerformed(e);\r
-      }\r
-    });\r
-    toolsMenu.setText("Tools");\r
-    saveState.setMnemonic('S');\r
-    saveState.setText("Save Project");\r
-    saveState.addActionListener(new ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        saveState_actionPerformed(e);\r
-      }\r
-    });\r
-    loadState.setMnemonic('L');\r
-    loadState.setText("Load Project");\r
-    loadState.addActionListener(new ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        loadState_actionPerformed(e);\r
-      }\r
-    });\r
-    jMenu1.setMnemonic('I');\r
-    jMenu1.setText("Input Alignment");\r
-    DesktopMenubar.add(FileMenu);\r
-    DesktopMenubar.add(toolsMenu);\r
-    DesktopMenubar.add(HelpMenu);\r
-    DesktopMenubar.add(windowMenu);\r
-    FileMenu.addSeparator();\r
-    FileMenu.add(jMenu1);\r
-    FileMenu.addSeparator();\r
-    FileMenu.add(saveState);\r
-    FileMenu.add(loadState);\r
-    FileMenu.addSeparator();\r
-    FileMenu.add(quit);\r
-    HelpMenu.add(aboutMenuItem);\r
-    HelpMenu.add(documentationMenuItem);\r
-    toolsMenu.add(preferences);\r
-    jMenu1.add(inputLocalFileMenuItem);\r
-    jMenu1.add(inputURLMenuItem);\r
-    jMenu1.add(inputTextboxMenuItem);\r
-\r
-  }\r
-\r
-  protected void inputLocalFileMenuItem_actionPerformed(ActionEvent e)\r
-  { }\r
-\r
-  protected void inputURLMenuItem_actionPerformed(ActionEvent e)\r
-  {  }\r
-\r
-  protected void inputTextboxMenuItem_actionPerformed(ActionEvent e)\r
-  { }\r
-\r
-  protected void quit_actionPerformed(ActionEvent e)\r
-  {  }\r
-\r
-  protected void aboutMenuItem_actionPerformed(ActionEvent e)\r
-  { }\r
-\r
-  protected void documentationMenuItem_actionPerformed(ActionEvent e)\r
-  {  }\r
-\r
-  public void SaveState_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-  protected void preferences_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-  public void saveState_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-  public void loadState_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-  public void loadJalviewAlign_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
+    public void loadState_actionPerformed(ActionEvent e) {\r
+    }\r
+\r
+    public void loadJalviewAlign_actionPerformed(ActionEvent e) {\r
+    }\r
 }\r
index b7cd2e8..5aa9db1 100755 (executable)
 * 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.jbgui;\r
 \r
-import javax.swing.*;\r
 import java.awt.*;\r
 import java.awt.event.*;\r
 \r
+import javax.swing.*;\r
 \r
-public class GFinder extends JPanel\r
-{\r
-  JLabel jLabel1 = new JLabel();\r
-  protected JTextField textfield = new JTextField();\r
-  protected JButton findAll = new JButton();\r
-  protected JButton findNext = new JButton();\r
-  JPanel jPanel1 = new JPanel();\r
-  GridLayout gridLayout1 = new GridLayout();\r
-  protected JButton createNewGroup = new JButton();\r
 \r
-  public GFinder()\r
-  {\r
-    try\r
-    {\r
-      jbInit();\r
-    }\r
-    catch(Exception e)\r
-    {\r
-      e.printStackTrace();\r
+public class GFinder extends JPanel {\r
+    JLabel jLabel1 = new JLabel();\r
+    protected JTextField textfield = new JTextField();\r
+    protected JButton findAll = new JButton();\r
+    protected JButton findNext = new JButton();\r
+    JPanel jPanel1 = new JPanel();\r
+    GridLayout gridLayout1 = new GridLayout();\r
+    protected JButton createNewGroup = new JButton();\r
+\r
+    public GFinder() {\r
+        try {\r
+            jbInit();\r
+        } catch (Exception e) {\r
+            e.printStackTrace();\r
+        }\r
     }\r
-  }\r
-  private void jbInit() throws Exception\r
-  {\r
-    jLabel1.setFont(new java.awt.Font("Verdana", 0, 12));\r
-    jLabel1.setText("Find");\r
-    jLabel1.setBounds(new Rectangle(3, 30, 34, 15));\r
-    this.setLayout(null);\r
-    textfield.setFont(new java.awt.Font("Verdana", 0, 12));\r
-    textfield.setText("");\r
-    textfield.setBounds(new Rectangle(40, 27, 133, 21));\r
-    textfield.addKeyListener(new java.awt.event.KeyAdapter()\r
-    {\r
-      public void keyTyped(KeyEvent e)\r
-      {\r
-        textfield_keyTyped(e);\r
-      }\r
-    });\r
-    textfield.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        textfield_actionPerformed(e);\r
-      }\r
-    });\r
-    findAll.setFont(new java.awt.Font("Verdana", 0, 12));\r
-    findAll.setText("Find all");\r
-    findAll.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        findAll_actionPerformed(e);\r
-      }\r
-    });\r
-    findNext.setEnabled(false);\r
-    findNext.setFont(new java.awt.Font("Verdana", 0, 12));\r
-    findNext.setText("Find Next");\r
-    findNext.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        findNext_actionPerformed(e);\r
-      }\r
-    });\r
-    jPanel1.setBounds(new Rectangle(180, 5, 141, 64));\r
-    jPanel1.setLayout(gridLayout1);\r
-    gridLayout1.setHgap(0);\r
-    gridLayout1.setRows(3);\r
-    gridLayout1.setVgap(2);\r
-    createNewGroup.setEnabled(false);\r
-    createNewGroup.setFont(new java.awt.Font("Verdana", 0, 12));\r
-    createNewGroup.setToolTipText("");\r
-    createNewGroup.setMargin(new Insets(0, 0, 0, 0));\r
-    createNewGroup.setText("Create new group");\r
-    createNewGroup.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        createNewGroup_actionPerformed(e);\r
-      }\r
-    });\r
-    jPanel1.add(findNext, null);\r
-    jPanel1.add(findAll, null);\r
-    jPanel1.add(createNewGroup, null);\r
-    this.add(textfield, null);\r
-    this.add(jLabel1, null);\r
-    this.add(jPanel1, null);\r
-  }\r
-\r
-  protected void findNext_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-  protected void findAll_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
 \r
+    private void jbInit() throws Exception {\r
+        jLabel1.setFont(new java.awt.Font("Verdana", 0, 12));\r
+        jLabel1.setText("Find");\r
+        jLabel1.setBounds(new Rectangle(3, 30, 34, 15));\r
+        this.setLayout(null);\r
+        textfield.setFont(new java.awt.Font("Verdana", 0, 12));\r
+        textfield.setText("");\r
+        textfield.setBounds(new Rectangle(40, 27, 133, 21));\r
+        textfield.addKeyListener(new java.awt.event.KeyAdapter() {\r
+                public void keyTyped(KeyEvent e) {\r
+                    textfield_keyTyped(e);\r
+                }\r
+            });\r
+        textfield.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    textfield_actionPerformed(e);\r
+                }\r
+            });\r
+        findAll.setFont(new java.awt.Font("Verdana", 0, 12));\r
+        findAll.setText("Find all");\r
+        findAll.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    findAll_actionPerformed(e);\r
+                }\r
+            });\r
+        findNext.setEnabled(false);\r
+        findNext.setFont(new java.awt.Font("Verdana", 0, 12));\r
+        findNext.setText("Find Next");\r
+        findNext.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    findNext_actionPerformed(e);\r
+                }\r
+            });\r
+        jPanel1.setBounds(new Rectangle(180, 5, 141, 64));\r
+        jPanel1.setLayout(gridLayout1);\r
+        gridLayout1.setHgap(0);\r
+        gridLayout1.setRows(3);\r
+        gridLayout1.setVgap(2);\r
+        createNewGroup.setEnabled(false);\r
+        createNewGroup.setFont(new java.awt.Font("Verdana", 0, 12));\r
+        createNewGroup.setToolTipText("");\r
+        createNewGroup.setMargin(new Insets(0, 0, 0, 0));\r
+        createNewGroup.setText("Create new group");\r
+        createNewGroup.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    createNewGroup_actionPerformed(e);\r
+                }\r
+            });\r
+        jPanel1.add(findNext, null);\r
+        jPanel1.add(findAll, null);\r
+        jPanel1.add(createNewGroup, null);\r
+        this.add(textfield, null);\r
+        this.add(jLabel1, null);\r
+        this.add(jPanel1, null);\r
+    }\r
 \r
-  protected void textfield_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
+    protected void findNext_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  void textfield_keyTyped(KeyEvent e)\r
-  {\r
-    findNext.setEnabled(true);\r
-  }\r
+    protected void findAll_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  public void createNewGroup_actionPerformed(ActionEvent e)\r
-  {\r
+    protected void textfield_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  }\r
+    void textfield_keyTyped(KeyEvent e) {\r
+        findNext.setEnabled(true);\r
+    }\r
 \r
+    public void createNewGroup_actionPerformed(ActionEvent e) {\r
+    }\r
 }\r
index 5966af5..4ca3b42 100755 (executable)
 * 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.jbgui;\r
 \r
-import javax.swing.*;\r
 import java.awt.*;\r
 import java.awt.event.*;\r
 \r
+import javax.swing.*;\r
 \r
-public class GFontChooser extends JPanel\r
-{\r
-  JLabel jLabel1 = new JLabel();\r
-  protected JComboBox fontSize = new JComboBox();\r
-  protected JComboBox fontStyle = new JComboBox();\r
-  JLabel jLabel2 = new JLabel();\r
-  JLabel jLabel3 = new JLabel();\r
-  protected JComboBox fontName = new JComboBox();\r
-  JButton ok = new JButton();\r
-  JButton cancel = new JButton();\r
-  JPanel jPanel1 = new JPanel();\r
-  JPanel jPanel2 = new JPanel();\r
-  JPanel jPanel3 = new JPanel();\r
-  BorderLayout borderLayout1 = new BorderLayout();\r
-  BorderLayout borderLayout2 = new BorderLayout();\r
-  BorderLayout borderLayout3 = new BorderLayout();\r
-  FlowLayout flowLayout1 = new FlowLayout();\r
-  JButton defaultButton = new JButton();\r
 \r
-  public GFontChooser()\r
-  {\r
-    try\r
-    {\r
-      jbInit();\r
-    }\r
-    catch(Exception e)\r
-    {\r
-      e.printStackTrace();\r
+public class GFontChooser extends JPanel {\r
+    JLabel jLabel1 = new JLabel();\r
+    protected JComboBox fontSize = new JComboBox();\r
+    protected JComboBox fontStyle = new JComboBox();\r
+    JLabel jLabel2 = new JLabel();\r
+    JLabel jLabel3 = new JLabel();\r
+    protected JComboBox fontName = new JComboBox();\r
+    JButton ok = new JButton();\r
+    JButton cancel = new JButton();\r
+    JPanel jPanel1 = new JPanel();\r
+    JPanel jPanel2 = new JPanel();\r
+    JPanel jPanel3 = new JPanel();\r
+    BorderLayout borderLayout1 = new BorderLayout();\r
+    BorderLayout borderLayout2 = new BorderLayout();\r
+    BorderLayout borderLayout3 = new BorderLayout();\r
+    FlowLayout flowLayout1 = new FlowLayout();\r
+    JButton defaultButton = new JButton();\r
+\r
+    public GFontChooser() {\r
+        try {\r
+            jbInit();\r
+        } catch (Exception e) {\r
+            e.printStackTrace();\r
+        }\r
     }\r
-  }\r
-  private void jbInit() throws Exception\r
-  {\r
-    jLabel1.setFont(new java.awt.Font("Verdana", 0, 11));\r
-    jLabel1.setHorizontalAlignment(SwingConstants.RIGHT);\r
-    jLabel1.setText("Font: ");\r
-    jLabel1.setVerticalTextPosition(javax.swing.SwingConstants.CENTER);\r
-    this.setLayout(flowLayout1);\r
-    fontSize.setFont(new java.awt.Font("Verdana", 0, 11));\r
-    fontSize.setOpaque(false);\r
-    fontSize.setPreferredSize(new Dimension(50, 21));\r
-    fontSize.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        fontSize_actionPerformed(e);\r
-      }\r
-    });\r
-    fontStyle.setFont(new java.awt.Font("Verdana", 0, 11));\r
-    fontStyle.setOpaque(false);\r
-    fontStyle.setPreferredSize(new Dimension(90, 21));\r
-    fontStyle.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        fontStyle_actionPerformed(e);\r
-      }\r
-    });\r
-    jLabel2.setFont(new java.awt.Font("Verdana", 0, 11));\r
-    jLabel2.setHorizontalAlignment(SwingConstants.RIGHT);\r
-    jLabel2.setText("Size: ");\r
-    jLabel2.setVerticalTextPosition(javax.swing.SwingConstants.CENTER);\r
-    jLabel3.setFont(new java.awt.Font("Verdana", 0, 11));\r
-    jLabel3.setHorizontalAlignment(SwingConstants.RIGHT);\r
-    jLabel3.setText("Style: ");\r
-    jLabel3.setVerticalTextPosition(javax.swing.SwingConstants.CENTER);\r
-    fontName.setFont(new java.awt.Font("Verdana", 0, 11));\r
-    fontName.setMaximumSize(new Dimension(32767, 32767));\r
-    fontName.setMinimumSize(new Dimension(300, 21));\r
-    fontName.setOpaque(false);\r
-    fontName.setPreferredSize(new Dimension(180, 21));\r
-    fontName.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        fontName_actionPerformed(e);\r
-      }\r
-    });\r
-    ok.setFont(new java.awt.Font("Verdana", 0, 11));\r
-    ok.setText("OK");\r
-    ok.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        ok_actionPerformed(e);\r
-      }\r
-    });\r
-    cancel.setFont(new java.awt.Font("Verdana", 0, 11));\r
-    cancel.setText("Cancel");\r
-    cancel.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        cancel_actionPerformed(e);\r
-      }\r
-    });\r
-    this.setBackground(Color.white);\r
-    jPanel1.setOpaque(false);\r
-    jPanel1.setLayout(borderLayout1);\r
-    jPanel2.setOpaque(false);\r
-    jPanel2.setLayout(borderLayout3);\r
-    jPanel3.setOpaque(false);\r
-    jPanel3.setLayout(borderLayout2);\r
-    flowLayout1.setAlignment(FlowLayout.CENTER);\r
-    flowLayout1.setVgap(5);\r
-    defaultButton.setText("Set as Default");\r
-    defaultButton.addActionListener(new ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        defaultButton_actionPerformed(e);\r
-      }\r
-    });\r
-    this.add(jPanel1, null);\r
-    jPanel1.add(jLabel1, BorderLayout.WEST);\r
-    jPanel1.add(fontName, BorderLayout.CENTER);\r
-    this.add(jPanel3, null);\r
-    this.add(jPanel2, null);\r
-    jPanel2.add(jLabel3,  BorderLayout.WEST);\r
-    jPanel2.add(fontStyle,  BorderLayout.CENTER);\r
-    jPanel3.add(jLabel2, BorderLayout.WEST);\r
-    jPanel3.add(fontSize, BorderLayout.CENTER);\r
-    this.add(ok, null);\r
-    this.add(cancel, null);\r
-    this.add(defaultButton);\r
-  }\r
-\r
-  protected void ok_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-  protected void cancel_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
 \r
-  protected void fontName_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
+    private void jbInit() throws Exception {\r
+        jLabel1.setFont(new java.awt.Font("Verdana", 0, 11));\r
+        jLabel1.setHorizontalAlignment(SwingConstants.RIGHT);\r
+        jLabel1.setText("Font: ");\r
+        jLabel1.setVerticalTextPosition(javax.swing.SwingConstants.CENTER);\r
+        this.setLayout(flowLayout1);\r
+        fontSize.setFont(new java.awt.Font("Verdana", 0, 11));\r
+        fontSize.setOpaque(false);\r
+        fontSize.setPreferredSize(new Dimension(50, 21));\r
+        fontSize.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    fontSize_actionPerformed(e);\r
+                }\r
+            });\r
+        fontStyle.setFont(new java.awt.Font("Verdana", 0, 11));\r
+        fontStyle.setOpaque(false);\r
+        fontStyle.setPreferredSize(new Dimension(90, 21));\r
+        fontStyle.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    fontStyle_actionPerformed(e);\r
+                }\r
+            });\r
+        jLabel2.setFont(new java.awt.Font("Verdana", 0, 11));\r
+        jLabel2.setHorizontalAlignment(SwingConstants.RIGHT);\r
+        jLabel2.setText("Size: ");\r
+        jLabel2.setVerticalTextPosition(javax.swing.SwingConstants.CENTER);\r
+        jLabel3.setFont(new java.awt.Font("Verdana", 0, 11));\r
+        jLabel3.setHorizontalAlignment(SwingConstants.RIGHT);\r
+        jLabel3.setText("Style: ");\r
+        jLabel3.setVerticalTextPosition(javax.swing.SwingConstants.CENTER);\r
+        fontName.setFont(new java.awt.Font("Verdana", 0, 11));\r
+        fontName.setMaximumSize(new Dimension(32767, 32767));\r
+        fontName.setMinimumSize(new Dimension(300, 21));\r
+        fontName.setOpaque(false);\r
+        fontName.setPreferredSize(new Dimension(180, 21));\r
+        fontName.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    fontName_actionPerformed(e);\r
+                }\r
+            });\r
+        ok.setFont(new java.awt.Font("Verdana", 0, 11));\r
+        ok.setText("OK");\r
+        ok.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    ok_actionPerformed(e);\r
+                }\r
+            });\r
+        cancel.setFont(new java.awt.Font("Verdana", 0, 11));\r
+        cancel.setText("Cancel");\r
+        cancel.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    cancel_actionPerformed(e);\r
+                }\r
+            });\r
+        this.setBackground(Color.white);\r
+        jPanel1.setOpaque(false);\r
+        jPanel1.setLayout(borderLayout1);\r
+        jPanel2.setOpaque(false);\r
+        jPanel2.setLayout(borderLayout3);\r
+        jPanel3.setOpaque(false);\r
+        jPanel3.setLayout(borderLayout2);\r
+        flowLayout1.setAlignment(FlowLayout.CENTER);\r
+        flowLayout1.setVgap(5);\r
+        defaultButton.setText("Set as Default");\r
+        defaultButton.addActionListener(new ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    defaultButton_actionPerformed(e);\r
+                }\r
+            });\r
+        this.add(jPanel1, null);\r
+        jPanel1.add(jLabel1, BorderLayout.WEST);\r
+        jPanel1.add(fontName, BorderLayout.CENTER);\r
+        this.add(jPanel3, null);\r
+        this.add(jPanel2, null);\r
+        jPanel2.add(jLabel3, BorderLayout.WEST);\r
+        jPanel2.add(fontStyle, BorderLayout.CENTER);\r
+        jPanel3.add(jLabel2, BorderLayout.WEST);\r
+        jPanel3.add(fontSize, BorderLayout.CENTER);\r
+        this.add(ok, null);\r
+        this.add(cancel, null);\r
+        this.add(defaultButton);\r
+    }\r
 \r
-  protected void fontSize_actionPerformed(ActionEvent e)\r
-  {\r
+    protected void ok_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  }\r
+    protected void cancel_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  protected void fontStyle_actionPerformed(ActionEvent e)\r
-  {\r
+    protected void fontName_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  }\r
+    protected void fontSize_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  public void defaultButton_actionPerformed(ActionEvent e)\r
-  {\r
+    protected void fontStyle_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  }\r
+    public void defaultButton_actionPerformed(ActionEvent e) {\r
+    }\r
 }\r
index 84e84c4..41d188e 100755 (executable)
 * 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.jbgui;
-
-import java.awt.*;
-import javax.swing.*;
-import java.awt.event.*;
-
-public class GPCAPanel extends JPanel
-{
-  JPanel jPanel2 = new JPanel();
-  JLabel jLabel1 = new JLabel();
-  JLabel jLabel2 = new JLabel();
-  JLabel jLabel3 = new JLabel();
-  protected JComboBox xCombobox = new JComboBox();
-  protected JComboBox yCombobox = new JComboBox();
-  protected JComboBox zCombobox = new JComboBox();
-  FlowLayout flowLayout1 = new FlowLayout();
-  BorderLayout borderLayout1 = new BorderLayout();
-
-  public GPCAPanel()
-  {
-    try
-    {
-      jbInit();
-    }
-    catch(Exception e)
-    {
-      e.printStackTrace();
-    }
-
-    for(int i=1; i<8; i++)
-    {
-      xCombobox.addItem("dim "+i);
-      yCombobox.addItem("dim "+i);
-      zCombobox.addItem("dim "+i);
-    }
-  }
-  private void jbInit() throws Exception
-  {
-    this.setLayout(borderLayout1);
-    jPanel2.setLayout(flowLayout1);
-    jLabel1.setFont(new java.awt.Font("Verdana", 0, 12));
-    jLabel1.setText("x=");
-    jLabel2.setFont(new java.awt.Font("Verdana", 0, 12));
-    jLabel2.setText("y=");
-    jLabel3.setFont(new java.awt.Font("Verdana", 0, 12));
-    jLabel3.setText("z=");
-    jPanel2.setBackground(Color.white);
-    jPanel2.setBorder(null);
-    zCombobox.setFont(new java.awt.Font("Verdana", 0, 12));
-    zCombobox.addActionListener(new java.awt.event.ActionListener()
-    {
-      public void actionPerformed(ActionEvent e)
-      {
-        zCombobox_actionPerformed(e);
-      }
-    });
-    yCombobox.setFont(new java.awt.Font("Verdana", 0, 12));
-    yCombobox.addActionListener(new java.awt.event.ActionListener()
-    {
-      public void actionPerformed(ActionEvent e)
-      {
-        yCombobox_actionPerformed(e);
-      }
-    });
-    xCombobox.setFont(new java.awt.Font("Verdana", 0, 12));
-    xCombobox.addActionListener(new java.awt.event.ActionListener()
-    {
-      public void actionPerformed(ActionEvent e)
-      {
-        xCombobox_actionPerformed(e);
-      }
-    });
-    this.add(jPanel2,  BorderLayout.SOUTH);
-    jPanel2.add(jLabel1, null);
-    jPanel2.add(xCombobox, null);
-    jPanel2.add(jLabel2, null);
-    jPanel2.add(yCombobox, null);
-    jPanel2.add(jLabel3, null);
-    jPanel2.add(zCombobox, null);
-  }
-
-  protected void xCombobox_actionPerformed(ActionEvent e)
-  {
-
-  }
-
-  protected void yCombobox_actionPerformed(ActionEvent e)
-  {
-
-  }
-
-  protected void zCombobox_actionPerformed(ActionEvent e)
-  {
-
-  }
-
-}
+*/\r
+package jalview.jbgui;\r
+\r
+import java.awt.*;\r
+import java.awt.event.*;\r
+\r
+import javax.swing.*;\r
+\r
+\r
+public class GPCAPanel extends JPanel {\r
+    JPanel jPanel2 = new JPanel();\r
+    JLabel jLabel1 = new JLabel();\r
+    JLabel jLabel2 = new JLabel();\r
+    JLabel jLabel3 = new JLabel();\r
+    protected JComboBox xCombobox = new JComboBox();\r
+    protected JComboBox yCombobox = new JComboBox();\r
+    protected JComboBox zCombobox = new JComboBox();\r
+    FlowLayout flowLayout1 = new FlowLayout();\r
+    BorderLayout borderLayout1 = new BorderLayout();\r
+\r
+    public GPCAPanel() {\r
+        try {\r
+            jbInit();\r
+        } catch (Exception e) {\r
+            e.printStackTrace();\r
+        }\r
+\r
+        for (int i = 1; i < 8; i++) {\r
+            xCombobox.addItem("dim " + i);\r
+            yCombobox.addItem("dim " + i);\r
+            zCombobox.addItem("dim " + i);\r
+        }\r
+    }\r
+\r
+    private void jbInit() throws Exception {\r
+        this.setLayout(borderLayout1);\r
+        jPanel2.setLayout(flowLayout1);\r
+        jLabel1.setFont(new java.awt.Font("Verdana", 0, 12));\r
+        jLabel1.setText("x=");\r
+        jLabel2.setFont(new java.awt.Font("Verdana", 0, 12));\r
+        jLabel2.setText("y=");\r
+        jLabel3.setFont(new java.awt.Font("Verdana", 0, 12));\r
+        jLabel3.setText("z=");\r
+        jPanel2.setBackground(Color.white);\r
+        jPanel2.setBorder(null);\r
+        zCombobox.setFont(new java.awt.Font("Verdana", 0, 12));\r
+        zCombobox.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    zCombobox_actionPerformed(e);\r
+                }\r
+            });\r
+        yCombobox.setFont(new java.awt.Font("Verdana", 0, 12));\r
+        yCombobox.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    yCombobox_actionPerformed(e);\r
+                }\r
+            });\r
+        xCombobox.setFont(new java.awt.Font("Verdana", 0, 12));\r
+        xCombobox.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    xCombobox_actionPerformed(e);\r
+                }\r
+            });\r
+        this.add(jPanel2, BorderLayout.SOUTH);\r
+        jPanel2.add(jLabel1, null);\r
+        jPanel2.add(xCombobox, null);\r
+        jPanel2.add(jLabel2, null);\r
+        jPanel2.add(yCombobox, null);\r
+        jPanel2.add(jLabel3, null);\r
+        jPanel2.add(zCombobox, null);\r
+    }\r
+\r
+    protected void xCombobox_actionPerformed(ActionEvent e) {\r
+    }\r
+\r
+    protected void yCombobox_actionPerformed(ActionEvent e) {\r
+    }\r
+\r
+    protected void zCombobox_actionPerformed(ActionEvent e) {\r
+    }\r
+}\r
index e8167cf..96a1a40 100755 (executable)
 * 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.jbgui;
-
-import javax.swing.*;
-import java.awt.*;
-import java.awt.event.*;
-
-
-public class GPairwiseAlignPanel extends JPanel
-{
-  protected JScrollPane scrollPane = new JScrollPane();
-  protected JTextArea textarea = new JTextArea();
-  protected JButton viewInEditorButton = new JButton();
-  JPanel jPanel1 = new JPanel();
-  BorderLayout borderLayout1 = new BorderLayout();
-
-  public GPairwiseAlignPanel()
-  {
-    try
-    {
-      jbInit();
-    }
-    catch(Exception e)
-    {
-      e.printStackTrace();
-    }
-  }
-  private void jbInit() throws Exception
-  {
-    this.setLayout(borderLayout1);
-    textarea.setFont(new java.awt.Font("Monospaced", 0, 12));
-    textarea.setText("");
-    textarea.setWrapStyleWord(false);
-    viewInEditorButton.setFont(new java.awt.Font("Verdana", 0, 12));
-    viewInEditorButton.setText("View in alignment editor");
-    viewInEditorButton.addActionListener(new java.awt.event.ActionListener()
-    {
-      public void actionPerformed(ActionEvent e)
-      {
-        viewInEditorButton_actionPerformed(e);
-      }
-    });
-    this.add(scrollPane, BorderLayout.CENTER);
-    scrollPane.getViewport().add(textarea, null);
-    this.add(jPanel1, BorderLayout.SOUTH);
-    jPanel1.add(viewInEditorButton, null);
-  }
-
-  protected void viewInEditorButton_actionPerformed(ActionEvent e)
-  {
-
-  }
-
-}
+*/\r
+package jalview.jbgui;\r
+\r
+import java.awt.*;\r
+import java.awt.event.*;\r
+\r
+import javax.swing.*;\r
+\r
+\r
+public class GPairwiseAlignPanel extends JPanel {\r
+    protected JScrollPane scrollPane = new JScrollPane();\r
+    protected JTextArea textarea = new JTextArea();\r
+    protected JButton viewInEditorButton = new JButton();\r
+    JPanel jPanel1 = new JPanel();\r
+    BorderLayout borderLayout1 = new BorderLayout();\r
+\r
+    public GPairwiseAlignPanel() {\r
+        try {\r
+            jbInit();\r
+        } catch (Exception e) {\r
+            e.printStackTrace();\r
+        }\r
+    }\r
+\r
+    private void jbInit() throws Exception {\r
+        this.setLayout(borderLayout1);\r
+        textarea.setFont(new java.awt.Font("Monospaced", 0, 12));\r
+        textarea.setText("");\r
+        textarea.setWrapStyleWord(false);\r
+        viewInEditorButton.setFont(new java.awt.Font("Verdana", 0, 12));\r
+        viewInEditorButton.setText("View in alignment editor");\r
+        viewInEditorButton.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    viewInEditorButton_actionPerformed(e);\r
+                }\r
+            });\r
+        this.add(scrollPane, BorderLayout.CENTER);\r
+        scrollPane.getViewport().add(textarea, null);\r
+        this.add(jPanel1, BorderLayout.SOUTH);\r
+        jPanel1.add(viewInEditorButton, null);\r
+    }\r
+\r
+    protected void viewInEditorButton_actionPerformed(ActionEvent e) {\r
+    }\r
+}\r
index 1ead51c..2ab6edd 100755 (executable)
 * 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.jbgui;\r
 \r
-import javax.swing.*;\r
 import java.awt.*;\r
-import java.awt.event.ActionListener;\r
 import java.awt.event.ActionEvent;\r
-import javax.swing.border.TitledBorder;\r
+import java.awt.event.ActionListener;\r
 import java.awt.event.MouseAdapter;\r
 import java.awt.event.MouseEvent;\r
 \r
-public class GPreferences\r
-    extends JPanel\r
-{\r
-  public GPreferences()\r
-  {\r
-    try\r
-    {\r
-      jbInit();\r
-    }\r
-    catch (Exception ex)\r
-    {\r
-      ex.printStackTrace();\r
-    }\r
-  }\r
-\r
-  private void jbInit()\r
-      throws Exception\r
-  {\r
-    this.setLayout(borderLayout1);\r
-    ok.setText("OK");\r
-    ok.addActionListener(new ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        ok_actionPerformed(e);\r
-      }\r
-    });\r
-    cancel.setText("Cancel");\r
-    cancel.addActionListener(new ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        cancel_actionPerformed(e);\r
-      }\r
-    });\r
-    visual.setLayout(null);\r
-    quality.setEnabled(false);\r
-    quality.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
-    quality.setHorizontalAlignment(SwingConstants.RIGHT);\r
-    quality.setHorizontalTextPosition(SwingConstants.LEFT);\r
-    quality.setSelected(true);\r
-    quality.setText("Quality");\r
-    quality.setBounds(new Rectangle(248, 53, 81, 23));\r
-    jPanel2.setBorder(titledBorder1);\r
-    jPanel2.setBounds(new Rectangle(9, 20, 442, 241));\r
-    jPanel2.setLayout(null);\r
-    fullID.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
-    fullID.setHorizontalAlignment(SwingConstants.RIGHT);\r
-    fullID.setHorizontalTextPosition(SwingConstants.LEFT);\r
-    fullID.setText("Full Sequence ID");\r
-    fullID.setBounds(new Rectangle(9, 78, 129, 23));\r
-    fullScreen.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
-    fullScreen.setHorizontalAlignment(SwingConstants.RIGHT);\r
-    fullScreen.setHorizontalTextPosition(SwingConstants.LEFT);\r
-    fullScreen.setText("Maximise Window");\r
-    fullScreen.setBounds(new Rectangle(5, 29, 132, 23));\r
-    conservation.setEnabled(false);\r
-    conservation.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
-    conservation.setHorizontalAlignment(SwingConstants.RIGHT);\r
-    conservation.setHorizontalTextPosition(SwingConstants.LEFT);\r
-    conservation.setSelected(true);\r
-    conservation.setText("Conservation");\r
-    conservation.setBounds(new Rectangle(137, 53, 113, 23));\r
-    identity.setEnabled(false);\r
-    identity.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
-    identity.setHorizontalAlignment(SwingConstants.RIGHT);\r
-    identity.setHorizontalTextPosition(SwingConstants.LEFT);\r
-    identity.setSelected(true);\r
-    identity.setText("Consensus");\r
-    identity.setBounds(new Rectangle(326, 53, 99, 23));\r
-    annotations.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
-    annotations.setHorizontalAlignment(SwingConstants.RIGHT);\r
-    annotations.setHorizontalTextPosition(SwingConstants.LEFT);\r
-    annotations.setSelected(true);\r
-    annotations.setText("Show Annotations");\r
-    annotations.setBounds(new Rectangle(10, 53, 128, 23));\r
-    annotations.addActionListener(new ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        annotations_actionPerformed(e);\r
-      }\r
-    });\r
-    jLabel1.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
-    jLabel1.setHorizontalAlignment(SwingConstants.RIGHT);\r
-    jLabel1.setText("Gap Symbol");\r
-    jLabel1.setBounds(new Rectangle(41, 142, 76, 15));\r
-    colour.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
-    colour.setBounds(new Rectangle(121, 168, 154, 21));\r
-    jLabel2.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
-    jLabel2.setHorizontalAlignment(SwingConstants.RIGHT);\r
-    jLabel2.setText("Colour");\r
-    jLabel2.setBounds(new Rectangle(60, 172, 58, 15));\r
-    jLabel3.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
-    jLabel3.setHorizontalAlignment(SwingConstants.RIGHT);\r
-    jLabel3.setText("Font");\r
-    jLabel3.setBounds(new Rectangle(83, 114, 34, 15));\r
-    fontSizeCB.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
-    fontSizeCB.setBounds(new Rectangle(304, 109, 49, 21));\r
-    fontStyleCB.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
-    fontStyleCB.setBounds(new Rectangle(353, 109, 80, 21));\r
-    fontNameCB.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
-    fontNameCB.setBounds(new Rectangle(121, 109, 183, 21));\r
-    gapSymbolCB.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
-    gapSymbolCB.setBounds(new Rectangle(121, 140, 67, 21));\r
-    startupCheckbox.setText("Open file");\r
-    startupCheckbox.setBounds(new Rectangle(4, 200, 115, 23));\r
-    startupCheckbox.addActionListener(new ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        jCheckBox1_actionPerformed(e);\r
-      }\r
-    });\r
-    startupCheckbox.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
-    startupCheckbox.setHorizontalAlignment(SwingConstants.RIGHT);\r
-    startupCheckbox.setHorizontalTextPosition(SwingConstants.LEFT);\r
-    startupCheckbox.setSelected(true);\r
-    startupFileTextfield.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
-    startupFileTextfield.setBounds(new Rectangle(122, 202, 309, 20));\r
-    startupFileTextfield.addMouseListener(new MouseAdapter()\r
-    {\r
-      public void mouseClicked(MouseEvent e)\r
-      {\r
-        startupFileTextfield_mouseClicked();\r
-      }\r
-    });\r
-\r
-    jPanel2.add(annotations);\r
-    jPanel2.add(conservation);\r
-    jPanel2.add(quality);\r
-    jPanel2.add(fullID);\r
-    jPanel2.add(gapSymbolCB);\r
-    jPanel2.add(jLabel1);\r
-    jPanel2.add(fontNameCB);\r
-    jPanel2.add(jLabel2);\r
-    jPanel2.add(jLabel3);\r
-    jPanel2.add(colour);\r
-    jPanel2.add(fontSizeCB);\r
-    jPanel2.add(fontStyleCB);\r
-    jPanel2.add(identity);\r
-    jPanel2.add(fullScreen);\r
-    jPanel2.add(startupCheckbox);\r
-    jPanel2.add(startupFileTextfield);\r
-    jPanel1.add(ok);\r
-    jPanel1.add(cancel);\r
-    this.add(visaulTab, java.awt.BorderLayout.CENTER);\r
-    visaulTab.add(visual, "visual");\r
-    visual.add(jPanel2);\r
-    this.add(jPanel1, java.awt.BorderLayout.SOUTH);\r
-    DefaultListCellRenderer dlcr = new DefaultListCellRenderer();\r
-    dlcr.setHorizontalAlignment(DefaultListCellRenderer.CENTER);\r
-    gapSymbolCB.setRenderer(dlcr);\r
-\r
-  }\r
-\r
-  JTabbedPane visaulTab = new JTabbedPane();\r
-  JPanel visual = new JPanel();\r
-  JButton ok = new JButton();\r
-  JButton cancel = new JButton();\r
-  JPanel jPanel1 = new JPanel();\r
-  BorderLayout borderLayout1 = new BorderLayout();\r
-  protected JCheckBox quality = new JCheckBox();\r
-  JPanel jPanel2 = new JPanel();\r
-  TitledBorder titledBorder1 = new TitledBorder("Open new alignment");\r
-  protected JCheckBox fullID = new JCheckBox();\r
-  protected JCheckBox fullScreen = new JCheckBox();\r
-  protected JCheckBox conservation = new JCheckBox();\r
-  protected JCheckBox identity = new JCheckBox();\r
-  protected JCheckBox annotations = new JCheckBox();\r
-  JLabel jLabel1 = new JLabel();\r
-  protected JComboBox colour = new JComboBox();\r
-  JLabel jLabel2 = new JLabel();\r
-  JLabel jLabel3 = new JLabel();\r
-  protected JComboBox fontSizeCB = new JComboBox();\r
-  protected JComboBox fontStyleCB = new JComboBox();\r
-  protected JComboBox fontNameCB = new JComboBox();\r
-  protected JComboBox gapSymbolCB = new JComboBox();\r
-  protected JCheckBox startupCheckbox = new JCheckBox();\r
-  protected JTextField startupFileTextfield = new JTextField();\r
-  public void ok_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-  public void cancel_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
+import javax.swing.*;\r
+import javax.swing.border.TitledBorder;\r
 \r
-  public void annotations_actionPerformed(ActionEvent e)\r
-  {\r
 \r
-  }\r
+public class GPreferences extends JPanel {\r
+    JTabbedPane visaulTab = new JTabbedPane();\r
+    JPanel visual = new JPanel();\r
+    JButton ok = new JButton();\r
+    JButton cancel = new JButton();\r
+    JPanel jPanel1 = new JPanel();\r
+    BorderLayout borderLayout1 = new BorderLayout();\r
+    protected JCheckBox quality = new JCheckBox();\r
+    JPanel jPanel2 = new JPanel();\r
+    TitledBorder titledBorder1 = new TitledBorder("Open new alignment");\r
+    protected JCheckBox fullID = new JCheckBox();\r
+    protected JCheckBox fullScreen = new JCheckBox();\r
+    protected JCheckBox conservation = new JCheckBox();\r
+    protected JCheckBox identity = new JCheckBox();\r
+    protected JCheckBox annotations = new JCheckBox();\r
+    JLabel jLabel1 = new JLabel();\r
+    protected JComboBox colour = new JComboBox();\r
+    JLabel jLabel2 = new JLabel();\r
+    JLabel jLabel3 = new JLabel();\r
+    protected JComboBox fontSizeCB = new JComboBox();\r
+    protected JComboBox fontStyleCB = new JComboBox();\r
+    protected JComboBox fontNameCB = new JComboBox();\r
+    protected JComboBox gapSymbolCB = new JComboBox();\r
+    protected JCheckBox startupCheckbox = new JCheckBox();\r
+    protected JTextField startupFileTextfield = new JTextField();\r
+\r
+    public GPreferences() {\r
+        try {\r
+            jbInit();\r
+        } catch (Exception ex) {\r
+            ex.printStackTrace();\r
+        }\r
+    }\r
 \r
-  public void jCheckBox1_actionPerformed(ActionEvent e)\r
-  {\r
+    private void jbInit() throws Exception {\r
+        this.setLayout(borderLayout1);\r
+        ok.setText("OK");\r
+        ok.addActionListener(new ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    ok_actionPerformed(e);\r
+                }\r
+            });\r
+        cancel.setText("Cancel");\r
+        cancel.addActionListener(new ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    cancel_actionPerformed(e);\r
+                }\r
+            });\r
+        visual.setLayout(null);\r
+        quality.setEnabled(false);\r
+        quality.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
+        quality.setHorizontalAlignment(SwingConstants.RIGHT);\r
+        quality.setHorizontalTextPosition(SwingConstants.LEFT);\r
+        quality.setSelected(true);\r
+        quality.setText("Quality");\r
+        quality.setBounds(new Rectangle(248, 53, 81, 23));\r
+        jPanel2.setBorder(titledBorder1);\r
+        jPanel2.setBounds(new Rectangle(9, 20, 442, 241));\r
+        jPanel2.setLayout(null);\r
+        fullID.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
+        fullID.setHorizontalAlignment(SwingConstants.RIGHT);\r
+        fullID.setHorizontalTextPosition(SwingConstants.LEFT);\r
+        fullID.setText("Full Sequence ID");\r
+        fullID.setBounds(new Rectangle(9, 78, 129, 23));\r
+        fullScreen.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
+        fullScreen.setHorizontalAlignment(SwingConstants.RIGHT);\r
+        fullScreen.setHorizontalTextPosition(SwingConstants.LEFT);\r
+        fullScreen.setText("Maximise Window");\r
+        fullScreen.setBounds(new Rectangle(5, 29, 132, 23));\r
+        conservation.setEnabled(false);\r
+        conservation.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
+        conservation.setHorizontalAlignment(SwingConstants.RIGHT);\r
+        conservation.setHorizontalTextPosition(SwingConstants.LEFT);\r
+        conservation.setSelected(true);\r
+        conservation.setText("Conservation");\r
+        conservation.setBounds(new Rectangle(137, 53, 113, 23));\r
+        identity.setEnabled(false);\r
+        identity.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
+        identity.setHorizontalAlignment(SwingConstants.RIGHT);\r
+        identity.setHorizontalTextPosition(SwingConstants.LEFT);\r
+        identity.setSelected(true);\r
+        identity.setText("Consensus");\r
+        identity.setBounds(new Rectangle(326, 53, 99, 23));\r
+        annotations.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
+        annotations.setHorizontalAlignment(SwingConstants.RIGHT);\r
+        annotations.setHorizontalTextPosition(SwingConstants.LEFT);\r
+        annotations.setSelected(true);\r
+        annotations.setText("Show Annotations");\r
+        annotations.setBounds(new Rectangle(10, 53, 128, 23));\r
+        annotations.addActionListener(new ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    annotations_actionPerformed(e);\r
+                }\r
+            });\r
+        jLabel1.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
+        jLabel1.setHorizontalAlignment(SwingConstants.RIGHT);\r
+        jLabel1.setText("Gap Symbol");\r
+        jLabel1.setBounds(new Rectangle(41, 142, 76, 15));\r
+        colour.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
+        colour.setBounds(new Rectangle(121, 168, 154, 21));\r
+        jLabel2.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
+        jLabel2.setHorizontalAlignment(SwingConstants.RIGHT);\r
+        jLabel2.setText("Colour");\r
+        jLabel2.setBounds(new Rectangle(60, 172, 58, 15));\r
+        jLabel3.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
+        jLabel3.setHorizontalAlignment(SwingConstants.RIGHT);\r
+        jLabel3.setText("Font");\r
+        jLabel3.setBounds(new Rectangle(83, 114, 34, 15));\r
+        fontSizeCB.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
+        fontSizeCB.setBounds(new Rectangle(304, 109, 49, 21));\r
+        fontStyleCB.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
+        fontStyleCB.setBounds(new Rectangle(353, 109, 80, 21));\r
+        fontNameCB.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
+        fontNameCB.setBounds(new Rectangle(121, 109, 183, 21));\r
+        gapSymbolCB.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
+        gapSymbolCB.setBounds(new Rectangle(121, 140, 67, 21));\r
+        startupCheckbox.setText("Open file");\r
+        startupCheckbox.setBounds(new Rectangle(4, 200, 115, 23));\r
+        startupCheckbox.addActionListener(new ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    jCheckBox1_actionPerformed(e);\r
+                }\r
+            });\r
+        startupCheckbox.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
+        startupCheckbox.setHorizontalAlignment(SwingConstants.RIGHT);\r
+        startupCheckbox.setHorizontalTextPosition(SwingConstants.LEFT);\r
+        startupCheckbox.setSelected(true);\r
+        startupFileTextfield.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11));\r
+        startupFileTextfield.setBounds(new Rectangle(122, 202, 309, 20));\r
+        startupFileTextfield.addMouseListener(new MouseAdapter() {\r
+                public void mouseClicked(MouseEvent e) {\r
+                    startupFileTextfield_mouseClicked();\r
+                }\r
+            });\r
+\r
+        jPanel2.add(annotations);\r
+        jPanel2.add(conservation);\r
+        jPanel2.add(quality);\r
+        jPanel2.add(fullID);\r
+        jPanel2.add(gapSymbolCB);\r
+        jPanel2.add(jLabel1);\r
+        jPanel2.add(fontNameCB);\r
+        jPanel2.add(jLabel2);\r
+        jPanel2.add(jLabel3);\r
+        jPanel2.add(colour);\r
+        jPanel2.add(fontSizeCB);\r
+        jPanel2.add(fontStyleCB);\r
+        jPanel2.add(identity);\r
+        jPanel2.add(fullScreen);\r
+        jPanel2.add(startupCheckbox);\r
+        jPanel2.add(startupFileTextfield);\r
+        jPanel1.add(ok);\r
+        jPanel1.add(cancel);\r
+        this.add(visaulTab, java.awt.BorderLayout.CENTER);\r
+        visaulTab.add(visual, "visual");\r
+        visual.add(jPanel2);\r
+        this.add(jPanel1, java.awt.BorderLayout.SOUTH);\r
+\r
+        DefaultListCellRenderer dlcr = new DefaultListCellRenderer();\r
+        dlcr.setHorizontalAlignment(DefaultListCellRenderer.CENTER);\r
+        gapSymbolCB.setRenderer(dlcr);\r
+    }\r
 \r
-  }\r
+    public void ok_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
+    public void cancel_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  public void startupFileTextfield_mouseClicked()\r
-  {\r
+    public void annotations_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  }\r
+    public void jCheckBox1_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
+    public void startupFileTextfield_mouseClicked() {\r
+    }\r
 }\r
index 17fdb34..341263f 100755 (executable)
 * 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.jbgui;
-
-import java.awt.*;
-import javax.swing.*;
-import java.awt.event.*;
-
-public class GSliderPanel extends JPanel
-{
-  // this is used for conservation colours, PID colours and redundancy threshold
-  protected JSlider slider = new JSlider();
-  protected JTextField valueField = new JTextField();
-  protected JLabel label = new JLabel();
-  JPanel jPanel1 = new JPanel();
-  GridLayout gridLayout1 = new GridLayout();
-  JPanel jPanel2 = new JPanel();
-  protected JButton applyButton = new JButton();
-  protected JButton undoButton = new JButton();
-  FlowLayout flowLayout1 = new FlowLayout();
-  protected JCheckBox allGroupsCheck = new JCheckBox();
-  BorderLayout borderLayout1 = new BorderLayout();
-
-  public GSliderPanel()
-  {
-    try
-    {
-      jbInit();
-    }
-    catch(Exception e)
-    {
-      e.printStackTrace();
-    }
-  }
-  private void jbInit() throws Exception
-  {
-    this.setLayout(gridLayout1);
-    slider.setMajorTickSpacing(10);
-    slider.setMinorTickSpacing(1);
-    slider.setPaintTicks(true);
-    slider.setBackground(Color.white);
-    slider.setFont(new java.awt.Font("Verdana", 0, 11));
-    slider.setDoubleBuffered(true);
-    valueField.setFont(new java.awt.Font("Verdana", 0, 11));
-    valueField.setMinimumSize(new Dimension(6, 14));
-    valueField.setPreferredSize(new Dimension(50, 12));
-    valueField.setText("");
-    valueField.setHorizontalAlignment(SwingConstants.CENTER);
-    valueField.addActionListener(new java.awt.event.ActionListener()
-    {
-      public void actionPerformed(ActionEvent e)
-      {
-        valueField_actionPerformed(e);
-      }
-    });
-    label.setFont(new java.awt.Font("Verdana", 0, 11));
-    label.setOpaque(false);
-    label.setHorizontalAlignment(SwingConstants.CENTER);
-    label.setText("set this label text");
-    jPanel1.setLayout(borderLayout1);
-    gridLayout1.setRows(2);
-    jPanel2.setLayout(flowLayout1);
-    applyButton.setFont(new java.awt.Font("Verdana", 0, 11));
-    applyButton.setOpaque(false);
-    applyButton.setText("Apply");
-    applyButton.addActionListener(new java.awt.event.ActionListener()
-    {
-      public void actionPerformed(ActionEvent e)
-      {
-        applyButton_actionPerformed(e);
-      }
-    });
-    undoButton.setEnabled(false);
-    undoButton.setFont(new java.awt.Font("Verdana", 0, 11));
-    undoButton.setOpaque(false);
-    undoButton.setText("Undo");
-    undoButton.addActionListener(new java.awt.event.ActionListener()
-    {
-      public void actionPerformed(ActionEvent e)
-      {
-        undoButton_actionPerformed(e);
-      }
-    });
-    allGroupsCheck.setEnabled(false);
-    allGroupsCheck.setFont(new java.awt.Font("Verdana", 0, 11));
-    allGroupsCheck.setOpaque(false);
-    allGroupsCheck.setText("Apply to all Groups");
-    allGroupsCheck.addActionListener(new java.awt.event.ActionListener()
-    {
-      public void actionPerformed(ActionEvent e)
-      {
-        allGroupsCheck_actionPerformed(e);
-      }
-    });
-    this.setBackground(Color.white);
-    this.setPreferredSize(new Dimension(415, 84));
-    jPanel2.setOpaque(false);
-    jPanel1.setOpaque(false);
-    this.add(jPanel2, null);
-    jPanel2.add(label, null);
-    jPanel2.add(applyButton, null);
-    jPanel2.add(undoButton, null);this.add(jPanel1, null);
-    jPanel1.add(slider,  BorderLayout.WEST);
-    jPanel1.add(valueField,  BorderLayout.CENTER);
-    jPanel1.add(allGroupsCheck, BorderLayout.EAST);
-
-  }
-
-  protected void valueField_actionPerformed(ActionEvent e)
-  {
-
-  }
-
-  protected void applyButton_actionPerformed(ActionEvent e)
-  {
-
-  }
-
-  protected void undoButton_actionPerformed(ActionEvent e)
-  {
-
-  }
-
-  protected void allGroupsCheck_actionPerformed(ActionEvent e)
-  {
-
-  }
-
-}
+*/\r
+package jalview.jbgui;\r
+\r
+import java.awt.*;\r
+import java.awt.event.*;\r
+\r
+import javax.swing.*;\r
+\r
+\r
+public class GSliderPanel extends JPanel {\r
+    // this is used for conservation colours, PID colours and redundancy threshold\r
+    protected JSlider slider = new JSlider();\r
+    protected JTextField valueField = new JTextField();\r
+    protected JLabel label = new JLabel();\r
+    JPanel jPanel1 = new JPanel();\r
+    GridLayout gridLayout1 = new GridLayout();\r
+    JPanel jPanel2 = new JPanel();\r
+    protected JButton applyButton = new JButton();\r
+    protected JButton undoButton = new JButton();\r
+    FlowLayout flowLayout1 = new FlowLayout();\r
+    protected JCheckBox allGroupsCheck = new JCheckBox();\r
+    BorderLayout borderLayout1 = new BorderLayout();\r
+\r
+    public GSliderPanel() {\r
+        try {\r
+            jbInit();\r
+        } catch (Exception e) {\r
+            e.printStackTrace();\r
+        }\r
+    }\r
+\r
+    private void jbInit() throws Exception {\r
+        this.setLayout(gridLayout1);\r
+        slider.setMajorTickSpacing(10);\r
+        slider.setMinorTickSpacing(1);\r
+        slider.setPaintTicks(true);\r
+        slider.setBackground(Color.white);\r
+        slider.setFont(new java.awt.Font("Verdana", 0, 11));\r
+        slider.setDoubleBuffered(true);\r
+        valueField.setFont(new java.awt.Font("Verdana", 0, 11));\r
+        valueField.setMinimumSize(new Dimension(6, 14));\r
+        valueField.setPreferredSize(new Dimension(50, 12));\r
+        valueField.setText("");\r
+        valueField.setHorizontalAlignment(SwingConstants.CENTER);\r
+        valueField.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    valueField_actionPerformed(e);\r
+                }\r
+            });\r
+        label.setFont(new java.awt.Font("Verdana", 0, 11));\r
+        label.setOpaque(false);\r
+        label.setHorizontalAlignment(SwingConstants.CENTER);\r
+        label.setText("set this label text");\r
+        jPanel1.setLayout(borderLayout1);\r
+        gridLayout1.setRows(2);\r
+        jPanel2.setLayout(flowLayout1);\r
+        applyButton.setFont(new java.awt.Font("Verdana", 0, 11));\r
+        applyButton.setOpaque(false);\r
+        applyButton.setText("Apply");\r
+        applyButton.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    applyButton_actionPerformed(e);\r
+                }\r
+            });\r
+        undoButton.setEnabled(false);\r
+        undoButton.setFont(new java.awt.Font("Verdana", 0, 11));\r
+        undoButton.setOpaque(false);\r
+        undoButton.setText("Undo");\r
+        undoButton.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    undoButton_actionPerformed(e);\r
+                }\r
+            });\r
+        allGroupsCheck.setEnabled(false);\r
+        allGroupsCheck.setFont(new java.awt.Font("Verdana", 0, 11));\r
+        allGroupsCheck.setOpaque(false);\r
+        allGroupsCheck.setText("Apply to all Groups");\r
+        allGroupsCheck.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    allGroupsCheck_actionPerformed(e);\r
+                }\r
+            });\r
+        this.setBackground(Color.white);\r
+        this.setPreferredSize(new Dimension(415, 84));\r
+        jPanel2.setOpaque(false);\r
+        jPanel1.setOpaque(false);\r
+        this.add(jPanel2, null);\r
+        jPanel2.add(label, null);\r
+        jPanel2.add(applyButton, null);\r
+        jPanel2.add(undoButton, null);\r
+        this.add(jPanel1, null);\r
+        jPanel1.add(slider, BorderLayout.WEST);\r
+        jPanel1.add(valueField, BorderLayout.CENTER);\r
+        jPanel1.add(allGroupsCheck, BorderLayout.EAST);\r
+    }\r
+\r
+    protected void valueField_actionPerformed(ActionEvent e) {\r
+    }\r
+\r
+    protected void applyButton_actionPerformed(ActionEvent e) {\r
+    }\r
+\r
+    protected void undoButton_actionPerformed(ActionEvent e) {\r
+    }\r
+\r
+    protected void allGroupsCheck_actionPerformed(ActionEvent e) {\r
+    }\r
+}\r
index 93bb850..5b8c6fa 100755 (executable)
 * 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.jbgui;\r
 \r
 import java.awt.*;\r
-import javax.swing.*;\r
 import java.awt.event.*;\r
 \r
-public class GTreePanel extends JInternalFrame\r
-{\r
-  BorderLayout borderLayout1 = new BorderLayout();\r
-  protected JScrollPane scrollPane = new JScrollPane();\r
-  JMenuBar jMenuBar1 = new JMenuBar();\r
-  JMenu jMenu1 = new JMenu();\r
-  JMenuItem saveAsNewick = new JMenuItem();\r
-  JMenuItem printMenu = new JMenuItem();\r
-  JMenu jMenu2 = new JMenu();\r
-  protected JMenuItem fontSize = new JMenuItem();\r
-  protected JCheckBoxMenuItem bootstrapMenu = new JCheckBoxMenuItem();\r
-  protected JCheckBoxMenuItem distanceMenu = new JCheckBoxMenuItem();\r
-  protected JCheckBoxMenuItem fitToWindow = new JCheckBoxMenuItem();\r
-  protected JCheckBoxMenuItem placeholdersMenu = new JCheckBoxMenuItem();\r
-  JMenuItem pngTree = new JMenuItem();\r
-  JMenuItem epsTree = new JMenuItem();\r
-  JMenu saveAsMenu = new JMenu();\r
-  JMenuItem textbox = new JMenuItem();\r
-\r
-  public GTreePanel()\r
-  {\r
-    try\r
-    {\r
-      jbInit();\r
-      this.setJMenuBar(jMenuBar1);\r
+import javax.swing.*;\r
+\r
+\r
+public class GTreePanel extends JInternalFrame {\r
+    BorderLayout borderLayout1 = new BorderLayout();\r
+    protected JScrollPane scrollPane = new JScrollPane();\r
+    JMenuBar jMenuBar1 = new JMenuBar();\r
+    JMenu jMenu1 = new JMenu();\r
+    JMenuItem saveAsNewick = new JMenuItem();\r
+    JMenuItem printMenu = new JMenuItem();\r
+    JMenu jMenu2 = new JMenu();\r
+    protected JMenuItem fontSize = new JMenuItem();\r
+    protected JCheckBoxMenuItem bootstrapMenu = new JCheckBoxMenuItem();\r
+    protected JCheckBoxMenuItem distanceMenu = new JCheckBoxMenuItem();\r
+    protected JCheckBoxMenuItem fitToWindow = new JCheckBoxMenuItem();\r
+    protected JCheckBoxMenuItem placeholdersMenu = new JCheckBoxMenuItem();\r
+    JMenuItem pngTree = new JMenuItem();\r
+    JMenuItem epsTree = new JMenuItem();\r
+    JMenu saveAsMenu = new JMenu();\r
+    JMenuItem textbox = new JMenuItem();\r
+\r
+    public GTreePanel() {\r
+        try {\r
+            jbInit();\r
+            this.setJMenuBar(jMenuBar1);\r
+        } catch (Exception e) {\r
+            e.printStackTrace();\r
+        }\r
+    }\r
+\r
+    private void jbInit() throws Exception {\r
+        this.getContentPane().setLayout(borderLayout1);\r
+        this.setBackground(Color.white);\r
+        this.setFont(new java.awt.Font("Verdana", 0, 12));\r
+        scrollPane.setOpaque(false);\r
+        jMenu1.setText("File");\r
+        saveAsNewick.setText("Newick Format");\r
+        saveAsNewick.addActionListener(new ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    saveAsNewick_actionPerformed(e);\r
+                }\r
+            });\r
+        printMenu.setText("Print");\r
+        printMenu.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    printMenu_actionPerformed(e);\r
+                }\r
+            });\r
+        jMenu2.setText("View");\r
+        fontSize.setText("Font Size - 12");\r
+        fontSize.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    fontSize_actionPerformed(e);\r
+                }\r
+            });\r
+        bootstrapMenu.setText("Show Bootstrap Values");\r
+        bootstrapMenu.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    bootstrapMenu_actionPerformed(e);\r
+                }\r
+            });\r
+        distanceMenu.setText("Show Distances");\r
+        distanceMenu.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    distanceMenu_actionPerformed(e);\r
+                }\r
+            });\r
+        fitToWindow.setSelected(true);\r
+        fitToWindow.setText("Fit To Window");\r
+        fitToWindow.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    fitToWindow_actionPerformed(e);\r
+                }\r
+            });\r
+        epsTree.setText("EPS");\r
+        epsTree.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    epsTree_actionPerformed(e);\r
+                }\r
+            });\r
+        pngTree.setText("PNG");\r
+        pngTree.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    pngTree_actionPerformed(e);\r
+                }\r
+            });\r
+        saveAsMenu.setText("Save as");\r
+        placeholdersMenu.setToolTipText(\r
+            "Marks leaves of tree not associated with a sequence");\r
+        placeholdersMenu.setText("Mark Unlinked Leaves");\r
+        placeholdersMenu.addActionListener(new ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    placeholdersMenu_actionPerformed(e);\r
+                }\r
+            });\r
+        textbox.setText("Output to Textbox...");\r
+        textbox.addActionListener(new ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    textbox_actionPerformed(e);\r
+                }\r
+            });\r
+        this.getContentPane().add(scrollPane, BorderLayout.CENTER);\r
+        jMenuBar1.add(jMenu1);\r
+        jMenuBar1.add(jMenu2);\r
+        jMenu1.add(saveAsMenu);\r
+        jMenu1.add(textbox);\r
+        jMenu1.add(printMenu);\r
+        jMenu2.add(fitToWindow);\r
+        jMenu2.add(fontSize);\r
+        jMenu2.add(distanceMenu);\r
+        jMenu2.add(bootstrapMenu);\r
+        jMenu2.add(placeholdersMenu);\r
+        saveAsMenu.add(saveAsNewick);\r
+        saveAsMenu.add(epsTree);\r
+        saveAsMenu.add(pngTree);\r
+    }\r
+\r
+    protected void printMenu_actionPerformed(ActionEvent e) {\r
+    }\r
+\r
+    protected void fontSize_actionPerformed(ActionEvent e) {\r
+    }\r
+\r
+    protected void distanceMenu_actionPerformed(ActionEvent e) {\r
+    }\r
+\r
+    protected void bootstrapMenu_actionPerformed(ActionEvent e) {\r
+    }\r
+\r
+    protected void fitToWindow_actionPerformed(ActionEvent e) {\r
+    }\r
+\r
+    protected void pngTree_actionPerformed(ActionEvent e) {\r
+    }\r
+\r
+    protected void epsTree_actionPerformed(ActionEvent e) {\r
     }\r
-    catch(Exception e)\r
-    {\r
-      e.printStackTrace();\r
+\r
+    protected void saveAsNewick_actionPerformed(ActionEvent e) {\r
     }\r
 \r
-  }\r
-  private void jbInit() throws Exception\r
-  {\r
-    this.getContentPane().setLayout(borderLayout1);\r
-    this.setBackground(Color.white);\r
-    this.setFont(new java.awt.Font("Verdana", 0, 12));\r
-    scrollPane.setOpaque(false);\r
-    jMenu1.setText("File");\r
-    saveAsNewick.setText("Newick Format");\r
-    saveAsNewick.addActionListener(new ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        saveAsNewick_actionPerformed(e);\r
-      }\r
-    });\r
-    printMenu.setText("Print");\r
-    printMenu.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        printMenu_actionPerformed(e);\r
-      }\r
-    });\r
-    jMenu2.setText("View");\r
-    fontSize.setText("Font Size - 12");\r
-    fontSize.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        fontSize_actionPerformed(e);\r
-      }\r
-    });\r
-    bootstrapMenu.setText("Show Bootstrap Values");\r
-    bootstrapMenu.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        bootstrapMenu_actionPerformed(e);\r
-      }\r
-    });\r
-    distanceMenu.setText("Show Distances");\r
-    distanceMenu.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        distanceMenu_actionPerformed(e);\r
-      }\r
-    });\r
-    fitToWindow.setSelected(true);\r
-    fitToWindow.setText("Fit To Window");\r
-    fitToWindow.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        fitToWindow_actionPerformed(e);\r
-      }\r
-    });\r
-    epsTree.setText("EPS");\r
-    epsTree.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        epsTree_actionPerformed(e);\r
-      }\r
-    });\r
-    pngTree.setText("PNG");\r
-    pngTree.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        pngTree_actionPerformed(e);\r
-      }\r
-    });\r
-    saveAsMenu.setText("Save as");\r
-    placeholdersMenu.setToolTipText(\r
-        "Marks leaves of tree not associated with a sequence");\r
-    placeholdersMenu.setText("Mark Unlinked Leaves");\r
-    placeholdersMenu.addActionListener(new ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        placeholdersMenu_actionPerformed(e);\r
-      }\r
-    });\r
-    textbox.setText("Output to Textbox...");\r
-    textbox.addActionListener(new ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        textbox_actionPerformed(e);\r
-      }\r
-    });\r
-    this.getContentPane().add(scrollPane, BorderLayout.CENTER);\r
-    jMenuBar1.add(jMenu1);\r
-    jMenuBar1.add(jMenu2);\r
-    jMenu1.add(saveAsMenu);\r
-    jMenu1.add(textbox);\r
-    jMenu1.add(printMenu);\r
-    jMenu2.add(fitToWindow);\r
-    jMenu2.add(fontSize);\r
-    jMenu2.add(distanceMenu);\r
-    jMenu2.add(bootstrapMenu);\r
-    jMenu2.add(placeholdersMenu);\r
-    saveAsMenu.add(saveAsNewick);\r
-    saveAsMenu.add(epsTree);\r
-    saveAsMenu.add(pngTree);\r
-  }\r
-\r
-\r
-  protected void printMenu_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-  protected void fontSize_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-  protected void distanceMenu_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-  protected void bootstrapMenu_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-  protected void fitToWindow_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-  protected void pngTree_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-  protected void epsTree_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-  protected void saveAsNewick_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-  protected void placeholdersMenu_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-  public void textbox_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
+    protected void placeholdersMenu_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
+    public void textbox_actionPerformed(ActionEvent e) {\r
+    }\r
 }\r
index 4d62593..3cd9f51 100755 (executable)
 * 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.jbgui;\r
 \r
-import javax.swing.*;\r
 import java.awt.*;\r
 import java.awt.event.*;\r
 \r
+import javax.swing.*;\r
 \r
-public class GUserDefinedColours extends JPanel\r
-{\r
-  protected JColorChooser colorChooser = new JColorChooser();\r
-  protected JPanel buttonPanel = new JPanel();\r
-  protected GridLayout gridLayout = new GridLayout();\r
-  JPanel jPanel2 = new JPanel();\r
-  protected JButton okButton = new JButton();\r
-  protected JButton applyButton = new JButton();\r
-  protected JButton loadbutton = new JButton();\r
-  protected JButton savebutton = new JButton();\r
-  protected JButton cancelButton = new JButton();\r
-  FlowLayout flowLayout1 = new FlowLayout();\r
 \r
-  public GUserDefinedColours()\r
-  {\r
-    try\r
-    {\r
-      jbInit();\r
-    }\r
-    catch(Exception e)\r
-    {\r
-      e.printStackTrace();\r
+public class GUserDefinedColours extends JPanel {\r
+    protected JColorChooser colorChooser = new JColorChooser();\r
+    protected JPanel buttonPanel = new JPanel();\r
+    protected GridLayout gridLayout = new GridLayout();\r
+    JPanel jPanel2 = new JPanel();\r
+    protected JButton okButton = new JButton();\r
+    protected JButton applyButton = new JButton();\r
+    protected JButton loadbutton = new JButton();\r
+    protected JButton savebutton = new JButton();\r
+    protected JButton cancelButton = new JButton();\r
+    FlowLayout flowLayout1 = new FlowLayout();\r
+\r
+    public GUserDefinedColours() {\r
+        try {\r
+            jbInit();\r
+        } catch (Exception e) {\r
+            e.printStackTrace();\r
+        }\r
     }\r
-  }\r
-  private void jbInit() throws Exception\r
-  {\r
-    this.setLayout(flowLayout1);\r
-    buttonPanel.setLayout(gridLayout);\r
-    gridLayout.setColumns(6);\r
-    gridLayout.setRows(4);\r
-    okButton.setFont(new java.awt.Font("Verdana", 0, 11));\r
-    okButton.setText("OK");\r
-    okButton.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        okButton_actionPerformed(e);\r
-      }\r
-    });\r
-    applyButton.setFont(new java.awt.Font("Verdana", 0, 11));\r
-    applyButton.setText("Apply");\r
-    applyButton.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        applyButton_actionPerformed(e);\r
-      }\r
-    });\r
-    loadbutton.setFont(new java.awt.Font("Verdana", 0, 11));\r
-    loadbutton.setText("Load scheme");\r
-    loadbutton.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        loadbutton_actionPerformed(e);\r
-      }\r
-    });\r
-    savebutton.setFont(new java.awt.Font("Verdana", 0, 11));\r
-    savebutton.setText("Save scheme");\r
-    savebutton.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        savebutton_actionPerformed(e);\r
-      }\r
-    });\r
-    cancelButton.setFont(new java.awt.Font("Verdana", 0, 11));\r
-    cancelButton.setText("Cancel");\r
-    cancelButton.addActionListener(new java.awt.event.ActionListener()\r
-    {\r
-      public void actionPerformed(ActionEvent e)\r
-      {\r
-        cancelButton_actionPerformed(e);\r
-      }\r
-    });\r
-    this.setBackground(new Color(212, 208, 223));\r
-    jPanel2.setOpaque(false);\r
-    colorChooser.setOpaque(false);\r
-    this.add(colorChooser, null);\r
-    this.add(buttonPanel, null);\r
-     this.add(jPanel2, null);\r
-    jPanel2.add(okButton, null);\r
-    jPanel2.add(applyButton, null);\r
-    jPanel2.add(loadbutton, null);\r
-    jPanel2.add(savebutton, null);\r
-    jPanel2.add(cancelButton, null);\r
-  }\r
-\r
-\r
-  protected void okButton_actionPerformed(ActionEvent e)\r
-  {\r
-\r
-  }\r
-\r
-  protected void applyButton_actionPerformed(ActionEvent e)\r
-  {\r
 \r
-  }\r
-\r
-  protected void loadbutton_actionPerformed(ActionEvent e)\r
-  {\r
+    private void jbInit() throws Exception {\r
+        this.setLayout(flowLayout1);\r
+        buttonPanel.setLayout(gridLayout);\r
+        gridLayout.setColumns(6);\r
+        gridLayout.setRows(4);\r
+        okButton.setFont(new java.awt.Font("Verdana", 0, 11));\r
+        okButton.setText("OK");\r
+        okButton.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    okButton_actionPerformed(e);\r
+                }\r
+            });\r
+        applyButton.setFont(new java.awt.Font("Verdana", 0, 11));\r
+        applyButton.setText("Apply");\r
+        applyButton.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    applyButton_actionPerformed(e);\r
+                }\r
+            });\r
+        loadbutton.setFont(new java.awt.Font("Verdana", 0, 11));\r
+        loadbutton.setText("Load scheme");\r
+        loadbutton.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    loadbutton_actionPerformed(e);\r
+                }\r
+            });\r
+        savebutton.setFont(new java.awt.Font("Verdana", 0, 11));\r
+        savebutton.setText("Save scheme");\r
+        savebutton.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    savebutton_actionPerformed(e);\r
+                }\r
+            });\r
+        cancelButton.setFont(new java.awt.Font("Verdana", 0, 11));\r
+        cancelButton.setText("Cancel");\r
+        cancelButton.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    cancelButton_actionPerformed(e);\r
+                }\r
+            });\r
+        this.setBackground(new Color(212, 208, 223));\r
+        jPanel2.setOpaque(false);\r
+        colorChooser.setOpaque(false);\r
+        this.add(colorChooser, null);\r
+        this.add(buttonPanel, null);\r
+        this.add(jPanel2, null);\r
+        jPanel2.add(okButton, null);\r
+        jPanel2.add(applyButton, null);\r
+        jPanel2.add(loadbutton, null);\r
+        jPanel2.add(savebutton, null);\r
+        jPanel2.add(cancelButton, null);\r
+    }\r
 \r
-  }\r
+    protected void okButton_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  protected void savebutton_actionPerformed(ActionEvent e)\r
-  {\r
+    protected void applyButton_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  }\r
+    protected void loadbutton_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  protected void cancelButton_actionPerformed(ActionEvent e)\r
-  {\r
+    protected void savebutton_actionPerformed(ActionEvent e) {\r
+    }\r
 \r
-  }\r
+    protected void cancelButton_actionPerformed(ActionEvent e) {\r
+    }\r
 }\r
index 4d3aab6..54eab04 100755 (executable)
 * 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.jbgui;
-
-import java.awt.*;
-import javax.swing.*;
-import java.awt.event.*;
-
-public class GWebserviceInfo extends JPanel
-{
-  protected JTextArea infoText = new JTextArea();
-  JScrollPane jScrollPane1 = new JScrollPane();
-  JScrollPane jScrollPane2 = new JScrollPane();
-  protected JTextArea progressText = new JTextArea();
-  JPanel jPanel1 = new JPanel();
-  BorderLayout borderLayout1 = new BorderLayout();
-  BorderLayout borderLayout2 = new BorderLayout();
-  protected JPanel titlePanel = new JPanel();
-  BorderLayout borderLayout3 = new BorderLayout();
-  JPanel jPanel2 = new JPanel();
-  protected JButton cancel = new JButton();
-  GridBagLayout gridBagLayout1 = new GridBagLayout();
-
-  public GWebserviceInfo()
-  {
-    try
-    {
-      jbInit();
-    }
-    catch(Exception e)
-    {
-      e.printStackTrace();
-    }
-  }
-  private void jbInit() throws Exception
-  {
-    infoText.setFont(new java.awt.Font("Verdana", 0, 10));
-    infoText.setBorder(null);
-    infoText.setEditable(false);
-    infoText.setText("");
-    infoText.setLineWrap(true);
-    infoText.setWrapStyleWord(true);
-    this.setLayout(borderLayout1);
-    progressText.setFont(new java.awt.Font("Verdana", 0, 10));
-    progressText.setBorder(null);
-    progressText.setEditable(false);
-    progressText.setText("");
-    progressText.setLineWrap(true);
-    progressText.setWrapStyleWord(true);
-    jPanel1.setLayout(borderLayout2);
-    titlePanel.setBackground(Color.white);
-    titlePanel.setPreferredSize(new Dimension(0, 60));
-    titlePanel.setLayout(borderLayout3);
-    jScrollPane2.setBorder(null);
-    jScrollPane1.setBorder(null);
-    jScrollPane1.setPreferredSize(new Dimension(400, 70));
-    cancel.setFont(new java.awt.Font("Verdana", 0, 11));
-    cancel.setText("Cancel");
-    cancel.addActionListener(new java.awt.event.ActionListener()
-    {
-      public void actionPerformed(ActionEvent e)
-      {
-        cancel_actionPerformed(e);
-      }
-    });
-    jPanel2.setLayout(gridBagLayout1);
-    jPanel2.setOpaque(false);
-    this.add(jScrollPane2, BorderLayout.CENTER);
-    this.add(jPanel1, BorderLayout.NORTH);
-    jPanel1.add(jScrollPane1, BorderLayout.CENTER);
-    jScrollPane1.getViewport().add(infoText, null);
-    jScrollPane2.getViewport().add(progressText, null);
-    jPanel1.add(titlePanel, BorderLayout.NORTH);
-    titlePanel.add(jPanel2, BorderLayout.EAST);
-    jPanel2.add(cancel,    new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0
-            ,GridBagConstraints.SOUTH, GridBagConstraints.NONE, new Insets(24, 5, 21, 5), 0, 0));
-  }
-
-  protected void cancel_actionPerformed(ActionEvent e)
-  {
-
-  }
-}
+*/\r
+package jalview.jbgui;\r
+\r
+import java.awt.*;\r
+import java.awt.event.*;\r
+\r
+import javax.swing.*;\r
+\r
+\r
+public class GWebserviceInfo extends JPanel {\r
+    protected JTextArea infoText = new JTextArea();\r
+    JScrollPane jScrollPane1 = new JScrollPane();\r
+    JScrollPane jScrollPane2 = new JScrollPane();\r
+    protected JTextArea progressText = new JTextArea();\r
+    JPanel jPanel1 = new JPanel();\r
+    BorderLayout borderLayout1 = new BorderLayout();\r
+    BorderLayout borderLayout2 = new BorderLayout();\r
+    protected JPanel titlePanel = new JPanel();\r
+    BorderLayout borderLayout3 = new BorderLayout();\r
+    JPanel jPanel2 = new JPanel();\r
+    protected JButton cancel = new JButton();\r
+    GridBagLayout gridBagLayout1 = new GridBagLayout();\r
+\r
+    public GWebserviceInfo() {\r
+        try {\r
+            jbInit();\r
+        } catch (Exception e) {\r
+            e.printStackTrace();\r
+        }\r
+    }\r
+\r
+    private void jbInit() throws Exception {\r
+        infoText.setFont(new java.awt.Font("Verdana", 0, 10));\r
+        infoText.setBorder(null);\r
+        infoText.setEditable(false);\r
+        infoText.setText("");\r
+        infoText.setLineWrap(true);\r
+        infoText.setWrapStyleWord(true);\r
+        this.setLayout(borderLayout1);\r
+        progressText.setFont(new java.awt.Font("Verdana", 0, 10));\r
+        progressText.setBorder(null);\r
+        progressText.setEditable(false);\r
+        progressText.setText("");\r
+        progressText.setLineWrap(true);\r
+        progressText.setWrapStyleWord(true);\r
+        jPanel1.setLayout(borderLayout2);\r
+        titlePanel.setBackground(Color.white);\r
+        titlePanel.setPreferredSize(new Dimension(0, 60));\r
+        titlePanel.setLayout(borderLayout3);\r
+        jScrollPane2.setBorder(null);\r
+        jScrollPane1.setBorder(null);\r
+        jScrollPane1.setPreferredSize(new Dimension(400, 70));\r
+        cancel.setFont(new java.awt.Font("Verdana", 0, 11));\r
+        cancel.setText("Cancel");\r
+        cancel.addActionListener(new java.awt.event.ActionListener() {\r
+                public void actionPerformed(ActionEvent e) {\r
+                    cancel_actionPerformed(e);\r
+                }\r
+            });\r
+        jPanel2.setLayout(gridBagLayout1);\r
+        jPanel2.setOpaque(false);\r
+        this.add(jScrollPane2, BorderLayout.CENTER);\r
+        this.add(jPanel1, BorderLayout.NORTH);\r
+        jPanel1.add(jScrollPane1, BorderLayout.CENTER);\r
+        jScrollPane1.getViewport().add(infoText, null);\r
+        jScrollPane2.getViewport().add(progressText, null);\r
+        jPanel1.add(titlePanel, BorderLayout.NORTH);\r
+        titlePanel.add(jPanel2, BorderLayout.EAST);\r
+        jPanel2.add(cancel,\r
+            new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0,\r
+                GridBagConstraints.SOUTH, GridBagConstraints.NONE,\r
+                new Insets(24, 5, 21, 5), 0, 0));\r
+    }\r
+\r
+    protected void cancel_actionPerformed(ActionEvent e) {\r
+    }\r
+}\r
index 3b93d6d..30c534b 100755 (executable)
 * 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.math;\r
 \r
 import jalview.util.*;\r
 \r
 import java.io.*;\r
 \r
-public class Matrix {\r
-\r
-  /**\r
-   * SMJSPUBLIC\r
-   */\r
-  public double[][] value;\r
-  public int rows;\r
-  public int cols;\r
-  public double[] d;  // Diagonal\r
-  public double[] e;  // off diagonal\r
-\r
-  public Matrix(double[][] value, int rows, int cols) {\r
-    this.rows = rows;\r
-    this.cols = cols;\r
-    this.value = value;\r
-  }\r
-\r
-  public Matrix transpose() {\r
-    double[][] out = new double[cols][rows];\r
-\r
-    for (int i = 0; i < cols; i++) {\r
-      for (int j = 0; j < rows ; j++) {\r
-        out[i][j] = value[j][i];\r
-      }\r
-    }\r
-    return new Matrix(out,cols,rows);\r
-  }\r
-\r
-  public void print(PrintStream ps) {\r
 \r
-    for (int i = 0; i < rows; i++) {\r
-      for (int j = 0; j < cols; j++) {\r
-        Format.print(ps,"%8.2f",value[i][j]);\r
-      }\r
-      ps.println();\r
+public class Matrix {\r
+    /**\r
+     * SMJSPUBLIC\r
+     */\r
+    public double[][] value;\r
+    public int rows;\r
+    public int cols;\r
+    public double[] d; // Diagonal\r
+    public double[] e; // off diagonal\r
+\r
+    public Matrix(double[][] value, int rows, int cols) {\r
+        this.rows = rows;\r
+        this.cols = cols;\r
+        this.value = value;\r
     }\r
-  }\r
 \r
+    public Matrix transpose() {\r
+        double[][] out = new double[cols][rows];\r
 \r
-  public Matrix  preMultiply(Matrix in) {\r
-    double[][] tmp = new double[in.rows][this.cols];\r
-\r
-    for (int i = 0; i < in.rows; i++) {\r
-      for (int j = 0; j < this.cols; j++ ) {\r
-        tmp[i][j] = 0.0;\r
-\r
-        for (int k = 0; k < in.cols; k++) {\r
-          tmp[i][j] += in.value[i][k]*this.value[k][j];\r
+        for (int i = 0; i < cols; i++) {\r
+            for (int j = 0; j < rows; j++) {\r
+                out[i][j] = value[j][i];\r
+            }\r
         }\r
 \r
-      }\r
+        return new Matrix(out, cols, rows);\r
     }\r
 \r
-    return new Matrix(tmp,in.rows,this.cols);\r
-  }\r
+    public void print(PrintStream ps) {\r
+        for (int i = 0; i < rows; i++) {\r
+            for (int j = 0; j < cols; j++) {\r
+                Format.print(ps, "%8.2f", value[i][j]);\r
+            }\r
 \r
-  public double[] vectorPostMultiply(double[] in) {\r
-    double[] out = new double[in.length];\r
-    for (int i = 0; i < in.length; i++) {\r
-      out[i] = 0.0;\r
-      for (int k=0; k < in.length; k++) {\r
-        out[i] += value[i][k] * in[k];\r
-      }\r
+            ps.println();\r
+        }\r
     }\r
-    return out;\r
-  }\r
-  public Matrix postMultiply(Matrix in) {\r
 \r
-    double[][] out = new double[this.rows][in.cols];\r
-    for (int i = 0; i < this.rows; i++) {\r
-      for (int j = 0; j < in.cols; j++ ) {\r
+    public Matrix preMultiply(Matrix in) {\r
+        double[][] tmp = new double[in.rows][this.cols];\r
 \r
-        out[i][j] = 0.0;\r
+        for (int i = 0; i < in.rows; i++) {\r
+            for (int j = 0; j < this.cols; j++) {\r
+                tmp[i][j] = 0.0;\r
 \r
-        for (int k = 0; k < rows; k++) {\r
-          out[i][j] = out[i][j] + value[i][k]*in.value[k][j];\r
+                for (int k = 0; k < in.cols; k++) {\r
+                    tmp[i][j] += (in.value[i][k] * this.value[k][j]);\r
+                }\r
+            }\r
         }\r
 \r
-      }\r
+        return new Matrix(tmp, in.rows, this.cols);\r
     }\r
-    return new Matrix(out,this.cols,in.rows);\r
-  }\r
 \r
-  public Matrix copy() {\r
-    double[][] newmat = new double[rows][cols];\r
+    public double[] vectorPostMultiply(double[] in) {\r
+        double[] out = new double[in.length];\r
 \r
-    for (int i = 0; i < rows; i++) {\r
-      for (int j = 0; j < cols; j++) {\r
-        newmat[i][j] = value[i][j];\r
-      }\r
-    }\r
-    return new Matrix(newmat,rows,cols);\r
-  }\r
-\r
-  public void tred() {\r
-    int n = rows;\r
-    int l;\r
-    int k;\r
-    int j;\r
-    int i;\r
-\r
-    double scale;\r
-    double hh;\r
-    double h;\r
-    double g;\r
-    double f;\r
-\r
-    this.d = new double[rows];\r
-    this.e = new double[rows];\r
-\r
-    for (i=n; i >= 2;i--) {\r
-      l=i-1;\r
-      h = 0.0;\r
-      scale = 0.0;\r
-\r
-      if (l > 1) {\r
-        for (k=1;k<=l;k++) {\r
-          scale += Math.abs(value[i-1][k-1]);\r
-        }\r
-        if (scale == 0.0) {\r
-          e[i-1] = value[i-1][l-1];\r
-        } else {\r
-          for (k=1; k <= l; k++) {\r
-            value[i-1][k-1] /= scale;\r
-            h += value[i-1][k-1]*value[i-1][k-1];\r
-          }\r
-          f = value[i-1][l-1];\r
-          if (f>0) {\r
-            g = -1.0*Math.sqrt(h);\r
-          } else {\r
-            g = Math.sqrt(h);\r
-          }\r
-          e[i-1] = scale*g;\r
-          h -= f*g;\r
-          value[i-1][l-1] = f-g;\r
-          f=0.0;\r
-          for (j=1; j <= l; j++) {\r
-            value[j-1][i-1] = value[i-1][j-1]/h;\r
-            g=0.0;\r
-            for (k= 1; k <= j; k++) {\r
-              g += value[j-1][k-1]*value[i-1][k-1];\r
-            }\r
-            for (k=j+1; k<=l;k++) {\r
-              g+= value[k-1][j-1]*value[i-1][k-1];\r
-            }\r
-            e[j-1] = g/h;\r
-            f+=e[j-1]*value[i-1][j-1];\r
-          }\r
-          hh=f/(h+h);\r
-          for (j=1;j<=l;j++) {\r
-            f=value[i-1][j-1];\r
-            g = e[j-1] - hh*f;\r
-            e[j-1] = g;\r
-            for (k=1;k<=j;k++) {\r
-              value[j-1][k-1] -= (f*e[k-1]+g*value[i-1][k-1]);\r
-            }\r
-          }\r
-        }\r
-      } else {\r
-        e[i-1] = value[i-1][l-1];\r
-      }\r
-      d[i-1] = h;\r
-    }\r
-    d[0] = 0.0;\r
-    e[0] = 0.0;\r
-    for (i=1;i<=n;i++) {\r
-      l=i-1;\r
-      if (d[i-1] != 0.0) {\r
-        for (j=1;j<=l;j++) {\r
-          g=0.0;\r
-          for (k=1;k<=l;k++) {\r
-            g+= value[i-1][k-1]*value[k-1][j-1];\r
-          }\r
-          for (k=1;k<=l;k++) {\r
-            value[k-1][j-1] -= g*value[k-1][i-1];\r
-          }\r
-        }\r
-      }\r
-      d[i-1] = value[i-1][i-1];\r
-      value[i-1][i-1] = 1.0;\r
-      for (j=1;j<=l;j++) {\r
-        value[j-1][i-1] = 0.0;\r
-        value[i-1][j-1] = 0.0;\r
-      }\r
-    }\r
-  }\r
-\r
-  public void tqli() {\r
-    int n = rows;\r
-\r
-    int m;\r
-    int l;\r
-    int iter;\r
-    int i;\r
-    int k;\r
-    double s;\r
-    double r;\r
-    double p;\r
-    ;\r
-    double g;\r
-    double f;\r
-    double dd;\r
-    double c;\r
-    double b;\r
-\r
-    for (i=2;i<=n;i++) {\r
-      e[i-2] = e[i-1];\r
-    }\r
-    e[n-1] = 0.0;\r
-    for (l=1;l<=n;l++) {\r
-      iter=0;\r
-      do {\r
-        for (m=l;m<=(n-1);m++) {\r
-          dd=Math.abs(d[m-1]) + Math.abs(d[m]);\r
-          if (Math.abs(e[m-1]) + dd == dd)\r
-            break;\r
-        }\r
-        if (m != l) {\r
-          iter++;\r
-          if (iter == 30) {\r
-            System.err.print("Too many iterations in tqli");\r
-            System.exit(0); // JBPNote - should this really be here ???\r
-          } else {\r
-            //     System.out.println("Iteration " + iter);\r
-          }\r
-          g=(d[l]-d[l-1])/(2.0*e[l-1]);\r
-          r = Math.sqrt((g*g) + 1.0);\r
-          g=d[m-1]-d[l-1]+e[l-1]/(g + sign(r,g));\r
-          c = 1.0;\r
-          s = c;\r
-          p=0.0;\r
-          for (i=m-1;i>=l;i--) {\r
-            f = s*e[i-1];\r
-            b = c*e[i-1];\r
-            if (Math.abs(f) >= Math.abs(g)) {\r
-              c=g/f;\r
-              r = Math.sqrt((c*c)+1.0);\r
-              e[i] = f*r;\r
-              s = 1.0/r;\r
-              c *= s;\r
-            } else {\r
-              s=f/g;\r
-              r = Math.sqrt((s*s)+1.0);\r
-              e[i] = g*r;\r
-              c = 1.0/r;\r
-              s *= c;\r
-            }\r
-            g=d[i] -p;\r
-            r=(d[i-1]-g)*s + 2.0*c*b;\r
-            p=s*r;\r
-            d[i] = g + p;\r
-            g = c * r - b;\r
-            for (k=1; k <= n; k++) {\r
-              f=value[k-1][i];\r
-              value[k-1][i] = s*value[k-1][i-1] + c*f;\r
-              value[k-1][i-1] = c*value[k-1][i-1] - s*f;\r
-            }\r
-          }\r
-          d[l-1] = d[l-1] - p;\r
-          e[l-1] = g;\r
-          e[m-1] = 0.0;\r
-        }\r
-      } while ( m != l);\r
-    }\r
-  }\r
-  public void tred2() {\r
-    int n = rows;\r
-    int l;\r
-    int k;\r
-    int j;\r
-    int i;\r
-\r
-    double scale;\r
-    double hh;\r
-    double h;\r
-    double g;\r
-    double f;\r
-\r
-    this.d = new double[rows];\r
-    this.e = new double[rows];\r
-\r
-    for (i=n-1; i >= 1;i--) {\r
-      l=i-1;\r
-      h = 0.0;\r
-      scale = 0.0;\r
-\r
-      if (l > 0) {\r
-        for (k=0;k<l;k++) {\r
-          scale += Math.abs(value[i][k]);\r
-        }\r
-        if (scale == 0.0) {\r
-          e[i] = value[i][l];\r
-        } else {\r
-          for (k=0; k < l; k++) {\r
-            value[i][k] /= scale;\r
-            h += value[i][k]*value[i][k];\r
-          }\r
-          f = value[i][l];\r
-          if (f>0) {\r
-            g = -1.0*Math.sqrt(h);\r
-          } else {\r
-            g = Math.sqrt(h);\r
-          }\r
-          e[i] = scale*g;\r
-          h -= f*g;\r
-          value[i][l] = f-g;\r
-          f=0.0;\r
-          for (j=0; j < l; j++) {\r
-            value[j][i] = value[i][j]/h;\r
-            g=0.0;\r
-            for (k= 0; k < j; k++) {\r
-              g += value[j][k]*value[i][k];\r
-            }\r
-            for (k=j; k<l;k++) {\r
-              g+= value[k][j]*value[i][k];\r
-            }\r
-            e[j] = g/h;\r
-            f+=e[j]*value[i][j];\r
-          }\r
-          hh=f/(h+h);\r
-          for (j=0;j<l;j++) {\r
-            f=value[i][j];\r
-            g = e[j] - hh*f;\r
-            e[j] = g;\r
-            for (k=0;k<j;k++) {\r
-              value[j][k] -= (f*e[k]+g*value[i][k]);\r
-            }\r
-          }\r
-        }\r
-      } else {\r
-        e[i] = value[i][l];\r
-      }\r
-      d[i] = h;\r
-    }\r
-    d[0] = 0.0;\r
-    e[0] = 0.0;\r
-    for (i=0;i<n;i++) {\r
-      l=i-1;\r
-      if (d[i] != 0.0) {\r
-        for (j=0;j<l;j++) {\r
-          g=0.0;\r
-          for (k=0;k<l;k++) {\r
-            g+= value[i][k]*value[k][j];\r
-          }\r
-          for (k=0;k<l;k++) {\r
-            value[k][j] -= g*value[k][i];\r
-          }\r
-        }\r
-      }\r
-      d[i] = value[i][i];\r
-      value[i][i] = 1.0;\r
-      for (j=0;j<l;j++) {\r
-        value[j][i] = 0.0;\r
-        value[i][j] = 0.0;\r
-      }\r
-    }\r
-  }\r
-\r
-  public void tqli2() {\r
-    int n = rows;\r
-\r
-    int m;\r
-    int l;\r
-    int iter;\r
-    int i;\r
-    int k;\r
-    double s;\r
-    double r;\r
-    double p;\r
-    ;\r
-    double g;\r
-    double f;\r
-    double dd;\r
-    double c;\r
-    double b;\r
-\r
-    for (i=2;i<=n;i++) {\r
-      e[i-2] = e[i-1];\r
-    }\r
-    e[n-1] = 0.0;\r
-    for (l=1;l<=n;l++) {\r
-      iter=0;\r
-      do {\r
-        for (m=l;m<=(n-1);m++) {\r
-          dd=Math.abs(d[m-1]) + Math.abs(d[m]);\r
-          if (Math.abs(e[m-1]) + dd == dd)\r
-            break;\r
-        }\r
-        if (m != l) {\r
-          iter++;\r
-          if (iter == 30) {\r
-            System.err.print("Too many iterations in tqli");\r
-            System.exit(0); // JBPNote - same as above - not a graceful exit!\r
-          } else {\r
-            //     System.out.println("Iteration " + iter);\r
-          }\r
-          g=(d[l]-d[l-1])/(2.0*e[l-1]);\r
-          r = Math.sqrt((g*g) + 1.0);\r
-          g=d[m-1]-d[l-1]+e[l-1]/(g + sign(r,g));\r
-          c = 1.0;\r
-          s = c;\r
-          p=0.0;\r
-          for (i=m-1;i>=l;i--) {\r
-            f = s*e[i-1];\r
-            b = c*e[i-1];\r
-            if (Math.abs(f) >= Math.abs(g)) {\r
-              c=g/f;\r
-              r = Math.sqrt((c*c)+1.0);\r
-              e[i] = f*r;\r
-              s = 1.0/r;\r
-              c *= s;\r
-            } else {\r
-              s=f/g;\r
-              r = Math.sqrt((s*s)+1.0);\r
-              e[i] = g*r;\r
-              c = 1.0/r;\r
-              s *= c;\r
-            }\r
-            g=d[i] -p;\r
-            r=(d[i-1]-g)*s + 2.0*c*b;\r
-            p=s*r;\r
-            d[i] = g + p;\r
-            g = c * r - b;\r
-            for (k=1; k <= n; k++) {\r
-              f=value[k-1][i];\r
-              value[k-1][i] = s*value[k-1][i-1] + c*f;\r
-              value[k-1][i-1] = c*value[k-1][i-1] - s*f;\r
+        for (int i = 0; i < in.length; i++) {\r
+            out[i] = 0.0;\r
+\r
+            for (int k = 0; k < in.length; k++) {\r
+                out[i] += (value[i][k] * in[k]);\r
             }\r
-          }\r
-          d[l-1] = d[l-1] - p;\r
-          e[l-1] = g;\r
-          e[m-1] = 0.0;\r
         }\r
-      } while ( m != l);\r
-    }\r
-  }\r
 \r
-  public double sign(double a, double b) {\r
-    if (b < 0) {\r
-      return -Math.abs(a);\r
-    } else {\r
-      return Math.abs(a);\r
+        return out;\r
     }\r
-  }\r
 \r
-  public double[] getColumn(int n) {\r
-    double[] out  = new double[rows];\r
-    for (int i=0;i<rows;i++) {\r
-      out[i] = value[i][n];\r
-    }\r
-    return out;\r
-  }\r
+    public Matrix postMultiply(Matrix in) {\r
+        double[][] out = new double[this.rows][in.cols];\r
 \r
+        for (int i = 0; i < this.rows; i++) {\r
+            for (int j = 0; j < in.cols; j++) {\r
+                out[i][j] = 0.0;\r
 \r
-  public void printD(PrintStream ps) {\r
+                for (int k = 0; k < rows; k++) {\r
+                    out[i][j] = out[i][j] + (value[i][k] * in.value[k][j]);\r
+                }\r
+            }\r
+        }\r
 \r
-    for (int j = 0; j < rows;j++) {\r
-      Format.print(ps,"%15.4e",d[j]);\r
+        return new Matrix(out, this.cols, in.rows);\r
     }\r
-  }\r
-  public void printE(PrintStream ps) {\r
 \r
-    for (int j = 0; j < rows;j++) {\r
-      Format.print(ps,"%15.4e",e[j]);\r
-    }\r
-  }\r
+    public Matrix copy() {\r
+        double[][] newmat = new double[rows][cols];\r
 \r
-  public static void main(String[] args) {\r
-    int n = Integer.parseInt(args[0]);\r
-    double[][] in = new double[n][n];\r
+        for (int i = 0; i < rows; i++) {\r
+            for (int j = 0; j < cols; j++) {\r
+                newmat[i][j] = value[i][j];\r
+            }\r
+        }\r
 \r
-    for (int i = 0;i < n;i++) {\r
-      for (int j = 0; j < n; j++) {\r
-        in[i][j] = (double)Math.random();\r
-      }\r
+        return new Matrix(newmat, rows, cols);\r
     }\r
 \r
-    Matrix origmat = new Matrix(in,n,n);\r
-    //    System.out.println(" --- Original matrix ---- ");\r
-    ///    origmat.print(System.out);\r
-    //System.out.println();\r
-\r
-    //System.out.println(" --- transpose matrix ---- ");\r
-    Matrix trans = origmat.transpose();\r
-    //trans.print(System.out);\r
-    //System.out.println();\r
-\r
-    //System.out.println(" --- OrigT * Orig ---- ");\r
-\r
-    Matrix symm = trans.postMultiply(origmat);\r
-    //symm.print(System.out);\r
-    //System.out.println();\r
-\r
-    // Copy the symmetric matrix for later\r
-    Matrix origsymm = symm.copy();\r
+    public void tred() {\r
+        int n = rows;\r
+        int l;\r
+        int k;\r
+        int j;\r
+        int i;\r
+\r
+        double scale;\r
+        double hh;\r
+        double h;\r
+        double g;\r
+        double f;\r
+\r
+        this.d = new double[rows];\r
+        this.e = new double[rows];\r
+\r
+        for (i = n; i >= 2; i--) {\r
+            l = i - 1;\r
+            h = 0.0;\r
+            scale = 0.0;\r
+\r
+            if (l > 1) {\r
+                for (k = 1; k <= l; k++) {\r
+                    scale += Math.abs(value[i - 1][k - 1]);\r
+                }\r
+\r
+                if (scale == 0.0) {\r
+                    e[i - 1] = value[i - 1][l - 1];\r
+                } else {\r
+                    for (k = 1; k <= l; k++) {\r
+                        value[i - 1][k - 1] /= scale;\r
+                        h += (value[i - 1][k - 1] * value[i - 1][k - 1]);\r
+                    }\r
+\r
+                    f = value[i - 1][l - 1];\r
+\r
+                    if (f > 0) {\r
+                        g = -1.0 * Math.sqrt(h);\r
+                    } else {\r
+                        g = Math.sqrt(h);\r
+                    }\r
+\r
+                    e[i - 1] = scale * g;\r
+                    h -= (f * g);\r
+                    value[i - 1][l - 1] = f - g;\r
+                    f = 0.0;\r
+\r
+                    for (j = 1; j <= l; j++) {\r
+                        value[j - 1][i - 1] = value[i - 1][j - 1] / h;\r
+                        g = 0.0;\r
+\r
+                        for (k = 1; k <= j; k++) {\r
+                            g += (value[j - 1][k - 1] * value[i - 1][k - 1]);\r
+                        }\r
+\r
+                        for (k = j + 1; k <= l; k++) {\r
+                            g += (value[k - 1][j - 1] * value[i - 1][k - 1]);\r
+                        }\r
+\r
+                        e[j - 1] = g / h;\r
+                        f += (e[j - 1] * value[i - 1][j - 1]);\r
+                    }\r
+\r
+                    hh = f / (h + h);\r
+\r
+                    for (j = 1; j <= l; j++) {\r
+                        f = value[i - 1][j - 1];\r
+                        g = e[j - 1] - (hh * f);\r
+                        e[j - 1] = g;\r
+\r
+                        for (k = 1; k <= j; k++) {\r
+                            value[j - 1][k - 1] -= ((f * e[k - 1]) +\r
+                            (g * value[i - 1][k - 1]));\r
+                        }\r
+                    }\r
+                }\r
+            } else {\r
+                e[i - 1] = value[i - 1][l - 1];\r
+            }\r
 \r
+            d[i - 1] = h;\r
+        }\r
 \r
-    // This produces the tridiagonal transformation matrix\r
-    long tstart = System.currentTimeMillis();\r
-    symm.tred();\r
-    long tend = System.currentTimeMillis();\r
-    //System.out.println("Time take for tred = " + (tend-tstart) + "ms");\r
-    //System.out.println(" ---Tridiag transform matrix ---");\r
-    //symm.print(System.out);\r
-    //System.out.println();\r
+        d[0] = 0.0;\r
+        e[0] = 0.0;\r
 \r
-    //System.out.println(" --- D vector ---");\r
-    //symm.printD(System.out);\r
-    //System.out.println();\r
-    //System.out.println(" --- E vector ---");\r
-    //symm.printE(System.out);\r
-    //System.out.println();\r
+        for (i = 1; i <= n; i++) {\r
+            l = i - 1;\r
 \r
+            if (d[i - 1] != 0.0) {\r
+                for (j = 1; j <= l; j++) {\r
+                    g = 0.0;\r
 \r
-    // Now produce the diagonalization matrix\r
-    tstart = System.currentTimeMillis();\r
-    symm.tqli();\r
-    tend = System.currentTimeMillis();\r
-    //System.out.println("Time take for tqli = " + (tend-tstart) + " ms");\r
+                    for (k = 1; k <= l; k++) {\r
+                        g += (value[i - 1][k - 1] * value[k - 1][j - 1]);\r
+                    }\r
 \r
-    //System.out.println(" --- New diagonalization matrix ---");\r
-    //symm.print(System.out);\r
-    //System.out.println();\r
+                    for (k = 1; k <= l; k++) {\r
+                        value[k - 1][j - 1] -= (g * value[k - 1][i - 1]);\r
+                    }\r
+                }\r
+            }\r
 \r
-    //System.out.println(" --- D vector ---");\r
-    //symm.printD(System.out);\r
-    //System.out.println();\r
-    //System.out.println(" --- E vector ---");\r
-    //symm.printE(System.out);\r
-    //System.out.println();\r
+            d[i - 1] = value[i - 1][i - 1];\r
+            value[i - 1][i - 1] = 1.0;\r
 \r
-    //System.out.println(" --- First eigenvector --- ");\r
-    //double[] eigenv = symm.getColumn(0);\r
-    //for (int i=0; i < eigenv.length;i++) {\r
-    //  Format.print(System.out,"%15.4f",eigenv[i]);\r
-    // }\r
-    //System.out.println();\r
+            for (j = 1; j <= l; j++) {\r
+                value[j - 1][i - 1] = 0.0;\r
+                value[i - 1][j - 1] = 0.0;\r
+            }\r
+        }\r
+    }\r
 \r
-    //double[] neigenv = origsymm.vectorPostMultiply(eigenv);\r
+    public void tqli() {\r
+        int n = rows;\r
+\r
+        int m;\r
+        int l;\r
+        int iter;\r
+        int i;\r
+        int k;\r
+        double s;\r
+        double r;\r
+        double p;\r
+        ;\r
+\r
+        double g;\r
+        double f;\r
+        double dd;\r
+        double c;\r
+        double b;\r
+\r
+        for (i = 2; i <= n; i++) {\r
+            e[i - 2] = e[i - 1];\r
+        }\r
 \r
-    //for (int i=0; i < neigenv.length;i++) {\r
-    //  Format.print(System.out,"%15.4f",neigenv[i]/symm.d[0]);\r
-    //}\r
+        e[n - 1] = 0.0;\r
+\r
+        for (l = 1; l <= n; l++) {\r
+            iter = 0;\r
+\r
+            do {\r
+                for (m = l; m <= (n - 1); m++) {\r
+                    dd = Math.abs(d[m - 1]) + Math.abs(d[m]);\r
+\r
+                    if ((Math.abs(e[m - 1]) + dd) == dd) {\r
+                        break;\r
+                    }\r
+                }\r
+\r
+                if (m != l) {\r
+                    iter++;\r
+\r
+                    if (iter == 30) {\r
+                        System.err.print("Too many iterations in tqli");\r
+                        System.exit(0); // JBPNote - should this really be here ???\r
+                    } else {\r
+                        //         System.out.println("Iteration " + iter);\r
+                    }\r
+\r
+                    g = (d[l] - d[l - 1]) / (2.0 * e[l - 1]);\r
+                    r = Math.sqrt((g * g) + 1.0);\r
+                    g = d[m - 1] - d[l - 1] + (e[l - 1] / (g + sign(r, g)));\r
+                    c = 1.0;\r
+                    s = c;\r
+                    p = 0.0;\r
+\r
+                    for (i = m - 1; i >= l; i--) {\r
+                        f = s * e[i - 1];\r
+                        b = c * e[i - 1];\r
+\r
+                        if (Math.abs(f) >= Math.abs(g)) {\r
+                            c = g / f;\r
+                            r = Math.sqrt((c * c) + 1.0);\r
+                            e[i] = f * r;\r
+                            s = 1.0 / r;\r
+                            c *= s;\r
+                        } else {\r
+                            s = f / g;\r
+                            r = Math.sqrt((s * s) + 1.0);\r
+                            e[i] = g * r;\r
+                            c = 1.0 / r;\r
+                            s *= c;\r
+                        }\r
+\r
+                        g = d[i] - p;\r
+                        r = ((d[i - 1] - g) * s) + (2.0 * c * b);\r
+                        p = s * r;\r
+                        d[i] = g + p;\r
+                        g = (c * r) - b;\r
+\r
+                        for (k = 1; k <= n; k++) {\r
+                            f = value[k - 1][i];\r
+                            value[k - 1][i] = (s * value[k - 1][i - 1]) +\r
+                                (c * f);\r
+                            value[k - 1][i - 1] = (c * value[k - 1][i - 1]) -\r
+                                (s * f);\r
+                        }\r
+                    }\r
+\r
+                    d[l - 1] = d[l - 1] - p;\r
+                    e[l - 1] = g;\r
+                    e[m - 1] = 0.0;\r
+                }\r
+            } while (m != l);\r
+        }\r
+    }\r
 \r
-    //System.out.println();\r
-  }\r
+    public void tred2() {\r
+        int n = rows;\r
+        int l;\r
+        int k;\r
+        int j;\r
+        int i;\r
+\r
+        double scale;\r
+        double hh;\r
+        double h;\r
+        double g;\r
+        double f;\r
+\r
+        this.d = new double[rows];\r
+        this.e = new double[rows];\r
+\r
+        for (i = n - 1; i >= 1; i--) {\r
+            l = i - 1;\r
+            h = 0.0;\r
+            scale = 0.0;\r
+\r
+            if (l > 0) {\r
+                for (k = 0; k < l; k++) {\r
+                    scale += Math.abs(value[i][k]);\r
+                }\r
+\r
+                if (scale == 0.0) {\r
+                    e[i] = value[i][l];\r
+                } else {\r
+                    for (k = 0; k < l; k++) {\r
+                        value[i][k] /= scale;\r
+                        h += (value[i][k] * value[i][k]);\r
+                    }\r
+\r
+                    f = value[i][l];\r
+\r
+                    if (f > 0) {\r
+                        g = -1.0 * Math.sqrt(h);\r
+                    } else {\r
+                        g = Math.sqrt(h);\r
+                    }\r
+\r
+                    e[i] = scale * g;\r
+                    h -= (f * g);\r
+                    value[i][l] = f - g;\r
+                    f = 0.0;\r
+\r
+                    for (j = 0; j < l; j++) {\r
+                        value[j][i] = value[i][j] / h;\r
+                        g = 0.0;\r
+\r
+                        for (k = 0; k < j; k++) {\r
+                            g += (value[j][k] * value[i][k]);\r
+                        }\r
+\r
+                        for (k = j; k < l; k++) {\r
+                            g += (value[k][j] * value[i][k]);\r
+                        }\r
+\r
+                        e[j] = g / h;\r
+                        f += (e[j] * value[i][j]);\r
+                    }\r
+\r
+                    hh = f / (h + h);\r
+\r
+                    for (j = 0; j < l; j++) {\r
+                        f = value[i][j];\r
+                        g = e[j] - (hh * f);\r
+                        e[j] = g;\r
+\r
+                        for (k = 0; k < j; k++) {\r
+                            value[j][k] -= ((f * e[k]) + (g * value[i][k]));\r
+                        }\r
+                    }\r
+                }\r
+            } else {\r
+                e[i] = value[i][l];\r
+            }\r
 \r
-}\r
+            d[i] = h;\r
+        }\r
 \r
+        d[0] = 0.0;\r
+        e[0] = 0.0;\r
 \r
+        for (i = 0; i < n; i++) {\r
+            l = i - 1;\r
 \r
+            if (d[i] != 0.0) {\r
+                for (j = 0; j < l; j++) {\r
+                    g = 0.0;\r
 \r
+                    for (k = 0; k < l; k++) {\r
+                        g += (value[i][k] * value[k][j]);\r
+                    }\r
 \r
+                    for (k = 0; k < l; k++) {\r
+                        value[k][j] -= (g * value[k][i]);\r
+                    }\r
+                }\r
+            }\r
 \r
+            d[i] = value[i][i];\r
+            value[i][i] = 1.0;\r
 \r
+            for (j = 0; j < l; j++) {\r
+                value[j][i] = 0.0;\r
+                value[i][j] = 0.0;\r
+            }\r
+        }\r
+    }\r
 \r
+    public void tqli2() {\r
+        int n = rows;\r
+\r
+        int m;\r
+        int l;\r
+        int iter;\r
+        int i;\r
+        int k;\r
+        double s;\r
+        double r;\r
+        double p;\r
+        ;\r
+\r
+        double g;\r
+        double f;\r
+        double dd;\r
+        double c;\r
+        double b;\r
+\r
+        for (i = 2; i <= n; i++) {\r
+            e[i - 2] = e[i - 1];\r
+        }\r
 \r
+        e[n - 1] = 0.0;\r
+\r
+        for (l = 1; l <= n; l++) {\r
+            iter = 0;\r
+\r
+            do {\r
+                for (m = l; m <= (n - 1); m++) {\r
+                    dd = Math.abs(d[m - 1]) + Math.abs(d[m]);\r
+\r
+                    if ((Math.abs(e[m - 1]) + dd) == dd) {\r
+                        break;\r
+                    }\r
+                }\r
+\r
+                if (m != l) {\r
+                    iter++;\r
+\r
+                    if (iter == 30) {\r
+                        System.err.print("Too many iterations in tqli");\r
+                        System.exit(0); // JBPNote - same as above - not a graceful exit!\r
+                    } else {\r
+                        //         System.out.println("Iteration " + iter);\r
+                    }\r
+\r
+                    g = (d[l] - d[l - 1]) / (2.0 * e[l - 1]);\r
+                    r = Math.sqrt((g * g) + 1.0);\r
+                    g = d[m - 1] - d[l - 1] + (e[l - 1] / (g + sign(r, g)));\r
+                    c = 1.0;\r
+                    s = c;\r
+                    p = 0.0;\r
+\r
+                    for (i = m - 1; i >= l; i--) {\r
+                        f = s * e[i - 1];\r
+                        b = c * e[i - 1];\r
+\r
+                        if (Math.abs(f) >= Math.abs(g)) {\r
+                            c = g / f;\r
+                            r = Math.sqrt((c * c) + 1.0);\r
+                            e[i] = f * r;\r
+                            s = 1.0 / r;\r
+                            c *= s;\r
+                        } else {\r
+                            s = f / g;\r
+                            r = Math.sqrt((s * s) + 1.0);\r
+                            e[i] = g * r;\r
+                            c = 1.0 / r;\r
+                            s *= c;\r
+                        }\r
+\r
+                        g = d[i] - p;\r
+                        r = ((d[i - 1] - g) * s) + (2.0 * c * b);\r
+                        p = s * r;\r
+                        d[i] = g + p;\r
+                        g = (c * r) - b;\r
+\r
+                        for (k = 1; k <= n; k++) {\r
+                            f = value[k - 1][i];\r
+                            value[k - 1][i] = (s * value[k - 1][i - 1]) +\r
+                                (c * f);\r
+                            value[k - 1][i - 1] = (c * value[k - 1][i - 1]) -\r
+                                (s * f);\r
+                        }\r
+                    }\r
+\r
+                    d[l - 1] = d[l - 1] - p;\r
+                    e[l - 1] = g;\r
+                    e[m - 1] = 0.0;\r
+                }\r
+            } while (m != l);\r
+        }\r
+    }\r
 \r
+    public double sign(double a, double b) {\r
+        if (b < 0) {\r
+            return -Math.abs(a);\r
+        } else {\r
+            return Math.abs(a);\r
+        }\r
+    }\r
 \r
+    public double[] getColumn(int n) {\r
+        double[] out = new double[rows];\r
 \r
+        for (int i = 0; i < rows; i++) {\r
+            out[i] = value[i][n];\r
+        }\r
 \r
+        return out;\r
+    }\r
 \r
+    public void printD(PrintStream ps) {\r
+        for (int j = 0; j < rows; j++) {\r
+            Format.print(ps, "%15.4e", d[j]);\r
+        }\r
+    }\r
 \r
+    public void printE(PrintStream ps) {\r
+        for (int j = 0; j < rows; j++) {\r
+            Format.print(ps, "%15.4e", e[j]);\r
+        }\r
+    }\r
 \r
+    public static void main(String[] args) {\r
+        int n = Integer.parseInt(args[0]);\r
+        double[][] in = new double[n][n];\r
 \r
+        for (int i = 0; i < n; i++) {\r
+            for (int j = 0; j < n; j++) {\r
+                in[i][j] = (double) Math.random();\r
+            }\r
+        }\r
 \r
+        Matrix origmat = new Matrix(in, n, n);\r
+\r
+        //    System.out.println(" --- Original matrix ---- ");\r
+        ///    origmat.print(System.out);\r
+        //System.out.println();\r
+        //System.out.println(" --- transpose matrix ---- ");\r
+        Matrix trans = origmat.transpose();\r
+\r
+        //trans.print(System.out);\r
+        //System.out.println();\r
+        //System.out.println(" --- OrigT * Orig ---- ");\r
+        Matrix symm = trans.postMultiply(origmat);\r
+\r
+        //symm.print(System.out);\r
+        //System.out.println();\r
+        // Copy the symmetric matrix for later\r
+        Matrix origsymm = symm.copy();\r
+\r
+        // This produces the tridiagonal transformation matrix\r
+        long tstart = System.currentTimeMillis();\r
+        symm.tred();\r
+\r
+        long tend = System.currentTimeMillis();\r
+\r
+        //System.out.println("Time take for tred = " + (tend-tstart) + "ms");\r
+        //System.out.println(" ---Tridiag transform matrix ---");\r
+        //symm.print(System.out);\r
+        //System.out.println();\r
+        //System.out.println(" --- D vector ---");\r
+        //symm.printD(System.out);\r
+        //System.out.println();\r
+        //System.out.println(" --- E vector ---");\r
+        //symm.printE(System.out);\r
+        //System.out.println();\r
+        // Now produce the diagonalization matrix\r
+        tstart = System.currentTimeMillis();\r
+        symm.tqli();\r
+        tend = System.currentTimeMillis();\r
+\r
+        //System.out.println("Time take for tqli = " + (tend-tstart) + " ms");\r
+        //System.out.println(" --- New diagonalization matrix ---");\r
+        //symm.print(System.out);\r
+        //System.out.println();\r
+        //System.out.println(" --- D vector ---");\r
+        //symm.printD(System.out);\r
+        //System.out.println();\r
+        //System.out.println(" --- E vector ---");\r
+        //symm.printE(System.out);\r
+        //System.out.println();\r
+        //System.out.println(" --- First eigenvector --- ");\r
+        //double[] eigenv = symm.getColumn(0);\r
+        //for (int i=0; i < eigenv.length;i++) {\r
+        //  Format.print(System.out,"%15.4f",eigenv[i]);\r
+        // }\r
+        //System.out.println();\r
+        //double[] neigenv = origsymm.vectorPostMultiply(eigenv);\r
+        //for (int i=0; i < neigenv.length;i++) {\r
+        //  Format.print(System.out,"%15.4f",neigenv[i]/symm.d[0]);\r
+        //}\r
+        //System.out.println();\r
+    }\r
+}\r
index d9f4bd5..c0ec1c9 100755 (executable)
 * 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.math;\r
 \r
-\r
-\r
 public class RotatableMatrix {\r
+    float[][] matrix;\r
+    float[] temp;\r
+    float[][] rot;\r
 \r
-  float matrix[][];\r
-\r
-  float[] temp;\r
-\r
-  float[][] rot;\r
-\r
-\r
-\r
-  public RotatableMatrix(int rows, int cols) {\r
-\r
-    matrix = new float[rows][cols];\r
-\r
-    temp = new float[3];\r
-\r
-    rot = new float[3][3];\r
-\r
-  }\r
-\r
-\r
-\r
-  public void addElement(int i, int j, float value) {\r
-\r
-    matrix[i][j] = value;\r
-\r
-  }\r
-\r
-\r
-\r
-  public void print() {\r
-\r
-    System.out.println(matrix[0][0] + " " + matrix[0][1] + " " + matrix[0][2]);\r
-\r
-    System.out.println(matrix[1][0] + " " + matrix[1][1] + " " + matrix[1][2]);\r
-\r
-    System.out.println(matrix[2][0] + " " + matrix[2][1] + " " + matrix[2][2]);\r
-\r
-  }\r
-\r
-\r
-\r
-  public void rotate (float degrees, char axis) {\r
-\r
-\r
-\r
-    float costheta = (float)Math.cos(degrees*Math.PI/(float)180.0);\r
-\r
-    float sintheta = (float)Math.sin(degrees*Math.PI/(float)180.0);\r
-\r
-\r
-\r
-    if (axis == 'z') {\r
-\r
-\r
+    public RotatableMatrix(int rows, int cols) {\r
+        matrix = new float[rows][cols];\r
 \r
-      rot[0][0] = (float)costheta;\r
-\r
-      rot[0][1] = (float)-sintheta;\r
-\r
-      rot[0][2] = (float)0.0;\r
-\r
-\r
-\r
-      rot[1][0] = (float)sintheta;\r
-\r
-      rot[1][1] = (float)costheta;\r
-\r
-      rot[1][2] = (float)0.0;\r
-\r
-\r
-\r
-      rot[2][0] = (float)0.0;\r
-\r
-      rot[2][1] = (float)0.0;\r
-\r
-      rot[2][2] = (float)1.0;\r
-\r
-\r
-\r
-      preMultiply(rot);\r
+        temp = new float[3];\r
 \r
+        rot = new float[3][3];\r
     }\r
 \r
-    if (axis == 'x') {\r
-\r
-      rot[0][0] = (float)1.0;\r
-\r
-      rot[0][1] = (float)0.0;\r
-\r
-      rot[0][2] = (float)0.0;\r
-\r
-\r
-\r
-      rot[1][0] = (float)0.0;\r
-\r
-      rot[1][1] = (float)costheta;\r
-\r
-      rot[1][2] = (float)sintheta;\r
-\r
-\r
-\r
-      rot[2][0] = (float)0.0;\r
-\r
-      rot[2][1] = (float)-sintheta;\r
-\r
-      rot[2][2] = (float)costheta;\r
-\r
-\r
-\r
-      preMultiply(rot);\r
-\r
-\r
-\r
+    public void addElement(int i, int j, float value) {\r
+        matrix[i][j] = value;\r
     }\r
 \r
-    if (axis == 'y') {\r
-\r
-      rot[0][0] = (float)costheta;\r
-\r
-      rot[0][1] = (float)0.0;\r
-\r
-      rot[0][2] = (float)-sintheta;\r
-\r
-\r
-\r
-      rot[1][0] = (float)0.0;\r
-\r
-      rot[1][1] = (float)1.0;\r
-\r
-      rot[1][2] = (float)0.0;\r
-\r
-\r
-\r
-      rot[2][0] = (float)sintheta;\r
-\r
-      rot[2][1] = (float)0.0;\r
-\r
-      rot[2][2] = (float)costheta;\r
-\r
-\r
-\r
-      preMultiply(rot);\r
-\r
+    public void print() {\r
+        System.out.println(matrix[0][0] + " " + matrix[0][1] + " " +\r
+            matrix[0][2]);\r
 \r
+        System.out.println(matrix[1][0] + " " + matrix[1][1] + " " +\r
+            matrix[1][2]);\r
 \r
+        System.out.println(matrix[2][0] + " " + matrix[2][1] + " " +\r
+            matrix[2][2]);\r
     }\r
 \r
+    public void rotate(float degrees, char axis) {\r
+        float costheta = (float) Math.cos((degrees * Math.PI) / (float) 180.0);\r
 \r
+        float sintheta = (float) Math.sin((degrees * Math.PI) / (float) 180.0);\r
 \r
-  }\r
-\r
-\r
-\r
-  public float[] vectorMultiply(float[] vect) {\r
+        if (axis == 'z') {\r
+            rot[0][0] = (float) costheta;\r
 \r
-    temp[0] = vect[0];\r
+            rot[0][1] = (float) -sintheta;\r
 \r
-    temp[1] = vect[1];\r
+            rot[0][2] = (float) 0.0;\r
 \r
-    temp[2] = vect[2];\r
+            rot[1][0] = (float) sintheta;\r
 \r
+            rot[1][1] = (float) costheta;\r
 \r
+            rot[1][2] = (float) 0.0;\r
 \r
-    for (int i = 0; i < 3; i++) {\r
+            rot[2][0] = (float) 0.0;\r
 \r
-      temp[i] = matrix[i][0]*vect[0] + matrix[i][1]*vect[1] + matrix[i][2]*vect[2];\r
+            rot[2][1] = (float) 0.0;\r
 \r
-    }\r
-\r
-\r
-\r
-    vect[0] = temp[0];\r
-\r
-    vect[1] = temp[1];\r
-\r
-    vect[2] = temp[2];\r
-\r
-\r
-\r
-    return vect;\r
+            rot[2][2] = (float) 1.0;\r
 \r
-  }\r
+            preMultiply(rot);\r
+        }\r
 \r
+        if (axis == 'x') {\r
+            rot[0][0] = (float) 1.0;\r
 \r
+            rot[0][1] = (float) 0.0;\r
 \r
-  public void preMultiply(float mat[][]) {\r
+            rot[0][2] = (float) 0.0;\r
 \r
-    float tmp[][]  = new float[3][3];\r
+            rot[1][0] = (float) 0.0;\r
 \r
+            rot[1][1] = (float) costheta;\r
 \r
+            rot[1][2] = (float) sintheta;\r
 \r
-    for (int i = 0; i < 3 ; i++) {\r
+            rot[2][0] = (float) 0.0;\r
 \r
-      for (int j = 0; j < 3; j++ ) {\r
+            rot[2][1] = (float) -sintheta;\r
 \r
-        tmp[i][j] = mat[i][0]*matrix[0][j] +\r
+            rot[2][2] = (float) costheta;\r
 \r
-                    mat[i][1]*matrix[1][j] +\r
+            preMultiply(rot);\r
+        }\r
 \r
-                    mat[i][2]*matrix[2][j];\r
+        if (axis == 'y') {\r
+            rot[0][0] = (float) costheta;\r
 \r
-      }\r
+            rot[0][1] = (float) 0.0;\r
 \r
-    }\r
+            rot[0][2] = (float) -sintheta;\r
 \r
+            rot[1][0] = (float) 0.0;\r
 \r
+            rot[1][1] = (float) 1.0;\r
 \r
-    for (int i = 0; i < 3 ; i++) {\r
+            rot[1][2] = (float) 0.0;\r
 \r
-      for (int j = 0; j < 3; j++ ) {\r
+            rot[2][0] = (float) sintheta;\r
 \r
-        matrix[i][j] = tmp[i][j];\r
+            rot[2][1] = (float) 0.0;\r
 \r
-      }\r
+            rot[2][2] = (float) costheta;\r
 \r
+            preMultiply(rot);\r
+        }\r
     }\r
 \r
-  }\r
-\r
-\r
-\r
-  public void postMultiply(float mat[][]) {\r
-\r
-    float tmp[][]  = new float[3][3];\r
+    public float[] vectorMultiply(float[] vect) {\r
+        temp[0] = vect[0];\r
 \r
+        temp[1] = vect[1];\r
 \r
+        temp[2] = vect[2];\r
 \r
-    for (int i = 0; i < 3 ; i++) {\r
+        for (int i = 0; i < 3; i++) {\r
+            temp[i] = (matrix[i][0] * vect[0]) + (matrix[i][1] * vect[1]) +\r
+                (matrix[i][2] * vect[2]);\r
+        }\r
 \r
-      for (int j = 0; j < 3; j++ ) {\r
+        vect[0] = temp[0];\r
 \r
-        tmp[i][j] = matrix[i][0]*mat[0][j] +\r
+        vect[1] = temp[1];\r
 \r
-                    matrix[i][1]*mat[1][j] +\r
-\r
-                    matrix[i][2]*mat[2][j];\r
-\r
-      }\r
+        vect[2] = temp[2];\r
 \r
+        return vect;\r
     }\r
 \r
-\r
-\r
-    for (int i = 0; i < 3 ; i++) {\r
-\r
-      for (int j = 0; j < 3; j++ ) {\r
-\r
-        matrix[i][j] = tmp[i][j];\r
-\r
-      }\r
-\r
+    public void preMultiply(float[][] mat) {\r
+        float[][] tmp = new float[3][3];\r
+\r
+        for (int i = 0; i < 3; i++) {\r
+            for (int j = 0; j < 3; j++) {\r
+                tmp[i][j] = (mat[i][0] * matrix[0][j]) +\r
+                    (mat[i][1] * matrix[1][j]) + (mat[i][2] * matrix[2][j]);\r
+            }\r
+        }\r
+\r
+        for (int i = 0; i < 3; i++) {\r
+            for (int j = 0; j < 3; j++) {\r
+                matrix[i][j] = tmp[i][j];\r
+            }\r
+        }\r
     }\r
 \r
-  }\r
-\r
-\r
-\r
-  public static void main(String[] args) {\r
-\r
-\r
-\r
-    RotatableMatrix m = new  RotatableMatrix(3,3);\r
-\r
-    m.addElement(0,0,1);\r
-\r
-    m.addElement(0,1,0);\r
-\r
-    m.addElement(0,2,0);\r
-\r
-    m.addElement(1,0,0);\r
-\r
-    m.addElement(1,1,2);\r
-\r
-    m.addElement(1,2,0);\r
-\r
-    m.addElement(2,0,0);\r
-\r
-    m.addElement(2,1,0);\r
-\r
-    m.addElement(2,2,1);\r
-\r
-\r
-\r
-    m.print();\r
-\r
-\r
-\r
-    RotatableMatrix n = new  RotatableMatrix(3,3);\r
-\r
-    n.addElement(0,0,2);\r
-\r
-    n.addElement(0,1,1);\r
-\r
-    n.addElement(0,2,1);\r
-\r
-    n.addElement(1,0,2);\r
-\r
-    n.addElement(1,1,1);\r
+    public void postMultiply(float[][] mat) {\r
+        float[][] tmp = new float[3][3];\r
+\r
+        for (int i = 0; i < 3; i++) {\r
+            for (int j = 0; j < 3; j++) {\r
+                tmp[i][j] = (matrix[i][0] * mat[0][j]) +\r
+                    (matrix[i][1] * mat[1][j]) + (matrix[i][2] * mat[2][j]);\r
+            }\r
+        }\r
+\r
+        for (int i = 0; i < 3; i++) {\r
+            for (int j = 0; j < 3; j++) {\r
+                matrix[i][j] = tmp[i][j];\r
+            }\r
+        }\r
+    }\r
 \r
-    n.addElement(1,2,1);\r
+    public static void main(String[] args) {\r
+        RotatableMatrix m = new RotatableMatrix(3, 3);\r
 \r
-    n.addElement(2,0,2);\r
+        m.addElement(0, 0, 1);\r
 \r
-    n.addElement(2,1,1);\r
+        m.addElement(0, 1, 0);\r
 \r
-    n.addElement(2,2,1);\r
+        m.addElement(0, 2, 0);\r
 \r
+        m.addElement(1, 0, 0);\r
 \r
+        m.addElement(1, 1, 2);\r
 \r
-    n.print();\r
+        m.addElement(1, 2, 0);\r
 \r
+        m.addElement(2, 0, 0);\r
 \r
+        m.addElement(2, 1, 0);\r
 \r
-    //m.postMultiply(n.matrix);\r
+        m.addElement(2, 2, 1);\r
 \r
-    //m.print();\r
+        m.print();\r
 \r
-    //     m.rotate(45,'z',new RotatableMatrix(3,3));\r
+        RotatableMatrix n = new RotatableMatrix(3, 3);\r
 \r
+        n.addElement(0, 0, 2);\r
 \r
+        n.addElement(0, 1, 1);\r
 \r
-    float vect[] = new float[3];\r
+        n.addElement(0, 2, 1);\r
 \r
-    vect[0] = 2;\r
+        n.addElement(1, 0, 2);\r
 \r
-    vect[1] = 4;\r
+        n.addElement(1, 1, 1);\r
 \r
-    vect[2] = 6;\r
+        n.addElement(1, 2, 1);\r
 \r
+        n.addElement(2, 0, 2);\r
 \r
+        n.addElement(2, 1, 1);\r
 \r
-    vect = m.vectorMultiply(vect);\r
+        n.addElement(2, 2, 1);\r
 \r
-    System.out.println(vect[0] + " " + vect[1] + " " + vect[2]);\r
+        n.print();\r
 \r
+        //m.postMultiply(n.matrix);\r
+        //m.print();\r
+        //     m.rotate(45,'z',new RotatableMatrix(3,3));\r
+        float[] vect = new float[3];\r
 \r
+        vect[0] = 2;\r
 \r
-  }\r
+        vect[1] = 4;\r
 \r
-  public void setIdentity() {\r
+        vect[2] = 6;\r
 \r
-    matrix[0][0] = (float)1.0;\r
+        vect = m.vectorMultiply(vect);\r
 \r
-    matrix[1][1] = (float)1.0;\r
+        System.out.println(vect[0] + " " + vect[1] + " " + vect[2]);\r
+    }\r
 \r
-    matrix[2][2] = (float)1.0;\r
+    public void setIdentity() {\r
+        matrix[0][0] = (float) 1.0;\r
 \r
-    matrix[0][1] = (float)0.0;\r
+        matrix[1][1] = (float) 1.0;\r
 \r
-    matrix[0][2] = (float)0.0;\r
+        matrix[2][2] = (float) 1.0;\r
 \r
-    matrix[1][0] = (float)0.0;\r
+        matrix[0][1] = (float) 0.0;\r
 \r
-    matrix[1][2] = (float) 0.0;\r
+        matrix[0][2] = (float) 0.0;\r
 \r
-    matrix[2][0] = (float)0.0;\r
+        matrix[1][0] = (float) 0.0;\r
 \r
-    matrix[2][1] = (float)0.0;\r
+        matrix[1][2] = (float) 0.0;\r
 \r
-  }\r
+        matrix[2][0] = (float) 0.0;\r
 \r
+        matrix[2][1] = (float) 0.0;\r
+    }\r
 }\r
-\r
-\r
-\r
index 40243f2..9c720ee 100755 (executable)
 * 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.schemes;\r
 \r
-\r
-import java.util.*;\r
 import java.awt.*;\r
 \r
-public class Blosum62ColourScheme extends ResidueColourScheme\r
-{\r
-\r
-  public Blosum62ColourScheme()\r
-  {\r
-    super();\r
-  }\r
-\r
-  public Color findColour(String s, int j)\r
-  {\r
-    if( threshold!=0 && !aboveThreshold(s,j))\r
-      return Color.white;\r
-\r
-    Hashtable hash = (Hashtable)consensus.elementAt(j);\r
-\r
-    if (!jalview.util.Comparison.isGap((s.charAt(0))))\r
-    {\r
-      String    max  = (String)hash.get("maxResidue");\r
-\r
-      if (max.indexOf(s)>-1)\r
-        return new Color(154, 154, 255);\r
-      else {\r
+import java.util.*;\r
 \r
-        int c = 0,\r
-            max_aa=0,\r
-            n=max.length();\r
-        do {\r
-          c+=ResidueProperties.getBLOSUM62(max.substring(max_aa, max_aa+1), s);\r
-        } while (++max_aa<n);\r
 \r
-        if (c>0)\r
-          return new Color(204, 204, 255);\r
-        else\r
-          return Color.white;\r
-      }\r
+public class Blosum62ColourScheme extends ResidueColourScheme {\r
+    public Blosum62ColourScheme() {\r
+        super();\r
     }\r
-    else\r
-        return Color.white;\r
-\r
-  }\r
-\r
 \r
+    public Color findColour(String s, int j) {\r
+        if ((threshold != 0) && !aboveThreshold(s, j)) {\r
+            return Color.white;\r
+        }\r
+\r
+        Hashtable hash = (Hashtable) consensus.elementAt(j);\r
+\r
+        if (!jalview.util.Comparison.isGap((s.charAt(0)))) {\r
+            String max = (String) hash.get("maxResidue");\r
+\r
+            if (max.indexOf(s) > -1) {\r
+                return new Color(154, 154, 255);\r
+            } else {\r
+                int c = 0;\r
+                int max_aa = 0;\r
+                int n = max.length();\r
+\r
+                do {\r
+                    c += ResidueProperties.getBLOSUM62(max.substring(max_aa,\r
+                            max_aa + 1), s);\r
+                } while (++max_aa < n);\r
+\r
+                if (c > 0) {\r
+                    return new Color(204, 204, 255);\r
+                } else {\r
+                    return Color.white;\r
+                }\r
+            }\r
+        } else {\r
+            return Color.white;\r
+        }\r
+    }\r
 }\r
index 8b0305d..186b98a 100755 (executable)
 * 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.schemes;\r
 \r
 import java.awt.*;\r
 \r
-public class BuriedColourScheme extends ScoreColourScheme {\r
 \r
-  public BuriedColourScheme() {\r
-    super(ResidueProperties.buried,ResidueProperties.buriedmin,ResidueProperties.buriedmax);\r
-  }\r
+public class BuriedColourScheme extends ScoreColourScheme {\r
+    public BuriedColourScheme() {\r
+        super(ResidueProperties.buried, ResidueProperties.buriedmin,\r
+            ResidueProperties.buriedmax);\r
+    }\r
 \r
-  public Color makeColour(float c) {\r
-    return new Color(0,(float)(1.0-c),c);\r
-  }\r
+    public Color makeColour(float c) {\r
+        return new Color(0, (float) (1.0 - c), c);\r
+    }\r
 }\r
index bbca4de..17398fc 100755 (executable)
 * 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.schemes;\r
 \r
 import jalview.datamodel.*;\r
-import java.util.*;\r
+\r
 import java.awt.*;\r
 \r
-public class ClustalxColourScheme extends ResidueColourScheme\r
-{\r
-  Hashtable[] cons;\r
-  int[][] cons2;\r
-  ConsensusColour[] colours;\r
-  ConsensusColour[] ResidueColour;\r
-  int size;\r
-    Consensus[] conses = new Consensus[32];\r
+import java.util.*;\r
+\r
+\r
+public class ClustalxColourScheme extends ResidueColourScheme {\r
     public static Hashtable colhash = new Hashtable();\r
+    Hashtable[] cons;\r
+    int[][] cons2;\r
+    ConsensusColour[] colours;\r
+    ConsensusColour[] ResidueColour;\r
+    int size;\r
+    Consensus[] conses = new Consensus[32];\r
+    Vector colourTable = new Vector();\r
 \r
     {\r
-        colhash.put("RED",new Color((float)0.9,(float)0.2,(float)0.1));\r
-        colhash.put("BLUE",new Color((float)0.5,(float)0.7,(float)0.9));\r
-        colhash.put("GREEN",new Color((float)0.1,(float)0.8,(float)0.1));\r
-        colhash.put("ORANGE",new Color((float)0.9,(float)0.6,(float)0.3));\r
-        colhash.put("CYAN",new Color((float)0.1,(float)0.7,(float)0.7));\r
-        colhash.put("PINK",new Color((float)0.9,(float)0.5,(float)0.5));\r
-        colhash.put("MAGENTA",new Color((float)0.8,(float)0.3,(float)0.8));\r
-        colhash.put("YELLOW",new Color((float)0.8,(float)0.8,(float)0.0));\r
-\r
+        colhash.put("RED", new Color((float) 0.9, (float) 0.2, (float) 0.1));\r
+        colhash.put("BLUE", new Color((float) 0.5, (float) 0.7, (float) 0.9));\r
+        colhash.put("GREEN", new Color((float) 0.1, (float) 0.8, (float) 0.1));\r
+        colhash.put("ORANGE", new Color((float) 0.9, (float) 0.6, (float) 0.3));\r
+        colhash.put("CYAN", new Color((float) 0.1, (float) 0.7, (float) 0.7));\r
+        colhash.put("PINK", new Color((float) 0.9, (float) 0.5, (float) 0.5));\r
+        colhash.put("MAGENTA", new Color((float) 0.8, (float) 0.3, (float) 0.8));\r
+        colhash.put("YELLOW", new Color((float) 0.8, (float) 0.8, (float) 0.0));\r
     }\r
-  Vector colourTable = new Vector();\r
-\r
-  public ClustalxColourScheme(Vector seqs, int maxWidth)\r
-  {\r
-    resetClustalX(seqs, maxWidth);\r
-  }\r
-\r
-  public void resetClustalX(Vector seqs, int maxWidth)\r
-  {\r
-    cons2 = new int[maxWidth][24];\r
-    int start = 0;\r
-\r
-    // Initialize the array\r
-    for (int j=0;j<24;j++)\r
-      for (int i=0; i < maxWidth;i++)\r
-        cons2[i][j] = 0;\r
-\r
-      int res,i, j = 0;\r
-      String seq;\r
-      while(j < seqs.size())\r
-      {\r
-        seq = ( (SequenceI) seqs.elementAt(j)).getSequence();\r
-        int end_j = seq.length()-1;\r
-        for (i = start; i <= end_j; i++)\r
-        {\r
-          if(seq.length()-1<i)\r
-            res = 23;\r
-          else\r
-            res = ( (Integer) ResidueProperties.aaHash.get(seq.charAt(i) + "")).intValue();\r
-          cons2[i][res]++;\r
-        }\r
-        j++;\r
-      }\r
-\r
-    this.size = seqs.size();\r
-    makeColours();\r
-  }\r
-  public void makeColours() {\r
-    conses[0] = new Consensus("WLVIMAFCYHP",60);\r
-    conses[1] = new Consensus("WLVIMAFCYHP",80);\r
-    conses[2] = new Consensus("ED",50);\r
-    conses[3] = new Consensus("KR",60);\r
-    conses[4] = new Consensus("G",50);\r
-    conses[5] = new Consensus("N",50);\r
-    conses[6] = new Consensus("QE",50);\r
-    conses[7] = new Consensus("P",50);\r
-    conses[8] = new Consensus("TS",50);\r
-\r
-    conses[26] = new Consensus("A",85);\r
-    conses[27] = new Consensus("C",85);\r
-    conses[10] = new Consensus("E",85);\r
-    conses[11] = new Consensus("F",85);\r
-    conses[12] = new Consensus("G",85);\r
-    conses[13] = new Consensus("H",85);\r
-    conses[14] = new Consensus("I",85);\r
-    conses[15] = new Consensus("L",85);\r
-    conses[16] = new Consensus("M",85);\r
-    conses[17] = new Consensus("N",85);\r
-    conses[18] = new Consensus("P",85);\r
-    conses[19] = new Consensus("Q",85);\r
-    conses[20] = new Consensus("R",85);\r
-    conses[21] = new Consensus("S",85);\r
-    conses[22] = new Consensus("T",85);\r
-    conses[23] = new Consensus("V",85);\r
-    conses[24] = new Consensus("W",85);\r
-    conses[25] = new Consensus("Y",85);\r
-    conses[28] = new Consensus("K",85);\r
-    conses[29] = new Consensus("D",85);\r
-\r
-    conses[30] = new Consensus("G",0);\r
-    conses[31] = new Consensus("P",0);\r
-\r
-    // We now construct the colours\r
-    colours = new ConsensusColour[11];\r
-\r
-\r
-    Consensus[] tmp8 = new Consensus[1];\r
-    tmp8[0] = conses[30];//G\r
-    colours[7] =new ConsensusColour((Color)colhash.get("ORANGE"),tmp8);\r
-\r
-    Consensus[] tmp9 = new Consensus[1];\r
-    tmp9[0] = conses[31];//P\r
-    colours[8] =new ConsensusColour((Color)colhash.get("YELLOW"),tmp9);\r
-\r
-    Consensus[] tmp10 = new Consensus[1];\r
-    tmp10[0] = conses[27];//C\r
-    colours[9] =new ConsensusColour((Color)colhash.get("PINK"),tmp8);\r
-\r
-    Consensus[] tmp1 = new Consensus[14];\r
-    tmp1[0] = conses[0]; //%\r
-    tmp1[1] = conses[1]; //#\r
-    tmp1[2] = conses[26]; //A\r
-    tmp1[3] = conses[27]; //C\r
-    tmp1[4] = conses[11]; //F\r
-    tmp1[5] = conses[13]; //H\r
-    tmp1[6] = conses[14]; //I\r
-    tmp1[7] = conses[15]; //L\r
-    tmp1[8] = conses[16]; //M\r
-    tmp1[9] = conses[23]; //V\r
-    tmp1[10] = conses[24]; //W\r
-    tmp1[11] = conses[25]; //Y\r
-    tmp1[12] = conses[18]; //P\r
-    tmp1[13] = conses[19]; //p\r
-    colours[0] = new ConsensusColour((Color)colhash.get("BLUE"),tmp1);\r
-\r
-    colours[10] = new ConsensusColour((Color)colhash.get("CYAN"),tmp1);\r
-\r
-    Consensus[] tmp2 = new Consensus[5];\r
-    tmp2[0] = conses[8];  //t\r
-    tmp2[1] = conses[21]; //S\r
-    tmp2[2] = conses[22]; //T\r
-    tmp2[3] = conses[0];  //%\r
-    tmp2[4] = conses[1];  //#\r
-    colours[1] = new ConsensusColour((Color)colhash.get("GREEN"),tmp2);\r
-\r
-    Consensus[] tmp3 = new Consensus[3];\r
-\r
-    tmp3[0] = conses[17]; //N\r
-    tmp3[1] = conses[29]; //D\r
-    tmp3[2] = conses[5];  //n\r
-    colours[2] = new ConsensusColour((Color)colhash.get("GREEN"),tmp3);\r
-\r
-    Consensus[] tmp4 = new Consensus[6];\r
-    tmp4[0] = conses[6];  // q = QE\r
-    tmp4[1] = conses[19]; //Q\r
-    tmp4[2] = conses[22]; //E\r
-    tmp4[3] = conses[3];  //+\r
-    tmp4[4] = conses[28]; //K\r
-    tmp4[5] = conses[20]; //R\r
-    colours[3] = new ConsensusColour((Color)colhash.get("GREEN"),tmp4);\r
-    Consensus[] tmp5 = new Consensus[4];\r
-    tmp5[0] = conses[3];  //+\r
-    tmp5[1] = conses[28]; //K\r
-    tmp5[2] = conses[20]; //R\r
-    tmp5[3] = conses[19]; //Q\r
-    colours[4] = new ConsensusColour((Color)colhash.get("RED"),tmp5);\r
-    Consensus[] tmp6 = new Consensus[5];\r
-    tmp6[0] = conses[3];  //-\r
-    tmp6[1] = conses[29]; //D\r
-    tmp6[2] = conses[10]; //E\r
-    tmp6[3] = conses[6];  //q\r
-    tmp6[4] = conses[19]; //Q\r
-    colours[5] = new ConsensusColour((Color)colhash.get("MAGENTA"),tmp6);\r
-\r
-    Consensus[] tmp7 = new Consensus[5];\r
-    tmp7[0] = conses[3];  //-\r
-    tmp7[1] = conses[29]; //D\r
-    tmp7[2] = conses[10]; //E\r
-    tmp7[3] = conses[17];  //N\r
-    tmp7[4] = conses[2]; //DE\r
-    colours[6] = new ConsensusColour((Color)colhash.get("MAGENTA"),tmp7);\r
-\r
-    // Now attach the ConsensusColours to the residue letters\r
-    ResidueColour = new ConsensusColour[20];\r
-    ResidueColour[0] = colours[0]; // A\r
-    ResidueColour[1] = colours[4]; // R\r
-    ResidueColour[2] = colours[2]; // N\r
-    ResidueColour[3] = colours[6]; // D\r
-    ResidueColour[4] = colours[0]; // C\r
-    ResidueColour[5] = colours[3]; // Q\r
-    ResidueColour[6] = colours[5]; // E\r
-    ResidueColour[7] = colours[7]; // G\r
-    ResidueColour[8] = colours[10]; // H\r
-    ResidueColour[9] = colours[0]; // I\r
-    ResidueColour[10] = colours[0]; // L\r
-    ResidueColour[11] = colours[4]; // K\r
-    ResidueColour[12] = colours[0]; // M\r
-    ResidueColour[13] = colours[0]; // F\r
-    ResidueColour[14] = colours[8]; // P\r
-    ResidueColour[15] = colours[1]; // S\r
-    ResidueColour[16] = colours[1]; // T\r
-    ResidueColour[17] = colours[0]; // W\r
-    ResidueColour[18] = colours[10]; // Y\r
-    ResidueColour[19] = colours[0]; // V\r
-  }\r
-\r
-  public Color findColour(String s)\r
-  {\r
-    return Color.pink;\r
-  }\r
-\r
-  public Color findColour(String s, int j)\r
-   {\r
-     if( threshold!=0 && !aboveThreshold(s,j))\r
-      return Color.white;\r
-\r
-\r
-     int i = ((Integer)ResidueProperties.aaHash.get(s)).intValue();\r
-\r
-     Color c = Color.white;\r
-\r
-     if(i>19)\r
-       return c;\r
-\r
-     for (int k=0; k < ResidueColour[i].conses.length ; k++)\r
-       if (ResidueColour[i].conses[k].isConserved(cons2,j,size))\r
-         c =  ResidueColour[i].c;\r
-\r
-     if (i == 4)\r
-    {\r
-      if (conses[27].isConserved(cons2, j, size))\r
-        c = (Color) colhash.get("PINK");\r
+\r
+    public ClustalxColourScheme(Vector seqs, int maxWidth) {\r
+        resetClustalX(seqs, maxWidth);\r
     }\r
 \r
+    public void resetClustalX(Vector seqs, int maxWidth) {\r
+        cons2 = new int[maxWidth][24];\r
 \r
-     return c;\r
+        int start = 0;\r
 \r
-   }\r
-}\r
+        // Initialize the array\r
+        for (int j = 0; j < 24; j++)\r
+            for (int i = 0; i < maxWidth; i++)\r
+                cons2[i][j] = 0;\r
 \r
-class ConsensusColour {\r
+        int res;\r
+        int i;\r
+        int j = 0;\r
+        String seq;\r
 \r
-  Consensus[] conses;\r
-  Color c;\r
+        while (j < seqs.size()) {\r
+            seq = ((SequenceI) seqs.elementAt(j)).getSequence();\r
 \r
-  public ConsensusColour(Color c,Consensus[] conses) {\r
-    this.conses = conses;\r
-    //    this.list = list;\r
-    this.c = c;\r
-  }\r
-}\r
+            int end_j = seq.length() - 1;\r
 \r
+            for (i = start; i <= end_j; i++) {\r
+                if ((seq.length() - 1) < i) {\r
+                    res = 23;\r
+                } else {\r
+                    res = ((Integer) ResidueProperties.aaHash.get(seq.charAt(i) +\r
+                            "")).intValue();\r
+                }\r
 \r
+                cons2[i][res]++;\r
+            }\r
 \r
+            j++;\r
+        }\r
+\r
+        this.size = seqs.size();\r
+        makeColours();\r
+    }\r
 \r
+    public void makeColours() {\r
+        conses[0] = new Consensus("WLVIMAFCYHP", 60);\r
+        conses[1] = new Consensus("WLVIMAFCYHP", 80);\r
+        conses[2] = new Consensus("ED", 50);\r
+        conses[3] = new Consensus("KR", 60);\r
+        conses[4] = new Consensus("G", 50);\r
+        conses[5] = new Consensus("N", 50);\r
+        conses[6] = new Consensus("QE", 50);\r
+        conses[7] = new Consensus("P", 50);\r
+        conses[8] = new Consensus("TS", 50);\r
+\r
+        conses[26] = new Consensus("A", 85);\r
+        conses[27] = new Consensus("C", 85);\r
+        conses[10] = new Consensus("E", 85);\r
+        conses[11] = new Consensus("F", 85);\r
+        conses[12] = new Consensus("G", 85);\r
+        conses[13] = new Consensus("H", 85);\r
+        conses[14] = new Consensus("I", 85);\r
+        conses[15] = new Consensus("L", 85);\r
+        conses[16] = new Consensus("M", 85);\r
+        conses[17] = new Consensus("N", 85);\r
+        conses[18] = new Consensus("P", 85);\r
+        conses[19] = new Consensus("Q", 85);\r
+        conses[20] = new Consensus("R", 85);\r
+        conses[21] = new Consensus("S", 85);\r
+        conses[22] = new Consensus("T", 85);\r
+        conses[23] = new Consensus("V", 85);\r
+        conses[24] = new Consensus("W", 85);\r
+        conses[25] = new Consensus("Y", 85);\r
+        conses[28] = new Consensus("K", 85);\r
+        conses[29] = new Consensus("D", 85);\r
+\r
+        conses[30] = new Consensus("G", 0);\r
+        conses[31] = new Consensus("P", 0);\r
+\r
+        // We now construct the colours\r
+        colours = new ConsensusColour[11];\r
+\r
+        Consensus[] tmp8 = new Consensus[1];\r
+        tmp8[0] = conses[30]; //G\r
+        colours[7] = new ConsensusColour((Color) colhash.get("ORANGE"), tmp8);\r
+\r
+        Consensus[] tmp9 = new Consensus[1];\r
+        tmp9[0] = conses[31]; //P\r
+        colours[8] = new ConsensusColour((Color) colhash.get("YELLOW"), tmp9);\r
+\r
+        Consensus[] tmp10 = new Consensus[1];\r
+        tmp10[0] = conses[27]; //C\r
+        colours[9] = new ConsensusColour((Color) colhash.get("PINK"), tmp8);\r
+\r
+        Consensus[] tmp1 = new Consensus[14];\r
+        tmp1[0] = conses[0]; //%\r
+        tmp1[1] = conses[1]; //#\r
+        tmp1[2] = conses[26]; //A\r
+        tmp1[3] = conses[27]; //C\r
+        tmp1[4] = conses[11]; //F\r
+        tmp1[5] = conses[13]; //H\r
+        tmp1[6] = conses[14]; //I\r
+        tmp1[7] = conses[15]; //L\r
+        tmp1[8] = conses[16]; //M\r
+        tmp1[9] = conses[23]; //V\r
+        tmp1[10] = conses[24]; //W\r
+        tmp1[11] = conses[25]; //Y\r
+        tmp1[12] = conses[18]; //P\r
+        tmp1[13] = conses[19]; //p\r
+        colours[0] = new ConsensusColour((Color) colhash.get("BLUE"), tmp1);\r
+\r
+        colours[10] = new ConsensusColour((Color) colhash.get("CYAN"), tmp1);\r
+\r
+        Consensus[] tmp2 = new Consensus[5];\r
+        tmp2[0] = conses[8]; //t\r
+        tmp2[1] = conses[21]; //S\r
+        tmp2[2] = conses[22]; //T\r
+        tmp2[3] = conses[0]; //%\r
+        tmp2[4] = conses[1]; //#\r
+        colours[1] = new ConsensusColour((Color) colhash.get("GREEN"), tmp2);\r
+\r
+        Consensus[] tmp3 = new Consensus[3];\r
+\r
+        tmp3[0] = conses[17]; //N\r
+        tmp3[1] = conses[29]; //D\r
+        tmp3[2] = conses[5]; //n\r
+        colours[2] = new ConsensusColour((Color) colhash.get("GREEN"), tmp3);\r
+\r
+        Consensus[] tmp4 = new Consensus[6];\r
+        tmp4[0] = conses[6]; // q = QE\r
+        tmp4[1] = conses[19]; //Q\r
+        tmp4[2] = conses[22]; //E\r
+        tmp4[3] = conses[3]; //+\r
+        tmp4[4] = conses[28]; //K\r
+        tmp4[5] = conses[20]; //R\r
+        colours[3] = new ConsensusColour((Color) colhash.get("GREEN"), tmp4);\r
+\r
+        Consensus[] tmp5 = new Consensus[4];\r
+        tmp5[0] = conses[3]; //+\r
+        tmp5[1] = conses[28]; //K\r
+        tmp5[2] = conses[20]; //R\r
+        tmp5[3] = conses[19]; //Q\r
+        colours[4] = new ConsensusColour((Color) colhash.get("RED"), tmp5);\r
+\r
+        Consensus[] tmp6 = new Consensus[5];\r
+        tmp6[0] = conses[3]; //-\r
+        tmp6[1] = conses[29]; //D\r
+        tmp6[2] = conses[10]; //E\r
+        tmp6[3] = conses[6]; //q\r
+        tmp6[4] = conses[19]; //Q\r
+        colours[5] = new ConsensusColour((Color) colhash.get("MAGENTA"), tmp6);\r
+\r
+        Consensus[] tmp7 = new Consensus[5];\r
+        tmp7[0] = conses[3]; //-\r
+        tmp7[1] = conses[29]; //D\r
+        tmp7[2] = conses[10]; //E\r
+        tmp7[3] = conses[17]; //N\r
+        tmp7[4] = conses[2]; //DE\r
+        colours[6] = new ConsensusColour((Color) colhash.get("MAGENTA"), tmp7);\r
+\r
+        // Now attach the ConsensusColours to the residue letters\r
+        ResidueColour = new ConsensusColour[20];\r
+        ResidueColour[0] = colours[0]; // A\r
+        ResidueColour[1] = colours[4]; // R\r
+        ResidueColour[2] = colours[2]; // N\r
+        ResidueColour[3] = colours[6]; // D\r
+        ResidueColour[4] = colours[0]; // C\r
+        ResidueColour[5] = colours[3]; // Q\r
+        ResidueColour[6] = colours[5]; // E\r
+        ResidueColour[7] = colours[7]; // G\r
+        ResidueColour[8] = colours[10]; // H\r
+        ResidueColour[9] = colours[0]; // I\r
+        ResidueColour[10] = colours[0]; // L\r
+        ResidueColour[11] = colours[4]; // K\r
+        ResidueColour[12] = colours[0]; // M\r
+        ResidueColour[13] = colours[0]; // F\r
+        ResidueColour[14] = colours[8]; // P\r
+        ResidueColour[15] = colours[1]; // S\r
+        ResidueColour[16] = colours[1]; // T\r
+        ResidueColour[17] = colours[0]; // W\r
+        ResidueColour[18] = colours[10]; // Y\r
+        ResidueColour[19] = colours[0]; // V\r
+    }\r
 \r
+    public Color findColour(String s) {\r
+        return Color.pink;\r
+    }\r
+\r
+    public Color findColour(String s, int j) {\r
+        if ((threshold != 0) && !aboveThreshold(s, j)) {\r
+            return Color.white;\r
+        }\r
 \r
+        int i = ((Integer) ResidueProperties.aaHash.get(s)).intValue();\r
 \r
+        Color c = Color.white;\r
 \r
+        if (i > 19) {\r
+            return c;\r
+        }\r
 \r
+        for (int k = 0; k < ResidueColour[i].conses.length; k++)\r
+            if (ResidueColour[i].conses[k].isConserved(cons2, j, size)) {\r
+                c = ResidueColour[i].c;\r
+            }\r
 \r
+        if (i == 4) {\r
+            if (conses[27].isConserved(cons2, j, size)) {\r
+                c = (Color) colhash.get("PINK");\r
+            }\r
+        }\r
 \r
+        return c;\r
+    }\r
+}\r
 \r
 \r
+class ConsensusColour {\r
+    Consensus[] conses;\r
+    Color c;\r
 \r
+    public ConsensusColour(Color c, Consensus[] conses) {\r
+        this.conses = conses;\r
 \r
+        //    this.list = list;\r
+        this.c = c;\r
+    }\r
+}\r
index 250cae5..2e28695 100755 (executable)
 * 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.schemes;\r
 \r
 import java.awt.*;\r
+\r
 import java.util.*;\r
 \r
-public interface ColourSchemeI\r
-{\r
-  public Color   findColour(String aa);\r
-  public Color   findColour(String s,int j);\r
-  public void    setConsensus(Vector v);\r
+\r
+public interface ColourSchemeI {\r
+    public Color findColour(String aa);\r
+\r
+    public Color findColour(String s, int j);\r
+\r
+    public void setConsensus(Vector v);\r
 }\r
index a981549..6e7a711 100755 (executable)
 * 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.schemes;\r
 \r
-public class ColourSchemeProperty\r
-{\r
-  public static final int CLUSTAL = 0;\r
-  public static final int BLOSUM = 1;\r
-  public static final int PID = 2;\r
-  public static final int ZAPPO = 3;\r
-  public static final int HYDROPHOBIC=4;\r
-  public static final int HELIX=5;\r
-  public static final int STRAND=6;\r
-  public static final int TURN = 7;\r
-  public static final int BURIED = 8;\r
-  public static final int NUCLEOTIDE = 9;\r
-  public static final int USER_DEFINED = 10;\r
-  public static final int NONE = 11;\r
-\r
-  public static int getColourIndexFromName(String name)\r
-  {\r
-    int ret=11;\r
-    if(name.equalsIgnoreCase("Clustal"))\r
-      ret = CLUSTAL;\r
-    else if(name.equalsIgnoreCase("Blosum62"))\r
-      ret = BLOSUM;\r
-    else if(name.equalsIgnoreCase("% Identity"))\r
-      ret = PID;\r
-    else if(name.equalsIgnoreCase("Zappo"))\r
-      ret = ZAPPO;\r
-    else if(name.equalsIgnoreCase("Hydrophobic"))\r
-      ret = HYDROPHOBIC;\r
-    else if(name.equalsIgnoreCase("Helix Propensity"))\r
-      ret = HELIX;\r
-    else if(name.equalsIgnoreCase("Strand Propensity"))\r
-      ret = STRAND;\r
-    else if(name.equalsIgnoreCase("Turn Propensity"))\r
-      ret = TURN;\r
-    else if(name.equalsIgnoreCase("Buried Index"))\r
-      ret = BURIED;\r
-    else if(name.equalsIgnoreCase("Nucleotide"))\r
-      ret = NUCLEOTIDE;\r
-    else if(name.equalsIgnoreCase("User Defined"))\r
-      ret =  USER_DEFINED;\r
-\r
-    return ret;\r
-  }\r
-\r
-  public static String getColourName(ColourSchemeI cs)\r
-  {\r
-    if(cs instanceof ConservationColourScheme)\r
-     cs = ((ConservationColourScheme)cs).cs;\r
-\r
-\r
-    int index = 11;\r
-    if(cs instanceof ClustalxColourScheme)\r
-      index = CLUSTAL;\r
-    else if(cs instanceof  Blosum62ColourScheme)\r
-      index = BLOSUM;\r
-    else if(cs instanceof  PIDColourScheme)\r
-      index = PID;\r
-    else if(cs instanceof  ZappoColourScheme)\r
-      index = ZAPPO;\r
-    else if(cs instanceof  HydrophobicColourScheme)\r
-      index = HYDROPHOBIC;\r
-    else if(cs instanceof  HelixColourScheme)\r
-      index = HELIX;\r
-    else if(cs instanceof  StrandColourScheme)\r
-      index = STRAND;\r
-    else if(cs instanceof  TurnColourScheme)\r
-      index = TURN;\r
-    else if(cs instanceof  BuriedColourScheme)\r
-      index = BURIED;\r
-    else if(cs instanceof  NucleotideColourScheme)\r
-      index = NUCLEOTIDE;\r
-    else if(cs instanceof  UserColourScheme)\r
-      index = USER_DEFINED;\r
-\r
-    return getColourName(index);\r
-  }\r
-\r
-  public static String getColourName(int index)\r
-  {\r
-    String ret=null;\r
-    switch(index)\r
-    {\r
-      case CLUSTAL: ret = "Clustal";    break;\r
-      case BLOSUM:  ret = "Blosum62";   break;\r
-      case PID:     ret = "% Identity"; break;\r
-      case ZAPPO:   ret = "Zappo";      break;\r
-      case HYDROPHOBIC: ret="Hydrophobic";break;\r
-      case HELIX:   ret="Helix Propensity";break;\r
-      case STRAND:  ret="Strand Propensity";break;\r
-      case TURN:    ret="Turn Propensity";break;\r
-      case BURIED:  ret="Buried Index";break;\r
-      case NUCLEOTIDE:ret="Nucleotide"; break;\r
-      case USER_DEFINED:ret="User Defined";break;\r
-      default: ret = "None"; break;\r
+public class ColourSchemeProperty {\r
+    public static final int CLUSTAL = 0;\r
+    public static final int BLOSUM = 1;\r
+    public static final int PID = 2;\r
+    public static final int ZAPPO = 3;\r
+    public static final int HYDROPHOBIC = 4;\r
+    public static final int HELIX = 5;\r
+    public static final int STRAND = 6;\r
+    public static final int TURN = 7;\r
+    public static final int BURIED = 8;\r
+    public static final int NUCLEOTIDE = 9;\r
+    public static final int USER_DEFINED = 10;\r
+    public static final int NONE = 11;\r
+\r
+    public static int getColourIndexFromName(String name) {\r
+        int ret = 11;\r
+\r
+        if (name.equalsIgnoreCase("Clustal")) {\r
+            ret = CLUSTAL;\r
+        } else if (name.equalsIgnoreCase("Blosum62")) {\r
+            ret = BLOSUM;\r
+        } else if (name.equalsIgnoreCase("% Identity")) {\r
+            ret = PID;\r
+        } else if (name.equalsIgnoreCase("Zappo")) {\r
+            ret = ZAPPO;\r
+        } else if (name.equalsIgnoreCase("Hydrophobic")) {\r
+            ret = HYDROPHOBIC;\r
+        } else if (name.equalsIgnoreCase("Helix Propensity")) {\r
+            ret = HELIX;\r
+        } else if (name.equalsIgnoreCase("Strand Propensity")) {\r
+            ret = STRAND;\r
+        } else if (name.equalsIgnoreCase("Turn Propensity")) {\r
+            ret = TURN;\r
+        } else if (name.equalsIgnoreCase("Buried Index")) {\r
+            ret = BURIED;\r
+        } else if (name.equalsIgnoreCase("Nucleotide")) {\r
+            ret = NUCLEOTIDE;\r
+        } else if (name.equalsIgnoreCase("User Defined")) {\r
+            ret = USER_DEFINED;\r
+        }\r
+\r
+        return ret;\r
+    }\r
+\r
+    public static String getColourName(ColourSchemeI cs) {\r
+        if (cs instanceof ConservationColourScheme) {\r
+            cs = ((ConservationColourScheme) cs).cs;\r
+        }\r
+\r
+        int index = 11;\r
+\r
+        if (cs instanceof ClustalxColourScheme) {\r
+            index = CLUSTAL;\r
+        } else if (cs instanceof Blosum62ColourScheme) {\r
+            index = BLOSUM;\r
+        } else if (cs instanceof PIDColourScheme) {\r
+            index = PID;\r
+        } else if (cs instanceof ZappoColourScheme) {\r
+            index = ZAPPO;\r
+        } else if (cs instanceof HydrophobicColourScheme) {\r
+            index = HYDROPHOBIC;\r
+        } else if (cs instanceof HelixColourScheme) {\r
+            index = HELIX;\r
+        } else if (cs instanceof StrandColourScheme) {\r
+            index = STRAND;\r
+        } else if (cs instanceof TurnColourScheme) {\r
+            index = TURN;\r
+        } else if (cs instanceof BuriedColourScheme) {\r
+            index = BURIED;\r
+        } else if (cs instanceof NucleotideColourScheme) {\r
+            index = NUCLEOTIDE;\r
+        } else if (cs instanceof UserColourScheme) {\r
+            index = USER_DEFINED;\r
+        }\r
+\r
+        return getColourName(index);\r
+    }\r
+\r
+    public static String getColourName(int index) {\r
+        String ret = null;\r
+\r
+        switch (index) {\r
+        case CLUSTAL:\r
+            ret = "Clustal";\r
+\r
+            break;\r
+\r
+        case BLOSUM:\r
+            ret = "Blosum62";\r
+\r
+            break;\r
+\r
+        case PID:\r
+            ret = "% Identity";\r
+\r
+            break;\r
+\r
+        case ZAPPO:\r
+            ret = "Zappo";\r
+\r
+            break;\r
+\r
+        case HYDROPHOBIC:\r
+            ret = "Hydrophobic";\r
+\r
+            break;\r
+\r
+        case HELIX:\r
+            ret = "Helix Propensity";\r
+\r
+            break;\r
+\r
+        case STRAND:\r
+            ret = "Strand Propensity";\r
+\r
+            break;\r
+\r
+        case TURN:\r
+            ret = "Turn Propensity";\r
+\r
+            break;\r
+\r
+        case BURIED:\r
+            ret = "Buried Index";\r
+\r
+            break;\r
+\r
+        case NUCLEOTIDE:\r
+            ret = "Nucleotide";\r
+\r
+            break;\r
+\r
+        case USER_DEFINED:\r
+            ret = "User Defined";\r
+\r
+            break;\r
+\r
+        default:\r
+            ret = "None";\r
+\r
+            break;\r
+        }\r
+\r
+        return ret;\r
     }\r
-    return ret;\r
-  }\r
-\r
-  public static ColourSchemeI getColour(jalview.datamodel.AlignmentI al, String name)\r
-  {\r
-    return getColour(al, getColourIndexFromName(name));\r
-  }\r
-\r
-  public static ColourSchemeI getColour(jalview.datamodel.AlignmentI al, int index)\r
-  {\r
-    ColourSchemeI cs = null;\r
-    switch(index)\r
-    {\r
-      case CLUSTAL: cs = new ClustalxColourScheme(al.getSequences(), al.getWidth()); break;\r
-      case BLOSUM: cs = new Blosum62ColourScheme(); break;\r
-      case PID: cs = new PIDColourScheme();  break;\r
-      case ZAPPO: cs = new ZappoColourScheme(); break;\r
-      case HYDROPHOBIC: cs = new HydrophobicColourScheme(); break;\r
-      case HELIX: cs = new HelixColourScheme(); break;\r
-      case STRAND: cs = new StrandColourScheme(); break;\r
-      case TURN: cs = new TurnColourScheme(); break;\r
-      case BURIED: cs = new BuriedColourScheme(); break;\r
-      case NUCLEOTIDE: cs = new NucleotideColourScheme(); break;\r
-      case USER_DEFINED: cs = new UserColourScheme(null);\r
-        break;\r
-\r
-      default: break;\r
+\r
+    public static ColourSchemeI getColour(jalview.datamodel.AlignmentI al,\r
+        String name) {\r
+        return getColour(al, getColourIndexFromName(name));\r
     }\r
 \r
-    return cs;\r
-  }\r
+    public static ColourSchemeI getColour(jalview.datamodel.AlignmentI al,\r
+        int index) {\r
+        ColourSchemeI cs = null;\r
+\r
+        switch (index) {\r
+        case CLUSTAL:\r
+            cs = new ClustalxColourScheme(al.getSequences(), al.getWidth());\r
+\r
+            break;\r
+\r
+        case BLOSUM:\r
+            cs = new Blosum62ColourScheme();\r
+\r
+            break;\r
+\r
+        case PID:\r
+            cs = new PIDColourScheme();\r
+\r
+            break;\r
+\r
+        case ZAPPO:\r
+            cs = new ZappoColourScheme();\r
+\r
+            break;\r
+\r
+        case HYDROPHOBIC:\r
+            cs = new HydrophobicColourScheme();\r
+\r
+            break;\r
+\r
+        case HELIX:\r
+            cs = new HelixColourScheme();\r
+\r
+            break;\r
+\r
+        case STRAND:\r
+            cs = new StrandColourScheme();\r
+\r
+            break;\r
+\r
+        case TURN:\r
+            cs = new TurnColourScheme();\r
+\r
+            break;\r
+\r
+        case BURIED:\r
+            cs = new BuriedColourScheme();\r
+\r
+            break;\r
+\r
+        case NUCLEOTIDE:\r
+            cs = new NucleotideColourScheme();\r
+\r
+            break;\r
+\r
+        case USER_DEFINED:\r
+            cs = new UserColourScheme(null);\r
+\r
+            break;\r
+\r
+        default:\r
+            break;\r
+        }\r
+\r
+        return cs;\r
+    }\r
 }\r
index 27c5906..8ca0223 100755 (executable)
 * 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.schemes;\r
 \r
+\r
 ////////////////////////////////////////////\r
 // This does nothing at all at the moment!!!!!!!!!!\r
 // AW 15th Dec 2004\r
 /////////////////////////////////////////\r
 public class Consensus {\r
+    int[] mask;\r
+    double threshold;\r
+    String maskstr;\r
 \r
-  int[] mask;\r
-  double threshold;\r
-   String maskstr;\r
-\r
-  public Consensus(String mask, double threshold) {\r
-    // this.id = id;\r
-    //    this.mask = mask;\r
+    public Consensus(String mask, double threshold) {\r
+        // this.id = id;\r
+        //    this.mask = mask;\r
         this.maskstr = mask;\r
-    setMask(mask);\r
-    this.threshold = threshold;\r
-  }\r
+        setMask(mask);\r
+        this.threshold = threshold;\r
+    }\r
 \r
-  public void setMask(String s) {\r
-    this.mask = setNums(s);\r
-    //   for (int i=0; i < mask.length; i++) {\r
-    //  System.out.println(mask[i] + " " + ResidueProperties.aa[mask[i]]);\r
-    // }\r
-  }\r
+    public void setMask(String s) {\r
+        this.mask = setNums(s);\r
 \r
-  public boolean isConserved(int[][] cons2,int col ,int size) {\r
-    int tot = 0;\r
-    for (int i = 0; i < mask.length; i++)\r
-      tot += cons2[col][mask[i]];\r
+        //   for (int i=0; i < mask.length; i++) {\r
+        //  System.out.println(mask[i] + " " + ResidueProperties.aa[mask[i]]);\r
+        // }\r
+    }\r
 \r
-    if ( (double) tot > threshold * size / 100)\r
-      return true;\r
+    public boolean isConserved(int[][] cons2, int col, int size) {\r
+        int tot = 0;\r
 \r
-    return false;\r
-  }\r
+        for (int i = 0; i < mask.length; i++)\r
+            tot += cons2[col][mask[i]];\r
 \r
-  int[] setNums(String s)\r
-  {\r
-    int [] out = new int[s.length()];\r
-    int i = 0;\r
-    while (i < s.length())\r
-    {\r
-      out[i] = ( (Integer) ResidueProperties.aaHash.get(s.substring(i, i + 1))).intValue();\r
-      i++;\r
+        if ((double) tot > ((threshold * size) / 100)) {\r
+            return true;\r
+        }\r
 \r
+        return false;\r
     }\r
 \r
-    return out;\r
-  }\r
+    int[] setNums(String s) {\r
+        int[] out = new int[s.length()];\r
+        int i = 0;\r
 \r
+        while (i < s.length()) {\r
+            out[i] = ((Integer) ResidueProperties.aaHash.get(s.substring(i,\r
+                        i + 1))).intValue();\r
+            i++;\r
+        }\r
 \r
+        return out;\r
+    }\r
 }\r
-\r
-\r
-\r
-\r
index 8c3f694..bbc0edd 100755 (executable)
 * 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.schemes;\r
-import java.awt.*;\r
+\r
 import jalview.analysis.*;\r
+\r
+import java.awt.*;\r
+\r
 import java.util.Vector;\r
 \r
+\r
 public class ConservationColourScheme extends ResidueColourScheme {\r
-  public Conservation conserve;\r
-  public ColourSchemeI cs;\r
-  public int inc = 30;\r
-\r
-  public ConservationColourScheme(Conservation cons, ColourSchemeI oldcs)\r
-  {\r
-    super();\r
-    conserve = cons;\r
-    cs = oldcs;\r
-  }\r
-\r
-  public void setConsensus(Vector consensus)\r
-  {\r
-    this.consensus = consensus;\r
-    if(cs!=null)\r
-      cs.setConsensus(consensus);\r
-  }\r
-\r
-   public Color findColour(String s, int i)\r
-   {\r
-     Color c = Color.white;\r
-     if (cs == null)\r
-       return c;\r
-\r
-     char ch = conserve.getConsSequence().getSequence().charAt(i);\r
-     if (ch == '*' || ch == '+')\r
-     {\r
-       c = cs.findColour(s, i);\r
-     }\r
-     else\r
-     {\r
-       int tmp = 10;\r
-       int t = 0;\r
-       if (!jalview.util.Comparison.isGap(ch))\r
-         t = Integer.parseInt(ch + "");\r
-\r
-       c = cs.findColour(s, i);\r
-\r
-       while (tmp >= t)\r
-       {\r
-         c = lighter(c, inc);\r
-         tmp--;\r
-       }\r
-\r
-     }\r
-\r
-   return c;\r
-   }\r
-\r
-\r
-  public Color lighter(Color c, int inc) {\r
-    int red = c.getRed();\r
-    int blue = c.getBlue();\r
-    int green = c.getGreen();\r
-\r
-    if (red < 255-inc) { red = red +inc;} else {red = 255;}\r
-    if (blue < 255-inc) { blue = blue +inc;} else {blue = 255;}\r
-    if (green < 255-inc) { green = green +inc;} else {green = 255;}\r
-\r
-    return new Color(red,green,blue);\r
-  }\r
+    public Conservation conserve;\r
+    public ColourSchemeI cs;\r
+    public int inc = 30;\r
+\r
+    public ConservationColourScheme(Conservation cons, ColourSchemeI oldcs) {\r
+        super();\r
+        conserve = cons;\r
+        cs = oldcs;\r
+    }\r
+\r
+    public void setConsensus(Vector consensus) {\r
+        this.consensus = consensus;\r
+\r
+        if (cs != null) {\r
+            cs.setConsensus(consensus);\r
+        }\r
+    }\r
+\r
+    public Color findColour(String s, int i) {\r
+        Color c = Color.white;\r
+\r
+        if (cs == null) {\r
+            return c;\r
+        }\r
+\r
+        char ch = conserve.getConsSequence().getSequence().charAt(i);\r
+\r
+        if ((ch == '*') || (ch == '+')) {\r
+            c = cs.findColour(s, i);\r
+        } else {\r
+            int tmp = 10;\r
+            int t = 0;\r
+\r
+            if (!jalview.util.Comparison.isGap(ch)) {\r
+                t = Integer.parseInt(ch + "");\r
+            }\r
+\r
+            c = cs.findColour(s, i);\r
+\r
+            while (tmp >= t) {\r
+                c = lighter(c, inc);\r
+                tmp--;\r
+            }\r
+        }\r
+\r
+        return c;\r
+    }\r
+\r
+    public Color lighter(Color c, int inc) {\r
+        int red = c.getRed();\r
+        int blue = c.getBlue();\r
+        int green = c.getGreen();\r
+\r
+        if (red < (255 - inc)) {\r
+            red = red + inc;\r
+        } else {\r
+            red = 255;\r
+        }\r
+\r
+        if (blue < (255 - inc)) {\r
+            blue = blue + inc;\r
+        } else {\r
+            blue = 255;\r
+        }\r
+\r
+        if (green < (255 - inc)) {\r
+            green = green + inc;\r
+        } else {\r
+            green = 255;\r
+        }\r
 \r
+        return new Color(red, green, blue);\r
+    }\r
 }\r
index 35e1a26..a25f014 100755 (executable)
 * 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.schemes;\r
 \r
 import java.awt.*;\r
 \r
-public class HelixColourScheme extends ScoreColourScheme {\r
-\r
 \r
-  public HelixColourScheme() {\r
-    super(ResidueProperties.helix,ResidueProperties.helixmin,ResidueProperties.helixmax);\r
-  }\r
+public class HelixColourScheme extends ScoreColourScheme {\r
+    public HelixColourScheme() {\r
+        super(ResidueProperties.helix, ResidueProperties.helixmin,\r
+            ResidueProperties.helixmax);\r
+    }\r
 \r
-  public Color makeColour(float c) {\r
-    return new Color(c,(float)1.0-c,c);\r
-  }\r
+    public Color makeColour(float c) {\r
+        return new Color(c, (float) 1.0 - c, c);\r
+    }\r
 }\r
index e1eef48..eeb43a3 100755 (executable)
 * 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.schemes;\r
 \r
 import java.awt.*;\r
 \r
-public class HydrophobicColourScheme extends ScoreColourScheme {\r
 \r
-  public HydrophobicColourScheme() {\r
-    super(ResidueProperties.hyd,ResidueProperties.hydmin,ResidueProperties.hydmax);\r
-  }\r
+public class HydrophobicColourScheme extends ScoreColourScheme {\r
+    public HydrophobicColourScheme() {\r
+        super(ResidueProperties.hyd, ResidueProperties.hydmin,\r
+            ResidueProperties.hydmax);\r
+    }\r
 \r
-  public Color makeColour(float c) {\r
-    return new Color(c,(float)0.0,(float)1.0-c);\r
-  }\r
+    public Color makeColour(float c) {\r
+        return new Color(c, (float) 0.0, (float) 1.0 - c);\r
+    }\r
 }\r
index 0f2101e..0cca608 100755 (executable)
 * 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.schemes;\r
 \r
 import java.awt.*;\r
 \r
-public class NucleotideColourScheme extends ResidueColourScheme\r
-{\r
-  public NucleotideColourScheme() {\r
-  super(ResidueProperties.nucleotide,0);\r
-  }\r
-\r
-\r
-  public Color findColour(String n)\r
-  {\r
-    // System.out.println("called"); log.debug\r
-    return colors[((Integer)(ResidueProperties.nucleotideHash.get(n))).intValue()];\r
-  }\r
-\r
-\r
-  public Color findColour(String n, int j) {\r
-\r
-    if (threshold == 0 || aboveThreshold( n, j))\r
-      try\r
-      {\r
-        return colors[ ( (Integer) (ResidueProperties.nucleotideHash.get(n))).intValue()];\r
-      }\r
-      catch (Exception ex)\r
-      {\r
-        return Color.white;\r
-      }\r
-    else\r
-      return Color.white;\r
-\r
-  }\r
 \r
+public class NucleotideColourScheme extends ResidueColourScheme {\r
+    public NucleotideColourScheme() {\r
+        super(ResidueProperties.nucleotide, 0);\r
+    }\r
+\r
+    public Color findColour(String n) {\r
+        // System.out.println("called"); log.debug\r
+        return colors[((Integer) (ResidueProperties.nucleotideHash.get(n))).intValue()];\r
+    }\r
+\r
+    public Color findColour(String n, int j) {\r
+        if ((threshold == 0) || aboveThreshold(n, j)) {\r
+            try {\r
+                return colors[((Integer) (ResidueProperties.nucleotideHash.get(n))).intValue()];\r
+            } catch (Exception ex) {\r
+                return Color.white;\r
+            }\r
+        } else {\r
+            return Color.white;\r
+        }\r
+    }\r
 }\r
index 34c47ed..2535154 100755 (executable)
 * 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.schemes;\r
 \r
 import jalview.datamodel.*;\r
-import java.util.*;\r
+\r
 import java.awt.*;\r
 \r
+import java.util.*;\r
+\r
+\r
 public class PIDColourScheme extends ResidueColourScheme {\r
     public Color[] pidColours;\r
     public float[] thresholds;\r
-\r
     SequenceGroup group;\r
 \r
     public PIDColourScheme() {\r
-       this.pidColours = ResidueProperties.pidColours;\r
-       this.thresholds = ResidueProperties.pidThresholds;\r
+        this.pidColours = ResidueProperties.pidColours;\r
+        this.thresholds = ResidueProperties.pidThresholds;\r
     }\r
 \r
+    public Color findColour(String s, int j) {\r
+        if ((threshold != 0) && !aboveThreshold(s, j)) {\r
+            return Color.white;\r
+        }\r
 \r
+        Color c = Color.white;\r
+        Hashtable hash = (Hashtable) consensus.elementAt(j);\r
 \r
-  public Color findColour(String s, int j) {\r
+        double sc = 0;\r
 \r
-    if( threshold!=0 && !aboveThreshold(s,j))\r
-      return Color.white;\r
+        if ((Integer.parseInt(hash.get("maxCount").toString()) != -1) &&\r
+                hash.contains(s)) {\r
+            sc = (((Integer) hash.get(s)).intValue() * 100.0) / ((Integer) hash.get(\r
+                    "size")).intValue();\r
 \r
-    Color     c    = Color.white;\r
-      Hashtable hash =  (Hashtable)consensus.elementAt(j);\r
+            // MC Should be isGap\r
+            if (!jalview.util.Comparison.isGap((s.charAt(0)))) {\r
+                for (int i = 0; i < thresholds.length; i++) {\r
+                    if (sc > thresholds[i]) {\r
+                        c = pidColours[i];\r
 \r
-      double sc = 0;\r
-      if ( Integer.parseInt( hash.get("maxCount").toString() ) != -1 && hash.contains(s))\r
-      {\r
-        sc = ( (Integer) hash.get(s)).intValue() * 100.0 / ((Integer)hash.get("size")).intValue() ;\r
-        // MC Should be isGap\r
-        if (!jalview.util.Comparison.isGap((s.charAt(0))))\r
-        {\r
-          for (int i = 0; i < thresholds.length; i++)\r
-          {\r
-            if (sc > thresholds[i])\r
-            {\r
-              c = pidColours[i];\r
-              break;\r
+                        break;\r
+                    }\r
+                }\r
             }\r
-          }\r
         }\r
 \r
-      }\r
-      return c;\r
-  }\r
+        return c;\r
+    }\r
 }\r
index e90e6cc..a688593 100755 (executable)
 * 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.schemes;\r
 \r
-import java.util.*;\r
 import java.awt.*;\r
 \r
-public class ResidueColourScheme implements ColourSchemeI{\r
-    Color    [] colors;\r
-    int       threshold = 0;\r
-    public Vector   consensus;\r
+import java.util.*;\r
+\r
+\r
+public class ResidueColourScheme implements ColourSchemeI {\r
+    Color[] colors;\r
+    int threshold = 0;\r
+    public Vector consensus;\r
 \r
     public ResidueColourScheme(Color[] colors, int threshold) {\r
-        this.colors    = colors;\r
-       this.threshold = threshold;\r
+        this.colors = colors;\r
+        this.threshold = threshold;\r
     }\r
 \r
-    public ResidueColourScheme()\r
-    {   }\r
+    public ResidueColourScheme() {\r
+    }\r
 \r
-    public void setConsensus(Vector consensus)\r
-    {\r
-      this.consensus = consensus;\r
+    public void setConsensus(Vector consensus) {\r
+        this.consensus = consensus;\r
     }\r
 \r
-    public Color findColour(String aa)\r
-    {\r
-      return colors[((Integer)(ResidueProperties.aaHash.get(aa))).intValue()];\r
+    public Color findColour(String aa) {\r
+        return colors[((Integer) (ResidueProperties.aaHash.get(aa))).intValue()];\r
     }\r
 \r
     public Color findColour(String s, int j) {\r
-\r
-       if( threshold==0 || aboveThreshold(s,j))\r
-          return colors[((Integer)(ResidueProperties.aaHash.get(s))).intValue()];\r
-       else\r
-          return Color.white;\r
-\r
+        if ((threshold == 0) || aboveThreshold(s, j)) {\r
+            return colors[((Integer) (ResidueProperties.aaHash.get(s))).intValue()];\r
+        } else {\r
+            return Color.white;\r
+        }\r
     }\r
 \r
     public int getThreshold() {\r
-       return threshold;\r
+        return threshold;\r
     }\r
 \r
     public void setThreshold(int ct) {\r
-       threshold = ct;\r
+        threshold = ct;\r
     }\r
 \r
-    public boolean aboveThreshold(String s, int j)\r
-    {\r
-       Hashtable hash = (Hashtable)consensus.elementAt(j);\r
-\r
-        if ( ( (Integer) hash.get("maxCount")).intValue() != -1 && hash.contains(s))\r
-        {\r
-               ////  resCount////////////////////                  ///////////////seq count////////////\r
-          double sc = ( (Integer) hash.get(s)).intValue()  * 100.0 / ( (Integer) hash.get("size")).intValue();\r
+    public boolean aboveThreshold(String s, int j) {\r
+        Hashtable hash = (Hashtable) consensus.elementAt(j);\r
 \r
-          if (sc >= threshold)\r
-            return true;\r
+        if ((((Integer) hash.get("maxCount")).intValue() != -1) &&\r
+                hash.contains(s)) {\r
+            ////  resCount////////////////////                  ///////////////seq count////////////\r
+            double sc = (((Integer) hash.get(s)).intValue() * 100.0) / ((Integer) hash.get(\r
+                    "size")).intValue();\r
 \r
+            if (sc >= threshold) {\r
+                return true;\r
+            }\r
         }\r
 \r
-       return false;\r
+        return false;\r
     }\r
 }\r
index 002917b..552a463 100755 (executable)
 * 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.schemes;\r
 \r
 import java.awt.Color;\r
+\r
 import java.util.*;\r
 \r
+\r
 public class ResidueProperties {\r
+    //Stores residue codes/names and colours and other things\r
+    public static Hashtable aaHash = new Hashtable(); // stores the number value of the aa\r
+    public static Hashtable aa3Hash = new Hashtable();\r
+    public static Hashtable aa2Triplet = new Hashtable();\r
+    public static Hashtable nucleotideHash = new Hashtable();\r
+\r
+    static {\r
+        aaHash.put("A", new Integer(0));\r
+        aaHash.put("R", new Integer(1));\r
+        aaHash.put("N", new Integer(2));\r
+        aaHash.put("D", new Integer(3));\r
+        aaHash.put("C", new Integer(4));\r
+        aaHash.put("Q", new Integer(5));\r
+        aaHash.put("E", new Integer(6));\r
+        aaHash.put("G", new Integer(7));\r
+        aaHash.put("H", new Integer(8));\r
+        aaHash.put("I", new Integer(9));\r
+        aaHash.put("L", new Integer(10));\r
+        aaHash.put("K", new Integer(11));\r
+        aaHash.put("M", new Integer(12));\r
+        aaHash.put("F", new Integer(13));\r
+        aaHash.put("P", new Integer(14));\r
+        aaHash.put("S", new Integer(15));\r
+        aaHash.put("T", new Integer(16));\r
+        aaHash.put("W", new Integer(17));\r
+        aaHash.put("Y", new Integer(18));\r
+        aaHash.put("V", new Integer(19));\r
+        aaHash.put("B", new Integer(20));\r
+        aaHash.put("Z", new Integer(21));\r
+        aaHash.put("X", new Integer(22));\r
+        aaHash.put("a", new Integer(0));\r
+        aaHash.put("r", new Integer(1));\r
+        aaHash.put("n", new Integer(2));\r
+        aaHash.put("d", new Integer(3));\r
+        aaHash.put("c", new Integer(4));\r
+        aaHash.put("q", new Integer(5));\r
+        aaHash.put("e", new Integer(6));\r
+        aaHash.put("g", new Integer(7));\r
+        aaHash.put("h", new Integer(8));\r
+        aaHash.put("i", new Integer(9));\r
+        aaHash.put("l", new Integer(10));\r
+        aaHash.put("k", new Integer(11));\r
+        aaHash.put("m", new Integer(12));\r
+        aaHash.put("f", new Integer(13));\r
+        aaHash.put("p", new Integer(14));\r
+        aaHash.put("s", new Integer(15));\r
+        aaHash.put("t", new Integer(16));\r
+        aaHash.put("w", new Integer(17));\r
+        aaHash.put("y", new Integer(18));\r
+        aaHash.put("v", new Integer(19));\r
+        aaHash.put("b", new Integer(20));\r
+        aaHash.put("z", new Integer(21));\r
+        aaHash.put("x", new Integer(22));\r
+        aaHash.put("-", new Integer(23));\r
+        aaHash.put("*", new Integer(23));\r
+        aaHash.put(".", new Integer(23));\r
+        aaHash.put(" ", new Integer(23));\r
+    }\r
+\r
+    static {\r
+        nucleotideHash.put("A", new Integer(0));\r
+        nucleotideHash.put("C", new Integer(1));\r
+        nucleotideHash.put("G", new Integer(2));\r
+        nucleotideHash.put("T", new Integer(3));\r
+        nucleotideHash.put("U", new Integer(4));\r
+    }\r
+\r
+    // These numbers should correspond to the indices in the Color hashes\r
+    public static Hashtable aaSpecialsHash = new Hashtable();\r
+\r
+    static {\r
+        aaSpecialsHash.put("-", new Integer(23));\r
+        aaSpecialsHash.put("*", new Integer(24));\r
+        aaSpecialsHash.put(".", new Integer(25));\r
+        aaSpecialsHash.put(" ", new Integer(26));\r
+    }\r
+\r
+    static {\r
+        aa3Hash.put("ALA", new Integer(0));\r
+        aa3Hash.put("ARG", new Integer(1));\r
+        aa3Hash.put("ASN", new Integer(2));\r
+        aa3Hash.put("ASP", new Integer(3)); //D\r
+        aa3Hash.put("CYS", new Integer(4));\r
+        aa3Hash.put("GLN", new Integer(5)); //Q\r
+        aa3Hash.put("GLU", new Integer(6)); // E\r
+        aa3Hash.put("GLY", new Integer(7));\r
+        aa3Hash.put("HIS", new Integer(8));\r
+        aa3Hash.put("ILE", new Integer(9));\r
+        aa3Hash.put("LEU", new Integer(10));\r
+        aa3Hash.put("LYS", new Integer(11));\r
+        aa3Hash.put("MET", new Integer(12));\r
+        aa3Hash.put("PHE", new Integer(13));\r
+        aa3Hash.put("PRO", new Integer(14));\r
+        aa3Hash.put("SER", new Integer(15));\r
+        aa3Hash.put("THR", new Integer(16));\r
+        aa3Hash.put("TRP", new Integer(17));\r
+        aa3Hash.put("TYR", new Integer(18));\r
+        aa3Hash.put("VAL", new Integer(19));\r
+        aa3Hash.put("B", new Integer(20));\r
+        aa3Hash.put("Z", new Integer(21));\r
+        aa3Hash.put("X", new Integer(22));\r
+        aa3Hash.put("-", new Integer(23));\r
+        aa3Hash.put("*", new Integer(23));\r
+        aa3Hash.put(".", new Integer(23));\r
+        aa3Hash.put(" ", new Integer(23));\r
+    }\r
+\r
+    static {\r
+        aa2Triplet.put("A", "ALA");\r
+        aa2Triplet.put("R", "ARG");\r
+        aa2Triplet.put("N", "ASN");\r
+        aa2Triplet.put("D", "ASP");\r
+        aa2Triplet.put("C", "CYS");\r
+        aa2Triplet.put("Q", "GLN");\r
+        aa2Triplet.put("E", "GLU");\r
+        aa2Triplet.put("G", "GLY");\r
+        aa2Triplet.put("H", "HIS");\r
+        aa2Triplet.put("I", "ILE");\r
+        aa2Triplet.put("L", "LEU");\r
+        aa2Triplet.put("K", "LYS");\r
+        aa2Triplet.put("M", "MET");\r
+        aa2Triplet.put("F", "PHE");\r
+        aa2Triplet.put("P", "PRO");\r
+        aa2Triplet.put("S", "SER");\r
+        aa2Triplet.put("T", "THR");\r
+        aa2Triplet.put("W", "TRP");\r
+        aa2Triplet.put("Y", "TYR");\r
+        aa2Triplet.put("V", "VAL");\r
+    }\r
+\r
+    public static String[] aa = {\r
+        "A", "R", "N", "D", "C", "Q", "E", "G", "H", "I", "L", "K", "M", "F",\r
+        "P", "S", "T", "W", "Y", "V", "B", "Z", "X", "_", "*", ".", " "\r
+    };\r
+    public static Color midBlue = new Color(100, 100, 255);\r
+    public static Vector scaleColours = new Vector();\r
+\r
+    static {\r
+        scaleColours.addElement(new Color(114, 0, 147));\r
+        scaleColours.addElement(new Color(156, 0, 98));\r
+        scaleColours.addElement(new Color(190, 0, 0));\r
+        scaleColours.addElement(Color.red);\r
+        scaleColours.addElement(new Color(255, 125, 0));\r
+        scaleColours.addElement(Color.orange);\r
+        scaleColours.addElement(new Color(255, 194, 85));\r
+        scaleColours.addElement(Color.yellow);\r
+        scaleColours.addElement(new Color(255, 255, 181));\r
+        scaleColours.addElement(Color.white);\r
+    }\r
+\r
+    public static Color[] taylor = {\r
+        new Color(204, 255, 0), // A  Greenish-yellowy-yellow\r
+        new Color(0, 0, 255), // R  Blueish-bluey-blue\r
+        new Color(204, 0, 255), // N  Blueish-reddy-blue\r
+        new Color(255, 0, 0), // D  Reddish-reddy-red\r
+        new Color(255, 255, 0), // C  Yellowish-yellowy-yellow\r
+        new Color(255, 0, 204), // Q  Reddish-bluey-red\r
+        new Color(255, 0, 102), // E  Blueish-reddy-red\r
+        new Color(255, 153, 0), // G  Yellowy-reddy-yellow\r
+        new Color(0, 102, 255), // H  Greenish-bluey-blue\r
+        new Color(102, 255, 0), // I  Greenish-yellowy-green\r
+        new Color(51, 255, 0), // L  Yellowish-greeny-green\r
+        new Color(102, 0, 255), // K  Reddish-bluey-blue\r
+        new Color(0, 255, 0), // M  Greenish-greeny-green\r
+        new Color(0, 255, 102), // F  Blueish-greeny-green\r
+        new Color(255, 204, 0), // P  Reddish-yellowy-yellow\r
+        new Color(255, 51, 0), // S  Yellowish-reddy-red\r
+        new Color(255, 102, 0), // T  Reddish-yellowy-red\r
+        new Color(0, 204, 255), // W  Blueish-greeny-green\r
+        new Color(0, 255, 204), // Y  Greenish-bluey-green\r
+        new Color(153, 255, 0), // V  Yellowish-greeny-yellow\r
+        Color.white, // B\r
+        Color.white, // Z\r
+        Color.white, // X\r
+        Color.white, // -\r
+        Color.white, // *\r
+        Color.white // .\r
+    };\r
+    public static Color[] nucleotide = {\r
+        new Color(100, 247, 63), // A\r
+        new Color(255, 179, 64), // C\r
+        new Color(235, 65, 60), // G\r
+        new Color(60, 136, 238), // T\r
+        new Color(60, 136, 238) // U\r
+    };\r
+    public static Color[] color = {\r
+        Color.pink, // A\r
+        midBlue, // R\r
+        Color.green, // N\r
+        Color.red, // D\r
+        Color.yellow, // C\r
+        Color.green, // Q\r
+        Color.red, // E\r
+        Color.magenta, // G\r
+        Color.red, // H\r
+        Color.pink, // I\r
+        Color.pink, // L\r
+        midBlue, // K\r
+        Color.pink, // M\r
+        Color.orange, // F\r
+        Color.magenta, // P\r
+        Color.green, // S\r
+        Color.green, // T\r
+        Color.orange, // W\r
+        Color.orange, // Y\r
+        Color.pink, // V\r
+        Color.white, // B\r
+        Color.white, // Z\r
+        Color.white, // X\r
+        Color.white, // -\r
+        Color.white, // *\r
+        Color.white, // .\r
+        Color.white // ' '\r
+    };\r
+\r
+    // Dunno where I got these numbers from\r
+    public static double[] hyd2 = {\r
+        0.62, //A\r
+        0.29, //R\r
+        -0.90, //N\r
+        -0.74, //D\r
+        1.19, //C\r
+        0.48, //Q\r
+        -0.40, //E\r
+        1.38, //G\r
+        -1.50, //H\r
+        1.06, //I\r
+        0.64, //L\r
+        -0.78, //K\r
+        0.12, //M\r
+        -0.85, //F\r
+        -2.53, //P\r
+        -0.18, //S\r
+        -0.05, //T\r
+        1.08, //W\r
+        0.81, //Y\r
+        0.0, //V\r
+        0.26, //B\r
+        0.0, //Z\r
+        0.0 //X\r
+    };\r
+    public static double[] helix = {\r
+        1.42, 0.98, 0.67, 1.01, 0.70, 1.11, 1.51, 0.57, 1.00, 1.08, 1.21, 1.16,\r
+        1.45, 1.13, 0.57, 0.77, 0.83, 1.08, 0.69, 1.06, 0.84, 1.31, 1.00, 0.0\r
+    };\r
+    public static double helixmin = 0.57;\r
+    public static double helixmax = 1.51;\r
+    public static double[] strand = {\r
+        0.83, 0.93, 0.89, 0.54, 1.19, 1.10, 0.37, 0.75, 0.87, 1.60, 1.30, 0.74,\r
+        1.05, 1.38, 0.55, 0.75, 1.19, 1.37, 1.47, 1.70, 0.72, 0.74, 1.0, 0.0\r
+    };\r
+    public static double strandmin = 0.37;\r
+    public static double strandmax = 1.7;\r
+    public static double[] turn = {\r
+        0.66, 0.95, 1.56, 1.46, 1.19, 0.98, 0.74, 1.56, 0.95, 0.47, 0.59, 1.01,\r
+        0.60, 0.60, 1.52, 1.43, 0.96, 0.96, 1.14, 0.50, 1.51, 0.86, 1.00, 0, 0\r
+    };\r
+    public static double turnmin = 0.47;\r
+    public static double turnmax = 1.56;\r
+    public static double[] buried = {\r
+        1.7, 0.1, 0.4, 0.4, 4.6, 0.3, 0.3, 1.8, 0.8, 3.1, 2.4, 0.05, 1.9, 2.2,\r
+        0.6, 0.8, 0.7, 1.6, 0.5, 2.9, 0.4, 0.3, 1.358, 0.00\r
+    };\r
+    public static double buriedmin = 0.05;\r
+    public static double buriedmax = 4.6;\r
+\r
+    // This is hydropathy index\r
+    // Kyte, J., and Doolittle, R.F., J. Mol. Biol.\r
+    // 1157, 105-132, 1982\r
+    public static double[] hyd = {\r
+        1.8, -4.5, -3.5, -3.5, 2.5, -3.5, -3.5, -0.4, -3.2, 4.5, 3.8, -3.9, 1.9,\r
+        2.8, -1.6, -0.8, -0.7, -0.9, -1.3, 4.2, -3.5, -3.5, -0.49, 0.0\r
+    };\r
+    public static final double hydmax = 4.5;\r
+    public static final double hydmin = -3.9;\r
+\r
+    //public static final double hydmax = 1.38;\r
+    //public static final double hydmin = -2.53;\r
+    static final int[][] BLOSUM62 = {\r
+        {\r
+            4, -1, -2, -2, 0, -1, -1, 0, -2, -1, -1, -1, -1, -2, -1, 1, 0, -3,\r
+            -2, 0, -2, -1, 0, -4\r
+        },\r
+        {\r
+            -1, 5, 0, -2, -3, 1, 0, -2, 0, -3, -2, 2, -1, -3, -2, -1, -1, -3, -2,\r
+            -3, -1, 0, -1, -4\r
+        },\r
+        {\r
+            -2, 0, 6, 1, -3, 0, 0, 0, 1, -3, -3, 0, -2, -3, -2, 1, 0, -4, -2, -3,\r
+            3, 0, -1, -4\r
+        },\r
+        {\r
+            -2, -2, 1, 6, -3, 0, 2, -1, -1, -3, -4, -1, -3, -3, -1, 0, -1, -4,\r
+            -3, -3, 4, 1, -1, -4\r
+        },\r
+        {\r
+            0, 3, -3, -3, 9, -3, -4, -3, -3, -1, -1, -3, -1, -2, -3, -1, -1, -2,\r
+            -2, -1, -3, -3, -2, -4\r
+        },\r
+        {\r
+            -1, 1, 0, 0, -3, 5, 2, -2, 0, -3, -2, 1, 0, -3, -1, 0, -1, -2, -1,\r
+            -2, 0, 3, -1, -4\r
+        },\r
+        {\r
+            -1, 0, 0, 2, -4, 2, 5, -2, 0, -3, -3, 1, -2, -3, -1, 0, -1, -3, -2,\r
+            -2, 1, 4, -1, -4\r
+        },\r
+        {\r
+            0, -2, 0, -1, -3, -2, -2, 6, -2, -4, -4, -2, -3, -3, -2, 0, -2, -2,\r
+            -3, -3, -1, -2, -1, -4\r
+        },\r
+        {\r
+            -2, 0, 1, -1, -3, 0, 0, -2, 8, -3, -3, -1, -2, -1, -2, -1, -2, -2, 2,\r
+            -3, 0, 0, -1, -4\r
+        },\r
+        {\r
+            -1, -3, -3, -3, -1, -3, -3, -4, -3, 4, 2, -3, 1, 0, -3, -2, -1, -3,\r
+            -1, 3, -3, -3, -1, -4\r
+        },\r
+        {\r
+            -1, -2, -3, -4, -1, -2, -3, -4, -3, 2, 4, -2, 2, 0, -3, -2, -1, -2,\r
+            -1, 1, -4, -3, -1, -4\r
+        },\r
+        {\r
+            -1, 2, 0, -1, -3, 1, 1, -2, -1, -3, -2, 5, -1, -3, -1, 0, -1, -3, -2,\r
+            -2, 0, 1, -1, -4\r
+        },\r
+        {\r
+            -1, -1, -2, -3, -1, 0, -2, -3, -2, 1, 2, -1, 5, 0, -2, -1, -1, -1,\r
+            -1, 1, -3, -1, -1, -4\r
+        },\r
+        {\r
+            -2, -3, -3, -3, -2, -3, -3, -3, -1, 0, 0, -3, 0, 6, -4, -2, -2, 1, 3,\r
+            -1, -3, -3, -1, -4\r
+        },\r
+        {\r
+            -1, -2, -2, -1, -3, -1, -1, -2, -2, -3, -3, -1, -2, -4, 7, -1, -1,\r
+            -4, -3, -2, -2, -1, -2, -4\r
+        },\r
+        {\r
+            1, -1, 1, 0, -1, 0, 0, 0, -1, -2, -2, 0, -1, -2, -1, 4, 1, -3, -2,\r
+            -2, 0, 0, 0, -4\r
+        },\r
+        {\r
+            0, -1, 0, -1, -1, -1, -1, -2, -2, -1, -1, -1, -1, -2, -1, 1, 5, -2,\r
+            -2, 0, -1, -1, 0, -4\r
+        },\r
+        {\r
+            -3, -3, -4, -4, -2, -2, -3, -2, -2, -3, -2, -3, -1, 1, -4, -3, -2,\r
+            11, 2, -3, -4, -3, -2, -4\r
+        },\r
+        {\r
+            -2, -2, -2, -3, -2, -1, -2, -3, 2, -1, -1, -2, -1, 3, -3, -2, -2, 2,\r
+            7, -1, -3, -2, -1, -4\r
+        },\r
+        {\r
+            0, -3, -3, -3, -1, -2, -2, -3, -3, 3, 1, -2, 1, -1, -2, -2, 0, -3,\r
+            -1, 4, -3, -2, -1, -4\r
+        },\r
+        {\r
+            -2, -1, 3, 4, -3, 0, 1, -1, 0, -3, -4, 0, -3, -3, -2, 0, -1, -4, -3,\r
+            -3, 4, 1, -1, -4\r
+        },\r
+        {\r
+            -1, 0, 0, 1, -3, 3, 4, -2, 0, -3, -3, 1, -1, -3, -1, 0, -1, -3, -2,\r
+            -2, 1, 4, -1, -4\r
+        },\r
+        {\r
+            0, -1, -1, -1, -2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -2, 0, 0, -2,\r
+            -1, -1, -1, -1, -1, -4\r
+        },\r
+        {\r
+            -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4, -4,\r
+            -4, -4, -4, -4, -4, -4, 1\r
+        },\r
+    };\r
+    static final int[][] PAM250 = {\r
+        {\r
+            2, -2, 0, 0, -2, 0, 0, 1, -1, -1, -2, -1, -1, -3, 1, 1, 1, -6, -3, 0,\r
+            0, 0, 0, -8\r
+        },\r
+        {\r
+            -2, 6, 0, -1, -4, 1, -1, -3, 2, -2, -3, 3, 0, -4, 0, 0, -1, 2, -4,\r
+            -2, -1, 0, -1, -8\r
+        },\r
+        {\r
+            0, 0, 2, 2, -4, 1, 1, 0, 2, -2, -3, 1, -2, -3, 0, 1, 0, -4, -2, -2,\r
+            2, 1, 0, -8\r
+        },\r
+        {\r
+            0, -1, 2, 4, -5, 2, 3, 1, 1, -2, -4, 0, -3, -6, -1, 0, 0, -7, -4, -2,\r
+            3, 3, -1, -8\r
+        },\r
+        {\r
+            -2, -4, -4, -5, 12, -5, -5, -3, -3, -2, -6, -5, -5, -4, -3, 0, -2,\r
+            -8, 0, -2, -4, -5, -3, -8\r
+        },\r
+        {\r
+            0, 1, 1, 2, -5, 4, 2, -1, 3, -2, -2, 1, -1, -5, 0, -1, -1, -5, -4,\r
+            -2, 1, 3, -1, -8\r
+        },\r
+        {\r
+            0, -1, 1, 3, -5, 2, 4, 0, 1, -2, -3, 0, -2, -5, -1, 0, 0, -7, -4, -2,\r
+            3, 3, -1, -8\r
+        },\r
+        {\r
+            1, -3, 0, 1, -3, -1, 0, 5, -2, -3, -4, -2, -3, -5, 0, 1, 0, -7, -5,\r
+            -1, 0, 0, -1, -8\r
+        },\r
+        {\r
+            -1, 2, 2, 1, -3, 3, 1, -2, 6, -2, -2, 0, -2, -2, 0, -1, -1, -3, 0,\r
+            -2, 1, 2, -1, -8\r
+        },\r
+        {\r
+            -1, -2, -2, -2, -2, -2, -2, -3, -2, 5, 2, -2, 2, 1, -2, -1, 0, -5,\r
+            -1, 4, -2, -2, -1, -8\r
+        },\r
+        {\r
+            -2, -3, -3, -4, -6, -2, -3, -4, -2, 2, 6, -3, 4, 2, -3, -3, -2, -2,\r
+            -1, 2, -3, -3, -1, -8\r
+        },\r
+        {\r
+            -1, 3, 1, 0, -5, 1, 0, -2, 0, -2, -3, 5, 0, -5, -1, 0, 0, -3, -4, -2,\r
+            1, 0, -1, -8\r
+        },\r
+        {\r
+            -1, 0, -2, -3, -5, -1, -2, -3, -2, 2, 4, 0, 6, 0, -2, -2, -1, -4, -2,\r
+            2, -2, -2, -1, -8\r
+        },\r
+        {\r
+            -3, -4, -3, -6, -4, -5, -5, -5, -2, 1, 2, -5, 0, 9, -5, -3, -3, 0, 7,\r
+            -1, -4, -5, -2, -8\r
+        },\r
+        {\r
+            1, 0, 0, -1, -3, 0, -1, 0, 0, -2, -3, -1, -2, -5, 6, 1, 0, -6, -5,\r
+            -1, -1, 0, -1, -8\r
+        },\r
+        {\r
+            1, 0, 1, 0, 0, -1, 0, 1, -1, -1, -3, 0, -2, -3, 1, 2, 1, -2, -3, -1,\r
+            0, 0, 0, -8\r
+        },\r
+        {\r
+            1, -1, 0, 0, -2, -1, 0, 0, -1, 0, -2, 0, -1, -3, 0, 1, 3, -5, -3, 0,\r
+            0, -1, 0, -8\r
+        },\r
+        {\r
+            -6, 2, -4, -7, -8, -5, -7, -7, -3, -5, -2, -3, -4, 0, -6, -2, -5, 17,\r
+            0, -6, -5, -6, -4, -8\r
+        },\r
+        {\r
+            -3, -4, -2, -4, 0, -4, -4, -5, 0, -1, -1, -4, -2, 7, -5, -3, -3, 0,\r
+            10, -2, -3, -4, -2, -8\r
+        },\r
+        {\r
+            0, -2, -2, -2, -2, -2, -2, -1, -2, 4, 2, -2, 2, -1, -1, -1, 0, -6,\r
+            -2, 4, -2, -2, -1, -8\r
+        },\r
+        {\r
+            0, -1, 2, 3, -4, 1, 3, 0, 1, -2, -3, 1, -2, -4, -1, 0, 0, -5, -3, -2,\r
+            3, 2, -1, -8\r
+        },\r
+        {\r
+            0, 0, 1, 3, -5, 3, 3, 0, 2, -2, -3, 0, -2, -5, 0, 0, -1, -6, -4, -2,\r
+            2, 3, -1, -8\r
+        },\r
+        {\r
+            0, -1, 0, -1, -3, -1, -1, -1, -1, -1, -1, -1, -1, -2, -1, 0, 0, -4,\r
+            -2, -1, -1, -1, -1, -8\r
+        },\r
+        {\r
+            -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -8,\r
+            -8, -8, -8, -8, -8, -8, 1\r
+        },\r
+    };\r
+    public static Hashtable ssHash = new Hashtable(); // stores the number value of the aa\r
+\r
+    static {\r
+        ssHash.put("H", Color.magenta);\r
+        ssHash.put("E", Color.yellow);\r
+        ssHash.put("-", Color.white);\r
+        ssHash.put(".", Color.white);\r
+        ssHash.put("S", Color.cyan);\r
+        ssHash.put("T", Color.blue);\r
+        ssHash.put("G", Color.pink);\r
+        ssHash.put("I", Color.pink);\r
+        ssHash.put("B", Color.yellow);\r
+    }\r
+\r
+    static final int[][] DNA = {\r
+        { 5, -4, -4, -4, 1 }, // C\r
+        { -4, 5, -4, -4, 1 }, // T\r
+        { -4, -4, 5, -4, 1 }, // A\r
+        { -4, -4, -4, 5, 1 }, // G\r
+        { 1, 1, 1, 1, 1 }, // -\r
+    };\r
+    public static Color[] pidColours = {\r
+        midBlue, new Color(153, 153, 255), \r
+        //    Color.lightGray,\r
+        new Color(204, 204, 255),\r
+    };\r
+    public static float[] pidThresholds = { 80, 60, 40, };\r
+    public static Hashtable codonHash = new Hashtable();\r
+    public static Vector Lys = new Vector();\r
+    public static Vector Asn = new Vector();\r
+    public static Vector Gln = new Vector();\r
+    public static Vector His = new Vector();\r
+    public static Vector Glu = new Vector();\r
+    public static Vector Asp = new Vector();\r
+    public static Vector Tyr = new Vector();\r
+    public static Vector Thr = new Vector();\r
+    public static Vector Pro = new Vector();\r
+    public static Vector Ala = new Vector();\r
+    public static Vector Ser = new Vector();\r
+    public static Vector Arg = new Vector();\r
+    public static Vector Gly = new Vector();\r
+    public static Vector Trp = new Vector();\r
+    public static Vector Cys = new Vector();\r
+    public static Vector Ile = new Vector();\r
+    public static Vector Met = new Vector();\r
+    public static Vector Leu = new Vector();\r
+    public static Vector Val = new Vector();\r
+    public static Vector Phe = new Vector();\r
+    public static Vector STOP = new Vector();\r
+\r
+    static {\r
+        codonHash.put("K", Lys);\r
+        codonHash.put("N", Asn);\r
+        codonHash.put("Q", Gln);\r
+        codonHash.put("H", His);\r
+        codonHash.put("E", Glu);\r
+        codonHash.put("D", Asp);\r
+        codonHash.put("Y", Tyr);\r
+        codonHash.put("T", Thr);\r
+        codonHash.put("P", Pro);\r
+        codonHash.put("A", Ala);\r
+        codonHash.put("S", Ser);\r
+        codonHash.put("R", Arg);\r
+        codonHash.put("G", Gly);\r
+        codonHash.put("W", Trp);\r
+        codonHash.put("C", Cys);\r
+        codonHash.put("I", Ile);\r
+        codonHash.put("M", Met);\r
+        codonHash.put("L", Leu);\r
+        codonHash.put("V", Val);\r
+        codonHash.put("F", Phe);\r
+        codonHash.put("STOP", STOP);\r
+    }\r
+\r
+    public static Hashtable codonHash2 = new Hashtable();\r
+\r
+    static {\r
+        codonHash2.put("AAA", "K");\r
+        codonHash2.put("AAG", "K");\r
+        codonHash2.put("AAC", "N");\r
+        codonHash2.put("AAT", "N");\r
+\r
+        codonHash2.put("CAA", "E");\r
+        codonHash2.put("CAG", "E");\r
+        codonHash2.put("CAC", "H");\r
+        codonHash2.put("CAT", "H");\r
+\r
+        codonHash2.put("GAA", "Q");\r
+        codonHash2.put("GAG", "Q");\r
+        codonHash2.put("GAC", "D");\r
+        codonHash2.put("GAT", "D");\r
+\r
+        codonHash2.put("TAC", "Y");\r
+        codonHash2.put("TAT", "Y");\r
+\r
+        codonHash2.put("ACA", "T");\r
+        codonHash2.put("AAG", "T");\r
+        codonHash2.put("ACC", "T");\r
+        codonHash2.put("ACT", "T");\r
+\r
+        codonHash2.put("CCA", "P");\r
+        codonHash2.put("CCG", "P");\r
+        codonHash2.put("CCC", "P");\r
+        codonHash2.put("CCT", "P");\r
+\r
+        codonHash2.put("GCA", "A");\r
+        codonHash2.put("GCG", "A");\r
+        codonHash2.put("GCC", "A");\r
+        codonHash2.put("GCT", "A");\r
+\r
+        codonHash2.put("TCA", "S");\r
+        codonHash2.put("TCG", "S");\r
+        codonHash2.put("TCC", "S");\r
+        codonHash2.put("TCT", "S");\r
+        codonHash2.put("AGC", "S");\r
+        codonHash2.put("AGT", "S");\r
+\r
+        codonHash2.put("AGA", "R");\r
+        codonHash2.put("AGG", "R");\r
+        codonHash2.put("CGA", "R");\r
+        codonHash2.put("CGG", "R");\r
+        codonHash2.put("CGC", "R");\r
+        codonHash2.put("CGT", "R");\r
+\r
+        codonHash2.put("GGA", "G");\r
+        codonHash2.put("GGG", "G");\r
+        codonHash2.put("GGC", "G");\r
+        codonHash2.put("GGT", "G");\r
+\r
+        codonHash2.put("TGA", "*");\r
+        codonHash2.put("TAA", "*");\r
+        codonHash2.put("TAG", "*");\r
+\r
+        codonHash2.put("TGG", "W");\r
+\r
+        codonHash2.put("TGC", "C");\r
+        codonHash2.put("TGT", "C");\r
+\r
+        codonHash2.put("ATA", "I");\r
+        codonHash2.put("ATC", "I");\r
+        codonHash2.put("ATT", "I");\r
+\r
+        codonHash2.put("ATG", "M");\r
+\r
+        codonHash2.put("CTA", "L");\r
+        codonHash2.put("CTG", "L");\r
+        codonHash2.put("CTC", "L");\r
+        codonHash2.put("CTT", "L");\r
+        codonHash2.put("TTA", "L");\r
+        codonHash2.put("TTG", "L");\r
+\r
+        codonHash2.put("GTA", "V");\r
+        codonHash2.put("GTG", "V");\r
+        codonHash2.put("GTC", "V");\r
+        codonHash2.put("GTT", "V");\r
+\r
+        codonHash2.put("TTC", "F");\r
+        codonHash2.put("TTT", "F");\r
+    }\r
+\r
+    static {\r
+        Lys.addElement("AAA");\r
+        Lys.addElement("AAG");\r
+        Asn.addElement("AAC");\r
+        Asn.addElement("AAT");\r
+\r
+        Gln.addElement("CAA");\r
+        Gln.addElement("CAG");\r
+        His.addElement("CAC");\r
+        His.addElement("CAT");\r
+\r
+        Glu.addElement("GAA");\r
+        Glu.addElement("GAG");\r
+        Asp.addElement("GAC");\r
+        Asp.addElement("GAT");\r
+\r
+        Tyr.addElement("TAC");\r
+        Tyr.addElement("TAT");\r
+\r
+        Thr.addElement("ACA");\r
+        Thr.addElement("ACG");\r
+        Thr.addElement("ACC");\r
+        Thr.addElement("ACT");\r
+\r
+        Pro.addElement("CCA");\r
+        Pro.addElement("CCG");\r
+        Pro.addElement("CCC");\r
+        Pro.addElement("CCT");\r
+\r
+        Ala.addElement("GCA");\r
+        Ala.addElement("GCG");\r
+        Ala.addElement("GCC");\r
+        Ala.addElement("GCT");\r
+\r
+        Ser.addElement("TCA");\r
+        Ser.addElement("TCG");\r
+        Ser.addElement("TCC");\r
+        Ser.addElement("TCT");\r
+        Ser.addElement("AGC");\r
+        Ser.addElement("AGT");\r
+\r
+        Arg.addElement("AGA");\r
+        Arg.addElement("AGG");\r
+        Arg.addElement("CGA");\r
+        Arg.addElement("CGG");\r
+        Arg.addElement("CGC");\r
+        Arg.addElement("CGT");\r
+\r
+        Gly.addElement("GGA");\r
+        Gly.addElement("GGG");\r
+        Gly.addElement("GGC");\r
+        Gly.addElement("GGT");\r
+\r
+        STOP.addElement("TGA");\r
+        STOP.addElement("TAA");\r
+        STOP.addElement("TAG");\r
+\r
+        Trp.addElement("TGG");\r
+\r
+        Cys.addElement("TGC");\r
+        Cys.addElement("TGT");\r
+\r
+        Ile.addElement("ATA");\r
+        Ile.addElement("ATC");\r
+        Ile.addElement("ATT");\r
+\r
+        Met.addElement("ATG");\r
+\r
+        Leu.addElement("CTA");\r
+        Leu.addElement("CTG");\r
+        Leu.addElement("CTC");\r
+        Leu.addElement("CTT");\r
+        Leu.addElement("TTA");\r
+        Leu.addElement("TTG");\r
+\r
+        Val.addElement("GTA");\r
+        Val.addElement("GTG");\r
+        Val.addElement("GTC");\r
+        Val.addElement("GTT");\r
+\r
+        Phe.addElement("TTC");\r
+        Phe.addElement("TTT");\r
+    }\r
+\r
+    public static Color[][] groupColors = {\r
+        { Color.red, Color.red.brighter(), Color.red.brighter().brighter() },\r
+        {\r
+            Color.orange, Color.orange.brighter(),\r
+            Color.orange.brighter().brighter()\r
+        },\r
+        { Color.green, Color.green.brighter(), Color.green.brighter().brighter() },\r
+        { Color.blue, Color.blue.brighter(), Color.blue.brighter().brighter() },\r
+        {\r
+            Color.magenta, Color.magenta.brighter(),\r
+            Color.magenta.brighter().brighter()\r
+        },\r
+        { Color.cyan, Color.cyan.brighter(), Color.cyan.brighter().brighter() },\r
+        { Color.pink, Color.pink.brighter(), Color.pink.brighter().brighter() },\r
+    };\r
+\r
+    //Stores residue codes/names and colours and other things\r
+    public static Hashtable propHash = new Hashtable();\r
+    public static Hashtable hydrophobic = new Hashtable();\r
+    public static Hashtable polar = new Hashtable();\r
+    public static Hashtable small = new Hashtable();\r
+    public static Hashtable positive = new Hashtable();\r
+    public static Hashtable negative = new Hashtable();\r
+    public static Hashtable charged = new Hashtable();\r
+    public static Hashtable aromatic = new Hashtable();\r
+    public static Hashtable aliphatic = new Hashtable();\r
+    public static Hashtable tiny = new Hashtable();\r
+    public static Hashtable proline = new Hashtable();\r
+\r
+    static {\r
+        hydrophobic.put("I", new Integer(1));\r
+        hydrophobic.put("L", new Integer(1));\r
+        hydrophobic.put("V", new Integer(1));\r
+        hydrophobic.put("C", new Integer(1));\r
+        hydrophobic.put("A", new Integer(1));\r
+        hydrophobic.put("G", new Integer(1));\r
+        hydrophobic.put("M", new Integer(1));\r
+        hydrophobic.put("F", new Integer(1));\r
+        hydrophobic.put("Y", new Integer(1));\r
+        hydrophobic.put("W", new Integer(1));\r
+        hydrophobic.put("H", new Integer(1));\r
+        hydrophobic.put("K", new Integer(1));\r
+        hydrophobic.put("X", new Integer(1));\r
+        hydrophobic.put("-", new Integer(1));\r
+        hydrophobic.put("*", new Integer(1));\r
+        hydrophobic.put("R", new Integer(0));\r
+        hydrophobic.put("E", new Integer(0));\r
+        hydrophobic.put("Q", new Integer(0));\r
+        hydrophobic.put("D", new Integer(0));\r
+        hydrophobic.put("N", new Integer(0));\r
+        hydrophobic.put("S", new Integer(0));\r
+        hydrophobic.put("T", new Integer(0));\r
+        hydrophobic.put("P", new Integer(0));\r
+    }\r
+\r
+    static {\r
+        polar.put("Y", new Integer(1));\r
+        polar.put("W", new Integer(1));\r
+        polar.put("H", new Integer(1));\r
+        polar.put("K", new Integer(1));\r
+        polar.put("R", new Integer(1));\r
+        polar.put("E", new Integer(1));\r
+        polar.put("Q", new Integer(1));\r
+        polar.put("D", new Integer(1));\r
+        polar.put("N", new Integer(1));\r
+        polar.put("S", new Integer(1));\r
+        polar.put("T", new Integer(1));\r
+        polar.put("X", new Integer(1));\r
+        polar.put("-", new Integer(1));\r
+        polar.put("*", new Integer(1));\r
+        polar.put("I", new Integer(0));\r
+        polar.put("L", new Integer(0));\r
+        polar.put("V", new Integer(0));\r
+        polar.put("C", new Integer(0));\r
+        polar.put("A", new Integer(0));\r
+        polar.put("G", new Integer(0));\r
+        polar.put("M", new Integer(0));\r
+        polar.put("F", new Integer(0));\r
+        polar.put("P", new Integer(0));\r
+    }\r
+\r
+    static {\r
+        small.put("I", new Integer(0));\r
+        small.put("L", new Integer(0));\r
+        small.put("V", new Integer(1));\r
+        small.put("C", new Integer(1));\r
+        small.put("A", new Integer(1));\r
+        small.put("G", new Integer(1));\r
+        small.put("M", new Integer(0));\r
+        small.put("F", new Integer(0));\r
+        small.put("Y", new Integer(0));\r
+        small.put("W", new Integer(0));\r
+        small.put("H", new Integer(0));\r
+        small.put("K", new Integer(0));\r
+        small.put("R", new Integer(0));\r
+        small.put("E", new Integer(0));\r
+        small.put("Q", new Integer(0));\r
+        small.put("D", new Integer(1));\r
+        small.put("N", new Integer(1));\r
+        small.put("S", new Integer(1));\r
+        small.put("T", new Integer(1));\r
+        small.put("P", new Integer(1));\r
+        small.put("-", new Integer(1));\r
+        small.put("*", new Integer(1));\r
+    }\r
+\r
+    static {\r
+        positive.put("I", new Integer(0));\r
+        positive.put("L", new Integer(0));\r
+        positive.put("V", new Integer(0));\r
+        positive.put("C", new Integer(0));\r
+        positive.put("A", new Integer(0));\r
+        positive.put("G", new Integer(0));\r
+        positive.put("M", new Integer(0));\r
+        positive.put("F", new Integer(0));\r
+        positive.put("Y", new Integer(0));\r
+        positive.put("W", new Integer(0));\r
+        positive.put("H", new Integer(1));\r
+        positive.put("K", new Integer(1));\r
+        positive.put("R", new Integer(1));\r
+        positive.put("E", new Integer(0));\r
+        positive.put("Q", new Integer(0));\r
+        positive.put("D", new Integer(0));\r
+        positive.put("N", new Integer(0));\r
+        positive.put("S", new Integer(0));\r
+        positive.put("T", new Integer(0));\r
+        positive.put("P", new Integer(0));\r
+        positive.put("-", new Integer(1));\r
+        positive.put("*", new Integer(1));\r
+    }\r
+\r
+    static {\r
+        negative.put("I", new Integer(0));\r
+        negative.put("L", new Integer(0));\r
+        negative.put("V", new Integer(0));\r
+        negative.put("C", new Integer(0));\r
+        negative.put("A", new Integer(0));\r
+        negative.put("G", new Integer(0));\r
+        negative.put("M", new Integer(0));\r
+        negative.put("F", new Integer(0));\r
+        negative.put("Y", new Integer(0));\r
+        negative.put("W", new Integer(0));\r
+        negative.put("H", new Integer(0));\r
+        negative.put("K", new Integer(0));\r
+        negative.put("R", new Integer(0));\r
+        negative.put("E", new Integer(1));\r
+        negative.put("Q", new Integer(0));\r
+        negative.put("D", new Integer(1));\r
+        negative.put("N", new Integer(0));\r
+        negative.put("S", new Integer(0));\r
+        negative.put("T", new Integer(0));\r
+        negative.put("P", new Integer(0));\r
+        negative.put("-", new Integer(1));\r
+        negative.put("*", new Integer(1));\r
+    }\r
+\r
+    static {\r
+        charged.put("I", new Integer(0));\r
+        charged.put("L", new Integer(0));\r
+        charged.put("V", new Integer(0));\r
+        charged.put("C", new Integer(0));\r
+        charged.put("A", new Integer(0));\r
+        charged.put("G", new Integer(0));\r
+        charged.put("M", new Integer(0));\r
+        charged.put("F", new Integer(0));\r
+        charged.put("Y", new Integer(0));\r
+        charged.put("W", new Integer(0));\r
+        charged.put("H", new Integer(1));\r
+        charged.put("K", new Integer(1));\r
+        charged.put("R", new Integer(1));\r
+        charged.put("E", new Integer(1));\r
+        charged.put("Q", new Integer(0));\r
+        charged.put("D", new Integer(1));\r
+        charged.put("N", new Integer(1));\r
+        charged.put("S", new Integer(0));\r
+        charged.put("T", new Integer(0));\r
+        charged.put("P", new Integer(0));\r
+        charged.put("-", new Integer(1));\r
+        charged.put("*", new Integer(1));\r
+    }\r
+\r
+    static {\r
+        aromatic.put("I", new Integer(0));\r
+        aromatic.put("L", new Integer(0));\r
+        aromatic.put("V", new Integer(0));\r
+        aromatic.put("C", new Integer(0));\r
+        aromatic.put("A", new Integer(0));\r
+        aromatic.put("G", new Integer(0));\r
+        aromatic.put("M", new Integer(0));\r
+        aromatic.put("F", new Integer(1));\r
+        aromatic.put("Y", new Integer(1));\r
+        aromatic.put("W", new Integer(1));\r
+        aromatic.put("H", new Integer(1));\r
+        aromatic.put("K", new Integer(0));\r
+        aromatic.put("R", new Integer(0));\r
+        aromatic.put("E", new Integer(0));\r
+        aromatic.put("Q", new Integer(0));\r
+        aromatic.put("D", new Integer(0));\r
+        aromatic.put("N", new Integer(0));\r
+        aromatic.put("S", new Integer(0));\r
+        aromatic.put("T", new Integer(0));\r
+        aromatic.put("P", new Integer(0));\r
+        aromatic.put("-", new Integer(1));\r
+        aromatic.put("*", new Integer(1));\r
+    }\r
+\r
+    static {\r
+        aliphatic.put("I", new Integer(1));\r
+        aliphatic.put("L", new Integer(1));\r
+        aliphatic.put("V", new Integer(1));\r
+        aliphatic.put("C", new Integer(0));\r
+        aliphatic.put("A", new Integer(0));\r
+        aliphatic.put("G", new Integer(0));\r
+        aliphatic.put("M", new Integer(0));\r
+        aliphatic.put("F", new Integer(0));\r
+        aliphatic.put("Y", new Integer(0));\r
+        aliphatic.put("W", new Integer(0));\r
+        aliphatic.put("H", new Integer(0));\r
+        aliphatic.put("K", new Integer(0));\r
+        aliphatic.put("R", new Integer(0));\r
+        aliphatic.put("E", new Integer(0));\r
+        aliphatic.put("Q", new Integer(0));\r
+        aliphatic.put("D", new Integer(0));\r
+        aliphatic.put("N", new Integer(0));\r
+        aliphatic.put("S", new Integer(0));\r
+        aliphatic.put("T", new Integer(0));\r
+        aliphatic.put("P", new Integer(0));\r
+        aliphatic.put("-", new Integer(1));\r
+        aliphatic.put("*", new Integer(1));\r
+    }\r
 \r
-  //Stores residue codes/names and colours and other things\r
-  public static Hashtable aaHash = new Hashtable();  // stores the number value of the aa\r
-  public static Hashtable aa3Hash = new Hashtable();\r
-  public static Hashtable aa2Triplet = new Hashtable();\r
-  public static Hashtable nucleotideHash = new Hashtable();\r
-\r
-  static {\r
-    aaHash.put("A", new Integer(0));\r
-    aaHash.put("R", new Integer(1));\r
-    aaHash.put("N", new Integer(2));\r
-    aaHash.put("D", new Integer(3));\r
-    aaHash.put("C", new Integer(4));\r
-    aaHash.put("Q", new Integer(5));\r
-    aaHash.put("E", new Integer(6));\r
-    aaHash.put("G", new Integer(7));\r
-    aaHash.put("H", new Integer(8));\r
-    aaHash.put("I", new Integer(9));\r
-    aaHash.put("L", new Integer(10));\r
-    aaHash.put("K", new Integer(11));\r
-    aaHash.put("M", new Integer(12));\r
-    aaHash.put("F", new Integer(13));\r
-    aaHash.put("P", new Integer(14));\r
-    aaHash.put("S", new Integer(15));\r
-    aaHash.put("T", new Integer(16));\r
-    aaHash.put("W", new Integer(17));\r
-    aaHash.put("Y", new Integer(18));\r
-    aaHash.put("V", new Integer(19));\r
-    aaHash.put("B", new Integer(20));\r
-    aaHash.put("Z", new Integer(21));\r
-    aaHash.put("X", new Integer(22));\r
-    aaHash.put("a", new Integer(0));\r
-    aaHash.put("r", new Integer(1));\r
-    aaHash.put("n", new Integer(2));\r
-    aaHash.put("d", new Integer(3));\r
-    aaHash.put("c", new Integer(4));\r
-    aaHash.put("q", new Integer(5));\r
-    aaHash.put("e", new Integer(6));\r
-    aaHash.put("g", new Integer(7));\r
-    aaHash.put("h", new Integer(8));\r
-    aaHash.put("i", new Integer(9));\r
-    aaHash.put("l", new Integer(10));\r
-    aaHash.put("k", new Integer(11));\r
-    aaHash.put("m", new Integer(12));\r
-    aaHash.put("f", new Integer(13));\r
-    aaHash.put("p", new Integer(14));\r
-    aaHash.put("s", new Integer(15));\r
-    aaHash.put("t", new Integer(16));\r
-    aaHash.put("w", new Integer(17));\r
-    aaHash.put("y", new Integer(18));\r
-    aaHash.put("v", new Integer(19));\r
-    aaHash.put("b", new Integer(20));\r
-    aaHash.put("z", new Integer(21));\r
-    aaHash.put("x", new Integer(22));\r
-    aaHash.put("-", new Integer(23));\r
-    aaHash.put("*", new Integer(23));\r
-    aaHash.put(".", new Integer(23));\r
-    aaHash.put(" ", new Integer(23));\r
-  }\r
-\r
-  static {\r
-    nucleotideHash.put("A", new Integer(0));\r
-    nucleotideHash.put("C", new Integer(1));\r
-    nucleotideHash.put("G", new Integer(2));\r
-    nucleotideHash.put("T", new Integer(3));\r
-    nucleotideHash.put("U", new Integer(4));\r
-  }\r
-\r
-  // These numbers should correspond to the indices in the Color hashes\r
-  public static Hashtable aaSpecialsHash = new Hashtable();\r
-  static {\r
-    aaSpecialsHash.put("-", new Integer(23));\r
-    aaSpecialsHash.put("*", new Integer(24));\r
-    aaSpecialsHash.put(".", new Integer(25));\r
-    aaSpecialsHash.put(" ", new Integer(26));\r
-  }\r
-\r
-  static {\r
-    aa3Hash.put("ALA", new Integer(0));\r
-    aa3Hash.put("ARG", new Integer(1));\r
-    aa3Hash.put("ASN", new Integer(2));\r
-    aa3Hash.put("ASP", new Integer(3)); //D\r
-    aa3Hash.put("CYS", new Integer(4));\r
-    aa3Hash.put("GLN", new Integer(5)); //Q\r
-    aa3Hash.put("GLU", new Integer(6));   // E\r
-    aa3Hash.put("GLY", new Integer(7));\r
-    aa3Hash.put("HIS", new Integer(8));\r
-    aa3Hash.put("ILE", new Integer(9));\r
-    aa3Hash.put("LEU", new Integer(10));\r
-    aa3Hash.put("LYS", new Integer(11));\r
-    aa3Hash.put("MET", new Integer(12));\r
-    aa3Hash.put("PHE", new Integer(13));\r
-    aa3Hash.put("PRO", new Integer(14));\r
-    aa3Hash.put("SER", new Integer(15));\r
-    aa3Hash.put("THR", new Integer(16));\r
-    aa3Hash.put("TRP", new Integer(17));\r
-    aa3Hash.put("TYR", new Integer(18));\r
-    aa3Hash.put("VAL", new Integer(19));\r
-    aa3Hash.put("B", new Integer(20));\r
-    aa3Hash.put("Z", new Integer(21));\r
-    aa3Hash.put("X", new Integer(22));\r
-    aa3Hash.put("-", new Integer(23));\r
-    aa3Hash.put("*", new Integer(23));\r
-    aa3Hash.put(".", new Integer(23));\r
-    aa3Hash.put(" ", new Integer(23));\r
-  }\r
-\r
-  static{\r
-     aa2Triplet.put("A", "ALA");\r
-     aa2Triplet.put("R", "ARG");\r
-     aa2Triplet.put("N", "ASN");\r
-     aa2Triplet.put("D", "ASP");\r
-     aa2Triplet.put("C", "CYS");\r
-     aa2Triplet.put("Q", "GLN");\r
-     aa2Triplet.put("E", "GLU");\r
-     aa2Triplet.put("G", "GLY");\r
-     aa2Triplet.put("H", "HIS");\r
-     aa2Triplet.put("I", "ILE");\r
-     aa2Triplet.put("L", "LEU");\r
-     aa2Triplet.put("K", "LYS");\r
-     aa2Triplet.put("M", "MET");\r
-     aa2Triplet.put("F", "PHE");\r
-     aa2Triplet.put("P", "PRO");\r
-     aa2Triplet.put("S", "SER");\r
-     aa2Triplet.put("T", "THR");\r
-     aa2Triplet.put("W", "TRP");\r
-     aa2Triplet.put("Y", "TYR");\r
-     aa2Triplet.put("V", "VAL");\r
-  }\r
-\r
-  public static String aa[] = {\r
-    "A","R","N","D","C","Q","E","G","H","I","L","K","M","F","P","S","T","W","Y","V","B","Z","X","_","*","."," "\r
-  };\r
-  public static Color midBlue = new Color(100,100,255);\r
-  public static Vector scaleColours = new Vector();\r
-  static {\r
-    scaleColours.addElement(new Color(114,0,147));\r
-    scaleColours.addElement(new Color(156,0,98));\r
-    scaleColours.addElement(new Color(190,0,0));\r
-    scaleColours.addElement(Color.red);\r
-    scaleColours.addElement(new Color(255,125,0));\r
-    scaleColours.addElement(Color.orange);\r
-    scaleColours.addElement(new Color(255,194,85));\r
-    scaleColours.addElement(Color.yellow);\r
-    scaleColours.addElement(new Color(255,255,181));\r
-    scaleColours.addElement(Color.white);\r
-  }\r
-\r
-  public static Color[] taylor = {\r
-    new Color(204,255,0),          // A  Greenish-yellowy-yellow\r
-    new Color(0,0,255),            // R  Blueish-bluey-blue\r
-    new Color(204,0,255),          // N  Blueish-reddy-blue\r
-    new Color(255,0,0),            // D  Reddish-reddy-red\r
-    new Color(255,255,0),          // C  Yellowish-yellowy-yellow\r
-    new Color(255,0,204),          // Q  Reddish-bluey-red\r
-    new Color(255,0,102),          // E  Blueish-reddy-red\r
-    new Color(255,153,0),          // G  Yellowy-reddy-yellow\r
-    new Color(0,102,255),          // H  Greenish-bluey-blue\r
-    new Color(102,255,0),          // I  Greenish-yellowy-green\r
-    new Color(51,255,0),           // L  Yellowish-greeny-green\r
-    new Color(102,0,255),          // K  Reddish-bluey-blue\r
-    new Color(0,255,0),            // M  Greenish-greeny-green\r
-    new Color(0,255,102),          // F  Blueish-greeny-green\r
-    new Color(255,204,0),          // P  Reddish-yellowy-yellow\r
-    new Color(255,51,0),           // S  Yellowish-reddy-red\r
-    new Color(255,102,0),          // T  Reddish-yellowy-red\r
-    new Color(0,204,255),          // W  Blueish-greeny-green\r
-    new Color(0,255,204),          // Y  Greenish-bluey-green\r
-    new Color(153,255,0),          // V  Yellowish-greeny-yellow\r
-    Color.white,         // B\r
-    Color.white,         // Z\r
-    Color.white,         // X\r
-    Color.white,         // -\r
-    Color.white,         // *\r
-    Color.white          // .\r
-  };\r
-\r
-  public static Color[] nucleotide = {\r
-      new Color(100,247,63),          // A\r
-      new Color(255,179,64),          // C\r
-      new Color(235,65,60),           // G\r
-      new Color(60,136,238),          // T\r
-      new Color(60,136,238)           // U\r
-  };\r
-\r
-  public static Color[] color = {\r
-    Color.pink,          // A\r
-    midBlue,             // R\r
-    Color.green,         // N\r
-    Color.red,           // D\r
-    Color.yellow,        // C\r
-    Color.green,         // Q\r
-    Color.red,           // E\r
-    Color.magenta,       // G\r
-    Color.red,           // H\r
-    Color.pink,          // I\r
-    Color.pink,          // L\r
-    midBlue,             // K\r
-    Color.pink,          // M\r
-    Color.orange,        // F\r
-    Color.magenta,       // P\r
-    Color.green,         // S\r
-    Color.green,         // T\r
-    Color.orange,        // W\r
-    Color.orange,        // Y\r
-    Color.pink,          // V\r
-    Color.white,         // B\r
-    Color.white,         // Z\r
-    Color.white,         // X\r
-    Color.white,         // -\r
-    Color.white,         // *\r
-    Color.white,          // .\r
-    Color.white          // ' '\r
-  };\r
-\r
-  // Dunno where I got these numbers from\r
-  public static double[] hyd2 = {\r
-    0.62,  //A\r
-    0.29,  //R\r
-    -0.90,  //N\r
-    -0.74,  //D\r
-    1.19,  //C\r
-    0.48,  //Q\r
-    -0.40, //E\r
-    1.38,  //G\r
-    -1.50, //H\r
-    1.06,  //I\r
-    0.64,  //L\r
-    -0.78, //K\r
-    0.12,  //M\r
-    -0.85, //F\r
-    -2.53, //P\r
-    -0.18, //S\r
-    -0.05, //T\r
-    1.08,  //W\r
-    0.81,  //Y\r
-    0.0,   //V\r
-    0.26,  //B\r
-    0.0,   //Z\r
-    0.0   //X\r
-  };\r
-  public static double[] helix = {\r
-    1.42,\r
-    0.98,\r
-    0.67,\r
-    1.01,\r
-    0.70,\r
-    1.11,\r
-    1.51,\r
-    0.57,\r
-    1.00,\r
-    1.08,\r
-    1.21,\r
-    1.16,\r
-    1.45,\r
-    1.13,\r
-    0.57,\r
-    0.77,\r
-    0.83,\r
-    1.08,\r
-    0.69,\r
-    1.06,\r
-    0.84,\r
-    1.31,\r
-    1.00,\r
-    0.0\r
-  };\r
-  public static double helixmin = 0.57;\r
-  public static double helixmax = 1.51;\r
-\r
-  public static double[] strand = {\r
-    0.83,0.93,0.89,0.54,1.19,1.10,0.37,\r
-    0.75,0.87,1.60,1.30,0.74,1.05,1.38,0.55,\r
-    0.75,1.19,1.37,1.47,1.70,0.72,0.74,1.0,0.0};\r
-\r
-  public static double strandmin = 0.37;\r
-  public static double strandmax = 1.7;\r
-\r
-  public static double[] turn = {\r
-    0.66,0.95,1.56,1.46,1.19,0.98,0.74,\r
-    1.56,0.95,0.47,0.59,1.01,0.60,0.60,1.52,\r
-    1.43,0.96,0.96,1.14,0.50,1.51,0.86,1.00,0,0};\r
-\r
-  public static double turnmin = 0.47;\r
-  public static double turnmax = 1.56;\r
-\r
-  public static double[] buried = {\r
-    1.7,\r
-    0.1,\r
-    0.4,\r
-    0.4,\r
-    4.6,\r
-    0.3,\r
-    0.3,\r
-    1.8,\r
-    0.8,\r
-    3.1,\r
-    2.4,\r
-    0.05,\r
-    1.9,\r
-    2.2,\r
-    0.6,\r
-    0.8,0.7,1.6,0.5,2.9,0.4,0.3,\r
-    1.358,\r
-    0.00\r
-  };\r
-\r
-  public static double buriedmin = 0.05;\r
-  public static double buriedmax = 4.6;\r
-\r
-  // This is hydropathy index\r
-  // Kyte, J., and Doolittle, R.F., J. Mol. Biol.\r
-  // 1157, 105-132, 1982\r
-\r
-  public static double hyd[] = {\r
-    1.8,\r
-    -4.5,\r
-    -3.5,\r
-    -3.5,\r
-    2.5,\r
-    -3.5,\r
-    -3.5,\r
-    -0.4,\r
-    -3.2,\r
-    4.5,\r
-    3.8,\r
-    -3.9,\r
-    1.9,\r
-    2.8,\r
-    -1.6,\r
-    -0.8,\r
-    -0.7,\r
-    -0.9,\r
-    -1.3,\r
-    4.2,\r
-    -3.5,\r
-    -3.5,\r
-    -0.49,\r
-    0.0\r
-  };\r
-\r
-  public static final double hydmax = 4.5;\r
-  public static final double hydmin = -3.9;\r
-\r
-  public static double getHydmax() {\r
-    return hydmax;\r
-  }\r
-  public static double getHydmin() {\r
-    return hydmin;\r
-  }\r
-  public static double[] getHyd() {\r
-    return hyd;\r
-  }\r
-  //public static final double hydmax = 1.38;\r
-  //public static final double hydmin = -2.53;\r
-\r
-  static final int[][] BLOSUM62 = {\r
-    //A   R   N   D   C   Q   E   G   H   I   L   K   M   F   P   S   T   W   Y   V   B   Z   X  -\r
-    { 4 ,-1, -2 ,-2 , 0 ,-1 ,-1 , 0 ,-2 ,-1 ,-1 ,-1 ,-1 ,-2 ,-1 , 1 , 0 ,-3 ,-2 , 0 ,-2, -1 , 0 ,-4},\r
-    {-1 , 5 , 0 ,-2 ,-3 , 1 , 0 ,-2 , 0 ,-3 ,-2 , 2 ,-1 ,-3 ,-2 ,-1 ,-1 ,-3 ,-2 ,-3 ,-1 , 0 ,-1 ,-4 },\r
-    {-2 , 0 , 6 , 1 ,-3 , 0 , 0 , 0 , 1 ,-3 ,-3 , 0 ,-2 ,-3 ,-2 , 1 , 0 ,-4 ,-2 ,-3 , 3 , 0 ,-1 ,-4 },\r
-    {-2 ,-2 , 1 , 6 ,-3 , 0 , 2 ,-1 ,-1 ,-3 ,-4 ,-1 ,-3 ,-3 ,-1 , 0 ,-1 ,-4 ,-3 ,-3 , 4 , 1 ,-1 ,-4 },\r
-    { 0 , 3 ,-3 ,-3 , 9 ,-3 ,-4 ,-3 ,-3 ,-1 ,-1 ,-3 ,-1 ,-2 ,-3 ,-1 ,-1 ,-2 ,-2 ,-1 ,-3 ,-3 ,-2 ,-4 },\r
-    {-1 , 1 , 0 , 0 ,-3 , 5 , 2 ,-2 , 0 ,-3 ,-2 , 1 , 0 ,-3 ,-1 , 0 ,-1 ,-2 ,-1 ,-2 , 0 , 3 ,-1 ,-4 },\r
-    {-1 , 0 , 0 , 2 ,-4 , 2 , 5 ,-2 , 0 ,-3 ,-3 , 1 ,-2 ,-3 ,-1 , 0 ,-1 ,-3 ,-2 ,-2 , 1 , 4 ,-1 ,-4 },\r
-    { 0 ,-2 , 0 ,-1 ,-3 ,-2 ,-2 , 6 ,-2 ,-4 ,-4 ,-2 ,-3 ,-3 ,-2 , 0 ,-2 ,-2 ,-3 ,-3 ,-1 ,-2 ,-1 ,-4 },\r
-    {-2 , 0 , 1 ,-1 ,-3 , 0 , 0 ,-2 , 8 ,-3 ,-3 ,-1 ,-2 ,-1 ,-2 ,-1 ,-2 ,-2 , 2 ,-3 , 0 , 0 ,-1 ,-4 },\r
-    {-1 ,-3 ,-3 ,-3 ,-1 ,-3 ,-3 ,-4 ,-3 , 4 , 2 ,-3 , 1 , 0 ,-3 ,-2 ,-1 ,-3 ,-1 , 3 ,-3 ,-3 ,-1 ,-4 },\r
-    {-1 ,-2 ,-3 ,-4 ,-1 ,-2 ,-3 ,-4 ,-3 , 2 , 4 ,-2 , 2 , 0 ,-3 ,-2 ,-1 ,-2 ,-1 , 1 ,-4 ,-3 ,-1 ,-4 },\r
-    {-1 , 2 , 0 ,-1 ,-3 , 1 , 1 ,-2 ,-1 ,-3 ,-2 , 5 ,-1 ,-3 ,-1 , 0 ,-1 ,-3 ,-2 ,-2 , 0 , 1 ,-1 ,-4 },\r
-    {-1 ,-1 ,-2 ,-3 ,-1 , 0 ,-2 ,-3 ,-2 , 1 , 2 ,-1 , 5 , 0 ,-2 ,-1 ,-1 ,-1 ,-1 , 1 ,-3 ,-1 ,-1 ,-4 },\r
-    {-2 ,-3 ,-3 ,-3 ,-2 ,-3 ,-3 ,-3 ,-1 , 0 , 0 ,-3 , 0 , 6 ,-4 ,-2 ,-2 , 1 , 3 ,-1 ,-3 ,-3 ,-1 ,-4 },\r
-    {-1 ,-2 ,-2 ,-1 ,-3 ,-1 ,-1 ,-2 ,-2 ,-3 ,-3 ,-1 ,-2 ,-4 , 7 ,-1 ,-1 ,-4 ,-3 ,-2 ,-2 ,-1 ,-2 ,-4 },\r
-    { 1 ,-1 , 1 , 0 ,-1 , 0 , 0 , 0 ,-1 ,-2 ,-2 , 0 ,-1 ,-2 ,-1 , 4 , 1 ,-3 ,-2 ,-2 , 0 , 0 , 0 ,-4 },\r
-    { 0 ,-1 , 0 ,-1 ,-1 ,-1 ,-1 ,-2 ,-2 ,-1 ,-1 ,-1 ,-1 ,-2 ,-1 , 1 , 5 ,-2 ,-2 , 0 ,-1 ,-1 , 0 ,-4 },\r
-    {-3 ,-3 ,-4 ,-4 ,-2 ,-2 ,-3 ,-2 ,-2 ,-3 ,-2 ,-3 ,-1 , 1 ,-4 ,-3 ,-2 ,11 , 2 ,-3 ,-4 ,-3 ,-2 ,-4 },\r
-    {-2 ,-2 ,-2 ,-3 ,-2 ,-1 ,-2 ,-3 , 2 ,-1 ,-1 ,-2 ,-1 , 3 ,-3 ,-2 ,-2 , 2 , 7 ,-1 ,-3 ,-2 ,-1 ,-4 },\r
-    { 0 ,-3 ,-3 ,-3 ,-1 ,-2 ,-2 ,-3 ,-3 , 3 , 1 ,-2 , 1 ,-1 ,-2 ,-2 , 0 ,-3 ,-1 , 4 ,-3 ,-2 ,-1 ,-4 },\r
-    {-2 ,-1 , 3 , 4 ,-3 , 0 , 1 ,-1 , 0 ,-3 ,-4 , 0 ,-3 ,-3 ,-2 , 0 ,-1 ,-4 ,-3 ,-3 , 4 , 1 ,-1 ,-4 },\r
-    {-1 , 0 , 0 , 1 ,-3 , 3 , 4 ,-2 , 0 ,-3 ,-3 , 1 ,-1 ,-3 ,-1 , 0 ,-1 ,-3 ,-2 ,-2 , 1 , 4 ,-1 ,-4 },\r
-    { 0 ,-1 ,-1 ,-1 ,-2 ,-1 ,-1 ,-1 ,-1 ,-1 ,-1 ,-1 ,-1 ,-1 ,-2 , 0 , 0 ,-2 ,-1 ,-1 ,-1 ,-1 ,-1 ,-4 },\r
-    {-4 ,-4 ,-4 ,-4 ,-4 ,-4 ,-4 ,-4 ,-4 ,-4 ,-4 ,-4 ,-4 ,-4 ,-4 ,-4 ,-4 ,-4 ,-4 ,-4 ,-4 ,-4 ,-4 , 1 },\r
-  };\r
-  static final int[][] PAM250 = {\r
-    {  2,-2 ,0 ,0,-2 ,0 ,0 ,1,-1,-1,-2,-1,-1,-3 ,1 ,1 ,1,-6,-3 ,0 ,0 ,0 ,0,-8},\r
-    { -2 ,6 ,0,-1,-4 ,1,-1,-3 ,2,-2,-3 ,3 ,0,-4 ,0 ,0,-1 ,2,-4,-2,-1 ,0,-1,-8},\r
-    {  0 ,0 ,2 ,2,-4 ,1 ,1 ,0 ,2,-2,-3 ,1,-2,-3 ,0 ,1 ,0,-4,-2,-2 ,2 ,1 ,0,-8},\r
-    {  0,-1 ,2 ,4,-5 ,2 ,3 ,1 ,1,-2,-4 ,0,-3,-6,-1 ,0 ,0,-7,-4,-2 ,3 ,3,-1,-8},\r
-    { -2,-4,-4,-5,12,-5,-5,-3,-3,-2,-6,-5,-5,-4,-3 ,0,-2,-8 ,0,-2,-4,-5,-3,-8},\r
-    {  0 ,1 ,1 ,2,-5 ,4 ,2,-1 ,3,-2,-2 ,1,-1,-5 ,0,-1,-1,-5,-4,-2 ,1 ,3,-1,-8},\r
-    {  0,-1 ,1 ,3,-5 ,2 ,4 ,0 ,1,-2,-3 ,0,-2,-5,-1 ,0 ,0,-7,-4,-2 ,3 ,3,-1,-8},\r
-    {  1,-3 ,0 ,1,-3,-1 ,0 ,5,-2,-3,-4,-2,-3,-5 ,0 ,1 ,0,-7,-5,-1 ,0 ,0,-1,-8},\r
-    { -1 ,2 ,2 ,1,-3 ,3 ,1,-2 ,6,-2,-2 ,0,-2,-2 ,0,-1,-1,-3 ,0,-2 ,1 ,2,-1,-8},\r
-    { -1,-2,-2,-2,-2,-2,-2,-3,-2 ,5 ,2,-2 ,2 ,1,-2,-1 ,0,-5,-1 ,4,-2,-2,-1,-8},\r
-    { -2,-3,-3,-4,-6,-2,-3,-4,-2 ,2 ,6,-3 ,4 ,2,-3,-3,-2,-2,-1 ,2,-3,-3,-1,-8},\r
-    { -1 ,3 ,1 ,0,-5 ,1 ,0,-2 ,0,-2,-3 ,5 ,0,-5,-1 ,0 ,0,-3,-4,-2 ,1 ,0,-1,-8},\r
-    { -1 ,0,-2,-3,-5,-1,-2,-3,-2 ,2 ,4 ,0 ,6 ,0,-2,-2,-1,-4,-2 ,2,-2,-2,-1,-8},\r
-    { -3,-4,-3,-6,-4,-5,-5,-5,-2 ,1 ,2,-5 ,0 ,9,-5,-3,-3 ,0 ,7,-1,-4,-5,-2,-8},\r
-    {  1 ,0 ,0,-1,-3 ,0,-1 ,0 ,0,-2,-3,-1,-2,-5 ,6 ,1 ,0,-6,-5,-1,-1 ,0,-1,-8},\r
-    {  1 ,0 ,1 ,0 ,0,-1 ,0 ,1,-1,-1,-3 ,0,-2,-3 ,1 ,2 ,1,-2,-3,-1 ,0 ,0 ,0,-8},\r
-    {  1,-1 ,0 ,0,-2,-1 ,0 ,0,-1 ,0,-2 ,0,-1,-3 ,0 ,1 ,3,-5,-3 ,0 ,0,-1 ,0,-8},\r
-    { -6 ,2,-4,-7,-8,-5,-7,-7,-3,-5,-2,-3,-4 ,0,-6,-2,-5,17 ,0,-6,-5,-6,-4,-8},\r
-    { -3,-4,-2,-4 ,0,-4,-4,-5 ,0,-1,-1,-4,-2 ,7,-5,-3,-3 ,0,10,-2,-3,-4,-2,-8},\r
-    {  0,-2,-2,-2,-2,-2,-2,-1,-2 ,4 ,2,-2 ,2,-1,-1,-1 ,0,-6,-2 ,4,-2,-2,-1,-8},\r
-    {  0,-1 ,2 ,3,-4 ,1 ,3 ,0 ,1,-2,-3 ,1,-2,-4,-1 ,0 ,0,-5,-3,-2 ,3 ,2,-1,-8},\r
-    {  0 ,0 ,1 ,3,-5 ,3 ,3 ,0 ,2,-2,-3 ,0,-2,-5 ,0 ,0,-1,-6,-4,-2 ,2 ,3,-1,-8},\r
-    {  0,-1 ,0,-1,-3,-1,-1,-1,-1,-1,-1,-1,-1,-2,-1 ,0 ,0,-4,-2,-1,-1,-1,-1,-8},\r
-    { -8,-8,-8,-8,-8,-8,-8,-8,-8,-8,-8,-8,-8,-8,-8,-8,-8,-8,-8,-8,-8,-8,-8 ,1},\r
-  };\r
-\r
-  public static Hashtable ssHash = new Hashtable();  // stores the number value of the aa\r
-\r
-  static {\r
-    ssHash.put("H", Color.magenta);\r
-    ssHash.put("E", Color.yellow);\r
-    ssHash.put("-", Color.white);\r
-    ssHash.put(".", Color.white);\r
-    ssHash.put("S", Color.cyan);\r
-    ssHash.put("T", Color.blue);\r
-    ssHash.put("G", Color.pink);\r
-    ssHash.put("I", Color.pink);\r
-    ssHash.put("B", Color.yellow);\r
-  }\r
-  static final int[][] DNA = {\r
-    //  C  T  A  G  -\r
-    { 5,-4,-4,-4, 1},// C\r
-    {-4, 5,-4,-4, 1},// T\r
-    {-4,-4, 5,-4, 1},// A\r
-    {-4,-4,-4, 5, 1},// G\r
-    { 1, 1, 1, 1, 1},// -\r
-  };\r
-  public static Hashtable getAAHash() {\r
-    return aaHash;\r
-  }\r
-  public static Hashtable getAA3Hash() {\r
-    return aa3Hash;\r
-  }\r
-  public static int[][] getDNA() {\r
-    return ResidueProperties.DNA;\r
-  }\r
-  public static int[][] getBLOSUM62() {\r
-    return ResidueProperties.BLOSUM62;\r
-  }\r
-  public static int getPAM250(String A1, String A2) {\r
-    Integer pog1  = (Integer)aaHash.get(A1);\r
-    Integer pog2  = (Integer)aaHash.get(A2);\r
-    int pog = ResidueProperties.PAM250[pog1.intValue()][pog2.intValue()];\r
-    return pog ;\r
-  }\r
-  public static int getBLOSUM62(String A1, String A2) {\r
-    int pog = 0;\r
-    try {\r
-      Integer pog1  = (Integer)aaHash.get(A1);\r
-      Integer pog2  = (Integer)aaHash.get(A2);\r
-      pog = ResidueProperties.BLOSUM62[pog1.intValue()][pog2.intValue()];\r
-    } catch (Exception e) {\r
-      //System.out.println("Unknown residue in " + A1 + " " + A2);\r
+    static {\r
+        tiny.put("I", new Integer(0));\r
+        tiny.put("L", new Integer(0));\r
+        tiny.put("V", new Integer(0));\r
+        tiny.put("C", new Integer(0));\r
+        tiny.put("A", new Integer(1));\r
+        tiny.put("G", new Integer(1));\r
+        tiny.put("M", new Integer(0));\r
+        tiny.put("F", new Integer(0));\r
+        tiny.put("Y", new Integer(0));\r
+        tiny.put("W", new Integer(0));\r
+        tiny.put("H", new Integer(0));\r
+        tiny.put("K", new Integer(0));\r
+        tiny.put("R", new Integer(0));\r
+        tiny.put("E", new Integer(0));\r
+        tiny.put("Q", new Integer(0));\r
+        tiny.put("D", new Integer(0));\r
+        tiny.put("N", new Integer(0));\r
+        tiny.put("S", new Integer(1));\r
+        tiny.put("T", new Integer(0));\r
+        tiny.put("P", new Integer(0));\r
+        tiny.put("-", new Integer(1));\r
+        tiny.put("*", new Integer(1));\r
     }\r
-    return pog ;\r
-  }\r
-\r
-  public static Color[] pidColours = {\r
-    midBlue,\r
-    new Color(153,153,255),\r
-    //    Color.lightGray,\r
-    new Color(204,204,255),\r
-  };\r
-  public static float[] pidThresholds = {\r
-    80,\r
-    60,\r
-    40,\r
-  } ;\r
-  private ResidueProperties() {}\r
-\r
-  public static Hashtable codonHash = new Hashtable();\r
-\r
-  public static Vector Lys = new Vector();\r
-  public static Vector Asn = new Vector();\r
-  public static Vector Gln = new Vector();\r
-  public static Vector His = new Vector();\r
-  public static Vector Glu = new Vector();\r
-  public static Vector Asp = new Vector();\r
-  public static Vector Tyr = new Vector();\r
-  public static Vector Thr = new Vector();\r
-  public static Vector Pro = new Vector();\r
-  public static Vector Ala = new Vector();\r
-  public static Vector Ser = new Vector();\r
-  public static Vector Arg = new Vector();\r
-  public static Vector Gly = new Vector();\r
-  public static Vector Trp = new Vector();\r
-  public static Vector Cys = new Vector();\r
-  public static Vector Ile = new Vector();\r
-  public static Vector Met = new Vector();\r
-  public static Vector Leu = new Vector();\r
-  public static Vector Val = new Vector();\r
-  public static Vector Phe = new Vector();\r
-  public static Vector STOP = new Vector();\r
-\r
-  static {\r
-    codonHash.put("K",Lys);\r
-    codonHash.put("N",Asn);\r
-    codonHash.put("Q",Gln);\r
-    codonHash.put("H",His);\r
-    codonHash.put("E",Glu);\r
-    codonHash.put("D",Asp);\r
-    codonHash.put("Y",Tyr);\r
-    codonHash.put("T",Thr);\r
-    codonHash.put("P",Pro);\r
-    codonHash.put("A",Ala);\r
-    codonHash.put("S",Ser);\r
-    codonHash.put("R",Arg);\r
-    codonHash.put("G",Gly);\r
-    codonHash.put("W",Trp);\r
-    codonHash.put("C",Cys);\r
-    codonHash.put("I",Ile);\r
-    codonHash.put("M",Met);\r
-    codonHash.put("L",Leu);\r
-    codonHash.put("V",Val);\r
-    codonHash.put("F",Phe);\r
-    codonHash.put("STOP",STOP);\r
-  }\r
-\r
-  public static Vector getCodons(String res) {\r
-    if (codonHash.containsKey(res))\r
-      return (Vector)codonHash.get(res);\r
-    return null;\r
-  }\r
-\r
-  public static String codonTranslate(String codon) {\r
-    Enumeration e = codonHash.keys();\r
-    while (e.hasMoreElements()) {\r
-      String key = (String)e.nextElement();\r
-      Vector tmp = (Vector)codonHash.get(key);\r
-      if (tmp.contains(codon)) {\r
-        return key;\r
-      }\r
+\r
+    static {\r
+        proline.put("I", new Integer(0));\r
+        proline.put("L", new Integer(0));\r
+        proline.put("V", new Integer(0));\r
+        proline.put("C", new Integer(0));\r
+        proline.put("A", new Integer(0));\r
+        proline.put("G", new Integer(0));\r
+        proline.put("M", new Integer(0));\r
+        proline.put("F", new Integer(0));\r
+        proline.put("Y", new Integer(0));\r
+        proline.put("W", new Integer(0));\r
+        proline.put("H", new Integer(0));\r
+        proline.put("K", new Integer(0));\r
+        proline.put("R", new Integer(0));\r
+        proline.put("E", new Integer(0));\r
+        proline.put("Q", new Integer(0));\r
+        proline.put("D", new Integer(0));\r
+        proline.put("N", new Integer(0));\r
+        proline.put("S", new Integer(0));\r
+        proline.put("T", new Integer(0));\r
+        proline.put("P", new Integer(1));\r
+        proline.put("-", new Integer(1));\r
+        proline.put("*", new Integer(1));\r
+    }\r
+\r
+    static {\r
+        propHash.put("hydrophobic", hydrophobic);\r
+        propHash.put("small", small);\r
+        propHash.put("positive", positive);\r
+        propHash.put("negative", negative);\r
+        propHash.put("charged", charged);\r
+        propHash.put("aromatic", aromatic);\r
+        propHash.put("aliphatic", aliphatic);\r
+        propHash.put("tiny", tiny);\r
+        propHash.put("proline", proline);\r
+        propHash.put("polar", polar);\r
+    }\r
+\r
+    public static Hashtable chainColours = new Hashtable();\r
+\r
+    static {\r
+        chainColours.put("A", Color.red);\r
+        chainColours.put("B", Color.orange);\r
+        chainColours.put("C", Color.yellow);\r
+        chainColours.put("D", Color.green);\r
+        chainColours.put("E", Color.cyan);\r
+        chainColours.put("F", Color.blue);\r
+        chainColours.put("G", Color.magenta);\r
+        chainColours.put("H", Color.pink);\r
+    }\r
+\r
+    private ResidueProperties() {\r
+    }\r
+\r
+    public static double getHydmax() {\r
+        return hydmax;\r
+    }\r
+\r
+    public static double getHydmin() {\r
+        return hydmin;\r
+    }\r
+\r
+    public static double[] getHyd() {\r
+        return hyd;\r
+    }\r
+\r
+    public static Hashtable getAAHash() {\r
+        return aaHash;\r
+    }\r
+\r
+    public static Hashtable getAA3Hash() {\r
+        return aa3Hash;\r
+    }\r
+\r
+    public static int[][] getDNA() {\r
+        return ResidueProperties.DNA;\r
+    }\r
+\r
+    public static int[][] getBLOSUM62() {\r
+        return ResidueProperties.BLOSUM62;\r
+    }\r
+\r
+    public static int getPAM250(String A1, String A2) {\r
+        Integer pog1 = (Integer) aaHash.get(A1);\r
+        Integer pog2 = (Integer) aaHash.get(A2);\r
+        int pog = ResidueProperties.PAM250[pog1.intValue()][pog2.intValue()];\r
+\r
+        return pog;\r
+    }\r
+\r
+    public static int getBLOSUM62(String A1, String A2) {\r
+        int pog = 0;\r
+\r
+        try {\r
+            Integer pog1 = (Integer) aaHash.get(A1);\r
+            Integer pog2 = (Integer) aaHash.get(A2);\r
+            pog = ResidueProperties.BLOSUM62[pog1.intValue()][pog2.intValue()];\r
+        } catch (Exception e) {\r
+            //System.out.println("Unknown residue in " + A1 + " " + A2);\r
+        }\r
+\r
+        return pog;\r
+    }\r
+\r
+    public static Vector getCodons(String res) {\r
+        if (codonHash.containsKey(res)) {\r
+            return (Vector) codonHash.get(res);\r
+        }\r
+\r
+        return null;\r
+    }\r
+\r
+    public static String codonTranslate(String codon) {\r
+        Enumeration e = codonHash.keys();\r
+\r
+        while (e.hasMoreElements()) {\r
+            String key = (String) e.nextElement();\r
+            Vector tmp = (Vector) codonHash.get(key);\r
+\r
+            if (tmp.contains(codon)) {\r
+                return key;\r
+            }\r
+        }\r
+\r
+        return null;\r
+    }\r
+\r
+    public static Hashtable getChainColours() {\r
+        return chainColours;\r
     }\r
-    return null;\r
-  }\r
-  public static Hashtable codonHash2 = new Hashtable();\r
-  static {\r
-    codonHash2.put("AAA","K");\r
-    codonHash2.put("AAG","K");\r
-    codonHash2.put("AAC","N");\r
-    codonHash2.put("AAT","N");\r
-\r
-    codonHash2.put("CAA","E");\r
-    codonHash2.put("CAG","E");\r
-    codonHash2.put("CAC","H");\r
-    codonHash2.put("CAT","H");\r
-\r
-    codonHash2.put("GAA","Q");\r
-    codonHash2.put("GAG","Q");\r
-    codonHash2.put("GAC","D");\r
-    codonHash2.put("GAT","D");\r
-\r
-    codonHash2.put("TAC","Y");\r
-    codonHash2.put("TAT","Y");\r
-\r
-    codonHash2.put("ACA","T");\r
-    codonHash2.put("AAG","T");\r
-    codonHash2.put("ACC","T");\r
-    codonHash2.put("ACT","T");\r
-\r
-    codonHash2.put("CCA","P");\r
-    codonHash2.put("CCG","P");\r
-    codonHash2.put("CCC","P");\r
-    codonHash2.put("CCT","P");\r
-\r
-    codonHash2.put("GCA","A");\r
-    codonHash2.put("GCG","A");\r
-    codonHash2.put("GCC","A");\r
-    codonHash2.put("GCT","A");\r
-\r
-    codonHash2.put("TCA","S");\r
-    codonHash2.put("TCG","S");\r
-    codonHash2.put("TCC","S");\r
-    codonHash2.put("TCT","S");\r
-    codonHash2.put("AGC","S");\r
-    codonHash2.put("AGT","S");\r
-\r
-    codonHash2.put("AGA","R");\r
-    codonHash2.put("AGG","R");\r
-    codonHash2.put("CGA","R");\r
-    codonHash2.put("CGG","R");\r
-    codonHash2.put("CGC","R");\r
-    codonHash2.put("CGT","R");\r
-\r
-    codonHash2.put("GGA","G");\r
-    codonHash2.put("GGG","G");\r
-    codonHash2.put("GGC","G");\r
-    codonHash2.put("GGT","G");\r
-\r
-    codonHash2.put("TGA","*");\r
-    codonHash2.put("TAA","*");\r
-    codonHash2.put("TAG","*");\r
-\r
-    codonHash2.put("TGG","W");\r
-\r
-    codonHash2.put("TGC","C");\r
-    codonHash2.put("TGT","C");\r
-\r
-    codonHash2.put("ATA","I");\r
-    codonHash2.put("ATC","I");\r
-    codonHash2.put("ATT","I");\r
-\r
-    codonHash2.put("ATG","M");\r
-\r
-    codonHash2.put("CTA","L");\r
-    codonHash2.put("CTG","L");\r
-    codonHash2.put("CTC","L");\r
-    codonHash2.put("CTT","L");\r
-    codonHash2.put("TTA","L");\r
-    codonHash2.put("TTG","L");\r
-\r
-    codonHash2.put("GTA","V");\r
-    codonHash2.put("GTG","V");\r
-    codonHash2.put("GTC","V");\r
-    codonHash2.put("GTT","V");\r
-\r
-    codonHash2.put("TTC","F");\r
-    codonHash2.put("TTT","F");\r
-\r
-  }\r
-\r
-  static {\r
-    Lys.addElement("AAA");\r
-    Lys.addElement("AAG");\r
-    Asn.addElement("AAC");\r
-    Asn.addElement("AAT");\r
-\r
-    Gln.addElement("CAA");\r
-    Gln.addElement("CAG");\r
-    His.addElement("CAC");\r
-    His.addElement("CAT");\r
-\r
-    Glu.addElement("GAA");\r
-    Glu.addElement("GAG");\r
-    Asp.addElement("GAC");\r
-    Asp.addElement("GAT");\r
-\r
-    Tyr.addElement("TAC");\r
-    Tyr.addElement("TAT");\r
-\r
-    Thr.addElement("ACA");\r
-    Thr.addElement("ACG");\r
-    Thr.addElement("ACC");\r
-    Thr.addElement("ACT");\r
-\r
-    Pro.addElement("CCA");\r
-    Pro.addElement("CCG");\r
-    Pro.addElement("CCC");\r
-    Pro.addElement("CCT");\r
-\r
-    Ala.addElement("GCA");\r
-    Ala.addElement("GCG");\r
-    Ala.addElement("GCC");\r
-    Ala.addElement("GCT");\r
-\r
-    Ser.addElement("TCA");\r
-    Ser.addElement("TCG");\r
-    Ser.addElement("TCC");\r
-    Ser.addElement("TCT");\r
-    Ser.addElement("AGC");\r
-    Ser.addElement("AGT");\r
-\r
-    Arg.addElement("AGA");\r
-    Arg.addElement("AGG");\r
-    Arg.addElement("CGA");\r
-    Arg.addElement("CGG");\r
-    Arg.addElement("CGC");\r
-    Arg.addElement("CGT");\r
-\r
-    Gly.addElement("GGA");\r
-    Gly.addElement("GGG");\r
-    Gly.addElement("GGC");\r
-    Gly.addElement("GGT");\r
-\r
-    STOP.addElement("TGA");\r
-    STOP.addElement("TAA");\r
-    STOP.addElement("TAG");\r
-\r
-    Trp.addElement("TGG");\r
-\r
-    Cys.addElement("TGC");\r
-    Cys.addElement("TGT");\r
-\r
-    Ile.addElement("ATA");\r
-    Ile.addElement("ATC");\r
-    Ile.addElement("ATT");\r
-\r
-    Met.addElement("ATG");\r
-\r
-    Leu.addElement("CTA");\r
-    Leu.addElement("CTG");\r
-    Leu.addElement("CTC");\r
-    Leu.addElement("CTT");\r
-    Leu.addElement("TTA");\r
-    Leu.addElement("TTG");\r
-\r
-    Val.addElement("GTA");\r
-    Val.addElement("GTG");\r
-    Val.addElement("GTC");\r
-    Val.addElement("GTT");\r
-\r
-    Phe.addElement("TTC");\r
-    Phe.addElement("TTT");\r
-  }\r
-\r
-  public static Color[][] groupColors = {\r
-    {Color.red,Color.red.brighter(),Color.red.brighter().brighter()},\r
-    {Color.orange,Color.orange.brighter(),Color.orange.brighter().brighter()},\r
-    {Color.green,Color.green.brighter(),Color.green.brighter().brighter()},\r
-    {Color.blue,Color.blue.brighter(),Color.blue.brighter().brighter()},\r
-    {Color.magenta,Color.magenta.brighter(),Color.magenta.brighter().brighter()},\r
-    {Color.cyan,Color.cyan.brighter(),Color.cyan.brighter().brighter()},\r
-    {Color.pink,Color.pink.brighter(),Color.pink.brighter().brighter()},\r
-\r
-  };\r
-\r
-\r
-\r
-  //Stores residue codes/names and colours and other things\r
-  public static Hashtable propHash = new Hashtable();\r
-  public static Hashtable hydrophobic = new Hashtable();\r
-  public static Hashtable polar = new Hashtable();\r
-  public static Hashtable small = new Hashtable();\r
-  public static Hashtable positive = new Hashtable();\r
-  public static Hashtable negative = new Hashtable();\r
-  public static Hashtable charged = new Hashtable();\r
-  public static Hashtable aromatic = new Hashtable();\r
-  public static Hashtable aliphatic = new Hashtable();\r
-  public static Hashtable tiny = new Hashtable();\r
-  public static Hashtable proline = new Hashtable();\r
-\r
-  static {\r
-    hydrophobic.put("I",new Integer(1));\r
-    hydrophobic.put("L",new Integer(1));\r
-    hydrophobic.put("V",new Integer(1));\r
-    hydrophobic.put("C",new Integer(1));\r
-    hydrophobic.put("A",new Integer(1));\r
-    hydrophobic.put("G",new Integer(1));\r
-    hydrophobic.put("M",new Integer(1));\r
-    hydrophobic.put("F",new Integer(1));\r
-    hydrophobic.put("Y",new Integer(1));\r
-    hydrophobic.put("W",new Integer(1));\r
-    hydrophobic.put("H",new Integer(1));\r
-    hydrophobic.put("K",new Integer(1));\r
-    hydrophobic.put("X",new Integer(1));\r
-    hydrophobic.put("-",new Integer(1));\r
-    hydrophobic.put("*",new Integer(1));\r
-    hydrophobic.put("R",new Integer(0));\r
-    hydrophobic.put("E",new Integer(0));\r
-    hydrophobic.put("Q",new Integer(0));\r
-    hydrophobic.put("D",new Integer(0));\r
-    hydrophobic.put("N",new Integer(0));\r
-    hydrophobic.put("S",new Integer(0));\r
-    hydrophobic.put("T",new Integer(0));\r
-    hydrophobic.put("P",new Integer(0));\r
-  }\r
-  static {\r
-    polar.put("Y",new Integer(1));\r
-    polar.put("W",new Integer(1));\r
-    polar.put("H",new Integer(1));\r
-    polar.put("K",new Integer(1));\r
-    polar.put("R",new Integer(1));\r
-    polar.put("E",new Integer(1));\r
-    polar.put("Q",new Integer(1));\r
-    polar.put("D",new Integer(1));\r
-    polar.put("N",new Integer(1));\r
-    polar.put("S",new Integer(1));\r
-    polar.put("T",new Integer(1));\r
-    polar.put("X",new Integer(1));\r
-    polar.put("-",new Integer(1));\r
-    polar.put("*",new Integer(1));\r
-    polar.put("I",new Integer(0));\r
-    polar.put("L",new Integer(0));\r
-    polar.put("V",new Integer(0));\r
-    polar.put("C",new Integer(0));\r
-    polar.put("A",new Integer(0));\r
-    polar.put("G",new Integer(0));\r
-    polar.put("M",new Integer(0));\r
-    polar.put("F",new Integer(0));\r
-    polar.put("P",new Integer(0));\r
-\r
-  }\r
-  static {\r
-    small.put("I",new Integer(0));\r
-    small.put("L",new Integer(0));\r
-    small.put("V",new Integer(1));\r
-    small.put("C",new Integer(1));\r
-    small.put("A",new Integer(1));\r
-    small.put("G",new Integer(1));\r
-    small.put("M",new Integer(0));\r
-    small.put("F",new Integer(0));\r
-    small.put("Y",new Integer(0));\r
-    small.put("W",new Integer(0));\r
-    small.put("H",new Integer(0));\r
-    small.put("K",new Integer(0));\r
-    small.put("R",new Integer(0));\r
-    small.put("E",new Integer(0));\r
-    small.put("Q",new Integer(0));\r
-    small.put("D",new Integer(1));\r
-    small.put("N",new Integer(1));\r
-    small.put("S",new Integer(1));\r
-    small.put("T",new Integer(1));\r
-    small.put("P",new Integer(1));\r
-    small.put("-",new Integer(1));\r
-    small.put("*",new Integer(1));\r
-  }\r
-  static {\r
-    positive.put("I",new Integer(0));\r
-    positive.put("L",new Integer(0));\r
-    positive.put("V",new Integer(0));\r
-    positive.put("C",new Integer(0));\r
-    positive.put("A",new Integer(0));\r
-    positive.put("G",new Integer(0));\r
-    positive.put("M",new Integer(0));\r
-    positive.put("F",new Integer(0));\r
-    positive.put("Y",new Integer(0));\r
-    positive.put("W",new Integer(0));\r
-    positive.put("H",new Integer(1));\r
-    positive.put("K",new Integer(1));\r
-    positive.put("R",new Integer(1));\r
-    positive.put("E",new Integer(0));\r
-    positive.put("Q",new Integer(0));\r
-    positive.put("D",new Integer(0));\r
-    positive.put("N",new Integer(0));\r
-    positive.put("S",new Integer(0));\r
-    positive.put("T",new Integer(0));\r
-    positive.put("P",new Integer(0));\r
-    positive.put("-",new Integer(1));\r
-    positive.put("*",new Integer(1));\r
-  }\r
-  static {\r
-    negative.put("I",new Integer(0));\r
-    negative.put("L",new Integer(0));\r
-    negative.put("V",new Integer(0));\r
-    negative.put("C",new Integer(0));\r
-    negative.put("A",new Integer(0));\r
-    negative.put("G",new Integer(0));\r
-    negative.put("M",new Integer(0));\r
-    negative.put("F",new Integer(0));\r
-    negative.put("Y",new Integer(0));\r
-    negative.put("W",new Integer(0));\r
-    negative.put("H",new Integer(0));\r
-    negative.put("K",new Integer(0));\r
-    negative.put("R",new Integer(0));\r
-    negative.put("E",new Integer(1));\r
-    negative.put("Q",new Integer(0));\r
-    negative.put("D",new Integer(1));\r
-    negative.put("N",new Integer(0));\r
-    negative.put("S",new Integer(0));\r
-    negative.put("T",new Integer(0));\r
-    negative.put("P",new Integer(0));\r
-    negative.put("-",new Integer(1));\r
-    negative.put("*",new Integer(1));\r
-  }\r
-  static {\r
-    charged.put("I",new Integer(0));\r
-    charged.put("L",new Integer(0));\r
-    charged.put("V",new Integer(0));\r
-    charged.put("C",new Integer(0));\r
-    charged.put("A",new Integer(0));\r
-    charged.put("G",new Integer(0));\r
-    charged.put("M",new Integer(0));\r
-    charged.put("F",new Integer(0));\r
-    charged.put("Y",new Integer(0));\r
-    charged.put("W",new Integer(0));\r
-    charged.put("H",new Integer(1));\r
-    charged.put("K",new Integer(1));\r
-    charged.put("R",new Integer(1));\r
-    charged.put("E",new Integer(1));\r
-    charged.put("Q",new Integer(0));\r
-    charged.put("D",new Integer(1));\r
-    charged.put("N",new Integer(1));\r
-    charged.put("S",new Integer(0));\r
-    charged.put("T",new Integer(0));\r
-    charged.put("P",new Integer(0));\r
-    charged.put("-",new Integer(1));\r
-    charged.put("*",new Integer(1));\r
-  }\r
-  static {\r
-    aromatic.put("I",new Integer(0));\r
-    aromatic.put("L",new Integer(0));\r
-    aromatic.put("V",new Integer(0));\r
-    aromatic.put("C",new Integer(0));\r
-    aromatic.put("A",new Integer(0));\r
-    aromatic.put("G",new Integer(0));\r
-    aromatic.put("M",new Integer(0));\r
-    aromatic.put("F",new Integer(1));\r
-    aromatic.put("Y",new Integer(1));\r
-    aromatic.put("W",new Integer(1));\r
-    aromatic.put("H",new Integer(1));\r
-    aromatic.put("K",new Integer(0));\r
-    aromatic.put("R",new Integer(0));\r
-    aromatic.put("E",new Integer(0));\r
-    aromatic.put("Q",new Integer(0));\r
-    aromatic.put("D",new Integer(0));\r
-    aromatic.put("N",new Integer(0));\r
-    aromatic.put("S",new Integer(0));\r
-    aromatic.put("T",new Integer(0));\r
-    aromatic.put("P",new Integer(0));\r
-    aromatic.put("-",new Integer(1));\r
-    aromatic.put("*",new Integer(1));\r
-  }\r
-  static {\r
-    aliphatic.put("I",new Integer(1));\r
-    aliphatic.put("L",new Integer(1));\r
-    aliphatic.put("V",new Integer(1));\r
-    aliphatic.put("C",new Integer(0));\r
-    aliphatic.put("A",new Integer(0));\r
-    aliphatic.put("G",new Integer(0));\r
-    aliphatic.put("M",new Integer(0));\r
-    aliphatic.put("F",new Integer(0));\r
-    aliphatic.put("Y",new Integer(0));\r
-    aliphatic.put("W",new Integer(0));\r
-    aliphatic.put("H",new Integer(0));\r
-    aliphatic.put("K",new Integer(0));\r
-    aliphatic.put("R",new Integer(0));\r
-    aliphatic.put("E",new Integer(0));\r
-    aliphatic.put("Q",new Integer(0));\r
-    aliphatic.put("D",new Integer(0));\r
-    aliphatic.put("N",new Integer(0));\r
-    aliphatic.put("S",new Integer(0));\r
-    aliphatic.put("T",new Integer(0));\r
-    aliphatic.put("P",new Integer(0));\r
-    aliphatic.put("-",new Integer(1));\r
-    aliphatic.put("*",new Integer(1));\r
-  }\r
-\r
-  static {\r
-    tiny.put("I",new Integer(0));\r
-    tiny.put("L",new Integer(0));\r
-    tiny.put("V",new Integer(0));\r
-    tiny.put("C",new Integer(0));\r
-    tiny.put("A",new Integer(1));\r
-    tiny.put("G",new Integer(1));\r
-    tiny.put("M",new Integer(0));\r
-    tiny.put("F",new Integer(0));\r
-    tiny.put("Y",new Integer(0));\r
-    tiny.put("W",new Integer(0));\r
-    tiny.put("H",new Integer(0));\r
-    tiny.put("K",new Integer(0));\r
-    tiny.put("R",new Integer(0));\r
-    tiny.put("E",new Integer(0));\r
-    tiny.put("Q",new Integer(0));\r
-    tiny.put("D",new Integer(0));\r
-    tiny.put("N",new Integer(0));\r
-    tiny.put("S",new Integer(1));\r
-    tiny.put("T",new Integer(0));\r
-    tiny.put("P",new Integer(0));\r
-    tiny.put("-",new Integer(1));\r
-    tiny.put("*",new Integer(1));\r
-  }\r
-\r
-  static {\r
-    proline.put("I",new Integer(0));\r
-    proline.put("L",new Integer(0));\r
-    proline.put("V",new Integer(0));\r
-    proline.put("C",new Integer(0));\r
-    proline.put("A",new Integer(0));\r
-    proline.put("G",new Integer(0));\r
-    proline.put("M",new Integer(0));\r
-    proline.put("F",new Integer(0));\r
-    proline.put("Y",new Integer(0));\r
-    proline.put("W",new Integer(0));\r
-    proline.put("H",new Integer(0));\r
-    proline.put("K",new Integer(0));\r
-    proline.put("R",new Integer(0));\r
-    proline.put("E",new Integer(0));\r
-    proline.put("Q",new Integer(0));\r
-    proline.put("D",new Integer(0));\r
-    proline.put("N",new Integer(0));\r
-    proline.put("S",new Integer(0));\r
-    proline.put("T",new Integer(0));\r
-    proline.put("P",new Integer(1));\r
-    proline.put("-",new Integer(1));\r
-    proline.put("*",new Integer(1));\r
-  }\r
-\r
-\r
-  static {\r
-    propHash.put("hydrophobic",hydrophobic);\r
-    propHash.put("small",small);\r
-    propHash.put("positive",positive);\r
-    propHash.put("negative",negative);\r
-    propHash.put("charged",charged);\r
-    propHash.put("aromatic",aromatic);\r
-    propHash.put("aliphatic",aliphatic);\r
-    propHash.put("tiny",tiny);\r
-    propHash.put("proline",proline);\r
-    propHash.put("polar",polar);\r
-  }\r
-\r
-  public static Hashtable chainColours = new Hashtable();\r
-  static {\r
-    chainColours.put("A",Color.red);\r
-    chainColours.put("B",Color.orange);\r
-    chainColours.put("C",Color.yellow);\r
-    chainColours.put("D",Color.green);\r
-    chainColours.put("E",Color.cyan);\r
-    chainColours.put("F",Color.blue);\r
-    chainColours.put("G",Color.magenta);\r
-    chainColours.put("H",Color.pink);\r
-  }\r
-  public static Hashtable getChainColours() {\r
-    return chainColours;\r
-  }\r
 }\r
index b6dc45b..12f252d 100755 (executable)
 * 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.schemes;\r
 \r
 import java.awt.*;\r
 \r
-public class ScoreColourScheme extends ResidueColourScheme {\r
-  public double min;\r
-  public double max;\r
-  public double[] scores;\r
-\r
-  public ScoreColourScheme( double[] scores,\r
-                          double min,\r
-                          double max) {\r
 \r
-    super();\r
+public class ScoreColourScheme extends ResidueColourScheme {\r
+    public double min;\r
+    public double max;\r
+    public double[] scores;\r
 \r
-    this.scores = scores;\r
-    this.min = min;\r
-    this.max = max;\r
-  }\r
+    public ScoreColourScheme(double[] scores, double min, double max) {\r
+        super();\r
 \r
+        this.scores = scores;\r
+        this.min = min;\r
+        this.max = max;\r
+    }\r
 \r
-    public Color findColour(String s,int j)\r
-    {\r
+    public Color findColour(String s, int j) {\r
+        if (threshold > 0) {\r
+            if (!aboveThreshold(s, j)) {\r
+                return Color.white;\r
+            }\r
+        }\r
 \r
-      if (threshold > 0)\r
-      {\r
-         if (!aboveThreshold(s,j))\r
-             return Color.white;\r
-      }\r
+        float red = (float) (scores[((Integer) ResidueProperties.aaHash.get(s)).intValue()] -\r
+            (float) min) / (float) (max - min);\r
 \r
-       float red = (float)(scores[((Integer)ResidueProperties.aaHash.get(s)).intValue()]\r
-                           - (float)min)/(float)(max - min);\r
-       if (red > 1.0f)\r
-           red = 1.0f;\r
+        if (red > 1.0f) {\r
+            red = 1.0f;\r
+        }\r
 \r
-       if (red < 0.0f)\r
-           red = 0.0f;\r
+        if (red < 0.0f) {\r
+            red = 0.0f;\r
+        }\r
 \r
-    char c = s.charAt(0);\r
+        char c = s.charAt(0);\r
 \r
-    if(jalview.util.Comparison.isGap((c)))\r
-        return Color.white;\r
+        if (jalview.util.Comparison.isGap((c))) {\r
+            return Color.white;\r
+        }\r
 \r
-       // This isn';t great - pool of colours in here?\r
-       return makeColour(red);\r
+        // This isn';t great - pool of colours in here?\r
+        return makeColour(red);\r
     }\r
+\r
     public Color makeColour(float c) {\r
-       return new Color(c,(float)0.0,(float)1.0-c);\r
+        return new Color(c, (float) 0.0, (float) 1.0 - c);\r
     }\r
 }\r
-\r
index 466ae4f..717e6dc 100755 (executable)
 * 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.schemes;\r
 \r
 import java.awt.*;\r
 \r
-public class StrandColourScheme extends ScoreColourScheme {\r
-\r
 \r
-  public StrandColourScheme() {\r
-    super(ResidueProperties.strand,ResidueProperties.strandmin,ResidueProperties.strandmax);\r
-  }\r
+public class StrandColourScheme extends ScoreColourScheme {\r
+    public StrandColourScheme() {\r
+        super(ResidueProperties.strand, ResidueProperties.strandmin,\r
+            ResidueProperties.strandmax);\r
+    }\r
 \r
-  public Color makeColour(float c) {\r
-    return new Color(c,c,(float)1.0-c);\r
-  }\r
+    public Color makeColour(float c) {\r
+        return new Color(c, c, (float) 1.0 - c);\r
+    }\r
 }\r
-\r
index 490425e..10277e9 100755 (executable)
 * 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.schemes;\r
 \r
 public class TaylorColourScheme extends ResidueColourScheme {\r
-\r
-  public TaylorColourScheme() {\r
-    super(ResidueProperties.taylor,0);\r
-  }\r
-\r
+    public TaylorColourScheme() {\r
+        super(ResidueProperties.taylor, 0);\r
+    }\r
 }\r
index 2964bae..e86c44c 100755 (executable)
 * 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.schemes;\r
 \r
 import java.awt.*;\r
 \r
-public class TurnColourScheme extends ScoreColourScheme {\r
 \r
-  public TurnColourScheme() {\r
-    super(ResidueProperties.turn,ResidueProperties.turnmin,ResidueProperties.turnmax);\r
-  }\r
+public class TurnColourScheme extends ScoreColourScheme {\r
+    public TurnColourScheme() {\r
+        super(ResidueProperties.turn, ResidueProperties.turnmin,\r
+            ResidueProperties.turnmax);\r
+    }\r
 \r
-  public Color makeColour(float c) {\r
-    return new Color(c,1-c,1-c);\r
-  }\r
+    public Color makeColour(float c) {\r
+        return new Color(c, 1 - c, 1 - c);\r
+    }\r
 }\r
-\r
index b4decde..38a1291 100755 (executable)
 * 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.schemes;\r
 \r
 import java.awt.*;\r
 \r
-public class UserColourScheme extends ResidueColourScheme\r
-{\r
-  public UserColourScheme(Color [] newColors)\r
-  {\r
-    colors = newColors;\r
-  }\r
 \r
-  public Color[] getColours()\r
-  {\r
-    return colors;\r
-  }\r
+public class UserColourScheme extends ResidueColourScheme {\r
+    public UserColourScheme(Color[] newColors) {\r
+        colors = newColors;\r
+    }\r
+\r
+    public Color[] getColours() {\r
+        return colors;\r
+    }\r
 }\r
index e042acb..2a439c0 100755 (executable)
 * 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.schemes;\r
 \r
 public class ZappoColourScheme extends ResidueColourScheme {\r
-\r
-  public ZappoColourScheme() {\r
-    super(ResidueProperties.color,0);\r
-  }\r
+    public ZappoColourScheme() {\r
+        super(ResidueProperties.color, 0);\r
+    }\r
 }\r
index aef74d5..12d6f02 100755 (executable)
 * 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.util;
-
-import java.io.File;
-import java.io.IOException;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Field;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-
+*/\r
+package jalview.util;\r
+\r
+import java.io.File;\r
+import java.io.IOException;\r
+\r
+import java.lang.reflect.Constructor;\r
+import java.lang.reflect.Field;\r
+import java.lang.reflect.InvocationTargetException;\r
+import java.lang.reflect.Method;\r
+\r
+\r
 /**
  * BrowserLauncher is a class that provides one static method, openURL, which opens the default
  * web browser for the current user of the system to the given URL.  It may support other
@@ -69,551 +70,698 @@ import java.lang.reflect.Method;
  *
  * @author Eric Albert (<a href="mailto:ejalbert@cs.stanford.edu">ejalbert@cs.stanford.edu</a>)
  * @version 1.4b1 (Released June 20, 2001)
- */
-public class BrowserLauncher {
-
-        /**
-         * The Java virtual machine that we are running on.  Actually, in most cases we only care
-         * about the operating system, but some operating systems require us to switch on the VM. */
-        private static int jvm;
-
-        /** The browser for the system */
-        private static Object browser;
-
-        /**
-         * Caches whether any classes, methods, and fields that are not part of the JDK and need to
-         * be dynamically loaded at runtime loaded successfully.
-         * <p>
-         * Note that if this is <code>false</code>, <code>openURL()</code> will always return an
-         * IOException.
-         */
-        private static boolean loadedWithoutErrors;
-
-        /** The com.apple.mrj.MRJFileUtils class */
-        private static Class mrjFileUtilsClass;
-
-        /** The com.apple.mrj.MRJOSType class */
-        private static Class mrjOSTypeClass;
-
-        /** The com.apple.MacOS.AEDesc class */
-        private static Class aeDescClass;
-
-        /** The &lt;init&gt;(int) method of com.apple.MacOS.AETarget */
-        private static Constructor aeTargetConstructor;
-
-        /** The &lt;init&gt;(int, int, int) method of com.apple.MacOS.AppleEvent */
-        private static Constructor appleEventConstructor;
-
-        /** The &lt;init&gt;(String) method of com.apple.MacOS.AEDesc */
-        private static Constructor aeDescConstructor;
-
-        /** The findFolder method of com.apple.mrj.MRJFileUtils */
-        private static Method findFolder;
-
-        /** The getFileCreator method of com.apple.mrj.MRJFileUtils */
-        private static Method getFileCreator;
-
-        /** The getFileType method of com.apple.mrj.MRJFileUtils */
-        private static Method getFileType;
-
-        /** The openURL method of com.apple.mrj.MRJFileUtils */
-        private static Method openURL;
-
-        /** The makeOSType method of com.apple.MacOS.OSUtils */
-        private static Method makeOSType;
-
-        /** The putParameter method of com.apple.MacOS.AppleEvent */
-        private static Method putParameter;
-
-        /** The sendNoReply method of com.apple.MacOS.AppleEvent */
-        private static Method sendNoReply;
-
-        /** Actually an MRJOSType pointing to the System Folder on a Macintosh */
-        private static Object kSystemFolderType;
-
-        /** The keyDirectObject AppleEvent parameter type */
-        private static Integer keyDirectObject;
-
-        /** The kAutoGenerateReturnID AppleEvent code */
-        private static Integer kAutoGenerateReturnID;
-
-        /** The kAnyTransactionID AppleEvent code */
-        private static Integer kAnyTransactionID;
-
-        /** The linkage object required for JDirect 3 on Mac OS X. */
-        private static Object linkage;
-
-        /** The framework to reference on Mac OS X */
-        private static final String JDirect_MacOSX = "/System/Library/Frameworks/Carbon.framework/Frameworks/HIToolbox.framework/HIToolbox";
-
-        /** JVM constant for MRJ 2.0 */
-        private static final int MRJ_2_0 = 0;
-
-        /** JVM constant for MRJ 2.1 or later */
-        private static final int MRJ_2_1 = 1;
-
-        /** JVM constant for Java on Mac OS X 10.0 (MRJ 3.0) */
-        private static final int MRJ_3_0 = 3;
-
-        /** JVM constant for MRJ 3.1 */
-        private static final int MRJ_3_1 = 4;
-
-        /** JVM constant for any Windows NT JVM */
-        private static final int WINDOWS_NT = 5;
-
-        /** JVM constant for any Windows 9x JVM */
-        private static final int WINDOWS_9x = 6;
-
-        /** JVM constant for any other platform */
-        private static final int OTHER = -1;
-
-        /**
-         * The file type of the Finder on a Macintosh.  Hardcoding "Finder" would keep non-U.S. English
-         * systems from working properly.
-         */
-        private static final String FINDER_TYPE = "FNDR";
-
-        /**
-         * The creator code of the Finder on a Macintosh, which is needed to send AppleEvents to the
-         * application.
-         */
-        private static final String FINDER_CREATOR = "MACS";
-
-        /** The name for the AppleEvent type corresponding to a GetURL event. */
-        private static final String GURL_EVENT = "GURL";
-
-        /**
-         * The first parameter that needs to be passed into Runtime.exec() to open the default web
-         * browser on Windows.
-         */
-    private static final String FIRST_WINDOWS_PARAMETER = "/c";
-
-    /** The second parameter for Runtime.exec() on Windows. */
-    private static final String SECOND_WINDOWS_PARAMETER = "start";
-
+ */\r
+public class BrowserLauncher {\r
     /**
-     * The third parameter for Runtime.exec() on Windows.  This is a "title"
-     * parameter that the command line expects.  Setting this parameter allows
-     * URLs containing spaces to work.
-     */
-    private static final String THIRD_WINDOWS_PARAMETER = "\"\"";
-
-        /**
-         * The shell parameters for Netscape that opens a given URL in an already-open copy of Netscape
-         * on many command-line systems.
-         */
-        private static final String NETSCAPE_REMOTE_PARAMETER = "-remote";
-        private static final String NETSCAPE_OPEN_PARAMETER_START = "openURL(";
-        private static final String NETSCAPE_OPEN_NEW_WINDOW = ", new-window";
-        private static final String NETSCAPE_OPEN_PARAMETER_END = ")";
-
-        /**
-         * The message from any exception thrown throughout the initialization process.
-         */
-        private static String errorMessage;
-
-        /**
-         * An initialization block that determines the operating system and loads the necessary
-         * runtime data.
-         */
-        static {
-                loadedWithoutErrors = true;
-                String osName = System.getProperty("os.name");
-                if (osName.startsWith("Mac OS")) {
-                        String mrjVersion = System.getProperty("mrj.version");
-                        String majorMRJVersion = mrjVersion.substring(0, 3);
-                        try {
-                                double version = Double.valueOf(majorMRJVersion).doubleValue();
-                                if (version == 2) {
-                                        jvm = MRJ_2_0;
-                                } else if (version >= 2.1 && version < 3) {
-                                        // Assume that all 2.x versions of MRJ work the same.  MRJ 2.1 actually
-                                        // works via Runtime.exec() and 2.2 supports that but has an openURL() method
-                                        // as well that we currently ignore.
-                                        jvm = MRJ_2_1;
-                                } else if (version == 3.0) {
-                                        jvm = MRJ_3_0;
-                                } else if (version >= 3.1) {
-                                        // Assume that all 3.1 and later versions of MRJ work the same.
-                                        jvm = MRJ_3_1;
-                                } else {
-                                        loadedWithoutErrors = false;
-                                        errorMessage = "Unsupported MRJ version: " + version;
-                                }
-                        } catch (NumberFormatException nfe) {
-                                loadedWithoutErrors = false;
-                                errorMessage = "Invalid MRJ version: " + mrjVersion;
-                        }
-                } else if (osName.startsWith("Windows")) {
-                        if (osName.indexOf("9") != -1) {
-                                jvm = WINDOWS_9x;
-                        } else {
-                                jvm = WINDOWS_NT;
-                        }
-                } else {
-                        jvm = OTHER;
-                }
-
-                if (loadedWithoutErrors) {     // if we haven't hit any errors yet
-                        loadedWithoutErrors = loadClasses();
-                }
-        }
-
-        /**
-         * This class should be never be instantiated; this just ensures so.
-         */
-        private BrowserLauncher() { }
-
-        /**
-         * Called by a static initializer to load any classes, fields, and methods required at runtime
-         * to locate the user's web browser.
-         * @return <code>true</code> if all intialization succeeded
-         *                     <code>false</code> if any portion of the initialization failed
-         */
-        private static boolean loadClasses() {
-                switch (jvm) {
-                        case MRJ_2_0:
-                                try {
-                                        Class aeTargetClass = Class.forName("com.apple.MacOS.AETarget");
-                                        Class osUtilsClass = Class.forName("com.apple.MacOS.OSUtils");
-                                        Class appleEventClass = Class.forName("com.apple.MacOS.AppleEvent");
-                                        Class aeClass = Class.forName("com.apple.MacOS.ae");
-                                        aeDescClass = Class.forName("com.apple.MacOS.AEDesc");
-
-                                        aeTargetConstructor = aeTargetClass.getDeclaredConstructor(new Class [] { int.class });
-                                        appleEventConstructor = appleEventClass.getDeclaredConstructor(new Class[] { int.class, int.class, aeTargetClass, int.class, int.class });
-                                        aeDescConstructor = aeDescClass.getDeclaredConstructor(new Class[] { String.class });
-
-                                        makeOSType = osUtilsClass.getDeclaredMethod("makeOSType", new Class [] { String.class });
-                                        putParameter = appleEventClass.getDeclaredMethod("putParameter", new Class[] { int.class, aeDescClass });
-                                        sendNoReply = appleEventClass.getDeclaredMethod("sendNoReply", new Class[] { });
-
-                                        Field keyDirectObjectField = aeClass.getDeclaredField("keyDirectObject");
-                                        keyDirectObject = (Integer) keyDirectObjectField.get(null);
-                                        Field autoGenerateReturnIDField = appleEventClass.getDeclaredField("kAutoGenerateReturnID");
-                                        kAutoGenerateReturnID = (Integer) autoGenerateReturnIDField.get(null);
-                                        Field anyTransactionIDField = appleEventClass.getDeclaredField("kAnyTransactionID");
-                                        kAnyTransactionID = (Integer) anyTransactionIDField.get(null);
-                                } catch (ClassNotFoundException cnfe) {
-                                        errorMessage = cnfe.getMessage();
-                                        return false;
-                                } catch (NoSuchMethodException nsme) {
-                                        errorMessage = nsme.getMessage();
-                                        return false;
-                                } catch (NoSuchFieldException nsfe) {
-                                        errorMessage = nsfe.getMessage();
-                                        return false;
-                                } catch (IllegalAccessException iae) {
-                                        errorMessage = iae.getMessage();
-                                        return false;
-                                }
-                                break;
-                        case MRJ_2_1:
-                                try {
-                                        mrjFileUtilsClass = Class.forName("com.apple.mrj.MRJFileUtils");
-                                        mrjOSTypeClass = Class.forName("com.apple.mrj.MRJOSType");
-                                        Field systemFolderField = mrjFileUtilsClass.getDeclaredField("kSystemFolderType");
-                                        kSystemFolderType = systemFolderField.get(null);
-                                        findFolder = mrjFileUtilsClass.getDeclaredMethod("findFolder", new Class[] { mrjOSTypeClass });
-                                        getFileCreator = mrjFileUtilsClass.getDeclaredMethod("getFileCreator", new Class[] { File.class });
-                                        getFileType = mrjFileUtilsClass.getDeclaredMethod("getFileType", new Class[] { File.class });
-                                } catch (ClassNotFoundException cnfe) {
-                                        errorMessage = cnfe.getMessage();
-                                        return false;
-                                } catch (NoSuchFieldException nsfe) {
-                                        errorMessage = nsfe.getMessage();
-                                        return false;
-                                } catch (NoSuchMethodException nsme) {
-                                        errorMessage = nsme.getMessage();
-                                        return false;
-                                } catch (SecurityException se) {
-                                        errorMessage = se.getMessage();
-                                        return false;
-                                } catch (IllegalAccessException iae) {
-                                        errorMessage = iae.getMessage();
-                                        return false;
-                                }
-                                break;
-                        case MRJ_3_0:
-                            try {
-                                        Class linker = Class.forName("com.apple.mrj.jdirect.Linker");
-                                        Constructor constructor = linker.getConstructor(new Class[]{ Class.class });
-                                        linkage = constructor.newInstance(new Object[] { BrowserLauncher.class });
-                                } catch (ClassNotFoundException cnfe) {
-                                        errorMessage = cnfe.getMessage();
-                                        return false;
-                                } catch (NoSuchMethodException nsme) {
-                                        errorMessage = nsme.getMessage();
-                                        return false;
-                                } catch (InvocationTargetException ite) {
-                                        errorMessage = ite.getMessage();
-                                        return false;
-                                } catch (InstantiationException ie) {
-                                        errorMessage = ie.getMessage();
-                                        return false;
-                                } catch (IllegalAccessException iae) {
-                                        errorMessage = iae.getMessage();
-                                        return false;
-                                }
-                                break;
-                        case MRJ_3_1:
-                                try {
-                                        mrjFileUtilsClass = Class.forName("com.apple.mrj.MRJFileUtils");
-                                        openURL = mrjFileUtilsClass.getDeclaredMethod("openURL", new Class[] { String.class });
-                                } catch (ClassNotFoundException cnfe) {
-                                        errorMessage = cnfe.getMessage();
-                                        return false;
-                                } catch (NoSuchMethodException nsme) {
-                                        errorMessage = nsme.getMessage();
-                                        return false;
-                                }
-                                break;
-                        default:
-                            break;
-                }
-                return true;
-        }
-
-        /**
-         * Attempts to locate the default web browser on the local system.  Caches results so it
-         * only locates the browser once for each use of this class per JVM instance.
-         * @return The browser for the system.  Note that this may not be what you would consider
-         *                     to be a standard web browser; instead, it's the application that gets called to
-         *                     open the default web browser.  In some cases, this will be a non-String object
-         *                     that provides the means of calling the default browser.
-         */
-        private static Object locateBrowser() {
-                if (browser != null) {
-                        return browser;
-                }
-                switch (jvm) {
-                        case MRJ_2_0:
-                                try {
-                                        Integer finderCreatorCode = (Integer) makeOSType.invoke(null, new Object[] { FINDER_CREATOR });
-                                        Object aeTarget = aeTargetConstructor.newInstance(new Object[] { finderCreatorCode });
-                                        Integer gurlType = (Integer) makeOSType.invoke(null, new Object[] { GURL_EVENT });
-                                        Object appleEvent = appleEventConstructor.newInstance(new Object[] { gurlType, gurlType, aeTarget, kAutoGenerateReturnID, kAnyTransactionID });
-                                        // Don't set browser = appleEvent because then the next time we call
-                                        // locateBrowser(), we'll get the same AppleEvent, to which we'll already have
-                                        // added the relevant parameter. Instead, regenerate the AppleEvent every time.
-                                        // There's probably a way to do this better; if any has any ideas, please let
-                                        // me know.
-                                        return appleEvent;
-                                } catch (IllegalAccessException iae) {
-                                        browser = null;
-                                        errorMessage = iae.getMessage();
-                                        return browser;
-                                } catch (InstantiationException ie) {
-                                        browser = null;
-                                        errorMessage = ie.getMessage();
-                                        return browser;
-                                } catch (InvocationTargetException ite) {
-                                        browser = null;
-                                        errorMessage = ite.getMessage();
-                                        return browser;
-                                }
-                        case MRJ_2_1:
-                                File systemFolder;
-                                try {
-                                        systemFolder = (File) findFolder.invoke(null, new Object[] { kSystemFolderType });
-                                } catch (IllegalArgumentException iare) {
-                                        browser = null;
-                                        errorMessage = iare.getMessage();
-                                        return browser;
-                                } catch (IllegalAccessException iae) {
-                                        browser = null;
-                                        errorMessage = iae.getMessage();
-                                        return browser;
-                                } catch (InvocationTargetException ite) {
-                                        browser = null;
-                                        errorMessage = ite.getTargetException().getClass() + ": " + ite.getTargetException().getMessage();
-                                        return browser;
-                                }
-                                String[] systemFolderFiles = systemFolder.list();
-                                // Avoid a FilenameFilter because that can't be stopped mid-list
-                                for(int i = 0; i < systemFolderFiles.length; i++) {
-                                        try {
-                                                File file = new File(systemFolder, systemFolderFiles[i]);
-                                                if (!file.isFile()) {
-                                                        continue;
-                                                }
-                                                // We're looking for a file with a creator code of 'MACS' and
-                                                // a type of 'FNDR'.  Only requiring the type results in non-Finder
-                                                // applications being picked up on certain Mac OS 9 systems,
-                                                // especially German ones, and sending a GURL event to those
-                                                // applications results in a logout under Multiple Users.
-                                                Object fileType = getFileType.invoke(null, new Object[] { file });
-                                                if (FINDER_TYPE.equals(fileType.toString())) {
-                                                        Object fileCreator = getFileCreator.invoke(null, new Object[] { file });
-                                                        if (FINDER_CREATOR.equals(fileCreator.toString())) {
-                                                                browser = file.toString();     // Actually the Finder, but that's OK
-                                                                return browser;
-                                                        }
-                                                }
-                                        } catch (IllegalArgumentException iare) {
-                                                browser = browser;
-                                                errorMessage = iare.getMessage();
-                                                return null;
-                                        } catch (IllegalAccessException iae) {
-                                                browser = null;
-                                                errorMessage = iae.getMessage();
-                                                return browser;
-                                        } catch (InvocationTargetException ite) {
-                                                browser = null;
-                                                errorMessage = ite.getTargetException().getClass() + ": " + ite.getTargetException().getMessage();
-                                                return browser;
-                                        }
-                                }
-                                browser = null;
-                                break;
-                        case MRJ_3_0:
-                        case MRJ_3_1:
-                                browser = "";  // Return something non-null
-                                break;
-                        case WINDOWS_NT:
-                                browser = "cmd.exe";
-                                break;
-                        case WINDOWS_9x:
-                                browser = "command.com";
-                                break;
-                        case OTHER:
-                        default:
-                                browser = jalview.bin.Cache.applicationProperties.getProperty("jalview.browser");
-                                if (browser==null) {
-                                  // hope firefox exists :-/
-                                  browser = "firefox";
-                                }
-                                break;
-                }
-                return browser;
-        }
-
-        /**
-         * Attempts to open the default web browser to the given URL.
-         * @param url The URL to open
-         * @throws IOException If the web browser could not be located or does not run
-         */
-        public static void openURL(String url) throws IOException {
-                if (!loadedWithoutErrors) {
-                        throw new IOException("Exception in finding browser: " + errorMessage);
-                }
-                Object browser = locateBrowser();
-                if (browser == null) {
-                        throw new IOException("Unable to locate browser: " + errorMessage);
-                }
-
-                switch (jvm) {
-                        case MRJ_2_0:
-                                Object aeDesc = null;
-                                try {
-                                        aeDesc = aeDescConstructor.newInstance(new Object[] { url });
-                                        putParameter.invoke(browser, new Object[] { keyDirectObject, aeDesc });
-                                        sendNoReply.invoke(browser, new Object[] { });
-                                } catch (InvocationTargetException ite) {
-                                        throw new IOException("InvocationTargetException while creating AEDesc: " + ite.getMessage());
-                                } catch (IllegalAccessException iae) {
-                                        throw new IOException("IllegalAccessException while building AppleEvent: " + iae.getMessage());
-                                } catch (InstantiationException ie) {
-                                        throw new IOException("InstantiationException while creating AEDesc: " + ie.getMessage());
-                                } finally {
-                                        aeDesc = null; // Encourage it to get disposed if it was created
-                                        browser = null;        // Ditto
-                                }
-                                break;
-                        case MRJ_2_1:
-                                Runtime.getRuntime().exec(new String[] { (String) browser, url } );
-                                break;
-                        case MRJ_3_0:
-                                int[] instance = new int[1];
-                                int result = ICStart(instance, 0);
-                                if (result == 0) {
-                                        int[] selectionStart = new int[] { 0 };
-                                        byte[] urlBytes = url.getBytes();
-                                        int[] selectionEnd = new int[] { urlBytes.length };
-                                        result = ICLaunchURL(instance[0], new byte[] { 0 }, urlBytes,
-                                                                                        urlBytes.length, selectionStart,
-                                                                                        selectionEnd);
-                                        if (result == 0) {
-                                                // Ignore the return value; the URL was launched successfully
-                                                // regardless of what happens here.
-                                                ICStop(instance);
-                                        } else {
-                                                throw new IOException("Unable to launch URL: " + result);
-                                        }
-                                } else {
-                                        throw new IOException("Unable to create an Internet Config instance: " + result);
-                                }
-                                break;
-                        case MRJ_3_1:
-                                try {
-                                        openURL.invoke(null, new Object[] { url });
-                                } catch (InvocationTargetException ite) {
-                                        throw new IOException("InvocationTargetException while calling openURL: " + ite.getMessage());
-                                } catch (IllegalAccessException iae) {
-                                        throw new IOException("IllegalAccessException while calling openURL: " + iae.getMessage());
-                                }
-                                break;
-                    case WINDOWS_NT:
-                    case WINDOWS_9x:
-                            // Add quotes around the URL to allow ampersands and other special
-                            // characters to work.
-                                Process process = Runtime.getRuntime().exec(new String[] { (String) browser,
-                                                                                                                                FIRST_WINDOWS_PARAMETER,
-                                                                                                                                SECOND_WINDOWS_PARAMETER,
-                                                                                                                                THIRD_WINDOWS_PARAMETER,
-                                                                                                                                '"' + url + '"' });
-                                // This avoids a memory leak on some versions of Java on Windows.
-                                // That's hinted at in <http://developer.java.sun.com/developer/qow/archive/68/>.
-                                try {
-                                        process.waitFor();
-                                        process.exitValue();
-                                } catch (InterruptedException ie) {
-                                        throw new IOException("InterruptedException while launching browser: " + ie.getMessage());
-                                }
-                                break;
-                        case OTHER:
-                                // Assume that we're on Unix and that Netscape (actually Firefox) is installed
-
-                                // First, attempt to open the URL in a currently running session of Netscape
-
-                        // JBPNote log debug
-    /* System.out.println("Executing : "+browser+" "+
-                                                                                                        NETSCAPE_REMOTE_PARAMETER+" "+
-                                                                                                        NETSCAPE_OPEN_PARAMETER_START +
-                                                                                                        url +
-                                                                                                        NETSCAPE_OPEN_NEW_WINDOW +
-                                                                                                        NETSCAPE_OPEN_PARAMETER_END);
-     */
-                            process = Runtime.getRuntime().exec(new String[] { (String) browser,
-                                                                                                        NETSCAPE_REMOTE_PARAMETER,
-                                                                                                        NETSCAPE_OPEN_PARAMETER_START +
-                                                                                                        url +
-                                                                                                        NETSCAPE_OPEN_NEW_WINDOW +
-                                                                                                        NETSCAPE_OPEN_PARAMETER_END });
-                                try {
-                                        int exitCode = process.waitFor();
-                                        if (exitCode != 0) {   // if Netscape was not open
-       // JBPNote log debug
-       //       System.out.println("Executing : "+browser+" "+url+"\n");
-       Runtime.getRuntime().exec(new String[] { (String) browser, url });
-                                        }
-                                } catch (InterruptedException ie) {
-                                        throw new IOException("InterruptedException while launching browser: " + ie.getMessage());
-                                }
-                                break;
-                        default:
-                                // This should never occur, but if it does, we'll try the simplest thing possible
-                                Runtime.getRuntime().exec(new String[] { (String) browser, url });
-                                break;
-                }
-        }
-
-        /**
-         * Methods required for Mac OS X.  The presence of native methods does not cause
-         * any problems on other platforms.
-         */
-        private native static int ICStart(int[] instance, int signature);
-        private native static int ICStop(int[] instance);
-        private native static int ICLaunchURL(int instance, byte[] hint, byte[] data, int len,
-                                                                                        int[] selectionStart, int[] selectionEnd);
-}
+ * The Java virtual machine that we are running on.  Actually, in most cases we only care
+ * about the operating system, but some operating systems require us to switch on the VM. */\r
+    private static int jvm;\r
+\r
+    /** The browser for the system */\r
+    private static Object browser;\r
+\r
+    /**
+ * Caches whether any classes, methods, and fields that are not part of the JDK and need to
+ * be dynamically loaded at runtime loaded successfully.
+ * <p>
+ * Note that if this is <code>false</code>, <code>openURL()</code> will always return an
+ * IOException.
+ */\r
+    private static boolean loadedWithoutErrors;\r
+\r
+    /** The com.apple.mrj.MRJFileUtils class */\r
+    private static Class mrjFileUtilsClass;\r
+\r
+    /** The com.apple.mrj.MRJOSType class */\r
+    private static Class mrjOSTypeClass;\r
+\r
+    /** The com.apple.MacOS.AEDesc class */\r
+    private static Class aeDescClass;\r
+\r
+    /** The &lt;init&gt;(int) method of com.apple.MacOS.AETarget */\r
+    private static Constructor aeTargetConstructor;\r
+\r
+    /** The &lt;init&gt;(int, int, int) method of com.apple.MacOS.AppleEvent */\r
+    private static Constructor appleEventConstructor;\r
+\r
+    /** The &lt;init&gt;(String) method of com.apple.MacOS.AEDesc */\r
+    private static Constructor aeDescConstructor;\r
+\r
+    /** The findFolder method of com.apple.mrj.MRJFileUtils */\r
+    private static Method findFolder;\r
+\r
+    /** The getFileCreator method of com.apple.mrj.MRJFileUtils */\r
+    private static Method getFileCreator;\r
+\r
+    /** The getFileType method of com.apple.mrj.MRJFileUtils */\r
+    private static Method getFileType;\r
+\r
+    /** The openURL method of com.apple.mrj.MRJFileUtils */\r
+    private static Method openURL;\r
+\r
+    /** The makeOSType method of com.apple.MacOS.OSUtils */\r
+    private static Method makeOSType;\r
+\r
+    /** The putParameter method of com.apple.MacOS.AppleEvent */\r
+    private static Method putParameter;\r
+\r
+    /** The sendNoReply method of com.apple.MacOS.AppleEvent */\r
+    private static Method sendNoReply;\r
+\r
+    /** Actually an MRJOSType pointing to the System Folder on a Macintosh */\r
+    private static Object kSystemFolderType;\r
+\r
+    /** The keyDirectObject AppleEvent parameter type */\r
+    private static Integer keyDirectObject;\r
+\r
+    /** The kAutoGenerateReturnID AppleEvent code */\r
+    private static Integer kAutoGenerateReturnID;\r
+\r
+    /** The kAnyTransactionID AppleEvent code */\r
+    private static Integer kAnyTransactionID;\r
+\r
+    /** The linkage object required for JDirect 3 on Mac OS X. */\r
+    private static Object linkage;\r
+\r
+    /** The framework to reference on Mac OS X */\r
+    private static final String JDirect_MacOSX = "/System/Library/Frameworks/Carbon.framework/Frameworks/HIToolbox.framework/HIToolbox";\r
+\r
+    /** JVM constant for MRJ 2.0 */\r
+    private static final int MRJ_2_0 = 0;\r
+\r
+    /** JVM constant for MRJ 2.1 or later */\r
+    private static final int MRJ_2_1 = 1;\r
+\r
+    /** JVM constant for Java on Mac OS X 10.0 (MRJ 3.0) */\r
+    private static final int MRJ_3_0 = 3;\r
+\r
+    /** JVM constant for MRJ 3.1 */\r
+    private static final int MRJ_3_1 = 4;\r
+\r
+    /** JVM constant for any Windows NT JVM */\r
+    private static final int WINDOWS_NT = 5;\r
+\r
+    /** JVM constant for any Windows 9x JVM */\r
+    private static final int WINDOWS_9x = 6;\r
+\r
+    /** JVM constant for any other platform */\r
+    private static final int OTHER = -1;\r
+\r
+    /**
+ * The file type of the Finder on a Macintosh.  Hardcoding "Finder" would keep non-U.S. English
+ * systems from working properly.
+ */\r
+    private static final String FINDER_TYPE = "FNDR";\r
+\r
+    /**
+ * The creator code of the Finder on a Macintosh, which is needed to send AppleEvents to the
+ * application.
+ */\r
+    private static final String FINDER_CREATOR = "MACS";\r
+\r
+    /** The name for the AppleEvent type corresponding to a GetURL event. */\r
+    private static final String GURL_EVENT = "GURL";\r
+\r
+    /**
+ * The first parameter that needs to be passed into Runtime.exec() to open the default web
+ * browser on Windows.
+ */\r
+    private static final String FIRST_WINDOWS_PARAMETER = "/c";\r
+\r
+    /** The second parameter for Runtime.exec() on Windows. */\r
+    private static final String SECOND_WINDOWS_PARAMETER = "start";\r
+\r
+    /**
+ * The third parameter for Runtime.exec() on Windows.  This is a "title"
+ * parameter that the command line expects.  Setting this parameter allows
+ * URLs containing spaces to work.
+ */\r
+    private static final String THIRD_WINDOWS_PARAMETER = "\"\"";\r
+\r
+    /**
+ * The shell parameters for Netscape that opens a given URL in an already-open copy of Netscape
+ * on many command-line systems.
+ */\r
+    private static final String NETSCAPE_REMOTE_PARAMETER = "-remote";\r
+    private static final String NETSCAPE_OPEN_PARAMETER_START = "openURL(";\r
+    private static final String NETSCAPE_OPEN_NEW_WINDOW = ", new-window";\r
+    private static final String NETSCAPE_OPEN_PARAMETER_END = ")";\r
+\r
+    /**
+ * The message from any exception thrown throughout the initialization process.
+ */\r
+    private static String errorMessage;\r
+\r
+    /**
+ * An initialization block that determines the operating system and loads the necessary
+ * runtime data.
+ */\r
+    static {\r
+        loadedWithoutErrors = true;\r
+\r
+        String osName = System.getProperty("os.name");\r
+\r
+        if (osName.startsWith("Mac OS")) {\r
+            String mrjVersion = System.getProperty("mrj.version");\r
+            String majorMRJVersion = mrjVersion.substring(0, 3);\r
+\r
+            try {\r
+                double version = Double.valueOf(majorMRJVersion).doubleValue();\r
+\r
+                if (version == 2) {\r
+                    jvm = MRJ_2_0;\r
+                } else if ((version >= 2.1) && (version < 3)) {\r
+                    // Assume that all 2.x versions of MRJ work the same.  MRJ 2.1 actually\r
+                    // works via Runtime.exec() and 2.2 supports that but has an openURL() method\r
+                    // as well that we currently ignore.\r
+                    jvm = MRJ_2_1;\r
+                } else if (version == 3.0) {\r
+                    jvm = MRJ_3_0;\r
+                } else if (version >= 3.1) {\r
+                    // Assume that all 3.1 and later versions of MRJ work the same.\r
+                    jvm = MRJ_3_1;\r
+                } else {\r
+                    loadedWithoutErrors = false;\r
+                    errorMessage = "Unsupported MRJ version: " + version;\r
+                }\r
+            } catch (NumberFormatException nfe) {\r
+                loadedWithoutErrors = false;\r
+                errorMessage = "Invalid MRJ version: " + mrjVersion;\r
+            }\r
+        } else if (osName.startsWith("Windows")) {\r
+            if (osName.indexOf("9") != -1) {\r
+                jvm = WINDOWS_9x;\r
+            } else {\r
+                jvm = WINDOWS_NT;\r
+            }\r
+        } else {\r
+            jvm = OTHER;\r
+        }\r
+\r
+        if (loadedWithoutErrors) { // if we haven't hit any errors yet\r
+            loadedWithoutErrors = loadClasses();\r
+        }\r
+    }\r
+\r
+    /**
+ * This class should be never be instantiated; this just ensures so.
+ */\r
+    private BrowserLauncher() {\r
+    }\r
+\r
+    /**
+ * Called by a static initializer to load any classes, fields, and methods required at runtime
+ * to locate the user's web browser.
+ * @return <code>true</code> if all intialization succeeded
+ *                        <code>false</code> if any portion of the initialization failed
+ */\r
+    private static boolean loadClasses() {\r
+        switch (jvm) {\r
+        case MRJ_2_0:\r
+\r
+            try {\r
+                Class aeTargetClass = Class.forName("com.apple.MacOS.AETarget");\r
+                Class osUtilsClass = Class.forName("com.apple.MacOS.OSUtils");\r
+                Class appleEventClass = Class.forName(\r
+                        "com.apple.MacOS.AppleEvent");\r
+                Class aeClass = Class.forName("com.apple.MacOS.ae");\r
+                aeDescClass = Class.forName("com.apple.MacOS.AEDesc");\r
+\r
+                aeTargetConstructor = aeTargetClass.getDeclaredConstructor(new Class[] {\r
+                            int.class\r
+                        });\r
+                appleEventConstructor = appleEventClass.getDeclaredConstructor(new Class[] {\r
+                            int.class, int.class, aeTargetClass, int.class,\r
+                            int.class\r
+                        });\r
+                aeDescConstructor = aeDescClass.getDeclaredConstructor(new Class[] {\r
+                            String.class\r
+                        });\r
+\r
+                makeOSType = osUtilsClass.getDeclaredMethod("makeOSType",\r
+                        new Class[] { String.class });\r
+                putParameter = appleEventClass.getDeclaredMethod("putParameter",\r
+                        new Class[] { int.class, aeDescClass });\r
+                sendNoReply = appleEventClass.getDeclaredMethod("sendNoReply",\r
+                        new Class[] {  });\r
+\r
+                Field keyDirectObjectField = aeClass.getDeclaredField(\r
+                        "keyDirectObject");\r
+                keyDirectObject = (Integer) keyDirectObjectField.get(null);\r
+\r
+                Field autoGenerateReturnIDField = appleEventClass.getDeclaredField(\r
+                        "kAutoGenerateReturnID");\r
+                kAutoGenerateReturnID = (Integer) autoGenerateReturnIDField.get(null);\r
+\r
+                Field anyTransactionIDField = appleEventClass.getDeclaredField(\r
+                        "kAnyTransactionID");\r
+                kAnyTransactionID = (Integer) anyTransactionIDField.get(null);\r
+            } catch (ClassNotFoundException cnfe) {\r
+                errorMessage = cnfe.getMessage();\r
+\r
+                return false;\r
+            } catch (NoSuchMethodException nsme) {\r
+                errorMessage = nsme.getMessage();\r
+\r
+                return false;\r
+            } catch (NoSuchFieldException nsfe) {\r
+                errorMessage = nsfe.getMessage();\r
+\r
+                return false;\r
+            } catch (IllegalAccessException iae) {\r
+                errorMessage = iae.getMessage();\r
+\r
+                return false;\r
+            }\r
+\r
+            break;\r
+\r
+        case MRJ_2_1:\r
+\r
+            try {\r
+                mrjFileUtilsClass = Class.forName("com.apple.mrj.MRJFileUtils");\r
+                mrjOSTypeClass = Class.forName("com.apple.mrj.MRJOSType");\r
+\r
+                Field systemFolderField = mrjFileUtilsClass.getDeclaredField(\r
+                        "kSystemFolderType");\r
+                kSystemFolderType = systemFolderField.get(null);\r
+                findFolder = mrjFileUtilsClass.getDeclaredMethod("findFolder",\r
+                        new Class[] { mrjOSTypeClass });\r
+                getFileCreator = mrjFileUtilsClass.getDeclaredMethod("getFileCreator",\r
+                        new Class[] { File.class });\r
+                getFileType = mrjFileUtilsClass.getDeclaredMethod("getFileType",\r
+                        new Class[] { File.class });\r
+            } catch (ClassNotFoundException cnfe) {\r
+                errorMessage = cnfe.getMessage();\r
+\r
+                return false;\r
+            } catch (NoSuchFieldException nsfe) {\r
+                errorMessage = nsfe.getMessage();\r
+\r
+                return false;\r
+            } catch (NoSuchMethodException nsme) {\r
+                errorMessage = nsme.getMessage();\r
+\r
+                return false;\r
+            } catch (SecurityException se) {\r
+                errorMessage = se.getMessage();\r
+\r
+                return false;\r
+            } catch (IllegalAccessException iae) {\r
+                errorMessage = iae.getMessage();\r
+\r
+                return false;\r
+            }\r
+\r
+            break;\r
+\r
+        case MRJ_3_0:\r
+\r
+            try {\r
+                Class linker = Class.forName("com.apple.mrj.jdirect.Linker");\r
+                Constructor constructor = linker.getConstructor(new Class[] {\r
+                            Class.class\r
+                        });\r
+                linkage = constructor.newInstance(new Object[] {\r
+                            BrowserLauncher.class\r
+                        });\r
+            } catch (ClassNotFoundException cnfe) {\r
+                errorMessage = cnfe.getMessage();\r
+\r
+                return false;\r
+            } catch (NoSuchMethodException nsme) {\r
+                errorMessage = nsme.getMessage();\r
+\r
+                return false;\r
+            } catch (InvocationTargetException ite) {\r
+                errorMessage = ite.getMessage();\r
+\r
+                return false;\r
+            } catch (InstantiationException ie) {\r
+                errorMessage = ie.getMessage();\r
+\r
+                return false;\r
+            } catch (IllegalAccessException iae) {\r
+                errorMessage = iae.getMessage();\r
+\r
+                return false;\r
+            }\r
+\r
+            break;\r
+\r
+        case MRJ_3_1:\r
+\r
+            try {\r
+                mrjFileUtilsClass = Class.forName("com.apple.mrj.MRJFileUtils");\r
+                openURL = mrjFileUtilsClass.getDeclaredMethod("openURL",\r
+                        new Class[] { String.class });\r
+            } catch (ClassNotFoundException cnfe) {\r
+                errorMessage = cnfe.getMessage();\r
+\r
+                return false;\r
+            } catch (NoSuchMethodException nsme) {\r
+                errorMessage = nsme.getMessage();\r
+\r
+                return false;\r
+            }\r
+\r
+            break;\r
+\r
+        default:\r
+            break;\r
+        }\r
+\r
+        return true;\r
+    }\r
+\r
+    /**
+ * Attempts to locate the default web browser on the local system.  Caches results so it
+ * only locates the browser once for each use of this class per JVM instance.
+ * @return The browser for the system.  Note that this may not be what you would consider
+ *                        to be a standard web browser; instead, it's the application that gets called to
+ *                        open the default web browser.  In some cases, this will be a non-String object
+ *                        that provides the means of calling the default browser.
+ */\r
+    private static Object locateBrowser() {\r
+        if (browser != null) {\r
+            return browser;\r
+        }\r
+\r
+        switch (jvm) {\r
+        case MRJ_2_0:\r
+\r
+            try {\r
+                Integer finderCreatorCode = (Integer) makeOSType.invoke(null,\r
+                        new Object[] { FINDER_CREATOR });\r
+                Object aeTarget = aeTargetConstructor.newInstance(new Object[] {\r
+                            finderCreatorCode\r
+                        });\r
+                Integer gurlType = (Integer) makeOSType.invoke(null,\r
+                        new Object[] { GURL_EVENT });\r
+                Object appleEvent = appleEventConstructor.newInstance(new Object[] {\r
+                            gurlType, gurlType, aeTarget, kAutoGenerateReturnID,\r
+                            kAnyTransactionID\r
+                        });\r
+\r
+                // Don't set browser = appleEvent because then the next time we call\r
+                // locateBrowser(), we'll get the same AppleEvent, to which we'll already have\r
+                // added the relevant parameter. Instead, regenerate the AppleEvent every time.\r
+                // There's probably a way to do this better; if any has any ideas, please let\r
+                // me know.\r
+                return appleEvent;\r
+            } catch (IllegalAccessException iae) {\r
+                browser = null;\r
+                errorMessage = iae.getMessage();\r
+\r
+                return browser;\r
+            } catch (InstantiationException ie) {\r
+                browser = null;\r
+                errorMessage = ie.getMessage();\r
+\r
+                return browser;\r
+            } catch (InvocationTargetException ite) {\r
+                browser = null;\r
+                errorMessage = ite.getMessage();\r
+\r
+                return browser;\r
+            }\r
+\r
+        case MRJ_2_1:\r
+\r
+            File systemFolder;\r
+\r
+            try {\r
+                systemFolder = (File) findFolder.invoke(null,\r
+                        new Object[] { kSystemFolderType });\r
+            } catch (IllegalArgumentException iare) {\r
+                browser = null;\r
+                errorMessage = iare.getMessage();\r
+\r
+                return browser;\r
+            } catch (IllegalAccessException iae) {\r
+                browser = null;\r
+                errorMessage = iae.getMessage();\r
+\r
+                return browser;\r
+            } catch (InvocationTargetException ite) {\r
+                browser = null;\r
+                errorMessage = ite.getTargetException().getClass() + ": " +\r
+                    ite.getTargetException().getMessage();\r
+\r
+                return browser;\r
+            }\r
+\r
+            String[] systemFolderFiles = systemFolder.list();\r
+\r
+            // Avoid a FilenameFilter because that can't be stopped mid-list\r
+            for (int i = 0; i < systemFolderFiles.length; i++) {\r
+                try {\r
+                    File file = new File(systemFolder, systemFolderFiles[i]);\r
+\r
+                    if (!file.isFile()) {\r
+                        continue;\r
+                    }\r
+\r
+                    // We're looking for a file with a creator code of 'MACS' and\r
+                    // a type of 'FNDR'.  Only requiring the type results in non-Finder\r
+                    // applications being picked up on certain Mac OS 9 systems,\r
+                    // especially German ones, and sending a GURL event to those\r
+                    // applications results in a logout under Multiple Users.\r
+                    Object fileType = getFileType.invoke(null,\r
+                            new Object[] { file });\r
+\r
+                    if (FINDER_TYPE.equals(fileType.toString())) {\r
+                        Object fileCreator = getFileCreator.invoke(null,\r
+                                new Object[] { file });\r
+\r
+                        if (FINDER_CREATOR.equals(fileCreator.toString())) {\r
+                            browser = file.toString(); // Actually the Finder, but that's OK\r
+\r
+                            return browser;\r
+                        }\r
+                    }\r
+                } catch (IllegalArgumentException iare) {\r
+                    browser = browser;\r
+                    errorMessage = iare.getMessage();\r
+\r
+                    return null;\r
+                } catch (IllegalAccessException iae) {\r
+                    browser = null;\r
+                    errorMessage = iae.getMessage();\r
+\r
+                    return browser;\r
+                } catch (InvocationTargetException ite) {\r
+                    browser = null;\r
+                    errorMessage = ite.getTargetException().getClass() + ": " +\r
+                        ite.getTargetException().getMessage();\r
+\r
+                    return browser;\r
+                }\r
+            }\r
+\r
+            browser = null;\r
+\r
+            break;\r
+\r
+        case MRJ_3_0:\r
+        case MRJ_3_1:\r
+            browser = ""; // Return something non-null\r
+\r
+            break;\r
+\r
+        case WINDOWS_NT:\r
+            browser = "cmd.exe";\r
+\r
+            break;\r
+\r
+        case WINDOWS_9x:\r
+            browser = "command.com";\r
+\r
+            break;\r
+\r
+        case OTHER:default:\r
+            browser = jalview.bin.Cache.applicationProperties.getProperty(\r
+                    "jalview.browser");\r
+\r
+            if (browser == null) {\r
+                // hope firefox exists :-/\r
+                browser = "firefox";\r
+            }\r
+\r
+            break;\r
+        }\r
+\r
+        return browser;\r
+    }\r
+\r
+    /**
+ * Attempts to open the default web browser to the given URL.
+ * @param url The URL to open
+ * @throws IOException If the web browser could not be located or does not run
+ */\r
+    public static void openURL(String url) throws IOException {\r
+        if (!loadedWithoutErrors) {\r
+            throw new IOException("Exception in finding browser: " +\r
+                errorMessage);\r
+        }\r
+\r
+        Object browser = locateBrowser();\r
+\r
+        if (browser == null) {\r
+            throw new IOException("Unable to locate browser: " + errorMessage);\r
+        }\r
+\r
+        switch (jvm) {\r
+        case MRJ_2_0:\r
+\r
+            Object aeDesc = null;\r
+\r
+            try {\r
+                aeDesc = aeDescConstructor.newInstance(new Object[] { url });\r
+                putParameter.invoke(browser,\r
+                    new Object[] { keyDirectObject, aeDesc });\r
+                sendNoReply.invoke(browser, new Object[] {  });\r
+            } catch (InvocationTargetException ite) {\r
+                throw new IOException(\r
+                    "InvocationTargetException while creating AEDesc: " +\r
+                    ite.getMessage());\r
+            } catch (IllegalAccessException iae) {\r
+                throw new IOException(\r
+                    "IllegalAccessException while building AppleEvent: " +\r
+                    iae.getMessage());\r
+            } catch (InstantiationException ie) {\r
+                throw new IOException(\r
+                    "InstantiationException while creating AEDesc: " +\r
+                    ie.getMessage());\r
+            } finally {\r
+                aeDesc = null; // Encourage it to get disposed if it was created\r
+                browser = null; // Ditto\r
+            }\r
+\r
+            break;\r
+\r
+        case MRJ_2_1:\r
+            Runtime.getRuntime().exec(new String[] { (String) browser, url });\r
+\r
+            break;\r
+\r
+        case MRJ_3_0:\r
+\r
+            int[] instance = new int[1];\r
+            int result = ICStart(instance, 0);\r
+\r
+            if (result == 0) {\r
+                int[] selectionStart = new int[] { 0 };\r
+                byte[] urlBytes = url.getBytes();\r
+                int[] selectionEnd = new int[] { urlBytes.length };\r
+                result = ICLaunchURL(instance[0], new byte[] { 0 }, urlBytes,\r
+                        urlBytes.length, selectionStart, selectionEnd);\r
+\r
+                if (result == 0) {\r
+                    // Ignore the return value; the URL was launched successfully\r
+                    // regardless of what happens here.\r
+                    ICStop(instance);\r
+                } else {\r
+                    throw new IOException("Unable to launch URL: " + result);\r
+                }\r
+            } else {\r
+                throw new IOException(\r
+                    "Unable to create an Internet Config instance: " + result);\r
+            }\r
+\r
+            break;\r
+\r
+        case MRJ_3_1:\r
+\r
+            try {\r
+                openURL.invoke(null, new Object[] { url });\r
+            } catch (InvocationTargetException ite) {\r
+                throw new IOException(\r
+                    "InvocationTargetException while calling openURL: " +\r
+                    ite.getMessage());\r
+            } catch (IllegalAccessException iae) {\r
+                throw new IOException(\r
+                    "IllegalAccessException while calling openURL: " +\r
+                    iae.getMessage());\r
+            }\r
+\r
+            break;\r
+\r
+        case WINDOWS_NT:\r
+        case WINDOWS_9x:\r
+\r
+            // Add quotes around the URL to allow ampersands and other special\r
+            // characters to work.\r
+            Process process = Runtime.getRuntime().exec(new String[] {\r
+                        (String) browser, FIRST_WINDOWS_PARAMETER,\r
+                        SECOND_WINDOWS_PARAMETER, THIRD_WINDOWS_PARAMETER,\r
+                        '"' + url + '"'\r
+                    });\r
+\r
+            // This avoids a memory leak on some versions of Java on Windows.\r
+            // That's hinted at in <http://developer.java.sun.com/developer/qow/archive/68/>.\r
+            try {\r
+                process.waitFor();\r
+                process.exitValue();\r
+            } catch (InterruptedException ie) {\r
+                throw new IOException(\r
+                    "InterruptedException while launching browser: " +\r
+                    ie.getMessage());\r
+            }\r
+\r
+            break;\r
+\r
+        case OTHER:\r
+\r
+            // Assume that we're on Unix and that Netscape (actually Firefox) is installed\r
+            // First, attempt to open the URL in a currently running session of Netscape\r
+            // JBPNote log debug\r
+\r
+            /* System.out.println("Executing : "+browser+" "+
+                                                                                                    NETSCAPE_REMOTE_PARAMETER+" "+
+                                                                                                    NETSCAPE_OPEN_PARAMETER_START +
+                                                                                                    url +
+                                                                                                    NETSCAPE_OPEN_NEW_WINDOW +
+                                                                                                    NETSCAPE_OPEN_PARAMETER_END);
+ */\r
+            process = Runtime.getRuntime().exec(new String[] {\r
+                        (String) browser, NETSCAPE_REMOTE_PARAMETER,\r
+                        \r
+                    NETSCAPE_OPEN_PARAMETER_START + url +\r
+                        NETSCAPE_OPEN_NEW_WINDOW + NETSCAPE_OPEN_PARAMETER_END\r
+                    });\r
+\r
+            try {\r
+                int exitCode = process.waitFor();\r
+\r
+                if (exitCode != 0) { // if Netscape was not open\r
+                    Runtime.getRuntime().exec(new String[] { (String) browser, url });\r
+                }\r
+            } catch (InterruptedException ie) {\r
+                throw new IOException(\r
+                    "InterruptedException while launching browser: " +\r
+                    ie.getMessage());\r
+            }\r
+\r
+            break;\r
+\r
+        default:\r
+\r
+            // This should never occur, but if it does, we'll try the simplest thing possible\r
+            Runtime.getRuntime().exec(new String[] { (String) browser, url });\r
+\r
+            break;\r
+        }\r
+    }\r
+\r
+    /**
+ * Methods required for Mac OS X.  The presence of native methods does not cause
+ * any problems on other platforms.
+ */\r
+    private native static int ICStart(int[] instance, int signature);\r
+\r
+    private native static int ICStop(int[] instance);\r
+\r
+    private native static int ICLaunchURL(int instance, byte[] hint,\r
+        byte[] data, int len, int[] selectionStart, int[] selectionEnd);\r
+}\r
index 320855a..8041d80 100755 (executable)
 * 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.util;\r
 \r
 import jalview.datamodel.*;\r
 \r
+\r
 public class Comparison {\r
+    public static String GapChars = " .-";\r
 \r
-  public static float compare(SequenceI ii, SequenceI jj)\r
-  {\r
-    return Comparison.compare(ii,jj,0,ii.getLength()-1);\r
-  }\r
-  /**\r
-   * this was supposed to be an ungapped pid calculation\r
-   * @param ii SequenceI\r
-   * @param jj SequenceI\r
-   * @param start int\r
-   * @param end int\r
-   * @return float\r
-   */\r
-  public static float compare(SequenceI ii, SequenceI jj, int start, int end) {\r
-\r
-     String si   = ii.getSequence();\r
-     String sj   = jj.getSequence();\r
-\r
-     int ilen = si.length()-1;\r
-     int jlen = sj.length()-1;\r
-\r
-     while (jalview.util.Comparison.isGap(si.charAt(start + ilen)))\r
-     {\r
-       ilen--;\r
-     }\r
-\r
-     while (jalview.util.Comparison.isGap(sj.charAt(start + jlen)))\r
-     {\r
-       jlen--;\r
-     }\r
-\r
-     int   count = 0;\r
-     int   match = 0;\r
-     float pid   = -1;\r
-\r
-     if (ilen > jlen) {\r
-\r
-       for (int j = 0; j < jlen; j++) {\r
-         if (si.substring(start + j,start + j+1).equals(sj.substring(start + j,start + j+1))) {\r
-           match++;\r
-         }\r
-         count++;\r
-       }\r
-       pid = (float)match/(float)ilen * 100;\r
-     } else {\r
-       for (int j = 0; j < jlen; j++) {\r
-         if (si.substring(start + j,start + j+1).equals(sj.substring(start + j,start + j+1))) {\r
-           match++;\r
-         }\r
-         count++;\r
-       }\r
-       pid = (float)match/(float)jlen * 100;\r
-     }\r
-\r
-    return pid;\r
-  }\r
-\r
-  /**\r
-   * this is a gapped PID calculation\r
-   *\r
-   * @param s1 SequenceI\r
-   * @param s2 SequenceI\r
-   * @return float\r
-   */\r
-  public static float PID(SequenceI s1 , SequenceI s2)\r
-  {\r
-    int len;\r
-\r
-    if (s1.getSequence().length() > s2.getSequence().length())\r
-      len = s1.getSequence().length();\r
-    else\r
-      len = s2.getSequence().length();\r
-\r
-\r
-    int bad = 0;\r
-\r
-    for (int i = 0; i < len; i++)\r
-    {\r
-      char chr1;\r
-      char chr2;\r
-\r
-      if (i < s1.getSequence().length())\r
-        chr1 = s1.getSequence().charAt(i);\r
-      else\r
-        chr1 = '.';\r
-\r
-\r
-      if (i < s2.getSequence().length())\r
-        chr2 = s2.getSequence().charAt(i);\r
-      else\r
-        chr2 = '.';\r
-\r
-\r
-      if (!(jalview.util.Comparison.isGap( chr1 ))  &&  !(jalview.util.Comparison.isGap( chr2 )))\r
-      {\r
-        if (chr1!=chr2)\r
-          bad++;\r
-      }\r
+    public static float compare(SequenceI ii, SequenceI jj) {\r
+        return Comparison.compare(ii, jj, 0, ii.getLength() - 1);\r
     }\r
 \r
-    return (float)100*(len-bad)/len;\r
-  }\r
-\r
-  // Another pid with region specification\r
-\r
-  public static float PID(SequenceI s1 , SequenceI s2, int start, int end)\r
-  {\r
-    int len;\r
-\r
-    if (s1.getSequence().length() > s2.getSequence().length())\r
-      len = s1.getSequence().length();\r
-    else\r
-      len = s2.getSequence().length();\r
-\r
-    if (end<len)\r
-      len=end;\r
-\r
-    if (len<start) {\r
-      start = len - 1; // we just use a single residue for the difference\r
+    /**\r
+     * this was supposed to be an ungapped pid calculation\r
+     * @param ii SequenceI\r
+     * @param jj SequenceI\r
+     * @param start int\r
+     * @param end int\r
+     * @return float\r
+     */\r
+    public static float compare(SequenceI ii, SequenceI jj, int start, int end) {\r
+        String si = ii.getSequence();\r
+        String sj = jj.getSequence();\r
+\r
+        int ilen = si.length() - 1;\r
+        int jlen = sj.length() - 1;\r
+\r
+        while (jalview.util.Comparison.isGap(si.charAt(start + ilen))) {\r
+            ilen--;\r
+        }\r
+\r
+        while (jalview.util.Comparison.isGap(sj.charAt(start + jlen))) {\r
+            jlen--;\r
+        }\r
+\r
+        int count = 0;\r
+        int match = 0;\r
+        float pid = -1;\r
+\r
+        if (ilen > jlen) {\r
+            for (int j = 0; j < jlen; j++) {\r
+                if (si.substring(start + j, start + j + 1).equals(sj.substring(start +\r
+                                j, start + j + 1))) {\r
+                    match++;\r
+                }\r
+\r
+                count++;\r
+            }\r
+\r
+            pid = (float) match / (float) ilen * 100;\r
+        } else {\r
+            for (int j = 0; j < jlen; j++) {\r
+                if (si.substring(start + j, start + j + 1).equals(sj.substring(start +\r
+                                j, start + j + 1))) {\r
+                    match++;\r
+                }\r
+\r
+                count++;\r
+            }\r
+\r
+            pid = (float) match / (float) jlen * 100;\r
+        }\r
+\r
+        return pid;\r
     }\r
 \r
-    int bad = 0;\r
-\r
-    for (int i = start; i < len; i++)\r
-    {\r
-      char chr1;\r
-      char chr2;\r
-\r
-      if (i < s1.getSequence().length())\r
-        chr1 = s1.getSequence().charAt(i);\r
-      else\r
-        chr1 = '.';\r
-\r
-\r
-      if (i < s2.getSequence().length())\r
-        chr2 = s2.getSequence().charAt(i);\r
-      else\r
-        chr2 = '.';\r
-\r
-\r
-      if (!(jalview.util.Comparison.isGap( chr1 ))  &&  !(jalview.util.Comparison.isGap( chr2 )))\r
-      {\r
-        if (chr1!=chr2)\r
-          bad++;\r
-      }\r
+    /**\r
+     * this is a gapped PID calculation\r
+     *\r
+     * @param s1 SequenceI\r
+     * @param s2 SequenceI\r
+     * @return float\r
+     */\r
+    public static float PID(SequenceI s1, SequenceI s2) {\r
+        int len;\r
+\r
+        if (s1.getSequence().length() > s2.getSequence().length()) {\r
+            len = s1.getSequence().length();\r
+        } else {\r
+            len = s2.getSequence().length();\r
+        }\r
+\r
+        int bad = 0;\r
+\r
+        for (int i = 0; i < len; i++) {\r
+            char chr1;\r
+            char chr2;\r
+\r
+            if (i < s1.getSequence().length()) {\r
+                chr1 = s1.getSequence().charAt(i);\r
+            } else {\r
+                chr1 = '.';\r
+            }\r
+\r
+            if (i < s2.getSequence().length()) {\r
+                chr2 = s2.getSequence().charAt(i);\r
+            } else {\r
+                chr2 = '.';\r
+            }\r
+\r
+            if (!(jalview.util.Comparison.isGap(chr1)) &&\r
+                    !(jalview.util.Comparison.isGap(chr2))) {\r
+                if (chr1 != chr2) {\r
+                    bad++;\r
+                }\r
+            }\r
+        }\r
+\r
+        return ((float) 100 * (len - bad)) / len;\r
     }\r
 \r
-    return (float)100*(len-bad)/len;\r
-  }\r
-\r
+    // Another pid with region specification\r
+    public static float PID(SequenceI s1, SequenceI s2, int start, int end) {\r
+        int len;\r
+\r
+        if (s1.getSequence().length() > s2.getSequence().length()) {\r
+            len = s1.getSequence().length();\r
+        } else {\r
+            len = s2.getSequence().length();\r
+        }\r
+\r
+        if (end < len) {\r
+            len = end;\r
+        }\r
+\r
+        if (len < start) {\r
+            start = len - 1; // we just use a single residue for the difference\r
+        }\r
+\r
+        int bad = 0;\r
+\r
+        for (int i = start; i < len; i++) {\r
+            char chr1;\r
+            char chr2;\r
+\r
+            if (i < s1.getSequence().length()) {\r
+                chr1 = s1.getSequence().charAt(i);\r
+            } else {\r
+                chr1 = '.';\r
+            }\r
+\r
+            if (i < s2.getSequence().length()) {\r
+                chr2 = s2.getSequence().charAt(i);\r
+            } else {\r
+                chr2 = '.';\r
+            }\r
+\r
+            if (!(jalview.util.Comparison.isGap(chr1)) &&\r
+                    !(jalview.util.Comparison.isGap(chr2))) {\r
+                if (chr1 != chr2) {\r
+                    bad++;\r
+                }\r
+            }\r
+        }\r
+\r
+        return ((float) 100 * (len - bad)) / len;\r
+    }\r
 \r
-  public static String GapChars = " .-";\r
-  public static boolean isGap(char c)\r
-  {\r
-    return  (c != '.' && c != '-' && c != ' ') ? false : true;\r
-  }\r
+    public static boolean isGap(char c) {\r
+        return ((c != '.') && (c != '-') && (c != ' ')) ? false : true;\r
+    }\r
 }\r
index 798dc8f..4c47f65 100755 (executable)
  * @version 1.03 25 Oct 1997\r
  * @author Cay Horstmann\r
  */\r
-\r
-\r
 package jalview.util;\r
 \r
 import java.io.*;\r
 \r
+\r
 public class Format {\r
+    private int width;\r
+    private int precision;\r
+    private String pre;\r
+    private String post;\r
+    private boolean leading_zeroes;\r
+    private boolean show_plus;\r
+    private boolean alternate;\r
+    private boolean show_space;\r
+    private boolean left_align;\r
+    private char fmt; // one of cdeEfgGiosxXos\r
+\r
+    public Format(String s) {\r
+        width = 0;\r
+        precision = -1;\r
+        pre = "";\r
+        post = "";\r
+        leading_zeroes = false;\r
+        show_plus = false;\r
+        alternate = false;\r
+        show_space = false;\r
+        left_align = false;\r
+        fmt = ' ';\r
+\r
+        int state = 0;\r
+        int length = s.length();\r
+        int parse_state = 0;\r
+\r
+        // 0 = prefix, 1 = flags, 2 = width, 3 = precision,\r
+        // 4 = format, 5 = end\r
+        int i = 0;\r
+\r
+        while (parse_state == 0) {\r
+            if (i >= length) {\r
+                parse_state = 5;\r
+            } else if (s.charAt(i) == '%') {\r
+                if (i < (length - 1)) {\r
+                    if (s.charAt(i + 1) == '%') {\r
+                        pre = pre + '%';\r
+                        i++;\r
+                    } else {\r
+                        parse_state = 1;\r
+                    }\r
+                } else {\r
+                    throw new java.lang.IllegalArgumentException();\r
+                }\r
+            } else {\r
+                pre = pre + s.charAt(i);\r
+            }\r
+\r
+            i++;\r
+        }\r
+\r
+        while (parse_state == 1) {\r
+            if (i >= length) {\r
+                parse_state = 5;\r
+            } else if (s.charAt(i) == ' ') {\r
+                show_space = true;\r
+            } else if (s.charAt(i) == '-') {\r
+                left_align = true;\r
+            } else if (s.charAt(i) == '+') {\r
+                show_plus = true;\r
+            } else if (s.charAt(i) == '0') {\r
+                leading_zeroes = true;\r
+            } else if (s.charAt(i) == '#') {\r
+                alternate = true;\r
+            } else {\r
+                parse_state = 2;\r
+                i--;\r
+            }\r
+\r
+            i++;\r
+        }\r
+\r
+        while (parse_state == 2) {\r
+            if (i >= length) {\r
+                parse_state = 5;\r
+            } else if (('0' <= s.charAt(i)) && (s.charAt(i) <= '9')) {\r
+                width = ((width * 10) + s.charAt(i)) - '0';\r
+                i++;\r
+            } else if (s.charAt(i) == '.') {\r
+                parse_state = 3;\r
+                precision = 0;\r
+                i++;\r
+            } else {\r
+                parse_state = 4;\r
+            }\r
+        }\r
+\r
+        while (parse_state == 3) {\r
+            if (i >= length) {\r
+                parse_state = 5;\r
+            } else if (('0' <= s.charAt(i)) && (s.charAt(i) <= '9')) {\r
+                precision = ((precision * 10) + s.charAt(i)) - '0';\r
+                i++;\r
+            } else {\r
+                parse_state = 4;\r
+            }\r
+        }\r
+\r
+        if (parse_state == 4) {\r
+            if (i >= length) {\r
+                parse_state = 5;\r
+            } else {\r
+                fmt = s.charAt(i);\r
+            }\r
+\r
+            i++;\r
+        }\r
+\r
+        if (i < length) {\r
+            post = s.substring(i, length);\r
+        }\r
+    }\r
+\r
     /**\r
      * Formats the number following printf conventions.\r
      * Main limitation: Can only handle one format parameter at a time\r
@@ -68,565 +181,525 @@ public class Format {
      * @exception IllegalArgumentException if bad format\r
      *\r
      */\r
+    public static String getHexString(java.awt.Color color) {\r
+        String r;\r
+        String g;\r
+        String b;\r
+        r = Integer.toHexString(color.getRed());\r
+\r
+        if (r.length() < 2) {\r
+            r = "0" + r;\r
+        }\r
 \r
-  public static String getHexString(java.awt.Color color)\r
-  {\r
-    String r, g, b;\r
-    r = Integer.toHexString(color.getRed());\r
-    if (r.length() < 2)\r
-      r = "0" + r;\r
-    g = Integer.toHexString(color.getGreen());\r
-    if (g.length() < 2)\r
-      g = "0" + g;\r
-    b = Integer.toHexString(color.getBlue());\r
-    if (b.length() < 2)\r
-      b = "0" + b;\r
-\r
-    return r+g+b;\r
-  }\r
-\r
-\r
-  public Format(String s) {\r
-    width = 0;\r
-    precision = -1;\r
-    pre = "";\r
-    post = "";\r
-    leading_zeroes = false;\r
-    show_plus = false;\r
-    alternate = false;\r
-    show_space = false;\r
-    left_align = false;\r
-    fmt = ' ';\r
-\r
-    int state = 0;\r
-    int length = s.length();\r
-    int parse_state = 0;\r
-    // 0 = prefix, 1 = flags, 2 = width, 3 = precision,\r
-    // 4 = format, 5 = end\r
-    int i = 0;\r
-\r
-    while (parse_state == 0) {\r
-      if (i >= length)\r
-        parse_state = 5;\r
-      else if (s.charAt(i) == '%') {\r
-        if (i < length - 1) {\r
-          if (s.charAt(i + 1) == '%') {\r
-            pre = pre + '%';\r
-            i++;\r
-          } else\r
-            parse_state = 1;\r
-        } else\r
-          throw new java.lang.IllegalArgumentException();\r
-      } else\r
-        pre = pre + s.charAt(i);\r
-      i++;\r
+        g = Integer.toHexString(color.getGreen());\r
+\r
+        if (g.length() < 2) {\r
+            g = "0" + g;\r
+        }\r
+\r
+        b = Integer.toHexString(color.getBlue());\r
+\r
+        if (b.length() < 2) {\r
+            b = "0" + b;\r
+        }\r
+\r
+        return r + g + b;\r
     }\r
-    while (parse_state == 1) {\r
-      if (i >= length)\r
-        parse_state = 5;\r
-      else if (s.charAt(i) == ' ')\r
-        show_space = true;\r
-      else if (s.charAt(i) == '-')\r
-        left_align = true;\r
-      else if (s.charAt(i) == '+')\r
-        show_plus = true;\r
-      else if (s.charAt(i) == '0')\r
-        leading_zeroes = true;\r
-      else if (s.charAt(i) == '#')\r
-        alternate = true;\r
-      else {\r
-        parse_state = 2;\r
-        i--;\r
-      }\r
-      i++;\r
+\r
+    /**\r
+    * prints a formatted number following printf conventions\r
+    * @param s a PrintStream\r
+    * @param fmt the format string\r
+    * @param x the double to print\r
+    */\r
+    public static void print(java.io.PrintStream s, String fmt, double x) {\r
+        s.print(new Format(fmt).form(x));\r
     }\r
-    while (parse_state == 2) {\r
-      if (i >= length)\r
-        parse_state = 5;\r
-      else if ('0' <= s.charAt(i) && s.charAt(i) <= '9') {\r
-        width = width * 10 + s.charAt(i) - '0';\r
-        i++;\r
-      } else if (s.charAt(i) == '.') {\r
-        parse_state = 3;\r
-        precision = 0;\r
-        i++;\r
-      } else\r
-        parse_state = 4;\r
+\r
+    /**\r
+    * prints a formatted number following printf conventions\r
+    * @param s a PrintStream\r
+    * @param fmt the format string\r
+    * @param x the long to print\r
+    */\r
+    public static void print(java.io.PrintStream s, String fmt, long x) {\r
+        s.print(new Format(fmt).form(x));\r
     }\r
-    while (parse_state == 3) {\r
-      if (i >= length)\r
-        parse_state = 5;\r
-      else if ('0' <= s.charAt(i) && s.charAt(i) <= '9') {\r
-        precision = precision * 10 + s.charAt(i) - '0';\r
-        i++;\r
-      } else\r
-        parse_state = 4;\r
+\r
+    /**\r
+    * prints a formatted number following printf conventions\r
+    * @param s a PrintStream\r
+    * @param fmt the format string\r
+    * @param x the character to\r
+    */\r
+    public static void print(java.io.PrintStream s, String fmt, char x) {\r
+        s.print(new Format(fmt).form(x));\r
     }\r
-    if (parse_state == 4) {\r
-      if (i >= length)\r
-        parse_state = 5;\r
-      else\r
-        fmt = s.charAt(i);\r
-      i++;\r
+\r
+    /**\r
+    * prints a formatted number following printf conventions\r
+    * @param s a PrintStream, fmt the format string\r
+    * @param x a string that represents the digits to print\r
+    */\r
+    public static void print(java.io.PrintStream s, String fmt, String x) {\r
+        s.print(new Format(fmt).form(x));\r
     }\r
-    if (i < length)\r
-      post = s.substring(i, length);\r
-  }\r
-\r
-  /**\r
-  * prints a formatted number following printf conventions\r
-  * @param s a PrintStream\r
-  * @param fmt the format string\r
-  * @param x the double to print\r
-  */\r
-\r
-  public static void print(java.io.PrintStream s, String fmt, double x) {\r
-    s.print(new Format(fmt).form(x));\r
-  }\r
-\r
-  /**\r
-  * prints a formatted number following printf conventions\r
-  * @param s a PrintStream\r
-  * @param fmt the format string\r
-  * @param x the long to print\r
-  */\r
-  public static void print(java.io.PrintStream s, String fmt, long x) {\r
-    s.print(new Format(fmt).form(x));\r
-  }\r
-\r
-  /**\r
-  * prints a formatted number following printf conventions\r
-  * @param s a PrintStream\r
-  * @param fmt the format string\r
-  * @param x the character to\r
-  */\r
-\r
-  public static void print(java.io.PrintStream s, String fmt, char x) {\r
-    s.print(new Format(fmt).form(x));\r
-  }\r
-\r
-  /**\r
-  * prints a formatted number following printf conventions\r
-  * @param s a PrintStream, fmt the format string\r
-  * @param x a string that represents the digits to print\r
-  */\r
-\r
-  public static void print(java.io.PrintStream s, String fmt, String x) {\r
-    s.print(new Format(fmt).form(x));\r
-  }\r
-\r
-  /**\r
-  * Converts a string of digits (decimal, octal or hex) to an integer\r
-  * @param s a string\r
-  * @return the numeric value of the prefix of s representing a base 10 integer\r
-  */\r
-\r
-  public static int atoi(String s) {\r
-    return (int)atol(s);\r
-  }\r
-\r
-  /**\r
-  * Converts a string of digits (decimal, octal or hex) to a long integer\r
-  * @param s a string\r
-  * @return the numeric value of the prefix of s representing a base 10 integer\r
-  */\r
-\r
-  public static long atol(String s) {\r
-    int i = 0;\r
-\r
-    while (i < s.length() && Character.isWhitespace(s.charAt(i)))\r
-      i++;\r
-    if (i < s.length() && s.charAt(i) == '0') {\r
-      if (i + 1 < s.length() && (s.charAt(i + 1) == 'x' || s.charAt(i + 1) == 'X'))\r
-        return parseLong(s.substring(i + 2), 16);\r
-      else\r
-        return parseLong(s, 8);\r
-    } else\r
-      return parseLong(s, 10);\r
-  }\r
-\r
-  private static long parseLong(String s, int base) {\r
-    int i = 0;\r
-    int sign = 1;\r
-    long r = 0;\r
-\r
-    while (i < s.length() && Character.isWhitespace(s.charAt(i)))\r
-      i++;\r
-    if (i < s.length() && s.charAt(i) == '-') {\r
-      sign = -1;\r
-      i++;\r
-    } else if (i < s.length() && s.charAt(i) == '+') {\r
-      i++;\r
+\r
+    /**\r
+    * Converts a string of digits (decimal, octal or hex) to an integer\r
+    * @param s a string\r
+    * @return the numeric value of the prefix of s representing a base 10 integer\r
+    */\r
+    public static int atoi(String s) {\r
+        return (int) atol(s);\r
     }\r
-    while (i < s.length()) {\r
-      char ch = s.charAt(i);\r
-      if ('0' <= ch && ch < '0' + base)\r
-        r = r * base + ch - '0';\r
-      else if ('A' <= ch && ch < 'A' + base - 10)\r
-        r = r * base + ch - 'A' + 10 ;\r
-      else if ('a' <= ch && ch < 'a' + base - 10)\r
-        r = r * base + ch - 'a' + 10 ;\r
-      else\r
-        return r * sign;\r
-      i++;\r
+\r
+    /**\r
+    * Converts a string of digits (decimal, octal or hex) to a long integer\r
+    * @param s a string\r
+    * @return the numeric value of the prefix of s representing a base 10 integer\r
+    */\r
+    public static long atol(String s) {\r
+        int i = 0;\r
+\r
+        while ((i < s.length()) && Character.isWhitespace(s.charAt(i)))\r
+            i++;\r
+\r
+        if ((i < s.length()) && (s.charAt(i) == '0')) {\r
+            if (((i + 1) < s.length()) &&\r
+                    ((s.charAt(i + 1) == 'x') || (s.charAt(i + 1) == 'X'))) {\r
+                return parseLong(s.substring(i + 2), 16);\r
+            } else {\r
+                return parseLong(s, 8);\r
+            }\r
+        } else {\r
+            return parseLong(s, 10);\r
+        }\r
     }\r
-    return r * sign;\r
-  }\r
-\r
-  /**\r
-  * Converts a string of digits to an double\r
-  * @param s a string\r
-  */\r
-\r
-  public static double atof(String s) {\r
-    int i = 0;\r
-    int sign = 1;\r
-    double r = 0; // integer part\r
-    double f = 0; // fractional part\r
-    double p = 1; // exponent of fractional part\r
-    int state = 0; // 0 = int part, 1 = frac part\r
-\r
-    while (i < s.length() && Character.isWhitespace(s.charAt(i)))\r
-      i++;\r
-    if (i < s.length() && s.charAt(i) == '-') {\r
-      sign = -1;\r
-      i++;\r
-    } else if (i < s.length() && s.charAt(i) == '+') {\r
-      i++;\r
+\r
+    private static long parseLong(String s, int base) {\r
+        int i = 0;\r
+        int sign = 1;\r
+        long r = 0;\r
+\r
+        while ((i < s.length()) && Character.isWhitespace(s.charAt(i)))\r
+            i++;\r
+\r
+        if ((i < s.length()) && (s.charAt(i) == '-')) {\r
+            sign = -1;\r
+            i++;\r
+        } else if ((i < s.length()) && (s.charAt(i) == '+')) {\r
+            i++;\r
+        }\r
+\r
+        while (i < s.length()) {\r
+            char ch = s.charAt(i);\r
+\r
+            if (('0' <= ch) && (ch < ('0' + base))) {\r
+                r = ((r * base) + ch) - '0';\r
+            } else if (('A' <= ch) && (ch < (('A' + base) - 10))) {\r
+                r = ((r * base) + ch) - 'A' + 10;\r
+            } else if (('a' <= ch) && (ch < (('a' + base) - 10))) {\r
+                r = ((r * base) + ch) - 'a' + 10;\r
+            } else {\r
+                return r * sign;\r
+            }\r
+\r
+            i++;\r
+        }\r
+\r
+        return r * sign;\r
     }\r
-    while (i < s.length()) {\r
-      char ch = s.charAt(i);\r
-      if ('0' <= ch && ch <= '9') {\r
-        if (state == 0)\r
-          r = r * 10 + ch - '0';\r
-        else if (state == 1) {\r
-          p = p / 10;\r
-          r = r + p * (ch - '0');\r
-        }\r
-      } else if (ch == '.') {\r
-        if (state == 0)\r
-          state = 1;\r
-        else\r
-          return sign * r;\r
-      } else if (ch == 'e' || ch == 'E') {\r
-        long e = (int)parseLong(s.substring(i + 1), 10);\r
-        return sign * r * Math.pow(10, e);\r
-      } else\r
+\r
+    /**\r
+    * Converts a string of digits to an double\r
+    * @param s a string\r
+    */\r
+    public static double atof(String s) {\r
+        int i = 0;\r
+        int sign = 1;\r
+        double r = 0; // integer part\r
+        double f = 0; // fractional part\r
+        double p = 1; // exponent of fractional part\r
+        int state = 0; // 0 = int part, 1 = frac part\r
+\r
+        while ((i < s.length()) && Character.isWhitespace(s.charAt(i)))\r
+            i++;\r
+\r
+        if ((i < s.length()) && (s.charAt(i) == '-')) {\r
+            sign = -1;\r
+            i++;\r
+        } else if ((i < s.length()) && (s.charAt(i) == '+')) {\r
+            i++;\r
+        }\r
+\r
+        while (i < s.length()) {\r
+            char ch = s.charAt(i);\r
+\r
+            if (('0' <= ch) && (ch <= '9')) {\r
+                if (state == 0) {\r
+                    r = ((r * 10) + ch) - '0';\r
+                } else if (state == 1) {\r
+                    p = p / 10;\r
+                    r = r + (p * (ch - '0'));\r
+                }\r
+            } else if (ch == '.') {\r
+                if (state == 0) {\r
+                    state = 1;\r
+                } else {\r
+                    return sign * r;\r
+                }\r
+            } else if ((ch == 'e') || (ch == 'E')) {\r
+                long e = (int) parseLong(s.substring(i + 1), 10);\r
+\r
+                return sign * r * Math.pow(10, e);\r
+            } else {\r
+                return sign * r;\r
+            }\r
+\r
+            i++;\r
+        }\r
+\r
         return sign * r;\r
-      i++;\r
     }\r
-    return sign * r;\r
-  }\r
-\r
-  /**\r
-  * Formats a double into a string (like sprintf in C)\r
-  * @param x the number to format\r
-  * @return the formatted string\r
-  * @exception IllegalArgumentException if bad argument\r
-  */\r
-\r
-  public String form(double x) {\r
-    String r;\r
-    if (precision < 0)\r
-      precision = 6;\r
-    int s = 1;\r
-    if (x < 0) {\r
-      x = -x;\r
-      s = -1;\r
+\r
+    /**\r
+    * Formats a double into a string (like sprintf in C)\r
+    * @param x the number to format\r
+    * @return the formatted string\r
+    * @exception IllegalArgumentException if bad argument\r
+    */\r
+    public String form(double x) {\r
+        String r;\r
+\r
+        if (precision < 0) {\r
+            precision = 6;\r
+        }\r
+\r
+        int s = 1;\r
+\r
+        if (x < 0) {\r
+            x = -x;\r
+            s = -1;\r
+        }\r
+\r
+        if (fmt == 'f') {\r
+            r = fixed_format(x);\r
+        } else if ((fmt == 'e') || (fmt == 'E') || (fmt == 'g') ||\r
+                (fmt == 'G')) {\r
+            r = exp_format(x);\r
+        } else {\r
+            throw new java.lang.IllegalArgumentException();\r
+        }\r
+\r
+        return pad(sign(s, r));\r
     }\r
-    if (fmt == 'f')\r
-      r = fixed_format(x);\r
-    else if (fmt == 'e' || fmt == 'E' || fmt == 'g' || fmt == 'G')\r
-      r = exp_format(x);\r
-    else\r
-      throw new java.lang.IllegalArgumentException();\r
-\r
-    return pad(sign(s, r));\r
-  }\r
-\r
-  /**\r
-  * Formats a long integer into a string (like sprintf in C)\r
-  * @param x the number to format\r
-  * @return the formatted string\r
-  */\r
-\r
-  public String form(long x) {\r
-    String r;\r
-    int s = 0;\r
-    if (fmt == 'd' || fmt == 'i') {\r
-      if (x < 0) {\r
-        r = ("" + x).substring(1);\r
-        s = -1;\r
-      } else {\r
-        r = "" + x;\r
-        s = 1;\r
-      }\r
-    } else if (fmt == 'o')\r
-      r = convert(x, 3, 7, "01234567");\r
-    else if (fmt == 'x')\r
-      r = convert(x, 4, 15, "0123456789abcdef");\r
-    else if (fmt == 'X')\r
-      r = convert(x, 4, 15, "0123456789ABCDEF");\r
-    else\r
-      throw new java.lang.IllegalArgumentException();\r
-\r
-    return pad(sign(s, r));\r
-  }\r
-\r
-  /**\r
-  * Formats a character into a string (like sprintf in C)\r
-  * @param x the value to format\r
-  * @return the formatted string\r
-  */\r
-\r
-  public String form(char c) {\r
-    if (fmt != 'c')\r
-      throw new java.lang.IllegalArgumentException();\r
-\r
-    String r = "" + c;\r
-    return pad(r);\r
-  }\r
-\r
-  /**\r
-  * Formats a string into a larger string (like sprintf in C)\r
-  * @param x the value to format\r
-  * @return the formatted string\r
-  */\r
-\r
-  public String form(String s) {\r
-    if (fmt != 's')\r
-      throw new java.lang.IllegalArgumentException();\r
-    if (precision >= 0)\r
-      s = s.substring(0, precision);\r
-    return pad(s);\r
-  }\r
-\r
-\r
-  /**\r
-  * a test stub for the format class\r
-  */\r
-\r
-  public static void main(String[] a) {\r
-    double x = 1.23456789012;\r
-    double y = 123;\r
-    double z = 1.2345e30;\r
-    double w = 1.02;\r
-    double u = 1.234e-5;\r
-    int d = 0xCAFE;\r
-    Format.print(System.out, "x = |%f|\n", x);\r
-    Format.print(System.out, "u = |%20f|\n", u);\r
-    Format.print(System.out, "x = |% .5f|\n", x);\r
-    Format.print(System.out, "w = |%20.5f|\n", w);\r
-    Format.print(System.out, "x = |%020.5f|\n", x);\r
-    Format.print(System.out, "x = |%+20.5f|\n", x);\r
-    Format.print(System.out, "x = |%+020.5f|\n", x);\r
-    Format.print(System.out, "x = |% 020.5f|\n", x);\r
-    Format.print(System.out, "y = |%#+20.5f|\n", y);\r
-    Format.print(System.out, "y = |%-+20.5f|\n", y);\r
-    Format.print(System.out, "z = |%20.5f|\n", z);\r
-\r
-    Format.print(System.out, "x = |%e|\n", x);\r
-    Format.print(System.out, "u = |%20e|\n", u);\r
-    Format.print(System.out, "x = |% .5e|\n", x);\r
-    Format.print(System.out, "w = |%20.5e|\n", w);\r
-    Format.print(System.out, "x = |%020.5e|\n", x);\r
-    Format.print(System.out, "x = |%+20.5e|\n", x);\r
-    Format.print(System.out, "x = |%+020.5e|\n", x);\r
-    Format.print(System.out, "x = |% 020.5e|\n", x);\r
-    Format.print(System.out, "y = |%#+20.5e|\n", y);\r
-    Format.print(System.out, "y = |%-+20.5e|\n", y);\r
-\r
-    Format.print(System.out, "x = |%g|\n", x);\r
-    Format.print(System.out, "z = |%g|\n", z);\r
-    Format.print(System.out, "w = |%g|\n", w);\r
-    Format.print(System.out, "u = |%g|\n", u);\r
-    Format.print(System.out, "y = |%.2g|\n", y);\r
-    Format.print(System.out, "y = |%#.2g|\n", y);\r
-\r
-    Format.print(System.out, "d = |%d|\n", d);\r
-    Format.print(System.out, "d = |%20d|\n", d);\r
-    Format.print(System.out, "d = |%020d|\n", d);\r
-    Format.print(System.out, "d = |%+20d|\n", d);\r
-    Format.print(System.out, "d = |% 020d|\n", d);\r
-    Format.print(System.out, "d = |%-20d|\n", d);\r
-    Format.print(System.out, "d = |%20.8d|\n", d);\r
-    Format.print(System.out, "d = |%x|\n", d);\r
-    Format.print(System.out, "d = |%20X|\n", d);\r
-    Format.print(System.out, "d = |%#20x|\n", d);\r
-    Format.print(System.out, "d = |%020X|\n", d);\r
-    Format.print(System.out, "d = |%20.8x|\n", d);\r
-    Format.print(System.out, "d = |%o|\n", d);\r
-    Format.print(System.out, "d = |%020o|\n", d);\r
-    Format.print(System.out, "d = |%#20o|\n", d);\r
-    Format.print(System.out, "d = |%#020o|\n", d);\r
-    Format.print(System.out, "d = |%20.12o|\n", d);\r
-\r
-    Format.print(System.out, "s = |%-20s|\n", "Hello");\r
-    Format.print(System.out, "s = |%-20c|\n", '!');\r
-\r
-    // regression test to confirm fix of reported bugs\r
-\r
-    Format.print(System.out, "|%i|\n", Long.MIN_VALUE);\r
-\r
-    Format.print(System.out, "|%6.2e|\n", 0.0);\r
-    Format.print(System.out, "|%6.2g|\n", 0.0);\r
-\r
-    Format.print(System.out, "|%6.2f|\n", 9.99);\r
-    Format.print(System.out, "|%6.2f|\n", 9.999);\r
-\r
-    Format.print(System.out, "|%6.0f|\n", 9.999);\r
-  }\r
-\r
-  private static String repeat(char c, int n) {\r
-    if (n <= 0)\r
-      return "";\r
-    StringBuffer s = new StringBuffer(n);\r
-    for (int i = 0; i < n; i++)\r
-      s.append(c);\r
-    return s.toString();\r
-  }\r
-\r
-  private static String convert(long x, int n, int m, String d) {\r
-    if (x == 0)\r
-      return "0";\r
-    String r = "";\r
-    while (x != 0) {\r
-      r = d.charAt((int)(x & m)) + r;\r
-      x = x >>> n;\r
+\r
+    /**\r
+    * Formats a long integer into a string (like sprintf in C)\r
+    * @param x the number to format\r
+    * @return the formatted string\r
+    */\r
+    public String form(long x) {\r
+        String r;\r
+        int s = 0;\r
+\r
+        if ((fmt == 'd') || (fmt == 'i')) {\r
+            if (x < 0) {\r
+                r = ("" + x).substring(1);\r
+                s = -1;\r
+            } else {\r
+                r = "" + x;\r
+                s = 1;\r
+            }\r
+        } else if (fmt == 'o') {\r
+            r = convert(x, 3, 7, "01234567");\r
+        } else if (fmt == 'x') {\r
+            r = convert(x, 4, 15, "0123456789abcdef");\r
+        } else if (fmt == 'X') {\r
+            r = convert(x, 4, 15, "0123456789ABCDEF");\r
+        } else {\r
+            throw new java.lang.IllegalArgumentException();\r
+        }\r
+\r
+        return pad(sign(s, r));\r
     }\r
-    return r;\r
-  }\r
-\r
-  private String pad(String r) {\r
-    String p = repeat(' ', width - r.length());\r
-    if (left_align)\r
-      return pre + r + p + post;\r
-    else\r
-      return pre + p + r + post;\r
-  }\r
-\r
-  private String sign(int s, String r) {\r
-    String p = "";\r
-    if (s < 0)\r
-      p = "-";\r
-    else if (s > 0) {\r
-      if (show_plus)\r
-        p = "+";\r
-      else if (show_space)\r
-        p = " ";\r
-    } else {\r
-      if (fmt == 'o' && alternate && r.length() > 0 && r.charAt(0) != '0')\r
-        p = "0";\r
-      else if (fmt == 'x' && alternate)\r
-        p = "0x";\r
-      else if (fmt == 'X' && alternate)\r
-        p = "0X";\r
+\r
+    /**\r
+    * Formats a character into a string (like sprintf in C)\r
+    * @param x the value to format\r
+    * @return the formatted string\r
+    */\r
+    public String form(char c) {\r
+        if (fmt != 'c') {\r
+            throw new java.lang.IllegalArgumentException();\r
+        }\r
+\r
+        String r = "" + c;\r
+\r
+        return pad(r);\r
     }\r
-    int w = 0;\r
-    if (leading_zeroes)\r
-      w = width;\r
-    else if ((fmt == 'd' || fmt == 'i' || fmt == 'x' || fmt == 'X' || fmt == 'o')\r
-             && precision > 0)\r
-      w = precision;\r
-\r
-    return p + repeat('0', w - p.length() - r.length()) + r;\r
-  }\r
-\r
-  private String fixed_format(double d) {\r
-    boolean removeTrailing\r
-    = (fmt == 'G' || fmt == 'g') && !alternate;\r
-    // remove trailing zeroes and decimal point\r
-\r
-    if (d > 0x7FFFFFFFFFFFFFFFL)\r
-      return exp_format(d);\r
-    if (precision == 0)\r
-      return (long)(d + 0.5) + (removeTrailing ? "" : ".");\r
-\r
-    long whole = (long)d;\r
-    double fr = d - whole; // fractional part\r
-    if (fr >= 1 || fr < 0)\r
-      return exp_format(d);\r
-\r
-    double factor = 1;\r
-    String leading_zeroes = "";\r
-    for (int i = 1; i <= precision && factor <= 0x7FFFFFFFFFFFFFFFL; i++) {\r
-      factor *= 10;\r
-      leading_zeroes = leading_zeroes + "0";\r
+\r
+    /**\r
+    * Formats a string into a larger string (like sprintf in C)\r
+    * @param x the value to format\r
+    * @return the formatted string\r
+    */\r
+    public String form(String s) {\r
+        if (fmt != 's') {\r
+            throw new java.lang.IllegalArgumentException();\r
+        }\r
+\r
+        if (precision >= 0) {\r
+            s = s.substring(0, precision);\r
+        }\r
+\r
+        return pad(s);\r
     }\r
-    long l = (long) (factor * fr + 0.5);\r
-    if (l >= factor) {\r
-      l = 0;\r
-      whole++;\r
-    } // CSH 10-25-97\r
-\r
-    String z = leading_zeroes + l;\r
-    z = "." + z.substring(z.length() - precision, z.length());\r
-\r
-    if (removeTrailing) {\r
-      int t = z.length() - 1;\r
-      while (t >= 0 && z.charAt(t) == '0')\r
-        t--;\r
-      if (t >= 0 && z.charAt(t) == '.')\r
-        t--;\r
-      z = z.substring(0, t + 1);\r
+\r
+    /**\r
+    * a test stub for the format class\r
+    */\r
+    public static void main(String[] a) {\r
+        double x = 1.23456789012;\r
+        double y = 123;\r
+        double z = 1.2345e30;\r
+        double w = 1.02;\r
+        double u = 1.234e-5;\r
+        int d = 0xCAFE;\r
+        Format.print(System.out, "x = |%f|\n", x);\r
+        Format.print(System.out, "u = |%20f|\n", u);\r
+        Format.print(System.out, "x = |% .5f|\n", x);\r
+        Format.print(System.out, "w = |%20.5f|\n", w);\r
+        Format.print(System.out, "x = |%020.5f|\n", x);\r
+        Format.print(System.out, "x = |%+20.5f|\n", x);\r
+        Format.print(System.out, "x = |%+020.5f|\n", x);\r
+        Format.print(System.out, "x = |% 020.5f|\n", x);\r
+        Format.print(System.out, "y = |%#+20.5f|\n", y);\r
+        Format.print(System.out, "y = |%-+20.5f|\n", y);\r
+        Format.print(System.out, "z = |%20.5f|\n", z);\r
+\r
+        Format.print(System.out, "x = |%e|\n", x);\r
+        Format.print(System.out, "u = |%20e|\n", u);\r
+        Format.print(System.out, "x = |% .5e|\n", x);\r
+        Format.print(System.out, "w = |%20.5e|\n", w);\r
+        Format.print(System.out, "x = |%020.5e|\n", x);\r
+        Format.print(System.out, "x = |%+20.5e|\n", x);\r
+        Format.print(System.out, "x = |%+020.5e|\n", x);\r
+        Format.print(System.out, "x = |% 020.5e|\n", x);\r
+        Format.print(System.out, "y = |%#+20.5e|\n", y);\r
+        Format.print(System.out, "y = |%-+20.5e|\n", y);\r
+\r
+        Format.print(System.out, "x = |%g|\n", x);\r
+        Format.print(System.out, "z = |%g|\n", z);\r
+        Format.print(System.out, "w = |%g|\n", w);\r
+        Format.print(System.out, "u = |%g|\n", u);\r
+        Format.print(System.out, "y = |%.2g|\n", y);\r
+        Format.print(System.out, "y = |%#.2g|\n", y);\r
+\r
+        Format.print(System.out, "d = |%d|\n", d);\r
+        Format.print(System.out, "d = |%20d|\n", d);\r
+        Format.print(System.out, "d = |%020d|\n", d);\r
+        Format.print(System.out, "d = |%+20d|\n", d);\r
+        Format.print(System.out, "d = |% 020d|\n", d);\r
+        Format.print(System.out, "d = |%-20d|\n", d);\r
+        Format.print(System.out, "d = |%20.8d|\n", d);\r
+        Format.print(System.out, "d = |%x|\n", d);\r
+        Format.print(System.out, "d = |%20X|\n", d);\r
+        Format.print(System.out, "d = |%#20x|\n", d);\r
+        Format.print(System.out, "d = |%020X|\n", d);\r
+        Format.print(System.out, "d = |%20.8x|\n", d);\r
+        Format.print(System.out, "d = |%o|\n", d);\r
+        Format.print(System.out, "d = |%020o|\n", d);\r
+        Format.print(System.out, "d = |%#20o|\n", d);\r
+        Format.print(System.out, "d = |%#020o|\n", d);\r
+        Format.print(System.out, "d = |%20.12o|\n", d);\r
+\r
+        Format.print(System.out, "s = |%-20s|\n", "Hello");\r
+        Format.print(System.out, "s = |%-20c|\n", '!');\r
+\r
+        // regression test to confirm fix of reported bugs\r
+        Format.print(System.out, "|%i|\n", Long.MIN_VALUE);\r
+\r
+        Format.print(System.out, "|%6.2e|\n", 0.0);\r
+        Format.print(System.out, "|%6.2g|\n", 0.0);\r
+\r
+        Format.print(System.out, "|%6.2f|\n", 9.99);\r
+        Format.print(System.out, "|%6.2f|\n", 9.999);\r
+\r
+        Format.print(System.out, "|%6.0f|\n", 9.999);\r
     }\r
 \r
-    return whole + z;\r
-  }\r
-\r
-  private String exp_format(double d) {\r
-    String f = "";\r
-    int e = 0;\r
-    double dd = d;\r
-    double factor = 1;\r
-    if (d != 0) {\r
-      while (dd > 10) {\r
-        e++;\r
-        factor /= 10;\r
-        dd = dd / 10;\r
-      }\r
-      while (dd < 1) {\r
-        e--;\r
-        factor *= 10;\r
-        dd = dd * 10;\r
-      }\r
+    private static String repeat(char c, int n) {\r
+        if (n <= 0) {\r
+            return "";\r
+        }\r
+\r
+        StringBuffer s = new StringBuffer(n);\r
+\r
+        for (int i = 0; i < n; i++)\r
+            s.append(c);\r
+\r
+        return s.toString();\r
     }\r
-    if ((fmt == 'g' || fmt == 'G') && e >= -4 && e < precision)\r
-      return fixed_format(d);\r
-\r
-    d = d * factor;\r
-    f = f + fixed_format(d);\r
-\r
-    if (fmt == 'e' || fmt == 'g')\r
-      f = f + "e";\r
-    else\r
-      f = f + "E";\r
-\r
-    String p = "000";\r
-    if (e >= 0) {\r
-      f = f + "+";\r
-      p = p + e;\r
-    } else {\r
-      f = f + "-";\r
-      p = p + (-e);\r
+\r
+    private static String convert(long x, int n, int m, String d) {\r
+        if (x == 0) {\r
+            return "0";\r
+        }\r
+\r
+        String r = "";\r
+\r
+        while (x != 0) {\r
+            r = d.charAt((int) (x & m)) + r;\r
+            x = x >>> n;\r
+        }\r
+\r
+        return r;\r
     }\r
 \r
-    return f + p.substring(p.length() - 3, p.length());\r
-  }\r
-\r
-  private int width;\r
-  private int precision;\r
-  private String pre;\r
-  private String post;\r
-  private boolean leading_zeroes;\r
-  private boolean show_plus;\r
-  private boolean alternate;\r
-  private boolean show_space;\r
-  private boolean left_align;\r
-  private char fmt; // one of cdeEfgGiosxXos\r
-}\r
+    private String pad(String r) {\r
+        String p = repeat(' ', width - r.length());\r
+\r
+        if (left_align) {\r
+            return pre + r + p + post;\r
+        } else {\r
+            return pre + p + r + post;\r
+        }\r
+    }\r
 \r
+    private String sign(int s, String r) {\r
+        String p = "";\r
+\r
+        if (s < 0) {\r
+            p = "-";\r
+        } else if (s > 0) {\r
+            if (show_plus) {\r
+                p = "+";\r
+            } else if (show_space) {\r
+                p = " ";\r
+            }\r
+        } else {\r
+            if ((fmt == 'o') && alternate && (r.length() > 0) &&\r
+                    (r.charAt(0) != '0')) {\r
+                p = "0";\r
+            } else if ((fmt == 'x') && alternate) {\r
+                p = "0x";\r
+            } else if ((fmt == 'X') && alternate) {\r
+                p = "0X";\r
+            }\r
+        }\r
+\r
+        int w = 0;\r
+\r
+        if (leading_zeroes) {\r
+            w = width;\r
+        } else if (((fmt == 'd') || (fmt == 'i') || (fmt == 'x') ||\r
+                (fmt == 'X') || (fmt == 'o')) && (precision > 0)) {\r
+            w = precision;\r
+        }\r
+\r
+        return p + repeat('0', w - p.length() - r.length()) + r;\r
+    }\r
+\r
+    private String fixed_format(double d) {\r
+        boolean removeTrailing = ((fmt == 'G') || (fmt == 'g')) && !alternate;\r
 \r
+        // remove trailing zeroes and decimal point\r
+        if (d > 0x7FFFFFFFFFFFFFFFL) {\r
+            return exp_format(d);\r
+        }\r
+\r
+        if (precision == 0) {\r
+            return (long) (d + 0.5) + (removeTrailing ? "" : ".");\r
+        }\r
+\r
+        long whole = (long) d;\r
+        double fr = d - whole; // fractional part\r
+\r
+        if ((fr >= 1) || (fr < 0)) {\r
+            return exp_format(d);\r
+        }\r
+\r
+        double factor = 1;\r
+        String leading_zeroes = "";\r
+\r
+        for (int i = 1; (i <= precision) && (factor <= 0x7FFFFFFFFFFFFFFFL);\r
+                i++) {\r
+            factor *= 10;\r
+            leading_zeroes = leading_zeroes + "0";\r
+        }\r
+\r
+        long l = (long) ((factor * fr) + 0.5);\r
+\r
+        if (l >= factor) {\r
+            l = 0;\r
+            whole++;\r
+        }\r
+         // CSH 10-25-97\r
 \r
+        String z = leading_zeroes + l;\r
+        z = "." + z.substring(z.length() - precision, z.length());\r
 \r
+        if (removeTrailing) {\r
+            int t = z.length() - 1;\r
 \r
+            while ((t >= 0) && (z.charAt(t) == '0'))\r
+                t--;\r
+\r
+            if ((t >= 0) && (z.charAt(t) == '.')) {\r
+                t--;\r
+            }\r
+\r
+            z = z.substring(0, t + 1);\r
+        }\r
+\r
+        return whole + z;\r
+    }\r
+\r
+    private String exp_format(double d) {\r
+        String f = "";\r
+        int e = 0;\r
+        double dd = d;\r
+        double factor = 1;\r
+\r
+        if (d != 0) {\r
+            while (dd > 10) {\r
+                e++;\r
+                factor /= 10;\r
+                dd = dd / 10;\r
+            }\r
+\r
+            while (dd < 1) {\r
+                e--;\r
+                factor *= 10;\r
+                dd = dd * 10;\r
+            }\r
+        }\r
+\r
+        if (((fmt == 'g') || (fmt == 'G')) && (e >= -4) && (e < precision)) {\r
+            return fixed_format(d);\r
+        }\r
+\r
+        d = d * factor;\r
+        f = f + fixed_format(d);\r
+\r
+        if ((fmt == 'e') || (fmt == 'g')) {\r
+            f = f + "e";\r
+        } else {\r
+            f = f + "E";\r
+        }\r
+\r
+        String p = "000";\r
+\r
+        if (e >= 0) {\r
+            f = f + "+";\r
+            p = p + e;\r
+        } else {\r
+            f = f + "-";\r
+            p = p + (-e);\r
+        }\r
+\r
+        return f + p.substring(p.length() - 3, p.length());\r
+    }\r
+}\r
index 3624144..127b419 100755 (executable)
 * 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.util;\r
 \r
-\r
 public class QuickSort {\r
+    public static void sort(float[] arr, Object[] s) {\r
+        sort(arr, 0, arr.length - 1, s);\r
+    }\r
 \r
-  public static void sort(float[] arr,Object[] s) {\r
-    sort(arr,0,arr.length-1,s);\r
-  }\r
-\r
-  public static void sort(String[] arr,Object[] s) {\r
-    stringSort(arr,0,arr.length-1,s);\r
-  }\r
+    public static void sort(String[] arr, Object[] s) {\r
+        stringSort(arr, 0, arr.length - 1, s);\r
+    }\r
 \r
-  public static void stringSort(String[] arr,int p, int r,Object[] s) {\r
-    int q;\r
+    public static void stringSort(String[] arr, int p, int r, Object[] s) {\r
+        int q;\r
 \r
-    if (p < r) {\r
-      q = stringPartition(arr,p,r,s);\r
-      stringSort(arr,p,q,s);\r
-      stringSort(arr,q+1,r,s);\r
+        if (p < r) {\r
+            q = stringPartition(arr, p, r, s);\r
+            stringSort(arr, p, q, s);\r
+            stringSort(arr, q + 1, r, s);\r
+        }\r
     }\r
-  }\r
 \r
-  public static void sort(float[] arr,int p, int r,Object[] s) {\r
-    int q;\r
+    public static void sort(float[] arr, int p, int r, Object[] s) {\r
+        int q;\r
 \r
-    if (p < r) {\r
-      q = partition(arr,p,r,s);\r
-      sort(arr,p,q,s);\r
-      sort(arr,q+1,r,s);\r
+        if (p < r) {\r
+            q = partition(arr, p, r, s);\r
+            sort(arr, p, q, s);\r
+            sort(arr, q + 1, r, s);\r
+        }\r
     }\r
-  }\r
-\r
-  private static int partition(float[] arr, int p, int r,Object[] s) {\r
-    float x = arr[p];\r
-    int i = p-1;\r
-    int j = r+1;\r
-\r
-    while(true) {\r
-      do {\r
-        j = j-1;\r
-      }        while (arr[j] > x);\r
-\r
-      do {\r
-        i = i+1;\r
-      } while (arr[i] < x);\r
-\r
-      if ( i < j) {\r
-        float tmp = arr[i];\r
-        arr[i] = arr[j];\r
-        arr[j] = tmp;\r
-\r
-        Object tmp2 = s[i];\r
-        s[i] = s[j];\r
-        s[j] = tmp2;\r
-      } else {\r
-        return j;\r
-      }\r
+\r
+    private static int partition(float[] arr, int p, int r, Object[] s) {\r
+        float x = arr[p];\r
+        int i = p - 1;\r
+        int j = r + 1;\r
+\r
+        while (true) {\r
+            do {\r
+                j = j - 1;\r
+            } while (arr[j] > x);\r
+\r
+            do {\r
+                i = i + 1;\r
+            } while (arr[i] < x);\r
+\r
+            if (i < j) {\r
+                float tmp = arr[i];\r
+                arr[i] = arr[j];\r
+                arr[j] = tmp;\r
+\r
+                Object tmp2 = s[i];\r
+                s[i] = s[j];\r
+                s[j] = tmp2;\r
+            } else {\r
+                return j;\r
+            }\r
+        }\r
     }\r
-  }\r
-  private static int stringPartition(String[] arr, int p, int r,Object[] s) {\r
-    String x = arr[p];\r
-    int i = p-1;\r
-    int j = r+1;\r
-\r
-    while(true) {\r
-      do {\r
-        j = j-1;\r
-      }        while (arr[j].compareTo(x) < 0);\r
-\r
-      do {\r
-        i = i+1;\r
-      } while (arr[i].compareTo(x) > 0);\r
-\r
-      if ( i < j) {\r
-        String tmp = arr[i];\r
-        arr[i] = arr[j];\r
-        arr[j] = tmp;\r
-\r
-        Object tmp2 = s[i];\r
-        s[i] = s[j];\r
-        s[j] = tmp2;\r
-      } else {\r
-        return j;\r
-      }\r
+\r
+    private static int stringPartition(String[] arr, int p, int r, Object[] s) {\r
+        String x = arr[p];\r
+        int i = p - 1;\r
+        int j = r + 1;\r
+\r
+        while (true) {\r
+            do {\r
+                j = j - 1;\r
+            } while (arr[j].compareTo(x) < 0);\r
+\r
+            do {\r
+                i = i + 1;\r
+            } while (arr[i].compareTo(x) > 0);\r
+\r
+            if (i < j) {\r
+                String tmp = arr[i];\r
+                arr[i] = arr[j];\r
+                arr[j] = tmp;\r
+\r
+                Object tmp2 = s[i];\r
+                s[i] = s[j];\r
+                s[j] = tmp2;\r
+            } else {\r
+                return j;\r
+            }\r
+        }\r
     }\r
-  }\r
 }\r
-\r
-\r
-\r
index 674743e..3711db0 100755 (executable)
 * 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.ws;\r
 \r
-import org.apache.axis.client.*;\r
-import javax.xml.namespace.QName;\r
-import java.util.*;\r
+import ext.vamsas.*;\r
+\r
+import jalview.analysis.AlignSeq;\r
+\r
 import jalview.datamodel.*;\r
+\r
 import jalview.gui.*;\r
-import javax.swing.*;\r
-import java.util.*;\r
+\r
+import org.apache.axis.client.*;\r
+\r
 import java.awt.*;\r
-import jalview.analysis.AlignSeq;\r
-import ext.vamsas.*;\r
 \r
-public class JPredClient\r
-    extends WSClient\r
-{\r
-  ext.vamsas.JPredWS server;\r
-  String altitle = "";\r
-  java.util.Hashtable SequenceInfo = null;\r
-  private WebserviceInfo setWebService()\r
-  {\r
-    WebServiceName = "JNetWS";\r
-    WebServiceJobTitle = "JNet secondary structure prediction";\r
-    WebServiceReference =\r
-        "\"Cuff J. A and Barton G.J (1999) Application of enhanced "\r
-        + "multiple sequence alignment profiles to improve protein secondary structure prediction, "\r
-        + "Proteins 40:502-511\".";\r
-    WsURL = "http://www.compbio.dundee.ac.uk/JalviewWS/services/jpred";\r
-    WebserviceInfo wsInfo = new WebserviceInfo(WebServiceJobTitle,\r
-                                               WebServiceReference);\r
-\r
-    return wsInfo;\r
-  }\r
-\r
-    private boolean locateWebService()\r
-    {\r
-\r
-      JPredWSServiceLocator loc = new JPredWSServiceLocator(); // Default\r
-      try\r
-      {\r
-        this.server = loc.getjpred(new java.net.URL(WsURL)); // JBPNote will be set from properties\r
-        ( (JpredSoapBindingStub)this.server).setTimeout(60000); // one minute stub\r
-      }\r
-      catch (Exception ex)\r
-      {\r
-        JOptionPane.showMessageDialog(Desktop.desktop,\r
-            "The Secondary Structure Prediction Service named "\r
-                                      + WebServiceName + " at " + WsURL +\r
-                                      " couldn't be located.",\r
-                                      "Internal Jalview Error",\r
-                                      JOptionPane.WARNING_MESSAGE);\r
-        wsInfo.setProgressText("Serious! " + WebServiceName +\r
-                               " Service location failed\nfor URL :"\r
-                               + WsURL + "\n" + ex.getMessage());\r
-        wsInfo.setStatus(wsInfo.STATE_STOPPED_SERVERERROR);\r
-        return false;\r
-      }\r
-      return true;\r
+import java.util.*;\r
+\r
+import javax.swing.*;\r
+\r
+import javax.xml.namespace.QName;\r
+\r
+\r
+public class JPredClient extends WSClient {\r
+    ext.vamsas.JPredWS server;\r
+    String altitle = "";\r
+    java.util.Hashtable SequenceInfo = null;\r
+\r
+    public JPredClient(String title, SequenceI[] msf) {\r
+        wsInfo = setWebService();\r
+\r
+        SequenceI seq = msf[0];\r
+        altitle = "JNet prediction on " + seq.getName() +\r
+            " using alignment from " + title;\r
+\r
+        wsInfo.setProgressText("Job details for MSA based prediction (" +\r
+            title + ") on sequence :\n>" + seq.getName() + "\n" +\r
+            AlignSeq.extractGaps("-. ", seq.getSequence()) + "\n");\r
+\r
+        SequenceInfo = jalview.analysis.SeqsetUtils.SeqCharacterHash(seq);\r
+\r
+        if (!locateWebService()) {\r
+            return;\r
+        }\r
+\r
+        JPredThread jthread = new JPredThread(msf);\r
+        jthread.start();\r
     }\r
 \r
-    public JPredClient(String title, SequenceI[] msf)\r
-    {\r
-      wsInfo = setWebService();\r
-      SequenceI seq = msf[0];\r
-      altitle = "JNet prediction on " + seq.getName() +\r
-          " using alignment from " + title;\r
-\r
-      wsInfo.setProgressText("Job details for MSA based prediction (" + title +\r
-                             ") on sequence :\n>"\r
-                             + seq.getName() + "\n"\r
-                             + AlignSeq.extractGaps("-. ", seq.getSequence()) +\r
-                             "\n");\r
-\r
-      SequenceInfo = jalview.analysis.SeqsetUtils.SeqCharacterHash(seq);\r
-      if (!locateWebService())\r
-        return;\r
-\r
-      JPredThread jthread = new JPredThread(msf);\r
-      jthread.start();\r
+    public JPredClient(String title, SequenceI seq) {\r
+        wsInfo = setWebService();\r
+        wsInfo.setProgressText("Job details for prediction on sequence :\n>" +\r
+            seq.getName() + "\n" +\r
+            AlignSeq.extractGaps("-. ", seq.getSequence()) + "\n");\r
+        altitle = "JNet prediction for sequence " + seq.getName() + " from " +\r
+            title;\r
+\r
+        SequenceInfo = jalview.analysis.SeqsetUtils.SeqCharacterHash(seq);\r
+\r
+        if (!locateWebService()) {\r
+            return;\r
+        }\r
+\r
+        JPredThread jthread = new JPredThread(seq);\r
+        jthread.start();\r
     }\r
 \r
-    public JPredClient(String title, SequenceI seq)\r
-    {\r
-      wsInfo = setWebService();\r
-      wsInfo.setProgressText("Job details for prediction on sequence :\n>"\r
-                             + seq.getName() + "\n" +\r
-                             AlignSeq.extractGaps("-. ", seq.getSequence()) +\r
-                             "\n");\r
-      altitle = "JNet prediction for sequence " + seq.getName() + " from " +\r
-          title;\r
+    private WebserviceInfo setWebService() {\r
+        WebServiceName = "JNetWS";\r
+        WebServiceJobTitle = "JNet secondary structure prediction";\r
+        WebServiceReference = "\"Cuff J. A and Barton G.J (1999) Application of enhanced " +\r
+            "multiple sequence alignment profiles to improve protein secondary structure prediction, " +\r
+            "Proteins 40:502-511\".";\r
+        WsURL = "http://www.compbio.dundee.ac.uk/JalviewWS/services/jpred";\r
 \r
-      SequenceInfo = jalview.analysis.SeqsetUtils.SeqCharacterHash(seq);\r
+        WebserviceInfo wsInfo = new WebserviceInfo(WebServiceJobTitle,\r
+                WebServiceReference);\r
 \r
-      if (!locateWebService())\r
-              return;\r
+        return wsInfo;\r
+    }\r
+\r
+    private boolean locateWebService() {\r
+        JPredWSServiceLocator loc = new JPredWSServiceLocator(); // Default\r
+\r
+        try {\r
+            this.server = loc.getjpred(new java.net.URL(WsURL)); // JBPNote will be set from properties\r
+            ((JpredSoapBindingStub) this.server).setTimeout(60000); // one minute stub\r
+        } catch (Exception ex) {\r
+            JOptionPane.showMessageDialog(Desktop.desktop,\r
+                "The Secondary Structure Prediction Service named " +\r
+                WebServiceName + " at " + WsURL + " couldn't be located.",\r
+                "Internal Jalview Error", JOptionPane.WARNING_MESSAGE);\r
+            wsInfo.setProgressText("Serious! " + WebServiceName +\r
+                " Service location failed\nfor URL :" + WsURL + "\n" +\r
+                ex.getMessage());\r
+            wsInfo.setStatus(wsInfo.STATE_STOPPED_SERVERERROR);\r
+\r
+            return false;\r
+        }\r
 \r
-      JPredThread jthread = new JPredThread(seq);\r
-      jthread.start();\r
+        return true;\r
     }\r
 \r
-    class JPredThread\r
-        extends Thread\r
-    {\r
-      String OutputHeader;\r
-      ext.vamsas.JpredResult result;\r
-      ext.vamsas.Sequence sequence;\r
-      ext.vamsas.Msfalignment msa;\r
-      String jobId;\r
-      boolean jobComplete = false;\r
-      int allowedServerExceptions = 3; // thread dies if too many exceptions.\r
-      JPredThread(SequenceI seq)\r
-      {\r
-        OutputHeader = wsInfo.getProgressText();\r
-        this.sequence = new ext.vamsas.Sequence();\r
-        this.sequence.setId(seq.getName());\r
-        this.sequence.setSeq(AlignSeq.extractGaps("-. ", seq.getSequence()));\r
-      }\r
-\r
-      JPredThread(SequenceI[] msf)\r
-      {\r
-        OutputHeader = wsInfo.getProgressText();\r
-        this.sequence = new ext.vamsas.Sequence();\r
-        this.sequence.setId(msf[0].getName());\r
-        this.sequence.setSeq(AlignSeq.extractGaps("-. ", msf[0].getSequence()));\r
-        jalview.io.PileUpfile mwrite = new jalview.io.PileUpfile();\r
-        this.msa = new ext.vamsas.Msfalignment();\r
-        msa.setMsf(mwrite.print(msf));\r
-      }\r
-\r
-      public void run()\r
-      {\r
-\r
-        StartJob();\r
-\r
-        while (!jobComplete && (allowedServerExceptions > 0))\r
-        {\r
-          try\r
-          {\r
-            if ( (result = server.getresult(jobId)) == null)\r
-            {\r
-              throw (new Exception(\r
-                  "Timed out when communicating with server\nTry again later.\n"));\r
-            }\r
+    class JPredThread extends Thread {\r
+        String OutputHeader;\r
+        ext.vamsas.JpredResult result;\r
+        ext.vamsas.Sequence sequence;\r
+        ext.vamsas.Msfalignment msa;\r
+        String jobId;\r
+        boolean jobComplete = false;\r
+        int allowedServerExceptions = 3; // thread dies if too many exceptions.\r
+\r
+        JPredThread(SequenceI seq) {\r
+            OutputHeader = wsInfo.getProgressText();\r
+            this.sequence = new ext.vamsas.Sequence();\r
+            this.sequence.setId(seq.getName());\r
+            this.sequence.setSeq(AlignSeq.extractGaps("-. ", seq.getSequence()));\r
+        }\r
 \r
-            if (result.isRunning())\r
-            {\r
-              wsInfo.setStatus(WebserviceInfo.STATE_RUNNING);\r
-            }\r
-            else if (result.isQueued())\r
-            {\r
-              wsInfo.setStatus(WebserviceInfo.STATE_QUEUING);\r
+        JPredThread(SequenceI[] msf) {\r
+            OutputHeader = wsInfo.getProgressText();\r
+            this.sequence = new ext.vamsas.Sequence();\r
+            this.sequence.setId(msf[0].getName());\r
+            this.sequence.setSeq(AlignSeq.extractGaps("-. ",\r
+                    msf[0].getSequence()));\r
+\r
+            jalview.io.PileUpfile mwrite = new jalview.io.PileUpfile();\r
+            this.msa = new ext.vamsas.Msfalignment();\r
+            msa.setMsf(mwrite.print(msf));\r
+        }\r
+\r
+        public void run() {\r
+            StartJob();\r
+\r
+            while (!jobComplete && (allowedServerExceptions > 0)) {\r
+                try {\r
+                    if ((result = server.getresult(jobId)) == null) {\r
+                        throw (new Exception(\r
+                            "Timed out when communicating with server\nTry again later.\n"));\r
+                    }\r
+\r
+                    if (result.isRunning()) {\r
+                        wsInfo.setStatus(WebserviceInfo.STATE_RUNNING);\r
+                    } else if (result.isQueued()) {\r
+                        wsInfo.setStatus(WebserviceInfo.STATE_QUEUING);\r
+                    }\r
+\r
+                    if (result.isFinished()) {\r
+                        parseResult();\r
+                        jobComplete = true;\r
+                        jobsRunning--;\r
+                    } else {\r
+                        wsInfo.setProgressText(OutputHeader + "\n" +\r
+                            result.getStatus());\r
+\r
+                        if (!(result.isJobFailed() || result.isServerError())) {\r
+                            try {\r
+                                Thread.sleep(5000);\r
+                            } catch (InterruptedException ex1) {\r
+                            }\r
+\r
+                            //  System.out.println("I'm alive "+seqid+" "+jobid);\r
+                        } else {\r
+                            wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_ERROR);\r
+                        }\r
+                    }\r
+                } catch (Exception ex) {\r
+                    allowedServerExceptions--;\r
+                    wsInfo.appendProgressText("\nJPredWS Server exception!\n" +\r
+                        ex.getMessage());\r
+\r
+                    try {\r
+                        if (allowedServerExceptions > 0) {\r
+                            Thread.sleep(5000);\r
+                        }\r
+                    } catch (InterruptedException ex1) {\r
+                    }\r
+                }\r
             }\r
 \r
-            if (result.isFinished())\r
-            {\r
-              parseResult();\r
-              jobComplete = true;\r
-              jobsRunning--;\r
+            if (!(result.isJobFailed() || result.isServerError())) {\r
+                wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_OK);\r
+            } else {\r
+                wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_ERROR);\r
             }\r
-            else\r
-            {\r
-              wsInfo.setProgressText(OutputHeader + "\n" + result.getStatus());\r
-              if (! (result.isJobFailed() || result.isServerError()))\r
-              {\r
-                try\r
-                {\r
-                  Thread.sleep(5000);\r
+        }\r
+\r
+        void StartJob() {\r
+            try {\r
+                if (msa != null) {\r
+                    jobId = server.predictOnMsa(msa);\r
+                } else {\r
+                    jobId = server.predict(sequence);\r
                 }\r
-                catch (InterruptedException ex1)\r
-                {\r
+\r
+                if (jobId != null) {\r
+                    if (jobId.startsWith("Broken")) {\r
+                        throw new Exception("Submission " + jobId);\r
+                    } else {\r
+                        System.out.println(WsURL + " Job Id '" + jobId + "'");\r
+                    }\r
+                } else {\r
+                    throw new Exception("Server timed out - try again later\n");\r
                 }\r
-                //  System.out.println("I'm alive "+seqid+" "+jobid);\r
-              }\r
-              else\r
-              {\r
-                wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_ERROR);\r
-              }\r
-            }\r
-          }\r
-          catch (Exception ex)\r
-          {\r
-            allowedServerExceptions--;\r
-            wsInfo.appendProgressText("\nJPredWS Server exception!\n" +\r
-                                      ex.getMessage());\r
-            try\r
-            {\r
-              if (allowedServerExceptions > 0)\r
-              {\r
-                Thread.sleep(5000);\r
-              }\r
-            }\r
-            catch (InterruptedException ex1)\r
-            {\r
+            } catch (Exception e) {\r
+                wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_SERVERERROR);\r
+                allowedServerExceptions = 0;\r
+                jobComplete = false;\r
+                wsInfo.appendProgressText("Failed to submit the prediction: " +\r
+                    e.toString() + "\nJust close the window\n");\r
+                System.err.println(\r
+                    "JPredWS Client: Failed to submit the prediction\n" +\r
+                    e.toString() + "\n");\r
+\r
+                // e.printStackTrace(); TODO: JBPNote DEBUG\r
             }\r
-          }\r
         }\r
 \r
-        if (! (result.isJobFailed() || result.isServerError()))\r
-        {\r
-          wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_OK);\r
-        }\r
-        else\r
-        {\r
-          wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_ERROR);\r
+        private void addFloatAnnotations(Alignment al, int[] gapmap,\r
+            Vector values, String Symname, String Visname, float min,\r
+            float max, int winLength) {\r
+            Annotation[] annotations = new Annotation[al.getWidth()];\r
+\r
+            for (int j = 0; j < values.size(); j++) {\r
+                float value = Float.parseFloat(values.get(j).toString());\r
+                annotations[gapmap[j]] = new Annotation("", value + "", ' ',\r
+                        value);\r
+            }\r
+\r
+            al.addAnnotation(new AlignmentAnnotation(Symname, Visname,\r
+                    annotations, min, max, winLength));\r
         }\r
-      }\r
-\r
-      void StartJob()\r
-      {\r
-        try\r
-        {\r
-          if (msa != null)\r
-          {\r
-            jobId = server.predictOnMsa(msa);\r
-          }\r
-          else\r
-          {\r
-            jobId = server.predict(sequence);\r
-          }\r
-          if (jobId != null)\r
-          {\r
-            if (jobId.startsWith("Broken"))\r
-            {\r
-              throw new Exception("Submission " + jobId);\r
+\r
+        void parseResult() {\r
+            // OutputHeader = output.getText();\r
+            if (result.isFailed()) {\r
+                OutputHeader += "Job failed.\n";\r
             }\r
-            else\r
-            {\r
-              System.out.println(WsURL + " Job Id '" + jobId + "'");\r
+\r
+            if (result.getStatus() != null) {\r
+                OutputHeader += ("\n" + result.getStatus());\r
             }\r
-          }\r
-          else\r
-          {\r
-            throw new Exception("Server timed out - try again later\n");\r
 \r
-          }\r
-        }\r
-        catch (Exception e)\r
-        {\r
-          wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_SERVERERROR);\r
-          allowedServerExceptions = 0;\r
-          jobComplete = false;\r
-          wsInfo.appendProgressText("Failed to submit the prediction: " +\r
-                                    e.toString() + "\nJust close the window\n");\r
-          System.err.println(\r
-              "JPredWS Client: Failed to submit the prediction\n" +\r
-              e.toString() + "\n");\r
-          // e.printStackTrace(); TODO: JBPNote DEBUG\r
-        }\r
-      }\r
-\r
-      private void addFloatAnnotations(Alignment al, int[] gapmap,\r
-                                       Vector values, String Symname,\r
-                                       String Visname, float min, float max,\r
-                                       int winLength)\r
-      {\r
-\r
-        Annotation[] annotations = new Annotation[al.getWidth()];\r
-        for (int j = 0; j < values.size(); j++)\r
-        {\r
-          float value = Float.parseFloat(values.get(j).toString());\r
-          annotations[gapmap[j]] = new Annotation("", value + "", ' ', value);\r
-        }\r
-        al.addAnnotation(new AlignmentAnnotation(Symname, Visname, annotations,\r
-                                                 min, max, winLength));\r
-      }\r
-\r
-      void parseResult()\r
-      {\r
-        // OutputHeader = output.getText();\r
-        if (result.isFailed())\r
-        {\r
-          OutputHeader += "Job failed.\n";\r
-        }\r
-        if (result.getStatus() != null)\r
-        {\r
-          OutputHeader += "\n" + result.getStatus();\r
-        }\r
-        if (result.getPredfile() != null)\r
-        {\r
-          OutputHeader += "\n" + result.getPredfile();\r
-          // JBPNote The returned files from a webservice could be hidden behind icons in the monitor window that, when clicked, pop up their corresponding data\r
-        }\r
-        if (result.getAligfile() != null)\r
-        {\r
-          OutputHeader += "\n" + result.getAligfile();\r
-        }\r
-        wsInfo.setProgressText(OutputHeader);\r
-        try\r
-        {\r
-          // JPredFile prediction = new JPredFile("C:/JalviewX/files/jpred.txt", "File");\r
-          jalview.io.JPredFile prediction = new jalview.io.JPredFile(result.\r
-              getPredfile(), "Paste");\r
-          SequenceI[] preds = prediction.getSeqsAsArray();\r
-          Alignment al;\r
-          int FirstSeq; // the position of the query sequence in Alignment al\r
-          boolean noMsa = true; // set if no MSA has been returned by JPred\r
-\r
-          if (this.msa != null && result.getAligfile() != null)\r
-          {\r
-            // we ignore the returned alignment if we only predicted on a single sequence\r
-            String format = jalview.io.IdentifyFile.Identify(result.getAligfile(),\r
-                "Paste");\r
-            if (jalview.io.FormatAdapter.formats.contains(format))\r
-            {\r
-              al = new Alignment(jalview.io.FormatAdapter.readFile(result.\r
-                  getAligfile(), "Paste", format));\r
-              noMsa = false;\r
-              FirstSeq = 0;\r
+            if (result.getPredfile() != null) {\r
+                OutputHeader += ("\n" + result.getPredfile());\r
+\r
+                // JBPNote The returned files from a webservice could be hidden behind icons in the monitor window that, when clicked, pop up their corresponding data\r
             }\r
-            else\r
-            {\r
-              throw (new Exception("Unknown format 'format' for file : \n" +\r
-                                   result.getAligfile()));\r
+\r
+            if (result.getAligfile() != null) {\r
+                OutputHeader += ("\n" + result.getAligfile());\r
             }\r
 \r
-          }\r
-          else\r
-          {\r
-            al = new Alignment(preds);\r
-            FirstSeq = prediction.getQuerySeqPosition();\r
-          }\r
-\r
-          if (!jalview.analysis.SeqsetUtils.SeqCharacterUnhash(al.getSequenceAt(\r
-              FirstSeq), SequenceInfo))\r
-          {\r
-            throw (new Exception(\r
-                "Couldn't recover sequence properties for JNet Query sequence!"));\r
-          }\r
-\r
-          AlignmentAnnotation annot;\r
-          Annotation[] annotations = null;\r
-          int i = 0;\r
-          int width = preds[0].getSequence().length();\r
-\r
-          int[] gapmap = al.getSequenceAt(FirstSeq).gapMap();\r
-\r
-          if (gapmap.length != width)\r
-          {\r
-            throw (new Exception(\r
-                "Jnet Client Error\nNumber of residues in supposed query sequence :\n"\r
-                + al.getSequenceAt(FirstSeq).getName() + "\n"\r
-                + al.getSequenceAt(FirstSeq).getSequence()\r
-                + "\nDiffer from number of prediction sites in \n" +\r
-                result.getPredfile() + "\n"));\r
-          }\r
-          // JBPNote Should also rename the query sequence sometime...\r
-          i = 0;\r
-          while (i < preds.length)\r
-          {\r
-            String id = preds[i].getName().toUpperCase();\r
-            if (id.startsWith("LUPAS") || id.startsWith("JNET") ||\r
-                id.startsWith("JPRED"))\r
-            {\r
-              annotations = new Annotation[al.getWidth()];\r
-\r
-              if (id.equals("JNETPRED")\r
-                  || id.equals("JNETPSSM")\r
-                  || id.equals("JNETFREQ")\r
-                  || id.equals("JNETHMM")\r
-                  || id.equals("JNETALIGN")\r
-                  || id.equals("JPRED"))\r
-              {\r
-                for (int j = 0; j < width; j++)\r
-                {\r
-                  annotations[gapmap[j]] = new Annotation("", "",\r
-                      preds[i].getCharAt(j), 0);\r
+            wsInfo.setProgressText(OutputHeader);\r
+\r
+            try {\r
+                // JPredFile prediction = new JPredFile("C:/JalviewX/files/jpred.txt", "File");\r
+                jalview.io.JPredFile prediction = new jalview.io.JPredFile(result.getPredfile(),\r
+                        "Paste");\r
+                SequenceI[] preds = prediction.getSeqsAsArray();\r
+                Alignment al;\r
+                int FirstSeq; // the position of the query sequence in Alignment al\r
+                boolean noMsa = true; // set if no MSA has been returned by JPred\r
+\r
+                if ((this.msa != null) && (result.getAligfile() != null)) {\r
+                    // we ignore the returned alignment if we only predicted on a single sequence\r
+                    String format = jalview.io.IdentifyFile.Identify(result.getAligfile(),\r
+                            "Paste");\r
+\r
+                    if (jalview.io.FormatAdapter.formats.contains(format)) {\r
+                        al = new Alignment(jalview.io.FormatAdapter.readFile(\r
+                                    result.getAligfile(), "Paste", format));\r
+                        noMsa = false;\r
+                        FirstSeq = 0;\r
+                    } else {\r
+                        throw (new Exception(\r
+                            "Unknown format 'format' for file : \n" +\r
+                            result.getAligfile()));\r
+                    }\r
+                } else {\r
+                    al = new Alignment(preds);\r
+                    FirstSeq = prediction.getQuerySeqPosition();\r
                 }\r
-              }\r
-              else if (id.equals("JNETCONF"))\r
-              {\r
-                for (int j = 0; j < width; j++)\r
-                {\r
-                  float value = Float.parseFloat(preds[i].getCharAt(j) + "");\r
-                  annotations[gapmap[j]] = new Annotation(preds[i].getCharAt(j) +\r
-                      "", "", preds[i].getCharAt(j), value);\r
+\r
+                if (!jalview.analysis.SeqsetUtils.SeqCharacterUnhash(\r
+                            al.getSequenceAt(FirstSeq), SequenceInfo)) {\r
+                    throw (new Exception(\r
+                        "Couldn't recover sequence properties for JNet Query sequence!"));\r
                 }\r
-              }\r
-              else\r
-              {\r
-                for (int j = 0; j < width; j++)\r
-                {\r
-                  annotations[gapmap[j]] = new Annotation(preds[i].getCharAt(j) +\r
-                      "", "", ' ', 0);\r
+\r
+                AlignmentAnnotation annot;\r
+                Annotation[] annotations = null;\r
+                int i = 0;\r
+                int width = preds[0].getSequence().length();\r
+\r
+                int[] gapmap = al.getSequenceAt(FirstSeq).gapMap();\r
+\r
+                if (gapmap.length != width) {\r
+                    throw (new Exception(\r
+                        "Jnet Client Error\nNumber of residues in supposed query sequence :\n" +\r
+                        al.getSequenceAt(FirstSeq).getName() + "\n" +\r
+                        al.getSequenceAt(FirstSeq).getSequence() +\r
+                        "\nDiffer from number of prediction sites in \n" +\r
+                        result.getPredfile() + "\n"));\r
                 }\r
-              }\r
-\r
-              if (id.equals("JNETCONF"))\r
-              {\r
-                annot = new AlignmentAnnotation(preds[i].getName(),\r
-                                                "JNet Output",\r
-                                                annotations, 0f, 10f, 1);\r
-              }\r
-\r
-              else\r
-              {\r
-                annot = new AlignmentAnnotation(preds[i].getName(),\r
-                                                "JNet Output",\r
-                                                annotations);\r
-              }\r
-              al.addAnnotation(annot);\r
-              if (noMsa)\r
-              {\r
-                al.deleteSequence(preds[i]);\r
-              }\r
-            }\r
-            i++;\r
-          }\r
 \r
-          Hashtable scores = prediction.getScores();\r
-          /*  addFloatAnnotations(al, gapmap,  (Vector)scores.get("JNETPROPH"),\r
-                                "JnetpropH", "Jnet Helix Propensity", 0f,1f,1);\r
+                // JBPNote Should also rename the query sequence sometime...\r
+                i = 0;\r
+\r
+                while (i < preds.length) {\r
+                    String id = preds[i].getName().toUpperCase();\r
+\r
+                    if (id.startsWith("LUPAS") || id.startsWith("JNET") ||\r
+                            id.startsWith("JPRED")) {\r
+                        annotations = new Annotation[al.getWidth()];\r
+\r
+                        if (id.equals("JNETPRED") || id.equals("JNETPSSM") ||\r
+                                id.equals("JNETFREQ") || id.equals("JNETHMM") ||\r
+                                id.equals("JNETALIGN") || id.equals("JPRED")) {\r
+                            for (int j = 0; j < width; j++) {\r
+                                annotations[gapmap[j]] = new Annotation("", "",\r
+                                        preds[i].getCharAt(j), 0);\r
+                            }\r
+                        } else if (id.equals("JNETCONF")) {\r
+                            for (int j = 0; j < width; j++) {\r
+                                float value = Float.parseFloat(preds[i].getCharAt(\r
+                                            j) + "");\r
+                                annotations[gapmap[j]] = new Annotation(preds[i].getCharAt(\r
+                                            j) + "", "", preds[i].getCharAt(j),\r
+                                        value);\r
+                            }\r
+                        } else {\r
+                            for (int j = 0; j < width; j++) {\r
+                                annotations[gapmap[j]] = new Annotation(preds[i].getCharAt(\r
+                                            j) + "", "", ' ', 0);\r
+                            }\r
+                        }\r
+\r
+                        if (id.equals("JNETCONF")) {\r
+                            annot = new AlignmentAnnotation(preds[i].getName(),\r
+                                    "JNet Output", annotations, 0f, 10f, 1);\r
+                        }\r
+                        else {\r
+                            annot = new AlignmentAnnotation(preds[i].getName(),\r
+                                    "JNet Output", annotations);\r
+                        }\r
+\r
+                        al.addAnnotation(annot);\r
+\r
+                        if (noMsa) {\r
+                            al.deleteSequence(preds[i]);\r
+                        }\r
+                    }\r
+\r
+                    i++;\r
+                }\r
 \r
-            addFloatAnnotations(al, gapmap,  (Vector)scores.get("JNETPROPB"),\r
-           "JnetpropB", "Jnet Beta Sheet Propensity", 0f,1f,1);\r
+                Hashtable scores = prediction.getScores();\r
 \r
-            addFloatAnnotations(al, gapmap,  (Vector)scores.get("JNETPROPC"),\r
-                                "JnetpropC", "Jnet Coil Propensity", 0f,1f,1);\r
-           */\r
-          AlignFrame af = new AlignFrame(al);\r
+                /*  addFloatAnnotations(al, gapmap,  (Vector)scores.get("JNETPROPH"),\r
+                                      "JnetpropH", "Jnet Helix Propensity", 0f,1f,1);\r
 \r
-          Desktop.addInternalFrame(af,\r
-                                   altitle,\r
-                                   AlignFrame.NEW_WINDOW_WIDTH,\r
-                                   AlignFrame.NEW_WINDOW_HEIGHT);\r
-        }\r
-        catch (Exception ex)\r
-        {\r
-          ex.printStackTrace();\r
-        }\r
+                  addFloatAnnotations(al, gapmap,  (Vector)scores.get("JNETPROPB"),\r
+                 "JnetpropB", "Jnet Beta Sheet Propensity", 0f,1f,1);\r
 \r
-      }\r
+                  addFloatAnnotations(al, gapmap,  (Vector)scores.get("JNETPROPC"),\r
+                                      "JnetpropC", "Jnet Coil Propensity", 0f,1f,1);\r
+                 */\r
+                AlignFrame af = new AlignFrame(al);\r
 \r
+                Desktop.addInternalFrame(af, altitle,\r
+                    AlignFrame.NEW_WINDOW_WIDTH, AlignFrame.NEW_WINDOW_HEIGHT);\r
+            } catch (Exception ex) {\r
+                ex.printStackTrace();\r
+            }\r
+        }\r
     }\r
-  }\r
+}\r
index 32f5c43..b5e7938 100755 (executable)
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
-*/
-
-package jalview.ws;
-
-import org.apache.axis.client.*;
-import javax.xml.namespace.QName;
-import java.util.*;
-import jalview.datamodel.*;
-import jalview.gui.*;
-import javax.swing.*;
-import java.util.*;
-import java.awt.*;
-import jalview.analysis.AlignSeq;
-import ext.vamsas.*;
-import vamsas.objects.*;
-
-
-
-
-public class MsaWSClient
-    extends WSClient
-{
+*/\r
+package jalview.ws;\r
+\r
+import ext.vamsas.*;\r
+\r
+import jalview.analysis.AlignSeq;\r
+\r
+import jalview.datamodel.*;\r
+\r
+import jalview.gui.*;\r
+\r
+import org.apache.axis.client.*;\r
+\r
+import vamsas.objects.*;\r
+\r
+import java.awt.*;\r
+\r
+import java.util.*;\r
+\r
+import javax.swing.*;\r
+\r
+import javax.xml.namespace.QName;\r
+\r
+\r
+public class MsaWSClient extends WSClient {\r
     /**
-     * server is a WSDL2Java generated stub for an archetypal MsaWSI service.
-     */
-    ext.vamsas.MuscleWS server;
-    // JBPNote Nasty object-global state setting methods shouldn't be allowed
-  private boolean setWebService(String MsaWSName) {
-    if (MsaWServices.info.containsKey(MsaWSName)) {
-      WebServiceName = MsaWSName;
-      String[] wsinfo = (String[]) MsaWServices.info.get(MsaWSName);
-      WsURL = wsinfo[0];
-      WebServiceJobTitle = wsinfo[1];
-      WebServiceReference = wsinfo[2];
-      return true;
-    } else {
-      return false;
-    }
-  }
-
-  private boolean locateWebService() {
-      // TODO: MuscleWS transmuted to generic MsaWS client
-      MuscleWSServiceLocator loc = new MuscleWSServiceLocator(); // Default
-      try {
-        this.server = (MuscleWS) loc.getMuscleWS(new java.net.URL(WsURL));
-        ((MuscleWSSoapBindingStub) this.server).setTimeout(60000); // One minute timeout
-      }
-      catch (Exception ex) {
-        wsInfo.setProgressText("Serious! "+WebServiceName+" Service location failed\nfor URL :"
-                       +WsURL+"\n"+ex.getMessage());
-        wsInfo.setStatus(wsInfo.ERROR);
-        ex.printStackTrace();
-        return false;
-      }
-      loc.getEngine().setOption("axis","1");
-      return true;
-  }
-
-  public MsaWSClient(String MsaWSName, String altitle, SequenceI[] msa, boolean submitGaps, boolean preserveOrder)
-  {
-    if (setWebService(MsaWSName)==false) {
-      JOptionPane.showMessageDialog(Desktop.desktop, "The Multiple Sequence Alignment Service named "+MsaWSName+" is unknown",
-                                    "Internal Jalview Error", JOptionPane.WARNING_MESSAGE);
-      return;
-    }
-
-    wsInfo = new jalview.gui.WebserviceInfo(WebServiceJobTitle, WebServiceReference);
-
-    if (!locateWebService())
-      return;
-
-    wsInfo.setProgressText(((submitGaps) ? "Re-alignment" : "Alignment")+" of "+altitle+"\nJob details\n");
-
-    MsaWSThread musclethread = new MsaWSThread(WebServiceName+" alignment of "+altitle, msa, submitGaps, preserveOrder);
-    wsInfo.setthisService(musclethread);
-    musclethread.start();
-  }
-
-
-  protected class MsaWSThread extends Thread implements WSClientI
-  {
-    String ServiceName = WebServiceName;
-
-    public boolean isCancellable()
-    {
-      return true;
-    }
-
-    String OutputHeader;
-    vamsas.objects.simple.MsaResult result = null;
-
-    vamsas.objects.simple.SequenceSet seqs = new vamsas.objects.simple.
-        SequenceSet();
-
-    Hashtable SeqNames = null;
-    boolean submitGaps = false,// default is to strip gaps from sequences
-        preserveOrder = true; // and always store and recover sequence order
-
-    String jobId;
-    String alTitle; // name which will be used to form new alignment window.
-    int allowedServerExceptions = 3; // thread dies if too many exceptions.
-    MsaWSThread(String title, SequenceI[] msa, boolean subgaps, boolean presorder)
-    {
-      alTitle = title;
-      submitGaps = subgaps;
-      preserveOrder = presorder;
-
-      OutputHeader = wsInfo.getProgressText();
-      SeqNames = new Hashtable();
-      vamsas.objects.simple.Sequence[] seqarray = new vamsas.objects.simple.
-          Sequence[msa.length];
-
-      for (int i = 0; i < msa.length; i++)
-      {
-        String newname = jalview.analysis.SeqsetUtils.unique_name(i);
-        // uniquify as we go
-        // TODO: JBPNote: this is a ubiquitous transformation - set of jalview seq objects to vamsas sequences with name preservation
-        SeqNames.put(newname, jalview.analysis.SeqsetUtils.SeqCharacterHash(msa[i]));
-        seqarray[i] = new vamsas.objects.simple.Sequence();
-        seqarray[i].setId(newname);
-        seqarray[i].setSeq((submitGaps) ? msa[i].getSequence()
-                           : AlignSeq.extractGaps(jalview.util.Comparison.GapChars, msa[i].getSequence()));
-      }
-
-      this.seqs = new vamsas.objects.simple.SequenceSet();
-      this.seqs.setSeqs(seqarray);
-    }
-
-    boolean jobComplete = false;
-
-    public void cancelJob() {
-      if (jobId!=null && !jobId.equals("") && !jobComplete) {
-        String cancelledMessage="";
-        try {
-          vamsas.objects.simple.WsJobId cancelledJob = server.cancel(jobId);
-          if (cancelledJob.getStatus() == 2)
-          {
-            // CANCELLED_JOB
-            cancelledMessage = "Job cancelled.";
-            wsInfo.setStatus(WebserviceInfo.STATE_CANCELLED_OK);
-            jobComplete = true;
-            jobsRunning--;
-            result = null;
-          }
-          else
-          if (cancelledJob.getStatus() == 3)
-          {
-            // VALID UNSTOPPABLE JOB
-            cancelledMessage +=
-                "Server cannot cancel this job. just close the window.\n";
-          }
-          if (cancelledJob.getJobId() != null)
-            cancelledMessage += "[" + cancelledJob.getJobId() + "]";
-          cancelledMessage +="\n";
-        } catch (Exception exc) {
-          cancelledMessage +="\nProblems cancelling the job : Exception received...\n"+exc+"\n";
-          exc.printStackTrace();
-        }
-        wsInfo.setProgressText(OutputHeader + cancelledMessage+"\n");
-      } else {
-        if (!jobComplete)
-        {
-          wsInfo.setProgressText(OutputHeader + "Server cannot cancel this job because it has not been submitted properly. just close the window.\n");
-        }
-      }
-    }
-
-    public void run()
-    {
-
-      StartJob();
-
-      while (!jobComplete && (allowedServerExceptions > 0))
-      {
-        try
-        {
-          if ((result = server.getResult(jobId))==null)
-            throw(new Exception("Timed out when communicating with server\nTry again later.\n"));
-
-          if (result.isRunning())
-            wsInfo.setStatus(WebserviceInfo.STATE_RUNNING);
-          else if (result.isQueued())
-            wsInfo.setStatus(WebserviceInfo.STATE_QUEUING);
-
-          if (result.isFinished())
-          {
-            parseResult();
-            jobComplete = true;
-            jobsRunning--;
-          }
-          else
-          {
-            if (result.getStatus() != null)
-              wsInfo.setProgressText(OutputHeader + "\n" + result.getStatus());
-            if (! (result.isJobFailed() || result.isServerError()))
-            {
-              Thread.sleep(5000);
-              //  System.out.println("I'm alive "+seqid+" "+jobid);
-            }
-            else
-            {
-              break;
-            }
-          }
-        }
-        catch (Exception ex)
-        {
-          allowedServerExceptions--;
-          wsInfo.appendProgressText("\n" + ServiceName + " Server exception!\n" +
-                                    ex.getMessage());
-          System.err.println(ServiceName + " Server exception: " +
-                                    ex.getMessage());
-          //          ex.printStackTrace(); JBPNote Debug
-          try
-          {
-            if (allowedServerExceptions>0)
-              Thread.sleep(5000);
-          }
-          catch (InterruptedException ex1)
-          {
-          }
-
-        }
-      }
-      if (allowedServerExceptions == 0)
-      {
-        wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_SERVERERROR);
-      }
-      else
-      {
-        if (! (result != null && (result.isJobFailed() || result.isServerError())))
-          wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_OK);
-        else
-        {
-          if (result.isFailed())
-            wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_ERROR);
-          if (result.isServerError())
-            wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_SERVERERROR);
-        }
-      }
-    }
-    void StartJob()
-    {
-      try
-      {
-        vamsas.objects.simple.WsJobId jobsubmit = server.align(seqs);
-        if (jobsubmit!=null && jobsubmit.getStatus()==1) {
-          jobId=jobsubmit.getJobId();
-          System.out.println(WsURL+" Job Id '"+jobId+"'");
-        } else {
-          if (jobsubmit == null) {
-            throw new Exception("Server at "+WsURL+" returned null object, it probably cannot be contacted. Try again later ?");
-          }
-          throw new Exception(jobsubmit.getJobId());
-        }
-      }
-      catch (Exception e)
-      {
-        // TODO: JBPNote catch timeout or other fault types explicitly
-        // For unexpected errors
-        System.err.println(WebServiceName + " Client: Failed to submit the sequences for alignment.\n"+WsURL+" : " +
-                           e.toString() + "\n");
-        this.allowedServerExceptions=0;
-        wsInfo.setStatus(wsInfo.STATE_STOPPED_SERVERERROR);
-        wsInfo.appendProgressText("Server problems! "+e.toString()+"\nFailed to submit sequences for alignment. Just close the window\n");
-        // e.printStackTrace(); // TODO: JBPNote DEBUG
-      }
-    }
-
-    private void addFloatAnnotations(Alignment al, int[] gapmap, Vector values, String Symname, String Visname, float min, float max, int winLength) {
-
-      Annotation[] annotations = new Annotation[al.getWidth()];
-      for (int j = 0; j < values.size(); j++)
-      {
-        float value = Float.parseFloat(values.get(j).toString());
-        annotations[gapmap[j]] = new Annotation("", value+"",' ',value);
-      }
-      al.addAnnotation(new AlignmentAnnotation(Symname, Visname, annotations, min, max, winLength));
-    }
-    private jalview.datamodel.Sequence[] getVamsasAlignment(vamsas.objects.simple.Alignment valign) {
-      vamsas.objects.simple.Sequence[] seqs = valign.getSeqs().getSeqs();
-      jalview.datamodel.Sequence[] msa = new jalview.datamodel.Sequence[seqs.length];
-      for (int i=0, j=seqs.length; i<j;i++)
-        msa[i] = new jalview.datamodel.Sequence(seqs[i].getId(), seqs[i].getSeq());
-      return msa;
-    }
-    void parseResult()
-    {
-      SequenceI[] seqs=null;
-      try {
-        // OutputHeader = output.getText();
-        if (result.isFailed()) {
-          OutputHeader +="Job failed.\n";
-        }
-        if (result.getStatus()!=null) {
-          OutputHeader += "\n"+result.getStatus();
-        }
-        if (result.getMsa()!=null) {
-          OutputHeader += "\nAlignment Object Method Notes\n";
-          String lines[] = result.getMsa().getMethod();
-          for (int line=0;line<lines.length; line++)
-            OutputHeader+=lines[line]+"\n";
-
-          // JBPNote The returned files from a webservice could be hidden behind icons in the monitor window that, when clicked, pop up their corresponding data
-          seqs = getVamsasAlignment(result.getMsa());
-        }
-
-        wsInfo.setProgressText(OutputHeader);
-        if (seqs!=null) {
-          AlignmentOrder msaorder = new AlignmentOrder(seqs);
-
-          if (preserveOrder) {
-            jalview.analysis.AlignmentSorter.recoverOrder(seqs);
-          }
-
-          jalview.analysis.SeqsetUtils.deuniquify(SeqNames, seqs);
-
-          Alignment al = new Alignment(seqs);
-
-          // TODO: JBPNote Should also rename the query sequence sometime...
-          AlignFrame af = new AlignFrame(al);
-          af.addSortByOrderMenuItem(ServiceName+" Ordering", msaorder);
-
-          Desktop.addInternalFrame(af,
-                                   alTitle,
-                                   AlignFrame.NEW_WINDOW_WIDTH,
-                                   AlignFrame.NEW_WINDOW_HEIGHT);
-        }
-      }catch(Exception ex){ex.printStackTrace();}
-
-    }
-
-  }
-}
-
-
+ * server is a WSDL2Java generated stub for an archetypal MsaWSI service.
+ */\r
+    ext.vamsas.MuscleWS server;\r
+\r
+    public MsaWSClient(String MsaWSName, String altitle, SequenceI[] msa,\r
+        boolean submitGaps, boolean preserveOrder) {\r
+        if (setWebService(MsaWSName) == false) {\r
+            JOptionPane.showMessageDialog(Desktop.desktop,\r
+                "The Multiple Sequence Alignment Service named " + MsaWSName +\r
+                " is unknown", "Internal Jalview Error",\r
+                JOptionPane.WARNING_MESSAGE);\r
+\r
+            return;\r
+        }\r
+\r
+        wsInfo = new jalview.gui.WebserviceInfo(WebServiceJobTitle,\r
+                WebServiceReference);\r
+\r
+        if (!locateWebService()) {\r
+            return;\r
+        }\r
+\r
+        wsInfo.setProgressText(((submitGaps) ? "Re-alignment" : "Alignment") +\r
+            " of " + altitle + "\nJob details\n");\r
+\r
+        MsaWSThread musclethread = new MsaWSThread(WebServiceName +\r
+                " alignment of " + altitle, msa, submitGaps, preserveOrder);\r
+        wsInfo.setthisService(musclethread);\r
+        musclethread.start();\r
+    }\r
+\r
+    // JBPNote Nasty object-global state setting methods shouldn't be allowed\r
+    private boolean setWebService(String MsaWSName) {\r
+        if (MsaWServices.info.containsKey(MsaWSName)) {\r
+            WebServiceName = MsaWSName;\r
+\r
+            String[] wsinfo = (String[]) MsaWServices.info.get(MsaWSName);\r
+            WsURL = wsinfo[0];\r
+            WebServiceJobTitle = wsinfo[1];\r
+            WebServiceReference = wsinfo[2];\r
+\r
+            return true;\r
+        } else {\r
+            return false;\r
+        }\r
+    }\r
+\r
+    private boolean locateWebService() {\r
+        // TODO: MuscleWS transmuted to generic MsaWS client\r
+        MuscleWSServiceLocator loc = new MuscleWSServiceLocator(); // Default\r
+\r
+        try {\r
+            this.server = (MuscleWS) loc.getMuscleWS(new java.net.URL(WsURL));\r
+            ((MuscleWSSoapBindingStub) this.server).setTimeout(60000); // One minute timeout\r
+        } catch (Exception ex) {\r
+            wsInfo.setProgressText("Serious! " + WebServiceName +\r
+                " Service location failed\nfor URL :" + WsURL + "\n" +\r
+                ex.getMessage());\r
+            wsInfo.setStatus(wsInfo.ERROR);\r
+            ex.printStackTrace();\r
+\r
+            return false;\r
+        }\r
+\r
+        loc.getEngine().setOption("axis", "1");\r
+\r
+        return true;\r
+    }\r
+\r
+    protected class MsaWSThread extends Thread implements WSClientI {\r
+        String ServiceName = WebServiceName;\r
+        String OutputHeader;\r
+        vamsas.objects.simple.MsaResult result = null;\r
+        vamsas.objects.simple.SequenceSet seqs = new vamsas.objects.simple.SequenceSet();\r
+        Hashtable SeqNames = null;\r
+        boolean submitGaps = false; // and always store and recover sequence order\r
+        boolean preserveOrder = true; // and always store and recover sequence order\r
+        String jobId;\r
+        String alTitle; // name which will be used to form new alignment window.\r
+        int allowedServerExceptions = 3; // thread dies if too many exceptions.\r
+        boolean jobComplete = false;\r
+\r
+        MsaWSThread(String title, SequenceI[] msa, boolean subgaps,\r
+            boolean presorder) {\r
+            alTitle = title;\r
+            submitGaps = subgaps;\r
+            preserveOrder = presorder;\r
+\r
+            OutputHeader = wsInfo.getProgressText();\r
+            SeqNames = new Hashtable();\r
+\r
+            vamsas.objects.simple.Sequence[] seqarray = new vamsas.objects.simple.Sequence[msa.length];\r
+\r
+            for (int i = 0; i < msa.length; i++) {\r
+                String newname = jalview.analysis.SeqsetUtils.unique_name(i);\r
+\r
+                // uniquify as we go\r
+                // TODO: JBPNote: this is a ubiquitous transformation - set of jalview seq objects to vamsas sequences with name preservation\r
+                SeqNames.put(newname,\r
+                    jalview.analysis.SeqsetUtils.SeqCharacterHash(msa[i]));\r
+                seqarray[i] = new vamsas.objects.simple.Sequence();\r
+                seqarray[i].setId(newname);\r
+                seqarray[i].setSeq((submitGaps) ? msa[i].getSequence()\r
+                                                : AlignSeq.extractGaps(\r
+                        jalview.util.Comparison.GapChars, msa[i].getSequence()));\r
+            }\r
+\r
+            this.seqs = new vamsas.objects.simple.SequenceSet();\r
+            this.seqs.setSeqs(seqarray);\r
+        }\r
+\r
+        public boolean isCancellable() {\r
+            return true;\r
+        }\r
+\r
+        public void cancelJob() {\r
+            if ((jobId != null) && !jobId.equals("") && !jobComplete) {\r
+                String cancelledMessage = "";\r
+\r
+                try {\r
+                    vamsas.objects.simple.WsJobId cancelledJob = server.cancel(jobId);\r
+\r
+                    if (cancelledJob.getStatus() == 2) {\r
+                        // CANCELLED_JOB\r
+                        cancelledMessage = "Job cancelled.";\r
+                        wsInfo.setStatus(WebserviceInfo.STATE_CANCELLED_OK);\r
+                        jobComplete = true;\r
+                        jobsRunning--;\r
+                        result = null;\r
+                    } else if (cancelledJob.getStatus() == 3) {\r
+                        // VALID UNSTOPPABLE JOB\r
+                        cancelledMessage += "Server cannot cancel this job. just close the window.\n";\r
+                    }\r
+\r
+                    if (cancelledJob.getJobId() != null) {\r
+                        cancelledMessage += ("[" + cancelledJob.getJobId() +\r
+                        "]");\r
+                    }\r
+\r
+                    cancelledMessage += "\n";\r
+                } catch (Exception exc) {\r
+                    cancelledMessage += ("\nProblems cancelling the job : Exception received...\n" +\r
+                    exc + "\n");\r
+                    exc.printStackTrace();\r
+                }\r
+\r
+                wsInfo.setProgressText(OutputHeader + cancelledMessage + "\n");\r
+            } else {\r
+                if (!jobComplete) {\r
+                    wsInfo.setProgressText(OutputHeader +\r
+                        "Server cannot cancel this job because it has not been submitted properly. just close the window.\n");\r
+                }\r
+            }\r
+        }\r
+\r
+        public void run() {\r
+            StartJob();\r
+\r
+            while (!jobComplete && (allowedServerExceptions > 0)) {\r
+                try {\r
+                    if ((result = server.getResult(jobId)) == null) {\r
+                        throw (new Exception(\r
+                            "Timed out when communicating with server\nTry again later.\n"));\r
+                    }\r
+\r
+                    if (result.isRunning()) {\r
+                        wsInfo.setStatus(WebserviceInfo.STATE_RUNNING);\r
+                    } else if (result.isQueued()) {\r
+                        wsInfo.setStatus(WebserviceInfo.STATE_QUEUING);\r
+                    }\r
+\r
+                    if (result.isFinished()) {\r
+                        parseResult();\r
+                        jobComplete = true;\r
+                        jobsRunning--;\r
+                    } else {\r
+                        if (result.getStatus() != null) {\r
+                            wsInfo.setProgressText(OutputHeader + "\n" +\r
+                                result.getStatus());\r
+                        }\r
+\r
+                        if (!(result.isJobFailed() || result.isServerError())) {\r
+                            Thread.sleep(5000);\r
+\r
+                            //  System.out.println("I'm alive "+seqid+" "+jobid);\r
+                        } else {\r
+                            break;\r
+                        }\r
+                    }\r
+                } catch (Exception ex) {\r
+                    allowedServerExceptions--;\r
+                    wsInfo.appendProgressText("\n" + ServiceName +\r
+                        " Server exception!\n" + ex.getMessage());\r
+                    System.err.println(ServiceName + " Server exception: " +\r
+                        ex.getMessage());\r
+\r
+                    //          ex.printStackTrace(); JBPNote Debug\r
+                    try {\r
+                        if (allowedServerExceptions > 0) {\r
+                            Thread.sleep(5000);\r
+                        }\r
+                    } catch (InterruptedException ex1) {\r
+                    }\r
+                }\r
+            }\r
+\r
+            if (allowedServerExceptions == 0) {\r
+                wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_SERVERERROR);\r
+            } else {\r
+                if (!((result != null) &&\r
+                        (result.isJobFailed() || result.isServerError()))) {\r
+                    wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_OK);\r
+                } else {\r
+                    if (result.isFailed()) {\r
+                        wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_ERROR);\r
+                    }\r
+\r
+                    if (result.isServerError()) {\r
+                        wsInfo.setStatus(WebserviceInfo.STATE_STOPPED_SERVERERROR);\r
+                    }\r
+                }\r
+            }\r
+        }\r
+\r
+        void StartJob() {\r
+            try {\r
+                vamsas.objects.simple.WsJobId jobsubmit = server.align(seqs);\r
+\r
+                if ((jobsubmit != null) && (jobsubmit.getStatus() == 1)) {\r
+                    jobId = jobsubmit.getJobId();\r
+                    System.out.println(WsURL + " Job Id '" + jobId + "'");\r
+                } else {\r
+                    if (jobsubmit == null) {\r
+                        throw new Exception("Server at " + WsURL +\r
+                            " returned null object, it probably cannot be contacted. Try again later ?");\r
+                    }\r
+\r
+                    throw new Exception(jobsubmit.getJobId());\r
+                }\r
+            } catch (Exception e) {\r
+                // TODO: JBPNote catch timeout or other fault types explicitly\r
+                // For unexpected errors\r
+                System.err.println(WebServiceName +\r
+                    " Client: Failed to submit the sequences for alignment.\n" +\r
+                    WsURL + " : " + e.toString() + "\n");\r
+                this.allowedServerExceptions = 0;\r
+                wsInfo.setStatus(wsInfo.STATE_STOPPED_SERVERERROR);\r
+                wsInfo.appendProgressText("Server problems! " + e.toString() +\r
+                    "\nFailed to submit sequences for alignment. Just close the window\n");\r
+\r
+                // e.printStackTrace(); // TODO: JBPNote DEBUG\r
+            }\r
+        }\r
+\r
+        private void addFloatAnnotations(Alignment al, int[] gapmap,\r
+            Vector values, String Symname, String Visname, float min,\r
+            float max, int winLength) {\r
+            Annotation[] annotations = new Annotation[al.getWidth()];\r
+\r
+            for (int j = 0; j < values.size(); j++) {\r
+                float value = Float.parseFloat(values.get(j).toString());\r
+                annotations[gapmap[j]] = new Annotation("", value + "", ' ',\r
+                        value);\r
+            }\r
+\r
+            al.addAnnotation(new AlignmentAnnotation(Symname, Visname,\r
+                    annotations, min, max, winLength));\r
+        }\r
+\r
+        private jalview.datamodel.Sequence[] getVamsasAlignment(\r
+            vamsas.objects.simple.Alignment valign) {\r
+            vamsas.objects.simple.Sequence[] seqs = valign.getSeqs().getSeqs();\r
+            jalview.datamodel.Sequence[] msa = new jalview.datamodel.Sequence[seqs.length];\r
+\r
+            for (int i = 0, j = seqs.length; i < j; i++)\r
+                msa[i] = new jalview.datamodel.Sequence(seqs[i].getId(),\r
+                        seqs[i].getSeq());\r
+\r
+            return msa;\r
+        }\r
+\r
+        void parseResult() {\r
+            SequenceI[] seqs = null;\r
+\r
+            try {\r
+                // OutputHeader = output.getText();\r
+                if (result.isFailed()) {\r
+                    OutputHeader += "Job failed.\n";\r
+                }\r
+\r
+                if (result.getStatus() != null) {\r
+                    OutputHeader += ("\n" + result.getStatus());\r
+                }\r
+\r
+                if (result.getMsa() != null) {\r
+                    OutputHeader += "\nAlignment Object Method Notes\n";\r
+\r
+                    String[] lines = result.getMsa().getMethod();\r
+\r
+                    for (int line = 0; line < lines.length; line++)\r
+                        OutputHeader += (lines[line] + "\n");\r
+\r
+                    // JBPNote The returned files from a webservice could be hidden behind icons in the monitor window that, when clicked, pop up their corresponding data\r
+                    seqs = getVamsasAlignment(result.getMsa());\r
+                }\r
+\r
+                wsInfo.setProgressText(OutputHeader);\r
+\r
+                if (seqs != null) {\r
+                    AlignmentOrder msaorder = new AlignmentOrder(seqs);\r
+\r
+                    if (preserveOrder) {\r
+                        jalview.analysis.AlignmentSorter.recoverOrder(seqs);\r
+                    }\r
+\r
+                    jalview.analysis.SeqsetUtils.deuniquify(SeqNames, seqs);\r
+\r
+                    Alignment al = new Alignment(seqs);\r
+\r
+                    // TODO: JBPNote Should also rename the query sequence sometime...\r
+                    AlignFrame af = new AlignFrame(al);\r
+                    af.addSortByOrderMenuItem(ServiceName + " Ordering",\r
+                        msaorder);\r
+\r
+                    Desktop.addInternalFrame(af, alTitle,\r
+                        AlignFrame.NEW_WINDOW_WIDTH,\r
+                        AlignFrame.NEW_WINDOW_HEIGHT);\r
+                }\r
+            } catch (Exception ex) {\r
+                ex.printStackTrace();\r
+            }\r
+        }\r
+    }\r
+}\r
index f881bd5..ac89f68 100755 (executable)
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
-*/
-
-package jalview.ws;
-import java.util.Hashtable;
+*/\r
+package jalview.ws;\r
+\r
+import java.util.Hashtable;\r
+\r
+\r
 /**
  * <p>Title: MsaWServices </p>
  *
@@ -30,32 +32,31 @@ import java.util.Hashtable;
  *
  * @author not attributable
  * @version 1.0
- */
+ */\r
 /**
  * TODO: MsaWServices will be set from properties and be dynamically discovered.
- */
-public class MsaWServices {
-  public static Hashtable info;
-  static
-  {
-    info = new Hashtable();
-    info.put("ClustalWS",
-             new String[]
-             {
-             "http://www.compbio.dundee.ac.uk/JalviewWS/services/ClustalWS",
-             "ClustalW Alignment job",
-             "\"Thompson, J.D., Higgins, D.G. and Gibson, T.J. (1994) CLUSTAL W: improving the sensitivity of progressive multiple" +
-             " sequence alignment through sequence weighting, position specific gap penalties and weight matrix choice."
-             + " Nucleic Acids Research, submitted, June 1994."
-    });
-    info.put("MuscleWS",
-             new String[]
-             {
-             "http://www.compbio.dundee.ac.uk/JalviewWS/services/MuscleWS",
-             "Muscle Alignment job",
-             "Edgar, Robert C. (2004), MUSCLE: multiple sequence alignment "
-             +
-             "with high accuracy and high throughput, Nucleic Acids Research 32(5), 1792-97."
-    });
-  };
-}
+ */\r
+public class MsaWServices {\r
+    public static Hashtable info;\r
+\r
+    static {\r
+        info = new Hashtable();\r
+        info.put("ClustalWS",\r
+            new String[] {\r
+                "http://www.compbio.dundee.ac.uk/JalviewWS/services/ClustalWS",\r
+                "ClustalW Alignment job",\r
+                \r
+            "\"Thompson, J.D., Higgins, D.G. and Gibson, T.J. (1994) CLUSTAL W: improving the sensitivity of progressive multiple" +\r
+                " sequence alignment through sequence weighting, position specific gap penalties and weight matrix choice." +\r
+                " Nucleic Acids Research, submitted, June 1994."\r
+            });\r
+        info.put("MuscleWS",\r
+            new String[] {\r
+                "http://www.compbio.dundee.ac.uk/JalviewWS/services/MuscleWS",\r
+                "Muscle Alignment job",\r
+                \r
+            "Edgar, Robert C. (2004), MUSCLE: multiple sequence alignment " +\r
+                "with high accuracy and high throughput, Nucleic Acids Research 32(5), 1792-97."\r
+            });\r
+    }\r
+}\r
index 1d03eab..506bd9b 100755 (executable)
 * 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
-*/
+*/\r
+package jalview.ws;\r
+\r
+import jalview.gui.WebserviceInfo;\r
+\r
+\r
+public class WSClient {\r
+    /**
 
-package jalview.ws;
-
-import jalview.gui.WebserviceInfo;
-
-public class WSClient
-{
-  public WSClient()
-  {
-  }
-  /**
-
-  * MsaWSClient
-  *
-  * @param msa SequenceI[]
-  */
-
- protected String WebServiceName;
- protected String WebServiceJobTitle;
- protected String WebServiceReference;
- protected String WsURL;
- protected WebserviceInfo wsInfo;
-  int jobsRunning = 0;
-}
+* MsaWSClient
+*
+* @param msa SequenceI[]
+*/\r
+    protected String WebServiceName;\r
+    protected String WebServiceJobTitle;\r
+    protected String WebServiceReference;\r
+    protected String WsURL;\r
+    protected WebserviceInfo wsInfo;\r
+    int jobsRunning = 0;\r
+\r
+    public WSClient() {\r
+    }\r
+}\r
index 7bd4ab8..c2db8c1 100755 (executable)
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
-*/
-
-package jalview.ws;
-
-public interface WSClientI
-{
-  boolean isCancellable();
-  void cancelJob();
-}
+*/\r
+package jalview.ws;\r
+\r
+public interface WSClientI {\r
+    boolean isCancellable();\r
+\r
+    void cancelJob();\r
+}\r
index 177d373..574a1e9 100755 (executable)
@@ -3,8 +3,8 @@
  *
  * This file was auto-generated from WSDL
  * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter.
- */
-
+ */\r
+\r
 /*
 * Jalview - A Sequence Alignment Editor and Viewer
 * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
 * 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 vamsas.objects.simple;
-
-public class Alignment  extends vamsas.objects.simple.Object  implements java.io.Serializable {
-    private java.lang.String gapchar;
-    private java.lang.String[] method;
-    private vamsas.objects.simple.SequenceSet seqs;
-
-    public Alignment() {
-    }
-
-    public Alignment(
-           java.lang.String gapchar,
-           java.lang.String[] method,
-           vamsas.objects.simple.SequenceSet seqs) {
-           this.gapchar = gapchar;
-           this.method = method;
-           this.seqs = seqs;
-    }
-
-
+*/\r
+package vamsas.objects.simple;\r
+\r
+public class Alignment extends vamsas.objects.simple.Object\r
+    implements java.io.Serializable {\r
+    private java.lang.String gapchar;\r
+    private java.lang.String[] method;\r
+    private vamsas.objects.simple.SequenceSet seqs;\r
+    private java.lang.Object __equalsCalc = null;\r
+    private boolean __hashCodeCalc = false;\r
+\r
+    public Alignment() {\r
+    }\r
+\r
+    public Alignment(java.lang.String gapchar, java.lang.String[] method,\r
+        vamsas.objects.simple.SequenceSet seqs) {\r
+        this.gapchar = gapchar;\r
+        this.method = method;\r
+        this.seqs = seqs;\r
+    }\r
+\r
     /**
-     * Gets the gapchar value for this Alignment.
-     *
-     * @return gapchar
-     */
-    public java.lang.String getGapchar() {
-        return gapchar;
-    }
-
-
+ * Gets the gapchar value for this Alignment.
+ *
+ * @return gapchar
+ */\r
+    public java.lang.String getGapchar() {\r
+        return gapchar;\r
+    }\r
+\r
     /**
-     * Sets the gapchar value for this Alignment.
-     *
-     * @param gapchar
-     */
-    public void setGapchar(java.lang.String gapchar) {
-        this.gapchar = gapchar;
-    }
-
-
+ * Sets the gapchar value for this Alignment.
+ *
+ * @param gapchar
+ */\r
+    public void setGapchar(java.lang.String gapchar) {\r
+        this.gapchar = gapchar;\r
+    }\r
+\r
     /**
-     * Gets the method value for this Alignment.
-     *
-     * @return method
-     */
-    public java.lang.String[] getMethod() {
-        return method;
-    }
-
-
+ * Gets the method value for this Alignment.
+ *
+ * @return method
+ */\r
+    public java.lang.String[] getMethod() {\r
+        return method;\r
+    }\r
+\r
     /**
-     * Sets the method value for this Alignment.
-     *
-     * @param method
-     */
-    public void setMethod(java.lang.String[] method) {
-        this.method = method;
-    }
-
-
+ * Sets the method value for this Alignment.
+ *
+ * @param method
+ */\r
+    public void setMethod(java.lang.String[] method) {\r
+        this.method = method;\r
+    }\r
+\r
     /**
-     * Gets the seqs value for this Alignment.
-     *
-     * @return seqs
-     */
-    public vamsas.objects.simple.SequenceSet getSeqs() {
-        return seqs;
-    }
-
-
+ * Gets the seqs value for this Alignment.
+ *
+ * @return seqs
+ */\r
+    public vamsas.objects.simple.SequenceSet getSeqs() {\r
+        return seqs;\r
+    }\r
+\r
     /**
-     * Sets the seqs value for this Alignment.
-     *
-     * @param seqs
-     */
-    public void setSeqs(vamsas.objects.simple.SequenceSet seqs) {
-        this.seqs = seqs;
-    }
-
-    private java.lang.Object __equalsCalc = null;
-    public synchronized boolean equals(java.lang.Object obj) {
-        if (!(obj instanceof Alignment)) return false;
-        Alignment other = (Alignment) obj;
-        if (obj == null) return false;
-        if (this == obj) return true;
-        if (__equalsCalc != null) {
-            return (__equalsCalc == obj);
-        }
-        __equalsCalc = obj;
-        boolean _equals;
-        _equals = super.equals(obj) &&
-            ((this.gapchar==null && other.getGapchar()==null) ||
-             (this.gapchar!=null &&
-              this.gapchar.equals(other.getGapchar()))) &&
-            ((this.method==null && other.getMethod()==null) ||
-             (this.method!=null &&
-              java.util.Arrays.equals(this.method, other.getMethod()))) &&
-            ((this.seqs==null && other.getSeqs()==null) ||
-             (this.seqs!=null &&
-              this.seqs.equals(other.getSeqs())));
-        __equalsCalc = null;
-        return _equals;
-    }
-
-    private boolean __hashCodeCalc = false;
-    public synchronized int hashCode() {
-        if (__hashCodeCalc) {
-            return 0;
-        }
-        __hashCodeCalc = true;
-        int _hashCode = super.hashCode();
-        if (getGapchar() != null) {
-            _hashCode += getGapchar().hashCode();
-        }
-        if (getMethod() != null) {
-            for (int i=0;
-                 i<java.lang.reflect.Array.getLength(getMethod());
-                 i++) {
-                java.lang.Object obj = java.lang.reflect.Array.get(getMethod(), i);
-                if (obj != null &&
-                    !obj.getClass().isArray()) {
-                    _hashCode += obj.hashCode();
-                }
-            }
-        }
-        if (getSeqs() != null) {
-            _hashCode += getSeqs().hashCode();
-        }
-        __hashCodeCalc = false;
-        return _hashCode;
-    }
-
-}
+ * Sets the seqs value for this Alignment.
+ *
+ * @param seqs
+ */\r
+    public void setSeqs(vamsas.objects.simple.SequenceSet seqs) {\r
+        this.seqs = seqs;\r
+    }\r
+\r
+    public synchronized boolean equals(java.lang.Object obj) {\r
+        if (!(obj instanceof Alignment)) {\r
+            return false;\r
+        }\r
+\r
+        Alignment other = (Alignment) obj;\r
+\r
+        if (obj == null) {\r
+            return false;\r
+        }\r
+\r
+        if (this == obj) {\r
+            return true;\r
+        }\r
+\r
+        if (__equalsCalc != null) {\r
+            return (__equalsCalc == obj);\r
+        }\r
+\r
+        __equalsCalc = obj;\r
+\r
+        boolean _equals;\r
+        _equals = super.equals(obj) &&\r
+            (((this.gapchar == null) && (other.getGapchar() == null)) ||\r
+            ((this.gapchar != null) && this.gapchar.equals(other.getGapchar()))) &&\r
+            (((this.method == null) && (other.getMethod() == null)) ||\r
+            ((this.method != null) &&\r
+            java.util.Arrays.equals(this.method, other.getMethod()))) &&\r
+            (((this.seqs == null) && (other.getSeqs() == null)) ||\r
+            ((this.seqs != null) && this.seqs.equals(other.getSeqs())));\r
+        __equalsCalc = null;\r
+\r
+        return _equals;\r
+    }\r
+\r
+    public synchronized int hashCode() {\r
+        if (__hashCodeCalc) {\r
+            return 0;\r
+        }\r
+\r
+        __hashCodeCalc = true;\r
+\r
+        int _hashCode = super.hashCode();\r
+\r
+        if (getGapchar() != null) {\r
+            _hashCode += getGapchar().hashCode();\r
+        }\r
+\r
+        if (getMethod() != null) {\r
+            for (int i = 0; i < java.lang.reflect.Array.getLength(getMethod());\r
+                    i++) {\r
+                java.lang.Object obj = java.lang.reflect.Array.get(getMethod(),\r
+                        i);\r
+\r
+                if ((obj != null) && !obj.getClass().isArray()) {\r
+                    _hashCode += obj.hashCode();\r
+                }\r
+            }\r
+        }\r
+\r
+        if (getSeqs() != null) {\r
+            _hashCode += getSeqs().hashCode();\r
+        }\r
+\r
+        __hashCodeCalc = false;\r
+\r
+        return _hashCode;\r
+    }\r
+}\r
index 57cd7ca..3f57064 100755 (executable)
@@ -3,8 +3,8 @@
  *
  * This file was auto-generated from WSDL
  * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter.
- */
-
+ */\r
+\r
 /*
 * Jalview - A Sequence Alignment Editor and Viewer
 * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
 * 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 vamsas.objects.simple;
-
-public class Alignment_Helper {
-    // Type metadata
-    private static org.apache.axis.description.TypeDesc typeDesc =
-        new org.apache.axis.description.TypeDesc(Alignment.class, true);
-
-    static {
-        typeDesc.setXmlType(new javax.xml.namespace.QName("simple.objects.vamsas", "Alignment"));
-        org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("gapchar");
-        elemField.setXmlName(new javax.xml.namespace.QName("", "gapchar"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://schemas.xmlsoap.org/soap/encoding/", "string"));
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("method");
-        elemField.setXmlName(new javax.xml.namespace.QName("", "method"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://schemas.xmlsoap.org/soap/encoding/", "string"));
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("seqs");
-        elemField.setXmlName(new javax.xml.namespace.QName("", "seqs"));
-        elemField.setXmlType(new javax.xml.namespace.QName("simple.objects.vamsas", "SequenceSet"));
-        typeDesc.addFieldDesc(elemField);
-    }
-
+*/\r
+package vamsas.objects.simple;\r
+\r
+public class Alignment_Helper {\r
+    // Type metadata\r
+    private static org.apache.axis.description.TypeDesc typeDesc = new org.apache.axis.description.TypeDesc(Alignment.class,\r
+            true);\r
+\r
+    static {\r
+        typeDesc.setXmlType(new javax.xml.namespace.QName(\r
+                "simple.objects.vamsas", "Alignment"));\r
+\r
+        org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();\r
+        elemField.setFieldName("gapchar");\r
+        elemField.setXmlName(new javax.xml.namespace.QName("", "gapchar"));\r
+        elemField.setXmlType(new javax.xml.namespace.QName(\r
+                "http://schemas.xmlsoap.org/soap/encoding/", "string"));\r
+        typeDesc.addFieldDesc(elemField);\r
+        elemField = new org.apache.axis.description.ElementDesc();\r
+        elemField.setFieldName("method");\r
+        elemField.setXmlName(new javax.xml.namespace.QName("", "method"));\r
+        elemField.setXmlType(new javax.xml.namespace.QName(\r
+                "http://schemas.xmlsoap.org/soap/encoding/", "string"));\r
+        typeDesc.addFieldDesc(elemField);\r
+        elemField = new org.apache.axis.description.ElementDesc();\r
+        elemField.setFieldName("seqs");\r
+        elemField.setXmlName(new javax.xml.namespace.QName("", "seqs"));\r
+        elemField.setXmlType(new javax.xml.namespace.QName(\r
+                "simple.objects.vamsas", "SequenceSet"));\r
+        typeDesc.addFieldDesc(elemField);\r
+    }\r
+\r
     /**
-     * Return type metadata object
-     */
-    public static org.apache.axis.description.TypeDesc getTypeDesc() {
-        return typeDesc;
-    }
-
+ * Return type metadata object
+ */\r
+    public static org.apache.axis.description.TypeDesc getTypeDesc() {\r
+        return typeDesc;\r
+    }\r
+\r
     /**
-     * Get Custom Serializer
-     */
-    public static org.apache.axis.encoding.Serializer getSerializer(
-           java.lang.String mechType,
-           java.lang.Class _javaType,
-           javax.xml.namespace.QName _xmlType) {
-        return
-          new  org.apache.axis.encoding.ser.BeanSerializer(
-            _javaType, _xmlType, typeDesc);
-    }
-
+ * Get Custom Serializer
+ */\r
+    public static org.apache.axis.encoding.Serializer getSerializer(\r
+        java.lang.String mechType, java.lang.Class _javaType,\r
+        javax.xml.namespace.QName _xmlType) {\r
+        return new org.apache.axis.encoding.ser.BeanSerializer(_javaType,\r
+            _xmlType, typeDesc);\r
+    }\r
+\r
     /**
-     * Get Custom Deserializer
-     */
-    public static org.apache.axis.encoding.Deserializer getDeserializer(
-           java.lang.String mechType,
-           java.lang.Class _javaType,
-           javax.xml.namespace.QName _xmlType) {
-        return
-          new  org.apache.axis.encoding.ser.BeanDeserializer(
-            _javaType, _xmlType, typeDesc);
-    }
-
-}
+ * Get Custom Deserializer
+ */\r
+    public static org.apache.axis.encoding.Deserializer getDeserializer(\r
+        java.lang.String mechType, java.lang.Class _javaType,\r
+        javax.xml.namespace.QName _xmlType) {\r
+        return new org.apache.axis.encoding.ser.BeanDeserializer(_javaType,\r
+            _xmlType, typeDesc);\r
+    }\r
+}\r
index e4af81e..43a8c6e 100755 (executable)
@@ -3,8 +3,8 @@
  *
  * This file was auto-generated from WSDL
  * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter.
- */
-
+ */\r
+\r
 /*
 * Jalview - A Sequence Alignment Editor and Viewer
 * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
 * 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 vamsas.objects.simple;
-
-public class MsaResult  extends vamsas.objects.simple.Result  implements java.io.Serializable {
-    private vamsas.objects.simple.Alignment msa;
-
-    public MsaResult() {
-    }
-
-    public MsaResult(
-           vamsas.objects.simple.Alignment msa) {
-           this.msa = msa;
-    }
-
-
+*/\r
+package vamsas.objects.simple;\r
+\r
+public class MsaResult extends vamsas.objects.simple.Result\r
+    implements java.io.Serializable {\r
+    private vamsas.objects.simple.Alignment msa;\r
+    private java.lang.Object __equalsCalc = null;\r
+    private boolean __hashCodeCalc = false;\r
+\r
+    public MsaResult() {\r
+    }\r
+\r
+    public MsaResult(vamsas.objects.simple.Alignment msa) {\r
+        this.msa = msa;\r
+    }\r
+\r
     /**
-     * Gets the msa value for this MsaResult.
-     *
-     * @return msa
-     */
-    public vamsas.objects.simple.Alignment getMsa() {
-        return msa;
-    }
-
-
+ * Gets the msa value for this MsaResult.
+ *
+ * @return msa
+ */\r
+    public vamsas.objects.simple.Alignment getMsa() {\r
+        return msa;\r
+    }\r
+\r
     /**
-     * Sets the msa value for this MsaResult.
-     *
-     * @param msa
-     */
-    public void setMsa(vamsas.objects.simple.Alignment msa) {
-        this.msa = msa;
-    }
-
-    private java.lang.Object __equalsCalc = null;
-    public synchronized boolean equals(java.lang.Object obj) {
-        if (!(obj instanceof MsaResult)) return false;
-        MsaResult other = (MsaResult) obj;
-        if (obj == null) return false;
-        if (this == obj) return true;
-        if (__equalsCalc != null) {
-            return (__equalsCalc == obj);
-        }
-        __equalsCalc = obj;
-        boolean _equals;
-        _equals = super.equals(obj) &&
-            ((this.msa==null && other.getMsa()==null) ||
-             (this.msa!=null &&
-              this.msa.equals(other.getMsa())));
-        __equalsCalc = null;
-        return _equals;
-    }
-
-    private boolean __hashCodeCalc = false;
-    public synchronized int hashCode() {
-        if (__hashCodeCalc) {
-            return 0;
-        }
-        __hashCodeCalc = true;
-        int _hashCode = super.hashCode();
-        if (getMsa() != null) {
-            _hashCode += getMsa().hashCode();
-        }
-        __hashCodeCalc = false;
-        return _hashCode;
-    }
-
-}
+ * Sets the msa value for this MsaResult.
+ *
+ * @param msa
+ */\r
+    public void setMsa(vamsas.objects.simple.Alignment msa) {\r
+        this.msa = msa;\r
+    }\r
+\r
+    public synchronized boolean equals(java.lang.Object obj) {\r
+        if (!(obj instanceof MsaResult)) {\r
+            return false;\r
+        }\r
+\r
+        MsaResult other = (MsaResult) obj;\r
+\r
+        if (obj == null) {\r
+            return false;\r
+        }\r
+\r
+        if (this == obj) {\r
+            return true;\r
+        }\r
+\r
+        if (__equalsCalc != null) {\r
+            return (__equalsCalc == obj);\r
+        }\r
+\r
+        __equalsCalc = obj;\r
+\r
+        boolean _equals;\r
+        _equals = super.equals(obj) &&\r
+            (((this.msa == null) && (other.getMsa() == null)) ||\r
+            ((this.msa != null) && this.msa.equals(other.getMsa())));\r
+        __equalsCalc = null;\r
+\r
+        return _equals;\r
+    }\r
+\r
+    public synchronized int hashCode() {\r
+        if (__hashCodeCalc) {\r
+            return 0;\r
+        }\r
+\r
+        __hashCodeCalc = true;\r
+\r
+        int _hashCode = super.hashCode();\r
+\r
+        if (getMsa() != null) {\r
+            _hashCode += getMsa().hashCode();\r
+        }\r
+\r
+        __hashCodeCalc = false;\r
+\r
+        return _hashCode;\r
+    }\r
+}\r
index ff8aefc..87db2d2 100755 (executable)
@@ -3,8 +3,8 @@
  *
  * This file was auto-generated from WSDL
  * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter.
- */
-
+ */\r
+\r
 /*
 * Jalview - A Sequence Alignment Editor and Viewer
 * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
 * 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 vamsas.objects.simple;
-
-public class MsaResult_Helper {
-    // Type metadata
-    private static org.apache.axis.description.TypeDesc typeDesc =
-        new org.apache.axis.description.TypeDesc(MsaResult.class, true);
-
-    static {
-        typeDesc.setXmlType(new javax.xml.namespace.QName("simple.objects.vamsas", "MsaResult"));
-        org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("msa");
-        elemField.setXmlName(new javax.xml.namespace.QName("", "msa"));
-        elemField.setXmlType(new javax.xml.namespace.QName("simple.objects.vamsas", "Alignment"));
-        typeDesc.addFieldDesc(elemField);
-    }
-
+*/\r
+package vamsas.objects.simple;\r
+\r
+public class MsaResult_Helper {\r
+    // Type metadata\r
+    private static org.apache.axis.description.TypeDesc typeDesc = new org.apache.axis.description.TypeDesc(MsaResult.class,\r
+            true);\r
+\r
+    static {\r
+        typeDesc.setXmlType(new javax.xml.namespace.QName(\r
+                "simple.objects.vamsas", "MsaResult"));\r
+\r
+        org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();\r
+        elemField.setFieldName("msa");\r
+        elemField.setXmlName(new javax.xml.namespace.QName("", "msa"));\r
+        elemField.setXmlType(new javax.xml.namespace.QName(\r
+                "simple.objects.vamsas", "Alignment"));\r
+        typeDesc.addFieldDesc(elemField);\r
+    }\r
+\r
     /**
-     * Return type metadata object
-     */
-    public static org.apache.axis.description.TypeDesc getTypeDesc() {
-        return typeDesc;
-    }
-
+ * Return type metadata object
+ */\r
+    public static org.apache.axis.description.TypeDesc getTypeDesc() {\r
+        return typeDesc;\r
+    }\r
+\r
     /**
-     * Get Custom Serializer
-     */
-    public static org.apache.axis.encoding.Serializer getSerializer(
-           java.lang.String mechType,
-           java.lang.Class _javaType,
-           javax.xml.namespace.QName _xmlType) {
-        return
-          new  org.apache.axis.encoding.ser.BeanSerializer(
-            _javaType, _xmlType, typeDesc);
-    }
-
+ * Get Custom Serializer
+ */\r
+    public static org.apache.axis.encoding.Serializer getSerializer(\r
+        java.lang.String mechType, java.lang.Class _javaType,\r
+        javax.xml.namespace.QName _xmlType) {\r
+        return new org.apache.axis.encoding.ser.BeanSerializer(_javaType,\r
+            _xmlType, typeDesc);\r
+    }\r
+\r
     /**
-     * Get Custom Deserializer
-     */
-    public static org.apache.axis.encoding.Deserializer getDeserializer(
-           java.lang.String mechType,
-           java.lang.Class _javaType,
-           javax.xml.namespace.QName _xmlType) {
-        return
-          new  org.apache.axis.encoding.ser.BeanDeserializer(
-            _javaType, _xmlType, typeDesc);
-    }
-
-}
+ * Get Custom Deserializer
+ */\r
+    public static org.apache.axis.encoding.Deserializer getDeserializer(\r
+        java.lang.String mechType, java.lang.Class _javaType,\r
+        javax.xml.namespace.QName _xmlType) {\r
+        return new org.apache.axis.encoding.ser.BeanDeserializer(_javaType,\r
+            _xmlType, typeDesc);\r
+    }\r
+}\r
index ea22e9e..ae1b515 100755 (executable)
@@ -3,8 +3,8 @@
  *
  * This file was auto-generated from WSDL
  * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter.
- */
-
+ */\r
+\r
 /*
 * Jalview - A Sequence Alignment Editor and Viewer
 * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
 * 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 vamsas.objects.simple;
-
-public abstract class Object  implements java.io.Serializable {
-
-    public Object() {
-    }
-
-    private java.lang.Object __equalsCalc = null;
-    public synchronized boolean equals(java.lang.Object obj) {
-        if (!(obj instanceof Object)) return false;
-        Object other = (Object) obj;
-        if (obj == null) return false;
-        if (this == obj) return true;
-        if (__equalsCalc != null) {
-            return (__equalsCalc == obj);
-        }
-        __equalsCalc = obj;
-        boolean _equals;
-        _equals = true;
-        __equalsCalc = null;
-        return _equals;
-    }
-
-    private boolean __hashCodeCalc = false;
-    public synchronized int hashCode() {
-        if (__hashCodeCalc) {
-            return 0;
-        }
-        __hashCodeCalc = true;
-        int _hashCode = 1;
-        __hashCodeCalc = false;
-        return _hashCode;
-    }
-
-}
+*/\r
+package vamsas.objects.simple;\r
+\r
+public abstract class Object implements java.io.Serializable {\r
+    private java.lang.Object __equalsCalc = null;\r
+    private boolean __hashCodeCalc = false;\r
+\r
+    public Object() {\r
+    }\r
+\r
+    public synchronized boolean equals(java.lang.Object obj) {\r
+        if (!(obj instanceof Object)) {\r
+            return false;\r
+        }\r
+\r
+        Object other = (Object) obj;\r
+\r
+        if (obj == null) {\r
+            return false;\r
+        }\r
+\r
+        if (this == obj) {\r
+            return true;\r
+        }\r
+\r
+        if (__equalsCalc != null) {\r
+            return (__equalsCalc == obj);\r
+        }\r
+\r
+        __equalsCalc = obj;\r
+\r
+        boolean _equals;\r
+        _equals = true;\r
+        __equalsCalc = null;\r
+\r
+        return _equals;\r
+    }\r
+\r
+    public synchronized int hashCode() {\r
+        if (__hashCodeCalc) {\r
+            return 0;\r
+        }\r
+\r
+        __hashCodeCalc = true;\r
+\r
+        int _hashCode = 1;\r
+        __hashCodeCalc = false;\r
+\r
+        return _hashCode;\r
+    }\r
+}\r
index e6012f4..f31c945 100755 (executable)
@@ -3,8 +3,8 @@
  *
  * This file was auto-generated from WSDL
  * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter.
- */
-
+ */\r
+\r
 /*
 * Jalview - A Sequence Alignment Editor and Viewer
 * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
 * 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 vamsas.objects.simple;
-
-public class Object_Helper {
-    // Type metadata
-    private static org.apache.axis.description.TypeDesc typeDesc =
-        new org.apache.axis.description.TypeDesc(Object.class, true);
-
-    static {
-        typeDesc.setXmlType(new javax.xml.namespace.QName("http://simple.objects.vamsas", "Object"));
-    }
-
+*/\r
+package vamsas.objects.simple;\r
+\r
+public class Object_Helper {\r
+    // Type metadata\r
+    private static org.apache.axis.description.TypeDesc typeDesc = new org.apache.axis.description.TypeDesc(Object.class,\r
+            true);\r
+\r
+    static {\r
+        typeDesc.setXmlType(new javax.xml.namespace.QName(\r
+                "http://simple.objects.vamsas", "Object"));\r
+    }\r
+\r
     /**
-     * Return type metadata object
-     */
-    public static org.apache.axis.description.TypeDesc getTypeDesc() {
-        return typeDesc;
-    }
-
+ * Return type metadata object
+ */\r
+    public static org.apache.axis.description.TypeDesc getTypeDesc() {\r
+        return typeDesc;\r
+    }\r
+\r
     /**
-     * Get Custom Serializer
-     */
-    public static org.apache.axis.encoding.Serializer getSerializer(
-           java.lang.String mechType,
-           java.lang.Class _javaType,
-           javax.xml.namespace.QName _xmlType) {
-        return
-          new  org.apache.axis.encoding.ser.BeanSerializer(
-            _javaType, _xmlType, typeDesc);
-    }
-
+ * Get Custom Serializer
+ */\r
+    public static org.apache.axis.encoding.Serializer getSerializer(\r
+        java.lang.String mechType, java.lang.Class _javaType,\r
+        javax.xml.namespace.QName _xmlType) {\r
+        return new org.apache.axis.encoding.ser.BeanSerializer(_javaType,\r
+            _xmlType, typeDesc);\r
+    }\r
+\r
     /**
-     * Get Custom Deserializer
-     */
-    public static org.apache.axis.encoding.Deserializer getDeserializer(
-           java.lang.String mechType,
-           java.lang.Class _javaType,
-           javax.xml.namespace.QName _xmlType) {
-        return
-          new  org.apache.axis.encoding.ser.BeanDeserializer(
-            _javaType, _xmlType, typeDesc);
-    }
-
-}
+ * Get Custom Deserializer
+ */\r
+    public static org.apache.axis.encoding.Deserializer getDeserializer(\r
+        java.lang.String mechType, java.lang.Class _javaType,\r
+        javax.xml.namespace.QName _xmlType) {\r
+        return new org.apache.axis.encoding.ser.BeanDeserializer(_javaType,\r
+            _xmlType, typeDesc);\r
+    }\r
+}\r
index 1444911..49756e2 100755 (executable)
@@ -3,8 +3,8 @@
  *
  * This file was auto-generated from WSDL
  * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter.
- */
-
+ */\r
+\r
 /*
 * Jalview - A Sequence Alignment Editor and Viewer
 * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
 * 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 vamsas.objects.simple;
-
-public class Result  implements java.io.Serializable {
-    private boolean broken;
-    private boolean failed;
-    private boolean finished;
-    private boolean invalid;
-    private boolean jobFailed;
-    private boolean queued;
-    private boolean running;
-    private boolean serverError;
-    private int state;
-    private java.lang.String status;
-    private boolean suspended;
-
-    public Result() {
-    }
-
-    public Result(
-           boolean broken,
-           boolean failed,
-           boolean finished,
-           boolean invalid,
-           boolean jobFailed,
-           boolean queued,
-           boolean running,
-           boolean serverError,
-           int state,
-           java.lang.String status,
-           boolean suspended) {
-           this.broken = broken;
-           this.failed = failed;
-           this.finished = finished;
-           this.invalid = invalid;
-           this.jobFailed = jobFailed;
-           this.queued = queued;
-           this.running = running;
-           this.serverError = serverError;
-           this.state = state;
-           this.status = status;
-           this.suspended = suspended;
-    }
-
-
+*/\r
+package vamsas.objects.simple;\r
+\r
+public class Result implements java.io.Serializable {\r
+    private boolean broken;\r
+    private boolean failed;\r
+    private boolean finished;\r
+    private boolean invalid;\r
+    private boolean jobFailed;\r
+    private boolean queued;\r
+    private boolean running;\r
+    private boolean serverError;\r
+    private int state;\r
+    private java.lang.String status;\r
+    private boolean suspended;\r
+    private java.lang.Object __equalsCalc = null;\r
+    private boolean __hashCodeCalc = false;\r
+\r
+    public Result() {\r
+    }\r
+\r
+    public Result(boolean broken, boolean failed, boolean finished,\r
+        boolean invalid, boolean jobFailed, boolean queued, boolean running,\r
+        boolean serverError, int state, java.lang.String status,\r
+        boolean suspended) {\r
+        this.broken = broken;\r
+        this.failed = failed;\r
+        this.finished = finished;\r
+        this.invalid = invalid;\r
+        this.jobFailed = jobFailed;\r
+        this.queued = queued;\r
+        this.running = running;\r
+        this.serverError = serverError;\r
+        this.state = state;\r
+        this.status = status;\r
+        this.suspended = suspended;\r
+    }\r
+\r
     /**
-     * Gets the broken value for this Result.
-     *
-     * @return broken
-     */
-    public boolean isBroken() {
-        return broken;
-    }
-
-
+ * Gets the broken value for this Result.
+ *
+ * @return broken
+ */\r
+    public boolean isBroken() {\r
+        return broken;\r
+    }\r
+\r
     /**
-     * Sets the broken value for this Result.
-     *
-     * @param broken
-     */
-    public void setBroken(boolean broken) {
-        this.broken = broken;
-    }
-
-
+ * Sets the broken value for this Result.
+ *
+ * @param broken
+ */\r
+    public void setBroken(boolean broken) {\r
+        this.broken = broken;\r
+    }\r
+\r
     /**
-     * Gets the failed value for this Result.
-     *
-     * @return failed
-     */
-    public boolean isFailed() {
-        return failed;
-    }
-
-
+ * Gets the failed value for this Result.
+ *
+ * @return failed
+ */\r
+    public boolean isFailed() {\r
+        return failed;\r
+    }\r
+\r
     /**
-     * Sets the failed value for this Result.
-     *
-     * @param failed
-     */
-    public void setFailed(boolean failed) {
-        this.failed = failed;
-    }
-
-
+ * Sets the failed value for this Result.
+ *
+ * @param failed
+ */\r
+    public void setFailed(boolean failed) {\r
+        this.failed = failed;\r
+    }\r
+\r
     /**
-     * Gets the finished value for this Result.
-     *
-     * @return finished
-     */
-    public boolean isFinished() {
-        return finished;
-    }
-
-
+ * Gets the finished value for this Result.
+ *
+ * @return finished
+ */\r
+    public boolean isFinished() {\r
+        return finished;\r
+    }\r
+\r
     /**
-     * Sets the finished value for this Result.
-     *
-     * @param finished
-     */
-    public void setFinished(boolean finished) {
-        this.finished = finished;
-    }
-
-
+ * Sets the finished value for this Result.
+ *
+ * @param finished
+ */\r
+    public void setFinished(boolean finished) {\r
+        this.finished = finished;\r
+    }\r
+\r
     /**
-     * Gets the invalid value for this Result.
-     *
-     * @return invalid
-     */
-    public boolean isInvalid() {
-        return invalid;
-    }
-
-
+ * Gets the invalid value for this Result.
+ *
+ * @return invalid
+ */\r
+    public boolean isInvalid() {\r
+        return invalid;\r
+    }\r
+\r
     /**
-     * Sets the invalid value for this Result.
-     *
-     * @param invalid
-     */
-    public void setInvalid(boolean invalid) {
-        this.invalid = invalid;
-    }
-
-
+ * Sets the invalid value for this Result.
+ *
+ * @param invalid
+ */\r
+    public void setInvalid(boolean invalid) {\r
+        this.invalid = invalid;\r
+    }\r
+\r
     /**
-     * Gets the jobFailed value for this Result.
-     *
-     * @return jobFailed
-     */
-    public boolean isJobFailed() {
-        return jobFailed;
-    }
-
-
+ * Gets the jobFailed value for this Result.
+ *
+ * @return jobFailed
+ */\r
+    public boolean isJobFailed() {\r
+        return jobFailed;\r
+    }\r
+\r
     /**
-     * Sets the jobFailed value for this Result.
-     *
-     * @param jobFailed
-     */
-    public void setJobFailed(boolean jobFailed) {
-        this.jobFailed = jobFailed;
-    }
-
-
+ * Sets the jobFailed value for this Result.
+ *
+ * @param jobFailed
+ */\r
+    public void setJobFailed(boolean jobFailed) {\r
+        this.jobFailed = jobFailed;\r
+    }\r
+\r
     /**
-     * Gets the queued value for this Result.
-     *
-     * @return queued
-     */
-    public boolean isQueued() {
-        return queued;
-    }
-
-
+ * Gets the queued value for this Result.
+ *
+ * @return queued
+ */\r
+    public boolean isQueued() {\r
+        return queued;\r
+    }\r
+\r
     /**
-     * Sets the queued value for this Result.
-     *
-     * @param queued
-     */
-    public void setQueued(boolean queued) {
-        this.queued = queued;
-    }
-
-
+ * Sets the queued value for this Result.
+ *
+ * @param queued
+ */\r
+    public void setQueued(boolean queued) {\r
+        this.queued = queued;\r
+    }\r
+\r
     /**
-     * Gets the running value for this Result.
-     *
-     * @return running
-     */
-    public boolean isRunning() {
-        return running;
-    }
-
-
+ * Gets the running value for this Result.
+ *
+ * @return running
+ */\r
+    public boolean isRunning() {\r
+        return running;\r
+    }\r
+\r
     /**
-     * Sets the running value for this Result.
-     *
-     * @param running
-     */
-    public void setRunning(boolean running) {
-        this.running = running;
-    }
-
-
+ * Sets the running value for this Result.
+ *
+ * @param running
+ */\r
+    public void setRunning(boolean running) {\r
+        this.running = running;\r
+    }\r
+\r
     /**
-     * Gets the serverError value for this Result.
-     *
-     * @return serverError
-     */
-    public boolean isServerError() {
-        return serverError;
-    }
-
-
+ * Gets the serverError value for this Result.
+ *
+ * @return serverError
+ */\r
+    public boolean isServerError() {\r
+        return serverError;\r
+    }\r
+\r
     /**
-     * Sets the serverError value for this Result.
-     *
-     * @param serverError
-     */
-    public void setServerError(boolean serverError) {
-        this.serverError = serverError;
-    }
-
-
+ * Sets the serverError value for this Result.
+ *
+ * @param serverError
+ */\r
+    public void setServerError(boolean serverError) {\r
+        this.serverError = serverError;\r
+    }\r
+\r
     /**
-     * Gets the state value for this Result.
-     *
-     * @return state
-     */
-    public int getState() {
-        return state;
-    }
-
-
+ * Gets the state value for this Result.
+ *
+ * @return state
+ */\r
+    public int getState() {\r
+        return state;\r
+    }\r
+\r
     /**
-     * Sets the state value for this Result.
-     *
-     * @param state
-     */
-    public void setState(int state) {
-        this.state = state;
-    }
-
-
+ * Sets the state value for this Result.
+ *
+ * @param state
+ */\r
+    public void setState(int state) {\r
+        this.state = state;\r
+    }\r
+\r
     /**
-     * Gets the status value for this Result.
-     *
-     * @return status
-     */
-    public java.lang.String getStatus() {
-        return status;
-    }
-
-
+ * Gets the status value for this Result.
+ *
+ * @return status
+ */\r
+    public java.lang.String getStatus() {\r
+        return status;\r
+    }\r
+\r
     /**
-     * Sets the status value for this Result.
-     *
-     * @param status
-     */
-    public void setStatus(java.lang.String status) {
-        this.status = status;
-    }
-
-
+ * Sets the status value for this Result.
+ *
+ * @param status
+ */\r
+    public void setStatus(java.lang.String status) {\r
+        this.status = status;\r
+    }\r
+\r
     /**
-     * Gets the suspended value for this Result.
-     *
-     * @return suspended
-     */
-    public boolean isSuspended() {
-        return suspended;
-    }
-
-
+ * Gets the suspended value for this Result.
+ *
+ * @return suspended
+ */\r
+    public boolean isSuspended() {\r
+        return suspended;\r
+    }\r
+\r
     /**
-     * Sets the suspended value for this Result.
-     *
-     * @param suspended
-     */
-    public void setSuspended(boolean suspended) {
-        this.suspended = suspended;
-    }
-
-    private java.lang.Object __equalsCalc = null;
-    public synchronized boolean equals(java.lang.Object obj) {
-        if (!(obj instanceof Result)) return false;
-        Result other = (Result) obj;
-        if (obj == null) return false;
-        if (this == obj) return true;
-        if (__equalsCalc != null) {
-            return (__equalsCalc == obj);
-        }
-        __equalsCalc = obj;
-        boolean _equals;
-        _equals = true &&
-            this.broken == other.isBroken() &&
-            this.failed == other.isFailed() &&
-            this.finished == other.isFinished() &&
-            this.invalid == other.isInvalid() &&
-            this.jobFailed == other.isJobFailed() &&
-            this.queued == other.isQueued() &&
-            this.running == other.isRunning() &&
-            this.serverError == other.isServerError() &&
-            this.state == other.getState() &&
-            ((this.status==null && other.getStatus()==null) ||
-             (this.status!=null &&
-              this.status.equals(other.getStatus()))) &&
-            this.suspended == other.isSuspended();
-        __equalsCalc = null;
-        return _equals;
-    }
-
-    private boolean __hashCodeCalc = false;
-    public synchronized int hashCode() {
-        if (__hashCodeCalc) {
-            return 0;
-        }
-        __hashCodeCalc = true;
-        int _hashCode = 1;
-        _hashCode += (isBroken() ? Boolean.TRUE : Boolean.FALSE).hashCode();
-        _hashCode += (isFailed() ? Boolean.TRUE : Boolean.FALSE).hashCode();
-        _hashCode += (isFinished() ? Boolean.TRUE : Boolean.FALSE).hashCode();
-        _hashCode += (isInvalid() ? Boolean.TRUE : Boolean.FALSE).hashCode();
-        _hashCode += (isJobFailed() ? Boolean.TRUE : Boolean.FALSE).hashCode();
-        _hashCode += (isQueued() ? Boolean.TRUE : Boolean.FALSE).hashCode();
-        _hashCode += (isRunning() ? Boolean.TRUE : Boolean.FALSE).hashCode();
-        _hashCode += (isServerError() ? Boolean.TRUE : Boolean.FALSE).hashCode();
-        _hashCode += getState();
-        if (getStatus() != null) {
-            _hashCode += getStatus().hashCode();
-        }
-        _hashCode += (isSuspended() ? Boolean.TRUE : Boolean.FALSE).hashCode();
-        __hashCodeCalc = false;
-        return _hashCode;
-    }
-
-}
+ * Sets the suspended value for this Result.
+ *
+ * @param suspended
+ */\r
+    public void setSuspended(boolean suspended) {\r
+        this.suspended = suspended;\r
+    }\r
+\r
+    public synchronized boolean equals(java.lang.Object obj) {\r
+        if (!(obj instanceof Result)) {\r
+            return false;\r
+        }\r
+\r
+        Result other = (Result) obj;\r
+\r
+        if (obj == null) {\r
+            return false;\r
+        }\r
+\r
+        if (this == obj) {\r
+            return true;\r
+        }\r
+\r
+        if (__equalsCalc != null) {\r
+            return (__equalsCalc == obj);\r
+        }\r
+\r
+        __equalsCalc = obj;\r
+\r
+        boolean _equals;\r
+        _equals = true && (this.broken == other.isBroken()) &&\r
+            (this.failed == other.isFailed()) &&\r
+            (this.finished == other.isFinished()) &&\r
+            (this.invalid == other.isInvalid()) &&\r
+            (this.jobFailed == other.isJobFailed()) &&\r
+            (this.queued == other.isQueued()) &&\r
+            (this.running == other.isRunning()) &&\r
+            (this.serverError == other.isServerError()) &&\r
+            (this.state == other.getState()) &&\r
+            (((this.status == null) && (other.getStatus() == null)) ||\r
+            ((this.status != null) && this.status.equals(other.getStatus()))) &&\r
+            (this.suspended == other.isSuspended());\r
+        __equalsCalc = null;\r
+\r
+        return _equals;\r
+    }\r
+\r
+    public synchronized int hashCode() {\r
+        if (__hashCodeCalc) {\r
+            return 0;\r
+        }\r
+\r
+        __hashCodeCalc = true;\r
+\r
+        int _hashCode = 1;\r
+        _hashCode += (isBroken() ? Boolean.TRUE : Boolean.FALSE).hashCode();\r
+        _hashCode += (isFailed() ? Boolean.TRUE : Boolean.FALSE).hashCode();\r
+        _hashCode += (isFinished() ? Boolean.TRUE : Boolean.FALSE).hashCode();\r
+        _hashCode += (isInvalid() ? Boolean.TRUE : Boolean.FALSE).hashCode();\r
+        _hashCode += (isJobFailed() ? Boolean.TRUE : Boolean.FALSE).hashCode();\r
+        _hashCode += (isQueued() ? Boolean.TRUE : Boolean.FALSE).hashCode();\r
+        _hashCode += (isRunning() ? Boolean.TRUE : Boolean.FALSE).hashCode();\r
+        _hashCode += (isServerError() ? Boolean.TRUE : Boolean.FALSE).hashCode();\r
+        _hashCode += getState();\r
+\r
+        if (getStatus() != null) {\r
+            _hashCode += getStatus().hashCode();\r
+        }\r
+\r
+        _hashCode += (isSuspended() ? Boolean.TRUE : Boolean.FALSE).hashCode();\r
+        __hashCodeCalc = false;\r
+\r
+        return _hashCode;\r
+    }\r
+}\r
index f61a0c9..42584f5 100755 (executable)
@@ -3,8 +3,8 @@
  *
  * This file was auto-generated from WSDL
  * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter.
- */
-
+ */\r
+\r
 /*
 * Jalview - A Sequence Alignment Editor and Viewer
 * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
 * 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 vamsas.objects.simple;
-
-public class Result_Helper {
-    // Type metadata
-    private static org.apache.axis.description.TypeDesc typeDesc =
-        new org.apache.axis.description.TypeDesc(Result.class, true);
-
-    static {
-        typeDesc.setXmlType(new javax.xml.namespace.QName("simple.objects.vamsas", "Result"));
-        org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("broken");
-        elemField.setXmlName(new javax.xml.namespace.QName("", "broken"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("failed");
-        elemField.setXmlName(new javax.xml.namespace.QName("", "failed"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("finished");
-        elemField.setXmlName(new javax.xml.namespace.QName("", "finished"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("invalid");
-        elemField.setXmlName(new javax.xml.namespace.QName("", "invalid"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("jobFailed");
-        elemField.setXmlName(new javax.xml.namespace.QName("", "jobFailed"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("queued");
-        elemField.setXmlName(new javax.xml.namespace.QName("", "queued"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("running");
-        elemField.setXmlName(new javax.xml.namespace.QName("", "running"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("serverError");
-        elemField.setXmlName(new javax.xml.namespace.QName("", "serverError"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("state");
-        elemField.setXmlName(new javax.xml.namespace.QName("", "state"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "int"));
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("status");
-        elemField.setXmlName(new javax.xml.namespace.QName("", "status"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://schemas.xmlsoap.org/soap/encoding/", "string"));
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("suspended");
-        elemField.setXmlName(new javax.xml.namespace.QName("", "suspended"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"));
-        typeDesc.addFieldDesc(elemField);
-    }
-
+*/\r
+package vamsas.objects.simple;\r
+\r
+public class Result_Helper {\r
+    // Type metadata\r
+    private static org.apache.axis.description.TypeDesc typeDesc = new org.apache.axis.description.TypeDesc(Result.class,\r
+            true);\r
+\r
+    static {\r
+        typeDesc.setXmlType(new javax.xml.namespace.QName(\r
+                "simple.objects.vamsas", "Result"));\r
+\r
+        org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();\r
+        elemField.setFieldName("broken");\r
+        elemField.setXmlName(new javax.xml.namespace.QName("", "broken"));\r
+        elemField.setXmlType(new javax.xml.namespace.QName(\r
+                "http://www.w3.org/2001/XMLSchema", "boolean"));\r
+        typeDesc.addFieldDesc(elemField);\r
+        elemField = new org.apache.axis.description.ElementDesc();\r
+        elemField.setFieldName("failed");\r
+        elemField.setXmlName(new javax.xml.namespace.QName("", "failed"));\r
+        elemField.setXmlType(new javax.xml.namespace.QName(\r
+                "http://www.w3.org/2001/XMLSchema", "boolean"));\r
+        typeDesc.addFieldDesc(elemField);\r
+        elemField = new org.apache.axis.description.ElementDesc();\r
+        elemField.setFieldName("finished");\r
+        elemField.setXmlName(new javax.xml.namespace.QName("", "finished"));\r
+        elemField.setXmlType(new javax.xml.namespace.QName(\r
+                "http://www.w3.org/2001/XMLSchema", "boolean"));\r
+        typeDesc.addFieldDesc(elemField);\r
+        elemField = new org.apache.axis.description.ElementDesc();\r
+        elemField.setFieldName("invalid");\r
+        elemField.setXmlName(new javax.xml.namespace.QName("", "invalid"));\r
+        elemField.setXmlType(new javax.xml.namespace.QName(\r
+                "http://www.w3.org/2001/XMLSchema", "boolean"));\r
+        typeDesc.addFieldDesc(elemField);\r
+        elemField = new org.apache.axis.description.ElementDesc();\r
+        elemField.setFieldName("jobFailed");\r
+        elemField.setXmlName(new javax.xml.namespace.QName("", "jobFailed"));\r
+        elemField.setXmlType(new javax.xml.namespace.QName(\r
+                "http://www.w3.org/2001/XMLSchema", "boolean"));\r
+        typeDesc.addFieldDesc(elemField);\r
+        elemField = new org.apache.axis.description.ElementDesc();\r
+        elemField.setFieldName("queued");\r
+        elemField.setXmlName(new javax.xml.namespace.QName("", "queued"));\r
+        elemField.setXmlType(new javax.xml.namespace.QName(\r
+                "http://www.w3.org/2001/XMLSchema", "boolean"));\r
+        typeDesc.addFieldDesc(elemField);\r
+        elemField = new org.apache.axis.description.ElementDesc();\r
+        elemField.setFieldName("running");\r
+        elemField.setXmlName(new javax.xml.namespace.QName("", "running"));\r
+        elemField.setXmlType(new javax.xml.namespace.QName(\r
+                "http://www.w3.org/2001/XMLSchema", "boolean"));\r
+        typeDesc.addFieldDesc(elemField);\r
+        elemField = new org.apache.axis.description.ElementDesc();\r
+        elemField.setFieldName("serverError");\r
+        elemField.setXmlName(new javax.xml.namespace.QName("", "serverError"));\r
+        elemField.setXmlType(new javax.xml.namespace.QName(\r
+                "http://www.w3.org/2001/XMLSchema", "boolean"));\r
+        typeDesc.addFieldDesc(elemField);\r
+        elemField = new org.apache.axis.description.ElementDesc();\r
+        elemField.setFieldName("state");\r
+        elemField.setXmlName(new javax.xml.namespace.QName("", "state"));\r
+        elemField.setXmlType(new javax.xml.namespace.QName(\r
+                "http://www.w3.org/2001/XMLSchema", "int"));\r
+        typeDesc.addFieldDesc(elemField);\r
+        elemField = new org.apache.axis.description.ElementDesc();\r
+        elemField.setFieldName("status");\r
+        elemField.setXmlName(new javax.xml.namespace.QName("", "status"));\r
+        elemField.setXmlType(new javax.xml.namespace.QName(\r
+                "http://schemas.xmlsoap.org/soap/encoding/", "string"));\r
+        typeDesc.addFieldDesc(elemField);\r
+        elemField = new org.apache.axis.description.ElementDesc();\r
+        elemField.setFieldName("suspended");\r
+        elemField.setXmlName(new javax.xml.namespace.QName("", "suspended"));\r
+        elemField.setXmlType(new javax.xml.namespace.QName(\r
+                "http://www.w3.org/2001/XMLSchema", "boolean"));\r
+        typeDesc.addFieldDesc(elemField);\r
+    }\r
+\r
     /**
-     * Return type metadata object
-     */
-    public static org.apache.axis.description.TypeDesc getTypeDesc() {
-        return typeDesc;
-    }
-
+ * Return type metadata object
+ */\r
+    public static org.apache.axis.description.TypeDesc getTypeDesc() {\r
+        return typeDesc;\r
+    }\r
+\r
     /**
-     * Get Custom Serializer
-     */
-    public static org.apache.axis.encoding.Serializer getSerializer(
-           java.lang.String mechType,
-           java.lang.Class _javaType,
-           javax.xml.namespace.QName _xmlType) {
-        return
-          new  org.apache.axis.encoding.ser.BeanSerializer(
-            _javaType, _xmlType, typeDesc);
-    }
-
+ * Get Custom Serializer
+ */\r
+    public static org.apache.axis.encoding.Serializer getSerializer(\r
+        java.lang.String mechType, java.lang.Class _javaType,\r
+        javax.xml.namespace.QName _xmlType) {\r
+        return new org.apache.axis.encoding.ser.BeanSerializer(_javaType,\r
+            _xmlType, typeDesc);\r
+    }\r
+\r
     /**
-     * Get Custom Deserializer
-     */
-    public static org.apache.axis.encoding.Deserializer getDeserializer(
-           java.lang.String mechType,
-           java.lang.Class _javaType,
-           javax.xml.namespace.QName _xmlType) {
-        return
-          new  org.apache.axis.encoding.ser.BeanDeserializer(
-            _javaType, _xmlType, typeDesc);
-    }
-
-}
+ * Get Custom Deserializer
+ */\r
+    public static org.apache.axis.encoding.Deserializer getDeserializer(\r
+        java.lang.String mechType, java.lang.Class _javaType,\r
+        javax.xml.namespace.QName _xmlType) {\r
+        return new org.apache.axis.encoding.ser.BeanDeserializer(_javaType,\r
+            _xmlType, typeDesc);\r
+    }\r
+}\r
index c8dd81e..ddf0177 100755 (executable)
@@ -3,8 +3,8 @@
  *
  * This file was auto-generated from WSDL
  * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter.
- */
-
+ */\r
+\r
 /*
 * Jalview - A Sequence Alignment Editor and Viewer
 * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
 * 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 vamsas.objects.simple;
-
-public class Sequence  implements java.io.Serializable {
-    private java.lang.String id;
-    private java.lang.String seq;
-
-    public Sequence() {
-    }
-
-    public Sequence(
-           java.lang.String id,
-           java.lang.String seq) {
-           this.id = id;
-           this.seq = seq;
-    }
-
-
+*/\r
+package vamsas.objects.simple;\r
+\r
+public class Sequence implements java.io.Serializable {\r
+    private java.lang.String id;\r
+    private java.lang.String seq;\r
+    private java.lang.Object __equalsCalc = null;\r
+    private boolean __hashCodeCalc = false;\r
+\r
+    public Sequence() {\r
+    }\r
+\r
+    public Sequence(java.lang.String id, java.lang.String seq) {\r
+        this.id = id;\r
+        this.seq = seq;\r
+    }\r
+\r
     /**
-     * Gets the id value for this Sequence.
-     *
-     * @return id
-     */
-    public java.lang.String getId() {
-        return id;
-    }
-
-
+ * Gets the id value for this Sequence.
+ *
+ * @return id
+ */\r
+    public java.lang.String getId() {\r
+        return id;\r
+    }\r
+\r
     /**
-     * Sets the id value for this Sequence.
-     *
-     * @param id
-     */
-    public void setId(java.lang.String id) {
-        this.id = id;
-    }
-
-
+ * Sets the id value for this Sequence.
+ *
+ * @param id
+ */\r
+    public void setId(java.lang.String id) {\r
+        this.id = id;\r
+    }\r
+\r
     /**
-     * Gets the seq value for this Sequence.
-     *
-     * @return seq
-     */
-    public java.lang.String getSeq() {
-        return seq;
-    }
-
-
+ * Gets the seq value for this Sequence.
+ *
+ * @return seq
+ */\r
+    public java.lang.String getSeq() {\r
+        return seq;\r
+    }\r
+\r
     /**
-     * Sets the seq value for this Sequence.
-     *
-     * @param seq
-     */
-    public void setSeq(java.lang.String seq) {
-        this.seq = seq;
-    }
-
-    private java.lang.Object __equalsCalc = null;
-    public synchronized boolean equals(java.lang.Object obj) {
-        if (!(obj instanceof Sequence)) return false;
-        Sequence other = (Sequence) obj;
-        if (obj == null) return false;
-        if (this == obj) return true;
-        if (__equalsCalc != null) {
-            return (__equalsCalc == obj);
-        }
-        __equalsCalc = obj;
-        boolean _equals;
-        _equals = true &&
-            ((this.id==null && other.getId()==null) ||
-             (this.id!=null &&
-              this.id.equals(other.getId()))) &&
-            ((this.seq==null && other.getSeq()==null) ||
-             (this.seq!=null &&
-              this.seq.equals(other.getSeq())));
-        __equalsCalc = null;
-        return _equals;
-    }
-
-    private boolean __hashCodeCalc = false;
-    public synchronized int hashCode() {
-        if (__hashCodeCalc) {
-            return 0;
-        }
-        __hashCodeCalc = true;
-        int _hashCode = 1;
-        if (getId() != null) {
-            _hashCode += getId().hashCode();
-        }
-        if (getSeq() != null) {
-            _hashCode += getSeq().hashCode();
-        }
-        __hashCodeCalc = false;
-        return _hashCode;
-    }
-
-}
+ * Sets the seq value for this Sequence.
+ *
+ * @param seq
+ */\r
+    public void setSeq(java.lang.String seq) {\r
+        this.seq = seq;\r
+    }\r
+\r
+    public synchronized boolean equals(java.lang.Object obj) {\r
+        if (!(obj instanceof Sequence)) {\r
+            return false;\r
+        }\r
+\r
+        Sequence other = (Sequence) obj;\r
+\r
+        if (obj == null) {\r
+            return false;\r
+        }\r
+\r
+        if (this == obj) {\r
+            return true;\r
+        }\r
+\r
+        if (__equalsCalc != null) {\r
+            return (__equalsCalc == obj);\r
+        }\r
+\r
+        __equalsCalc = obj;\r
+\r
+        boolean _equals;\r
+        _equals = true &&\r
+            (((this.id == null) && (other.getId() == null)) ||\r
+            ((this.id != null) && this.id.equals(other.getId()))) &&\r
+            (((this.seq == null) && (other.getSeq() == null)) ||\r
+            ((this.seq != null) && this.seq.equals(other.getSeq())));\r
+        __equalsCalc = null;\r
+\r
+        return _equals;\r
+    }\r
+\r
+    public synchronized int hashCode() {\r
+        if (__hashCodeCalc) {\r
+            return 0;\r
+        }\r
+\r
+        __hashCodeCalc = true;\r
+\r
+        int _hashCode = 1;\r
+\r
+        if (getId() != null) {\r
+            _hashCode += getId().hashCode();\r
+        }\r
+\r
+        if (getSeq() != null) {\r
+            _hashCode += getSeq().hashCode();\r
+        }\r
+\r
+        __hashCodeCalc = false;\r
+\r
+        return _hashCode;\r
+    }\r
+}\r
index f7fc39e..afecdb9 100755 (executable)
@@ -3,8 +3,8 @@
  *
  * This file was auto-generated from WSDL
  * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter.
- */
-
+ */\r
+\r
 /*
 * Jalview - A Sequence Alignment Editor and Viewer
 * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
 * 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 vamsas.objects.simple;
-
-public class SequenceSet  implements java.io.Serializable {
-    private vamsas.objects.simple.Sequence[] seqs;
-
-    public SequenceSet() {
-    }
-
-    public SequenceSet(
-           vamsas.objects.simple.Sequence[] seqs) {
-           this.seqs = seqs;
-    }
-
-
+*/\r
+package vamsas.objects.simple;\r
+\r
+public class SequenceSet implements java.io.Serializable {\r
+    private vamsas.objects.simple.Sequence[] seqs;\r
+    private java.lang.Object __equalsCalc = null;\r
+    private boolean __hashCodeCalc = false;\r
+\r
+    public SequenceSet() {\r
+    }\r
+\r
+    public SequenceSet(vamsas.objects.simple.Sequence[] seqs) {\r
+        this.seqs = seqs;\r
+    }\r
+\r
     /**
-     * Gets the seqs value for this SequenceSet.
-     *
-     * @return seqs
-     */
-    public vamsas.objects.simple.Sequence[] getSeqs() {
-        return seqs;
-    }
-
-
+ * Gets the seqs value for this SequenceSet.
+ *
+ * @return seqs
+ */\r
+    public vamsas.objects.simple.Sequence[] getSeqs() {\r
+        return seqs;\r
+    }\r
+\r
     /**
-     * Sets the seqs value for this SequenceSet.
-     *
-     * @param seqs
-     */
-    public void setSeqs(vamsas.objects.simple.Sequence[] seqs) {
-        this.seqs = seqs;
-    }
-
-    private java.lang.Object __equalsCalc = null;
-    public synchronized boolean equals(java.lang.Object obj) {
-        if (!(obj instanceof SequenceSet)) return false;
-        SequenceSet other = (SequenceSet) obj;
-        if (obj == null) return false;
-        if (this == obj) return true;
-        if (__equalsCalc != null) {
-            return (__equalsCalc == obj);
-        }
-        __equalsCalc = obj;
-        boolean _equals;
-        _equals = true &&
-            ((this.seqs==null && other.getSeqs()==null) ||
-             (this.seqs!=null &&
-              java.util.Arrays.equals(this.seqs, other.getSeqs())));
-        __equalsCalc = null;
-        return _equals;
-    }
-
-    private boolean __hashCodeCalc = false;
-    public synchronized int hashCode() {
-        if (__hashCodeCalc) {
-            return 0;
-        }
-        __hashCodeCalc = true;
-        int _hashCode = 1;
-        if (getSeqs() != null) {
-            for (int i=0;
-                 i<java.lang.reflect.Array.getLength(getSeqs());
-                 i++) {
-                java.lang.Object obj = java.lang.reflect.Array.get(getSeqs(), i);
-                if (obj != null &&
-                    !obj.getClass().isArray()) {
-                    _hashCode += obj.hashCode();
-                }
-            }
-        }
-        __hashCodeCalc = false;
-        return _hashCode;
-    }
-
-}
+ * Sets the seqs value for this SequenceSet.
+ *
+ * @param seqs
+ */\r
+    public void setSeqs(vamsas.objects.simple.Sequence[] seqs) {\r
+        this.seqs = seqs;\r
+    }\r
+\r
+    public synchronized boolean equals(java.lang.Object obj) {\r
+        if (!(obj instanceof SequenceSet)) {\r
+            return false;\r
+        }\r
+\r
+        SequenceSet other = (SequenceSet) obj;\r
+\r
+        if (obj == null) {\r
+            return false;\r
+        }\r
+\r
+        if (this == obj) {\r
+            return true;\r
+        }\r
+\r
+        if (__equalsCalc != null) {\r
+            return (__equalsCalc == obj);\r
+        }\r
+\r
+        __equalsCalc = obj;\r
+\r
+        boolean _equals;\r
+        _equals = true &&\r
+            (((this.seqs == null) && (other.getSeqs() == null)) ||\r
+            ((this.seqs != null) &&\r
+            java.util.Arrays.equals(this.seqs, other.getSeqs())));\r
+        __equalsCalc = null;\r
+\r
+        return _equals;\r
+    }\r
+\r
+    public synchronized int hashCode() {\r
+        if (__hashCodeCalc) {\r
+            return 0;\r
+        }\r
+\r
+        __hashCodeCalc = true;\r
+\r
+        int _hashCode = 1;\r
+\r
+        if (getSeqs() != null) {\r
+            for (int i = 0; i < java.lang.reflect.Array.getLength(getSeqs());\r
+                    i++) {\r
+                java.lang.Object obj = java.lang.reflect.Array.get(getSeqs(), i);\r
+\r
+                if ((obj != null) && !obj.getClass().isArray()) {\r
+                    _hashCode += obj.hashCode();\r
+                }\r
+            }\r
+        }\r
+\r
+        __hashCodeCalc = false;\r
+\r
+        return _hashCode;\r
+    }\r
+}\r
index d5f04a0..ec56cb2 100755 (executable)
@@ -3,8 +3,8 @@
  *
  * This file was auto-generated from WSDL
  * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter.
- */
-
+ */\r
+\r
 /*
 * Jalview - A Sequence Alignment Editor and Viewer
 * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
 * 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 vamsas.objects.simple;
-
-public class SequenceSet_Helper {
-    // Type metadata
-    private static org.apache.axis.description.TypeDesc typeDesc =
-        new org.apache.axis.description.TypeDesc(SequenceSet.class, true);
-
-    static {
-        typeDesc.setXmlType(new javax.xml.namespace.QName("simple.objects.vamsas", "SequenceSet"));
-        org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("seqs");
-        elemField.setXmlName(new javax.xml.namespace.QName("", "seqs"));
-        elemField.setXmlType(new javax.xml.namespace.QName("simple.objects.vamsas", "Sequence"));
-        typeDesc.addFieldDesc(elemField);
-    }
-
+*/\r
+package vamsas.objects.simple;\r
+\r
+public class SequenceSet_Helper {\r
+    // Type metadata\r
+    private static org.apache.axis.description.TypeDesc typeDesc = new org.apache.axis.description.TypeDesc(SequenceSet.class,\r
+            true);\r
+\r
+    static {\r
+        typeDesc.setXmlType(new javax.xml.namespace.QName(\r
+                "simple.objects.vamsas", "SequenceSet"));\r
+\r
+        org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();\r
+        elemField.setFieldName("seqs");\r
+        elemField.setXmlName(new javax.xml.namespace.QName("", "seqs"));\r
+        elemField.setXmlType(new javax.xml.namespace.QName(\r
+                "simple.objects.vamsas", "Sequence"));\r
+        typeDesc.addFieldDesc(elemField);\r
+    }\r
+\r
     /**
-     * Return type metadata object
-     */
-    public static org.apache.axis.description.TypeDesc getTypeDesc() {
-        return typeDesc;
-    }
-
+ * Return type metadata object
+ */\r
+    public static org.apache.axis.description.TypeDesc getTypeDesc() {\r
+        return typeDesc;\r
+    }\r
+\r
     /**
-     * Get Custom Serializer
-     */
-    public static org.apache.axis.encoding.Serializer getSerializer(
-           java.lang.String mechType,
-           java.lang.Class _javaType,
-           javax.xml.namespace.QName _xmlType) {
-        return
-          new  org.apache.axis.encoding.ser.BeanSerializer(
-            _javaType, _xmlType, typeDesc);
-    }
-
+ * Get Custom Serializer
+ */\r
+    public static org.apache.axis.encoding.Serializer getSerializer(\r
+        java.lang.String mechType, java.lang.Class _javaType,\r
+        javax.xml.namespace.QName _xmlType) {\r
+        return new org.apache.axis.encoding.ser.BeanSerializer(_javaType,\r
+            _xmlType, typeDesc);\r
+    }\r
+\r
     /**
-     * Get Custom Deserializer
-     */
-    public static org.apache.axis.encoding.Deserializer getDeserializer(
-           java.lang.String mechType,
-           java.lang.Class _javaType,
-           javax.xml.namespace.QName _xmlType) {
-        return
-          new  org.apache.axis.encoding.ser.BeanDeserializer(
-            _javaType, _xmlType, typeDesc);
-    }
-
-}
+ * Get Custom Deserializer
+ */\r
+    public static org.apache.axis.encoding.Deserializer getDeserializer(\r
+        java.lang.String mechType, java.lang.Class _javaType,\r
+        javax.xml.namespace.QName _xmlType) {\r
+        return new org.apache.axis.encoding.ser.BeanDeserializer(_javaType,\r
+            _xmlType, typeDesc);\r
+    }\r
+}\r
index c8118c4..b080dc5 100755 (executable)
@@ -3,8 +3,8 @@
  *
  * This file was auto-generated from WSDL
  * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter.
- */
-
+ */\r
+\r
 /*
 * Jalview - A Sequence Alignment Editor and Viewer
 * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
 * 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 vamsas.objects.simple;
-
-public class Sequence_Helper {
-    // Type metadata
-    private static org.apache.axis.description.TypeDesc typeDesc =
-        new org.apache.axis.description.TypeDesc(Sequence.class, true);
-
-    static {
-        typeDesc.setXmlType(new javax.xml.namespace.QName("simple.objects.vamsas", "Sequence"));
-        org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("id");
-        elemField.setXmlName(new javax.xml.namespace.QName("", "id"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://schemas.xmlsoap.org/soap/encoding/", "string"));
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("seq");
-        elemField.setXmlName(new javax.xml.namespace.QName("", "seq"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://schemas.xmlsoap.org/soap/encoding/", "string"));
-        typeDesc.addFieldDesc(elemField);
-    }
-
+*/\r
+package vamsas.objects.simple;\r
+\r
+public class Sequence_Helper {\r
+    // Type metadata\r
+    private static org.apache.axis.description.TypeDesc typeDesc = new org.apache.axis.description.TypeDesc(Sequence.class,\r
+            true);\r
+\r
+    static {\r
+        typeDesc.setXmlType(new javax.xml.namespace.QName(\r
+                "simple.objects.vamsas", "Sequence"));\r
+\r
+        org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();\r
+        elemField.setFieldName("id");\r
+        elemField.setXmlName(new javax.xml.namespace.QName("", "id"));\r
+        elemField.setXmlType(new javax.xml.namespace.QName(\r
+                "http://schemas.xmlsoap.org/soap/encoding/", "string"));\r
+        typeDesc.addFieldDesc(elemField);\r
+        elemField = new org.apache.axis.description.ElementDesc();\r
+        elemField.setFieldName("seq");\r
+        elemField.setXmlName(new javax.xml.namespace.QName("", "seq"));\r
+        elemField.setXmlType(new javax.xml.namespace.QName(\r
+                "http://schemas.xmlsoap.org/soap/encoding/", "string"));\r
+        typeDesc.addFieldDesc(elemField);\r
+    }\r
+\r
     /**
-     * Return type metadata object
-     */
-    public static org.apache.axis.description.TypeDesc getTypeDesc() {
-        return typeDesc;
-    }
-
+ * Return type metadata object
+ */\r
+    public static org.apache.axis.description.TypeDesc getTypeDesc() {\r
+        return typeDesc;\r
+    }\r
+\r
     /**
-     * Get Custom Serializer
-     */
-    public static org.apache.axis.encoding.Serializer getSerializer(
-           java.lang.String mechType,
-           java.lang.Class _javaType,
-           javax.xml.namespace.QName _xmlType) {
-        return
-          new  org.apache.axis.encoding.ser.BeanSerializer(
-            _javaType, _xmlType, typeDesc);
-    }
-
+ * Get Custom Serializer
+ */\r
+    public static org.apache.axis.encoding.Serializer getSerializer(\r
+        java.lang.String mechType, java.lang.Class _javaType,\r
+        javax.xml.namespace.QName _xmlType) {\r
+        return new org.apache.axis.encoding.ser.BeanSerializer(_javaType,\r
+            _xmlType, typeDesc);\r
+    }\r
+\r
     /**
-     * Get Custom Deserializer
-     */
-    public static org.apache.axis.encoding.Deserializer getDeserializer(
-           java.lang.String mechType,
-           java.lang.Class _javaType,
-           javax.xml.namespace.QName _xmlType) {
-        return
-          new  org.apache.axis.encoding.ser.BeanDeserializer(
-            _javaType, _xmlType, typeDesc);
-    }
-
-}
+ * Get Custom Deserializer
+ */\r
+    public static org.apache.axis.encoding.Deserializer getDeserializer(\r
+        java.lang.String mechType, java.lang.Class _javaType,\r
+        javax.xml.namespace.QName _xmlType) {\r
+        return new org.apache.axis.encoding.ser.BeanDeserializer(_javaType,\r
+            _xmlType, typeDesc);\r
+    }\r
+}\r
index 891201f..fb882db 100755 (executable)
@@ -3,8 +3,8 @@
  *
  * This file was auto-generated from WSDL
  * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter.
- */
-
+ */\r
+\r
 /*
 * Jalview - A Sequence Alignment Editor and Viewer
 * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
 * 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 vamsas.objects.simple;
-
-public class WsJobId  implements java.io.Serializable {
-    private java.lang.String jobId;
-    private int status;
-
-    public WsJobId() {
-    }
-
-    public WsJobId(
-           java.lang.String jobId,
-           int status) {
-           this.jobId = jobId;
-           this.status = status;
-    }
-
-
+*/\r
+package vamsas.objects.simple;\r
+\r
+public class WsJobId implements java.io.Serializable {\r
+    private java.lang.String jobId;\r
+    private int status;\r
+    private java.lang.Object __equalsCalc = null;\r
+    private boolean __hashCodeCalc = false;\r
+\r
+    public WsJobId() {\r
+    }\r
+\r
+    public WsJobId(java.lang.String jobId, int status) {\r
+        this.jobId = jobId;\r
+        this.status = status;\r
+    }\r
+\r
     /**
-     * Gets the jobId value for this WsJobId.
-     *
-     * @return jobId
-     */
-    public java.lang.String getJobId() {
-        return jobId;
-    }
-
-
+ * Gets the jobId value for this WsJobId.
+ *
+ * @return jobId
+ */\r
+    public java.lang.String getJobId() {\r
+        return jobId;\r
+    }\r
+\r
     /**
-     * Sets the jobId value for this WsJobId.
-     *
-     * @param jobId
-     */
-    public void setJobId(java.lang.String jobId) {
-        this.jobId = jobId;
-    }
-
-
+ * Sets the jobId value for this WsJobId.
+ *
+ * @param jobId
+ */\r
+    public void setJobId(java.lang.String jobId) {\r
+        this.jobId = jobId;\r
+    }\r
+\r
     /**
-     * Gets the status value for this WsJobId.
-     *
-     * @return status
-     */
-    public int getStatus() {
-        return status;
-    }
-
-
+ * Gets the status value for this WsJobId.
+ *
+ * @return status
+ */\r
+    public int getStatus() {\r
+        return status;\r
+    }\r
+\r
     /**
-     * Sets the status value for this WsJobId.
-     *
-     * @param status
-     */
-    public void setStatus(int status) {
-        this.status = status;
-    }
-
-    private java.lang.Object __equalsCalc = null;
-    public synchronized boolean equals(java.lang.Object obj) {
-        if (!(obj instanceof WsJobId)) return false;
-        WsJobId other = (WsJobId) obj;
-        if (obj == null) return false;
-        if (this == obj) return true;
-        if (__equalsCalc != null) {
-            return (__equalsCalc == obj);
-        }
-        __equalsCalc = obj;
-        boolean _equals;
-        _equals = true &&
-            ((this.jobId==null && other.getJobId()==null) ||
-             (this.jobId!=null &&
-              this.jobId.equals(other.getJobId()))) &&
-            this.status == other.getStatus();
-        __equalsCalc = null;
-        return _equals;
-    }
-
-    private boolean __hashCodeCalc = false;
-    public synchronized int hashCode() {
-        if (__hashCodeCalc) {
-            return 0;
-        }
-        __hashCodeCalc = true;
-        int _hashCode = 1;
-        if (getJobId() != null) {
-            _hashCode += getJobId().hashCode();
-        }
-        _hashCode += getStatus();
-        __hashCodeCalc = false;
-        return _hashCode;
-    }
-
-}
+ * Sets the status value for this WsJobId.
+ *
+ * @param status
+ */\r
+    public void setStatus(int status) {\r
+        this.status = status;\r
+    }\r
+\r
+    public synchronized boolean equals(java.lang.Object obj) {\r
+        if (!(obj instanceof WsJobId)) {\r
+            return false;\r
+        }\r
+\r
+        WsJobId other = (WsJobId) obj;\r
+\r
+        if (obj == null) {\r
+            return false;\r
+        }\r
+\r
+        if (this == obj) {\r
+            return true;\r
+        }\r
+\r
+        if (__equalsCalc != null) {\r
+            return (__equalsCalc == obj);\r
+        }\r
+\r
+        __equalsCalc = obj;\r
+\r
+        boolean _equals;\r
+        _equals = true &&\r
+            (((this.jobId == null) && (other.getJobId() == null)) ||\r
+            ((this.jobId != null) && this.jobId.equals(other.getJobId()))) &&\r
+            (this.status == other.getStatus());\r
+        __equalsCalc = null;\r
+\r
+        return _equals;\r
+    }\r
+\r
+    public synchronized int hashCode() {\r
+        if (__hashCodeCalc) {\r
+            return 0;\r
+        }\r
+\r
+        __hashCodeCalc = true;\r
+\r
+        int _hashCode = 1;\r
+\r
+        if (getJobId() != null) {\r
+            _hashCode += getJobId().hashCode();\r
+        }\r
+\r
+        _hashCode += getStatus();\r
+        __hashCodeCalc = false;\r
+\r
+        return _hashCode;\r
+    }\r
+}\r
index 042a32e..75418c4 100755 (executable)
@@ -3,8 +3,8 @@
  *
  * This file was auto-generated from WSDL
  * by the Apache Axis 1.2RC2 Nov 16, 2004 (12:19:44 EST) WSDL2Java emitter.
- */
-
+ */\r
+\r
 /*
 * Jalview - A Sequence Alignment Editor and Viewer
 * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
 * 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 vamsas.objects.simple;
-
-public class WsJobId_Helper {
-    // Type metadata
-    private static org.apache.axis.description.TypeDesc typeDesc =
-        new org.apache.axis.description.TypeDesc(WsJobId.class, true);
-
-    static {
-        typeDesc.setXmlType(new javax.xml.namespace.QName("simple.objects.vamsas", "WsJobId"));
-        org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("jobId");
-        elemField.setXmlName(new javax.xml.namespace.QName("", "jobId"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://schemas.xmlsoap.org/soap/encoding/", "string"));
-        typeDesc.addFieldDesc(elemField);
-        elemField = new org.apache.axis.description.ElementDesc();
-        elemField.setFieldName("status");
-        elemField.setXmlName(new javax.xml.namespace.QName("", "status"));
-        elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "int"));
-        typeDesc.addFieldDesc(elemField);
-    }
-
+*/\r
+package vamsas.objects.simple;\r
+\r
+public class WsJobId_Helper {\r
+    // Type metadata\r
+    private static org.apache.axis.description.TypeDesc typeDesc = new org.apache.axis.description.TypeDesc(WsJobId.class,\r
+            true);\r
+\r
+    static {\r
+        typeDesc.setXmlType(new javax.xml.namespace.QName(\r
+                "simple.objects.vamsas", "WsJobId"));\r
+\r
+        org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();\r
+        elemField.setFieldName("jobId");\r
+        elemField.setXmlName(new javax.xml.namespace.QName("", "jobId"));\r
+        elemField.setXmlType(new javax.xml.namespace.QName(\r
+                "http://schemas.xmlsoap.org/soap/encoding/", "string"));\r
+        typeDesc.addFieldDesc(elemField);\r
+        elemField = new org.apache.axis.description.ElementDesc();\r
+        elemField.setFieldName("status");\r
+        elemField.setXmlName(new javax.xml.namespace.QName("", "status"));\r
+        elemField.setXmlType(new javax.xml.namespace.QName(\r
+                "http://www.w3.org/2001/XMLSchema", "int"));\r
+        typeDesc.addFieldDesc(elemField);\r
+    }\r
+\r
     /**
-     * Return type metadata object
-     */
-    public static org.apache.axis.description.TypeDesc getTypeDesc() {
-        return typeDesc;
-    }
-
+ * Return type metadata object
+ */\r
+    public static org.apache.axis.description.TypeDesc getTypeDesc() {\r
+        return typeDesc;\r
+    }\r
+\r
     /**
-     * Get Custom Serializer
-     */
-    public static org.apache.axis.encoding.Serializer getSerializer(
-           java.lang.String mechType,
-           java.lang.Class _javaType,
-           javax.xml.namespace.QName _xmlType) {
-        return
-          new  org.apache.axis.encoding.ser.BeanSerializer(
-            _javaType, _xmlType, typeDesc);
-    }
-
+ * Get Custom Serializer
+ */\r
+    public static org.apache.axis.encoding.Serializer getSerializer(\r
+        java.lang.String mechType, java.lang.Class _javaType,\r
+        javax.xml.namespace.QName _xmlType) {\r
+        return new org.apache.axis.encoding.ser.BeanSerializer(_javaType,\r
+            _xmlType, typeDesc);\r
+    }\r
+\r
     /**
-     * Get Custom Deserializer
-     */
-    public static org.apache.axis.encoding.Deserializer getDeserializer(
-           java.lang.String mechType,
-           java.lang.Class _javaType,
-           javax.xml.namespace.QName _xmlType) {
-        return
-          new  org.apache.axis.encoding.ser.BeanDeserializer(
-            _javaType, _xmlType, typeDesc);
-    }
-
-}
+ * Get Custom Deserializer
+ */\r
+    public static org.apache.axis.encoding.Deserializer getDeserializer(\r
+        java.lang.String mechType, java.lang.Class _javaType,\r
+        javax.xml.namespace.QName _xmlType) {\r
+        return new org.apache.axis.encoding.ser.BeanDeserializer(_javaType,\r
+            _xmlType, typeDesc);\r
+    }\r
+}\r