X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FPaintRefresher.java;h=0fe4b85e7a19ac63c83373aeeed3b93840c58877;hb=d5ae51f80441c008a5e23741b40ab095720ff618;hp=e59ecd97b2b11964d5bd389810b920d9713133c8;hpb=6e71f42b0a3713ddbc3054e7ea9d8f5088130ec9;p=jalview.git diff --git a/src/jalview/gui/PaintRefresher.java b/src/jalview/gui/PaintRefresher.java index e59ecd9..0fe4b85 100755 --- a/src/jalview/gui/PaintRefresher.java +++ b/src/jalview/gui/PaintRefresher.java @@ -16,53 +16,82 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.gui; + +import jalview.datamodel.*; + import java.awt.*; + import java.util.*; -import jalview.datamodel.*; + +/** + * DOCUMENT ME! + * + * @author $author$ + * @version $Revision$ + */ public class PaintRefresher { - static Hashtable components = new Hashtable(); + static Hashtable components = new Hashtable(); - public static void Register(Component comp, AlignmentI al) - { - if(components.containsKey(al)) + /** + * DOCUMENT ME! + * + * @param comp DOCUMENT ME! + * @param al DOCUMENT ME! + */ + public static void Register(Component comp, AlignmentI al) { - Vector comps = (Vector)components.get(al); - comps.addElement(comp); + 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) { - Vector vcoms = new Vector(); - vcoms.addElement(comp); - components.put(al, vcoms); + Refresh(null, al); } - } - - public static void Refresh(AlignmentI al) - { - Refresh(null, al); - } - public static void Refresh(Component c, AlignmentI al) - { - Component temp; - Vector coms = (Vector)components.get(al); - Enumeration e = coms.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(); + Component temp; + Vector coms = (Vector) components.get(al); + Enumeration e = coms.elements(); - if(!temp.isValid()) - coms.removeElement( temp ); - else if( temp == c ) - continue; + while (e.hasMoreElements()) + { + temp = (Component) e.nextElement(); - temp.repaint(); - } - - } + if (!temp.isValid()) + { + coms.removeElement(temp); + } + else if (temp == c) + { + continue; + } + temp.repaint(); + } + } }