{\r
( (ResidueColourScheme) cs).setThreshold(threshold);\r
}\r
- else if (cs instanceof ScoreColourScheme)\r
- {\r
- ( (ScoreColourScheme) cs).setThreshold(threshold);\r
- }\r
\r
viewport.setGlobalColourScheme(cs);\r
}\r
{\r
( (ResidueColourScheme) cs).setThreshold(0);\r
}\r
- else if (cs instanceof ScoreColourScheme)\r
- {\r
- ( (ScoreColourScheme) cs).setThreshold(0);\r
- }\r
\r
if (viewport.getConservationSelected())\r
{\r
{\r
SequenceGroup sg = (SequenceGroup) groups.elementAt(i);\r
\r
+ if(cs==null)\r
+ {\r
+ sg.cs = null;\r
+ continue;\r
+ }\r
if (cs instanceof ClustalxColourScheme)\r
{\r
- sg.cs = new ClustalxColourScheme(sg.sequences, sg.getWidth());\r
+ ClustalxColourScheme cxs = (ClustalxColourScheme) cs;\r
+ cxs.resetClustalX(viewport.alignment.getSequences(), viewport.alignment.getWidth());\r
+ sg.cs = cxs;\r
}\r
else\r
{\r
{\r
( (ResidueColourScheme) sg.cs).setThreshold(threshold);\r
}\r
- else if (sg.cs instanceof ScoreColourScheme)\r
- {\r
- ( (ScoreColourScheme) sg.cs).setThreshold(threshold);\r
- }\r
\r
sg.cs.setConsensus(AAFrequency.calculate(sg.sequences, 0, sg.getWidth()));\r
}\r
{\r
setLayout(null);\r
this.av = av;\r
- PaintRefresher.Register(this);\r
+ PaintRefresher.Register(this, av.alignment);\r
}\r
\r
public void drawIdString(Graphics gg, SequenceI s, int i, int starty,\r
av.getSelectionGroup().recalcConservation();\r
\r
mouseDragging = false;\r
- PaintRefresher.Refresh(this);\r
+ PaintRefresher.Refresh(this, av.alignment);\r
}\r
\r
public void highlightSearchResults(java.util.Vector found)\r
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA\r
*/\r
\r
-package jalview.appletgui;\r
\r
-import java.util.*;\r
+\r
+package jalview.appletgui;\r
\r
import java.awt.*;\r
+import java.util.*;\r
+import jalview.datamodel.*;\r
\r
public class PaintRefresher\r
{\r
- static Vector components = new Vector();\r
+ static Hashtable components = new Hashtable();\r
\r
- public static void Register(Component c)\r
+ public static void Register(Component comp, AlignmentI al)\r
{\r
- if (!components.contains(c))\r
+ if(components.containsKey(al))\r
{\r
- components.addElement(c);\r
+ Vector comps = (Vector)components.get(al);\r
+ comps.addElement(comp);\r
}\r
else\r
{\r
- components.removeElement(c);\r
+ Vector vcoms = new Vector();\r
+ vcoms.addElement(comp);\r
+ components.put(al, vcoms);\r
}\r
}\r
\r
- public static void Refresh(Component c)\r
+ public static void Refresh(AlignmentI al)\r
+ {\r
+ Refresh(null, al);\r
+ }\r
+\r
+ public static void Refresh(Component c, AlignmentI al)\r
{\r
Component temp;\r
- Enumeration e = components.elements();\r
- while (e.hasMoreElements())\r
+ Vector coms = (Vector)components.get(al);\r
+ Enumeration e = coms.elements();\r
+ while( e.hasMoreElements() )\r
{\r
- temp = (Component) e.nextElement();\r
+ temp = (Component)e.nextElement();\r
\r
- if (!temp.isValid())\r
- {\r
- components.removeElement(temp);\r
- }\r
- else if (temp == c)\r
- {\r
+ if(!temp.isValid())\r
+ coms.removeElement( temp );\r
+ else if( temp == c )\r
continue;\r
- }\r
\r
temp.repaint();\r
}\r
}\r
\r
}\r
+\r
this.points = points;\r
this.npoint = npoint;\r
this.av = av;\r
- PaintRefresher.Register(this);\r
+ PaintRefresher.Register(this, av.alignment);\r
//\r
prefsize = getPreferredSize();\r
orig = new float[npoint][3];\r
if (av.getSelectionGroup() != null)\r
{\r
av.getSelectionGroup().addOrRemove(found, true);\r
- PaintRefresher.Refresh(this);\r
+ PaintRefresher.Refresh(this, av.alignment);\r
}\r
else\r
{\r
this.av = av;\r
fr = new FeatureRenderer(av);\r
sr = new SequenceRenderer(av);\r
- PaintRefresher.Register(this);\r
+ PaintRefresher.Register(this, av.alignment);\r
\r
}\r
\r
\r
public void doMouseReleasedDefineMode(MouseEvent evt)\r
{\r
- mouseDragging = false;\r
+ if(mouseDragging)\r
+ {\r
+ stretchGroup.recalcConservation();\r
+ mouseDragging = false;\r
+ }\r
\r
if (stretchGroup == null)\r
{\r
return;\r
}\r
\r
- stretchGroup.recalcConservation();\r
-\r
- if (stretchGroup.cs instanceof ClustalxColourScheme)\r
- {\r
- stretchGroup.cs = new ClustalxColourScheme(stretchGroup.sequences,\r
- av.alignment.getWidth());\r
- }\r
-\r
- else if (stretchGroup.cs instanceof ConservationColourScheme)\r
+ if (stretchGroup.cs instanceof ConservationColourScheme)\r
{\r
ConservationColourScheme ccs = (ConservationColourScheme) stretchGroup.cs;\r
stretchGroup.cs = ccs;\r
SliderPanel.setConservationSlider(ap, stretchGroup.cs,\r
stretchGroup.getName());\r
-\r
}\r
else\r
{\r
longestName = label;\r
setLayout(null);\r
\r
- PaintRefresher.Register(this);\r
+ PaintRefresher.Register(this, av.alignment);\r
}\r
\r
public void TreeSelectionChanged(Sequence sequence)\r
selected.setEndRes(av.alignment.getWidth());\r
selected.addOrRemove(sequence, true);\r
\r
- PaintRefresher.Refresh(this);\r
+System.out.println("called here");\r
+ PaintRefresher.Refresh(this, av.alignment);\r
repaint();\r
}\r
\r
\r
public void mousePressed(MouseEvent e)\r
{\r
-\r
av.setCurrentTree(tree);\r
\r
int x = e.getX();\r
\r
Vector l = tree.findLeaves( (SequenceNode) tree.getGroups().elementAt(\r
i), new Vector());\r
- SequenceGroup sg = new SequenceGroup("TreeGroup", av.getGlobalColourScheme(), true, true, false,\r
- 0, av.alignment.getWidth());\r
+\r
+ Vector sequences = new Vector();\r
for (int j = 0; j < l.size(); j++)\r
{\r
- SequenceNode sn = (SequenceNode) l.elementAt(j);\r
- sg.addSequence( (Sequence) sn.element(), false);\r
+ sequences.addElement( (Sequence) ( (SequenceNode) l.elementAt(j)).element());\r
}\r
\r
+ ColourSchemeI cs = ColourSchemeProperty.getColour(sequences, av.alignment.getWidth(),\r
+ ColourSchemeProperty.getColourName(av.getGlobalColourScheme()));\r
+\r
+\r
+ SequenceGroup sg = new SequenceGroup(sequences, "TreeGroup",\r
+ cs, true, true,\r
+ false, 0, av.alignment.getWidth());\r
+\r
+\r
if (av.getGlobalColourScheme() instanceof ConservationColourScheme)\r
{\r
ConservationColourScheme ccs = (ConservationColourScheme) av.\r
}\r
}\r
\r
- PaintRefresher.Refresh(this);\r
+ PaintRefresher.Refresh(this, av.alignment);\r
repaint();\r
\r
}\r
AnnotationLabels alabels;\r
\r
// this value is set false when selection area being dragged\r
- boolean fastPaint = false;\r
+ boolean fastPaint = true;\r
int hextent = 0;\r
int vextent = 0;\r
\r
{\r
setLayout(new BorderLayout());\r
this.av = av;\r
- PaintRefresher.Register(this);\r
+ PaintRefresher.Register(this, av.alignment);\r
}\r
\r
public void drawIdString(Graphics2D gg, SequenceI s, int i, int starty,\r
\r
void drawIds(int starty, int endy)\r
{\r
- if(gg==null)\r
- return;\r
-\r
\r
Color currentColor = Color.white;\r
Color currentTextColor = Color.black;\r
}\r
\r
mouseDragging = false;\r
- PaintRefresher.Refresh(this);\r
+ PaintRefresher.Refresh(av.alignment);\r
}\r
\r
public void highlightSearchResults(java.util.Vector found)\r
* along with this program; if not, write to the Free Software\r
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA\r
*/\r
-package jalview.gui;\r
-\r
-import java.util.*;\r
\r
+package jalview.gui;\r
import java.awt.*;\r
+import java.util.*;\r
+import jalview.datamodel.*;\r
\r
public class PaintRefresher\r
{\r
- static Vector components = new Vector();\r
+ static Hashtable components = new Hashtable();\r
\r
- public static void Register(Component c)\r
+ public static void Register(Component comp, AlignmentI al)\r
{\r
- if (!components.contains(c))\r
+ if(components.containsKey(al))\r
{\r
- components.add(c);\r
+ Vector comps = (Vector)components.get(al);\r
+ comps.addElement(comp);\r
}\r
else\r
{\r
- components.remove(c);\r
+ Vector vcoms = new Vector();\r
+ vcoms.addElement(comp);\r
+ components.put(al, vcoms);\r
}\r
}\r
\r
- public static void Refresh(Component c)\r
+ public static void Refresh(AlignmentI al)\r
{\r
- Component temp;\r
- Enumeration e = components.elements();\r
+ Refresh(null, al);\r
+ }\r
\r
- while (e.hasMoreElements())\r
+ public static void Refresh(Component c, AlignmentI al)\r
+ {\r
+ Component temp;\r
+ Vector coms = (Vector)components.get(al);\r
+ Enumeration e = coms.elements();\r
+ while( e.hasMoreElements() )\r
{\r
- temp = (Component) e.nextElement();\r
-\r
- if (!temp.isValid())\r
- {\r
- components.removeElement(temp);\r
- }\r
- else if (temp == c)\r
- {\r
+ temp = (Component)e.nextElement();\r
+\r
+ if(!temp.isValid())\r
+ coms.removeElement( temp );\r
+ else if( temp == c )\r
continue;\r
- }\r
\r
temp.repaint();\r
}\r
+\r
}\r
+\r
}\r
SequenceGroup sg = ap.av.getSelectionGroup();\r
ap.av.alignment.deleteGroup(sg);\r
ap.av.setSelectionGroup(null);\r
- ap.repaint();\r
+ refresh();\r
}\r
\r
void pdbMenuItem_actionPerformed(ActionEvent e)\r
sg.setOutlineColour(col);\r
}\r
\r
- ap.repaint();\r
+ refresh();\r
}\r
\r
public void showBoxes_actionPerformed(ActionEvent e)\r
this.npoint = npoint;\r
this.av = av;\r
ToolTipManager.sharedInstance().registerComponent(this);\r
- PaintRefresher.Register(this);\r
+ PaintRefresher.Register(this, av.alignment);\r
\r
//\r
prefsize = getPreferredSize();\r
if (av.getSelectionGroup() != null)\r
{\r
av.getSelectionGroup().addOrRemove(found, true);\r
- PaintRefresher.Refresh(this);\r
+ PaintRefresher.Refresh(this, av.alignment);\r
}\r
else\r
{\r
int LABEL_WEST;\r
int LABEL_EAST;\r
\r
+\r
public SeqCanvas(AlignViewport av)\r
{\r
this.av = av;\r
fr = new FeatureRenderer(av);\r
sr = new SequenceRenderer(av);\r
setLayout(new BorderLayout());\r
- PaintRefresher.Register(this);\r
+ PaintRefresher.Register(this, av.alignment);\r
+ setBackground(Color.white);\r
}\r
\r
void drawNorthScale(Graphics g, int startx, int endx, int ypos)\r
* NOTE 1: The av limits are set in setFont in this class and\r
* in the adjustment listener in SeqPanel when the scrollbars move.\r
*/\r
+\r
+\r
+ // Set this to false to force a full panel paint\r
public void paintComponent(Graphics g)\r
{\r
- g.setColor(Color.white);\r
- g.fillRect(0, 0, getWidth(), getHeight());\r
-\r
- if (fastPaint)\r
+ if (fastPaint || getWidth() != g.getClipBounds().width\r
+ || getHeight() != g.getClipBounds().height)\r
{\r
g.drawImage(img, 0, 0, this);\r
fastPaint = false;\r
-\r
return;\r
}\r
\r
public SeqPanel(AlignViewport avp, AlignmentPanel p)\r
{\r
this.av = avp;\r
+ setBackground(Color.white);\r
\r
seqCanvas = new SeqCanvas(avp);\r
setLayout(new BorderLayout());\r
doMouseEnteredDefineMode(evt);\r
}\r
});\r
- repaint();\r
}\r
\r
+\r
public void doMouseReleased(MouseEvent evt)\r
{\r
if (seqEditOccurred > -1)\r
editingSeqs = false;\r
groupEditing = false;\r
\r
- ap.repaint();\r
+ seqCanvas.repaint();\r
}\r
\r
public void doMousePressed(MouseEvent evt)\r
\r
endEdit = res;\r
lastres = res;\r
- repaint();\r
+ seqCanvas.repaint();\r
}\r
\r
public void drawChars(int seqstart, int seqend, int start)\r
{\r
seqCanvas.drawPanel(seqCanvas.gg, start, av.getEndRes(), seqstart,\r
seqend, av.getStartRes(), av.getStartSeq(), 0);\r
- repaint();\r
+ seqCanvas.repaint();\r
}\r
\r
public void insertChar(int j, int seq)\r
seqEditOccurred = seq;\r
\r
av.alignment.getWidth();\r
- repaint();\r
+ seqCanvas.repaint();\r
}\r
\r
void editOccurred(int i)\r
\r
stretchGroup.getWidth();\r
\r
- repaint();\r
+ seqCanvas.repaint();\r
}\r
\r
public void doMouseReleasedDefineMode(MouseEvent evt)\r
{\r
- mouseDragging = false;\r
+ if(mouseDragging)\r
+ {\r
+ stretchGroup.recalcConservation();\r
+ mouseDragging = false;\r
+ }\r
\r
if (stretchGroup == null)\r
{\r
return;\r
}\r
\r
- stretchGroup.recalcConservation();\r
-\r
if (stretchGroup.cs instanceof ClustalxColourScheme)\r
{\r
- stretchGroup.cs = new ClustalxColourScheme(stretchGroup.sequences,\r
- av.alignment.getWidth());\r
+ ( (ClustalxColourScheme) stretchGroup.cs).resetClustalX(stretchGroup.sequences,\r
+ stretchGroup.getWidth());\r
}\r
else if (stretchGroup.cs instanceof ConservationColourScheme)\r
{\r
changeEndRes = false;\r
changeStartRes = false;\r
stretchGroup = null;\r
- repaint();\r
+ seqCanvas.repaint();\r
ap.idPanel.repaint();\r
}\r
\r
scrollThread.setEvent(evt);\r
}\r
\r
- repaint();\r
+ seqCanvas.repaint();\r
}\r
\r
public void doMouseEnteredDefineMode(MouseEvent e)\r
tree.findHeight(tree.getTopNode());\r
longestName = label;\r
\r
- PaintRefresher.Register(this);\r
+ PaintRefresher.Register(this, av.alignment);\r
}\r
\r
public void TreeSelectionChanged(Sequence sequence)\r
selected.setEndRes(av.alignment.getWidth());\r
selected.addOrRemove(sequence, true);\r
\r
- PaintRefresher.Refresh(this);\r
+ PaintRefresher.Refresh(this, av.alignment);\r
repaint();\r
}\r
\r
sequences.add( (Sequence)((SequenceNode) l.elementAt(j)).element());\r
}\r
\r
+ ColourSchemeI cs = ColourSchemeProperty.getColour(sequences, av.alignment.getWidth(),\r
+ ColourSchemeProperty.getColourName(av.getGlobalColourScheme()));\r
+\r
SequenceGroup sg = new SequenceGroup(sequences, "TreeGroup",\r
- av.getGlobalColourScheme(), true, true,\r
+ cs, true, true,\r
false, 0, av.alignment.getWidth());\r
\r
\r
+ ( (ResidueColourScheme) sg.cs).setThreshold(25);\r
+\r
+\r
+\r
+\r
if (av.getGlobalColourScheme() instanceof ConservationColourScheme)\r
{\r
ConservationColourScheme ccs = (ConservationColourScheme) av.\r
}\r
}\r
\r
- PaintRefresher.Refresh(this);\r
+ PaintRefresher.Refresh(this, av.alignment);\r
repaint();\r
}\r
\r