From: kiramt Date: Mon, 27 Feb 2017 16:10:21 +0000 (+0000) Subject: JAL-2388 Make startRes,startSeq,endRes,endSeq private with get/setters X-Git-Tag: Release_2_10_2~3^2~92^2~63 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=d559b47886de6427219011e6e355320a0babd757;p=jalview.git JAL-2388 Make startRes,startSeq,endRes,endSeq private with get/setters --- diff --git a/src/jalview/appletgui/AlignFrame.java b/src/jalview/appletgui/AlignFrame.java index 6a0b390..dc622f5 100644 --- a/src/jalview/appletgui/AlignFrame.java +++ b/src/jalview/appletgui/AlignFrame.java @@ -571,8 +571,8 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, new String[] { (viewport.cursorMode ? "on" : "off") })); if (viewport.cursorMode) { - alignPanel.seqPanel.seqCanvas.cursorX = viewport.startRes; - alignPanel.seqPanel.seqCanvas.cursorY = viewport.startSeq; + alignPanel.seqPanel.seqCanvas.cursorX = viewport.getStartRes(); + alignPanel.seqPanel.seqCanvas.cursorY = viewport.getStartSeq(); } break; @@ -598,8 +598,8 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, } else { - alignPanel.setScrollValues(viewport.startRes, viewport.startSeq - - viewport.endSeq + viewport.startSeq); + alignPanel.setScrollValues(viewport.getStartRes(), + 2 * viewport.getStartSeq() - viewport.getEndSeq()); } break; @@ -610,8 +610,8 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, } else { - alignPanel.setScrollValues(viewport.startRes, viewport.startSeq - + viewport.endSeq - viewport.startSeq); + alignPanel.setScrollValues(viewport.getStartRes(), + viewport.getEndSeq()); } break; @@ -2388,7 +2388,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, // This is to maintain viewport position on first residue // of first sequence SequenceI seq = viewport.getAlignment().getSequenceAt(0); - int startRes = seq.findPosition(viewport.startRes); + int startRes = seq.findPosition(viewport.getStartRes()); // ShiftList shifts; // viewport.getAlignment().removeGaps(shifts=new ShiftList()); // edit.alColumnChanges=shifts.getInverse(); @@ -2420,7 +2420,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, // This is to maintain viewport position on first residue // of first sequence SequenceI seq = viewport.getAlignment().getSequenceAt(0); - int startRes = seq.findPosition(viewport.startRes); + int startRes = seq.findPosition(viewport.getStartRes()); addHistoryItem(new RemoveGapsCommand("Remove Gaps", seqs, start, end, viewport.getAlignment())); diff --git a/src/jalview/appletgui/AlignViewport.java b/src/jalview/appletgui/AlignViewport.java index 951a651..f927e63 100644 --- a/src/jalview/appletgui/AlignViewport.java +++ b/src/jalview/appletgui/AlignViewport.java @@ -76,10 +76,10 @@ public class AlignViewport extends AlignmentViewport implements alignment = al; // we always pad gaps this.setPadGaps(true); - this.startRes = 0; - this.endRes = al.getWidth() - 1; - this.startSeq = 0; - this.endSeq = al.getHeight() - 1; + this.setStartRes(0); + this.setEndRes(al.getWidth() - 1); + this.setStartSeq(0); + this.setEndSeq(al.getHeight() - 1); if (applet != null) { // get the width and height scaling factors if they were specified diff --git a/src/jalview/appletgui/AlignmentPanel.java b/src/jalview/appletgui/AlignmentPanel.java index e97c347..af7e9cd 100644 --- a/src/jalview/appletgui/AlignmentPanel.java +++ b/src/jalview/appletgui/AlignmentPanel.java @@ -519,7 +519,7 @@ public class AlignmentPanel extends Panel implements AdjustmentListener, if (res <= av.getStartRes() || res >= (av.getStartRes() + cwidth)) { vscroll.setValue(res / cwidth); - av.startRes = vscroll.getValue() * cwidth; + av.setStartRes(vscroll.getValue() * cwidth); } } @@ -632,8 +632,8 @@ public class AlignmentPanel extends Panel implements AdjustmentListener, public void setWrapAlignment(boolean wrap) { - av.startSeq = 0; - av.startRes = 0; + av.setStartSeq(0); + av.setStartRes(0); scalePanelHolder.setVisible(!wrap); hscroll.setVisible(!wrap); @@ -832,8 +832,8 @@ public class AlignmentPanel extends Panel implements AdjustmentListener, overviewPanel.setBoxPosition(); } - int scrollX = av.startRes - oldX; - int scrollY = av.startSeq - oldY; + int scrollX = av.getStartRes() - oldX; + int scrollY = av.getStartSeq() - oldY; if (av.getWrapAlignment() || !fastPaint || av.MAC) { @@ -843,13 +843,13 @@ public class AlignmentPanel extends Panel implements AdjustmentListener, { // Make sure we're not trying to draw a panel // larger than the visible window - if (scrollX > av.endRes - av.startRes) + if (scrollX > av.getEndRes() - av.getStartRes()) { - scrollX = av.endRes - av.startRes; + scrollX = av.getEndRes() - av.getStartRes(); } - else if (scrollX < av.startRes - av.endRes) + else if (scrollX < av.getStartRes() - av.getEndRes()) { - scrollX = av.startRes - av.endRes; + scrollX = av.getStartRes() - av.getEndRes(); } idPanel.idCanvas.fastPaint(scrollY); @@ -955,8 +955,8 @@ public class AlignmentPanel extends Panel implements AdjustmentListener, private void sendViewPosition() { StructureSelectionManager.getStructureSelectionManager(av.applet) - .sendViewPosition(this, av.startRes, av.endRes, av.startSeq, - av.endSeq); + .sendViewPosition(this, av.getStartRes(), av.getEndRes(), + av.getStartSeq(), av.getEndSeq()); } /** diff --git a/src/jalview/appletgui/AnnotationPanel.java b/src/jalview/appletgui/AnnotationPanel.java index 6012c1a..8b1bb26 100755 --- a/src/jalview/appletgui/AnnotationPanel.java +++ b/src/jalview/appletgui/AnnotationPanel.java @@ -618,7 +618,7 @@ public class AnnotationPanel extends Panel implements AwtRenderPanelI, gg.setColor(Color.white); gg.fillRect(0, 0, getSize().width, getSize().height); - drawComponent(gg, av.startRes, av.endRes + 1); + drawComponent(gg, av.getStartRes(), av.getEndRes() + 1); g.drawImage(image, 0, 0, this); } @@ -635,7 +635,7 @@ public class AnnotationPanel extends Panel implements AwtRenderPanelI, gg.copyArea(0, 0, imgWidth, getSize().height, -horizontal * av.getCharWidth(), 0); - int sr = av.startRes, er = av.endRes + 1, transX = 0; + int sr = av.getStartRes(), er = av.getEndRes() + 1, transX = 0; if (horizontal > 0) // scrollbar pulled right, image to the left { diff --git a/src/jalview/appletgui/IdCanvas.java b/src/jalview/appletgui/IdCanvas.java index d72e91f..8f8ed35 100755 --- a/src/jalview/appletgui/IdCanvas.java +++ b/src/jalview/appletgui/IdCanvas.java @@ -106,13 +106,14 @@ public class IdCanvas extends Panel gg.copyArea(0, 0, getSize().width, imgHeight, 0, -vertical * av.getCharHeight()); - int ss = av.startSeq, es = av.endSeq, transY = 0; + int ss = av.getStartSeq(), es = av.getEndSeq(), transY = 0; if (vertical > 0) // scroll down { ss = es - vertical; - if (ss < av.startSeq) // ie scrolling too fast, more than a page at a time + if (ss < av.getStartSeq()) // ie scrolling too fast, more than a page at a + // time { - ss = av.startSeq; + ss = av.getStartSeq(); } else { @@ -122,9 +123,9 @@ public class IdCanvas extends Panel else if (vertical < 0) { es = ss - vertical; - if (es > av.endSeq) + if (es > av.getEndSeq()) { - es = av.endSeq; + es = av.getEndSeq(); } } @@ -180,7 +181,7 @@ public class IdCanvas extends Panel gg.setFont(italic); gg.fillRect(0, 0, getSize().width, getSize().height); - drawIds(av.startSeq, av.endSeq); + drawIds(av.getStartSeq(), av.getEndSeq()); g.drawImage(image, 0, 0, this); } @@ -235,7 +236,7 @@ public class IdCanvas extends Panel int rowSize = av.getEndRes() - av.getStartRes(); // Draw the rest of the panels - for (int ypos = hgap, row = av.startRes; (ypos <= getSize().height) + for (int ypos = hgap, row = av.getStartRes(); (ypos <= getSize().height) && (row < maxwidth); ypos += cHeight, row += rowSize) { for (int i = starty; i < alheight; i++) diff --git a/src/jalview/appletgui/OverviewPanel.java b/src/jalview/appletgui/OverviewPanel.java index 1b6df1d..0d3f058 100755 --- a/src/jalview/appletgui/OverviewPanel.java +++ b/src/jalview/appletgui/OverviewPanel.java @@ -253,7 +253,6 @@ public class OverviewPanel extends Panel implements Runnable, if ((int) (row * sampleRow) == lastrow) { sameRow++; - continue; } else { @@ -261,10 +260,13 @@ public class OverviewPanel extends Panel implements Runnable, hiddenRow = false; if (hasHiddenRows) { + // look for sequence in hidden rows seq = av.getAlignment().getHiddenSequences() .getHiddenSequence(lastrow); if (seq == null) { + // didn't find in hidden rows, adjust the index and retrieve from + // full row set int index = av.getAlignment().getHiddenSequences() .findIndexWithoutHiddenSeqs(lastrow); @@ -272,6 +274,7 @@ public class OverviewPanel extends Panel implements Runnable, } else { + // found in hidden rows, ergo this row is hidden hiddenRow = true; } } diff --git a/src/jalview/appletgui/SeqCanvas.java b/src/jalview/appletgui/SeqCanvas.java index 5d6bb07..fd74c4a 100755 --- a/src/jalview/appletgui/SeqCanvas.java +++ b/src/jalview/appletgui/SeqCanvas.java @@ -216,12 +216,12 @@ public class SeqCanvas extends Panel // Its possible on certain browsers that the call to fastpaint // is faster than it can paint, so this check here catches // this possibility - if (lastsr + horizontal != av.startRes) + if (lastsr + horizontal != av.getStartRes()) { - horizontal = av.startRes - lastsr; + horizontal = av.getStartRes() - lastsr; } - lastsr = av.startRes; + lastsr = av.getStartRes(); fastPaint = true; gg.copyArea(horizontal * avcharWidth, vertical * avcharHeight, imgWidth @@ -229,7 +229,8 @@ public class SeqCanvas extends Panel imgHeight - vertical * avcharHeight, -horizontal * avcharWidth, -vertical * avcharHeight); - int sr = av.startRes, er = av.endRes, ss = av.startSeq, es = av.endSeq, transX = 0, transY = 0; + int sr = av.getStartRes(), er = av.getEndRes(), ss = av.getStartSeq(), es = av + .getEndSeq(), transX = 0, transY = 0; if (horizontal > 0) // scrollbar pulled right, image to the left { @@ -244,9 +245,10 @@ public class SeqCanvas extends Panel else if (vertical > 0) // scroll down { ss = es - vertical; - if (ss < av.startSeq) // ie scrolling too fast, more than a page at a time + if (ss < av.getStartSeq()) // ie scrolling too fast, more than a page at a + // time { - ss = av.startSeq; + ss = av.getStartSeq(); } else { @@ -256,9 +258,9 @@ public class SeqCanvas extends Panel else if (vertical < 0) { es = ss - vertical; - if (es > av.endSeq) + if (es > av.getEndSeq()) { - es = av.endSeq; + es = av.getEndSeq(); } } @@ -331,11 +333,12 @@ public class SeqCanvas extends Panel if (av.getWrapAlignment()) { - drawWrappedPanel(gg, imgWidth, imgHeight, av.startRes); + drawWrappedPanel(gg, imgWidth, imgHeight, av.getStartRes()); } else { - drawPanel(gg, av.startRes, av.endRes, av.startSeq, av.endSeq, 0); + drawPanel(gg, av.getStartRes(), av.getEndRes(), av.getStartSeq(), + av.getEndSeq(), 0); } g.drawImage(img, 0, 0, this); @@ -421,7 +424,7 @@ public class SeqCanvas extends Panel av.setWrappedWidth(cWidth); - av.endRes = av.startRes + cWidth; + av.setEndRes(av.getStartRes() + cWidth); int endx; int ypos = hgap; diff --git a/src/jalview/appletgui/SeqPanel.java b/src/jalview/appletgui/SeqPanel.java index 1352fe9..946fc2a 100644 --- a/src/jalview/appletgui/SeqPanel.java +++ b/src/jalview/appletgui/SeqPanel.java @@ -226,16 +226,16 @@ public class SeqPanel extends Panel implements MouseMotionListener, } else { - while (seqCanvas.cursorY < av.startSeq) + while (seqCanvas.cursorY < av.getStartSeq()) { ap.scrollUp(true); } - while (seqCanvas.cursorY + 1 > av.endSeq) + while (seqCanvas.cursorY + 1 > av.getEndSeq()) { ap.scrollUp(false); } while (seqCanvas.cursorX < av.getColumnSelection() - .adjustForHiddenColumns(av.startRes)) + .adjustForHiddenColumns(av.getStartRes())) { if (!ap.scrollRight(false)) @@ -244,7 +244,7 @@ public class SeqPanel extends Panel implements MouseMotionListener, } } while (seqCanvas.cursorX > av.getColumnSelection() - .adjustForHiddenColumns(av.endRes)) + .adjustForHiddenColumns(av.getEndRes())) { if (!ap.scrollRight(true)) { @@ -1643,8 +1643,8 @@ public class SeqPanel extends Panel implements MouseMotionListener, oldSeq = -1; } - if (res > av.endRes || res < av.startRes || y < av.startSeq - || y > av.endSeq) + if (res > av.getEndRes() || res < av.getStartRes() + || y < av.getStartSeq() || y > av.getEndSeq()) { mouseExited(evt); } @@ -1890,8 +1890,8 @@ public class SeqPanel extends Panel implements MouseMotionListener, public void scrollTo(int row, int column) { - row = row < 0 ? ap.av.startSeq : row; - column = column < 0 ? ap.av.startRes : column; + row = row < 0 ? ap.av.getStartSeq() : row; + column = column < 0 ? ap.av.getStartRes() : column; ap.scrollTo(column, column, row, true, true); } @@ -1903,8 +1903,8 @@ public class SeqPanel extends Panel implements MouseMotionListener, public void scrollToRow(int row) { - row = row < 0 ? ap.av.startSeq : row; - ap.scrollTo(ap.av.startRes, ap.av.startRes, row, true, true); + row = row < 0 ? ap.av.getStartSeq() : row; + ap.scrollTo(ap.av.getStartRes(), ap.av.getStartRes(), row, true, true); } /** @@ -1915,8 +1915,8 @@ public class SeqPanel extends Panel implements MouseMotionListener, public void scrollToColumn(int column) { - column = column < 0 ? ap.av.startRes : column; - ap.scrollTo(column, column, ap.av.startSeq, true, true); + column = column < 0 ? ap.av.getStartRes() : column; + ap.scrollTo(column, column, ap.av.getStartSeq(), true, true); } /** diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index b5fc817..75d3677 100644 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -640,8 +640,10 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, new String[] { (viewport.cursorMode ? "on" : "off") })); if (viewport.cursorMode) { - alignPanel.getSeqPanel().seqCanvas.cursorX = viewport.startRes; - alignPanel.getSeqPanel().seqCanvas.cursorY = viewport.startSeq; + alignPanel.getSeqPanel().seqCanvas.cursorX = viewport + .getStartRes(); + alignPanel.getSeqPanel().seqCanvas.cursorY = viewport + .getStartSeq(); } alignPanel.getSeqPanel().seqCanvas.repaint(); break; @@ -679,8 +681,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, } else { - alignPanel.setScrollValues(viewport.startRes, viewport.startSeq - - viewport.endSeq + viewport.startSeq); + alignPanel.setScrollValues(viewport.getStartRes(), + 2 * viewport.getStartSeq() - viewport.getEndSeq()); } break; case KeyEvent.VK_PAGE_DOWN: @@ -690,8 +692,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, } else { - alignPanel.setScrollValues(viewport.startRes, viewport.startSeq - + viewport.endSeq - viewport.startSeq); + alignPanel.setScrollValues(viewport.getStartRes(), + viewport.getEndSeq()); } break; } @@ -2612,7 +2614,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, // This is to maintain viewport position on first residue // of first sequence SequenceI seq = viewport.getAlignment().getSequenceAt(0); - int startRes = seq.findPosition(viewport.startRes); + int startRes = seq.findPosition(viewport.getStartRes()); // ShiftList shifts; // viewport.getAlignment().removeGaps(shifts=new ShiftList()); // edit.alColumnChanges=shifts.getInverse(); @@ -2651,7 +2653,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, // This is to maintain viewport position on first residue // of first sequence SequenceI seq = viewport.getAlignment().getSequenceAt(0); - int startRes = seq.findPosition(viewport.startRes); + int startRes = seq.findPosition(viewport.getStartRes()); addHistoryItem(new RemoveGapsCommand("Remove Gaps", seqs, start, end, viewport.getAlignment())); diff --git a/src/jalview/gui/AlignViewport.java b/src/jalview/gui/AlignViewport.java index 3d0eb21..4c888a1 100644 --- a/src/jalview/gui/AlignViewport.java +++ b/src/jalview/gui/AlignViewport.java @@ -237,10 +237,10 @@ public class AlignViewport extends AlignmentViewport implements void init() { - this.startRes = 0; - this.endRes = alignment.getWidth() - 1; - this.startSeq = 0; - this.endSeq = alignment.getHeight() - 1; + setStartRes(0); + setEndRes(alignment.getWidth() - 1); + setStartSeq(0); + setEndSeq(alignment.getHeight() - 1); applyViewProperties(); String fontName = Cache.getDefault("FONT_NAME", "SansSerif"); diff --git a/src/jalview/gui/AlignmentPanel.java b/src/jalview/gui/AlignmentPanel.java index d793e6a..552d166 100644 --- a/src/jalview/gui/AlignmentPanel.java +++ b/src/jalview/gui/AlignmentPanel.java @@ -467,7 +467,7 @@ public class AlignmentPanel extends GAlignmentPanel implements if (res < av.getStartRes() || res >= (av.getStartRes() + cwidth)) { vscroll.setValue((res / cwidth)); - av.startRes = vscroll.getValue() * cwidth; + av.setStartRes(vscroll.getValue() * cwidth); } } @@ -591,7 +591,7 @@ public class AlignmentPanel extends GAlignmentPanel implements fontChanged(); setAnnotationVisible(av.isShowAnnotation()); boolean wrap = av.getWrapAlignment(); - av.startSeq = 0; + av.setStartSeq(0); scalePanelHolder.setVisible(!wrap); hscroll.setVisible(!wrap); idwidthAdjuster.setVisible(!wrap); @@ -810,8 +810,8 @@ public class AlignmentPanel extends GAlignmentPanel implements overviewPanel.setBoxPosition(); } - int scrollX = av.startRes - oldX; - int scrollY = av.startSeq - oldY; + int scrollX = av.getStartRes() - oldX; + int scrollY = av.getStartSeq() - oldY; if (av.getWrapAlignment() || !fastPaint) { @@ -821,13 +821,13 @@ public class AlignmentPanel extends GAlignmentPanel implements { // Make sure we're not trying to draw a panel // larger than the visible window - if (scrollX > av.endRes - av.startRes) + if (scrollX > av.getEndRes() - av.getStartRes()) { - scrollX = av.endRes - av.startRes; + scrollX = av.getEndRes() - av.getStartRes(); } - else if (scrollX < av.startRes - av.endRes) + else if (scrollX < av.getStartRes() - av.getEndRes()) { - scrollX = av.startRes - av.endRes; + scrollX = av.getStartRes() - av.getEndRes(); } if (scrollX != 0 || scrollY != 0) diff --git a/src/jalview/gui/AnnotationPanel.java b/src/jalview/gui/AnnotationPanel.java index b1f0edb..c619dc1 100755 --- a/src/jalview/gui/AnnotationPanel.java +++ b/src/jalview/gui/AnnotationPanel.java @@ -55,7 +55,6 @@ import java.util.List; import javax.swing.JColorChooser; import javax.swing.JMenuItem; -import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JPopupMenu; import javax.swing.Scrollable; @@ -905,7 +904,7 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI, return; } } - imgWidth = (av.endRes - av.startRes + 1) * av.getCharWidth(); + imgWidth = (av.getEndRes() - av.getStartRes() + 1) * av.getCharWidth(); if (imgWidth < 1) { return; @@ -946,7 +945,7 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI, imageFresh = true; } - drawComponent(gg, av.startRes, av.endRes + 1); + drawComponent(gg, av.getStartRes(), av.getEndRes() + 1); imageFresh = false; g.drawImage(image, 0, 0, this); } @@ -976,8 +975,8 @@ public class AnnotationPanel extends JPanel implements AwtRenderPanelI, gg.copyArea(0, 0, imgWidth, getHeight(), -horizontal * av.getCharWidth(), 0); long mtime = System.currentTimeMillis(); - int sr = av.startRes; - int er = av.endRes + 1; + int sr = av.getStartRes(); + int er = av.getEndRes() + 1; int transX = 0; if (horizontal > 0) // scrollbar pulled right, image to the left diff --git a/src/jalview/gui/IdCanvas.java b/src/jalview/gui/IdCanvas.java index 37be8bc..c753cae 100755 --- a/src/jalview/gui/IdCanvas.java +++ b/src/jalview/gui/IdCanvas.java @@ -161,17 +161,17 @@ public class IdCanvas extends JPanel gg.copyArea(0, 0, getWidth(), imgHeight, 0, -vertical * av.getCharHeight()); - int ss = av.startSeq; - int es = av.endSeq; + int ss = av.getStartSeq(); + int es = av.getEndSeq(); int transY = 0; if (vertical > 0) // scroll down { ss = es - vertical; - if (ss < av.startSeq) + if (ss < av.getStartSeq()) { // ie scrolling too fast, more than a page at a time - ss = av.startSeq; + ss = av.getStartSeq(); } else { @@ -182,9 +182,9 @@ public class IdCanvas extends JPanel { es = ss - vertical; - if (es > av.endSeq) + if (es > av.getEndSeq()) { - es = av.endSeq; + es = av.getEndSeq(); } } @@ -240,7 +240,7 @@ public class IdCanvas extends JPanel gg.setColor(Color.white); gg.fillRect(0, 0, getWidth(), imgHeight); - drawIds(av.getStartSeq(), av.endSeq); + drawIds(av.getStartSeq(), av.getEndSeq()); g.drawImage(image, 0, 0, this); } @@ -317,7 +317,7 @@ public class IdCanvas extends JPanel int rowSize = av.getEndRes() - av.getStartRes(); // Draw the rest of the panels - for (int ypos = hgap, row = av.startRes; (ypos <= getHeight()) + for (int ypos = hgap, row = av.getStartRes(); (ypos <= getHeight()) && (row < maxwidth); ypos += cHeight, row += rowSize) { for (int i = starty; i < alheight; i++) diff --git a/src/jalview/gui/Jalview2XML.java b/src/jalview/gui/Jalview2XML.java index 3ac453f..55d29d5 100644 --- a/src/jalview/gui/Jalview2XML.java +++ b/src/jalview/gui/Jalview2XML.java @@ -1270,8 +1270,8 @@ public class Jalview2XML view.setWidth(size.width); view.setHeight(size.height); - view.setStartRes(av.startRes); - view.setStartSeq(av.startSeq); + view.setStartRes(av.getStartRes()); + view.setStartSeq(av.getStartSeq()); if (av.getGlobalColourScheme() instanceof jalview.schemes.UserColourScheme) { diff --git a/src/jalview/gui/SeqCanvas.java b/src/jalview/gui/SeqCanvas.java index d015292..54d2be7 100755 --- a/src/jalview/gui/SeqCanvas.java +++ b/src/jalview/gui/SeqCanvas.java @@ -279,10 +279,10 @@ public class SeqCanvas extends JComponent gg.copyArea(horizontal * charWidth, vertical * charHeight, imgWidth, imgHeight, -horizontal * charWidth, -vertical * charHeight); - int sr = av.startRes; - int er = av.endRes; - int ss = av.startSeq; - int es = av.endSeq; + int sr = av.getStartRes(); + int er = av.getEndRes(); + int ss = av.getStartSeq(); + int es = av.getEndSeq(); int transX = 0; int transY = 0; @@ -300,9 +300,9 @@ public class SeqCanvas extends JComponent { ss = es - vertical; - if (ss < av.startSeq) + if (ss < av.getStartSeq()) { // ie scrolling too fast, more than a page at a time - ss = av.startSeq; + ss = av.getStartSeq(); } else { @@ -313,9 +313,9 @@ public class SeqCanvas extends JComponent { es = ss - vertical; - if (es > av.endSeq) + if (es > av.getEndSeq()) { - es = av.endSeq; + es = av.getEndSeq(); } } @@ -397,11 +397,12 @@ public class SeqCanvas extends JComponent if (av.getWrapAlignment()) { - drawWrappedPanel(gg, getWidth(), getHeight(), av.startRes); + drawWrappedPanel(gg, getWidth(), getHeight(), av.getStartRes()); } else { - drawPanel(gg, av.startRes, av.endRes, av.startSeq, av.endSeq, 0); + drawPanel(gg, av.getStartRes(), av.getEndRes(), av.getStartSeq(), + av.getEndSeq(), 0); } g.drawImage(lcimg, 0, 0, this); @@ -503,7 +504,7 @@ public class SeqCanvas extends JComponent av.setWrappedWidth(cWidth); - av.endRes = av.startRes + cWidth; + av.setEndRes(av.getStartRes() + cWidth); int endx; int ypos = hgap; diff --git a/src/jalview/gui/SeqPanel.java b/src/jalview/gui/SeqPanel.java index 37b4852..16415cc 100644 --- a/src/jalview/gui/SeqPanel.java +++ b/src/jalview/gui/SeqPanel.java @@ -385,18 +385,18 @@ public class SeqPanel extends JPanel implements MouseListener, } else { - while (seqCanvas.cursorY < av.startSeq) + while (seqCanvas.cursorY < av.getStartSeq()) { ap.scrollUp(true); } - while (seqCanvas.cursorY + 1 > av.endSeq) + while (seqCanvas.cursorY + 1 > av.getEndSeq()) { ap.scrollUp(false); } if (!av.getWrapAlignment()) { while (seqCanvas.cursorX < av.getColumnSelection() - .adjustForHiddenColumns(av.startRes)) + .adjustForHiddenColumns(av.getStartRes())) { if (!ap.scrollRight(false)) { @@ -404,7 +404,7 @@ public class SeqPanel extends JPanel implements MouseListener, } } while (seqCanvas.cursorX > av.getColumnSelection() - .adjustForHiddenColumns(av.endRes)) + .adjustForHiddenColumns(av.getEndRes())) { if (!ap.scrollRight(true)) { diff --git a/src/jalview/viewmodel/AlignmentViewport.java b/src/jalview/viewmodel/AlignmentViewport.java index fb2b4071..b728efc 100644 --- a/src/jalview/viewmodel/AlignmentViewport.java +++ b/src/jalview/viewmodel/AlignmentViewport.java @@ -1285,14 +1285,13 @@ public abstract class AlignmentViewport implements AlignViewportI, */ private boolean followHighlight = true; - // TODO private with getters and setters? - public int startRes; + private int startRes; - public int endRes; + private int endRes; - public int startSeq; + private int startSeq; - public int endSeq; + private int endSeq; /** * Property change listener for changes in alignment