/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
- * Copyright (C) 2008 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.6)
+ * Copyright (C) 2010 J Procter, AM Waterhouse, 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 file is part of Jalview.
*
- * 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.
+ * Jalview 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 3 of the License, or (at your option) any later version.
*
- * 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 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 Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
package jalview.appletgui;
SequenceNode highlightNode;
- public TreeCanvas(AlignViewport av, ScrollPane scroller)
+ AlignmentPanel ap;
+ public TreeCanvas(AlignmentPanel ap, ScrollPane scroller)
{
- this.av = av;
+ this.ap = ap;
+ this.av = ap.av;
font = av.getFont();
scrollPane = scroller;
addMouseListener(this);
}
String name = (markPlaceholders && node.isPlaceholder()) ? (PLACEHOLDER + node
- .getName())
- : node.getName();
+ .getName()) : node.getName();
FontMetrics fm = g.getFontMetrics(font);
int charWidth = fm.stringWidth(name) + 3;
int charHeight = fm.getHeight();
setSize(new Dimension(width, height));
g.setFont(font);
-
draw(g, width, height);
-
+ validate();
}
public void draw(Graphics g, int width, int height)
g.fillRect(0, 0, width, height);
labelLength = g.getFontMetrics(font).stringWidth(longestName) + 20; // 20
- // allows
- // for
- // scrollbar
+ // allows
+ // for
+ // scrollbar
float wscale = (float) (width - labelLength - offx * 2)
/ tree.getMaxHeight();
PaintRefresher.Refresh(this, av.getSequenceSetId());
repaint();
+ av.sendSelection();
}
}
treeSelectionChanged((Sequence) ob);
PaintRefresher.Refresh(this, av.getSequenceSetId());
repaint();
+ av.sendSelection();
return;
}
else if (!(ob instanceof SequenceNode))
for (int i = 0; i < tree.getGroups().size(); i++)
{
- Color col = new Color((int) (Math.random() * 255), (int) (Math
- .random() * 255), (int) (Math.random() * 255));
+ Color col = new Color((int) (Math.random() * 255),
+ (int) (Math.random() * 255), (int) (Math.random() * 255));
setColor((SequenceNode) tree.getGroups().elementAt(i), col.brighter());
- Vector l = tree.findLeaves((SequenceNode) tree.getGroups().elementAt(
- i), new Vector());
+ Vector l = tree.findLeaves(
+ (SequenceNode) tree.getGroups().elementAt(i), new Vector());
Vector sequences = new Vector();
for (int j = 0; j < l.size(); j++)
{
if (av.getGlobalColourScheme() instanceof UserColourScheme)
{
- cs = new UserColourScheme(((UserColourScheme) av
- .getGlobalColourScheme()).getColours());
+ cs = new UserColourScheme(
+ ((UserColourScheme) av.getGlobalColourScheme())
+ .getColours());
}
else
.getGlobalColourScheme()));
}
- cs.setThreshold(av.getGlobalColourScheme().getThreshold(), av
- .getIgnoreGapsConsensus());
+ cs.setThreshold(av.getGlobalColourScheme().getThreshold(),
+ av.getIgnoreGapsConsensus());
}
SequenceGroup sg = new SequenceGroup(sequences, "", cs, true, true,
&& av.getGlobalColourScheme().conservationApplied())
{
Conservation c = new Conservation("Group",
- ResidueProperties.propHash, 3, sg.getSequences(null), sg
- .getStartRes(), sg.getEndRes());
+ ResidueProperties.propHash, 3, sg.getSequences(null),
+ sg.getStartRes(), sg.getEndRes());
c.calculate();
c.verdict(false, av.ConsPercGaps);
av.alignment.addGroup(sg);
}
-
+ ap.updateAnnotation();
+
}
public void setShowDistances(boolean state)