X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjalview%2Fgui%2FAlignFrame.java;h=8396e6a80d109b87b368ab3296b1a04e3c9aa8d5;hb=071ecbceb65b4207d9ce866ffc0aa31d200d35ef;hp=cbf7a5ad11df62b2d0e495dd43aaba84864c639b;hpb=6cea511f67037933b07d4e966546552fb6fbcd41;p=jalview.git diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index cbf7a5a..8396e6a 100755 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -880,7 +880,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, for (int i = 0; i < frames.length; i++) { if (frames[i] instanceof AlignFrame && frames[i] != this - && ((AlignFrame) frames[i]).fileName.equals(fileName)) + && ((AlignFrame) frames[i]).fileName!=null && ((AlignFrame) frames[i]).fileName.equals(fileName)) { try { @@ -1781,6 +1781,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, } int alwidth = 0; + ArrayList newGraphGroups=new ArrayList(); + int fgroup=-1; if (newAlignment) { @@ -1848,6 +1850,16 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, { newDs.clear(); // tidy up } + if (alignment.getAlignmentAnnotation()!=null) + { + for (AlignmentAnnotation alan:alignment.getAlignmentAnnotation()) + { + if (alan.graphGroup>fgroup) + { + fgroup=alan.graphGroup; + } + } + } if (pastedal.getAlignmentAnnotation() != null) { // Add any annotation attached to alignment. @@ -1858,6 +1870,19 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, if (alann[i].sequenceRef == null && !alann[i].autoCalculated) { AlignmentAnnotation newann = new AlignmentAnnotation(alann[i]); + if (newann.graphGroup>-1) + { + if (newGraphGroups.size()<=newann.graphGroup || newGraphGroups.get(newann.graphGroup)==null) + { + for (int q=newGraphGroups.size();q<=newann.graphGroup; q++) + { + newGraphGroups.add(q, null); + } + newGraphGroups.set(newann.graphGroup,new Integer(++fgroup)); + } + newann.graphGroup = newGraphGroups.get(newann.graphGroup).intValue(); + } + newann.padAnnotation(alwidth); alignment.addAnnotation(newann); } @@ -1877,11 +1902,28 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, { if (sequences[i].getAnnotation() != null) { + AlignmentAnnotation newann; for (int a = 0; a < sequences[i].getAnnotation().length; a++) { annotationAdded = true; - sequences[i].getAnnotation()[a].adjustForAlignment(); - sequences[i].getAnnotation()[a].padAnnotation(alwidth); + newann=sequences[i].getAnnotation()[a]; + newann.adjustForAlignment(); + newann.padAnnotation(alwidth); + if (newann.graphGroup>-1) + { + if (newann.graphGroup>-1) + { + if (newGraphGroups.size()<=newann.graphGroup || newGraphGroups.get(newann.graphGroup)==null) + { + for (int q=newGraphGroups.size();q<=newann.graphGroup; q++) + { + newGraphGroups.add(q, null); + } + newGraphGroups.set(newann.graphGroup,new Integer(++fgroup)); + } + newann.graphGroup = newGraphGroups.get(newann.graphGroup).intValue(); + } + } alignment.addAnnotation(sequences[i].getAnnotation()[a]); // annotation // was // duplicated @@ -1921,6 +1963,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, newann.padAnnotation(avwidth); alview[avnum].addAnnotation(newann); // annotation was // duplicated earlier + // TODO JAL-1145 graphGroups are not updated for sequence annotation added to several views. This may cause strangeness alview[avnum].setAnnotationIndex(newann, a); } } @@ -1930,6 +1973,10 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, } viewport.firePropertyChange("alignment", null, alignment.getSequences()); + if (alignPanels!=null ) {for (AlignmentPanel ap:((Vector)alignPanels)) + { + ap.validateAnnotationDimensions(false); + }} else { alignPanel.validateAnnotationDimensions(false);} } else @@ -4929,6 +4976,13 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, { ex.printStackTrace(); } + catch (OutOfMemoryError oom) + { + try { + System.gc(); + } catch (Exception x){}; + new OOMWarning("loading data "+(protocol!=null ? (protocol.equals(FormatAdapter.PASTE) ? "from clipboard." : "using "+protocol+" from "+file) : ".")+(format!=null ? "(parsing as '"+format+"' file)" :""), oom, Desktop.desktop); + } } @Override @@ -5356,6 +5410,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, @Override protected void normaliseSequenceLogo_actionPerformed(ActionEvent e) { + showSequenceLogo.setState(true); + viewport.setShowSequenceLogo(true); viewport.setNormaliseSequenceLogo(normaliseSequenceLogo.getState()); alignPanel.updateAnnotation(applyAutoAnnotationSettings.getState()); }