2 * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3 * Copyright (C) $$Year-Rel$$ The Jalview Authors
5 * This file is part of Jalview.
7 * Jalview is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation, either version 3
10 * of the License, or (at your option) any later version.
12 * Jalview is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19 * The Jalview Authors are detailed in the 'AUTHORS' file.
23 import java.awt.Color;
24 import java.awt.Dimension;
26 import java.awt.FontMetrics;
27 import java.awt.Graphics;
28 import java.awt.Graphics2D;
29 import java.awt.Point;
30 import java.awt.Rectangle;
31 import java.awt.RenderingHints;
32 import java.awt.event.MouseEvent;
33 import java.awt.event.MouseListener;
34 import java.awt.event.MouseMotionListener;
35 import java.awt.print.PageFormat;
36 import java.awt.print.Printable;
37 import java.awt.print.PrinterException;
38 import java.awt.print.PrinterJob;
39 import java.util.ArrayList;
40 import java.util.BitSet;
41 import java.util.HashMap;
42 import java.util.Hashtable;
43 import java.util.List;
45 import java.util.Map.Entry;
46 import java.util.Vector;
48 import javax.swing.JPanel;
49 import javax.swing.JScrollPane;
50 import javax.swing.SwingUtilities;
51 import javax.swing.ToolTipManager;
53 import jalview.analysis.Conservation;
54 import jalview.analysis.TreeModel;
55 import jalview.api.AlignViewportI;
56 import jalview.datamodel.AlignmentAnnotation;
57 import jalview.datamodel.Annotation;
58 import jalview.datamodel.BinaryNode;
59 import jalview.datamodel.ColumnSelection;
60 import jalview.datamodel.ContactMatrixI;
61 import jalview.datamodel.HiddenColumns;
62 import jalview.datamodel.Sequence;
63 import jalview.datamodel.SequenceGroup;
64 import jalview.datamodel.SequenceI;
65 import jalview.datamodel.SequenceNode;
66 import jalview.gui.JalviewColourChooser.ColourChooserListener;
67 import jalview.schemes.ColourSchemeI;
68 import jalview.structure.SelectionSource;
69 import jalview.util.Format;
70 import jalview.util.MessageManager;
78 public class TreeCanvas extends JPanel implements MouseListener, Runnable,
79 Printable, MouseMotionListener, SelectionSource
82 public static final String PLACEHOLDER = " * ";
86 JScrollPane scrollPane;
90 private AlignViewport av;
92 private AlignmentPanel ap;
98 boolean fitToWindow = true;
100 boolean showDistances = false;
102 boolean showBootstrap = false;
104 boolean markPlaceholders = false;
110 private float threshold;
114 int labelLength = -1;
116 Map<Object, Rectangle> nameHash = new Hashtable<>();
118 Map<BinaryNode, Rectangle> nodeHash = new Hashtable<>();
120 BinaryNode highlightNode;
122 boolean applyToAllViews = false;
125 * Creates a new TreeCanvas object.
136 public TreeCanvas(TreePanel tp, AlignmentPanel ap, JScrollPane scroller)
140 this.setAssociatedPanel(ap);
142 scrollPane = scroller;
143 addMouseListener(this);
144 addMouseMotionListener(this);
145 ToolTipManager.sharedInstance().registerComponent(this);
154 public void treeSelectionChanged(SequenceI sequence)
156 AlignmentPanel[] aps = getAssociatedPanels();
158 for (int a = 0; a < aps.length; a++)
160 SequenceGroup selected = aps[a].av.getSelectionGroup();
162 if (selected == null)
164 selected = new SequenceGroup();
165 aps[a].av.setSelectionGroup(selected);
168 selected.setEndRes(aps[a].av.getAlignment().getWidth() - 1);
169 selected.addOrRemove(sequence, true);
179 public void setTree(TreeModel tree)
182 tree.findHeight(tree.getTopNode());
184 // Now have to calculate longest name based on the leaves
185 Vector<BinaryNode> leaves = tree.findLeaves(tree.getTopNode());
186 boolean has_placeholders = false;
189 for (int i = 0; i < leaves.size(); i++)
191 BinaryNode lf = leaves.elementAt(i);
193 if (lf instanceof SequenceNode && ((SequenceNode)lf).isPlaceholder())
195 has_placeholders = true;
198 if (longestName.length() < ((Sequence) lf.element()).getName()
201 longestName = TreeCanvas.PLACEHOLDER
202 + ((Sequence) lf.element()).getName();
206 setMarkPlaceholders(has_placeholders);
227 public void drawNode(Graphics g, BinaryNode node, float chunk,
228 double wscale, int width, int offx, int offy)
235 if ((node.left() == null) && (node.right() == null))
238 double height = node.height;
239 double dist = node.dist;
241 int xstart = (int) ((height - dist) * wscale) + offx;
242 int xend = (int) (height * wscale) + offx;
244 int ypos = (int) (node.ycount * chunk) + offy;
246 if (node.element() instanceof SequenceI)
248 SequenceI seq = (SequenceI) node.element();
250 if (av.getSequenceColour(seq) == Color.white)
252 g.setColor(Color.black);
256 g.setColor(av.getSequenceColour(seq).darker());
261 g.setColor(Color.black);
264 // Draw horizontal line
265 g.drawLine(xstart, ypos, xend, ypos);
267 String nodeLabel = "";
269 if (showDistances && (node.dist > 0))
271 nodeLabel = new Format("%g").form(node.dist);
274 if (showBootstrap && node.bootstrap > -1)
278 nodeLabel = nodeLabel + " : ";
281 nodeLabel = nodeLabel + String.valueOf(node.bootstrap);
284 if (!nodeLabel.equals(""))
286 g.drawString(nodeLabel, xstart + 2, ypos - 2);
289 String name = (markPlaceholders && ((node instanceof SequenceNode && ((SequenceNode)node).isPlaceholder())))
290 ? (PLACEHOLDER + node.getName())
293 int charWidth = fm.stringWidth(name) + 3;
294 int charHeight = font.getSize();
296 Rectangle rect = new Rectangle(xend + 10, ypos - charHeight / 2,
297 charWidth, charHeight);
299 nameHash.put(node.element(), rect);
301 // Colour selected leaves differently
302 boolean isSelected = false;
303 if (tp.isColumnWise())
305 isSelected = isColumnForNodeSelected(node);
309 SequenceGroup selected = av.getSelectionGroup();
311 if ((selected != null)
312 && selected.getSequences(null).contains(node.element()))
319 g.setColor(Color.gray);
321 g.fillRect(xend + 10, ypos - charHeight / 2, charWidth, charHeight);
322 g.setColor(Color.white);
325 g.drawString(name, xend + 10, ypos + fm.getDescent());
326 g.setColor(Color.black);
330 drawNode(g, (BinaryNode) node.left(), chunk, wscale, width, offx,
332 drawNode(g, (BinaryNode) node.right(), chunk, wscale, width, offx,
335 double height = node.height;
336 double dist = node.dist;
338 int xstart = (int) ((height - dist) * wscale) + offx;
339 int xend = (int) (height * wscale) + offx;
340 int ypos = (int) (node.ycount * chunk) + offy;
342 g.setColor(node.color.darker());
344 // Draw horizontal line
345 g.drawLine(xstart, ypos, xend, ypos);
346 if (node == highlightNode)
348 g.fillRect(xend - 3, ypos - 3, 6, 6);
352 g.fillRect(xend - 2, ypos - 2, 4, 4);
355 int ystart = (node.left() == null ? 0
356 : (int) (((BinaryNode) node.left()).ycount * chunk)) + offy;
357 int yend = (node.right() == null ? 0
358 : (int) (((BinaryNode) node.right()).ycount * chunk))
361 Rectangle pos = new Rectangle(xend - 2, ypos - 2, 5, 5);
362 nodeHash.put(node, pos);
364 g.drawLine((int) (height * wscale) + offx, ystart,
365 (int) (height * wscale) + offx, yend);
367 String nodeLabel = "";
369 if (showDistances && (node.dist > 0))
371 nodeLabel = new Format("%g").form(node.dist);
374 if (showBootstrap && node.bootstrap > -1)
378 nodeLabel = nodeLabel + " : ";
381 nodeLabel = nodeLabel + String.valueOf(node.bootstrap);
384 if (!nodeLabel.equals(""))
386 g.drawString(nodeLabel, xstart + 2, ypos - 2);
399 * @return DOCUMENT ME!
401 public Object findElement(int x, int y)
403 for (Entry<Object, Rectangle> entry : nameHash.entrySet())
405 Rectangle rect = entry.getValue();
407 if ((x >= rect.x) && (x <= (rect.x + rect.width)) && (y >= rect.y)
408 && (y <= (rect.y + rect.height)))
410 return entry.getKey();
414 for (Entry<BinaryNode, Rectangle> entry : nodeHash.entrySet())
416 Rectangle rect = entry.getValue();
418 if ((x >= rect.x) && (x <= (rect.x + rect.width)) && (y >= rect.y)
419 && (y <= (rect.y + rect.height)))
421 return entry.getKey();
434 public void pickNodes(Rectangle pickBox)
436 int width = getWidth();
437 int height = getHeight();
439 BinaryNode top = tree.getTopNode();
441 double wscale = ((width * .8) - (offx * 2)) / tree.getMaxHeight();
445 top.count = ((BinaryNode) top.left()).count
446 + ((BinaryNode) top.right()).count;
449 float chunk = (float) (height - (offy)) / top.count;
451 pickNode(pickBox, top, chunk, wscale, width, offx, offy);
472 public void pickNode(Rectangle pickBox, BinaryNode node, float chunk,
473 double wscale, int width, int offx, int offy)
480 if ((node.left() == null) && (node.right() == null))
482 double height = node.height;
483 // double dist = node.dist;
484 // int xstart = (int) ((height - dist) * wscale) + offx;
485 int xend = (int) (height * wscale) + offx;
487 int ypos = (int) (node.ycount * chunk) + offy;
489 if (pickBox.contains(new Point(xend, ypos)))
491 if (node.element() instanceof SequenceI)
493 SequenceI seq = (SequenceI) node.element();
494 SequenceGroup sg = av.getSelectionGroup();
498 sg.addOrRemove(seq, true);
505 pickNode(pickBox, (BinaryNode) node.left(), chunk, wscale, width,
507 pickNode(pickBox, (BinaryNode) node.right(), chunk, wscale, width,
520 public void setColor(BinaryNode node, Color c)
528 if (node.element() instanceof SequenceI)
530 final SequenceI seq = (SequenceI) node.element();
531 AlignmentPanel[] aps = getAssociatedPanels();
534 for (int a = 0; a < aps.length; a++)
536 aps[a].av.setSequenceColour(seq, c);
540 setColor((BinaryNode) node.left(), c);
541 setColor((BinaryNode) node.right(), c);
549 Thread thread = new Thread(this);
553 // put printing in a thread to avoid painting problems
557 PrinterJob printJob = PrinterJob.getPrinterJob();
558 PageFormat defaultPage = printJob.defaultPage();
559 PageFormat pf = printJob.pageDialog(defaultPage);
561 if (defaultPage == pf)
569 printJob.setPrintable(this, pf);
571 if (printJob.printDialog())
576 } catch (Exception PrintException)
578 PrintException.printStackTrace();
593 * @return DOCUMENT ME!
595 * @throws PrinterException
599 public int print(Graphics pg, PageFormat pf, int pi)
600 throws PrinterException
603 pg.translate((int) pf.getImageableX(), (int) pf.getImageableY());
605 int pwidth = (int) pf.getImageableWidth();
606 int pheight = (int) pf.getImageableHeight();
608 int noPages = getHeight() / pheight;
612 return Printable.NO_SUCH_PAGE;
615 if (pwidth > getWidth())
622 if (pheight > getHeight())
624 pheight = getHeight();
631 FontMetrics fm = pg.getFontMetrics(font);
632 int height = fm.getHeight() * nameHash.size();
633 pg.translate(0, -pi * pheight);
634 pg.setClip(0, pi * pheight, pwidth, (pi * pheight) + pheight);
636 // translate number of pages,
637 // height is screen size as this is the
638 // non overlapping text size
642 draw(pg, pwidth, pheight);
644 return Printable.PAGE_EXISTS;
654 public void paintComponent(Graphics g)
656 super.paintComponent(g);
662 MessageManager.getString("label.calculating_tree") + "....",
663 20, getHeight() / 2);
667 fm = g.getFontMetrics(font);
669 int nameCount = nameHash.size();
675 if (fitToWindow || (!fitToWindow && (scrollPane
676 .getHeight() > ((fm.getHeight() * nameCount) + offy))))
678 draw(g, scrollPane.getWidth(), scrollPane.getHeight());
679 setPreferredSize(null);
683 setPreferredSize(new Dimension(scrollPane.getWidth(),
684 fm.getHeight() * nameCount));
685 draw(g, scrollPane.getWidth(), fm.getHeight() * nameCount);
688 scrollPane.revalidate();
699 public void setFont(Font font)
715 public void draw(Graphics g1, int width, int height)
717 Graphics2D g2 = (Graphics2D) g1;
718 g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
719 RenderingHints.VALUE_ANTIALIAS_ON);
720 g2.setColor(Color.white);
721 g2.fillRect(0, 0, width, height);
724 if (longestName == null || tree == null)
726 g2.drawString("Calculating tree.", 20, 20);
729 offy = font.getSize() + 10;
731 fm = g2.getFontMetrics(font);
733 labelLength = fm.stringWidth(longestName) + 20; // 20 allows for scrollbar
735 double wscale = (width - labelLength - (offx * 2))
736 / tree.getMaxHeight();
738 BinaryNode top = tree.getTopNode();
742 top.count = ((BinaryNode) top.left()).count
743 + ((BinaryNode) top.right()).count;
746 float chunk = (float) (height - (offy)) / top.count;
748 drawNode(g2, tree.getTopNode(), chunk, wscale, width, offx, offy);
752 if (av.getCurrentTree() == tree)
754 g2.setColor(Color.red);
758 g2.setColor(Color.gray);
761 int x = (int) ((threshold * (getWidth() - labelLength - (2 * offx)))
764 g2.drawLine(x, 0, x, getHeight());
769 * Empty method to satisfy the MouseListener interface
774 public void mouseReleased(MouseEvent e)
777 * isPopupTrigger is set on mouseReleased on Windows
779 if (e.isPopupTrigger())
781 chooseSubtreeColour();
782 e.consume(); // prevent mouseClicked happening
787 * Empty method to satisfy the MouseListener interface
792 public void mouseEntered(MouseEvent e)
797 * Empty method to satisfy the MouseListener interface
802 public void mouseExited(MouseEvent e)
807 * Handles a mouse click on a tree node (clicks elsewhere are handled in
808 * mousePressed). Click selects the sub-tree, double-click swaps leaf nodes
809 * order, right-click opens a dialogue to choose colour for the sub-tree.
814 public void mouseClicked(MouseEvent evt)
816 if (highlightNode == null)
821 if (evt.getClickCount() > 1)
823 tree.swapNodes(highlightNode);
824 tree.reCount(tree.getTopNode());
825 tree.findHeight(tree.getTopNode());
829 Vector<BinaryNode> leaves = tree.findLeaves(highlightNode);
830 if (tp.isColumnWise()) {
831 markColumnsFor(getAssociatedPanels(), leaves, Color.red);
833 for (int i = 0; i < leaves.size(); i++)
835 SequenceI seq = (SequenceI) leaves.elementAt(i).element();
836 treeSelectionChanged(seq);
842 PaintRefresher.Refresh(tp, av.getSequenceSetId());
847 * Offer the user the option to choose a colour for the highlighted node and
848 * its children; this colour is also applied to the corresponding sequence ids
851 void chooseSubtreeColour()
853 String ttl = MessageManager.getString("label.select_subtree_colour");
854 ColourChooserListener listener = new ColourChooserListener()
857 public void colourSelected(Color c)
859 setColor(highlightNode, c);
860 PaintRefresher.Refresh(tp, ap.av.getSequenceSetId());
864 JalviewColourChooser.showColourChooser(this, ttl, highlightNode.color,
869 public void mouseMoved(MouseEvent evt)
871 av.setCurrentTree(tree);
873 Object ob = findElement(evt.getX(), evt.getY());
875 if (ob instanceof BinaryNode)
877 highlightNode = (BinaryNode) ob;
879 "<html>" + MessageManager.getString("label.highlightnode"));
885 if (highlightNode != null)
887 highlightNode = null;
888 setToolTipText(null);
895 public void mouseDragged(MouseEvent ect)
900 * Handles a mouse press on a sequence name or the tree background canvas
901 * (click on a node is handled in mouseClicked). The action is to create
902 * groups by partitioning the tree at the mouse position. Colours for the
903 * groups (and sequence names) are generated randomly.
908 public void mousePressed(MouseEvent e)
910 av.setCurrentTree(tree);
913 * isPopupTrigger is set for mousePressed (Mac)
914 * or mouseReleased (Windows)
916 if (e.isPopupTrigger())
918 if (highlightNode != null)
920 chooseSubtreeColour();
926 * defer right-click handling on Windows to
927 * mouseClicked; note isRightMouseButton
928 * also matches Cmd-click on Mac which should do
931 if (SwingUtilities.isRightMouseButton(e))
939 Object ob = findElement(x, y);
941 if (ob instanceof SequenceI)
943 treeSelectionChanged((Sequence) ob);
944 PaintRefresher.Refresh(tp,
945 getAssociatedPanel().av.getSequenceSetId());
950 else if (!(ob instanceof BinaryNode))
953 if (tree.getMaxHeight() != 0)
955 threshold = (float) (x - offx)
956 / (float) (getWidth() - labelLength - (2 * offx));
958 List<BinaryNode> groups = tree.groupNodes(threshold);
959 setColor(tree.getTopNode(), Color.black);
961 AlignmentPanel[] aps = getAssociatedPanels();
963 // TODO push calls below into a single AlignViewportI method?
964 // see also AlignViewController.deleteGroups
965 for (int a = 0; a < aps.length; a++)
967 aps[a].av.setSelectionGroup(null);
968 aps[a].av.getAlignment().deleteAllGroups();
969 aps[a].av.clearSequenceColours();
970 if (aps[a].av.getCodingComplement() != null)
972 aps[a].av.getCodingComplement().setSelectionGroup(null);
973 aps[a].av.getCodingComplement().getAlignment()
975 aps[a].av.getCodingComplement().clearSequenceColours();
977 aps[a].av.setUpdateStructures(true);
979 colourGroups(groups);
982 * clear partition (don't show vertical line) if
983 * it is to the right of all nodes
985 if (groups.isEmpty())
991 PaintRefresher.Refresh(tp,
992 getAssociatedPanel().av.getSequenceSetId());
998 void colourGroups(List<BinaryNode> groups)
1000 AlignmentPanel[] aps = getAssociatedPanels();
1001 List<BitSet> colGroups = new ArrayList<>();
1002 Map<BitSet,Color> colors=new HashMap();
1003 for (int i = 0; i < groups.size(); i++)
1005 Color col = new Color((int) (Math.random() * 255),
1006 (int) (Math.random() * 255), (int) (Math.random() * 255));
1007 setColor(groups.get(i), col.brighter());
1009 Vector<BinaryNode> l = tree.findLeaves(groups.get(i));
1010 if (!tp.isColumnWise()) {
1011 createSeqGroupFor(aps, l, col);
1013 BitSet gp=createColumnGroupFor(l,col);
1016 colors.put(gp, col);
1019 if (tp.isColumnWise())
1021 AlignmentAnnotation aa = tp.getAssocAnnotation();
1023 ContactMatrixI cm = av.getContactMatrix(aa);
1026 cm.updateGroups(colGroups);
1027 for (BitSet gp:colors.keySet())
1029 cm.setColorForGroup(gp, colors.get(gp));
1032 // stash colors in linked annotation row.
1033 // doesn't work yet. TESTS!
1034 int sstart=aa.sequenceRef!=null ? aa.sequenceRef.getStart()-1 : 0;
1035 for (BitSet gp : colors.keySet())
1037 Color gpcol = colors.get(gp);
1038 for (int p = gp.nextSetBit(0); p >= 0; p = gp.nextSetBit(p + 1))
1040 Annotation ae = aa.getAnnotationForPosition(p+sstart);
1043 ae.colour = gpcol.brighter().darker();
1050 // notify the panel(s) to redo any group specific stuff
1051 // also updates structure views if necessary
1052 for (int a = 0; a < aps.length; a++)
1054 aps[a].updateAnnotation();
1055 final AlignViewportI codingComplement = aps[a].av
1056 .getCodingComplement();
1057 if (codingComplement != null)
1059 ((AlignViewport) codingComplement).getAlignPanel()
1060 .updateAnnotation();
1065 private boolean isColumnForNodeSelected(BinaryNode bn)
1067 SequenceI rseq = tp.assocAnnotation.sequenceRef;
1071 colm = Integer.parseInt(
1072 bn.getName().substring(bn.getName().indexOf("c") + 1));
1073 } catch (Exception e)
1077 if (av==null||av.getAlignment()==null)
1079 // alignment is closed
1082 ColumnSelection cs = av.getColumnSelection();
1084 HiddenColumns hc = av.getAlignment().getHiddenColumns();
1085 int offp = (rseq != null) ? rseq.findIndex(rseq.getStart() + colm)
1088 if (!av.hasHiddenColumns())
1090 return cs.contains(offp-1);
1092 if (hc.isVisible(offp-1))
1094 return cs.contains(offp-1);
1095 // return cs.contains(hc.absoluteToVisibleColumn(offp));
1100 private BitSet createColumnGroupFor(Vector<BinaryNode> l,
1103 BitSet gp=new BitSet();
1104 for (BinaryNode bn:l)
1107 if (bn.element()!=null && bn.element()instanceof Integer)
1108 { colm = (Integer)bn.element();
1110 // parse out from nodename
1112 colm = Integer.parseInt(bn.getName().substring(bn.getName().indexOf("c")+1));
1113 } catch (Exception e)
1123 private void markColumnsFor(AlignmentPanel[] aps, Vector<BinaryNode> l,
1126 SequenceI rseq = tp.assocAnnotation.sequenceRef;
1127 if (av==null||av.getAlignment()==null)
1129 // alignment is closed
1133 for (BinaryNode bn:l)
1137 colm = Integer.parseInt(bn.getName().substring(bn.getName().indexOf("c")+1));
1138 } catch (Exception e)
1142 ColumnSelection cs = av.getColumnSelection();
1143 HiddenColumns hc = av.getAlignment().getHiddenColumns();
1145 int offp = (rseq!=null) ? rseq.findIndex(rseq.getStart()+colm) : colm;
1147 if (!av.hasHiddenColumns() || hc.isVisible(offp-1))
1149 if (cs.contains(offp-1))
1151 cs.removeElement(offp-1);
1153 cs.addElement(offp-1);
1160 public void createSeqGroupFor(AlignmentPanel[] aps, Vector<BinaryNode> l,
1164 Vector<SequenceI> sequences = new Vector<>();
1166 for (int j = 0; j < l.size(); j++)
1168 SequenceI s1 = (SequenceI) l.elementAt(j).element();
1170 if (!sequences.contains(s1))
1172 sequences.addElement(s1);
1176 ColourSchemeI cs = null;
1177 SequenceGroup _sg = new SequenceGroup(sequences, null, cs, true, true,
1178 false, 0, av.getAlignment().getWidth() - 1);
1180 _sg.setName("JTreeGroup:" + _sg.hashCode());
1181 _sg.setIdColour(col);
1183 for (int a = 0; a < aps.length; a++)
1185 SequenceGroup sg = new SequenceGroup(_sg);
1186 AlignViewport viewport = aps[a].av;
1188 // Propagate group colours in each view
1189 if (viewport.getGlobalColourScheme() != null)
1191 cs = viewport.getGlobalColourScheme().getInstance(viewport, sg);
1192 sg.setColourScheme(cs);
1193 sg.getGroupColourScheme().setThreshold(
1194 viewport.getResidueShading().getThreshold(),
1195 viewport.isIgnoreGapsConsensus());
1197 if (viewport.getResidueShading().conservationApplied())
1199 Conservation c = new Conservation("Group", sg.getSequences(null),
1200 sg.getStartRes(), sg.getEndRes());
1202 c.verdict(false, viewport.getConsPercGaps());
1203 sg.cs.setConservation(c);
1206 // indicate that associated structure views will need an update
1207 viewport.setUpdateStructures(true);
1208 // propagate structure view update and sequence group to complement view
1209 viewport.addSequenceGroup(sg);
1219 public void setShowDistances(boolean state)
1221 this.showDistances = state;
1231 public void setShowBootstrap(boolean state)
1233 this.showBootstrap = state;
1243 public void setMarkPlaceholders(boolean state)
1245 this.markPlaceholders = state;
1249 AlignmentPanel[] getAssociatedPanels()
1251 if (applyToAllViews)
1253 return PaintRefresher.getAssociatedPanels(av.getSequenceSetId());
1257 return new AlignmentPanel[] { getAssociatedPanel() };
1261 public AlignmentPanel getAssociatedPanel()
1266 public void setAssociatedPanel(AlignmentPanel ap)
1271 public AlignViewport getViewport()
1276 public void setViewport(AlignViewport av)
1281 public float getThreshold()
1286 public void setThreshold(float threshold)
1288 this.threshold = threshold;
1291 public boolean isApplyToAllViews()
1293 return this.applyToAllViews;
1296 public void setApplyToAllViews(boolean applyToAllViews)
1298 this.applyToAllViews = applyToAllViews;