From b62d7ddaf034d0bb6b4c347aedd582f69d1119cc Mon Sep 17 00:00:00 2001 From: gmungoc Date: Mon, 18 May 2015 13:38:41 +0100 Subject: [PATCH] JAL-1663 apply new colour correctly; source formatting --- src/jalview/appletgui/FeatureRenderer.java | 56 ++++++++++++++++++++-------- 1 file changed, 41 insertions(+), 15 deletions(-) diff --git a/src/jalview/appletgui/FeatureRenderer.java b/src/jalview/appletgui/FeatureRenderer.java index 9751514..4536b1a 100644 --- a/src/jalview/appletgui/FeatureRenderer.java +++ b/src/jalview/appletgui/FeatureRenderer.java @@ -20,16 +20,30 @@ */ package jalview.appletgui; -import java.util.*; -import java.awt.*; -import java.awt.event.*; - -import jalview.datamodel.*; +import java.awt.BorderLayout; +import java.awt.Button; +import java.awt.Choice; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Font; +import java.awt.Graphics; +import java.awt.GridLayout; +import java.awt.Label; +import java.awt.Panel; +import java.awt.ScrollPane; +import java.awt.TextArea; +import java.awt.TextField; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.Hashtable; + +import jalview.datamodel.SearchResults; +import jalview.datamodel.SequenceFeature; +import jalview.datamodel.SequenceI; import jalview.schemes.AnnotationColourGradient; import jalview.schemes.GraduatedColor; import jalview.util.MessageManager; import jalview.viewmodel.AlignmentViewport; -import jalview.viewmodel.seqfeatures.FeaturesDisplayed; /** * DOCUMENT ME! @@ -37,7 +51,8 @@ import jalview.viewmodel.seqfeatures.FeaturesDisplayed; * @author $author$ * @version $Revision$ */ -public class FeatureRenderer extends jalview.renderer.seqfeatures.FeatureRenderer +public class FeatureRenderer extends + jalview.renderer.seqfeatures.FeatureRenderer { // Holds web links for feature groups and feature types @@ -55,7 +70,8 @@ public class FeatureRenderer extends jalview.renderer.seqfeatures.FeatureRendere super(); this.av = av; - setTransparencyAvailable(!System.getProperty("java.version").startsWith("1.1")); + setTransparencyAvailable(!System.getProperty("java.version") + .startsWith("1.1")); } static String lastFeatureAdded; @@ -101,7 +117,9 @@ public class FeatureRenderer extends jalview.renderer.seqfeatures.FeatureRendere } else { - throw new Error(MessageManager.getString("error.invalid_colour_for_mycheckbox")); + throw new Error( + MessageManager + .getString("error.invalid_colour_for_mycheckbox")); } if (col != null) { @@ -198,7 +216,9 @@ public class FeatureRenderer extends jalview.renderer.seqfeatures.FeatureRendere + "-" + features[i].getEnd(); if (features[i].getFeatureGroup() != null) + { item += " (" + features[i].getFeatureGroup() + ")"; + } overlaps.addItem(item); } @@ -303,8 +323,11 @@ public class FeatureRenderer extends jalview.renderer.seqfeatures.FeatureRendere } } - String title = newFeatures ? MessageManager.getString("label.create_new_sequence_features") - : MessageManager.formatMessage("label.amend_delete_features", new String[]{sequences[0].getName()}); + String title = newFeatures ? MessageManager + .getString("label.create_new_sequence_features") + : MessageManager.formatMessage("label.amend_delete_features", + new String[] + { sequences[0].getName() }); final JVDialog dialog = new JVDialog(ap.alignFrame, title, true, 385, 240); @@ -377,7 +400,9 @@ public class FeatureRenderer extends jalview.renderer.seqfeatures.FeatureRendere } if (lastFeatureGroupAdded != null && lastFeatureGroupAdded.length() < 1) + { lastFeatureGroupAdded = null; + } if (!newFeatures) { @@ -402,7 +427,8 @@ public class FeatureRenderer extends jalview.renderer.seqfeatures.FeatureRendere } ffile.parseDescriptionHTML(sf, false); - setVisible(lastFeatureAdded); // if user edited name then make sure new type is visible + setVisible(lastFeatureAdded); // if user edited name then make sure new + // type is visible } if (deleteFeature) { @@ -423,16 +449,16 @@ public class FeatureRenderer extends jalview.renderer.seqfeatures.FeatureRendere ffile.parseDescriptionHTML(features[i], false); } - col = colourPanel.getBackground(); + Color newColour = colourPanel.getBackground(); // setColour(lastFeatureAdded, fcol); if (lastFeatureGroupAdded != null) { setGroupVisibility(lastFeatureGroupAdded, true); } - setColour(lastFeatureAdded, fcol); + setColour(lastFeatureAdded, newColour); // was fcol setVisible(lastFeatureAdded); - findAllFeatures(false); // different to original applet behaviour ? + findAllFeatures(false); // different to original applet behaviour ? // findAllFeatures(); } else -- 1.7.10.2