X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=inline;f=src%2Fjalview%2Fgui%2FAlignmentPanel.java;h=2d057bb383e04e9379b25bc83185ff8bdd17ba29;hb=ee19482a42988b76fdca9d46065ce2ca14ea73c5;hp=45e4b95efd5cef8b2c1ffb45c970f86a81dcda5d;hpb=006890b02106eb31841e6e84d75f1027434823e0;p=jalview.git
diff --git a/src/jalview/gui/AlignmentPanel.java b/src/jalview/gui/AlignmentPanel.java
index 45e4b95..2d057bb 100644
--- a/src/jalview/gui/AlignmentPanel.java
+++ b/src/jalview/gui/AlignmentPanel.java
@@ -24,6 +24,7 @@ import jalview.analysis.AnnotationSorter;
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;
@@ -122,7 +123,7 @@ public class AlignmentPanel extends GAlignmentPanel implements
*/
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));
@@ -228,6 +229,9 @@ public class AlignmentPanel extends GAlignmentPanel implements
// 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()));
@@ -471,8 +475,7 @@ public class AlignmentPanel extends GAlignmentPanel implements
/*
* 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
@@ -572,7 +575,6 @@ public class AlignmentPanel extends GAlignmentPanel implements
Dimension e = idPanel.getSize();
alabels.setSize(new Dimension(e.width, annotationHeight));
-
annotationSpaceFillerHolder.setPreferredSize(new Dimension(
annotationSpaceFillerHolder.getWidth(), annotationHeight));
annotationScroller.validate();
@@ -806,7 +808,7 @@ public class AlignmentPanel extends GAlignmentPanel implements
// 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.log.warn(
+ Console.warn(
"Unexpected path through code: Wrapped jar file opened with wrap alignment set in preferences");
// scroll to start of panel
@@ -1020,8 +1022,8 @@ public class AlignmentPanel extends GAlignmentPanel implements
* 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))
@@ -1065,8 +1067,8 @@ public class AlignmentPanel extends GAlignmentPanel implements
*
* @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());
@@ -1118,8 +1120,8 @@ public class AlignmentPanel extends GAlignmentPanel implements
g.translate(idWidth, 0);
- getSeqPanel().seqCanvas.drawWrappedPanelForPrinting(g, pageWidth - idWidth,
- totalHeight, 0);
+ getSeqPanel().seqCanvas.drawWrappedPanelForPrinting(g,
+ pageWidth - idWidth, totalHeight, 0);
if ((pageNumber * pageHeight) < totalHeight)
{
@@ -1284,13 +1286,13 @@ public class AlignmentPanel extends GAlignmentPanel implements
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)
@@ -1307,7 +1309,8 @@ public class AlignmentPanel extends GAlignmentPanel implements
text.append(" features = seq.findFeatures(column, column);
+ List features = seq.findFeatures(column,
+ column);
for (SequenceFeature sf : features)
{
if (sf.isContactFeature())
@@ -1464,9 +1468,9 @@ public class AlignmentPanel extends GAlignmentPanel implements
}
else
{
- if (Cache.log.isDebugEnabled())
+ if (Console.isDebugEnabled())
{
- Cache.log.warn("Closing alignment panel which is already closed.");
+ Console.warn("Closing alignment panel which is already closed.");
}
}
}
@@ -1541,13 +1545,17 @@ public class AlignmentPanel extends GAlignmentPanel implements
} catch (Exception ex)
{
}
-
if (b)
{
- alignFrame.setDisplayedView(this);
+ setAlignFrameView();
}
}
+ public void setAlignFrameView()
+ {
+ alignFrame.setDisplayedView(this);
+ }
+
@Override
public StructureSelectionManager getStructureSelectionManager()
{
@@ -1737,4 +1745,42 @@ public class AlignmentPanel extends GAlignmentPanel implements
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;
+ }
+ }
+
}