X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fappletgui%2FPaintRefresher.java;h=9a220a4ea8e29f97295ac833b71013687c73b3ad;hb=5cd5b6e7864fe435ceb3f5c2f339a436ea0aac93;hp=670af70d41842fd0b2cd23f67d3c1c42d99f543a;hpb=588042b69abf8e60bcc950b24c283933c7dd422f;p=jalview.git diff --git a/src/jalview/appletgui/PaintRefresher.java b/src/jalview/appletgui/PaintRefresher.java index 670af70..9a220a4 100755 --- a/src/jalview/appletgui/PaintRefresher.java +++ b/src/jalview/appletgui/PaintRefresher.java @@ -17,48 +17,56 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -package jalview.appletgui; -import java.util.*; + +package jalview.appletgui; import java.awt.*; +import java.util.*; +import jalview.datamodel.*; public class PaintRefresher { - static Vector components = new Vector(); + static Hashtable components = new Hashtable(); - public static void Register(Component c) + public static void Register(Component comp, AlignmentI al) { - if (!components.contains(c)) + if(components.containsKey(al)) { - components.addElement(c); + Vector comps = (Vector)components.get(al); + comps.addElement(comp); } else { - components.removeElement(c); + Vector vcoms = new Vector(); + vcoms.addElement(comp); + components.put(al, vcoms); } } - public static void Refresh(Component c) + public static void Refresh(AlignmentI al) + { + Refresh(null, al); + } + + public static void Refresh(Component c, AlignmentI al) { Component temp; - Enumeration e = components.elements(); - while (e.hasMoreElements()) + Vector coms = (Vector)components.get(al); + Enumeration e = coms.elements(); + while( e.hasMoreElements() ) { - temp = (Component) e.nextElement(); + temp = (Component)e.nextElement(); - if (!temp.isValid()) - { - components.removeElement(temp); - } - else if (temp == c) - { + if(!temp.isValid()) + coms.removeElement( temp ); + else if( temp == c ) continue; - } - - temp.repaint(); + else + temp.repaint(); } } } +