X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjalview%2Fgui%2FAlignmentPanel.java;h=f06ca94a1acf8557c3797fb95ffee7969011be70;hb=95b271e7afc0a09a6ccfcdb92422c69a9b989a7e;hp=ec83a5d521fb0f310965c56e1ff26f171550c7a1;hpb=4d7f98a6dd54d9863ba449ec79dcd95d25ed863d;p=jalview.git diff --git a/src/jalview/gui/AlignmentPanel.java b/src/jalview/gui/AlignmentPanel.java index ec83a5d..f06ca94 100644 --- a/src/jalview/gui/AlignmentPanel.java +++ b/src/jalview/gui/AlignmentPanel.java @@ -99,7 +99,7 @@ public class AlignmentPanel extends GAlignmentPanel implements * 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. @@ -137,6 +137,7 @@ public class AlignmentPanel extends GAlignmentPanel implements final AlignmentPanel ap = this; av.addPropertyChangeListener(new PropertyChangeListener() { + @Override public void propertyChange(PropertyChangeEvent evt) { if (evt.getPropertyName().equals("alignment")) @@ -509,6 +510,7 @@ public class AlignmentPanel extends GAlignmentPanel implements * 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 @@ -566,6 +568,9 @@ public class AlignmentPanel extends GAlignmentPanel implements 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(); @@ -729,7 +734,14 @@ public class AlignmentPanel extends GAlignmentPanel implements 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); } @@ -739,6 +751,7 @@ public class AlignmentPanel extends GAlignmentPanel implements * @param evt * DOCUMENT ME! */ + @Override public void adjustmentValueChanged(AdjustmentEvent evt) { int oldX = av.getStartRes(); @@ -772,6 +785,7 @@ public class AlignmentPanel extends GAlignmentPanel implements // as preference setting SwingUtilities.invokeLater(new Runnable() { + @Override public void run() { setScrollValues(av.getStartRes(), av.getStartSeq()); @@ -828,9 +842,9 @@ public class AlignmentPanel extends GAlignmentPanel implements * 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 { @@ -842,6 +856,7 @@ public class AlignmentPanel extends GAlignmentPanel implements * Repaint the alignment including the annotations and overview panels (if * shown). */ + @Override public void paintAlignment(boolean updateOverview) { final AnnotationSorter sorter = new AnnotationSorter(getAlignment(), @@ -868,6 +883,7 @@ public class AlignmentPanel extends GAlignmentPanel implements * @param g * DOCUMENT ME! */ + @Override public void paintComponent(Graphics g) { invalidate(); @@ -877,6 +893,12 @@ public class AlignmentPanel extends GAlignmentPanel implements 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(); @@ -920,6 +942,7 @@ public class AlignmentPanel extends GAlignmentPanel implements * @throws PrinterException * DOCUMENT ME! */ + @Override public int print(Graphics pg, PageFormat pf, int pi) throws PrinterException { @@ -1246,14 +1269,17 @@ public class AlignmentPanel extends GAlignmentPanel implements void makeAlignmentImage(jalview.util.ImageMaker.TYPE type, File file) { - long progress = System.currentTimeMillis(); + 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 { @@ -1280,7 +1306,7 @@ public class AlignmentPanel extends GAlignmentPanel implements im = new jalview.util.ImageMaker(this, type, imageAction, aDimension.getWidth(), aDimension.getHeight(), file, - imageTitle); + imageTitle, alignFrame, pSessionId, headless); if (av.getWrapAlignment()) { if (im.getGraphics() != null) @@ -1299,6 +1325,7 @@ public class AlignmentPanel extends GAlignmentPanel implements im.writeImage(); } } + } catch (OutOfMemoryError err) { // Be noisy here. @@ -1312,12 +1339,7 @@ public class AlignmentPanel extends GAlignmentPanel implements } } finally { - if (alignFrame != null && !headless) - { - alignFrame.setProgressBar( - MessageManager.getString("status.export_complete"), - progress); - } + } } @@ -1786,17 +1808,17 @@ public class AlignmentPanel extends GAlignmentPanel implements } /** - * 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; } }