From: jprocter Date: Wed, 9 Jun 2010 14:06:03 +0000 (+0000) Subject: patch for JAL-545 - make deep copy of feature settings X-Git-Tag: Release_2_5_1~15 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=05a1420df55d0f180ce3c0337133e9be98a643b7;p=jalview.git patch for JAL-545 - make deep copy of feature settings --- diff --git a/src/jalview/gui/FeatureRenderer.java b/src/jalview/gui/FeatureRenderer.java index 09dccfe..b822bc5 100755 --- a/src/jalview/gui/FeatureRenderer.java +++ b/src/jalview/gui/FeatureRenderer.java @@ -105,13 +105,31 @@ public class FeatureRenderer this.featureOrder = featureOrder; } + /** + * create an independent instance of the feature renderer settings + * + * @param fr + */ public FeatureRendererSettings(FeatureRenderer fr) { - this.renderOrder = fr.renderOrder; - this.featureGroups = fr.featureGroups; - this.featureColours = fr.featureColours; + this.renderOrder = new String[fr.renderOrder.length]; + System.arraycopy(fr.renderOrder, 0, renderOrder, 0, + renderOrder.length); + this.featureGroups = new Hashtable(fr.featureGroups); + this.featureColours = new Hashtable(fr.featureColours); + Enumeration en = fr.featureColours.keys(); + while (en.hasMoreElements()) + { + Object next = en.nextElement(); + Object val = featureColours.get(next); + if (val instanceof GraduatedColor) + { + featureColours + .put(next, new GraduatedColor((GraduatedColor) val)); + } + } this.transparency = fr.transparency; - this.featureOrder = fr.featureOrder; + this.featureOrder = new Hashtable(fr.featureOrder); } } @@ -1329,7 +1347,7 @@ public class FeatureRenderer { String type = data[i][0].toString(); setColour(type, data[i][1]); // todo : typesafety - feature color - // interface object + // interface object if (((Boolean) data[i][2]).booleanValue()) { av.featuresDisplayed.put(type, new Integer(getColour(type)