From 8136b9b35478ec46e2f2064c32506b6bcdd85533 Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Mon, 4 Apr 2016 15:22:56 +0100 Subject: [PATCH] JAL-969 refactor columnselection operation (during JAL-2001) --- src/jalview/appletgui/AlignViewport.java | 33 -------------------------- src/jalview/gui/AlignViewport.java | 33 -------------------------- src/jalview/viewmodel/AlignmentViewport.java | 33 ++++++++++++++++++++++++++ 3 files changed, 33 insertions(+), 66 deletions(-) diff --git a/src/jalview/appletgui/AlignViewport.java b/src/jalview/appletgui/AlignViewport.java index 09e6562..e5178cb 100644 --- a/src/jalview/appletgui/AlignViewport.java +++ b/src/jalview/appletgui/AlignViewport.java @@ -348,39 +348,6 @@ public class AlignViewport extends AlignmentViewport implements .getStructureSelectionManager(applet); } - /** - * synthesize a column selection if none exists so it covers the given - * selection group. if wholewidth is false, no column selection is made if the - * selection group covers the whole alignment width. - * - * @param sg - * @param wholewidth - */ - public void expandColSelection(SequenceGroup sg, boolean wholewidth) - { - int sgs, sge; - if (sg != null - && (sgs = sg.getStartRes()) >= 0 - && sg.getStartRes() <= (sge = sg.getEndRes()) - && (colSel == null || colSel.getSelected() == null || colSel - .getSelected().size() == 0)) - { - if (!wholewidth && alignment.getWidth() == (1 + sge - sgs)) - { - // do nothing - return; - } - if (colSel == null) - { - colSel = new ColumnSelection(); - } - for (int cspos = sg.getStartRes(); cspos <= sg.getEndRes(); cspos++) - { - colSel.addElement(cspos); - } - } - } - @Override public boolean isNormaliseSequenceLogo() { diff --git a/src/jalview/gui/AlignViewport.java b/src/jalview/gui/AlignViewport.java index 7d8d4fe..692cd18 100644 --- a/src/jalview/gui/AlignViewport.java +++ b/src/jalview/gui/AlignViewport.java @@ -663,39 +663,6 @@ public class AlignViewport extends AlignmentViewport implements } /** - * synthesize a column selection if none exists so it covers the given - * selection group. if wholewidth is false, no column selection is made if the - * selection group covers the whole alignment width. - * - * @param sg - * @param wholewidth - */ - public void expandColSelection(SequenceGroup sg, boolean wholewidth) - { - int sgs, sge; - if (sg != null - && (sgs = sg.getStartRes()) >= 0 - && sg.getStartRes() <= (sge = sg.getEndRes()) - && (colSel == null || colSel.getSelected() == null || colSel - .getSelected().size() == 0)) - { - if (!wholewidth && alignment.getWidth() == (1 + sge - sgs)) - { - // do nothing - return; - } - if (colSel == null) - { - colSel = new ColumnSelection(); - } - for (int cspos = sg.getStartRes(); cspos <= sg.getEndRes(); cspos++) - { - colSel.addElement(cspos); - } - } - } - - /** * Returns the (Desktop) instance of the StructureSelectionManager */ @Override diff --git a/src/jalview/viewmodel/AlignmentViewport.java b/src/jalview/viewmodel/AlignmentViewport.java index 6322243..b70e92b 100644 --- a/src/jalview/viewmodel/AlignmentViewport.java +++ b/src/jalview/viewmodel/AlignmentViewport.java @@ -2655,4 +2655,37 @@ public abstract class AlignmentViewport implements AlignViewportI, sequence.findPosition(middleColumn), mappings); return seqOffset; } + + /** + * synthesize a column selection if none exists so it covers the given + * selection group. if wholewidth is false, no column selection is made if the + * selection group covers the whole alignment width. + * + * @param sg + * @param wholewidth + */ + public void expandColSelection(SequenceGroup sg, boolean wholewidth) + { + int sgs, sge; + if (sg != null + && (sgs = sg.getStartRes()) >= 0 + && sg.getStartRes() <= (sge = sg.getEndRes()) + && (colSel == null || colSel.getSelected() == null || colSel + .getSelected().size() == 0)) + { + if (!wholewidth && alignment.getWidth() == (1 + sge - sgs)) + { + // do nothing + return; + } + if (colSel == null) + { + colSel = new ColumnSelection(); + } + for (int cspos = sg.getStartRes(); cspos <= sg.getEndRes(); cspos++) + { + colSel.addElement(cspos); + } + } + } } -- 1.7.10.2