JAL-2843 save/restore colour feature by attribute, and feature filters, to Jalview...
[jalview.git] / src / jalview / schemabinding / version2 / Setting.java
index c458971..59e9522 100644 (file)
@@ -73,6 +73,12 @@ public class Setting implements java.io.Serializable
   private boolean _has_mincolour;
 
   /**
+   * Field _noValueColour.
+   */
+  private jalview.schemabinding.version2.types.NoValueColour _noValueColour = jalview.schemabinding.version2.types.NoValueColour
+          .valueOf("Min");
+
+  /**
    * threshold value for graduated feature colour
    * 
    */
@@ -134,6 +140,16 @@ public class Setting implements java.io.Serializable
    */
   private boolean _has_autoScale;
 
+  /**
+   * name of feature attribute to colour by, or attribute and sub-attribute
+   */
+  private java.util.Vector _attributeNameList;
+
+  /**
+   * optional filter(s) applied to the feature type
+   */
+  private jalview.schemabinding.version2.MatcherSet _matcherSet;
+
   // ----------------/
   // - Constructors -/
   // ----------------/
@@ -141,6 +157,9 @@ public class Setting implements java.io.Serializable
   public Setting()
   {
     super();
+    setNoValueColour(jalview.schemabinding.version2.types.NoValueColour
+            .valueOf("Min"));
+    this._attributeNameList = new java.util.Vector();
   }
 
   // -----------/
@@ -148,76 +167,175 @@ public class Setting implements java.io.Serializable
   // -----------/
 
   /**
-     */
+   * 
+   * 
+   * @param vAttributeName
+   * @throws java.lang.IndexOutOfBoundsException
+   *           if the index given is outside the bounds of the collection
+   */
+  public void addAttributeName(final java.lang.String vAttributeName)
+          throws java.lang.IndexOutOfBoundsException
+  {
+    // check for the maximum size
+    if (this._attributeNameList.size() >= 2)
+    {
+      throw new IndexOutOfBoundsException(
+              "addAttributeName has a maximum of 2");
+    }
+
+    this._attributeNameList.addElement(vAttributeName);
+  }
+
+  /**
+   * 
+   * 
+   * @param index
+   * @param vAttributeName
+   * @throws java.lang.IndexOutOfBoundsException
+   *           if the index given is outside the bounds of the collection
+   */
+  public void addAttributeName(final int index,
+          final java.lang.String vAttributeName)
+          throws java.lang.IndexOutOfBoundsException
+  {
+    // check for the maximum size
+    if (this._attributeNameList.size() >= 2)
+    {
+      throw new IndexOutOfBoundsException(
+              "addAttributeName has a maximum of 2");
+    }
+
+    this._attributeNameList.add(index, vAttributeName);
+  }
+
+  /**
+   */
   public void deleteAutoScale()
   {
     this._has_autoScale = false;
   }
 
   /**
-     */
+   */
   public void deleteColour()
   {
     this._has_colour = false;
   }
 
   /**
-     */
+   */
   public void deleteColourByLabel()
   {
     this._has_colourByLabel = false;
   }
 
   /**
-     */
+   */
   public void deleteDisplay()
   {
     this._has_display = false;
   }
 
   /**
-     */
+   */
   public void deleteMax()
   {
     this._has_max = false;
   }
 
   /**
-     */
+   */
   public void deleteMin()
   {
     this._has_min = false;
   }
 
   /**
-     */
+   */
   public void deleteMincolour()
   {
     this._has_mincolour = false;
   }
 
   /**
-     */
+   */
   public void deleteOrder()
   {
     this._has_order = false;
   }
 
   /**
-     */
+   */
   public void deleteThreshold()
   {
     this._has_threshold = false;
   }
 
   /**
-     */
+   */
   public void deleteThreshstate()
   {
     this._has_threshstate = false;
   }
 
   /**
+   * Method enumerateAttributeName.
+   * 
+   * @return an Enumeration over all java.lang.String elements
+   */
+  public java.util.Enumeration enumerateAttributeName()
+  {
+    return this._attributeNameList.elements();
+  }
+
+  /**
+   * Method getAttributeName.
+   * 
+   * @param index
+   * @throws java.lang.IndexOutOfBoundsException
+   *           if the index given is outside the bounds of the collection
+   * @return the value of the java.lang.String at the given index
+   */
+  public java.lang.String getAttributeName(final int index)
+          throws java.lang.IndexOutOfBoundsException
+  {
+    // check bounds for index
+    if (index < 0 || index >= this._attributeNameList.size())
+    {
+      throw new IndexOutOfBoundsException("getAttributeName: Index value '"
+              + index + "' not in range [0.."
+              + (this._attributeNameList.size() - 1) + "]");
+    }
+
+    return (java.lang.String) _attributeNameList.get(index);
+  }
+
+  /**
+   * Method getAttributeName.Returns the contents of the collection in an Array.
+   * <p>
+   * Note: Just in case the collection contents are changing in another thread,
+   * we pass a 0-length Array of the correct type into the API call. This way we
+   * <i>know</i> that the Array returned is of exactly the correct length.
+   * 
+   * @return this collection as an Array
+   */
+  public java.lang.String[] getAttributeName()
+  {
+    java.lang.String[] array = new java.lang.String[0];
+    return (java.lang.String[]) this._attributeNameList.toArray(array);
+  }
+
+  /**
+   * Method getAttributeNameCount.
+   * 
+   * @return the size of this collection
+   */
+  public int getAttributeNameCount()
+  {
+    return this._attributeNameList.size();
+  }
+
+  /**
    * Returns the value of field 'autoScale'.
    * 
    * @return the value of field 'AutoScale'.
@@ -258,6 +376,17 @@ public class Setting implements java.io.Serializable
   }
 
   /**
+   * Returns the value of field 'matcherSet'. The field 'matcherSet' has the
+   * following description: optional filter(s) applied to the feature type
+   * 
+   * @return the value of field 'MatcherSet'.
+   */
+  public jalview.schemabinding.version2.MatcherSet getMatcherSet()
+  {
+    return this._matcherSet;
+  }
+
+  /**
    * Returns the value of field 'max'.
    * 
    * @return the value of field 'Max'.
@@ -290,6 +419,16 @@ public class Setting implements java.io.Serializable
   }
 
   /**
+   * Returns the value of field 'noValueColour'.
+   * 
+   * @return the value of field 'NoValueColour'.
+   */
+  public jalview.schemabinding.version2.types.NoValueColour getNoValueColour()
+  {
+    return this._noValueColour;
+  }
+
+  /**
    * Returns the value of field 'order'.
    * 
    * @return the value of field 'Order'.
@@ -518,6 +657,76 @@ public class Setting implements java.io.Serializable
   }
 
   /**
+   */
+  public void removeAllAttributeName()
+  {
+    this._attributeNameList.clear();
+  }
+
+  /**
+   * Method removeAttributeName.
+   * 
+   * @param vAttributeName
+   * @return true if the object was removed from the collection.
+   */
+  public boolean removeAttributeName(final java.lang.String vAttributeName)
+  {
+    boolean removed = _attributeNameList.remove(vAttributeName);
+    return removed;
+  }
+
+  /**
+   * Method removeAttributeNameAt.
+   * 
+   * @param index
+   * @return the element removed from the collection
+   */
+  public java.lang.String removeAttributeNameAt(final int index)
+  {
+    java.lang.Object obj = this._attributeNameList.remove(index);
+    return (java.lang.String) obj;
+  }
+
+  /**
+   * 
+   * 
+   * @param index
+   * @param vAttributeName
+   * @throws java.lang.IndexOutOfBoundsException
+   *           if the index given is outside the bounds of the collection
+   */
+  public void setAttributeName(final int index,
+          final java.lang.String vAttributeName)
+          throws java.lang.IndexOutOfBoundsException
+  {
+    // check bounds for index
+    if (index < 0 || index >= this._attributeNameList.size())
+    {
+      throw new IndexOutOfBoundsException("setAttributeName: Index value '"
+              + index + "' not in range [0.."
+              + (this._attributeNameList.size() - 1) + "]");
+    }
+
+    this._attributeNameList.set(index, vAttributeName);
+  }
+
+  /**
+   * 
+   * 
+   * @param vAttributeNameArray
+   */
+  public void setAttributeName(final java.lang.String[] vAttributeNameArray)
+  {
+    // -- copy array
+    _attributeNameList.clear();
+
+    for (int i = 0; i < vAttributeNameArray.length; i++)
+    {
+      this._attributeNameList.add(vAttributeNameArray[i]);
+    }
+  }
+
+  /**
    * Sets the value of field 'autoScale'.
    * 
    * @param autoScale
@@ -566,6 +775,19 @@ public class Setting implements java.io.Serializable
   }
 
   /**
+   * Sets the value of field 'matcherSet'. The field 'matcherSet' has the
+   * following description: optional filter(s) applied to the feature type
+   * 
+   * @param matcherSet
+   *          the value of field 'matcherSet'.
+   */
+  public void setMatcherSet(
+          final jalview.schemabinding.version2.MatcherSet matcherSet)
+  {
+    this._matcherSet = matcherSet;
+  }
+
+  /**
    * Sets the value of field 'max'.
    * 
    * @param max
@@ -604,6 +826,18 @@ public class Setting implements java.io.Serializable
   }
 
   /**
+   * Sets the value of field 'noValueColour'.
+   * 
+   * @param noValueColour
+   *          the value of field 'noValueColour'.
+   */
+  public void setNoValueColour(
+          final jalview.schemabinding.version2.types.NoValueColour noValueColour)
+  {
+    this._noValueColour = noValueColour;
+  }
+
+  /**
    * Sets the value of field 'order'.
    * 
    * @param order