JAL-244 Changes to Annotation labels width now adjusts the overall idWidth if larger...
[jalview.git] / src / jalview / gui / IdwidthAdjuster.java
index 4ba0699..eef5bfb 100755 (executable)
@@ -20,8 +20,6 @@
  */
 package jalview.gui;
 
-import jalview.api.AlignViewportI;
-
 import java.awt.Color;
 import java.awt.Cursor;
 import java.awt.Graphics;
@@ -31,6 +29,8 @@ import java.awt.event.MouseMotionListener;
 
 import javax.swing.JPanel;
 
+import jalview.api.AlignViewportI;
+
 /**
  * DOCUMENT ME!
  * 
@@ -46,6 +46,8 @@ public class IdwidthAdjuster extends JPanel
 
   AlignmentPanel ap;
 
+  private boolean manuallyAdjusted = false;
+
   /**
    * Creates a new IdwidthAdjuster object.
    * 
@@ -146,7 +148,26 @@ public class IdwidthAdjuster extends JPanel
       return;
     }
     viewport.setIdWidth(newWidth);
+    ap.validateAnnotationDimensions(false);
     ap.paintAlignment(true, false);
+
+    manuallyAdjusted = true;
+  }
+
+  public void setWidth(int newWidth)
+  {
+    if (newWidth < MIN_ID_WIDTH)
+    {
+      return;
+    }
+    final AlignViewportI viewport = ap.getAlignViewport();
+    viewport.setIdWidth(newWidth);
+    ap.paintAlignment(true, false);
+  }
+
+  public boolean manuallyAdjusted()
+  {
+    return manuallyAdjusted;
   }
 
   @Override