From: gmungoc Date: Tue, 8 Aug 2017 09:08:46 +0000 (+0200) Subject: JAL-2650 configure new viewport settings before selecting view tab X-Git-Tag: Release_2_10_3b1~132^2~14 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=613818a08b858e3fe0dd778c738a362b3a4a0882;p=jalview.git JAL-2650 configure new viewport settings before selecting view tab --- diff --git a/src/jalview/gui/Jalview2XML.java b/src/jalview/gui/Jalview2XML.java index 45988fb..d472ef8 100644 --- a/src/jalview/gui/Jalview2XML.java +++ b/src/jalview/gui/Jalview2XML.java @@ -4423,13 +4423,6 @@ public class Jalview2XML } // recover view properties and display parameters - if (view.getViewName() != null) - { - af.viewport.viewName = view.getViewName(); - af.setInitialTabVisible(); - } - af.setBounds(view.getXpos(), view.getYpos(), view.getWidth(), - view.getHeight()); af.viewport.setShowAnnotation(view.getShowAnnotation()); af.viewport.setAbovePIDThreshold(view.getPidSelected()); @@ -4463,6 +4456,14 @@ public class Jalview2XML af.viewport.setShowUnconserved(view.hasShowUnconserved() ? view .isShowUnconserved() : false); af.viewport.getRanges().setStartRes(view.getStartRes()); + + if (view.getViewName() != null) + { + af.viewport.viewName = view.getViewName(); + af.setInitialTabVisible(); + } + af.setBounds(view.getXpos(), view.getYpos(), view.getWidth(), + view.getHeight()); // startSeq set in af.alignPanel.updateLayout below af.alignPanel.updateLayout(); ColourSchemeI cs = null; diff --git a/src/jalview/gui/SliderPanel.java b/src/jalview/gui/SliderPanel.java index ec53e93..2176719 100755 --- a/src/jalview/gui/SliderPanel.java +++ b/src/jalview/gui/SliderPanel.java @@ -365,7 +365,7 @@ public class SliderPanel extends GSliderPanel } if (forConservation) { - if (!scheme.conservationApplied()) + if (!scheme.conservationApplied() && sg != null) { /* * first time the colour scheme has had Conservation shading applied diff --git a/test/jalview/gui/AlignFrameTest.java b/test/jalview/gui/AlignFrameTest.java index 67098ae..1d8b240 100644 --- a/test/jalview/gui/AlignFrameTest.java +++ b/test/jalview/gui/AlignFrameTest.java @@ -26,6 +26,7 @@ import static org.testng.Assert.assertNotSame; import static org.testng.Assert.assertSame; import static org.testng.Assert.assertTrue; +import jalview.api.AlignCalcManagerI; import jalview.bin.Cache; import jalview.bin.Jalview; import jalview.datamodel.Alignment; @@ -538,16 +539,28 @@ public class AlignFrameTest new String[] { "Background" })); /* - * make a new View, verify alignment and group colour schemes + * make a new View, wait for Conservation thread to complete, + * verify alignment and group colour schemes */ af.newView_actionPerformed(null); assertEquals(af.alignPanel.getViewName(), "View 1"); AlignViewport av2 = af.getViewport(); assertNotSame(av, av2); + assertSame(av2, af.alignPanel.av); + AlignCalcManagerI calcManager = av2.getCalcManager(); + do + { + try + { + Thread.sleep(50); + } catch (InterruptedException x) + { + } + } while (calcManager.isWorking()); rs = av2.getResidueShading(); assertNotSame(av.getResidueShading(), rs); assertEquals(rs.getThreshold(), 10); - assertTrue(rs.conservationApplied()); + assertTrue(rs.conservationApplied(), rs.toString()); assertEquals(rs.getConservationInc(), 20); assertEquals(av2.getAlignment().getGroups().size(), 1); sg = av2.getAlignment().getGroups().get(0);