2 * Jalview - A Sequence Alignment Editor and Viewer
3 * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
25 import java.awt.event.*;
26 import java.awt.print.*;
29 import jalview.datamodel.*;
30 import jalview.jbgui.*;
31 import jalview.schemes.*;
39 public class AlignmentPanel
40 extends GAlignmentPanel implements AdjustmentListener, Printable
42 public AlignViewport av;
43 OverviewPanel overviewPanel;
46 IdwidthAdjuster idwidthAdjuster;
49 public AlignFrame alignFrame;
50 ScalePanel scalePanel;
51 AnnotationPanel annotationPanel;
52 AnnotationLabels alabels;
54 // this value is set false when selection area being dragged
55 boolean fastPaint = true;
60 * Creates a new AlignmentPanel object.
62 * @param af DOCUMENT ME!
63 * @param av DOCUMENT ME!
65 public AlignmentPanel(AlignFrame af, final AlignViewport av)
69 seqPanel = new SeqPanel(av, this);
70 idPanel = new IdPanel(av, this);
72 scalePanel = new ScalePanel(av, this);
74 idPanelHolder.add(idPanel, BorderLayout.CENTER);
75 idwidthAdjuster = new IdwidthAdjuster(this);
76 idSpaceFillerPanel1.add(idwidthAdjuster, BorderLayout.CENTER);
78 annotationPanel = new AnnotationPanel(this);
79 alabels = new AnnotationLabels(this);
81 annotationScroller.setViewportView(annotationPanel);
82 annotationSpaceFillerHolder.add(alabels, BorderLayout.CENTER);
84 scalePanelHolder.add(scalePanel, BorderLayout.CENTER);
85 seqPanelHolder.add(seqPanel, BorderLayout.CENTER);
87 setScrollValues(0, 0);
89 setAnnotationVisible(av.getShowAnnotation());
91 hscroll.addAdjustmentListener(this);
92 vscroll.addAdjustmentListener(this);
94 final AlignmentPanel ap = this;
95 av.addPropertyChangeListener(new PropertyChangeListener()
97 public void propertyChange(PropertyChangeEvent evt)
99 if (evt.getPropertyName().equals("alignment"))
101 PaintRefresher.Refresh(ap,
102 av.getSequenceSetId(),
111 adjustAnnotationHeight();
115 public void alignmentChanged()
117 av.alignmentChanged(this);
119 alignFrame.updateEditMenuBar();
121 paintAlignment(true);
128 public void fontChanged()
130 // set idCanvas bufferedImage to null
131 // to prevent drawing old image
132 FontMetrics fm = getFontMetrics(av.getFont());
134 scalePanelHolder.setPreferredSize(new Dimension(10,
135 av.charHeight + fm.getDescent()));
136 idSpaceFillerPanel1.setPreferredSize(new Dimension(10,
137 av.charHeight + fm.getDescent()));
139 idPanel.idCanvas.gg = null;
140 seqPanel.seqCanvas.img = null;
141 annotationPanel.adjustPanelHeight();
143 Dimension d = calculateIdWidth();
144 d.setSize(d.width + 4, d.height);
145 idPanel.idCanvas.setPreferredSize(d);
146 hscrollFillerPanel.setPreferredSize(d);
148 if (overviewPanel != null)
150 overviewPanel.setBoxPosition();
159 * @return DOCUMENT ME!
161 public Dimension calculateIdWidth()
163 Container c = new Container();
165 FontMetrics fm = c.getFontMetrics(
166 new Font(av.font.getName(), Font.ITALIC, av.font.getSize()));
168 AlignmentI al = av.getAlignment();
174 while ( (i < al.getHeight()) && (al.getSequenceAt(i) != null))
176 SequenceI s = al.getSequenceAt(i);
178 id = s.getDisplayId(av.getShowJVSuffix());
180 if (fm.stringWidth(id) > idWidth)
182 idWidth = fm.stringWidth(id);
188 // Also check annotation label widths
191 if (al.getAlignmentAnnotation() != null)
193 fm = c.getFontMetrics(alabels.getFont());
195 while (i < al.getAlignmentAnnotation().length)
197 String label = al.getAlignmentAnnotation()[i].label;
199 if (fm.stringWidth(label) > idWidth)
201 idWidth = fm.stringWidth(label);
208 return new Dimension(idWidth, 12);
214 * @param results DOCUMENT ME!
216 public void highlightSearchResults(SearchResults results)
218 seqPanel.seqCanvas.highlightSearchResults(results);
220 // do we need to scroll the panel?
223 SequenceI seq = results.getResultSequence(0);
224 int seqIndex = av.alignment.findIndex(seq);
225 int start = seq.findIndex(results.getResultStart(0)) - 1;
226 int end = seq.findIndex(results.getResultEnd(0)) - 1;
228 if (!av.wrapAlignment)
230 if ( (av.getStartRes() > end) || (av.getEndRes() < start) ||
231 ( (av.getStartSeq() > seqIndex) || (av.getEndSeq() < seqIndex)))
233 setScrollValues(start, seqIndex);
238 scrollToWrappedVisible(start);
242 paintAlignment(true);
245 void scrollToWrappedVisible(int res)
247 int cwidth = seqPanel.seqCanvas.getWrappedCanvasWidth(seqPanel.seqCanvas.
249 if (res <= av.getStartRes() || res >= (av.getStartRes() + cwidth))
251 vscroll.setValue(res / cwidth);
252 av.startRes = vscroll.getValue() * cwidth;
259 * @return DOCUMENT ME!
261 public OverviewPanel getOverviewPanel()
263 return overviewPanel;
269 * @param op DOCUMENT ME!
271 public void setOverviewPanel(OverviewPanel op)
279 * @param b DOCUMENT ME!
281 public void setAnnotationVisible(boolean b)
283 if (!av.wrapAlignment)
285 annotationSpaceFillerHolder.setVisible(b);
286 annotationScroller.setVisible(b);
291 public void adjustAnnotationHeight()
293 //TODO: display vertical annotation scrollbar if necessary
294 // this is called after loading new annotation onto alignment
295 if (alignFrame.getHeight() == 0)
297 System.out.println("NEEDS FIXING");
300 int height = annotationPanel.adjustPanelHeight();
302 if (hscroll.isVisible())
304 height += hscroll.getPreferredSize().height;
306 if (height > alignFrame.getHeight() / 2)
308 height = alignFrame.getHeight() / 2;
313 annotationScroller.setPreferredSize(
314 new Dimension(annotationScroller.getWidth(), height));
317 annotationSpaceFillerHolder.setPreferredSize(new Dimension(
318 annotationSpaceFillerHolder.getWidth(),
320 annotationScroller.validate();// repaint();
327 * @param wrap DOCUMENT ME!
329 public void setWrapAlignment(boolean wrap)
332 scalePanelHolder.setVisible(!wrap);
333 hscroll.setVisible(!wrap);
334 idwidthAdjuster.setVisible(!wrap);
338 annotationScroller.setVisible(false);
339 annotationSpaceFillerHolder.setVisible(false);
341 else if (av.showAnnotation)
343 annotationScroller.setVisible(true);
344 annotationSpaceFillerHolder.setVisible(true);
347 idSpaceFillerPanel1.setVisible(!wrap);
352 // return value is true if the scroll is valid
353 public boolean scrollUp(boolean up)
357 if (vscroll.getValue() < 1)
363 vscroll.setValue(vscroll.getValue() - 1);
367 if ( (vextent + vscroll.getValue()) >= av.getAlignment().getHeight())
373 vscroll.setValue(vscroll.getValue() + 1);
384 * @param right DOCUMENT ME!
386 * @return DOCUMENT ME!
388 public boolean scrollRight(boolean right)
392 if (hscroll.getValue() < 1)
398 hscroll.setValue(hscroll.getValue() - 1);
402 if ( (hextent + hscroll.getValue()) >= av.getAlignment().getWidth())
408 hscroll.setValue(hscroll.getValue() + 1);
419 * @param x DOCUMENT ME!
420 * @param y DOCUMENT ME!
422 public void setScrollValues(int x, int y)
425 int width = av.alignment.getWidth();
426 int height = av.alignment.getHeight();
428 if (av.hasHiddenColumns)
430 width = av.getColumnSelection().findColumnPosition(width);
433 av.setEndRes( (x + (seqPanel.seqCanvas.getWidth() / av.charWidth)) - 1);
435 hextent = seqPanel.seqCanvas.getWidth() / av.charWidth;
436 vextent = seqPanel.seqCanvas.getHeight() / av.charHeight;
443 if (vextent > height)
448 if ( (hextent + x) > width)
453 if ( (vextent + y) > height)
455 y = height - vextent;
468 hscroll.setValues(x, hextent, 0, width);
469 vscroll.setValues(y, vextent, 0, height);
475 * @param evt DOCUMENT ME!
477 public void adjustmentValueChanged(AdjustmentEvent evt)
480 int oldX = av.getStartRes();
481 int oldY = av.getStartSeq();
483 if (evt.getSource() == hscroll)
485 int x = hscroll.getValue();
488 (seqPanel.seqCanvas.getWidth() / av.getCharWidth())) - 1);
491 if (evt.getSource() == vscroll)
493 int offy = vscroll.getValue();
495 if (av.getWrapAlignment())
499 int rowSize = seqPanel.seqCanvas.getWrappedCanvasWidth(seqPanel.
500 seqCanvas.getWidth());
501 av.setStartRes(offy * rowSize);
502 av.setEndRes( (offy + 1) * rowSize);
506 //This is only called if file loaded is a jar file that
507 //was wrapped when saved and user has wrap alignment true
508 //as preference setting
509 SwingUtilities.invokeLater(new Runnable()
513 setScrollValues(av.getStartRes(), av.getStartSeq());
520 av.setStartSeq(offy);
522 (seqPanel.seqCanvas.getHeight() / av.getCharHeight()));
526 if (overviewPanel != null)
528 overviewPanel.setBoxPosition();
531 int scrollX = av.startRes - oldX;
532 int scrollY = av.startSeq - oldY;
534 if (av.getWrapAlignment() || !fastPaint)
540 // Make sure we're not trying to draw a panel
541 // larger than the visible window
542 if (scrollX > av.endRes - av.startRes)
544 scrollX = av.endRes - av.startRes;
546 else if (scrollX < av.startRes - av.endRes)
548 scrollX = av.startRes - av.endRes;
551 if (scrollX != 0 || scrollY != 0)
553 idPanel.idCanvas.fastPaint(scrollY);
554 seqPanel.seqCanvas.fastPaint(scrollX,
556 scalePanel.repaint();
558 if (av.getShowAnnotation())
560 annotationPanel.fastPaint(scrollX);
566 public void paintAlignment(boolean updateOverview)
572 jalview.structure.StructureSelectionManager.getStructureSelectionManager()
573 .sequenceColoursChanged(this);
575 if (overviewPanel != null)
577 overviewPanel.updateOverviewImage();
585 * @param g DOCUMENT ME!
587 public void paintComponent(Graphics g)
591 Dimension d = idPanel.idCanvas.getPreferredSize();
592 idPanelHolder.setPreferredSize(d);
593 hscrollFillerPanel.setPreferredSize(new Dimension(d.width, 12));
596 if (av.getWrapAlignment())
598 int maxwidth = av.alignment.getWidth();
600 if (av.hasHiddenColumns)
602 maxwidth = av.getColumnSelection().findColumnPosition(maxwidth) - 1;
605 int canvasWidth = seqPanel.seqCanvas.getWrappedCanvasWidth(seqPanel.
606 seqCanvas.getWidth());
610 seqPanel.seqCanvas.getWrappedCanvasWidth(seqPanel.seqCanvas.
613 vscroll.setMaximum(max);
614 vscroll.setUnitIncrement(1);
615 vscroll.setVisibleAmount(1);
620 setScrollValues(av.getStartRes(), av.getStartSeq());
627 * @param pg DOCUMENT ME!
628 * @param pf DOCUMENT ME!
629 * @param pi DOCUMENT ME!
631 * @return DOCUMENT ME!
633 * @throws PrinterException DOCUMENT ME!
635 public int print(Graphics pg, PageFormat pf, int pi)
636 throws PrinterException
638 pg.translate( (int) pf.getImageableX(), (int) pf.getImageableY());
640 int pwidth = (int) pf.getImageableWidth();
641 int pheight = (int) pf.getImageableHeight();
643 if (av.getWrapAlignment())
645 return printWrappedAlignment(pg, pwidth, pheight, pi);
649 return printUnwrapped(pg, pwidth, pheight, pi);
656 * @param pg DOCUMENT ME!
657 * @param pwidth DOCUMENT ME!
658 * @param pheight DOCUMENT ME!
659 * @param pi DOCUMENT ME!
661 * @return DOCUMENT ME!
663 * @throws PrinterException DOCUMENT ME!
665 public int printUnwrapped(Graphics pg, int pwidth, int pheight, int pi)
666 throws PrinterException
668 int idWidth = getVisibleIdWidth();
669 FontMetrics fm = getFontMetrics(av.getFont());
670 int scaleHeight = av.charHeight + fm.getDescent();
672 pg.setColor(Color.white);
673 pg.fillRect(0, 0, pwidth, pheight);
674 pg.setFont(av.getFont());
676 ////////////////////////////////////
677 /// How many sequences and residues can we fit on a printable page?
678 int totalRes = (pwidth - idWidth) / av.getCharWidth();
680 int totalSeq = (int) ( (pheight - scaleHeight) / av.getCharHeight()) -
683 int pagesWide = (av.getAlignment().getWidth() / totalRes) + 1;
685 /////////////////////////////
686 /// Only print these sequences and residues on this page
689 /////////////////////////////
690 /// Only print these sequences and residues on this page
693 /////////////////////////////
694 /// Only print these sequences and residues on this page
697 /////////////////////////////
698 /// Only print these sequences and residues on this page
700 startRes = (pi % pagesWide) * totalRes;
701 endRes = (startRes + totalRes) - 1;
703 if (endRes > (av.getAlignment().getWidth() - 1))
705 endRes = av.getAlignment().getWidth() - 1;
708 startSeq = (pi / pagesWide) * totalSeq;
709 endSeq = startSeq + totalSeq;
711 if (endSeq > av.getAlignment().getHeight())
713 endSeq = av.getAlignment().getHeight();
716 int pagesHigh = ( (av.alignment.getHeight() / totalSeq) + 1) * pheight;
718 if (av.showAnnotation)
720 pagesHigh += annotationPanel.adjustPanelHeight() + 3;
723 pagesHigh /= pheight;
725 if (pi >= (pagesWide * pagesHigh))
727 return Printable.NO_SUCH_PAGE;
731 pg.translate(idWidth, 0);
732 scalePanel.drawScale(pg, startRes, endRes, pwidth - idWidth, scaleHeight);
733 pg.translate( -idWidth, scaleHeight);
737 Color currentColor = null;
738 Color currentTextColor = null;
740 pg.setFont(idPanel.idCanvas.idfont);
743 for (int i = startSeq; i < endSeq; i++)
745 seq = av.getAlignment().getSequenceAt(i);
746 if ( (av.getSelectionGroup() != null) &&
747 av.getSelectionGroup().getSequences(null).contains(seq))
749 currentColor = Color.gray;
750 currentTextColor = Color.black;
754 currentColor = av.getSequenceColour(seq);
755 currentTextColor = Color.black;
758 pg.setColor(currentColor);
759 pg.fillRect(0, (i - startSeq) * av.charHeight, idWidth,
762 pg.setColor(currentTextColor);
765 if (av.rightAlignIds)
767 fm = pg.getFontMetrics();
768 xPos = idWidth - fm.stringWidth(
769 seq.getDisplayId(av.getShowJVSuffix())
773 pg.drawString(seq.getDisplayId(av.getShowJVSuffix()),
775 ( ( (i - startSeq) * av.charHeight) + av.getCharHeight()) -
776 (av.getCharHeight() / 5));
779 pg.setFont(av.getFont());
781 // draw main sequence panel
782 pg.translate(idWidth, 0);
783 seqPanel.seqCanvas.drawPanel(pg, startRes, endRes, startSeq, endSeq, 0);
785 if (av.showAnnotation && (endSeq == av.alignment.getHeight()))
787 pg.translate( -idWidth - 3, (endSeq - startSeq) * av.charHeight + 3);
788 alabels.drawComponent( (Graphics2D) pg, idWidth);
789 pg.translate(idWidth + 3, 0);
790 annotationPanel.drawComponent( (Graphics2D) pg, startRes, endRes +
794 return Printable.PAGE_EXISTS;
800 * @param pg DOCUMENT ME!
801 * @param pwidth DOCUMENT ME!
802 * @param pheight DOCUMENT ME!
803 * @param pi DOCUMENT ME!
805 * @return DOCUMENT ME!
807 * @throws PrinterException DOCUMENT ME!
809 public int printWrappedAlignment(Graphics pg, int pwidth, int pheight,
811 throws PrinterException
814 int annotationHeight = 0;
815 AnnotationLabels labels = null;
816 if (av.showAnnotation)
818 annotationHeight = annotationPanel.adjustPanelHeight();
819 labels = new AnnotationLabels(av);
822 int hgap = av.charHeight;
823 if (av.scaleAboveWrapped)
825 hgap += av.charHeight;
828 int cHeight = av.getAlignment().getHeight() * av.charHeight
832 int idWidth = getVisibleIdWidth();
834 int maxwidth = av.alignment.getWidth();
835 if (av.hasHiddenColumns)
837 maxwidth = av.getColumnSelection().findColumnPosition(maxwidth) - 1;
840 int resWidth = seqPanel.seqCanvas.getWrappedCanvasWidth(pwidth -
843 int totalHeight = cHeight * (maxwidth / resWidth + 1);
845 pg.setColor(Color.white);
846 pg.fillRect(0, 0, pwidth, pheight);
847 pg.setFont(av.getFont());
851 pg.setColor(Color.black);
853 pg.translate(0, -pi * pheight);
855 pg.setClip(0, pi * pheight, pwidth, pheight);
861 for (int i = 0; i < av.alignment.getHeight(); i++)
863 pg.setFont(idPanel.idCanvas.idfont);
864 SequenceI s = av.alignment.getSequenceAt(i);
865 String string = s.getDisplayId(av.getShowJVSuffix());
867 if (av.rightAlignIds)
869 FontMetrics fm = pg.getFontMetrics();
870 xPos = idWidth - fm.stringWidth(string) - 4;
872 pg.drawString(string, xPos,
873 ( (i * av.charHeight) + ypos + av.charHeight) -
874 (av.charHeight / 5));
880 (av.getAlignment().getHeight() * av.charHeight));
882 pg.setFont(av.getFont());
883 labels.drawComponent(pg, idWidth);
886 (av.getAlignment().getHeight() * av.charHeight));
891 while (ypos < totalHeight);
893 pg.translate(idWidth, 0);
895 seqPanel.seqCanvas.drawWrappedPanel(pg, pwidth - idWidth, totalHeight, 0);
897 if ( (pi * pheight) < totalHeight)
899 return Printable.PAGE_EXISTS;
904 return Printable.NO_SUCH_PAGE;
908 int getVisibleIdWidth()
911 idPanel.getWidth() > 0 ? idPanel.getWidth() :
912 calculateIdWidth().width + 4;
915 void makeAlignmentImage(int type, File file)
917 int maxwidth = av.alignment.getWidth();
918 if (av.hasHiddenColumns)
920 maxwidth = av.getColumnSelection().findColumnPosition(maxwidth);
923 int height = ( (av.alignment.getHeight() + 1) * av.charHeight)
924 + scalePanel.getHeight();
925 int width = getVisibleIdWidth() + (maxwidth * av.charWidth);
927 if (av.getWrapAlignment())
929 height = getWrappedHeight();
930 if (System.getProperty("java.awt.headless") != null
931 && System.getProperty("java.awt.headless").equals("true"))
933 width = alignFrame.getWidth()
934 - vscroll.getPreferredSize().width
935 - alignFrame.getInsets().left
936 - alignFrame.getInsets().right;
940 width = seqPanel.getWidth() + getVisibleIdWidth();
944 else if (av.getShowAnnotation())
946 height += annotationPanel.adjustPanelHeight() + 3;
952 jalview.util.ImageMaker im;
953 if (type == jalview.util.ImageMaker.PNG)
955 im = new jalview.util.ImageMaker(this,
956 jalview.util.ImageMaker.PNG,
957 "Create PNG image from alignment",
958 width, height, file, null);
962 im = new jalview.util.ImageMaker(this,
963 jalview.util.ImageMaker.EPS,
964 "Create EPS file from alignment",
966 alignFrame.getTitle());
969 if (av.getWrapAlignment())
971 if (im.getGraphics() != null)
973 printWrappedAlignment(im.getGraphics(), width, height, 0);
979 if (im.getGraphics() != null)
981 printUnwrapped(im.getGraphics(), width, height, 0);
986 catch (OutOfMemoryError err)
988 System.out.println("########################\n"
989 + "OUT OF MEMORY " + file + "\n"
990 + "########################");
992 JOptionPane.showInternalMessageDialog(Desktop.desktop,
993 "Out of Memory Creating Image!!"
995 "\nSee help files for increasing Java Virtual Machine memory."
997 JOptionPane.WARNING_MESSAGE);
998 System.out.println("Create IMAGE: " + err);
1002 catch (Exception ex)
1004 ex.printStackTrace();
1011 public void makeEPS(File epsFile)
1013 makeAlignmentImage(jalview.util.ImageMaker.EPS, epsFile);
1019 public void makePNG(File pngFile)
1021 makeAlignmentImage(jalview.util.ImageMaker.PNG, pngFile);
1024 public void makePNGImageMap(File imgMapFile, String imageName)
1026 ///////ONLY WORKS WITH NONE WRAPPED ALIGNMENTS
1027 //////////////////////////////////////////////
1028 int idWidth = getVisibleIdWidth();
1029 FontMetrics fm = getFontMetrics(av.getFont());
1030 int scaleHeight = av.charHeight + fm.getDescent();
1033 //////////////////////////////////
1034 if (imgMapFile != null)
1038 int s, sSize = av.alignment.getHeight(),
1039 res, alwidth = av.alignment.getWidth(), g, gSize, f, fSize, sy;
1040 StringBuffer text = new StringBuffer();
1041 PrintWriter out = new PrintWriter(new FileWriter(imgMapFile));
1042 out.println(jalview.io.HTMLOutput.getImageMapHTML());
1043 out.println("<img src=\"" + imageName +
1044 "\" border=\"0\" usemap=\"#Map\" >"
1045 + "<map name=\"Map\">");
1047 for (s = 0; s < sSize; s++)
1049 sy = s * av.charHeight + scaleHeight;
1051 SequenceI seq = av.alignment.getSequenceAt(s);
1052 SequenceFeature[] features = seq.getDatasetSequence().
1053 getSequenceFeatures();
1054 SequenceGroup[] groups = av.alignment.findAllGroups(seq);
1055 for (res = 0; res < alwidth; res++)
1057 text = new StringBuffer();
1059 if (av.alignment.isNucleotide())
1061 obj = ResidueProperties.nucleotideName.get(seq.getCharAt(res) +
1066 obj = ResidueProperties.aa2Triplet.get(
1067 seq.getCharAt(res) + "");
1075 String triplet = obj.toString();
1076 int alIndex = seq.findPosition(res);
1077 gSize = groups.length;
1078 for (g = 0; g < gSize; g++)
1080 if (text.length() < 1)
1082 text.append("<area shape=\"rect\" coords=\""
1083 + (idWidth + res * av.charWidth) + ","
1085 + (idWidth + (res + 1) * av.charWidth) + ","
1086 + (av.charHeight + sy) + "\""
1087 + " onMouseOver=\"toolTip('"
1088 + alIndex + " " + triplet);
1091 if (groups[g].getStartRes() < res && groups[g].getEndRes() > res)
1093 text.append("<br><em>" + groups[g].getName() + "</em>");
1097 if (features != null)
1099 if (text.length() < 1)
1101 text.append("<area shape=\"rect\" coords=\""
1102 + (idWidth + res * av.charWidth) + ","
1104 + (idWidth + (res + 1) * av.charWidth) + ","
1105 + (av.charHeight + sy) + "\""
1106 + " onMouseOver=\"toolTip('"
1107 + alIndex + " " + triplet);
1109 fSize = features.length;
1110 for (f = 0; f < fSize; f++)
1113 if ( (features[f].getBegin() <= seq.findPosition(res)) &&
1114 (features[f].getEnd() >= seq.findPosition(res)))
1116 if (features[f].getType().equals("disulfide bond"))
1118 if (features[f].getBegin() == seq.findPosition(res)
1119 || features[f].getEnd() == seq.findPosition(res))
1121 text.append("<br>disulfide bond " + features[f].getBegin() +
1123 features[f].getEnd());
1128 text.append("<br>");
1129 text.append(features[f].getType());
1130 if (features[f].getDescription() != null &&
1132 getType().equals(features[f].getDescription()))
1134 text.append(" " + features[f].getDescription());
1137 if (features[f].getValue("status") != null)
1139 text.append(" (" + features[f].getValue("status") + ")");
1146 if (text.length() > 1)
1148 text.append("')\"; onMouseOut=\"toolTip()\"; href=\"#\">");
1149 out.println(text.toString());
1153 out.println("</map></body></html>");
1157 catch (Exception ex)
1159 ex.printStackTrace();
1161 } ///////////END OF IMAGE MAP
1165 int getWrappedHeight()
1167 int seqPanelWidth = seqPanel.seqCanvas.getWidth();
1169 if (System.getProperty("java.awt.headless") != null
1170 && System.getProperty("java.awt.headless").equals("true"))
1172 seqPanelWidth = alignFrame.getWidth()
1173 - getVisibleIdWidth()
1174 - vscroll.getPreferredSize().width
1175 - alignFrame.getInsets().left
1176 - alignFrame.getInsets().right;
1179 int chunkWidth = seqPanel.seqCanvas.getWrappedCanvasWidth(
1183 int hgap = av.charHeight;
1184 if (av.scaleAboveWrapped)
1186 hgap += av.charHeight;
1189 int annotationHeight = 0;
1190 if (av.showAnnotation)
1192 annotationHeight = annotationPanel.adjustPanelHeight();
1195 int cHeight = av.getAlignment().getHeight() * av.charHeight
1199 int maxwidth = av.alignment.getWidth();
1200 if (av.hasHiddenColumns)
1202 maxwidth = av.getColumnSelection().findColumnPosition(maxwidth) - 1;
1205 int height = ( (maxwidth / chunkWidth) + 1) * cHeight;