2 * Jalview - A Sequence Alignment Editor and Viewer
\r
3 * Copyright (C) 2006 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
\r
5 * This program is free software; you can redistribute it and/or
\r
6 * modify it under the terms of the GNU General Public License
\r
7 * as published by the Free Software Foundation; either version 2
\r
8 * of the License, or (at your option) any later version.
\r
10 * This program is distributed in the hope that it will be useful,
\r
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
13 * GNU General Public License for more details.
\r
15 * You should have received a copy of the GNU General Public License
\r
16 * along with this program; if not, write to the Free Software
\r
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
\r
19 package jalview.gui;
\r
21 import jalview.datamodel.*;
\r
32 * @version $Revision$
\r
34 public class PaintRefresher
\r
36 static Hashtable components;
\r
41 * @param comp DOCUMENT ME!
\r
42 * @param al DOCUMENT ME!
\r
44 public static void Register(Component comp, String seqSetId)
\r
46 if (components == null)
\r
47 components = new Hashtable();
\r
49 if (components.containsKey(seqSetId))
\r
51 Vector comps = (Vector) components.get(seqSetId);
\r
52 if(!comps.contains(comp))
\r
53 comps.addElement(comp);
\r
57 Vector vcoms = new Vector();
\r
58 vcoms.addElement(comp);
\r
59 components.put(seqSetId, vcoms);
\r
63 public static void RemoveComponent(Component comp)
\r
65 if (components == null)
\r
68 Enumeration en = components.keys();
\r
69 while(en.hasMoreElements())
\r
71 String id = en.nextElement().toString();
\r
72 Vector comps = (Vector) components.get(id);
\r
76 components.remove(id);
\r
81 public static void Refresh(Component source, String id)
\r
83 Refresh( source, id, null, null);
\r
86 public static void Refresh(Component source, String id,
\r
87 SequenceI removeSeq,
\r
90 if (components == null)
\r
94 Vector comps = (Vector) components.get(id);
\r
101 Enumeration e = comps.elements();
\r
102 while (e.hasMoreElements())
\r
104 comp = (Component) e.nextElement();
\r
109 if (!comp.isValid())
\r
111 comps.removeElement(comp);
\r
113 else if(comp instanceof AlignmentPanel)
\r
115 AlignmentPanel ap = (AlignmentPanel)comp;
\r
117 ap.av.alignment.addSequence(addSeq);
\r
118 if(removeSeq!=null)
\r
119 ap.av.alignment.deleteSequence(removeSeq);
\r
121 // if(source instanceof AlignmentPanel)
\r
122 // ap.av.alignment.setGroups(
\r
123 // ((AlignmentPanel)source).av.alignment.getGroups() );
\r