2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4)
3 * Copyright (C) 2008 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.*;
32 import jalview.structure.SelectionSource;
40 public class AlignmentPanel extends GAlignmentPanel implements
41 AdjustmentListener, Printable
43 public AlignViewport av;
45 OverviewPanel overviewPanel;
51 IdwidthAdjuster idwidthAdjuster;
54 public AlignFrame alignFrame;
56 ScalePanel scalePanel;
58 AnnotationPanel annotationPanel;
60 AnnotationLabels alabels;
62 // this value is set false when selection area being dragged
63 boolean fastPaint = true;
70 * Creates a new AlignmentPanel object.
77 public AlignmentPanel(AlignFrame af, final AlignViewport av)
81 seqPanel = new SeqPanel(av, this);
82 idPanel = new IdPanel(av, this);
84 scalePanel = new ScalePanel(av, this);
86 idPanelHolder.add(idPanel, BorderLayout.CENTER);
87 idwidthAdjuster = new IdwidthAdjuster(this);
88 idSpaceFillerPanel1.add(idwidthAdjuster, BorderLayout.CENTER);
90 annotationPanel = new AnnotationPanel(this);
91 alabels = new AnnotationLabels(this);
93 annotationScroller.setViewportView(annotationPanel);
94 annotationSpaceFillerHolder.add(alabels, BorderLayout.CENTER);
96 scalePanelHolder.add(scalePanel, BorderLayout.CENTER);
97 seqPanelHolder.add(seqPanel, BorderLayout.CENTER);
99 setScrollValues(0, 0);
101 setAnnotationVisible(av.getShowAnnotation());
103 hscroll.addAdjustmentListener(this);
104 vscroll.addAdjustmentListener(this);
106 final AlignmentPanel ap = this;
107 av.addPropertyChangeListener(new PropertyChangeListener()
109 public void propertyChange(PropertyChangeEvent evt)
111 if (evt.getPropertyName().equals("alignment"))
113 PaintRefresher.Refresh(ap, av.getSequenceSetId(), true, true);
119 adjustAnnotationHeight();
123 public void alignmentChanged()
125 av.alignmentChanged(this);
127 alignFrame.updateEditMenuBar();
129 paintAlignment(true);
136 public void fontChanged()
138 // set idCanvas bufferedImage to null
139 // to prevent drawing old image
140 FontMetrics fm = getFontMetrics(av.getFont());
142 scalePanelHolder.setPreferredSize(new Dimension(10, av.charHeight
144 idSpaceFillerPanel1.setPreferredSize(new Dimension(10, av.charHeight
147 idPanel.idCanvas.gg = null;
148 seqPanel.seqCanvas.img = null;
149 annotationPanel.adjustPanelHeight();
151 Dimension d = calculateIdWidth();
152 d.setSize(d.width + 4, d.height);
153 idPanel.idCanvas.setPreferredSize(d);
154 hscrollFillerPanel.setPreferredSize(d);
156 if (overviewPanel != null)
158 overviewPanel.setBoxPosition();
165 * Calculate the width of the alignment labels based on the displayed names
166 * and any bounds on label width set in preferences.
168 * @return Dimension giving the maximum width of the alignment label panel
169 * that should be used.
171 public Dimension calculateIdWidth()
173 Container c = new Container();
175 FontMetrics fm = c.getFontMetrics(new Font(av.font.getName(),
176 Font.ITALIC, av.font.getSize()));
178 AlignmentI al = av.getAlignment();
179 int afwidth = (alignFrame != null ? alignFrame.getWidth() : 300);
180 int maxwidth = Math.max(20, Math.min(afwidth - 200, (int) 2 * afwidth
186 while ((i < al.getHeight()) && (al.getSequenceAt(i) != null))
188 SequenceI s = al.getSequenceAt(i);
190 id = s.getDisplayId(av.getShowJVSuffix());
192 if (fm.stringWidth(id) > idWidth)
194 idWidth = fm.stringWidth(id);
200 // Also check annotation label widths
203 if (al.getAlignmentAnnotation() != null)
205 fm = c.getFontMetrics(alabels.getFont());
207 while (i < al.getAlignmentAnnotation().length)
209 String label = al.getAlignmentAnnotation()[i].label;
211 if (fm.stringWidth(label) > idWidth)
213 idWidth = fm.stringWidth(label);
220 return new Dimension(Math.min(maxwidth, idWidth), 12);
229 public void highlightSearchResults(SearchResults results)
231 scrollToPosition(results);
232 seqPanel.seqCanvas.highlightSearchResults(results);
235 * scroll the view to show the position of the highlighted
236 * region in results (if any) and redraw the overview
239 public void scrollToPosition(SearchResults results) {
240 scrollToPosition(results, true);
243 * scroll the view to show the position of the highlighted
244 * region in results (if any)
246 * @param redrawOverview - when set, the overview will be recalculated (takes longer)
248 public void scrollToPosition(SearchResults results, boolean redrawOverview) {
249 // do we need to scroll the panel?
250 if (results != null && results.getSize()>0)
252 int seqIndex = av.alignment.findIndex(results);
257 SequenceI seq = av.alignment.getSequenceAt(seqIndex);
258 int [] r = results.getResults(seq, seq.getStart(), seq.getEnd());
269 if (end==seq.getEnd())
273 if (!av.wrapAlignment)
275 if ((av.getStartRes() >= start)
276 || (av.getEndRes() <= end))
278 setScrollValues(start-1, seqIndex);
279 } else if ((av.getStartSeq() > seqIndex) || (av.getEndSeq() < seqIndex))
281 setScrollValues(av.getStartRes(), seqIndex);
286 scrollToWrappedVisible(start);
289 if (!redrawOverview && overviewPanel!=null)
291 overviewPanel.setBoxPosition();
293 paintAlignment(!redrawOverview);
296 void scrollToWrappedVisible(int res)
298 int cwidth = seqPanel.seqCanvas
299 .getWrappedCanvasWidth(seqPanel.seqCanvas.getWidth());
300 if (res < av.getStartRes() || res >= (av.getStartRes()+cwidth))
302 vscroll.setValue((res / cwidth));
303 av.startRes = vscroll.getValue() * cwidth;
311 * @return DOCUMENT ME!
313 public OverviewPanel getOverviewPanel()
315 return overviewPanel;
324 public void setOverviewPanel(OverviewPanel op)
335 public void setAnnotationVisible(boolean b)
337 if (!av.wrapAlignment)
339 annotationSpaceFillerHolder.setVisible(b);
340 annotationScroller.setVisible(b);
345 public void adjustAnnotationHeight()
347 // TODO: display vertical annotation scrollbar if necessary
348 // this is called after loading new annotation onto alignment
349 if (alignFrame.getHeight() == 0)
351 System.out.println("NEEDS FIXING");
354 int height = annotationPanel.adjustPanelHeight();
356 if (hscroll.isVisible())
358 height += hscroll.getPreferredSize().height;
360 if (height > alignFrame.getHeight() / 2)
362 height = alignFrame.getHeight() / 2;
367 annotationScroller.setPreferredSize(new Dimension(annotationScroller
368 .getWidth(), height));
370 annotationSpaceFillerHolder.setPreferredSize(new Dimension(
371 annotationSpaceFillerHolder.getWidth(), height));
372 annotationScroller.validate();// repaint();
382 public void setWrapAlignment(boolean wrap)
385 scalePanelHolder.setVisible(!wrap);
386 hscroll.setVisible(!wrap);
387 idwidthAdjuster.setVisible(!wrap);
391 annotationScroller.setVisible(false);
392 annotationSpaceFillerHolder.setVisible(false);
394 else if (av.showAnnotation)
396 annotationScroller.setVisible(true);
397 annotationSpaceFillerHolder.setVisible(true);
400 idSpaceFillerPanel1.setVisible(!wrap);
405 // return value is true if the scroll is valid
406 public boolean scrollUp(boolean up)
410 if (vscroll.getValue() < 1)
416 vscroll.setValue(vscroll.getValue() - 1);
420 if ((vextent + vscroll.getValue()) >= av.getAlignment().getHeight())
426 vscroll.setValue(vscroll.getValue() + 1);
440 * @return DOCUMENT ME!
442 public boolean scrollRight(boolean right)
446 if (hscroll.getValue() < 1)
452 hscroll.setValue(hscroll.getValue() - 1);
456 if ((hextent + hscroll.getValue()) >= av.getAlignment().getWidth())
462 hscroll.setValue(hscroll.getValue() + 1);
478 public void setScrollValues(int x, int y)
480 if (av==null || av.alignment==null)
484 int width = av.alignment.getWidth();
485 int height = av.alignment.getHeight();
487 if (av.hasHiddenColumns)
489 width = av.getColumnSelection().findColumnPosition(width);
492 av.setEndRes((x + (seqPanel.seqCanvas.getWidth() / av.charWidth)) - 1);
494 hextent = seqPanel.seqCanvas.getWidth() / av.charWidth;
495 vextent = seqPanel.seqCanvas.getHeight() / av.charHeight;
502 if (vextent > height)
507 if ((hextent + x) > width)
512 if ((vextent + y) > height)
514 y = height - vextent;
527 hscroll.setValues(x, hextent, 0, width);
528 vscroll.setValues(y, vextent, 0, height);
537 public void adjustmentValueChanged(AdjustmentEvent evt)
540 int oldX = av.getStartRes();
541 int oldY = av.getStartSeq();
543 if (evt.getSource() == hscroll)
545 int x = hscroll.getValue();
548 .setEndRes((x + (seqPanel.seqCanvas.getWidth() / av
549 .getCharWidth())) - 1);
552 if (evt.getSource() == vscroll)
554 int offy = vscroll.getValue();
556 if (av.getWrapAlignment())
560 int rowSize = seqPanel.seqCanvas
561 .getWrappedCanvasWidth(seqPanel.seqCanvas.getWidth());
562 av.setStartRes(offy * rowSize);
563 av.setEndRes((offy + 1) * rowSize);
567 // This is only called if file loaded is a jar file that
568 // was wrapped when saved and user has wrap alignment true
569 // as preference setting
570 SwingUtilities.invokeLater(new Runnable()
574 setScrollValues(av.getStartRes(), av.getStartSeq());
581 av.setStartSeq(offy);
583 + (seqPanel.seqCanvas.getHeight() / av.getCharHeight()));
587 if (overviewPanel != null)
589 overviewPanel.setBoxPosition();
592 int scrollX = av.startRes - oldX;
593 int scrollY = av.startSeq - oldY;
595 if (av.getWrapAlignment() || !fastPaint)
601 // Make sure we're not trying to draw a panel
602 // larger than the visible window
603 if (scrollX > av.endRes - av.startRes)
605 scrollX = av.endRes - av.startRes;
607 else if (scrollX < av.startRes - av.endRes)
609 scrollX = av.startRes - av.endRes;
612 if (scrollX != 0 || scrollY != 0)
614 idPanel.idCanvas.fastPaint(scrollY);
615 seqPanel.seqCanvas.fastPaint(scrollX, scrollY);
616 scalePanel.repaint();
618 if (av.getShowAnnotation())
620 annotationPanel.fastPaint(scrollX);
626 public void paintAlignment(boolean updateOverview)
632 jalview.structure.StructureSelectionManager
633 .getStructureSelectionManager().sequenceColoursChanged(this);
635 if (overviewPanel != null)
637 overviewPanel.updateOverviewImage();
648 public void paintComponent(Graphics g)
652 Dimension d = idPanel.idCanvas.getPreferredSize();
653 idPanelHolder.setPreferredSize(d);
654 hscrollFillerPanel.setPreferredSize(new Dimension(d.width, 12));
657 if (av.getWrapAlignment())
659 int maxwidth = av.alignment.getWidth();
661 if (av.hasHiddenColumns)
663 maxwidth = av.getColumnSelection().findColumnPosition(maxwidth) - 1;
666 int canvasWidth = seqPanel.seqCanvas
667 .getWrappedCanvasWidth(seqPanel.seqCanvas.getWidth());
672 .getWrappedCanvasWidth(seqPanel.seqCanvas
674 vscroll.setMaximum(max);
675 vscroll.setUnitIncrement(1);
676 vscroll.setVisibleAmount(1);
681 setScrollValues(av.getStartRes(), av.getStartSeq());
695 * @return DOCUMENT ME!
697 * @throws PrinterException
700 public int print(Graphics pg, PageFormat pf, int pi)
701 throws PrinterException
703 pg.translate((int) pf.getImageableX(), (int) pf.getImageableY());
705 int pwidth = (int) pf.getImageableWidth();
706 int pheight = (int) pf.getImageableHeight();
708 if (av.getWrapAlignment())
710 return printWrappedAlignment(pg, pwidth, pheight, pi);
714 return printUnwrapped(pg, pwidth, pheight, pi);
730 * @return DOCUMENT ME!
732 * @throws PrinterException
735 public int printUnwrapped(Graphics pg, int pwidth, int pheight, int pi)
736 throws PrinterException
738 int idWidth = getVisibleIdWidth();
739 FontMetrics fm = getFontMetrics(av.getFont());
740 int scaleHeight = av.charHeight + fm.getDescent();
742 pg.setColor(Color.white);
743 pg.fillRect(0, 0, pwidth, pheight);
744 pg.setFont(av.getFont());
746 // //////////////////////////////////
747 // / How many sequences and residues can we fit on a printable page?
748 int totalRes = (pwidth - idWidth) / av.getCharWidth();
750 int totalSeq = (int) ((pheight - scaleHeight) / av.getCharHeight()) - 1;
752 int pagesWide = (av.getAlignment().getWidth() / totalRes) + 1;
754 // ///////////////////////////
755 // / Only print these sequences and residues on this page
758 // ///////////////////////////
759 // / Only print these sequences and residues on this page
762 // ///////////////////////////
763 // / Only print these sequences and residues on this page
766 // ///////////////////////////
767 // / Only print these sequences and residues on this page
769 startRes = (pi % pagesWide) * totalRes;
770 endRes = (startRes + totalRes) - 1;
772 if (endRes > (av.getAlignment().getWidth() - 1))
774 endRes = av.getAlignment().getWidth() - 1;
777 startSeq = (pi / pagesWide) * totalSeq;
778 endSeq = startSeq + totalSeq;
780 if (endSeq > av.getAlignment().getHeight())
782 endSeq = av.getAlignment().getHeight();
785 int pagesHigh = ((av.alignment.getHeight() / totalSeq) + 1) * pheight;
787 if (av.showAnnotation)
789 pagesHigh += annotationPanel.adjustPanelHeight() + 3;
792 pagesHigh /= pheight;
794 if (pi >= (pagesWide * pagesHigh))
796 return Printable.NO_SUCH_PAGE;
800 pg.translate(idWidth, 0);
801 scalePanel.drawScale(pg, startRes, endRes, pwidth - idWidth,
803 pg.translate(-idWidth, scaleHeight);
807 Color currentColor = null;
808 Color currentTextColor = null;
810 pg.setFont(idPanel.idCanvas.idfont);
813 for (int i = startSeq; i < endSeq; i++)
815 seq = av.getAlignment().getSequenceAt(i);
816 if ((av.getSelectionGroup() != null)
817 && av.getSelectionGroup().getSequences(null).contains(seq))
819 currentColor = Color.gray;
820 currentTextColor = Color.black;
824 currentColor = av.getSequenceColour(seq);
825 currentTextColor = Color.black;
828 pg.setColor(currentColor);
829 pg.fillRect(0, (i - startSeq) * av.charHeight, idWidth, av
832 pg.setColor(currentTextColor);
835 if (av.rightAlignIds)
837 fm = pg.getFontMetrics();
839 - fm.stringWidth(seq.getDisplayId(av.getShowJVSuffix()))
843 pg.drawString(seq.getDisplayId(av.getShowJVSuffix()), xPos,
844 (((i - startSeq) * av.charHeight) + av.getCharHeight())
845 - (av.getCharHeight() / 5));
848 pg.setFont(av.getFont());
850 // draw main sequence panel
851 pg.translate(idWidth, 0);
852 seqPanel.seqCanvas.drawPanel(pg, startRes, endRes, startSeq, endSeq, 0);
854 if (av.showAnnotation && (endSeq == av.alignment.getHeight()))
856 pg.translate(-idWidth - 3, (endSeq - startSeq) * av.charHeight + 3);
857 alabels.drawComponent((Graphics2D) pg, idWidth);
858 pg.translate(idWidth + 3, 0);
859 annotationPanel.drawComponent((Graphics2D) pg, startRes, endRes + 1);
862 return Printable.PAGE_EXISTS;
877 * @return DOCUMENT ME!
879 * @throws PrinterException
882 public int printWrappedAlignment(Graphics pg, int pwidth, int pheight,
883 int pi) throws PrinterException
886 int annotationHeight = 0;
887 AnnotationLabels labels = null;
888 if (av.showAnnotation)
890 annotationHeight = annotationPanel.adjustPanelHeight();
891 labels = new AnnotationLabels(av);
894 int hgap = av.charHeight;
895 if (av.scaleAboveWrapped)
897 hgap += av.charHeight;
900 int cHeight = av.getAlignment().getHeight() * av.charHeight + hgap
903 int idWidth = getVisibleIdWidth();
905 int maxwidth = av.alignment.getWidth();
906 if (av.hasHiddenColumns)
908 maxwidth = av.getColumnSelection().findColumnPosition(maxwidth) - 1;
911 int resWidth = seqPanel.seqCanvas.getWrappedCanvasWidth(pwidth
914 int totalHeight = cHeight * (maxwidth / resWidth + 1);
916 pg.setColor(Color.white);
917 pg.fillRect(0, 0, pwidth, pheight);
918 pg.setFont(av.getFont());
922 pg.setColor(Color.black);
924 pg.translate(0, -pi * pheight);
926 pg.setClip(0, pi * pheight, pwidth, pheight);
932 for (int i = 0; i < av.alignment.getHeight(); i++)
934 pg.setFont(idPanel.idCanvas.idfont);
935 SequenceI s = av.alignment.getSequenceAt(i);
936 String string = s.getDisplayId(av.getShowJVSuffix());
938 if (av.rightAlignIds)
940 FontMetrics fm = pg.getFontMetrics();
941 xPos = idWidth - fm.stringWidth(string) - 4;
943 pg.drawString(string, xPos,
944 ((i * av.charHeight) + ypos + av.charHeight)
945 - (av.charHeight / 5));
949 pg.translate(-3, ypos
950 + (av.getAlignment().getHeight() * av.charHeight));
952 pg.setFont(av.getFont());
953 labels.drawComponent(pg, idWidth);
954 pg.translate(+3, -ypos
955 - (av.getAlignment().getHeight() * av.charHeight));
959 } while (ypos < totalHeight);
961 pg.translate(idWidth, 0);
963 seqPanel.seqCanvas.drawWrappedPanel(pg, pwidth - idWidth, totalHeight,
966 if ((pi * pheight) < totalHeight)
968 return Printable.PAGE_EXISTS;
973 return Printable.NO_SUCH_PAGE;
977 int getVisibleIdWidth()
979 return idPanel.getWidth() > 0 ? idPanel.getWidth()
980 : calculateIdWidth().width + 4;
983 void makeAlignmentImage(int type, File file)
985 int maxwidth = av.alignment.getWidth();
986 if (av.hasHiddenColumns)
988 maxwidth = av.getColumnSelection().findColumnPosition(maxwidth);
991 int height = ((av.alignment.getHeight() + 1) * av.charHeight)
992 + scalePanel.getHeight();
993 int width = getVisibleIdWidth() + (maxwidth * av.charWidth);
995 if (av.getWrapAlignment())
997 height = getWrappedHeight();
998 if (System.getProperty("java.awt.headless") != null
999 && System.getProperty("java.awt.headless").equals("true"))
1001 width = alignFrame.getWidth() - vscroll.getPreferredSize().width
1002 - alignFrame.getInsets().left
1003 - alignFrame.getInsets().right;
1007 width = seqPanel.getWidth() + getVisibleIdWidth();
1011 else if (av.getShowAnnotation())
1013 height += annotationPanel.adjustPanelHeight() + 3;
1019 jalview.util.ImageMaker im;
1020 if (type == jalview.util.ImageMaker.PNG)
1022 im = new jalview.util.ImageMaker(this, jalview.util.ImageMaker.PNG,
1023 "Create PNG image from alignment", width, height, file,
1028 im = new jalview.util.ImageMaker(this, jalview.util.ImageMaker.EPS,
1029 "Create EPS file from alignment", width, height, file,
1030 alignFrame.getTitle());
1033 if (av.getWrapAlignment())
1035 if (im.getGraphics() != null)
1037 printWrappedAlignment(im.getGraphics(), width, height, 0);
1043 if (im.getGraphics() != null)
1045 printUnwrapped(im.getGraphics(), width, height, 0);
1049 } catch (OutOfMemoryError err)
1052 System.out.println("########################\n" + "OUT OF MEMORY "
1053 + file + "\n" + "########################");
1054 new OOMWarning("Creating Image for " + file, err);
1055 // System.out.println("Create IMAGE: " + err);
1056 } catch (Exception ex)
1058 ex.printStackTrace();
1065 public void makeEPS(File epsFile)
1067 makeAlignmentImage(jalview.util.ImageMaker.EPS, epsFile);
1073 public void makePNG(File pngFile)
1075 makeAlignmentImage(jalview.util.ImageMaker.PNG, pngFile);
1078 public void makePNGImageMap(File imgMapFile, String imageName)
1080 // /////ONLY WORKS WITH NONE WRAPPED ALIGNMENTS
1081 // ////////////////////////////////////////////
1082 int idWidth = getVisibleIdWidth();
1083 FontMetrics fm = getFontMetrics(av.getFont());
1084 int scaleHeight = av.charHeight + fm.getDescent();
1087 // ////////////////////////////////
1088 if (imgMapFile != null)
1092 int s, sSize = av.alignment.getHeight(), res, alwidth = av.alignment
1093 .getWidth(), g, gSize, f, fSize, sy;
1094 StringBuffer text = new StringBuffer();
1095 PrintWriter out = new PrintWriter(new FileWriter(imgMapFile));
1096 out.println(jalview.io.HTMLOutput.getImageMapHTML());
1097 out.println("<img src=\"" + imageName
1098 + "\" border=\"0\" usemap=\"#Map\" >"
1099 + "<map name=\"Map\">");
1101 for (s = 0; s < sSize; s++)
1103 sy = s * av.charHeight + scaleHeight;
1105 SequenceI seq = av.alignment.getSequenceAt(s);
1106 SequenceFeature[] features = seq.getDatasetSequence()
1107 .getSequenceFeatures();
1108 SequenceGroup[] groups = av.alignment.findAllGroups(seq);
1109 for (res = 0; res < alwidth; res++)
1111 text = new StringBuffer();
1113 if (av.alignment.isNucleotide())
1115 obj = ResidueProperties.nucleotideName.get(seq.getCharAt(res)
1120 obj = ResidueProperties.aa2Triplet.get(seq.getCharAt(res)
1129 String triplet = obj.toString();
1130 int alIndex = seq.findPosition(res);
1131 gSize = groups.length;
1132 for (g = 0; g < gSize; g++)
1134 if (text.length() < 1)
1136 text.append("<area shape=\"rect\" coords=\""
1137 + (idWidth + res * av.charWidth) + "," + sy + ","
1138 + (idWidth + (res + 1) * av.charWidth) + ","
1139 + (av.charHeight + sy) + "\""
1140 + " onMouseOver=\"toolTip('" + alIndex + " "
1144 if (groups[g].getStartRes() < res
1145 && groups[g].getEndRes() > res)
1147 text.append("<br><em>" + groups[g].getName() + "</em>");
1151 if (features != null)
1153 if (text.length() < 1)
1155 text.append("<area shape=\"rect\" coords=\""
1156 + (idWidth + res * av.charWidth) + "," + sy + ","
1157 + (idWidth + (res + 1) * av.charWidth) + ","
1158 + (av.charHeight + sy) + "\""
1159 + " onMouseOver=\"toolTip('" + alIndex + " "
1162 fSize = features.length;
1163 for (f = 0; f < fSize; f++)
1166 if ((features[f].getBegin() <= seq.findPosition(res))
1167 && (features[f].getEnd() >= seq.findPosition(res)))
1169 if (features[f].getType().equals("disulfide bond"))
1171 if (features[f].getBegin() == seq.findPosition(res)
1172 || features[f].getEnd() == seq
1175 text.append("<br>disulfide bond "
1176 + features[f].getBegin() + ":"
1177 + features[f].getEnd());
1182 text.append("<br>");
1183 text.append(features[f].getType());
1184 if (features[f].getDescription() != null
1185 && !features[f].getType().equals(
1186 features[f].getDescription()))
1188 text.append(" " + features[f].getDescription());
1191 if (features[f].getValue("status") != null)
1193 text.append(" (" + features[f].getValue("status")
1201 if (text.length() > 1)
1203 text.append("')\"; onMouseOut=\"toolTip()\"; href=\"#\">");
1204 out.println(text.toString());
1208 out.println("</map></body></html>");
1211 } catch (Exception ex)
1213 ex.printStackTrace();
1215 } // /////////END OF IMAGE MAP
1219 int getWrappedHeight()
1221 int seqPanelWidth = seqPanel.seqCanvas.getWidth();
1223 if (System.getProperty("java.awt.headless") != null
1224 && System.getProperty("java.awt.headless").equals("true"))
1226 seqPanelWidth = alignFrame.getWidth() - getVisibleIdWidth()
1227 - vscroll.getPreferredSize().width
1228 - alignFrame.getInsets().left - alignFrame.getInsets().right;
1231 int chunkWidth = seqPanel.seqCanvas
1232 .getWrappedCanvasWidth(seqPanelWidth);
1234 int hgap = av.charHeight;
1235 if (av.scaleAboveWrapped)
1237 hgap += av.charHeight;
1240 int annotationHeight = 0;
1241 if (av.showAnnotation)
1243 annotationHeight = annotationPanel.adjustPanelHeight();
1246 int cHeight = av.getAlignment().getHeight() * av.charHeight + hgap
1249 int maxwidth = av.alignment.getWidth();
1250 if (av.hasHiddenColumns)
1252 maxwidth = av.getColumnSelection().findColumnPosition(maxwidth) - 1;
1255 int height = ((maxwidth / chunkWidth) + 1) * cHeight;