Case shifter
[jalview.git] / src / jalview / appletgui / AlignViewport.java
index e7cae44..36b0a31 100755 (executable)
@@ -36,7 +36,10 @@ public class AlignViewport
   int startSeq;\r
   int endSeq;\r
 \r
-  boolean showFullId = true;\r
+\r
+  boolean cursorMode = false;\r
+\r
+  boolean showJVSuffix = true;\r
   boolean showText = true;\r
   boolean showColourText = false;\r
   boolean showBoxes = true;\r
@@ -57,8 +60,7 @@ public class AlignViewport
 \r
   int charHeight;\r
   int charWidth;\r
-  int chunkWidth;\r
-  int chunkHeight;\r
+  int wrappedWidth;\r
 \r
   Font font = new Font("SansSerif", Font.PLAIN, 10);\r
   AlignmentI alignment;\r
@@ -74,6 +76,21 @@ public class AlignViewport
   boolean scaleLeftWrapped = true;\r
   boolean scaleRightWrapped = true;\r
 \r
+  // The following vector holds the features which are\r
+ // currently visible, in the correct order or rendering\r
+  Hashtable featuresDisplayed = null;\r
+\r
+\r
+  public Vector vconsensus;\r
+  AlignmentAnnotation consensus;\r
+  AlignmentAnnotation conservation;\r
+  AlignmentAnnotation quality;\r
+\r
+  boolean autocalculateConsensus = true;\r
+\r
+  public int ConsPercGaps = 25; // JBPNote : This should be a scalable property!\r
+\r
+  private java.beans.PropertyChangeSupport changeSupport = new java.beans.PropertyChangeSupport(this);\r
 \r
   boolean ignoreGapsInConsensusCalculation = false;\r
 \r
@@ -91,7 +108,7 @@ public class AlignViewport
       String param = applet.getParameter("showFullId");\r
       if (param != null)\r
       {\r
-        showFullId = Boolean.valueOf(param).booleanValue();\r
+        showJVSuffix = Boolean.valueOf(param).booleanValue();\r
       }\r
 \r
       param = applet.getParameter("showAnnotation");\r
@@ -139,15 +156,17 @@ public class AlignViewport
     showSequenceFeatures = b;\r
   }\r
 \r
-  public Vector vconsensus;\r
-  AlignmentAnnotation consensus;\r
-  AlignmentAnnotation conservation;\r
-  AlignmentAnnotation quality;\r
+  public boolean getShowSequenceFeatures()\r
+  {\r
+    return showSequenceFeatures;\r
+  }\r
 \r
-  public int ConsPercGaps = 25; // JBPNote : This should be a scalable property!\r
 \r
   public void updateConservation()\r
   {\r
+    if(alignment.isNucleotide())\r
+          return;\r
+\r
     Conservation cons = new jalview.analysis.Conservation("All",\r
         jalview.schemes.ResidueProperties.propHash, 3,\r
         alignment.getSequences(), 0,\r
@@ -217,7 +236,7 @@ public class AlignViewport
                                              annotations,\r
                                              0f, // cons.qualityRange[0].floatValue(),\r
                                              11f, // cons.qualityRange[1].floatValue()\r
-                                             1);\r
+                                             AlignmentAnnotation.BAR_GRAPH);\r
       if (showConservation)\r
       {\r
         alignment.addAnnotation(conservation);\r
@@ -227,7 +246,7 @@ public class AlignViewport
                                         qannotations,\r
                                         cons.qualityRange[0].floatValue(),\r
                                         cons.qualityRange[1].floatValue(),\r
-                                        1);\r
+                                        AlignmentAnnotation.BAR_GRAPH);\r
       if (showQuality)\r
       {\r
         alignment.addAnnotation(quality);\r
@@ -290,7 +309,7 @@ public class AlignViewport
     if (consensus == null)\r
     {\r
       consensus = new AlignmentAnnotation("Consensus",\r
-                                          "PID", annotations, 0f, 100f, 1);\r
+                                          "PID", annotations, 0f, 100f, AlignmentAnnotation.BAR_GRAPH);\r
       if (showConsensus)\r
       {\r
         alignment.addAnnotation(consensus);\r
@@ -301,6 +320,9 @@ public class AlignViewport
       consensus.annotations = annotations;\r
     }\r
 \r
+    if(globalColourScheme!=null)\r
+          globalColourScheme.setConsensus(vconsensus);\r
+\r
   }\r
 \r
   public SequenceGroup getSelectionGroup()\r
@@ -435,24 +457,14 @@ public class AlignViewport
     return charHeight;\r
   }\r
 \r
-  public void setChunkWidth(int w)\r
-  {\r
-    this.chunkWidth = w;\r
-  }\r
-\r
-  public int getChunkWidth()\r
+  public void setWrappedWidth(int w)\r
   {\r
-    return chunkWidth;\r
+    this.wrappedWidth = w;\r
   }\r
 \r
-  public void setChunkHeight(int h)\r
+  public int getwrappedWidth()\r
   {\r
-    this.chunkHeight = h;\r
-  }\r
-\r
-  public int getChunkHeight()\r
-  {\r
-    return chunkHeight;\r
+    return wrappedWidth;\r
   }\r
 \r
   public AlignmentI getAlignment()\r
@@ -599,14 +611,14 @@ public class AlignViewport
     return colourAppliesToAllGroups;\r
   }\r
 \r
-  public boolean getShowFullId()\r
+  public boolean getShowJVSuffix()\r
   {\r
-    return showFullId;\r
+    return showJVSuffix;\r
   }\r
 \r
-  public void setShowFullId(boolean b)\r
+  public void setShowJVSuffix(boolean b)\r
   {\r
-    showFullId = b;\r
+    showJVSuffix = b;\r
   }\r
 \r
   public boolean getShowAnnotation()\r
@@ -653,16 +665,50 @@ public class AlignViewport
   {\r
     ignoreGapsInConsensusCalculation = b;\r
     updateConsensus();\r
-    if (globalColourScheme!=null && globalColourScheme instanceof ResidueColourScheme)\r
+    if (globalColourScheme!=null)\r
     {\r
-      ( (ResidueColourScheme) globalColourScheme).setThreshold(\r
-          ( (ResidueColourScheme) globalColourScheme).getThreshold(),\r
+      globalColourScheme.setThreshold(globalColourScheme.getThreshold(),\r
           ignoreGapsInConsensusCalculation);\r
 \r
     }\r
+  }\r
 \r
+  /**\r
+   * Property change listener for changes in alignment\r
+   *\r
+   * @param listener DOCUMENT ME!\r
+   */\r
+  public void addPropertyChangeListener(\r
+      java.beans.PropertyChangeListener listener)\r
+  {\r
+      changeSupport.addPropertyChangeListener(listener);\r
   }\r
 \r
+  /**\r
+   * DOCUMENT ME!\r
+   *\r
+   * @param listener DOCUMENT ME!\r
+   */\r
+  public void removePropertyChangeListener(\r
+      java.beans.PropertyChangeListener listener)\r
+  {\r
+      changeSupport.removePropertyChangeListener(listener);\r
+  }\r
+\r
+  /**\r
+   * Property change listener for changes in alignment\r
+   *\r
+   * @param prop DOCUMENT ME!\r
+   * @param oldvalue DOCUMENT ME!\r
+   * @param newvalue DOCUMENT ME!\r
+   */\r
+  public void firePropertyChange(String prop, Object oldvalue, Object newvalue)\r
+  {\r
+      changeSupport.firePropertyChange(prop, oldvalue, newvalue);\r
+  }\r
+\r
+\r
+\r
   public boolean getIgnoreGapsConsensus()\r
   {\r
     return ignoreGapsInConsensusCalculation;\r