X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fappletgui%2FPaintRefresher.java;h=2da1db6e0bff57dfab5edbfbdc28b8644dcf28d8;hb=c1cbfffa52f43d3b0dd74eca5e7d4e30af3b83dc;hp=0f2c1f6a0d77b47624e39d350bf126c982e8eee9;hpb=99c58ee0ae2a848f982552e53feaf6d5cb9925e5;p=jalview.git diff --git a/src/jalview/appletgui/PaintRefresher.java b/src/jalview/appletgui/PaintRefresher.java index 0f2c1f6..2da1db6 100755 --- a/src/jalview/appletgui/PaintRefresher.java +++ b/src/jalview/appletgui/PaintRefresher.java @@ -1,50 +1,67 @@ /* -* Jalview - A Sequence Alignment Editor and Viewer -* Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle -* -* This program is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License -* as published by the Free Software Foundation; either version 2 -* of the License, or (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software -* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA -*/ + * Jalview - A Sequence Alignment Editor and Viewer + * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * 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.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)) - components.addElement(c); + if(components.containsKey(al)) + { + 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(); + Vector coms = (Vector)components.get(al); + Enumeration e = coms.elements(); while( e.hasMoreElements() ) { temp = (Component)e.nextElement(); if(!temp.isValid()) - components.removeElement( temp ); + coms.removeElement( temp ); else if( temp == c ) - continue; + continue; temp.repaint(); } @@ -52,3 +69,4 @@ public class PaintRefresher } } +