X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fappletgui%2FTreeCanvas.java;h=94834363056bfa073c0acff835e1bf330022c8aa;hb=064f2fdaa463367f8bf7e6aea5e7fc6a32170138;hp=b00d6cc7bb45a5cd76bcdc58a9119ecc00862b76;hpb=4ebc6d5b362bc093c39312aa1a69836e3dd6ae84;p=jalview.git diff --git a/src/jalview/appletgui/TreeCanvas.java b/src/jalview/appletgui/TreeCanvas.java index b00d6cc..9483436 100755 --- a/src/jalview/appletgui/TreeCanvas.java +++ b/src/jalview/appletgui/TreeCanvas.java @@ -70,7 +70,7 @@ public class TreeCanvas longestName = label; setLayout(null); - PaintRefresher.Register(this); + PaintRefresher.Register(this, av.alignment); } public void TreeSelectionChanged(Sequence sequence) @@ -82,10 +82,10 @@ public class TreeCanvas av.setSelectionGroup(selected); } - selected.setEndRes(av.alignment.getWidth()); + selected.setEndRes(av.alignment.getWidth()-1); selected.addOrRemove(sequence, true); - PaintRefresher.Refresh(this); + PaintRefresher.Refresh(this, av.alignment); repaint(); } @@ -424,7 +424,6 @@ public class TreeCanvas public void mousePressed(MouseEvent e) { - av.setCurrentTree(tree); int x = e.getX(); @@ -472,18 +471,43 @@ public class TreeCanvas Vector l = tree.findLeaves( (SequenceNode) tree.getGroups().elementAt( i), new Vector()); - SequenceGroup sg = new SequenceGroup("TreeGroup", av.getGlobalColourScheme(), true, true, false, - 0, av.alignment.getWidth()); + + Vector sequences = new Vector(); for (int j = 0; j < l.size(); j++) { - SequenceNode sn = (SequenceNode) l.elementAt(j); - sg.addSequence( (Sequence) sn.element(), false); + SequenceI s1 = (SequenceI) ( (SequenceNode) l.elementAt(j)).element(); + if(!sequences.contains(s1)) + sequences.addElement(s1); } - if (av.getGlobalColourScheme() instanceof ConservationColourScheme) + ColourSchemeI cs = null; + + if (av.getGlobalColourScheme() != null) { - ConservationColourScheme ccs = (ConservationColourScheme) av. - getGlobalColourScheme(); + if (av.getGlobalColourScheme() instanceof UserColourScheme) + { + cs = new UserColourScheme( + ( (UserColourScheme) av.getGlobalColourScheme()).getColours()); + + } + else + cs = ColourSchemeProperty.getColour(sequences, + av.alignment.getWidth(), + ColourSchemeProperty.getColourName( + av.getGlobalColourScheme())); + + cs.setThreshold(av.getGlobalColourScheme().getThreshold(), + av.getIgnoreGapsConsensus()); + } + + SequenceGroup sg = new SequenceGroup(sequences, "TreeGroup", + cs, true, true, + false, 0, av.alignment.getWidth()-1); + + + if ( av.getGlobalColourScheme()!=null + && av.getGlobalColourScheme().conservationApplied()) + { Conservation c = new Conservation("Group", ResidueProperties.propHash, 3, sg.sequences, sg.getStartRes(), @@ -491,9 +515,9 @@ public class TreeCanvas c.calculate(); c.verdict(false, av.ConsPercGaps); - ccs = new ConservationColourScheme(c, ccs.cs); + cs.setConservation(c); - sg.cs = ccs; + sg.cs = cs; } @@ -503,7 +527,7 @@ public class TreeCanvas } } - PaintRefresher.Refresh(this); + PaintRefresher.Refresh(this, av.alignment); repaint(); }