* Flag set while scrolling to follow complementary cDNA/protein scroll. When
* true, suppresses invoking the same method recursively.
*/
- private boolean followingComplementScroll;
+ private boolean dontScrollComplement;
/**
* Creates a new AlignmentPanel object.
final AlignmentPanel ap = this;
av.addPropertyChangeListener(new PropertyChangeListener()
{
+ @Override
public void propertyChange(PropertyChangeEvent evt)
{
if (evt.getPropertyName().equals("alignment"))
* automatically adjust annotation panel height for new annotation whilst
* ensuring the alignment is still visible.
*/
+ @Override
public void adjustAnnotationHeight()
{
// TODO: display vertical annotation scrollbar if necessary
annotationScroller.setPreferredSize(new Dimension(annotationScroller
.getWidth(), annotationHeight));
+ Dimension e = idPanel.getSize();
+ alabels.setSize(new Dimension(e.width, annotationHeight));
+
annotationSpaceFillerHolder.setPreferredSize(new Dimension(
annotationSpaceFillerHolder.getWidth(), annotationHeight));
annotationScroller.validate();
x = 0;
}
+ /*
+ * each scroll adjustment triggers adjustmentValueChanged, which resets the
+ * 'do not scroll complement' flag; ensure it is the same for both
+ * operations
+ */
+ boolean flag = isDontScrollComplement();
hscroll.setValues(x, hextent, 0, width);
+ setDontScrollComplement(flag);
vscroll.setValues(y, vextent, 0, height);
}
* @param evt
* DOCUMENT ME!
*/
+ @Override
public void adjustmentValueChanged(AdjustmentEvent evt)
{
int oldX = av.getStartRes();
// as preference setting
SwingUtilities.invokeLater(new Runnable()
{
+ @Override
public void run()
{
setScrollValues(av.getStartRes(), av.getStartSeq());
* If there is one, scroll the (Protein/cDNA) complementary alignment to
* match, unless we are ourselves doing that.
*/
- if (isFollowingComplementScroll())
+ if (isDontScrollComplement())
{
- setFollowingComplementScroll(false);
+ setDontScrollComplement(false);
}
else
{
* Repaint the alignment including the annotations and overview panels (if
* shown).
*/
+ @Override
public void paintAlignment(boolean updateOverview)
{
final AnnotationSorter sorter = new AnnotationSorter(getAlignment(),
* @param g
* DOCUMENT ME!
*/
+ @Override
public void paintComponent(Graphics g)
{
invalidate();
hscrollFillerPanel.setPreferredSize(new Dimension(d.width, 12));
validate();
+ /*
+ * set scroll bar positions; first suppress this being 'followed' in any
+ * complementary split pane
+ */
+ setDontScrollComplement(true);
+
if (av.getWrapAlignment())
{
int maxwidth = av.getAlignment().getWidth();
* @throws PrinterException
* DOCUMENT ME!
*/
+ @Override
public int print(Graphics pg, PageFormat pf, int pi)
throws PrinterException
{
void makeAlignmentImage(jalview.util.ImageMaker.TYPE type, File file)
{
- long progress = System.currentTimeMillis();
+ int boarderBottomOffset = 5;
+ long pSessionId = System.currentTimeMillis();
headless = (System.getProperty("java.awt.headless") != null && System
.getProperty("java.awt.headless").equals("true"));
if (alignFrame != null && !headless)
{
- alignFrame.setProgressBar(MessageManager.formatMessage(
+ if (file != null)
+ {
+ alignFrame.setProgressBar(MessageManager.formatMessage(
"status.saving_file", new Object[] { type.getLabel() }),
- progress);
+ pSessionId);
+ }
}
try
{
}
im = new jalview.util.ImageMaker(this, type, imageAction,
- aDimension.getWidth(), aDimension.getHeight(), file,
- imageTitle);
+ aDimension.getWidth(), aDimension.getHeight()
+ + boarderBottomOffset, file,
+ imageTitle, alignFrame, pSessionId, headless);
if (av.getWrapAlignment())
{
if (im.getGraphics() != null)
{
printWrappedAlignment(im.getGraphics(), aDimension.getWidth(),
- aDimension.getHeight(), 0);
+ aDimension.getHeight() + boarderBottomOffset, 0);
im.writeImage();
}
}
im.writeImage();
}
}
+
} catch (OutOfMemoryError err)
{
// Be noisy here.
}
} finally
{
- if (alignFrame != null && !headless)
- {
- alignFrame.setProgressBar(
- MessageManager.getString("status.export_complete"),
- progress);
- }
+
}
}
}
/**
- * Set a flag to say we are scrolling to follow a (cDNA/protein) complement.
+ * Set a flag to say do not scroll any (cDNA/protein) complement.
*
* @param b
*/
- protected void setFollowingComplementScroll(boolean b)
+ protected void setDontScrollComplement(boolean b)
{
- this.followingComplementScroll = b;
+ this.dontScrollComplement = b;
}
- protected boolean isFollowingComplementScroll()
+ protected boolean isDontScrollComplement()
{
- return this.followingComplementScroll;
+ return this.dontScrollComplement;
}
}