X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FPaintRefresher.java;h=ea28568c0e65cfc4767aa084942de9522ea468cd;hb=f5f5806de6923a8a62906c5a62c6276ba56ae0da;hp=6bec8fdd40fb68627f9f9cea0356bdd959d41aeb;hpb=588042b69abf8e60bcc950b24c283933c7dd422f;p=jalview.git diff --git a/src/jalview/gui/PaintRefresher.java b/src/jalview/gui/PaintRefresher.java index 6bec8fd..ea28568 100755 --- a/src/jalview/gui/PaintRefresher.java +++ b/src/jalview/gui/PaintRefresher.java @@ -18,45 +18,83 @@ */ package jalview.gui; -import java.util.*; +import jalview.datamodel.*; import java.awt.*; +import java.util.*; + + +/** + * DOCUMENT ME! + * + * @author $author$ + * @version $Revision$ + */ public class PaintRefresher { - static Vector components = new Vector(); + static Hashtable components = new Hashtable(); - public static void Register(Component c) - { - if (!components.contains(c)) + /** + * DOCUMENT ME! + * + * @param comp DOCUMENT ME! + * @param al DOCUMENT ME! + */ + public static void Register(Component comp, AlignmentI al) { - components.add(c); + if (components.containsKey(al)) + { + Vector comps = (Vector) components.get(al); + comps.addElement(comp); + } + else + { + Vector vcoms = new Vector(); + vcoms.addElement(comp); + components.put(al, vcoms); + } } - else + + /** + * DOCUMENT ME! + * + * @param al DOCUMENT ME! + */ + public static void Refresh(AlignmentI al) { - components.remove(c); + Refresh(null, al); } - } - - public static void Refresh(Component c) - { - Component temp; - Enumeration e = components.elements(); - while (e.hasMoreElements()) + /** + * DOCUMENT ME! + * + * @param c DOCUMENT ME! + * @param al DOCUMENT ME! + */ + public static void Refresh(Component c, AlignmentI al) { - temp = (Component) e.nextElement(); - - if (!temp.isValid()) - { - components.removeElement(temp); - } - else if (temp == c) - { - continue; - } - - temp.repaint(); + Component temp; + Vector coms = (Vector) components.get(al); + if(coms==null) + return; + + Enumeration e = coms.elements(); + + while (e.hasMoreElements()) + { + temp = (Component) e.nextElement(); + + if (!temp.isValid()) + { + coms.removeElement(temp); + } + else if (temp == c) + { + continue; + } + else + temp.repaint(); + } } - } }