X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FJalview2XML.java;h=96abf81aaef44c08f79fc4c17679dce257fa9bc8;hb=4fda616141adc0db39ae78c3431446bcc83a0acc;hp=23b09deb1ba8a7f61622c450f56091ea0b81e0b3;hpb=06e3a52df5af8243cdb67c023c8ddd834711ad36;p=jalview.git diff --git a/src/jalview/gui/Jalview2XML.java b/src/jalview/gui/Jalview2XML.java index 23b09de..96abf81 100644 --- a/src/jalview/gui/Jalview2XML.java +++ b/src/jalview/gui/Jalview2XML.java @@ -20,6 +20,7 @@ */ package jalview.gui; +import jalview.api.ViewStyleI; import jalview.api.structures.JalviewStructureDisplayI; import jalview.bin.Cache; import jalview.datamodel.AlignedCodonFrame; @@ -760,10 +761,11 @@ public class Jalview2XML if (sf[index].otherDetails != null) { String key; - Enumeration keys = sf[index].otherDetails.keys(); - while (keys.hasMoreElements()) + Iterator keys = sf[index].otherDetails.keySet() + .iterator(); + while (keys.hasNext()) { - key = keys.nextElement().toString(); + key = keys.next(); OtherData keyValue = new OtherData(); keyValue.setKey(key); keyValue.setValue(sf[index].otherDetails.get(key).toString()); @@ -878,7 +880,7 @@ public class Jalview2XML // SAVE MAPPINGS if (jal.getCodonFrames() != null) { - Set jac = jal.getCodonFrames(); + List jac = jal.getCodonFrames(); for (AlignedCodonFrame acf : jac) { AlcodonFrame alc = new AlcodonFrame(); @@ -1091,15 +1093,26 @@ public class Jalview2XML view.setViewName(av.viewName); view.setGatheredViews(av.isGatherViewsHere()); - Rectangle position = ap.av.getExplodedGeometry(); - if (position == null) + Rectangle size = ap.av.getExplodedGeometry(); + Rectangle position = size; + if (size == null) { - position = ap.alignFrame.getBounds(); + size = ap.alignFrame.getBounds(); + if (av.getCodingComplement() != null) + { + position = ((SplitFrame) ap.alignFrame.getSplitViewContainer()) + .getBounds(); + } + else + { + position = size; + } } view.setXpos(position.x); view.setYpos(position.y); - view.setWidth(position.width); - view.setHeight(position.height); + + view.setWidth(size.width); + view.setHeight(size.height); view.setStartRes(av.startRes); view.setStartSeq(av.startSeq); @@ -1149,6 +1162,7 @@ public class Jalview2XML view.setFontName(av.font.getName()); view.setFontSize(av.font.getSize()); view.setFontStyle(av.font.getStyle()); + view.setScaleProteinAsCdna(av.getViewStyle().isScaleProteinAsCdna()); view.setRenderGaps(av.isRenderGaps()); view.setShowAnnotation(av.isShowAnnotation()); view.setShowBoxes(av.getShowBoxes()); @@ -1852,8 +1866,8 @@ public class Jalview2XML } } throw new Error(MessageManager.formatMessage( - "error.unsupported_version_calcIdparam", new Object[] - { calcIdParam.toString() })); + "error.unsupported_version_calcIdparam", + new Object[] { calcIdParam.toString() })); } /** @@ -2165,6 +2179,7 @@ public class Jalview2XML { SwingUtilities.invokeAndWait(new Runnable() { + @Override public void run() { setLoadingFinishedForNewStructureViewers(); @@ -2451,6 +2466,11 @@ public class Jalview2XML int width = (int) dnaFrame.getBounds().getWidth(); int height = (int) (dnaFrame.getBounds().getHeight() + proteinFrame.getBounds().getHeight() + 50); + + /* + * SplitFrame location is saved to both enclosed frames + */ + splitFrame.setLocation(dnaFrame.getX(), dnaFrame.getY()); Desktop.addInternalFrame(splitFrame, title, width, height); /* @@ -2837,8 +2857,8 @@ public class Jalview2XML else { // defer to later - frefedSequence.add(new Object[] - { maps[m].getDnasq(), cf, mapping }); + frefedSequence.add(new Object[] { maps[m].getDnasq(), cf, + mapping }); } } } @@ -3248,8 +3268,8 @@ public class Jalview2XML * indicate that annotation colours are applied across all groups (pre * Jalview 2.8.1 behaviour) */ - boolean doGroupAnnColour = isVersionStringLaterThan("2.8.1", - object.getVersion()); + boolean doGroupAnnColour = Jalview2XML.isVersionStringLaterThan( + "2.8.1", object.getVersion()); AlignmentPanel ap = null; boolean isnewview = true; @@ -4035,7 +4055,7 @@ public class Jalview2XML * @return true if version is development/null or evaluates to the same or * later X.Y.Z (where X,Y,Z are like [0-9]+b?[0-9]*) */ - protected boolean isVersionStringLaterThan(String supported, + public static boolean isVersionStringLaterThan(String supported, String version) { if (version == null || version.equalsIgnoreCase("DEVELOPMENT BUILD") @@ -4058,11 +4078,18 @@ public class Jalview2XML String fileT = fileV.nextToken().toLowerCase().replace('b', '.'); try { - if (Float.valueOf(curT) > Float.valueOf(fileT)) + float supportedVersionToken = Float.parseFloat(curT); + float myVersiontoken = Float.parseFloat(fileT); + if (supportedVersionToken > myVersiontoken) { // current version is newer than the version that wrote the file return false; } + if (supportedVersionToken < myVersiontoken) + { + // current version is older than the version that wrote the file + return true; + } } catch (NumberFormatException nfe) { System.err @@ -4194,6 +4221,9 @@ public class Jalview2XML af.viewport.setFont( new java.awt.Font(view.getFontName(), view.getFontStyle(), view .getFontSize()), true); + ViewStyleI vs = af.viewport.getViewStyle(); + vs.setScaleProteinAsCdna(view.isScaleProteinAsCdna()); + af.viewport.setViewStyle(vs); // TODO: allow custom charWidth/Heights to be restored by updating them // after setting font - which means set above to false af.viewport.setRenderGaps(view.getRenderGaps()); @@ -4578,8 +4608,8 @@ public class Jalview2XML /** * Kludge for magic autoannotation names (see JAL-811) */ - String[] magicNames = new String[] - { "Consensus", "Quality", "Conservation" }; + String[] magicNames = new String[] { "Consensus", "Quality", + "Conservation" }; JvAnnotRow nullAnnot = new JvAnnotRow(-1, null); Hashtable visan = new Hashtable(); for (String nm : magicNames) @@ -4989,8 +5019,7 @@ public class Jalview2XML } else { - frefedSequence.add(new Object[] - { dsfor, jmap }); + frefedSequence.add(new Object[] { dsfor, jmap }); } } else