X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fappletgui%2FAlignFrame.java;h=122afa8664df4b4874db5c4e4f3405ae90626b4f;hb=refs%2Fheads%2Freleases%2FRelease_2_10_0_Branch;hp=b7e78998cb83116b614947e1ef5fc0bfbf754085;hpb=e2399fe0a610faf5dee11a68a8643c34e3ef2490;p=jalview.git diff --git a/src/jalview/appletgui/AlignFrame.java b/src/jalview/appletgui/AlignFrame.java index b7e7899..122afa8 100644 --- a/src/jalview/appletgui/AlignFrame.java +++ b/src/jalview/appletgui/AlignFrame.java @@ -25,6 +25,7 @@ import jalview.analysis.AnnotationSorter.SequenceAnnotationOrder; import jalview.api.AlignViewControllerGuiI; import jalview.api.AlignViewControllerI; import jalview.api.AlignViewportI; +import jalview.api.FeatureColourI; import jalview.api.FeatureRenderer; import jalview.api.FeatureSettingsControllerI; import jalview.api.SequenceStructureBinding; @@ -101,7 +102,6 @@ import java.net.URLEncoder; import java.util.Arrays; import java.util.Deque; import java.util.HashMap; -import java.util.Hashtable; import java.util.List; import java.util.Map; import java.util.StringTokenizer; @@ -218,6 +218,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, { viewport.setColumnSelection(columnSelection); } + viewport.setScaleAboveWrapped(scaleAbove.getState()); alignPanel = new AlignmentPanel(this, viewport); avc = new jalview.controller.AlignViewController(this, viewport, @@ -364,18 +365,15 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, public boolean parseFeaturesFile(String file, String type, boolean autoenabledisplay) { - // TODO: test if importing a features file onto an alignment which already - // has features with links overwrites the original links. - - Hashtable featureLinks = new Hashtable(); boolean featuresFile = false; try { - featuresFile = new jalview.io.FeaturesFile(file, type).parse(viewport - .getAlignment(), alignPanel.seqPanel.seqCanvas - .getFeatureRenderer().getFeatureColours(), featureLinks, - true, viewport.applet.getDefaultParameter("relaxedidmatch", - false)); + Map colours = alignPanel.seqPanel.seqCanvas + .getFeatureRenderer().getFeatureColours(); + boolean relaxedIdMatching = viewport.applet.getDefaultParameter( + "relaxedidmatch", false); + featuresFile = new FeaturesFile(file, type).parse( + viewport.getAlignment(), colours, true, relaxedIdMatching); } catch (Exception ex) { ex.printStackTrace(); @@ -383,10 +381,6 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, if (featuresFile) { - if (featureLinks.size() > 0) - { - alignPanel.seqPanel.seqCanvas.getFeatureRenderer().featureLinks = featureLinks; - } if (autoenabledisplay) { viewport.setShowSequenceFeatures(true); @@ -708,9 +702,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, // Hide everything by the current selection - this is a hack - we do the // invert and then hide // first check that there will be visible columns after the invert. - if ((viewport.getColumnSelection() != null - && viewport.getColumnSelection().getSelected() != null && viewport - .getColumnSelection().getSelected().size() > 0) + if (viewport.hasSelectedColumns() || (sg != null && sg.getSize() > 0 && sg.getStartRes() <= sg .getEndRes())) { @@ -738,8 +730,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, hide = true; viewport.hideAllSelectedSeqs(); } - else if (!(toggleCols && viewport.getColumnSelection().getSelected() - .size() > 0)) + else if (!(toggleCols && viewport.hasSelectedColumns())) { viewport.showAllHiddenSeqs(); } @@ -747,7 +738,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, if (toggleCols) { - if (viewport.getColumnSelection().getSelected().size() > 0) + if (viewport.hasSelectedColumns()) { viewport.hideSelectedColumns(); if (!toggleSeqs) @@ -934,11 +925,11 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, if (alignPanel.getAlignment().getAlignmentAnnotation() != null) { for (AlignmentAnnotation aa : alignPanel.getAlignment() - .getAlignmentAnnotation()) - { - boolean visible = (aa.sequenceRef == null ? showForAlignment - : showForSequences); - aa.visible = visible; + .getAlignmentAnnotation()) + { + boolean visible = (aa.sequenceRef == null ? showForAlignment + : showForSequences); + aa.visible = visible; } } alignPanel.validateAnnotationDimensions(true); @@ -1406,7 +1397,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, return annotation; } - private Map getDisplayedFeatureCols() + private Map getDisplayedFeatureCols() { if (alignPanel.getFeatureRenderer() != null && viewport.getFeaturesDisplayed() != null) @@ -1420,15 +1411,15 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, public String outputFeatures(boolean displayTextbox, String format) { String features; + FeaturesFile formatter = new FeaturesFile(); if (format.equalsIgnoreCase("Jalview")) { - features = new FeaturesFile().printJalviewFormat(viewport - .getAlignment().getSequencesArray(), - getDisplayedFeatureCols()); + features = formatter.printJalviewFormat(viewport.getAlignment() + .getSequencesArray(), getDisplayedFeatureCols()); } else { - features = new FeaturesFile().printGFFFormat(viewport.getAlignment() + features = formatter.printGffFormat(viewport.getAlignment() .getSequencesArray(), getDisplayedFeatureCols()); } @@ -2238,7 +2229,10 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, } sg.setEndRes(viewport.getAlignment().getWidth() - 1); viewport.setSelectionGroup(sg); - alignPanel.paintAlignment(true); + // JAL-2034 - should delegate to + // alignPanel to decide if overview needs + // updating. + alignPanel.paintAlignment(false); PaintRefresher.Refresh(alignPanel, viewport.getSequenceSetId()); viewport.sendSelection(); } @@ -2255,7 +2249,10 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, viewport.setSelectionGroup(null); alignPanel.idPanel.idCanvas.searchResults = null; alignPanel.seqPanel.seqCanvas.highlightSearchResults(null); - alignPanel.paintAlignment(true); + // JAL-2034 - should delegate to + // alignPanel to decide if overview needs + // updating. + alignPanel.paintAlignment(false); PaintRefresher.Refresh(alignPanel, viewport.getSequenceSetId()); viewport.sendSelection(); } @@ -3515,10 +3512,10 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, nucleotideColour.setLabel(MessageManager.getString("label.nucleotide")); nucleotideColour.addActionListener(this); modifyPID.setLabel(MessageManager - .getString("label.modify_identity_thereshold")); + .getString("label.modify_identity_threshold")); modifyPID.addActionListener(this); modifyConservation.setLabel(MessageManager - .getString("label.modify_conservation_thereshold")); + .getString("label.modify_conservation_threshold")); modifyConservation.addActionListener(this); annotationColour.setLabel(MessageManager .getString("action.by_annotation")); @@ -4026,12 +4023,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, } if (needtoadd) { - // make a note of the access mode and add - if (pdbentry.getProperty() == null) - { - pdbentry.setProperty(new Hashtable()); - } - pdbentry.getProperty().put("protocol", protocol); + pdbentry.setProperty("protocol", protocol); toaddpdb.addPDBId(pdbentry); alignPanel.getStructureSelectionManager() .registerPDBEntry(pdbentry); @@ -4082,7 +4074,7 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener, if (protocol == null || protocol.trim().length() == 0 || protocol.equals("null")) { - protocol = (String) pdb.getProperty().get("protocol"); + protocol = (String) pdb.getProperty("protocol"); if (protocol == null) { System.err.println("Couldn't work out protocol to open structure: "