import jalview.api.AlignViewportI;
import jalview.api.AlignmentViewPanel;
import jalview.bin.Cache;
+import jalview.bin.Console;
import jalview.bin.Jalview;
import jalview.datamodel.AlignmentI;
import jalview.datamodel.HiddenColumns;
*/
public AlignmentPanel(AlignFrame af, final AlignViewport av)
{
-// setBackground(Color.white); // BH 2019
+ // setBackground(Color.white); // BH 2019
alignFrame = af;
this.av = av;
setSeqPanel(new SeqPanel(av, this));
// set idCanvas bufferedImage to null
// to prevent drawing old image
FontMetrics fm = getFontMetrics(av.getFont());
+
+ // update the flag controlling whether the grid is too small to render the font
+ av.validCharWidth = fm.charWidth('M') <= av.getCharWidth();
scalePanelHolder.setPreferredSize(
new Dimension(10, av.getCharHeight() + fm.getDescent()));
/*
* Scroll down to make end of search results visible
*/
- setScrollValues(ranges.getStartRes(), starts + seqIndex - ends
- + 1);
+ setScrollValues(ranges.getStartRes(), starts + seqIndex - ends + 1);
}
/*
* Else results are already visible - no need to scroll
Dimension e = idPanel.getSize();
alabels.setSize(new Dimension(e.width, annotationHeight));
-
annotationSpaceFillerHolder.setPreferredSize(new Dimension(
annotationSpaceFillerHolder.getWidth(), annotationHeight));
annotationScroller.validate();
// could not be validated and it is not clear if it is now being
// called. Log warning here in case it is called and unforeseen
// problems occur
- Cache.warn(
+ Console.warn(
"Unexpected path through code: Wrapped jar file opened with wrap alignment set in preferences");
// scroll to start of panel
* single graphics context), then reset to (0, scale height)
*/
alignmentGraphics.translate(alignmentGraphicsOffset, scaleHeight);
- getSeqPanel().seqCanvas.drawPanelForPrinting(alignmentGraphics, startRes,
- endRes, startSeq, endSeq - 1);
+ getSeqPanel().seqCanvas.drawPanelForPrinting(alignmentGraphics,
+ startRes, endRes, startSeq, endSeq - 1);
alignmentGraphics.translate(-alignmentGraphicsOffset, 0);
if (av.isShowAnnotation() && (endSeq == alignmentHeight))
*
* @throws PrinterException
*/
- public int printWrappedAlignment(int pageWidth, int pageHeight, int pageNumber,
- Graphics g) throws PrinterException
+ public int printWrappedAlignment(int pageWidth, int pageHeight,
+ int pageNumber, Graphics g) throws PrinterException
{
getSeqPanel().seqCanvas.calculateWrappedGeometry(getWidth(),
getHeight());
g.translate(idWidth, 0);
- getSeqPanel().seqCanvas.drawWrappedPanelForPrinting(g, pageWidth - idWidth,
- totalHeight, 0);
+ getSeqPanel().seqCanvas.drawWrappedPanelForPrinting(g,
+ pageWidth - idWidth, totalHeight, 0);
if ((pageNumber * pageHeight) < totalHeight)
{
String triplet = null;
if (av.getAlignment().isNucleotide())
{
- triplet = ResidueProperties.nucleotideName.get(seq
- .getCharAt(column) + "");
+ triplet = ResidueProperties.nucleotideName
+ .get(seq.getCharAt(column) + "");
}
else
{
- triplet = ResidueProperties.aa2Triplet.get(seq.getCharAt(column)
- + "");
+ triplet = ResidueProperties.aa2Triplet
+ .get(seq.getCharAt(column) + "");
}
if (triplet == null)
text.append("<area shape=\"rect\" coords=\"")
.append((idWidth + column * av.getCharWidth()))
.append(",").append(sy).append(",")
- .append((idWidth + (column + 1) * av.getCharWidth()))
+ .append((idWidth
+ + (column + 1) * av.getCharWidth()))
.append(",").append((av.getCharHeight() + sy))
.append("\"").append(" onMouseOver=\"toolTip('")
.append(seqPos).append(" ").append(triplet);
}
if (!Comparison.isGap(seq.getCharAt(column)))
{
- List<SequenceFeature> features = seq.findFeatures(column, column);
+ List<SequenceFeature> features = seq.findFeatures(column,
+ column);
for (SequenceFeature sf : features)
{
if (sf.isContactFeature())
}
else
{
- if (Cache.isDebugEnabled())
+ if (Console.isDebugEnabled())
{
- Cache.warn("Closing alignment panel which is already closed.");
+ Console.warn("Closing alignment panel which is already closed.");
}
}
}
setAlignFrameView();
}
}
+
public void setAlignFrameView()
{
alignFrame.setDisplayedView(this);
}
-
+
@Override
public StructureSelectionManager getStructureSelectionManager()
{
return calculationDialog;
}
+ /**
+ * Constructs and sets the title for the Overview window (if there is one),
+ * including the align frame's title, and view name (if applicable). Returns
+ * the title, or null if this panel has no Overview window open.
+ *
+ * @param alignFrame
+ * @return
+ */
+ public String setOverviewTitle(AlignFrame alignFrame)
+ {
+ if (this.overviewPanel == null)
+ {
+ return null;
+ }
+ String overviewTitle = MessageManager
+ .formatMessage("label.overview_params", new Object[]
+ { alignFrame.getTitle() });
+ String viewName = getViewName();
+ if (viewName != null)
+ {
+ overviewTitle += (" " + viewName);
+ }
+ overviewPanel.setTitle(overviewTitle);
+ return overviewTitle;
+ }
+
+ /**
+ * If this alignment panel has an Overview panel open, closes it
+ */
+ public void closeOverviewPanel()
+ {
+ if (overviewPanel != null)
+ {
+ overviewPanel.close();
+ overviewPanel = null;
+ }
+ }
+
}