TreePanel tp;
- AlignViewport av;
+ private AlignViewport av;
- AlignmentPanel ap;
+ private AlignmentPanel ap;
Font font;
int offy;
- float threshold;
+ private float threshold;
String longestName;
{
this.tp = tp;
this.av = ap.av;
- this.ap = ap;
+ this.setAssociatedPanel(ap);
font = av.getFont();
scrollPane = scroller;
addMouseListener(this);
g.drawString(nodeLabel, xstart + 2, ypos - 2);
}
- String name = (markPlaceholders && node.isPlaceholder()) ? (PLACEHOLDER + node
- .getName()) : node.getName();
+ String name = (markPlaceholders && node.isPlaceholder())
+ ? (PLACEHOLDER + node.getName())
+ : node.getName();
int charWidth = fm.stringWidth(name) + 3;
int charHeight = font.getSize();
g.fillRect(xend - 2, ypos - 2, 4, 4);
}
- int ystart = (node.left() == null ? 0 : (int) (((SequenceNode) node
- .left()).ycount * chunk)) + offy;
- int yend = (node.right() == null ? 0 : (int) (((SequenceNode) node
- .right()).ycount * chunk))
+ int ystart = (node.left() == null ? 0
+ : (int) (((SequenceNode) node.left()).ycount * chunk)) + offy;
+ int yend = (node.right() == null ? 0
+ : (int) (((SequenceNode) node.right()).ycount * chunk))
+ offy;
Rectangle pos = new Rectangle(xend - 2, ypos - 2, 5, 5);
SequenceNode top = tree.getTopNode();
- double wscale = ((width * .8) - (offx * 2))
- / tree.getMaxHeight();
+ double wscale = ((width * .8) - (offx * 2)) / tree.getMaxHeight();
if (top.count == 0)
{
if (tree == null)
{
- g.drawString(MessageManager.getString("label.calculating_tree")
- + "....", 20, getHeight() / 2);
+ g.drawString(
+ MessageManager.getString("label.calculating_tree") + "....",
+ 20, getHeight() / 2);
}
else
{
repaint();
}
- if (fitToWindow
- || (!fitToWindow && (scrollPane.getHeight() > ((fm
- .getHeight() * nameHash.size()) + offy))))
+ if (fitToWindow || (!fitToWindow && (scrollPane
+ .getHeight() > ((fm.getHeight() * nameHash.size()) + offy))))
{
draw(g, scrollPane.getWidth(), scrollPane.getHeight());
setPreferredSize(null);
g2.setColor(Color.gray);
}
- int x = (int) ((threshold * (getWidth() - labelLength - (2 * offx))) + offx);
+ int x = (int) ((threshold * (getWidth() - labelLength - (2 * offx)))
+ + offx);
g2.drawLine(x, 0, x, getHeight());
}
if (col != null)
{
setColor(highlightNode, col);
- PaintRefresher.Refresh(tp, ap.av.getSequenceSetId());
+ PaintRefresher.Refresh(tp, getAssociatedPanel().av.getSequenceSetId());
repaint();
}
}
if (ob instanceof SequenceNode)
{
highlightNode = (SequenceNode) ob;
- this.setToolTipText("<html>"
- + MessageManager.getString("label.highlightnode"));
+ this.setToolTipText(
+ "<html>" + MessageManager.getString("label.highlightnode"));
repaint();
}
if (ob instanceof SequenceI)
{
treeSelectionChanged((Sequence) ob);
- PaintRefresher.Refresh(tp, ap.av.getSequenceSetId());
+ PaintRefresher.Refresh(tp, getAssociatedPanel().av.getSequenceSetId());
repaint();
av.sendSelection();
return;
}
}
colourGroups(groups);
+
+ /*
+ * clear partition (don't show vertical line) if
+ * it is to the right of all nodes
+ */
+ if (groups.isEmpty())
+ {
+ threshold = 0f;
+ }
}
- PaintRefresher.Refresh(tp, ap.av.getSequenceSetId());
+ PaintRefresher.Refresh(tp, getAssociatedPanel().av.getSequenceSetId());
repaint();
}
Vector<SequenceNode> l = tree.findLeaves(groups.get(i));
- Vector<SequenceI> sequences = new Vector<SequenceI>();
+ Vector<SequenceI> sequences = new Vector<>();
for (int j = 0; j < l.size(); j++)
{
}
else
{
- cs = ColourSchemeProperty.getColourScheme(sg,
- ColourSchemeProperty.getColourName(av
- .getGlobalColourScheme()));
+ cs = ColourSchemeProperty.getColourScheme(sg, ColourSchemeProperty
+ .getColourName(av.getGlobalColourScheme()));
}
// cs is null if shading is an annotationColourGradient
// if (cs != null)
for (int a = 0; a < aps.length; a++)
{
if (aps[a].av.getGlobalColourScheme() != null
- && aps[a].av.getResidueShading()
- .conservationApplied())
+ && aps[a].av.getResidueShading().conservationApplied())
{
Conservation c = new Conservation("Group", sg.getSequences(null),
sg.getStartRes(), sg.getEndRes());
}
else
{
- return new AlignmentPanel[] { ap };
+ return new AlignmentPanel[] { getAssociatedPanel() };
}
}
+
+ public AlignmentPanel getAssociatedPanel()
+ {
+ return ap;
+ }
+
+ public void setAssociatedPanel(AlignmentPanel ap)
+ {
+ this.ap = ap;
+ }
+
+ public AlignViewport getViewport()
+ {
+ return av;
+ }
+
+ public void setViewport(AlignViewport av)
+ {
+ this.av = av;
+ }
+
+ public float getThreshold()
+ {
+ return threshold;
+ }
+
+ public void setThreshold(float threshold)
+ {
+ this.threshold = threshold;
+ }
+
+ public boolean isApplyToAllViews()
+ {
+ return this.applyToAllViews;
+ }
+
+ public void setApplyToAllViews(boolean applyToAllViews)
+ {
+ this.applyToAllViews = applyToAllViews;
+ }
}