import java.beans.PropertyChangeEvent;
import java.util.List;
-public class AlignmentPanel extends Panel implements AdjustmentListener,
- AlignmentViewPanel, ViewportListenerI
+public class AlignmentPanel extends Panel
+ implements AdjustmentListener, AlignmentViewPanel, ViewportListenerI
{
public AlignViewport av;
idPanel.idCanvas.image = null;
FontMetrics fm = getFontMetrics(av.getFont());
- scalePanel.setSize(new Dimension(10, av.getCharHeight()
- + fm.getDescent()));
- idwidthAdjuster.setSize(new Dimension(10, av.getCharHeight()
- + fm.getDescent()));
+ scalePanel.setSize(
+ new Dimension(10, av.getCharHeight() + fm.getDescent()));
+ idwidthAdjuster.setSize(
+ new Dimension(10, av.getCharHeight() + fm.getDescent()));
av.updateSequenceIdColours();
annotationPanel.image = null;
int ap = annotationPanel.adjustPanelHeight(false);
* @return false if results were not found
*/
public boolean scrollToPosition(SearchResultsI results,
- int verticalOffset,
- boolean redrawOverview, boolean centre)
+ int verticalOffset, boolean redrawOverview, boolean centre)
{
// do we need to scroll the panel?
if (results != null && results.getSize() > 0)
{
if (JalviewLite.debug)
{// DEBUG
- System.out
- .println("DEBUG: scroll didn't happen - results not within alignment : "
+ System.out.println(
+ "DEBUG: scroll didn't happen - results not within alignment : "
+ seq.getStart() + "," + seq.getEnd());
}
return false;
*/
if (centre)
{
- int offset = (vpRanges.getEndRes() - vpRanges.getStartRes() + 1) / 2 - 1;
+ int offset = (vpRanges.getEndRes() - vpRanges.getStartRes() + 1) / 2
+ - 1;
start = Math.max(start - offset, 0);
end = end + offset - 1;
// end = Math.min(end + offset, seq.getEnd() - 1);
/*
* Scroll down to make end of search results visible
*/
- setScrollValues(vpRanges.getStartRes(), starts + seqIndex - ends
- + 1);
+ setScrollValues(vpRanges.getStartRes(),
+ starts + seqIndex - ends + 1);
}
/*
* Else results are already visible - no need to scroll
// this is called after loading new annotation onto alignment
if (alignFrame.getSize().height == 0)
{
- System.out
- .println("adjustAnnotationHeight frame size zero NEEDS FIXING");
+ System.out.println(
+ "adjustAnnotationHeight frame size zero NEEDS FIXING");
}
fontChanged();
validateAnnotationDimensions(true);
*/
if (annotationHeight + alignmentHeight > availableHeight)
{
- annotationHeight = Math.min(annotationHeight, availableHeight - 2
- * rowHeight);
+ annotationHeight = Math.min(annotationHeight,
+ availableHeight - 2 * rowHeight);
}
}
else
annotationPanel.setSize(new Dimension(d.width, annotationHeight));
annotationPanelHolder.setSize(new Dimension(d.width, annotationHeight));
// seqPanelHolder.setSize(d.width, seqandannot - height);
- seqPanel.seqCanvas
- .setSize(d.width, seqPanel.seqCanvas.getSize().height);
+ seqPanel.seqCanvas.setSize(d.width,
+ seqPanel.seqCanvas.getSize().height);
Dimension e = idPanel.getSize();
alabels.setSize(new Dimension(e.width, annotationHeight));
- annotationSpaceFillerHolder.setSize(new Dimension(e.width,
- annotationHeight));
+ annotationSpaceFillerHolder
+ .setSize(new Dimension(e.width, annotationHeight));
int s = apvscroll.getValue();
if (s > mheight - annotationHeight)
public void setWrapAlignment(boolean wrap)
{
- vpRanges.setStartSeq(0);
+ vpRanges.setStartEndSeq(0, vpRanges.getVisibleAlignmentHeight());
vpRanges.setStartRes(0);
scalePanelHolder.setVisible(!wrap);
{
return;
}
- else if (newY > -1)
+ if (newY > -1)
{
/*
* limit page up/down to one width's worth of positions
*/
int rowSize = vpRanges.getViewportWidth();
int newX = newY > oldY ? oldX + rowSize : oldX - rowSize;
- vpRanges.setViewportStartAndWidth(newX, rowSize);
+ vpRanges.setViewportStartAndWidth(Math.max(0, newX), rowSize);
}
}
else
@Override
/**
- * Property change event fired when a change is made to the viewport ranges
+ * Property change event fired when a change is made to the viewport ranges
* object associated with this alignment panel's viewport
*/
public void propertyChange(PropertyChangeEvent evt)